export interface ParsedKimiToolCall { id: string | null; name: string; arguments: unknown; } export interface ParsedKimiToolResult { toolCallId: string | null; content: string; } export interface ParsedKimiJsonl { sessionId: string | null; summary: string; toolCalls: ParsedKimiToolCall[]; toolResults: ParsedKimiToolResult[]; errorMessage: string | null; } /** * Build the run summary that Paperclip may auto-post as an issue comment. * * Kimi emits many intermediate assistant content lines during a multi-step * agent loop ("Let me check…", tool plans, etc.). Joining all of them produced * 50k+ character issue dumps. Prefer the last non-empty assistant content — * typically the final board-facing wrap-up after the last tool turn. */ export declare function buildKimiRunSummary(assistantContents: string[]): string; /** * Parse `kimi -p ... --output-format stream-json` stdout. * * Verified event shapes (kimi 0.27.0): * - {"role":"assistant","content":"..."} * - {"role":"assistant","tool_calls":[{"type":"function","id":"...","function":{"name":"...","arguments":"{...}"}}]} * - {"role":"tool","tool_call_id":"...","content":"..."} * - {"role":"meta","type":"session.resume_hint","session_id":"...","command":"kimi -r ...","content":"..."} */ export declare function parseKimiJsonl(stdout: string): ParsedKimiJsonl; export interface KimiRuntimeEvent { eventType: string; message?: string; payload?: Record; } /** * Map a single `kimi -p ... --output-format stream-json` line to live runtime * events for `onEvent`, which drive the issue-thread activity indicator * (`currentToolName` / `lastAssistantSnippet` / `lastEventAt`). * * Kimi emits complete messages in bursts with no token-level streaming, so * without this the issue thread never sees a tool name or assistant snippet and * sits on a stale "no output for N s" line while the model thinks. Tool results * are intentionally omitted so the last meaningful "Using X" / assistant snippet * is not overwritten by a generic label; the raw run-log stream keeps the * activity timer fresh across tool execution. */ export declare function extractKimiRuntimeEvents(line: string): KimiRuntimeEvent[]; export declare function isKimiSessionUnrecoverableError(stdout: string, stderr: string): boolean; export declare function isKimiTransientNetworkError(stdout: string, stderr: string): boolean; export declare function describeKimiFailure(input: { errorMessage?: string | null; stderr?: string; }): string | null; export declare function detectKimiAuthRequired(input: { stdout: string; stderr: string; }): { requiresAuth: boolean; }; //# sourceMappingURL=parse.d.ts.map