feat(capabilities): CommandBridge for capability-registered slash commands - #272
Open
Leoyzen wants to merge 1 commit into
Open
feat(capabilities): CommandBridge for capability-registered slash commands#272Leoyzen wants to merge 1 commit into
Leoyzen wants to merge 1 commit into
Conversation
…mands Add CommandBridge connecting ExtensionRegistry to protocol servers (ACP, OpenCode) so capabilities implementing CommandResource can register slash commands visible to clients. Core changes: - CommandEntry.handler: Callable[[str, AgentContext], Awaitable[str]] | None Added to resource_protocols.py with compare=False - 'commands_changed' added to ChangeKind Literal - CommandBridge class (command_bridge.py): discover_commands(), execute(), watch_changes(), entry_to_slashed_command() — per-session lifecycle - ExtensionRegistry.get_command_resources() reordered TURN->AGENT->SESSION->POOL - SkillManagerCap.list_commands() populates handler for local skills, passes through McpServerCap entries unchanged - McpServerCap.list_commands() populates handler wrapping get_prompt() - ACP server: per-session CommandBridge, discovery, execution routing, change watching for commands_changed/skills_changed/prompts_changed - OpenCode server: OpenCodeCommandBridge class, GET /command updated, execution routing with fallback, change watcher updated Tests: 26 unit tests (test_command_bridge.py) — all passing Full suite: 4939 passed, 1 pre-existing failure, no regressions OpenSpec change: openspec/changes/capability-command-bridge/ RFC: docs/rfcs/draft/RFC-0058-capability-command-bridge.md Example: examples/custom_command_capability.py
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
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
Connects
ExtensionRegistryto protocol servers (ACP, OpenCode) so capabilities implementingCommandResourcecan register slash commands visible to clients.The Problem
The architecture had all the right building blocks but they weren't connected:
CommandResourceprotocol existed — capabilities could implementlist_commands()/get_command()ExtensionRegistry.get_command_resources(scope)existed — could query for command-producing capabilitiesSkillManagerCapandMcpServerCapimplementedCommandResourceget_command_resources()— they read fromSkillsRegistryonlyCommandResourcewas discovery-only — no execution path back to the capabilityExtensionRegistry→ protocolCommandStoreA custom capability implementing
CommandResourcewould have its commands invisible to all protocol servers.The Solution
CommandBridge — a per-session class that:
CommandResourcecapabilities viaExtensionRegistryCommandEntry.handler— a callable that routes back to the producing capabilitycommands_changed,skills_changed,prompts_changedevents)CommandEntryto protocol-specific formats (SlashedCommand,AvailableCommand)Changes
Core:
CommandEntry.handlerfield added toresource_protocols.py—Callable[[str, AgentContext], Awaitable[str]] | None = field(default=None, compare=False)"commands_changed"added toChangeKindLiteralCommandBridgeclass (src/agentpool/capabilities/command_bridge.py, ~265 LOC)ExtensionRegistry.get_command_resources()reordered to TURN→AGENT→SESSION→POOLCapability updates:
SkillManagerCap.list_commands()— populates handler for local skills, passes through McpServerCap entries unchangedMcpServerCap.list_commands()— populates handler wrappingget_prompt()Protocol server integration:
CommandBridge, discovery, execution routing with fallback, change watchingOpenCodeCommandBridgeclass,GET /commandendpoint updated, execution routing, change watcherDocumentation:
examples/custom_command_capability.py— end-to-end exampleAGENTS.mdupdated withCommandResource,CommandBridgedocumentationTest Results
tests/capabilities/test_command_bridge.py) — all passingtest_vision), no regressionsruff check: cleanmypy: cleanOpenSpec
openspec/changes/capability-command-bridge/(proposal, design, 7 spec files, 46 tasks)Files Changed
command_bridge.pycore,command_bridge.pyopencode, test, example, RFC)