import type { AgentRunArgs } from './agent-runner.js'; import type { AgyStreamEvent, TurnOutcome } from './antigravity-runner-types.js'; /** * Fence-boundary-aware incremental streaming cursor. Given the full text * accumulated so far for one in-progress agent_response step and how much * of it (from the start) has already been surfaced as visible text, returns * the additional prefix that is now also safe to surface, plus the new * high-water mark to pass back in on the next call. * * "Safe" means: never any part of an unclosed ```tool_call fence (its * content must never reach the user, complete or not — same as * TOOL_CALL_RE's own stripping), and never a trailing partial match of the * "```tool_call" opening marker itself, which could still complete into a * real fence as more text arrives on the next call. A complete fence found * along the way is skipped in its entirety — scanning resumes right after * its closing ``` — so the fence never appears in the returned chunk. * * Pure and only ever reads forward from flushedUpTo, so calling it once * per accumulated string or once per tiny incremental slice (as real * per-token deltas arrive) converges on the identical assembled output — * exercised directly in this file's own test suite. */ export declare function computeSafeChunk(text: string, flushedUpTo: number): { chunk: string; safeEnd: number; }; /** * Run one `agy` invocation and stream its stream-json output * INCREMENTALLY: each parsed event is yielded as soon as its line arrives * on stdout (see antigravity-runner.ts's header "Streaming / liveness" note * for why buffering until process exit was a bug). End-of-turn facts (exit * code, stderr tail, conversation id, usage, error, timeout flag) are * written into `outcome`, which the caller reads after this generator * completes. */ export declare function streamTurn(bin: string, prompt: string, conversationId: string | undefined, args: AgentRunArgs, outcome: TurnOutcome): AsyncGenerator; /** Build the actionable error for a failed agy turn. */ export declare function turnError(outcome: TurnOutcome, round: number, _bin: string): Error; //# sourceMappingURL=antigravity-runner-stream.d.ts.map