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