/** * 从 main-helpers.ts 拆分出的时间线、工具状态与流式输出辅助函数 * * 这些函数仅依赖 streamStateManager, outputBuffer, permissionHandler, * questionHandler,不引用 chatSessionStore 或会话解析逻辑。 */ import { type ToolRuntimeState, type TimelineSegment, type StreamTimelineState } from '../store/stream-state.js'; import { type StreamCardSegment, type StreamCardPendingPermission, type StreamCardPendingQuestion } from '../feishu/cards-stream.js'; export declare function getPendingPermissionForChat(chatId: string): StreamCardPendingPermission | undefined; export declare function getOrCreateTimelineState(bufferKey: string): StreamTimelineState; export declare function trimTimeline(timeline: StreamTimelineState): void; export declare function upsertTimelineSegment(bufferKey: string, segmentKey: string, segment: TimelineSegment): void; export declare function appendTimelineText(bufferKey: string, segmentKey: string, type: 'text' | 'reasoning', deltaText: string): void; export declare function setTimelineText(bufferKey: string, segmentKey: string, type: 'text' | 'reasoning', text: string): void; export declare function upsertTimelineTool(bufferKey: string, toolKey: string, state: ToolRuntimeState, kind?: 'tool' | 'subtask'): void; export declare function upsertTimelineNote(bufferKey: string, noteKey: string, text: string, variant?: 'retry' | 'compaction' | 'question' | 'error' | 'permission'): void; export declare function getTimelineSegments(bufferKey: string): StreamCardSegment[]; export declare function getPendingQuestionForBuffer(sessionId: string, chatId: string): StreamCardPendingQuestion | undefined; export declare function normalizeToolStatus(status: unknown): 'pending' | 'running' | 'completed' | 'failed'; export declare function getToolStatusText(status: ToolRuntimeState['status']): string; export declare function stringifyToolOutput(value: unknown): string | undefined; export declare function asRecord(value: unknown): Record | null; export declare function pickFirstDefined(...values: unknown[]): unknown; export declare function buildToolTraceOutput(part: Record, status: ToolRuntimeState['status'], withInput: boolean): string | undefined; export declare function clipToolTrace(text: string): string; export declare function mergeToolOutput(previous: string | undefined, incoming: string | undefined): string | undefined; export declare function getOrCreateToolStateBucket(bufferKey: string): Map; export declare function syncToolsToBuffer(bufferKey: string): void; export declare function upsertToolState(bufferKey: string, toolKey: string, nextState: ToolRuntimeState, kind?: 'tool' | 'subtask'): void; export declare function markActiveToolsCompleted(bufferKey: string): void; export declare function appendTextFromPart(sessionID: string, part: { id?: unknown; text?: unknown; }, bufferKey: string): void; export declare function appendReasoningFromPart(sessionID: string, part: { id?: unknown; text?: unknown; }, bufferKey: string): void; export declare function clearPartSnapshotsForSession(sessionID: string): void; //# sourceMappingURL=main-helpers-timeline.d.ts.map