import { Client, StreamMode } from "@langchain/langgraph-sdk"; import { StandardSchemaV1 } from "@standard-schema/spec"; import { ComponentType, PropsWithChildren } from "react"; type AddToolResultOptions = { messageId: string; toolName: string; toolCallId: string; result: ReadonlyJSONValue; isError: boolean; artifact?: ReadonlyJSONValue | undefined; modelContent?: readonly ToolModelContentPart[] | undefined; }; type AppendMessage = Omit & { parentId: string | null; sourceId: string | null; runConfig: RunConfig | undefined; startRun?: boolean | undefined; steer?: boolean | undefined; }; type AsNumber = K extends `${infer N extends number}` ? N | K : never; declare class AssistantCloud { readonly threads: AssistantCloudThreads; readonly auth: { tokens: AssistantCloudAuthTokens; }; readonly runs: AssistantCloudRuns; readonly files: AssistantCloudFiles; readonly telemetry: AssistantCloudTelemetryConfig; constructor(config: AssistantCloudConfig); } declare class AssistantCloudAPI { _auth: AssistantCloudAuthStrategy; _baseUrl: string; constructor(config: AssistantCloudConfig); initializeAuth(): Promise; makeRawRequest(endpoint: string, options?: MakeRequestOptions): Promise; makeRequest(endpoint: string, options?: MakeRequestOptions): Promise; } type AssistantCloudAuthStrategy = { readonly strategy: "anon" | "api-key" | "jwt"; getAuthHeaders(): Promise | false>; readAuthHeaders(headers: Headers): void; }; declare class AssistantCloudAuthTokens { private cloud; constructor(cloud: AssistantCloudAPI); create(): Promise; } type AssistantCloudAuthTokensCreateResponse = { token: string; }; type AssistantCloudConfig = ({ baseUrl: string; authToken: () => Promise; } | { baseUrl?: string; apiKey: string; userId: string; workspaceId: string; } | { baseUrl: string; anonymous: true; }) & { telemetry?: boolean | AssistantCloudTelemetryConfig; }; declare class AssistantCloudFiles { private cloud; constructor(cloud: AssistantCloudAPI); pdfToImages(body: PdfToImagesRequestBody): Promise; generatePresignedUploadUrl(body: GeneratePresignedUploadUrlRequestBody): Promise; } type AssistantCloudMessageCreateResponse = { message_id: string; }; type AssistantCloudRunReport = { thread_id: string; status: "completed" | "error" | "incomplete"; total_steps?: number; tool_calls?: ReportToolCall[]; steps?: { input_tokens?: number; output_tokens?: number; reasoning_tokens?: number; cached_input_tokens?: number; tool_calls?: ReportToolCall[]; start_ms?: number; end_ms?: number; }[]; input_tokens?: number; output_tokens?: number; reasoning_tokens?: number; cached_input_tokens?: number; model_id?: string; provider_type?: string; duration_ms?: number; output_text?: string; metadata?: Record; }; declare class AssistantCloudRuns { private cloud; constructor(cloud: AssistantCloudAPI); __internal_getAssistantOptions(assistantId: string): { api: string; headers: () => Promise<{ Accept: string; }>; body: { assistant_id: string; response_format: string; thread_id: string; }; }; stream(body: AssistantCloudRunsStreamBody): Promise; report(body: AssistantCloudRunReport): Promise<{ run_id: string; }>; } type AssistantCloudRunsStreamBody = { thread_id: string; assistant_id: "system/thread_title"; messages: readonly unknown[]; }; type AssistantCloudTelemetryConfig = { enabled?: boolean; beforeReport?: (report: AssistantCloudRunReport) => AssistantCloudRunReport | null; }; type AssistantCloudThreadMessageCreateBody = { parent_id: string | null; format: "aui/v0" | string; content: ReadonlyJSONObject; }; type AssistantCloudThreadMessageListQuery = { format?: string; }; type AssistantCloudThreadMessageListResponse = { messages: CloudMessage[]; }; type AssistantCloudThreadMessageUpdateBody = { content: ReadonlyJSONObject; }; declare class AssistantCloudThreadMessages { private cloud; constructor(cloud: AssistantCloudAPI); list(threadId: string, query?: AssistantCloudThreadMessageListQuery): Promise; create(threadId: string, body: AssistantCloudThreadMessageCreateBody): Promise; update(threadId: string, messageId: string, body: AssistantCloudThreadMessageUpdateBody): Promise; } declare class AssistantCloudThreads { private cloud; readonly messages: AssistantCloudThreadMessages; constructor(cloud: AssistantCloudAPI); list(query?: AssistantCloudThreadsListQuery): Promise; get(threadId: string): Promise; create(body: AssistantCloudThreadsCreateBody): Promise; update(threadId: string, body: AssistantCloudThreadsUpdateBody): Promise; delete(threadId: string): Promise; } type AssistantCloudThreadsCreateBody = { title?: string | undefined; last_message_at: Date; metadata?: unknown | undefined; external_id?: string | undefined; }; type AssistantCloudThreadsCreateResponse = { thread_id: string; }; type AssistantCloudThreadsListQuery = { is_archived?: boolean; limit?: number; after?: string; }; type AssistantCloudThreadsListResponse = { threads: CloudThread[]; }; type AssistantCloudThreadsUpdateBody = { title?: string | undefined; last_message_at?: Date | undefined; metadata?: unknown | undefined; is_archived?: boolean | undefined; }; type AssistantMessageContent = string | AssistantMessageContentComplex[]; type AssistantMessageContentComplex = MessageContentText | MessageContentImageUrl | MessageContentToolUse | MessageContentFile | MessageContentReasoning | MessageContentThinking | MessageContentComputerCall; type AssistantRuntime = { readonly threads: ThreadListRuntime; readonly thread: ThreadRuntime; registerModelContextProvider(provider: ModelContextProvider): Unsubscribe; }; type AssistantStream = ReadableStream; declare const AssistantStream: { toResponse(stream: AssistantStream, transformer: AssistantStreamEncoder): Response; fromResponse(response: Response, transformer: ReadableWritablePair>): ReadableStream; toByteStream(stream: AssistantStream, transformer: ReadableWritablePair, AssistantStreamChunk>): ReadableStream>; fromByteStream(readable: ReadableStream>, transformer: ReadableWritablePair>): ReadableStream; }; type AssistantStreamChunk = { readonly path: readonly number[]; } & ({ readonly type: "part-start"; readonly part: PartInit; } | { readonly type: "part-finish"; } | { readonly type: "tool-call-args-text-finish"; } | { readonly type: "text-delta"; readonly textDelta: string; } | { readonly type: "annotations"; readonly annotations: ReadonlyJSONValue[]; } | { readonly type: "data"; readonly data: ReadonlyJSONValue[]; } | { readonly type: "step-start"; readonly messageId: string; } | { readonly type: "step-finish"; readonly finishReason: "content-filter" | "error" | "length" | "other" | "stop" | "tool-calls" | "unknown"; readonly usage: { readonly inputTokens: number; readonly outputTokens: number; }; readonly isContinued: boolean; } | { readonly type: "message-finish"; readonly finishReason: "content-filter" | "error" | "length" | "other" | "stop" | "tool-calls" | "unknown"; readonly usage: { readonly inputTokens: number; readonly outputTokens: number; }; } | { readonly type: "result"; readonly artifact?: ReadonlyJSONValue; readonly result: ReadonlyJSONValue; readonly isError: boolean; readonly modelContent?: readonly ToolModelContentPart[]; readonly messages?: ReadonlyJSONValue; } | { readonly type: "error"; readonly error: string; } | { readonly type: "update-state"; readonly operations: ObjectStreamOperation[]; }); type AssistantStreamEncoder = ReadableWritablePair, AssistantStreamChunk> & { headers?: Headers; }; type AsyncIterableStream = AsyncIterable & ReadableStream; type Attachment = PendingAttachment | CompleteAttachment; type AttachmentAdapter = { accept: string; add(state: { file: File; }): Promise | AsyncGenerator; remove(attachment: Attachment): Promise; send(attachment: PendingAttachment): Promise; }; type AttachmentAddErrorEvent = { readonly reason: AttachmentAddErrorReason; readonly message: string; readonly attachmentId?: string; readonly error?: Error; }; type AttachmentAddErrorReason = "adapter-error" | "no-adapter" | "not-accepted"; type AttachmentRuntime = { readonly path: AttachmentRuntimePath & { attachmentSource: TSource; }; readonly source: TSource; getState(): AttachmentState & { source: TSource; }; remove(): Promise; subscribe(callback: () => void): Unsubscribe; }; type AttachmentRuntimePath = ((MessageRuntimePath & { readonly attachmentSource: "edit-composer" | "message"; }) | (ThreadRuntimePath & { readonly attachmentSource: "thread-composer"; })) & { readonly attachmentSelector: { readonly type: "index"; readonly index: number; } | { readonly type: "index"; readonly index: number; } | { readonly type: "index"; readonly index: number; }; }; type AttachmentRuntimeSource = AttachmentState["source"]; type AttachmentState = ThreadComposerAttachmentState | EditComposerAttachmentState | MessageAttachmentState; type BackendTool = Record, TResult = unknown> = ToolBase & { type: "backend"; description?: undefined; parameters?: undefined; disabled?: undefined; execute?: undefined; toModelOutput?: undefined; experimental_onSchemaValidationError?: undefined; providerOptions?: undefined; }; type BaseAttachment = { id: string; type: "image" | "document" | "file" | (string & {}); name: string; contentType?: string | undefined; file?: File; content?: ThreadUserMessagePart[]; }; type BaseComposerState = { readonly canCancel: boolean; readonly canSend: boolean; readonly isEditing: boolean; readonly isEmpty: boolean; readonly text: string; readonly role: MessageRole; readonly attachments: readonly Attachment[]; readonly runConfig: RunConfig; readonly attachmentAccept: string; readonly dictation: DictationState | undefined; readonly quote: QuoteInfo | undefined; readonly queue: readonly QueueItemState[]; }; type BaseThreadMessage = { readonly status?: ThreadAssistantMessage["status"]; readonly metadata: { readonly unstable_state?: ReadonlyJSONValue; readonly unstable_annotations?: readonly ReadonlyJSONValue[]; readonly unstable_data?: readonly ReadonlyJSONValue[]; readonly steps?: readonly ThreadStep[]; readonly submittedFeedback?: { readonly type: "negative" | "positive"; }; readonly timing?: MessageTiming; readonly isOptimistic?: boolean; readonly custom: Record; }; readonly attachments?: ThreadUserMessage["attachments"]; }; type ChatModelRunOptions = { readonly messages: readonly ThreadMessage[]; readonly runConfig: RunConfig; readonly abortSignal: AbortSignal; readonly context: ModelContext; readonly unstable_assistantMessageId?: string | undefined; readonly unstable_threadId?: string | undefined; readonly unstable_parentId?: string | null | undefined; unstable_getMessage(): ThreadMessage; }; type ChatModelRunResult = { readonly content?: readonly ThreadAssistantMessagePart[] | undefined; readonly status?: MessageStatus | undefined; readonly metadata?: { readonly unstable_state?: ReadonlyJSONValue; readonly unstable_annotations?: readonly ReadonlyJSONValue[] | undefined; readonly unstable_data?: readonly ReadonlyJSONValue[] | undefined; readonly steps?: readonly ThreadStep[] | undefined; readonly timing?: MessageTiming | undefined; readonly custom?: Record | undefined; }; }; type CloudMessage = { id: string; parent_id: string | null; height: number; created_at: Date; updated_at: Date; format: "aui/v0" | string; content: ReadonlyJSONObject; }; type CloudThread = { title: string; last_message_at: Date; metadata: unknown; external_id: string | null; id: string; project_id: string; created_at: Date; updated_at: Date; workspace_id: string; is_archived: boolean; }; type CompleteAttachment = BaseAttachment & { status: CompleteAttachmentStatus; content: ThreadUserMessagePart[]; }; type CompleteAttachmentStatus = { type: "complete"; }; type ComposerRuntime = { readonly path: ComposerRuntimePath; readonly type: "edit" | "thread"; getState(): ComposerState; addAttachment(fileOrAttachment: File | CreateAttachment): Promise; setText(text: string): void; setRole(role: MessageRole): void; setRunConfig(runConfig: RunConfig): void; reset(): Promise; clearAttachments(): Promise; send(options?: SendOptions): void; cancel(): void; steerQueueItem(queueItemId: string): void; removeQueueItem(queueItemId: string): void; subscribe(callback: () => void): Unsubscribe; getAttachmentByIndex(idx: number): AttachmentRuntime; startDictation(): void; stopDictation(): void; setQuote(quote: QuoteInfo | undefined): void; unstable_on(event: E, callback: ComposerRuntimeEventCallback): Unsubscribe; }; type ComposerRuntimeEventCallback = (payload: ComposerRuntimeEventPayload[E]) => void; type ComposerRuntimeEventPayload = { send: Record; attachmentAdd: Record; attachmentAddError: AttachmentAddErrorEvent; }; type ComposerRuntimeEventType = keyof ComposerRuntimeEventPayload; type ComposerRuntimePath = (ThreadRuntimePath & { readonly composerSource: "thread"; }) | (MessageRuntimePath & { readonly composerSource: "edit"; }); type ComposerState = ThreadComposerState | EditComposerState; type CreateAppendMessage = string | { parentId?: string | null | undefined; sourceId?: string | null | undefined; role?: AppendMessage["role"] | undefined; content: AppendMessage["content"]; attachments?: AppendMessage["attachments"] | undefined; metadata?: AppendMessage["metadata"] | undefined; createdAt?: Date | undefined; runConfig?: AppendMessage["runConfig"] | undefined; startRun?: boolean | undefined; }; type CreateAttachment = { id?: string; type?: "image" | "document" | "file" | (string & {}); name: string; contentType?: string; content: ThreadUserMessagePart[]; }; type CreateLangGraphStreamOptions = { client: LangGraphStreamClient; assistantId: string; streamMode?: StreamMode | StreamMode[]; onDisconnect?: StreamPayload["onDisconnect"]; }; type CreateResumeRunConfig = CreateStartRunConfig & { stream?: (options: ChatModelRunOptions) => AsyncGenerator; }; type CreateStartRunConfig = { parentId: string | null; sourceId?: string | null | undefined; runConfig?: RunConfig | undefined; }; type CustomEventType = string; type DataMessagePart = { readonly type: "data"; readonly name: string; readonly data: T; }; type DataMessagePartComponent = ComponentType>; type DataMessagePartProps = MessagePartState & DataMessagePart; type DataPrefixedPart = { readonly type: `data-${string}`; readonly data: any; }; type DeepPartial = T extends readonly any[] ? readonly DeepPartial[] : T extends { [key: string]: any; } ? { readonly [K in keyof T]?: DeepPartial; } : T; declare namespace DictationAdapter { type Status = { type: "running" | "starting"; } | { type: "ended"; reason: "cancelled" | "error" | "stopped"; }; type Result = { transcript: string; isFinal?: boolean; }; type Session = { status: Status; stop: () => Promise; cancel: () => void; onSpeechStart: (callback: () => void) => Unsubscribe; onSpeechEnd: (callback: (result: Result) => void) => Unsubscribe; onSpeech: (callback: (result: Result) => void) => Unsubscribe; }; } type DictationAdapter = { listen: () => DictationAdapter.Session; disableInputDuringDictation?: boolean; }; type DictationState = { readonly status: DictationAdapter.Status; readonly transcript?: string; readonly inputDisabled?: boolean; }; type EditComposerAttachmentState = Attachment & { readonly source: "edit-composer"; }; type EditComposerRuntime = Omit & { readonly path: ComposerRuntimePath & { composerSource: "edit"; }; readonly type: "edit"; getState(): EditComposerState; beginEdit(): void; getAttachmentByIndex(idx: number): AttachmentRuntime & { source: "edit-composer"; }; }; type EditComposerState = BaseComposerState & { readonly type: "edit"; readonly parentId: string | null; readonly sourceId: string | null; }; type EventType = LangGraphKnownEventTypes | CustomEventType; type ExportedMessageRepository = { headId?: string | null; messages: Array<{ message: ThreadMessage; parentId: string | null; runConfig?: RunConfig; }>; }; declare const ExportedMessageRepository: { fromArray: (messages: readonly ThreadMessageLike[]) => ExportedMessageRepository; fromBranchableArray: (items: readonly { message: ThreadMessageLike; parentId: string | null; }[], options?: { headId?: string | null; }) => ExportedMessageRepository; }; type ExternalStoreAdapter = ExternalStoreAdapterBase & (T extends ThreadMessage ? object : ExternalStoreMessageConverterAdapter); type ExternalStoreAdapterBase = { isDisabled?: boolean | undefined; isSendDisabled?: boolean | undefined; isRunning?: boolean | undefined; isLoading?: boolean | undefined; messages?: readonly T[]; messageRepository?: ExportedMessageRepository; suggestions?: readonly ThreadSuggestion[] | undefined; state?: ReadonlyJSONValue | undefined; extras?: unknown; setMessages?: ((messages: readonly T[]) => void) | undefined; unstable_onBranchChange?: ((event: ExternalStoreBranchChange) => void) | undefined; onImport?: ((messages: readonly ThreadMessage[]) => void) | undefined; onExportExternalState?: (() => any) | undefined; onLoadExternalState?: ((state: any) => void) | undefined; onNew: (message: AppendMessage) => Promise; queue?: ExternalThreadQueueAdapter | undefined; onEdit?: ((message: AppendMessage) => Promise) | undefined; onDelete?: ((messageId: string) => Promise | void) | undefined; onReload?: ((parentId: string | null, config: StartRunConfig) => Promise) | undefined; onResume?: ((config: ResumeRunConfig) => Promise) | undefined; onCancel?: (() => Promise) | undefined; onAddToolResult?: ((options: AddToolResultOptions) => Promise | void) | undefined; onResumeToolCall?: ((options: { toolCallId: string; payload: unknown; }) => void) | undefined; onRespondToToolApproval?: ((options: RespondToToolApprovalOptions) => Promise | void) | undefined; convertMessage?: ExternalStoreMessageConverter | undefined; adapters?: { attachments?: AttachmentAdapter | undefined; speech?: SpeechSynthesisAdapter | undefined; dictation?: DictationAdapter | undefined; voice?: RealtimeVoiceAdapter | undefined; feedback?: FeedbackAdapter | undefined; threadList?: ExternalStoreThreadListAdapter | undefined; } | undefined; unstable_capabilities?: { copy?: boolean | undefined; } | undefined; unstable_enableToolInvocations?: boolean | undefined; setToolStatuses?: ((statuses: Record) => void) | undefined; }; type ExternalStoreBranchChange = { headId: string | null; visibleMessageIds: readonly string[]; }; type ExternalStoreMessageConverter = (message: T, idx: number) => ThreadMessageLike; type ExternalStoreMessageConverterAdapter = { convertMessage: ExternalStoreMessageConverter; }; type ExternalStoreSharedOptions = Pick; type ExternalStoreThreadData = { status: TState; id: string; remoteId?: string | undefined; externalId?: string | undefined; title?: string | undefined; custom?: Record | undefined; }; type ExternalStoreThreadListAdapter = { threadId?: string | undefined; isLoading?: boolean | undefined; threads?: readonly ExternalStoreThreadData<"regular">[] | undefined; archivedThreads?: readonly ExternalStoreThreadData<"archived">[] | undefined; onSwitchToNewThread?: (() => Promise | void) | undefined; onSwitchToThread?: ((threadId: string) => Promise | void) | undefined; onRename?: (threadId: string, newTitle: string) => (Promise | void) | undefined; onUpdateCustom?: ((threadId: string, custom: Record | undefined) => Promise | void) | undefined; onArchive?: ((threadId: string) => Promise | void) | undefined; onUnarchive?: ((threadId: string) => Promise | void) | undefined; onDelete?: ((threadId: string) => Promise | void) | undefined; }; type ExternalThreadQueueAdapter = { items: readonly QueueItemState[]; enqueue: (message: AppendMessage, options: { steer: boolean; }) => void; steer: (queueItemId: string) => void; remove: (queueItemId: string) => void; clear: (reason: "cancel-run" | "edit" | "reload") => void; }; type FeedbackAdapter = { submit: (feedback: FeedbackAdapterFeedback) => void; }; type FeedbackAdapterFeedback = { message: ThreadMessage; type: "negative" | "positive"; }; type FileMessagePart = { readonly type: "file"; readonly filename?: string; readonly data: string; readonly mimeType: string; readonly parentId?: string; }; type FrontendTool = Record, TResult = unknown> = ToolBase & { type: "frontend"; description?: string | undefined; parameters: StandardSchemaV1 | JSONSchema7; disabled?: boolean; execute?: ToolExecuteFunction; toModelOutput?: ToolModelOutputFunction; experimental_onSchemaValidationError?: OnSchemaValidationErrorFunction; providerOptions?: ProviderOptions; }; type GeneratePresignedUploadUrlRequestBody = { filename: string; }; type GeneratePresignedUploadUrlResponse = { success: boolean; signedUrl: string; expiresAt: string; publicUrl: string; }; type GenerativeUIMessagePart = { readonly type: "generative-ui"; readonly spec: GenerativeUISpec; readonly id?: string; readonly parentId?: string; }; type GenerativeUINode = string | { readonly component: string; readonly props?: Record; readonly children?: readonly GenerativeUINode[]; readonly key?: string; }; type GenerativeUISpec = { readonly root: GenerativeUINode | readonly GenerativeUINode[]; }; type HumanTool = Record, TResult = unknown> = ToolBase & { type: "human"; description?: string | undefined; parameters: StandardSchemaV1 | JSONSchema7; disabled?: boolean; display?: "standalone"; execute?: undefined; toModelOutput?: undefined; experimental_onSchemaValidationError?: undefined; providerOptions?: ProviderOptions; }; type ImageMessagePart = { readonly type: "image"; readonly image: string; readonly filename?: string; }; interface JSONSchema7 { $id?: string | undefined; $ref?: string | undefined; $schema?: JSONSchema7Version | undefined; $comment?: string | undefined; $defs?: { [key: string]: JSONSchema7Definition; } | undefined; type?: JSONSchema7TypeName | JSONSchema7TypeName[] | undefined; enum?: JSONSchema7Type[] | undefined; const?: JSONSchema7Type | undefined; multipleOf?: number | undefined; maximum?: number | undefined; exclusiveMaximum?: number | undefined; minimum?: number | undefined; exclusiveMinimum?: number | undefined; maxLength?: number | undefined; minLength?: number | undefined; pattern?: string | undefined; items?: JSONSchema7Definition | JSONSchema7Definition[] | undefined; additionalItems?: JSONSchema7Definition | undefined; maxItems?: number | undefined; minItems?: number | undefined; uniqueItems?: boolean | undefined; contains?: JSONSchema7Definition | undefined; maxProperties?: number | undefined; minProperties?: number | undefined; required?: string[] | undefined; properties?: { [key: string]: JSONSchema7Definition; } | undefined; patternProperties?: { [key: string]: JSONSchema7Definition; } | undefined; additionalProperties?: JSONSchema7Definition | undefined; dependencies?: { [key: string]: JSONSchema7Definition | string[]; } | undefined; propertyNames?: JSONSchema7Definition | undefined; if?: JSONSchema7Definition | undefined; then?: JSONSchema7Definition | undefined; else?: JSONSchema7Definition | undefined; allOf?: JSONSchema7Definition[] | undefined; anyOf?: JSONSchema7Definition[] | undefined; oneOf?: JSONSchema7Definition[] | undefined; not?: JSONSchema7Definition | undefined; format?: string | undefined; contentMediaType?: string | undefined; contentEncoding?: string | undefined; definitions?: { [key: string]: JSONSchema7Definition; } | undefined; title?: string | undefined; description?: string | undefined; default?: JSONSchema7Type | undefined; readOnly?: boolean | undefined; writeOnly?: boolean | undefined; examples?: JSONSchema7Type | undefined; } interface JSONSchema7Array extends Array { } type JSONSchema7Definition = JSONSchema7 | boolean; interface JSONSchema7Object { [key: string]: JSONSchema7Type; } type JSONSchema7Type = string | number | boolean | JSONSchema7Object | JSONSchema7Array | null; type JSONSchema7TypeName = "array" | "boolean" | "integer" | "null" | "number" | "object" | "string"; type JSONSchema7Version = string; type JoinStrategy = "concat-content" | "none"; type LangChainEvent = { event: LangGraphKnownEventTypes.MessagesPartial | LangGraphKnownEventTypes.MessagesComplete; data: LangChainMessage[]; }; type LangChainMessage = { id?: string; type: "system"; content: string; additional_kwargs?: Record; } | { id?: string; type: "human"; content: UserMessageContent; additional_kwargs?: Record; } | { id?: string; type: "tool"; content: string; tool_call_id: string; name: string; artifact?: any; status: "error" | "success"; } | { id?: string; type: "ai"; content: AssistantMessageContent; tool_call_chunks?: LangChainToolCallChunk[]; tool_calls?: LangChainToolCall[]; status?: MessageStatus; additional_kwargs?: { reasoning?: MessageContentReasoning; tool_outputs?: MessageContentComputerCall[]; metadata?: Record; }; }; type LangChainMessageChunk = { id?: string | undefined; type: "AIMessageChunk"; content?: AssistantMessageContent | undefined; tool_call_chunks?: LangChainToolCallChunk[] | undefined; }; type LangChainToolCall = { index?: number; id: string; name: string; args: ReadonlyJSONObject; partial_json?: string; }; type LangChainToolCallChunk = { index: number; id: string; name: string; args?: string; args_json?: string; }; type LangGraphCommand = { resume: string; }; type LangGraphInterruptState = { value?: any; resumable?: boolean; when?: string; ns?: string[]; }; declare enum LangGraphKnownEventTypes { Messages = "messages", MessagesPartial = "messages/partial", MessagesComplete = "messages/complete", Metadata = "metadata", Updates = "updates", Values = "values", Info = "info", Error = "error" } declare class LangGraphMessageAccumulator { private messagesMap; private metadataMap; private uiMessages; private appendMessage; constructor(_param0?: LangGraphStateAccumulatorConfig); private ensureMessageId; addMessages(newMessages: TMessage[]): TMessage[]; addMessageWithMetadata(message: TMessage, metadata: LangGraphTupleMetadata): TMessage[]; getMessages(): TMessage[]; getMetadataMap(): Map; replaceMessages(newMessages: TMessage[]): TMessage[]; reconcileMessages(serverMessages: TMessage[]): TMessage[]; applyUIUpdate(update: UIMessage | RemoveUIMessage | readonly (UIMessage | RemoveUIMessage)[]): UIMessage[]; replaceUIMessages(newUIMessages: UIMessage[]): UIMessage[]; getUIMessages(): UIMessage[]; clear(): void; } type LangGraphMessagesEvent = { event: EventType; data: TMessage[] | any; }; type LangGraphSendMessageConfig = { command?: LangGraphCommand; runConfig?: unknown; checkpointId?: string; }; type LangGraphStateAccumulatorConfig = { initialMessages?: TMessage[]; initialUIMessages?: UIMessage[]; appendMessage?: (prev: TMessage | undefined, curr: TMessage) => TMessage; }; type LangGraphStreamCallback = (messages: TMessage[], config: LangGraphSendMessageConfig & { abortSignal: AbortSignal; initialize: () => Promise<{ remoteId: string; externalId: string | undefined; }>; }) => Promise>> | AsyncGenerator>; type LangGraphStreamClient = { runs: Pick; }; type LangGraphTupleMetadata = Record; type LanguageModelConfig = { apiKey?: string; baseUrl?: string; modelName?: string; reasoningEffort?: string; }; type LanguageModelV1CallSettings = { maxTokens?: number; temperature?: number; topP?: number; presencePenalty?: number; frequencyPenalty?: number; seed?: number; headers?: Record; }; type MakeRequestOptions = { method?: "POST" | "PUT" | "DELETE" | undefined; headers?: Record | undefined; query?: Record | undefined; body?: object | undefined; }; type McpAppMetadata = { readonly resourceUri: string; readonly mimeType?: string; readonly visibility?: readonly ("app" | "model")[]; }; type McpServerConfig = { type: "http" | "sse"; url: string; headers?: Record; redirect?: "error" | "follow"; connectionTimeout?: number | undefined; } | { type: "stdio"; command: string; args?: readonly string[]; env?: Record; cwd?: string; connectionTimeout?: number | undefined; }; type McpTool = ToolBase, unknown> & { type: "mcp"; server: McpServerConfig; description?: undefined; parameters?: undefined; disabled?: boolean; execute?: undefined; toModelOutput?: undefined; experimental_onSchemaValidationError?: undefined; providerOptions?: undefined; }; type MessageAttachmentState = CompleteAttachment & { readonly source: "message"; }; type MessageCommonProps = { readonly id: string; readonly createdAt: Date; }; type MessageContentComputerCall = { type: "computer_call"; call_id: string; id: string; action: unknown; pending_safety_checks: unknown[]; index: number; }; type MessageContentFile = { type: "file"; data: string; mime_type: string; source_type?: "base64"; metadata?: { filename?: string; }; } | { type: "file"; url: string; mime_type?: string; source_type: "url"; metadata?: { filename?: string; }; } | { type: "file"; id: string; mime_type?: string; source_type: "id"; metadata?: { filename?: string; }; }; type MessageContentImageUrl = { type: "image_url"; image_url: string | { url?: string; }; }; type MessageContentReasoning = { type: "reasoning"; summary?: MessageContentReasoningSummaryText[]; reasoning?: string; }; type MessageContentReasoningSummaryText = { type: "summary_text"; text?: string; }; type MessageContentText = { type: "text" | "text_delta"; text: string; }; type MessageContentThinking = { type: "thinking"; thinking: string; }; type MessageContentToolUse = { type: "input_json_delta" | "tool_use"; }; type MessagePartRuntime = { addToolResult(result: any | ToolResponse): void; resumeToolCall(payload: unknown): void; respondToToolApproval(response: ToolApprovalResponse): void; readonly path: MessagePartRuntimePath; getState(): MessagePartState; subscribe(callback: () => void): Unsubscribe; }; type MessagePartRuntimePath = MessageRuntimePath & { readonly messagePartSelector: { readonly type: "index"; readonly index: number; } | { readonly type: "toolCallId"; readonly toolCallId: string; }; }; type MessagePartState = (ThreadUserMessagePart | ThreadAssistantMessagePart) & { readonly status: MessagePartStatus | ToolCallMessagePartStatus; }; type MessagePartStatus = { readonly type: "running"; } | { readonly type: "complete"; } | { readonly type: "incomplete"; readonly reason: "cancelled" | "content-filter" | "error" | "length" | "other"; readonly error?: unknown; }; type MessageRole = ThreadMessage["role"]; type MessageRuntime = { readonly path: MessageRuntimePath; readonly composer: EditComposerRuntime; getState(): MessageState; delete(): void | Promise; reload(config?: ReloadConfig): void; speak(): void; stopSpeaking(): void; submitFeedback(_param1: { type: "positive" | "negative"; }): void; switchToBranch(_param2: { position?: "previous" | "next" | undefined; branchId?: string | undefined; }): void; unstable_getCopyText(): string; subscribe(callback: () => void): Unsubscribe; getMessagePartByIndex(idx: number): MessagePartRuntime; getMessagePartByToolCallId(toolCallId: string): MessagePartRuntime; getAttachmentByIndex(idx: number): AttachmentRuntime & { source: "message"; }; }; type MessageRuntimePath = ThreadRuntimePath & { readonly messageSelector: { readonly type: "messageId"; readonly messageId: string; } | { readonly type: "index"; readonly index: number; }; }; type MessageState = ThreadMessage & { readonly parentId: string | null; readonly index: number; readonly isLast: boolean; readonly branchNumber: number; readonly branchCount: number; readonly speech: SpeechState | undefined; }; type MessageStatus = { readonly type: "running"; } | { readonly type: "requires-action"; readonly reason: "interrupt" | "tool-calls"; } | { readonly type: "complete"; readonly reason: "stop" | "unknown"; } | { readonly type: "incomplete"; readonly reason: "cancelled" | "content-filter" | "error" | "length" | "other" | "tool-calls"; readonly error?: ReadonlyJSONValue; }; type MessageTiming = { readonly streamStartTime: number; readonly firstTokenTime?: number; readonly totalStreamTime?: number; readonly tokenCount?: number; readonly tokensPerSecond?: number; readonly totalChunks: number; readonly toolCallCount: number; }; type ModelContext = { priority?: number | undefined; system?: string | undefined; tools?: Record> | undefined; callSettings?: LanguageModelV1CallSettings | undefined; config?: LanguageModelConfig | undefined; unstable_composerMetadata?: Record | undefined; }; type ModelContextProvider = { getModelContext: () => ModelContext; subscribe?: (callback: () => void) => Unsubscribe; }; type ObjectKey = keyof T & (string | number); type ObjectStreamOperation = { readonly type: "set"; readonly path: readonly string[]; readonly value: ReadonlyJSONValue; } | { readonly type: "append-text"; readonly path: readonly string[]; readonly value: string; }; type OnCustomEventCallback = (type: string, data: unknown) => void | Promise; type OnErrorEventCallback = (error: unknown) => void | Promise; type OnInfoEventCallback = (info: unknown) => void | Promise; type OnMessageChunkCallback = (chunk: LangChainMessageChunk, metadata: LangGraphTupleMetadata) => void | Promise; type OnMetadataEventCallback = (metadata: unknown) => void | Promise; type OnSchemaValidationErrorFunction = ToolExecuteFunction; type OnSubgraphErrorEventCallback = (namespace: string, error: unknown) => void | Promise; type OnSubgraphUpdatesEventCallback = (namespace: string, updates: unknown) => void | Promise; type OnSubgraphValuesEventCallback = (namespace: string, values: unknown) => void | Promise; type OnUpdatesEventCallback = (updates: unknown) => void | Promise; type OnValuesEventCallback = (values: unknown) => void | Promise; type PartInit = { readonly type: "reasoning" | "text"; readonly parentId?: string; } | { readonly type: "tool-call"; readonly toolCallId: string; readonly toolName: string; readonly parentId?: string; } | { readonly type: "source"; readonly sourceType: "url"; readonly id: string; readonly url: string; readonly title?: string; readonly parentId?: string; } | { readonly type: "file"; readonly data: string; readonly mimeType: string; readonly parentId?: string; } | { readonly type: "data"; readonly name: string; readonly data: ReadonlyJSONValue; readonly parentId?: string; }; type PartProviderMetadata = { readonly [providerName: string]: ReadonlyJSONObject; }; type PdfToImagesRequestBody = { file_blob?: string | undefined; file_url?: string | undefined; }; type PdfToImagesResponse = { success: boolean; urls: string[]; message: string; }; type PendingAttachment = BaseAttachment & { status: PendingAttachmentStatus; file: File; }; type PendingAttachmentStatus = { type: "running"; reason: "uploading"; progress: number; } | { type: "requires-action"; reason: "composer-send"; } | { type: "incomplete"; reason: "error" | "upload-paused"; message?: string; }; type ProviderOptions = Record>; type ProviderTool = Record, TResult = unknown> = ToolBase & { type: "provider"; providerId: `${string}.${string}`; parameters?: StandardSchemaV1 | JSONSchema7 | undefined; args: Record; supportsDeferredResults?: boolean; description?: undefined; disabled?: boolean; execute?: undefined; toModelOutput?: undefined; experimental_onSchemaValidationError?: undefined; providerOptions?: ProviderOptions; }; type QueueItemState = { readonly id: string; readonly prompt: string; }; type QuoteInfo = { readonly text: string; readonly messageId: string; }; type ReadonlyJSONArray = readonly ReadonlyJSONValue[]; type ReadonlyJSONObject = { readonly [key: string]: ReadonlyJSONValue; }; type ReadonlyJSONValue = null | string | number | boolean | ReadonlyJSONObject | ReadonlyJSONArray; declare namespace RealtimeVoiceAdapter { type Status = { type: "running" | "starting"; } | { type: "ended"; reason: "cancelled" | "error" | "finished"; error?: unknown; }; type Mode = "listening" | "speaking"; type TranscriptItem = { role: "assistant" | "user"; text: string; isFinal?: boolean; }; type Session = { status: Status; isMuted: boolean; disconnect: () => void; mute: () => void; unmute: () => void; onStatusChange: (callback: (status: Status) => void) => Unsubscribe; onTranscript: (callback: (transcript: TranscriptItem) => void) => Unsubscribe; onModeChange: (callback: (mode: Mode) => void) => Unsubscribe; onVolumeChange: (callback: (volume: number) => void) => Unsubscribe; }; } type RealtimeVoiceAdapter = { connect: (options: { abortSignal?: AbortSignal; }) => RealtimeVoiceAdapter.Session; }; type ReasoningMessagePart = { readonly type: "reasoning"; readonly text: string; readonly providerMetadata?: PartProviderMetadata; readonly parentId?: string; }; type ReloadConfig = { runConfig?: RunConfig; }; type RemoteThreadInitializeResponse = { remoteId: string; externalId: string | undefined; }; type RemoteThreadListAdapter = { list(params?: RemoteThreadListPageOptions): Promise; rename(remoteId: string, newTitle: string): Promise; updateCustom?(remoteId: string, custom: Record | undefined): Promise; archive(remoteId: string): Promise; unarchive(remoteId: string): Promise; delete(remoteId: string): Promise; initialize(threadId: string): Promise; generateTitle(remoteId: string, unstable_messages: readonly ThreadMessage[]): Promise; fetch(threadId: string): Promise; unstable_Provider?: ComponentType | undefined; }; type RemoteThreadListPageOptions = { after?: string | undefined; }; type RemoteThreadListResponse = { threads: RemoteThreadMetadata[]; nextCursor?: string | undefined; }; type RemoteThreadMetadata = { readonly status: "archived" | "regular"; readonly remoteId: string; readonly externalId?: string | undefined; readonly title?: string | undefined; readonly lastMessageAt?: Date | undefined; readonly custom?: Record | undefined; }; type RemoveUIMessage = { type: "remove-ui"; id: string; }; type ReportToolCall = { tool_name: string; tool_call_id: string; tool_args?: string; tool_result?: string; tool_source?: "backend" | "frontend" | "mcp"; start_ms?: number; end_ms?: number; sampling_calls?: SamplingCallData[]; }; type RespondToToolApprovalOptions = { approvalId: string; approved: boolean; optionId?: string; reason?: string; }; type ResumeRunConfig = StartRunConfig & { stream?: (options: ChatModelRunOptions) => AsyncGenerator; }; type RunConfig = { readonly custom?: Record; }; type RuntimeCapabilities = { readonly switchToBranch: boolean; readonly switchBranchDuringRun: boolean; readonly edit: boolean; readonly reload: boolean; readonly delete: boolean; readonly cancel: boolean; readonly unstable_copy: boolean; readonly speech: boolean; readonly dictation: boolean; readonly voice: boolean; readonly attachments: boolean; readonly feedback: boolean; readonly queue: boolean; }; type SamplingCallData = { model_id?: string; input_tokens?: number; output_tokens?: number; reasoning_tokens?: number; cached_input_tokens?: number; duration_ms?: number; }; type SendOptions = { startRun?: boolean; steer?: boolean; }; type SourceMessagePart = { readonly type: "source"; readonly sourceType: "url"; readonly id: string; readonly url: string; readonly title?: string; readonly providerMetadata?: SourceProviderMetadata; readonly parentId?: string; } | { readonly type: "source"; readonly sourceType: "document"; readonly id: string; readonly url?: undefined; readonly title: string; readonly mediaType: string; readonly filename?: string; readonly providerMetadata?: SourceProviderMetadata; readonly parentId?: string; }; type SourceProviderMetadata = PartProviderMetadata; interface SpeechRecognitionConstructor { new (): SpeechRecognitionInstance; } interface SpeechRecognitionInstance extends EventTarget { lang: string; continuous: boolean; interimResults: boolean; start(): void; stop(): void; abort(): void; } type SpeechState = { readonly messageId: string; readonly status: SpeechSynthesisAdapter.Status; }; declare namespace SpeechSynthesisAdapter { type Status = { type: "running" | "starting"; } | { type: "ended"; reason: "cancelled" | "error" | "finished"; error?: unknown; }; type Utterance = { status: Status; cancel: () => void; subscribe: (callback: () => void) => Unsubscribe; }; } type SpeechSynthesisAdapter = { speak: (text: string) => SpeechSynthesisAdapter.Utterance; }; type StartRunConfig = { parentId: string | null; sourceId: string | null; runConfig: RunConfig; }; type StreamPayload = NonNullable[2]>; declare const TOOL_RESPONSE_SYMBOL: unique symbol; type TextMessagePart = { readonly type: "text"; readonly text: string; readonly providerMetadata?: PartProviderMetadata; readonly parentId?: string; }; type ThreadAssistantMessage = MessageCommonProps & { readonly role: "assistant"; readonly content: readonly ThreadAssistantMessagePart[]; readonly status: MessageStatus; readonly metadata: { readonly unstable_state: ReadonlyJSONValue; readonly unstable_annotations: readonly ReadonlyJSONValue[]; readonly unstable_data: readonly ReadonlyJSONValue[]; readonly steps: readonly ThreadStep[]; readonly submittedFeedback?: { readonly type: "negative" | "positive"; }; readonly timing?: MessageTiming; readonly isOptimistic?: boolean; readonly custom: Record; }; }; type ThreadAssistantMessagePart = TextMessagePart | ReasoningMessagePart | ToolCallMessagePart | SourceMessagePart | FileMessagePart | ImageMessagePart | DataMessagePart | GenerativeUIMessagePart; type ThreadComposerAttachmentState = Attachment & { readonly source: "thread-composer"; }; type ThreadComposerRuntime = Omit & { readonly path: ComposerRuntimePath & { composerSource: "thread"; }; readonly type: "thread"; getState(): ThreadComposerState; getAttachmentByIndex(idx: number): AttachmentRuntime & { source: "thread-composer"; }; }; type ThreadComposerState = BaseComposerState & { readonly type: "thread"; }; type ThreadListItemEventCallback = (payload: ThreadListItemEventPayload[E]) => void; type ThreadListItemEventPayload = { switchedTo: Record; switchedAway: Record; }; type ThreadListItemEventType = keyof ThreadListItemEventPayload; type ThreadListItemRuntime = { readonly path: ThreadListItemRuntimePath; getState(): ThreadListItemState; initialize(): Promise<{ remoteId: string; externalId: string | undefined; }>; generateTitle(): Promise; switchTo(options?: { unarchive?: boolean; }): Promise; rename(newTitle: string): Promise; updateCustom(custom: Record | undefined): Promise; archive(): Promise; unarchive(): Promise; delete(): Promise; detach(): void; subscribe(callback: () => void): Unsubscribe; unstable_on(event: E, callback: ThreadListItemEventCallback): Unsubscribe; __internal_getRuntime(): ThreadListItemRuntime; }; type ThreadListItemRuntimePath = { readonly ref: string; readonly threadSelector: { readonly type: "main"; } | { readonly type: "index"; readonly index: number; } | { readonly type: "archiveIndex"; readonly index: number; } | { readonly type: "threadId"; readonly threadId: string; }; }; type ThreadListItemState = { readonly isMain: boolean; readonly id: string; readonly remoteId: string | undefined; readonly externalId: string | undefined; readonly status: ThreadListItemStatus; readonly title?: string | undefined; readonly lastMessageAt?: Date | undefined; readonly custom?: Record | undefined; }; type ThreadListItemStatus = "archived" | "deleted" | "new" | "regular"; type ThreadListRuntime = { getState(): ThreadListState; subscribe(callback: () => void): Unsubscribe; readonly main: ThreadRuntime; getById(threadId: string): ThreadRuntime; readonly mainItem: ThreadListItemRuntime; getItemById(threadId: string): ThreadListItemRuntime; getItemByIndex(idx: number): ThreadListItemRuntime; getArchivedItemByIndex(idx: number): ThreadListItemRuntime; switchToThread(threadId: string, options?: { unarchive?: boolean; }): Promise; switchToNewThread(): Promise; getLoadThreadsPromise(): Promise; reload(): Promise; loadMore(): Promise; }; type ThreadListState = { readonly mainThreadId: string; readonly newThreadId: string | undefined; readonly threadIds: readonly string[]; readonly archivedThreadIds: readonly string[]; readonly isLoading: boolean; readonly isLoadingMore: boolean; readonly hasMore: boolean; readonly threadItems: Readonly>>; }; type ThreadMessage = BaseThreadMessage & (ThreadSystemMessage | ThreadUserMessage | ThreadAssistantMessage); type ThreadMessageLike = { readonly role: "assistant" | "system" | "user"; readonly content: string | readonly (TextMessagePart | ReasoningMessagePart | SourceMessagePart | ImageMessagePart | FileMessagePart | DataMessagePart | GenerativeUIMessagePart | Unstable_AudioMessagePart | DataPrefixedPart | { readonly type: "tool-call"; readonly toolCallId?: string; readonly toolName: string; readonly args?: ReadonlyJSONObject; readonly argsText?: string; readonly artifact?: any; readonly result?: any | undefined; readonly isError?: boolean | undefined; readonly parentId?: string | undefined; readonly messages?: readonly ThreadMessage[] | undefined; readonly interrupt?: { type: "human"; payload: unknown; }; readonly timing?: ToolCallTiming; readonly providerMetadata?: PartProviderMetadata; readonly approval?: { readonly id: string; readonly approved?: boolean; readonly reason?: string; readonly isAutomatic?: boolean; readonly options?: readonly ToolApprovalOption[]; readonly optionId?: string; readonly resolution?: "cancelled" | "expired"; }; })[]; readonly id?: string | undefined; readonly createdAt?: Date | undefined; readonly status?: MessageStatus | undefined; readonly attachments?: readonly (Omit & { readonly content: readonly (ThreadUserMessagePart | DataPrefixedPart)[]; })[] | undefined; readonly metadata?: { readonly unstable_state?: ReadonlyJSONValue; readonly unstable_annotations?: readonly ReadonlyJSONValue[] | undefined; readonly unstable_data?: readonly ReadonlyJSONValue[] | undefined; readonly steps?: readonly ThreadStep[] | undefined; readonly timing?: MessageTiming | undefined; readonly submittedFeedback?: { readonly type: "negative" | "positive"; }; readonly isOptimistic?: boolean | undefined; readonly custom?: Record | undefined; } | undefined; }; type ThreadRuntime = { readonly path: ThreadRuntimePath; readonly composer: ThreadComposerRuntime; getState(): ThreadState; append(message: CreateAppendMessage): void; deleteMessage(messageId: string): void | Promise; startRun(config: CreateStartRunConfig): void; resumeRun(config: CreateResumeRunConfig): void; exportExternalState(): any; importExternalState(state: any): void; subscribe(callback: () => void): Unsubscribe; cancelRun(): void; getModelContext(): ModelContext; export(): ExportedMessageRepository; import(repository: ExportedMessageRepository): void; reset(initialMessages?: readonly ThreadMessageLike[]): void; getMessageByIndex(idx: number): MessageRuntime; getMessageById(messageId: string): MessageRuntime; stopSpeaking(): void; connectVoice(): void; disconnectVoice(): void; getVoiceVolume(): number; subscribeVoiceVolume(callback: () => void): Unsubscribe; muteVoice(): void; unmuteVoice(): void; unstable_on(event: E, callback: ThreadRuntimeEventCallback): Unsubscribe; }; type ThreadRuntimeEventCallback = (payload: ThreadRuntimeEventPayload[E]) => void; type ThreadRuntimeEventPayload = { runStart: Record; runEnd: Record; initialize: Record; modelContextUpdate: Record; }; type ThreadRuntimeEventType = keyof ThreadRuntimeEventPayload; type ThreadRuntimePath = { readonly ref: string; readonly threadSelector: { readonly type: "main"; } | { readonly type: "threadId"; readonly threadId: string; }; }; type ThreadState = { readonly threadId: string; readonly metadata: ThreadListItemState; readonly isDisabled: boolean; readonly isLoading: boolean; readonly isRunning: boolean; readonly capabilities: RuntimeCapabilities; readonly messages: readonly ThreadMessage[]; readonly state: ReadonlyJSONValue; readonly suggestions: readonly ThreadSuggestion[]; readonly extras: unknown; readonly speech: SpeechState | undefined; readonly voice: VoiceSessionState | undefined; }; type ThreadStep = { readonly messageId?: string; readonly usage?: { readonly inputTokens: number; readonly outputTokens: number; } | undefined; }; type ThreadSuggestion = { prompt: string; }; type ThreadSystemMessage = MessageCommonProps & { readonly role: "system"; readonly content: readonly [ TextMessagePart ]; readonly metadata: { readonly unstable_state?: undefined; readonly unstable_annotations?: undefined; readonly unstable_data?: undefined; readonly steps?: undefined; readonly submittedFeedback?: undefined; readonly timing?: undefined; readonly custom: Record; }; }; type ThreadUserMessage = MessageCommonProps & { readonly role: "user"; readonly content: readonly ThreadUserMessagePart[]; readonly attachments: readonly CompleteAttachment[]; readonly metadata: { readonly unstable_state?: undefined; readonly unstable_annotations?: undefined; readonly unstable_data?: undefined; readonly steps?: undefined; readonly submittedFeedback?: undefined; readonly timing?: undefined; readonly custom: Record; }; }; type ThreadUserMessagePart = TextMessagePart | ImageMessagePart | FileMessagePart | DataMessagePart | Unstable_AudioMessagePart; type Tool = Record, TResult = unknown> = FrontendTool | BackendTool | HumanTool | ProviderTool | McpTool | ToolWithoutType; type ToolApprovalOption = { readonly id: string; readonly kind: ToolApprovalOptionKind | (string & {}); readonly label?: string; readonly description?: string; readonly grants?: readonly string[]; readonly confirm?: boolean | { title?: string; description?: string; }; }; type ToolApprovalOptionKind = "allow-always" | "allow-once" | "reject-always" | "reject-once"; type ToolApprovalResponse = { readonly approved: boolean; readonly reason?: string; } | { readonly optionId: string; readonly reason?: string; } | { readonly approved: boolean; readonly optionId: string; readonly reason?: string; }; type ToolBase = Record, TResult = unknown> = { streamCall?: ToolStreamCallFunction; display?: ToolDisplay; }; interface ToolCallArgsReader> { get>(...fieldPath: PathT): Promise>; streamValues>(...fieldPath: PathT): AsyncIterableStream>>; streamText>(...fieldPath: PathT): TypeAtPath extends string & (infer U) ? AsyncIterableStream : never; forEach>(...fieldPath: PathT): NonNullable> extends Array ? AsyncIterableStream : never; } type ToolCallMessagePart = { readonly type: "tool-call"; readonly toolCallId: string; readonly toolName: string; readonly args: TArgs; readonly result?: TResult | undefined; readonly isError?: boolean | undefined; readonly argsText: string; readonly artifact?: unknown; readonly timing?: ToolCallTiming; readonly mcp?: ToolCallMessagePartMcpMetadata; readonly providerMetadata?: PartProviderMetadata; readonly modelContent?: readonly ToolModelContentPart[] | undefined; readonly interrupt?: { type: "human"; payload: unknown; }; readonly approval?: { readonly id: string; readonly approved?: boolean; readonly reason?: string; readonly isAutomatic?: boolean; readonly options?: readonly ToolApprovalOption[]; readonly optionId?: string; readonly resolution?: "cancelled" | "expired"; }; readonly parentId?: string; readonly messages?: readonly ThreadMessage[]; }; type ToolCallMessagePartMcpMetadata = { readonly app?: McpAppMetadata; }; type ToolCallMessagePartStatus = { readonly type: "requires-action"; readonly reason: "interrupt"; } | MessagePartStatus; interface ToolCallReader = Record, TResult = unknown> { args: ToolCallArgsReader; response: ToolCallResponseReader; result: { get: () => Promise; }; } interface ToolCallResponseReader { get: () => Promise>; } type ToolCallTiming = { readonly startedAt: number; readonly completedAt?: number; }; type ToolDisplay = "inline" | "standalone"; type ToolExecuteFunction = (args: TArgs, context: ToolExecutionContext) => TResult | Promise; type ToolExecutionContext = { toolCallId: string; abortSignal: AbortSignal; human: (payload: unknown) => Promise; }; type ToolExecutionStatus = { type: "executing"; } | { type: "interrupt"; payload: { type: "human"; payload: unknown; }; }; type ToolModelContentPart = { readonly type: "text"; readonly text: string; } | { readonly type: "file"; readonly data: string; readonly mediaType: string; readonly filename?: string; }; type ToolModelOutputFunction = (options: { toolCallId: string; input: TArgs; output: TResult; }) => readonly ToolModelContentPart[] | Promise; declare class ToolResponse { get [TOOL_RESPONSE_SYMBOL](): boolean; readonly artifact?: ReadonlyJSONValue; readonly result: TResult; readonly isError: boolean; readonly modelContent?: readonly ToolModelContentPart[]; readonly messages?: ReadonlyJSONValue; constructor(options: ToolResponseLike); static [Symbol.hasInstance](obj: unknown): obj is ToolResponse; static toResponse(result: any | ToolResponse): ToolResponse; } type ToolResponseLike = { result: TResult; artifact?: ReadonlyJSONValue | undefined; isError?: boolean | undefined; modelContent?: readonly ToolModelContentPart[] | undefined; messages?: ReadonlyJSONValue | undefined; }; type ToolStreamCallFunction = Record, TResult = unknown> = (reader: ToolCallReader, context: ToolExecutionContext) => void; type ToolWithoutType = Record, TResult = unknown> = (Omit, "type"> | Omit, "type"> | Omit, "type"> | Omit, "type">) & { type?: undefined; }; type TupleIndex = Exclude; type TypeAtPath = P extends [ infer Head, ...infer Rest ] ? Head extends keyof T ? TypeAtPath : never : T; type TypePath = [ ] | (0 extends 1 & T ? any[] : T extends object ? T extends readonly any[] ? number extends T["length"] ? { [K in TupleIndex]: [ AsNumber, ...TypePath ]; }[TupleIndex] : [ number, ...TypePath ] : { [K in ObjectKey]: [ K, ...TypePath ]; }[ObjectKey] : [ ]); type UIMessage = Record> = { type: "ui"; id: string; name: TName; props: TProps; metadata?: { merge?: boolean; run_id?: string; name?: string; tags?: string[]; message_id?: string; [key: string]: unknown; }; }; type Unstable_AudioMessagePart = { readonly type: "audio"; readonly audio: { readonly data: string; readonly format: "mp3" | "wav"; }; }; type Unsubscribe = () => void; type UseLangGraphRuntimeOptions = ExternalStoreSharedOptions & { onThreadIdChange?: ((threadId: string | undefined) => void) | undefined; autoCancelPendingToolCalls?: boolean | undefined; unstable_allowCancellation?: boolean | undefined; unstable_enableMessageQueue?: boolean | undefined; stream: LangGraphStreamCallback; uiStateKey?: string; getCheckpointId?: (threadId: string, parentMessages: LangChainMessage[]) => Promise; load?: (threadId: string, config?: { signal: AbortSignal; }) => Promise<{ messages: LangChainMessage[]; interrupts?: LangGraphInterruptState[]; uiMessages?: UIMessage[]; }>; create?: () => Promise<{ externalId: string; }>; delete?: (threadId: string) => Promise; adapters?: { attachments?: AttachmentAdapter; speech?: SpeechSynthesisAdapter; dictation?: DictationAdapter; voice?: RealtimeVoiceAdapter; feedback?: FeedbackAdapter; } | undefined; eventHandlers?: { onMessageChunk?: OnMessageChunkCallback; onValues?: OnValuesEventCallback; onUpdates?: OnUpdatesEventCallback; onSubgraphValues?: OnSubgraphValuesEventCallback; onSubgraphUpdates?: OnSubgraphUpdatesEventCallback; onMetadata?: OnMetadataEventCallback; onInfo?: OnInfoEventCallback; onError?: OnErrorEventCallback; onSubgraphError?: OnSubgraphErrorEventCallback; onCustomEvent?: OnCustomEventCallback; } | undefined; uiComponents?: { fallback?: DataMessagePartComponent; renderers?: Record; } | undefined; cloud?: AssistantCloud | undefined; unstable_threadListAdapter?: RemoteThreadListAdapter | undefined; }; type UserMessageContent = string | UserMessageContentComplex[]; type UserMessageContentComplex = MessageContentText | MessageContentImageUrl | MessageContentFile; type VoiceSessionState = { readonly status: RealtimeVoiceAdapter.Status; readonly isMuted: boolean; readonly mode: RealtimeVoiceAdapter.Mode; }; declare const appendLangChainChunk: (prev: LangChainMessage | undefined, curr: LangChainMessage | LangChainMessageChunk) => LangChainMessage; declare const convertLangChainMessages: useExternalMessageConverter.Callback; declare global { interface Window { SpeechRecognition?: SpeechRecognitionConstructor; webkitSpeechRecognition?: SpeechRecognitionConstructor; } } declare namespace entry_root_exports { export { CreateLangGraphStreamOptions, LangChainEvent, LangChainMessage, LangChainMessageChunk, LangChainToolCall, LangChainToolCallChunk, LangGraphCommand, LangGraphInterruptState, LangGraphMessageAccumulator, LangGraphMessagesEvent, LangGraphSendMessageConfig, LangGraphStreamCallback, LangGraphStreamClient, LangGraphTupleMetadata, OnCustomEventCallback, OnErrorEventCallback, OnInfoEventCallback, OnMessageChunkCallback, OnMetadataEventCallback, OnSubgraphErrorEventCallback, OnSubgraphUpdatesEventCallback, OnSubgraphValuesEventCallback, OnUpdatesEventCallback, OnValuesEventCallback, RemoveUIMessage, UIMessage, UseLangGraphRuntimeOptions, appendLangChainChunk, convertLangChainMessages, unstable_createLangGraphStream, useLangGraphInterruptState, useLangGraphMessageMetadata, useLangGraphMessages, useLangGraphRuntime, useLangGraphSend, useLangGraphSendCommand, useLangGraphStreamingTiming, useLangGraphUIMessages }; } declare const unstable_createLangGraphStream: (_param3: CreateLangGraphStreamOptions) => LangGraphStreamCallback; declare namespace useExternalMessageConverter { type Message = (ThreadMessageLike & { readonly convertConfig?: { readonly joinStrategy?: JoinStrategy; }; }) | { role: "tool"; toolCallId: string; toolName?: string | undefined; result: any; artifact?: any; isError?: boolean; messages?: readonly ThreadMessage[]; }; type Metadata = { readonly toolStatuses?: Record; readonly error?: ReadonlyJSONValue; readonly messageTiming?: Record; }; type Callback = (message: T, metadata: Metadata) => Message | Message[]; } declare const useExternalMessageConverter: (_param4: { callback: useExternalMessageConverter.Callback; messages: T[]; isRunning: boolean; joinStrategy?: JoinStrategy | undefined; metadata?: useExternalMessageConverter.Metadata | undefined; }) => ThreadMessage[]; declare const useLangGraphInterruptState: () => LangGraphInterruptState | undefined; declare const useLangGraphMessageMetadata: () => Map; declare const useLangGraphMessages: (_param5: { stream: LangGraphStreamCallback; appendMessage?: (prev: TMessage | undefined, curr: TMessage) => TMessage; uiStateKey?: string; eventHandlers?: { onMessageChunk?: OnMessageChunkCallback; onValues?: OnValuesEventCallback; onUpdates?: OnUpdatesEventCallback; onSubgraphValues?: OnSubgraphValuesEventCallback; onSubgraphUpdates?: OnSubgraphUpdatesEventCallback; onMetadata?: OnMetadataEventCallback; onInfo?: OnInfoEventCallback; onError?: OnErrorEventCallback; onSubgraphError?: OnSubgraphErrorEventCallback; onCustomEvent?: OnCustomEventCallback; }; }) => { interrupt: LangGraphInterruptState | undefined; messages: TMessage[]; messageMetadata: Map; uiMessages: UIMessage[]; sendMessage: (newMessages: TMessage[], config: LangGraphSendMessageConfig, onComplete?: () => void) => Promise; cancel: () => void; setInterrupt: import("react").Dispatch>; setMessages: (msgs: TMessage[]) => void; setUIMessages: (next: UIMessage[]) => void; }; declare const useLangGraphRuntime: (_param6: UseLangGraphRuntimeOptions) => AssistantRuntime; declare const useLangGraphSend: () => (messages: LangChainMessage[], config: LangGraphSendMessageConfig) => Promise; declare const useLangGraphSendCommand: () => (command: LangGraphCommand) => Promise; declare const useLangGraphStreamingTiming: (messages: readonly LangChainMessage[], isRunning: boolean) => Record; declare const useLangGraphUIMessages: () => readonly UIMessage>[]; export { entry_root_exports as entry_root };