Skip to content

Antigravity backend - #648

Open
toanalien wants to merge 17 commits into
coollabsio:mainfrom
toanalien:feat/antigravity-backend
Open

Antigravity backend#648
toanalien wants to merge 17 commits into
coollabsio:mainfrom
toanalien:feat/antigravity-backend

Conversation

@toanalien

@toanalien toanalien commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds Google Antigravity CLI (agy) as a first-class Jean chat backend with streaming responses, tool-call rendering, conversation resume, model discovery, managed installation, settings, onboarding, and MCP integration.

The implementation was validated against the real agy 1.1.9 CLI. During live testing, the stream parser, model IDs, execution flags, backend routing, and response persistence were corrected to match actual runtime behavior.

What changed

Backend and execution

  • Adds Backend::Antigravity and persists antigravity_session_id across sessions and runs.
  • Executes agy in headless streaming mode with --output-format stream-json.
  • Parses real agy events (init, step_update, and result) for incremental text, tool calls, usage, and conversation IDs.
  • Resumes subsequent turns with --conversation <id>.
  • Uses native Antigravity execution modes (--mode plan / --mode accept-edits).
  • Normalizes Jean model IDs by removing the internal antigravity/ prefix before invoking agy.
  • Clamps Jean effort levels to the values supported by agy: low, medium, and high.
  • Persists completed Antigravity responses into Jean run JSONL so chat history survives navigation and restart.

CLI integration

  • Detects agy from PATH and supports Jean-managed installation/uninstallation.
  • Discovers available models from agy models with tested fallback models.
  • Detects the local Antigravity authentication state.
  • Automatically trusts the active workspace for non-interactive execution.
  • Removes inherited ANTIGRAVITY_* environment variables before spawning the CLI.
  • Synchronizes Jean's managed MCP server with ~/.gemini/config/mcp_config.json.

UI and preferences

  • Adds Antigravity to the backend and model pickers.
  • Adds an Antigravity preferences pane with installation, version, and authentication status.
  • Adds Antigravity to onboarding and the new-session flow.
  • Adds Antigravity support to Magic Prompt backend selection.
  • Uses the official Google Antigravity logo.

Runtime verification

Verified locally with agy 1.1.9:

  • Real stream-json text events are rendered incrementally.
  • Tool events and tool output are parsed.
  • gemini-3.6-flash-high and other IDs returned by agy models are accepted.
  • A second turn resumes the first conversation using the captured conversation ID.
  • --json-schema returns top-level structured_output for one-shot operations.
  • MCP configuration path and shape match Antigravity's built-in documentation.
  • The official installer URL returns HTTP 200.
  • Completed responses remain visible after session reload.

Validation

  • bun run typecheck
  • bun run lint
  • cargo check --manifest-path jean-core/Cargo.toml
  • cargo check --manifest-path src-tauri/Cargo.toml --no-default-features
  • Antigravity Rust tests, including fixtures captured from real agy output
  • Manual end-to-end test through Jean Dev using the real agy binary

How to test

terminal 1

export PATH="$HOME/.bun/bin:$HOME/.local/bin:$PATH"
bun run dev

terminal 2

pkill -9 -f 'src-tauri/target/debug/jean' 2>/dev/null || true

screen -dmS jean-dev /bin/zsh -lc '
  export PATH="$HOME/.bun/bin:$HOME/.local/bin:$PATH"
  exec ./src-tauri/target/debug/jean
'

Screenshots

jean-model-pick-antigravity jean-model-pick-antigravity jean-chat-response-antigravity-1 jean-chat-response-antigravity-2 jean-chat-response-antigravity-3

Add Antigravity CLI (`agy`) as a streaming chat backend (headless
`agy -p --output-format stream-json`), peer of Command Code/Grok.

- Backend::Antigravity enum + Deserialize + antigravity_session_id threaded
  through Session/SessionMetadata/RunEntry
- antigravity_cli module: PATH-first detect/auth(heuristic)/models
- chat/antigravity.rs: streaming stream-json parser (init/step_update/result
  -> chat:chunk/tool/done), conversation-id resume, one-shot magic-prompt exec
- wire send dispatch, model select, resume plumbing, handoff, fork-clear
- AppPreferences: selected_antigravity_model + antigravity_cli_source
- is_antigravity_model (antigravity/ prefix); 8 unit tests
Add check_antigravity_cli_installed / detect_antigravity_in_path /
check_antigravity_cli_auth / list_antigravity_models to dispatch_command().
- Backend/CliBackend unions + antigravity_session_id + backendOptions
- AppPreferences: selected_antigravity_model + antigravity_cli_source (PATH)
- AntigravityIcon + backend-label icon/label/beta cases
- antigravity-cli service (status/auth/models/path) + types
- useInstalledBackends detection; cli-auth status command; approval label

Note: frontend not typecheck-verified in this env (no bun/node_modules);
run `bun install && bun run typecheck`. Backend switches use defaults so
only backend-label needed an explicit case.
…P0/P3/P4 Rust)

P0: auto_trust_workspace (~/.gemini/antigravity-cli/settings.json trustedWorkspaces),
    env_remove(ANTIGRAVITY_*), --sandbox for plan mode (boolean flag).
P3: managed-install source (jean|path) in config.rs; install_antigravity_cli
    (official installer script) + uninstall_antigravity_cli; dispatch arms.
P4: antigravity_cli/mcp.rs syncs Jean's managed 'jean' MCP server into
    ~/.gemini/config/mcp_config.json (HOME-level, per antigravity-cli coollabsio#60);
    Antigravity added to thread_mcp_config merge + threaded into executor.

Ideas ported from PR coollabsio#469 (auto_trust, env_remove, managed install) onto our
stream-json engine. cargo check clean, 10 antigravity tests pass.
ANTIGRAVITY_MODEL_OPTIONS + full wiring in useToolbarDerivedState
(section, resolved options, filtered arm, installedBackends default,
return) so the backend/model picker shows Antigravity models.

NOTE: frontend not typecheck-verified here (no bun/node_modules).
… (P2)

Add antigravity to BACKEND_LABELS (mcp.ts), backendCommands + status map +
BACKEND_ORDER + loading (NewSessionModeModal) so the union is exhaustive.
bun run typecheck now passes (0 errors).
AntigravityPane (GeneralPane scope=antigravity): status/version, auth
indicator, install/uninstall (managed). Register in PreferencesDialog nav +
icon map + render; add 'antigravity' to PreferencePane union.
typecheck passes (0 errors).
- OnboardingDialog: add antigravity to AIBackend/AI_BACKENDS/BETA_BACKENDS/
  stepToBackend/backendLabel so it satisfies 'offers every supported backend'.
- Update useInstalledBackends.test (mock antigravity-cli),
  PreferencesDialog.test (nav order) for the new backend.

typecheck 0 errors, lint clean, 1840 tests pass (6 pre-existing
GitDiffModal/MessageDiffModal failures unchanged, unrelated).
isAntigravityModel + ANTIGRAVITY_DEFAULT_MAGIC_PROMPT_BACKENDS preset;
MagicPromptsPane recognizes antigravity models + effort fallback.
Per-dialog model pickers still fall back to defaults (documented).
typecheck 0 errors, magic/preferences tests pass.
- rustfmt applied to antigravity_cli/*, chat/antigravity.rs
- clippy: doc-link formatting + conversation_id if/else (was method chain)
Remaining clippy error in projects/checkpoints.rs:1503 is PRE-EXISTING
(zero diff vs base, unrelated to Antigravity).
Ran agy live — found the executor was broken on real output:
- stream-json discriminator is `event` (not `type`) and payload is NESTED
  under the event-named key → old parser matched nothing (zero streaming).
  Rewrote handle_line for real shape; tool input is `tool_info.parameters`,
  no tool id (correlate by step_index). Tests now use verbatim real lines.
- Model ids were wrong (`gemini-3-pro` doesn't exist). Real defaults from
  `agy models`: gemini-3.6-flash-high (default), 3.1-pro-high, 3.5-flash-medium,
  claude-sonnet-4-6. list_antigravity_models now runs `agy models` live.
- `--effort` only accepts low|medium|high → added clamp_effort.
- Use native `--mode plan|accept-edits` (verified flag) + `--new-project`
  when no resume, instead of guessed `--sandbox` for build.
- Confirmed correct: --sandbox is boolean, auth heuristic files
  (google_accounts.json), auto_trust trustedWorkspaces shape.

cargo test 991 pass, clippy/fmt clean, typecheck 0, lint clean.
… live-run findings

Verified all 4 remaining paths against real agy 1.1.9 (no code bugs found):
- --json-schema: structured_output is TOP-LEVEL of json envelope; extracted
  parse_one_shot_output helper + regression test with real envelope shape.
- resume --conversation: recall confirmed across 2 turns (PINEAPPLE test).
- MCP: ~/.gemini/config/mcp_config.json + {mcpServers} confirmed from agy's own
  builtin docs — sync writes exactly this path/format.
- install URL: HTTP 200 (valid).
12 antigravity tests pass, clippy/fmt clean.
@toanalien
toanalien force-pushed the feat/antigravity-backend branch from efa0a74 to 926603a Compare August 4, 2026 11:24
@toanalien toanalien changed the title Feat/antigravity backend Antigravity backend Aug 4, 2026
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