t3code icon indicating copy to clipboard operation
t3code copied to clipboard

Add Antigravity (agy) provider via an ACP compatibility bridge

Open agentool opened this issue 4 months ago • 3 comments

Adds antigravity as a provider driver alongside Codex, Claude, Cursor, Grok and OpenCode.

Up front, re: CONTRIBUTING: this is large (+3442) and unsolicited, and I did not open an issue first. Opening it anyway as a working reference rather than a request for your time — if the answer is no, close it and it costs you nothing. Notes on scope and on splitting it are at the bottom.

Why this needs a bridge rather than another ACP driver

Antigravity ships no native agent protocol. Verified against agy 1.1.7:

  • agy agent stdio → unexpected arguments: [stdio] (Grok's entrypoint is grok agent stdio)
  • no --acp flag; the binary carries jsonrpc2 and MCP, but no ACP methods
  • Antigravity.app/Contents/Resources/bin/language_server speaks Codeium gRPC (exa.language_server_pb), not ACP

So provider/acp/antigravity/agyBridge.ts presents the ACP surface AcpSessionRuntime already expects, and runs each turn through the documented non-interactive agy --print. It ships as hidden subcommands of the server binary (t3 agy-acp, t3 agy-hook) so it versions with the server and adds no build artifact.

How the event stream is reconstructed

Two documented Antigravity sources correlate on step index — a hook's stepIdx is the transcript record's step_index:

Signal Source
Tool start, name, args, human title (toolSummary) PreToolUse hook
Tool output (real stdout / file contents) transcript record with matching step_index
Tool completed/failed PostToolUse hook
Assistant text, streamed during the turn PLANNER_RESPONSE records as they land
conversationId for resume present on every hook

Neither source alone is sufficient: hooks never carry tool output, the transcript never carries tool arguments.

Three things that cost real debugging time

--add-dir replaces the workspace, it does not extend cwd. Hooks are registered via a throwaway --add-dir workspace so nothing is written into the user's repo — but passing only that dir makes the project invisible to the agent. Both the session cwd and the hook workspace are passed.

Edit diffs must be captured inside the hook process. Both hooks for a fast edit land within one 50ms poll, so reading the file while draining hook output makes "before" read back as "after". The hook brackets the tool call and is the only place that sees true pre-edit state.

Probes must set stdin: "ignore". agy starts a language server and emits nothing while stdin stays open; ChildProcess defaults stdin to "pipe", which hangs it. Presented as installed: true, models: 0 while agy models worked by hand.

Known constraints

All inherent to print mode, documented in AGENTS.md:

  • tools auto-approve (--dangerously-skip-permissions); no approval flow is possible
  • no image attachments, no session modes
  • model binds at spawn, so sessionModelSwitch is "unsupported"
  • assistant text streams per planner step, not per token

The trajectory JSONL format is undocumented. Every parse path degrades to emitting nothing rather than failing a turn, so an agy release that changes it costs observability, not correctness.

UI surface

No new components. The provider renders through the existing rows: PROVIDER_OPTIONS, PROVIDER_ICON_BY_PROVIDER, and PROVIDER_CLIENT_DEFINITIONS, reusing the AntigravityIcon already in Icons.tsx for the editor integration, with an Experimental badge in the same slot Cursor and Grok use for Early Access. CONTRIBUTING asks for before/after images on UI changes — I don't have a clean way to attach them here; the visible delta is one additional provider row.

Verification

  • 1076 tests pass (6 skipped), including 39 new across agyEvents, agyTranscript, AntigravityAcpSupport
  • 0 type errors, 0 lint errors, format clean
  • pnpm build clean; bridge bundles into dist/bin.mjs and all three entrypoints work off the built binary
  • live probe: status: ready | version: 1.1.7 | models: 11
  • a full turn driven through the built binary against real agy: tool calls, real tool output, a file edit with diff, stopReason: end_turn, file on disk actually changed

Three ProviderRegistry fixtures assert an exact provider list or that only the subject provider probes, so they gain the new driver.

On size

Most of the diff is AntigravityAdapter.ts (~690 lines), which follows the existing convention of one standalone adapter per provider (Cursor 1.2k, Grok 1.5k, Claude 3.9k) over the shared ACP helpers. I deliberately did not refactor a shared adapter core out of GrokAdapter, since that would mean touching a working provider to land a new one.

Happy to split this into (1) contracts + bridge + tests and (2) driver + UI wiring, or to drop the text-generation backend, if either would make it reviewable. Equally happy for you to take the bridge approach and reimplement it your way — the --add-dir, hook-timing and stdin findings above are the parts that were expensive to discover.


[!NOTE] High Risk Large new provider surface spanning process spawning, HMAC-gated tool approvals, and workspace-affecting CLI behavior; mis-handling cancel or approvals could leave tools running or auto-approve unexpectedly.

Overview Adds Antigravity as a built-in provider that talks to the agy CLI through a bundled ACP compatibility bridge (t3 agy-acp / t3 agy-hook), since Antigravity has no native agent protocol.

Each turn runs agy --print while the bridge rebuilds a live stream from PreToolUse/PostToolUse/Stop hooks (tool metadata, approvals) and the trajectory transcript (assistant text and tool output), correlated by step index. The server-side adapter wires this into the existing ACP session runtime: tool approval via hooks when requireToolApproval is on, attachments as resource_link + attachmentFileUrl, in-session model switches, explicit rollback failure, and careful cancel/teardown (epoch fences, process-group kills).

Provider plumbing includes AntigravityDriver, health/model discovery (agy --version, agy models with stdin: "ignore"), contracts/settings for antigravity, and registry test updates. AGENTS.md documents print-mode constraints (permissions, attachments, resume, cancellation).

Reviewed by Cursor Bugbot for commit 158dfe15b3eb8508e68e2d7a4a59f90af948738c. Bugbot is set up for automated code reviews on this repo. Configure here.

[!NOTE]

Add Antigravity (agy) provider via an ACP compatibility bridge

  • Adds a new antigravity provider driver that integrates the Antigravity CLI (agy) through a stdio ACP compatibility bridge, exposing it as a selectable provider in the UI with an "Experimental" badge.
  • The bridge (agyBridge.ts) communicates with the agy CLI via hook callbacks and live transcript tailing; agyEvents.ts and agyTranscript.ts translate Antigravity-specific hook payloads and JSONL transcripts into ACP updates.
  • Two hidden CLI subcommands are registered on the t3 binary: agy-acp (starts the bridge over stdio) and agy-hook (handles per-tool lifecycle hook callbacks).
  • Provider status probing runs agy --version (4s timeout) and agy models (15s timeout) to populate the provider snapshot with installation state, version, and discovered model slugs.
  • Antigravity-backed text generation (commit messages, PR content, branch names, thread titles) streams output via ACP, validates structured JSON against schemas, and enforces a 180s timeout.
  • Risk: the provider is marked Experimental; model switching takes effect only on subsequent turns, and tool approval gating depends on hook callbacks which have documented limitations in AGENTS.md.

Macroscope summarized 158dfe1.

agentool avatar Jul 25 '26 01:07 agentool

[!IMPORTANT]

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 810156ec-965c-45a6-adec-efe614966a73

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • [ ] 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • [ ] Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

coderabbitai[bot] avatar Jul 25 '26 01:07 coderabbitai[bot]

Approvability

Verdict: Needs human review

2 blocking correctness issues found. Diff is too large for automated approval analysis. A human reviewer should evaluate this PR.

You can customize Macroscope's approvability policy. Learn more.

macroscopeapp[bot] avatar Jul 25 '26 17:07 macroscopeapp[bot]

Bro ... Read contributors md :/

kridaydave avatar Jul 25 '26 18:07 kridaydave

might revisit after #2829

juliusmarminge avatar Jul 27 '26 21:07 juliusmarminge