Skip to content

feat(agy): negotiate ACP slash commands and support native /swarm - #2454

Merged
tiann merged 3 commits into
tiann:mainfrom
Kiyo5hi:feat/agy-slash-swarm
Nov 17, 2026
Merged

tiann merged 3 commits into
tiann:mainfrom
Kiyo5hi:feat/agy-slash-swarm

Conversation

@Kiyo5hi

@Kiyo5hi Kiyo5hi commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

Summary

Adapts HAPI's Antigravity (agy acp) integration so agy's native slash commands and /swarm multi-agent workflows work end-to-end:

  1. Dynamic ACP Slash Command Negotiation (available_commands_update):

    • Retains full { name, description } descriptors in AcpSdkBackend when session/update (available_commands_update) or session metadata arrives, and exposes getAvailableCommands() + setAvailableCommandsUpdateListener().
    • Registers RPC_METHODS.ListSlashCommands in AgyAcpRemoteLauncher to merge agy'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 syncs metadata.slashCommands.
    • Adds agy built-in commands to BUILTIN_SLASH_COMMANDS in @hapi/protocol/slashCommands (preventing getBuiltinSlashCommands('agy') from falling back to Claude's command list) and adds agy skill roots (~/.gemini/config/skills, ~/.gemini/antigravity-cli/skills, .agent/skills) to listSkills.
  2. Reactive Wakeup Support for Native Swarm (swarm_wait & Internal Tools):

    • Removes the hardcoded AGY_INTERNAL_TOOLS whitelist fallback in agyReactiveWakeup.ts so 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 to parked_on_tool. Internal tools (read_board, post_message, swarm, run_workflow, etc.) are never misclassified as stuck on permission prompts.
    • Recognizes swarm_wait as a turn-terminating tool in inspectAgyReactiveSteps and advanceAgyTurnTranscriptCursor: when a reactive wakeup ends with a completed swarm_wait action step (MODEL/GENERIC/DONE), agy parks the coordinator immediately without a trailing PLANNER_RESPONSE, so inspectAgyReactiveSteps now settles to completed after settleMs.
  3. Local /swarm board Snapshot & Canonical Swarm Tool Cards:

    • Intercepts /swarm board (and /swarm board --channel <name> / #<name>, which agy's swarm tool 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 to agy acp as usual.
    • Maps swarm (add, title, kill, status, models, model), post_message, send_message, swarm_wait, and read_board in mapAgyToolCall to canonical tool cards.

Verification

  • bun run --cwd cli typecheck && bun run --cwd web typecheck
  • bunx 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)

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ 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

Comment thread cli/src/agy/agyAcpRemoteLauncher.ts Resolved
@github-actions github-actions Bot added the codex-review:pass HAPI Bot: all review stages passed, no Blocker/Major findings label Nov 17, 2026
@github-actions github-actions Bot removed the codex-review:pass HAPI Bot: all review stages passed, no Blocker/Major findings label Nov 17, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ 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

Comment thread cli/src/agy/agyReactiveWakeup.ts Resolved
@github-actions github-actions Bot added the codex-review:pass HAPI Bot: all review stages passed, no Blocker/Major findings label Nov 17, 2026
@github-actions github-actions Bot removed the codex-review:pass HAPI Bot: all review stages passed, no Blocker/Major findings label Nov 17, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ 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

@github-actions github-actions Bot added the codex-review:pass HAPI Bot: all review stages passed, no Blocker/Major findings label Nov 17, 2026
@tiann
tiann merged commit 37446bc into tiann:main Nov 17, 2026
6 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

codex-review:pass HAPI Bot: all review stages passed, no Blocker/Major findings

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants