import type { ServerEvent, FinishInfo, Question, WorkerTaskState } from '@optima-chat/gateway-protocol'; import type { Conversation, ToolCall, ChatError, ApprovalRequestWithId, ConversationLastMessageKind } from '../types.js'; /** * Output of parseServerEvent — a declarative action (or list of actions) for * the caller to apply to the store + forward to consumer callbacks. Returning * `null` means the event is intentionally ignored. */ export type ParsedAction = { type: 'setSessionInfo'; sessionId: string; userId: string; provider?: string; model?: string; mode?: string; } | { type: 'setConversations'; conversations: Conversation[]; } | { type: 'setConversationPinSupported'; supported: boolean; } | { type: 'mergeConversations'; conversations: Conversation[]; } | { type: 'recovery'; conversationId: string; } | { type: 'createAssistantMessage'; conversationId: string; } | { type: 'appendContent'; conversationId: string; text: string; seq?: number; } | { type: 'appendReasoning'; conversationId: string; text: string; seq?: number; } | { type: 'addToolCall'; conversationId: string; toolCall: ToolCall; } | { type: 'updateToolCall'; conversationId: string; toolCallId: string; updates: Partial; } | { type: 'finishMessage'; conversationId: string; finish: FinishInfo; } | { type: 'setError'; error: ChatError; conversationId?: string; } | { type: 'setPendingQuestion'; requestId: string; conversationId: string; questions: Question[]; /** #161A:相对超时时长(ms),老容器无 */ timeoutMs?: number; } | { type: 'addPendingApproval'; approval: ApprovalRequestWithId; } | { type: 'updateConversationTitle'; conversationId: string; title: string; } | { type: 'updateConversationActivity'; conversationId: string; patch: { lastMessageAt: number; lastMessagePreview?: string; lastMessageKind?: ConversationLastMessageKind; messageCount?: number; }; } | { type: 'notification'; notificationType: 'info' | 'warning' | 'error'; message: string; code?: string; } | { type: 'tokenRefresh'; } | { type: 'connectionStateChange'; state: 'reconnecting' | 'connected'; } | { type: 'setThinking'; conversationId: string; } | { type: 'routeToConversationIfIdle'; conversationId: string; } | { type: 'reconcileTurnEnd'; conversationId: string; finish?: FinishInfo; } | { type: 'setRecovering'; value: boolean; } | { type: 'setCooStatus'; status: 'sleeping' | 'woke_up' | 'dispatching_worker' | 'worker_launched' | 'idle'; detail?: string; } | { type: 'upsertTask'; task: { id: string; name: string; startedAt: string; conversationId?: string; }; } | { type: 'completeTask'; id: string; patch: { completedAt: string; result: WorkerTaskState['result']; conversationId?: string; }; } | { type: 'failTask'; id: string; patch: { failedAt: string; error: string; conversationId?: string; }; } | { type: 'setSubagentProgress'; agentId: string; phase: string; detail?: string; }; /** * Parse a ServerEvent into zero or more declarative store actions. * Returns null for events that are intentionally ignored. */ export declare function parseServerEvent(event: ServerEvent, activeConversationId: string | null, sessionMode?: string, latestRestoreRequestId?: string | null): ParsedAction | ParsedAction[] | null; //# sourceMappingURL=event-parser.d.ts.map