import { M as Message, A as AgentStep, U as UseAgentOptions, d as ApprovalRequest, p as UseApprovalOptions, q as UseChatOptions, T as ToolCall, m as StreamEvent, r as UseStreamingOptions } from '../types-CHPP16pW.js'; import { FormEvent } from 'react'; interface MessagesState { messages: Message[]; isLoading: boolean; error: Error | null; } type MessagesAction = { type: "ADD_MESSAGE"; message: Message; } | { type: "UPDATE_MESSAGE"; id: string; updates: Partial; } | { type: "APPEND_CONTENT"; id: string; content: string; } | { type: "SET_STATUS"; id: string; status: Message["status"]; } | { type: "REMOVE_MESSAGE"; id: string; } | { type: "SET_LOADING"; isLoading: boolean; } | { type: "SET_ERROR"; error: Error | null; } | { type: "SET_MESSAGES"; messages: Message[]; } | { type: "CLEAR"; }; declare const initialState: MessagesState; declare function messagesReducer(state: MessagesState, action: MessagesAction): MessagesState; interface UseAgentReturn { steps: AgentStep[]; currentStep: AgentStep | null; isRunning: boolean; error: Error | null; trackExecution: (executionId: string) => void; cancel: () => void; } declare function useAgent(options: UseAgentOptions): UseAgentReturn; interface UseApprovalReturn { pendingApprovals: ApprovalRequest[]; approve: (id: string, reason?: string) => Promise; reject: (id: string, reason?: string) => Promise; isDeciding: boolean; addApproval: (request: ApprovalRequest) => void; /** * Reload the pending-approval inbox from the provider. In API v2 this is the * set of executions parked at `waiting_approval` * (`provider.listApprovals`). No-op if the provider does not support it. */ refresh: () => Promise; } declare function useApproval(options: UseApprovalOptions): UseApprovalReturn; interface UseChatReturn { messages: Message[]; isLoading: boolean; error: Error | null; sendMessage: (content: string) => Promise; retry: (messageId: string) => Promise; clearMessages: () => void; setMessages: (messages: Message[]) => void; input: string; setInput: (input: string) => void; handleSubmit: (e?: FormEvent) => void; } declare function useChat(options: UseChatOptions): UseChatReturn; interface UseStreamingReturn { isStreaming: boolean; content: string; /** * Tool calls streamed so far. Each entry starts with status "running" on * tool_start and flips to "complete" on tool_end (carrying the summary * from the backend as `result`). */ toolCalls: ToolCall[]; /** Latest intermediate reasoning text emitted between tool rounds. */ thinking: string; error: Error | null; startStream: (generator: AsyncGenerator) => void; stopStream: () => void; } declare function useStreaming(options?: UseStreamingOptions): UseStreamingReturn; /** * Generate a unique client-side ID. */ declare function generateId(): string; /** * Parse a text/event-stream response into StreamEvents. */ declare function parseSSEStream(response: Response, signal?: AbortSignal): AsyncGenerator; /** * Retry a function with exponential backoff. */ declare function retryWithBackoff(fn: () => Promise, maxRetries: number, baseDelayMs?: number): Promise; export { type MessagesAction, type MessagesState, type UseAgentReturn, type UseApprovalReturn, type UseChatReturn, type UseStreamingReturn, generateId, initialState, messagesReducer, parseSSEStream, retryWithBackoff, useAgent, useApproval, useChat, useStreaming };