Skip to content

feat(antigravity): add Antigravity CLI over native ACP - #12

Merged
eshatalov merged 1 commit into
mainfrom
t3/add-antigravity-cli-acp
Nov 22, 2026
Merged

eshatalov merged 1 commit into
mainfrom
t3/add-antigravity-cli-acp

Conversation

@eshatalov

Copy link
Copy Markdown
Owner

Subturn had no plugin for the Antigravity CLI (agy), so orchestrators couldn't spawn or resume Antigravity models through the same five-tool surface without dealing with its ACP flags, auth layouts, and config options directly.

What changed

  • src/plugins/antigravity.ts & src/plugins/index.ts: adds the antigravity plugin over native ACP (agy acp), discovering only agy (never the IDE's antigravity binary).
    • Applies model then thought_level via session/set_config_option on both fresh and resumed (session/load) turns, emitting per-config evidence (set_config_result / set_config_error) and writing ack.json. Models without a thought_level option fail loudly with -32602 rather than silently skipping effort.
    • Isolates per-session state under --gemini-dir + --app-data-dir antigravity-cli + GEMINI_HOME, with --dangerously-skip-permissions, --disable-telemetry, --include-default-customizations=false, and AGY_CLI_DISABLE_AUTO_UPDATE=1.
    • Resolves credentials in one place: GEMINI_API_KEY (via ACP authenticate), file-based OAuth tokens (antigravity-oauth-token / legacy acp_token.json) copied privately at 0600 (not symlinked, so agy's in-place token refreshes never mutate the user's profile) and reconciled on resume so refreshed shadow tokens are preserved while profile/method switches clear stale files and cache/acp-auth-state.json, or desktop OS keyring.
  • src/core/acp-turn.ts: optional authMethodId for ACP authenticate, fail turns on stopReason === "refusal" alongside cancelled, and emit an exit event on clean child shutdown.
  • src/plugins/acp-models-probe.ts: prefer deduplicated configOptions[id="model"] values (including grouped select options) over legacy suffixed models.availableModels, check protocolVersion === 1, and support optional authMethodId.
  • src/faces/cli.ts: compute the status name-column width from registered plugin names so antigravity stays aligned.
  • test/antigravity.test.ts, test/live.test.ts, README.md, package.json: offline test suite against a stateful fake agy, cheap live bundle (gemini-3.8-flash/low), and docs.

Verification

  • npm run typecheck, npm test (40 pass, 3 live skipped), npm run build.
  • Built CLI dist/faces/cli.js status (against a scratch SUBTURN_STATE_DIR) in both file-token and desktop-keyring environments, plus built MCP dist/faces/mcp.js stdio handshake.
  • Live validation against agy 1.5.14 (7 tiny turns on gemini-3.8-flash, scratch SUBTURN_STATE_DIR): verified low + resume (modelId=1320, Gemini 3.8 Flash (Low) in gen_metadata on both turns, zero trace in ~/.gemini/antigravity-cli), high (modelId=1318, Gemini 3.8 Flash (High)), legacy suffixed ID override, and pre-prompt -32602 rejections for unsupported thought_level.

Model and harness: Gemini 4 Neon (High) in Antigravity.

Add Antigravity CLI (`agy acp`) as a built-in Subturn harness so callers can spawn and resume Antigravity models through the same five-tool surface without learning its flags, auth layout, or config options.

- `src/plugins/antigravity.ts`: `antigravity` plugin discovering `agy`, applying `model` then `thought_level` via `session/set_config_option` on every turn, isolating session state under `--gemini-dir` / `GEMINI_HOME`, copying file-based OAuth tokens privately (0600, reconciled on resume so refreshes stay in the shadow and account/method switches clear stale state), and falling back to ACP `authenticate` (`gemini-api-key`) when `GEMINI_API_KEY` is set.
- `src/core/acp-turn.ts`: optional `authMethodId` for ACP `authenticate`, treat `stopReason=refusal` as a failed turn, and emit an `exit` event on clean child shutdown.
- `src/plugins/acp-models-probe.ts`: prefer deduplicated `configOptions[id="model"]` values (including grouped select options) over legacy `models.availableModels`, check `protocolVersion === 1`, and support optional `authMethodId`.
- `src/faces/cli.ts`: size the `status` name column dynamically so longer harness names stay aligned.
- `test/antigravity.test.ts`, `test/live.test.ts`, `README.md`, `package.json`: offline tests against a stateful fake `agy`, cheap live bundle entry, and docs.

Model and harness: Gemini 4 Neon (High) in Antigravity.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-22T14:33:17.157871Z e7b4f29 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@eshatalov
eshatalov merged commit c059d09 into main Nov 22, 2026
1 check passed
@eshatalov
eshatalov deleted the t3/add-antigravity-cli-acp branch November 22, 2026 14:35
@eshatalov eshatalov mentioned this pull request Nov 22, 2026
eshatalov added a commit that referenced this pull request Nov 22, 2026
Version bump for 0.3.0. Minor rather than patch because this adds the
Antigravity CLI plugin over native ACP (#12).

Ships since 0.2.0:
- #11 every Codex turn runs on the standard service tier
- #12 add Antigravity CLI over native ACP

Done by Gemini 4 Neon in Antigravity.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant