Summary
Extend the pre_tool_call hook system to support an {"action": "approve"} directive, allowing plugins to override built-in approval checks (e.g., dangerous command detection).
Changes
-
hermes_cli/plugins.py:
- Rename
get_pre_tool_call_block_message() → get_pre_tool_call_directive()
- Return tuple
(directive, message) where directive is "block", "approve", or None
-
tools/terminal_tool.py:
- Check for
"approve" directive before security checks
- Skip dangerous-command guard when plugin approves
-
tools/approval.py:
- Add
"plugin" to approval modes
- Return early with
{"approved": True, "plugin_mode": True} when in plugin mode
Related
Summary
Extend the
pre_tool_callhook system to support an{"action": "approve"}directive, allowing plugins to override built-in approval checks (e.g., dangerous command detection).Changes
hermes_cli/plugins.py:
get_pre_tool_call_block_message()→get_pre_tool_call_directive()(directive, message)where directive is"block","approve", orNonetools/terminal_tool.py:
"approve"directive before security checkstools/approval.py:
"plugin"to approval modes{"approved": True, "plugin_mode": True}when in plugin modeRelated
{"action": "block"}mechanismpre_tool_callhook should support REJECT semantics (10-line patch) #9388 for discussion on pre_tool_call hook semantics