/** * One aider invocation (monoes/monomind#383): spawn the shim (or, in the * fallback, the plain `aider` CLI), stream its output line by line and * normalize it to AiderEvent. End-of-invocation facts land in `outcome`. * * Shim mode reads the shim's own NDJSON (see aider/monomind_aider_shim.py's * header for the schema). Fallback mode scrapes aider's plain-text lines: * `Applied edit to ` / `Commit ` become start-only tool * pings, `Tokens: X sent, Y received. Cost: $a message, $b session.` becomes * usage, and litellm's auth/quota errors (which the CLI exits 0 on) become * an error. */ import type { AgentRunArgs } from './agent-runner.js'; export declare const TURN_TIMEOUT_MS: number; export type AiderEvent = { type: 'session'; session_id: string; resumed?: boolean; } | { type: 'status'; message: string; } | { type: 'text'; text: string; } | { type: 'tool_start'; id: string; name: string; kind: string; input: Record; } | { type: 'tool_end'; id: string; ok: boolean; output: string; exit_code?: number; } | { type: 'usage'; input_tokens: number; output_tokens: number; cost_usd: number; } | { type: 'error'; code: string; message: string; } | { type: 'result'; stop_reason: string; text: string; } /** Fallback only: a start-only tool ping scraped from the CLI's text. */ | { type: 'cli_tool'; name: string; }; export interface AiderOutcome { exitCode: number; stderrTail: string; timedOut: boolean; error?: { code: string; message: string; }; usage?: { input: number; output: number; usd: number; }; stopReason?: string; } export interface AiderInvocation { mode: 'shim' | 'cli'; command: string; argv: string[]; /** Written to the child's stdin, which is then closed. */ stdin: string; } /** One shim NDJSON line → event (anything else on stdout is ignored). */ export declare function parseShimLine(line: string): AiderEvent | undefined; /** `2.4k` / `1.1M` / `950` → a token count. */ export declare function parseTokenCount(s: string): number; /** One plain-CLI output line → event (fallback mode). */ export declare function parseCliLine(line: string): AiderEvent | undefined; /** * Run one invocation and yield its events as they arrive. Usage, errors * and the stop reason are also folded into `outcome`, which the caller * reads once this generator completes. */ export declare function streamAider(inv: AiderInvocation, args: AgentRunArgs, outcome: AiderOutcome): AsyncGenerator; //# sourceMappingURL=aider-runner-stream.d.ts.map