@copilotkit/react-core 1.83.0 → 2.0.0-rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/dist/{runtime-context-CrHq-iTf.d.mts → MarkdownRendererContext-B4Us6mwL.d.cts} +127 -97
  2. package/dist/MarkdownRendererContext-B4Us6mwL.d.cts.map +1 -0
  3. package/dist/{runtime-context-D3NcP9oE.d.cts → MarkdownRendererContext-CRKFzsEB.d.mts} +127 -97
  4. package/dist/MarkdownRendererContext-CRKFzsEB.d.mts.map +1 -0
  5. package/dist/{MarkdownSurfaces-FF5za2kU.cjs → MarkdownSurfaces-C2XZISKn.cjs} +203 -55
  6. package/dist/MarkdownSurfaces-C2XZISKn.cjs.map +1 -0
  7. package/dist/{MarkdownSurfaces-DGpjmPaB.mjs → MarkdownSurfaces-ChSlVYOk.mjs} +171 -47
  8. package/dist/MarkdownSurfaces-ChSlVYOk.mjs.map +1 -0
  9. package/dist/{v2/context.cjs → context.cjs} +2 -2
  10. package/dist/context.cjs.map +1 -0
  11. package/dist/{v2/context.d.cts → context.d.cts} +5 -5
  12. package/dist/context.d.cts.map +1 -0
  13. package/dist/{v2/context.d.mts → context.d.mts} +5 -5
  14. package/dist/context.d.mts.map +1 -0
  15. package/dist/{v2/context.mjs → context.mjs} +2 -2
  16. package/dist/context.mjs.map +1 -0
  17. package/dist/{v2/generative-ui.cjs → generative-ui.cjs} +40 -43
  18. package/dist/generative-ui.cjs.map +1 -0
  19. package/dist/{v2/generative-ui.d.cts → generative-ui.d.cts} +14 -12
  20. package/dist/generative-ui.d.cts.map +1 -0
  21. package/dist/{v2/generative-ui.d.mts → generative-ui.d.mts} +14 -12
  22. package/dist/generative-ui.d.mts.map +1 -0
  23. package/dist/{v2/generative-ui.mjs → generative-ui.mjs} +40 -43
  24. package/dist/generative-ui.mjs.map +1 -0
  25. package/dist/{v2/headless.cjs → headless.cjs} +68 -53
  26. package/dist/headless.cjs.map +1 -0
  27. package/dist/{v2/headless.d.cts → headless.d.cts} +24 -23
  28. package/dist/headless.d.cts.map +1 -0
  29. package/dist/{v2/headless.d.mts → headless.d.mts} +21 -20
  30. package/dist/headless.d.mts.map +1 -0
  31. package/dist/{v2/headless.mjs → headless.mjs} +51 -36
  32. package/dist/headless.mjs.map +1 -0
  33. package/dist/index.cjs +15391 -1862
  34. package/dist/index.cjs.map +1 -1
  35. package/dist/index.css +2 -0
  36. package/dist/index.d.cts +3252 -1370
  37. package/dist/index.d.cts.map +1 -1
  38. package/dist/index.d.mts +3234 -1369
  39. package/dist/index.d.mts.map +1 -1
  40. package/dist/index.mjs +13733 -1815
  41. package/dist/index.mjs.map +1 -1
  42. package/dist/index.umd.js +11944 -5481
  43. package/dist/index.umd.js.map +1 -1
  44. package/package.json +21 -30
  45. package/dist/MarkdownSurfaces-DGpjmPaB.mjs.map +0 -1
  46. package/dist/MarkdownSurfaces-FF5za2kU.cjs.map +0 -1
  47. package/dist/copilotkit-BuIuo-Z1.cjs +0 -16531
  48. package/dist/copilotkit-BuIuo-Z1.cjs.map +0 -1
  49. package/dist/copilotkit-C765tOUi.d.mts +0 -4112
  50. package/dist/copilotkit-C765tOUi.d.mts.map +0 -1
  51. package/dist/copilotkit-DyxwF9wL.mjs +0 -16025
  52. package/dist/copilotkit-DyxwF9wL.mjs.map +0 -1
  53. package/dist/copilotkit-wqaNanhw.d.cts +0 -4129
  54. package/dist/copilotkit-wqaNanhw.d.cts.map +0 -1
  55. package/dist/runtime-context-CrHq-iTf.d.mts.map +0 -1
  56. package/dist/runtime-context-D3NcP9oE.d.cts.map +0 -1
  57. package/dist/v2/context.cjs.map +0 -1
  58. package/dist/v2/context.d.cts.map +0 -1
  59. package/dist/v2/context.d.mts.map +0 -1
  60. package/dist/v2/context.mjs.map +0 -1
  61. package/dist/v2/generative-ui.cjs.map +0 -1
  62. package/dist/v2/generative-ui.d.cts.map +0 -1
  63. package/dist/v2/generative-ui.d.mts.map +0 -1
  64. package/dist/v2/generative-ui.mjs.map +0 -1
  65. package/dist/v2/headless.cjs.map +0 -1
  66. package/dist/v2/headless.d.cts.map +0 -1
  67. package/dist/v2/headless.d.mts.map +0 -1
  68. package/dist/v2/headless.mjs.map +0 -1
  69. package/dist/v2/index.cjs +0 -1635
  70. package/dist/v2/index.css +0 -2
  71. package/dist/v2/index.d.cts +0 -4
  72. package/dist/v2/index.d.mts +0 -4
  73. package/dist/v2/index.mjs +0 -8
  74. package/dist/v2/index.umd.js +0 -20695
  75. package/dist/v2/index.umd.js.map +0 -1
@@ -1,4129 +0,0 @@
1
- import { F as ReactActivityMessageRenderer, P as GenerativeUIChatSurfaceProps, t as GenerativeUIConfig } from "./runtime-context-D3NcP9oE.cjs";
2
- import * as react_jsx_runtime0 from "react/jsx-runtime";
3
- import { Agent, ExtensionsInput, ForwardedParametersInput, LangGraphInterruptEvent } from "@copilotkit/runtime-client-gql";
4
- import * as react from "react";
5
- import React$1, { ComponentType, ReactNode } from "react";
6
- import { Action, Attachment, Attachment as Attachment$1, AttachmentModality, AttachmentsConfig, AttachmentsConfig as AttachmentsConfig$1, CopilotCloudConfig, CopilotErrorHandler, CopilotKitError, DebugConfig, FunctionCallHandler, InferSchemaOutput, InputContentSource, LicenseContextValue, MappedParameterTypes, Parameter, StandardSchemaV1 } from "@copilotkit/shared";
7
- import { A2UIMarkdownOperation, A2UI_FENCE_LANGUAGE, ActionConfig, ActionCreator, ActionFromCreator, ActionFromCreators, ActionGroupConfig, ActionGroupResult, AgentRegistry, AgentThreadLockedError, AnyAction, ChildIdsOf, ChildWalkOptions, ContextStore, CopilotKitCore, CopilotKitCore as CopilotKitCore$1, CopilotKitCoreAddAgentParams, CopilotKitCoreCatalogComponent, CopilotKitCoreConfig, CopilotKitCoreConfig as CopilotKitCoreConfig$1, CopilotKitCoreConnectAgentParams, CopilotKitCoreContinuationHandoff, CopilotKitCoreErrorCode, CopilotKitCoreErrorCode as CopilotKitCoreErrorCode$1, CopilotKitCoreFriendsAccess, CopilotKitCoreGetSuggestionsResult, CopilotKitCoreGetToolParams, CopilotKitCoreRegisterProxiedAgentParams, CopilotKitCoreRegisterProxiedAgentResult, CopilotKitCoreRunAgentParams, CopilotKitCoreRunToolParams, CopilotKitCoreRunToolResult, CopilotKitCoreRuntimeConnectionStatus, CopilotKitCoreStopAgentParams, CopilotKitCoreSubscriber, CopilotKitCoreSubscriber as CopilotKitCoreSubscriber$1, CopilotKitCoreSubscription, CopilotKitCoreSubscription as CopilotKitCoreSubscription$1, CopilotKitHeaderResolutionError, CopilotKitHeadersSource, CopilotKitHeadersSource as CopilotKitHeadersSource$1, CopilotKitMessageFilter, CopilotKitMessageFilter as CopilotKitMessageFilter$1, CopilotRuntimeTransport, DispatchingEffect, DispatchingEffectOptions, DynamicSuggestionsConfig, DynamicSuggestionsConfig as DynamicSuggestionsConfig$1, Effect, EmptyActionConfig, FrontendTool, FrontendTool as FrontendTool$1, FrontendToolHandlerContext, FrontendToolReconnectBehavior, INSPECTOR_THREAD_BRIDGE_PLUGIN_ID, InspectorActiveThreadPayload, InspectorMetadataV1, InspectorStopViewingPayload, InspectorViewThreadPayload, InspectorViewThreadResultPayload, IntelligenceAgent, IntelligenceAgentConfig, IntelligenceRuntimeInfo, JsonValue, LearningConfig, LearningConfig as LearningConfig$1, LegacyLearningConfig, MEMORY_ERROR_REGISTRY, MarkdownSegment, Memory, Memory as Memory$1, MemoryChanges, MemoryChanges as MemoryChanges$1, MemoryError, MemoryErrorCategory, MemoryErrorCode, MemoryErrorRegistryEntry, MemoryKind, MemoryRealtimeStatus, MemoryRealtimeStatus as MemoryRealtimeStatus$1, MemoryScope, NewMemory, NewMemory as NewMemory$1, NonDispatchingEffect, NonDispatchingEffectOptions, OpenThreadRegistration, PropsActionConfig, ProxiedCopilotRuntimeAgent, ProxiedCopilotRuntimeAgentConfig, Reducer, RunCompletionAware, RunHandler, RuntimeLicenseStatus, RuntimeMode, ScopedContext, ScopedProperties, Selector, StartResult, StateManager, StaticSuggestionsConfig, StaticSuggestionsConfig as StaticSuggestionsConfig$1, Store, StoreLifecycleAction, SubscribeToAgentOptions, SubscribeToAgentSubscriber, Suggestion, Suggestion as Suggestion$1, SuggestionAvailability, SuggestionEngine, SuggestionsConfig, SurfaceSegment, ThreadEndpointRuntimeInfo, ThreadRunActivityNotification, ToolCallStatus, ToolCallStatus as ToolCallStatus$1, TrajectoryStartOptions, WebMCPModelContext, WebMCPRegistry, WebMCPToolAnnotations, WebMCPToolConfig, WebMCPToolConfig as WebMCPToolConfig$1, classifySurfaceCards, completePartialMarkdown, createActionGroup, createEffect, createInspectorThreadRequestId, createReducer, createSelector, createStore, emitInspectorActiveThread, emitInspectorStopViewing, emitInspectorViewThread, emitInspectorViewThreadResult, empty, ensureObjectArgs, extractCompleteArrayItems, extractFenceOperations, extractStringField, flattenInformationalCards, getMarkdownOperationSurfaceId, getWebMCPModelContext, isAbortError, isInspectorThreadBridgeEnabled, isRunCompletionAware, ofType, on, onInspectorActiveThread, onInspectorStopViewing, onInspectorViewThread, onInspectorViewThreadResult, parseToolArguments, prepareSurfaceOperations, props, segmentSurfaceProse, select, splitA2UIMarkdown, ɵCOPILOTKIT_FEATURES, ɵCopilotKitFeature, ɵGenerativeUIDebugFunction, ɵGenerativeUIDebugPromptSection, ɵGenerativeUIDebugRun, ɵGenerativeUIDebugSnapshot, ɵGenerativeUIDebugSource, ɵGenerativeUIDebugSurface, ɵInterruptDecision, ɵInterruptEvent, ɵInterruptState, ɵInterruptToolResult, ɵMAX_SOCKET_RETRIES, ɵMemoryEnvironment, ɵMemoryMetadataEvent, ɵMemoryRuntimeContext, ɵMemoryState, ɵMemoryStore, ɵPendingInterrupt, ɵPhoenixChannelLike, ɵPhoenixChannelOptions, ɵPhoenixChannelSession, ɵPhoenixJoinOutcome, ɵPhoenixPushLike, ɵPhoenixSocketLike, ɵPhoenixSocketOptions, ɵPhoenixSocketSession, ɵPhoenixSocketSignal, ɵRUNTIME_PROBE_TIMEOUT_MS, ɵTHREAD_REQUEST_TIMEOUT_MS, ɵThread, ɵThreadEnvironment, ɵThreadMetadataEvent, ɵThreadRuntimeContext, ɵThreadSelectors, ɵThreadStore, ɵcreateMemoryStore, ɵcreateThreadSelectors, ɵcreateThreadStore, ɵisCopilotKitFeature, ɵisHttpAgent, ɵisRetryableMemoryStatus, ɵjoinPhoenixChannel$, ɵmapMemoryMetadataEvent, ɵmemoryAdapterEvents, ɵmemoryDomainEvents, ɵmemoryReducer, ɵmemoryRestEvents, ɵobservePhoenixEvent$, ɵobservePhoenixJoinOutcome$, ɵobservePhoenixSocketHealth$, ɵobservePhoenixSocketSignals$, ɵphoenixChannel$, ɵphoenixSocket$, ɵselectFetchMoreError, ɵselectHasNextPage, ɵselectIsFetchingNextPage, ɵselectIsMutating, ɵselectMemories, ɵselectMemoriesAvailable, ɵselectMemoriesError, ɵselectMemoriesIsLoading, ɵselectMemoriesIsMutating, ɵselectMemoriesRealtimeStatus, ɵselectThreads, ɵselectThreadsError, ɵselectThreadsIsLoading, ɵthreadAdapterEvents, ɵwithHeaderDefaults } from "@copilotkit/core";
8
- import { ACTIVITY_HISTORY_METADATA, AGUIConnectNotImplementedError, AGUIError, AGUIEvent, AGUIEventByType, AGUIEventOf, AGUI_METADATA_KEY, AbstractAgent, AbstractAgent as AbstractAgent$1, ActivityDeltaEvent, ActivityDeltaEventProps, ActivityMessage as ActivityMessage$1, ActivitySnapshotEvent, ActivitySnapshotEventProps, AddOperation, AgentCapabilities as AgentCapabilities$1, AgentConfig, AgentDebugConfig, AgentStateMutation, AgentSubscriber, AgentSubscriberParams, AssistantMessage as AssistantMessage$1, Attributable, AudioInputContent, AudioInputPart, AudioPart, BackwardCompatibility_0_0_39, BackwardCompatibility_0_0_45, BackwardCompatibility_0_0_57, BaseEvent, BaseEventFields, BaseEventProps, BaseMessage, CompatibilityBoundary, ContentPart, Context, CopyOperation, CustomEvent, CustomEventProps, DataSource, DebugLogger, DebugLoggerInput, DeveloperMessage, DocumentInputContent, DocumentInputPart, DocumentPart, Event, EventPayloadOf, EventType, ExecutionCapabilities, FileSource, FilterToolCallsMiddleware, FunctionCall, FunctionMiddleware, HttpAgent, HttpAgentConfig, HttpAgentFetchFn, HumanInTheLoopCapabilities, IdentityCapabilities, ImageInputContent, ImageInputPart, ImagePart, InputContent, InputContentDataSource, InputContentPart, InputContentSource as InputContentSource$1, InputContentUrlSource, Interrupt, JsonPatch, JsonPatchOperation, JsonPointer, Message as Message$3, MessagesSnapshotEvent, MessagesSnapshotEventProps, Metadata, Middleware, MiddlewareFunction, MoveOperation, MultiAgentCapabilities, MultimodalCapabilities, MultimodalInputCapabilities, MultimodalOutputCapabilities, OutputCapabilities, PROTOCOL_VERSION, PartSource, RawEvent, RawEventProps, ReasoningCapabilities, ReasoningEncryptedValueEvent, ReasoningEncryptedValueEventProps, ReasoningEncryptedValueSubtype, ReasoningEndEvent, ReasoningEndEventProps, ReasoningMessage as ReasoningMessage$1, ReasoningMessageChunkEvent, ReasoningMessageChunkEventProps, ReasoningMessageContentEvent, ReasoningMessageContentEventProps, ReasoningMessageEndEvent, ReasoningMessageEndEventProps, ReasoningMessageStartEvent, ReasoningMessageStartEventProps, ReasoningStartEvent, ReasoningStartEventProps, RemoveOperation, ReplaceOperation, ResolvedAgentDebugConfig, ResumeEntry, ResumeStatus, Role, RunAgentInput, RunAgentParameters, RunAgentResult, RunAgentResult as RunAgentResult$1, RunErrorEvent, RunErrorEventProps, RunFinishedCancelledOutcome, RunFinishedEvent, RunFinishedEventProps, RunFinishedInterruptOutcome, RunFinishedOutcome, RunFinishedSuccessOutcome, RunStartedEvent, RunStartedEventProps, State, StateCapabilities, StateDeltaEvent, StateDeltaEventProps, StateSnapshotEvent, StateSnapshotEventProps, StepFinishedEvent, StepFinishedEventProps, StepStartedEvent, StepStartedEventProps, SubagentErrorEvent, SubagentErrorEventProps, SubagentFinishedEvent, SubagentFinishedEventProps, SubagentFinishedOutcome, SubagentFinishedSuccessOutcome, SubagentFinishedSuspendedOutcome, SubagentInfo, SubagentRunId, SubagentStartedEvent, SubagentStartedEventProps, SystemMessage, TestOperation, TextInputContent, TextMessageChunkEvent, TextMessageChunkEventProps, TextMessageContentEvent, TextMessageContentEventProps, TextMessageEndEvent, TextMessageEndEventProps, TextMessageRole, TextMessageStartEvent, TextMessageStartEventProps, TextPart, TokenUsage, Tool, ToolCall as ToolCall$1, ToolCallArgsEvent, ToolCallArgsEventProps, ToolCallChunkEvent, ToolCallChunkEventProps, ToolCallEndEvent, ToolCallEndEventProps, ToolCallResultEvent, ToolCallResultEventProps, ToolCallStartEvent, ToolCallStartEventProps, ToolMessage as ToolMessage$1, ToolsCapabilities, TransportCapabilities, UnrecognizedEvent, UrlSource, UserMessage as UserMessage$1, VideoInputContent, VideoInputPart, VideoPart, aggregateTokenUsage, authoritativeActivityTypes, buildResumeArray, compactEvents, contentHasMedia, contentToText, convertToLegacyEvents, createDebugLogger, defaultApplyEvents, enforceEvents, enforceOutgoingInput, getRunOutcome, isInterruptExpired, isRecognizedEvent, mergeMetadata, omitOptionalNulls, parseProtoStream, parseSSEStream, randomUUID, resolveAgentDebugConfig, resolveDebugLogger, runHttpRequest, structuredClone_, tokenUsageFromAiSdkUsage, tokenUsageFromLangChainMetadata, transformChunks, transformHttpEventStream, verifyEvents, withAuthoritativeActivityTypes } from "@ag-ui/client";
9
- import { ActivityDeltaEventSchema, ActivityMessageSchema, ActivitySnapshotEventSchema, AddOperationSchema, AgentCapabilitiesSchema, AssistantMessageSchema, AttributableSchema, AudioInputContentSchema, AudioInputPartSchema, AudioPartSchema, BaseEventSchema, BaseMessageSchema, ContentPartSchema, ContextSchema, CopyOperationSchema, CustomEventSchema, DataSourceSchema, DeveloperMessageSchema, DocumentInputContentSchema, DocumentInputPartSchema, DocumentPartSchema, EventSchema, EventSchemas, EventTypeSchema, ExecutionCapabilitiesSchema, FileSourceSchema, FunctionCallSchema, HumanInTheLoopCapabilitiesSchema, IdentityCapabilitiesSchema, ImageInputContentSchema, ImageInputPartSchema, ImagePartSchema, InputContentDataSourceSchema, InputContentSchema, InputContentSourceSchema, InputContentUrlSourceSchema, InterruptSchema, JsonPatchOperationSchema, JsonPatchSchema, JsonPointerSchema, MessageSchema, MessagesSnapshotEventSchema, MetadataSchema, MoveOperationSchema, MultiAgentCapabilitiesSchema, MultimodalCapabilitiesSchema, MultimodalInputCapabilitiesSchema, MultimodalOutputCapabilitiesSchema, OptionalMetadataSchema, OutputCapabilitiesSchema, PartSourceSchema, RawEventSchema, ReasoningCapabilitiesSchema, ReasoningEncryptedValueEventSchema, ReasoningEncryptedValueSubtypeSchema, ReasoningEndEventSchema, ReasoningMessageChunkEventSchema, ReasoningMessageContentEventSchema, ReasoningMessageEndEventSchema, ReasoningMessageSchema, ReasoningMessageStartEventSchema, ReasoningStartEventSchema, RemoveOperationSchema, ReplaceOperationSchema, ResumeEntrySchema, RoleSchema, RunAgentInputSchema, RunErrorEventSchema, RunFinishedCancelledOutcomeSchema, RunFinishedEventSchema, RunFinishedInterruptOutcomeSchema, RunFinishedOutcomeSchema, RunFinishedSuccessOutcomeSchema, RunStartedEventSchema, StateCapabilitiesSchema, StateDeltaEventSchema, StateSchema, StateSnapshotEventSchema, StepFinishedEventSchema, StepStartedEventSchema, SubagentErrorEventSchema, SubagentFinishedEventSchema, SubagentFinishedOutcomeSchema, SubagentFinishedSuccessOutcomeSchema, SubagentFinishedSuspendedOutcomeSchema, SubagentInfoSchema, SubagentRunIdSchema, SubagentStartedEventSchema, SystemMessageSchema, TestOperationSchema, TextInputContentSchema, TextMessageChunkEventSchema, TextMessageContentEventSchema, TextMessageEndEventSchema, TextMessageRoleSchema, TextMessageStartEventSchema, TextPartSchema, TokenUsageSchema, ToolCallArgsEventSchema, ToolCallChunkEventSchema, ToolCallEndEventSchema, ToolCallResultEventSchema, ToolCallSchema, ToolCallStartEventSchema, ToolMessageSchema, ToolSchema, ToolsCapabilitiesSchema, TransportCapabilitiesSchema, UrlSourceSchema, UserMessageSchema, VideoInputContentSchema, VideoInputPartSchema, VideoPartSchema } from "@ag-ui/core/schemas";
10
- import { ActivityMessage, AgentCapabilities, AssistantMessage, Message as Message$2, ReasoningMessage, ToolCall, ToolMessage, UserMessage } from "@ag-ui/core";
11
- import { Streamdown } from "streamdown";
12
- import { MCPAppsActivityContent, MCPAppsActivityContent as MCPAppsActivityContent$1, MCPAppsActivityContentSchema, MCPAppsActivityType, ɵMcpFollowUpHost, ɵrunMcpFollowUp } from "@copilotkit/mcp-apps-renderer/activity";
13
- import { z } from "zod";
14
- import { Theme } from "@copilotkit/a2ui-renderer";
15
- import { Anchor as InspectorAnchor } from "@copilotkit/web-inspector";
16
-
17
- //#region src/v1-deprecated/types/frontend-action.d.ts
18
- interface InProgressState<T extends Parameter[] | [] = []> {
19
- status: "inProgress";
20
- args: Partial<MappedParameterTypes<T>>;
21
- result: undefined;
22
- }
23
- interface ExecutingState<T extends Parameter[] | [] = []> {
24
- status: "executing";
25
- args: MappedParameterTypes<T>;
26
- result: undefined;
27
- }
28
- interface CompleteState<T extends Parameter[] | [] = []> {
29
- status: "complete";
30
- args: MappedParameterTypes<T>;
31
- result: any;
32
- }
33
- interface InProgressStateNoArgs<T extends Parameter[] | [] = []> {
34
- status: "inProgress";
35
- args: Partial<MappedParameterTypes<T>>;
36
- result: undefined;
37
- }
38
- interface ExecutingStateNoArgs<T extends Parameter[] | [] = []> {
39
- status: "executing";
40
- args: MappedParameterTypes<T>;
41
- result: undefined;
42
- }
43
- interface CompleteStateNoArgs<T extends Parameter[] | [] = []> {
44
- status: "complete";
45
- args: MappedParameterTypes<T>;
46
- result: any;
47
- }
48
- interface InProgressStateWait<T extends Parameter[] | [] = []> {
49
- status: "inProgress";
50
- args: Partial<MappedParameterTypes<T>>;
51
- /** @deprecated use respond instead */
52
- handler: undefined;
53
- respond: undefined;
54
- result: undefined;
55
- }
56
- interface ExecutingStateWait<T extends Parameter[] | [] = []> {
57
- status: "executing";
58
- args: MappedParameterTypes<T>;
59
- /** @deprecated use respond instead */
60
- handler: (result: any) => void;
61
- respond: (result: any) => void;
62
- result: undefined;
63
- }
64
- interface CompleteStateWait<T extends Parameter[] | [] = []> {
65
- status: "complete";
66
- args: MappedParameterTypes<T>;
67
- /** @deprecated use respond instead */
68
- handler: undefined;
69
- respond: undefined;
70
- result: any;
71
- }
72
- interface InProgressStateNoArgsWait<T extends Parameter[] | [] = []> {
73
- status: "inProgress";
74
- args: Partial<MappedParameterTypes<T>>;
75
- /** @deprecated use respond instead */
76
- handler: undefined;
77
- respond: undefined;
78
- result: undefined;
79
- }
80
- interface ExecutingStateNoArgsWait<T extends Parameter[] | [] = []> {
81
- status: "executing";
82
- args: MappedParameterTypes<T>;
83
- /** @deprecated use respond instead */
84
- handler: (result: any) => void;
85
- respond: (result: any) => void;
86
- result: undefined;
87
- }
88
- interface CompleteStateNoArgsWait<T extends Parameter[] | [] = []> {
89
- status: "complete";
90
- args: MappedParameterTypes<T>;
91
- /** @deprecated use respond instead */
92
- handler: undefined;
93
- respond: undefined;
94
- }
95
- type ActionRenderProps<T extends Parameter[] | [] = []> = CompleteState<T> | ExecutingState<T> | InProgressState<T>;
96
- type ActionRenderPropsNoArgs<T extends Parameter[] | [] = []> = CompleteStateNoArgs<T> | ExecutingStateNoArgs<T> | InProgressStateNoArgs<T>;
97
- type ActionRenderPropsWait<T extends Parameter[] | [] = []> = CompleteStateWait<T> | ExecutingStateWait<T> | InProgressStateWait<T>;
98
- type ActionRenderPropsNoArgsWait<T extends Parameter[] | [] = []> = CompleteStateNoArgsWait<T> | ExecutingStateNoArgsWait<T> | InProgressStateNoArgsWait<T>;
99
- type CatchAllActionRenderProps<T extends Parameter[] | [] = []> = (CompleteState<T> & {
100
- name: string;
101
- }) | (ExecutingState<T> & {
102
- name: string;
103
- }) | (InProgressState<T> & {
104
- name: string;
105
- });
106
- /**
107
- * Render props for a catch-all action that waits for a response. Same as
108
- * {@link ActionRenderPropsWait} — including `respond` while executing — plus
109
- * the `name` of the tool call being handled, since one catch-all render serves
110
- * every tool.
111
- */
112
- type CatchAllActionRenderPropsWait<T extends Parameter[] | [] = []> = (CompleteStateWait<T> & {
113
- name: string;
114
- }) | (ExecutingStateWait<T> & {
115
- name: string;
116
- }) | (InProgressStateWait<T> & {
117
- name: string;
118
- });
119
- type FrontendActionAvailability = "disabled" | "enabled" | "remote" | "frontend";
120
- type FrontendAction<T extends Parameter[] | [] = [], N extends string = string> = Action<T> & {
121
- name: Exclude<N, "*">;
122
- /**
123
- * @deprecated Use `available` instead.
124
- */
125
- disabled?: boolean;
126
- available?: FrontendActionAvailability;
127
- pairedAction?: string;
128
- followUp?: boolean;
129
- /**
130
- * Also expose this action to browser agents through the WebMCP API
131
- * (`document.modelContext`). `true` uses default annotations;
132
- * `{ annotations }` provides WebMCP annotations.
133
- */
134
- webmcp?: boolean | WebMCPToolConfig;
135
- } & ({
136
- render?: string | (T extends [] ? (props: ActionRenderPropsNoArgs<T>) => string | React$1.ReactElement : (props: ActionRenderProps<T>) => string | React$1.ReactElement); /** @deprecated use renderAndWaitForResponse instead */
137
- renderAndWait?: never;
138
- renderAndWaitForResponse?: never;
139
- } | {
140
- render?: never; /** @deprecated use renderAndWaitForResponse instead */
141
- renderAndWait?: T extends [] ? (props: ActionRenderPropsNoArgsWait<T>) => React$1.ReactElement : (props: ActionRenderPropsWait<T>) => React$1.ReactElement;
142
- renderAndWaitForResponse?: T extends [] ? (props: ActionRenderPropsNoArgsWait<T>) => React$1.ReactElement : (props: ActionRenderPropsWait<T>) => React$1.ReactElement;
143
- handler?: never;
144
- });
145
- type CatchAllFrontendAction = {
146
- name: "*";
147
- } & ({
148
- render: (props: CatchAllActionRenderProps<any>) => React$1.ReactElement; /** @deprecated use renderAndWaitForResponse instead */
149
- renderAndWait?: never;
150
- renderAndWaitForResponse?: never;
151
- } | {
152
- render?: never; /** @deprecated use renderAndWaitForResponse instead */
153
- renderAndWait?: (props: CatchAllActionRenderPropsWait<any>) => React$1.ReactElement;
154
- /**
155
- * Handle every tool call that has no dedicated action with one
156
- * human-in-the-loop render: the call stays pending until `respond` is
157
- * called. Use `name` to tell the calls apart.
158
- */
159
- renderAndWaitForResponse?: (props: CatchAllActionRenderPropsWait<any>) => React$1.ReactElement;
160
- });
161
- type RenderFunctionStatus = ActionRenderProps<any>["status"];
162
- //#endregion
163
- //#region src/v1-deprecated/hooks/use-tree.d.ts
164
- type TreeNodeId = string;
165
- interface TreeNode {
166
- id: TreeNodeId;
167
- value: string;
168
- children: TreeNode[];
169
- parentId?: TreeNodeId;
170
- categories: Set<string>;
171
- }
172
- type Tree = TreeNode[];
173
- //#endregion
174
- //#region src/v1-deprecated/types/document-pointer.d.ts
175
- interface DocumentPointer {
176
- id: string;
177
- name: string;
178
- sourceApplication: string;
179
- iconImageUri: string;
180
- getContents: () => string;
181
- }
182
- //#endregion
183
- //#region src/v1-deprecated/types/system-message.d.ts
184
- type SystemMessageFunction = (contextString: string, additionalInstructions?: string) => string;
185
- //#endregion
186
- //#region src/v1-deprecated/types/chat-suggestion-configuration.d.ts
187
- interface CopilotChatSuggestionConfiguration {
188
- /**
189
- * A prompt or instructions for the GPT to generate suggestions.
190
- */
191
- instructions: string;
192
- /**
193
- * The minimum number of suggestions to generate. Defaults to `1`.
194
- * @default 1
195
- */
196
- minSuggestions?: number;
197
- /**
198
- * The maximum number of suggestions to generate. Defaults to `3`.
199
- * @default 1
200
- */
201
- maxSuggestions?: number;
202
- /**
203
- * An optional class name to apply to the suggestions.
204
- */
205
- className?: string;
206
- }
207
- //#endregion
208
- //#region src/v1-deprecated/types/crew.d.ts
209
- /**
210
- * Status of a response or action that requires user input
211
- */
212
- type CrewsResponseStatus = "inProgress" | "complete" | "executing";
213
- /**
214
- * Response data structure for the ResponseRenderer
215
- */
216
- interface CrewsResponse {
217
- /**
218
- * Unique identifier for the response
219
- */
220
- id: string;
221
- /**
222
- * The content of the response to display
223
- */
224
- content: string;
225
- /**
226
- * Optional metadata for the response
227
- */
228
- metadata?: Record<string, any>;
229
- }
230
- /**
231
- * Base state item interface for agent state items
232
- */
233
- interface CrewsStateItem {
234
- /**
235
- * Unique identifier for the item
236
- */
237
- id: string;
238
- /**
239
- * Timestamp when the item was created
240
- */
241
- timestamp: string;
242
- }
243
- /**
244
- * Tool execution state item
245
- */
246
- interface CrewsToolStateItem extends CrewsStateItem {
247
- /**
248
- * Name of the tool that was executed
249
- */
250
- tool: string;
251
- /**
252
- * Optional thought process for the tool execution
253
- */
254
- thought?: string;
255
- /**
256
- * Result of the tool execution
257
- */
258
- result?: any;
259
- }
260
- /**
261
- * Task state item
262
- */
263
- interface CrewsTaskStateItem extends CrewsStateItem {
264
- /**
265
- * Name of the task
266
- */
267
- name: string;
268
- /**
269
- * Description of the task
270
- */
271
- description?: string;
272
- }
273
- /**
274
- * AgentState containing information about steps and tasks
275
- */
276
- interface CrewsAgentState {
277
- /**
278
- * Array of tool execution steps
279
- */
280
- steps?: CrewsToolStateItem[];
281
- /**
282
- * Array of tasks
283
- */
284
- tasks?: CrewsTaskStateItem[];
285
- }
286
- //#endregion
287
- //#region src/v1-deprecated/types/interrupt-action.d.ts
288
- interface LangGraphInterruptRenderHandlerProps<TEventValue = any> {
289
- event: LangGraphInterruptEvent<TEventValue>;
290
- resolve: (resolution: string) => void;
291
- }
292
- interface LangGraphInterruptRenderProps<TEventValue = any> {
293
- result: unknown;
294
- event: LangGraphInterruptEvent<TEventValue>;
295
- resolve: (resolution: string) => void;
296
- }
297
- interface LangGraphInterruptRender<TEventValue = any> {
298
- id: string;
299
- /**
300
- * The handler function to handle the event.
301
- */
302
- handler?: (props: LangGraphInterruptRenderHandlerProps<TEventValue>) => any | Promise<any>;
303
- /**
304
- * The render function to handle the event.
305
- */
306
- render?: (props: LangGraphInterruptRenderProps<TEventValue>) => string | React.ReactElement;
307
- /**
308
- * Method that returns a boolean, indicating if the interrupt action should run
309
- * Useful when using multiple interrupts
310
- */
311
- enabled?: (args: {
312
- eventValue: TEventValue;
313
- agentMetadata: AgentSession;
314
- }) => boolean;
315
- /**
316
- * Optional agent ID to scope this interrupt to a specific agent.
317
- * Defaults to the agent configured in the CopilotKit chat configuration.
318
- */
319
- agentId?: string;
320
- }
321
- type LangGraphInterruptAction = LangGraphInterruptRender & {
322
- event?: LangGraphInterruptEvent;
323
- };
324
- type LangGraphInterruptActionSetterArgs = Partial<LangGraphInterruptRender> | null;
325
- type LangGraphInterruptActionSetter = (action: LangGraphInterruptActionSetterArgs) => void;
326
- interface QueuedInterruptEvent {
327
- eventId: string;
328
- threadId: string;
329
- event: LangGraphInterruptEvent;
330
- }
331
- //#endregion
332
- //#region src/v1-deprecated/types/coagent-action.d.ts
333
- type CoAgentStateRenderProps<T> = {
334
- state: T;
335
- nodeName: string;
336
- status: "inProgress" | "complete";
337
- };
338
- type CoAgentStateRenderHandlerArguments<T> = {
339
- nodeName: string;
340
- state: T;
341
- };
342
- interface CoAgentStateRender<T = any> {
343
- /**
344
- * The name of the coagent.
345
- */
346
- name: string;
347
- /**
348
- * The node name of the coagent.
349
- */
350
- nodeName?: string;
351
- /**
352
- * The handler function to handle the state of the agent.
353
- */
354
- handler?: (props: CoAgentStateRenderHandlerArguments<T>) => void | Promise<void>;
355
- /**
356
- * The render function to handle the state of the agent.
357
- */
358
- render?: ((props: CoAgentStateRenderProps<T>) => string | React.ReactElement | undefined | null) | string;
359
- }
360
- //#endregion
361
- //#region src/v1-deprecated/types/coagent-state.d.ts
362
- interface CoagentState {
363
- name: string;
364
- state: any;
365
- running: boolean;
366
- active: boolean;
367
- threadId?: string;
368
- config?: {
369
- configurable?: Record<string, any>;
370
- [key: string]: any;
371
- };
372
- nodeName?: string;
373
- runId?: string;
374
- }
375
- //#endregion
376
- //#region src/v1-deprecated/context/copilot-context.d.ts
377
- /**
378
- * Interface for the configuration of the Copilot API.
379
- */
380
- interface CopilotApiConfig {
381
- /**
382
- * Your CopilotKit public license key (legacy `publicApiKey` alias of `publicLicenseKey`).
383
- */
384
- publicApiKey?: string;
385
- /**
386
- * The configuration for the CopilotKit hosted runtime.
387
- */
388
- cloud?: CopilotCloudConfig;
389
- /**
390
- * The endpoint for the chat API.
391
- */
392
- chatApiEndpoint: string;
393
- /**
394
- * The endpoint for the Copilot transcribe audio service.
395
- */
396
- transcribeAudioUrl?: string;
397
- /**
398
- * The endpoint for the Copilot text to speech service.
399
- */
400
- textToSpeechUrl?: string;
401
- /**
402
- * additional headers to be sent with the request
403
- * @default {}
404
- * @example
405
- * ```
406
- * {
407
- * 'Authorization': 'Bearer your_token_here'
408
- * }
409
- * ```
410
- */
411
- headers: Record<string, string>;
412
- /**
413
- * Custom properties to be sent with the request
414
- * @default {}
415
- * @example
416
- * ```
417
- * {
418
- * 'user_id': 'user_id'
419
- * }
420
- * ```
421
- */
422
- properties?: Record<string, any>;
423
- /**
424
- * Indicates whether the user agent should send or receive cookies from the other domain
425
- * in the case of cross-origin requests.
426
- */
427
- credentials?: RequestCredentials;
428
- /**
429
- * Optional configuration for connecting to Model Context Protocol (MCP) servers.
430
- * This is typically derived from the CopilotKitProps and used internally.
431
- * @experimental
432
- */
433
- mcpServers?: Array<{
434
- endpoint: string;
435
- apiKey?: string;
436
- }>;
437
- }
438
- type InChatRenderFunction<TProps = ActionRenderProps<any> | CatchAllActionRenderProps<any>> = (props: TProps) => string | React$1.JSX.Element;
439
- type CoagentInChatRenderFunction = (props: CoAgentStateRenderProps<any>) => string | React$1.JSX.Element | undefined | null;
440
- interface ChatComponentsCache {
441
- actions: Record<string, InChatRenderFunction | string>;
442
- coAgentStateRenders: Record<string, CoagentInChatRenderFunction | string>;
443
- }
444
- interface AgentSession {
445
- agentName: string;
446
- threadId?: string;
447
- nodeName?: string;
448
- }
449
- interface AuthState {
450
- status: "authenticated" | "unauthenticated";
451
- authHeaders: Record<string, string>;
452
- userId?: string;
453
- metadata?: Record<string, any>;
454
- }
455
- type ActionName = string;
456
- interface CopilotContextParams {
457
- actions: Record<string, FrontendAction<any>>;
458
- setAction: (id: string, action: FrontendAction<any>) => void;
459
- removeAction: (id: string) => void;
460
- setRegisteredActions: (actionConfig: any) => string;
461
- removeRegisteredAction: (actionKey: string) => void;
462
- chatComponentsCache: React$1.RefObject<ChatComponentsCache>;
463
- getFunctionCallHandler: (customEntryPoints?: Record<string, FrontendAction<any>>) => FunctionCallHandler;
464
- addContext: (context: string, parentId?: string, categories?: string[]) => TreeNodeId;
465
- removeContext: (id: TreeNodeId) => void;
466
- getAllContext: () => Tree;
467
- getContextString: (documents: DocumentPointer[], categories: string[]) => string;
468
- addDocumentContext: (documentPointer: DocumentPointer, categories?: string[]) => TreeNodeId;
469
- removeDocumentContext: (documentId: string) => void;
470
- getDocumentsContext: (categories: string[]) => DocumentPointer[];
471
- isLoading: boolean;
472
- setIsLoading: React$1.Dispatch<React$1.SetStateAction<boolean>>;
473
- chatSuggestionConfiguration: {
474
- [key: string]: CopilotChatSuggestionConfiguration;
475
- };
476
- addChatSuggestionConfiguration: (id: string, suggestion: CopilotChatSuggestionConfiguration) => void;
477
- removeChatSuggestionConfiguration: (id: string) => void;
478
- chatInstructions: string;
479
- setChatInstructions: React$1.Dispatch<React$1.SetStateAction<string>>;
480
- additionalInstructions?: string[];
481
- setAdditionalInstructions: React$1.Dispatch<React$1.SetStateAction<string[]>>;
482
- copilotApiConfig: CopilotApiConfig;
483
- showDevConsole: boolean;
484
- coagentStates: Record<string, CoagentState>;
485
- setCoagentStates: React$1.Dispatch<React$1.SetStateAction<Record<string, CoagentState>>>;
486
- coagentStatesRef: React$1.RefObject<Record<string, CoagentState>>;
487
- setCoagentStatesWithRef: (value: Record<string, CoagentState> | ((prev: Record<string, CoagentState>) => Record<string, CoagentState>)) => void;
488
- agentSession: AgentSession | null;
489
- setAgentSession: React$1.Dispatch<React$1.SetStateAction<AgentSession | null>>;
490
- agentLock: string | null;
491
- threadId: string;
492
- setThreadId: React$1.Dispatch<React$1.SetStateAction<string>>;
493
- runId: string | null;
494
- setRunId: React$1.Dispatch<React$1.SetStateAction<string | null>>;
495
- chatAbortControllerRef: React$1.MutableRefObject<AbortController | null>;
496
- /**
497
- * The forwarded parameters to use for the task.
498
- */
499
- forwardedParameters?: Partial<Pick<ForwardedParametersInput, "temperature">>;
500
- availableAgents: Agent[];
501
- /**
502
- * The auth states for the CopilotKit.
503
- */
504
- authStates_c?: Record<ActionName, AuthState>;
505
- setAuthStates_c?: React$1.Dispatch<React$1.SetStateAction<Record<ActionName, AuthState>>>;
506
- /**
507
- * The auth config for the CopilotKit.
508
- */
509
- authConfig_c?: {
510
- SignInComponent: React$1.ComponentType<{
511
- onSignInComplete: (authState: AuthState) => void;
512
- }>;
513
- };
514
- extensions: ExtensionsInput;
515
- setExtensions: React$1.Dispatch<React$1.SetStateAction<ExtensionsInput>>;
516
- interruptActions: Record<string, LangGraphInterruptRender>;
517
- setInterruptAction: LangGraphInterruptActionSetter;
518
- removeInterruptAction: (actionId: string) => void;
519
- interruptEventQueue: Record<string, QueuedInterruptEvent[]>;
520
- addInterruptEvent: (queuedEvent: QueuedInterruptEvent) => void;
521
- resolveInterruptEvent: (threadId: string, eventId: string, response: string) => void;
522
- /**
523
- * Optional trace handler for comprehensive debugging and observability.
524
- */
525
- onError: CopilotErrorHandler;
526
- bannerError: CopilotKitError | null;
527
- setBannerError: React$1.Dispatch<React$1.SetStateAction<CopilotKitError | null>>;
528
- internalErrorHandlers: Record<string, CopilotErrorHandler>;
529
- setInternalErrorHandler: (handler: Record<string, CopilotErrorHandler>) => void;
530
- removeInternalErrorHandler: (id: string) => void;
531
- }
532
- declare const CopilotContext: React$1.Context<CopilotContextParams>;
533
- declare function useCopilotContext(): CopilotContextParams;
534
- //#endregion
535
- //#region src/v2/components/chat/CopilotChatAudioRecorder.d.ts
536
- /** Finite-state machine for every recorder implementation */
537
- type AudioRecorderState = "idle" | "recording" | "processing";
538
- /** Error subclass so callers can `instanceof`-guard recorder failures */
539
- declare class AudioRecorderError extends Error {
540
- constructor(message: string);
541
- }
542
- interface AudioRecorderRef {
543
- state: AudioRecorderState;
544
- start: () => Promise<void>;
545
- stop: () => Promise<Blob>;
546
- dispose: () => void;
547
- }
548
- declare const CopilotChatAudioRecorder: react.ForwardRefExoticComponent<react.HTMLAttributes<HTMLDivElement> & react.RefAttributes<AudioRecorderRef>>;
549
- //#endregion
550
- //#region src/v2/providers/CopilotChatConfigurationProvider.d.ts
551
- declare const CopilotChatDefaultLabels: {
552
- chatInputPlaceholder: string;
553
- chatInputToolbarStartTranscribeButtonLabel: string;
554
- chatInputToolbarCancelTranscribeButtonLabel: string;
555
- chatInputToolbarFinishTranscribeButtonLabel: string;
556
- chatInputToolbarAddButtonLabel: string;
557
- chatInputToolbarToolsButtonLabel: string;
558
- chatInputToolbarSendButtonLabel: string;
559
- chatInputToolbarStopButtonLabel: string;
560
- assistantMessageToolbarCopyCodeLabel: string;
561
- assistantMessageToolbarCopyCodeCopiedLabel: string;
562
- assistantMessageToolbarCopyMessageLabel: string;
563
- assistantMessageToolbarInspectorLabel: string;
564
- assistantMessageToolbarInspectorDescription: string;
565
- assistantMessageToolbarInspectorLocalOnlyLabel: string;
566
- assistantMessageToolbarInspectorLocalOnlyDescription: string;
567
- assistantMessageToolbarInspectorTitle: string;
568
- assistantMessageToolbarInspectorHideLabel: string;
569
- assistantMessageToolbarInspectorHideDescription: string;
570
- assistantMessageToolbarThumbsUpLabel: string;
571
- assistantMessageToolbarThumbsDownLabel: string;
572
- assistantMessageFeedbackCommentPlaceholder: string;
573
- assistantMessageFeedbackCommentSubmitLabel: string;
574
- assistantMessageToolbarReadAloudLabel: string;
575
- assistantMessageToolbarRegenerateLabel: string;
576
- userMessageToolbarCopyMessageLabel: string;
577
- userMessageToolbarEditMessageLabel: string;
578
- userMessageToolbarPreviousBranchLabel: string;
579
- userMessageToolbarNextBranchLabel: string;
580
- chatDisclaimerText: string;
581
- chatToggleOpenLabel: string;
582
- chatToggleCloseLabel: string;
583
- chatScrollToBottomLabel: string;
584
- modalHeaderTitle: string;
585
- welcomeMessageText: string;
586
- reasoningMessageThinkingLabel: string;
587
- chatInputSlashMenuLabel: string;
588
- chatInputSlashMenuEmptyText: string;
589
- attachmentRemoveButtonLabel: string;
590
- attachmentPlayVideoButtonLabel: string;
591
- attachmentPreviewCloseButtonLabel: string;
592
- modalHeaderCloseButtonLabel: string;
593
- modalHeaderThreadsButtonLabel: string;
594
- sidebarLabel: string;
595
- };
596
- type CopilotChatLabels = typeof CopilotChatDefaultLabels;
597
- interface CopilotChatConfigurationValue {
598
- labels: CopilotChatLabels;
599
- agentId: string;
600
- threadId: string;
601
- isModalOpen: boolean;
602
- setModalOpen: (open: boolean) => void;
603
- /**
604
- * Whether the thread-list drawer is open. A sibling boolean to `isModalOpen`
605
- * (deliberately NOT folded into a tri-state enum): on desktop the chat modal
606
- * and the drawer coexist, so two independent booleans are required.
607
- */
608
- drawerOpen: boolean;
609
- /**
610
- * Toggles the drawer open state. On mobile viewports (`<768px`) opening the
611
- * drawer closes the chat modal (mutual exclusion); on desktop there is no
612
- * constraint.
613
- */
614
- setDrawerOpen: (open: boolean) => void;
615
- /**
616
- * True once a `<CopilotThreadsDrawer>` wrapper has registered itself with this chat
617
- * configuration. The header thread-list launcher renders ONLY when this is
618
- * set, so chats with no drawer stay byte-for-byte unchanged.
619
- */
620
- drawerRegistered: boolean;
621
- /**
622
- * Called by the drawer wrapper on mount to announce its presence (and flip
623
- * `drawerRegistered`). Returns a cleanup function that de-registers the
624
- * drawer on unmount.
625
- *
626
- * @returns A cleanup callback that reverses the registration.
627
- */
628
- registerDrawer: () => () => void;
629
- /**
630
- * Internal: registers the modal-close setter of the provider that actually
631
- * owns the rendered modal (a descendant that supplied `isModalDefaultOpen`),
632
- * so the drawer's mobile mutual-exclusion — owned by the top-most provider —
633
- * closes the modal that is genuinely on screen rather than the top-most
634
- * provider's own (possibly unrendered) modal state.
635
- *
636
- * @param closeModal - A setter the drawer may call to close the rendered modal.
637
- * @returns A cleanup callback that de-registers the closer.
638
- */
639
- ɵregisterModalCloser: (closeModal: (open: boolean) => void) => () => void;
640
- hasExplicitThreadId: boolean;
641
- /**
642
- * Imperatively sets the active thread for this chat configuration.
643
- *
644
- * Use this to drive the rendered thread without a host callback — e.g. a
645
- * `<CopilotThreadsDrawer>` selecting a thread row sets it explicitly so the chat
646
- * connects to that backend thread.
647
- *
648
- * Guarded like the top-level `<CopilotKit>` provider's `setThreadId`: when
649
- * the consumer controls the threadId via the `threadId` prop on this
650
- * provider, this is a no-op (a warning is logged) so a prop-controlled
651
- * threadId is never silently overridden.
652
- *
653
- * @param threadId - The thread id to make active.
654
- * @param options.explicit - Whether the thread is a caller choice. Defaults
655
- * to `true` (a picked thread). Pass `false` to set a non-explicit thread
656
- * so the welcome screen shows (see {@link startNewThread}).
657
- */
658
- setActiveThreadId: (threadId: string, options?: {
659
- explicit?: boolean;
660
- }) => void;
661
- /**
662
- * Resets the active thread to a fresh, non-explicit client-side thread: a
663
- * newly minted UUID with `hasExplicitThreadId=false`, so the welcome screen
664
- * shows. Pairs with the core `startNewThread()` to clear the conversation
665
- * with no host wiring.
666
- *
667
- * Guarded identically to {@link setActiveThreadId}: a no-op when the
668
- * threadId is prop-controlled.
669
- */
670
- startNewThread: () => void;
671
- }
672
- interface CopilotChatConfigurationProviderProps {
673
- children: ReactNode;
674
- labels?: Partial<CopilotChatLabels>;
675
- agentId?: string;
676
- threadId?: string;
677
- hasExplicitThreadId?: boolean;
678
- isModalDefaultOpen?: boolean;
679
- }
680
- declare const CopilotChatConfigurationProvider: React$1.FC<CopilotChatConfigurationProviderProps>;
681
- declare const useCopilotChatConfiguration: () => CopilotChatConfigurationValue | null;
682
- //#endregion
683
- //#region src/v2/lib/slots.d.ts
684
- /** Existing union (unchanged) */
685
- type SlotValue<C extends React$1.ComponentType<any>> = C | string | Partial<React$1.ComponentProps<C>>;
686
- /** Utility: concrete React elements for every slot */
687
- type SlotElements<S> = { [K in keyof S]: React$1.ReactElement };
688
- type WithSlots<S extends Record<string, React$1.ComponentType<any>>, Rest = {}> = { [K in keyof S]?: SlotValue<S[K]> } & {
689
- children?: (props: SlotElements<S> & Rest) => React$1.ReactNode;
690
- } & Omit<Rest, "children">;
691
- //#endregion
692
- //#region src/v2/components/chat/CopilotChatInput.d.ts
693
- type CopilotChatInputMode = "input" | "transcribe" | "processing";
694
- type ToolsMenuItem = {
695
- label: string;
696
- } & ({
697
- action: () => void;
698
- items?: never;
699
- } | {
700
- action?: never;
701
- items: (ToolsMenuItem | "-")[];
702
- });
703
- type CopilotChatInputSlots = {
704
- textArea: typeof CopilotChatInput.TextArea;
705
- sendButton: typeof CopilotChatInput.SendButton;
706
- startTranscribeButton: typeof CopilotChatInput.StartTranscribeButton;
707
- cancelTranscribeButton: typeof CopilotChatInput.CancelTranscribeButton;
708
- finishTranscribeButton: typeof CopilotChatInput.FinishTranscribeButton;
709
- addMenuButton: typeof CopilotChatInput.AddMenuButton;
710
- audioRecorder: typeof CopilotChatAudioRecorder;
711
- disclaimer: typeof CopilotChatInput.Disclaimer;
712
- };
713
- type CopilotChatInputRestProps = {
714
- mode?: CopilotChatInputMode;
715
- toolsMenu?: (ToolsMenuItem | "-")[];
716
- autoFocus?: boolean;
717
- onSubmitMessage?: (value: string) => void;
718
- onStop?: () => void;
719
- isRunning?: boolean;
720
- onStartTranscribe?: () => void;
721
- onCancelTranscribe?: () => void;
722
- onFinishTranscribe?: () => void;
723
- onFinishTranscribeWithAudio?: (audioBlob: Blob) => Promise<void>;
724
- onAddFile?: () => void;
725
- value?: string;
726
- onChange?: (value: string) => void; /** Positioning mode for the input container. Default: 'static' */
727
- positioning?: "static" | "absolute"; /** Keyboard height in pixels for mobile keyboard handling */
728
- keyboardHeight?: number; /** Ref for the outer positioning container */
729
- containerRef?: React$1.Ref<HTMLDivElement>; /** Whether to show the disclaimer. Default: true for absolute positioning, false for static */
730
- showDisclaimer?: boolean;
731
- /**
732
- * Set to `true` when the input sits at the bottom of its container as a
733
- * flex-last-child (visible position is driven by layout, not CSS
734
- * positioning). Triggers reservation of bottom space for the fixed
735
- * CopilotKit license banner via the
736
- * `--copilotkit-license-banner-offset` CSS var so the two don't overlap.
737
- *
738
- * Not needed when `positioning === "absolute"`; that mode already pins the
739
- * input to the bottom and picks up the same reservation automatically.
740
- * Leave unset (default `false`) for inputs rendered mid-layout such as the
741
- * welcome screen, where the banner offset would push the input off-center.
742
- */
743
- bottomAnchored?: boolean;
744
- } & Omit<React$1.HTMLAttributes<HTMLDivElement>, "onChange">;
745
- type CopilotChatInputBaseProps = WithSlots<CopilotChatInputSlots, CopilotChatInputRestProps>;
746
- type CopilotChatInputChildrenArgs = CopilotChatInputBaseProps extends {
747
- children?: infer C;
748
- } ? C extends ((props: infer P) => React$1.ReactNode) ? P : never : never;
749
- type CopilotChatInputProps = Omit<CopilotChatInputBaseProps, "children"> & {
750
- children?: (props: CopilotChatInputChildrenArgs) => React$1.ReactNode;
751
- };
752
- /**
753
- * The chat composer: a text area with the add-menu, voice and send/stop
754
- * buttons, and a slash-command menu that lists `toolsMenu` items once the text
755
- * starts with "/".
756
- */
757
- declare function CopilotChatInput({
758
- mode,
759
- onSubmitMessage,
760
- onStop,
761
- isRunning,
762
- onStartTranscribe,
763
- onCancelTranscribe,
764
- onFinishTranscribe,
765
- onFinishTranscribeWithAudio,
766
- onAddFile,
767
- onChange,
768
- value,
769
- toolsMenu,
770
- autoFocus,
771
- positioning,
772
- keyboardHeight,
773
- containerRef,
774
- showDisclaimer,
775
- bottomAnchored,
776
- textArea,
777
- sendButton,
778
- startTranscribeButton,
779
- cancelTranscribeButton,
780
- finishTranscribeButton,
781
- addMenuButton,
782
- audioRecorder,
783
- disclaimer,
784
- children,
785
- className,
786
- ...props
787
- }: CopilotChatInputProps): react_jsx_runtime0.JSX.Element;
788
- declare namespace CopilotChatInput {
789
- /**
790
- * The icon-only send button. Its accessible name is
791
- * `labels.chatInputToolbarSendButtonLabel` unless an `aria-label` is passed;
792
- * the input passes `labels.chatInputToolbarStopButtonLabel` while the button
793
- * stops a run.
794
- */
795
- const SendButton: React$1.FC<React$1.ButtonHTMLAttributes<HTMLButtonElement>>;
796
- /**
797
- * An icon-only toolbar button. `labels[labelKey]` is both its accessible
798
- * name and its tooltip text.
799
- */
800
- const ToolbarButton: React$1.FC<React$1.ButtonHTMLAttributes<HTMLButtonElement> & {
801
- icon: React$1.ReactNode;
802
- labelKey: keyof CopilotChatLabels;
803
- defaultClassName?: string;
804
- }>;
805
- const StartTranscribeButton: React$1.FC<React$1.ButtonHTMLAttributes<HTMLButtonElement>>;
806
- const CancelTranscribeButton: React$1.FC<React$1.ButtonHTMLAttributes<HTMLButtonElement>>;
807
- const FinishTranscribeButton: React$1.FC<React$1.ButtonHTMLAttributes<HTMLButtonElement>>;
808
- /**
809
- * The "+" button that opens the attachment and tools menu. Its accessible
810
- * name and tooltip come from `labels.chatInputToolbarAddButtonLabel`.
811
- */
812
- const AddMenuButton: React$1.FC<React$1.ButtonHTMLAttributes<HTMLButtonElement> & {
813
- toolsMenu?: (ToolsMenuItem | "-")[];
814
- onAddFile?: () => void;
815
- }>;
816
- type TextAreaProps = React$1.TextareaHTMLAttributes<HTMLTextAreaElement>;
817
- const TextArea: React$1.ForwardRefExoticComponent<TextAreaProps & React$1.RefAttributes<HTMLTextAreaElement>>;
818
- const AudioRecorder: React$1.ForwardRefExoticComponent<React$1.HTMLAttributes<HTMLDivElement> & React$1.RefAttributes<AudioRecorderRef>>;
819
- const Disclaimer: React$1.FC<React$1.HTMLAttributes<HTMLDivElement>>;
820
- }
821
- //#endregion
822
- //#region src/v2/components/chat/tool-call-layout.d.ts
823
- /**
824
- * How the chat shows tool calls.
825
- *
826
- * - `"grouped"` (default): calls made in a row share one card, collapsed to a
827
- * summary ("Used 3 tools") that opens to a row per call.
828
- * - `"line"`: the same grouping as a quiet line of text, like the reasoning
829
- * message's "Thought for 4 seconds".
830
- * - `"stacked"`: the latest call on top of a stack of the earlier ones; click
831
- * to fan the stack out into its cards.
832
- * - `"turn"`: the agent works in the open (narration, then a row per call),
833
- * and when the reply is done everything before it folds into "Worked for 9s".
834
- * - `"separate"`: every call gets its own card, as before grouping existed.
835
- *
836
- * Only calls drawn by a renderer that opts into grouping (`group: true`) are
837
- * grouped; CopilotKit's built-in card from `useDefaultRenderTool()` does. Any
838
- * other call always shows on its own and splits the group around it.
839
- */
840
- type CopilotChatToolCallDisplay = "grouped" | "line" | "stacked" | "turn" | "separate";
841
- /** One tool call and, once it has finished, the message carrying its result. */
842
- interface ToolCallEntry {
843
- toolCall: ToolCall;
844
- toolMessage?: ToolMessage;
845
- }
846
- //#endregion
847
- //#region src/v2/components/chat/CopilotChatToolCallGroup.d.ts
848
- type CopilotChatToolCallGroupAppearance = "card" | "line" | "stack";
849
- interface CopilotChatToolCallGroupProps extends Omit<React$1.HTMLAttributes<HTMLDivElement>, "children"> {
850
- /** The calls in the group, in order. */
851
- calls: ToolCallEntry[];
852
- /** Renders one call through the registered renderers. */
853
- renderCall: (call: ToolCallEntry) => React$1.ReactNode;
854
- /**
855
- * - `"card"` (default): one card with a summary header and a row per call.
856
- * - `"line"`: a quiet line of text that opens to a list of rows.
857
- * - `"stack"`: the latest call on a stack of the earlier ones.
858
- */
859
- appearance?: CopilotChatToolCallGroupAppearance;
860
- /** The agent is running and nothing follows the group, so more calls may join it. */
861
- isActive?: boolean;
862
- }
863
- /**
864
- * Tool calls made in a row, collapsed into one summary. While a call runs the
865
- * summary names it ("Running read_file src/app.ts"); once they're all done it
866
- * reads "Used 3 tools" and opens to the calls.
867
- *
868
- * Each call is drawn by its registered renderer. CopilotKit's built-in card
869
- * (`useDefaultRenderTool`) draws a compact row inside the card and line
870
- * appearances and an open stack; a custom wildcard renderer draws whatever it
871
- * draws.
872
- */
873
- declare function CopilotChatToolCallGroup({
874
- calls,
875
- renderCall,
876
- appearance,
877
- isActive,
878
- className,
879
- ...props
880
- }: CopilotChatToolCallGroupProps): react_jsx_runtime0.JSX.Element | null;
881
- //#endregion
882
- //#region src/v2/components/chat/CopilotChatToolCallsView.d.ts
883
- type CopilotChatToolCallsViewProps = {
884
- message: AssistantMessage;
885
- messages?: Message$2[];
886
- /**
887
- * How to show the calls (see `CopilotChatToolCallDisplay`). Inside a message
888
- * view it follows the view's `toolCallDisplay`; on its own it defaults to
889
- * `"grouped"`.
890
- */
891
- display?: CopilotChatToolCallDisplay;
892
- /**
893
- * Draws a group of calls made in a row: a component, a class name for the
894
- * default group, or props for it (e.g. `{ appearance: "line" }`).
895
- */
896
- group?: SlotValue<typeof CopilotChatToolCallGroup>;
897
- };
898
- declare function CopilotChatToolCallsView({
899
- message,
900
- messages,
901
- display: displayProp,
902
- group
903
- }: CopilotChatToolCallsViewProps): react_jsx_runtime0.JSX.Element | null;
904
- //#endregion
905
- //#region src/v2/components/chat/CopilotChatAssistantMessage.d.ts
906
- type CopilotChatFeedbackMessage = AssistantMessage & {
907
- rawEvent?: unknown;
908
- };
909
- type CopilotChatAssistantMessageProps = WithSlots<{
910
- markdownRenderer: typeof CopilotChatAssistantMessage.MarkdownRenderer;
911
- toolbar: typeof CopilotChatAssistantMessage.Toolbar;
912
- copyButton: typeof CopilotChatAssistantMessage.CopyButton;
913
- inspectorButton: typeof CopilotChatAssistantMessage.InspectorButton;
914
- thumbsUpButton: typeof CopilotChatAssistantMessage.ThumbsUpButton;
915
- thumbsDownButton: typeof CopilotChatAssistantMessage.ThumbsDownButton;
916
- readAloudButton: typeof CopilotChatAssistantMessage.ReadAloudButton;
917
- regenerateButton: typeof CopilotChatAssistantMessage.RegenerateButton;
918
- toolCallsView: typeof CopilotChatToolCallsView;
919
- }, {
920
- onThumbsUp?: (message: CopilotChatFeedbackMessage) => void;
921
- onThumbsDown?: (message: CopilotChatFeedbackMessage) => void;
922
- onReadAloud?: (message: AssistantMessage) => void;
923
- onRegenerate?: (message: AssistantMessage) => void;
924
- message: AssistantMessage;
925
- messages?: Message$2[];
926
- isRunning?: boolean;
927
- /**
928
- * Whether this is the last message the chat renders. The message view
929
- * passes it, because the rendered list can differ from `messages` when
930
- * `transformMessages` drops, replaces or reorders messages. Defaults to
931
- * comparing against the last entry of `messages`.
932
- */
933
- isLatest?: boolean;
934
- additionalToolbarItems?: React.ReactNode;
935
- toolbarVisible?: boolean;
936
- /**
937
- * The comment field of a reply rating, inside the popover next to the
938
- * chosen thumb. Shown only while Automatic Learning records ratings; it
939
- * renders after `children`, so a `children` layout does not place it.
940
- */
941
- feedbackComment?: SlotValue<typeof CopilotChatAssistantMessage.FeedbackComment>;
942
- } & React.HTMLAttributes<HTMLDivElement>>;
943
- declare function CopilotChatAssistantMessage({
944
- message,
945
- messages,
946
- isRunning,
947
- isLatest,
948
- onThumbsUp,
949
- onThumbsDown,
950
- onReadAloud,
951
- onRegenerate,
952
- additionalToolbarItems,
953
- toolbarVisible,
954
- markdownRenderer,
955
- toolbar,
956
- copyButton,
957
- inspectorButton,
958
- thumbsUpButton,
959
- thumbsDownButton,
960
- readAloudButton,
961
- regenerateButton,
962
- feedbackComment: feedbackCommentSlot,
963
- toolCallsView,
964
- children,
965
- className,
966
- ...props
967
- }: CopilotChatAssistantMessageProps): react_jsx_runtime0.JSX.Element;
968
- declare namespace CopilotChatAssistantMessage {
969
- const MarkdownRenderer: React.FC<Omit<React.ComponentProps<typeof Streamdown>, "children"> & {
970
- content: string; /** Id of the rendered message. The markdown transport finds its fences by it. */
971
- messageId?: string;
972
- }>;
973
- const Toolbar: React.FC<React.HTMLAttributes<HTMLDivElement>>;
974
- const ToolbarButton: React.FC<React.ButtonHTMLAttributes<HTMLButtonElement> & {
975
- title: string;
976
- tooltip?: React.ReactNode;
977
- tooltipClassName?: string;
978
- children: React.ReactNode;
979
- }>;
980
- const CopyButton: React.FC<React.ButtonHTMLAttributes<HTMLButtonElement>>;
981
- const InspectorButton: React.FC<React.ButtonHTMLAttributes<HTMLButtonElement>>;
982
- const ThumbsUpButton: React.FC<React.ButtonHTMLAttributes<HTMLButtonElement>>;
983
- const ThumbsDownButton: React.FC<React.ButtonHTMLAttributes<HTMLButtonElement>>;
984
- /**
985
- * The comment field of a rating, shown in a popover next to the chosen
986
- * thumb. Enter saves; Send appears once the text differs from the saved
987
- * comment. The popover marks itself `data-copilotkit-ignore`, so Learning
988
- * records the saved comment but not the typing; outside it, mark the
989
- * field yourself.
990
- */
991
- const FeedbackComment: React.FC<{
992
- value: string; /** The comment already saved. */
993
- savedComment: string;
994
- inputRef?: React.Ref<HTMLInputElement>;
995
- onChange: (value: string) => void;
996
- onSubmit: () => void;
997
- onEditingChange?: (editing: boolean) => void;
998
- /**
999
- * Focus left the form for `next`, or for no focusable element when null.
1000
- * Not called when the window loses focus.
1001
- */
1002
- onLeave?: (next: Element | null) => void;
1003
- className?: string;
1004
- }>;
1005
- const ReadAloudButton: React.FC<React.ButtonHTMLAttributes<HTMLButtonElement>>;
1006
- const RegenerateButton: React.FC<React.ButtonHTMLAttributes<HTMLButtonElement>>;
1007
- }
1008
- //#endregion
1009
- //#region src/v2/components/chat/CopilotChatUserMessage.d.ts
1010
- interface CopilotChatUserMessageOnEditMessageProps {
1011
- message: UserMessage;
1012
- }
1013
- interface CopilotChatUserMessageOnSwitchToBranchProps {
1014
- message: UserMessage;
1015
- branchIndex: number;
1016
- numberOfBranches: number;
1017
- }
1018
- type CopilotChatUserMessageProps = WithSlots<{
1019
- messageRenderer: typeof CopilotChatUserMessage.MessageRenderer;
1020
- toolbar: typeof CopilotChatUserMessage.Toolbar;
1021
- copyButton: typeof CopilotChatUserMessage.CopyButton;
1022
- editButton: typeof CopilotChatUserMessage.EditButton;
1023
- branchNavigation: typeof CopilotChatUserMessage.BranchNavigation;
1024
- }, {
1025
- onEditMessage?: (props: CopilotChatUserMessageOnEditMessageProps) => void;
1026
- onSwitchToBranch?: (props: CopilotChatUserMessageOnSwitchToBranchProps) => void;
1027
- message: UserMessage;
1028
- branchIndex?: number;
1029
- numberOfBranches?: number;
1030
- additionalToolbarItems?: React.ReactNode;
1031
- } & React.HTMLAttributes<HTMLDivElement>>;
1032
- declare function CopilotChatUserMessage({
1033
- message,
1034
- onEditMessage,
1035
- branchIndex,
1036
- numberOfBranches,
1037
- onSwitchToBranch,
1038
- additionalToolbarItems,
1039
- messageRenderer,
1040
- toolbar,
1041
- copyButton,
1042
- editButton,
1043
- branchNavigation,
1044
- children,
1045
- className,
1046
- ...props
1047
- }: CopilotChatUserMessageProps): react_jsx_runtime0.JSX.Element;
1048
- declare namespace CopilotChatUserMessage {
1049
- const Container: React.FC<React.PropsWithChildren<React.HTMLAttributes<HTMLDivElement>>>;
1050
- const MessageRenderer: React.FC<{
1051
- content: string;
1052
- className?: string;
1053
- }>;
1054
- const Toolbar: React.FC<React.HTMLAttributes<HTMLDivElement>>;
1055
- const ToolbarButton: React.FC<React.ButtonHTMLAttributes<HTMLButtonElement> & {
1056
- title: string;
1057
- children: React.ReactNode;
1058
- }>;
1059
- const CopyButton: React.FC<React.ButtonHTMLAttributes<HTMLButtonElement> & {
1060
- copied?: boolean;
1061
- }>;
1062
- const EditButton: React.FC<React.ButtonHTMLAttributes<HTMLButtonElement>>;
1063
- /**
1064
- * Previous/next buttons and an "n/m" counter for switching between branches
1065
- * of a user message. Renders only with more than one branch and an
1066
- * `onSwitchToBranch` handler. The buttons are named by
1067
- * `labels.userMessageToolbarPreviousBranchLabel` and
1068
- * `labels.userMessageToolbarNextBranchLabel`.
1069
- */
1070
- const BranchNavigation: React.FC<React.HTMLAttributes<HTMLDivElement> & {
1071
- currentBranch?: number;
1072
- numberOfBranches?: number;
1073
- onSwitchToBranch?: (props: CopilotChatUserMessageOnSwitchToBranchProps) => void;
1074
- message: UserMessage;
1075
- }>;
1076
- }
1077
- //#endregion
1078
- //#region src/v2/components/chat/CopilotChatReasoningMessage.d.ts
1079
- type CopilotChatReasoningMessageProps = WithSlots<{
1080
- header: typeof CopilotChatReasoningMessage.Header;
1081
- contentView: typeof CopilotChatReasoningMessage.Content;
1082
- toggle: typeof CopilotChatReasoningMessage.Toggle;
1083
- }, {
1084
- message: ReasoningMessage;
1085
- messages?: Message$2[];
1086
- isRunning?: boolean;
1087
- /**
1088
- * Whether this is the last message the chat renders. The message view
1089
- * passes it, because the rendered list can differ from `messages` when
1090
- * `transformMessages` drops, replaces or reorders messages. Defaults to
1091
- * comparing against the last entry of `messages`.
1092
- */
1093
- isLatest?: boolean;
1094
- } & React.HTMLAttributes<HTMLDivElement>>;
1095
- /**
1096
- * A reasoning message as a collapsible block. While the model reasons it is
1097
- * open and the header shows `labels.reasoningMessageThinkingLabel`; when
1098
- * streaming ends it collapses and the header reads "Thought for …". The
1099
- * `header` slot also receives `elapsedSeconds`.
1100
- */
1101
- declare function CopilotChatReasoningMessage({
1102
- message,
1103
- messages,
1104
- isRunning,
1105
- isLatest: isLatestProp,
1106
- header,
1107
- contentView,
1108
- toggle,
1109
- children,
1110
- className,
1111
- ...props
1112
- }: CopilotChatReasoningMessageProps): react_jsx_runtime0.JSX.Element;
1113
- declare namespace CopilotChatReasoningMessage {
1114
- const Header: React.FC<React.ButtonHTMLAttributes<HTMLButtonElement> & {
1115
- isOpen?: boolean;
1116
- label?: string;
1117
- hasContent?: boolean;
1118
- isStreaming?: boolean;
1119
- /**
1120
- * Seconds spent reasoning so far, updated every second while streaming.
1121
- * The default label formats it in English ("Thought for 12 seconds");
1122
- * a custom header can use it to build a localized label.
1123
- */
1124
- elapsedSeconds?: number;
1125
- }>;
1126
- const Content: React.FC<React.HTMLAttributes<HTMLDivElement> & {
1127
- isStreaming?: boolean;
1128
- hasContent?: boolean;
1129
- }>;
1130
- const Toggle: React.FC<React.HTMLAttributes<HTMLDivElement> & {
1131
- isOpen?: boolean;
1132
- }>;
1133
- }
1134
- //#endregion
1135
- //#region src/v2/components/chat/CopilotChatSuggestionPill.d.ts
1136
- interface CopilotChatSuggestionPillProps extends React$1.ButtonHTMLAttributes<HTMLButtonElement> {
1137
- /** Optional icon to render on the left side when not loading. */
1138
- icon?: React$1.ReactNode;
1139
- /** Whether the pill should display a loading spinner. */
1140
- isLoading?: boolean;
1141
- }
1142
- declare const CopilotChatSuggestionPill: React$1.ForwardRefExoticComponent<CopilotChatSuggestionPillProps & React$1.RefAttributes<HTMLButtonElement>>;
1143
- //#endregion
1144
- //#region src/v2/components/chat/CopilotChatSuggestionView.d.ts
1145
- declare const DefaultContainer: React$1.ForwardRefExoticComponent<React$1.HTMLAttributes<HTMLDivElement> & React$1.RefAttributes<HTMLDivElement>>;
1146
- type CopilotChatSuggestionViewProps = WithSlots<{
1147
- container: typeof DefaultContainer;
1148
- suggestion: typeof CopilotChatSuggestionPill;
1149
- }, {
1150
- suggestions: Suggestion[];
1151
- onSelectSuggestion?: (suggestion: Suggestion, index: number) => void;
1152
- loadingIndexes?: ReadonlyArray<number>;
1153
- } & React$1.HTMLAttributes<HTMLDivElement>>;
1154
- declare const CopilotChatSuggestionView: React$1.ForwardRefExoticComponent<{
1155
- container?: SlotValue<React$1.ForwardRefExoticComponent<React$1.HTMLAttributes<HTMLDivElement> & React$1.RefAttributes<HTMLDivElement>>> | undefined;
1156
- suggestion?: SlotValue<React$1.ForwardRefExoticComponent<CopilotChatSuggestionPillProps & React$1.RefAttributes<HTMLButtonElement>>> | undefined;
1157
- } & {
1158
- children?: ((props: {
1159
- container: React$1.ReactElement<unknown, string | React$1.JSXElementConstructor<any>>;
1160
- suggestion: React$1.ReactElement<unknown, string | React$1.JSXElementConstructor<any>>;
1161
- } & {
1162
- suggestions: Suggestion[];
1163
- onSelectSuggestion?: (suggestion: Suggestion, index: number) => void;
1164
- loadingIndexes?: ReadonlyArray<number>;
1165
- } & React$1.HTMLAttributes<HTMLDivElement>) => React$1.ReactNode) | undefined;
1166
- } & Omit<{
1167
- suggestions: Suggestion[];
1168
- onSelectSuggestion?: (suggestion: Suggestion, index: number) => void;
1169
- loadingIndexes?: ReadonlyArray<number>;
1170
- } & React$1.HTMLAttributes<HTMLDivElement>, "children"> & React$1.RefAttributes<HTMLDivElement>>;
1171
- //#endregion
1172
- //#region src/v2/components/chat/CopilotChatWorkSummary.d.ts
1173
- interface CopilotChatWorkSummaryProps extends React$1.ButtonHTMLAttributes<HTMLButtonElement> {
1174
- /** The agent is still working on this reply. */
1175
- isWorking: boolean;
1176
- /** Whether the work (narration and tool calls) is showing. */
1177
- isOpen: boolean;
1178
- /** The tool calls the reply made. */
1179
- calls: ToolCallEntry[];
1180
- /**
1181
- * How long the agent has worked on the reply, in ms, summed over its runs
1182
- * so time spent waiting between them doesn't count. Only known for replies
1183
- * this client watched start; without it the summary shows the tool count.
1184
- */
1185
- elapsedMs?: number;
1186
- /** When the current run started (epoch ms), while the agent is working. */
1187
- workingSince?: number;
1188
- }
1189
- /**
1190
- * The line at the top of a reply in the `"turn"` tool-call display. While the
1191
- * agent works it reads "Working 4s"; once the reply is done it reads "Worked
1192
- * for 9s · 7 tools" and toggles the work it folded away.
1193
- */
1194
- declare function CopilotChatWorkSummary({
1195
- isWorking,
1196
- isOpen,
1197
- calls,
1198
- elapsedMs,
1199
- workingSince,
1200
- className,
1201
- ...props
1202
- }: CopilotChatWorkSummaryProps): react_jsx_runtime0.JSX.Element;
1203
- //#endregion
1204
- //#region src/v2/components/intelligence-indicator/IntelligenceIndicatorView.d.ts
1205
- /** Lifecycle state the brain hands the face. */
1206
- type IntelligenceIndicatorStatus = "in-progress" | "finished";
1207
- interface IntelligenceIndicatorViewProps extends React$1.HTMLAttributes<HTMLSpanElement> {
1208
- /** The assistant message this indicator is attached to. */
1209
- message: Message$2;
1210
- /**
1211
- * Whether the intelligence work is still running (`in-progress`) or
1212
- * has settled (`finished`). Drives the icon morph and chrome
1213
- * fade-out via the `data-status` attribute on the wrapper.
1214
- */
1215
- status: IntelligenceIndicatorStatus;
1216
- /** The visible label, e.g. "Using CopilotKit Intelligence". */
1217
- label: string;
1218
- }
1219
- /**
1220
- * The presentational "CopilotKit Intelligence" face — the default
1221
- * rendered by the {@link IntelligenceIndicator} brain and the default
1222
- * value for the `intelligenceIndicator` slot.
1223
- *
1224
- * Layout: a glassmorphism pill (the `__chrome` layer) wrapping an icon
1225
- * and a label. The icon is two overlaid SVG paths — a spinner arc and a
1226
- * checkmark — whose geometry lives in each path's `d` ATTRIBUTE so it
1227
- * renders in every browser (the CSS `d:` property is Chrome-only).
1228
- *
1229
- * Two states, driven by the `data-status` attribute (see globals.css
1230
- * for the exact timing):
1231
- * 1. **In-progress.** The arc spins (CSS rotation) inside the pill and
1232
- * the checkmark is hidden. Label + icon are a saturated purple.
1233
- * 2. **Finished.** The arc fades out mid-spin while the checkmark draws
1234
- * itself in upright (animated `stroke-dashoffset`); the pill chrome
1235
- * fades away; and the label + icon settle from purple to a neutral
1236
- * gray, with the label slanting slightly (a `transform: skewX`
1237
- * faux-italic, so it interpolates with the color instead of snapping
1238
- * and never reflows). The result reads as quiet "history metadata"
1239
- * rather than an active spinner. The label text itself never changes
1240
- * — the static check plus the color/slant shift carry the "done"
1241
- * meaning, so no wording change is needed.
1242
- *
1243
- * All motion is gated behind `prefers-reduced-motion` (globals.css):
1244
- * when reduced motion is requested the arc does not spin and the two
1245
- * states swap instantly, without transitions.
1246
- *
1247
- * Customize via the `intelligenceIndicator` slot on `CopilotChat`:
1248
- * a className string restyles the wrapper, a props object tweaks
1249
- * the default (`{ label }`), and a component replaces it entirely
1250
- * with full control over visuals and timing.
1251
- */
1252
- declare function IntelligenceIndicatorView({
1253
- message,
1254
- status,
1255
- label,
1256
- className,
1257
- ...rest
1258
- }: IntelligenceIndicatorViewProps): React$1.ReactElement;
1259
- //#endregion
1260
- //#region src/v2/components/intelligence-indicator/IntelligenceIndicator.d.ts
1261
- interface IntelligenceIndicatorProps {
1262
- /** The message this indicator is attached to. */
1263
- message: Message$2;
1264
- /**
1265
- * Agent id whose run state the indicator tracks. Pass through from
1266
- * the surrounding chat configuration; mounting from
1267
- * `CopilotChatMessageView` resolves this automatically.
1268
- */
1269
- agentId: string;
1270
- /**
1271
- * Optional override for the visible label. Defaults to
1272
- * "CopilotKit Intelligence".
1273
- */
1274
- label?: string;
1275
- /**
1276
- * Slot override for the presentational face. A className string, a
1277
- * props object, or a full replacement component — see
1278
- * {@link IntelligenceIndicatorView}. Forwarded from the
1279
- * `intelligenceIndicator` slot on `CopilotChat`.
1280
- */
1281
- intelligenceIndicator?: SlotValue<typeof IntelligenceIndicatorView>;
1282
- }
1283
- /**
1284
- * Stable turn id for the messages that precede the first user message (a turn
1285
- * with no opening user message of its own). Used as the React key so the
1286
- * indicator for that turn never collides with a real user-message id.
1287
- */
1288
- declare const INTELLIGENCE_TURN_HEAD = "__cpk_turn_head__";
1289
- /**
1290
- * Map each Intelligence-using turn to its anchor message — the FIRST bash-using
1291
- * assistant message of the turn — and a stable turn id (the id of the user
1292
- * message that opened the turn, or {@link INTELLIGENCE_TURN_HEAD} for the
1293
- * pre-first-user turn). Returns `Map<anchorMessageId, turnId>`.
1294
- *
1295
- * Anchoring to the FIRST (not last) bash-using message keeps the indicator
1296
- * fixed in place for the whole turn: later bash steps don't reposition it, so
1297
- * the spinner never abruptly jumps mid-turn (bug 1). `CopilotChatMessageView`
1298
- * emits exactly one `IntelligenceIndicator` per entry, keyed by the turn id and
1299
- * positioned at the anchor; the per-turn key also lets every past turn keep its
1300
- * own indicator in scroll-back.
1301
- *
1302
- * `visibleMessages` is what actually renders, when that differs from
1303
- * `messages` (the chat's `transformMessages`). Turns are still read from the
1304
- * full list, so hiding a user message does not merge its turn into the one
1305
- * before it, and anchors are only chosen among visible messages. A message the
1306
- * transform built itself joins the turn of the visible message before it.
1307
- */
1308
- declare function getIntelligenceTurnAnchors(messages: readonly Message$2[], visibleMessages?: readonly Message$2[]): Map<string, string>;
1309
- /**
1310
- * The "Using CopilotKit Intelligence" indicator brain. Auto-mounted by
1311
- * `CopilotChatMessageView` — once per Intelligence-using turn, at that
1312
- * turn's anchor message and keyed by the turn id (see
1313
- * {@link getIntelligenceTurnAnchors}). Callers do not register this
1314
- * themselves. It owns the run subscription and the phase machine and
1315
- * renders its swappable face via the `intelligenceIndicator` slot.
1316
- *
1317
- * Placement (which message anchors the turn) is decided by the view, so
1318
- * this component does not self-gate its own placement; it only derives
1319
- * in-progress/finished for the turn it was mounted on.
1320
- *
1321
- * Render gates (all must hold):
1322
- * 1. `copilotkit.intelligence !== undefined`
1323
- * 2. The (anchor) message is an assistant message with at least one
1324
- * tool call whose name matches {@link DEFAULT_TOOL_PATTERNS}.
1325
- * 3. The phase machine is past `hidden`.
1326
- *
1327
- * Because the view keys each indicator by its turn id, the instance moves
1328
- * with the anchor across a hand-off (no remount, no spinner restart), and
1329
- * every prior Intelligence-using turn keeps its own persistent indicator
1330
- * in chat history.
1331
- *
1332
- * Phase machine (per-instance, all timers local):
1333
- * - Starts in `hidden`, unless the message mounts onto an
1334
- * already-completed turn (no pending work, agent stopped or a
1335
- * real follow-up already present), in which case the lazy
1336
- * `useState` initializer starts directly in `finished`. This is
1337
- * what avoids a "hidden flash" on history replay.
1338
- * - `hidden → spinner` once a matching tool call has been pending
1339
- * (no `tool`-role result with a matching `toolCallId`) for
1340
- * {@link PENDING_THRESHOLD_MS}. Replay flashes (tool call + result
1341
- * in the same tick) never cross this threshold.
1342
- * - `hidden → finished` if after the grace window the turn is
1343
- * already complete (no pending work AND
1344
- * `sawRealFollowup || !agent.isRunning`). Handles very fast tools
1345
- * whose result lands within the grace window.
1346
- * - `spinner → finished` as soon as EITHER `agent.isRunning` flips
1347
- * false OR a non-tool-call-like message appears later in
1348
- * `agent.messages` (i.e. the agent produced a "real" follow-up —
1349
- * prose answer or a new user turn).
1350
- * - `finished` is terminal: the indicator settles into its
1351
- * persistent tag form and stays mounted.
1352
- */
1353
- declare function IntelligenceIndicator(props: IntelligenceIndicatorProps): React$1.ReactElement | null;
1354
- //#endregion
1355
- //#region src/v2/components/chat/CopilotChatMessageView.d.ts
1356
- /** What the view passes the wrapper of a message group. */
1357
- interface MessageGroupWrapperProps<S = unknown> {
1358
- /** The group's key, as returned by `groupMessages`. */
1359
- groupKey: string;
1360
- /** The messages in the group, in order. */
1361
- messages: Message$2[];
1362
- /** The default rendering of the group's messages. */
1363
- children: React$1.ReactNode;
1364
- /**
1365
- * State the view keeps for this group, keyed by `groupKey`. It survives the
1366
- * row leaving the window and the wrapper remounting, is dropped once the key
1367
- * no longer appears, and is cleared when the thread changes. `undefined`
1368
- * until first set.
1369
- */
1370
- state: S | undefined;
1371
- setState: (next: S) => void;
1372
- }
1373
- /** Several messages rendered as one row, inside an app-provided wrapper. */
1374
- interface MessageGroup<S = unknown> {
1375
- type: "group";
1376
- /**
1377
- * Identifies the group across renders: its React key and the key its state
1378
- * is held under. Keep it stable while the thread streams, e.g. the id of the
1379
- * group's first message.
1380
- */
1381
- key: string;
1382
- messages: Message$2[];
1383
- /**
1384
- * Define it once at module level. A component created inside
1385
- * `groupMessages` is a new type on every call and remounts each time.
1386
- */
1387
- wrapper: React$1.ComponentType<MessageGroupWrapperProps<S>>;
1388
- }
1389
- /** One row of the message list: a single message, or a group of them. */
1390
- type MessageRow = {
1391
- type: "message";
1392
- message: Message$2;
1393
- } | MessageGroup;
1394
- /** A row holding a single message, rendered as it would be ungrouped. */
1395
- declare function messageRow(message: Message$2): MessageRow;
1396
- /** A row holding a group of messages, rendered inside `wrapper`. */
1397
- declare function messageGroup<S>(group: Omit<MessageGroup<S>, "type">): MessageRow;
1398
- type CopilotChatMessageViewProps = Omit<WithSlots<{
1399
- assistantMessage: typeof CopilotChatAssistantMessage;
1400
- userMessage: typeof CopilotChatUserMessage;
1401
- reasoningMessage: typeof CopilotChatReasoningMessage;
1402
- cursor: typeof CopilotChatMessageView.Cursor;
1403
- intelligenceIndicator: typeof IntelligenceIndicatorView; /** The "Working… / Worked for 9s" line of the `"turn"` tool-call display. */
1404
- workSummary: typeof CopilotChatWorkSummary;
1405
- }, {
1406
- isRunning?: boolean;
1407
- messages?: Message$2[];
1408
- /**
1409
- * Reshapes the message list before it renders: drop, replace or reorder
1410
- * messages with the whole list in view. Receives the list after duplicate
1411
- * ids are merged. Row keys, virtualization and rendering all work off
1412
- * the returned list, so a dropped message takes no row.
1413
- *
1414
- * Tool-call cards still look up their results in the full list, so
1415
- * hiding tool-result messages here does not strip results from them.
1416
- *
1417
- * Memoized on the input list and this function — pass a stable function
1418
- * (e.g. `useCallback`) or it reruns on every render.
1419
- */
1420
- transformMessages?: (messages: Message$2[]) => Message$2[];
1421
- /**
1422
- * Splits the message list into rows. Return `messageRow(message)` for a
1423
- * message that renders on its own, and `messageGroup({ key, messages,
1424
- * wrapper })` for messages that render together inside `wrapper` — a
1425
- * collapsible block of tool calls, say. Receives the list after
1426
- * `transformMessages`. Each row is one virtualized row.
1427
- *
1428
- * Return each message in at most one row. Tool-call cards still find
1429
- * their results in the full list.
1430
- *
1431
- * Memoized on its input and this function — pass a stable function.
1432
- */
1433
- groupMessages?: (messages: Message$2[]) => MessageRow[];
1434
- /**
1435
- * Whether reply thumbs record ratings for Automatic Learning once a
1436
- * Trajectory has started. Defaults to `true`; set `false` to keep the
1437
- * thumbs to your own `onThumbsUp` / `onThumbsDown` handlers and slots.
1438
- */
1439
- messageFeedback?: boolean;
1440
- /**
1441
- * How tool calls show. Defaults to `"grouped"`: calls made in a row
1442
- * share one card that opens to a row per call. `"line"` and `"stacked"`
1443
- * group them too; `"turn"` folds a reply's whole working phase into
1444
- * "Worked for 9s" once it's done; `"separate"` gives every call its own
1445
- * card. Calls with a renderer of their own always show on their own.
1446
- */
1447
- toolCallDisplay?: CopilotChatToolCallDisplay;
1448
- } & React$1.HTMLAttributes<HTMLDivElement>>, "children"> & {
1449
- children?: (props: {
1450
- isRunning: boolean;
1451
- messages: Message$2[];
1452
- messageElements: React$1.ReactElement[];
1453
- interruptElement: React$1.ReactElement | null;
1454
- }) => React$1.ReactElement;
1455
- };
1456
- declare function CopilotChatMessageView({
1457
- messages,
1458
- assistantMessage,
1459
- userMessage,
1460
- reasoningMessage,
1461
- cursor,
1462
- intelligenceIndicator,
1463
- workSummary,
1464
- isRunning,
1465
- transformMessages,
1466
- groupMessages,
1467
- messageFeedback,
1468
- toolCallDisplay,
1469
- children,
1470
- className,
1471
- ...props
1472
- }: CopilotChatMessageViewProps): react_jsx_runtime0.JSX.Element;
1473
- declare namespace CopilotChatMessageView {
1474
- var Cursor: ({
1475
- className,
1476
- ...props
1477
- }: React$1.HTMLAttributes<HTMLDivElement>) => react_jsx_runtime0.JSX.Element;
1478
- }
1479
- //#endregion
1480
- //#region src/v2/components/chat/normalize-auto-scroll.d.ts
1481
- type AutoScrollMode = "pin-to-bottom" | "pin-to-send" | "none";
1482
- //#endregion
1483
- //#region src/v2/components/chat/CopilotChatView.d.ts
1484
- type WelcomeScreenProps = WithSlots<{
1485
- welcomeMessage: React$1.FC<React$1.HTMLAttributes<HTMLDivElement>>;
1486
- }, {
1487
- input: React$1.ReactElement;
1488
- suggestionView: React$1.ReactElement;
1489
- } & React$1.HTMLAttributes<HTMLDivElement>>;
1490
- type CopilotChatViewProps = WithSlots<{
1491
- messageView: typeof CopilotChatMessageView;
1492
- scrollView: typeof CopilotChatView.ScrollView;
1493
- input: typeof CopilotChatInput;
1494
- suggestionView: typeof CopilotChatSuggestionView;
1495
- }, {
1496
- messages?: Message$2[];
1497
- autoScroll?: AutoScrollMode | boolean;
1498
- isRunning?: boolean;
1499
- suggestions?: Suggestion[];
1500
- suggestionLoadingIndexes?: ReadonlyArray<number>;
1501
- onSelectSuggestion?: (suggestion: Suggestion, index: number) => void;
1502
- welcomeScreen?: SlotValue<React$1.FC<WelcomeScreenProps>> | boolean;
1503
- onSubmitMessage?: (value: string) => void;
1504
- onStop?: () => void;
1505
- inputMode?: CopilotChatInputMode;
1506
- inputValue?: string;
1507
- onInputChange?: (value: string) => void;
1508
- onStartTranscribe?: () => void;
1509
- onCancelTranscribe?: () => void;
1510
- onFinishTranscribe?: () => void;
1511
- onFinishTranscribeWithAudio?: (audioBlob: Blob) => Promise<void>;
1512
- attachments?: Attachment[];
1513
- onRemoveAttachment?: (id: string) => void;
1514
- onAddFile?: () => void;
1515
- dragOver?: boolean;
1516
- onDragOver?: (e: React$1.DragEvent) => void;
1517
- onDragLeave?: (e: React$1.DragEvent) => void;
1518
- onDrop?: (e: React$1.DragEvent) => void;
1519
- /**
1520
- * When `true`, suppresses the welcome screen while a thread's initial
1521
- * connect is in flight. Prevents the "How can I help you today?" flash
1522
- * that would otherwise appear between mounting an empty agent instance
1523
- * and the bootstrap messages arriving from /connect.
1524
- */
1525
- isConnecting?: boolean;
1526
- /**
1527
- * When `true`, the caller has explicitly picked a thread (via `threadId`
1528
- * prop or `CopilotChatConfigurationProvider`). Suppresses the welcome
1529
- * screen unconditionally — a caller-managed thread targets a specific
1530
- * conversation and should render its messages (or an empty panel during
1531
- * connect) rather than a generic "start a new chat" greeting.
1532
- */
1533
- hasExplicitThreadId?: boolean;
1534
- /**
1535
- * @deprecated Use the `input` slot's `disclaimer` prop instead:
1536
- * ```tsx
1537
- * <CopilotChat input={{ disclaimer: MyDisclaimer }} />
1538
- * ```
1539
- */
1540
- disclaimer?: SlotValue<React$1.FC<React$1.HTMLAttributes<HTMLDivElement>>>;
1541
- /**
1542
- * Slot for the "Using CopilotKit Intelligence" indicator. Pass-through
1543
- * to `CopilotChatMessageView`'s `intelligenceIndicator` slot — accepts a
1544
- * className string, a props object, or a replacement component.
1545
- */
1546
- intelligenceIndicator?: SlotValue<typeof IntelligenceIndicatorView>;
1547
- } & Omit<React$1.HTMLAttributes<HTMLDivElement>, "inputMode">>;
1548
- declare function CopilotChatView({
1549
- messageView,
1550
- input,
1551
- scrollView,
1552
- suggestionView,
1553
- welcomeScreen,
1554
- messages,
1555
- autoScroll,
1556
- isRunning,
1557
- suggestions,
1558
- suggestionLoadingIndexes,
1559
- onSelectSuggestion,
1560
- onSubmitMessage,
1561
- onStop,
1562
- inputMode,
1563
- inputValue,
1564
- onInputChange,
1565
- onStartTranscribe,
1566
- onCancelTranscribe,
1567
- onFinishTranscribe,
1568
- onFinishTranscribeWithAudio,
1569
- attachments,
1570
- onRemoveAttachment,
1571
- onAddFile,
1572
- dragOver,
1573
- onDragOver,
1574
- onDragLeave,
1575
- onDrop,
1576
- isConnecting,
1577
- hasExplicitThreadId,
1578
- disclaimer,
1579
- intelligenceIndicator,
1580
- children,
1581
- className,
1582
- ...props
1583
- }: CopilotChatViewProps): react_jsx_runtime0.JSX.Element;
1584
- declare namespace CopilotChatView {
1585
- const ScrollView: React$1.FC<React$1.HTMLAttributes<HTMLDivElement> & {
1586
- autoScroll?: AutoScrollMode | boolean;
1587
- scrollThreadId?: string;
1588
- scrollToBottomButton?: SlotValue<React$1.FC<React$1.ButtonHTMLAttributes<HTMLButtonElement>>>;
1589
- feather?: SlotValue<React$1.FC<React$1.HTMLAttributes<HTMLDivElement>>>;
1590
- inputContainerHeight?: number;
1591
- isResizing?: boolean;
1592
- }>;
1593
- /**
1594
- * Scrolls the message list to the latest message. Shown while the user is
1595
- * scrolled up; its accessible name is `labels.chatScrollToBottomLabel`.
1596
- */
1597
- const ScrollToBottomButton: React$1.FC<React$1.ButtonHTMLAttributes<HTMLButtonElement>>;
1598
- const Feather: React$1.FC<React$1.HTMLAttributes<HTMLDivElement>>;
1599
- const WelcomeMessage: React$1.FC<React$1.HTMLAttributes<HTMLDivElement>>;
1600
- const WelcomeScreen: React$1.FC<WelcomeScreenProps>;
1601
- }
1602
- //#endregion
1603
- //#region src/v2/components/chat/CopilotChat.d.ts
1604
- type CopilotChatProps = Omit<CopilotChatViewProps, "messages" | "isRunning" | "suggestions" | "suggestionLoadingIndexes" | "onSelectSuggestion" | "attachments" | "onRemoveAttachment" | "onAddFile" | "dragOver" | "onDragOver" | "onDragLeave" | "onDrop"> & {
1605
- agentId?: string;
1606
- threadId?: string;
1607
- labels?: Partial<CopilotChatLabels>;
1608
- /**
1609
- * Enable Inspector message shortcuts for this chat (enabled by default).
1610
- * An explicit CopilotKit provider enableInspector value takes priority.
1611
- * Shortcuts only appear in local development while Inspector is visible.
1612
- */
1613
- inspectorTools?: boolean; /** Accepts a className, partial props, or any component with CopilotChatView props — static namespace members are not required. */
1614
- chatView?: SlotValue<React$1.ComponentType<CopilotChatViewProps>>;
1615
- isModalDefaultOpen?: boolean; /** Enable multimodal file attachments (images, audio, video, documents). */
1616
- attachments?: AttachmentsConfig;
1617
- /**
1618
- * Error handler scoped to this chat's agent. Fires in addition to the
1619
- * provider-level onError (does not suppress it). Receives only errors
1620
- * whose context.agentId matches this chat's agent.
1621
- */
1622
- onError?: (event: {
1623
- error: Error;
1624
- code: CopilotKitCoreErrorCode;
1625
- context: Record<string, any>;
1626
- }) => void | Promise<void>;
1627
- /**
1628
- * Throttle interval (in milliseconds) for re-renders triggered by message
1629
- * change notifications. Overrides the provider-level `defaultThrottleMs`
1630
- * for this chat instance. Forwarded to the internal `useAgent()` hook,
1631
- * which resolves the effective throttle value.
1632
- *
1633
- * @default undefined — inherits from provider `defaultThrottleMs`;
1634
- * if that is also unset, re-renders are unthrottled. Note: passing
1635
- * `throttleMs={0}` explicitly disables throttling for this instance
1636
- * even when the provider specifies a non-zero `defaultThrottleMs`.
1637
- */
1638
- throttleMs?: number;
1639
- /**
1640
- * Experimental. Wrapper for generative UI surfaces rendered in this chat.
1641
- * Receives `{ surfaceId, isStreaming, error, children }`.
1642
- */
1643
- generativeUISurface?: React$1.ComponentType<GenerativeUIChatSurfaceProps>;
1644
- };
1645
- declare function CopilotChat({
1646
- agentId,
1647
- threadId,
1648
- labels,
1649
- inspectorTools,
1650
- chatView,
1651
- isModalDefaultOpen,
1652
- attachments: attachmentsConfig,
1653
- onError,
1654
- throttleMs,
1655
- generativeUISurface,
1656
- ...props
1657
- }: CopilotChatProps): react_jsx_runtime0.JSX.Element;
1658
- declare namespace CopilotChat {
1659
- const View: typeof CopilotChatView;
1660
- }
1661
- //#endregion
1662
- //#region src/v2/components/chat/CopilotChatToggleButton.d.ts
1663
- declare const DefaultOpenIcon: React$1.FC<React$1.SVGProps<SVGSVGElement>>;
1664
- declare const DefaultCloseIcon: React$1.FC<React$1.SVGProps<SVGSVGElement>>;
1665
- interface CopilotChatToggleButtonProps extends Omit<React$1.ButtonHTMLAttributes<HTMLButtonElement>, "children"> {
1666
- /** Optional slot override for the chat (closed) icon. */
1667
- openIcon?: SlotValue<typeof DefaultOpenIcon>;
1668
- /** Optional slot override for the close icon. */
1669
- closeIcon?: SlotValue<typeof DefaultCloseIcon>;
1670
- }
1671
- declare const CopilotChatToggleButton: React$1.ForwardRefExoticComponent<CopilotChatToggleButtonProps & React$1.RefAttributes<HTMLButtonElement>>;
1672
- //#endregion
1673
- //#region src/v2/components/chat/CopilotModalHeader.d.ts
1674
- type HeaderSlots = {
1675
- titleContent: typeof CopilotModalHeader.Title;
1676
- closeButton: typeof CopilotModalHeader.CloseButton;
1677
- drawerLauncher: typeof CopilotModalHeader.DrawerLauncher;
1678
- };
1679
- type HeaderRestProps = {
1680
- title?: string;
1681
- } & Omit<React$1.HTMLAttributes<HTMLDivElement>, "children">;
1682
- /**
1683
- * Payload handed to the optional `children` render function. `drawerLauncher`
1684
- * is nullable because the launcher is rendered only when a drawer has
1685
- * registered — when none is present, custom layouts receive `null` and can omit
1686
- * the launcher slot entirely.
1687
- */
1688
- type HeaderChildrenPayload = {
1689
- titleContent: React$1.ReactElement;
1690
- closeButton: React$1.ReactElement;
1691
- drawerLauncher: React$1.ReactElement | null;
1692
- title?: string;
1693
- } & Omit<HeaderRestProps, "title">;
1694
- type CopilotModalHeaderProps = Omit<WithSlots<HeaderSlots, HeaderRestProps>, "children"> & {
1695
- children?: (props: HeaderChildrenPayload) => React$1.ReactNode;
1696
- };
1697
- declare function CopilotModalHeader({
1698
- title,
1699
- titleContent,
1700
- closeButton,
1701
- drawerLauncher,
1702
- children,
1703
- className,
1704
- ...rest
1705
- }: CopilotModalHeaderProps): string | number | bigint | boolean | Iterable<React$1.ReactNode> | Promise<string | number | bigint | boolean | React$1.ReactPortal | React$1.ReactElement<unknown, string | React$1.JSXElementConstructor<any>> | Iterable<React$1.ReactNode> | null | undefined> | react_jsx_runtime0.JSX.Element | null | undefined;
1706
- declare namespace CopilotModalHeader {
1707
- var displayName: string;
1708
- }
1709
- declare namespace CopilotModalHeader {
1710
- const Title: React$1.FC<React$1.HTMLAttributes<HTMLDivElement>>;
1711
- /**
1712
- * Closes the popup or sidebar. Its accessible name is
1713
- * `labels.modalHeaderCloseButtonLabel`.
1714
- */
1715
- const CloseButton: React$1.FC<React$1.ButtonHTMLAttributes<HTMLButtonElement>>;
1716
- /**
1717
- * The thread-list launcher button. Rendered in the header ONLY when a
1718
- * `<CopilotThreadsDrawer>` wrapper has registered with the chat configuration; it
1719
- * toggles the drawer open state. The stable `data-testid` is the focus-return
1720
- * target for the drawer wrapper on cancel/back/backdrop/Escape.
1721
- */
1722
- const DrawerLauncher: React$1.FC<React$1.ButtonHTMLAttributes<HTMLButtonElement>>;
1723
- }
1724
- //#endregion
1725
- //#region src/v2/components/chat/CopilotSidebarView.d.ts
1726
- type CopilotSidebarViewProps = CopilotChatViewProps & {
1727
- header?: SlotValue<typeof CopilotModalHeader>;
1728
- toggleButton?: SlotValue<typeof CopilotChatToggleButton>;
1729
- width?: number | string;
1730
- defaultOpen?: boolean;
1731
- position?: "left" | "right";
1732
- };
1733
- /**
1734
- * The chat in a side panel: a `complementary` region named by
1735
- * `labels.sidebarLabel`, with a header, the chat view and a toggle button.
1736
- */
1737
- declare function CopilotSidebarView({
1738
- header,
1739
- toggleButton,
1740
- width,
1741
- defaultOpen,
1742
- position,
1743
- ...props
1744
- }: CopilotSidebarViewProps): react_jsx_runtime0.JSX.Element;
1745
- declare namespace CopilotSidebarView {
1746
- var displayName: string;
1747
- }
1748
- declare namespace CopilotSidebarView {
1749
- /**
1750
- * Sidebar-specific welcome screen layout:
1751
- * - Suggestions at the top
1752
- * - Welcome message in the middle
1753
- * - Input fixed at the bottom (like normal chat)
1754
- */
1755
- const WelcomeScreen: React$1.FC<WelcomeScreenProps>;
1756
- }
1757
- //#endregion
1758
- //#region src/v2/components/chat/CopilotPopupView.d.ts
1759
- type CopilotPopupViewProps = CopilotChatViewProps & {
1760
- header?: SlotValue<typeof CopilotModalHeader>;
1761
- toggleButton?: SlotValue<typeof CopilotChatToggleButton>;
1762
- width?: number | string;
1763
- height?: number | string;
1764
- clickOutsideToClose?: boolean;
1765
- defaultOpen?: boolean;
1766
- };
1767
- declare function CopilotPopupView({
1768
- header,
1769
- toggleButton,
1770
- width,
1771
- height,
1772
- clickOutsideToClose,
1773
- defaultOpen,
1774
- className,
1775
- ...restProps
1776
- }: CopilotPopupViewProps): react_jsx_runtime0.JSX.Element;
1777
- declare namespace CopilotPopupView {
1778
- var displayName: string;
1779
- }
1780
- declare namespace CopilotPopupView {
1781
- /**
1782
- * Popup-specific welcome screen layout:
1783
- * - Welcome message centered vertically
1784
- * - Suggestions just above input
1785
- * - Input fixed at the bottom
1786
- */
1787
- const WelcomeScreen: React$1.FC<WelcomeScreenProps>;
1788
- }
1789
- //#endregion
1790
- //#region src/v2/components/chat/CopilotSidebar.d.ts
1791
- type CopilotSidebarProps = Omit<CopilotChatProps, "chatView"> & {
1792
- header?: CopilotSidebarViewProps["header"];
1793
- toggleButton?: CopilotSidebarViewProps["toggleButton"];
1794
- defaultOpen?: boolean;
1795
- /**
1796
- * Controlled open state. When supplied, the host owns whether the sidebar is
1797
- * open: the sidebar renders this value and never changes it on its own.
1798
- * Pair it with `onOpenChange` to react to the toggle button. Omit it (and use
1799
- * `defaultOpen`) to let the sidebar manage its own state.
1800
- */
1801
- open?: boolean;
1802
- /**
1803
- * Called with the requested state whenever the sidebar asks to open or close
1804
- * (the toggle button, or the thread drawer on mobile). In controlled mode
1805
- * nothing moves until the host updates `open`.
1806
- */
1807
- onOpenChange?: (open: boolean) => void;
1808
- width?: number | string;
1809
- position?: CopilotSidebarViewProps["position"];
1810
- };
1811
- declare function CopilotSidebar({
1812
- header,
1813
- toggleButton,
1814
- defaultOpen,
1815
- open,
1816
- onOpenChange,
1817
- width,
1818
- position,
1819
- ...chatProps
1820
- }: CopilotSidebarProps): react_jsx_runtime0.JSX.Element;
1821
- declare namespace CopilotSidebar {
1822
- var displayName: string;
1823
- }
1824
- //#endregion
1825
- //#region src/v2/components/chat/CopilotPopup.d.ts
1826
- type CopilotPopupProps = Omit<CopilotChatProps, "chatView"> & {
1827
- header?: CopilotPopupViewProps["header"];
1828
- toggleButton?: CopilotPopupViewProps["toggleButton"];
1829
- defaultOpen?: boolean;
1830
- /**
1831
- * Controlled open state. When supplied, the host owns whether the popup is
1832
- * open: the popup renders this value and never changes it on its own. Pair it
1833
- * with `onOpenChange` to react to the toggle button and to click-outside.
1834
- * Omit it (and use `defaultOpen`) to let the popup manage its own state.
1835
- */
1836
- open?: boolean;
1837
- /**
1838
- * Called with the requested state whenever the popup asks to open or close
1839
- * (the toggle button, click-outside, or the thread drawer on mobile). In
1840
- * controlled mode nothing moves until the host updates `open`.
1841
- */
1842
- onOpenChange?: (open: boolean) => void;
1843
- width?: CopilotPopupViewProps["width"];
1844
- height?: CopilotPopupViewProps["height"];
1845
- clickOutsideToClose?: CopilotPopupViewProps["clickOutsideToClose"];
1846
- };
1847
- declare function CopilotPopup({
1848
- header,
1849
- toggleButton,
1850
- defaultOpen,
1851
- open,
1852
- onOpenChange,
1853
- width,
1854
- height,
1855
- clickOutsideToClose,
1856
- ...chatProps
1857
- }: CopilotPopupProps): react_jsx_runtime0.JSX.Element;
1858
- declare namespace CopilotPopup {
1859
- var displayName: string;
1860
- }
1861
- //#endregion
1862
- //#region src/v2/hooks/use-threads.d.ts
1863
- /**
1864
- * A conversation thread managed by CopilotKit Intelligence.
1865
- *
1866
- * Each thread has a unique `id`, an optional human-readable `name`, and
1867
- * timestamp fields tracking creation and update times.
1868
- */
1869
- interface Thread {
1870
- id: string;
1871
- agentId: string;
1872
- name: string | null;
1873
- archived: boolean;
1874
- createdAt: string;
1875
- updatedAt: string;
1876
- /**
1877
- * ISO-8601 timestamp of the most recent agent run on this thread. Absent
1878
- * when the thread has never been run. Prefer this over `updatedAt` for
1879
- * user-facing "last activity" displays — it is not bumped by metadata-only
1880
- * actions like rename or archive.
1881
- */
1882
- lastRunAt?: string;
1883
- }
1884
- /**
1885
- * Configuration for the {@link useThreads} hook.
1886
- *
1887
- * Thread operations are scoped to the runtime-authenticated user and the
1888
- * provided agent on CopilotKit Intelligence.
1889
- */
1890
- interface UseThreadsInput {
1891
- /** The ID of the agent whose threads to list and manage. */
1892
- agentId: string;
1893
- /** When `true`, archived threads are included in the list. Defaults to `false`. */
1894
- includeArchived?: boolean;
1895
- /** Maximum number of threads to fetch per page. When set, enables cursor-based pagination. */
1896
- limit?: number;
1897
- /**
1898
- * When `false`, the hook stays inert: no runtime context is dispatched, so
1899
- * NO thread-list fetch or realtime subscription is issued. Used by gated
1900
- * surfaces (e.g. an unlicensed `<CopilotThreadsDrawer>`) that must not touch the
1901
- * network until the gate opens. Defaults to `true`.
1902
- *
1903
- * Flipping `enabled` back to `true` resumes normal fetching on the next
1904
- * effect run; mutations are likewise short-circuited while disabled.
1905
- */
1906
- enabled?: boolean;
1907
- }
1908
- /**
1909
- * Return value of the {@link useThreads} hook.
1910
- *
1911
- * The `threads` array is kept in sync with the platform via a realtime
1912
- * WebSocket subscription (when available) and is sorted most-recently-updated
1913
- * first. Mutations reject with an `Error` if the platform request fails.
1914
- */
1915
- interface UseThreadsResult {
1916
- /**
1917
- * Threads for the current user/agent pair, sorted by most recently
1918
- * updated first. Updated in realtime when the platform pushes metadata
1919
- * events. Includes archived threads only when `includeArchived` is set.
1920
- */
1921
- threads: Thread[];
1922
- /**
1923
- * `true` while the initial thread list is being fetched from the platform.
1924
- * Subsequent realtime updates do not re-enter the loading state.
1925
- */
1926
- isLoading: boolean;
1927
- /**
1928
- * The most recent error from fetching threads or executing a mutation,
1929
- * or `null` when there is no error. Reset to `null` on the next
1930
- * successful fetch.
1931
- *
1932
- * This channel folds together developer/config errors (missing runtime URL,
1933
- * runtime without thread endpoints) and genuine list-load/mutation failures.
1934
- * End-user surfaces that must not leak config errors should prefer
1935
- * {@link listError}, which excludes the config/runtime-setup errors.
1936
- */
1937
- error: Error | null;
1938
- /**
1939
- * The most recent genuine list-load or mutation error from the platform, or
1940
- * `null`. Unlike {@link error}, this EXCLUDES developer/config errors (a
1941
- * missing runtime URL, or a runtime that does not advertise thread
1942
- * endpoints), so an end-user surface can render it directly without leaking
1943
- * a developer-facing configuration message into the UI.
1944
- */
1945
- listError: Error | null;
1946
- /**
1947
- * The error from the most recent FAILED next-page (fetch-more) load, or
1948
- * `null`. Tracked separately from {@link listError} so a paginated-load
1949
- * failure surfaces an inline "couldn't load more" affordance while the
1950
- * already-loaded list stays visible. Cleared when a fetch-more is retried or
1951
- * succeeds.
1952
- */
1953
- fetchMoreError: Error | null;
1954
- /**
1955
- * `true` when there are more threads available to fetch via
1956
- * {@link fetchMoreThreads}. Only meaningful when `limit` is set.
1957
- */
1958
- hasMoreThreads: boolean;
1959
- /**
1960
- * `true` while a subsequent page of threads is being fetched.
1961
- */
1962
- isFetchingMoreThreads: boolean;
1963
- /**
1964
- * `true` while at least one thread mutation (rename, archive, unarchive,
1965
- * delete) is awaiting a server response. Mutations apply optimistically, so
1966
- * this is primarily useful for disabling controls or showing a subtle
1967
- * in-flight indicator.
1968
- */
1969
- isMutating: boolean;
1970
- /**
1971
- * Fetch the next page of threads. No-op when {@link hasMoreThreads} is
1972
- * `false` or a fetch is already in progress.
1973
- */
1974
- fetchMoreThreads: () => void;
1975
- /**
1976
- * Re-fetch the thread list from the platform without clearing the current
1977
- * list. Backs the drawer's error-state Retry and the Active/All filter
1978
- * refetch. No-op until the runtime is connected.
1979
- */
1980
- refetchThreads: () => void;
1981
- /**
1982
- * Reset to a fresh, non-explicit client-side thread so the welcome screen
1983
- * shows. Lazy creation: no row appears in {@link threads} until the new
1984
- * thread's first run persists server-side.
1985
- */
1986
- startNewThread: () => void;
1987
- /**
1988
- * Rename a thread on the platform.
1989
- * Resolves when the server confirms the update; rejects on failure.
1990
- */
1991
- renameThread: (threadId: string, name: string) => Promise<void>;
1992
- /**
1993
- * Archive a thread on the platform.
1994
- * Archived threads are excluded from subsequent list results.
1995
- * Resolves when the server confirms the update; rejects on failure.
1996
- */
1997
- archiveThread: (threadId: string) => Promise<void>;
1998
- /**
1999
- * Restore a previously archived thread on the platform.
2000
- * The thread re-appears in default (non-archived) list results.
2001
- * Resolves when the server confirms the update; rejects on failure.
2002
- */
2003
- unarchiveThread: (threadId: string) => Promise<void>;
2004
- /**
2005
- * Permanently delete a thread from the platform.
2006
- * This is irreversible. Resolves when the server confirms deletion;
2007
- * rejects on failure.
2008
- */
2009
- deleteThread: (threadId: string) => Promise<void>;
2010
- }
2011
- /**
2012
- * React hook for listing and managing CopilotKit Intelligence threads.
2013
- *
2014
- * On mount the hook fetches the thread list for the runtime-authenticated user
2015
- * and the given `agentId`. When CopilotKit Intelligence exposes a WebSocket
2016
- * URL, it also opens a realtime subscription so the `threads` array stays
2017
- * current without polling — thread creates, renames, archives, and deletes
2018
- * from any client are reflected immediately.
2019
- *
2020
- * Mutation methods (`renameThread`, `archiveThread`, `unarchiveThread`,
2021
- * `deleteThread`) return promises that resolve once the platform confirms the
2022
- * operation and reject with an `Error` on failure.
2023
- *
2024
- * @param input - Agent identifier and optional list controls.
2025
- * @returns Thread list state and stable mutation callbacks.
2026
- *
2027
- * @example
2028
- * ```tsx
2029
- * import { useThreads } from "@copilotkit/react-core";
2030
- *
2031
- * function ThreadList() {
2032
- * const { threads, isLoading, renameThread, deleteThread } = useThreads({
2033
- * agentId: "agent-1",
2034
- * });
2035
- *
2036
- * if (isLoading) return <p>Loading…</p>;
2037
- *
2038
- * return (
2039
- * <ul>
2040
- * {threads.map((t) => (
2041
- * <li key={t.id}>
2042
- * {t.name ?? "Untitled"}
2043
- * <button onClick={() => renameThread(t.id, "New name")}>Rename</button>
2044
- * <button onClick={() => deleteThread(t.id)}>Delete</button>
2045
- * </li>
2046
- * ))}
2047
- * </ul>
2048
- * );
2049
- * }
2050
- * ```
2051
- */
2052
- declare function useThreads({
2053
- agentId,
2054
- includeArchived,
2055
- limit,
2056
- enabled
2057
- }: UseThreadsInput): UseThreadsResult;
2058
- //#endregion
2059
- //#region src/v2/components/chat/CopilotThreadsDrawer.d.ts
2060
- /**
2061
- * Per-row content render function. Receives a thread and returns the React
2062
- * node to project into the element's `slot="row:{id}"`. Returning `null`
2063
- * (or omitting the prop) falls back to the element's built-in row name.
2064
- */
2065
- type CopilotThreadsDrawerRowRenderer = (thread: Thread) => React$1.ReactNode;
2066
- /**
2067
- * Props for {@link CopilotThreadsDrawer}.
2068
- *
2069
- * The drawer is a thin controller around the framework-agnostic
2070
- * `<copilotkit-threads-drawer>` custom element. It feeds the element domain data
2071
- * (threads/loading/error from {@link useThreads}, the active thread from the
2072
- * chat configuration) and routes the element's outbound DOM events back into
2073
- * core thread operations and chat-configuration changes.
2074
- */
2075
- interface CopilotThreadsDrawerProps {
2076
- /**
2077
- * The agent whose threads to list and manage. Defaults to the agent of the
2078
- * surrounding chat configuration, or the platform default when none is set.
2079
- */
2080
- agentId?: string;
2081
- /**
2082
- * Optional escape-hatch called when the user picks a thread row. The wrapper
2083
- * additionally focuses the chat input. When omitted, the wrapper drives the
2084
- * surrounding chat configuration directly (`setActiveThreadId`), so a bare
2085
- * `<CopilotThreadsDrawer>` switches the rendered thread with no host wiring. Provide
2086
- * this only to take control of the active thread yourself (e.g. a v1
2087
- * `setThreadId`); when provided it is preferred over the provider.
2088
- */
2089
- onThreadSelect?: (threadId: string) => void;
2090
- /**
2091
- * Optional escape-hatch called when the user starts a new thread (the
2092
- * element's "+ New" button). The wrapper always resets the core thread store
2093
- * to a fresh, non-explicit client-side thread (`startNewThread`). When this
2094
- * is omitted, the wrapper also resets the surrounding chat configuration to a
2095
- * fresh non-explicit thread (`startNewThread`) so the welcome screen shows
2096
- * with no host wiring. Provide this only to clear your own active thread;
2097
- * when provided it is preferred over the provider.
2098
- */
2099
- onNewThread?: () => void;
2100
- /** Called when the Upgrade CTA is clicked. */
2101
- onLicensed?: () => void;
2102
- /**
2103
- * Destination the locked view's Upgrade CTA opens in a new tab. Defaults to
2104
- * the element's built-in CopilotKit Intelligence docs URL when omitted. Set
2105
- * to an empty string to suppress the default navigation and handle the click
2106
- * yourself via `onLicensed`.
2107
- */
2108
- licenseUrl?: string;
2109
- /**
2110
- * Optional per-row content. Rendered as light-DOM children with
2111
- * `slot="row:{id}"` so the element projects them in place of the default
2112
- * row name. Return `null` for a given row to keep the element's default.
2113
- */
2114
- renderRow?: CopilotThreadsDrawerRowRenderer;
2115
- /**
2116
- * Accessible + default-header label for the drawer region. Sets the custom
2117
- * element's `aria-label` and the default header text (shown when no
2118
- * `slot="header"` content is projected). Defaults to the element's built-in
2119
- * `"Threads"` when omitted.
2120
- */
2121
- label?: string;
2122
- /**
2123
- * Heading for the "Recent Conversations" section above the thread list. Sets
2124
- * the custom element's `recent-label` attribute. Defaults to the element's
2125
- * built-in `"Recent Conversations"` when omitted.
2126
- */
2127
- recentLabel?: string;
2128
- /**
2129
- * Whether the drawer offers a collapse toggle. Sets the custom element's
2130
- * `collapsible` PROPERTY. When `false`, the drawer has no collapse toggle and
2131
- * is always expanded. Defaults to the element's built-in `true` when omitted.
2132
- */
2133
- collapsible?: boolean;
2134
- /**
2135
- * Called when the drawer's collapsed state changes (via the element's collapse
2136
- * toggle), with the new collapsed state. Mirrors the element's
2137
- * `collapse-change` event.
2138
- */
2139
- onCollapseChange?: (collapsed: boolean) => void;
2140
- /**
2141
- * Page size for thread pagination. When set, threads are fetched in pages of
2142
- * this size and the drawer shows a "Load more" control while more remain.
2143
- * When omitted, the full list loads at once and no pagination control shows.
2144
- */
2145
- limit?: number;
2146
- /**
2147
- * `data-testid` set on the underlying custom element (handy in tests and for
2148
- * targeting from a host page). Defaults to `"copilot-threads-drawer"`.
2149
- */
2150
- "data-testid"?: string;
2151
- }
2152
- /**
2153
- * React wrapper for the shadow-DOM `<copilotkit-threads-drawer>` threads drawer.
2154
- *
2155
- * Responsibilities:
2156
- * - Registers the custom element on the client (SSR-safe; nothing renders
2157
- * during prerender to avoid hydration mismatch).
2158
- * - Feeds the element domain data: `threads`, `loading`, `error`,
2159
- * `activeThreadId`, `licensed`, fetch-more state.
2160
- * - Routes the element's outbound events to core thread operations
2161
- * ({@link useThreads}) and chat-configuration changes.
2162
- * - Registers with the surrounding chat configuration so the header
2163
- * thread-list launcher appears, and binds the element `open` state to the
2164
- * configuration's `drawerOpen`.
2165
- *
2166
- * Intelligence gating is two-pronged: the locked view shows when the runtime
2167
- * reports no active entitlement OR the `threads` feature is unavailable. While
2168
- * unavailable, the thread fetch is skipped entirely so the drawer issues no
2169
- * network requests.
2170
- *
2171
- * Thread switching needs no host wiring: when `onThreadSelect`/`onNewThread`
2172
- * are omitted, the wrapper drives the surrounding chat configuration directly
2173
- * ({@link CopilotChatConfigurationValue.setActiveThreadId} /
2174
- * {@link CopilotChatConfigurationValue.startNewThread}), so a bare drawer
2175
- * connects to the picked thread and shows the welcome screen on "+ New". Pass
2176
- * the callbacks only to take control yourself.
2177
- *
2178
- * @example
2179
- * ```tsx
2180
- * // Callback-free: the drawer drives the chat configuration itself.
2181
- * <CopilotKitProvider runtimeUrl="/api/copilotkit">
2182
- * <CopilotChat />
2183
- * <CopilotThreadsDrawer />
2184
- * </CopilotKitProvider>
2185
- * ```
2186
- */
2187
- declare function CopilotThreadsDrawer({
2188
- agentId,
2189
- onThreadSelect,
2190
- onNewThread,
2191
- onLicensed,
2192
- licenseUrl,
2193
- renderRow,
2194
- label,
2195
- recentLabel,
2196
- collapsible,
2197
- onCollapseChange,
2198
- limit,
2199
- "data-testid": dataTestId
2200
- }: CopilotThreadsDrawerProps): React$1.ReactElement | null;
2201
- declare namespace CopilotThreadsDrawer {
2202
- var displayName: string;
2203
- }
2204
- //#endregion
2205
- //#region src/v2/components/chat/CopilotChatAttachmentQueue.d.ts
2206
- interface CopilotChatAttachmentQueueProps {
2207
- attachments: Attachment[];
2208
- onRemoveAttachment: (id: string) => void;
2209
- className?: string;
2210
- }
2211
- /**
2212
- * The attachments queued in the composer, each with a preview and a remove
2213
- * button named by `labels.attachmentRemoveButtonLabel`.
2214
- */
2215
- declare const CopilotChatAttachmentQueue: React$1.FC<CopilotChatAttachmentQueueProps>;
2216
- //#endregion
2217
- //#region src/v2/components/chat/CopilotChatAttachmentRenderer.d.ts
2218
- interface CopilotChatAttachmentRendererProps {
2219
- type: "image" | "audio" | "video" | "document";
2220
- source: InputContentSource;
2221
- filename?: string;
2222
- className?: string;
2223
- }
2224
- declare const CopilotChatAttachmentRenderer: React$1.FC<CopilotChatAttachmentRendererProps>;
2225
- //#endregion
2226
- //#region src/v2/components/WildcardToolCallRender.d.ts
2227
- /**
2228
- * Catch-all (`"*"`) tool-call renderer that shows CopilotKit's default
2229
- * tool-call card for any tool without a dedicated renderer.
2230
- */
2231
- declare const WildcardToolCallRender: ReactToolCallRenderer<any>;
2232
- //#endregion
2233
- //#region src/v2/components/CopilotKitInspectorContext.d.ts
2234
- type CopilotKitInspectorOpenRequest = {
2235
- messageId: string;
2236
- threadId?: string;
2237
- agentId?: string;
2238
- };
2239
- //#endregion
2240
- //#region src/v2/components/CopilotKitInspector.d.ts
2241
- interface CopilotKitInspectorProps {
2242
- core?: CopilotKitCore | null;
2243
- onVisibilityChange?: (visible: boolean) => void;
2244
- openRequest?: CopilotKitInspectorOpenRequest | null;
2245
- }
2246
- declare const CopilotKitInspector: react.FC<CopilotKitInspectorProps>;
2247
- //#endregion
2248
- //#region src/v2/components/MCPAppsActivityRenderer.d.ts
2249
- /**
2250
- * Props for the activity renderer component
2251
- */
2252
- interface MCPAppsActivityRendererProps {
2253
- activityType: string;
2254
- content: MCPAppsActivityContent;
2255
- message: unknown;
2256
- agent: AbstractAgent | undefined;
2257
- /**
2258
- * Restore `allow-same-origin` on the sandbox. Unsafe: the widget runs with
2259
- * the host page's origin. Set via `mcpApps.allowSameOriginFallback` on
2260
- * `CopilotKitProvider`.
2261
- */
2262
- allowSameOriginFallback?: boolean;
2263
- }
2264
- /**
2265
- * MCP Apps Extension Activity Renderer
2266
- *
2267
- * Renders MCP Apps UI in a sandboxed iframe with full protocol support.
2268
- * Fetches resource content on-demand via proxied MCP requests. The React shell
2269
- * owns the iframe; `bindMcpApp` owns the protocol.
2270
- */
2271
- declare const MCPAppsActivityRenderer: React$1.FC<MCPAppsActivityRendererProps>;
2272
- //#endregion
2273
- //#region src/v2/components/OpenGenerativeUIRenderer.d.ts
2274
- declare const OpenGenerativeUIActivityType = "open-generative-ui";
2275
- declare const OpenGenerativeUIContentSchema: z.ZodObject<{
2276
- initialHeight: z.ZodOptional<z.ZodNumber>;
2277
- generating: z.ZodOptional<z.ZodBoolean>;
2278
- css: z.ZodOptional<z.ZodString>;
2279
- cssComplete: z.ZodOptional<z.ZodBoolean>;
2280
- html: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
2281
- htmlComplete: z.ZodOptional<z.ZodBoolean>;
2282
- jsFunctions: z.ZodOptional<z.ZodString>;
2283
- jsFunctionsComplete: z.ZodOptional<z.ZodBoolean>;
2284
- jsExpressions: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
2285
- jsExpressionsComplete: z.ZodOptional<z.ZodBoolean>;
2286
- }, "strip", z.ZodTypeAny, {
2287
- html?: string[] | undefined;
2288
- initialHeight?: number | undefined;
2289
- generating?: boolean | undefined;
2290
- css?: string | undefined;
2291
- cssComplete?: boolean | undefined;
2292
- htmlComplete?: boolean | undefined;
2293
- jsFunctions?: string | undefined;
2294
- jsFunctionsComplete?: boolean | undefined;
2295
- jsExpressions?: string[] | undefined;
2296
- jsExpressionsComplete?: boolean | undefined;
2297
- }, {
2298
- html?: string[] | undefined;
2299
- initialHeight?: number | undefined;
2300
- generating?: boolean | undefined;
2301
- css?: string | undefined;
2302
- cssComplete?: boolean | undefined;
2303
- htmlComplete?: boolean | undefined;
2304
- jsFunctions?: string | undefined;
2305
- jsFunctionsComplete?: boolean | undefined;
2306
- jsExpressions?: string[] | undefined;
2307
- jsExpressionsComplete?: boolean | undefined;
2308
- }>;
2309
- type OpenGenerativeUIContent = z.infer<typeof OpenGenerativeUIContentSchema>;
2310
- /**
2311
- * Schema for the generateSandboxedUi tool call arguments.
2312
- * Used by the frontend tool renderer to display placeholder messages.
2313
- */
2314
- declare const GenerateSandboxedUiArgsSchema: z.ZodObject<{
2315
- initialHeight: z.ZodOptional<z.ZodNumber>;
2316
- placeholderMessages: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
2317
- css: z.ZodOptional<z.ZodString>;
2318
- html: z.ZodOptional<z.ZodString>;
2319
- jsFunctions: z.ZodOptional<z.ZodString>;
2320
- jsExpressions: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
2321
- }, "strip", z.ZodTypeAny, {
2322
- html?: string | undefined;
2323
- initialHeight?: number | undefined;
2324
- css?: string | undefined;
2325
- jsFunctions?: string | undefined;
2326
- jsExpressions?: string[] | undefined;
2327
- placeholderMessages?: string[] | undefined;
2328
- }, {
2329
- html?: string | undefined;
2330
- initialHeight?: number | undefined;
2331
- css?: string | undefined;
2332
- jsFunctions?: string | undefined;
2333
- jsExpressions?: string[] | undefined;
2334
- placeholderMessages?: string[] | undefined;
2335
- }>;
2336
- type GenerateSandboxedUiArgs = z.infer<typeof GenerateSandboxedUiArgsSchema>;
2337
- interface OpenGenerativeUIActivityRendererProps {
2338
- activityType: string;
2339
- content: OpenGenerativeUIContent;
2340
- message: unknown;
2341
- agent: unknown;
2342
- }
2343
- /**
2344
- * Outer wrapper — absorbs every parent re-render but only forwards
2345
- * throttled content snapshots to the memoized inner component.
2346
- */
2347
- declare const OpenGenerativeUIActivityRenderer: React$1.FC<OpenGenerativeUIActivityRendererProps>;
2348
- /**
2349
- * Frontend tool renderer for generateSandboxedUi.
2350
- * Displays placeholder messages while the UI is being generated.
2351
- */
2352
- declare const OpenGenerativeUIToolRenderer: React$1.FC<{
2353
- name: string;
2354
- args: Partial<GenerateSandboxedUiArgs>;
2355
- status: ToolCallStatus.InProgress;
2356
- result: undefined;
2357
- } | {
2358
- name: string;
2359
- args: GenerateSandboxedUiArgs;
2360
- status: ToolCallStatus.Executing;
2361
- result: undefined;
2362
- } | {
2363
- name: string;
2364
- args: GenerateSandboxedUiArgs;
2365
- status: ToolCallStatus.Complete;
2366
- result: string;
2367
- }>;
2368
- //#endregion
2369
- //#region src/v2/types/react-tool-call-renderer.d.ts
2370
- interface ReactToolCallRenderer<T = unknown> {
2371
- name: string;
2372
- /**
2373
- * Schema describing the tool arguments. Optional — renderers registered for
2374
- * tools without parameters (e.g. HITL confirm dialogs) have no schema.
2375
- */
2376
- args?: StandardSchemaV1<any, T>;
2377
- /**
2378
- * Optional agent ID to constrain this tool renderer to a specific agent.
2379
- * If specified, this renderer will only be used for the specified agent.
2380
- */
2381
- agentId?: string;
2382
- /**
2383
- * Whether calls this renderer draws join the chat's tool-call groups (see
2384
- * `toolCallDisplay` on `CopilotChatMessageView`). CopilotKit's built-in card
2385
- * sets it; a renderer that leaves it unset always shows its calls on their
2386
- * own, since the chat can't tell what it draws (it may even draw nothing).
2387
- */
2388
- group?: boolean;
2389
- render: React.ComponentType<{
2390
- name: string;
2391
- toolCallId: string;
2392
- args: Partial<T>;
2393
- status: ToolCallStatus.InProgress;
2394
- result: undefined;
2395
- } | {
2396
- name: string;
2397
- toolCallId: string;
2398
- args: T;
2399
- status: ToolCallStatus.Executing;
2400
- result: undefined;
2401
- } | {
2402
- name: string;
2403
- toolCallId: string;
2404
- args: T;
2405
- status: ToolCallStatus.Complete;
2406
- result: string;
2407
- }>;
2408
- }
2409
- //#endregion
2410
- //#region src/v2/hooks/use-render-tool-call.d.ts
2411
- interface UseRenderToolCallProps {
2412
- toolCall: ToolCall;
2413
- toolMessage?: ToolMessage;
2414
- }
2415
- /**
2416
- * Hook that returns a function to render tool calls based on the render functions
2417
- * defined in CopilotKitProvider.
2418
- *
2419
- * @returns A function that takes a tool call and optional tool message and returns the rendered component
2420
- */
2421
- declare function useRenderToolCall(): ({
2422
- toolCall,
2423
- toolMessage
2424
- }: UseRenderToolCallProps) => React$1.ReactElement | null;
2425
- //#endregion
2426
- //#region src/v2/types/react-custom-message-renderer.d.ts
2427
- type ReactCustomMessageRendererPosition = "before" | "after";
2428
- interface ReactCustomMessageRenderer {
2429
- agentId?: string;
2430
- render: React.ComponentType<{
2431
- message: Message$2;
2432
- position: ReactCustomMessageRendererPosition;
2433
- runId: string;
2434
- messageIndex: number;
2435
- messageIndexInRun: number;
2436
- numberOfMessagesInRun: number;
2437
- agentId: string;
2438
- stateSnapshot: any;
2439
- }> | null;
2440
- }
2441
- //#endregion
2442
- //#region src/v2/hooks/use-render-custom-messages.d.ts
2443
- interface UseRenderCustomMessagesParams {
2444
- message: Message$2;
2445
- position: ReactCustomMessageRendererPosition;
2446
- }
2447
- declare function useRenderCustomMessages(): ((params: UseRenderCustomMessagesParams) => react_jsx_runtime0.JSX.Element | null) | null;
2448
- //#endregion
2449
- //#region src/v2/types/frontend-tool.d.ts
2450
- type ReactFrontendTool<T extends Record<string, unknown> = Record<string, unknown>> = FrontendTool<T> & {
2451
- render?: ReactToolCallRenderer<T>["render"];
2452
- };
2453
- //#endregion
2454
- //#region src/v2/types/human-in-the-loop.d.ts
2455
- type ReactHumanInTheLoop<T extends Record<string, unknown> = Record<string, unknown>> = Omit<FrontendTool<T>, "handler"> & {
2456
- /**
2457
- * Render the human-in-the-loop UI for this tool call.
2458
- *
2459
- * Beyond the tool call's `args`/`status`/`result`, the render props carry
2460
- * attribution:
2461
- * - `toolCallId` — the AG-UI tool call id, unique per interrupt. It is the
2462
- * stable key for correlating this interrupt with runtime (sub)agent
2463
- * attribution — e.g. the `agentId` reported by `onToolExecutionStart`, or
2464
- * per-run attribution stamped on the event stream — so the UI can label
2465
- * the interrupt with the agent that actually raised it.
2466
- * - `agentId` — the agent this tool was *registered* to (the tool's own
2467
- * `agentId`), or `undefined` for an unscoped tool. This is the static
2468
- * registration scope; it is NOT necessarily the runtime (sub)agent that
2469
- * raised the interrupt. For runtime attribution, correlate `toolCallId`
2470
- * with the event-stream/`onToolExecutionStart` agent id.
2471
- */
2472
- render: React$1.ComponentType<{
2473
- name: string;
2474
- description: string;
2475
- toolCallId: string;
2476
- agentId?: string;
2477
- args: Partial<T>;
2478
- status: ToolCallStatus.InProgress;
2479
- result: undefined;
2480
- respond: undefined;
2481
- } | {
2482
- name: string;
2483
- description: string;
2484
- toolCallId: string;
2485
- agentId?: string;
2486
- args: T;
2487
- status: ToolCallStatus.Executing;
2488
- result: undefined;
2489
- respond: (result: unknown) => Promise<void>;
2490
- } | {
2491
- name: string;
2492
- description: string;
2493
- toolCallId: string;
2494
- agentId?: string;
2495
- args: T;
2496
- status: ToolCallStatus.Complete;
2497
- result: string;
2498
- respond: undefined;
2499
- }>;
2500
- };
2501
- //#endregion
2502
- //#region src/v2/types/defineToolCallRenderer.d.ts
2503
- /**
2504
- * Helper to define a type-safe tool call renderer entry.
2505
- * - Accepts a single object whose keys match ReactToolCallRenderer's fields: { name, args, render, agentId? }.
2506
- * - Derives `args` type from the provided schema (any Standard Schema V1 compatible library).
2507
- * - Ensures the render function param type exactly matches ReactToolCallRenderer<T>["render"]'s param.
2508
- * - For wildcard tools (name: "*"), args is optional and defaults to z.any()
2509
- */
2510
- type RenderProps<T> = {
2511
- name: string;
2512
- toolCallId: string;
2513
- args: Partial<T>;
2514
- status: ToolCallStatus.InProgress;
2515
- result: undefined;
2516
- } | {
2517
- name: string;
2518
- toolCallId: string;
2519
- args: T;
2520
- status: ToolCallStatus.Executing;
2521
- result: undefined;
2522
- } | {
2523
- name: string;
2524
- toolCallId: string;
2525
- args: T;
2526
- status: ToolCallStatus.Complete;
2527
- result: string;
2528
- };
2529
- declare function defineToolCallRenderer(def: {
2530
- name: "*";
2531
- render: (props: RenderProps<any>) => React$1.ReactElement | null;
2532
- agentId?: string;
2533
- group?: boolean;
2534
- }): ReactToolCallRenderer<any>;
2535
- declare function defineToolCallRenderer<S extends StandardSchemaV1>(def: {
2536
- name: string;
2537
- args: S;
2538
- render: (props: RenderProps<InferSchemaOutput<S>>) => React$1.ReactElement | null;
2539
- agentId?: string;
2540
- group?: boolean;
2541
- }): ReactToolCallRenderer<InferSchemaOutput<S>>;
2542
- //#endregion
2543
- //#region src/v2/types/interrupt.d.ts
2544
- /** Name of the legacy custom event agents emit to signal an interrupt. */
2545
- declare const INTERRUPT_EVENT_NAME = "on_interrupt";
2546
- /** Legacy custom-event interrupt payload (agent emits a custom `on_interrupt` event). */
2547
- interface InterruptEvent<TValue = unknown> {
2548
- name: string;
2549
- value: TValue;
2550
- }
2551
- /**
2552
- * Resolve the agent with user input for an interrupt.
2553
- *
2554
- * - Standard interrupts: records `{ status: "resolved", payload }` for the target
2555
- * interrupt (defaults to the primary one). Resumes once every open interrupt is
2556
- * addressed; returns the resume run result, or `void` while still awaiting others.
2557
- * - Legacy interrupts: resumes immediately via `command.resume = payload`.
2558
- */
2559
- type InterruptResolveFn = (payload?: unknown, interruptId?: string) => Promise<RunAgentResult | void>;
2560
- /**
2561
- * Cancel an interrupt.
2562
- *
2563
- * - Standard interrupts: records `{ status: "cancelled" }` for the target interrupt
2564
- * (defaults to the primary one), then resumes once all are addressed.
2565
- * - Legacy interrupts: dismisses the pending interrupt without resuming.
2566
- */
2567
- type InterruptCancelFn = (interruptId?: string) => Promise<RunAgentResult | void>;
2568
- interface InterruptHandlerProps<TValue = unknown> {
2569
- /**
2570
- * Legacy event shape (`{ name, value }`). Always present for back-compat: for
2571
- * standard interrupts, `value` is the primary `Interrupt` and `name` is `"on_interrupt"`.
2572
- * Prefer `interrupt` / `interrupts` for standard interrupts.
2573
- */
2574
- event: InterruptEvent<TValue>;
2575
- /** Primary standard interrupt (`interrupts[0]`), or `null` for legacy interrupts. */
2576
- interrupt: Interrupt | null;
2577
- /** All open standard interrupts (empty array for legacy interrupts). */
2578
- interrupts: Interrupt[];
2579
- resolve: InterruptResolveFn;
2580
- cancel: InterruptCancelFn;
2581
- }
2582
- interface InterruptRenderProps<TValue = unknown, TResult = unknown> {
2583
- event: InterruptEvent<TValue>;
2584
- interrupt: Interrupt | null;
2585
- interrupts: Interrupt[];
2586
- result: TResult;
2587
- resolve: InterruptResolveFn;
2588
- cancel: InterruptCancelFn;
2589
- }
2590
- //#endregion
2591
- //#region src/v2/types/sandbox-function.d.ts
2592
- type SandboxFunction<TParams extends StandardSchemaV1 = StandardSchemaV1> = {
2593
- name: string;
2594
- description: string;
2595
- parameters: TParams;
2596
- handler: (args: any) => Promise<unknown>;
2597
- };
2598
- //#endregion
2599
- //#region src/v2/hooks/use-render-activity-message.d.ts
2600
- declare function useRenderActivityMessage(): {
2601
- renderActivityMessage: (message: ActivityMessage) => React.ReactElement | null;
2602
- findRenderer: (activityType: string) => ReactActivityMessageRenderer<unknown> | null;
2603
- };
2604
- //#endregion
2605
- //#region src/v2/hooks/use-frontend-tool.d.ts
2606
- declare function useFrontendTool<T extends Record<string, unknown> = Record<string, unknown>>(tool: ReactFrontendTool<T>, deps?: ReadonlyArray<unknown>): void;
2607
- //#endregion
2608
- //#region src/v2/hooks/use-frontend-tools.d.ts
2609
- /**
2610
- * Register a list of frontend tools whose length can change between renders.
2611
- *
2612
- * `useFrontendTool` registers exactly one tool per call, so it cannot be called
2613
- * in a loop over a runtime-length list without breaking the rules of hooks.
2614
- * This hook runs a single effect over the whole array instead, which makes it
2615
- * safe to build the list from state, props, or a server response.
2616
- *
2617
- * Tools are keyed by `name` plus `agentId`, the same as `useFrontendTool`. A
2618
- * tool that disappears from the array is unregistered on the next render, and
2619
- * every tool is unregistered on unmount. Renderers stay registered after
2620
- * unmount so past tool calls still render in the chat history.
2621
- *
2622
- * @param tools - The tools to register. May be empty and may change length.
2623
- * @param deps - Extra dependencies that force re-registration, compared by
2624
- * identity like the second argument of `useEffect`. Use this when a handler
2625
- * closes over a value that is not part of the tool definition. Keep the array
2626
- * a constant length across renders.
2627
- *
2628
- * @example
2629
- * Register one tool per item in application state:
2630
- * ```tsx
2631
- * const [reports, setReports] = useState<Report[]>([]);
2632
- *
2633
- * useFrontendTools(
2634
- * reports.map((report) => ({
2635
- * name: `open_${report.id}`,
2636
- * description: `Open the ${report.title} report`,
2637
- * handler: async () => navigate(`/reports/${report.id}`),
2638
- * })),
2639
- * [navigate],
2640
- * );
2641
- * ```
2642
- *
2643
- * @example
2644
- * Register tools described by the backend:
2645
- * ```tsx
2646
- * const { data } = useQuery(fetchToolDescriptors);
2647
- *
2648
- * useFrontendTools(
2649
- * (data ?? []).map((descriptor) => ({
2650
- * name: descriptor.name,
2651
- * description: descriptor.description,
2652
- * parameters: z.object({ query: z.string() }),
2653
- * handler: async ({ query }) => runDescriptor(descriptor.id, query),
2654
- * })),
2655
- * );
2656
- * ```
2657
- */
2658
- declare function useFrontendTools(tools: ReadonlyArray<ReactFrontendTool<any>> | undefined, deps?: ReadonlyArray<unknown>): void;
2659
- //#endregion
2660
- //#region src/v2/hooks/use-component.d.ts
2661
- type InferRenderProps<T> = T extends StandardSchemaV1 ? InferSchemaOutput<T> : any;
2662
- /**
2663
- * Registers a React component as a frontend tool renderer in chat.
2664
- *
2665
- * This hook is a convenience wrapper around `useFrontendTool` that:
2666
- * - builds a model-facing tool description,
2667
- * - forwards optional schema parameters (any Standard Schema V1 compatible library),
2668
- * - renders your component with tool call parameters.
2669
- *
2670
- * Use this when you want to display a typed visual component for a tool call
2671
- * without manually wiring a full frontend tool object.
2672
- *
2673
- * When `parameters` is provided, render props are inferred from the schema.
2674
- * When omitted, the render component may accept any props.
2675
- *
2676
- * @typeParam TSchema - Schema describing tool parameters, or `undefined` when no schema is given.
2677
- * @param config - Tool registration config.
2678
- * @param deps - Optional dependencies to refresh registration (same semantics as `useEffect`).
2679
- *
2680
- * @example
2681
- * ```tsx
2682
- * // Without parameters — render accepts any props
2683
- * useComponent({
2684
- * name: "showGreeting",
2685
- * render: ({ message }: { message: string }) => <div>{message}</div>,
2686
- * });
2687
- * ```
2688
- *
2689
- * @example
2690
- * ```tsx
2691
- * // With parameters — render props inferred from schema
2692
- * useComponent({
2693
- * name: "showWeatherCard",
2694
- * parameters: z.object({ city: z.string() }),
2695
- * render: ({ city }) => <div>{city}</div>,
2696
- * });
2697
- * ```
2698
- *
2699
- * @example
2700
- * ```tsx
2701
- * useComponent(
2702
- * {
2703
- * name: "renderProfile",
2704
- * parameters: z.object({ userId: z.string() }),
2705
- * render: ProfileCard,
2706
- * agentId: "support-agent",
2707
- * },
2708
- * [selectedAgentId],
2709
- * );
2710
- * ```
2711
- */
2712
- declare function useComponent<TSchema extends StandardSchemaV1<any, Record<string, unknown>> | undefined = undefined>(config: {
2713
- name: string;
2714
- description?: string;
2715
- parameters?: TSchema;
2716
- render: ComponentType<NoInfer<InferRenderProps<TSchema>>>;
2717
- agentId?: string;
2718
- followUp?: boolean;
2719
- }, deps?: ReadonlyArray<unknown>): void;
2720
- //#endregion
2721
- //#region src/v2/hooks/use-render-tool.d.ts
2722
- interface RenderToolInProgressProps<S extends StandardSchemaV1> {
2723
- name: string;
2724
- toolCallId: string;
2725
- parameters: Partial<InferSchemaOutput<S>>;
2726
- status: "inProgress";
2727
- result: undefined;
2728
- }
2729
- interface RenderToolExecutingProps<S extends StandardSchemaV1> {
2730
- name: string;
2731
- toolCallId: string;
2732
- parameters: InferSchemaOutput<S>;
2733
- status: "executing";
2734
- result: undefined;
2735
- }
2736
- interface RenderToolCompleteProps<S extends StandardSchemaV1> {
2737
- name: string;
2738
- toolCallId: string;
2739
- parameters: InferSchemaOutput<S>;
2740
- status: "complete";
2741
- result: string;
2742
- }
2743
- type RenderToolProps<S extends StandardSchemaV1> = RenderToolInProgressProps<S> | RenderToolExecutingProps<S> | RenderToolCompleteProps<S>;
2744
- /**
2745
- * Registers a wildcard (`"*"`) renderer for tool calls.
2746
- *
2747
- * The wildcard renderer is used as a fallback when no exact name-matched
2748
- * renderer is registered for a tool call.
2749
- *
2750
- * @param config - Wildcard renderer configuration.
2751
- * @param deps - Optional dependencies to refresh registration.
2752
- *
2753
- * @example
2754
- * ```tsx
2755
- * useRenderTool(
2756
- * {
2757
- * name: "*",
2758
- * render: ({ name, status }) => (
2759
- * <div>
2760
- * {status === "complete" ? "✓" : "⏳"} {name}
2761
- * </div>
2762
- * ),
2763
- * },
2764
- * [],
2765
- * );
2766
- * ```
2767
- */
2768
- declare function useRenderTool(config: {
2769
- name: "*";
2770
- render: (props: any) => React.ReactElement | null;
2771
- agentId?: string; /** Let the chat group the calls this renderer draws (see `toolCallDisplay`). */
2772
- group?: boolean;
2773
- }, deps?: ReadonlyArray<unknown>): void;
2774
- /**
2775
- * Registers a name-scoped renderer for tool calls.
2776
- *
2777
- * The provided `parameters` schema defines the typed shape of `props.parameters`
2778
- * in `render` for `executing` and `complete` states. Accepts any Standard Schema V1
2779
- * compatible library (Zod, Valibot, ArkType, etc.).
2780
- *
2781
- * @typeParam S - Schema type describing tool call parameters.
2782
- * @param config - Named renderer configuration.
2783
- * @param deps - Optional dependencies to refresh registration.
2784
- *
2785
- * @example
2786
- * ```tsx
2787
- * useRenderTool(
2788
- * {
2789
- * name: "searchDocs",
2790
- * parameters: z.object({ query: z.string() }),
2791
- * render: ({ status, parameters, result }) => {
2792
- * if (status === "inProgress") return <div>Preparing...</div>;
2793
- * if (status === "executing") return <div>Searching {parameters.query}</div>;
2794
- * return <div>{result}</div>;
2795
- * },
2796
- * },
2797
- * [],
2798
- * );
2799
- * ```
2800
- */
2801
- declare function useRenderTool<S extends StandardSchemaV1>(config: {
2802
- name: string;
2803
- parameters: S;
2804
- render: (props: RenderToolProps<S>) => React.ReactElement | null;
2805
- agentId?: string; /** Let the chat group the calls this renderer draws (see `toolCallDisplay`). */
2806
- group?: boolean;
2807
- }, deps?: ReadonlyArray<unknown>): void;
2808
- //#endregion
2809
- //#region src/v2/hooks/use-default-render-tool.d.ts
2810
- type DefaultRenderProps = {
2811
- /** The name of the tool being called. */name: string; /** The id of the tool call being rendered. */
2812
- toolCallId: string; /** The parsed parameters passed to the tool call. */
2813
- parameters: unknown; /** Current execution status of the tool call. */
2814
- status: "inProgress" | "executing" | "complete"; /** The tool call result string, available only when `status` is `"complete"`. */
2815
- result: string | undefined;
2816
- };
2817
- /**
2818
- * Registers a wildcard (`"*"`) tool-call renderer via `useRenderTool`.
2819
- *
2820
- * - Call with no config to use CopilotKit's built-in default tool-call card.
2821
- * - Pass `config.render` to replace the default UI with your own fallback renderer.
2822
- *
2823
- * This is useful when you want a generic renderer for tools that do not have a
2824
- * dedicated `useRenderTool({ name: "..." })` registration.
2825
- *
2826
- * @param config - Optional custom wildcard render function.
2827
- * @param deps - Optional dependencies to refresh registration.
2828
- *
2829
- * @example
2830
- * ```tsx
2831
- * useDefaultRenderTool();
2832
- * ```
2833
- *
2834
- * @example
2835
- * ```tsx
2836
- * useDefaultRenderTool({
2837
- * render: ({ name, status }) => <div>{name}: {status}</div>,
2838
- * });
2839
- * ```
2840
- *
2841
- * @example
2842
- * ```tsx
2843
- * useDefaultRenderTool(
2844
- * {
2845
- * render: ({ name, result }) => (
2846
- * <ToolEventRow title={name} payload={result} compact={compactMode} />
2847
- * ),
2848
- * },
2849
- * [compactMode],
2850
- * );
2851
- * ```
2852
- */
2853
- declare function useDefaultRenderTool(config?: {
2854
- render?: (props: DefaultRenderProps) => React$1.ReactElement | null;
2855
- /**
2856
- * Let the chat group calls your `render` draws, like it groups the
2857
- * built-in card's (see `toolCallDisplay` on `CopilotChatMessageView`).
2858
- * Off by default for a custom `render`, since it may draw nothing.
2859
- */
2860
- group?: boolean;
2861
- }, deps?: ReadonlyArray<unknown>): void;
2862
- //#endregion
2863
- //#region src/v2/hooks/use-human-in-the-loop.d.ts
2864
- declare function useHumanInTheLoop<T extends Record<string, unknown> = Record<string, unknown>>(tool: ReactHumanInTheLoop<T>, deps?: ReadonlyArray<unknown>): void;
2865
- //#endregion
2866
- //#region src/v2/hooks/use-agent.d.ts
2867
- declare enum UseAgentUpdate {
2868
- OnMessagesChanged = "OnMessagesChanged",
2869
- OnStateChanged = "OnStateChanged",
2870
- OnRunStatusChanged = "OnRunStatusChanged"
2871
- }
2872
- interface UseAgentPropsBase {
2873
- updates?: UseAgentUpdate[];
2874
- /**
2875
- * Throttle interval (in milliseconds) for re-renders triggered by
2876
- * `onMessagesChanged` and `onStateChanged` notifications. Useful to reduce
2877
- * re-render frequency during high-frequency streaming updates.
2878
- *
2879
- * Uses a leading+trailing pattern with a shared window — first update
2880
- * fires immediately, subsequent updates within the window are coalesced,
2881
- * and a trailing timer ensures the most recent update fires after the
2882
- * window expires. See `CopilotKitCore.subscribeToAgentWithOptions` in `@copilotkit/core`
2883
- * for details.
2884
- *
2885
- * Resolved as: `throttleMs ?? provider defaultThrottleMs ?? 0`.
2886
- * Passing `throttleMs={0}` explicitly disables throttling even when the
2887
- * provider specifies a non-zero `defaultThrottleMs`.
2888
- *
2889
- * Run lifecycle callbacks (`onRunInitialized`, `onRunFinalized`,
2890
- * `onRunFailed`, `onRunErrorEvent`) always fire immediately.
2891
- *
2892
- * @default undefined
2893
- * When unset, inherits from the provider's `defaultThrottleMs`;
2894
- * if that is also unset, the effective value is `0` (no throttle).
2895
- */
2896
- throttleMs?: number;
2897
- }
2898
- /**
2899
- * Thread-scoped variant. `agentId`, `runtimeAgentId`, and `threadId` are a
2900
- * matched set: together they give this hook a *private* agent — registered
2901
- * under the local `agentId`, routing outbound to `runtimeAgentId` — that is
2902
- * safe to pin a thread onto. None of the three is meaningful without the other
2903
- * two, so all are required here.
2904
- */
2905
- interface UseAgentThreadScopedProps {
2906
- /**
2907
- * The name to register this hook's proxied agent under.
2908
- *
2909
- * Required, and must not already be taken. The usual fallbacks (the chat
2910
- * configuration's agentId, then `DEFAULT_AGENT_ID`) name agents that already
2911
- * exist, and registering over one either throws `already registered` or
2912
- * silently shadows it, depending on whether runtime discovery has landed — so
2913
- * the caller has to name it.
2914
- */
2915
- agentId: string;
2916
- /**
2917
- * Thread to scope the agent's run to. Written onto the underlying agent, so
2918
- * `/agent/run`, `/agent/connect`, and `/agent/stop` address this thread.
2919
- *
2920
- * REQUIRES `runtimeAgentId`. A runtime agent registered under a given id is a
2921
- * singleton, so writing a per-hook threadId directly onto it would let two
2922
- * `useAgent` calls that share an `agentId` clobber each other's thread.
2923
- * Passing a distinct local `agentId` plus the `runtimeAgentId` it routes to
2924
- * gives this hook a private proxied agent to pin the thread onto instead of a
2925
- * shared one.
2926
- */
2927
- threadId: string;
2928
- /**
2929
- * The id of the runtime agent to route outbound requests to, while this hook
2930
- * exposes a distinct local `agentId`. Registers a proxied agent via
2931
- * `CopilotKitCore.registerProxiedAgent`, letting several frontend agents
2932
- * (e.g. one per open thread) mount against a single runtime agent without a
2933
- * shared-singleton collision.
2934
- *
2935
- * When set, `agentId` is the *local* registry id (must not collide with an
2936
- * existing local or runtime-discovered agent) and `runtimeAgentId` is the
2937
- * runtime agent the proxy addresses on `/agent/run` etc.
2938
- *
2939
- * REQUIRES `threadId`. Registering a private agent is only worth doing to
2940
- * scope a thread to it; without a `threadId` the private agent would take its
2941
- * thread from the chat configuration, which is what binding to the shared
2942
- * agent via `agentId` alone already does — just with an extra registration
2943
- * and a local id to keep unique.
2944
- */
2945
- runtimeAgentId: string;
2946
- }
2947
- /**
2948
- * Default variant: neither `threadId` nor `runtimeAgentId`. The hook binds to
2949
- * the shared agent registered under `agentId` and leaves its threadId to the
2950
- * chat configuration (or to the agent's own auto-minted UUID).
2951
- *
2952
- * Both props are typed `undefined` here rather than omitted so that supplying
2953
- * either one on its own fails to match *both* branches — that is the
2954
- * type-level enforcement of the all-or-nothing rule.
2955
- */
2956
- interface UseAgentUnscopedProps {
2957
- /**
2958
- * Agent to bind to. Resolution precedence: this property, then the surrounding
2959
- * chat configuration's agentId, then the global default.
2960
- */
2961
- agentId?: string;
2962
- /** Requires `runtimeAgentId`. See {@link UseAgentThreadScopedProps.threadId}. */
2963
- threadId?: undefined;
2964
- /** Requires `threadId`. See {@link UseAgentThreadScopedProps.runtimeAgentId}. */
2965
- runtimeAgentId?: undefined;
2966
- }
2967
- /**
2968
- * Props for {@link useAgent}.
2969
- *
2970
- * There are exactly two valid shapes, and the type admits nothing in between:
2971
- *
2972
- * - **Bind to an agent** — `useAgent()`, `useAgent({ agentId })`. The shared
2973
- * instance from the registry; the thread comes from the chat configuration.
2974
- * - **Bind a private agent to a thread** —
2975
- * `useAgent({ agentId, runtimeAgentId, threadId })`. All three required.
2976
- *
2977
- * So `useAgent({ agentId, threadId })`, `useAgent({ agentId, runtimeAgentId })`,
2978
- * and `useAgent({ runtimeAgentId, threadId })` are all compile errors. Each
2979
- * partial combination is either unsafe (a thread scoped onto a shared singleton)
2980
- * or pointless (a private agent with no thread, or one registered over an id
2981
- * that already belongs to a real agent).
2982
- */
2983
- type UseAgentProps = UseAgentPropsBase & (UseAgentThreadScopedProps | UseAgentUnscopedProps);
2984
- declare function useAgent({
2985
- agentId,
2986
- threadId,
2987
- runtimeAgentId,
2988
- updates,
2989
- throttleMs
2990
- }?: UseAgentProps): {
2991
- agent: AbstractAgent;
2992
- /**
2993
- * Whether `agent` is the real, runtime-synced (or locally-registered) agent
2994
- * rather than a provisional stand-in returned while the runtime is still
2995
- * connecting (or in an error state).
2996
- *
2997
- * `agent` is always a fully-constructed `AbstractAgent`, so calling
2998
- * `agent.subscribe(...)`, `agent.setState(...)`, etc. is always safe. But
2999
- * while `isReady` is `false` the instance is a placeholder that will be
3000
- * swapped for the real agent once the runtime `/info` sync resolves, at
3001
- * which point `agent` changes reference and dependent effects re-run.
3002
- * Guard on `isReady` when you only want to act against the real agent —
3003
- * e.g. subscribing to run-lifecycle events you don't want to miss during
3004
- * the provisional window (#5000).
3005
- */
3006
- isReady: boolean;
3007
- };
3008
- //#endregion
3009
- //#region src/v2/hooks/use-capabilities.d.ts
3010
- /**
3011
- * Returns the capabilities declared by the given agent (or the agent resolved
3012
- * from the surrounding chat configuration, falling back to the default agent).
3013
- * Capabilities are populated from the runtime `/info` response at connection
3014
- * time. The hook reads them synchronously from the agent instance — there is
3015
- * no separate loading state, but the value will be `undefined` until the
3016
- * runtime handshake completes.
3017
- *
3018
- * @param agentId - Optional agent ID. If omitted, inherits the surrounding
3019
- * chat configuration's agent, falling back to the default agent.
3020
- * @returns The agent's capabilities, or `undefined` if the agent doesn't
3021
- * declare capabilities.
3022
- */
3023
- declare function useCapabilities(agentId?: string): AgentCapabilities | undefined;
3024
- //#endregion
3025
- //#region src/v2/hooks/use-agent-context.d.ts
3026
- /**
3027
- * Represents any value that can be serialized to JSON.
3028
- */
3029
- type JsonSerializable = string | number | boolean | null | JsonSerializable[] | {
3030
- [key: string]: JsonSerializable;
3031
- };
3032
- /**
3033
- * Context configuration for useAgentContext.
3034
- * Accepts any JSON-serializable value which will be converted to a string.
3035
- */
3036
- interface AgentContextInput {
3037
- /** A human-readable description of what this context represents */
3038
- description: string;
3039
- /** The context value - will be converted to a JSON string if not already a string */
3040
- value: JsonSerializable;
3041
- }
3042
- declare function useAgentContext(context: AgentContextInput): void;
3043
- //#endregion
3044
- //#region src/v2/hooks/use-suggestions.d.ts
3045
- interface UseSuggestionsOptions {
3046
- agentId?: string;
3047
- }
3048
- interface UseSuggestionsResult {
3049
- suggestions: Suggestion[];
3050
- reloadSuggestions: () => void;
3051
- clearSuggestions: () => void;
3052
- isLoading: boolean;
3053
- }
3054
- declare function useSuggestions({
3055
- agentId
3056
- }?: UseSuggestionsOptions): UseSuggestionsResult;
3057
- //#endregion
3058
- //#region src/v2/hooks/use-configure-suggestions.d.ts
3059
- type StaticSuggestionInput = Omit<Suggestion, "isLoading"> & Partial<Pick<Suggestion, "isLoading">>;
3060
- type StaticSuggestionsConfigInput = Omit<StaticSuggestionsConfig, "suggestions"> & {
3061
- suggestions: StaticSuggestionInput[];
3062
- };
3063
- type SuggestionsConfigInput = DynamicSuggestionsConfig | StaticSuggestionsConfigInput;
3064
- declare function useConfigureSuggestions(config: SuggestionsConfigInput | null | undefined, deps?: ReadonlyArray<unknown>): void;
3065
- //#endregion
3066
- //#region src/v2/hooks/use-interrupt.d.ts
3067
- type InterruptHandlerFn<TValue, TResult> = (props: InterruptHandlerProps<TValue>) => TResult | PromiseLike<TResult>;
3068
- type InterruptResultFromHandler<THandler> = THandler extends ((...args: never[]) => infer TResult) ? TResult extends PromiseLike<infer TResolved> ? TResolved | null : TResult | null : null;
3069
- type InterruptResult<TValue, TResult> = InterruptResultFromHandler<InterruptHandlerFn<TValue, TResult>>;
3070
- type InterruptRenderInChat = boolean | undefined;
3071
- type UseInterruptReturn<TRenderInChat extends InterruptRenderInChat> = TRenderInChat extends false ? React$1.ReactElement | null : TRenderInChat extends true | undefined ? void : React$1.ReactElement | null | void;
3072
- /**
3073
- * Configuration options for `useInterrupt`.
3074
- */
3075
- interface UseInterruptConfigBase<TValue = unknown, TResult = never> {
3076
- /**
3077
- * Render function for the interrupt UI.
3078
- *
3079
- * Receives both the standard `interrupt`/`interrupts` and the legacy `event`.
3080
- * Call `resolve(payload)` to resume with user input, or `cancel()` to cancel.
3081
- */
3082
- render: (props: InterruptRenderProps<TValue, InterruptResult<TValue, TResult>>) => React$1.ReactElement;
3083
- /**
3084
- * Optional pre-render handler invoked when an interrupt is received.
3085
- * Return a sync or async value to expose as `result` in `render`.
3086
- * Rejecting/throwing falls back to `result = null`.
3087
- */
3088
- handler?: InterruptHandlerFn<TValue, TResult>;
3089
- /**
3090
- * Optional predicate to filter which interrupts this hook handles.
3091
- * Receives the legacy-compatible event (for standard interrupts, `value` is
3092
- * the primary `Interrupt`). Return `false` to ignore.
3093
- */
3094
- enabled?: (event: InterruptEvent<TValue>) => boolean;
3095
- /** Optional agent id. Defaults to the current configured chat agent. */
3096
- agentId?: string;
3097
- }
3098
- type UseInterruptConfig<TValue = unknown, TResult = never, TRenderInChat extends InterruptRenderInChat = undefined> = UseInterruptConfigBase<TValue, TResult> & {
3099
- /** When true (default), the interrupt UI renders inside `<CopilotChat>` automatically. */renderInChat?: TRenderInChat;
3100
- };
3101
- /**
3102
- * Handles agent interrupts with optional filtering, preprocessing, and resume behavior.
3103
- *
3104
- * Supports both the AG-UI standard interrupt flow (`RUN_FINISHED` with
3105
- * `outcome.type === "interrupt"`) and the legacy custom-event flow
3106
- * (`on_interrupt`). For standard interrupts, `render` receives `interrupt`
3107
- * (the primary one) and `interrupts` (the full open set); call `resolve(payload)`
3108
- * to resume or `cancel()` to cancel. Resuming addresses the targeted interrupt
3109
- * and, once every open interrupt is addressed, submits a single spec `resume`
3110
- * array via `copilotkit.runAgent`.
3111
- *
3112
- * - `renderInChat: true` (default): the element is published into `<CopilotChat>`; returns `void`.
3113
- * - `renderInChat: false`: the hook returns the interrupt element for manual placement.
3114
- *
3115
- * @example
3116
- * ```tsx
3117
- * useInterrupt({
3118
- * render: ({ interrupt, resolve, cancel }) => (
3119
- * <div>
3120
- * <p>{interrupt?.message}</p>
3121
- * <button onClick={() => resolve({ approved: true })}>Approve</button>
3122
- * <button onClick={() => cancel()}>Cancel</button>
3123
- * </div>
3124
- * ),
3125
- * });
3126
- * ```
3127
- */
3128
- declare function useInterrupt<TResult = never, TRenderInChat extends InterruptRenderInChat = undefined>(config: UseInterruptConfig<any, TResult, TRenderInChat>): UseInterruptReturn<TRenderInChat>;
3129
- //#endregion
3130
- //#region src/v2/hooks/use-memories.d.ts
3131
- /**
3132
- * Return value of the {@link useMemories} hook.
3133
- *
3134
- * The `memories` array is the server-authoritative list for the current user.
3135
- * It is hydrated from a REST snapshot and kept current by realtime
3136
- * `memory_metadata` deltas from the store's own channel. Mutations resolve
3137
- * once the platform confirms the operation and reject with an `Error` on
3138
- * failure.
3139
- */
3140
- interface UseMemoriesResult {
3141
- /**
3142
- * Memories for the current user, newest first. Updated in realtime when
3143
- * the platform pushes `memory_metadata` events.
3144
- */
3145
- memories: Memory[];
3146
- /**
3147
- * `true` while the initial memory snapshot is being fetched. Subsequent
3148
- * realtime updates do not re-enter the loading state.
3149
- */
3150
- isLoading: boolean;
3151
- /**
3152
- * The most recent error from fetching memories or executing a mutation, or
3153
- * `null` when there is no error. Cleared on the next fetch attempt, on a
3154
- * successful fetch, when the runtime context changes, and on a successful
3155
- * mutation (a failed mutation replaces it with that mutation's error).
3156
- */
3157
- error: Error | null;
3158
- /**
3159
- * `true` when the platform memory routes are available. Set to `false`
3160
- * after a 404 or 501, indicating memory is not supported by the current
3161
- * runtime configuration.
3162
- */
3163
- isAvailable: boolean;
3164
- /**
3165
- * Health of the realtime connection that streams live `memory_metadata`
3166
- * deltas. Distinct from `isAvailable`/`error` (which describe the REST list
3167
- * route): `"connecting"` while the socket opens/joins, `"connected"` once
3168
- * live deltas are flowing, and `"unavailable"` once the socket permanently
3169
- * gives up — at which point the list is a frozen snapshot. Lets the UI drop a
3170
- * "live" indicator instead of showing it over stale data.
3171
- */
3172
- realtimeStatus: MemoryRealtimeStatus;
3173
- /**
3174
- * Re-fetch the memory snapshot from the platform. Resolves once the re-pull
3175
- * settles; rejects if it fails or the store is torn down mid-flight.
3176
- */
3177
- refresh: () => Promise<void>;
3178
- /**
3179
- * Create a memory. Resolves to the stored memory (server-authoritative);
3180
- * rejects on failure.
3181
- */
3182
- addMemory: (input: NewMemory) => Promise<Memory>;
3183
- /**
3184
- * Supersede a memory: the old memory is retired and a new one is created.
3185
- * Resolves to the new memory (its `id` differs from `id`); rejects on
3186
- * failure.
3187
- *
3188
- * Supersede is a FULL replacement, not a partial patch: `changes` is the
3189
- * complete definition of the new memory. You must re-supply `content` and
3190
- * `kind`, and an omitted `sourceThreadIds` resets the new memory's source
3191
- * threads to empty — it does not preserve the prior memory's value.
3192
- */
3193
- updateMemory: (id: string, changes: MemoryChanges) => Promise<Memory>;
3194
- /**
3195
- * Retire a memory (non-lossy delete). Resolves when the server confirms;
3196
- * rejects on failure.
3197
- */
3198
- removeMemory: (id: string) => Promise<void>;
3199
- }
3200
- /**
3201
- * React hook for listing and managing platform memories.
3202
- *
3203
- * Reads the memory store owned and wired by `CopilotKitCore`. On mount the
3204
- * hook exposes the live list plus stable `addMemory` / `updateMemory` /
3205
- * `removeMemory` / `refresh` callbacks. Mutations are server-authoritative:
3206
- * each resolves once the platform confirms the operation and rejects with an
3207
- * `Error` on failure.
3208
- *
3209
- * Realtime updates are automatic: the core's memory store opens its own
3210
- * `user_meta:memories:<joinCode>` channel and applies `memory_metadata` deltas
3211
- * to the list. You can still call `refresh()` to re-pull the REST snapshot on
3212
- * demand.
3213
- *
3214
- * @returns Memory list state and stable mutation callbacks.
3215
- *
3216
- * @example
3217
- * ```tsx
3218
- * import { useMemories } from "@copilotkit/react-core";
3219
- *
3220
- * function MemoryList() {
3221
- * const { memories, isLoading, isAvailable, addMemory, removeMemory } =
3222
- * useMemories();
3223
- *
3224
- * if (!isAvailable) return null;
3225
- * if (isLoading) return <p>Loading…</p>;
3226
- *
3227
- * return (
3228
- * <ul>
3229
- * {memories.map((m) => (
3230
- * <li key={m.id}>
3231
- * {m.content}
3232
- * <button onClick={() => removeMemory(m.id)}>Delete</button>
3233
- * </li>
3234
- * ))}
3235
- * </ul>
3236
- * );
3237
- * }
3238
- * ```
3239
- */
3240
- declare function useMemories(): UseMemoriesResult;
3241
- //#endregion
3242
- //#region src/v2/hooks/use-learn-from-user-action.d.ts
3243
- /**
3244
- * Input to {@link UseLearnFromUserActionRecorder}, the function returned
3245
- * by {@link useLearnFromUserAction}. Captures a single UI interaction that
3246
- * CopilotKit Intelligence's auto-curated knowledge base loop will distill
3247
- * into the team's `/project` notes.
3248
- */
3249
- interface LearnFromUserActionInput {
3250
- /** Thread the action is associated with. May be unknown to the platform. */
3251
- threadId: string;
3252
- /** Short, agent-readable summary of what the user did. Optional. */
3253
- title?: string | null;
3254
- /** Optional longer explanation. */
3255
- description?: string | null;
3256
- /** Free-form, JSON-serializable snapshot describing the action. Optional. */
3257
- data?: unknown;
3258
- /** ISO-8601 client-asserted timestamp. Defaults to server NOW() when absent. */
3259
- occurredAt?: string;
3260
- /**
3261
- * Caller-supplied idempotency key. When omitted, `recordAnnotation` generates a
3262
- * fresh UUID per call so retries collapse to the original row at the
3263
- * platform. Supply your own to keep a single semantic event idempotent
3264
- * across calls (e.g. a React re-render or a manual retry button).
3265
- */
3266
- clientEventId?: string;
3267
- }
3268
- /** Outcome returned by the recorder function. */
3269
- interface LearnFromUserActionResult {
3270
- /** Platform-assigned id of the user-action row. */
3271
- id: string;
3272
- /** True when the platform recognized this `clientEventId` as a retry. */
3273
- duplicate: boolean;
3274
- }
3275
- /** Recorder function returned by {@link useLearnFromUserAction}. */
3276
- type UseLearnFromUserActionRecorder = (input: LearnFromUserActionInput) => Promise<LearnFromUserActionResult>;
3277
- /**
3278
- * Record a user UI interaction in CopilotKit Intelligence's user-actions
3279
- * stream. The platform's auto-curated knowledge base agent reads these
3280
- * (alongside finished agent runs) and writes free-form Obsidian-flavored
3281
- * markdown to `/project`, where any agent in the same project can later
3282
- * read it via the `copilotkit_knowledge_base_shell` MCP tool.
3283
- *
3284
- * The hook returns a stable function. Calling it issues a request to the
3285
- * customer's CopilotKit runtime (`POST ${runtimeUrl}/annotate`), which
3286
- * resolves the Intel user from the BFF's auth and forwards to the
3287
- * platform — the Intel API key never reaches the browser.
3288
- *
3289
- * If `clientEventId` is omitted `recordAnnotation` generates a UUID per call,
3290
- * so a naive double-call (e.g. React 18 strict-mode double-mount, or a retry
3291
- * after a network blip on a fresh Promise) is naturally safe. Supply your
3292
- * own key when a single semantic event must remain idempotent across
3293
- * multiple `learnFromUserAction(...)` calls.
3294
- *
3295
- * @example
3296
- * ```tsx
3297
- * import { useLearnFromUserAction } from "@copilotkit/react-core";
3298
- *
3299
- * function SettingsPage({ threadId }) {
3300
- * const learnFromUserAction = useLearnFromUserAction();
3301
- *
3302
- * const onRename = (oldName: string, newName: string) => {
3303
- * void learnFromUserAction({
3304
- * threadId,
3305
- * title: "Renamed project",
3306
- * data: { previous: { name: oldName }, next: { name: newName } },
3307
- * });
3308
- * };
3309
- * }
3310
- * ```
3311
- */
3312
- declare function useLearnFromUserAction(): UseLearnFromUserActionRecorder;
3313
- //#endregion
3314
- //#region src/v2/hooks/use-learn-from-user-action-in-current-thread.d.ts
3315
- /**
3316
- * Input to {@link UseLearnFromUserActionInCurrentThreadRecorder} — same as
3317
- * {@link LearnFromUserActionInput} minus `threadId`, which is sourced from
3318
- * the surrounding `<CopilotChatConfigurationProvider>` at call time.
3319
- */
3320
- type LearnFromUserActionInCurrentThreadInput = Omit<LearnFromUserActionInput, "threadId">;
3321
- /** Recorder function returned by {@link useLearnFromUserActionInCurrentThread}. */
3322
- type UseLearnFromUserActionInCurrentThreadRecorder = (input: LearnFromUserActionInCurrentThreadInput) => Promise<LearnFromUserActionResult>;
3323
- /**
3324
- * Record a user UI interaction against the **current chat's** thread. The
3325
- * `threadId` is sourced from the surrounding
3326
- * `<CopilotChatConfigurationProvider>` (the same provider `<CopilotChat>`,
3327
- * `<CopilotSidebar>`, and friends set up), so callers in a chat-aware
3328
- * subtree don't need to thread an id through manually.
3329
- *
3330
- * Throws on **call** (not on mount) when there is no chat-config provider
3331
- * in scope — matches the "throw on call when runtimeUrl is missing"
3332
- * behavior of {@link useLearnFromUserAction}. Mounting the hook in a branch
3333
- * that never fires is harmless.
3334
- *
3335
- * The recorder does NOT accept a `threadId` override. If you need to
3336
- * record against an explicit thread, use {@link useLearnFromUserAction}
3337
- * directly — two hooks, two crisp contracts, no mode confusion.
3338
- *
3339
- * This hook always uses `config.threadId`, regardless of whether the
3340
- * surrounding chat config minted it internally or received one from
3341
- * the caller. Auto-minted threads simply mean the action lands under
3342
- * a thread the platform never saw — the writer agent still distills
3343
- * user-action-only threads (it does not require the thread to exist
3344
- * in `cpki.threads`), so the loop keeps learning.
3345
- *
3346
- * @example
3347
- * ```tsx
3348
- * import { useLearnFromUserActionInCurrentThread } from "@copilotkit/react-core";
3349
- *
3350
- * function SettingsPanel() {
3351
- * const learnFromUserAction = useLearnFromUserActionInCurrentThread();
3352
- *
3353
- * const onRename = (oldName: string, newName: string) => {
3354
- * void learnFromUserAction({
3355
- * title: "Renamed project",
3356
- * data: { previous: { name: oldName }, next: { name: newName } },
3357
- * });
3358
- * };
3359
- *
3360
- * // ...
3361
- * }
3362
- * ```
3363
- */
3364
- declare function useLearnFromUserActionInCurrentThread(): UseLearnFromUserActionInCurrentThreadRecorder;
3365
- //#endregion
3366
- //#region src/v2/hooks/use-attachments.d.ts
3367
- interface UseAttachmentsProps {
3368
- config?: AttachmentsConfig;
3369
- }
3370
- interface UseAttachmentsReturn {
3371
- /** Currently selected attachments (uploading + ready). */
3372
- attachments: Attachment[];
3373
- /** Whether attachments are enabled. */
3374
- enabled: boolean;
3375
- /** Whether the user is dragging a file over the drop zone. */
3376
- dragOver: boolean;
3377
- /** Ref for the hidden file input element. */
3378
- fileInputRef: React$1.RefObject<HTMLInputElement | null>;
3379
- /** Ref for the container element (used for scoped paste handling). */
3380
- containerRef: React$1.RefObject<HTMLDivElement | null>;
3381
- /** Process an array of files (validate, upload, add to state). */
3382
- processFiles: (files: File[]) => Promise<void>;
3383
- /** Handler for `<input type="file" onChange>`. */
3384
- handleFileUpload: (e: React$1.ChangeEvent<HTMLInputElement>) => Promise<void>;
3385
- /** Handler for `onDragOver` on the drop zone. */
3386
- handleDragOver: (e: React$1.DragEvent) => void;
3387
- /** Handler for `onDragLeave` on the drop zone. */
3388
- handleDragLeave: (e: React$1.DragEvent) => void;
3389
- /** Handler for `onDrop` on the drop zone. */
3390
- handleDrop: (e: React$1.DragEvent) => Promise<void>;
3391
- /** Remove an attachment by ID. */
3392
- removeAttachment: (id: string) => void;
3393
- /**
3394
- * Consume ready attachments and clear the queue.
3395
- * Returns the attachments that were ready; resets the file input.
3396
- * No-ops if the queue is already empty (no state update triggered).
3397
- */
3398
- consumeAttachments: () => Attachment[];
3399
- }
3400
- /**
3401
- * Hook that manages file attachment state — uploads, drag-and-drop, paste,
3402
- * and lifecycle. All returned callbacks are referentially stable across
3403
- * renders (via useCallback) to avoid destabilizing downstream memoization.
3404
- */
3405
- declare function useAttachments({
3406
- config
3407
- }: UseAttachmentsProps): UseAttachmentsReturn;
3408
- //#endregion
3409
- //#region src/v2/hooks/use-learning-containers.d.ts
3410
- /**
3411
- * Arguments for {@link useLearningContainers}.
3412
- *
3413
- * @deprecated This interface supports only the legacy plural-container
3414
- * annotation. Configure `getLearningContainerId` on `CopilotKitIntelligence`
3415
- * for new Intelligence runtimes.
3416
- */
3417
- interface UseLearningContainersArgs {
3418
- /** Thread to apply the learning-container selection to. */
3419
- threadId: string;
3420
- /**
3421
- * The ordered list of learning container identifiers to activate for this
3422
- * thread. Defaults to `["project"]` on the backend when absent.
3423
- */
3424
- learningContainers: readonly string[];
3425
- }
3426
- /**
3427
- * Legacy compatibility hook that keeps a thread's plural learning-container
3428
- * annotation in sync by emitting
3429
- * `set_learning_containers` annotations via the CopilotKit runtime annotate
3430
- * endpoint (`POST ${runtimeUrl}/annotate`).
3431
- *
3432
- * **Emit rules:**
3433
- * - On mount with `["project"]` (the backend default) → does NOT emit.
3434
- * Absence of an annotation equals the default, so the round-trip is skipped.
3435
- * - On mount with any other value → emits immediately.
3436
- * - On any subsequent content change (including a switch back to
3437
- * `["project"]`) → emits (a deliberate switch is always recorded).
3438
- * - On unmount or threadId change → emits a reset to `["project"]`
3439
- * so the backend is left in a clean state for the next consumer.
3440
- * Changing `learningContainers` within the same thread does NOT reset the
3441
- * thread; only the new value is emitted.
3442
- *
3443
- * Content-equality is evaluated via `JSON.stringify` so a fresh array literal
3444
- * with the same items does NOT trigger a redundant emit.
3445
- *
3446
- * If `runtimeUrl` is absent, all emits are silently skipped.
3447
- *
3448
- * @example
3449
- * ```tsx
3450
- * function ThreadPane({ threadId, userScope }: Props) {
3451
- * useLearningContainers({
3452
- * threadId,
3453
- * learningContainers: [userScope],
3454
- * });
3455
- * // ...
3456
- * }
3457
- * ```
3458
- *
3459
- * @deprecated This hook supports only the legacy plural-container annotation.
3460
- * Configure `getLearningContainerId` on `CopilotKitIntelligence` for new
3461
- * Intelligence runtimes.
3462
- */
3463
- declare function useLearningContainers({
3464
- threadId,
3465
- learningContainers
3466
- }: UseLearningContainersArgs): void;
3467
- //#endregion
3468
- //#region src/v2/hooks/use-learning-containers-in-current-thread.d.ts
3469
- /**
3470
- * Arguments for {@link useLearningContainersInCurrentThread}.
3471
- * Same as {@link UseLearningContainersArgs} minus `threadId`, which is
3472
- * sourced from the surrounding `<CopilotChatConfigurationProvider>` at
3473
- * render time.
3474
- *
3475
- * @deprecated This type supports only the legacy plural-container annotation.
3476
- * Configure `getLearningContainerId` on `CopilotKitIntelligence` for new
3477
- * Intelligence runtimes.
3478
- */
3479
- type UseLearningContainersInCurrentThreadArgs = Omit<UseLearningContainersArgs, "threadId">;
3480
- /**
3481
- * Legacy compatibility hook that keeps the **current chat thread's** plural
3482
- * learning-container annotation in sync. The `threadId` is sourced from the surrounding
3483
- * `<CopilotChatConfigurationProvider>` (the same provider `<CopilotChat>`,
3484
- * `<CopilotSidebar>`, and friends set up), so callers in a chat-aware
3485
- * subtree don't need to thread an id through manually.
3486
- *
3487
- * **Throws on render** when there is no chat-config provider in scope or
3488
- * when the provider does not yet have an active `threadId`. Mount the hook
3489
- * inside a subtree that is guaranteed to have a thread context.
3490
- *
3491
- * If you need to manage an explicit thread, use {@link useLearningContainers}
3492
- * directly — two hooks, two crisp contracts, no mode confusion.
3493
- *
3494
- * @throws When no `CopilotChatConfigurationProvider` is in scope or when the
3495
- * active `threadId` is absent/empty.
3496
- *
3497
- * @example
3498
- * ```tsx
3499
- * function ThreadPanel({ scope }: Props) {
3500
- * useLearningContainersInCurrentThread({
3501
- * learningContainers: [scope],
3502
- * });
3503
- * // ...
3504
- * }
3505
- * ```
3506
- *
3507
- * @deprecated This hook supports only the legacy plural-container annotation.
3508
- * Configure `getLearningContainerId` on `CopilotKitIntelligence` for new
3509
- * Intelligence runtimes.
3510
- */
3511
- declare function useLearningContainersInCurrentThread({
3512
- learningContainers
3513
- }: UseLearningContainersInCurrentThreadArgs): void;
3514
- //#endregion
3515
- //#region src/v2/lib/react-core.d.ts
3516
- interface CopilotKitCoreReactConfig extends CopilotKitCoreConfig {
3517
- renderToolCalls?: ReactToolCallRenderer<any>[];
3518
- renderActivityMessages?: ReactActivityMessageRenderer<any>[];
3519
- renderCustomMessages?: ReactCustomMessageRenderer[];
3520
- }
3521
- interface CopilotKitCoreReactSubscriber extends CopilotKitCoreSubscriber {
3522
- onRenderToolCallsChanged?: (event: {
3523
- copilotkit: CopilotKitCore;
3524
- renderToolCalls: ReactToolCallRenderer<any>[];
3525
- }) => void | Promise<void>;
3526
- onInterruptElementChanged?: (event: {
3527
- copilotkit: CopilotKitCore;
3528
- interruptElement: React$1.ReactElement | null;
3529
- }) => void | Promise<void>;
3530
- }
3531
- declare class CopilotKitCoreReact extends CopilotKitCore {
3532
- private _renderToolCalls;
3533
- private _hookRenderToolCalls;
3534
- private _cachedMergedRenderToolCalls;
3535
- private _renderCustomMessages;
3536
- private _renderActivityMessages;
3537
- private _interruptElement;
3538
- constructor(config: CopilotKitCoreReactConfig);
3539
- get renderCustomMessages(): Readonly<ReactCustomMessageRenderer[]>;
3540
- get renderActivityMessages(): Readonly<ReactActivityMessageRenderer<any>>[];
3541
- get renderToolCalls(): Readonly<ReactToolCallRenderer<any>>[];
3542
- setRenderActivityMessages(renderers: ReactActivityMessageRenderer<any>[]): void;
3543
- setRenderCustomMessages(renderers: ReactCustomMessageRenderer[]): void;
3544
- setRenderToolCalls(renderToolCalls: ReactToolCallRenderer<any>[]): void;
3545
- addHookRenderToolCall(entry: ReactToolCallRenderer<any>): void;
3546
- removeHookRenderToolCall(name: string, agentId?: string): void;
3547
- private _notifyRenderToolCallsChanged;
3548
- get interruptElement(): React$1.ReactElement | null;
3549
- setInterruptElement(element: React$1.ReactElement | null): void;
3550
- subscribe(subscriber: CopilotKitCoreReactSubscriber): CopilotKitCoreSubscription;
3551
- /**
3552
- * Wait for pending React state updates before the follow-up agent run.
3553
- *
3554
- * When a frontend tool handler calls setState(), React 18 batches the update
3555
- * and schedules a commit via its internal scheduler (MessageChannel). The
3556
- * useAgentContext hook registers context via useLayoutEffect, which runs
3557
- * synchronously after React commits that batch.
3558
- *
3559
- * Awaiting a zero-delay timeout yields to the macrotask queue. React's
3560
- * MessageChannel task runs first, committing the pending state and running
3561
- * useLayoutEffect (which updates the context store). The follow-up runAgent
3562
- * call then reads fresh context.
3563
- */
3564
- waitForPendingFrameworkUpdates(): Promise<void>;
3565
- }
3566
- //#endregion
3567
- //#region src/v2/context.d.ts
3568
- interface CopilotKitContextValue {
3569
- copilotkit: CopilotKitCoreReact;
3570
- /**
3571
- * Whether CopilotKit should automatically mount Intelligence indicators.
3572
- * Defaults to true when omitted for compatibility with custom providers.
3573
- */
3574
- showIntelligenceIndicator?: boolean;
3575
- /**
3576
- * Set of tool call IDs currently being executed.
3577
- * This is tracked at the provider level to ensure tool execution events
3578
- * are captured even before child components mount.
3579
- */
3580
- executingToolCallIds: ReadonlySet<string>;
3581
- }
3582
- declare const useCopilotKit: () => CopilotKitContextValue;
3583
- declare const useLicenseContext: () => LicenseContextValue;
3584
- //#endregion
3585
- //#region src/v2/a2ui/A2UIRecoveryStates.d.ts
3586
- /**
3587
- * Shared pre-paint lifecycle states for the A2UI surface renderer (OSS-162).
3588
- *
3589
- * The A2UI middleware drives the WHOLE generative-UI lifecycle on a single
3590
- * `a2ui-surface` activity (one stable messageId, `replace: true`), so the states
3591
- * below swap IN PLACE and the painted surface ultimately replaces them:
3592
- *
3593
- * building → animated skeleton + "Building interface" (+ optional ~N tokens)
3594
- * retrying → same skeleton; once perceptible, the sub-label becomes
3595
- * "Retrying generation… (N/M attempts)" (threshold-gated so a fast
3596
- * transient retry never flashes), with debug detail per debugExposure
3597
- * failed → a clean hard-failure card (replacing the skeleton), developer
3598
- * detail tucked into an expander gated by debugExposure
3599
- * painted → the surface renderer owns the UI (these states render nothing)
3600
- *
3601
- * Timing (`showAfterMs` / `showAfterAttempts`) and how much debug detail to surface
3602
- * (`debugExposure`) are client concerns; the server can override `debugExposure`
3603
- * by stamping it onto the activity content (it wins over the client option).
3604
- */
3605
- type A2UIRecoveryRendererOptions = {
3606
- /** Delay (ms) before the "Retrying…" sub-label becomes visible. Default 2000. */showAfterMs?: number; /** Show the "Retrying…" sub-label immediately once `attempt` reaches this. Default 2. */
3607
- showAfterAttempts?: number; /** How much retry/debug detail to surface. Default "collapsed". */
3608
- debugExposure?: "hidden" | "collapsed" | "verbose";
3609
- };
3610
- //#endregion
3611
- //#region src/v2/providers/CopilotKitProvider.d.ts
3612
- interface CopilotKitProviderProps {
3613
- children: ReactNode;
3614
- runtimeUrl?: string;
3615
- /**
3616
- * Headers sent with every request. A record, or a sync or async builder
3617
- * that runs when each request is sent. An inline arrow is fine. The builder
3618
- * should be cheap; cache tokens in it (Clerk's `getToken()` already does).
3619
- */
3620
- headers?: CopilotKitHeadersSource;
3621
- /**
3622
- * Credentials mode for fetch requests (e.g., "include" for HTTP-only cookies in cross-origin requests).
3623
- */
3624
- credentials?: RequestCredentials;
3625
- /**
3626
- * Rewrites the message list sent to runtime agents on every run.
3627
- *
3628
- * CopilotKit sends the whole thread each time. When your agent already
3629
- * stores the conversation, most of that payload is waste, and an agent that
3630
- * merges the inbound list with its own store can show the model every turn
3631
- * twice. Return the messages to send:
3632
- *
3633
- * ```tsx
3634
- * <CopilotKit
3635
- * runtimeUrl="/api/copilotkit"
3636
- * messageFilter={(messages) => messages.slice(-1)}
3637
- * />
3638
- * ```
3639
- *
3640
- * The filter changes the request body only. The transcript the UI renders is
3641
- * untouched. Broken tool-call pairs are repaired before the request is sent,
3642
- * so a filter this blunt cannot strand a tool result mid-HITL.
3643
- *
3644
- * Agents reached through your CopilotRuntime honor this. An agent your app
3645
- * passes in directly does not, and neither Intelligence runs nor suggestion
3646
- * runs are ever filtered.
3647
- *
3648
- * Prefer a stable reference (`useCallback`). An inline arrow re-registers the
3649
- * filter on every render, which is harmless but needless.
3650
- */
3651
- messageFilter?: CopilotKitMessageFilter;
3652
- /** Your CopilotKit public license key. */
3653
- publicApiKey?: string;
3654
- /** Your public license key for accessing CopilotKit Intelligence features. */
3655
- publicLicenseKey?: string;
3656
- /**
3657
- * Signed license token for offline verification of CopilotKit Intelligence features.
3658
- * Obtain from https://dashboard.operations.copilotkit.ai.
3659
- */
3660
- licenseToken?: string;
3661
- properties?: Record<string, unknown>;
3662
- /**
3663
- * The id of the agent every `<CopilotChat>` under this provider talks to,
3664
- * unless a chat names its own with the `agentId` prop.
3665
- *
3666
- * This is the v2 replacement for the v1 `<CopilotKit agent="...">` prop. Set
3667
- * it here and you never need the v1 compatibility provider just to name an
3668
- * agent. Defaults to `"default"`.
3669
- */
3670
- agentId?: string;
3671
- useSingleEndpoint?: boolean;
3672
- agents__unsafe_dev_only?: Record<string, AbstractAgent>;
3673
- selfManagedAgents?: Record<string, AbstractAgent>;
3674
- renderToolCalls?: ReactToolCallRenderer<any>[];
3675
- renderActivityMessages?: ReactActivityMessageRenderer<any>[];
3676
- renderCustomMessages?: ReactCustomMessageRenderer[];
3677
- frontendTools?: ReactFrontendTool[];
3678
- humanInTheLoop?: ReactHumanInTheLoop[];
3679
- /**
3680
- * Configuration for OpenGenerativeUI — sandboxed UI generated by the LLM.
3681
- *
3682
- * @example
3683
- * ```tsx
3684
- * <CopilotKit
3685
- * runtimeUrl="/api/copilotkit"
3686
- * openGenerativeUI={{
3687
- * sandboxFunctions: [{ name: "addToCart", description: "…", parameters: schema, handler: fn }],
3688
- * }}
3689
- * >
3690
- * ```
3691
- */
3692
- openGenerativeUI?: {
3693
- /**
3694
- * Functions made available inside sandboxed iframes.
3695
- * Each function is described to the LLM via agent context and exposed
3696
- * via websandbox's `localApi`.
3697
- *
3698
- * Inside the iframe, call them with:
3699
- * ```js
3700
- * await Websandbox.connection.remote.<functionName>(args)
3701
- * ```
3702
- */
3703
- sandboxFunctions?: SandboxFunction[];
3704
- /**
3705
- * Design guidelines injected as agent context for the `generateSandboxedUi` tool.
3706
- * Override this to control the visual style of generated UIs.
3707
- *
3708
- * A sensible default is provided if omitted.
3709
- */
3710
- designSkill?: string;
3711
- };
3712
- /**
3713
- * @deprecated This prop no longer controls the Inspector. Use
3714
- * `enableInspector` instead.
3715
- */
3716
- showDevConsole?: boolean | "auto";
3717
- /**
3718
- * Disable the CopilotKit Inspector in development.
3719
- * The Inspector is enabled by default in development browser builds on
3720
- * localhost/loopback. It is always disabled on remote hosts, in production,
3721
- * and during server rendering. Temporary Inspector hides also hide its
3722
- * message shortcuts.
3723
- * An explicit value takes priority over CopilotChat's inspectorTools prop.
3724
- */
3725
- enableInspector?: boolean;
3726
- /**
3727
- * Whether to automatically mount the Intelligence indicator in chat.
3728
- *
3729
- * @default true
3730
- */
3731
- showIntelligenceIndicator?: boolean;
3732
- /**
3733
- * Error handler called when CopilotKit encounters an error.
3734
- * Fires for all error types (runtime connection failures, agent errors, tool errors).
3735
- */
3736
- onError?: (event: {
3737
- error: Error;
3738
- code: CopilotKitCoreErrorCode;
3739
- context: Record<string, any>;
3740
- }) => void | Promise<void>;
3741
- /**
3742
- * Configuration for the A2UI (Agent-to-UI) renderer.
3743
- * The built-in A2UI renderer is activated automatically when the runtime reports
3744
- * that `a2ui` is configured in `CopilotRuntime`. This prop is optional and only
3745
- * needed if you want to override the default theme.
3746
- *
3747
- * @example
3748
- * ```tsx
3749
- * <CopilotKit runtimeUrl="/api/copilotkit" a2ui={{ theme: myCustomTheme }}>
3750
- * {children}
3751
- * </CopilotKit>
3752
- * ```
3753
- */
3754
- a2ui?: {
3755
- /**
3756
- * Override the default A2UI viewer theme.
3757
- * When omitted, the built-in `viewerTheme` from `@copilotkit/a2ui-renderer` is used.
3758
- */
3759
- theme?: Theme;
3760
- /**
3761
- * Optional component catalog to pass to the A2UI renderer.
3762
- * When omitted, the default basicCatalog is used.
3763
- */
3764
- catalog?: any;
3765
- /**
3766
- * Optional custom loading component shown while an A2UI surface is generating.
3767
- * When omitted, a default animated skeleton is shown.
3768
- */
3769
- loadingComponent?: React$1.ComponentType;
3770
- /**
3771
- * When true (the default), the full component schemas from the catalog are
3772
- * sent as agent context so the agent knows what components and props are
3773
- * available. The A2UI middleware can overwrite this with a server-side
3774
- * schema if configured.
3775
- *
3776
- * When false, the agent context still describes the catalog, but only by its
3777
- * catalog ID and the names of its custom components, without their JSON
3778
- * schemas. The component schema entry and the A2UI generation and design
3779
- * guidelines are not sent. With the CopilotKit LangGraph middleware's
3780
- * injected A2UI tool, the A2UI subagent then gets the component names only;
3781
- * a host can still give it a composition guide through the middleware's
3782
- * guidelines (`a2uiParams.guidelines.compositionGuide` in TypeScript,
3783
- * `a2ui_params["guidelines"]["composition_guide"]` in Python).
3784
- */
3785
- includeSchema?: boolean;
3786
- /**
3787
- * Options for the A2UI error-recovery status UI (OSS-162): how long before
3788
- * the transient "Retrying…" hint appears, after how many attempts, and how
3789
- * much retry/debug detail to surface. When omitted, sane defaults apply.
3790
- */
3791
- recovery?: A2UIRecoveryRendererOptions;
3792
- };
3793
- /**
3794
- * Experimental. Native generative UI: `generativeUI={{ ui }}`, where `ui`
3795
- * comes from `createGenerativeUI`. The agent renders your React components
3796
- * into chat or into `<GenerativeUISurface id>` mounts. Props that match
3797
- * the declared state and events that match the declared functions are
3798
- * bound by the library, and the model does not see them.
3799
- */
3800
- generativeUI?: GenerativeUIConfig;
3801
- /**
3802
- * Configuration for the built-in MCP Apps renderer.
3803
- *
3804
- * @example
3805
- * ```tsx
3806
- * <CopilotKit runtimeUrl="/api/copilotkit" mcpApps={{ allowSameOriginFallback: true }}>
3807
- * {children}
3808
- * </CopilotKit>
3809
- * ```
3810
- */
3811
- mcpApps?: {
3812
- /**
3813
- * Restore `allow-same-origin` on the MCP App sandbox. Default `false`.
3814
- *
3815
- * **Unsafe.** The widget then runs with your page's origin: it can read
3816
- * your cookies, storage and DOM, and call your APIs as the signed-in user.
3817
- * Only set it for widgets you wrote and trust that need `localStorage`,
3818
- * `IndexedDB` or cookies. By default widgets get an opaque origin.
3819
- */
3820
- allowSameOriginFallback?: boolean;
3821
- };
3822
- /**
3823
- * Default throttle interval (in milliseconds) for `useAgent` re-renders
3824
- * triggered by `OnMessagesChanged` notifications. This value is used as
3825
- * a fallback when neither the `useAgent()` hook nor `<CopilotChat>` /
3826
- * `<CopilotSidebar>` / `<CopilotPopup>` specify an explicit `throttleMs`.
3827
- *
3828
- * @default undefined (components/hooks without an explicit throttleMs will be unthrottled)
3829
- */
3830
- defaultThrottleMs?: number;
3831
- /**
3832
- * Enable debug logging for the client-side event pipeline.
3833
- */
3834
- debug?: DebugConfig;
3835
- /**
3836
- * Turns on interaction capture (`@copilotkit/learning`). `learning` (short
3837
- * for `learning={true}`) records with the default options; pass an object
3838
- * for options. `false` or omitting the prop turns capture off and cancels
3839
- * startup. Without a sink, Core authenticates with the runtime and sends
3840
- * browser events to Intelligence; a custom sink keeps the standalone
3841
- * collector behavior. Updated settings apply to the next Trajectory.
3842
- *
3843
- * Capture starts after mount. Set `trajectoryId` to use your own ID;
3844
- * otherwise the provider generates one. The generated ID stays the same
3845
- * across rerenders, reconnects and option changes; turning capture off,
3846
- * setting `autoStart: false` or supplying a `trajectoryId` ends it, and the
3847
- * next generated Trajectory gets a new ID. Read the active ID from
3848
- * `copilotkit.trajectoryId`.
3849
- *
3850
- * Set `autoStart: false` to start capture yourself with `startTrajectory()`.
3851
- * Capture stops on unmount, including manually started Trajectories.
3852
- *
3853
- * @example
3854
- * <CopilotKitProvider runtimeUrl="/api/copilotkit" learning>
3855
- */
3856
- learning?: boolean | LearningProp;
3857
- }
3858
- type LearningProp = LearningConfig & {
3859
- /**
3860
- * Starts a Trajectory after mount. Defaults to `true`; set `false` to call
3861
- * `startTrajectory()` yourself.
3862
- */
3863
- autoStart?: boolean;
3864
- trajectoryId?: string;
3865
- /**
3866
- * Used only by explicit custom sinks. Authenticated capture warns and ignores
3867
- * this option; assign Learning Spaces on the server with
3868
- * `getTrajectoryLearningContainerIds` on `CopilotKitIntelligence`.
3869
- */
3870
- learningContainerIds?: string[];
3871
- };
3872
- /** Provide a shared core instance and synchronize runtime, tool, and UI configuration. */
3873
- declare const CopilotKitProvider: React$1.FC<CopilotKitProviderProps>;
3874
- //#endregion
3875
- //#region src/v2/providers/SandboxFunctionsContext.d.ts
3876
- declare const SandboxFunctionsContext: react.Context<readonly SandboxFunction[]>;
3877
- declare function useSandboxFunctions(): readonly SandboxFunction[];
3878
- //#endregion
3879
- //#region src/v2/a2ui/A2UIMessageRenderer.d.ts
3880
- /**
3881
- * User action with dataContextPath, as dispatched by A2UI components.
3882
- */
3883
- type A2UIUserAction = {
3884
- name: string;
3885
- sourceComponentId: string;
3886
- surfaceId: string;
3887
- timestamp: string;
3888
- context?: Record<string, unknown>;
3889
- dataContextPath?: string;
3890
- };
3891
- /**
3892
- * Intercept an A2UI user action before it reaches the agent.
3893
- *
3894
- * Called with the dispatched action and a `forward` helper that runs the agent
3895
- * with the (optionally modified) action. The return value drives the default
3896
- * forwarding:
3897
- * - return `null` → the app handled it client-side (e.g. a `navigate` event);
3898
- * the action is NOT forwarded to the agent.
3899
- * - return an `A2UIUserAction` → that (possibly modified) action is forwarded.
3900
- * - return `undefined` / `void` → the original action is forwarded unchanged.
3901
- *
3902
- * `forward` is provided for advanced cases where you want to do async work and
3903
- * forward manually; if you call it yourself, return `null` to suppress the
3904
- * default forward and avoid running the agent twice.
3905
- */
3906
- type A2UIActionInterceptor = (action: A2UIUserAction, forward: (action?: A2UIUserAction) => Promise<void>) => void | A2UIUserAction | null | Promise<void | A2UIUserAction | null>;
3907
- type A2UIMessageRendererOptions = {
3908
- theme: Theme; /** Optional component catalog to pass to A2UIProvider */
3909
- catalog?: any; /** Optional custom loading component shown while the A2UI surface is building. */
3910
- loadingComponent?: React.ComponentType;
3911
- /**
3912
- * Pre-paint recovery/loading UX options (OSS-162): timing before the
3913
- * "Retrying…" sub-label appears + how much retry/debug detail to surface.
3914
- */
3915
- recovery?: A2UIRecoveryRendererOptions;
3916
- /**
3917
- * Intercept actions before they reach the agent. Lets an app handle an action
3918
- * client-side (e.g. `navigate`) instead of forwarding every action. See
3919
- * {@link A2UIActionInterceptor}.
3920
- */
3921
- onAction?: A2UIActionInterceptor;
3922
- };
3923
- declare function createA2UIMessageRenderer(options: A2UIMessageRendererOptions): ReactActivityMessageRenderer<any>;
3924
- //#endregion
3925
- //#region src/v1-deprecated/components/copilot-provider/copilotkit-props.d.ts
3926
- /**
3927
- * Props for CopilotKit.
3928
- */
3929
- /**
3930
- * We shouldn't need this `Omit` here, but using it because `CopilotKitProps`
3931
- * and `CopilotKitProviderProps` have non-identical `children` types
3932
- *
3933
- * TODO: Remove this `Omit` once this is resolved.
3934
- */
3935
- interface CopilotKitProps extends Omit<CopilotKitProviderProps, "children" | "onError"> {
3936
- /** Your CopilotKit public license key. */
3937
- publicApiKey?: string;
3938
- /** Your public license key for accessing CopilotKit Intelligence features. */
3939
- publicLicenseKey?: string;
3940
- /**
3941
- * Restrict input to a specific topic.
3942
- * @deprecated Use `guardrails_c` instead to control input restrictions
3943
- */
3944
- cloudRestrictToTopic?: {
3945
- validTopics?: string[];
3946
- invalidTopics?: string[];
3947
- };
3948
- /** @internal Defunct — retained for backward compatibility. */
3949
- guardrails_c?: {
3950
- validTopics?: string[];
3951
- invalidTopics?: string[];
3952
- };
3953
- /**
3954
- * The endpoint for the Copilot Runtime instance. [Click here for more information](/backend/copilot-runtime).
3955
- */
3956
- runtimeUrl?: string;
3957
- /**
3958
- * The endpoint for the Copilot transcribe audio service.
3959
- */
3960
- transcribeAudioUrl?: string;
3961
- /**
3962
- * The endpoint for the Copilot text to speech service.
3963
- */
3964
- textToSpeechUrl?: string;
3965
- /**
3966
- * Additional headers to be sent with the request.
3967
- * Can be a static object, a synchronous builder, or an async builder
3968
- * (useful for refreshing auth tokens). Whichever form you use, it is
3969
- * evaluated when each request is sent, not when this component renders.
3970
- *
3971
- * For example:
3972
- * ```tsx
3973
- * // Static headers
3974
- * headers={{ "Authorization": "Bearer X" }}
3975
- *
3976
- * // Synchronous builder, evaluated at send time
3977
- * headers={() => ({ "Authorization": `Bearer ${getToken()}` })}
3978
- *
3979
- * // Async builder, evaluated (and awaited) at send time
3980
- * headers={async () => ({ "Authorization": `Bearer ${await getToken()}` })}
3981
- * ```
3982
- *
3983
- * An async builder is only awaited on the request paths served by
3984
- * `<CopilotKit>`'s v2 provider (agent runs, threads, the inspector, and
3985
- * so on). The legacy v1 `CopilotTask` / GraphQL path (and anything else
3986
- * that reads the internal `copilotApiConfig.headers` snapshot) never
3987
- * awaits it: an async builder is called once, its result (and any
3988
- * rejection) is discarded, and every read there gets an empty object
3989
- * instead, with one console warning per provider instance in development.
3990
- *
3991
- * Cache inside the builder. Clerk's and Auth0's `getToken()` already
3992
- * cache. A builder that calls the network every time adds one call per
3993
- * request.
3994
- *
3995
- * If the builder throws or rejects, that request is not sent and
3996
- * `onError` gets `header_resolution_failed`.
3997
- *
3998
- * Passing the same builder again, or a new builder function, does not
3999
- * reload anything, because the provider keeps one stable wrapper. On a
4000
- * user switch, remount the provider (for example `key={userId}`) so
4001
- * thread lists and Inspector metadata reload for the new user.
4002
- *
4003
- * Core headers are also sent to any self-managed agent registered
4004
- * directly with CopilotKit, including ones on other origins. Don't put a
4005
- * bearer token in core headers if those agents point at a third party.
4006
- */
4007
- headers?: CopilotKitHeadersSource;
4008
- /**
4009
- * The children to be rendered within the CopilotKit.
4010
- */
4011
- children: ReactNode;
4012
- /**
4013
- * Custom properties to be sent with the request.
4014
- * Can include threadMetadata for thread creation and authorization for LangGraph Platform authentication.
4015
- * For example:
4016
- * ```js
4017
- * {
4018
- * 'user_id': 'users_id',
4019
- * 'authorization': 'your-auth-token', // For LangGraph Platform authentication
4020
- * threadMetadata: {
4021
- * 'account_id': '123',
4022
- * 'user_type': 'premium'
4023
- * }
4024
- * }
4025
- * ```
4026
- *
4027
- * **Note**: The `authorization` property is automatically forwarded to LangGraph agents. See the [LangGraph Agent Authentication Guide](/auth) for details.
4028
- */
4029
- properties?: Record<string, any>;
4030
- /**
4031
- * Indicates whether the user agent should send or receive cookies from the other domain
4032
- * in the case of cross-origin requests.
4033
- *
4034
- * To enable HTTP-only cookie authentication, set `credentials="include"` and configure
4035
- * CORS on your runtime endpoint:
4036
- *
4037
- * ```tsx
4038
- * // Frontend (https://myapp.com)
4039
- * <CopilotKit runtimeUrl="https://api.myapp.com/copilotkit" credentials="include">
4040
- * {children}
4041
- * </CopilotKit>
4042
- *
4043
- * // Backend (https://api.myapp.com)
4044
- * copilotRuntimeNextJSAppRouterEndpoint({
4045
- * runtime,
4046
- * endpoint: "/copilotkit",
4047
- * cors: {
4048
- * origin: "https://myapp.com",
4049
- * credentials: true,
4050
- * },
4051
- * });
4052
- * ```
4053
- */
4054
- credentials?: RequestCredentials;
4055
- /**
4056
- * Whether to show the dev console (error banners and toasts).
4057
- *
4058
- * @deprecated Use `enableInspector` to control the AG-UI inspector,
4059
- * which is what most users want. `showDevConsole` only controls
4060
- * error toasts/banners, not the inspector button.
4061
- * Defaults to `false` for production safety.
4062
- */
4063
- showDevConsole?: boolean;
4064
- /**
4065
- * The name of the agent to use.
4066
- */
4067
- agent?: string;
4068
- /**
4069
- * The forwarded parameters to use for the task.
4070
- */
4071
- forwardedParameters?: Pick<ForwardedParametersInput, "temperature">;
4072
- /** @internal Defunct — retained for backward compatibility. */
4073
- authConfig_c?: {
4074
- SignInComponent: React.ComponentType<{
4075
- onSignInComplete: (authState: AuthState) => void;
4076
- }>;
4077
- };
4078
- /**
4079
- * The thread id to use for the CopilotKit.
4080
- */
4081
- threadId?: string;
4082
- /**
4083
- * Optional error handler for comprehensive debugging and observability.
4084
- *
4085
- * @param errorEvent - Structured error event with rich debugging context
4086
- *
4087
- * @example
4088
- * ```typescript
4089
- * <CopilotKit
4090
- * onError={(errorEvent) => {
4091
- * debugDashboard.capture(errorEvent);
4092
- * }}
4093
- * >
4094
- * ```
4095
- */
4096
- onError?: CopilotErrorHandler;
4097
- /**
4098
- * Enable or disable the CopilotKit Inspector, letting you inspect AG-UI events,
4099
- * view agent messages, check agent state, and visualize agent context. The
4100
- * Inspector is enabled by default in development browser builds and is always
4101
- * disabled in production and during server rendering.
4102
- */
4103
- enableInspector?: boolean;
4104
- /**
4105
- * Enable debug logging. On the server (`CopilotRuntime`), this enables
4106
- * structured Pino logging of the AG-UI event pipeline. On the client,
4107
- * this configuration is forwarded to the AG-UI transport layer
4108
- * (`transformChunks`) for transport-level debug output.
4109
- *
4110
- * Pass `true` for full output, or an object for granular control:
4111
- *
4112
- * ```tsx
4113
- * <CopilotKit debug={true} runtimeUrl="...">
4114
- * {children}
4115
- * </CopilotKit>
4116
- * ```
4117
- */
4118
- debug?: DebugConfig;
4119
- }
4120
- //#endregion
4121
- //#region src/v1-deprecated/components/copilot-provider/copilotkit.d.ts
4122
- declare function CopilotKit({
4123
- children,
4124
- ...props
4125
- }: CopilotKitProps): react_jsx_runtime0.JSX.Element;
4126
- declare const defaultCopilotContextCategories: string[];
4127
- //#endregion
4128
- export { useRenderTool as $, InterruptSchema as $a, SurfaceSegment as $c, ɵTHREAD_REQUEST_TIMEOUT_MS as $d, CrewsResponse as $f, DocumentInputPartSchema as $i, UnrecognizedEvent as $l, CopilotChatConfigurationValue as $n, ReasoningEncryptedValueEventProps as $o, BackwardCompatibility_0_0_57 as $r, RunStartedEvent as $s, CopilotPopupView as $t, omitOptionalNulls as $u, UseAttachmentsReturn as A, ImageInputContent as Aa, SubagentErrorEventSchema as Ac, ɵGenerativeUIDebugSource as Ad, ɵselectMemoriesError as Af, CopilotKitCoreStopAgentParams as Ai, ToolCallArgsEventSchema as Al, CopilotChatSuggestionView as An, MultimodalCapabilitiesSchema as Ao, AddOperationSchema as Ar, ResumeStatus as As, MCPAppsActivityRenderer as At, defaultApplyEvents as Au, useMemories as B, InputContentSchema as Ba, SubagentInfo as Bc, ɵMemoryState as Bd, CopilotApiConfig as Bf, CustomEventProps as Bi, ToolCallSchema as Bl, CopilotChatFeedbackMessage as Bn, OutputCapabilitiesSchema as Bo, AnyAction as Br, RunErrorEventSchema as Bs, CopilotChatAttachmentRenderer as Bt, extractFenceOperations as Bu, MemoryScope as C, HttpAgentConfig as Ca, StepStartedEvent as Cc, withAuthoritativeActivityTypes as Cd, ɵphoenixSocket$ as Cf, CopilotKitCoreGetToolParams as Ci, ThreadRunActivityNotification as Cl, IntelligenceIndicatorProps as Cn, Middleware as Co, ActivityDeltaEventSchema as Cr, Reducer as Cs, OpenGenerativeUIActivityRenderer as Ct, createActionGroup as Cu, UseLearningContainersArgs as D, INSPECTOR_THREAD_BRIDGE_PLUGIN_ID as Da, StoreLifecycleAction as Dc, ɵGenerativeUIDebugPromptSection as Dd, ɵselectIsMutating as Df, CopilotKitCoreRunToolParams as Di, ToolCall$1 as Dl, IntelligenceIndicatorViewProps as Dn, MultiAgentCapabilities as Do, ActivitySnapshotEventProps as Dr, ReplaceOperationSchema as Ds, OpenGenerativeUIToolRenderer as Dt, createReducer as Du, useLearningContainersInCurrentThread as E, HumanInTheLoopCapabilitiesSchema as Ea, Store as Ec, ɵGenerativeUIDebugFunction as Ed, ɵselectIsFetchingNextPage as Ef, CopilotKitCoreRunAgentParams as Ei, Tool as El, IntelligenceIndicatorView as En, MoveOperationSchema as Eo, ActivitySnapshotEvent as Er, ReplaceOperation as Es, OpenGenerativeUIContentSchema as Et, createInspectorThreadRequestId as Eu, LearnFromUserActionInput as F, ImagePartSchema as Fa, SubagentFinishedOutcomeSchema as Fc, ɵInterruptToolResult as Fd, ɵselectThreadsError as Ff, CopilotKitMessageFilter$1 as Fi, ToolCallEndEventProps as Fl, CopilotChatReasoningMessageProps as Fn, NonDispatchingEffect as Fo, AgentRegistry as Fr, RunAgentParameters as Fs, CopilotKitInspectorProps as Ft, empty as Fu, AgentContextInput as G, InspectorActiveThreadPayload as Ga, SubagentStartedEventProps as Gc, ɵPhoenixChannelSession as Gd, LangGraphInterruptAction as Gf, DebugLoggerInput as Gi, ToolMessage$1 as Gl, CopilotChatToolCallGroupProps as Gn, ProxiedCopilotRuntimeAgent as Go, AudioInputContent as Gr, RunFinishedEventSchema as Gs, Thread as Gt, getWebMCPModelContext as Gu, useInterrupt as H, InputContentSourceSchema as Ha, SubagentRunId as Hc, ɵPendingInterrupt as Hd, CopilotContextParams as Hf, DataSource as Hi, ToolCallStartEventProps as Hl, CopilotChatToolCallsViewProps as Hn, PartSource as Ho, AssistantMessageSchema as Hr, RunFinishedCancelledOutcomeSchema as Hs, CopilotThreadsDrawer as Ht, flattenInformationalCards as Hu, LearnFromUserActionResult as I, InputContent as Ia, SubagentFinishedSuccessOutcome as Ic, ɵMAX_SOCKET_RETRIES as Id, ɵselectThreadsIsLoading as If, CopilotRuntimeTransport as Ii, ToolCallEndEventSchema as Il, CopilotChatUserMessage as In, NonDispatchingEffectOptions as Io, AgentStateMutation as Ir, RunAgentResult$1 as Is, WildcardToolCallRender as It, enforceEvents as Iu, useCapabilities as J, InspectorViewThreadPayload as Ja, SubscribeToAgentSubscriber as Jc, ɵPhoenixSocketLike as Jd, LangGraphInterruptRender as Jf, DispatchingEffect as Ji, ToolsCapabilities as Jl, CopilotChatInput as Jn, RawEventProps as Jo, AudioInputPartSchema as Jr, RunFinishedOutcome as Js, useThreads as Jt, isInterruptExpired as Ju, JsonSerializable as K, InspectorMetadataV1 as Ka, SubagentStartedEventSchema as Kc, ɵPhoenixJoinOutcome as Kd, LangGraphInterruptActionSetter as Kf, DeveloperMessage as Ki, ToolMessageSchema as Kl, CopilotChatToolCallDisplay as Kn, ProxiedCopilotRuntimeAgentConfig as Ko, AudioInputContentSchema as Kr, RunFinishedInterruptOutcome as Ks, UseThreadsInput as Kt, isAbortError as Ku, UseLearnFromUserActionRecorder as L, InputContentDataSource as La, SubagentFinishedSuccessOutcomeSchema as Lc, ɵMemoryEnvironment as Ld, ɵthreadAdapterEvents as Lf, CopyOperation as Li, ToolCallResultEvent as Ll, CopilotChatUserMessageProps as Ln, OpenThreadRegistration as Lo, AgentSubscriber as Lr, RunCompletionAware as Ls, Attachment$1 as Lt, enforceOutgoingInput as Lu, LearnFromUserActionInCurrentThreadInput as M, ImageInputPart as Ma, SubagentFinishedEventProps as Mc, ɵInterruptDecision as Md, ɵselectMemoriesIsMutating as Mf, CopilotKitCoreSubscription$1 as Mi, ToolCallChunkEventProps as Ml, CopilotChatSuggestionPill as Mn, MultimodalInputCapabilitiesSchema as Mo, AgentCapabilitiesSchema as Mr, RoleSchema as Ms, ɵMcpFollowUpHost as Mt, emitInspectorStopViewing as Mu, UseLearnFromUserActionInCurrentThreadRecorder as N, ImageInputPartSchema as Na, SubagentFinishedEventSchema as Nc, ɵInterruptEvent as Nd, ɵselectMemoriesRealtimeStatus as Nf, CopilotKitHeaderResolutionError as Ni, ToolCallChunkEventSchema as Nl, CopilotChatSuggestionPillProps as Nn, MultimodalOutputCapabilities as No, AgentConfig as Nr, RunAgentInput as Ns, ɵrunMcpFollowUp as Nt, emitInspectorViewThread as Nu, useLearningContainers as O, IdentityCapabilities as Oa, SubagentErrorEvent as Oc, ɵGenerativeUIDebugRun as Od, ɵselectMemories as Of, CopilotKitCoreRunToolResult as Oi, ToolCallArgsEvent as Ol, CopilotChatWorkSummary as On, MultiAgentCapabilitiesSchema as Oo, ActivitySnapshotEventSchema as Or, ResolvedAgentDebugConfig as Os, MCPAppsActivityContent$1 as Ot, createSelector as Ou, useLearnFromUserActionInCurrentThread as P, ImagePart as Pa, SubagentFinishedOutcome as Pc, ɵInterruptState as Pd, ɵselectThreads as Pf, CopilotKitHeadersSource$1 as Pi, ToolCallEndEvent as Pl, CopilotChatReasoningMessage as Pn, MultimodalOutputCapabilitiesSchema as Po, AgentDebugConfig as Pr, RunAgentInputSchema as Ps, CopilotKitInspector as Pt, emitInspectorViewThreadResult as Pu, useDefaultRenderTool as Q, IntelligenceRuntimeInfo as Qa, SuggestionsConfig as Qc, ɵRUNTIME_PROBE_TIMEOUT_MS as Qd, CrewsAgentState as Qf, DocumentInputPart as Qi, TransportCapabilitiesSchema as Ql, CopilotChatConfigurationProviderProps as Qn, ReasoningEncryptedValueEvent as Qo, BackwardCompatibility_0_0_45 as Qr, RunHandler as Qs, CopilotSidebarProps as Qt, ofType as Qu, useLearnFromUserAction as R, InputContentDataSourceSchema as Ra, SubagentFinishedSuspendedOutcome as Rc, ɵMemoryMetadataEvent as Rd, ɵwithHeaderDefaults as Rf, CopyOperationSchema as Ri, ToolCallResultEventProps as Rl, CopilotChatAssistantMessage as Rn, OptionalMetadataSchema as Ro, AgentSubscriberParams as Rr, RunErrorEvent as Rs, AttachmentModality as Rt, ensureObjectArgs as Ru, MemoryKind as S, HttpAgent as Sa, StepFinishedEventSchema as Sc, verifyEvents as Sd, ɵphoenixChannel$ as Sf, CopilotKitCoreGetSuggestionsResult as Si, ThreadEndpointRuntimeInfo as Sl, IntelligenceIndicator as Sn, MetadataSchema as So, ActivityDeltaEventProps as Sr, ReasoningStartEventSchema as Ss, GenerateSandboxedUiArgsSchema as St, convertToLegacyEvents as Su, UseLearningContainersInCurrentThreadArgs as T, HumanInTheLoopCapabilities as Ta, StepStartedEventSchema as Tc, ɵCopilotKitFeature as Td, ɵselectHasNextPage as Tf, CopilotKitCoreRegisterProxiedAgentResult as Ti, TokenUsageSchema as Tl, IntelligenceIndicatorStatus as Tn, MoveOperation as To, ActivityMessageSchema as Tr, RemoveOperationSchema as Ts, OpenGenerativeUIContent as Tt, createEffect as Tu, useConfigureSuggestions as U, InputContentUrlSource as Ua, SubagentRunIdSchema as Uc, ɵPhoenixChannelLike as Ud, useCopilotContext as Uf, DataSourceSchema as Ui, ToolCallStartEventSchema as Ul, CopilotChatToolCallGroup as Un, PartSourceSchema as Uo, Attributable as Ur, RunFinishedEvent as Us, CopilotThreadsDrawerProps as Ut, getMarkdownOperationSurfaceId as Uu, UseInterruptConfig as V, InputContentSource$1 as Va, SubagentInfoSchema as Vc, ɵMemoryStore as Vd, CopilotContext as Vf, CustomEventSchema as Vi, ToolCallStartEvent as Vl, CopilotChatToolCallsView as Vn, PROTOCOL_VERSION as Vo, AssistantMessage$1 as Vr, RunFinishedCancelledOutcome as Vs, CopilotChatAttachmentQueue as Vt, extractStringField as Vu, useSuggestions as W, InputContentUrlSourceSchema as Wa, SubagentStartedEvent as Wc, ɵPhoenixChannelOptions as Wd, CoAgentStateRender as Wf, DebugLogger as Wi, ToolCallStatus$1 as Wl, CopilotChatToolCallGroupAppearance as Wn, PropsActionConfig as Wo, AttributableSchema as Wr, RunFinishedEventProps as Ws, CopilotThreadsDrawerRowRenderer as Wt, getRunOutcome as Wu, useAgent as X, IntelligenceAgent as Xa, SuggestionAvailability as Xc, ɵPhoenixSocketSession as Xd, LangGraphInterruptRenderProps as Xf, DocumentInputContent as Xi, TrajectoryStartOptions as Xl, ToolsMenuItem as Xn, ReasoningCapabilities as Xo, AudioPartSchema as Xr, RunFinishedSuccessOutcome as Xs, CopilotPopupProps as Xt, isRunCompletionAware as Xu, UseAgentUpdate as Y, InspectorViewThreadResultPayload as Ya, Suggestion$1 as Yc, ɵPhoenixSocketOptions as Yd, LangGraphInterruptRenderHandlerProps as Yf, DispatchingEffectOptions as Yi, ToolsCapabilitiesSchema as Yl, CopilotChatInputProps as Yn, RawEventSchema as Yo, AudioPart as Yr, RunFinishedOutcomeSchema as Ys, CopilotPopup as Yt, isRecognizedEvent as Yu, useHumanInTheLoop as Z, IntelligenceAgentConfig as Za, SuggestionEngine as Zc, ɵPhoenixSocketSignal as Zd, QueuedInterruptEvent as Zf, DocumentInputContentSchema as Zi, TransportCapabilities as Zl, CopilotChatConfigurationProvider as Zn, ReasoningCapabilitiesSchema as Zo, BackwardCompatibility_0_0_39 as Zr, RunFinishedSuccessOutcomeSchema as Zs, CopilotSidebar as Zt, mergeMetadata as Zu, CopilotKitCoreReact as _, FrontendToolHandlerContext as _a, StateSnapshotEventProps as _c, structuredClone_ as _d, ɵmemoryRestEvents as _f, CopilotKitCoreConfig$1 as _i, TextMessageStartEvent as _l, MessageGroupWrapperProps as _n, MessageSchema as _o, FrontendActionAvailability as _p, ActionFromCreator as _r, ReasoningMessageStartEvent as _s, ReactCustomMessageRenderer as _t, classifySurfaceCards as _u, A2UIMessageRendererOptions as a, Event as aa, ScopedProperties as ac, parseProtoStream as ad, ɵThreadStore as af, BaseMessageSchema as ai, TextInputContentSchema as al, CopilotChatToggleButton as an, JsonPointerSchema as ao, SystemMessageFunction as ap, A2UIMarkdownOperation as ar, ReasoningEndEventSchema as as, INTERRUPT_EVENT_NAME as at, VideoInputContentSchema as au, Memory$1 as b, FunctionCallSchema as ba, StepFinishedEvent as bc, transformChunks as bd, ɵobservePhoenixSocketHealth$ as bf, CopilotKitCoreErrorCode$1 as bi, TextPart as bl, messageRow as bn, MessagesSnapshotEventSchema as bo, ActionGroupResult as br, ReasoningStartEvent as bs, ReactToolCallRenderer as bt, contentHasMedia as bu, InspectorAnchor as c, EventSchemas as ca, State as cc, prepareSurfaceOperations as cd, ɵcreateThreadStore as cf, CompatibilityBoundary as ci, TextMessageChunkEventSchema as cl, DefaultOpenIcon as cn, LegacyLearningConfig as co, TreeNode as cp, AGUIConnectNotImplementedError as cr, ReasoningMessageChunkEventProps as cs, InterruptEvent as ct, VideoPart as cu, CopilotKitProvider as d, ExecutionCapabilities as da, StateDeltaEvent as dc, resolveAgentDebugConfig as dd, ɵisRetryableMemoryStatus as df, Context as di, TextMessageContentEventSchema as dl, CopilotChatView as dn, MemoryError as do, ActionRenderPropsNoArgsWait as dp, AGUIEventByType as dr, ReasoningMessageContentEventProps as ds, InterruptResolveFn as dt, WebMCPRegistry as du, DocumentPart as ea, RunStartedEventProps as ec, on as ed, ɵThread as ef, BaseEvent as ei, SystemMessage as el, CopilotPopupViewProps as en, JsonPatch as eo, CrewsResponseStatus as ep, CopilotChatLabels as er, ReasoningEncryptedValueEventSchema as es, useComponent as et, UrlSource as eu, CopilotKitProviderProps as f, ExecutionCapabilitiesSchema as fa, StateDeltaEventProps as fc, resolveDebugLogger as fd, ɵjoinPhoenixChannel$ as ff, ContextSchema as fi, TextMessageEndEvent as fl, CopilotChatViewProps as fn, MemoryErrorCategory as fo, ActionRenderPropsWait as fp, AGUIEventOf as fr, ReasoningMessageContentEventSchema as fs, ResumeEntry as ft, WebMCPToolAnnotations as fu, useLicenseContext as g, FrontendTool$1 as ga, StateSnapshotEvent as gc, splitA2UIMarkdown as gd, ɵmemoryReducer as gf, CopilotKitCoreCatalogComponent as gi, TextMessageRoleSchema as gl, MessageGroup as gn, Message$3 as go, FrontendAction as gp, ActionCreator as gr, ReasoningMessageSchema as gs, useRenderCustomMessages as gt, buildResumeArray as gu, useCopilotKit as h, FilterToolCallsMiddleware as ha, StateSchema as hc, select as hd, ɵmemoryDomainEvents as hf, CopilotKitCoreAddAgentParams as hi, TextMessageRole as hl, CopilotChatMessageViewProps as hn, MemoryRealtimeStatus$1 as ho, CatchAllFrontendAction as hp, ActionConfig as hr, ReasoningMessageEndEventSchema as hs, ReactFrontendTool as ht, authoritativeActivityTypes as hu, A2UIActionInterceptor as i, EmptyActionConfig as ia, ScopedContext as ic, onInspectorViewThreadResult as id, ɵThreadSelectors as if, BaseMessage as ii, TextInputContent as il, CopilotModalHeaderProps as in, JsonPointer as io, CopilotChatSuggestionConfiguration as ip, CopilotChatAudioRecorder as ir, ReasoningEndEventProps as is, SandboxFunction as it, VideoInputContent as iu, useAttachments as j, ImageInputContentSchema as ja, SubagentFinishedEvent as jc, ɵGenerativeUIDebugSurface as jd, ɵselectMemoriesIsLoading as jf, CopilotKitCoreSubscriber$1 as ji, ToolCallChunkEvent as jl, CopilotChatSuggestionViewProps as jn, MultimodalInputCapabilities as jo, AgentCapabilities$1 as jr, Role as js, MCPAppsActivityType as jt, emitInspectorActiveThread as ju, UseAttachmentsProps as k, IdentityCapabilitiesSchema as ka, SubagentErrorEventProps as kc, ɵGenerativeUIDebugSnapshot as kd, ɵselectMemoriesAvailable as kf, CopilotKitCoreRuntimeConnectionStatus as ki, ToolCallArgsEventProps as kl, CopilotChatWorkSummaryProps as kn, MultimodalCapabilities as ko, AddOperation as kr, ResumeEntrySchema as ks, MCPAppsActivityContentSchema as kt, createStore as ku, SandboxFunctionsContext as l, EventType as la, StateCapabilities as lc, props as ld, ɵisCopilotKitFeature as lf, ContentPart as li, TextMessageContentEvent as ll, CopilotChat as ln, MEMORY_ERROR_REGISTRY as lo, ActionRenderProps as lp, AGUIError as lr, ReasoningMessageChunkEventSchema as ls, InterruptHandlerProps as lt, VideoPartSchema as lu, CopilotKitContextValue as m, FileSourceSchema as ma, StateManager as mc, segmentSurfaceProse as md, ɵmemoryAdapterEvents as mf, CopilotKitCore$1 as mi, TextMessageEndEventSchema as ml, CopilotChatMessageView as mn, MemoryErrorRegistryEntry as mo, CatchAllActionRenderPropsWait as mp, AbstractAgent$1 as mr, ReasoningMessageEndEventProps as ms, ReactHumanInTheLoop as mt, aggregateTokenUsage as mu, defaultCopilotContextCategories as n, DynamicSuggestionsConfig$1 as na, RuntimeLicenseStatus as nc, onInspectorStopViewing as nd, ɵThreadMetadataEvent as nf, BaseEventProps as ni, TestOperation as nl, CopilotSidebarViewProps as nn, JsonPatchOperationSchema as no, CrewsTaskStateItem as np, AudioRecorderError as nr, ReasoningEncryptedValueSubtypeSchema as ns, useFrontendTool as nt, UserMessage$1 as nu, A2UIUserAction as o, EventPayloadOf as oa, Selector as oc, parseSSEStream as od, ɵcreateMemoryStore as of, ChildIdsOf as oi, TextMessageChunkEvent as ol, CopilotChatToggleButtonProps as on, JsonValue as oo, DocumentPointer as op, A2UI_FENCE_LANGUAGE as or, ReasoningMessage$1 as os, Interrupt as ot, VideoInputPart as ou, A2UIRecoveryRendererOptions as p, FileSource as pa, StateDeltaEventSchema as pc, runHttpRequest as pd, ɵmapMemoryMetadataEvent as pf, ContextStore as pi, TextMessageEndEventProps as pl, AutoScrollMode as pn, MemoryErrorCode as po, CatchAllActionRenderProps as pp, AGUI_METADATA_KEY as pr, ReasoningMessageEndEvent as ps, defineToolCallRenderer as pt, WebMCPToolConfig$1 as pu, useAgentContext as q, InspectorStopViewingPayload as qa, SubscribeToAgentOptions as qc, ɵPhoenixPushLike as qd, LangGraphInterruptActionSetterArgs as qf, DeveloperMessageSchema as qi, ToolSchema as ql, ToolCallEntry as qn, RawEvent as qo, AudioInputPart as qr, RunFinishedInterruptOutcomeSchema as qs, UseThreadsResult as qt, isInspectorThreadBridgeEnabled as qu, CopilotKitProps as r, Effect as ra, RuntimeMode as rc, onInspectorViewThread as rd, ɵThreadRuntimeContext as rf, BaseEventSchema as ri, TestOperationSchema as rl, CopilotModalHeader as rn, JsonPatchSchema as ro, CrewsToolStateItem as rp, AudioRecorderState as rr, ReasoningEndEvent as rs, useRenderActivityMessage as rt, UserMessageSchema as ru, createA2UIMessageRenderer as s, EventSchema as sa, StartResult as sc, parseToolArguments as sd, ɵcreateThreadSelectors as sf, ChildWalkOptions as si, TextMessageChunkEventProps as sl, DefaultCloseIcon as sn, LearningConfig$1 as so, Tree as sp, ACTIVITY_HISTORY_METADATA as sr, ReasoningMessageChunkEvent as ss, InterruptCancelFn as st, VideoInputPartSchema as su, CopilotKit as t, DocumentPartSchema as ta, RunStartedEventSchema as tc, onInspectorActiveThread as td, ɵThreadEnvironment as tf, BaseEventFields as ti, SystemMessageSchema as tl, CopilotSidebarView as tn, JsonPatchOperation as to, CrewsStateItem as tp, useCopilotChatConfiguration as tr, ReasoningEncryptedValueSubtype as ts, useFrontendTools as tt, UrlSourceSchema as tu, useSandboxFunctions as u, EventTypeSchema as ua, StateCapabilitiesSchema as uc, randomUUID as ud, ɵisHttpAgent as uf, ContentPartSchema as ui, TextMessageContentEventProps as ul, CopilotChatProps as un, MarkdownSegment as uo, ActionRenderPropsNoArgs as up, AGUIEvent as ur, ReasoningMessageContentEvent as us, InterruptRenderProps as ut, WebMCPModelContext as uu, CopilotKitCoreReactConfig as v, FrontendToolReconnectBehavior as va, StateSnapshotEventSchema as vc, tokenUsageFromAiSdkUsage as vd, ɵobservePhoenixEvent$ as vf, CopilotKitCoreConnectAgentParams as vi, TextMessageStartEventProps as vl, MessageRow as vn, MessagesSnapshotEvent as vo, RenderFunctionStatus as vp, ActionFromCreators as vr, ReasoningMessageStartEventProps as vs, ReactCustomMessageRendererPosition as vt, compactEvents as vu, NewMemory$1 as w, HttpAgentFetchFn as wa, StepStartedEventProps as wc, ɵCOPILOTKIT_FEATURES as wd, ɵselectFetchMoreError as wf, CopilotKitCoreRegisterProxiedAgentParams as wi, TokenUsage as wl, getIntelligenceTurnAnchors as wn, MiddlewareFunction as wo, ActivityMessage$1 as wr, RemoveOperation as ws, OpenGenerativeUIActivityType as wt, createDebugLogger as wu, MemoryChanges$1 as x, FunctionMiddleware as xa, StepFinishedEventProps as xc, transformHttpEventStream as xd, ɵobservePhoenixSocketSignals$ as xf, CopilotKitCoreFriendsAccess as xi, TextPartSchema as xl, INTELLIGENCE_TURN_HEAD as xn, Metadata as xo, ActivityDeltaEvent as xr, ReasoningStartEventProps as xs, GenerateSandboxedUiArgs as xt, contentToText as xu, CopilotKitCoreReactSubscriber as y, FunctionCall as ya, StaticSuggestionsConfig$1 as yc, tokenUsageFromLangChainMetadata as yd, ɵobservePhoenixJoinOutcome$ as yf, CopilotKitCoreContinuationHandoff as yi, TextMessageStartEventSchema as yl, messageGroup as yn, MessagesSnapshotEventProps as yo, ActionGroupConfig as yr, ReasoningMessageStartEventSchema as ys, useRenderToolCall as yt, completePartialMarkdown as yu, UseMemoriesResult as z, InputContentPart as za, SubagentFinishedSuspendedOutcomeSchema as zc, ɵMemoryRuntimeContext as zd, CoagentInChatRenderFunction as zf, CustomEvent as zi, ToolCallResultEventSchema as zl, CopilotChatAssistantMessageProps as zn, OutputCapabilities as zo, AgentThreadLockedError as zr, RunErrorEventProps as zs, AttachmentsConfig$1 as zt, extractCompleteArrayItems as zu };
4129
- //# sourceMappingURL=copilotkit-wqaNanhw.d.cts.map