Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions acp_adapter/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -617,6 +617,21 @@ def _make_agent(

_register_task_cwd(session_id, cwd)
agent = AIAgent(**kwargs)

# Register declarative shell hooks from cli-config.yaml. ACP adapter
# has no TTY, so consent has to come from one of the three opt-in
# channels (--accept-hooks on launch, HERMES_ACCEPT_HOOKS env var,
# or hooks_auto_accept: true in config.yaml). Pass accept_hooks=False
# and let register_from_config resolve the effective value from env +
# config itself. Failures are logged but must not block session creation.
try:
from agent.shell_hooks import register_from_config
register_from_config(config, accept_hooks=False)
except Exception:
logger.debug(
"shell-hook registration failed for ACP session %s", session_id, exc_info=True
)

# ACP stdio transport requires stdout to remain protocol-only JSON-RPC.
# Route any incidental human-readable agent output to stderr instead.
agent._print_fn = _acp_stderr_print
Expand Down
15 changes: 15 additions & 0 deletions tui_gateway/entry.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,21 @@ def _discover_mcp_background() -> None:
global _mcp_discovery_thread
_mcp_discovery_thread = _mcp_thread

# Register declarative shell hooks from cli-config.yaml. TUI gateway
# has no TTY, so consent has to come from one of the three opt-in
# channels (--accept-hooks on launch, HERMES_ACCEPT_HOOKS env var,
# or hooks_auto_accept: true in config.yaml). Pass accept_hooks=False
# and let register_from_config resolve the effective value from env +
# config itself. Failures are logged but must never block startup.
try:
from hermes_cli.config import load_config
from agent.shell_hooks import register_from_config
register_from_config(load_config(), accept_hooks=False)
except Exception:
logger.debug(
"shell-hook registration failed at TUI gateway startup", exc_info=True
)

if not write_json({
"jsonrpc": "2.0",
"method": "event",
Expand Down