@copilotkit/react-core 1.50.0-beta.16 → 1.50.0-beta.17

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 (35) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/{chunk-CO6V4G7P.mjs → chunk-4YZA2BZC.mjs} +4 -4
  3. package/dist/{chunk-4TKK4322.mjs → chunk-5J7RRLRO.mjs} +2 -2
  4. package/dist/{chunk-HQTDDA6V.mjs → chunk-LCZZ7YGZ.mjs} +2 -2
  5. package/dist/{chunk-VSQWPEYV.mjs → chunk-LDEWO5XH.mjs} +2 -408
  6. package/dist/chunk-LDEWO5XH.mjs.map +1 -0
  7. package/dist/{chunk-66TKKRF4.mjs → chunk-ZE4JVTEP.mjs} +2 -2
  8. package/dist/components/copilot-provider/copilotkit.mjs +4 -4
  9. package/dist/components/copilot-provider/index.mjs +4 -4
  10. package/dist/components/index.mjs +4 -4
  11. package/dist/hooks/index.js +3 -405
  12. package/dist/hooks/index.js.map +1 -1
  13. package/dist/hooks/index.mjs +3 -3
  14. package/dist/hooks/use-copilot-chat-headless_c.js +3 -405
  15. package/dist/hooks/use-copilot-chat-headless_c.js.map +1 -1
  16. package/dist/hooks/use-copilot-chat-headless_c.mjs +2 -2
  17. package/dist/hooks/use-copilot-chat.js +3 -405
  18. package/dist/hooks/use-copilot-chat.js.map +1 -1
  19. package/dist/hooks/use-copilot-chat.mjs +2 -2
  20. package/dist/hooks/use-copilot-chat_internal.js +3 -405
  21. package/dist/hooks/use-copilot-chat_internal.js.map +1 -1
  22. package/dist/hooks/use-copilot-chat_internal.mjs +1 -1
  23. package/dist/index.js +2 -406
  24. package/dist/index.js.map +1 -1
  25. package/dist/index.mjs +11 -11
  26. package/dist/lib/copilot-task.mjs +5 -5
  27. package/dist/lib/index.mjs +5 -5
  28. package/dist/types/index.mjs +1 -1
  29. package/dist/utils/index.mjs +3 -3
  30. package/package.json +6 -6
  31. package/dist/chunk-VSQWPEYV.mjs.map +0 -1
  32. /package/dist/{chunk-CO6V4G7P.mjs.map → chunk-4YZA2BZC.mjs.map} +0 -0
  33. /package/dist/{chunk-4TKK4322.mjs.map → chunk-5J7RRLRO.mjs.map} +0 -0
  34. /package/dist/{chunk-HQTDDA6V.mjs.map → chunk-LCZZ7YGZ.mjs.map} +0 -0
  35. /package/dist/{chunk-66TKKRF4.mjs.map → chunk-ZE4JVTEP.mjs.map} +0 -0
package/dist/index.js CHANGED
@@ -2289,412 +2289,8 @@ function useLazyToolRenderer() {
2289
2289
  );
2290
2290
  }
2291
2291
 
2292
- // ../../node_modules/.pnpm/@ag-ui+core@0.0.42/node_modules/@ag-ui/core/dist/index.mjs
2293
- var import_zod = require("zod");
2294
- var import_zod2 = require("zod");
2295
- var FunctionCallSchema = import_zod.z.object({
2296
- name: import_zod.z.string(),
2297
- arguments: import_zod.z.string()
2298
- });
2299
- var ToolCallSchema = import_zod.z.object({
2300
- id: import_zod.z.string(),
2301
- type: import_zod.z.literal("function"),
2302
- function: FunctionCallSchema
2303
- });
2304
- var BaseMessageSchema = import_zod.z.object({
2305
- id: import_zod.z.string(),
2306
- role: import_zod.z.string(),
2307
- content: import_zod.z.string().optional(),
2308
- name: import_zod.z.string().optional()
2309
- });
2310
- var TextInputContentSchema = import_zod.z.object({
2311
- type: import_zod.z.literal("text"),
2312
- text: import_zod.z.string()
2313
- });
2314
- var BinaryInputContentObjectSchema = import_zod.z.object({
2315
- type: import_zod.z.literal("binary"),
2316
- mimeType: import_zod.z.string(),
2317
- id: import_zod.z.string().optional(),
2318
- url: import_zod.z.string().optional(),
2319
- data: import_zod.z.string().optional(),
2320
- filename: import_zod.z.string().optional()
2321
- });
2322
- var ensureBinaryPayload = (value, ctx) => {
2323
- if (!value.id && !value.url && !value.data) {
2324
- ctx.addIssue({
2325
- code: import_zod.z.ZodIssueCode.custom,
2326
- message: "BinaryInputContent requires at least one of id, url, or data.",
2327
- path: ["id"]
2328
- });
2329
- }
2330
- };
2331
- var BinaryInputContentSchema = BinaryInputContentObjectSchema.superRefine((value, ctx) => {
2332
- ensureBinaryPayload(value, ctx);
2333
- });
2334
- var InputContentBaseSchema = import_zod.z.discriminatedUnion("type", [
2335
- TextInputContentSchema,
2336
- BinaryInputContentObjectSchema
2337
- ]);
2338
- var InputContentSchema = InputContentBaseSchema.superRefine((value, ctx) => {
2339
- if (value.type === "binary") {
2340
- ensureBinaryPayload(value, ctx);
2341
- }
2342
- });
2343
- var DeveloperMessageSchema = BaseMessageSchema.extend({
2344
- role: import_zod.z.literal("developer"),
2345
- content: import_zod.z.string()
2346
- });
2347
- var SystemMessageSchema = BaseMessageSchema.extend({
2348
- role: import_zod.z.literal("system"),
2349
- content: import_zod.z.string()
2350
- });
2351
- var AssistantMessageSchema = BaseMessageSchema.extend({
2352
- role: import_zod.z.literal("assistant"),
2353
- content: import_zod.z.string().optional(),
2354
- toolCalls: import_zod.z.array(ToolCallSchema).optional()
2355
- });
2356
- var UserMessageSchema = BaseMessageSchema.extend({
2357
- role: import_zod.z.literal("user"),
2358
- content: import_zod.z.union([import_zod.z.string(), import_zod.z.array(InputContentSchema)])
2359
- });
2360
- var ToolMessageSchema = import_zod.z.object({
2361
- id: import_zod.z.string(),
2362
- content: import_zod.z.string(),
2363
- role: import_zod.z.literal("tool"),
2364
- toolCallId: import_zod.z.string(),
2365
- error: import_zod.z.string().optional()
2366
- });
2367
- var ActivityMessageSchema = import_zod.z.object({
2368
- id: import_zod.z.string(),
2369
- role: import_zod.z.literal("activity"),
2370
- activityType: import_zod.z.string(),
2371
- content: import_zod.z.record(import_zod.z.any())
2372
- });
2373
- var MessageSchema = import_zod.z.discriminatedUnion("role", [
2374
- DeveloperMessageSchema,
2375
- SystemMessageSchema,
2376
- AssistantMessageSchema,
2377
- UserMessageSchema,
2378
- ToolMessageSchema,
2379
- ActivityMessageSchema
2380
- ]);
2381
- var RoleSchema = import_zod.z.union([
2382
- import_zod.z.literal("developer"),
2383
- import_zod.z.literal("system"),
2384
- import_zod.z.literal("assistant"),
2385
- import_zod.z.literal("user"),
2386
- import_zod.z.literal("tool"),
2387
- import_zod.z.literal("activity")
2388
- ]);
2389
- var ContextSchema = import_zod.z.object({
2390
- description: import_zod.z.string(),
2391
- value: import_zod.z.string()
2392
- });
2393
- var ToolSchema = import_zod.z.object({
2394
- name: import_zod.z.string(),
2395
- description: import_zod.z.string(),
2396
- parameters: import_zod.z.any()
2397
- // JSON Schema for the tool parameters
2398
- });
2399
- var RunAgentInputSchema = import_zod.z.object({
2400
- threadId: import_zod.z.string(),
2401
- runId: import_zod.z.string(),
2402
- parentRunId: import_zod.z.string().optional(),
2403
- state: import_zod.z.any(),
2404
- messages: import_zod.z.array(MessageSchema),
2405
- tools: import_zod.z.array(ToolSchema),
2406
- context: import_zod.z.array(ContextSchema),
2407
- forwardedProps: import_zod.z.any()
2408
- });
2409
- var StateSchema = import_zod.z.any();
2410
- var AGUIError = class extends Error {
2411
- constructor(message) {
2412
- super(message);
2413
- }
2414
- };
2415
- var AGUIConnectNotImplementedError = class extends AGUIError {
2416
- constructor() {
2417
- super("Connect not implemented. This method is not supported by the current agent.");
2418
- }
2419
- };
2420
- var TextMessageRoleSchema = import_zod2.z.union([
2421
- import_zod2.z.literal("developer"),
2422
- import_zod2.z.literal("system"),
2423
- import_zod2.z.literal("assistant"),
2424
- import_zod2.z.literal("user")
2425
- ]);
2426
- var EventType = /* @__PURE__ */ ((EventType2) => {
2427
- EventType2["TEXT_MESSAGE_START"] = "TEXT_MESSAGE_START";
2428
- EventType2["TEXT_MESSAGE_CONTENT"] = "TEXT_MESSAGE_CONTENT";
2429
- EventType2["TEXT_MESSAGE_END"] = "TEXT_MESSAGE_END";
2430
- EventType2["TEXT_MESSAGE_CHUNK"] = "TEXT_MESSAGE_CHUNK";
2431
- EventType2["THINKING_TEXT_MESSAGE_START"] = "THINKING_TEXT_MESSAGE_START";
2432
- EventType2["THINKING_TEXT_MESSAGE_CONTENT"] = "THINKING_TEXT_MESSAGE_CONTENT";
2433
- EventType2["THINKING_TEXT_MESSAGE_END"] = "THINKING_TEXT_MESSAGE_END";
2434
- EventType2["TOOL_CALL_START"] = "TOOL_CALL_START";
2435
- EventType2["TOOL_CALL_ARGS"] = "TOOL_CALL_ARGS";
2436
- EventType2["TOOL_CALL_END"] = "TOOL_CALL_END";
2437
- EventType2["TOOL_CALL_CHUNK"] = "TOOL_CALL_CHUNK";
2438
- EventType2["TOOL_CALL_RESULT"] = "TOOL_CALL_RESULT";
2439
- EventType2["THINKING_START"] = "THINKING_START";
2440
- EventType2["THINKING_END"] = "THINKING_END";
2441
- EventType2["STATE_SNAPSHOT"] = "STATE_SNAPSHOT";
2442
- EventType2["STATE_DELTA"] = "STATE_DELTA";
2443
- EventType2["MESSAGES_SNAPSHOT"] = "MESSAGES_SNAPSHOT";
2444
- EventType2["ACTIVITY_SNAPSHOT"] = "ACTIVITY_SNAPSHOT";
2445
- EventType2["ACTIVITY_DELTA"] = "ACTIVITY_DELTA";
2446
- EventType2["RAW"] = "RAW";
2447
- EventType2["CUSTOM"] = "CUSTOM";
2448
- EventType2["RUN_STARTED"] = "RUN_STARTED";
2449
- EventType2["RUN_FINISHED"] = "RUN_FINISHED";
2450
- EventType2["RUN_ERROR"] = "RUN_ERROR";
2451
- EventType2["STEP_STARTED"] = "STEP_STARTED";
2452
- EventType2["STEP_FINISHED"] = "STEP_FINISHED";
2453
- return EventType2;
2454
- })(EventType || {});
2455
- var BaseEventSchema = import_zod2.z.object({
2456
- type: import_zod2.z.nativeEnum(EventType),
2457
- timestamp: import_zod2.z.number().optional(),
2458
- rawEvent: import_zod2.z.any().optional()
2459
- });
2460
- var TextMessageStartEventSchema = BaseEventSchema.extend({
2461
- type: import_zod2.z.literal(
2462
- "TEXT_MESSAGE_START"
2463
- /* TEXT_MESSAGE_START */
2464
- ),
2465
- messageId: import_zod2.z.string(),
2466
- role: TextMessageRoleSchema.default("assistant")
2467
- });
2468
- var TextMessageContentEventSchema = BaseEventSchema.extend({
2469
- type: import_zod2.z.literal(
2470
- "TEXT_MESSAGE_CONTENT"
2471
- /* TEXT_MESSAGE_CONTENT */
2472
- ),
2473
- messageId: import_zod2.z.string(),
2474
- delta: import_zod2.z.string().refine((s) => s.length > 0, "Delta must not be an empty string")
2475
- });
2476
- var TextMessageEndEventSchema = BaseEventSchema.extend({
2477
- type: import_zod2.z.literal(
2478
- "TEXT_MESSAGE_END"
2479
- /* TEXT_MESSAGE_END */
2480
- ),
2481
- messageId: import_zod2.z.string()
2482
- });
2483
- var TextMessageChunkEventSchema = BaseEventSchema.extend({
2484
- type: import_zod2.z.literal(
2485
- "TEXT_MESSAGE_CHUNK"
2486
- /* TEXT_MESSAGE_CHUNK */
2487
- ),
2488
- messageId: import_zod2.z.string().optional(),
2489
- role: TextMessageRoleSchema.optional(),
2490
- delta: import_zod2.z.string().optional()
2491
- });
2492
- var ThinkingTextMessageStartEventSchema = BaseEventSchema.extend({
2493
- type: import_zod2.z.literal(
2494
- "THINKING_TEXT_MESSAGE_START"
2495
- /* THINKING_TEXT_MESSAGE_START */
2496
- )
2497
- });
2498
- var ThinkingTextMessageContentEventSchema = TextMessageContentEventSchema.omit({
2499
- messageId: true,
2500
- type: true
2501
- }).extend({
2502
- type: import_zod2.z.literal(
2503
- "THINKING_TEXT_MESSAGE_CONTENT"
2504
- /* THINKING_TEXT_MESSAGE_CONTENT */
2505
- )
2506
- });
2507
- var ThinkingTextMessageEndEventSchema = BaseEventSchema.extend({
2508
- type: import_zod2.z.literal(
2509
- "THINKING_TEXT_MESSAGE_END"
2510
- /* THINKING_TEXT_MESSAGE_END */
2511
- )
2512
- });
2513
- var ToolCallStartEventSchema = BaseEventSchema.extend({
2514
- type: import_zod2.z.literal(
2515
- "TOOL_CALL_START"
2516
- /* TOOL_CALL_START */
2517
- ),
2518
- toolCallId: import_zod2.z.string(),
2519
- toolCallName: import_zod2.z.string(),
2520
- parentMessageId: import_zod2.z.string().optional()
2521
- });
2522
- var ToolCallArgsEventSchema = BaseEventSchema.extend({
2523
- type: import_zod2.z.literal(
2524
- "TOOL_CALL_ARGS"
2525
- /* TOOL_CALL_ARGS */
2526
- ),
2527
- toolCallId: import_zod2.z.string(),
2528
- delta: import_zod2.z.string()
2529
- });
2530
- var ToolCallEndEventSchema = BaseEventSchema.extend({
2531
- type: import_zod2.z.literal(
2532
- "TOOL_CALL_END"
2533
- /* TOOL_CALL_END */
2534
- ),
2535
- toolCallId: import_zod2.z.string()
2536
- });
2537
- var ToolCallResultEventSchema = BaseEventSchema.extend({
2538
- messageId: import_zod2.z.string(),
2539
- type: import_zod2.z.literal(
2540
- "TOOL_CALL_RESULT"
2541
- /* TOOL_CALL_RESULT */
2542
- ),
2543
- toolCallId: import_zod2.z.string(),
2544
- content: import_zod2.z.string(),
2545
- role: import_zod2.z.literal("tool").optional()
2546
- });
2547
- var ToolCallChunkEventSchema = BaseEventSchema.extend({
2548
- type: import_zod2.z.literal(
2549
- "TOOL_CALL_CHUNK"
2550
- /* TOOL_CALL_CHUNK */
2551
- ),
2552
- toolCallId: import_zod2.z.string().optional(),
2553
- toolCallName: import_zod2.z.string().optional(),
2554
- parentMessageId: import_zod2.z.string().optional(),
2555
- delta: import_zod2.z.string().optional()
2556
- });
2557
- var ThinkingStartEventSchema = BaseEventSchema.extend({
2558
- type: import_zod2.z.literal(
2559
- "THINKING_START"
2560
- /* THINKING_START */
2561
- ),
2562
- title: import_zod2.z.string().optional()
2563
- });
2564
- var ThinkingEndEventSchema = BaseEventSchema.extend({
2565
- type: import_zod2.z.literal(
2566
- "THINKING_END"
2567
- /* THINKING_END */
2568
- )
2569
- });
2570
- var StateSnapshotEventSchema = BaseEventSchema.extend({
2571
- type: import_zod2.z.literal(
2572
- "STATE_SNAPSHOT"
2573
- /* STATE_SNAPSHOT */
2574
- ),
2575
- snapshot: StateSchema
2576
- });
2577
- var StateDeltaEventSchema = BaseEventSchema.extend({
2578
- type: import_zod2.z.literal(
2579
- "STATE_DELTA"
2580
- /* STATE_DELTA */
2581
- ),
2582
- delta: import_zod2.z.array(import_zod2.z.any())
2583
- // JSON Patch (RFC 6902)
2584
- });
2585
- var MessagesSnapshotEventSchema = BaseEventSchema.extend({
2586
- type: import_zod2.z.literal(
2587
- "MESSAGES_SNAPSHOT"
2588
- /* MESSAGES_SNAPSHOT */
2589
- ),
2590
- messages: import_zod2.z.array(MessageSchema)
2591
- });
2592
- var ActivitySnapshotEventSchema = BaseEventSchema.extend({
2593
- type: import_zod2.z.literal(
2594
- "ACTIVITY_SNAPSHOT"
2595
- /* ACTIVITY_SNAPSHOT */
2596
- ),
2597
- messageId: import_zod2.z.string(),
2598
- activityType: import_zod2.z.string(),
2599
- content: import_zod2.z.record(import_zod2.z.any()),
2600
- replace: import_zod2.z.boolean().optional().default(true)
2601
- });
2602
- var ActivityDeltaEventSchema = BaseEventSchema.extend({
2603
- type: import_zod2.z.literal(
2604
- "ACTIVITY_DELTA"
2605
- /* ACTIVITY_DELTA */
2606
- ),
2607
- messageId: import_zod2.z.string(),
2608
- activityType: import_zod2.z.string(),
2609
- patch: import_zod2.z.array(import_zod2.z.any())
2610
- });
2611
- var RawEventSchema = BaseEventSchema.extend({
2612
- type: import_zod2.z.literal(
2613
- "RAW"
2614
- /* RAW */
2615
- ),
2616
- event: import_zod2.z.any(),
2617
- source: import_zod2.z.string().optional()
2618
- });
2619
- var CustomEventSchema = BaseEventSchema.extend({
2620
- type: import_zod2.z.literal(
2621
- "CUSTOM"
2622
- /* CUSTOM */
2623
- ),
2624
- name: import_zod2.z.string(),
2625
- value: import_zod2.z.any()
2626
- });
2627
- var RunStartedEventSchema = BaseEventSchema.extend({
2628
- type: import_zod2.z.literal(
2629
- "RUN_STARTED"
2630
- /* RUN_STARTED */
2631
- ),
2632
- threadId: import_zod2.z.string(),
2633
- runId: import_zod2.z.string(),
2634
- parentRunId: import_zod2.z.string().optional(),
2635
- input: RunAgentInputSchema.optional()
2636
- });
2637
- var RunFinishedEventSchema = BaseEventSchema.extend({
2638
- type: import_zod2.z.literal(
2639
- "RUN_FINISHED"
2640
- /* RUN_FINISHED */
2641
- ),
2642
- threadId: import_zod2.z.string(),
2643
- runId: import_zod2.z.string(),
2644
- result: import_zod2.z.any().optional()
2645
- });
2646
- var RunErrorEventSchema = BaseEventSchema.extend({
2647
- type: import_zod2.z.literal(
2648
- "RUN_ERROR"
2649
- /* RUN_ERROR */
2650
- ),
2651
- message: import_zod2.z.string(),
2652
- code: import_zod2.z.string().optional()
2653
- });
2654
- var StepStartedEventSchema = BaseEventSchema.extend({
2655
- type: import_zod2.z.literal(
2656
- "STEP_STARTED"
2657
- /* STEP_STARTED */
2658
- ),
2659
- stepName: import_zod2.z.string()
2660
- });
2661
- var StepFinishedEventSchema = BaseEventSchema.extend({
2662
- type: import_zod2.z.literal(
2663
- "STEP_FINISHED"
2664
- /* STEP_FINISHED */
2665
- ),
2666
- stepName: import_zod2.z.string()
2667
- });
2668
- var EventSchemas = import_zod2.z.discriminatedUnion("type", [
2669
- TextMessageStartEventSchema,
2670
- TextMessageContentEventSchema,
2671
- TextMessageEndEventSchema,
2672
- TextMessageChunkEventSchema,
2673
- ThinkingStartEventSchema,
2674
- ThinkingEndEventSchema,
2675
- ThinkingTextMessageStartEventSchema,
2676
- ThinkingTextMessageContentEventSchema,
2677
- ThinkingTextMessageEndEventSchema,
2678
- ToolCallStartEventSchema,
2679
- ToolCallArgsEventSchema,
2680
- ToolCallEndEventSchema,
2681
- ToolCallChunkEventSchema,
2682
- ToolCallResultEventSchema,
2683
- StateSnapshotEventSchema,
2684
- StateDeltaEventSchema,
2685
- MessagesSnapshotEventSchema,
2686
- ActivitySnapshotEventSchema,
2687
- ActivityDeltaEventSchema,
2688
- RawEventSchema,
2689
- CustomEventSchema,
2690
- RunStartedEventSchema,
2691
- RunFinishedEventSchema,
2692
- RunErrorEventSchema,
2693
- StepStartedEventSchema,
2694
- StepFinishedEventSchema
2695
- ]);
2696
-
2697
2292
  // src/hooks/use-copilot-chat_internal.ts
2293
+ var import_client = require("@ag-ui/client");
2698
2294
  function useCopilotChatInternal({
2699
2295
  suggestions
2700
2296
  } = {}) {
@@ -2712,7 +2308,7 @@ function useCopilotChatInternal({
2712
2308
  yield copilotkit.connectAgent({ agent: agent2 });
2713
2309
  setAgentAvailable(true);
2714
2310
  } catch (error) {
2715
- if (error instanceof AGUIConnectNotImplementedError) {
2311
+ if (error instanceof import_client.AGUIConnectNotImplementedError) {
2716
2312
  } else {
2717
2313
  throw error;
2718
2314
  }