feat: let plugin slash commands opt into gateway context - #56782
DoctaWasabi wants to merge 1 commit into
Conversation
teknium1
left a comment
There was a problem hiding this comment.
Thanks for extending the plugin slash-command surface. The gateway-context premise is valid: current hermes_cli/plugins.py:529-580 only exposes handler(raw_args).
Problems
- The busy-session behavior is unreachable. The new
gateway/run.py:8783dispatcher is never reached for a normal active-session plugin command becausegateway/platforms/base.py:4675-4731queues it unlessshould_bypass_active_session()succeeds;hermes_cli/commands.py:389-409only resolves built-in commands. The added tests call the private dispatcher directly rather than exercising adapter delivery. - The new busy-path dispatch is before the access gate. Current cold-path plugin dispatch gates recognized plugin commands at
gateway/run.py:9770-9773; the running-agent gate atgateway/run.py:9353-9362only recognizes built-inCommandDefs. A metadata-aware bypass must preserve the same authorization policy. plugins/context_engine/__init__.py:216-262has a parallelregister_command()implementation that cannot accept or retain the new flags.
Suggested changes
- Use one shared metadata-aware bypass predicate from the adapter through runner dispatch, gate it before invocation, and cover active delivery plus denied-user cases end to end.
- Propagate the options through
_EngineCollectorand document the expanded public registration contract.
Automated hermes-sweeper review.
| @@ -8740,6 +8783,15 @@ async def _handle_message(self, event: MessageEvent) -> Optional[str]: | |||
| _evt_cmd = event.get_command() | |||
There was a problem hiding this comment.
This dispatcher is not reached for normal busy-session plugin commands: BasePlatformAdapter.handle_message() queues an active-session event unless should_bypass_active_session(cmd) succeeds (gateway/platforms/base.py:4675-4731), and that predicate only uses built-in resolve_command() (hermes_cli/commands.py:389-409). Please wire a shared metadata-aware predicate into the adapter guard and add an adapter-level integration test.
| active_session_bypass: bool = False, | ||
| wants_context: bool = False, | ||
| ) -> None: | ||
| """Register a slash command (e.g. ``/lcm``) available in CLI and gateway sessions. |
There was a problem hiding this comment.
This public registration option also needs to be accepted and stored by the context-engine collector (plugins/context_engine/__init__.py:216-262), which independently implements register_command() and directly constructs plugin-command metadata.
What does this PR do?
Related Issue
Fixes #
Type of Change
Changes Made
How to Test
Checklist
Code
fix(scope):,feat(scope):, etc.)pytest tests/ -qand all tests passDocumentation & Housekeeping
docs/, docstrings) — or N/Acli-config.yaml.exampleif I added/changed config keys — or N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows — or N/AFor New Skills
hermes --toolsets skills -q "Use the X skill to do Y"Screenshots / Logs