/** * 流状态管理器 * * 统一管理流式响应相关的所有状态,包括: * - 内容快照 * - 工具状态 * - 时间线 * - 关联缓存 */ export type ToolRuntimeState = { name: string; status: 'pending' | 'running' | 'completed' | 'failed'; output?: string; kind?: 'tool' | 'subtask'; }; export type TimelineSegment = { type: 'text'; text: string; } | { type: 'reasoning'; text: string; } | { type: 'tool'; name: string; status: ToolRuntimeState['status']; output?: string; kind?: 'tool' | 'subtask'; } | { type: 'note'; text: string; variant?: 'retry' | 'compaction' | 'question' | 'error' | 'permission'; }; export type StreamTimelineState = { order: string[]; segments: Map; }; type ContentSnapshot = { text: string; thinking: string; }; export declare const CORRELATION_CACHE_TTL_MS: number; export declare class StreamStateManager { private streamContentMap; private reasoningSnapshotMap; private textSnapshotMap; private retryNoticeMap; private errorNoticeMap; private streamCardMessageIdsMap; private toolCallChatMap; private messageChatMap; private streamToolStateMap; private streamTimelineMap; getContent(bufferKey: string): ContentSnapshot | undefined; setContent(bufferKey: string, content: ContentSnapshot): void; getReasoningSnapshot(bufferKey: string): string | undefined; setReasoningSnapshot(bufferKey: string, snapshot: string): void; getTextSnapshot(bufferKey: string): string | undefined; setTextSnapshot(bufferKey: string, snapshot: string): void; getRetryNotice(bufferKey: string): string | undefined; setRetryNotice(bufferKey: string, notice: string): void; getErrorNotice(bufferKey: string): string | undefined; setErrorNotice(bufferKey: string, notice: string): void; getCardMessageIds(bufferKey: string): string[] | undefined; setCardMessageIds(bufferKey: string, ids: string[]): void; getChatIdByToolCall(toolCallId: string): string | undefined; setToolCallChat(toolCallId: string, chatId: string): void; getChatIdByMessage(messageId: string): string | undefined; setMessageChat(messageId: string, chatId: string): void; getToolStates(bufferKey: string): Map | undefined; setToolStates(bufferKey: string, states: Map): void; getTimeline(bufferKey: string): StreamTimelineState | undefined; getOrCreateTimeline(bufferKey: string): StreamTimelineState; trimTimeline(timeline: StreamTimelineState): void; upsertTimelineSegment(bufferKey: string, segmentKey: string, segment: TimelineSegment): void; clear(bufferKey: string): void; clearAll(): void; cleanupExpiredCorrelations(): void; } export declare const streamStateManager: StreamStateManager; export {}; //# sourceMappingURL=stream-state.d.ts.map