import type { AgentRunArgs } from './agent-runner.js'; import type { KimiStreamEvent } from './kimicode-runner-parse.js'; export interface TurnOutcome { sessionId?: string; exitCode: number; stderrTail: string; timedOut: boolean; } /** * Run one `kimi -p` invocation and stream its stream-json output * INCREMENTALLY: each parsed event is yielded as soon as its line arrives * on stdout (see kimicode-runner.ts's header "Streaming / liveness" note for * why buffering until process exit was a bug). End-of-turn facts (exit code, * stderr tail, final session id, timeout flag) are written into `outcome`, * which the caller reads after this generator completes. */ export declare function streamTurn(bin: string, promptText: string, sessionId: string | undefined, args: AgentRunArgs, agentFile: string | undefined, emptySkillsDir: string | undefined, outcome: TurnOutcome): AsyncGenerator; /** * Sum usage.record entries in the session's wire.jsonl written at or after * `since` (the round's start time). Timestamp filtering (not line offsets) * is what makes resume safe: a resumed session's wire file already contains * historical entries from previous processes, and those must not be * double-counted. Returns zeros when the wire file can't be found — usage * reporting must never break a turn. */ export declare function readUsageDelta(sessionId: string | undefined, env: Record, since: number): { input: number; output: number; }; /** Build the actionable error for a failed CLI turn. */ export declare function turnError(outcome: TurnOutcome, round: number, bin: string): Error; //# sourceMappingURL=kimicode-runner-stream.d.ts.map