feat(plugins): add pre_tool_call approve action and plugin mode#11816
Open
vaddisrinivas wants to merge 3 commits into
Open
feat(plugins): add pre_tool_call approve action and plugin mode#11816vaddisrinivas wants to merge 3 commits into
vaddisrinivas wants to merge 3 commits into
Conversation
5a166e4 to
855fd12
Compare
- Add approval_callback parameter to AIAgent.__init__ for SDK usage pattern - Add _approval_callback_context context manager for lifecycle management - Wrap run_conversation execution with approval callback context - Enables gateway-style approval workflows for SDK integrations Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Add "approve" action to get_pre_tool_call_directive for plugin override - Add "plugin" approval mode to delegate approval to pre_tool_call hooks - Update terminal_tool to check for approve directive before built-in checks - Backward compatibility: get_pre_tool_call_block_message wrapper retained Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Add platform_class field to PlatformConfig for custom adapter path - Update _create_adapter to check for platform_class override - Enables plugin/third-party platform adapters without code changes - Supports dynamic class loading via importlib.import_module Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
855fd12 to
d833eb1
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Extend
pre_tool_callhooks to support{"action": "approve"}directive, allowing plugins to override built-in approval checks (e.g., dangerous command detection). Also adds"plugin"approval mode.What changed
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 documented approval modes{"approved": True, "plugin_mode": True}when in plugin modetests/: Updated for new function signature
How to test
Platforms tested
Related
{"action": "block"}mechanismpre_tool_callhook should support REJECT semantics (10-line patch) #9388 for pre_tool_call hook discussionCloses #11812