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