fix(approval): emit observer hooks for smart verdicts

This commit is contained in:
hellno 2026-07-12 18:44:00 -07:00 • committed by Teknium
parent 2bd721cebc
commit b03c94dbed
4 changed files with 274 additions and 21 deletions

View file

@ -172,17 +172,19 @@ VALID_HOOKS: Set[str] = {
# Kwargs: event: MessageEvent, gateway: GatewayRunner, session_store.
"pre_gateway_dispatch",
# Approval lifecycle hooks. Fired by tools/approval.py when a dangerous
# command needs user approval -- fires BOTH for CLI-interactive prompts
# and for gateway/ACP approvals (Telegram, Discord, Slack, TUI, etc.).
# command needs an approval decision -- fires for CLI-interactive prompts,
# gateway/ACP approvals, and smart-mode auxiliary-LLM decisions.
# Observers only: return values are ignored. Plugins cannot veto or
# pre-answer an approval from these hooks (use pre_tool_call to block
# a tool before it reaches approval).
#
# Kwargs for pre_approval_request:
# command: str, description: str, pattern_key: str, pattern_keys: list[str],
# session_key: str, surface: "cli" | "gateway"
# session_key: str, surface: "cli" | "gateway" | "smart"
# Kwargs for post_approval_response: same as above plus
# choice: "once" | "session" | "always" | "deny" | "timeout"
# | "smart_approve" | "smart_deny"
# decided_by: "aux_llm" -- only on surface="smart"
"pre_approval_request",
"post_approval_response",
# Kanban task lifecycle hooks. Fired by hermes_cli.kanban_db when a task