@copilotkit/runtime 0.0.0-fix-interrupt-issues-20250409144731 → 0.0.0-fix-agent-lock-20250618155414

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 +440 -3
  2. package/__snapshots__/schema/schema.graphql +19 -1
  3. package/dist/chunk-4SPWC35T.mjs +141 -0
  4. package/dist/chunk-4SPWC35T.mjs.map +1 -0
  5. package/dist/{chunk-XPNNDFCN.mjs → chunk-5HGBWMSC.mjs} +4 -4
  6. package/dist/chunk-5HGBWMSC.mjs.map +1 -0
  7. package/dist/{chunk-FZJAYGIR.mjs → chunk-IIXJVVTV.mjs} +306 -177
  8. package/dist/chunk-IIXJVVTV.mjs.map +1 -0
  9. package/dist/{chunk-VUTLFZ6R.mjs → chunk-LFZVEW57.mjs} +3 -3
  10. package/dist/chunk-LFZVEW57.mjs.map +1 -0
  11. package/dist/{chunk-MNZKCJK5.mjs → chunk-MJ23IGS7.mjs} +3 -3
  12. package/dist/chunk-MJ23IGS7.mjs.map +1 -0
  13. package/dist/{chunk-7MWJJP4Z.mjs → chunk-N6SLSBQM.mjs} +584 -60
  14. package/dist/chunk-N6SLSBQM.mjs.map +1 -0
  15. package/dist/{chunk-RTFJTJMA.mjs → chunk-SHBDMA63.mjs} +14 -2
  16. package/dist/chunk-SHBDMA63.mjs.map +1 -0
  17. package/dist/graphql/types/converted/index.d.ts +1 -1
  18. package/dist/graphql/types/converted/index.js +13 -0
  19. package/dist/graphql/types/converted/index.js.map +1 -1
  20. package/dist/graphql/types/converted/index.mjs +3 -1
  21. package/dist/{groq-adapter-fb9aa3ab.d.ts → groq-adapter-25a2bd35.d.ts} +17 -1
  22. package/dist/{index-5bec5424.d.ts → index-d4614f9b.d.ts} +17 -2
  23. package/dist/index.d.ts +15 -11
  24. package/dist/index.js +4885 -4080
  25. package/dist/index.js.map +1 -1
  26. package/dist/index.mjs +20 -7
  27. package/dist/index.mjs.map +1 -1
  28. package/dist/{langserve-6f7af8d3.d.ts → langserve-4a5c9217.d.ts} +2 -2
  29. package/dist/lib/index.d.ts +164 -11
  30. package/dist/lib/index.js +4447 -3719
  31. package/dist/lib/index.js.map +1 -1
  32. package/dist/lib/index.mjs +18 -7
  33. package/dist/lib/integrations/index.d.ts +7 -6
  34. package/dist/lib/integrations/index.js +168 -21
  35. package/dist/lib/integrations/index.js.map +1 -1
  36. package/dist/lib/integrations/index.mjs +6 -6
  37. package/dist/lib/integrations/nest/index.d.ts +6 -5
  38. package/dist/lib/integrations/nest/index.js +165 -18
  39. package/dist/lib/integrations/nest/index.js.map +1 -1
  40. package/dist/lib/integrations/nest/index.mjs +4 -4
  41. package/dist/lib/integrations/node-express/index.d.ts +6 -5
  42. package/dist/lib/integrations/node-express/index.js +165 -18
  43. package/dist/lib/integrations/node-express/index.js.map +1 -1
  44. package/dist/lib/integrations/node-express/index.mjs +4 -4
  45. package/dist/lib/integrations/node-http/index.d.ts +6 -5
  46. package/dist/lib/integrations/node-http/index.js +164 -17
  47. package/dist/lib/integrations/node-http/index.js.map +1 -1
  48. package/dist/lib/integrations/node-http/index.mjs +3 -3
  49. package/dist/service-adapters/index.d.ts +50 -5
  50. package/dist/service-adapters/index.js +305 -175
  51. package/dist/service-adapters/index.js.map +1 -1
  52. package/dist/service-adapters/index.mjs +3 -1
  53. package/dist/{copilot-runtime-9347bd66.d.ts → shared-0c31d7c5.d.ts} +140 -46
  54. package/jest.config.js +8 -3
  55. package/package.json +16 -3
  56. package/src/graphql/inputs/agent-state.input.ts +1 -1
  57. package/src/graphql/inputs/message.input.ts +18 -0
  58. package/src/graphql/resolvers/copilot.resolver.ts +27 -0
  59. package/src/graphql/types/converted/index.ts +15 -1
  60. package/src/graphql/types/copilot-response.type.ts +17 -0
  61. package/src/lib/index.ts +3 -1
  62. package/src/lib/integrations/nest/index.ts +1 -4
  63. package/src/lib/integrations/nextjs/app-router.ts +1 -4
  64. package/src/lib/integrations/nextjs/pages-router.ts +1 -4
  65. package/src/lib/integrations/node-express/index.ts +1 -4
  66. package/src/lib/integrations/node-http/index.ts +1 -4
  67. package/src/lib/runtime/agui-action.ts +129 -0
  68. package/src/lib/runtime/copilot-runtime.ts +269 -11
  69. package/src/lib/runtime/langgraph/langgraph-agent.ts +190 -0
  70. package/src/lib/runtime/mcp-tools-utils.ts +188 -0
  71. package/src/lib/runtime/remote-action-constructors.ts +11 -14
  72. package/src/lib/runtime/remote-actions.ts +29 -2
  73. package/src/lib/runtime/remote-lg-action.ts +123 -35
  74. package/src/lib/telemetry-client.ts +11 -2
  75. package/src/service-adapters/anthropic/anthropic-adapter.ts +138 -67
  76. package/src/service-adapters/anthropic/utils.ts +32 -19
  77. package/src/service-adapters/bedrock/bedrock-adapter.ts +65 -0
  78. package/src/service-adapters/conversion.ts +10 -0
  79. package/src/service-adapters/google/google-genai-adapter.test.ts +104 -0
  80. package/src/service-adapters/google/google-genai-adapter.ts +19 -1
  81. package/src/service-adapters/index.ts +1 -0
  82. package/src/service-adapters/openai/openai-adapter.ts +120 -69
  83. package/src/service-adapters/openai/openai-assistant-adapter.ts +11 -1
  84. package/src/service-adapters/openai/utils.ts +12 -0
  85. package/tests/global.d.ts +13 -0
  86. package/tests/service-adapters/anthropic/allowlist-approach.test.ts +226 -0
  87. package/tests/service-adapters/anthropic/anthropic-adapter.test.ts +604 -0
  88. package/tests/service-adapters/openai/allowlist-approach.test.ts +238 -0
  89. package/tests/service-adapters/openai/openai-adapter.test.ts +301 -0
  90. package/tests/setup.jest.ts +21 -0
  91. package/tests/tsconfig.json +10 -0
  92. package/tsconfig.json +1 -1
  93. package/dist/chunk-7MWJJP4Z.mjs.map +0 -1
  94. package/dist/chunk-FZJAYGIR.mjs.map +0 -1
  95. package/dist/chunk-MNZKCJK5.mjs.map +0 -1
  96. package/dist/chunk-PTC5JN3P.mjs +0 -1
  97. package/dist/chunk-PTC5JN3P.mjs.map +0 -1
  98. package/dist/chunk-RTFJTJMA.mjs.map +0 -1
  99. package/dist/chunk-VUTLFZ6R.mjs.map +0 -1
  100. package/dist/chunk-XPNNDFCN.mjs.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,14 +1,451 @@
1
1
  # @copilotkit/runtime
2
2
 
3
- ## 0.0.0-fix-interrupt-issues-20250409144731
3
+ ## 0.0.0-fix-agent-lock-20250618155414
4
4
 
5
5
  ### Patch Changes
6
6
 
7
- - b817a9f: - fix: fix how results are communicated back on interrupt
7
+ - 6aab014: - fix: remove all agents as tools when there is an active agent session
8
+ - @copilotkit/shared@0.0.0-fix-agent-lock-20250618155414
9
+
10
+ ## 1.9.1
11
+
12
+ ### Patch Changes
13
+
14
+ - deaeca0: - feat: Add public key
15
+
16
+ Signed-off-by: Luis Valdes <luis@copilotkit.ai>
17
+
18
+ - Updated dependencies [deaeca0]
19
+ - @copilotkit/shared@1.9.1
20
+
21
+ ## 1.9.1-next.0
22
+
23
+ ### Patch Changes
24
+
25
+ - deaeca0: - feat: Add public key
26
+
27
+ Signed-off-by: Luis Valdes <luis@copilotkit.ai>
28
+
29
+ - Updated dependencies [deaeca0]
30
+ - @copilotkit/shared@1.9.1-next.0
31
+
32
+ ## 1.9.0
33
+
34
+ ### Minor Changes
35
+
36
+ - 8408d58: - feat: create copilotkit agui langgraph agent
37
+ - docs: replace remote endpoint with AGUI agent
38
+
39
+ ### Patch Changes
40
+
41
+ - c120e07: - refactor(react-ui): pass full message to onThumbsUp and onThumbsDown handlers
42
+ - 54cae30: - fix(react-core): allow custom toolChoice in forwardedParameters to override default
43
+ - fix: move react-dom to peerDependencies in @copilotkit/react-textarea
44
+ - feat: add amazon bedrock adapter support
45
+ - @copilotkit/shared@1.9.0
46
+
47
+ ## 1.9.0-next.2
48
+
49
+ ### Minor Changes
50
+
51
+ - 8408d58: - feat: create copilotkit agui langgraph agent
52
+ - docs: replace remote endpoint with AGUI agent
53
+
54
+ ### Patch Changes
55
+
56
+ - @copilotkit/shared@1.9.0-next.2
57
+
58
+ ## 1.8.15-next.1
59
+
60
+ ### Patch Changes
61
+
62
+ - 54cae30: - fix(react-core): allow custom toolChoice in forwardedParameters to override default
63
+ - fix: move react-dom to peerDependencies in @copilotkit/react-textarea
64
+ - feat: add amazon bedrock adapter support
65
+ - @copilotkit/shared@1.8.15-next.1
66
+
67
+ ## 1.8.15-next.0
68
+
69
+ ### Patch Changes
70
+
71
+ - c120e07: - refactor(react-ui): pass full message to onThumbsUp and onThumbsDown handlers
72
+ - @copilotkit/shared@1.8.15-next.0
73
+
74
+ ## 1.8.14
75
+
76
+ ### Patch Changes
77
+
78
+ - ddd4165: - fix(runtime): filter empty AIMessages in GoogleGenerativeAIAdapter
79
+ - fix(runtime): filter empty text messages in AnthropicAdapter
80
+ - 9d33836: - fix: prepare cpk agui wiring for ag-ui langgraph support
81
+ - 12b8ca8: - fix: fix cpk agui wiring for langgraph
82
+ - ddd4165: - fix(runtime): filter empty AIMessages in GoogleGenerativeAIAdapter
83
+ - 1af7333: - docs: updates ag-ui agent interface
84
+ - Updated dependencies [34a78d8]
85
+ - @copilotkit/shared@1.8.14
86
+
87
+ ## 1.8.14-next.5
88
+
89
+ ### Patch Changes
90
+
91
+ - ddd4165: - fix(runtime): filter empty AIMessages in GoogleGenerativeAIAdapter
92
+ - fix(runtime): filter empty text messages in AnthropicAdapter
93
+ - ddd4165: - fix(runtime): filter empty AIMessages in GoogleGenerativeAIAdapter
94
+ - @copilotkit/shared@1.8.14-next.5
95
+
96
+ ## 1.8.14-next.4
97
+
98
+ ### Patch Changes
99
+
100
+ - 12b8ca8: - fix: fix cpk agui wiring for langgraph
101
+ - @copilotkit/shared@1.8.14-next.4
102
+
103
+ ## 1.8.14-next.3
104
+
105
+ ### Patch Changes
106
+
107
+ - 9d33836: - fix: prepare cpk agui wiring for ag-ui langgraph support
108
+ - @copilotkit/shared@1.8.14-next.3
109
+
110
+ ## 1.8.14-next.2
111
+
112
+ ### Patch Changes
113
+
114
+ - 1af7333: - docs: updates ag-ui agent interface
115
+ - @copilotkit/shared@1.8.14-next.2
116
+
117
+ ## 1.8.14-next.1
118
+
119
+ ### Patch Changes
120
+
121
+ - Updated dependencies [34a78d8]
122
+ - @copilotkit/shared@1.8.14-next.1
123
+
124
+ ## 1.8.14-next.0
125
+
126
+ ### Patch Changes
127
+
128
+ - @copilotkit/shared@1.8.14-next.0
129
+
130
+ ## 1.8.13
131
+
132
+ ### Patch Changes
133
+
134
+ - 6ed54f4: - AG-UI 0.0.28
135
+ - @copilotkit/shared@1.8.13
136
+
137
+ ## 1.8.13-next.3
138
+
139
+ ### Patch Changes
140
+
141
+ - @copilotkit/shared@1.8.13-next.3
142
+
143
+ ## 1.8.13-next.2
144
+
145
+ ### Patch Changes
146
+
147
+ - @copilotkit/shared@1.8.13-next.2
148
+
149
+ ## 1.8.13-next.1
150
+
151
+ ### Patch Changes
152
+
153
+ - @copilotkit/shared@1.8.13-next.1
154
+
155
+ ## 1.8.13-next.0
156
+
157
+ ### Patch Changes
158
+
159
+ - 6ed54f4: - AG-UI 0.0.28
160
+ - @copilotkit/shared@1.8.13-next.0
161
+
162
+ ## 1.8.12
163
+
164
+ ### Patch Changes
165
+
166
+ - 54838cb: - feat: allow keeping system role for openai adapters
167
+ - 2b89ad7: - fix: use latest claude 3.5 as default model instead of specific
168
+ - chore: add missing variable assignment in llm provider docs
169
+ - chore: add missing call to fetch azure api key in docs
170
+ - f419d99: - fix: Implement allowlist approach to prevent duplicate tool_result blocks in API calls to OpenAI and Anthropic
171
+ - @copilotkit/shared@1.8.12
172
+
173
+ ## 1.8.12-next.6
174
+
175
+ ### Patch Changes
176
+
177
+ - @copilotkit/shared@1.8.12-next.6
178
+
179
+ ## 1.8.12-next.5
180
+
181
+ ### Patch Changes
182
+
183
+ - @copilotkit/shared@1.8.12-next.5
184
+
185
+ ## 1.8.12-next.4
186
+
187
+ ### Patch Changes
188
+
189
+ - f419d99: - fix: Implement allowlist approach to prevent duplicate tool_result blocks in API calls to OpenAI and Anthropic
190
+ - @copilotkit/shared@1.8.12-next.4
191
+
192
+ ## 1.8.12-next.3
193
+
194
+ ### Patch Changes
195
+
196
+ - @copilotkit/shared@1.8.12-next.3
197
+
198
+ ## 1.8.12-next.2
199
+
200
+ ### Patch Changes
201
+
202
+ - @copilotkit/shared@1.8.12-next.2
203
+
204
+ ## 1.8.12-next.1
205
+
206
+ ### Patch Changes
207
+
208
+ - 54838cb: - feat: allow keeping system role for openai adapters
209
+ - @copilotkit/shared@1.8.12-next.1
210
+
211
+ ## 1.8.12-next.0
212
+
213
+ ### Patch Changes
214
+
215
+ - 2b89ad7: - fix: use latest claude 3.5 as default model instead of specific
216
+ - chore: add missing variable assignment in llm provider docs
217
+ - chore: add missing call to fetch azure api key in docs
218
+ - @copilotkit/shared@1.8.12-next.0
219
+
220
+ ## 1.8.11
221
+
222
+ ### Patch Changes
223
+
224
+ - 52d0bb5: - fix: do not attempt to hash lgc key if it doesnt exist
225
+ - fix: accept null on langsmith api key
226
+ - @copilotkit/shared@1.8.11
227
+
228
+ ## 1.8.11-next.1
229
+
230
+ ### Patch Changes
231
+
232
+ - 52d0bb5: - fix: do not attempt to hash lgc key if it doesnt exist
233
+ - fix: accept null on langsmith api key
234
+ - @copilotkit/shared@1.8.11-next.1
235
+
236
+ ## 1.8.11-next.0
237
+
238
+ ### Patch Changes
239
+
240
+ - @copilotkit/shared@1.8.11-next.0
241
+
242
+ ## 1.8.10
243
+
244
+ ### Patch Changes
245
+
246
+ - f3a0a33: - updates ag-ui deps
247
+ - 742efbb: - feat: enable setting langgraph config from ui
248
+ - chore: document usage of new config
249
+ - @copilotkit/shared@1.8.10
250
+
251
+ ## 1.8.10-next.3
252
+
253
+ ### Patch Changes
254
+
255
+ - @copilotkit/shared@1.8.10-next.3
256
+
257
+ ## 1.8.10-next.2
258
+
259
+ ### Patch Changes
260
+
261
+ - f3a0a33: - updates ag-ui deps
262
+ - @copilotkit/shared@1.8.10-next.2
263
+
264
+ ## 1.8.10-next.1
265
+
266
+ ### Patch Changes
267
+
268
+ - @copilotkit/shared@1.8.10-next.1
269
+
270
+ ## 1.8.10-next.0
271
+
272
+ ### Patch Changes
273
+
274
+ - 742efbb: - feat: enable setting langgraph config from ui
275
+ - chore: document usage of new config
276
+ - @copilotkit/shared@1.8.10-next.0
277
+
278
+ ## 1.8.9
279
+
280
+ ### Patch Changes
281
+
282
+ - f81a526: - Fix MCP tool schema structure to match interface requirements
283
+ - add utils
284
+ - @copilotkit/shared@1.8.9
285
+
286
+ ## 1.8.9-next.0
287
+
288
+ ### Patch Changes
289
+
290
+ - f81a526: - Fix MCP tool schema structure to match interface requirements
291
+ - add utils
292
+ - @copilotkit/shared@1.8.9-next.0
293
+
294
+ ## 1.8.8
295
+
296
+ ### Patch Changes
297
+
298
+ - 8c26335: - fix: update MCP tool parameter extraction to handle full tool objects
299
+ - dfb67c3: - refactor: rename mcpEndpoints to mcpServers for naming consistency
300
+ - doc changes
301
+ - @copilotkit/shared@1.8.8
302
+
303
+ ## 1.8.8-next.1
304
+
305
+ ### Patch Changes
306
+
307
+ - 8c26335: - fix: update MCP tool parameter extraction to handle full tool objects
308
+ - @copilotkit/shared@1.8.8-next.1
309
+
310
+ ## 1.8.8-next.0
311
+
312
+ ### Patch Changes
313
+
314
+ - dfb67c3: - refactor: rename mcpEndpoints to mcpServers for naming consistency
315
+ - doc changes
316
+ - @copilotkit/shared@1.8.8-next.0
317
+
318
+ ## 1.8.7
319
+
320
+ ### Patch Changes
321
+
322
+ - 8b8474f: - feat: add image input support with multi-model compatibility, pasting, and UX improvements
323
+ - @copilotkit/shared@1.8.7
324
+
325
+ ## 1.8.7-next.0
326
+
327
+ ### Patch Changes
328
+
329
+ - 8b8474f: - feat: add image input support with multi-model compatibility, pasting, and UX improvements
330
+ - @copilotkit/shared@1.8.7-next.0
331
+
332
+ ## 1.8.6
333
+
334
+ ### Patch Changes
335
+
336
+ - 7a04bd1: - fix: fix how results are communicated back on interrupt
337
+ - fix: do not allow followup for interrupt actions
338
+ - chore: improve TS docs for interrupt
339
+ - @copilotkit/shared@1.8.6
340
+
341
+ ## 1.8.6-next.0
342
+
343
+ ### Patch Changes
344
+
345
+ - 7a04bd1: - fix: fix how results are communicated back on interrupt
8
346
  - fix: do not allow followup for interrupt actions
9
347
  - chore: improve TS docs for interrupt
348
+ - @copilotkit/shared@1.8.6-next.0
349
+
350
+ ## 1.8.5
351
+
352
+ ### Patch Changes
353
+
354
+ - c0d3261: - full AWP support
355
+
356
+ Signed-off-by: Tyler Slaton <tyler@copilotkit.ai>
357
+
358
+ - refactor: address linter issues with the new pages
359
+
360
+ Signed-off-by: Tyler Slaton <tyler@copilotkit.ai>
361
+
362
+ - Merge branch 'mme/acp' into mme/mastra
363
+ - add sse example
364
+ - Create small-turkeys-agree.md
365
+ - upgrade AWP
366
+ - Merge branch 'mme/mastra' of github.com:CopilotKit/CopilotKit into mme/mastra
367
+ - make agents a dict
368
+ - update docs
369
+ - send tools
370
+ - update to latest packages
371
+ - fix problem where state sync are preventing tool calls
372
+ - set possibly undefined toolCalls to an empty array
373
+ - fix missing tool call ids
374
+
375
+ - 77a7457: - feat: Add Model Context Protocol (MCP) support
376
+ - 76d9ef9: - fix: handle langgraph client specific errors when running lgc stream
377
+ - c0d3261: - add AWP support
378
+
379
+ - make it work
380
+ - update docs
381
+ - refactor: move UI files to be normal NextJS pages and update generation
382
+
383
+ Signed-off-by: Tyler Slaton <tyler@copilotkit.ai>
384
+
385
+ - refactor: address linter issues with the new pages
386
+
387
+ Signed-off-by: Tyler Slaton <tyler@copilotkit.ai>
388
+
389
+ - Merge branch 'mme/acp' into mme/mastra
390
+ - add sse example
391
+
10
392
  - d0e8a1e: - fix: fix duplicate messages on regenerate
11
- - @copilotkit/shared@0.0.0-fix-interrupt-issues-20250409144731
393
+ - @copilotkit/shared@1.8.5
394
+
395
+ ## 1.8.5-next.5
396
+
397
+ ### Patch Changes
398
+
399
+ - c0d3261: - full AWP support
400
+
401
+ Signed-off-by: Tyler Slaton <tyler@copilotkit.ai>
402
+
403
+ - refactor: address linter issues with the new pages
404
+
405
+ Signed-off-by: Tyler Slaton <tyler@copilotkit.ai>
406
+
407
+ - Merge branch 'mme/acp' into mme/mastra
408
+ - add sse example
409
+ - Create small-turkeys-agree.md
410
+ - upgrade AWP
411
+ - Merge branch 'mme/mastra' of github.com:CopilotKit/CopilotKit into mme/mastra
412
+ - make agents a dict
413
+ - update docs
414
+ - send tools
415
+ - update to latest packages
416
+ - fix problem where state sync are preventing tool calls
417
+ - set possibly undefined toolCalls to an empty array
418
+ - fix missing tool call ids
419
+
420
+ - c0d3261: - add AWP support
421
+
422
+ - make it work
423
+ - update docs
424
+ - refactor: move UI files to be normal NextJS pages and update generation
425
+
426
+ Signed-off-by: Tyler Slaton <tyler@copilotkit.ai>
427
+
428
+ - refactor: address linter issues with the new pages
429
+
430
+ Signed-off-by: Tyler Slaton <tyler@copilotkit.ai>
431
+
432
+ - Merge branch 'mme/acp' into mme/mastra
433
+ - add sse example
434
+ - @copilotkit/shared@1.8.5-next.5
435
+
436
+ ## 1.8.5-next.4
437
+
438
+ ### Patch Changes
439
+
440
+ - 76d9ef9: - fix: handle langgraph client specific errors when running lgc stream
441
+ - @copilotkit/shared@1.8.5-next.4
442
+
443
+ ## 1.8.5-next.3
444
+
445
+ ### Patch Changes
446
+
447
+ - 77a7457: - feat: Add Model Context Protocol (MCP) support
448
+ - @copilotkit/shared@1.8.5-next.3
12
449
 
13
450
  ## 1.8.5-next.2
14
451
 
@@ -48,7 +48,7 @@ input AgentSessionInput {
48
48
 
49
49
  input AgentStateInput {
50
50
  agentName: String!
51
- configurable: String
51
+ config: String
52
52
  state: String!
53
53
  }
54
54
 
@@ -203,6 +203,23 @@ input GuardrailsRuleInput {
203
203
  denyList: [String!] = []
204
204
  }
205
205
 
206
+ input ImageMessageInput {
207
+ bytes: String!
208
+ format: String!
209
+ parentMessageId: String
210
+ role: MessageRole!
211
+ }
212
+
213
+ type ImageMessageOutput implements BaseMessageOutput {
214
+ bytes: String!
215
+ createdAt: DateTimeISO!
216
+ format: String!
217
+ id: String!
218
+ parentMessageId: String
219
+ role: MessageRole!
220
+ status: MessageStatus!
221
+ }
222
+
206
223
  """
207
224
  The `JSON` scalar type represents JSON values as specified by [ECMA-404](http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf).
208
225
  """
@@ -237,6 +254,7 @@ input MessageInput {
237
254
  agentStateMessage: AgentStateMessageInput
238
255
  createdAt: DateTimeISO!
239
256
  id: String!
257
+ imageMessage: ImageMessageInput
240
258
  resultMessage: ResultMessageInput
241
259
  textMessage: TextMessageInput
242
260
  }
@@ -0,0 +1,141 @@
1
+ import {
2
+ LangGraphEventTypes
3
+ } from "./chunk-N6SLSBQM.mjs";
4
+ import {
5
+ __name
6
+ } from "./chunk-FHD4JECV.mjs";
7
+
8
+ // src/lib/runtime/langgraph/langgraph-agent.ts
9
+ import { EventType } from "@ag-ui/client";
10
+ import { map } from "rxjs";
11
+ import { LangGraphAgent as AGUILangGraphAgent } from "@ag-ui/langgraph";
12
+ var CustomEventNames;
13
+ (function(CustomEventNames2) {
14
+ CustomEventNames2["CopilotKitManuallyEmitMessage"] = "copilotkit_manually_emit_message";
15
+ CustomEventNames2["CopilotKitManuallyEmitToolCall"] = "copilotkit_manually_emit_tool_call";
16
+ CustomEventNames2["CopilotKitManuallyEmitIntermediateState"] = "copilotkit_manually_emit_intermediate_state";
17
+ CustomEventNames2["CopilotKitExit"] = "copilotkit_exit";
18
+ })(CustomEventNames || (CustomEventNames = {}));
19
+ var LangGraphAgent = class extends AGUILangGraphAgent {
20
+ constructor(config) {
21
+ super(config);
22
+ }
23
+ dispatchEvent(event) {
24
+ if (event.type === EventType.CUSTOM) {
25
+ const customEvent = event;
26
+ if (customEvent.name === "copilotkit_manually_emit_message") {
27
+ this.subscriber.next({
28
+ type: EventType.TEXT_MESSAGE_START,
29
+ role: "assistant",
30
+ messageId: customEvent.value.message_id,
31
+ rawEvent: event
32
+ });
33
+ this.subscriber.next({
34
+ type: EventType.TEXT_MESSAGE_CONTENT,
35
+ messageId: customEvent.value.message_id,
36
+ delta: customEvent.value.message,
37
+ rawEvent: event
38
+ });
39
+ this.subscriber.next({
40
+ type: EventType.TEXT_MESSAGE_END,
41
+ messageId: customEvent.value.message_id,
42
+ rawEvent: event
43
+ });
44
+ return true;
45
+ }
46
+ if (customEvent.name === "copilotkit_manually_emit_tool_call") {
47
+ this.subscriber.next({
48
+ type: EventType.TOOL_CALL_START,
49
+ toolCallId: customEvent.value.id,
50
+ toolCallName: customEvent.value.name,
51
+ parentMessageId: customEvent.value.id,
52
+ rawEvent: event
53
+ });
54
+ this.subscriber.next({
55
+ type: EventType.TOOL_CALL_ARGS,
56
+ toolCallId: customEvent.value.id,
57
+ delta: customEvent.value.args,
58
+ rawEvent: event
59
+ });
60
+ this.subscriber.next({
61
+ type: EventType.TOOL_CALL_END,
62
+ toolCallId: customEvent.value.id,
63
+ rawEvent: event
64
+ });
65
+ return true;
66
+ }
67
+ if (customEvent.name === "copilotkit_manually_emit_intermediate_state") {
68
+ this.activeRun.manuallyEmittedState = customEvent.value;
69
+ this.dispatchEvent({
70
+ type: EventType.STATE_SNAPSHOT,
71
+ snapshot: this.getStateSnapshot(this.activeRun.manuallyEmittedState),
72
+ rawEvent: event
73
+ });
74
+ return true;
75
+ }
76
+ if (customEvent.name === "copilotkit_exit") {
77
+ this.subscriber.next({
78
+ type: EventType.CUSTOM,
79
+ name: "Exit",
80
+ value: true
81
+ });
82
+ return true;
83
+ }
84
+ }
85
+ const rawEvent = event.rawEvent;
86
+ if (!rawEvent) {
87
+ this.subscriber.next(event);
88
+ return true;
89
+ }
90
+ const isMessageEvent = event.type === EventType.TEXT_MESSAGE_START || event.type === EventType.TEXT_MESSAGE_CONTENT || event.type === EventType.TEXT_MESSAGE_END;
91
+ const isToolEvent = event.type === EventType.TOOL_CALL_START || event.type === EventType.TOOL_CALL_ARGS || event.type === EventType.TOOL_CALL_END;
92
+ if ("copilotkit:emit-tool-calls" in (rawEvent.metadata || {})) {
93
+ if (rawEvent.metadata["copilotkit:emit-tool-calls"] === false && isToolEvent) {
94
+ return false;
95
+ }
96
+ }
97
+ if ("copilotkit:emit-messages" in (rawEvent.metadata || {})) {
98
+ if (rawEvent.metadata["copilotkit:emit-messages"] === false && isMessageEvent) {
99
+ return false;
100
+ }
101
+ }
102
+ this.subscriber.next(event);
103
+ return true;
104
+ }
105
+ // @ts-ignore
106
+ run(input) {
107
+ return super.run(input).pipe(map((processedEvent) => {
108
+ var _a, _b, _c, _d, _e;
109
+ if (processedEvent.type === EventType.RAW) {
110
+ const event = processedEvent.event ?? processedEvent.rawEvent;
111
+ const eventType = event.event;
112
+ const toolCallData = (_c = (_b = (_a = event.data) == null ? void 0 : _a.chunk) == null ? void 0 : _b.tool_call_chunks) == null ? void 0 : _c[0];
113
+ const toolCallUsedToPredictState = (_e = (_d = event.metadata) == null ? void 0 : _d["copilotkit:emit-intermediate-state"]) == null ? void 0 : _e.some((predictStateTool) => predictStateTool.tool === (toolCallData == null ? void 0 : toolCallData.name));
114
+ if (eventType === LangGraphEventTypes.OnChatModelStream && toolCallUsedToPredictState) {
115
+ return {
116
+ type: EventType.CUSTOM,
117
+ name: "PredictState",
118
+ value: event.metadata["copilotkit:emit-intermediate-state"]
119
+ };
120
+ }
121
+ }
122
+ return processedEvent;
123
+ }));
124
+ }
125
+ langGraphDefaultMergeState(state, messages, tools) {
126
+ const { tools: returnedTools, ...rest } = super.langGraphDefaultMergeState(state, messages, tools);
127
+ return {
128
+ ...rest,
129
+ copilotkit: {
130
+ actions: returnedTools
131
+ }
132
+ };
133
+ }
134
+ };
135
+ __name(LangGraphAgent, "LangGraphAgent");
136
+
137
+ export {
138
+ CustomEventNames,
139
+ LangGraphAgent
140
+ };
141
+ //# sourceMappingURL=chunk-4SPWC35T.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/lib/runtime/langgraph/langgraph-agent.ts"],"sourcesContent":["import {\n RunAgentInput,\n EventType,\n CustomEvent,\n TextMessageStartEvent,\n TextMessageContentEvent,\n TextMessageEndEvent,\n ToolCallStartEvent,\n ToolCallArgsEvent,\n ToolCallEndEvent,\n} from \"@ag-ui/client\";\nimport { map } from \"rxjs\";\nimport { LangGraphEventTypes } from \"../../../agents/langgraph/events\";\nimport { RawEvent } from \"@ag-ui/core\";\nimport {\n LangGraphAgent as AGUILangGraphAgent,\n type LangGraphAgentConfig,\n ProcessedEvents,\n} from \"@ag-ui/langgraph\";\nimport { Message as LangGraphMessage } from \"@langchain/langgraph-sdk/dist/types.messages\";\n\nexport interface PredictStateTool {\n tool: string;\n state_key: string;\n tool_argument: string;\n}\nexport type State = Record<string, any>;\n\nexport type TextMessageEvents =\n | TextMessageStartEvent\n | TextMessageContentEvent\n | TextMessageEndEvent;\n\nexport type ToolCallEvents = ToolCallStartEvent | ToolCallArgsEvent | ToolCallEndEvent;\n\nexport enum CustomEventNames {\n CopilotKitManuallyEmitMessage = \"copilotkit_manually_emit_message\",\n CopilotKitManuallyEmitToolCall = \"copilotkit_manually_emit_tool_call\",\n CopilotKitManuallyEmitIntermediateState = \"copilotkit_manually_emit_intermediate_state\",\n CopilotKitExit = \"copilotkit_exit\",\n}\n\nexport class LangGraphAgent extends AGUILangGraphAgent {\n constructor(config: LangGraphAgentConfig) {\n super(config);\n }\n\n dispatchEvent(event: ProcessedEvents) {\n if (event.type === EventType.CUSTOM) {\n // const event = processedEvent as unknown as CustomEvent;\n const customEvent = event as unknown as CustomEvent;\n\n if (customEvent.name === CustomEventNames.CopilotKitManuallyEmitMessage) {\n this.subscriber.next({\n type: EventType.TEXT_MESSAGE_START,\n role: \"assistant\",\n messageId: customEvent.value.message_id,\n rawEvent: event,\n });\n this.subscriber.next({\n type: EventType.TEXT_MESSAGE_CONTENT,\n messageId: customEvent.value.message_id,\n delta: customEvent.value.message,\n rawEvent: event,\n });\n this.subscriber.next({\n type: EventType.TEXT_MESSAGE_END,\n messageId: customEvent.value.message_id,\n rawEvent: event,\n });\n return true;\n }\n\n if (customEvent.name === CustomEventNames.CopilotKitManuallyEmitToolCall) {\n this.subscriber.next({\n type: EventType.TOOL_CALL_START,\n toolCallId: customEvent.value.id,\n toolCallName: customEvent.value.name,\n parentMessageId: customEvent.value.id,\n rawEvent: event,\n });\n this.subscriber.next({\n type: EventType.TOOL_CALL_ARGS,\n toolCallId: customEvent.value.id,\n delta: customEvent.value.args,\n rawEvent: event,\n });\n this.subscriber.next({\n type: EventType.TOOL_CALL_END,\n toolCallId: customEvent.value.id,\n rawEvent: event,\n });\n return true;\n }\n\n if (customEvent.name === CustomEventNames.CopilotKitManuallyEmitIntermediateState) {\n this.activeRun.manuallyEmittedState = customEvent.value;\n this.dispatchEvent({\n type: EventType.STATE_SNAPSHOT,\n snapshot: this.getStateSnapshot(this.activeRun.manuallyEmittedState),\n rawEvent: event,\n });\n return true;\n }\n\n if (customEvent.name === CustomEventNames.CopilotKitExit) {\n this.subscriber.next({\n type: EventType.CUSTOM,\n name: \"Exit\",\n value: true,\n });\n return true;\n }\n }\n\n // Intercept all text message and tool call events and check if should disable\n const rawEvent = (event as ToolCallEvents | TextMessageEvents).rawEvent;\n if (!rawEvent) {\n this.subscriber.next(event);\n return true;\n }\n\n const isMessageEvent =\n event.type === EventType.TEXT_MESSAGE_START ||\n event.type === EventType.TEXT_MESSAGE_CONTENT ||\n event.type === EventType.TEXT_MESSAGE_END;\n const isToolEvent =\n event.type === EventType.TOOL_CALL_START ||\n event.type === EventType.TOOL_CALL_ARGS ||\n event.type === EventType.TOOL_CALL_END;\n if (\"copilotkit:emit-tool-calls\" in (rawEvent.metadata || {})) {\n if (rawEvent.metadata[\"copilotkit:emit-tool-calls\"] === false && isToolEvent) {\n return false;\n }\n }\n if (\"copilotkit:emit-messages\" in (rawEvent.metadata || {})) {\n if (rawEvent.metadata[\"copilotkit:emit-messages\"] === false && isMessageEvent) {\n return false;\n }\n }\n\n this.subscriber.next(event);\n return true;\n }\n\n // @ts-ignore\n run(input: RunAgentInput) {\n return super.run(input).pipe(\n map((processedEvent) => {\n // Turn raw event into emit state snapshot from tool call event\n if (processedEvent.type === EventType.RAW) {\n // Get the LangGraph event from the AGUI event.\n const event = (processedEvent as RawEvent).event ?? (processedEvent as RawEvent).rawEvent;\n\n const eventType = event.event;\n const toolCallData = event.data?.chunk?.tool_call_chunks?.[0];\n const toolCallUsedToPredictState = event.metadata?.[\n \"copilotkit:emit-intermediate-state\"\n ]?.some(\n (predictStateTool: PredictStateTool) => predictStateTool.tool === toolCallData?.name,\n );\n\n if (eventType === LangGraphEventTypes.OnChatModelStream && toolCallUsedToPredictState) {\n return {\n type: EventType.CUSTOM,\n name: \"PredictState\",\n value: event.metadata[\"copilotkit:emit-intermediate-state\"],\n };\n }\n }\n\n return processedEvent;\n }),\n );\n }\n\n langGraphDefaultMergeState(state: State, messages: LangGraphMessage[], tools: any): State {\n const { tools: returnedTools, ...rest } = super.langGraphDefaultMergeState(\n state,\n messages,\n tools,\n );\n return {\n ...rest,\n copilotkit: {\n actions: returnedTools,\n },\n };\n }\n}\n"],"mappings":"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","names":["EventType","map","LangGraphAgent","AGUILangGraphAgent","CustomEventNames","LangGraphAgent","AGUILangGraphAgent","constructor","config","dispatchEvent","event","type","EventType","CUSTOM","customEvent","name","subscriber","next","TEXT_MESSAGE_START","role","messageId","value","message_id","rawEvent","TEXT_MESSAGE_CONTENT","delta","message","TEXT_MESSAGE_END","TOOL_CALL_START","toolCallId","id","toolCallName","parentMessageId","TOOL_CALL_ARGS","args","TOOL_CALL_END","activeRun","manuallyEmittedState","STATE_SNAPSHOT","snapshot","getStateSnapshot","isMessageEvent","isToolEvent","metadata","run","input","pipe","map","processedEvent","RAW","eventType","toolCallData","data","chunk","tool_call_chunks","toolCallUsedToPredictState","some","predictStateTool","tool","LangGraphEventTypes","OnChatModelStream","langGraphDefaultMergeState","state","messages","tools","returnedTools","rest","copilotkit","actions"]}
@@ -2,7 +2,7 @@ import {
2
2
  getCommonConfig,
3
3
  getRuntimeInstanceTelemetryInfo,
4
4
  telemetry_client_default
5
- } from "./chunk-7MWJJP4Z.mjs";
5
+ } from "./chunk-N6SLSBQM.mjs";
6
6
  import {
7
7
  __name
8
8
  } from "./chunk-FHD4JECV.mjs";
@@ -22,7 +22,7 @@ function copilotRuntimeNextJSAppRouterEndpoint(options) {
22
22
  _copilotkit: options.properties._copilotkit
23
23
  });
24
24
  }
25
- telemetry_client_default.capture("oss.runtime.instance_created", getRuntimeInstanceTelemetryInfo(options.runtime));
25
+ telemetry_client_default.capture("oss.runtime.instance_created", getRuntimeInstanceTelemetryInfo(options));
26
26
  const logger = commonConfig.logging;
27
27
  logger.debug("Creating NextJS App Router endpoint");
28
28
  const yoga = createYoga({
@@ -61,7 +61,7 @@ function copilotRuntimeNextJSPagesRouterEndpoint(options) {
61
61
  _copilotkit: options.properties._copilotkit
62
62
  });
63
63
  }
64
- telemetry_client_default.capture("oss.runtime.instance_created", getRuntimeInstanceTelemetryInfo(options.runtime));
64
+ telemetry_client_default.capture("oss.runtime.instance_created", getRuntimeInstanceTelemetryInfo(options));
65
65
  const logger = commonConfig.logging;
66
66
  logger.debug("Creating NextJS Pages Router endpoint");
67
67
  const yoga = createYoga2({
@@ -77,4 +77,4 @@ export {
77
77
  config,
78
78
  copilotRuntimeNextJSPagesRouterEndpoint
79
79
  };
80
- //# sourceMappingURL=chunk-XPNNDFCN.mjs.map
80
+ //# sourceMappingURL=chunk-5HGBWMSC.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/lib/integrations/nextjs/app-router.ts","../src/lib/integrations/nextjs/pages-router.ts"],"sourcesContent":["import { createYoga } from \"graphql-yoga\";\nimport { CreateCopilotRuntimeServerOptions, getCommonConfig } from \"../shared\";\nimport telemetry, { getRuntimeInstanceTelemetryInfo } from \"../../telemetry-client\";\n\nexport function copilotRuntimeNextJSAppRouterEndpoint(options: CreateCopilotRuntimeServerOptions) {\n const commonConfig = getCommonConfig(options);\n\n telemetry.setGlobalProperties({\n runtime: {\n framework: \"nextjs-app-router\",\n },\n });\n\n if (options.properties?._copilotkit) {\n telemetry.setGlobalProperties({\n _copilotkit: options.properties._copilotkit,\n });\n }\n\n telemetry.capture(\"oss.runtime.instance_created\", getRuntimeInstanceTelemetryInfo(options));\n\n const logger = commonConfig.logging;\n logger.debug(\"Creating NextJS App Router endpoint\");\n\n const yoga = createYoga({\n ...commonConfig,\n graphqlEndpoint: options.endpoint,\n fetchAPI: { Response: globalThis.Response },\n });\n\n return {\n handleRequest: yoga,\n GET: yoga as any,\n POST: yoga as any,\n OPTIONS: yoga as any,\n };\n}\n","import { YogaServerInstance, createYoga } from \"graphql-yoga\";\nimport { CreateCopilotRuntimeServerOptions, GraphQLContext, getCommonConfig } from \"../shared\";\nimport telemetry, { getRuntimeInstanceTelemetryInfo } from \"../../telemetry-client\";\n\nexport const config = {\n api: {\n bodyParser: false,\n },\n};\n\nexport type CopilotRuntimeServerInstance<T> = YogaServerInstance<T, Partial<GraphQLContext>>;\n\n// This import is needed to fix the type error\n// Fix is currently in TypeScript 5.5 beta, waiting for stable version\n// https://github.com/microsoft/TypeScript/issues/42873#issuecomment-2066874644\nexport type {} from \"@whatwg-node/server\";\n\nexport function copilotRuntimeNextJSPagesRouterEndpoint(\n options: CreateCopilotRuntimeServerOptions,\n): CopilotRuntimeServerInstance<GraphQLContext> {\n const commonConfig = getCommonConfig(options);\n\n telemetry.setGlobalProperties({\n runtime: {\n framework: \"nextjs-pages-router\",\n },\n });\n\n if (options.properties?._copilotkit) {\n telemetry.setGlobalProperties({\n _copilotkit: options.properties._copilotkit,\n });\n }\n\n telemetry.capture(\"oss.runtime.instance_created\", getRuntimeInstanceTelemetryInfo(options));\n\n const logger = commonConfig.logging;\n logger.debug(\"Creating NextJS Pages Router endpoint\");\n\n const yoga = createYoga({\n ...commonConfig,\n graphqlEndpoint: options.endpoint,\n });\n\n return yoga;\n}\n"],"mappings":";;;;;;;;;;AAAA,SAASA,kBAAkB;AAIpB,SAASC,sCAAsCC,SAA0C;AAJhG;AAKE,QAAMC,eAAeC,gBAAgBF,OAAAA;AAErCG,2BAAUC,oBAAoB;IAC5BC,SAAS;MACPC,WAAW;IACb;EACF,CAAA;AAEA,OAAIN,aAAQO,eAARP,mBAAoBQ,aAAa;AACnCL,6BAAUC,oBAAoB;MAC5BI,aAAaR,QAAQO,WAAWC;IAClC,CAAA;EACF;AAEAL,2BAAUM,QAAQ,gCAAgCC,gCAAgCV,OAAAA,CAAAA;AAElF,QAAMW,SAASV,aAAaW;AAC5BD,SAAOE,MAAM,qCAAA;AAEb,QAAMC,OAAOC,WAAW;IACtB,GAAGd;IACHe,iBAAiBhB,QAAQiB;IACzBC,UAAU;MAAEC,UAAUC,WAAWD;IAAS;EAC5C,CAAA;AAEA,SAAO;IACLE,eAAeP;IACfQ,KAAKR;IACLS,MAAMT;IACNU,SAASV;EACX;AACF;AAhCgBf;;;ACJhB,SAA6B0B,cAAAA,mBAAkB;AAIxC,IAAMC,SAAS;EACpBC,KAAK;IACHC,YAAY;EACd;AACF;AASO,SAASC,wCACdC,SAA0C;AAlB5C;AAoBE,QAAMC,eAAeC,gBAAgBF,OAAAA;AAErCG,2BAAUC,oBAAoB;IAC5BC,SAAS;MACPC,WAAW;IACb;EACF,CAAA;AAEA,OAAIN,aAAQO,eAARP,mBAAoBQ,aAAa;AACnCL,6BAAUC,oBAAoB;MAC5BI,aAAaR,QAAQO,WAAWC;IAClC,CAAA;EACF;AAEAL,2BAAUM,QAAQ,gCAAgCC,gCAAgCV,OAAAA,CAAAA;AAElF,QAAMW,SAASV,aAAaW;AAC5BD,SAAOE,MAAM,uCAAA;AAEb,QAAMC,OAAOC,YAAW;IACtB,GAAGd;IACHe,iBAAiBhB,QAAQiB;EAC3B,CAAA;AAEA,SAAOH;AACT;AA5BgBf;","names":["createYoga","copilotRuntimeNextJSAppRouterEndpoint","options","commonConfig","getCommonConfig","telemetry","setGlobalProperties","runtime","framework","properties","_copilotkit","capture","getRuntimeInstanceTelemetryInfo","logger","logging","debug","yoga","createYoga","graphqlEndpoint","endpoint","fetchAPI","Response","globalThis","handleRequest","GET","POST","OPTIONS","createYoga","config","api","bodyParser","copilotRuntimeNextJSPagesRouterEndpoint","options","commonConfig","getCommonConfig","telemetry","setGlobalProperties","runtime","framework","properties","_copilotkit","capture","getRuntimeInstanceTelemetryInfo","logger","logging","debug","yoga","createYoga","graphqlEndpoint","endpoint"]}