Skip to content

feat(runtime): add Antigravity local harness via agy headless stream-json - #545

Open
atou42 wants to merge 5 commits into
netaart:mainfrom
atou42:feat/local-runtime-antigravity
Open

atou42 wants to merge 5 commits into
netaart:mainfrom
atou42:feat/local-runtime-antigravity

Conversation

@atou42

@atou42 atou42 commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adds the antigravity local harness for the Antigravity CLI (agy). It drives agy's own headless interface, not ACP, the same way Claude Code / WorkBuddy / Cursor use their native protocols.

runAntigravity (one process per Turn)
  agy --input-format stream-json --output-format stream-json
      [--conversation <id>] [--model <base>] [--effort <level>]
      [--dangerously-skip-permissions | --settings <read-only deny rules>]
  wait for `init` → conversation id known before the prompt → turn.started(real transcript)
  write {"event":"user", ...}; map step_update (agent_response / tool) and result
  endInput → adopt Cohub's Turn by the step index of its `user_input`
Area Behavior
Discovery --help must list the flags a Turn uses; agy models lists the models (a signed-out CLI is skipped with its own message). Effort variants (gemini-4-neon-high) collapse into one model with thinking levels → --effort
History New chat / handoff / a conversation agy no longer has (--conversation silently starts a new one): Cohub history goes into a <cohub_session_history> block in the first prompt, which the transcript reader strips
Permissions inherit (local settings) · full access → --dangerously-skip-permissions · read-only → --settings deny rules for writes / commands / MCP / web, merged with the user's own deny rules. plan mode is not read-only: it only prepends /plan
Approvals Headless mode can't ask; whatever needs approval is soft-denied. A Turn that ends on a denial reports which tool was denied instead of an empty reply
Images Written to a temp dir and listed in the prompt; agy's read_file sends them to the model inline
Stop SIGINT, escalating to closing the process
Usage Sum of this run's step usage (result.usage covers the whole conversation)
Sync Read-only from ~/.gemini/antigravity-cli/brain/…/transcript.jsonl (and the desktop app's ~/.gemini/antigravity); project and sub-agents from conversation_summaries.db (primary workspace only)
Web LobeHub Antigravity logo

Evidence

Real agy 1.5.14 against a mock endpoint set through GOOGLE_GEMINI_BASE_URL (agy's supported custom-endpoint route), driven through NativeRuntime / executeTurn:

  • handoff → --conversation resume on the same id → tool call (run_command) with full access
  • read-only: command(...) and write_file(...) rejected with "Matches user-configured deny rule", even with a user allow rule; no file written
  • soft-denied command → stopReason: error, "Antigravity denied Bash: headless mode cannot ask…"
  • SIGINT → aborted; deleted conversation → handoff into a new conversation with history
  • image → model received inlineData through read_file; per-Turn usage 100 / 200, no longer cumulative
  • verified on real agy: init arrives before stdin is read; --settings replaces permissions.deny (so it is merged)

Tests: runtime-antigravity.test.ts 6/6; CLI suite 282/282; @cohub/protocol 202/202; runtime-status-view 6/6; svelte-check 0/0. Mutation checks: reverting the own-Turn match, the deny merge, the missing-conversation handoff, the usage sum or --dangerously-skip-permissions in read-only each fails the suite.

Not verified: a signed-in account (models/quota come from Google, not the mock), the desktop app's ~/.gemini/antigravity layout, and Windows.

Merge Danger

Door: two-way. Only an additive registry entry; existing harnesses and shared ingest are unchanged relative to main.

Blast Radius: Antigravity users. Deploy API / Gateway / Agent / Web with the updated LOCAL_HARNESSES before publishing the CLI. Known gap: a terminal Turn that ends on an error or interrupt leaves only its USER_INPUT in agy's transcript, so it stays open until the next prompt.

atou42 and others added 5 commits November 21, 2026 23:52
Register `antigravity` in LOCAL_HARNESSES/LOCAL_HARNESS_SPECS and add a
LocalHarnessAdapter that runs `agy acp --stdio` over JSON-RPC 2.0:
- Discover models, per-model thinking levels, and approval modes via ACP
- Hand over Cohub history via `_meta.antigravity.systemPrompt.append` and
  resume natively with `session/resume`
- Map approval modes (inherit/auto/full_access/read_only) and translate ACP
  `session/request_permission` into Cohub approval cards (denying all in read_only)
- Stream thinking, text, tool calls/results, usage, and `session/cancel` aborts
- Sync native terminal/IDE transcripts read-only via `conversation_summaries.db`
  (node:sqlite) and `transcript.jsonl` (with `transcript_full.jsonl` fallback)
- Add web harness icon, tests with ACP fixture, and bilingual runtime docs
Replace the ACP adapter with agy's own headless interface, as every other
local harness uses its native protocol.

- One `agy --input-format stream-json` process per Turn; the conversation id
  arrives before the prompt, later Turns continue with --conversation, and a
  missing conversation gets Cohub history in the first prompt.
- Models come from `agy models`; effort variants become thinking levels.
- Read-only adds deny rules through --settings and keeps the user's own,
  since plan mode is not read-only and --settings replaces the deny list.
- Cohub's Turn is identified by the step index the run reports.
- Per-Turn usage sums step usage; result usage covers the whole conversation.
- Drop invented env vars, multi-root ownership and the shared ingest change.
- Use the LobeHub Antigravity logo.

Cohub Session: https://cohub.live/spaces/5089f055-9dbb-4fcd-b98c-fb232353281a/sessions/21ef84da-5192-4188-8aaf-067c085d07a2
@markbang markbang changed the title feat(runtime): add Antigravity local harness adapter via agy ACP feat(runtime): add Antigravity local harness via agy headless stream-json Nov 23, 2026

This branch has not been deployed

No deployments
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.

2 participants