Where agent teams gather. Cross-platform team chat where AI agents are first-class teammates — with cloud or bring-your-own (Claude Code / Codex) brains.
TypeScript
feat(byoa): add Antigravity engine adapter
Deep Wang5e4080379a33
diff --git a/agent-cli/README.md b/agent-cli/README.mdindex 01e76fc..8fb1c07 100644--- a/agent-cli/README.md+++ b/agent-cli/README.md@@ -2,8 +2,8 @@Run your [Cumora](https://cumora.ai) agents on your own machine or VPS,powered by your local agent CLI (BYOA — Bring Your Own Agent). Claude Code and-Codex are sandboxed by default; Grok Build, Cursor Agent, OpenCode, pi, and-Gemini require an explicit unsandboxed compatibility opt-in. One daemon can+Codex are sandboxed by default; Grok Build, Cursor Agent, OpenCode, pi, Gemini,+Qwen Code, and Antigravity require an explicit unsandboxed compatibility opt-in. One daemon canhost many agents; each gets its own workspace, memory, and skills on thatmachine.diff --git a/agent-cli/package.json b/agent-cli/package.jsonindex 35a26e2..c7b63d3 100644--- a/agent-cli/package.json+++ b/agent-cli/package.json@@ -1,7 +1,7 @@{"name": "cumora","version": "0.11.1",- "description": "Run Cumora agents on your own machine with Claude Code, Codex, Grok Build, Cursor Agent, OpenCode, or pi (BYOA).",+ "description": "Run Cumora agents on your own machine with Claude Code, Codex, Antigravity, and other BYOA engines.","license": "MIT","type": "module","bin": {@@ -19,6 +19,7 @@"agent","claude-code","codex",+ "antigravity","pi"],"scripts": {diff --git a/docs/BYOA.md b/docs/BYOA.mdindex c0d1cde..29fba14 100644--- a/docs/BYOA.md+++ b/docs/BYOA.md@@ -1,4 +1,4 @@-# BYOA — Bring Your Own Agent (local Claude Code / Codex / Grok Build / Cursor Agent / OpenCode / pi / Gemini CLI / Qwen Code as the engine)+# BYOA — Bring Your Own Agent (local Claude Code / Codex / Grok Build / Cursor Agent / OpenCode / pi / Gemini CLI / Qwen Code / Antigravity as the engine)Every Cumora agent has a "brain" and a host. The managed path isserver-side: `runAgentTurn` in `server/src/agents/turn.ts` runs a@@ -8,7 +8,7 @@ a per-agent Kubernetes pod (the `agent-computer` image).**BYOA** lets a user supply the brain instead: a long-running daemon onthe user's own machine (laptop **or** VPS) drives a local **Claude Code**,**Codex CLI**, **Grok Build** (`grok`), **Cursor Agent** (`cursor-agent`),-**OpenCode** (`opencode`), **pi** (`pi`), **Gemini CLI** (`gemini`), or **Qwen Code** (`qwen`) as the reasoning engine, on the user's own provider+**OpenCode** (`opencode`), **pi** (`pi`), **Gemini CLI** (`gemini`), **Qwen Code** (`qwen`), or **Antigravity** (`agy`) as the reasoning engine, on the user's own provideraccount — the server never holds the user's provider credentials.One daemon hosts **many independent agents** — each with its own dedicatedhome directory, memory, skills, and notes. In Cumora these still appear@@ -45,7 +45,7 @@ managed cloud agents and local agents into the same picture.user to set up; it's always online.- **Your computers** — machines you pair (your Mac, a VPS). Each runs the`cumora agent computer` daemon with a local engine (Claude Code /- Codex / Grok Build / Cursor Agent / OpenCode / pi / Gemini CLI / Qwen Code). Agents you place here are BYOA agents.+ Codex / Grok Build / Cursor Agent / OpenCode / pi / Gemini CLI / Qwen Code / Antigravity). Agents you place here are BYOA agents.```Computers@@ -194,13 +194,13 @@ from their own agenda — Kanban cards and due calendar slots — via## Engine integration`server/src/agents/computer/engine.ts` defines one `EngineAdapter` per-engine (`claude`, `codex`, `grok`, `cursor`, `opencode`, `gemini`, `qwen`). Persistent per-agent+engine (`claude`, `codex`, `grok`, `cursor`, `opencode`, `pi`, `gemini`, `qwen`, `antigravity`). Persistent per-agentsessions are preferred when the CLI exposes one; Cursor and OpenCode useone-shot `run()` for every wake and resume the session id reported by the CLI.```tsinterface EngineAdapter {- id: 'claude' | 'codex' | 'grok' | 'cursor' | 'opencode' | 'gemini' | 'qwen'+ id: 'claude' | 'codex' | 'grok' | 'cursor' | 'opencode' | 'pi' | 'gemini' | 'qwen' | 'antigravity'seedHome(home, persona) // lay out CLAUDE.md/AGENTS.md, skills, dirsstartSession?(args): EngineSession | null // persistent session (primary)run(args): Promise<…> // one-shot fallback@@ -215,16 +215,16 @@ interface EngineSession {}```-| Concern | Claude Code | Codex CLI | Grok Build | Cursor Agent | OpenCode | pi | Gemini CLI | Qwen Code |-| --- | --- | --- | --- | --- | --- | --- | --- | --- |-| Secure default | Claude Code ≥ 2.1.248 with `--restricted`; no Bash/PowerShell/web tools; host-home reads, command network, unsandboxed retry, and subprocess credentials are denied | Codex ≥ 0.138.0 with a custom permission profile: only minimal runtime reads plus the agent home; command network disabled; tool env allowlisted; user/project config, rules, hooks, apps, remote plugins, and multi-agent tools ignored or disabled | disabled | disabled | disabled | disabled | disabled | disabled |-| Platform | macOS, Linux, WSL2; native Windows disabled because Claude's sandbox is unsupported there | macOS, Linux, WSL2, native Windows | compatibility opt-in only | compatibility opt-in only | compatibility opt-in only | compatibility opt-in only | compatibility opt-in only | compatibility opt-in only |-| Persistent session | secure default; `claude -p --input-format stream-json --output-format stream-json --verbose` | compatibility opt-in only; secure default uses one-shot `exec` | compatibility opt-in ACP | none | none | compatibility opt-in RPC | none | none — 0.22.3 has no stream-json INPUT mode |-| Standing prompt | `--append-system-prompt-file <home>/.cumora-standing-prompt.md` | inlined into each secure one-shot wake | compatibility ACP `_meta.rules` | inlined | inlined | compatibility `--append-system-prompt` | inlined | inlined |-| One-shot | sandboxed `claude -p … --output-format stream-json` | sandboxed `codex exec --ignore-user-config --ignore-rules …` | compatibility `grok -p … --always-approve` | compatibility `cursor-agent … --force --trust` | compatibility `opencode run … --auto` | compatibility `pi … -p` | compatibility `gemini … --yolo` | compatibility `qwen --output-format stream-json --yolo` |-| Custom argv | ignored securely; requires the compatibility opt-in | ignored securely; requires the compatibility opt-in | compatibility opt-in required | compatibility opt-in required | compatibility opt-in required | compatibility opt-in required | compatibility opt-in required | compatibility opt-in required |-| Memory / persona file | `CLAUDE.md` | `AGENTS.md` | `AGENTS.md` | `AGENTS.md` | `AGENTS.md` plus `.opencode/skills/` | `AGENTS.md` plus `.pi/skills/` (loaded via `--skill`) | `GEMINI.md` plus `.gemini/skills/` | `QWEN.md` plus `.qwen/skills/` |-| Triage (small brain) | restricted and tool-free | read-only custom profile and tool env | compatibility only | compatibility only | compatibility only | compatibility only | compatibility only | compatibility only |+| Concern | Claude Code | Codex CLI | Grok Build | Cursor Agent | OpenCode | pi | Gemini CLI | Qwen Code | Antigravity |+| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |+| Secure default | Claude Code ≥ 2.1.248 with `--restricted`; no Bash/PowerShell/web tools; host-home reads, command network, unsandboxed retry, and subprocess credentials are denied | Codex ≥ 0.138.0 with a custom permission profile: only minimal runtime reads plus the agent home; command network disabled; tool env allowlisted; user/project config, rules, hooks, apps, remote plugins, and multi-agent tools ignored or disabled | disabled | disabled | disabled | disabled | disabled | disabled | disabled |+| Platform | macOS, Linux, WSL2; native Windows disabled because Claude's sandbox is unsupported there | macOS, Linux, WSL2, native Windows | compatibility opt-in only | compatibility opt-in only | compatibility opt-in only | compatibility opt-in only | compatibility opt-in only | compatibility opt-in only | compatibility opt-in only |+| Persistent session | secure default; `claude -p --input-format stream-json --output-format stream-json --verbose` | compatibility opt-in only; secure default uses one-shot `exec` | compatibility opt-in ACP | none | none | compatibility opt-in RPC | none | none — 0.22.3 has no stream-json INPUT mode | compatibility bidirectional stream-json |+| Standing prompt | `--append-system-prompt-file <home>/.cumora-standing-prompt.md` | inlined into each secure one-shot wake | compatibility ACP `_meta.rules` | inlined | inlined | compatibility `--append-system-prompt` | inlined | inlined | inlined |+| One-shot | sandboxed `claude -p … --output-format stream-json` | sandboxed `codex exec --ignore-user-config --ignore-rules …` | compatibility `grok -p … --always-approve` | compatibility `cursor-agent … --force --trust` | compatibility `opencode run … --auto` | compatibility `pi … -p` | compatibility `gemini … --yolo` | compatibility `qwen --output-format stream-json --yolo` | same stream-json protocol for one turn |+| Custom argv | ignored securely; requires the compatibility opt-in | ignored securely; requires the compatibility opt-in | compatibility opt-in required | compatibility opt-in required | compatibility opt-in required | compatibility opt-in required | compatibility opt-in required | compatibility opt-in required | not supported initially |+| Memory / persona file | `CLAUDE.md` | `AGENTS.md` | `AGENTS.md` | `AGENTS.md` | `AGENTS.md` plus `.opencode/skills/` | `AGENTS.md` plus `.pi/skills/` (loaded via `--skill`) | `GEMINI.md` plus `.gemini/skills/` | `QWEN.md` plus `.qwen/skills/` | `AGENTS.md` plus `.agents/skills/` |+| Triage (small brain) | restricted and tool-free | read-only custom profile and tool env | compatibility only | compatibility only | compatibility only | compatibility only | compatibility only | compatibility only | plan mode inside `agy --sandbox` |Sessions carry a resume id (`~/.cumora/sessions/<agentId>.session`); afailed resume falls back to a fresh thread instead of wedging the agent.@@ -239,9 +239,18 @@ unknown flag as fatal. And Gemini's `stats.input_tokens` is the whole promptINCLUDING cache reads, while `stats.input` is the fresh remainder; the ledgerbills `input` and reports `cached` separately, so a cached prefix is notcharged twice.+Antigravity runs through its documented bidirectional NDJSON protocol. Its+terminal `result.usage` counters are cumulative for the live CLI process, so+the adapter subtracts the previous result before recording each Cumora turn.+It deliberately starts a fresh Antigravity conversation after a daemon restart:+Cumora currently persists the conversation id but not the prior cumulative+counters, and resuming without that baseline would rebill historical turns.+Every invocation requests `agy --sandbox`, but Antigravity remains a compatibility+engine until Cumora has independently verified that its complete file, tool,+credential, and network boundary fails closed on every supported platform.Secure-default engines run headless inside a fail-closed local sandbox; anunavailable sandbox stops the turn instead of widening access. On Windows the daemon resolves the real-`claude`/`codex`/`grok`/`cursor-agent`/`opencode`/`pi`/`gemini` `.cmd` shims and routes large+`claude`/`codex`/`grok`/`cursor-agent`/`opencode`/`pi`/`gemini`/`qwen`/`agy` `.cmd` shims and routes largeprompts via stdin. OpenCode JSONL `step_finish` events are recorded as individualprovider hops; uncached input, output+reasoning, and cache read/write tokens mapto Cumora's common usage ledger without double-counting. OpenCode may race its@@ -268,7 +277,7 @@ fail-closed host boundary:CLI precedence, and hooks, apps, remote plugins, multi-agent tools, websearch, and shell snapshots are disabled. Codex 0.138.0 or newer is required.-Grok, Cursor, OpenCode, pi, Gemini, and Claude on native Windows remain+Grok, Cursor, OpenCode, pi, Gemini, Qwen, Antigravity, and Claude on native Windows remainavailable only as a backwards-compatibility escape hatch. They are not merelyhidden in the UI: the daemon removes them from its runnable inventory, so aserver assignment cannot make one execute accidentally.@@ -385,7 +394,7 @@ CREATE TABLE computers (owner_user_id TEXT, -- null for the managed Cumora Cloud rowname TEXT NOT NULL, -- "Cumora Cloud", "MacBook Pro", …kind TEXT NOT NULL, -- 'cloud' | 'local' | 'vps'- available_engines JSONB, -- ['claude','codex','grok','cursor','opencode','pi','gemini','qwen'] (daemon-detected)+ available_engines JSONB, -- ['claude','codex','grok','cursor','opencode','pi','gemini','qwen','antigravity'] (daemon-detected)status TEXT NOT NULL, -- 'online' | 'offline' | 'busy'last_seen_at TIMESTAMP,credential_hash TEXT, -- SHA256 of the device token@@ -398,7 +407,7 @@ CREATE TABLE computers (-- participants carry their host + engine + models-- computer_id TEXT (FK → computers.id)--- engine TEXT ('managed' | 'claude' | 'codex' | 'grok' | 'cursor' | 'opencode' | 'pi')+-- engine TEXT ('managed' | 'claude' | 'codex' | 'grok' | 'cursor' | 'opencode' | 'pi' | 'gemini' | 'qwen' | 'antigravity')-- model TEXT (big-brain override)-- fast_model TEXT (small-brain override)```@@ -487,7 +496,7 @@ npx cumora@latest agent computer --pair <code> [--server <url>]## Boundaries- **Cost / rate limits are the operator's** (their Claude Code / Codex / Grok Build /- Cursor subscription, or OpenCode / pi provider account) — a stated BYOA benefit. The daemon's semaphores, spawn+ Cursor / Antigravity subscription, or OpenCode / pi provider account) — a stated BYOA benefit. The daemon's semaphores, spawnpacing, and cooldowns exist to stay inside those limits gracefully(COORDINATION.md 2-4).- **Local inner state is not mirrored to the server.** Memory, notes,diff --git a/scripts/guard-big-brain.mjs b/scripts/guard-big-brain.mjsindex a29b181..2d6e8d9 100644--- a/scripts/guard-big-brain.mjs+++ b/scripts/guard-big-brain.mjs@@ -80,7 +80,7 @@ export function lineViolations(rel, raw) {out.push('big-brain engine spawn (adapter.run) outside the gated daemon path')}// R4 — a supported engine binary spawned directly, outside the adapter.- if (/(?:spawn|execFile\w*|exec)\s*\(\s*['"`](claude|codex|grok|cursor-agent|opencode|pi|gemini|qwen)['"`]/.test(code) && !ALLOW.engineSpawn.includes(rel)) {+ if (/(?:spawn|execFile\w*|exec)\s*\(\s*['"`](claude|codex|grok|cursor-agent|opencode|pi|gemini|qwen|agy)['"`]/.test(code) && !ALLOW.engineSpawn.includes(rel)) {out.push('engine binary spawned outside the engine adapter (bypasses the classify=small / run=big split)')}return outdiff --git a/server/src/__tests__/agents-computer-engine-antigravity.test.ts b/server/src/__tests__/agents-computer-engine-antigravity.test.tsnew file mode 100644index 0000000..5ca401c--- /dev/null+++ b/server/src/__tests__/agents-computer-engine-antigravity.test.ts@@ -0,0 +1,195 @@+/**+ * Contract tests for the BYOA Antigravity (`agy`) adapter.+ *+ * The fake binary implements Antigravity's documented bidirectional NDJSON+ * protocol: one user event on stdin per turn, one cumulative result envelope+ * back. Keeping the fixture cumulative is load-bearing — it catches the most+ * expensive adapter bug: billing prior turns again on every wake.+ */+import { existsSync } from 'node:fs'+import { chmod, mkdtemp, mkdir, readFile, realpath, rm, writeFile } from 'node:fs/promises'+import { tmpdir } from 'node:os'+import { delimiter, join } from 'node:path'+import { afterEach, test } from 'node:test'+import assert from 'node:assert/strict'+import { detectEngines, getAdapter, type EngineHopReport } from '../agents/computer/engine.js'++const IS_WIN = process.platform === 'win32'+const ORIGINAL_PATH = process.env.PATH+const tempDirs: string[] = []++afterEach(async () => {+ delete process.env.CUMORA_TRIAGE_MODEL+ process.env.PATH = ORIGINAL_PATH+ await Promise.all(tempDirs.splice(0).map((dir) => rm(dir, { recursive: true, force: true })))+})++const FAKE_AGY = `#!/usr/bin/env node+'use strict'+const fs = require('node:fs')+const readline = require('node:readline')+const argv = process.argv.slice(2)+const log = process.env.FAKE_AGY_LOG+if (log) fs.appendFileSync(log, JSON.stringify({ type: 'start', argv, cwd: process.cwd() }) + '\\n')+let turn = 0+const out = (event) => process.stdout.write(JSON.stringify(event) + '\\n')+out({ event: 'init', conversation_id: 'agy-conversation-1', init: { conversation_id: 'agy-conversation-1', model: 'Gemini 3.5 Flash (High)' } })+const rl = readline.createInterface({ input: process.stdin, crlfDelay: Infinity })+rl.on('line', (line) => {+ if (!line.trim()) return+ const event = JSON.parse(line)+ const content = event?.message?.content || ''+ if (log) fs.appendFileSync(log, JSON.stringify({ type: 'prompt', event }) + '\\n')+ turn += 1+ if (process.env.FAKE_AGY_SCENARIO === 'error') {+ out({ event: 'result', result: {+ conversation_id: 'agy-conversation-1', status: 'ERROR', response: '', error: 'quota exhausted',+ duration_seconds: 0.1, num_turns: turn,+ usage: { input_tokens: 10, output_tokens: 0, thinking_tokens: 0, cache_read_tokens: 0, total_tokens: 10 },+ } })+ return+ }+ out({ event: 'step_update', step_update: {+ conversation_id: 'agy-conversation-1', step_index: turn, state: 'DONE', step_type: 'tool',+ tool_info: { name: 'run_command' },+ } })+ const usage = turn === 1+ ? { input_tokens: 100, output_tokens: 10, thinking_tokens: 4, cache_read_tokens: 40, total_tokens: 110 }+ : { input_tokens: 160, output_tokens: 16, thinking_tokens: 7, cache_read_tokens: 70, total_tokens: 176 }+ out({ event: 'result', result: {+ conversation_id: 'agy-conversation-1', status: 'SUCCESS', response: 'echo:' + content,+ duration_seconds: turn, num_turns: turn, model: 'Gemini 3.5 Flash (High)', usage,+ } })+})+`++interface Fixture { root: string; home: string; log: string; env: NodeJS.ProcessEnv }++async function fixture(scenario = 'ok'): Promise<Fixture> {+ const root = await mkdtemp(join(tmpdir(), 'cumora-antigravity-'))+ tempDirs.push(root)+ const binDir = join(root, 'bin')+ const home = join(root, 'home')+ const log = join(root, 'fake.log')+ await mkdir(binDir)+ await mkdir(home)+ const fake = join(binDir, 'agy')+ await writeFile(fake, FAKE_AGY, 'utf8')+ await chmod(fake, 0o755)+ return {+ root, home, log,+ env: {+ ...process.env,+ PATH: `${binDir}${delimiter}${ORIGINAL_PATH ?? ''}`,+ FAKE_AGY_LOG: log,+ FAKE_AGY_SCENARIO: scenario,+ },+ }+}++async function fakeLog(f: Fixture): Promise<Array<Record<string, unknown>>> {+ if (!existsSync(f.log)) return []+ return (await readFile(f.log, 'utf8')).split('\n').filter(Boolean).map((line) => JSON.parse(line))+}++test('antigravity persistent session uses sandboxed stream-json and bills per-turn deltas', { skip: IS_WIN }, async () => {+ const f = await fixture()+ const hops: EngineHopReport[] = []+ const session = getAdapter('antigravity').startSession?.({+ home: f.home,+ env: f.env,+ model: 'Gemini 3.5 Flash (High)',+ onLog: () => {},+ onHopUsage: (hop) => hops.push(hop),+ })+ assert.ok(session)++ const first = await session.send('first prompt')+ const second = await session.send('second prompt')+ await session.stop()++ assert.equal(first.exitCode, 0)+ assert.equal(first.sessionId, 'agy-conversation-1')+ assert.equal(first.model, 'Gemini 3.5 Flash (High)')+ assert.deepEqual(first.usage, {+ input_tokens: 60,+ output_tokens: 10,+ cache_read_input_tokens: 40,+ })+ // The second result is cumulative (160/16/70). Only the 60/6/30 delta is+ // this turn, and cache is a subset of input: 60 - 30 = 30 fresh.+ assert.deepEqual(second.usage, {+ input_tokens: 30,+ output_tokens: 6,+ cache_read_input_tokens: 30,+ })+ assert.equal(hops.length, 2)+ assert.deepEqual(hops[1].usage, second.usage)+ assert.equal(hops[0].toolUses, 1)++ const records = await fakeLog(f)+ const start = records.find((record) => record.type === 'start') as { argv: string[]; cwd: string }+ assert.ok(start.argv.includes('--input-format'))+ assert.ok(start.argv.includes('--output-format'))+ assert.ok(start.argv.includes('--sandbox'))+ assert.ok(start.argv.includes('--dangerously-skip-permissions'))+ assert.equal(start.argv[start.argv.indexOf('--mode') + 1], 'accept-edits')+ assert.ok(!start.argv.includes('first prompt'), 'the prompt must travel on stdin, not argv')+ assert.equal(start.cwd, await realpath(f.home))+ const prompts = records.filter((record) => record.type === 'prompt') as Array<{ event: { event: string; message: { content: string } } }>+ assert.deepEqual(prompts.map((record) => record.event.message.content), ['first prompt', 'second prompt'])+})++test('antigravity triage uses plan mode and returns the current reply', { skip: IS_WIN }, async () => {+ const f = await fixture()+ process.env.CUMORA_TRIAGE_MODEL = 'Gemini 3.5 Flash (Low)'+ const result = await getAdapter('antigravity').classify({+ cwd: f.home,+ prompt: 'classify this',+ env: f.env,+ onLog: () => {},+ signal: new AbortController().signal,+ })+ assert.equal(result.text, 'echo:classify this')+ const records = await fakeLog(f)+ const start = records.find((record) => record.type === 'start') as { argv: string[] }+ assert.equal(start.argv[start.argv.indexOf('--mode') + 1], 'plan')+ assert.equal(start.argv[start.argv.indexOf('--model') + 1], 'Gemini 3.5 Flash (Low)')+})++test('antigravity failed result surfaces its reason and still reports spent usage', { skip: IS_WIN }, async () => {+ const f = await fixture('error')+ const result = await getAdapter('antigravity').run({+ home: f.home,+ prompt: 'fail',+ env: f.env,+ onLog: () => {},+ signal: new AbortController().signal,+ })+ assert.equal(result.exitCode, 1)+ assert.match(result.error ?? '', /quota exhausted/)+ assert.deepEqual(result.usage, { input_tokens: 10, output_tokens: 0, cache_read_input_tokens: 0 })+})++test('antigravity seedHome writes AGENTS.md and native workspace skills', { skip: IS_WIN }, async () => {+ const f = await fixture()+ await getAdapter('antigravity').seedHome(f.home, {+ id: 'agy-reviewer', name: 'Aster', role: 'Reviewer', systemPrompt: 'Review independently.',+ })+ const persona = await readFile(join(f.home, 'AGENTS.md'), 'utf8')+ assert.match(persona, /Aster/)+ assert.match(persona, /Review independently/)+ assert.match(persona, /`\.agents\/skills\/` — your skills/)+ assert.ok(existsSync(join(f.home, '.agents', 'skills')))+})++test('antigravity is detected through the agy binary on PATH', { skip: IS_WIN }, async () => {+ const f = await fixture()+ const old = process.env.PATH+ process.env.PATH = f.env.PATH+ try {+ assert.ok((await detectEngines()).includes('antigravity'))+ } finally {+ process.env.PATH = old+ }+})diff --git a/server/src/__tests__/agents-computer-engine-detect.test.ts b/server/src/__tests__/agents-computer-engine-detect.test.tsindex 024da13..8384afd 100644--- a/server/src/__tests__/agents-computer-engine-detect.test.ts+++ b/server/src/__tests__/agents-computer-engine-detect.test.ts@@ -8,6 +8,7 @@ import assert from 'node:assert/strict'process.env.CUMORA_RUNTIME_CLIENT = 'http'process.env.CUMORA_DEFAULT_CLAUDE_MODEL = 'claude-opus-4-7'+process.env.CUMORA_DEFAULT_ANTIGRAVITY_MODEL = 'Gemini 3.5 Flash (High)'process.env.OPENAI_API_KEY ??= 'test-key'const registry = await import('../agents/computer/registry.js')@@ -45,7 +46,7 @@ after(async () => {test('sanitizeDetectedEngines drops unknown ids and fills missing bins', () => {const out = registry.sanitizeDetectedEngines([{ id: 'claude', bin: 'claude', path: '/usr/bin/claude' }, { id: 'bogus', bin: 'x', path: null }],- ['claude', 'codex', 'gemini', 'bogus'],+ ['claude', 'codex', 'gemini', 'antigravity', 'bogus'],)// Version fields come back on every row — null here, since a daemon this old// reports paths only. See agents-computer-engine-version.test.ts.@@ -54,6 +55,7 @@ test('sanitizeDetectedEngines drops unknown ids and fills missing bins', () => {{ id: 'claude', bin: 'claude', path: '/usr/bin/claude', ...noVersion },{ id: 'codex', bin: 'codex', path: null, ...noVersion },{ id: 'gemini', bin: 'gemini', path: null, ...noVersion },+ { id: 'antigravity', bin: 'agy', path: null, ...noVersion },])})@@ -63,6 +65,7 @@ test('listAgentsForComputer keeps an explicit model and pins CUMORA_DEFAULT_* whreturn { rows: [{ id: 'bram', name: 'Bram', role: 'engineer', systemPrompt: null, engine: 'claude', model: 'stale-pin', fastModel: 'haiku' },{ id: 'saga', name: 'Saga', role: 'writer', systemPrompt: null, engine: 'claude', model: null, fastModel: null },+ { id: 'aster', name: 'Aster', role: 'reviewer', systemPrompt: null, engine: 'antigravity', model: null, fastModel: null },] }}return { rows: [] }@@ -72,6 +75,8 @@ test('listAgentsForComputer keeps an explicit model and pins CUMORA_DEFAULT_* whassert.equal(agents[0]?.fastModel, 'haiku')assert.equal(agents[1]?.model, 'claude-opus-4-7')assert.equal(agents[1]?.engine, 'claude')+ assert.equal(agents[2]?.model, 'Gemini 3.5 Flash (High)')+ assert.equal(agents[2]?.engine, 'antigravity')})test('reportDetectedEngines keeps the previous default first when it is still installed', async () => {diff --git a/server/src/__tests__/agents-computer-engine-version.test.ts b/server/src/__tests__/agents-computer-engine-version.test.tsindex 1c4486b..64ec72e 100644--- a/server/src/__tests__/agents-computer-engine-version.test.ts+++ b/server/src/__tests__/agents-computer-engine-version.test.ts@@ -96,6 +96,10 @@ test('inferUpdateCommand prefers the vendor updater, then brew, then npm', () =>// pi needs the vendor's documented flag when it falls through to npm.assert.equal(inferUpdateCommand({ versionArgs: ['--version'], npm: '@earendil-works/pi-coding-agent', npmFlags: '--ignore-scripts' }, '/usr/local/bin/pi'),'npm install -g --ignore-scripts @earendil-works/pi-coding-agent@latest')+ assert.equal(+ inferUpdateCommand(ENGINE_VERSION_SPECS.antigravity, '/Users/test/.local/bin/agy'),+ 'agy update',+ )})test('parseCursorAbout / parseGrokCheck read their vendor formats', () => {diff --git a/server/src/__tests__/agents-computer-engine.test.ts b/server/src/__tests__/agents-computer-engine.test.tsindex baf8405..b64b924 100644--- a/server/src/__tests__/agents-computer-engine.test.ts+++ b/server/src/__tests__/agents-computer-engine.test.ts@@ -66,7 +66,7 @@ afterEach(async () => {})test('secure inventory exposes only engines with a verified boundary', () => {- const installed = ['claude', 'codex', 'grok', 'cursor', 'opencode', 'pi', 'gemini'] as const+ const installed = ['claude', 'codex', 'grok', 'cursor', 'opencode', 'pi', 'gemini', 'qwen', 'antigravity'] as constassert.deepEqual(runnableEngineIds(installed, {}, 'darwin'), ['claude', 'codex'])assert.deepEqual(runnableEngineIds(installed, {}, 'linux'), ['claude', 'codex'])assert.deepEqual(runnableEngineIds(installed, {}, 'win32'), ['codex'])diff --git a/server/src/agents/computer/cli-version.ts b/server/src/agents/computer/cli-version.tsindex 14c16cf..c0261e4 100644--- a/server/src/agents/computer/cli-version.ts+++ b/server/src/agents/computer/cli-version.ts@@ -115,6 +115,10 @@ export const ENGINE_VERSION_SPECS: Record<string, EngineVersionSpec> = {versionArgs: ['--version'],npm: '@qwen-code/qwen-code',},+ antigravity: {+ versionArgs: ['--version'],+ selfUpdate: 'agy update',+ },hermes: {versionArgs: ['version'],selfUpdate: 'hermes update',diff --git a/server/src/agents/computer/daemon.ts b/server/src/agents/computer/daemon.tsindex fb0ef26..cdda506 100644--- a/server/src/agents/computer/daemon.ts+++ b/server/src/agents/computer/daemon.ts@@ -3,7 +3,8 @@** A long-running process on the user's machine (laptop or VPS) that hosts one* or more of their Cumora agents, using a local engine (Claude Code / Codex / pi /- * Grok Build / Cursor Agent / OpenCode) as each agent's brain. See docs/BYOA.md.+ * Grok Build / Cursor Agent / OpenCode / Gemini / Qwen / Antigravity) as each+ * agent's brain. See docs/BYOA.md.** It talks to the Cumora server only over HTTP — no DB/Redis — so it can run* anywhere:@@ -652,6 +653,9 @@ function authFailureHint(engine: EngineId, detail: string): string {if (engine === 'pi') {return 'Open pi on that computer and run `/login` for its provider (or fix the API key / quota), then wake the agent again.'}+ if (engine === 'antigravity') {+ return 'Open Antigravity on that computer and run `agy` to refresh its login, model access, or quota, then wake the agent again.'+ }return 'Open Codex on that computer and refresh its login or quota, then wake the agent again.'}@@ -668,6 +672,9 @@ function missingEngineMessage(): string {' - Cursor Agent: install Cursor (the `cursor-agent` CLI ships with it), then run `cursor-agent login`',' - OpenCode: install the `opencode` CLI, then run `opencode providers login` once',' - pi: `npm install -g --ignore-scripts @earendil-works/pi-coding-agent`, then run `pi` once and `/login` a provider',+ ' - Gemini CLI: install the `gemini` CLI, then run `gemini` once to sign in',+ ' - Qwen Code: install the `qwen` CLI, then run `qwen` once to sign in',+ ' - Antigravity: install the `agy` CLI, then run `agy` once to sign in','','After that, rerun:',' npx cumora@latest agent computer --pair <code>',@@ -681,7 +688,7 @@ function sandboxedEngineMessage(installed: readonly EngineId[]): string {process.platform === 'win32'? 'Use Codex on native Windows, or run Claude Code inside WSL2.': 'Install and sign in to Claude Code or Codex.',- 'Grok, Cursor, OpenCode, pi, Gemini, and native-Windows Claude currently lack',+ 'Grok, Cursor, OpenCode, pi, Gemini, Qwen, Antigravity, and native-Windows Claude currently lack','a Cumora-verified fail-closed host boundary.','','Compatibility only (grants the model your host files, environment, and network):',@@ -706,7 +713,7 @@ function helpText(): string {'','The daemon talks to a Cumora server over HTTP and drives a local agent','engine. Claude Code and Codex are sandboxed by default. Grok Build, Cursor',- 'Agent, OpenCode, pi, Gemini, and native-Windows Claude require the explicit',+ 'Agent, OpenCode, pi, Gemini, Qwen, Antigravity, and native-Windows Claude require the explicit','high-risk CUMORA_BYOA_ALLOW_UNSANDBOXED=1 compatibility switch.','Pair once, then the daemon runs in the background.','',@@ -1988,6 +1995,7 @@ class AgentRunner {if (this.adapter.id === 'codex') return 'gpt-5.4-mini'if (this.adapter.id === 'opencode') return this.agent.model ?? '<opencode-default>'if (this.adapter.id === 'pi') return this.agent.model ?? '<pi-default>'+ if (this.adapter.id === 'antigravity') return this.agent.model ?? '<antigravity-default>'return this.agent.model ?? '<cursor-default>'}diff --git a/server/src/agents/computer/engine.ts b/server/src/agents/computer/engine.tsindex edb8cff..6e92658 100644--- a/server/src/agents/computer/engine.ts+++ b/server/src/agents/computer/engine.ts@@ -3,7 +3,7 @@** A BYOA agent's reasoning loop is delegated to a local CLI engine running* on the user's machine: Claude Code, Codex, Grok Build, Cursor Agent,- * OpenCode, or pi. The daemon (daemon.ts) hands+ * OpenCode, pi, Gemini CLI, Qwen Code, or Antigravity. The daemon (daemon.ts) hands* each wake to an adapter, which spawns the engine headlessly in the agent's* dedicated home directory. The engine reads its persona + memory + skills* from that home natively (CLAUDE.md / AGENTS.md, .claude/skills, …) and acts@@ -349,10 +349,10 @@ function resolveCodexSpawn(): CodexSpawn {return { command: node, argsPrefix: [script], shell: false, wantsStdinPrompt: false }}-export type EngineId = 'claude' | 'codex' | 'grok' | 'cursor' | 'opencode' | 'pi' | 'gemini' | 'qwen'+export type EngineId = 'claude' | 'codex' | 'grok' | 'cursor' | 'opencode' | 'pi' | 'gemini' | 'qwen' | 'antigravity'/** The pairable engine ids, in the daemon's default detection order. */-export const ENGINE_IDS: EngineId[] = ['claude', 'codex', 'grok', 'cursor', 'opencode', 'pi', 'gemini', 'qwen']+export const ENGINE_IDS: EngineId[] = ['claude', 'codex', 'grok', 'cursor', 'opencode', 'pi', 'gemini', 'qwen', 'antigravity']/** Engines for which Cumora can impose a fail-closed filesystem + tool-network* boundary non-interactively. The remaining adapters still work for operators@@ -4620,6 +4620,410 @@ class QwenAdapter implements EngineAdapter {// fresh one, which is what the one-shot path already does.}+// ─── Antigravity CLI ──────────────────────────────────────────────────────────────────+//+// `agy --input-format stream-json --output-format stream-json` is a real+// long-lived protocol: one NDJSON user event goes in per turn and exactly one+// terminal result event comes back. Result usage is CUMULATIVE for the whole+// process, so the tracker must subtract the previous total before handing a+// turn to Cumora's ledger. Treating the result as per-turn silently bills the+// first turn again on every later wake.++interface AntigravityNativeUsage {+ input_tokens?: number+ output_tokens?: number+ thinking_tokens?: number+ cache_read_tokens?: number+ total_tokens?: number+}++interface AntigravityEvent {+ event?: string+ conversation_id?: string+ init?: { conversation_id?: string; model?: string }+ step_update?: {+ conversation_id?: string+ step_index?: number+ state?: string+ step_type?: string+ text_delta?: string+ tool_info?: unknown+ }+ result?: {+ conversation_id?: string+ status?: string+ response?: string+ error?: string+ duration_seconds?: number+ num_turns?: number+ model?: string+ usage?: AntigravityNativeUsage+ }+}++function antigravityCounter(value: unknown): number {+ return typeof value === 'number' && Number.isFinite(value) ? Math.max(0, value) : 0+}++/** Convert Antigravity's counters without charging cache reads twice.+ *+ * `input_tokens` is the complete prompt, including cache reads (the documented+ * examples satisfy total = input + output). Cumora's common shape wants fresh+ * input and cache reads in disjoint fields. `thinking_tokens` is a subset of+ * output_tokens, not an extra token class, so it is intentionally not added+ * again. */+function antigravityUsage(raw: AntigravityNativeUsage | undefined): EngineUsage | undefined {+ if (!raw) return undefined+ const cached = antigravityCounter(raw.cache_read_tokens)+ const input = Math.max(0, antigravityCounter(raw.input_tokens) - cached)+ const output = antigravityCounter(raw.output_tokens)+ if (!input && !output && !cached) return undefined+ return {+ input_tokens: input,+ output_tokens: output,+ cache_read_input_tokens: cached,+ }+}++function antigravityUsageDelta(+ current: AntigravityNativeUsage | undefined,+ previous: AntigravityNativeUsage | undefined,+): AntigravityNativeUsage | undefined {+ if (!current) return undefined+ const delta = (key: keyof AntigravityNativeUsage): number => {+ const now = antigravityCounter(current[key])+ const before = antigravityCounter(previous?.[key])+ // A CLI-side session reset makes the cumulative total smaller. That new+ // value is the whole current turn, not a negative delta.+ return now >= before ? now - before : now+ }+ return {+ input_tokens: delta('input_tokens'),+ output_tokens: delta('output_tokens'),+ thinking_tokens: delta('thinking_tokens'),+ cache_read_tokens: delta('cache_read_tokens'),+ total_tokens: delta('total_tokens'),+ }+}++function parseAntigravityLine(line: string): AntigravityEvent | null {+ if (!line.startsWith('{')) return null+ try { return JSON.parse(line) as AntigravityEvent } catch { return null }+}++class AntigravityTurnTracker {+ sessionId: string | null = null+ model: string | null+ text = ''+ error: string | null = null+ usage: EngineUsage | undefined+ private previousUsage: AntigravityNativeUsage | undefined+ private startedAt: number | null = null+ private toolUses = 0+ private readonly seenToolSteps = new Set<number>()+ private hopIndex = 0++ constructor(+ pin: string | null,+ private readonly onHopUsage?: (report: EngineHopReport) => void,+ ) {+ this.model = pin+ }++ beginTurn(): void {+ this.text = ''+ this.error = null+ this.usage = undefined+ this.startedAt = Date.now()+ this.toolUses = 0+ this.seenToolSteps.clear()+ }++ /** Feed one event. True means the current turn reached its terminal result. */+ observe(event: AntigravityEvent): boolean {+ const id = event.conversation_id ?? event.init?.conversation_id ?? event.result?.conversation_id+ if (typeof id === 'string' && id) this.sessionId = id+ const namedModel = event.init?.model ?? event.result?.model+ if (typeof namedModel === 'string' && namedModel) this.model = namedModel++ if (event.event === 'step_update') {+ const step = event.step_update+ if (step?.tool_info != null && step.state === 'DONE' && typeof step.step_index === 'number' && !this.seenToolSteps.has(step.step_index)) {+ this.seenToolSteps.add(step.step_index)+ this.toolUses += 1+ }+ return false+ }+ if (event.event !== 'result' || !event.result) return false++ const result = event.result+ if (typeof result.response === 'string') this.text = result.response+ if (result.status !== 'SUCCESS') {+ this.error = typeof result.error === 'string' && result.error+ ? result.error+ : `antigravity turn ended with status ${result.status || 'UNKNOWN'}`+ }+ const delta = antigravityUsageDelta(result.usage, this.previousUsage)+ this.previousUsage = result.usage+ this.usage = antigravityUsage(delta)+ if (this.usage && this.onHopUsage) {+ this.hopIndex += 1+ try {+ this.onHopUsage({+ model: this.model ?? 'antigravity',+ usage: this.usage,+ latencyMs: this.startedAt == null ? undefined : Date.now() - this.startedAt,+ hopIndex: this.hopIndex,+ toolUses: this.toolUses,+ textChars: this.text.length,+ })+ } catch { /* ledger reporting is best-effort */ }+ }+ return true+ }+}++class AntigravitySession implements EngineSession {+ private readonly child: ChildProcess+ private readonly tracker: AntigravityTurnTracker+ private readonly decoder = new StringDecoder('utf8')+ private outBuf = ''+ private exited = false+ private exitCode = 0+ private stderrTail: string[] = []+ private stdoutTail: string[] = []+ private pending: { resolve: (result: EngineRunResult) => void } | null = null+ private stopPromise: Promise<void> | null = null+ readonly carriesStandingPrompt = false++ constructor(+ command: string,+ argv: string[],+ shell: boolean,+ private readonly opts: EngineSessionArgs,+ pin: string | null,+ ) {+ this.tracker = new AntigravityTurnTracker(pin, opts.onHopUsage)+ this.child = spawnEngineChild(command, argv, {+ cwd: opts.home,+ env: opts.env,+ stdio: ['pipe', 'pipe', 'pipe'],+ shell,+ })+ this.child.stdout?.on('data', (buf: Buffer) => this.onStdout(buf))+ this.child.stderr?.on('data', (buf: Buffer) => this.onStderr(buf))+ this.child.on('error', (err) => this.die(1, err.message))+ this.child.on('close', (code, signalName) => {+ this.flushStdout()+ this.die(code ?? (signalName ? 128 : 1), signalName ? `terminated by ${signalName}` : `exited with code ${code}`)+ })+ }++ get alive(): boolean { return !this.exited && this.child.stdin?.writable === true }+ get sessionId(): string | null { return this.tracker.sessionId }+ get text(): string { return this.tracker.text }++ send(prompt: string): Promise<EngineRunResult> {+ if (this.pending) return Promise.resolve({ exitCode: 1, error: 'engine session busy — a turn is already in flight', sessionId: this.sessionId })+ if (!this.alive) {+ return Promise.resolve({+ exitCode: this.exitCode || 1,+ error: failurePreview({ exitCode: this.exitCode || 1, signalName: null, stderr: this.stderrTail, stdout: this.stdoutTail }),+ sessionId: this.sessionId,+ })+ }+ this.tracker.beginTurn()+ return new Promise((resolve) => {+ this.pending = { resolve }+ const message = JSON.stringify({ event: 'user', message: { content: stripLoneSurrogates(prompt) } })+ if (!writeStdin(this.child, `${message}\n`)) {+ this.settle({ exitCode: 1, error: 'failed to write turn to antigravity', sessionId: this.sessionId })+ }+ })+ }++ steer(_text: string): void {+ // The documented protocol requires waiting for a result before the next+ // user event. Queueing mid-turn would be an undocumented race; the daemon's+ // normal coalesced wake delivers the ping after this turn instead.+ if (this.pending) this.opts.onLog('[antigravity] same-turn steer is not supported; the ping rides the next wake')+ }++ stop(options: { force?: boolean } = {}): Promise<void> {+ this.exited = true+ try { this.child.stdin?.end() } catch { /* ignore */ }+ if (options.force) return terminateEngineTree(this.child, true)+ if (!this.stopPromise) {+ this.stopPromise = (async () => {+ if (await waitForChildExit(this.child, 2_000)) return+ await terminateEngineTree(this.child)+ })()+ }+ return this.stopPromise+ }++ private onStdout(buf: Buffer): void {+ this.outBuf += this.decoder.write(buf)+ let newline: number+ while ((newline = this.outBuf.indexOf('\n')) >= 0) {+ const raw = this.outBuf.slice(0, newline)+ this.outBuf = this.outBuf.slice(newline + 1)+ this.takeLine(raw)+ }+ }++ private flushStdout(): void {+ this.outBuf += this.decoder.end()+ if (this.outBuf) this.takeLine(this.outBuf)+ this.outBuf = ''+ }++ private takeLine(raw: string): void {+ const line = cleanLine(raw)+ if (!line) return+ pushTail(this.stdoutTail, line)+ this.opts.onLog(line)+ const event = parseAntigravityLine(line)+ if (event && this.tracker.observe(event)) {+ const eventError = this.tracker.error+ this.settle({+ exitCode: eventError ? 1 : 0,+ error: eventError ? `engine turn error: ${eventError.slice(0, MAX_FAILURE_CHARS)}` : undefined,+ sessionId: this.tracker.sessionId,+ usage: this.tracker.usage,+ model: this.tracker.model,+ })+ }+ }++ private onStderr(buf: Buffer): void {+ for (const raw of buf.toString('utf8').split('\n')) {+ const line = cleanLine(raw)+ if (!line) continue+ pushTail(this.stderrTail, line)+ this.opts.onLog(line)+ }+ }++ private settle(result: EngineRunResult): void {+ const pending = this.pending+ if (!pending) return+ this.pending = null+ pending.resolve(result)+ }++ private die(code: number, detail: string): void {+ if (this.exited && !this.pending) return+ this.exited = true+ this.exitCode = code+ if (this.pending) {+ this.settle({+ exitCode: code || 1,+ error: failurePreview({ exitCode: code || 1, signalName: null, stderr: this.stderrTail, stdout: this.stdoutTail }) || detail,+ sessionId: this.sessionId,+ usage: this.tracker.usage,+ model: this.tracker.model,+ })+ }+ }+}++class AntigravityAdapter implements EngineAdapter {+ readonly id = 'antigravity' as const+ readonly bin = 'agy'++ private sessionArgs(args: EngineSessionArgs, mode: 'accept-edits' | 'plan'): string[] {+ const model = args.model ? ['--model', args.model] : []+ return [+ '--input-format', 'stream-json',+ '--output-format', 'stream-json',+ '--sandbox',+ '--mode', mode,+ '--dangerously-skip-permissions',+ '--disable-slash-commands',+ ...model,+ ]+ }++ private start(args: EngineSessionArgs, mode: 'accept-edits' | 'plan'): AntigravitySession {+ const { command, shell } = resolveSpawn(this.bin)+ // Do not pass --conversation across daemon restarts yet. Its result usage is+ // cumulative over the historical conversation, while Cumora persists only+ // the id, not the prior counters; resuming would overbill that history as+ // the first new turn. The per-agent home + memory remains durable.+ return new AntigravitySession(command, this.sessionArgs(args, mode), shell, args, args.model ?? null)+ }++ startSession(args: EngineSessionArgs): EngineSession | null {+ return this.start(args, 'accept-edits')+ }++ async run(args: EngineRunArgs): Promise<EngineRunResult> {+ if (args.signal.aborted) return { exitCode: 130, error: 'engine turn aborted before start', sessionId: null }+ const sessionArgs: EngineSessionArgs = {+ home: args.home,+ env: args.env,+ model: args.model,+ fastModel: args.fastModel,+ resumeSessionId: args.resumeSessionId,+ onLog: args.onLog,+ onHopUsage: args.onHopUsage,+ }+ const session = this.start(sessionArgs, 'accept-edits')+ const onAbort = (): void => { void session.stop({ force: true }) }+ args.signal.addEventListener('abort', onAbort, { once: true })+ if (args.signal.aborted) onAbort()+ try {+ if (args.signal.aborted) return { exitCode: 130, error: 'engine turn aborted before start', sessionId: null }+ return await session.send(args.prompt)+ } finally {+ args.signal.removeEventListener('abort', onAbort)+ await session.stop()+ }+ }++ async classify(args: EngineClassifyArgs): Promise<EngineClassifyResult> {+ const session = this.start({+ home: args.cwd,+ env: args.env,+ model: args.model ?? process.env.CUMORA_TRIAGE_MODEL ?? null,+ onLog: args.onLog ?? (() => {}),+ }, 'plan')+ const onAbort = (): void => { void session.stop({ force: true }) }+ args.signal.addEventListener('abort', onAbort, { once: true })+ if (args.signal.aborted) onAbort()+ try {+ if (args.signal.aborted) return { text: '', error: 'engine turn aborted before start' }+ const result = await session.send(args.prompt)+ return { text: session.text, error: result.error, usage: result.usage, model: result.model }+ } finally {+ args.signal.removeEventListener('abort', onAbort)+ await session.stop()+ }+ }++ async probe(args: EngineProbeArgs): Promise<EngineClassifyResult> {+ const model = args.tier === 'small' ? (process.env.CUMORA_TRIAGE_MODEL ?? null) : null+ return this.classify({ cwd: args.cwd, prompt: DOCTOR_PROMPT, env: args.env, model, signal: args.signal })+ }++ probeWake(_args: EngineWakeProbeArgs): Promise<EngineWakeProbeResult> {+ // classify()/probe() use the same bidirectional stream-json protocol as a+ // real wake, only in plan mode, so the brain probes already cover it.+ return Promise.resolve({ ok: true, detail: '', skipped: true })+ }++ async seedHome(home: string, persona: EnginePersona): Promise<void> {+ await ensureCommonHome(home)+ await mkdir(join(home, '.agents', 'skills'), { recursive: true })+ await writeFile(+ join(home, 'AGENTS.md'),+ PERSONA_HEADER(persona, { personaFile: 'AGENTS.md', skillsDir: '.agents/skills/' }),+ 'utf8',+ )+ }+}+const ADAPTERS: Record<EngineId, EngineAdapter> = {claude: new ClaudeAdapter(),@@ -4630,6 +5034,7 @@ const ADAPTERS: Record<EngineId, EngineAdapter> = {pi: new PiAdapter(),gemini: new GeminiAdapter(),qwen: new QwenAdapter(),+ antigravity: new AntigravityAdapter(),}export function getAdapter(id: EngineId): EngineAdapter {diff --git a/server/src/agents/computer/registry.ts b/server/src/agents/computer/registry.tsindex d686ebf..6bc1be5 100644--- a/server/src/agents/computer/registry.ts+++ b/server/src/agents/computer/registry.ts@@ -20,7 +20,7 @@ import { CH_STATUS, publish } from '../../redis.js'import { signAgentToken } from '../runtime/jwt.js'export type ComputerKind = 'cloud' | 'local' | 'vps'-export type EngineId = 'managed' | 'claude' | 'codex' | 'grok' | 'cursor' | 'opencode' | 'pi' | 'gemini' | 'qwen'+export type EngineId = 'managed' | 'claude' | 'codex' | 'grok' | 'cursor' | 'opencode' | 'pi' | 'gemini' | 'qwen' | 'antigravity'export type ComputerStatus = 'online' | 'offline' | 'busy'/** How long a paired computer can go without a heartbeat before the sweep@@ -59,6 +59,7 @@ export async function announceComputerOnline(computerId: string, companyId: striconst PAIRABLE: Record<Exclude<EngineId, 'managed'>, true> = {claude: true, codex: true, grok: true, cursor: true, opencode: true, pi: true, gemini: true,qwen: true,+ antigravity: true,}const PAIRABLE_ENGINES: ReadonlySet<string> = new Set<string>(Object.keys(PAIRABLE))@@ -101,6 +102,8 @@ const ENGINE_BINS: Record<string, string> = {opencode: 'opencode',pi: 'pi',gemini: 'gemini',+ qwen: 'qwen',+ antigravity: 'agy',}/** Cached PATH snapshot from the daemon. The app reads this; it never probes. */@@ -523,7 +526,8 @@ export async function mintAgentRuntimeToken(args: {* When a row has no explicit model, fall back to the deploy-level default* (CUMORA_DEFAULT_CLAUDE_MODEL / CUMORA_DEFAULT_CODEX_MODEL /* CUMORA_DEFAULT_GROK_MODEL / CUMORA_DEFAULT_CURSOR_MODEL /- * CUMORA_DEFAULT_OPENCODE_MODEL / CUMORA_DEFAULT_PI_MODEL) so every BYOA+ * CUMORA_DEFAULT_OPENCODE_MODEL / CUMORA_DEFAULT_PI_MODEL /+ * CUMORA_DEFAULT_ANTIGRAVITY_MODEL) so every BYOA* daemon gets a consistent pin — independent of whatever model the local* engine CLI happens to default to today. Critical: a model* upgrade in the underlying CLI (e.g. claude 4.7 → 4.8) silently changes@@ -543,6 +547,7 @@ export async function listAgentsForComputer(computerId: string): Promise<const cursorDefault = process.env.CUMORA_DEFAULT_CURSOR_MODEL?.trim() || nullconst openCodeDefault = process.env.CUMORA_DEFAULT_OPENCODE_MODEL?.trim() || nullconst piDefault = process.env.CUMORA_DEFAULT_PI_MODEL?.trim() || null+ const antigravityDefault = process.env.CUMORA_DEFAULT_ANTIGRAVITY_MODEL?.trim() || nullreturn rows.map((r) => {if (r.model) return rconst dflt = r.engine === 'codex'@@ -557,6 +562,8 @@ export async function listAgentsForComputer(computerId: string): Promise<? openCodeDefault: r.engine === 'pi'? piDefault+ : r.engine === 'antigravity'+ ? antigravityDefault: nullreturn dflt ? { ...r, model: dflt } : r})diff --git a/server/src/agents/llm-ledger.ts b/server/src/agents/llm-ledger.tsindex f9dc763..e6ec906 100644--- a/server/src/agents/llm-ledger.ts+++ b/server/src/agents/llm-ledger.ts@@ -75,7 +75,7 @@ export type LlmCallPurpose =| 'agent-image'export type LlmCallStatus = 'ok' | 'rate_limited' | 'timeout' | 'failed'-export type LlmCallSource = 'cloud' | 'byoa-claude' | 'byoa-codex' | 'byoa-grok' | 'byoa-cursor' | 'byoa-opencode' | 'byoa-pi' | 'byoa-gemini' | 'byoa-qwen'+export type LlmCallSource = 'cloud' | 'byoa-claude' | 'byoa-codex' | 'byoa-grok' | 'byoa-cursor' | 'byoa-opencode' | 'byoa-pi' | 'byoa-gemini' | 'byoa-qwen' | 'byoa-antigravity'/** Context bound to a tracked client. Every LLM call it makes carries this* shape into the ledger. `purpose` is mandatory; everything else scopes thediff --git a/server/src/agents/observability.ts b/server/src/agents/observability.tsindex b284fb1..a33ccd9 100644--- a/server/src/agents/observability.ts+++ b/server/src/agents/observability.ts@@ -4,7 +4,7 @@ import { pool } from '../db/pool.js'import { EMPTY_USAGE, effectiveCostUsd, modelPriceTable, priceFor, type TokenUsage } from './cost.js'export type AgentRunStatus = 'running' | 'completed' | 'failed' | 'skipped'-export type TriageSource = 'cloud' | 'byoa-claude' | 'byoa-codex' | 'byoa-grok' | 'byoa-cursor' | 'byoa-opencode' | 'byoa-pi' | 'byoa-gemini' | 'byoa-qwen'+export type TriageSource = 'cloud' | 'byoa-claude' | 'byoa-codex' | 'byoa-grok' | 'byoa-cursor' | 'byoa-opencode' | 'byoa-pi' | 'byoa-gemini' | 'byoa-qwen' | 'byoa-antigravity'export type AgentEventLevel = 'debug' | 'info' | 'warn' | 'error'type Queryable = Pick<PoolClient, 'query'>diff --git a/server/src/agents/runtime/byoa-source.ts b/server/src/agents/runtime/byoa-source.tsindex 2c2356e..3926185 100644--- a/server/src/agents/runtime/byoa-source.ts+++ b/server/src/agents/runtime/byoa-source.ts@@ -9,6 +9,7 @@ export const BYOA_SOURCES = ['byoa-pi','byoa-gemini','byoa-qwen',+ 'byoa-antigravity',] as constexport type ByoaSource = typeof BYOA_SOURCES[number]diff --git a/src/admin/api.ts b/src/admin/api.tsindex d650050..2ee0e3c 100644--- a/src/admin/api.ts+++ b/src/admin/api.ts@@ -120,7 +120,7 @@ export type LlmCallPurpose =| 'palette' | 'gender' | 'avatar-image' | 'agent-image'export type LlmCallStatus = 'ok' | 'rate_limited' | 'timeout' | 'failed'-export type LlmCallSource = 'cloud' | 'byoa-claude' | 'byoa-codex' | 'byoa-grok' | 'byoa-cursor' | 'byoa-opencode' | 'byoa-pi' | 'byoa-gemini' | 'byoa-qwen'+export type LlmCallSource = 'cloud' | 'byoa-claude' | 'byoa-codex' | 'byoa-grok' | 'byoa-cursor' | 'byoa-opencode' | 'byoa-pi' | 'byoa-gemini' | 'byoa-qwen' | 'byoa-antigravity'export interface LlmSummary {sinceDays: numberdiff --git a/src/api/client.ts b/src/api/client.tsindex bd85f16..33ab55c 100644--- a/src/api/client.ts+++ b/src/api/client.ts@@ -404,7 +404,7 @@ export interface ApiAgentRun {}// ── Triage cost-effectiveness ledger ──-export type ApiTriageSource = 'cloud' | 'byoa-claude' | 'byoa-codex' | 'byoa-grok' | 'byoa-cursor' | 'byoa-opencode' | 'byoa-pi' | 'byoa-gemini' | 'byoa-qwen'+export type ApiTriageSource = 'cloud' | 'byoa-claude' | 'byoa-codex' | 'byoa-grok' | 'byoa-cursor' | 'byoa-opencode' | 'byoa-pi' | 'byoa-gemini' | 'byoa-qwen' | 'byoa-antigravity'export interface ApiTriageAgentRow {agentId: stringdiff --git a/src/components/AgentEditor.tsx b/src/components/AgentEditor.tsxindex 64d39cd..26de444 100644--- a/src/components/AgentEditor.tsx+++ b/src/components/AgentEditor.tsx@@ -286,7 +286,7 @@ export function AgentEditor({ agent, onClose, onSaved }: Props) {<Fieldlabel={isByoa ? t('agent.modelLabelByoa') : t('agent.modelLabel')}hint={isByoa- ? `${t('agent.modelHintByoaPrefix')} ${selectedEngineId === 'codex' ? t('agent.modelHintByoaCodex') : selectedEngineId === 'grok' ? t('agent.modelHintByoaGrok') : selectedEngineId === 'cursor' ? t('agent.modelHintByoaCursor') : selectedEngineId === 'opencode' ? t('agent.modelHintByoaOpenCode') : selectedEngineId === 'pi' ? t('agent.modelHintByoaPi') : t('agent.modelHintByoaClaude')} ${t('agent.modelHintByoaSuffix')}`+ ? `${t('agent.modelHintByoaPrefix')} ${selectedEngineId === 'codex' ? t('agent.modelHintByoaCodex') : selectedEngineId === 'grok' ? t('agent.modelHintByoaGrok') : selectedEngineId === 'cursor' ? t('agent.modelHintByoaCursor') : selectedEngineId === 'opencode' ? t('agent.modelHintByoaOpenCode') : selectedEngineId === 'pi' ? t('agent.modelHintByoaPi') : selectedEngineId === 'gemini' ? t('agent.modelHintByoaGemini') : selectedEngineId === 'qwen' ? t('agent.modelHintByoaQwen') : selectedEngineId === 'antigravity' ? t('agent.modelHintByoaAntigravity') : t('agent.modelHintByoaClaude')} ${t('agent.modelHintByoaSuffix')}`: t('agent.modelHintCloud')}><Input@@ -312,6 +312,12 @@ export function AgentEditor({ agent, onClose, onSaved }: Props) {? t('agent.fastHintByoaOpenCode'): selectedEngineId === 'pi'? t('agent.fastHintByoaPi')+ : selectedEngineId === 'gemini'+ ? t('agent.fastHintByoaGemini')+ : selectedEngineId === 'qwen'+ ? t('agent.fastHintByoaQwen')+ : selectedEngineId === 'antigravity'+ ? t('agent.fastHintByoaAntigravity'): t('agent.fastHintByoaClaude')}><Inputdiff --git a/src/lib/engines.ts b/src/lib/engines.tsindex 4eedb84..430d16b 100644--- a/src/lib/engines.ts+++ b/src/lib/engines.ts@@ -9,6 +9,7 @@ export const ENGINE_LABEL: Record<string, string> = {pi: 'Pi',gemini: 'Gemini',qwen: 'Qwen Code',+ antigravity: 'Antigravity',hermes: 'Hermes',}@@ -22,6 +23,7 @@ export const ENGINE_BIN: Record<string, string> = {pi: 'pi',gemini: 'gemini',qwen: 'qwen',+ antigravity: 'agy',hermes: 'hermes',}@@ -33,7 +35,7 @@ export const ENGINE_BIN: Record<string, string> = {* state that holds a choice, and the set for membership tests. Engine pickers* used to inline their own copy of this list *and* their own copy of the* labels, which is how adding an engine could leave it unselectable. */-export const RUNNABLE_ENGINES = ['claude', 'codex', 'grok', 'cursor', 'opencode', 'pi', 'gemini', 'qwen'] as const+export const RUNNABLE_ENGINES = ['claude', 'codex', 'grok', 'cursor', 'opencode', 'pi', 'gemini', 'qwen', 'antigravity'] as constexport type RunnableEngineId = typeof RUNNABLE_ENGINES[number]diff --git a/src/locales/en.ts b/src/locales/en.tsindex be5e15f..56f37da 100644--- a/src/locales/en.ts+++ b/src/locales/en.ts@@ -459,6 +459,9 @@ export const en = {'agent.modelHintByoaCursor': 'A Cursor model id or alias; blank = Auto.','agent.modelHintByoaOpenCode': 'An OpenCode provider/model id (e.g. anthropic/claude-sonnet-4-6).','agent.modelHintByoaPi': 'A pi model pattern, ideally provider/id (e.g. anthropic/claude-sonnet-4-6); add :<level> to enable thinking.',+ 'agent.modelHintByoaGemini': 'A Gemini CLI model id or alias; blank = Gemini CLI default.',+ 'agent.modelHintByoaQwen': 'A Qwen Code model id or configured provider model; blank = Qwen default.',+ 'agent.modelHintByoaAntigravity': 'An exact Antigravity model name shown by `agy models` (e.g. Gemini 3.5 Flash (High)).','agent.modelHintByoaClaude': "A Claude alias or full name (e.g. opus, sonnet, claude-sonnet-4-6).",'agent.modelHintByoaSuffix': 'Blank = engine default.','agent.modelHintCloud': 'Optional — leave blank to use the system default. Any OpenAI model name works (e.g. gpt-5.5, gpt-5.5-pro, gpt-5.5-mini). Prefix with novita/ to run this agent on Novita instead (e.g. novita/deepseek/deepseek-v3.2).',@@ -468,10 +471,13 @@ export const en = {'agent.fastHintByoaCursor': 'Not used by Cursor; triage follows CUMORA_TRIAGE_MODEL on the computer. Blank = Auto.','agent.fastHintByoaOpenCode': 'Not used by OpenCode; triage follows CUMORA_TRIAGE_MODEL on the computer. Blank = OpenCode default.','agent.fastHintByoaPi': 'Not used by pi; triage follows CUMORA_TRIAGE_MODEL on the computer. Blank = pi default.',+ 'agent.fastHintByoaGemini': 'Not used by Gemini; triage follows CUMORA_TRIAGE_MODEL on the computer. Blank = Gemini default.',+ 'agent.fastHintByoaQwen': 'Not used by Qwen; triage follows CUMORA_TRIAGE_MODEL on the computer. Blank = Qwen default.',+ 'agent.fastHintByoaAntigravity': 'Not used by Antigravity; triage follows CUMORA_TRIAGE_MODEL on the computer. Blank = Antigravity default.','agent.fastHintByoaClaude': "Cheaper/faster model for light auxiliary tasks — maps to Claude's ANTHROPIC_SMALL_FAST_MODEL. Blank = engine default.",'agent.defaultPh': '(default)','agent.runsOnLabel': 'Runs on',- 'agent.runsOnHint': "Which computer executes this agent. Cumora Cloud is managed; a computer you've paired runs it on your local Claude Code, Codex, Grok Build, Cursor Agent, or OpenCode.",+ 'agent.runsOnHint': "Which computer executes this agent. Cumora Cloud is managed; a paired computer runs it through one of its detected local engines, including Claude Code, Codex, or Antigravity.",'agent.offlineSuffix': '(offline)','agent.upgradeToPro': '☁ Cumora Cloud — upgrade to Pro','agent.engineLabel': 'Engine',diff --git a/src/locales/zh-CN.ts b/src/locales/zh-CN.tsindex f4beef0..1dcaea1 100644--- a/src/locales/zh-CN.ts+++ b/src/locales/zh-CN.ts@@ -461,6 +461,9 @@ export const zhCN: Partial<Record<keyof typeof en, string>> = {'agent.modelHintByoaCursor': 'Cursor 模型 id 或别名;留空 = Auto。','agent.modelHintByoaOpenCode': 'OpenCode 的 provider/model id(例如 anthropic/claude-sonnet-4-6)。','agent.modelHintByoaPi': 'pi 的模型匹配串,建议用 provider/id(例如 anthropic/claude-sonnet-4-6);加 :<level> 后缀可开启思考。',+ 'agent.modelHintByoaGemini': 'Gemini CLI 的模型 id 或别名;留空 = Gemini CLI 默认。',+ 'agent.modelHintByoaQwen': 'Qwen Code 的模型 id 或已配置的 provider 模型;留空 = Qwen 默认。',+ 'agent.modelHintByoaAntigravity': 'Antigravity `agy models` 显示的完整模型名(例如 Gemini 3.5 Flash (High))。','agent.modelHintByoaClaude': 'Claude 别名或全名(例如 opus、sonnet、claude-sonnet-4-6)。','agent.modelHintByoaSuffix': '留空 = 使用引擎默认。','agent.modelHintCloud': '可选 — 留空使用系统默认。任意 OpenAI 模型名都可以(例如 gpt-5.5、gpt-5.5-pro、gpt-5.5-mini)。加 novita/ 前缀可改走 Novita(例如 novita/deepseek/deepseek-v3.2)。',@@ -470,10 +473,13 @@ export const zhCN: Partial<Record<keyof typeof en, string>> = {'agent.fastHintByoaCursor': 'Cursor 用不到这一项;分流跟随该计算机上的 CUMORA_TRIAGE_MODEL。留空 = Auto。','agent.fastHintByoaOpenCode': 'OpenCode 用不到这一项;分流跟随该计算机上的 CUMORA_TRIAGE_MODEL。留空 = OpenCode 默认模型。','agent.fastHintByoaPi': 'pi 用不到这一项;分流跟随该计算机上的 CUMORA_TRIAGE_MODEL。留空 = pi 默认模型。',+ 'agent.fastHintByoaGemini': 'Gemini 用不到这一项;分流跟随该计算机上的 CUMORA_TRIAGE_MODEL。留空 = Gemini 默认。',+ 'agent.fastHintByoaQwen': 'Qwen 用不到这一项;分流跟随该计算机上的 CUMORA_TRIAGE_MODEL。留空 = Qwen 默认。',+ 'agent.fastHintByoaAntigravity': 'Antigravity 用不到这一项;分流跟随该计算机上的 CUMORA_TRIAGE_MODEL。留空 = Antigravity 默认。','agent.fastHintByoaClaude': "更便宜、更快的轻量任务模型 —— 对应 Claude 的 ANTHROPIC_SMALL_FAST_MODEL。留空 = 引擎默认。",'agent.defaultPh': '(默认)','agent.runsOnLabel': '运行于',- 'agent.runsOnHint': '哪个计算机执行这个智能体。Cumora Cloud 是托管的;你已配对的计算机会在本地的 Claude Code、Codex、Grok Build、Cursor Agent 或 OpenCode 上运行。',+ 'agent.runsOnHint': '哪个计算机执行这个智能体。Cumora Cloud 是托管的;已配对的计算机会通过它检测到的本地引擎运行,包括 Claude Code、Codex 或 Antigravity。','agent.offlineSuffix': '(离线)','agent.upgradeToPro': '☁ Cumora Cloud — 升级到 Pro','agent.engineLabel': '引擎',diff --git a/src/types.ts b/src/types.tsindex 073b723..21c900e 100644--- a/src/types.ts+++ b/src/types.ts@@ -7,7 +7,7 @@ export type Status = 'avail' | 'working' | 'thinking' | 'waiting' | 'resting'export type ComputerKind = 'cloud' | 'local' | 'vps'export type ComputerStatus = 'online' | 'offline' | 'busy'/** Engine an agent's host runs it on. 'managed' = Cumora's server-side loop. */-export type EngineId = 'managed' | 'claude' | 'codex' | 'grok' | 'cursor' | 'opencode' | 'pi' | 'gemini' | 'qwen'+export type EngineId = 'managed' | 'claude' | 'codex' | 'grok' | 'cursor' | 'opencode' | 'pi' | 'gemini' | 'qwen' | 'antigravity'export interface Computer {id: string