Repository navigation
feat(agy): negotiate ACP slash commands and support native /swarm - #2454
Conversation
There was a problem hiding this comment.
✅ All stages passed (1 Minor)
Review mode: initial
Requirement — Pass
Exposing Antigravity’s native commands and swarm activity through HAPI addresses gaps in the existing ACP integration and fits the product’s remote-control purpose.
Evidence
- The PR describes negotiated command discovery, native swarm wakeups, and a local board snapshot.
- The base shared/src/slashCommands.ts has no agy catalog, causing getBuiltinSlashCommands('agy') to return Claude commands.
- The existing cli/src/agy/agyAcpRemoteLauncher.ts already supports transcript-based reactive wakeups.
Approach — Pass
Retaining ACP command descriptors, extending the existing wakeup classifier, and handling board inspection locally are viable extensions of the current integration.
Evidence
- cli/src/agent/backends/acp/AcpSdkBackend.ts:1800 captures command descriptors and notifies consumers.
- cli/src/agy/agyAcpRemoteLauncher.ts:780 merges negotiated commands with built-ins.
- cli/src/agy/runAgy.ts:167 isolates board commands, and agyAcpRemoteLauncher.ts:1055 handles them without an ACP prompt.
- cli/src/agy/agyReactiveWakeup.ts:432 recognizes swarm_wait as a terminal action.
Code — Reviewed
Reviewed the full fixed-head merge-base diff. Found one command-catalog invalidation defect. Runtime behavior was assessed statically.
- [Minor] Clear cached commands when ACP advertises an empty catalog —
cli/src/agy/agyAcpRemoteLauncher.ts:769
Testing
Not run (automation; PR code execution is prohibited).
- No PR code, tests, builds, or scripts were executed, as required.
- For head 3422376, drift-gate, integration, and windows-codex-mcp passed.
- The test check failed in the unchanged Shared Web/App Passkey browser regression with a 15000ms waitForFunction timeout; the inspected logs do not establish a connection to this PR.
- The added command-negotiation coverage does not test clearing a previously populated catalog.
HAPI Bot
There was a problem hiding this comment.
✅ All stages passed (1 Minor)
Review mode: follow-up after new commits
Requirement — Pass
Exposing agy's native commands and swarm activity supports HAPI's remote-control use case and addresses gaps in its ACP integration.
Evidence
- The fixed PR description specifies negotiated commands, swarm wakeups, and local board inspection.
- Base shared/src/slashCommands.ts lacks an agy catalog and falls back to Claude commands.
- docs/guide/agents.md:400 documents persistent agy ACP sessions controlled through HAPI.
Approach — Pass
Command negotiation, extending the existing transcript classifier, and handling board inspection locally are viable extensions of the current integration.
Evidence
- cli/src/agent/backends/acp/AcpSdkBackend.ts:1800 retains negotiated command descriptors.
- cli/src/agy/agyAcpRemoteLauncher.ts:781 merges negotiated commands with offline built-ins.
- cli/src/agy/agyAcpRemoteLauncher.ts:1056 renders board snapshots without sending an ACP prompt.
Code — Reviewed
Reviewed the full fixed-head merge-base diff statically. The previous empty-catalog finding is fixed. One transcript-boundary defect remains.
- [Minor] Recognize background commands when locating a swarm turn's end —
cli/src/agy/agyReactiveWakeup.ts:577
Testing
Not run (automation; PR code execution is prohibited).
- No PR code, tests, builds, or scripts were executed.
- For head 7e4c955, integration, drift-gate, and windows-codex-mcp passed.
- The test check failed in Shared Web/App Passkey browser regression with a 15000ms waitForFunction timeout; the inspected logs do not establish a connection to this PR.
- Added coverage verifies empty-catalog replacement and completed swarm-wait classification, but does not cover the mixed background-command cursor case.
HAPI Bot
There was a problem hiding this comment.
✅ All stages passed
Review mode: follow-up after new commits
Requirement — Pass
Exposing native agy commands and swarm activity addresses gaps in HAPI’s existing remote-control integration.
Evidence
- The fixed PR description specifies negotiated commands, swarm wakeups, and local board inspection.
- Base shared/src/slashCommands.ts has no agy catalog and falls back to Claude commands.
- docs/guide/agents.md:400 documents persistent agy ACP sessions controlled through HAPI.
Approach — Pass
Retaining ACP command descriptors, extending transcript classification, and rendering board snapshots locally fit the existing integration.
Evidence
- cli/src/agent/backends/acp/AcpSdkBackend.ts:1800 captures normalized command descriptors.
- cli/src/agy/agyAcpRemoteLauncher.ts:781 merges negotiated commands with built-ins.
- cli/src/agy/agyAcpRemoteLauncher.ts:1056 handles board inspection without an ACP prompt.
- cli/src/agy/agyReactiveWakeup.ts:464 shares completion handling between wakeup classification and cursor reconciliation.
Code — Reviewed
Reviewed the entire fixed-head merge-base diff statically. The previous background-command cursor finding is fixed and has regression coverage. No additional actionable defects found; live agy behavior was not exercised.
No reportable code issues found.
Testing
Not run (automation; PR code execution is prohibited).
- No PR code, tests, builds, or scripts were executed locally, as required.
- For ef3ccf2, repository typecheck, integration, drift-gate, and windows-codex-mcp passed.
- The test check failed in Shared Web/App Passkey browser regression with a 15000ms waitForFunction timeout. The inspected logs do not establish a connection to this PR; the subsequent repository test suite was skipped.
- Added tests cover command negotiation and empty-catalog replacement, board interception, tool mappings, skill discovery, completed swarm waits, and the mixed background-command cursor regression.
HAPI Bot
Summary
Adapts HAPI's Antigravity (
agy acp) integration soagy's native slash commands and/swarmmulti-agent workflows work end-to-end:Dynamic ACP Slash Command Negotiation (
available_commands_update):{ name, description }descriptors inAcpSdkBackendwhensession/update (available_commands_update)or session metadata arrives, and exposesgetAvailableCommands()+setAvailableCommandsUpdateListener().RPC_METHODS.ListSlashCommandsinAgyAcpRemoteLauncherto mergeagy's negotiated ACP command catalog (including/swarm,/run-workflow,/goal,/schedule,/browser,/plan,/grill-me,/teamwork,/learn,/boost, and discovered skills/workflows) with offline built-ins and syncsmetadata.slashCommands.agybuilt-in commands toBUILTIN_SLASH_COMMANDSin@hapi/protocol/slashCommands(preventinggetBuiltinSlashCommands('agy')from falling back to Claude's command list) and addsagyskill roots (~/.gemini/config/skills,~/.gemini/antigravity-cli/skills,.agent/skills) tolistSkills.Reactive Wakeup Support for Native Swarm (
swarm_wait& Internal Tools):AGY_INTERNAL_TOOLSwhitelist fallback inagyReactiveWakeup.tsso only tools that actually gate on ACP permission/form elicitation (run_command,edit_file,write_file,call_mcp_tool,read_file,ask_question) can transition toparked_on_tool. Internal tools (read_board,post_message,swarm,run_workflow, etc.) are never misclassified as stuck on permission prompts.swarm_waitas a turn-terminating tool ininspectAgyReactiveStepsandadvanceAgyTurnTranscriptCursor: when a reactive wakeup ends with a completedswarm_waitaction step (MODEL/GENERIC/DONE),agyparks the coordinator immediately without a trailingPLANNER_RESPONSE, soinspectAgyReactiveStepsnow settles tocompletedaftersettleMs.Local
/swarm boardSnapshot & Canonical Swarm Tool Cards:/swarm board(and/swarm board --channel <name>/#<name>, whichagy'sswarmtool output instructs users to run) as an isolated control command (pushIsolated) and renders the live roster + board messages from<brainDir>/<sessionId>/.system_generated/swarm/{members.json,board.jsonl}without consuming an LLM turn, while forwarding/swarm <task>prompts toagy acpas usual.swarm(add,title,kill,status,models,model),post_message,send_message,swarm_wait, andread_boardinmapAgyToolCallto canonical tool cards.Verification
bun run --cwd cli typecheck && bun run --cwd web typecheckbunx vitest run src/agy/agyToolCards.test.ts src/agy/agyReactiveWakeup.test.ts src/agy/agyAcpRemoteLauncher.test.ts src/agy/runAgy.test.ts src/modules/common/slashCommands.test.ts src/modules/common/skills.test.ts src/agent/backends/acp/AcpSdkBackend.test.ts(7 test files, 282 passed)