/** * AntigravityAgentRunner — AgentRunner impl backed by the Antigravity CLI (`agy`). * * Architectural pattern: SAME as KimiCodeAgentRunner and CodexAgentRunner — * spawn the vendor's CLI binary as a subprocess, parse its JSONL stream, * normalize to AgentMessage. No SDK dependency (Antigravity ships a Go binary * installed via curl, plus a Python SDK; no Node SDK exists). * * Auth: inherited from the OS keyring after `agy` interactive login. Google * AI Pro / Google AI Ultra consumer subscriptions flow through this credential * cache. No env vars needed. * * Streaming / liveness — WHY INCREMENTAL: * agy turns routinely run many minutes when a role reads large dossiers or * chains tool steps. session.ts races the FIRST pull from this runner * against a 4-minute silent-stream watchdog (SILENT_SESSION_MS), so * buffering stdout until process exit (the original design) meant any turn * longer than 4 minutes yielded zero messages in time — abort, retry, kill, * circuit breaker, stalled org (observed live: "SDK stream silent for 240s * with zero messages" every ~4 minutes on antigravity roles). This runner * therefore parses stdout LINE BY LINE as data arrives: a liveness * `tool_use` message is yielded the moment the subprocess spawns * (deterministically winning the first-pull race regardless of * model-thinking latency), assistant text is yielded at agent_response DONE * boundaries, and agy's own tool steps (step_type 'tool' with tool_info) * are forwarded as rich `tool_use`/`tool_result` pairs (ACTIVE step = * start, DONE step of the same step_index = end with the tool's output, * verified live 2026-09-29) so the StateDetector/idle watchdog see a * working agent throughout the turn and agent exec gets full-fidelity * tool_activity. Tool_call fences are * still collected from the raw texts and parsed at end of turn (fence * parsing needs the complete text — agy's per-token deltas would split a * fence across many events). * * Org tools (org_send, knowledge_search, ask_human, …) — FENCE PROTOCOL: * Same approach as kimi/opencode/codex. Tools are rendered INTO the first * prompt; the model emits ```tool_call fences; this runner parses them out * of the agent_response text, executes the real OrgToolDef handlers * in-process (gated through canUseTool), and feeds results back as the * next prompt. * * Subprocess protocol (from https://antigravity.google/docs/cli/headless): * - Invocation: `agy -p "" --output-format stream-json * [--model X] [--dangerously-skip-permissions] * [--continue | --conversation ]` * - NDJSON on stdout, one event per line * - Event types: `init`, `step_update` (multiple), `result` * - step_update carries `step_type` ∈ {user_input, agent_response, tool, * checkpoint}, `state` ∈ {ACTIVE, DONE}, `text_delta` for streaming text, * `tool_info` for tool calls, `subagent_info` for subagents * - Assistant text arrives via step_update with step_type === 'agent_response' * and text_delta (per-token streaming — unlike codex which sends whole items) * - result envelope: { conversation_id, status, response, error, usage } * - status ∈ {SUCCESS, ERROR, CANCELED, INTERRUPTED, INVALID, WAITING, RUNNING} * - Resume: `--continue` (last session) or `--conversation ` (specific) * - Session ID captured from result.conversation_id * - stderr is human diagnostics; buffer and surface on non-zero exit only * - Unknown --model fails loudly (exit 1, ERROR status) * - Headless requires cached creds — must authenticate interactively first * * File-size sweep: the wire-shape types live in antigravity-runner-types.ts, * and the subprocess stream reader (streamTurn, computeSafeChunk, turnError) * lives in antigravity-runner-stream.ts — both re-exported below where other * modules import them from here. */ import type { AgentMessage, AgentRunArgs, AgentRunner } from './agent-runner.js'; export { computeSafeChunk } from './antigravity-runner-stream.js'; export declare class AntigravityAgentRunner implements AgentRunner { private agyBin?; readonly budgetFloorGated = true; constructor(agyBin?: string | undefined); run(args: AgentRunArgs): AsyncIterable; } //# sourceMappingURL=antigravity-runner.d.ts.map