@copilotkit/sdk-js 0.0.0-test-custom-tag-prerelease-1-20250108200215

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,422 @@
1
+ # @copilotkit/sdk-js
2
+
3
+ ## 0.0.0-test-custom-tag-prerelease-1-20250108200215
4
+
5
+ ### Patch Changes
6
+
7
+ - 896c825: testing a prerelease
8
+ - Updated dependencies [896c825]
9
+ - @copilotkit/shared@0.0.0-test-custom-tag-prerelease-1-20250108200215
10
+
11
+ ## 1.5.0
12
+
13
+ ### Minor Changes
14
+
15
+ - 1b47092: Synchronize LangGraph messages with CopilotKit
16
+
17
+ ### Patch Changes
18
+
19
+ - 1b47092: CoAgents v0.3 prerelease
20
+ - Updated dependencies [1b47092]
21
+ - Updated dependencies [1b47092]
22
+ - @copilotkit/shared@1.5.0
23
+
24
+ ## 1.5.0-coagents-v0-3.0
25
+
26
+ ### Minor Changes
27
+
28
+ - Synchronize LangGraph messages with CopilotKit
29
+
30
+ ### Patch Changes
31
+
32
+ - e66bce4: CoAgents v0.3 prerelease
33
+ - Updated dependencies
34
+ - Updated dependencies [e66bce4]
35
+ - @copilotkit/shared@1.5.0-coagents-v0-3.0
36
+
37
+ ## 1.4.8
38
+
39
+ ### Patch Changes
40
+
41
+ - - Better error handling
42
+ - Introduce new "EmptyLLMAdapter" for when using CoAgents
43
+ - Improve dev console help options
44
+ - Allow CopilotKit remote endpoint without agents
45
+ - Updated dependencies
46
+ - @copilotkit/shared@1.4.8
47
+
48
+ ## 1.4.8-next.0
49
+
50
+ ### Patch Changes
51
+
52
+ - @copilotkit/shared@1.4.8-next.0
53
+
54
+ ## 1.4.7
55
+
56
+ ### Patch Changes
57
+
58
+ - Fix broken build script before release
59
+ - Updated dependencies
60
+ - @copilotkit/shared@1.4.7
61
+
62
+ ## 1.4.6
63
+
64
+ ### Patch Changes
65
+
66
+ - .
67
+
68
+ ## 1.4.5
69
+
70
+ ### Patch Changes
71
+
72
+ - testing release workflow
73
+ - Updated dependencies
74
+ - @copilotkit/shared@1.4.5
75
+
76
+ ## 1.4.5-next.0
77
+
78
+ ### Patch Changes
79
+
80
+ - testing release workflow
81
+ - Updated dependencies
82
+ - @copilotkit/shared@1.4.5-next.0
83
+
84
+ ## 1.4.4
85
+
86
+ ### Patch Changes
87
+
88
+ - @copilotkit/shared@1.4.4
89
+
90
+ ## 1.4.4-next.4
91
+
92
+ ### Patch Changes
93
+
94
+ - @copilotkit/shared@1.4.4-next.4
95
+
96
+ ## 1.4.4-next.3
97
+
98
+ ### Patch Changes
99
+
100
+ - @copilotkit/shared@1.4.4-next.3
101
+
102
+ ## 1.4.4-next.2
103
+
104
+ ### Patch Changes
105
+
106
+ - @copilotkit/shared@1.4.4-next.2
107
+
108
+ ## 1.4.4-next.1
109
+
110
+ ### Patch Changes
111
+
112
+ - @copilotkit/shared@1.4.4-next.1
113
+
114
+ ## 1.4.4-next.0
115
+
116
+ ### Patch Changes
117
+
118
+ - @copilotkit/shared@1.4.4-next.0
119
+
120
+ ## 1.4.3
121
+
122
+ ### Patch Changes
123
+
124
+ - c296282: - Better error surfacing when using LangGraph Platform streaming
125
+ - Ensure state is immediately set without using flushSync
126
+ - - Better error surfacing when using LangGraph Platform streaming
127
+ - Ensure state is immediately set without using flushSync
128
+ - Updated dependencies [c296282]
129
+ - Updated dependencies
130
+ - @copilotkit/shared@1.4.3
131
+
132
+ ## 1.4.3-pre.0
133
+
134
+ ### Patch Changes
135
+
136
+ - - Better error surfacing when using LangGraph Platform streaming
137
+ - Ensure state is immediately set without using flushSync
138
+ - Updated dependencies
139
+ - @copilotkit/shared@1.4.3-pre.0
140
+
141
+ ## 1.4.2
142
+
143
+ ### Patch Changes
144
+
145
+ - - Make sure agent state is set immediately (#1077)
146
+ - Support running an agent without messages (#1075)
147
+ - Updated dependencies
148
+ - @copilotkit/shared@1.4.2
149
+
150
+ ## 1.4.1
151
+
152
+ ### Patch Changes
153
+
154
+ - 1721cbd: lower case copilotkit property
155
+ - 1721cbd: add zod conversion
156
+ - 8d0144f: bump
157
+ - 8d0144f: bump
158
+ - 8d0144f: bump
159
+ - e16d95e: New prerelease
160
+ - 1721cbd: Add convertActionsToDynamicStructuredTools to sdk-js
161
+ - CopilotKit Core:
162
+
163
+ - Improved error messages and overall logs
164
+ - `useCopilotAction.renderAndAwait` renamed to `.renderAndAwaitForResponse` (backwards compatible, will be deprecated in the future)
165
+ - Improved scrolling behavior. It is now possible to scroll up during LLM response generation
166
+ - Added Azure OpenAI integration
167
+ - Updated interfaces for better developer ergonomics
168
+
169
+ CoAgents:
170
+
171
+ - Renamed `remoteActions` to `remoteEndpoints` (backwards compatible, will be deprecated in the future)
172
+ - Support for LangGraph Platform in Remote Endpoints
173
+ - LangGraph JS Support for CoAgents (locally via `langgraph dev`, `langgraph up` or deployed to LangGraph Platform)
174
+ - Improved LangSmith integration - requests made through CoAgents will now surface in LangSmith
175
+ - Enhanced state management and message handling
176
+
177
+ CopilotKid Back-end SDK:
178
+
179
+ - Released a whole-new `@copilotkit/sdk-js` for building agents with LangGraph JS Support
180
+
181
+ - 8d0144f: bump
182
+ - 8d0144f: bump
183
+ - fef1b74: fix assistant message CSS and propagate actions to LG JS
184
+ - Updated dependencies [1721cbd]
185
+ - Updated dependencies [1721cbd]
186
+ - Updated dependencies [8d0144f]
187
+ - Updated dependencies [8d0144f]
188
+ - Updated dependencies [8d0144f]
189
+ - Updated dependencies [e16d95e]
190
+ - Updated dependencies [1721cbd]
191
+ - Updated dependencies
192
+ - Updated dependencies [8d0144f]
193
+ - Updated dependencies [8d0144f]
194
+ - Updated dependencies [fef1b74]
195
+ - @copilotkit/shared@1.4.1
196
+
197
+ ## 1.4.1-pre.6
198
+
199
+ ### Patch Changes
200
+
201
+ - 1721cbd: lower case copilotkit property
202
+ - 1721cbd: add zod conversion
203
+ - 1721cbd: Add convertActionsToDynamicStructuredTools to sdk-js
204
+ - fix assistant message CSS and propagate actions to LG JS
205
+ - Updated dependencies [1721cbd]
206
+ - Updated dependencies [1721cbd]
207
+ - Updated dependencies [1721cbd]
208
+ - Updated dependencies
209
+ - @copilotkit/shared@1.4.1-pre.6
210
+
211
+ ## 1.4.1-pre.5
212
+
213
+ ### Patch Changes
214
+
215
+ - bump
216
+ - Updated dependencies
217
+ - @copilotkit/shared@1.4.1-pre.5
218
+
219
+ ## 1.4.1-pre.4
220
+
221
+ ### Patch Changes
222
+
223
+ - bump
224
+ - Updated dependencies
225
+ - @copilotkit/shared@1.4.1-pre.4
226
+
227
+ ## 1.4.1-pre.3
228
+
229
+ ### Patch Changes
230
+
231
+ - bump
232
+ - Updated dependencies
233
+ - @copilotkit/shared@1.4.1-pre.3
234
+
235
+ ## 1.4.1-pre.2
236
+
237
+ ### Patch Changes
238
+
239
+ - bump
240
+ - Updated dependencies
241
+ - @copilotkit/shared@1.4.1-pre.2
242
+
243
+ ## 1.4.1-pre.1
244
+
245
+ ### Patch Changes
246
+
247
+ - bump
248
+ - Updated dependencies
249
+ - @copilotkit/shared@1.4.1-pre.1
250
+
251
+ ## 1.4.1-pre.0
252
+
253
+ ### Patch Changes
254
+
255
+ - New prerelease
256
+ - Updated dependencies
257
+ - @copilotkit/shared@1.4.1-pre.0
258
+
259
+ ## 1.4.0
260
+
261
+ ### Minor Changes
262
+
263
+ CopilotKit Core:
264
+
265
+ - Improved error messages and overall logs
266
+ - `useCopilotAction.renderAndAwait` renamed to `.renderAndAwaitForResponse` (backwards compatible, will be deprecated in the future)
267
+ - Improved scrolling behavior. It is now possible to scroll up during LLM response generation
268
+ - Added Azure OpenAI integration
269
+ - Updated interfaces for better developer ergonomics
270
+
271
+ CoAgents:
272
+
273
+ - Renamed `remoteActions` to `remoteEndpoints` (backwards compatible, will be deprecated in the future)
274
+ - Support for LangGraph Platform in Remote Endpoints
275
+ - LangGraph JS Support for CoAgents (locally via `langgraph dev`, `langgraph up` or deployed to LangGraph Platform)
276
+ - Improved LangSmith integration - requests made through CoAgents will now surface in LangSmith
277
+ - Enhanced state management and message handling
278
+
279
+ CopilotKid Back-end SDK:
280
+
281
+ - Released a whole-new `@copilotkit/sdk-js` for building agents with LangGraph JS Support
282
+
283
+ ### Patch Changes
284
+
285
+ - f6fab28: update tsup config
286
+ - f6fab28: update entry
287
+ - f6fab28: export langchain module
288
+ - f6fab28: Ensure intermediate state config is sent as snake case
289
+ - f6fab28: update entry in tsup config
290
+ - a5efccd: Revert rxjs changes
291
+ - f6fab28: update entry
292
+ - f6fab28: Update exports
293
+ - f6fab28: Update exports
294
+ - f6fab28: Export LangGraph functions
295
+ - f6fab28: Update lockfile
296
+ - Updated dependencies [f6fab28]
297
+ - Updated dependencies [f6fab28]
298
+ - Updated dependencies
299
+ - Updated dependencies [f6fab28]
300
+ - Updated dependencies [8a77944]
301
+ - Updated dependencies [f6fab28]
302
+ - Updated dependencies [f6fab28]
303
+ - Updated dependencies [8a77944]
304
+ - Updated dependencies [a5efccd]
305
+ - Updated dependencies [f6fab28]
306
+ - Updated dependencies [f6fab28]
307
+ - Updated dependencies [f6fab28]
308
+ - Updated dependencies [332d744]
309
+ - Updated dependencies [f6fab28]
310
+ - Updated dependencies [f6fab28]
311
+ - @copilotkit/shared@1.4.0
312
+
313
+ ## 1.3.16-mme-revert-rxjs-changes.10
314
+
315
+ ### Patch Changes
316
+
317
+ - f6fab28: update tsup config
318
+ - f6fab28: update entry
319
+ - f6fab28: export langchain module
320
+ - f6fab28: Ensure intermediate state config is sent as snake case
321
+ - f6fab28: update entry in tsup config
322
+ - Revert rxjs changes
323
+ - f6fab28: update entry
324
+ - f6fab28: Update exports
325
+ - f6fab28: Update exports
326
+ - f6fab28: Export LangGraph functions
327
+ - f6fab28: Update lockfile
328
+ - Updated dependencies [f6fab28]
329
+ - Updated dependencies [f6fab28]
330
+ - Updated dependencies [f6fab28]
331
+ - Updated dependencies [8a77944]
332
+ - Updated dependencies [f6fab28]
333
+ - Updated dependencies [f6fab28]
334
+ - Updated dependencies [8a77944]
335
+ - Updated dependencies
336
+ - Updated dependencies [f6fab28]
337
+ - Updated dependencies [f6fab28]
338
+ - Updated dependencies [f6fab28]
339
+ - Updated dependencies [332d744]
340
+ - Updated dependencies [f6fab28]
341
+ - Updated dependencies [f6fab28]
342
+ - @copilotkit/shared@1.3.16-mme-revert-rxjs-changes.10
343
+
344
+ ## 1.3.16-mme-lgc-langgraph-package.9
345
+
346
+ ### Patch Changes
347
+
348
+ - update entry
349
+ - Updated dependencies
350
+ - @copilotkit/shared@1.3.16-mme-lgc-langgraph-package.9
351
+
352
+ ## 1.3.16-mme-lgc-langgraph-package.8
353
+
354
+ ### Patch Changes
355
+
356
+ - update entry
357
+ - Updated dependencies
358
+ - @copilotkit/shared@1.3.16-mme-lgc-langgraph-package.8
359
+
360
+ ## 1.3.16-mme-lgc-langgraph-package.7
361
+
362
+ ### Patch Changes
363
+
364
+ - update entry in tsup config
365
+ - Updated dependencies
366
+ - @copilotkit/shared@1.3.16-mme-lgc-langgraph-package.7
367
+
368
+ ## 1.3.16-mme-lgc-langgraph-package.6
369
+
370
+ ### Patch Changes
371
+
372
+ - Update exports
373
+ - Updated dependencies
374
+ - @copilotkit/shared@1.3.16-mme-lgc-langgraph-package.6
375
+
376
+ ## 1.3.16-mme-lgc-langgraph-package.5
377
+
378
+ ### Patch Changes
379
+
380
+ - update tsup config
381
+ - Updated dependencies
382
+ - @copilotkit/shared@1.3.16-mme-lgc-langgraph-package.5
383
+
384
+ ## 1.3.16-mme-lgc-langgraph-package.4
385
+
386
+ ### Patch Changes
387
+
388
+ - Update exports
389
+ - Updated dependencies
390
+ - @copilotkit/shared@1.3.16-mme-lgc-langgraph-package.4
391
+
392
+ ## 1.3.16-mme-lgc-langgraph-package.3
393
+
394
+ ### Patch Changes
395
+
396
+ - export langchain module
397
+ - Updated dependencies
398
+ - @copilotkit/shared@1.3.16-mme-lgc-langgraph-package.3
399
+
400
+ ## 1.3.16-mme-sdk-js.2
401
+
402
+ ### Patch Changes
403
+
404
+ - Ensure intermediate state config is sent as snake case
405
+ - Updated dependencies
406
+ - @copilotkit/shared@1.3.16-mme-sdk-js.2
407
+
408
+ ## 1.3.16-mme-sdk-js.1
409
+
410
+ ### Patch Changes
411
+
412
+ - Update lockfile
413
+ - Updated dependencies
414
+ - @copilotkit/shared@1.3.16-mme-sdk-js.1
415
+
416
+ ## 1.3.16-mme-sdk-js.0
417
+
418
+ ### Patch Changes
419
+
420
+ - Export LangGraph functions
421
+ - Updated dependencies
422
+ - @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-test-custom-tag-prerelease-1-20250108200215",
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-test-custom-tag-prerelease-1-20250108200215"
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
+ }