@copilotkit/shared 0.0.0-main-20260220223427 → 0.0.0-main-20260402184302

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 (100) hide show
  1. package/CHANGELOG.md +113 -1
  2. package/dist/constants/index.cjs +5 -0
  3. package/dist/constants/index.cjs.map +1 -1
  4. package/dist/constants/index.d.cts +4 -1
  5. package/dist/constants/index.d.cts.map +1 -1
  6. package/dist/constants/index.d.mts +4 -1
  7. package/dist/constants/index.d.mts.map +1 -1
  8. package/dist/constants/index.mjs +4 -1
  9. package/dist/constants/index.mjs.map +1 -1
  10. package/dist/finalize-events.cjs +106 -0
  11. package/dist/finalize-events.cjs.map +1 -0
  12. package/dist/finalize-events.d.cts +11 -0
  13. package/dist/finalize-events.d.cts.map +1 -0
  14. package/dist/finalize-events.d.mts +11 -0
  15. package/dist/finalize-events.d.mts.map +1 -0
  16. package/dist/finalize-events.mjs +105 -0
  17. package/dist/finalize-events.mjs.map +1 -0
  18. package/dist/index.cjs +25 -0
  19. package/dist/index.cjs.map +1 -1
  20. package/dist/index.d.cts +9 -4
  21. package/dist/index.d.cts.map +1 -1
  22. package/dist/index.d.mts +9 -4
  23. package/dist/index.d.mts.map +1 -1
  24. package/dist/index.mjs +10 -3
  25. package/dist/index.mjs.map +1 -1
  26. package/dist/index.umd.js +290 -5
  27. package/dist/index.umd.js.map +1 -1
  28. package/dist/logger.cjs +7 -0
  29. package/dist/logger.cjs.map +1 -0
  30. package/dist/logger.d.cts +5 -0
  31. package/dist/logger.d.cts.map +1 -0
  32. package/dist/logger.d.mts +5 -0
  33. package/dist/logger.d.mts.map +1 -0
  34. package/dist/logger.mjs +6 -0
  35. package/dist/logger.mjs.map +1 -0
  36. package/dist/package.cjs +1 -1
  37. package/dist/package.mjs +1 -1
  38. package/dist/standard-schema.cjs +29 -0
  39. package/dist/standard-schema.cjs.map +1 -0
  40. package/dist/standard-schema.d.cts +32 -0
  41. package/dist/standard-schema.d.cts.map +1 -0
  42. package/dist/standard-schema.d.mts +32 -0
  43. package/dist/standard-schema.d.mts.map +1 -0
  44. package/dist/standard-schema.mjs +28 -0
  45. package/dist/standard-schema.mjs.map +1 -0
  46. package/dist/telemetry/events.d.cts +0 -8
  47. package/dist/telemetry/events.d.cts.map +1 -1
  48. package/dist/telemetry/events.d.mts +0 -8
  49. package/dist/telemetry/events.d.mts.map +1 -1
  50. package/dist/transcription-errors.cjs +84 -0
  51. package/dist/transcription-errors.cjs.map +1 -0
  52. package/dist/transcription-errors.d.cts +52 -0
  53. package/dist/transcription-errors.d.cts.map +1 -0
  54. package/dist/transcription-errors.d.mts +52 -0
  55. package/dist/transcription-errors.d.mts.map +1 -0
  56. package/dist/transcription-errors.mjs +82 -0
  57. package/dist/transcription-errors.mjs.map +1 -0
  58. package/dist/types/message.d.cts +1 -1
  59. package/dist/types/message.d.mts +1 -1
  60. package/dist/utils/index.cjs +49 -0
  61. package/dist/utils/index.cjs.map +1 -1
  62. package/dist/utils/index.d.cts +24 -2
  63. package/dist/utils/index.d.cts.map +1 -1
  64. package/dist/utils/index.d.mts +24 -2
  65. package/dist/utils/index.d.mts.map +1 -1
  66. package/dist/utils/index.mjs +45 -1
  67. package/dist/utils/index.mjs.map +1 -1
  68. package/dist/utils/json-schema.cjs +4 -0
  69. package/dist/utils/json-schema.cjs.map +1 -1
  70. package/dist/utils/json-schema.d.cts.map +1 -1
  71. package/dist/utils/json-schema.d.mts.map +1 -1
  72. package/dist/utils/json-schema.mjs +4 -0
  73. package/dist/utils/json-schema.mjs.map +1 -1
  74. package/dist/utils/types.cjs +9 -0
  75. package/dist/utils/types.cjs.map +1 -0
  76. package/dist/utils/types.d.cts +12 -1
  77. package/dist/utils/types.d.cts.map +1 -1
  78. package/dist/utils/types.d.mts +12 -1
  79. package/dist/utils/types.d.mts.map +1 -1
  80. package/dist/utils/types.mjs +7 -0
  81. package/dist/utils/types.mjs.map +1 -0
  82. package/package.json +36 -30
  83. package/src/__tests__/standard-schema-types.test.ts +144 -0
  84. package/src/__tests__/standard-schema.test.ts +267 -0
  85. package/src/__tests__/zod-regression.test.ts +319 -0
  86. package/src/constants/index.ts +5 -0
  87. package/src/finalize-events.ts +154 -0
  88. package/src/index.ts +12 -0
  89. package/src/logger.ts +1 -0
  90. package/src/standard-schema.ts +76 -0
  91. package/src/telemetry/events.ts +0 -9
  92. package/src/transcription-errors.ts +99 -0
  93. package/src/types/message.ts +1 -1
  94. package/src/utils/{json-schema.test.ts → __tests__/json-schema.test.ts} +21 -2
  95. package/src/utils/index.ts +58 -0
  96. package/src/utils/json-schema.ts +6 -0
  97. package/src/utils/types.ts +21 -0
  98. package/src/utils.test.ts +66 -0
  99. package/tsconfig.json +9 -1
  100. package/tsdown.config.ts +10 -2
package/CHANGELOG.md CHANGED
@@ -1,11 +1,106 @@
1
1
  # @copilotkit/shared
2
2
 
3
- ## 0.0.0-main-20260220223427
3
+ ## 0.0.0-main-20260402184302
4
+
5
+ ### Minor Changes
6
+
7
+ - 1ceb963: refactor: consolidate V1/V2 packages into flat @copilotkit/\* structure
8
+
9
+ ## 1.55.0-next.8
10
+
11
+ ## 1.55.0-next.7
12
+
13
+ ### Minor Changes
14
+
15
+ - 1ceb963: refactor: consolidate V1/V2 packages into flat @copilotkit/\* structure
16
+
17
+ ## 1.54.1-next.6
18
+
19
+ ## 1.54.1-next.5
20
+
21
+ ## 1.54.1-next.4
22
+
23
+ ## 1.54.1-next.3
24
+
25
+ ## 1.54.1-next.2
26
+
27
+ ## 1.54.1-next.1
28
+
29
+ ## 1.54.1-next.0
30
+
31
+ ## 1.54.0
32
+
33
+ ## 1.54.0-next.9
34
+
35
+ ## 1.54.0-next.8
36
+
37
+ ## 1.54.0-next.7
38
+
39
+ ## 1.54.0-next.6
40
+
41
+ ## 1.54.0-next.5
42
+
43
+ ## 1.54.0-next.4
44
+
45
+ ## 1.54.0-next.3
46
+
47
+ ## 1.53.1-next.2
48
+
49
+ ## 1.53.1-next.1
50
+
51
+ ## 1.53.1-next.0
52
+
53
+ ## 1.53.0
54
+
55
+ ### Patch Changes
56
+
57
+ - 1510f64: feat: enable mcp and a2ui middleware directly from copilotkit runtime
58
+ - bf1fc6f: fix: `convertJsonSchemaToZodSchema` drops enum constraints
59
+
60
+ ## 1.53.0-next.6
61
+
62
+ ## 1.53.0-next.5
63
+
64
+ ## 1.52.2-next.4
65
+
66
+ ## 1.52.2-next.3
67
+
68
+ ### Patch Changes
69
+
70
+ - 1510f64: feat: enable mcp and a2ui middleware directly from copilotkit runtime
71
+
72
+ ## 1.52.2-next.2
73
+
74
+ ## 1.52.2-next.1
75
+
76
+ ### Patch Changes
77
+
78
+ - bf1fc6f: fix: `convertJsonSchemaToZodSchema` drops enum constraints
79
+
80
+ ## 1.52.2-next.0
81
+
82
+ ## 1.52.1
83
+
84
+ ## 1.52.1-next.1
85
+
86
+ ## 1.52.1-next.0
87
+
88
+ ## 1.52.0
4
89
 
5
90
  ### Patch Changes
6
91
 
7
92
  - ef0f539: Add reasoning support and default components for reasoning messages
8
93
 
94
+ ## 1.52.0-next.8
95
+
96
+ ## 1.52.0-next.7
97
+
98
+ ## 1.52.0-next.6
99
+
100
+ ## 1.52.0-next.5
101
+
102
+ ## 1.51.5-next.4
103
+
9
104
  ## 1.51.5-next.3
10
105
 
11
106
  ## 1.51.5-next.2
@@ -336,12 +431,14 @@
336
431
  agentic runtimes we acquired tech-debt that, with this PR, is being alleviated.
337
432
 
338
433
  As such, the following features have been updated to be completely functional with Headless UI.
434
+
339
435
  - Generative UI
340
436
  - Suggestions
341
437
  - Agentic Generative UI
342
438
  - Interrupts
343
439
 
344
440
  In addition, a variety of QOL changes have been made.
441
+
345
442
  - New AG-UI based message types
346
443
  - Inline code rendering is fixed
347
444
 
@@ -353,15 +450,19 @@
353
450
  - 6d1de58: - fix: address issues that would cause headless UI breaking changes in the next release
354
451
 
355
452
  Signed-off-by: Tyler Slaton <tyler@copilotkit.ai>
453
+
356
454
  - fix: more fixes addressing breaking changes in new Headless UI
357
455
 
358
456
  Signed-off-by: Tyler Slaton <tyler@copilotkit.ai>
457
+
359
458
  - chore: address linting issues
360
459
 
361
460
  Signed-off-by: Tyler Slaton <tyler@copilotkit.ai>
461
+
362
462
  - chore: fixing branding and docs
363
463
 
364
464
  Signed-off-by: Tyler Slaton <tyler@copilotkit.ai>
465
+
365
466
  - chore: more docs fixing
366
467
 
367
468
  Signed-off-by: Tyler Slaton <tyler@copilotkit.ai>
@@ -379,15 +480,19 @@
379
480
  - 6d1de58: - fix: address issues that would cause headless UI breaking changes in the next release
380
481
 
381
482
  Signed-off-by: Tyler Slaton <tyler@copilotkit.ai>
483
+
382
484
  - fix: more fixes addressing breaking changes in new Headless UI
383
485
 
384
486
  Signed-off-by: Tyler Slaton <tyler@copilotkit.ai>
487
+
385
488
  - chore: address linting issues
386
489
 
387
490
  Signed-off-by: Tyler Slaton <tyler@copilotkit.ai>
491
+
388
492
  - chore: fixing branding and docs
389
493
 
390
494
  Signed-off-by: Tyler Slaton <tyler@copilotkit.ai>
495
+
391
496
  - chore: more docs fixing
392
497
 
393
498
  Signed-off-by: Tyler Slaton <tyler@copilotkit.ai>
@@ -424,12 +529,14 @@
424
529
  agentic runtimes we acquired tech-debt that, with this PR, is being alleviated.
425
530
 
426
531
  As such, the following features have been updated to be completely functional with Headless UI.
532
+
427
533
  - Generative UI
428
534
  - Suggestions
429
535
  - Agentic Generative UI
430
536
  - Interrupts
431
537
 
432
538
  In addition, a variety of QOL changes have been made.
539
+
433
540
  - New AG-UI based message types
434
541
  - Inline code rendering is fixed
435
542
 
@@ -460,6 +567,7 @@
460
567
  ### Patch Changes
461
568
 
462
569
  - fac89c2: - refactor: rename onTrace to onError throughout codebase
570
+
463
571
  - Rename CopilotTraceEvent to CopilotErrorEvent and CopilotTraceHandler to CopilotErrorHandler
464
572
 
465
573
  - 9169ad7: - feat: add onTrace handler for runtime and UI error/event tracking
@@ -1092,6 +1200,7 @@
1092
1200
  - e16d95e: New prerelease
1093
1201
  - 1721cbd: Add convertActionsToDynamicStructuredTools to sdk-js
1094
1202
  - CopilotKit Core:
1203
+
1095
1204
  - Improved error messages and overall logs
1096
1205
  - `useCopilotAction.renderAndAwait` renamed to `.renderAndAwaitForResponse` (backwards compatible, will be deprecated in the future)
1097
1206
  - Improved scrolling behavior. It is now possible to scroll up during LLM response generation
@@ -1099,6 +1208,7 @@
1099
1208
  - Updated interfaces for better developer ergonomics
1100
1209
 
1101
1210
  CoAgents:
1211
+
1102
1212
  - Renamed `remoteActions` to `remoteEndpoints` (backwards compatible, will be deprecated in the future)
1103
1213
  - Support for LangGraph Platform in Remote Endpoints
1104
1214
  - LangGraph JS Support for CoAgents (locally via `langgraph dev`, `langgraph up` or deployed to LangGraph Platform)
@@ -1106,6 +1216,7 @@
1106
1216
  - Enhanced state management and message handling
1107
1217
 
1108
1218
  CopilotKid Back-end SDK:
1219
+
1109
1220
  - Released a whole-new `@copilotkit/sdk-js` for building agents with LangGraph JS Support
1110
1221
 
1111
1222
  - 8d0144f: bump
@@ -1446,6 +1557,7 @@ CopilotKid Back-end SDK:
1446
1557
  ### Major Changes
1447
1558
 
1448
1559
  - b6a4b6eb: V1.0 Release Candidate
1560
+
1449
1561
  - A robust new protocol between the frontend and the Copilot Runtime
1450
1562
  - Support for Copilot Cloud
1451
1563
  - Generative UI
@@ -4,10 +4,15 @@ const COPILOT_CLOUD_API_URL = "https://api.cloud.copilotkit.ai";
4
4
  const COPILOT_CLOUD_VERSION = "v1";
5
5
  const COPILOT_CLOUD_CHAT_URL = `${COPILOT_CLOUD_API_URL}/copilotkit/${COPILOT_CLOUD_VERSION}`;
6
6
  const COPILOT_CLOUD_PUBLIC_API_KEY_HEADER = "X-CopilotCloud-Public-Api-Key";
7
+ const DEFAULT_AGENT_ID = "default";
8
+ /** Phoenix channel event name used for all AG-UI events. */
9
+ const AG_UI_CHANNEL_EVENT = "ag-ui";
7
10
 
8
11
  //#endregion
12
+ exports.AG_UI_CHANNEL_EVENT = AG_UI_CHANNEL_EVENT;
9
13
  exports.COPILOT_CLOUD_API_URL = COPILOT_CLOUD_API_URL;
10
14
  exports.COPILOT_CLOUD_CHAT_URL = COPILOT_CLOUD_CHAT_URL;
11
15
  exports.COPILOT_CLOUD_PUBLIC_API_KEY_HEADER = COPILOT_CLOUD_PUBLIC_API_KEY_HEADER;
12
16
  exports.COPILOT_CLOUD_VERSION = COPILOT_CLOUD_VERSION;
17
+ exports.DEFAULT_AGENT_ID = DEFAULT_AGENT_ID;
13
18
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":[],"sources":["../../src/constants/index.ts"],"sourcesContent":["export const COPILOT_CLOUD_API_URL = \"https://api.cloud.copilotkit.ai\";\nexport const COPILOT_CLOUD_VERSION = \"v1\";\nexport const COPILOT_CLOUD_CHAT_URL = `${COPILOT_CLOUD_API_URL}/copilotkit/${COPILOT_CLOUD_VERSION}`;\nexport const COPILOT_CLOUD_PUBLIC_API_KEY_HEADER =\n \"X-CopilotCloud-Public-Api-Key\";\n"],"mappings":";;AAAA,MAAa,wBAAwB;AACrC,MAAa,wBAAwB;AACrC,MAAa,yBAAyB,GAAG,sBAAsB,cAAc;AAC7E,MAAa,sCACX"}
1
+ {"version":3,"file":"index.cjs","names":[],"sources":["../../src/constants/index.ts"],"sourcesContent":["export const COPILOT_CLOUD_API_URL = \"https://api.cloud.copilotkit.ai\";\nexport const COPILOT_CLOUD_VERSION = \"v1\";\nexport const COPILOT_CLOUD_CHAT_URL = `${COPILOT_CLOUD_API_URL}/copilotkit/${COPILOT_CLOUD_VERSION}`;\nexport const COPILOT_CLOUD_PUBLIC_API_KEY_HEADER =\n \"X-CopilotCloud-Public-Api-Key\";\n\nexport const DEFAULT_AGENT_ID = \"default\";\n\n/** Phoenix channel event name used for all AG-UI events. */\nexport const AG_UI_CHANNEL_EVENT = \"ag-ui\";\n"],"mappings":";;AAAA,MAAa,wBAAwB;AACrC,MAAa,wBAAwB;AACrC,MAAa,yBAAyB,GAAG,sBAAsB,cAAc;AAC7E,MAAa,sCACX;AAEF,MAAa,mBAAmB;;AAGhC,MAAa,sBAAsB"}
@@ -3,6 +3,9 @@ declare const COPILOT_CLOUD_API_URL = "https://api.cloud.copilotkit.ai";
3
3
  declare const COPILOT_CLOUD_VERSION = "v1";
4
4
  declare const COPILOT_CLOUD_CHAT_URL = "https://api.cloud.copilotkit.ai/copilotkit/v1";
5
5
  declare const COPILOT_CLOUD_PUBLIC_API_KEY_HEADER = "X-CopilotCloud-Public-Api-Key";
6
+ declare const DEFAULT_AGENT_ID = "default";
7
+ /** Phoenix channel event name used for all AG-UI events. */
8
+ declare const AG_UI_CHANNEL_EVENT = "ag-ui";
6
9
  //#endregion
7
- export { COPILOT_CLOUD_API_URL, COPILOT_CLOUD_CHAT_URL, COPILOT_CLOUD_PUBLIC_API_KEY_HEADER, COPILOT_CLOUD_VERSION };
10
+ export { AG_UI_CHANNEL_EVENT, COPILOT_CLOUD_API_URL, COPILOT_CLOUD_CHAT_URL, COPILOT_CLOUD_PUBLIC_API_KEY_HEADER, COPILOT_CLOUD_VERSION, DEFAULT_AGENT_ID };
8
11
  //# sourceMappingURL=index.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","names":[],"sources":["../../src/constants/index.ts"],"mappings":";cAAa,qBAAA;AAAA,cACA,qBAAA;AAAA,cACA,sBAAA;AAAA,cACA,mCAAA"}
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../../src/constants/index.ts"],"mappings":";cAAa,qBAAA;AAAA,cACA,qBAAA;AAAA,cACA,sBAAA;AAAA,cACA,mCAAA;AAAA,cAGA,gBAAA;;cAGA,mBAAA"}
@@ -3,6 +3,9 @@ declare const COPILOT_CLOUD_API_URL = "https://api.cloud.copilotkit.ai";
3
3
  declare const COPILOT_CLOUD_VERSION = "v1";
4
4
  declare const COPILOT_CLOUD_CHAT_URL = "https://api.cloud.copilotkit.ai/copilotkit/v1";
5
5
  declare const COPILOT_CLOUD_PUBLIC_API_KEY_HEADER = "X-CopilotCloud-Public-Api-Key";
6
+ declare const DEFAULT_AGENT_ID = "default";
7
+ /** Phoenix channel event name used for all AG-UI events. */
8
+ declare const AG_UI_CHANNEL_EVENT = "ag-ui";
6
9
  //#endregion
7
- export { COPILOT_CLOUD_API_URL, COPILOT_CLOUD_CHAT_URL, COPILOT_CLOUD_PUBLIC_API_KEY_HEADER, COPILOT_CLOUD_VERSION };
10
+ export { AG_UI_CHANNEL_EVENT, COPILOT_CLOUD_API_URL, COPILOT_CLOUD_CHAT_URL, COPILOT_CLOUD_PUBLIC_API_KEY_HEADER, COPILOT_CLOUD_VERSION, DEFAULT_AGENT_ID };
8
11
  //# sourceMappingURL=index.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../../src/constants/index.ts"],"mappings":";cAAa,qBAAA;AAAA,cACA,qBAAA;AAAA,cACA,sBAAA;AAAA,cACA,mCAAA"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../../src/constants/index.ts"],"mappings":";cAAa,qBAAA;AAAA,cACA,qBAAA;AAAA,cACA,sBAAA;AAAA,cACA,mCAAA;AAAA,cAGA,gBAAA;;cAGA,mBAAA"}
@@ -3,7 +3,10 @@ const COPILOT_CLOUD_API_URL = "https://api.cloud.copilotkit.ai";
3
3
  const COPILOT_CLOUD_VERSION = "v1";
4
4
  const COPILOT_CLOUD_CHAT_URL = `${COPILOT_CLOUD_API_URL}/copilotkit/${COPILOT_CLOUD_VERSION}`;
5
5
  const COPILOT_CLOUD_PUBLIC_API_KEY_HEADER = "X-CopilotCloud-Public-Api-Key";
6
+ const DEFAULT_AGENT_ID = "default";
7
+ /** Phoenix channel event name used for all AG-UI events. */
8
+ const AG_UI_CHANNEL_EVENT = "ag-ui";
6
9
 
7
10
  //#endregion
8
- export { COPILOT_CLOUD_API_URL, COPILOT_CLOUD_CHAT_URL, COPILOT_CLOUD_PUBLIC_API_KEY_HEADER, COPILOT_CLOUD_VERSION };
11
+ export { AG_UI_CHANNEL_EVENT, COPILOT_CLOUD_API_URL, COPILOT_CLOUD_CHAT_URL, COPILOT_CLOUD_PUBLIC_API_KEY_HEADER, COPILOT_CLOUD_VERSION, DEFAULT_AGENT_ID };
9
12
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../../src/constants/index.ts"],"sourcesContent":["export const COPILOT_CLOUD_API_URL = \"https://api.cloud.copilotkit.ai\";\nexport const COPILOT_CLOUD_VERSION = \"v1\";\nexport const COPILOT_CLOUD_CHAT_URL = `${COPILOT_CLOUD_API_URL}/copilotkit/${COPILOT_CLOUD_VERSION}`;\nexport const COPILOT_CLOUD_PUBLIC_API_KEY_HEADER =\n \"X-CopilotCloud-Public-Api-Key\";\n"],"mappings":";AAAA,MAAa,wBAAwB;AACrC,MAAa,wBAAwB;AACrC,MAAa,yBAAyB,GAAG,sBAAsB,cAAc;AAC7E,MAAa,sCACX"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../../src/constants/index.ts"],"sourcesContent":["export const COPILOT_CLOUD_API_URL = \"https://api.cloud.copilotkit.ai\";\nexport const COPILOT_CLOUD_VERSION = \"v1\";\nexport const COPILOT_CLOUD_CHAT_URL = `${COPILOT_CLOUD_API_URL}/copilotkit/${COPILOT_CLOUD_VERSION}`;\nexport const COPILOT_CLOUD_PUBLIC_API_KEY_HEADER =\n \"X-CopilotCloud-Public-Api-Key\";\n\nexport const DEFAULT_AGENT_ID = \"default\";\n\n/** Phoenix channel event name used for all AG-UI events. */\nexport const AG_UI_CHANNEL_EVENT = \"ag-ui\";\n"],"mappings":";AAAA,MAAa,wBAAwB;AACrC,MAAa,wBAAwB;AACrC,MAAa,yBAAyB,GAAG,sBAAsB,cAAc;AAC7E,MAAa,sCACX;AAEF,MAAa,mBAAmB;;AAGhC,MAAa,sBAAsB"}
@@ -0,0 +1,106 @@
1
+ const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
2
+ const require_random_id = require('./utils/random-id.cjs');
3
+ let _ag_ui_client = require("@ag-ui/client");
4
+
5
+ //#region src/finalize-events.ts
6
+ const defaultStopMessage = "Run stopped by user";
7
+ const defaultAbruptEndMessage = "Run ended without emitting a terminal event";
8
+ function finalizeRunEvents(events, options = {}) {
9
+ const { stopRequested = false, interruptionMessage } = options;
10
+ const resolvedStopMessage = interruptionMessage ?? defaultStopMessage;
11
+ const resolvedAbruptMessage = interruptionMessage && interruptionMessage !== defaultStopMessage ? interruptionMessage : defaultAbruptEndMessage;
12
+ const appended = [];
13
+ const openMessageIds = /* @__PURE__ */ new Set();
14
+ const openToolCalls = /* @__PURE__ */ new Map();
15
+ for (const event of events) switch (event.type) {
16
+ case _ag_ui_client.EventType.TEXT_MESSAGE_START: {
17
+ const messageId = event.messageId;
18
+ if (typeof messageId === "string") openMessageIds.add(messageId);
19
+ break;
20
+ }
21
+ case _ag_ui_client.EventType.TEXT_MESSAGE_END: {
22
+ const messageId = event.messageId;
23
+ if (typeof messageId === "string") openMessageIds.delete(messageId);
24
+ break;
25
+ }
26
+ case _ag_ui_client.EventType.TOOL_CALL_START: {
27
+ const toolCallId = event.toolCallId;
28
+ if (typeof toolCallId === "string") openToolCalls.set(toolCallId, {
29
+ hasEnd: false,
30
+ hasResult: false
31
+ });
32
+ break;
33
+ }
34
+ case _ag_ui_client.EventType.TOOL_CALL_END: {
35
+ const toolCallId = event.toolCallId;
36
+ const info = toolCallId ? openToolCalls.get(toolCallId) : void 0;
37
+ if (info) info.hasEnd = true;
38
+ break;
39
+ }
40
+ case _ag_ui_client.EventType.TOOL_CALL_RESULT: {
41
+ const toolCallId = event.toolCallId;
42
+ const info = toolCallId ? openToolCalls.get(toolCallId) : void 0;
43
+ if (info) info.hasResult = true;
44
+ break;
45
+ }
46
+ default: break;
47
+ }
48
+ const hasRunFinished = events.some((event) => event.type === _ag_ui_client.EventType.RUN_FINISHED);
49
+ const hasRunError = events.some((event) => event.type === _ag_ui_client.EventType.RUN_ERROR);
50
+ const terminalEventMissing = !(hasRunFinished || hasRunError);
51
+ for (const messageId of openMessageIds) {
52
+ const endEvent = {
53
+ type: _ag_ui_client.EventType.TEXT_MESSAGE_END,
54
+ messageId
55
+ };
56
+ events.push(endEvent);
57
+ appended.push(endEvent);
58
+ }
59
+ for (const [toolCallId, info] of openToolCalls) {
60
+ if (!info.hasEnd) {
61
+ const endEvent = {
62
+ type: _ag_ui_client.EventType.TOOL_CALL_END,
63
+ toolCallId
64
+ };
65
+ events.push(endEvent);
66
+ appended.push(endEvent);
67
+ }
68
+ if (terminalEventMissing && !info.hasResult) {
69
+ const resultEvent = {
70
+ type: _ag_ui_client.EventType.TOOL_CALL_RESULT,
71
+ toolCallId,
72
+ messageId: `${toolCallId ?? require_random_id.randomUUID()}-result`,
73
+ role: "tool",
74
+ content: JSON.stringify(stopRequested ? {
75
+ status: "stopped",
76
+ reason: "stop_requested",
77
+ message: resolvedStopMessage
78
+ } : {
79
+ status: "error",
80
+ reason: "missing_terminal_event",
81
+ message: resolvedAbruptMessage
82
+ })
83
+ };
84
+ events.push(resultEvent);
85
+ appended.push(resultEvent);
86
+ }
87
+ }
88
+ if (terminalEventMissing) if (stopRequested) {
89
+ const finishedEvent = { type: _ag_ui_client.EventType.RUN_FINISHED };
90
+ events.push(finishedEvent);
91
+ appended.push(finishedEvent);
92
+ } else {
93
+ const errorEvent = {
94
+ type: _ag_ui_client.EventType.RUN_ERROR,
95
+ message: resolvedAbruptMessage,
96
+ code: "INCOMPLETE_STREAM"
97
+ };
98
+ events.push(errorEvent);
99
+ appended.push(errorEvent);
100
+ }
101
+ return appended;
102
+ }
103
+
104
+ //#endregion
105
+ exports.finalizeRunEvents = finalizeRunEvents;
106
+ //# sourceMappingURL=finalize-events.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"finalize-events.cjs","names":["EventType","randomUUID"],"sources":["../src/finalize-events.ts"],"sourcesContent":["import { BaseEvent, EventType, RunErrorEvent } from \"@ag-ui/client\";\nimport { randomUUID } from \"./utils\";\n\ninterface FinalizeRunOptions {\n stopRequested?: boolean;\n interruptionMessage?: string;\n}\n\nconst defaultStopMessage = \"Run stopped by user\";\nconst defaultAbruptEndMessage = \"Run ended without emitting a terminal event\";\n\nexport function finalizeRunEvents(\n events: BaseEvent[],\n options: FinalizeRunOptions = {},\n): BaseEvent[] {\n const { stopRequested = false, interruptionMessage } = options;\n\n const resolvedStopMessage = interruptionMessage ?? defaultStopMessage;\n const resolvedAbruptMessage =\n interruptionMessage && interruptionMessage !== defaultStopMessage\n ? interruptionMessage\n : defaultAbruptEndMessage;\n\n const appended: BaseEvent[] = [];\n\n const openMessageIds = new Set<string>();\n const openToolCalls = new Map<\n string,\n {\n hasEnd: boolean;\n hasResult: boolean;\n }\n >();\n\n for (const event of events) {\n switch (event.type) {\n case EventType.TEXT_MESSAGE_START: {\n const messageId = (event as { messageId?: string }).messageId;\n if (typeof messageId === \"string\") {\n openMessageIds.add(messageId);\n }\n break;\n }\n case EventType.TEXT_MESSAGE_END: {\n const messageId = (event as { messageId?: string }).messageId;\n if (typeof messageId === \"string\") {\n openMessageIds.delete(messageId);\n }\n break;\n }\n case EventType.TOOL_CALL_START: {\n const toolCallId = (event as { toolCallId?: string }).toolCallId;\n if (typeof toolCallId === \"string\") {\n openToolCalls.set(toolCallId, {\n hasEnd: false,\n hasResult: false,\n });\n }\n break;\n }\n case EventType.TOOL_CALL_END: {\n const toolCallId = (event as { toolCallId?: string }).toolCallId;\n const info = toolCallId ? openToolCalls.get(toolCallId) : undefined;\n if (info) {\n info.hasEnd = true;\n }\n break;\n }\n case EventType.TOOL_CALL_RESULT: {\n const toolCallId = (event as { toolCallId?: string }).toolCallId;\n const info = toolCallId ? openToolCalls.get(toolCallId) : undefined;\n if (info) {\n info.hasResult = true;\n }\n break;\n }\n default:\n break;\n }\n }\n\n const hasRunFinished = events.some(\n (event) => event.type === EventType.RUN_FINISHED,\n );\n const hasRunError = events.some(\n (event) => event.type === EventType.RUN_ERROR,\n );\n const hasTerminalEvent = hasRunFinished || hasRunError;\n const terminalEventMissing = !hasTerminalEvent;\n\n for (const messageId of openMessageIds) {\n const endEvent = {\n type: EventType.TEXT_MESSAGE_END,\n messageId,\n } as BaseEvent;\n events.push(endEvent);\n appended.push(endEvent);\n }\n\n for (const [toolCallId, info] of openToolCalls) {\n if (!info.hasEnd) {\n const endEvent = {\n type: EventType.TOOL_CALL_END,\n toolCallId,\n } as BaseEvent;\n events.push(endEvent);\n appended.push(endEvent);\n }\n\n if (terminalEventMissing && !info.hasResult) {\n const resultEvent = {\n type: EventType.TOOL_CALL_RESULT,\n toolCallId,\n messageId: `${toolCallId ?? randomUUID()}-result`,\n role: \"tool\",\n content: JSON.stringify(\n stopRequested\n ? {\n status: \"stopped\",\n reason: \"stop_requested\",\n message: resolvedStopMessage,\n }\n : {\n status: \"error\",\n reason: \"missing_terminal_event\",\n message: resolvedAbruptMessage,\n },\n ),\n } as BaseEvent;\n events.push(resultEvent);\n appended.push(resultEvent);\n }\n }\n\n if (terminalEventMissing) {\n if (stopRequested) {\n const finishedEvent = {\n type: EventType.RUN_FINISHED,\n } as BaseEvent;\n events.push(finishedEvent);\n appended.push(finishedEvent);\n } else {\n const errorEvent: RunErrorEvent = {\n type: EventType.RUN_ERROR,\n message: resolvedAbruptMessage,\n code: \"INCOMPLETE_STREAM\",\n };\n events.push(errorEvent);\n appended.push(errorEvent);\n }\n }\n\n return appended;\n}\n"],"mappings":";;;;;AAQA,MAAM,qBAAqB;AAC3B,MAAM,0BAA0B;AAEhC,SAAgB,kBACd,QACA,UAA8B,EAAE,EACnB;CACb,MAAM,EAAE,gBAAgB,OAAO,wBAAwB;CAEvD,MAAM,sBAAsB,uBAAuB;CACnD,MAAM,wBACJ,uBAAuB,wBAAwB,qBAC3C,sBACA;CAEN,MAAM,WAAwB,EAAE;CAEhC,MAAM,iCAAiB,IAAI,KAAa;CACxC,MAAM,gCAAgB,IAAI,KAMvB;AAEH,MAAK,MAAM,SAAS,OAClB,SAAQ,MAAM,MAAd;EACE,KAAKA,wBAAU,oBAAoB;GACjC,MAAM,YAAa,MAAiC;AACpD,OAAI,OAAO,cAAc,SACvB,gBAAe,IAAI,UAAU;AAE/B;;EAEF,KAAKA,wBAAU,kBAAkB;GAC/B,MAAM,YAAa,MAAiC;AACpD,OAAI,OAAO,cAAc,SACvB,gBAAe,OAAO,UAAU;AAElC;;EAEF,KAAKA,wBAAU,iBAAiB;GAC9B,MAAM,aAAc,MAAkC;AACtD,OAAI,OAAO,eAAe,SACxB,eAAc,IAAI,YAAY;IAC5B,QAAQ;IACR,WAAW;IACZ,CAAC;AAEJ;;EAEF,KAAKA,wBAAU,eAAe;GAC5B,MAAM,aAAc,MAAkC;GACtD,MAAM,OAAO,aAAa,cAAc,IAAI,WAAW,GAAG;AAC1D,OAAI,KACF,MAAK,SAAS;AAEhB;;EAEF,KAAKA,wBAAU,kBAAkB;GAC/B,MAAM,aAAc,MAAkC;GACtD,MAAM,OAAO,aAAa,cAAc,IAAI,WAAW,GAAG;AAC1D,OAAI,KACF,MAAK,YAAY;AAEnB;;EAEF,QACE;;CAIN,MAAM,iBAAiB,OAAO,MAC3B,UAAU,MAAM,SAASA,wBAAU,aACrC;CACD,MAAM,cAAc,OAAO,MACxB,UAAU,MAAM,SAASA,wBAAU,UACrC;CAED,MAAM,uBAAuB,EADJ,kBAAkB;AAG3C,MAAK,MAAM,aAAa,gBAAgB;EACtC,MAAM,WAAW;GACf,MAAMA,wBAAU;GAChB;GACD;AACD,SAAO,KAAK,SAAS;AACrB,WAAS,KAAK,SAAS;;AAGzB,MAAK,MAAM,CAAC,YAAY,SAAS,eAAe;AAC9C,MAAI,CAAC,KAAK,QAAQ;GAChB,MAAM,WAAW;IACf,MAAMA,wBAAU;IAChB;IACD;AACD,UAAO,KAAK,SAAS;AACrB,YAAS,KAAK,SAAS;;AAGzB,MAAI,wBAAwB,CAAC,KAAK,WAAW;GAC3C,MAAM,cAAc;IAClB,MAAMA,wBAAU;IAChB;IACA,WAAW,GAAG,cAAcC,8BAAY,CAAC;IACzC,MAAM;IACN,SAAS,KAAK,UACZ,gBACI;KACE,QAAQ;KACR,QAAQ;KACR,SAAS;KACV,GACD;KACE,QAAQ;KACR,QAAQ;KACR,SAAS;KACV,CACN;IACF;AACD,UAAO,KAAK,YAAY;AACxB,YAAS,KAAK,YAAY;;;AAI9B,KAAI,qBACF,KAAI,eAAe;EACjB,MAAM,gBAAgB,EACpB,MAAMD,wBAAU,cACjB;AACD,SAAO,KAAK,cAAc;AAC1B,WAAS,KAAK,cAAc;QACvB;EACL,MAAM,aAA4B;GAChC,MAAMA,wBAAU;GAChB,SAAS;GACT,MAAM;GACP;AACD,SAAO,KAAK,WAAW;AACvB,WAAS,KAAK,WAAW;;AAI7B,QAAO"}
@@ -0,0 +1,11 @@
1
+ import { BaseEvent } from "@ag-ui/client";
2
+
3
+ //#region src/finalize-events.d.ts
4
+ interface FinalizeRunOptions {
5
+ stopRequested?: boolean;
6
+ interruptionMessage?: string;
7
+ }
8
+ declare function finalizeRunEvents(events: BaseEvent[], options?: FinalizeRunOptions): BaseEvent[];
9
+ //#endregion
10
+ export { finalizeRunEvents };
11
+ //# sourceMappingURL=finalize-events.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"finalize-events.d.cts","names":[],"sources":["../src/finalize-events.ts"],"mappings":";;;UAGU,kBAAA;EACR,aAAA;EACA,mBAAA;AAAA;AAAA,iBAMc,iBAAA,CACd,MAAA,EAAQ,SAAA,IACR,OAAA,GAAS,kBAAA,GACR,SAAA"}
@@ -0,0 +1,11 @@
1
+ import { BaseEvent } from "@ag-ui/client";
2
+
3
+ //#region src/finalize-events.d.ts
4
+ interface FinalizeRunOptions {
5
+ stopRequested?: boolean;
6
+ interruptionMessage?: string;
7
+ }
8
+ declare function finalizeRunEvents(events: BaseEvent[], options?: FinalizeRunOptions): BaseEvent[];
9
+ //#endregion
10
+ export { finalizeRunEvents };
11
+ //# sourceMappingURL=finalize-events.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"finalize-events.d.mts","names":[],"sources":["../src/finalize-events.ts"],"mappings":";;;UAGU,kBAAA;EACR,aAAA;EACA,mBAAA;AAAA;AAAA,iBAMc,iBAAA,CACd,MAAA,EAAQ,SAAA,IACR,OAAA,GAAS,kBAAA,GACR,SAAA"}
@@ -0,0 +1,105 @@
1
+ import { randomUUID } from "./utils/random-id.mjs";
2
+ import { EventType } from "@ag-ui/client";
3
+
4
+ //#region src/finalize-events.ts
5
+ const defaultStopMessage = "Run stopped by user";
6
+ const defaultAbruptEndMessage = "Run ended without emitting a terminal event";
7
+ function finalizeRunEvents(events, options = {}) {
8
+ const { stopRequested = false, interruptionMessage } = options;
9
+ const resolvedStopMessage = interruptionMessage ?? defaultStopMessage;
10
+ const resolvedAbruptMessage = interruptionMessage && interruptionMessage !== defaultStopMessage ? interruptionMessage : defaultAbruptEndMessage;
11
+ const appended = [];
12
+ const openMessageIds = /* @__PURE__ */ new Set();
13
+ const openToolCalls = /* @__PURE__ */ new Map();
14
+ for (const event of events) switch (event.type) {
15
+ case EventType.TEXT_MESSAGE_START: {
16
+ const messageId = event.messageId;
17
+ if (typeof messageId === "string") openMessageIds.add(messageId);
18
+ break;
19
+ }
20
+ case EventType.TEXT_MESSAGE_END: {
21
+ const messageId = event.messageId;
22
+ if (typeof messageId === "string") openMessageIds.delete(messageId);
23
+ break;
24
+ }
25
+ case EventType.TOOL_CALL_START: {
26
+ const toolCallId = event.toolCallId;
27
+ if (typeof toolCallId === "string") openToolCalls.set(toolCallId, {
28
+ hasEnd: false,
29
+ hasResult: false
30
+ });
31
+ break;
32
+ }
33
+ case EventType.TOOL_CALL_END: {
34
+ const toolCallId = event.toolCallId;
35
+ const info = toolCallId ? openToolCalls.get(toolCallId) : void 0;
36
+ if (info) info.hasEnd = true;
37
+ break;
38
+ }
39
+ case EventType.TOOL_CALL_RESULT: {
40
+ const toolCallId = event.toolCallId;
41
+ const info = toolCallId ? openToolCalls.get(toolCallId) : void 0;
42
+ if (info) info.hasResult = true;
43
+ break;
44
+ }
45
+ default: break;
46
+ }
47
+ const hasRunFinished = events.some((event) => event.type === EventType.RUN_FINISHED);
48
+ const hasRunError = events.some((event) => event.type === EventType.RUN_ERROR);
49
+ const terminalEventMissing = !(hasRunFinished || hasRunError);
50
+ for (const messageId of openMessageIds) {
51
+ const endEvent = {
52
+ type: EventType.TEXT_MESSAGE_END,
53
+ messageId
54
+ };
55
+ events.push(endEvent);
56
+ appended.push(endEvent);
57
+ }
58
+ for (const [toolCallId, info] of openToolCalls) {
59
+ if (!info.hasEnd) {
60
+ const endEvent = {
61
+ type: EventType.TOOL_CALL_END,
62
+ toolCallId
63
+ };
64
+ events.push(endEvent);
65
+ appended.push(endEvent);
66
+ }
67
+ if (terminalEventMissing && !info.hasResult) {
68
+ const resultEvent = {
69
+ type: EventType.TOOL_CALL_RESULT,
70
+ toolCallId,
71
+ messageId: `${toolCallId ?? randomUUID()}-result`,
72
+ role: "tool",
73
+ content: JSON.stringify(stopRequested ? {
74
+ status: "stopped",
75
+ reason: "stop_requested",
76
+ message: resolvedStopMessage
77
+ } : {
78
+ status: "error",
79
+ reason: "missing_terminal_event",
80
+ message: resolvedAbruptMessage
81
+ })
82
+ };
83
+ events.push(resultEvent);
84
+ appended.push(resultEvent);
85
+ }
86
+ }
87
+ if (terminalEventMissing) if (stopRequested) {
88
+ const finishedEvent = { type: EventType.RUN_FINISHED };
89
+ events.push(finishedEvent);
90
+ appended.push(finishedEvent);
91
+ } else {
92
+ const errorEvent = {
93
+ type: EventType.RUN_ERROR,
94
+ message: resolvedAbruptMessage,
95
+ code: "INCOMPLETE_STREAM"
96
+ };
97
+ events.push(errorEvent);
98
+ appended.push(errorEvent);
99
+ }
100
+ return appended;
101
+ }
102
+
103
+ //#endregion
104
+ export { finalizeRunEvents };
105
+ //# sourceMappingURL=finalize-events.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"finalize-events.mjs","names":[],"sources":["../src/finalize-events.ts"],"sourcesContent":["import { BaseEvent, EventType, RunErrorEvent } from \"@ag-ui/client\";\nimport { randomUUID } from \"./utils\";\n\ninterface FinalizeRunOptions {\n stopRequested?: boolean;\n interruptionMessage?: string;\n}\n\nconst defaultStopMessage = \"Run stopped by user\";\nconst defaultAbruptEndMessage = \"Run ended without emitting a terminal event\";\n\nexport function finalizeRunEvents(\n events: BaseEvent[],\n options: FinalizeRunOptions = {},\n): BaseEvent[] {\n const { stopRequested = false, interruptionMessage } = options;\n\n const resolvedStopMessage = interruptionMessage ?? defaultStopMessage;\n const resolvedAbruptMessage =\n interruptionMessage && interruptionMessage !== defaultStopMessage\n ? interruptionMessage\n : defaultAbruptEndMessage;\n\n const appended: BaseEvent[] = [];\n\n const openMessageIds = new Set<string>();\n const openToolCalls = new Map<\n string,\n {\n hasEnd: boolean;\n hasResult: boolean;\n }\n >();\n\n for (const event of events) {\n switch (event.type) {\n case EventType.TEXT_MESSAGE_START: {\n const messageId = (event as { messageId?: string }).messageId;\n if (typeof messageId === \"string\") {\n openMessageIds.add(messageId);\n }\n break;\n }\n case EventType.TEXT_MESSAGE_END: {\n const messageId = (event as { messageId?: string }).messageId;\n if (typeof messageId === \"string\") {\n openMessageIds.delete(messageId);\n }\n break;\n }\n case EventType.TOOL_CALL_START: {\n const toolCallId = (event as { toolCallId?: string }).toolCallId;\n if (typeof toolCallId === \"string\") {\n openToolCalls.set(toolCallId, {\n hasEnd: false,\n hasResult: false,\n });\n }\n break;\n }\n case EventType.TOOL_CALL_END: {\n const toolCallId = (event as { toolCallId?: string }).toolCallId;\n const info = toolCallId ? openToolCalls.get(toolCallId) : undefined;\n if (info) {\n info.hasEnd = true;\n }\n break;\n }\n case EventType.TOOL_CALL_RESULT: {\n const toolCallId = (event as { toolCallId?: string }).toolCallId;\n const info = toolCallId ? openToolCalls.get(toolCallId) : undefined;\n if (info) {\n info.hasResult = true;\n }\n break;\n }\n default:\n break;\n }\n }\n\n const hasRunFinished = events.some(\n (event) => event.type === EventType.RUN_FINISHED,\n );\n const hasRunError = events.some(\n (event) => event.type === EventType.RUN_ERROR,\n );\n const hasTerminalEvent = hasRunFinished || hasRunError;\n const terminalEventMissing = !hasTerminalEvent;\n\n for (const messageId of openMessageIds) {\n const endEvent = {\n type: EventType.TEXT_MESSAGE_END,\n messageId,\n } as BaseEvent;\n events.push(endEvent);\n appended.push(endEvent);\n }\n\n for (const [toolCallId, info] of openToolCalls) {\n if (!info.hasEnd) {\n const endEvent = {\n type: EventType.TOOL_CALL_END,\n toolCallId,\n } as BaseEvent;\n events.push(endEvent);\n appended.push(endEvent);\n }\n\n if (terminalEventMissing && !info.hasResult) {\n const resultEvent = {\n type: EventType.TOOL_CALL_RESULT,\n toolCallId,\n messageId: `${toolCallId ?? randomUUID()}-result`,\n role: \"tool\",\n content: JSON.stringify(\n stopRequested\n ? {\n status: \"stopped\",\n reason: \"stop_requested\",\n message: resolvedStopMessage,\n }\n : {\n status: \"error\",\n reason: \"missing_terminal_event\",\n message: resolvedAbruptMessage,\n },\n ),\n } as BaseEvent;\n events.push(resultEvent);\n appended.push(resultEvent);\n }\n }\n\n if (terminalEventMissing) {\n if (stopRequested) {\n const finishedEvent = {\n type: EventType.RUN_FINISHED,\n } as BaseEvent;\n events.push(finishedEvent);\n appended.push(finishedEvent);\n } else {\n const errorEvent: RunErrorEvent = {\n type: EventType.RUN_ERROR,\n message: resolvedAbruptMessage,\n code: \"INCOMPLETE_STREAM\",\n };\n events.push(errorEvent);\n appended.push(errorEvent);\n }\n }\n\n return appended;\n}\n"],"mappings":";;;;AAQA,MAAM,qBAAqB;AAC3B,MAAM,0BAA0B;AAEhC,SAAgB,kBACd,QACA,UAA8B,EAAE,EACnB;CACb,MAAM,EAAE,gBAAgB,OAAO,wBAAwB;CAEvD,MAAM,sBAAsB,uBAAuB;CACnD,MAAM,wBACJ,uBAAuB,wBAAwB,qBAC3C,sBACA;CAEN,MAAM,WAAwB,EAAE;CAEhC,MAAM,iCAAiB,IAAI,KAAa;CACxC,MAAM,gCAAgB,IAAI,KAMvB;AAEH,MAAK,MAAM,SAAS,OAClB,SAAQ,MAAM,MAAd;EACE,KAAK,UAAU,oBAAoB;GACjC,MAAM,YAAa,MAAiC;AACpD,OAAI,OAAO,cAAc,SACvB,gBAAe,IAAI,UAAU;AAE/B;;EAEF,KAAK,UAAU,kBAAkB;GAC/B,MAAM,YAAa,MAAiC;AACpD,OAAI,OAAO,cAAc,SACvB,gBAAe,OAAO,UAAU;AAElC;;EAEF,KAAK,UAAU,iBAAiB;GAC9B,MAAM,aAAc,MAAkC;AACtD,OAAI,OAAO,eAAe,SACxB,eAAc,IAAI,YAAY;IAC5B,QAAQ;IACR,WAAW;IACZ,CAAC;AAEJ;;EAEF,KAAK,UAAU,eAAe;GAC5B,MAAM,aAAc,MAAkC;GACtD,MAAM,OAAO,aAAa,cAAc,IAAI,WAAW,GAAG;AAC1D,OAAI,KACF,MAAK,SAAS;AAEhB;;EAEF,KAAK,UAAU,kBAAkB;GAC/B,MAAM,aAAc,MAAkC;GACtD,MAAM,OAAO,aAAa,cAAc,IAAI,WAAW,GAAG;AAC1D,OAAI,KACF,MAAK,YAAY;AAEnB;;EAEF,QACE;;CAIN,MAAM,iBAAiB,OAAO,MAC3B,UAAU,MAAM,SAAS,UAAU,aACrC;CACD,MAAM,cAAc,OAAO,MACxB,UAAU,MAAM,SAAS,UAAU,UACrC;CAED,MAAM,uBAAuB,EADJ,kBAAkB;AAG3C,MAAK,MAAM,aAAa,gBAAgB;EACtC,MAAM,WAAW;GACf,MAAM,UAAU;GAChB;GACD;AACD,SAAO,KAAK,SAAS;AACrB,WAAS,KAAK,SAAS;;AAGzB,MAAK,MAAM,CAAC,YAAY,SAAS,eAAe;AAC9C,MAAI,CAAC,KAAK,QAAQ;GAChB,MAAM,WAAW;IACf,MAAM,UAAU;IAChB;IACD;AACD,UAAO,KAAK,SAAS;AACrB,YAAS,KAAK,SAAS;;AAGzB,MAAI,wBAAwB,CAAC,KAAK,WAAW;GAC3C,MAAM,cAAc;IAClB,MAAM,UAAU;IAChB;IACA,WAAW,GAAG,cAAc,YAAY,CAAC;IACzC,MAAM;IACN,SAAS,KAAK,UACZ,gBACI;KACE,QAAQ;KACR,QAAQ;KACR,SAAS;KACV,GACD;KACE,QAAQ;KACR,QAAQ;KACR,SAAS;KACV,CACN;IACF;AACD,UAAO,KAAK,YAAY;AACxB,YAAS,KAAK,YAAY;;;AAI9B,KAAI,qBACF,KAAI,eAAe;EACjB,MAAM,gBAAgB,EACpB,MAAM,UAAU,cACjB;AACD,SAAO,KAAK,cAAc;AAC1B,WAAS,KAAK,cAAc;QACvB;EACL,MAAM,aAA4B;GAChC,MAAM,UAAU;GAChB,SAAS;GACT,MAAM;GACP;AACD,SAAO,KAAK,WAAW;AACvB,WAAS,KAAK,WAAW;;AAI7B,QAAO"}
package/dist/index.cjs CHANGED
@@ -3,17 +3,23 @@ const require_conditions = require('./utils/conditions.cjs');
3
3
  const require_console_styling = require('./utils/console-styling.cjs');
4
4
  const require_errors = require('./utils/errors.cjs');
5
5
  const require_json_schema = require('./utils/json-schema.cjs');
6
+ const require_types = require('./utils/types.cjs');
6
7
  const require_random_id = require('./utils/random-id.cjs');
7
8
  const require_requests = require('./utils/requests.cjs');
8
9
  const require_index = require('./utils/index.cjs');
9
10
  const require_index$1 = require('./constants/index.cjs');
10
11
  const require_package = require('./package.cjs');
11
12
  const require_telemetry_client = require('./telemetry/telemetry-client.cjs');
13
+ const require_standard_schema = require('./standard-schema.cjs');
14
+ const require_logger = require('./logger.cjs');
15
+ const require_finalize_events = require('./finalize-events.cjs');
16
+ const require_transcription_errors = require('./transcription-errors.cjs');
12
17
 
13
18
  //#region src/index.ts
14
19
  const COPILOTKIT_VERSION = require_package.version;
15
20
 
16
21
  //#endregion
22
+ exports.AG_UI_CHANNEL_EVENT = require_index$1.AG_UI_CHANNEL_EVENT;
17
23
  exports.BANNER_ERROR_NAMES = require_errors.BANNER_ERROR_NAMES;
18
24
  exports.COPILOTKIT_VERSION = COPILOTKIT_VERSION;
19
25
  exports.COPILOT_CLOUD_API_URL = require_index$1.COPILOT_CLOUD_API_URL;
@@ -32,19 +38,25 @@ exports.CopilotKitLowLevelError = require_errors.CopilotKitLowLevelError;
32
38
  exports.CopilotKitMisuseError = require_errors.CopilotKitMisuseError;
33
39
  exports.CopilotKitRemoteEndpointDiscoveryError = require_errors.CopilotKitRemoteEndpointDiscoveryError;
34
40
  exports.CopilotKitVersionMismatchError = require_errors.CopilotKitVersionMismatchError;
41
+ exports.DEFAULT_AGENT_ID = require_index$1.DEFAULT_AGENT_ID;
35
42
  exports.ERROR_CONFIG = require_errors.ERROR_CONFIG;
36
43
  exports.ERROR_NAMES = require_errors.ERROR_NAMES;
37
44
  exports.ErrorVisibility = require_errors.ErrorVisibility;
38
45
  exports.MissingPublicApiKeyError = require_errors.MissingPublicApiKeyError;
46
+ exports.RUNTIME_MODE_INTELLIGENCE = require_types.RUNTIME_MODE_INTELLIGENCE;
47
+ exports.RUNTIME_MODE_SSE = require_types.RUNTIME_MODE_SSE;
39
48
  exports.ResolvedCopilotKitError = require_errors.ResolvedCopilotKitError;
40
49
  exports.Severity = require_errors.Severity;
41
50
  exports.TelemetryClient = require_telemetry_client.TelemetryClient;
51
+ exports.TranscriptionErrorCode = require_transcription_errors.TranscriptionErrorCode;
52
+ exports.TranscriptionErrors = require_transcription_errors.TranscriptionErrors;
42
53
  exports.UpgradeRequiredError = require_errors.UpgradeRequiredError;
43
54
  exports.actionParametersToJsonSchema = require_json_schema.actionParametersToJsonSchema;
44
55
  exports.convertJsonSchemaToZodSchema = require_json_schema.convertJsonSchemaToZodSchema;
45
56
  exports.dataToUUID = require_random_id.dataToUUID;
46
57
  exports.ensureStructuredError = require_errors.ensureStructuredError;
47
58
  exports.executeConditions = require_conditions.executeConditions;
59
+ exports.finalizeRunEvents = require_finalize_events.finalizeRunEvents;
48
60
  exports.getPossibleVersionMismatch = require_errors.getPossibleVersionMismatch;
49
61
  exports.getZodParameters = require_json_schema.getZodParameters;
50
62
  exports.isMacOS = require_index.isMacOS;
@@ -54,11 +66,24 @@ exports.isValidUUID = require_random_id.isValidUUID;
54
66
  exports.jsonSchemaToActionParameters = require_json_schema.jsonSchemaToActionParameters;
55
67
  exports.logCopilotKitPlatformMessage = require_console_styling.logCopilotKitPlatformMessage;
56
68
  exports.logStyled = require_console_styling.logStyled;
69
+ exports.logger = require_logger.logger;
57
70
  exports.parseJson = require_index.parseJson;
71
+ exports.partialJSONParse = require_index.partialJSONParse;
72
+ exports.phoenixExponentialBackoff = require_index.phoenixExponentialBackoff;
58
73
  exports.publicApiKeyRequired = require_console_styling.publicApiKeyRequired;
59
74
  exports.randomId = require_random_id.randomId;
60
75
  exports.randomUUID = require_random_id.randomUUID;
61
76
  exports.readBody = require_requests.readBody;
77
+ exports.safeParseToolArgs = require_index.safeParseToolArgs;
78
+ exports.schemaToJsonSchema = require_standard_schema.schemaToJsonSchema;
62
79
  exports.styledConsole = require_console_styling.styledConsole;
63
80
  exports.tryMap = require_index.tryMap;
81
+ var _copilotkit_license_verifier = require("@copilotkit/license-verifier");
82
+ Object.keys(_copilotkit_license_verifier).forEach(function (k) {
83
+ if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
84
+ enumerable: true,
85
+ get: function () { return _copilotkit_license_verifier[k]; }
86
+ });
87
+ });
88
+
64
89
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["export * from \"./types\";\nexport * from \"./utils\";\nexport * from \"./constants\";\nexport * from \"./telemetry\";\n\nimport * as packageJson from \"../package.json\";\nexport const COPILOTKIT_VERSION = packageJson.version;\n"],"mappings":";;;;;;;;;;;;;AAMA,MAAa"}
1
+ {"version":3,"file":"index.cjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["export * from \"./types\";\nexport * from \"./utils\";\nexport * from \"./constants\";\nexport * from \"./telemetry\";\nexport * from \"./standard-schema\";\n\nexport { logger } from \"./logger\";\nexport { finalizeRunEvents } from \"./finalize-events\";\n\nexport {\n TranscriptionErrorCode,\n TranscriptionErrors,\n type TranscriptionErrorResponse,\n} from \"./transcription-errors\";\n\nimport * as packageJson from \"../package.json\";\nexport const COPILOTKIT_VERSION = packageJson.version;\n\nexport * from \"@copilotkit/license-verifier\";\n"],"mappings":";;;;;;;;;;;;;;;;;;AAgBA,MAAa"}