import type { PartDelta } from '../adapter/types.js'; import type { ChatMessage, ChatModel, Conversation, ConversationSummary, MessagePart, ProviderInfo, ProviderIssue, TokenUsage, UnreachableSession } from '../types.js'; export interface ChatState { conversations: ConversationSummary[]; currentConversation: Conversation | null; providers: ProviderInfo[]; models: ChatModel[]; unreachableSessions: UnreachableSession[]; providerIssues: ProviderIssue[]; selectedProvider: string | null; selectedAllocation: string | null; isLoading: boolean; isLoadingConversation: boolean; isLoadingModels: boolean; hasLoadedModels: boolean; modelsError: string | null; isStreaming: boolean; isThinking: boolean; streamingContent: string; streamingReasoning: string; streamingParts: MessagePart[]; streamingUsage: TokenUsage | null; thinkingStartTime: number | null; queuedMessages: ChatMessage[]; } export type ChatAction = { type: 'SET_CONVERSATIONS'; conversations: ConversationSummary[]; } | { type: 'SET_CURRENT_CONVERSATION'; conversation: Conversation | null; } | { type: 'SET_PROVIDERS'; providers: ProviderInfo[]; } | { type: 'SET_MODELS'; models: ChatModel[]; unreachableSessions?: UnreachableSession[]; providerIssues?: ProviderIssue[]; } | { type: 'SET_SELECTED_PROVIDER'; providerId: string | null; } | { type: 'SET_SELECTED_ALLOCATION'; allocation: string | null; } | { type: 'SET_LOADING'; isLoading: boolean; } | { type: 'SET_LOADING_MODELS'; isLoadingModels: boolean; } | { type: 'SET_MODELS_ERROR'; error: string | null; } | { type: 'SET_STREAMING'; isStreaming: boolean; conversationId?: string; } | { type: 'APPEND_STREAMING_CONTENT'; content: string; conversationId: string; } | { type: 'APPEND_STREAMING_REASONING'; reasoning: string; conversationId: string; } | { type: 'APPLY_STREAMING_PART'; delta: PartDelta; conversationId: string; } | { type: 'CLEAR_STREAMING_CONTENT'; conversationId?: string; } | { type: 'SET_STREAMING_USAGE'; usage: TokenUsage; conversationId: string; } | { type: 'ADD_MESSAGE'; message: ChatMessage; conversationId: string; } | { type: 'UPDATE_MESSAGE'; messageId: string; updates: Partial; conversationId: string; } | { type: 'ADD_CONVERSATION'; conversation: ConversationSummary; } | { type: 'REMOVE_CONVERSATION'; conversationId: string; } | { type: 'SET_LOADING_CONVERSATION'; isLoadingConversation: boolean; } | { type: 'RESTORE_BACKGROUND_STREAM'; content: string; reasoning: string; parts?: MessagePart[]; } | { type: 'ADD_QUEUED_MESSAGE'; message: ChatMessage; conversationId?: string; } | { type: 'REMOVE_QUEUED_MESSAGE'; id: string; } | { type: 'CLEAR_QUEUED_MESSAGES'; }; export declare const initialState: ChatState; export declare function chatReducer(state: ChatState, action: ChatAction): ChatState;