/** Per-session cursor over the `stream_event` sequence. Cheap and self-healing: every * `message_start` resets it, so a missed line can at worst drop one block's deltas. */ export interface StreamDeltaState { /** `message.id` of the message being streamed — the first half of every blockId. */ messageId: string | null; /** Backend-reported model for the current message. */ model: string | null; /** blockId of the text block currently open, awaiting its complete `assistant` event. */ textBlockId: string | null; } export declare function createStreamDeltaState(): StreamDeltaState; /** Translate a partial stdout event into one text delta while advancing the message cursor. */ export declare function parseStreamEvent(data: any, state: StreamDeltaState): { text: string; blockId: string; } | null; /** * Consume the blockId of the streamed text block that the complete `assistant` event now being * handled belongs to. Returns null when nothing streamed (kill switch, older CLI, thinking-only * message) — the finalizing path then behaves exactly as before, without a blockId. * * Consumed once: a block's id is handed out to exactly one complete message, so a later event * can never re-adopt a stale id. */ export declare function takeTextBlockId(state: StreamDeltaState): string | null; export declare function extractAskUserQuestions(data: any, sessionId: string): Array<{ toolUseId: string | null; questions: any[]; sessionId: string; }>; export declare function formatAssistantEvent(data: any): string | null; export declare function formatUserEvent(data: any): string | null; export declare function formatResultEvent(data: any): string; export declare function formatEvent(data: any): string | null; export declare function buildPrompt(userMessage: string, files: any[]): string; /** Merge a brief epilogue with a substantially longer earlier message (e.g. an orient briefing) so Slack gets the real content. * Triggers only when final is both absolutely short (<300) AND relatively short (<50% of longest). */ export declare function mergeSubstantialOutput(finalOutput: string | null, longestOutput: string | null): string | null; export type ExtractResultOutcome = { resolved: true; value: any; error?: undefined; } | { resolved: false; error: Error; value?: undefined; }; export declare function extractResult(resultData: any, effectiveSessionId: string, killed: boolean, code: number, stderr: string, planFilePath: string | null, enteredPlanMode: boolean, exitedPlanMode: boolean, askUserQuestions: any[], finalOutput: string | null, longestOutput: string | null): ExtractResultOutcome; export declare const PLAN_DIRS: string[]; export declare function isPlanFilePath(filePath: unknown): boolean; export declare function setActivePlanFile(sessionId: string, path: string): void; export declare function clearActivePlanFile(sessionId: string): void; export declare function getCurrentPlanFilePath(sessionId: string): string | null;