t3code icon indicating copy to clipboard operation
t3code copied to clipboard

feat(provider): add Antigravity (Google AGY) provider integration & ACP bridge

Open umarfaruq0z opened this issue 4 months ago • 3 comments

Summary

Adds full support for the Google Antigravity (agy) provider into T3 Code.

Antigravity has no native agent protocol, so this integration introduces an ACP compatibility bridge process (t3 agy-acp) that wraps agy --print mode while reconstructing live event streams from PreToolUse/PostToolUse/Stop hooks and trajectory transcripts (transcript.jsonl).

[!NOTE] Credit & Reference: This PR incorporates and builds upon the foundational ACP bridge architecture originally submitted by @agentool in #4497. It extends that work with dynamic UI model grouping, log-based account/subscription discovery, official vector SVG branding, non-interactive text-generation shortcuts, and full unit test coverage across all provider layers.


📸 Screenshots & UI Showcase

1. Model Discovery & Reasoning Effort Selector

Groups raw CLI slugs (gemini-3.6-flash-high, gemini-3.6-flash-medium, etc.) into clean base models with dynamic Reasoning Effort (Low / Medium / High) selectors.

image image

2. Provider Settings & Account Authentication

Automatically parses CLI logs to display the authenticated user's email address and subscription tier badge (Google AI Pro Subscription / Enterprise).

image

3. Agent Conversation & Clean UI Footer

Renders structured response streaming, markdown formatting, and clean provider footer (with mode selector dropdown hidden via showInteractionModeToggle: false).

image ---

🛠️ What Changed & Why

1. UI Model Grouping (AntigravityProvider.ts)

  • Problem: agy models returns 11 raw, un-grouped slugs (e.g. gemini-3.6-flash-high, gemini-3.6-flash-medium, gemini-3.6-flash-low), cluttering the model picker dropdown.
  • Solution: Implemented groupAntigravityModels() to consolidate slugs under clean base models (Gemini 3.6 Flash) with a dynamic Reasoning Effort Selector (Low, Medium, High).

2. Account & Subscription Discovery (AntigravityProvider.ts)

  • Implemented checkAntigravityAccountAuth() to inspect .gemini/antigravity-cli/cli.log and onboarding.json, displaying the logged-in email and subscription badge (Google AI Pro Subscription, Enterprise, etc.).

3. Tool Execution & Live Event Stream (agyBridge.ts & AntigravityAdapter.ts)

  • Executes turns via agy --print mode using --dangerously-skip-permissions.
  • Reconstructs a real-time event stream by correlating PreToolUse/PostToolUse/Stop hooks with transcript JSONL records on stepIdx/step_index.
  • Sets showInteractionModeToggle: false so that unnecessary permission mode selectors (Full access / Supervised) are automatically hidden from the UI for Antigravity sessions.

4. Official Vector SVG Branding & Preview Badge (Icons.tsx & providerDriverMeta.ts)

  • Replaced fuzzy PNG icon with high-resolution vector SVG paths and gradient masks.
  • Updated provider badge label to "Preview".

5. File Attachments (attachmentStore.ts & AntigravityAdapter.ts)

  • Added attachmentFileUrl() using NodeURL.pathToFileURL() to safely URI-encode file paths across operating systems.
  • Attached files are converted to resource_link URIs, appended to the prompt, and granted directory access via agy --add-dir.

6. In-Session Model Switching (sessionModelSwitch: "in-session")

  • Because --model is a per-turn flag on agy --print --conversation <id>, model changes take effect on subsequent turns while preserving the conversation trajectory.

7. Process Concurrency & Error Resiliency

  • Uses isolated per-session state files (t3code-acp-sessions/<sessionId>.json) to avoid race conditions when running multiple subagents/threads concurrently.
  • Queue error catching returns explicit JSON-RPC error responses (-32603), preventing UI client hangups if an internal bridge error occurs.

✅ Checklist

  • [x] Code follows repository standards and TypeScript Effect conventions.
  • [x] Formatting ran cleanly via vp fmt.
  • [x] All 61 unit tests pass locally.
  • [x] Credited prior work in #4497 by @agentool.
  • [x] Includes documentation in AGENTS.md.

[!NOTE]

Add Antigravity (Google AGY) provider integration with ACP bridge

  • Introduces a full Antigravity provider driver (ProviderDriverKind: 'antigravity') that spawns the agy CLI as a subprocess, discovers models via agy models, and checks authentication from local CLI artifacts.
  • Adds an ACP stdio bridge (agyBridge.ts) that translates Antigravity hook events (pre-tool-use, post-tool-use, stop) and live transcript JSONL into ACP session updates including tool call lifecycle, diffs, and streamed assistant text.
  • Registers agy-acp and agy-hook as hidden CLI subcommands in the server binary, enabling the bridge and hook handler to be invoked as child processes.
  • Adds an Antigravity-backed TextGeneration service covering commit messages, PR content, branch names, and thread titles, with a 180s timeout and schema-validated JSON extraction from streamed output.
  • Extends contracts, settings schemas, and the web provider picker to include Antigravity with an inline SVG icon and an 'Experimental' badge.
  • Risk: Antigravity sessions do not support images, session modes, or per-turn stdin; tool approval defaults to required and model changes only apply on the next turn.

Macroscope summarized 76f12ef.


[!NOTE] High Risk Large new subprocess and JSON-RPC bridge surface runs agy with skipped CLI permissions and optional hook-based tool gating; mistakes in approval, attachment staging, or transcript parsing can affect repo access and session correctness.

Overview Adds Antigravity as a first-class built-in provider for the Google agy CLI, which has no native agent protocol. Sessions talk to a bundled ACP stdio bridge (t3 agy-acp) that runs each turn via agy --print and rebuilds live updates by correlating PreToolUse / PostToolUse / Stop hooks with transcript.jsonl records on stepIdx / step_index.

The server registers AntigravityDriver in builtInDrivers, wires AntigravityAdapter (sessions, steers, cancel epochs, optional PreToolUse approval when requireToolApproval is on), AntigravityProvider (agy --version / agy models with stdin: "ignore", grouped reasoning tiers, auth hints from local CLI logs), and AntigravityTextGeneration for commit/PR/branch/title helpers. Hidden CLI subcommands agy-acp and agy-hook ship in the server binary; attachmentFileUrl turns stored attachments into safe file: URIs for resource_link prompts and per-turn staging in the bridge.

AGENTS.md documents bridge behavior and print-mode limits (no images/session modes; model binding per spawn). Provider rollback is explicitly unsupported; in-session model switches apply on the next turn via --model + --conversation.

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

umarfaruq0z avatar Jul 26 '26 15:07 umarfaruq0z

[!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: ece840ca-0d5e-4ac5-83ce-92771fcb6894

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 26 '26 15: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 26 '26 16:07 macroscopeapp[bot]

I have been using this for an hour with no issues so far.

MicahWade avatar Jul 29 '26 06:07 MicahWade

@umarfaruq0z why did you close it?

Malix-Labs avatar Jul 30 '26 01:07 Malix-Labs