@copilotkit/react-core 1.50.0-beta.9 → 1.50.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.
Files changed (67) hide show
  1. package/CHANGELOG.md +189 -0
  2. package/dist/{chunk-YJGPIN3R.mjs → chunk-5J7RRLRO.mjs} +2 -2
  3. package/dist/{chunk-HE22TZMF.mjs → chunk-7HI6VLJJ.mjs} +4 -4
  4. package/dist/{chunk-4RRMC7L2.mjs → chunk-BTZ3TJVX.mjs} +4 -4
  5. package/dist/{chunk-B5ELMVT7.mjs → chunk-FESRCHUE.mjs} +2 -2
  6. package/dist/{chunk-YTQHRJUA.mjs → chunk-IUNU4CUG.mjs} +4 -4
  7. package/dist/{chunk-FYMZKPOL.mjs → chunk-JZN7YOPM.mjs} +29 -21
  8. package/dist/chunk-JZN7YOPM.mjs.map +1 -0
  9. package/dist/{chunk-3775VM7Y.mjs → chunk-LDEWO5XH.mjs} +5 -411
  10. package/dist/chunk-LDEWO5XH.mjs.map +1 -0
  11. package/dist/{chunk-LHERIF3L.mjs → chunk-SNON4QA6.mjs} +4 -4
  12. package/dist/{chunk-7SHWECGN.mjs → chunk-ZE4JVTEP.mjs} +2 -2
  13. package/dist/components/copilot-provider/copilot-messages.mjs +2 -2
  14. package/dist/components/copilot-provider/copilotkit-props.d.ts +6 -0
  15. package/dist/components/copilot-provider/copilotkit-props.js.map +1 -1
  16. package/dist/components/copilot-provider/copilotkit.js +127 -1150
  17. package/dist/components/copilot-provider/copilotkit.js.map +1 -1
  18. package/dist/components/copilot-provider/copilotkit.mjs +10 -13
  19. package/dist/components/copilot-provider/index.js +127 -1150
  20. package/dist/components/copilot-provider/index.js.map +1 -1
  21. package/dist/components/copilot-provider/index.mjs +10 -13
  22. package/dist/components/dev-console/console-trigger.mjs +225 -5
  23. package/dist/components/dev-console/console-trigger.mjs.map +1 -1
  24. package/dist/components/error-boundary/error-boundary.mjs +2 -2
  25. package/dist/components/index.js +127 -1150
  26. package/dist/components/index.js.map +1 -1
  27. package/dist/components/index.mjs +10 -13
  28. package/dist/context/index.mjs +5 -5
  29. package/dist/hooks/index.js +3 -405
  30. package/dist/hooks/index.js.map +1 -1
  31. package/dist/hooks/index.mjs +35 -35
  32. package/dist/hooks/use-coagent-state-render-bridge.mjs +1 -1
  33. package/dist/hooks/use-coagent-state-render.mjs +2 -2
  34. package/dist/hooks/use-copilot-chat-headless_c.js +3 -405
  35. package/dist/hooks/use-copilot-chat-headless_c.js.map +1 -1
  36. package/dist/hooks/use-copilot-chat-headless_c.mjs +6 -6
  37. package/dist/hooks/use-copilot-chat.js +3 -405
  38. package/dist/hooks/use-copilot-chat.js.map +1 -1
  39. package/dist/hooks/use-copilot-chat.mjs +6 -6
  40. package/dist/hooks/use-copilot-chat_internal.js +3 -405
  41. package/dist/hooks/use-copilot-chat_internal.js.map +1 -1
  42. package/dist/hooks/use-copilot-chat_internal.mjs +5 -5
  43. package/dist/hooks/use-langgraph-interrupt-render.mjs +1 -1
  44. package/dist/hooks/use-langgraph-interrupt.mjs +2 -2
  45. package/dist/index.js +276 -1694
  46. package/dist/index.js.map +1 -1
  47. package/dist/index.mjs +58 -61
  48. package/dist/lib/copilot-task.js.map +1 -1
  49. package/dist/lib/copilot-task.mjs +11 -14
  50. package/dist/lib/index.js.map +1 -1
  51. package/dist/lib/index.mjs +11 -14
  52. package/dist/types/index.mjs +1 -1
  53. package/dist/utils/index.mjs +3 -3
  54. package/package.json +6 -6
  55. package/src/components/copilot-provider/copilotkit-props.tsx +7 -0
  56. package/src/components/copilot-provider/copilotkit.tsx +13 -5
  57. package/dist/chunk-3775VM7Y.mjs.map +0 -1
  58. package/dist/chunk-FYMZKPOL.mjs.map +0 -1
  59. package/dist/chunk-PMWUKW3Z.mjs +0 -231
  60. package/dist/chunk-PMWUKW3Z.mjs.map +0 -1
  61. /package/dist/{chunk-YJGPIN3R.mjs.map → chunk-5J7RRLRO.mjs.map} +0 -0
  62. /package/dist/{chunk-HE22TZMF.mjs.map → chunk-7HI6VLJJ.mjs.map} +0 -0
  63. /package/dist/{chunk-4RRMC7L2.mjs.map → chunk-BTZ3TJVX.mjs.map} +0 -0
  64. /package/dist/{chunk-B5ELMVT7.mjs.map → chunk-FESRCHUE.mjs.map} +0 -0
  65. /package/dist/{chunk-YTQHRJUA.mjs.map → chunk-IUNU4CUG.mjs.map} +0 -0
  66. /package/dist/{chunk-LHERIF3L.mjs.map → chunk-SNON4QA6.mjs.map} +0 -0
  67. /package/dist/{chunk-7SHWECGN.mjs.map → chunk-ZE4JVTEP.mjs.map} +0 -0
@@ -1,9 +1,9 @@
1
- import {
2
- useLazyToolRenderer
3
- } from "./chunk-ZVF5Q6IH.mjs";
4
1
  import {
5
2
  useLangGraphInterruptRender
6
3
  } from "./chunk-VV56AVPB.mjs";
4
+ import {
5
+ useLazyToolRenderer
6
+ } from "./chunk-ZVF5Q6IH.mjs";
7
7
  import {
8
8
  useAsyncCallback
9
9
  } from "./chunk-6PUNP7CD.mjs";
@@ -29,413 +29,7 @@ import {
29
29
  useRenderCustomMessages,
30
30
  useSuggestions
31
31
  } from "@copilotkitnext/react";
32
-
33
- // ../../node_modules/.pnpm/@ag-ui+core@0.0.42/node_modules/@ag-ui/core/dist/index.mjs
34
- import { z } from "zod";
35
- import { z as z2 } from "zod";
36
- var FunctionCallSchema = z.object({
37
- name: z.string(),
38
- arguments: z.string()
39
- });
40
- var ToolCallSchema = z.object({
41
- id: z.string(),
42
- type: z.literal("function"),
43
- function: FunctionCallSchema
44
- });
45
- var BaseMessageSchema = z.object({
46
- id: z.string(),
47
- role: z.string(),
48
- content: z.string().optional(),
49
- name: z.string().optional()
50
- });
51
- var TextInputContentSchema = z.object({
52
- type: z.literal("text"),
53
- text: z.string()
54
- });
55
- var BinaryInputContentObjectSchema = z.object({
56
- type: z.literal("binary"),
57
- mimeType: z.string(),
58
- id: z.string().optional(),
59
- url: z.string().optional(),
60
- data: z.string().optional(),
61
- filename: z.string().optional()
62
- });
63
- var ensureBinaryPayload = (value, ctx) => {
64
- if (!value.id && !value.url && !value.data) {
65
- ctx.addIssue({
66
- code: z.ZodIssueCode.custom,
67
- message: "BinaryInputContent requires at least one of id, url, or data.",
68
- path: ["id"]
69
- });
70
- }
71
- };
72
- var BinaryInputContentSchema = BinaryInputContentObjectSchema.superRefine((value, ctx) => {
73
- ensureBinaryPayload(value, ctx);
74
- });
75
- var InputContentBaseSchema = z.discriminatedUnion("type", [
76
- TextInputContentSchema,
77
- BinaryInputContentObjectSchema
78
- ]);
79
- var InputContentSchema = InputContentBaseSchema.superRefine((value, ctx) => {
80
- if (value.type === "binary") {
81
- ensureBinaryPayload(value, ctx);
82
- }
83
- });
84
- var DeveloperMessageSchema = BaseMessageSchema.extend({
85
- role: z.literal("developer"),
86
- content: z.string()
87
- });
88
- var SystemMessageSchema = BaseMessageSchema.extend({
89
- role: z.literal("system"),
90
- content: z.string()
91
- });
92
- var AssistantMessageSchema = BaseMessageSchema.extend({
93
- role: z.literal("assistant"),
94
- content: z.string().optional(),
95
- toolCalls: z.array(ToolCallSchema).optional()
96
- });
97
- var UserMessageSchema = BaseMessageSchema.extend({
98
- role: z.literal("user"),
99
- content: z.union([z.string(), z.array(InputContentSchema)])
100
- });
101
- var ToolMessageSchema = z.object({
102
- id: z.string(),
103
- content: z.string(),
104
- role: z.literal("tool"),
105
- toolCallId: z.string(),
106
- error: z.string().optional()
107
- });
108
- var ActivityMessageSchema = z.object({
109
- id: z.string(),
110
- role: z.literal("activity"),
111
- activityType: z.string(),
112
- content: z.record(z.any())
113
- });
114
- var MessageSchema = z.discriminatedUnion("role", [
115
- DeveloperMessageSchema,
116
- SystemMessageSchema,
117
- AssistantMessageSchema,
118
- UserMessageSchema,
119
- ToolMessageSchema,
120
- ActivityMessageSchema
121
- ]);
122
- var RoleSchema = z.union([
123
- z.literal("developer"),
124
- z.literal("system"),
125
- z.literal("assistant"),
126
- z.literal("user"),
127
- z.literal("tool"),
128
- z.literal("activity")
129
- ]);
130
- var ContextSchema = z.object({
131
- description: z.string(),
132
- value: z.string()
133
- });
134
- var ToolSchema = z.object({
135
- name: z.string(),
136
- description: z.string(),
137
- parameters: z.any()
138
- // JSON Schema for the tool parameters
139
- });
140
- var RunAgentInputSchema = z.object({
141
- threadId: z.string(),
142
- runId: z.string(),
143
- parentRunId: z.string().optional(),
144
- state: z.any(),
145
- messages: z.array(MessageSchema),
146
- tools: z.array(ToolSchema),
147
- context: z.array(ContextSchema),
148
- forwardedProps: z.any()
149
- });
150
- var StateSchema = z.any();
151
- var AGUIError = class extends Error {
152
- constructor(message) {
153
- super(message);
154
- }
155
- };
156
- var AGUIConnectNotImplementedError = class extends AGUIError {
157
- constructor() {
158
- super("Connect not implemented. This method is not supported by the current agent.");
159
- }
160
- };
161
- var TextMessageRoleSchema = z2.union([
162
- z2.literal("developer"),
163
- z2.literal("system"),
164
- z2.literal("assistant"),
165
- z2.literal("user")
166
- ]);
167
- var EventType = /* @__PURE__ */ ((EventType2) => {
168
- EventType2["TEXT_MESSAGE_START"] = "TEXT_MESSAGE_START";
169
- EventType2["TEXT_MESSAGE_CONTENT"] = "TEXT_MESSAGE_CONTENT";
170
- EventType2["TEXT_MESSAGE_END"] = "TEXT_MESSAGE_END";
171
- EventType2["TEXT_MESSAGE_CHUNK"] = "TEXT_MESSAGE_CHUNK";
172
- EventType2["THINKING_TEXT_MESSAGE_START"] = "THINKING_TEXT_MESSAGE_START";
173
- EventType2["THINKING_TEXT_MESSAGE_CONTENT"] = "THINKING_TEXT_MESSAGE_CONTENT";
174
- EventType2["THINKING_TEXT_MESSAGE_END"] = "THINKING_TEXT_MESSAGE_END";
175
- EventType2["TOOL_CALL_START"] = "TOOL_CALL_START";
176
- EventType2["TOOL_CALL_ARGS"] = "TOOL_CALL_ARGS";
177
- EventType2["TOOL_CALL_END"] = "TOOL_CALL_END";
178
- EventType2["TOOL_CALL_CHUNK"] = "TOOL_CALL_CHUNK";
179
- EventType2["TOOL_CALL_RESULT"] = "TOOL_CALL_RESULT";
180
- EventType2["THINKING_START"] = "THINKING_START";
181
- EventType2["THINKING_END"] = "THINKING_END";
182
- EventType2["STATE_SNAPSHOT"] = "STATE_SNAPSHOT";
183
- EventType2["STATE_DELTA"] = "STATE_DELTA";
184
- EventType2["MESSAGES_SNAPSHOT"] = "MESSAGES_SNAPSHOT";
185
- EventType2["ACTIVITY_SNAPSHOT"] = "ACTIVITY_SNAPSHOT";
186
- EventType2["ACTIVITY_DELTA"] = "ACTIVITY_DELTA";
187
- EventType2["RAW"] = "RAW";
188
- EventType2["CUSTOM"] = "CUSTOM";
189
- EventType2["RUN_STARTED"] = "RUN_STARTED";
190
- EventType2["RUN_FINISHED"] = "RUN_FINISHED";
191
- EventType2["RUN_ERROR"] = "RUN_ERROR";
192
- EventType2["STEP_STARTED"] = "STEP_STARTED";
193
- EventType2["STEP_FINISHED"] = "STEP_FINISHED";
194
- return EventType2;
195
- })(EventType || {});
196
- var BaseEventSchema = z2.object({
197
- type: z2.nativeEnum(EventType),
198
- timestamp: z2.number().optional(),
199
- rawEvent: z2.any().optional()
200
- });
201
- var TextMessageStartEventSchema = BaseEventSchema.extend({
202
- type: z2.literal(
203
- "TEXT_MESSAGE_START"
204
- /* TEXT_MESSAGE_START */
205
- ),
206
- messageId: z2.string(),
207
- role: TextMessageRoleSchema.default("assistant")
208
- });
209
- var TextMessageContentEventSchema = BaseEventSchema.extend({
210
- type: z2.literal(
211
- "TEXT_MESSAGE_CONTENT"
212
- /* TEXT_MESSAGE_CONTENT */
213
- ),
214
- messageId: z2.string(),
215
- delta: z2.string().refine((s) => s.length > 0, "Delta must not be an empty string")
216
- });
217
- var TextMessageEndEventSchema = BaseEventSchema.extend({
218
- type: z2.literal(
219
- "TEXT_MESSAGE_END"
220
- /* TEXT_MESSAGE_END */
221
- ),
222
- messageId: z2.string()
223
- });
224
- var TextMessageChunkEventSchema = BaseEventSchema.extend({
225
- type: z2.literal(
226
- "TEXT_MESSAGE_CHUNK"
227
- /* TEXT_MESSAGE_CHUNK */
228
- ),
229
- messageId: z2.string().optional(),
230
- role: TextMessageRoleSchema.optional(),
231
- delta: z2.string().optional()
232
- });
233
- var ThinkingTextMessageStartEventSchema = BaseEventSchema.extend({
234
- type: z2.literal(
235
- "THINKING_TEXT_MESSAGE_START"
236
- /* THINKING_TEXT_MESSAGE_START */
237
- )
238
- });
239
- var ThinkingTextMessageContentEventSchema = TextMessageContentEventSchema.omit({
240
- messageId: true,
241
- type: true
242
- }).extend({
243
- type: z2.literal(
244
- "THINKING_TEXT_MESSAGE_CONTENT"
245
- /* THINKING_TEXT_MESSAGE_CONTENT */
246
- )
247
- });
248
- var ThinkingTextMessageEndEventSchema = BaseEventSchema.extend({
249
- type: z2.literal(
250
- "THINKING_TEXT_MESSAGE_END"
251
- /* THINKING_TEXT_MESSAGE_END */
252
- )
253
- });
254
- var ToolCallStartEventSchema = BaseEventSchema.extend({
255
- type: z2.literal(
256
- "TOOL_CALL_START"
257
- /* TOOL_CALL_START */
258
- ),
259
- toolCallId: z2.string(),
260
- toolCallName: z2.string(),
261
- parentMessageId: z2.string().optional()
262
- });
263
- var ToolCallArgsEventSchema = BaseEventSchema.extend({
264
- type: z2.literal(
265
- "TOOL_CALL_ARGS"
266
- /* TOOL_CALL_ARGS */
267
- ),
268
- toolCallId: z2.string(),
269
- delta: z2.string()
270
- });
271
- var ToolCallEndEventSchema = BaseEventSchema.extend({
272
- type: z2.literal(
273
- "TOOL_CALL_END"
274
- /* TOOL_CALL_END */
275
- ),
276
- toolCallId: z2.string()
277
- });
278
- var ToolCallResultEventSchema = BaseEventSchema.extend({
279
- messageId: z2.string(),
280
- type: z2.literal(
281
- "TOOL_CALL_RESULT"
282
- /* TOOL_CALL_RESULT */
283
- ),
284
- toolCallId: z2.string(),
285
- content: z2.string(),
286
- role: z2.literal("tool").optional()
287
- });
288
- var ToolCallChunkEventSchema = BaseEventSchema.extend({
289
- type: z2.literal(
290
- "TOOL_CALL_CHUNK"
291
- /* TOOL_CALL_CHUNK */
292
- ),
293
- toolCallId: z2.string().optional(),
294
- toolCallName: z2.string().optional(),
295
- parentMessageId: z2.string().optional(),
296
- delta: z2.string().optional()
297
- });
298
- var ThinkingStartEventSchema = BaseEventSchema.extend({
299
- type: z2.literal(
300
- "THINKING_START"
301
- /* THINKING_START */
302
- ),
303
- title: z2.string().optional()
304
- });
305
- var ThinkingEndEventSchema = BaseEventSchema.extend({
306
- type: z2.literal(
307
- "THINKING_END"
308
- /* THINKING_END */
309
- )
310
- });
311
- var StateSnapshotEventSchema = BaseEventSchema.extend({
312
- type: z2.literal(
313
- "STATE_SNAPSHOT"
314
- /* STATE_SNAPSHOT */
315
- ),
316
- snapshot: StateSchema
317
- });
318
- var StateDeltaEventSchema = BaseEventSchema.extend({
319
- type: z2.literal(
320
- "STATE_DELTA"
321
- /* STATE_DELTA */
322
- ),
323
- delta: z2.array(z2.any())
324
- // JSON Patch (RFC 6902)
325
- });
326
- var MessagesSnapshotEventSchema = BaseEventSchema.extend({
327
- type: z2.literal(
328
- "MESSAGES_SNAPSHOT"
329
- /* MESSAGES_SNAPSHOT */
330
- ),
331
- messages: z2.array(MessageSchema)
332
- });
333
- var ActivitySnapshotEventSchema = BaseEventSchema.extend({
334
- type: z2.literal(
335
- "ACTIVITY_SNAPSHOT"
336
- /* ACTIVITY_SNAPSHOT */
337
- ),
338
- messageId: z2.string(),
339
- activityType: z2.string(),
340
- content: z2.record(z2.any()),
341
- replace: z2.boolean().optional().default(true)
342
- });
343
- var ActivityDeltaEventSchema = BaseEventSchema.extend({
344
- type: z2.literal(
345
- "ACTIVITY_DELTA"
346
- /* ACTIVITY_DELTA */
347
- ),
348
- messageId: z2.string(),
349
- activityType: z2.string(),
350
- patch: z2.array(z2.any())
351
- });
352
- var RawEventSchema = BaseEventSchema.extend({
353
- type: z2.literal(
354
- "RAW"
355
- /* RAW */
356
- ),
357
- event: z2.any(),
358
- source: z2.string().optional()
359
- });
360
- var CustomEventSchema = BaseEventSchema.extend({
361
- type: z2.literal(
362
- "CUSTOM"
363
- /* CUSTOM */
364
- ),
365
- name: z2.string(),
366
- value: z2.any()
367
- });
368
- var RunStartedEventSchema = BaseEventSchema.extend({
369
- type: z2.literal(
370
- "RUN_STARTED"
371
- /* RUN_STARTED */
372
- ),
373
- threadId: z2.string(),
374
- runId: z2.string(),
375
- parentRunId: z2.string().optional(),
376
- input: RunAgentInputSchema.optional()
377
- });
378
- var RunFinishedEventSchema = BaseEventSchema.extend({
379
- type: z2.literal(
380
- "RUN_FINISHED"
381
- /* RUN_FINISHED */
382
- ),
383
- threadId: z2.string(),
384
- runId: z2.string(),
385
- result: z2.any().optional()
386
- });
387
- var RunErrorEventSchema = BaseEventSchema.extend({
388
- type: z2.literal(
389
- "RUN_ERROR"
390
- /* RUN_ERROR */
391
- ),
392
- message: z2.string(),
393
- code: z2.string().optional()
394
- });
395
- var StepStartedEventSchema = BaseEventSchema.extend({
396
- type: z2.literal(
397
- "STEP_STARTED"
398
- /* STEP_STARTED */
399
- ),
400
- stepName: z2.string()
401
- });
402
- var StepFinishedEventSchema = BaseEventSchema.extend({
403
- type: z2.literal(
404
- "STEP_FINISHED"
405
- /* STEP_FINISHED */
406
- ),
407
- stepName: z2.string()
408
- });
409
- var EventSchemas = z2.discriminatedUnion("type", [
410
- TextMessageStartEventSchema,
411
- TextMessageContentEventSchema,
412
- TextMessageEndEventSchema,
413
- TextMessageChunkEventSchema,
414
- ThinkingStartEventSchema,
415
- ThinkingEndEventSchema,
416
- ThinkingTextMessageStartEventSchema,
417
- ThinkingTextMessageContentEventSchema,
418
- ThinkingTextMessageEndEventSchema,
419
- ToolCallStartEventSchema,
420
- ToolCallArgsEventSchema,
421
- ToolCallEndEventSchema,
422
- ToolCallChunkEventSchema,
423
- ToolCallResultEventSchema,
424
- StateSnapshotEventSchema,
425
- StateDeltaEventSchema,
426
- MessagesSnapshotEventSchema,
427
- ActivitySnapshotEventSchema,
428
- ActivityDeltaEventSchema,
429
- RawEventSchema,
430
- CustomEventSchema,
431
- RunStartedEventSchema,
432
- RunFinishedEventSchema,
433
- RunErrorEventSchema,
434
- StepStartedEventSchema,
435
- StepFinishedEventSchema
436
- ]);
437
-
438
- // src/hooks/use-copilot-chat_internal.ts
32
+ import { AGUIConnectNotImplementedError } from "@ag-ui/client";
439
33
  function useCopilotChatInternal({
440
34
  suggestions
441
35
  } = {}) {
@@ -731,4 +325,4 @@ export {
731
325
  useCopilotChatInternal,
732
326
  defaultSystemMessage
733
327
  };
734
- //# sourceMappingURL=chunk-3775VM7Y.mjs.map
328
+ //# sourceMappingURL=chunk-LDEWO5XH.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/hooks/use-copilot-chat_internal.ts"],"sourcesContent":["import { useRef, useEffect, useCallback, useMemo, useState, createElement } from \"react\";\nimport { useCopilotContext } from \"../context/copilot-context\";\nimport { SystemMessageFunction } from \"../types\";\nimport { useAsyncCallback } from \"../components/error-boundary/error-utils\";\nimport { Message } from \"@copilotkit/shared\";\nimport { gqlToAGUI, Message as DeprecatedGqlMessage } from \"@copilotkit/runtime-client-gql\";\nimport { useLangGraphInterruptRender } from \"./use-langgraph-interrupt-render\";\nimport {\n useAgent,\n useCopilotChatConfiguration,\n useCopilotKit,\n useRenderCustomMessages,\n useSuggestions,\n} from \"@copilotkitnext/react\";\nimport { Suggestion } from \"@copilotkitnext/core\";\nimport { useLazyToolRenderer } from \"./use-lazy-tool-renderer\";\nimport { AbstractAgent, AGUIConnectNotImplementedError } from \"@ag-ui/client\";\nimport {\n CoAgentStateRenderBridge,\n type CoAgentStateRenderBridgeProps,\n} from \"./use-coagent-state-render-bridge\";\n\n/**\n * The type of suggestions to use in the chat.\n *\n * `auto` - Suggestions are generated automatically.\n * `manual` - Suggestions are controlled programmatically.\n * `SuggestionItem[]` - Static suggestions array.\n */\nexport type ChatSuggestions = \"auto\" | \"manual\" | Omit<Suggestion, \"isLoading\">[];\n\nexport interface AppendMessageOptions {\n /**\n * Whether to run the chat completion after appending the message. Defaults to `true`.\n */\n followUp?: boolean;\n /**\n * Whether to clear the suggestions after appending the message. Defaults to `true`.\n */\n clearSuggestions?: boolean;\n}\n\nexport interface UseCopilotChatOptions {\n /**\n * A unique identifier for the chat. If not provided, a random one will be\n * generated. When provided, the `useChat` hook with the same `id` will\n * have shared states across components.\n */\n id?: string;\n\n /**\n * HTTP headers to be sent with the API request.\n */\n headers?: Record<string, string> | Headers;\n\n /**\n * Initial messages to populate the chat with.\n */\n initialMessages?: Message[];\n\n /**\n * A function to generate the system message. Defaults to `defaultSystemMessage`.\n */\n makeSystemMessage?: SystemMessageFunction;\n\n /**\n * Disables inclusion of CopilotKit’s default system message. When true, no system message is sent (this also suppresses any custom message from <code>makeSystemMessage</code>).\n */\n disableSystemMessage?: boolean;\n /**\n * Controls the behavior of suggestions in the chat interface.\n *\n * `auto` (default) - Suggestions are generated automatically:\n * - When the chat is first opened (empty state)\n * - After each message exchange completes\n * - Uses configuration from `useCopilotChatSuggestions` hooks\n *\n * `manual` - Suggestions are controlled programmatically:\n * - Use `setSuggestions()` to set custom suggestions\n * - Use `generateSuggestions()` to trigger AI generation\n * - Access via `useCopilotChat` hook\n *\n * `SuggestionItem[]` - Static suggestions array:\n * - Always shows the same suggestions\n * - No AI generation involved\n */\n suggestions?: ChatSuggestions;\n}\n\nexport interface MCPServerConfig {\n endpoint: string;\n apiKey?: string;\n}\n\n// Old suggestion item interface, for returning from useCopilotChatInternal\ninterface SuggestionItem {\n title: string;\n message: string;\n partial?: boolean;\n className?: string;\n}\n\nexport interface UseCopilotChatReturn {\n /**\n * @deprecated use `messages` instead, this is an old non ag-ui version of the messages\n * Array of messages currently visible in the chat interface\n *\n * This is the visible messages, not the raw messages from the runtime client.\n */\n visibleMessages: DeprecatedGqlMessage[];\n\n /**\n * The messages that are currently in the chat in AG-UI format.\n */\n messages: Message[];\n\n /** @deprecated use `sendMessage` in `useCopilotChatHeadless_c` instead. This will be removed in a future major version. */\n appendMessage: (message: DeprecatedGqlMessage, options?: AppendMessageOptions) => Promise<void>;\n\n /**\n * Send a new message to the chat\n *\n * ```tsx\n * await sendMessage({\n * id: \"123\",\n * role: \"user\",\n * content: \"Hello, process this request\",\n * });\n * ```\n */\n sendMessage: (message: Message, options?: AppendMessageOptions) => Promise<void>;\n\n /**\n * Replace all messages in the chat\n *\n * ```tsx\n * setMessages([\n * { id: \"123\", role: \"user\", content: \"Hello, process this request\" },\n * { id: \"456\", role: \"assistant\", content: \"Hello, I'm the assistant\" },\n * ]);\n * ```\n *\n * **Deprecated** non-ag-ui version:\n *\n * ```tsx\n * setMessages([\n * new TextMessage({\n * content: \"Hello, process this request\",\n * role: gqlRole.User,\n * }),\n * new TextMessage({\n * content: \"Hello, I'm the assistant\",\n * role: gqlRole.Assistant,\n * ]);\n * ```\n *\n */\n setMessages: (messages: Message[] | DeprecatedGqlMessage[]) => void;\n\n /**\n * Remove a specific message by ID\n *\n * ```tsx\n * deleteMessage(\"123\");\n * ```\n */\n deleteMessage: (messageId: string) => void;\n\n /**\n * Regenerate the response for a specific message\n *\n * ```tsx\n * reloadMessages(\"123\");\n * ```\n */\n reloadMessages: (messageId: string) => Promise<void>;\n\n /**\n * Stop the current message generation\n *\n * ```tsx\n * if (isLoading) {\n * stopGeneration();\n * }\n * ```\n */\n stopGeneration: () => void;\n\n /**\n * Clear all messages and reset chat state\n *\n * ```tsx\n * reset();\n * console.log(messages); // []\n * ```\n */\n reset: () => void;\n\n /**\n * Whether the chat is currently generating a response\n *\n * ```tsx\n * if (isLoading) {\n * console.log(\"Loading...\");\n * } else {\n * console.log(\"Not loading\");\n * }\n */\n isLoading: boolean;\n\n /**\n * Whether the chat agent is available to generate responses\n *\n * ```tsx\n * if (isAvailable) {\n * console.log(\"Loading...\");\n * } else {\n * console.log(\"Not loading\");\n * }\n */\n isAvailable: boolean;\n\n /** Manually trigger chat completion (advanced usage) */\n runChatCompletion: () => Promise<Message[]>;\n\n /** MCP (Model Context Protocol) server configurations */\n mcpServers: MCPServerConfig[];\n\n /** Update MCP server configurations */\n setMcpServers: (mcpServers: MCPServerConfig[]) => void;\n\n /**\n * Current suggestions array\n * Use this to read the current suggestions or in conjunction with setSuggestions for manual control\n */\n suggestions: Suggestion[];\n\n /**\n * Manually set suggestions\n * Useful for manual mode or custom suggestion workflows\n */\n setSuggestions: (suggestions: Omit<Suggestion, \"isLoading\">[]) => void;\n\n /**\n * Trigger AI-powered suggestion generation\n * Uses configurations from useCopilotChatSuggestions hooks\n * Respects global debouncing - only one generation can run at a time\n *\n * ```tsx\n * generateSuggestions();\n * console.log(suggestions); // [suggestion1, suggestion2, suggestion3]\n * ```\n */\n generateSuggestions: () => Promise<void>;\n\n /**\n * Clear all current suggestions\n * Also resets suggestion generation state\n */\n resetSuggestions: () => void;\n\n /** Whether suggestions are currently being generated */\n isLoadingSuggestions: boolean;\n\n /** Interrupt content for human-in-the-loop workflows */\n interrupt: string | React.ReactElement | null;\n\n agent?: ReturnType<typeof useAgent>[\"agent\"];\n\n threadId?: string;\n}\n\nexport function useCopilotChatInternal({\n suggestions,\n}: UseCopilotChatOptions = {}): UseCopilotChatReturn {\n const { copilotkit } = useCopilotKit();\n const { threadId, agentSession } = useCopilotContext();\n const existingConfig = useCopilotChatConfiguration();\n const [agentAvailable, setAgentAvailable] = useState(false);\n\n // Apply priority: props > existing config > defaults\n const resolvedAgentId = existingConfig?.agentId ?? \"default\";\n const { agent } = useAgent({ agentId: resolvedAgentId });\n\n useEffect(() => {\n const connect = async (agent: AbstractAgent) => {\n setAgentAvailable(false);\n try {\n await copilotkit.connectAgent({ agent });\n setAgentAvailable(true);\n } catch (error) {\n if (error instanceof AGUIConnectNotImplementedError) {\n // connect not implemented, ignore\n } else {\n throw error;\n }\n }\n };\n if (agent && existingConfig?.threadId && agent.threadId !== existingConfig.threadId) {\n agent.threadId = existingConfig.threadId;\n connect(agent);\n }\n return () => {};\n }, [existingConfig?.threadId, agent, copilotkit, resolvedAgentId]);\n\n const interrupt = useLangGraphInterruptRender(agent);\n\n const reset = () => {\n agent?.setMessages([]);\n agent?.setState(null);\n };\n\n const deleteMessage = useCallback(\n (messageId: string) => {\n const filteredMessages = (agent?.messages ?? []).filter(\n (message) => message.id !== messageId,\n );\n agent?.setMessages(filteredMessages);\n },\n [agent?.setMessages, agent?.messages],\n );\n\n const latestDelete = useUpdatedRef(deleteMessage);\n const latestDeleteFunc = useCallback(\n (messageId: string) => {\n return latestDelete.current(messageId);\n },\n [latestDelete],\n );\n\n const currentSuggestions = useSuggestions({ agentId: resolvedAgentId });\n\n const reload = useAsyncCallback(\n async (reloadMessageId: string): Promise<void> => {\n const messages = agent?.messages ?? [];\n // TODO: get isLoading\n const isLoading = false;\n if (isLoading || messages.length === 0) {\n return;\n }\n\n const reloadMessageIndex = messages.findIndex((msg) => msg.id === reloadMessageId);\n if (reloadMessageIndex === -1) {\n console.warn(`Message with id ${reloadMessageId} not found`);\n return;\n }\n\n const reloadMessageRole = messages[reloadMessageIndex].role;\n if (reloadMessageRole !== \"assistant\") {\n console.warn(`Regenerate cannot be performed on ${reloadMessageRole} role`);\n return;\n }\n let historyCutoff: Message[] = [messages[0]];\n\n if (messages.length > 2 && reloadMessageIndex !== 0) {\n // message to regenerate from is now first.\n // Work backwards to find the first the closest user message\n const lastUserMessageBeforeRegenerate = messages\n .slice(0, reloadMessageIndex)\n .reverse()\n .find((msg) => msg.role === \"user\");\n\n if (!lastUserMessageBeforeRegenerate) {\n historyCutoff = [messages[0]];\n } else {\n const indexOfLastUserMessageBeforeRegenerate = messages.findIndex(\n (msg) => msg.id === lastUserMessageBeforeRegenerate.id,\n );\n // Include the user message, remove everything after it\n historyCutoff = messages.slice(0, indexOfLastUserMessageBeforeRegenerate + 1);\n }\n } else if (messages.length > 2 && reloadMessageIndex === 0) {\n historyCutoff = [messages[0], messages[1]];\n }\n\n agent?.setMessages(historyCutoff);\n\n if (agent) {\n copilotkit.runAgent({ agent });\n }\n return;\n },\n [agent?.setMessages, copilotkit?.runAgent],\n );\n\n const latestSendMessageFunc = useAsyncCallback(\n async (message: Message, options?: AppendMessageOptions) => {\n if (!agent) return;\n const followUp = options?.followUp ?? true;\n if (options?.clearSuggestions) {\n copilotkit.clearSuggestions(resolvedAgentId);\n }\n agent?.addMessage(message);\n if (followUp) {\n try {\n await copilotkit.runAgent({ agent });\n } catch (error) {\n console.error(\"CopilotChat: runAgent failed\", error);\n }\n }\n },\n [agent, copilotkit, resolvedAgentId],\n );\n\n const latestAppendFunc = useAsyncCallback(\n async (message: DeprecatedGqlMessage, options?: AppendMessageOptions) => {\n return latestSendMessageFunc(gqlToAGUI([message])[0], options);\n },\n [latestSendMessageFunc],\n );\n\n const latestSetMessagesFunc = useCallback(\n (messages: Message[] | DeprecatedGqlMessage[]) => {\n if (messages.every((message) => message instanceof DeprecatedGqlMessage)) {\n return agent?.setMessages?.(gqlToAGUI(messages));\n }\n return agent?.setMessages?.(messages);\n },\n [agent?.setMessages, agent],\n );\n\n const latestReload = useUpdatedRef(reload);\n const latestReloadFunc = useAsyncCallback(\n async (messageId: string) => {\n return await latestReload.current(messageId);\n },\n [latestReload],\n );\n\n const latestStopFunc = useCallback(() => {\n return agent?.abortRun?.();\n }, [agent?.abortRun]);\n\n const latestReset = useUpdatedRef(reset);\n const latestResetFunc = useCallback(() => {\n return latestReset.current();\n }, [latestReset]);\n\n const lazyToolRendered = useLazyToolRenderer();\n const renderCustomMessage = useRenderCustomMessages();\n const legacyCustomMessageRenderer = useLegacyCoagentRenderer({\n copilotkit,\n agent,\n agentId: resolvedAgentId,\n threadId: existingConfig?.threadId ?? threadId,\n });\n const allMessages = agent?.messages ?? [];\n const resolvedMessages = useMemo(() => {\n let processedMessages = allMessages.map((message) => {\n if (message.role !== \"assistant\") {\n return message;\n }\n\n const lazyRendered = lazyToolRendered(message, allMessages);\n if (lazyRendered) {\n const renderedGenUi = lazyRendered();\n if (renderedGenUi) {\n return { ...message, generativeUI: () => renderedGenUi };\n }\n }\n\n const bridgeRenderer =\n legacyCustomMessageRenderer || renderCustomMessage\n ? () => {\n const customRender = renderCustomMessage?.({\n message,\n position: \"before\",\n });\n if (customRender) {\n return customRender;\n }\n return legacyCustomMessageRenderer?.({ message, position: \"before\" });\n }\n : null;\n\n if (bridgeRenderer) {\n return { ...message, generativeUI: bridgeRenderer };\n }\n return message;\n });\n\n const hasAssistantMessages = processedMessages.some((msg) => msg.role === \"assistant\");\n\n // TODO: what is this?\n // if (legacyCustomMessageRenderer && !hasAssistantMessages) {\n // const placeholderId = `coagent-state-render-${resolvedAgentId}`;\n // const placeholderMessage: Message = {\n // id: placeholderId,\n // role: \"assistant\",\n // content: \"\",\n // name: \"coagent-state-render\",\n // };\n // processedMessages = [\n // ...processedMessages,\n // {\n // ...placeholderMessage,\n // generativeUI: () =>\n // legacyCustomMessageRenderer({\n // message: placeholderMessage,\n // position: \"before\",\n // }),\n // } as Message,\n // ];\n // }\n\n return processedMessages;\n }, [\n agent?.messages,\n lazyToolRendered,\n allMessages,\n renderCustomMessage,\n // legacyCustomMessageRenderer,\n resolvedAgentId,\n ]);\n\n const renderedSuggestions = useMemo(() => {\n if (Array.isArray(suggestions)) {\n return {\n suggestions: suggestions.map((s) => ({ ...s, isLoading: false })),\n isLoading: false,\n };\n }\n return currentSuggestions;\n }, [suggestions, currentSuggestions]);\n\n // @ts-ignore\n return {\n messages: resolvedMessages,\n sendMessage: latestSendMessageFunc,\n appendMessage: latestAppendFunc,\n setMessages: latestSetMessagesFunc,\n reloadMessages: latestReloadFunc,\n stopGeneration: latestStopFunc,\n reset: latestResetFunc,\n deleteMessage: latestDeleteFunc,\n isAvailable: agentAvailable,\n isLoading: Boolean(agent?.isRunning),\n // mcpServers,\n // setMcpServers,\n suggestions: renderedSuggestions.suggestions,\n setSuggestions: (suggestions: Omit<Suggestion, \"isLoading\">[]) =>\n copilotkit.addSuggestionsConfig({ suggestions }),\n generateSuggestions: async () => copilotkit.reloadSuggestions(resolvedAgentId),\n resetSuggestions: () => copilotkit.clearSuggestions(resolvedAgentId),\n isLoadingSuggestions: renderedSuggestions.isLoading,\n interrupt,\n agent,\n threadId,\n };\n}\n\n// store `value` in a ref and update\n// it whenever it changes.\nfunction useUpdatedRef<T>(value: T) {\n const ref = useRef(value);\n\n useEffect(() => {\n ref.current = value;\n }, [value]);\n\n return ref;\n}\n\ntype LegacyRenderParams = {\n message: Message;\n position: \"before\" | \"after\";\n};\n\ntype LegacyRenderer = ((args: LegacyRenderParams) => any) | null;\n\nfunction useLegacyCoagentRenderer({\n copilotkit,\n agent,\n agentId,\n threadId,\n}: {\n copilotkit: ReturnType<typeof useCopilotKit>[\"copilotkit\"];\n agent?: AbstractAgent;\n agentId: string;\n threadId?: string;\n}): LegacyRenderer {\n return useMemo(() => {\n if (!copilotkit || !agent) {\n return null;\n }\n\n return ({ message, position }: LegacyRenderParams) => {\n const effectiveThreadId = threadId ?? agent.threadId ?? \"default\";\n const existingRunId = copilotkit.getRunIdForMessage(agentId, effectiveThreadId, message.id);\n const runId = existingRunId || `pending:${message.id}`;\n const messageIndex = Math.max(\n agent.messages.findIndex((msg) => msg.id === message.id),\n 0,\n );\n\n const bridgeProps: CoAgentStateRenderBridgeProps = {\n message: message as any,\n position,\n runId,\n messageIndex,\n messageIndexInRun: 0,\n numberOfMessagesInRun: 1,\n agentId,\n stateSnapshot: (message as any).state,\n };\n\n return createElement(CoAgentStateRenderBridge, bridgeProps) as any;\n };\n }, [agent, agentId, copilotkit, threadId]);\n}\n\nexport function defaultSystemMessage(\n contextString: string,\n additionalInstructions?: string,\n): string {\n return (\n `\nPlease act as an efficient, competent, conscientious, and industrious professional assistant.\n\nHelp the user achieve their goals, and you do so in a way that is as efficient as possible, without unnecessary fluff, but also without sacrificing professionalism.\nAlways be polite and respectful, and prefer brevity over verbosity.\n\nThe user has provided you with the following context:\n\\`\\`\\`\n${contextString}\n\\`\\`\\`\n\nThey have also provided you with functions you can call to initiate actions on their behalf, or functions you can call to receive more information.\n\nPlease assist them as best you can.\n\nYou can ask them for clarifying questions if needed, but don't be annoying about it. If you can reasonably 'fill in the blanks' yourself, do so.\n\nIf you would like to call a function, call it without saying anything else.\nIn case of a function error:\n- If this error stems from incorrect function parameters or syntax, you may retry with corrected arguments.\n- If the error's source is unclear or seems unrelated to your input, do not attempt further retries.\n` + (additionalInstructions ? `\\n\\n${additionalInstructions}` : \"\")\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,QAAQ,WAAW,aAAa,SAAS,UAAU,qBAAqB;AAKjF,SAAS,WAAW,WAAW,4BAA4B;AAE3D;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAGP,SAAwB,sCAAsC;AAgQvD,SAAS,uBAAuB;AAAA,EACrC;AACF,IAA2B,CAAC,GAAyB;AAlRrD;AAmRE,QAAM,EAAE,WAAW,IAAI,cAAc;AACrC,QAAM,EAAE,UAAU,aAAa,IAAI,kBAAkB;AACrD,QAAM,iBAAiB,4BAA4B;AACnD,QAAM,CAAC,gBAAgB,iBAAiB,IAAI,SAAS,KAAK;AAG1D,QAAM,mBAAkB,sDAAgB,YAAhB,YAA2B;AACnD,QAAM,EAAE,MAAM,IAAI,SAAS,EAAE,SAAS,gBAAgB,CAAC;AAEvD,YAAU,MAAM;AACd,UAAM,UAAU,CAAOA,WAAyB;AAC9C,wBAAkB,KAAK;AACvB,UAAI;AACF,cAAM,WAAW,aAAa,EAAE,OAAAA,OAAM,CAAC;AACvC,0BAAkB,IAAI;AAAA,MACxB,SAAS,OAAP;AACA,YAAI,iBAAiB,gCAAgC;AAAA,QAErD,OAAO;AACL,gBAAM;AAAA,QACR;AAAA,MACF;AAAA,IACF;AACA,QAAI,UAAS,iDAAgB,aAAY,MAAM,aAAa,eAAe,UAAU;AACnF,YAAM,WAAW,eAAe;AAChC,cAAQ,KAAK;AAAA,IACf;AACA,WAAO,MAAM;AAAA,IAAC;AAAA,EAChB,GAAG,CAAC,iDAAgB,UAAU,OAAO,YAAY,eAAe,CAAC;AAEjE,QAAM,YA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PUNP7CD.mjs";
7
4
  import {
8
5
  UsageBanner,
9
6
  getErrorActions
10
7
  } from "./chunk-6ZLPNY7X.mjs";
8
+ import {
9
+ useErrorToast
10
+ } from "./chunk-6PUNP7CD.mjs";
11
11
 
12
12
  // src/components/error-boundary/error-boundary.tsx
13
13
  import React, { useEffect } from "react";
@@ -80,4 +80,4 @@ export {
80
80
  CopilotErrorBoundary,
81
81
  ErrorToast
82
82
  };
83
- //# sourceMappingURL=chunk-LHERIF3L.mjs.map
83
+ //# sourceMappingURL=chunk-SNON4QA6.mjs.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  useCopilotChatInternal
3
- } from "./chunk-3775VM7Y.mjs";
3
+ } from "./chunk-LDEWO5XH.mjs";
4
4
 
5
5
  // src/hooks/use-copilot-chat.ts
6
6
  function useCopilotChat(options = {}) {
@@ -33,4 +33,4 @@ function useCopilotChat(options = {}) {
33
33
  export {
34
34
  useCopilotChat
35
35
  };
36
- //# sourceMappingURL=chunk-7SHWECGN.mjs.map
36
+ //# sourceMappingURL=chunk-ZE4JVTEP.mjs.map
@@ -2,11 +2,11 @@ import {
2
2
  CopilotMessages,
3
3
  MessagesTapProvider,
4
4
  useMessagesTap
5
- } from "../../chunk-HE22TZMF.mjs";
5
+ } from "../../chunk-7HI6VLJJ.mjs";
6
6
  import "../../chunk-ICIK2BSB.mjs";
7
- import "../../chunk-EFL5OBKN.mjs";
8
7
  import "../../chunk-AFNWX62Q.mjs";
9
8
  import "../../chunk-DMLQZG75.mjs";
9
+ import "../../chunk-EFL5OBKN.mjs";
10
10
  import "../../chunk-SKC7AJIV.mjs";
11
11
  export {
12
12
  CopilotMessages,
@@ -149,6 +149,12 @@ interface CopilotKitProps extends Omit<CopilotKitProviderProps, "children"> {
149
149
  * ```
150
150
  */
151
151
  onError?: CopilotErrorHandler;
152
+ /**
153
+ * Enable or disable the CopilotKit Inspector, letting you inspect AG-UI events,
154
+ * view agent messages, check agent state, and visualize agent context. Defaults
155
+ * to enabled.
156
+ */
157
+ enableInspector?: boolean;
152
158
  }
153
159
 
154
160
  export { CopilotKitProps };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/copilot-provider/copilotkit-props.tsx"],"sourcesContent":["import { ForwardedParametersInput } from \"@copilotkit/runtime-client-gql\";\nimport { ReactNode } from \"react\";\nimport { AuthState } from \"../../context/copilot-context\";\nimport { CopilotErrorHandler } from \"@copilotkit/shared\";\nimport { CopilotKitProviderProps } from \"@copilotkitnext/react\";\n/**\n * Props for CopilotKit.\n */\n\n/**\n * We shouldn't need this `Omit` here, but using it because `CopilotKitProps`\n * and `CopilotKitProviderProps` have non-identical `children` types\n *\n * TODO: Remove this `Omit` once this is resolved.\n */\nexport interface CopilotKitProps extends Omit<CopilotKitProviderProps, \"children\"> {\n /**\n * Your Copilot Cloud API key.\n *\n * Don't have it yet? Go to https://cloud.copilotkit.ai and get one for free.\n */\n publicApiKey?: string;\n\n /**\n * Your public license key for accessing premium CopilotKit features.\n *\n * Don't have it yet? Go to https://cloud.copilotkit.ai and get one for free.\n */\n publicLicenseKey?: string;\n\n /**\n * Restrict input to a specific topic.\n * @deprecated Use `guardrails_c` instead to control input restrictions\n */\n cloudRestrictToTopic?: {\n validTopics?: string[];\n invalidTopics?: string[];\n };\n\n /**\n * Restrict input to specific topics using guardrails.\n * @remarks\n *\n * 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.\n */\n guardrails_c?: {\n validTopics?: string[];\n invalidTopics?: string[];\n };\n\n /**\n * The endpoint for the Copilot Runtime instance. [Click here for more information](/concepts/copilot-runtime).\n */\n runtimeUrl?: string;\n\n /**\n * The endpoint for the Copilot transcribe audio service.\n */\n transcribeAudioUrl?: string;\n\n /**\n * The endpoint for the Copilot text to speech service.\n */\n textToSpeechUrl?: string;\n\n /**\n * Additional headers to be sent with the request.\n *\n * For example:\n * ```json\n * {\n * \"Authorization\": \"Bearer X\"\n * }\n * ```\n */\n headers?: Record<string, string>;\n\n /**\n * The children to be rendered within the CopilotKit.\n */\n children: ReactNode;\n\n /**\n * Custom properties to be sent with the request.\n * Can include threadMetadata for thread creation and authorization for LangGraph Platform authentication.\n * For example:\n * ```js\n * {\n * 'user_id': 'users_id',\n * 'authorization': 'your-auth-token', // For LangGraph Platform authentication\n * threadMetadata: {\n * 'account_id': '123',\n * 'user_type': 'premium'\n * }\n * }\n * ```\n *\n * **Note**: The `authorization` property is automatically forwarded to LangGraph agents. See the [LangGraph Agent Authentication Guide](/coagents/shared/guides/langgraph-platform-authentication) for details.\n */\n properties?: Record<string, any>;\n\n /**\n * Indicates whether the user agent should send or receive cookies from the other domain\n * in the case of cross-origin requests.\n */\n credentials?: RequestCredentials;\n\n /**\n * Whether to show the dev console.\n *\n * Set to `true` to show error banners and toasts, `false` to hide all error UI.\n * Defaults to `false` for production safety.\n */\n showDevConsole?: boolean;\n\n /**\n * The name of the agent to use.\n */\n agent?: string;\n\n /**\n * The forwarded parameters to use for the task.\n */\n forwardedParameters?: Pick<ForwardedParametersInput, \"temperature\">;\n\n /**\n * The auth config to use for the CopilotKit.\n * @remarks\n *\n * 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.\n */\n authConfig_c?: {\n SignInComponent: React.ComponentType<{\n onSignInComplete: (authState: AuthState) => void;\n }>;\n };\n\n /**\n * The thread id to use for the CopilotKit.\n */\n threadId?: string;\n\n /**\n * Optional error handler for comprehensive debugging and observability.\n *\n * **Requires publicApiKey**: Error handling only works when publicApiKey is provided.\n * This is a premium Copilot Cloud feature.\n *\n * @param errorEvent - Structured error event with rich debugging context\n *\n * @example\n * ```typescript\n * <CopilotKit\n * publicApiKey=\"ck_pub_your_key\"\n * onError={(errorEvent) => {\n * debugDashboard.capture(errorEvent);\n * }}\n * >\n * ```\n */\n onError?: CopilotErrorHandler;\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
1
+ {"version":3,"sources":["../../../src/components/copilot-provider/copilotkit-props.tsx"],"sourcesContent":["import { ForwardedParametersInput } from \"@copilotkit/runtime-client-gql\";\nimport { ReactNode } from \"react\";\nimport { AuthState } from \"../../context/copilot-context\";\nimport { CopilotErrorHandler } from \"@copilotkit/shared\";\nimport { CopilotKitProviderProps } from \"@copilotkitnext/react\";\n/**\n * Props for CopilotKit.\n */\n\n/**\n * We shouldn't need this `Omit` here, but using it because `CopilotKitProps`\n * and `CopilotKitProviderProps` have non-identical `children` types\n *\n * TODO: Remove this `Omit` once this is resolved.\n */\nexport interface CopilotKitProps extends Omit<CopilotKitProviderProps, \"children\"> {\n /**\n * Your Copilot Cloud API key.\n *\n * Don't have it yet? Go to https://cloud.copilotkit.ai and get one for free.\n */\n publicApiKey?: string;\n\n /**\n * Your public license key for accessing premium CopilotKit features.\n *\n * Don't have it yet? Go to https://cloud.copilotkit.ai and get one for free.\n */\n publicLicenseKey?: string;\n\n /**\n * Restrict input to a specific topic.\n * @deprecated Use `guardrails_c` instead to control input restrictions\n */\n cloudRestrictToTopic?: {\n validTopics?: string[];\n invalidTopics?: string[];\n };\n\n /**\n * Restrict input to specific topics using guardrails.\n * @remarks\n *\n * 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.\n */\n guardrails_c?: {\n validTopics?: string[];\n invalidTopics?: string[];\n };\n\n /**\n * The endpoint for the Copilot Runtime instance. [Click here for more information](/concepts/copilot-runtime).\n */\n runtimeUrl?: string;\n\n /**\n * The endpoint for the Copilot transcribe audio service.\n */\n transcribeAudioUrl?: string;\n\n /**\n * The endpoint for the Copilot text to speech service.\n */\n textToSpeechUrl?: string;\n\n /**\n * Additional headers to be sent with the request.\n *\n * For example:\n * ```json\n * {\n * \"Authorization\": \"Bearer X\"\n * }\n * ```\n */\n headers?: Record<string, string>;\n\n /**\n * The children to be rendered within the CopilotKit.\n */\n children: ReactNode;\n\n /**\n * Custom properties to be sent with the request.\n * Can include threadMetadata for thread creation and authorization for LangGraph Platform authentication.\n * For example:\n * ```js\n * {\n * 'user_id': 'users_id',\n * 'authorization': 'your-auth-token', // For LangGraph Platform authentication\n * threadMetadata: {\n * 'account_id': '123',\n * 'user_type': 'premium'\n * }\n * }\n * ```\n *\n * **Note**: The `authorization` property is automatically forwarded to LangGraph agents. See the [LangGraph Agent Authentication Guide](/coagents/shared/guides/langgraph-platform-authentication) for details.\n */\n properties?: Record<string, any>;\n\n /**\n * Indicates whether the user agent should send or receive cookies from the other domain\n * in the case of cross-origin requests.\n */\n credentials?: RequestCredentials;\n\n /**\n * Whether to show the dev console.\n *\n * Set to `true` to show error banners and toasts, `false` to hide all error UI.\n * Defaults to `false` for production safety.\n */\n showDevConsole?: boolean;\n\n /**\n * The name of the agent to use.\n */\n agent?: string;\n\n /**\n * The forwarded parameters to use for the task.\n */\n forwardedParameters?: Pick<ForwardedParametersInput, \"temperature\">;\n\n /**\n * The auth config to use for the CopilotKit.\n * @remarks\n *\n * 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.\n */\n authConfig_c?: {\n SignInComponent: React.ComponentType<{\n onSignInComplete: (authState: AuthState) => void;\n }>;\n };\n\n /**\n * The thread id to use for the CopilotKit.\n */\n threadId?: string;\n\n /**\n * Optional error handler for comprehensive debugging and observability.\n *\n * **Requires publicApiKey**: Error handling only works when publicApiKey is provided.\n * This is a premium Copilot Cloud feature.\n *\n * @param errorEvent - Structured error event with rich debugging context\n *\n * @example\n * ```typescript\n * <CopilotKit\n * publicApiKey=\"ck_pub_your_key\"\n * onError={(errorEvent) => {\n * debugDashboard.capture(errorEvent);\n * }}\n * >\n * ```\n */\n onError?: CopilotErrorHandler;\n\n /**\n * Enable or disable the CopilotKit Inspector, letting you inspect AG-UI events,\n * view agent messages, check agent state, and visualize agent context. Defaults\n * to enabled.\n */\n enableInspector?: boolean;\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}