@copilotkit/react-core 1.53.0 → 1.53.1-next.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/CHANGELOG.md +10 -0
- package/dist/copilotkit-BRPQ2sqS.d.cts +670 -0
- package/dist/copilotkit-BRPQ2sqS.d.cts.map +1 -0
- package/dist/copilotkit-C94ayZbs.cjs +2161 -0
- package/dist/copilotkit-C94ayZbs.cjs.map +1 -0
- package/dist/copilotkit-CwZMFmSK.d.mts +670 -0
- package/dist/copilotkit-CwZMFmSK.d.mts.map +1 -0
- package/dist/copilotkit-Yh_Ld_FX.mjs +2031 -0
- package/dist/copilotkit-Yh_Ld_FX.mjs.map +1 -0
- package/dist/index.cjs +30 -2082
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +13 -674
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +13 -674
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +4 -2028
- package/dist/index.mjs.map +1 -1
- package/dist/v2/index.cjs +3 -1
- package/dist/v2/index.css +1 -1
- package/dist/v2/index.d.cts +3 -1
- package/dist/v2/index.d.mts +3 -1
- package/dist/v2/index.mjs +3 -1
- package/dist/v2/index.umd.js +1979 -7
- package/dist/v2/index.umd.js.map +1 -0
- package/package.json +5 -5
- package/src/v2/index.ts +3 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# ui
|
|
2
2
|
|
|
3
|
+
## 1.53.1-next.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [6e0cddf]
|
|
8
|
+
- @copilotkitnext/react@1.53.1-next.0
|
|
9
|
+
- @copilotkit/runtime-client-gql@1.53.1-next.0
|
|
10
|
+
- @copilotkit/shared@1.53.1-next.0
|
|
11
|
+
- @copilotkitnext/core@1.53.1-next.0
|
|
12
|
+
|
|
3
13
|
## 1.53.0
|
|
4
14
|
|
|
5
15
|
### Patch Changes
|
|
@@ -0,0 +1,670 @@
|
|
|
1
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
2
|
+
import { Agent, ExtensionsInput, ForwardedParametersInput, LangGraphInterruptEvent } from "@copilotkit/runtime-client-gql";
|
|
3
|
+
import React$1, { ReactNode } from "react";
|
|
4
|
+
import { Action, CopilotCloudConfig, CopilotErrorHandler, CopilotKitError, FunctionCallHandler, MappedParameterTypes, Parameter } from "@copilotkit/shared";
|
|
5
|
+
import { CopilotKitProviderProps } from "@copilotkitnext/react";
|
|
6
|
+
|
|
7
|
+
//#region src/types/frontend-action.d.ts
|
|
8
|
+
interface InProgressState<T extends Parameter[] | [] = []> {
|
|
9
|
+
status: "inProgress";
|
|
10
|
+
args: Partial<MappedParameterTypes<T>>;
|
|
11
|
+
result: undefined;
|
|
12
|
+
}
|
|
13
|
+
interface ExecutingState<T extends Parameter[] | [] = []> {
|
|
14
|
+
status: "executing";
|
|
15
|
+
args: MappedParameterTypes<T>;
|
|
16
|
+
result: undefined;
|
|
17
|
+
}
|
|
18
|
+
interface CompleteState<T extends Parameter[] | [] = []> {
|
|
19
|
+
status: "complete";
|
|
20
|
+
args: MappedParameterTypes<T>;
|
|
21
|
+
result: any;
|
|
22
|
+
}
|
|
23
|
+
interface InProgressStateNoArgs<T extends Parameter[] | [] = []> {
|
|
24
|
+
status: "inProgress";
|
|
25
|
+
args: Partial<MappedParameterTypes<T>>;
|
|
26
|
+
result: undefined;
|
|
27
|
+
}
|
|
28
|
+
interface ExecutingStateNoArgs<T extends Parameter[] | [] = []> {
|
|
29
|
+
status: "executing";
|
|
30
|
+
args: MappedParameterTypes<T>;
|
|
31
|
+
result: undefined;
|
|
32
|
+
}
|
|
33
|
+
interface CompleteStateNoArgs<T extends Parameter[] | [] = []> {
|
|
34
|
+
status: "complete";
|
|
35
|
+
args: MappedParameterTypes<T>;
|
|
36
|
+
result: any;
|
|
37
|
+
}
|
|
38
|
+
interface InProgressStateWait<T extends Parameter[] | [] = []> {
|
|
39
|
+
status: "inProgress";
|
|
40
|
+
args: Partial<MappedParameterTypes<T>>;
|
|
41
|
+
/** @deprecated use respond instead */
|
|
42
|
+
handler: undefined;
|
|
43
|
+
respond: undefined;
|
|
44
|
+
result: undefined;
|
|
45
|
+
}
|
|
46
|
+
interface ExecutingStateWait<T extends Parameter[] | [] = []> {
|
|
47
|
+
status: "executing";
|
|
48
|
+
args: MappedParameterTypes<T>;
|
|
49
|
+
/** @deprecated use respond instead */
|
|
50
|
+
handler: (result: any) => void;
|
|
51
|
+
respond: (result: any) => void;
|
|
52
|
+
result: undefined;
|
|
53
|
+
}
|
|
54
|
+
interface CompleteStateWait<T extends Parameter[] | [] = []> {
|
|
55
|
+
status: "complete";
|
|
56
|
+
args: MappedParameterTypes<T>;
|
|
57
|
+
/** @deprecated use respond instead */
|
|
58
|
+
handler: undefined;
|
|
59
|
+
respond: undefined;
|
|
60
|
+
result: any;
|
|
61
|
+
}
|
|
62
|
+
interface InProgressStateNoArgsWait<T extends Parameter[] | [] = []> {
|
|
63
|
+
status: "inProgress";
|
|
64
|
+
args: Partial<MappedParameterTypes<T>>;
|
|
65
|
+
/** @deprecated use respond instead */
|
|
66
|
+
handler: undefined;
|
|
67
|
+
respond: undefined;
|
|
68
|
+
result: undefined;
|
|
69
|
+
}
|
|
70
|
+
interface ExecutingStateNoArgsWait<T extends Parameter[] | [] = []> {
|
|
71
|
+
status: "executing";
|
|
72
|
+
args: MappedParameterTypes<T>;
|
|
73
|
+
/** @deprecated use respond instead */
|
|
74
|
+
handler: (result: any) => void;
|
|
75
|
+
respond: (result: any) => void;
|
|
76
|
+
result: undefined;
|
|
77
|
+
}
|
|
78
|
+
interface CompleteStateNoArgsWait<T extends Parameter[] | [] = []> {
|
|
79
|
+
status: "complete";
|
|
80
|
+
args: MappedParameterTypes<T>;
|
|
81
|
+
/** @deprecated use respond instead */
|
|
82
|
+
handler: undefined;
|
|
83
|
+
respond: undefined;
|
|
84
|
+
}
|
|
85
|
+
type ActionRenderProps<T extends Parameter[] | [] = []> = CompleteState<T> | ExecutingState<T> | InProgressState<T>;
|
|
86
|
+
type ActionRenderPropsNoArgs<T extends Parameter[] | [] = []> = CompleteStateNoArgs<T> | ExecutingStateNoArgs<T> | InProgressStateNoArgs<T>;
|
|
87
|
+
type ActionRenderPropsWait<T extends Parameter[] | [] = []> = CompleteStateWait<T> | ExecutingStateWait<T> | InProgressStateWait<T>;
|
|
88
|
+
type ActionRenderPropsNoArgsWait<T extends Parameter[] | [] = []> = CompleteStateNoArgsWait<T> | ExecutingStateNoArgsWait<T> | InProgressStateNoArgsWait<T>;
|
|
89
|
+
type CatchAllActionRenderProps<T extends Parameter[] | [] = []> = (CompleteState<T> & {
|
|
90
|
+
name: string;
|
|
91
|
+
}) | (ExecutingState<T> & {
|
|
92
|
+
name: string;
|
|
93
|
+
}) | (InProgressState<T> & {
|
|
94
|
+
name: string;
|
|
95
|
+
});
|
|
96
|
+
type FrontendActionAvailability = "disabled" | "enabled" | "remote" | "frontend";
|
|
97
|
+
type FrontendAction<T extends Parameter[] | [] = [], N extends string = string> = Action<T> & {
|
|
98
|
+
name: Exclude<N, "*">;
|
|
99
|
+
/**
|
|
100
|
+
* @deprecated Use `available` instead.
|
|
101
|
+
*/
|
|
102
|
+
disabled?: boolean;
|
|
103
|
+
available?: FrontendActionAvailability;
|
|
104
|
+
pairedAction?: string;
|
|
105
|
+
followUp?: boolean;
|
|
106
|
+
} & ({
|
|
107
|
+
render?: string | (T extends [] ? (props: ActionRenderPropsNoArgs<T>) => string | React$1.ReactElement : (props: ActionRenderProps<T>) => string | React$1.ReactElement); /** @deprecated use renderAndWaitForResponse instead */
|
|
108
|
+
renderAndWait?: never;
|
|
109
|
+
renderAndWaitForResponse?: never;
|
|
110
|
+
} | {
|
|
111
|
+
render?: never; /** @deprecated use renderAndWaitForResponse instead */
|
|
112
|
+
renderAndWait?: T extends [] ? (props: ActionRenderPropsNoArgsWait<T>) => React$1.ReactElement : (props: ActionRenderPropsWait<T>) => React$1.ReactElement;
|
|
113
|
+
renderAndWaitForResponse?: T extends [] ? (props: ActionRenderPropsNoArgsWait<T>) => React$1.ReactElement : (props: ActionRenderPropsWait<T>) => React$1.ReactElement;
|
|
114
|
+
handler?: never;
|
|
115
|
+
});
|
|
116
|
+
type CatchAllFrontendAction = {
|
|
117
|
+
name: "*";
|
|
118
|
+
render: (props: CatchAllActionRenderProps<any>) => React$1.ReactElement;
|
|
119
|
+
};
|
|
120
|
+
type RenderFunctionStatus = ActionRenderProps<any>["status"];
|
|
121
|
+
//#endregion
|
|
122
|
+
//#region src/hooks/use-tree.d.ts
|
|
123
|
+
type TreeNodeId = string;
|
|
124
|
+
interface TreeNode {
|
|
125
|
+
id: TreeNodeId;
|
|
126
|
+
value: string;
|
|
127
|
+
children: TreeNode[];
|
|
128
|
+
parentId?: TreeNodeId;
|
|
129
|
+
categories: Set<string>;
|
|
130
|
+
}
|
|
131
|
+
type Tree = TreeNode[];
|
|
132
|
+
//#endregion
|
|
133
|
+
//#region src/types/document-pointer.d.ts
|
|
134
|
+
interface DocumentPointer {
|
|
135
|
+
id: string;
|
|
136
|
+
name: string;
|
|
137
|
+
sourceApplication: string;
|
|
138
|
+
iconImageUri: string;
|
|
139
|
+
getContents: () => string;
|
|
140
|
+
}
|
|
141
|
+
//#endregion
|
|
142
|
+
//#region src/types/system-message.d.ts
|
|
143
|
+
type SystemMessageFunction = (contextString: string, additionalInstructions?: string) => string;
|
|
144
|
+
//#endregion
|
|
145
|
+
//#region src/types/chat-suggestion-configuration.d.ts
|
|
146
|
+
interface CopilotChatSuggestionConfiguration {
|
|
147
|
+
/**
|
|
148
|
+
* A prompt or instructions for the GPT to generate suggestions.
|
|
149
|
+
*/
|
|
150
|
+
instructions: string;
|
|
151
|
+
/**
|
|
152
|
+
* The minimum number of suggestions to generate. Defaults to `1`.
|
|
153
|
+
* @default 1
|
|
154
|
+
*/
|
|
155
|
+
minSuggestions?: number;
|
|
156
|
+
/**
|
|
157
|
+
* The maximum number of suggestions to generate. Defaults to `3`.
|
|
158
|
+
* @default 1
|
|
159
|
+
*/
|
|
160
|
+
maxSuggestions?: number;
|
|
161
|
+
/**
|
|
162
|
+
* An optional class name to apply to the suggestions.
|
|
163
|
+
*/
|
|
164
|
+
className?: string;
|
|
165
|
+
}
|
|
166
|
+
//#endregion
|
|
167
|
+
//#region src/types/crew.d.ts
|
|
168
|
+
/**
|
|
169
|
+
* Status of a response or action that requires user input
|
|
170
|
+
*/
|
|
171
|
+
type CrewsResponseStatus = "inProgress" | "complete" | "executing";
|
|
172
|
+
/**
|
|
173
|
+
* Response data structure for the ResponseRenderer
|
|
174
|
+
*/
|
|
175
|
+
interface CrewsResponse {
|
|
176
|
+
/**
|
|
177
|
+
* Unique identifier for the response
|
|
178
|
+
*/
|
|
179
|
+
id: string;
|
|
180
|
+
/**
|
|
181
|
+
* The content of the response to display
|
|
182
|
+
*/
|
|
183
|
+
content: string;
|
|
184
|
+
/**
|
|
185
|
+
* Optional metadata for the response
|
|
186
|
+
*/
|
|
187
|
+
metadata?: Record<string, any>;
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Base state item interface for agent state items
|
|
191
|
+
*/
|
|
192
|
+
interface CrewsStateItem {
|
|
193
|
+
/**
|
|
194
|
+
* Unique identifier for the item
|
|
195
|
+
*/
|
|
196
|
+
id: string;
|
|
197
|
+
/**
|
|
198
|
+
* Timestamp when the item was created
|
|
199
|
+
*/
|
|
200
|
+
timestamp: string;
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Tool execution state item
|
|
204
|
+
*/
|
|
205
|
+
interface CrewsToolStateItem extends CrewsStateItem {
|
|
206
|
+
/**
|
|
207
|
+
* Name of the tool that was executed
|
|
208
|
+
*/
|
|
209
|
+
tool: string;
|
|
210
|
+
/**
|
|
211
|
+
* Optional thought process for the tool execution
|
|
212
|
+
*/
|
|
213
|
+
thought?: string;
|
|
214
|
+
/**
|
|
215
|
+
* Result of the tool execution
|
|
216
|
+
*/
|
|
217
|
+
result?: any;
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Task state item
|
|
221
|
+
*/
|
|
222
|
+
interface CrewsTaskStateItem extends CrewsStateItem {
|
|
223
|
+
/**
|
|
224
|
+
* Name of the task
|
|
225
|
+
*/
|
|
226
|
+
name: string;
|
|
227
|
+
/**
|
|
228
|
+
* Description of the task
|
|
229
|
+
*/
|
|
230
|
+
description?: string;
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* AgentState containing information about steps and tasks
|
|
234
|
+
*/
|
|
235
|
+
interface CrewsAgentState {
|
|
236
|
+
/**
|
|
237
|
+
* Array of tool execution steps
|
|
238
|
+
*/
|
|
239
|
+
steps?: CrewsToolStateItem[];
|
|
240
|
+
/**
|
|
241
|
+
* Array of tasks
|
|
242
|
+
*/
|
|
243
|
+
tasks?: CrewsTaskStateItem[];
|
|
244
|
+
}
|
|
245
|
+
//#endregion
|
|
246
|
+
//#region src/types/interrupt-action.d.ts
|
|
247
|
+
interface LangGraphInterruptRenderHandlerProps<TEventValue = any> {
|
|
248
|
+
event: LangGraphInterruptEvent<TEventValue>;
|
|
249
|
+
resolve: (resolution: string) => void;
|
|
250
|
+
}
|
|
251
|
+
interface LangGraphInterruptRenderProps<TEventValue = any> {
|
|
252
|
+
result: unknown;
|
|
253
|
+
event: LangGraphInterruptEvent<TEventValue>;
|
|
254
|
+
resolve: (resolution: string) => void;
|
|
255
|
+
}
|
|
256
|
+
interface LangGraphInterruptRender<TEventValue = any> {
|
|
257
|
+
id: string;
|
|
258
|
+
/**
|
|
259
|
+
* The handler function to handle the event.
|
|
260
|
+
*/
|
|
261
|
+
handler?: (props: LangGraphInterruptRenderHandlerProps<TEventValue>) => any | Promise<any>;
|
|
262
|
+
/**
|
|
263
|
+
* The render function to handle the event.
|
|
264
|
+
*/
|
|
265
|
+
render?: (props: LangGraphInterruptRenderProps<TEventValue>) => string | React.ReactElement;
|
|
266
|
+
/**
|
|
267
|
+
* Method that returns a boolean, indicating if the interrupt action should run
|
|
268
|
+
* Useful when using multiple interrupts
|
|
269
|
+
*/
|
|
270
|
+
enabled?: (args: {
|
|
271
|
+
eventValue: TEventValue;
|
|
272
|
+
agentMetadata: AgentSession;
|
|
273
|
+
}) => boolean;
|
|
274
|
+
/**
|
|
275
|
+
* Optional agent ID to scope this interrupt to a specific agent.
|
|
276
|
+
* Defaults to the agent configured in the CopilotKit chat configuration.
|
|
277
|
+
*/
|
|
278
|
+
agentId?: string;
|
|
279
|
+
}
|
|
280
|
+
type LangGraphInterruptAction = LangGraphInterruptRender & {
|
|
281
|
+
event?: LangGraphInterruptEvent;
|
|
282
|
+
};
|
|
283
|
+
type LangGraphInterruptActionSetterArgs = Partial<LangGraphInterruptRender> | null;
|
|
284
|
+
type LangGraphInterruptActionSetter = (action: LangGraphInterruptActionSetterArgs) => void;
|
|
285
|
+
interface QueuedInterruptEvent {
|
|
286
|
+
eventId: string;
|
|
287
|
+
threadId: string;
|
|
288
|
+
event: LangGraphInterruptEvent;
|
|
289
|
+
}
|
|
290
|
+
//#endregion
|
|
291
|
+
//#region src/types/coagent-action.d.ts
|
|
292
|
+
type CoAgentStateRenderProps<T> = {
|
|
293
|
+
state: T;
|
|
294
|
+
nodeName: string;
|
|
295
|
+
status: "inProgress" | "complete";
|
|
296
|
+
};
|
|
297
|
+
type CoAgentStateRenderHandlerArguments<T> = {
|
|
298
|
+
nodeName: string;
|
|
299
|
+
state: T;
|
|
300
|
+
};
|
|
301
|
+
interface CoAgentStateRender<T = any> {
|
|
302
|
+
/**
|
|
303
|
+
* The name of the coagent.
|
|
304
|
+
*/
|
|
305
|
+
name: string;
|
|
306
|
+
/**
|
|
307
|
+
* The node name of the coagent.
|
|
308
|
+
*/
|
|
309
|
+
nodeName?: string;
|
|
310
|
+
/**
|
|
311
|
+
* The handler function to handle the state of the agent.
|
|
312
|
+
*/
|
|
313
|
+
handler?: (props: CoAgentStateRenderHandlerArguments<T>) => void | Promise<void>;
|
|
314
|
+
/**
|
|
315
|
+
* The render function to handle the state of the agent.
|
|
316
|
+
*/
|
|
317
|
+
render?: ((props: CoAgentStateRenderProps<T>) => string | React.ReactElement | undefined | null) | string;
|
|
318
|
+
}
|
|
319
|
+
//#endregion
|
|
320
|
+
//#region src/types/coagent-state.d.ts
|
|
321
|
+
interface CoagentState {
|
|
322
|
+
name: string;
|
|
323
|
+
state: any;
|
|
324
|
+
running: boolean;
|
|
325
|
+
active: boolean;
|
|
326
|
+
threadId?: string;
|
|
327
|
+
config?: {
|
|
328
|
+
configurable?: Record<string, any>;
|
|
329
|
+
[key: string]: any;
|
|
330
|
+
};
|
|
331
|
+
nodeName?: string;
|
|
332
|
+
runId?: string;
|
|
333
|
+
}
|
|
334
|
+
//#endregion
|
|
335
|
+
//#region src/context/copilot-context.d.ts
|
|
336
|
+
/**
|
|
337
|
+
* Interface for the configuration of the Copilot API.
|
|
338
|
+
*/
|
|
339
|
+
interface CopilotApiConfig {
|
|
340
|
+
/**
|
|
341
|
+
* The public API key for Copilot Cloud.
|
|
342
|
+
*/
|
|
343
|
+
publicApiKey?: string;
|
|
344
|
+
/**
|
|
345
|
+
* The configuration for Copilot Cloud.
|
|
346
|
+
*/
|
|
347
|
+
cloud?: CopilotCloudConfig;
|
|
348
|
+
/**
|
|
349
|
+
* The endpoint for the chat API.
|
|
350
|
+
*/
|
|
351
|
+
chatApiEndpoint: string;
|
|
352
|
+
/**
|
|
353
|
+
* The endpoint for the Copilot transcribe audio service.
|
|
354
|
+
*/
|
|
355
|
+
transcribeAudioUrl?: string;
|
|
356
|
+
/**
|
|
357
|
+
* The endpoint for the Copilot text to speech service.
|
|
358
|
+
*/
|
|
359
|
+
textToSpeechUrl?: string;
|
|
360
|
+
/**
|
|
361
|
+
* additional headers to be sent with the request
|
|
362
|
+
* @default {}
|
|
363
|
+
* @example
|
|
364
|
+
* ```
|
|
365
|
+
* {
|
|
366
|
+
* 'Authorization': 'Bearer your_token_here'
|
|
367
|
+
* }
|
|
368
|
+
* ```
|
|
369
|
+
*/
|
|
370
|
+
headers: Record<string, string>;
|
|
371
|
+
/**
|
|
372
|
+
* Custom properties to be sent with the request
|
|
373
|
+
* @default {}
|
|
374
|
+
* @example
|
|
375
|
+
* ```
|
|
376
|
+
* {
|
|
377
|
+
* 'user_id': 'user_id'
|
|
378
|
+
* }
|
|
379
|
+
* ```
|
|
380
|
+
*/
|
|
381
|
+
properties?: Record<string, any>;
|
|
382
|
+
/**
|
|
383
|
+
* Indicates whether the user agent should send or receive cookies from the other domain
|
|
384
|
+
* in the case of cross-origin requests.
|
|
385
|
+
*/
|
|
386
|
+
credentials?: RequestCredentials;
|
|
387
|
+
/**
|
|
388
|
+
* Optional configuration for connecting to Model Context Protocol (MCP) servers.
|
|
389
|
+
* This is typically derived from the CopilotKitProps and used internally.
|
|
390
|
+
* @experimental
|
|
391
|
+
*/
|
|
392
|
+
mcpServers?: Array<{
|
|
393
|
+
endpoint: string;
|
|
394
|
+
apiKey?: string;
|
|
395
|
+
}>;
|
|
396
|
+
}
|
|
397
|
+
type InChatRenderFunction<TProps = ActionRenderProps<any> | CatchAllActionRenderProps<any>> = (props: TProps) => string | React$1.JSX.Element;
|
|
398
|
+
type CoagentInChatRenderFunction = (props: CoAgentStateRenderProps<any>) => string | React$1.JSX.Element | undefined | null;
|
|
399
|
+
interface ChatComponentsCache {
|
|
400
|
+
actions: Record<string, InChatRenderFunction | string>;
|
|
401
|
+
coAgentStateRenders: Record<string, CoagentInChatRenderFunction | string>;
|
|
402
|
+
}
|
|
403
|
+
interface AgentSession {
|
|
404
|
+
agentName: string;
|
|
405
|
+
threadId?: string;
|
|
406
|
+
nodeName?: string;
|
|
407
|
+
}
|
|
408
|
+
interface AuthState {
|
|
409
|
+
status: "authenticated" | "unauthenticated";
|
|
410
|
+
authHeaders: Record<string, string>;
|
|
411
|
+
userId?: string;
|
|
412
|
+
metadata?: Record<string, any>;
|
|
413
|
+
}
|
|
414
|
+
type ActionName = string;
|
|
415
|
+
interface CopilotContextParams {
|
|
416
|
+
actions: Record<string, FrontendAction<any>>;
|
|
417
|
+
setAction: (id: string, action: FrontendAction<any>) => void;
|
|
418
|
+
removeAction: (id: string) => void;
|
|
419
|
+
setRegisteredActions: (actionConfig: any) => string;
|
|
420
|
+
removeRegisteredAction: (actionKey: string) => void;
|
|
421
|
+
chatComponentsCache: React$1.RefObject<ChatComponentsCache>;
|
|
422
|
+
getFunctionCallHandler: (customEntryPoints?: Record<string, FrontendAction<any>>) => FunctionCallHandler;
|
|
423
|
+
addContext: (context: string, parentId?: string, categories?: string[]) => TreeNodeId;
|
|
424
|
+
removeContext: (id: TreeNodeId) => void;
|
|
425
|
+
getAllContext: () => Tree;
|
|
426
|
+
getContextString: (documents: DocumentPointer[], categories: string[]) => string;
|
|
427
|
+
addDocumentContext: (documentPointer: DocumentPointer, categories?: string[]) => TreeNodeId;
|
|
428
|
+
removeDocumentContext: (documentId: string) => void;
|
|
429
|
+
getDocumentsContext: (categories: string[]) => DocumentPointer[];
|
|
430
|
+
isLoading: boolean;
|
|
431
|
+
setIsLoading: React$1.Dispatch<React$1.SetStateAction<boolean>>;
|
|
432
|
+
chatSuggestionConfiguration: {
|
|
433
|
+
[key: string]: CopilotChatSuggestionConfiguration;
|
|
434
|
+
};
|
|
435
|
+
addChatSuggestionConfiguration: (id: string, suggestion: CopilotChatSuggestionConfiguration) => void;
|
|
436
|
+
removeChatSuggestionConfiguration: (id: string) => void;
|
|
437
|
+
chatInstructions: string;
|
|
438
|
+
setChatInstructions: React$1.Dispatch<React$1.SetStateAction<string>>;
|
|
439
|
+
additionalInstructions?: string[];
|
|
440
|
+
setAdditionalInstructions: React$1.Dispatch<React$1.SetStateAction<string[]>>;
|
|
441
|
+
copilotApiConfig: CopilotApiConfig;
|
|
442
|
+
showDevConsole: boolean;
|
|
443
|
+
coagentStates: Record<string, CoagentState>;
|
|
444
|
+
setCoagentStates: React$1.Dispatch<React$1.SetStateAction<Record<string, CoagentState>>>;
|
|
445
|
+
coagentStatesRef: React$1.RefObject<Record<string, CoagentState>>;
|
|
446
|
+
setCoagentStatesWithRef: (value: Record<string, CoagentState> | ((prev: Record<string, CoagentState>) => Record<string, CoagentState>)) => void;
|
|
447
|
+
agentSession: AgentSession | null;
|
|
448
|
+
setAgentSession: React$1.Dispatch<React$1.SetStateAction<AgentSession | null>>;
|
|
449
|
+
agentLock: string | null;
|
|
450
|
+
threadId: string;
|
|
451
|
+
setThreadId: React$1.Dispatch<React$1.SetStateAction<string>>;
|
|
452
|
+
runId: string | null;
|
|
453
|
+
setRunId: React$1.Dispatch<React$1.SetStateAction<string | null>>;
|
|
454
|
+
chatAbortControllerRef: React$1.MutableRefObject<AbortController | null>;
|
|
455
|
+
/**
|
|
456
|
+
* The forwarded parameters to use for the task.
|
|
457
|
+
*/
|
|
458
|
+
forwardedParameters?: Partial<Pick<ForwardedParametersInput, "temperature">>;
|
|
459
|
+
availableAgents: Agent[];
|
|
460
|
+
/**
|
|
461
|
+
* The auth states for the CopilotKit.
|
|
462
|
+
*/
|
|
463
|
+
authStates_c?: Record<ActionName, AuthState>;
|
|
464
|
+
setAuthStates_c?: React$1.Dispatch<React$1.SetStateAction<Record<ActionName, AuthState>>>;
|
|
465
|
+
/**
|
|
466
|
+
* The auth config for the CopilotKit.
|
|
467
|
+
*/
|
|
468
|
+
authConfig_c?: {
|
|
469
|
+
SignInComponent: React$1.ComponentType<{
|
|
470
|
+
onSignInComplete: (authState: AuthState) => void;
|
|
471
|
+
}>;
|
|
472
|
+
};
|
|
473
|
+
extensions: ExtensionsInput;
|
|
474
|
+
setExtensions: React$1.Dispatch<React$1.SetStateAction<ExtensionsInput>>;
|
|
475
|
+
interruptActions: Record<string, LangGraphInterruptRender>;
|
|
476
|
+
setInterruptAction: LangGraphInterruptActionSetter;
|
|
477
|
+
removeInterruptAction: (actionId: string) => void;
|
|
478
|
+
interruptEventQueue: Record<string, QueuedInterruptEvent[]>;
|
|
479
|
+
addInterruptEvent: (queuedEvent: QueuedInterruptEvent) => void;
|
|
480
|
+
resolveInterruptEvent: (threadId: string, eventId: string, response: string) => void;
|
|
481
|
+
/**
|
|
482
|
+
* Optional trace handler for comprehensive debugging and observability.
|
|
483
|
+
*/
|
|
484
|
+
onError: CopilotErrorHandler;
|
|
485
|
+
bannerError: CopilotKitError | null;
|
|
486
|
+
setBannerError: React$1.Dispatch<React$1.SetStateAction<CopilotKitError | null>>;
|
|
487
|
+
internalErrorHandlers: Record<string, CopilotErrorHandler>;
|
|
488
|
+
setInternalErrorHandler: (handler: Record<string, CopilotErrorHandler>) => void;
|
|
489
|
+
removeInternalErrorHandler: (id: string) => void;
|
|
490
|
+
}
|
|
491
|
+
declare const CopilotContext: React$1.Context<CopilotContextParams>;
|
|
492
|
+
declare function useCopilotContext(): CopilotContextParams;
|
|
493
|
+
//#endregion
|
|
494
|
+
//#region src/components/copilot-provider/copilotkit-props.d.ts
|
|
495
|
+
/**
|
|
496
|
+
* Props for CopilotKit.
|
|
497
|
+
*/
|
|
498
|
+
/**
|
|
499
|
+
* We shouldn't need this `Omit` here, but using it because `CopilotKitProps`
|
|
500
|
+
* and `CopilotKitProviderProps` have non-identical `children` types
|
|
501
|
+
*
|
|
502
|
+
* TODO: Remove this `Omit` once this is resolved.
|
|
503
|
+
*/
|
|
504
|
+
interface CopilotKitProps extends Omit<CopilotKitProviderProps, "children"> {
|
|
505
|
+
/**
|
|
506
|
+
* Your Copilot Cloud API key.
|
|
507
|
+
*
|
|
508
|
+
* Don't have it yet? Go to https://cloud.copilotkit.ai and get one for free.
|
|
509
|
+
*/
|
|
510
|
+
publicApiKey?: string;
|
|
511
|
+
/**
|
|
512
|
+
* Your public license key for accessing premium CopilotKit features.
|
|
513
|
+
*
|
|
514
|
+
* Don't have it yet? Go to https://cloud.copilotkit.ai and get one for free.
|
|
515
|
+
*/
|
|
516
|
+
publicLicenseKey?: string;
|
|
517
|
+
/**
|
|
518
|
+
* Restrict input to a specific topic.
|
|
519
|
+
* @deprecated Use `guardrails_c` instead to control input restrictions
|
|
520
|
+
*/
|
|
521
|
+
cloudRestrictToTopic?: {
|
|
522
|
+
validTopics?: string[];
|
|
523
|
+
invalidTopics?: string[];
|
|
524
|
+
};
|
|
525
|
+
/**
|
|
526
|
+
* Restrict input to specific topics using guardrails.
|
|
527
|
+
* @remarks
|
|
528
|
+
*
|
|
529
|
+
* This feature is only available when using CopilotKit's hosted cloud service. To use this feature, sign up at https://cloud.copilotkit.ai to get your publicApiKey. The feature allows restricting chat conversations to specific topics.
|
|
530
|
+
*/
|
|
531
|
+
guardrails_c?: {
|
|
532
|
+
validTopics?: string[];
|
|
533
|
+
invalidTopics?: string[];
|
|
534
|
+
};
|
|
535
|
+
/**
|
|
536
|
+
* The endpoint for the Copilot Runtime instance. [Click here for more information](/concepts/copilot-runtime).
|
|
537
|
+
*/
|
|
538
|
+
runtimeUrl?: string;
|
|
539
|
+
/**
|
|
540
|
+
* The endpoint for the Copilot transcribe audio service.
|
|
541
|
+
*/
|
|
542
|
+
transcribeAudioUrl?: string;
|
|
543
|
+
/**
|
|
544
|
+
* The endpoint for the Copilot text to speech service.
|
|
545
|
+
*/
|
|
546
|
+
textToSpeechUrl?: string;
|
|
547
|
+
/**
|
|
548
|
+
* Additional headers to be sent with the request.
|
|
549
|
+
*
|
|
550
|
+
* For example:
|
|
551
|
+
* ```json
|
|
552
|
+
* {
|
|
553
|
+
* "Authorization": "Bearer X"
|
|
554
|
+
* }
|
|
555
|
+
* ```
|
|
556
|
+
*/
|
|
557
|
+
headers?: Record<string, string>;
|
|
558
|
+
/**
|
|
559
|
+
* The children to be rendered within the CopilotKit.
|
|
560
|
+
*/
|
|
561
|
+
children: ReactNode;
|
|
562
|
+
/**
|
|
563
|
+
* Custom properties to be sent with the request.
|
|
564
|
+
* Can include threadMetadata for thread creation and authorization for LangGraph Platform authentication.
|
|
565
|
+
* For example:
|
|
566
|
+
* ```js
|
|
567
|
+
* {
|
|
568
|
+
* 'user_id': 'users_id',
|
|
569
|
+
* 'authorization': 'your-auth-token', // For LangGraph Platform authentication
|
|
570
|
+
* threadMetadata: {
|
|
571
|
+
* 'account_id': '123',
|
|
572
|
+
* 'user_type': 'premium'
|
|
573
|
+
* }
|
|
574
|
+
* }
|
|
575
|
+
* ```
|
|
576
|
+
*
|
|
577
|
+
* **Note**: The `authorization` property is automatically forwarded to LangGraph agents. See the [LangGraph Agent Authentication Guide](/coagents/shared/guides/langgraph-platform-authentication) for details.
|
|
578
|
+
*/
|
|
579
|
+
properties?: Record<string, any>;
|
|
580
|
+
/**
|
|
581
|
+
* Indicates whether the user agent should send or receive cookies from the other domain
|
|
582
|
+
* in the case of cross-origin requests.
|
|
583
|
+
*
|
|
584
|
+
* To enable HTTP-only cookie authentication, set `credentials="include"` and configure
|
|
585
|
+
* CORS on your runtime endpoint:
|
|
586
|
+
*
|
|
587
|
+
* ```tsx
|
|
588
|
+
* // Frontend (https://myapp.com)
|
|
589
|
+
* <CopilotKit runtimeUrl="https://api.myapp.com/copilotkit" credentials="include">
|
|
590
|
+
* {children}
|
|
591
|
+
* </CopilotKit>
|
|
592
|
+
*
|
|
593
|
+
* // Backend (https://api.myapp.com)
|
|
594
|
+
* copilotRuntimeNextJSAppRouterEndpoint({
|
|
595
|
+
* runtime,
|
|
596
|
+
* endpoint: "/copilotkit",
|
|
597
|
+
* cors: {
|
|
598
|
+
* origin: "https://myapp.com",
|
|
599
|
+
* credentials: true,
|
|
600
|
+
* },
|
|
601
|
+
* });
|
|
602
|
+
* ```
|
|
603
|
+
*/
|
|
604
|
+
credentials?: RequestCredentials;
|
|
605
|
+
/**
|
|
606
|
+
* Whether to show the dev console.
|
|
607
|
+
*
|
|
608
|
+
* Set to `true` to show error banners and toasts, `false` to hide all error UI.
|
|
609
|
+
* Defaults to `false` for production safety.
|
|
610
|
+
*/
|
|
611
|
+
showDevConsole?: boolean;
|
|
612
|
+
/**
|
|
613
|
+
* The name of the agent to use.
|
|
614
|
+
*/
|
|
615
|
+
agent?: string;
|
|
616
|
+
/**
|
|
617
|
+
* The forwarded parameters to use for the task.
|
|
618
|
+
*/
|
|
619
|
+
forwardedParameters?: Pick<ForwardedParametersInput, "temperature">;
|
|
620
|
+
/**
|
|
621
|
+
* The auth config to use for the CopilotKit.
|
|
622
|
+
* @remarks
|
|
623
|
+
*
|
|
624
|
+
* This feature is only available when using CopilotKit's hosted cloud service. To use this feature, sign up at https://cloud.copilotkit.ai to get your publicApiKey. The feature allows restricting chat conversations to specific topics.
|
|
625
|
+
*/
|
|
626
|
+
authConfig_c?: {
|
|
627
|
+
SignInComponent: React.ComponentType<{
|
|
628
|
+
onSignInComplete: (authState: AuthState) => void;
|
|
629
|
+
}>;
|
|
630
|
+
};
|
|
631
|
+
/**
|
|
632
|
+
* The thread id to use for the CopilotKit.
|
|
633
|
+
*/
|
|
634
|
+
threadId?: string;
|
|
635
|
+
/**
|
|
636
|
+
* Optional error handler for comprehensive debugging and observability.
|
|
637
|
+
*
|
|
638
|
+
* **Requires publicApiKey**: Error handling only works when publicApiKey is provided.
|
|
639
|
+
* This is a premium Copilot Cloud feature.
|
|
640
|
+
*
|
|
641
|
+
* @param errorEvent - Structured error event with rich debugging context
|
|
642
|
+
*
|
|
643
|
+
* @example
|
|
644
|
+
* ```typescript
|
|
645
|
+
* <CopilotKit
|
|
646
|
+
* publicApiKey="ck_pub_your_key"
|
|
647
|
+
* onError={(errorEvent) => {
|
|
648
|
+
* debugDashboard.capture(errorEvent);
|
|
649
|
+
* }}
|
|
650
|
+
* >
|
|
651
|
+
* ```
|
|
652
|
+
*/
|
|
653
|
+
onError?: CopilotErrorHandler;
|
|
654
|
+
/**
|
|
655
|
+
* Enable or disable the CopilotKit Inspector, letting you inspect AG-UI events,
|
|
656
|
+
* view agent messages, check agent state, and visualize agent context. Defaults
|
|
657
|
+
* to enabled.
|
|
658
|
+
*/
|
|
659
|
+
enableInspector?: boolean;
|
|
660
|
+
}
|
|
661
|
+
//#endregion
|
|
662
|
+
//#region src/components/copilot-provider/copilotkit.d.ts
|
|
663
|
+
declare function CopilotKit({
|
|
664
|
+
children,
|
|
665
|
+
...props
|
|
666
|
+
}: CopilotKitProps): react_jsx_runtime0.JSX.Element;
|
|
667
|
+
declare const defaultCopilotContextCategories: string[];
|
|
668
|
+
//#endregion
|
|
669
|
+
export { ActionRenderPropsNoArgsWait as A, CopilotChatSuggestionConfiguration as C, TreeNode as D, Tree as E, FrontendActionAvailability as F, RenderFunctionStatus as I, CatchAllActionRenderProps as M, CatchAllFrontendAction as N, ActionRenderProps as O, FrontendAction as P, CrewsToolStateItem as S, DocumentPointer as T, CrewsAgentState as _, CopilotApiConfig as a, CrewsStateItem as b, useCopilotContext as c, LangGraphInterruptActionSetter as d, LangGraphInterruptActionSetterArgs as f, QueuedInterruptEvent as g, LangGraphInterruptRenderProps as h, CoagentInChatRenderFunction as i, ActionRenderPropsWait as j, ActionRenderPropsNoArgs as k, CoAgentStateRender as l, LangGraphInterruptRenderHandlerProps as m, defaultCopilotContextCategories as n, CopilotContext as o, LangGraphInterruptRender as p, CopilotKitProps as r, CopilotContextParams as s, CopilotKit as t, LangGraphInterruptAction as u, CrewsResponse as v, SystemMessageFunction as w, CrewsTaskStateItem as x, CrewsResponseStatus as y };
|
|
670
|
+
//# sourceMappingURL=copilotkit-BRPQ2sqS.d.cts.map
|