@copilotkit/sdk-js 0.0.0-feat-dynamic-copilotcloud-qa-20250117190454

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md ADDED
@@ -0,0 +1,566 @@
1
+ # @copilotkit/sdk-js
2
+
3
+ ## 0.0.0-feat-dynamic-copilotcloud-qa-20250117190454
4
+
5
+ ### Patch Changes
6
+
7
+ - @copilotkit/shared@0.0.0-feat-dynamic-copilotcloud-qa-20250117190454
8
+
9
+ ## 1.5.12-next.2
10
+
11
+ ### Patch Changes
12
+
13
+ - @copilotkit/shared@1.5.12-next.2
14
+
15
+ ## 1.5.12-next.1
16
+
17
+ ### Patch Changes
18
+
19
+ - @copilotkit/shared@1.5.12-next.1
20
+
21
+ ## 1.5.12-next.0
22
+
23
+ ### Patch Changes
24
+
25
+ - @copilotkit/shared@1.5.12-next.0
26
+
27
+ ## 1.5.11
28
+
29
+ ### Patch Changes
30
+
31
+ - @copilotkit/shared@1.5.11
32
+
33
+ ## 1.5.11-next.0
34
+
35
+ ### Patch Changes
36
+
37
+ - @copilotkit/shared@1.5.11-next.0
38
+
39
+ ## 1.5.10
40
+
41
+ ### Patch Changes
42
+
43
+ - @copilotkit/shared@1.5.10
44
+
45
+ ## 1.5.10-next.0
46
+
47
+ ### Patch Changes
48
+
49
+ - @copilotkit/shared@1.5.10-next.0
50
+
51
+ ## 1.5.9
52
+
53
+ ### Patch Changes
54
+
55
+ - @copilotkit/shared@1.5.9
56
+
57
+ ## 1.5.8
58
+
59
+ ### Patch Changes
60
+
61
+ - @copilotkit/shared@1.5.8
62
+
63
+ ## 1.5.6-next.0
64
+
65
+ ### Patch Changes
66
+
67
+ - @copilotkit/shared@1.5.6-next.0
68
+
69
+ ## 1.5.5-next.5
70
+
71
+ ### Patch Changes
72
+
73
+ - @copilotkit/shared@1.5.5-next.5
74
+
75
+ ## 1.5.5-next.3
76
+
77
+ ### Patch Changes
78
+
79
+ - @copilotkit/shared@1.5.5-next.3
80
+
81
+ ## 1.5.5-next.2
82
+
83
+ ### Patch Changes
84
+
85
+ - @copilotkit/shared@1.5.5-next.2
86
+
87
+ ## 1.5.4
88
+
89
+ ### Patch Changes
90
+
91
+ - @copilotkit/shared@1.5.4
92
+
93
+ ## 1.5.3
94
+
95
+ ### Patch Changes
96
+
97
+ - @copilotkit/shared@1.5.3
98
+
99
+ ## 1.5.2
100
+
101
+ ### Patch Changes
102
+
103
+ - @copilotkit/shared@1.5.2
104
+
105
+ ## 1.5.1
106
+
107
+ ### Patch Changes
108
+
109
+ - 5c01e9e: test prerelease #4
110
+ - da280ed: Test prerelease script
111
+ - 27e42d7: testing a prerelease
112
+ - 05240a9: test pre #2
113
+ - 33218fe: test prerelease #3
114
+ - 03f3d6f: Test next prerelease
115
+ - Updated dependencies [5c01e9e]
116
+ - Updated dependencies [da280ed]
117
+ - Updated dependencies [27e42d7]
118
+ - Updated dependencies [05240a9]
119
+ - Updated dependencies [33218fe]
120
+ - Updated dependencies [03f3d6f]
121
+ - @copilotkit/shared@1.5.1
122
+
123
+ ## 1.5.1-next.3
124
+
125
+ ### Patch Changes
126
+
127
+ - 33218fe: test prerelease #3
128
+ - Updated dependencies [33218fe]
129
+ - @copilotkit/shared@1.5.1-next.3
130
+
131
+ ## 1.5.1-next.2
132
+
133
+ ### Patch Changes
134
+
135
+ - da280ed: Test prerelease script
136
+ - Updated dependencies [da280ed]
137
+ - @copilotkit/shared@1.5.1-next.2
138
+
139
+ ## 1.5.1-next.1
140
+
141
+ ### Patch Changes
142
+
143
+ - 03f3d6f: Test next prerelease
144
+ - Updated dependencies [03f3d6f]
145
+ - @copilotkit/shared@1.5.1-next.1
146
+
147
+ ## 1.5.1-next.0
148
+
149
+ ### Patch Changes
150
+
151
+ - 27e42d7: testing a prerelease
152
+ - Updated dependencies [27e42d7]
153
+ - @copilotkit/shared@1.5.1-next.0
154
+
155
+ ## 1.5.0
156
+
157
+ ### Minor Changes
158
+
159
+ - 1b47092: Synchronize LangGraph messages with CopilotKit
160
+
161
+ ### Patch Changes
162
+
163
+ - 1b47092: CoAgents v0.3 prerelease
164
+ - Updated dependencies [1b47092]
165
+ - Updated dependencies [1b47092]
166
+ - @copilotkit/shared@1.5.0
167
+
168
+ ## 1.5.0-coagents-v0-3.0
169
+
170
+ ### Minor Changes
171
+
172
+ - Synchronize LangGraph messages with CopilotKit
173
+
174
+ ### Patch Changes
175
+
176
+ - e66bce4: CoAgents v0.3 prerelease
177
+ - Updated dependencies
178
+ - Updated dependencies [e66bce4]
179
+ - @copilotkit/shared@1.5.0-coagents-v0-3.0
180
+
181
+ ## 1.4.8
182
+
183
+ ### Patch Changes
184
+
185
+ - - Better error handling
186
+ - Introduce new "EmptyLLMAdapter" for when using CoAgents
187
+ - Improve dev console help options
188
+ - Allow CopilotKit remote endpoint without agents
189
+ - Updated dependencies
190
+ - @copilotkit/shared@1.4.8
191
+
192
+ ## 1.4.8-next.0
193
+
194
+ ### Patch Changes
195
+
196
+ - @copilotkit/shared@1.4.8-next.0
197
+
198
+ ## 1.4.7
199
+
200
+ ### Patch Changes
201
+
202
+ - Fix broken build script before release
203
+ - Updated dependencies
204
+ - @copilotkit/shared@1.4.7
205
+
206
+ ## 1.4.6
207
+
208
+ ### Patch Changes
209
+
210
+ - .
211
+
212
+ ## 1.4.5
213
+
214
+ ### Patch Changes
215
+
216
+ - testing release workflow
217
+ - Updated dependencies
218
+ - @copilotkit/shared@1.4.5
219
+
220
+ ## 1.4.5-next.0
221
+
222
+ ### Patch Changes
223
+
224
+ - testing release workflow
225
+ - Updated dependencies
226
+ - @copilotkit/shared@1.4.5-next.0
227
+
228
+ ## 1.4.4
229
+
230
+ ### Patch Changes
231
+
232
+ - @copilotkit/shared@1.4.4
233
+
234
+ ## 1.4.4-next.4
235
+
236
+ ### Patch Changes
237
+
238
+ - @copilotkit/shared@1.4.4-next.4
239
+
240
+ ## 1.4.4-next.3
241
+
242
+ ### Patch Changes
243
+
244
+ - @copilotkit/shared@1.4.4-next.3
245
+
246
+ ## 1.4.4-next.2
247
+
248
+ ### Patch Changes
249
+
250
+ - @copilotkit/shared@1.4.4-next.2
251
+
252
+ ## 1.4.4-next.1
253
+
254
+ ### Patch Changes
255
+
256
+ - @copilotkit/shared@1.4.4-next.1
257
+
258
+ ## 1.4.4-next.0
259
+
260
+ ### Patch Changes
261
+
262
+ - @copilotkit/shared@1.4.4-next.0
263
+
264
+ ## 1.4.3
265
+
266
+ ### Patch Changes
267
+
268
+ - c296282: - Better error surfacing when using LangGraph Platform streaming
269
+ - Ensure state is immediately set without using flushSync
270
+ - - Better error surfacing when using LangGraph Platform streaming
271
+ - Ensure state is immediately set without using flushSync
272
+ - Updated dependencies [c296282]
273
+ - Updated dependencies
274
+ - @copilotkit/shared@1.4.3
275
+
276
+ ## 1.4.3-pre.0
277
+
278
+ ### Patch Changes
279
+
280
+ - - Better error surfacing when using LangGraph Platform streaming
281
+ - Ensure state is immediately set without using flushSync
282
+ - Updated dependencies
283
+ - @copilotkit/shared@1.4.3-pre.0
284
+
285
+ ## 1.4.2
286
+
287
+ ### Patch Changes
288
+
289
+ - - Make sure agent state is set immediately (#1077)
290
+ - Support running an agent without messages (#1075)
291
+ - Updated dependencies
292
+ - @copilotkit/shared@1.4.2
293
+
294
+ ## 1.4.1
295
+
296
+ ### Patch Changes
297
+
298
+ - 1721cbd: lower case copilotkit property
299
+ - 1721cbd: add zod conversion
300
+ - 8d0144f: bump
301
+ - 8d0144f: bump
302
+ - 8d0144f: bump
303
+ - e16d95e: New prerelease
304
+ - 1721cbd: Add convertActionsToDynamicStructuredTools to sdk-js
305
+ - CopilotKit Core:
306
+
307
+ - Improved error messages and overall logs
308
+ - `useCopilotAction.renderAndAwait` renamed to `.renderAndAwaitForResponse` (backwards compatible, will be deprecated in the future)
309
+ - Improved scrolling behavior. It is now possible to scroll up during LLM response generation
310
+ - Added Azure OpenAI integration
311
+ - Updated interfaces for better developer ergonomics
312
+
313
+ CoAgents:
314
+
315
+ - Renamed `remoteActions` to `remoteEndpoints` (backwards compatible, will be deprecated in the future)
316
+ - Support for LangGraph Platform in Remote Endpoints
317
+ - LangGraph JS Support for CoAgents (locally via `langgraph dev`, `langgraph up` or deployed to LangGraph Platform)
318
+ - Improved LangSmith integration - requests made through CoAgents will now surface in LangSmith
319
+ - Enhanced state management and message handling
320
+
321
+ CopilotKid Back-end SDK:
322
+
323
+ - Released a whole-new `@copilotkit/sdk-js` for building agents with LangGraph JS Support
324
+
325
+ - 8d0144f: bump
326
+ - 8d0144f: bump
327
+ - fef1b74: fix assistant message CSS and propagate actions to LG JS
328
+ - Updated dependencies [1721cbd]
329
+ - Updated dependencies [1721cbd]
330
+ - Updated dependencies [8d0144f]
331
+ - Updated dependencies [8d0144f]
332
+ - Updated dependencies [8d0144f]
333
+ - Updated dependencies [e16d95e]
334
+ - Updated dependencies [1721cbd]
335
+ - Updated dependencies
336
+ - Updated dependencies [8d0144f]
337
+ - Updated dependencies [8d0144f]
338
+ - Updated dependencies [fef1b74]
339
+ - @copilotkit/shared@1.4.1
340
+
341
+ ## 1.4.1-pre.6
342
+
343
+ ### Patch Changes
344
+
345
+ - 1721cbd: lower case copilotkit property
346
+ - 1721cbd: add zod conversion
347
+ - 1721cbd: Add convertActionsToDynamicStructuredTools to sdk-js
348
+ - fix assistant message CSS and propagate actions to LG JS
349
+ - Updated dependencies [1721cbd]
350
+ - Updated dependencies [1721cbd]
351
+ - Updated dependencies [1721cbd]
352
+ - Updated dependencies
353
+ - @copilotkit/shared@1.4.1-pre.6
354
+
355
+ ## 1.4.1-pre.5
356
+
357
+ ### Patch Changes
358
+
359
+ - bump
360
+ - Updated dependencies
361
+ - @copilotkit/shared@1.4.1-pre.5
362
+
363
+ ## 1.4.1-pre.4
364
+
365
+ ### Patch Changes
366
+
367
+ - bump
368
+ - Updated dependencies
369
+ - @copilotkit/shared@1.4.1-pre.4
370
+
371
+ ## 1.4.1-pre.3
372
+
373
+ ### Patch Changes
374
+
375
+ - bump
376
+ - Updated dependencies
377
+ - @copilotkit/shared@1.4.1-pre.3
378
+
379
+ ## 1.4.1-pre.2
380
+
381
+ ### Patch Changes
382
+
383
+ - bump
384
+ - Updated dependencies
385
+ - @copilotkit/shared@1.4.1-pre.2
386
+
387
+ ## 1.4.1-pre.1
388
+
389
+ ### Patch Changes
390
+
391
+ - bump
392
+ - Updated dependencies
393
+ - @copilotkit/shared@1.4.1-pre.1
394
+
395
+ ## 1.4.1-pre.0
396
+
397
+ ### Patch Changes
398
+
399
+ - New prerelease
400
+ - Updated dependencies
401
+ - @copilotkit/shared@1.4.1-pre.0
402
+
403
+ ## 1.4.0
404
+
405
+ ### Minor Changes
406
+
407
+ CopilotKit Core:
408
+
409
+ - Improved error messages and overall logs
410
+ - `useCopilotAction.renderAndAwait` renamed to `.renderAndAwaitForResponse` (backwards compatible, will be deprecated in the future)
411
+ - Improved scrolling behavior. It is now possible to scroll up during LLM response generation
412
+ - Added Azure OpenAI integration
413
+ - Updated interfaces for better developer ergonomics
414
+
415
+ CoAgents:
416
+
417
+ - Renamed `remoteActions` to `remoteEndpoints` (backwards compatible, will be deprecated in the future)
418
+ - Support for LangGraph Platform in Remote Endpoints
419
+ - LangGraph JS Support for CoAgents (locally via `langgraph dev`, `langgraph up` or deployed to LangGraph Platform)
420
+ - Improved LangSmith integration - requests made through CoAgents will now surface in LangSmith
421
+ - Enhanced state management and message handling
422
+
423
+ CopilotKid Back-end SDK:
424
+
425
+ - Released a whole-new `@copilotkit/sdk-js` for building agents with LangGraph JS Support
426
+
427
+ ### Patch Changes
428
+
429
+ - f6fab28: update tsup config
430
+ - f6fab28: update entry
431
+ - f6fab28: export langchain module
432
+ - f6fab28: Ensure intermediate state config is sent as snake case
433
+ - f6fab28: update entry in tsup config
434
+ - a5efccd: Revert rxjs changes
435
+ - f6fab28: update entry
436
+ - f6fab28: Update exports
437
+ - f6fab28: Update exports
438
+ - f6fab28: Export LangGraph functions
439
+ - f6fab28: Update lockfile
440
+ - Updated dependencies [f6fab28]
441
+ - Updated dependencies [f6fab28]
442
+ - Updated dependencies
443
+ - Updated dependencies [f6fab28]
444
+ - Updated dependencies [8a77944]
445
+ - Updated dependencies [f6fab28]
446
+ - Updated dependencies [f6fab28]
447
+ - Updated dependencies [8a77944]
448
+ - Updated dependencies [a5efccd]
449
+ - Updated dependencies [f6fab28]
450
+ - Updated dependencies [f6fab28]
451
+ - Updated dependencies [f6fab28]
452
+ - Updated dependencies [332d744]
453
+ - Updated dependencies [f6fab28]
454
+ - Updated dependencies [f6fab28]
455
+ - @copilotkit/shared@1.4.0
456
+
457
+ ## 1.3.16-mme-revert-rxjs-changes.10
458
+
459
+ ### Patch Changes
460
+
461
+ - f6fab28: update tsup config
462
+ - f6fab28: update entry
463
+ - f6fab28: export langchain module
464
+ - f6fab28: Ensure intermediate state config is sent as snake case
465
+ - f6fab28: update entry in tsup config
466
+ - Revert rxjs changes
467
+ - f6fab28: update entry
468
+ - f6fab28: Update exports
469
+ - f6fab28: Update exports
470
+ - f6fab28: Export LangGraph functions
471
+ - f6fab28: Update lockfile
472
+ - Updated dependencies [f6fab28]
473
+ - Updated dependencies [f6fab28]
474
+ - Updated dependencies [f6fab28]
475
+ - Updated dependencies [8a77944]
476
+ - Updated dependencies [f6fab28]
477
+ - Updated dependencies [f6fab28]
478
+ - Updated dependencies [8a77944]
479
+ - Updated dependencies
480
+ - Updated dependencies [f6fab28]
481
+ - Updated dependencies [f6fab28]
482
+ - Updated dependencies [f6fab28]
483
+ - Updated dependencies [332d744]
484
+ - Updated dependencies [f6fab28]
485
+ - Updated dependencies [f6fab28]
486
+ - @copilotkit/shared@1.3.16-mme-revert-rxjs-changes.10
487
+
488
+ ## 1.3.16-mme-lgc-langgraph-package.9
489
+
490
+ ### Patch Changes
491
+
492
+ - update entry
493
+ - Updated dependencies
494
+ - @copilotkit/shared@1.3.16-mme-lgc-langgraph-package.9
495
+
496
+ ## 1.3.16-mme-lgc-langgraph-package.8
497
+
498
+ ### Patch Changes
499
+
500
+ - update entry
501
+ - Updated dependencies
502
+ - @copilotkit/shared@1.3.16-mme-lgc-langgraph-package.8
503
+
504
+ ## 1.3.16-mme-lgc-langgraph-package.7
505
+
506
+ ### Patch Changes
507
+
508
+ - update entry in tsup config
509
+ - Updated dependencies
510
+ - @copilotkit/shared@1.3.16-mme-lgc-langgraph-package.7
511
+
512
+ ## 1.3.16-mme-lgc-langgraph-package.6
513
+
514
+ ### Patch Changes
515
+
516
+ - Update exports
517
+ - Updated dependencies
518
+ - @copilotkit/shared@1.3.16-mme-lgc-langgraph-package.6
519
+
520
+ ## 1.3.16-mme-lgc-langgraph-package.5
521
+
522
+ ### Patch Changes
523
+
524
+ - update tsup config
525
+ - Updated dependencies
526
+ - @copilotkit/shared@1.3.16-mme-lgc-langgraph-package.5
527
+
528
+ ## 1.3.16-mme-lgc-langgraph-package.4
529
+
530
+ ### Patch Changes
531
+
532
+ - Update exports
533
+ - Updated dependencies
534
+ - @copilotkit/shared@1.3.16-mme-lgc-langgraph-package.4
535
+
536
+ ## 1.3.16-mme-lgc-langgraph-package.3
537
+
538
+ ### Patch Changes
539
+
540
+ - export langchain module
541
+ - Updated dependencies
542
+ - @copilotkit/shared@1.3.16-mme-lgc-langgraph-package.3
543
+
544
+ ## 1.3.16-mme-sdk-js.2
545
+
546
+ ### Patch Changes
547
+
548
+ - Ensure intermediate state config is sent as snake case
549
+ - Updated dependencies
550
+ - @copilotkit/shared@1.3.16-mme-sdk-js.2
551
+
552
+ ## 1.3.16-mme-sdk-js.1
553
+
554
+ ### Patch Changes
555
+
556
+ - Update lockfile
557
+ - Updated dependencies
558
+ - @copilotkit/shared@1.3.16-mme-sdk-js.1
559
+
560
+ ## 1.3.16-mme-sdk-js.0
561
+
562
+ ### Patch Changes
563
+
564
+ - Export LangGraph functions
565
+ - Updated dependencies
566
+ - @copilotkit/shared@1.3.16-mme-sdk-js.0
package/README.md ADDED
@@ -0,0 +1,46 @@
1
+ <div align="center">
2
+ <a href="https://copilotkit.ai" target="_blank">
3
+ <img src="https://github.com/copilotkit/copilotkit/raw/main/assets/banner.png" alt="CopilotKit Logo">
4
+ </a>
5
+
6
+ <br/>
7
+
8
+ <strong>
9
+ CopilotKit is the open-source framework for integrating powerful AI Copilots into any application. Easily implement custom AI Chatbots, AI Agents, AI Textareas, and more.
10
+ </strong>
11
+ </div>
12
+
13
+ <br/>
14
+
15
+ <div align="center">
16
+ <a href="https://www.npmjs.com/package/@copilotkit/react-core" target="_blank">
17
+ <img src="https://img.shields.io/npm/v/%40copilotkit%2Freact-core?logo=npm&logoColor=%23FFFFFF&label=Version&color=%236963ff" alt="NPM">
18
+ </a>
19
+ <img src="https://img.shields.io/github/license/copilotkit/copilotkit?color=%236963ff&label=License" alt="MIT">
20
+ <a href="https://discord.gg/6dffbvGU3D" target="_blank">
21
+ <img src="https://img.shields.io/discord/1122926057641742418?logo=discord&logoColor=%23FFFFFF&label=Discord&color=%236963ff" alt="Discord">
22
+ </a>
23
+ </div>
24
+ <br/>
25
+
26
+ <div align="center">
27
+ <a href="https://discord.gg/6dffbvGU3D?ref=github_readme" target="_blank">
28
+ <img src="https://github.com/copilotkit/copilotkit/raw/main/assets/btn_discord.png" alt="CopilotKit Discord" height="40px">
29
+ </a>
30
+ <a href="https://docs.copilotkit.ai?ref=github_readme" target="_blank">
31
+ <img src="https://github.com/copilotkit/copilotkit/raw/main/assets/btn_docs.png" alt="CopilotKit GitHub" height="40px">
32
+ </a>
33
+ <a href="https://cloud.copilotkit.ai?ref=github_readme" target="_blank">
34
+ <img src="https://github.com/copilotkit/copilotkit/raw/main/assets/btn_cloud.png" alt="CopilotKit GitHub" height="40px">
35
+ </a>
36
+ </div>
37
+
38
+ <br />
39
+
40
+ <div align="center">
41
+ <img src="https://github.com/CopilotKit/CopilotKit/raw/main/assets/animated-banner.gif" alt="CopilotKit Screenshot" style="border-radius: 15px;" />
42
+ </div>
43
+
44
+ # Documentation
45
+
46
+ To get started with CopilotKit, please check out the [documentation](https://docs.copilotkit.ai).
@@ -0,0 +1,2 @@
1
+
2
+ export { }
package/dist/index.js ADDED
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
package/dist/index.mjs ADDED
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,73 @@
1
+ import * as zod from 'zod';
2
+ import * as _langchain_core_messages from '@langchain/core/messages';
3
+ import * as _langchain_langgraph from '@langchain/langgraph';
4
+ import { RunnableConfig } from '@langchain/core/runnables';
5
+ import { DynamicStructuredTool } from '@langchain/core/tools';
6
+
7
+ interface IntermediateStateConfig {
8
+ stateKey: string;
9
+ tool: string;
10
+ toolArgument?: string;
11
+ }
12
+ interface OptionsConfig {
13
+ emitToolCalls?: boolean | string | string[];
14
+ emitMessages?: boolean;
15
+ emitAll?: boolean;
16
+ emitIntermediateState?: IntermediateStateConfig[];
17
+ }
18
+ declare const CopilotKitPropertiesAnnotation: _langchain_langgraph._INTERNAL_ANNOTATION_ROOT<{
19
+ actions: {
20
+ (): _langchain_langgraph.LastValue<any[]>;
21
+ (annotation: _langchain_langgraph.SingleReducer<any[], any[]>): _langchain_langgraph.BinaryOperatorAggregate<any[], any[]>;
22
+ Root: <S extends _langchain_langgraph.StateDefinition>(sd: S) => _langchain_langgraph._INTERNAL_ANNOTATION_ROOT<S>;
23
+ };
24
+ }>;
25
+ declare const CopilotKitStateAnnotation: _langchain_langgraph._INTERNAL_ANNOTATION_ROOT<{
26
+ messages: _langchain_langgraph.BinaryOperatorAggregate<_langchain_core_messages.BaseMessage[], _langchain_langgraph.Messages>;
27
+ copilotkit: {
28
+ (): _langchain_langgraph.LastValue<_langchain_langgraph.StateType<{
29
+ actions: {
30
+ (): _langchain_langgraph.LastValue<any[]>;
31
+ (annotation: _langchain_langgraph.SingleReducer<any[], any[]>): _langchain_langgraph.BinaryOperatorAggregate<any[], any[]>;
32
+ Root: <S extends _langchain_langgraph.StateDefinition>(sd: S) => _langchain_langgraph._INTERNAL_ANNOTATION_ROOT<S>;
33
+ };
34
+ }>>;
35
+ (annotation: _langchain_langgraph.SingleReducer<_langchain_langgraph.StateType<{
36
+ actions: {
37
+ (): _langchain_langgraph.LastValue<any[]>;
38
+ (annotation: _langchain_langgraph.SingleReducer<any[], any[]>): _langchain_langgraph.BinaryOperatorAggregate<any[], any[]>;
39
+ Root: <S extends _langchain_langgraph.StateDefinition>(sd: S) => _langchain_langgraph._INTERNAL_ANNOTATION_ROOT<S>;
40
+ };
41
+ }>, _langchain_langgraph.StateType<{
42
+ actions: {
43
+ (): _langchain_langgraph.LastValue<any[]>;
44
+ (annotation: _langchain_langgraph.SingleReducer<any[], any[]>): _langchain_langgraph.BinaryOperatorAggregate<any[], any[]>;
45
+ Root: <S extends _langchain_langgraph.StateDefinition>(sd: S) => _langchain_langgraph._INTERNAL_ANNOTATION_ROOT<S>;
46
+ };
47
+ }>>): _langchain_langgraph.BinaryOperatorAggregate<_langchain_langgraph.StateType<{
48
+ actions: {
49
+ (): _langchain_langgraph.LastValue<any[]>;
50
+ (annotation: _langchain_langgraph.SingleReducer<any[], any[]>): _langchain_langgraph.BinaryOperatorAggregate<any[], any[]>;
51
+ Root: <S extends _langchain_langgraph.StateDefinition>(sd: S) => _langchain_langgraph._INTERNAL_ANNOTATION_ROOT<S>;
52
+ };
53
+ }>, _langchain_langgraph.StateType<{
54
+ actions: {
55
+ (): _langchain_langgraph.LastValue<any[]>;
56
+ (annotation: _langchain_langgraph.SingleReducer<any[], any[]>): _langchain_langgraph.BinaryOperatorAggregate<any[], any[]>;
57
+ Root: <S extends _langchain_langgraph.StateDefinition>(sd: S) => _langchain_langgraph._INTERNAL_ANNOTATION_ROOT<S>;
58
+ };
59
+ }>>;
60
+ Root: <S extends _langchain_langgraph.StateDefinition>(sd: S) => _langchain_langgraph._INTERNAL_ANNOTATION_ROOT<S>;
61
+ };
62
+ }>;
63
+ type CopilotKitState = typeof CopilotKitStateAnnotation.State;
64
+ type CopilotKitProperties = typeof CopilotKitPropertiesAnnotation.State;
65
+ declare function copilotKitCustomizeConfig(baseConfig: RunnableConfig, options?: OptionsConfig): RunnableConfig;
66
+ declare function copilotKitExit(config: RunnableConfig): Promise<void>;
67
+ declare function copilotKitEmitState(config: RunnableConfig, state: any): Promise<void>;
68
+ declare function copilotKitEmitMessage(config: RunnableConfig, message: string): Promise<void>;
69
+ declare function copilotKitEmitToolCall(config: RunnableConfig, name: string, args: any): Promise<void>;
70
+ declare function convertActionToDynamicStructuredTool(actionInput: any): DynamicStructuredTool<zod.ZodType<any, zod.ZodTypeDef, any>>;
71
+ declare function convertActionsToDynamicStructuredTools(actions: any[]): DynamicStructuredTool<zod.ZodType<any, zod.ZodTypeDef, any>>[];
72
+
73
+ export { CopilotKitProperties, CopilotKitPropertiesAnnotation, CopilotKitState, CopilotKitStateAnnotation, convertActionToDynamicStructuredTool, convertActionsToDynamicStructuredTools, copilotKitCustomizeConfig, copilotKitEmitMessage, copilotKitEmitState, copilotKitEmitToolCall, copilotKitExit };
@@ -0,0 +1,124 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/langchain.ts
21
+ var langchain_exports = {};
22
+ __export(langchain_exports, {
23
+ CopilotKitPropertiesAnnotation: () => CopilotKitPropertiesAnnotation,
24
+ CopilotKitStateAnnotation: () => CopilotKitStateAnnotation,
25
+ convertActionToDynamicStructuredTool: () => convertActionToDynamicStructuredTool,
26
+ convertActionsToDynamicStructuredTools: () => convertActionsToDynamicStructuredTools,
27
+ copilotKitCustomizeConfig: () => copilotKitCustomizeConfig,
28
+ copilotKitEmitMessage: () => copilotKitEmitMessage,
29
+ copilotKitEmitState: () => copilotKitEmitState,
30
+ copilotKitEmitToolCall: () => copilotKitEmitToolCall,
31
+ copilotKitExit: () => copilotKitExit
32
+ });
33
+ module.exports = __toCommonJS(langchain_exports);
34
+ var import_dispatch = require("@langchain/core/callbacks/dispatch");
35
+ var import_shared = require("@copilotkit/shared");
36
+ var import_langgraph = require("@langchain/langgraph");
37
+ var import_tools = require("@langchain/core/tools");
38
+ var CopilotKitPropertiesAnnotation = import_langgraph.Annotation.Root({
39
+ actions: import_langgraph.Annotation
40
+ });
41
+ var CopilotKitStateAnnotation = import_langgraph.Annotation.Root({
42
+ copilotkit: import_langgraph.Annotation,
43
+ ...import_langgraph.MessagesAnnotation.spec
44
+ });
45
+ function copilotKitCustomizeConfig(baseConfig, options) {
46
+ const metadata = (baseConfig == null ? void 0 : baseConfig.metadata) || {};
47
+ if (options == null ? void 0 : options.emitAll) {
48
+ metadata["copilotkit:emit-tool-calls"] = true;
49
+ metadata["copilotkit:emit-messages"] = true;
50
+ } else {
51
+ if ((options == null ? void 0 : options.emitToolCalls) !== void 0) {
52
+ metadata["copilotkit:emit-tool-calls"] = options.emitToolCalls;
53
+ }
54
+ if ((options == null ? void 0 : options.emitMessages) !== void 0) {
55
+ metadata["copilotkit:emit-messages"] = options.emitMessages;
56
+ }
57
+ }
58
+ if (options == null ? void 0 : options.emitIntermediateState) {
59
+ const snakeCaseIntermediateState = options.emitIntermediateState.map((state) => ({
60
+ tool: state.tool,
61
+ tool_argument: state.toolArgument,
62
+ state_key: state.stateKey
63
+ }));
64
+ metadata["copilotkit:emit-intermediate-state"] = snakeCaseIntermediateState;
65
+ }
66
+ baseConfig = baseConfig || {};
67
+ return {
68
+ ...baseConfig,
69
+ metadata
70
+ };
71
+ }
72
+ __name(copilotKitCustomizeConfig, "copilotKitCustomizeConfig");
73
+ async function copilotKitExit(config) {
74
+ await (0, import_dispatch.dispatchCustomEvent)("copilotkit_exit", {}, config);
75
+ }
76
+ __name(copilotKitExit, "copilotKitExit");
77
+ async function copilotKitEmitState(config, state) {
78
+ await (0, import_dispatch.dispatchCustomEvent)("copilotkit_manually_emit_intermediate_state", state, config);
79
+ }
80
+ __name(copilotKitEmitState, "copilotKitEmitState");
81
+ async function copilotKitEmitMessage(config, message) {
82
+ await (0, import_dispatch.dispatchCustomEvent)("copilotkit_manually_emit_message", {
83
+ message,
84
+ message_id: (0, import_shared.randomId)(),
85
+ role: "assistant"
86
+ }, config);
87
+ }
88
+ __name(copilotKitEmitMessage, "copilotKitEmitMessage");
89
+ async function copilotKitEmitToolCall(config, name, args) {
90
+ await (0, import_dispatch.dispatchCustomEvent)("copilotkit_manually_emit_tool_call", {
91
+ name,
92
+ args,
93
+ id: (0, import_shared.randomId)()
94
+ }, config);
95
+ }
96
+ __name(copilotKitEmitToolCall, "copilotKitEmitToolCall");
97
+ function convertActionToDynamicStructuredTool(actionInput) {
98
+ return new import_tools.DynamicStructuredTool({
99
+ name: actionInput.name,
100
+ description: actionInput.description,
101
+ schema: (0, import_shared.convertJsonSchemaToZodSchema)(actionInput.parameters, true),
102
+ func: async () => {
103
+ return "";
104
+ }
105
+ });
106
+ }
107
+ __name(convertActionToDynamicStructuredTool, "convertActionToDynamicStructuredTool");
108
+ function convertActionsToDynamicStructuredTools(actions) {
109
+ return actions.map((action) => convertActionToDynamicStructuredTool(action));
110
+ }
111
+ __name(convertActionsToDynamicStructuredTools, "convertActionsToDynamicStructuredTools");
112
+ // Annotate the CommonJS export names for ESM import in node:
113
+ 0 && (module.exports = {
114
+ CopilotKitPropertiesAnnotation,
115
+ CopilotKitStateAnnotation,
116
+ convertActionToDynamicStructuredTool,
117
+ convertActionsToDynamicStructuredTools,
118
+ copilotKitCustomizeConfig,
119
+ copilotKitEmitMessage,
120
+ copilotKitEmitState,
121
+ copilotKitEmitToolCall,
122
+ copilotKitExit
123
+ });
124
+ //# sourceMappingURL=langchain.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/langchain.ts"],"sourcesContent":["import { RunnableConfig } from \"@langchain/core/runnables\";\nimport { dispatchCustomEvent } from \"@langchain/core/callbacks/dispatch\";\nimport { convertJsonSchemaToZodSchema, randomId } from \"@copilotkit/shared\";\nimport { Annotation, MessagesAnnotation } from \"@langchain/langgraph\";\nimport { DynamicStructuredTool } from \"@langchain/core/tools\";\n\ninterface IntermediateStateConfig {\n stateKey: string;\n tool: string;\n toolArgument?: string;\n}\n\ninterface OptionsConfig {\n emitToolCalls?: boolean | string | string[];\n emitMessages?: boolean;\n emitAll?: boolean;\n emitIntermediateState?: IntermediateStateConfig[];\n}\n\nexport const CopilotKitPropertiesAnnotation = Annotation.Root({\n actions: Annotation<any[]>,\n});\n\nexport const CopilotKitStateAnnotation = Annotation.Root({\n copilotkit: Annotation<typeof CopilotKitPropertiesAnnotation.State>,\n ...MessagesAnnotation.spec,\n});\n\nexport type CopilotKitState = typeof CopilotKitStateAnnotation.State;\nexport type CopilotKitProperties = typeof CopilotKitPropertiesAnnotation.State;\n\nexport function copilotKitCustomizeConfig(\n baseConfig: RunnableConfig,\n options?: OptionsConfig,\n): RunnableConfig {\n const metadata = baseConfig?.metadata || {};\n\n if (options?.emitAll) {\n metadata[\"copilotkit:emit-tool-calls\"] = true;\n metadata[\"copilotkit:emit-messages\"] = true;\n } else {\n if (options?.emitToolCalls !== undefined) {\n metadata[\"copilotkit:emit-tool-calls\"] = options.emitToolCalls;\n }\n if (options?.emitMessages !== undefined) {\n metadata[\"copilotkit:emit-messages\"] = options.emitMessages;\n }\n }\n\n if (options?.emitIntermediateState) {\n const snakeCaseIntermediateState = options.emitIntermediateState.map((state) => ({\n tool: state.tool,\n tool_argument: state.toolArgument,\n state_key: state.stateKey,\n }));\n\n metadata[\"copilotkit:emit-intermediate-state\"] = snakeCaseIntermediateState;\n }\n\n baseConfig = baseConfig || {};\n\n return {\n ...baseConfig,\n metadata: metadata,\n };\n}\n\nexport async function copilotKitExit(config: RunnableConfig) {\n await dispatchCustomEvent(\"copilotkit_exit\", {}, config);\n}\n\nexport async function copilotKitEmitState(config: RunnableConfig, state: any) {\n await dispatchCustomEvent(\"copilotkit_manually_emit_intermediate_state\", state, config);\n}\n\nexport async function copilotKitEmitMessage(config: RunnableConfig, message: string) {\n await dispatchCustomEvent(\n \"copilotkit_manually_emit_message\",\n { message, message_id: randomId(), role: \"assistant\" },\n config,\n );\n}\n\nexport async function copilotKitEmitToolCall(config: RunnableConfig, name: string, args: any) {\n await dispatchCustomEvent(\n \"copilotkit_manually_emit_tool_call\",\n { name, args, id: randomId() },\n config,\n );\n}\n\nexport function convertActionToDynamicStructuredTool(actionInput: any) {\n return new DynamicStructuredTool({\n name: actionInput.name,\n description: actionInput.description,\n schema: convertJsonSchemaToZodSchema(actionInput.parameters, true),\n func: async () => {\n return \"\";\n },\n });\n}\n\nexport function convertActionsToDynamicStructuredTools(actions: any[]) {\n return actions.map((action) => convertActionToDynamicStructuredTool(action));\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AACA;;;;;;;;;;;;;sBAAoC;AACpC,oBAAuD;AACvD,uBAA+C;AAC/C,mBAAsC;AAe/B,IAAMA,iCAAiCC,4BAAWC,KAAK;EAC5DC,SAASF;AACX,CAAA;AAEO,IAAMG,4BAA4BH,4BAAWC,KAAK;EACvDG,YAAYJ;EACZ,GAAGK,oCAAmBC;AACxB,CAAA;AAKO,SAASC,0BACdC,YACAC,SAAuB;AAEvB,QAAMC,YAAWF,yCAAYE,aAAY,CAAC;AAE1C,MAAID,mCAASE,SAAS;AACpBD,aAAS,4BAAA,IAAgC;AACzCA,aAAS,0BAAA,IAA8B;EACzC,OAAO;AACL,SAAID,mCAASG,mBAAkBC,QAAW;AACxCH,eAAS,4BAAA,IAAgCD,QAAQG;IACnD;AACA,SAAIH,mCAASK,kBAAiBD,QAAW;AACvCH,eAAS,0BAAA,IAA8BD,QAAQK;IACjD;EACF;AAEA,MAAIL,mCAASM,uBAAuB;AAClC,UAAMC,6BAA6BP,QAAQM,sBAAsBE,IAAI,CAACC,WAAW;MAC/EC,MAAMD,MAAMC;MACZC,eAAeF,MAAMG;MACrBC,WAAWJ,MAAMK;IACnB,EAAA;AAEAb,aAAS,oCAAA,IAAwCM;EACnD;AAEAR,eAAaA,cAAc,CAAC;AAE5B,SAAO;IACL,GAAGA;IACHE;EACF;AACF;AAlCgBH;AAoChB,eAAsBiB,eAAeC,QAAsB;AACzD,YAAMC,qCAAoB,mBAAmB,CAAC,GAAGD,MAAAA;AACnD;AAFsBD;AAItB,eAAsBG,oBAAoBF,QAAwBP,OAAU;AAC1E,YAAMQ,qCAAoB,+CAA+CR,OAAOO,MAAAA;AAClF;AAFsBE;AAItB,eAAsBC,sBAAsBH,QAAwBI,SAAe;AACjF,YAAMH,qCACJ,oCACA;IAAEG;IAASC,gBAAYC,wBAAAA;IAAYC,MAAM;EAAY,GACrDP,MAAAA;AAEJ;AANsBG;AAQtB,eAAsBK,uBAAuBR,QAAwBS,MAAcC,MAAS;AAC1F,YAAMT,qCACJ,sCACA;IAAEQ;IAAMC;IAAMC,QAAIL,wBAAAA;EAAW,GAC7BN,MAAAA;AAEJ;AANsBQ;AAQf,SAASI,qCAAqCC,aAAgB;AACnE,SAAO,IAAIC,mCAAsB;IAC/BL,MAAMI,YAAYJ;IAClBM,aAAaF,YAAYE;IACzBC,YAAQC,4CAA6BJ,YAAYK,YAAY,IAAA;IAC7DC,MAAM,YAAA;AACJ,aAAO;IACT;EACF,CAAA;AACF;AATgBP;AAWT,SAASQ,uCAAuC3C,SAAc;AACnE,SAAOA,QAAQe,IAAI,CAAC6B,WAAWT,qCAAqCS,MAAAA,CAAAA;AACtE;AAFgBD;","names":["CopilotKitPropertiesAnnotation","Annotation","Root","actions","CopilotKitStateAnnotation","copilotkit","MessagesAnnotation","spec","copilotKitCustomizeConfig","baseConfig","options","metadata","emitAll","emitToolCalls","undefined","emitMessages","emitIntermediateState","snakeCaseIntermediateState","map","state","tool","tool_argument","toolArgument","state_key","stateKey","copilotKitExit","config","dispatchCustomEvent","copilotKitEmitState","copilotKitEmitMessage","message","message_id","randomId","role","copilotKitEmitToolCall","name","args","id","convertActionToDynamicStructuredTool","actionInput","DynamicStructuredTool","description","schema","convertJsonSchemaToZodSchema","parameters","func","convertActionsToDynamicStructuredTools","action"]}
@@ -0,0 +1,94 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+
4
+ // src/langchain.ts
5
+ import { dispatchCustomEvent } from "@langchain/core/callbacks/dispatch";
6
+ import { convertJsonSchemaToZodSchema, randomId } from "@copilotkit/shared";
7
+ import { Annotation, MessagesAnnotation } from "@langchain/langgraph";
8
+ import { DynamicStructuredTool } from "@langchain/core/tools";
9
+ var CopilotKitPropertiesAnnotation = Annotation.Root({
10
+ actions: Annotation
11
+ });
12
+ var CopilotKitStateAnnotation = Annotation.Root({
13
+ copilotkit: Annotation,
14
+ ...MessagesAnnotation.spec
15
+ });
16
+ function copilotKitCustomizeConfig(baseConfig, options) {
17
+ const metadata = (baseConfig == null ? void 0 : baseConfig.metadata) || {};
18
+ if (options == null ? void 0 : options.emitAll) {
19
+ metadata["copilotkit:emit-tool-calls"] = true;
20
+ metadata["copilotkit:emit-messages"] = true;
21
+ } else {
22
+ if ((options == null ? void 0 : options.emitToolCalls) !== void 0) {
23
+ metadata["copilotkit:emit-tool-calls"] = options.emitToolCalls;
24
+ }
25
+ if ((options == null ? void 0 : options.emitMessages) !== void 0) {
26
+ metadata["copilotkit:emit-messages"] = options.emitMessages;
27
+ }
28
+ }
29
+ if (options == null ? void 0 : options.emitIntermediateState) {
30
+ const snakeCaseIntermediateState = options.emitIntermediateState.map((state) => ({
31
+ tool: state.tool,
32
+ tool_argument: state.toolArgument,
33
+ state_key: state.stateKey
34
+ }));
35
+ metadata["copilotkit:emit-intermediate-state"] = snakeCaseIntermediateState;
36
+ }
37
+ baseConfig = baseConfig || {};
38
+ return {
39
+ ...baseConfig,
40
+ metadata
41
+ };
42
+ }
43
+ __name(copilotKitCustomizeConfig, "copilotKitCustomizeConfig");
44
+ async function copilotKitExit(config) {
45
+ await dispatchCustomEvent("copilotkit_exit", {}, config);
46
+ }
47
+ __name(copilotKitExit, "copilotKitExit");
48
+ async function copilotKitEmitState(config, state) {
49
+ await dispatchCustomEvent("copilotkit_manually_emit_intermediate_state", state, config);
50
+ }
51
+ __name(copilotKitEmitState, "copilotKitEmitState");
52
+ async function copilotKitEmitMessage(config, message) {
53
+ await dispatchCustomEvent("copilotkit_manually_emit_message", {
54
+ message,
55
+ message_id: randomId(),
56
+ role: "assistant"
57
+ }, config);
58
+ }
59
+ __name(copilotKitEmitMessage, "copilotKitEmitMessage");
60
+ async function copilotKitEmitToolCall(config, name, args) {
61
+ await dispatchCustomEvent("copilotkit_manually_emit_tool_call", {
62
+ name,
63
+ args,
64
+ id: randomId()
65
+ }, config);
66
+ }
67
+ __name(copilotKitEmitToolCall, "copilotKitEmitToolCall");
68
+ function convertActionToDynamicStructuredTool(actionInput) {
69
+ return new DynamicStructuredTool({
70
+ name: actionInput.name,
71
+ description: actionInput.description,
72
+ schema: convertJsonSchemaToZodSchema(actionInput.parameters, true),
73
+ func: async () => {
74
+ return "";
75
+ }
76
+ });
77
+ }
78
+ __name(convertActionToDynamicStructuredTool, "convertActionToDynamicStructuredTool");
79
+ function convertActionsToDynamicStructuredTools(actions) {
80
+ return actions.map((action) => convertActionToDynamicStructuredTool(action));
81
+ }
82
+ __name(convertActionsToDynamicStructuredTools, "convertActionsToDynamicStructuredTools");
83
+ export {
84
+ CopilotKitPropertiesAnnotation,
85
+ CopilotKitStateAnnotation,
86
+ convertActionToDynamicStructuredTool,
87
+ convertActionsToDynamicStructuredTools,
88
+ copilotKitCustomizeConfig,
89
+ copilotKitEmitMessage,
90
+ copilotKitEmitState,
91
+ copilotKitEmitToolCall,
92
+ copilotKitExit
93
+ };
94
+ //# sourceMappingURL=langchain.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/langchain.ts"],"sourcesContent":["import { RunnableConfig } from \"@langchain/core/runnables\";\nimport { dispatchCustomEvent } from \"@langchain/core/callbacks/dispatch\";\nimport { convertJsonSchemaToZodSchema, randomId } from \"@copilotkit/shared\";\nimport { Annotation, MessagesAnnotation } from \"@langchain/langgraph\";\nimport { DynamicStructuredTool } from \"@langchain/core/tools\";\n\ninterface IntermediateStateConfig {\n stateKey: string;\n tool: string;\n toolArgument?: string;\n}\n\ninterface OptionsConfig {\n emitToolCalls?: boolean | string | string[];\n emitMessages?: boolean;\n emitAll?: boolean;\n emitIntermediateState?: IntermediateStateConfig[];\n}\n\nexport const CopilotKitPropertiesAnnotation = Annotation.Root({\n actions: Annotation<any[]>,\n});\n\nexport const CopilotKitStateAnnotation = Annotation.Root({\n copilotkit: Annotation<typeof CopilotKitPropertiesAnnotation.State>,\n ...MessagesAnnotation.spec,\n});\n\nexport type CopilotKitState = typeof CopilotKitStateAnnotation.State;\nexport type CopilotKitProperties = typeof CopilotKitPropertiesAnnotation.State;\n\nexport function copilotKitCustomizeConfig(\n baseConfig: RunnableConfig,\n options?: OptionsConfig,\n): RunnableConfig {\n const metadata = baseConfig?.metadata || {};\n\n if (options?.emitAll) {\n metadata[\"copilotkit:emit-tool-calls\"] = true;\n metadata[\"copilotkit:emit-messages\"] = true;\n } else {\n if (options?.emitToolCalls !== undefined) {\n metadata[\"copilotkit:emit-tool-calls\"] = options.emitToolCalls;\n }\n if (options?.emitMessages !== undefined) {\n metadata[\"copilotkit:emit-messages\"] = options.emitMessages;\n }\n }\n\n if (options?.emitIntermediateState) {\n const snakeCaseIntermediateState = options.emitIntermediateState.map((state) => ({\n tool: state.tool,\n tool_argument: state.toolArgument,\n state_key: state.stateKey,\n }));\n\n metadata[\"copilotkit:emit-intermediate-state\"] = snakeCaseIntermediateState;\n }\n\n baseConfig = baseConfig || {};\n\n return {\n ...baseConfig,\n metadata: metadata,\n };\n}\n\nexport async function copilotKitExit(config: RunnableConfig) {\n await dispatchCustomEvent(\"copilotkit_exit\", {}, config);\n}\n\nexport async function copilotKitEmitState(config: RunnableConfig, state: any) {\n await dispatchCustomEvent(\"copilotkit_manually_emit_intermediate_state\", state, config);\n}\n\nexport async function copilotKitEmitMessage(config: RunnableConfig, message: string) {\n await dispatchCustomEvent(\n \"copilotkit_manually_emit_message\",\n { message, message_id: randomId(), role: \"assistant\" },\n config,\n );\n}\n\nexport async function copilotKitEmitToolCall(config: RunnableConfig, name: string, args: any) {\n await dispatchCustomEvent(\n \"copilotkit_manually_emit_tool_call\",\n { name, args, id: randomId() },\n config,\n );\n}\n\nexport function convertActionToDynamicStructuredTool(actionInput: any) {\n return new DynamicStructuredTool({\n name: actionInput.name,\n description: actionInput.description,\n schema: convertJsonSchemaToZodSchema(actionInput.parameters, true),\n func: async () => {\n return \"\";\n },\n });\n}\n\nexport function convertActionsToDynamicStructuredTools(actions: any[]) {\n return actions.map((action) => convertActionToDynamicStructuredTool(action));\n}\n"],"mappings":";;;;AACA,SAASA,2BAA2B;AACpC,SAASC,8BAA8BC,gBAAgB;AACvD,SAASC,YAAYC,0BAA0B;AAC/C,SAASC,6BAA6B;AAe/B,IAAMC,iCAAiCC,WAAWC,KAAK;EAC5DC,SAASF;AACX,CAAA;AAEO,IAAMG,4BAA4BH,WAAWC,KAAK;EACvDG,YAAYJ;EACZ,GAAGK,mBAAmBC;AACxB,CAAA;AAKO,SAASC,0BACdC,YACAC,SAAuB;AAEvB,QAAMC,YAAWF,yCAAYE,aAAY,CAAC;AAE1C,MAAID,mCAASE,SAAS;AACpBD,aAAS,4BAAA,IAAgC;AACzCA,aAAS,0BAAA,IAA8B;EACzC,OAAO;AACL,SAAID,mCAASG,mBAAkBC,QAAW;AACxCH,eAAS,4BAAA,IAAgCD,QAAQG;IACnD;AACA,SAAIH,mCAASK,kBAAiBD,QAAW;AACvCH,eAAS,0BAAA,IAA8BD,QAAQK;IACjD;EACF;AAEA,MAAIL,mCAASM,uBAAuB;AAClC,UAAMC,6BAA6BP,QAAQM,sBAAsBE,IAAI,CAACC,WAAW;MAC/EC,MAAMD,MAAMC;MACZC,eAAeF,MAAMG;MACrBC,WAAWJ,MAAMK;IACnB,EAAA;AAEAb,aAAS,oCAAA,IAAwCM;EACnD;AAEAR,eAAaA,cAAc,CAAC;AAE5B,SAAO;IACL,GAAGA;IACHE;EACF;AACF;AAlCgBH;AAoChB,eAAsBiB,eAAeC,QAAsB;AACzD,QAAMC,oBAAoB,mBAAmB,CAAC,GAAGD,MAAAA;AACnD;AAFsBD;AAItB,eAAsBG,oBAAoBF,QAAwBP,OAAU;AAC1E,QAAMQ,oBAAoB,+CAA+CR,OAAOO,MAAAA;AAClF;AAFsBE;AAItB,eAAsBC,sBAAsBH,QAAwBI,SAAe;AACjF,QAAMH,oBACJ,oCACA;IAAEG;IAASC,YAAYC,SAAAA;IAAYC,MAAM;EAAY,GACrDP,MAAAA;AAEJ;AANsBG;AAQtB,eAAsBK,uBAAuBR,QAAwBS,MAAcC,MAAS;AAC1F,QAAMT,oBACJ,sCACA;IAAEQ;IAAMC;IAAMC,IAAIL,SAAAA;EAAW,GAC7BN,MAAAA;AAEJ;AANsBQ;AAQf,SAASI,qCAAqCC,aAAgB;AACnE,SAAO,IAAIC,sBAAsB;IAC/BL,MAAMI,YAAYJ;IAClBM,aAAaF,YAAYE;IACzBC,QAAQC,6BAA6BJ,YAAYK,YAAY,IAAA;IAC7DC,MAAM,YAAA;AACJ,aAAO;IACT;EACF,CAAA;AACF;AATgBP;AAWT,SAASQ,uCAAuC3C,SAAc;AACnE,SAAOA,QAAQe,IAAI,CAAC6B,WAAWT,qCAAqCS,MAAAA,CAAAA;AACtE;AAFgBD;","names":["dispatchCustomEvent","convertJsonSchemaToZodSchema","randomId","Annotation","MessagesAnnotation","DynamicStructuredTool","CopilotKitPropertiesAnnotation","Annotation","Root","actions","CopilotKitStateAnnotation","copilotkit","MessagesAnnotation","spec","copilotKitCustomizeConfig","baseConfig","options","metadata","emitAll","emitToolCalls","undefined","emitMessages","emitIntermediateState","snakeCaseIntermediateState","map","state","tool","tool_argument","toolArgument","state_key","stateKey","copilotKitExit","config","dispatchCustomEvent","copilotKitEmitState","copilotKitEmitMessage","message","message_id","randomId","role","copilotKitEmitToolCall","name","args","id","convertActionToDynamicStructuredTool","actionInput","DynamicStructuredTool","description","schema","convertJsonSchemaToZodSchema","parameters","func","convertActionsToDynamicStructuredTools","action"]}
package/jest.config.js ADDED
@@ -0,0 +1,5 @@
1
+ /** @type {import('ts-jest').JestConfigWithTsJest} */
2
+ module.exports = {
3
+ preset: 'ts-jest',
4
+ testEnvironment: 'node',
5
+ };
package/package.json ADDED
@@ -0,0 +1,85 @@
1
+ {
2
+ "name": "@copilotkit/sdk-js",
3
+ "private": false,
4
+ "homepage": "https://github.com/CopilotKit/CopilotKit",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "https://github.com/CopilotKit/CopilotKit.git"
8
+ },
9
+ "publishConfig": {
10
+ "access": "public"
11
+ },
12
+ "version": "0.0.0-feat-dynamic-copilotcloud-qa-20250117190454",
13
+ "sideEffects": false,
14
+ "main": "./dist/index.js",
15
+ "module": "./dist/index.mjs",
16
+ "exports": {
17
+ ".": {
18
+ "require": "./dist/index.js",
19
+ "import": "./dist/index.mjs"
20
+ },
21
+ "./langchain": {
22
+ "require": "./dist/langchain.js",
23
+ "import": "./dist/langchain.mjs"
24
+ }
25
+ },
26
+ "types": "./dist/index.d.ts",
27
+ "typesVersions": {
28
+ "*": {
29
+ "langchain": [
30
+ "dist/langchain.d.ts"
31
+ ],
32
+ "*": [
33
+ "dist/*"
34
+ ]
35
+ }
36
+ },
37
+ "license": "MIT",
38
+ "devDependencies": {
39
+ "@swc/core": "1.5.28",
40
+ "@types/express": "^4.17.21",
41
+ "@types/jest": "^29.5.4",
42
+ "@types/node": "^18.11.17",
43
+ "@whatwg-node/server": "^0.9.34",
44
+ "eslint": "^8.56.0",
45
+ "jest": "^29.6.4",
46
+ "nodemon": "^3.1.3",
47
+ "ts-jest": "^29.1.1",
48
+ "ts-node": "^10.9.2",
49
+ "tsup": "^6.7.0",
50
+ "typescript": "^5.2.3",
51
+ "zod-to-json-schema": "^3.23.5",
52
+ "eslint-config-custom": "1.4.6",
53
+ "tsconfig": "1.4.6"
54
+ },
55
+ "dependencies": {
56
+ "@langchain/community": "^0.0.53",
57
+ "@langchain/core": "^0.3.13",
58
+ "@langchain/langgraph": "^0.2.22",
59
+ "@langchain/langgraph-sdk": "^0.0.16",
60
+ "langchain": "^0.3.3",
61
+ "zod": "^3.23.3",
62
+ "@copilotkit/shared": "0.0.0-feat-dynamic-copilotcloud-qa-20250117190454"
63
+ },
64
+ "keywords": [
65
+ "copilotkit",
66
+ "copilot",
67
+ "react",
68
+ "nextjs",
69
+ "nodejs",
70
+ "ai",
71
+ "assistant",
72
+ "javascript",
73
+ "automation",
74
+ "textarea"
75
+ ],
76
+ "scripts": {
77
+ "build": "tsup --clean",
78
+ "dev": "tsup --watch --no-splitting",
79
+ "test": "jest --passWithNoTests",
80
+ "check-types": "tsc --noEmit",
81
+ "clean": "rm -rf .turbo && rm -rf node_modules && rm -rf dist && rm -rf .next",
82
+ "link:global": "pnpm link --global",
83
+ "unlink:global": "pnpm unlink --global"
84
+ }
85
+ }
package/src/index.ts ADDED
File without changes
@@ -0,0 +1,105 @@
1
+ import { RunnableConfig } from "@langchain/core/runnables";
2
+ import { dispatchCustomEvent } from "@langchain/core/callbacks/dispatch";
3
+ import { convertJsonSchemaToZodSchema, randomId } from "@copilotkit/shared";
4
+ import { Annotation, MessagesAnnotation } from "@langchain/langgraph";
5
+ import { DynamicStructuredTool } from "@langchain/core/tools";
6
+
7
+ interface IntermediateStateConfig {
8
+ stateKey: string;
9
+ tool: string;
10
+ toolArgument?: string;
11
+ }
12
+
13
+ interface OptionsConfig {
14
+ emitToolCalls?: boolean | string | string[];
15
+ emitMessages?: boolean;
16
+ emitAll?: boolean;
17
+ emitIntermediateState?: IntermediateStateConfig[];
18
+ }
19
+
20
+ export const CopilotKitPropertiesAnnotation = Annotation.Root({
21
+ actions: Annotation<any[]>,
22
+ });
23
+
24
+ export const CopilotKitStateAnnotation = Annotation.Root({
25
+ copilotkit: Annotation<typeof CopilotKitPropertiesAnnotation.State>,
26
+ ...MessagesAnnotation.spec,
27
+ });
28
+
29
+ export type CopilotKitState = typeof CopilotKitStateAnnotation.State;
30
+ export type CopilotKitProperties = typeof CopilotKitPropertiesAnnotation.State;
31
+
32
+ export function copilotKitCustomizeConfig(
33
+ baseConfig: RunnableConfig,
34
+ options?: OptionsConfig,
35
+ ): RunnableConfig {
36
+ const metadata = baseConfig?.metadata || {};
37
+
38
+ if (options?.emitAll) {
39
+ metadata["copilotkit:emit-tool-calls"] = true;
40
+ metadata["copilotkit:emit-messages"] = true;
41
+ } else {
42
+ if (options?.emitToolCalls !== undefined) {
43
+ metadata["copilotkit:emit-tool-calls"] = options.emitToolCalls;
44
+ }
45
+ if (options?.emitMessages !== undefined) {
46
+ metadata["copilotkit:emit-messages"] = options.emitMessages;
47
+ }
48
+ }
49
+
50
+ if (options?.emitIntermediateState) {
51
+ const snakeCaseIntermediateState = options.emitIntermediateState.map((state) => ({
52
+ tool: state.tool,
53
+ tool_argument: state.toolArgument,
54
+ state_key: state.stateKey,
55
+ }));
56
+
57
+ metadata["copilotkit:emit-intermediate-state"] = snakeCaseIntermediateState;
58
+ }
59
+
60
+ baseConfig = baseConfig || {};
61
+
62
+ return {
63
+ ...baseConfig,
64
+ metadata: metadata,
65
+ };
66
+ }
67
+
68
+ export async function copilotKitExit(config: RunnableConfig) {
69
+ await dispatchCustomEvent("copilotkit_exit", {}, config);
70
+ }
71
+
72
+ export async function copilotKitEmitState(config: RunnableConfig, state: any) {
73
+ await dispatchCustomEvent("copilotkit_manually_emit_intermediate_state", state, config);
74
+ }
75
+
76
+ export async function copilotKitEmitMessage(config: RunnableConfig, message: string) {
77
+ await dispatchCustomEvent(
78
+ "copilotkit_manually_emit_message",
79
+ { message, message_id: randomId(), role: "assistant" },
80
+ config,
81
+ );
82
+ }
83
+
84
+ export async function copilotKitEmitToolCall(config: RunnableConfig, name: string, args: any) {
85
+ await dispatchCustomEvent(
86
+ "copilotkit_manually_emit_tool_call",
87
+ { name, args, id: randomId() },
88
+ config,
89
+ );
90
+ }
91
+
92
+ export function convertActionToDynamicStructuredTool(actionInput: any) {
93
+ return new DynamicStructuredTool({
94
+ name: actionInput.name,
95
+ description: actionInput.description,
96
+ schema: convertJsonSchemaToZodSchema(actionInput.parameters, true),
97
+ func: async () => {
98
+ return "";
99
+ },
100
+ });
101
+ }
102
+
103
+ export function convertActionsToDynamicStructuredTools(actions: any[]) {
104
+ return actions.map((action) => convertActionToDynamicStructuredTool(action));
105
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,11 @@
1
+ {
2
+ "extends": "../../utilities/tsconfig/base.json",
3
+ "compilerOptions": {
4
+ "lib": ["es2017", "dom"],
5
+ "emitDecoratorMetadata": true,
6
+ "experimentalDecorators": true,
7
+ "strict": false
8
+ },
9
+ "include": ["./src/**/*.ts"],
10
+ "exclude": ["dist", "build", "node_modules", "**/*.test.ts", "**/*.test.tsx", "**/__tests__/*"]
11
+ }
package/tsup.config.ts ADDED
@@ -0,0 +1,22 @@
1
+ import { defineConfig, Options } from "tsup";
2
+
3
+ export default defineConfig((options: Options) => ({
4
+ ...options,
5
+ entry: {
6
+ index: "src/index.ts",
7
+ langchain: "src/langchain.ts",
8
+ },
9
+ format: ["esm", "cjs"],
10
+ dts: {
11
+ entry: ["src/index.ts", "src/langchain.ts"],
12
+ },
13
+ minify: false,
14
+ external: [],
15
+ sourcemap: true,
16
+ entryNames: "[name]",
17
+ exclude: [
18
+ "**/*.test.ts", // Exclude TypeScript test files
19
+ "**/*.test.tsx", // Exclude TypeScript React test files
20
+ "**/__tests__/*", // Exclude any files inside a __tests__ directory
21
+ ],
22
+ }));
package/typedoc.json ADDED
@@ -0,0 +1,4 @@
1
+ {
2
+ "extends": ["../../typedoc.base.json"],
3
+ "entryPoints": ["src/index.ts"]
4
+ }