@copilotkit/sdk-js 1.51.5-next.0 → 1.51.5-next.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/_virtual/_rolldown/runtime.cjs +29 -0
  3. package/dist/index.cjs +0 -0
  4. package/dist/index.d.cts +1 -0
  5. package/dist/index.d.mts +1 -0
  6. package/dist/index.mjs +1 -1
  7. package/dist/langchain.cjs +18 -0
  8. package/dist/langchain.cjs.map +1 -0
  9. package/dist/langchain.d.cts +3 -0
  10. package/dist/langchain.d.mts +4 -0
  11. package/dist/langchain.mjs +6 -23
  12. package/dist/langchain.mjs.map +1 -1
  13. package/dist/langgraph/middleware.cjs +139 -0
  14. package/dist/langgraph/middleware.cjs.map +1 -0
  15. package/dist/langgraph/middleware.d.cts +8 -0
  16. package/dist/langgraph/middleware.d.cts.map +1 -0
  17. package/dist/langgraph/middleware.d.mts +8 -0
  18. package/dist/langgraph/middleware.d.mts.map +1 -0
  19. package/dist/langgraph/middleware.mjs +137 -0
  20. package/dist/langgraph/middleware.mjs.map +1 -0
  21. package/dist/langgraph/types.cjs +19 -0
  22. package/dist/langgraph/types.cjs.map +1 -0
  23. package/dist/langgraph/types.d.cts +246 -0
  24. package/dist/langgraph/types.d.cts.map +1 -0
  25. package/dist/langgraph/types.d.mts +246 -0
  26. package/dist/langgraph/types.d.mts.map +1 -0
  27. package/dist/langgraph/types.mjs +17 -0
  28. package/dist/langgraph/types.mjs.map +1 -0
  29. package/dist/langgraph/utils.cjs +281 -0
  30. package/dist/langgraph/utils.cjs.map +1 -0
  31. package/dist/langgraph/utils.d.cts +192 -0
  32. package/dist/langgraph/utils.d.cts.map +1 -0
  33. package/dist/langgraph/utils.d.mts +192 -0
  34. package/dist/langgraph/utils.d.mts.map +1 -0
  35. package/dist/langgraph/utils.mjs +273 -0
  36. package/dist/langgraph/utils.mjs.map +1 -0
  37. package/dist/langgraph.cjs +16 -0
  38. package/dist/langgraph.d.cts +4 -0
  39. package/dist/langgraph.d.mts +4 -0
  40. package/dist/langgraph.mjs +5 -27
  41. package/package.json +22 -22
  42. package/tsdown.config.ts +17 -0
  43. package/vitest.config.mjs +11 -0
  44. package/dist/chunk-A7ZQHBQI.mjs +0 -505
  45. package/dist/chunk-A7ZQHBQI.mjs.map +0 -1
  46. package/dist/index.d.ts +0 -2
  47. package/dist/index.js +0 -1
  48. package/dist/index.js.map +0 -1
  49. package/dist/index.mjs.map +0 -1
  50. package/dist/langchain-db7cb6cb.d.ts +0 -427
  51. package/dist/langchain.d.ts +0 -6
  52. package/dist/langchain.js +0 -284
  53. package/dist/langchain.js.map +0 -1
  54. package/dist/langgraph/index.d.ts +0 -10
  55. package/dist/langgraph.js +0 -548
  56. package/dist/langgraph.js.map +0 -1
  57. package/dist/langgraph.mjs.map +0 -1
  58. package/jest.config.js +0 -5
  59. package/tsup.config.ts +0 -23
@@ -0,0 +1,281 @@
1
+ const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
2
+ let _langchain_langgraph = require("@langchain/langgraph");
3
+ let _langchain_core_callbacks_dispatch = require("@langchain/core/callbacks/dispatch");
4
+ let _copilotkit_shared = require("@copilotkit/shared");
5
+ let _langchain_core_tools = require("@langchain/core/tools");
6
+ let _langchain_core_messages = require("@langchain/core/messages");
7
+
8
+ //#region src/langgraph/utils.ts
9
+ /**
10
+ * Customize the LangGraph configuration for use in CopilotKit.
11
+ *
12
+ * To the CopilotKit SDK, run:
13
+ *
14
+ * ```bash
15
+ * npm install @copilotkit/sdk-js
16
+ * ```
17
+ *
18
+ * ### Examples
19
+ *
20
+ * Disable emitting messages and tool calls:
21
+ *
22
+ * ```typescript
23
+ * import { copilotkitCustomizeConfig } from "@copilotkit/sdk-js";
24
+ *
25
+ * config = copilotkitCustomizeConfig(
26
+ * config,
27
+ * emitMessages=false,
28
+ * emitToolCalls=false
29
+ * )
30
+ * ```
31
+ *
32
+ * To emit a tool call as streaming LangGraph state, pass the destination key in state,
33
+ * the tool name and optionally the tool argument. (If you don't pass the argument name,
34
+ * all arguments are emitted under the state key.)
35
+ *
36
+ * ```typescript
37
+ * import { copilotkitCustomizeConfig } from "@copilotkit/sdk-js";
38
+ *
39
+ * config = copilotkitCustomizeConfig(
40
+ * config,
41
+ * emitIntermediateState=[
42
+ * {
43
+ * "stateKey": "steps",
44
+ * "tool": "SearchTool",
45
+ * "toolArgument": "steps",
46
+ * },
47
+ * ],
48
+ * )
49
+ * ```
50
+ */
51
+ function copilotkitCustomizeConfig(baseConfig, options) {
52
+ if (baseConfig && typeof baseConfig !== "object") throw new _copilotkit_shared.CopilotKitMisuseError({ message: "baseConfig must be an object or null/undefined" });
53
+ if (options && typeof options !== "object") throw new _copilotkit_shared.CopilotKitMisuseError({ message: "options must be an object when provided" });
54
+ if (options?.emitIntermediateState) {
55
+ if (!Array.isArray(options.emitIntermediateState)) throw new _copilotkit_shared.CopilotKitMisuseError({ message: "emitIntermediateState must be an array when provided" });
56
+ options.emitIntermediateState.forEach((state, index) => {
57
+ if (!state || typeof state !== "object") throw new _copilotkit_shared.CopilotKitMisuseError({ message: `emitIntermediateState[${index}] must be an object` });
58
+ if (!state.stateKey || typeof state.stateKey !== "string") throw new _copilotkit_shared.CopilotKitMisuseError({ message: `emitIntermediateState[${index}] must have a valid 'stateKey' string property` });
59
+ if (!state.tool || typeof state.tool !== "string") throw new _copilotkit_shared.CopilotKitMisuseError({ message: `emitIntermediateState[${index}] must have a valid 'tool' string property` });
60
+ if (state.toolArgument && typeof state.toolArgument !== "string") throw new _copilotkit_shared.CopilotKitMisuseError({ message: `emitIntermediateState[${index}].toolArgument must be a string when provided` });
61
+ });
62
+ }
63
+ try {
64
+ const metadata = baseConfig?.metadata || {};
65
+ if (options?.emitAll) {
66
+ metadata["copilotkit:emit-tool-calls"] = true;
67
+ metadata["copilotkit:emit-messages"] = true;
68
+ } else {
69
+ if (options?.emitToolCalls !== void 0) metadata["copilotkit:emit-tool-calls"] = options.emitToolCalls;
70
+ if (options?.emitMessages !== void 0) metadata["copilotkit:emit-messages"] = options.emitMessages;
71
+ }
72
+ if (options?.emitIntermediateState) metadata["copilotkit:emit-intermediate-state"] = options.emitIntermediateState.map((state) => ({
73
+ tool: state.tool,
74
+ tool_argument: state.toolArgument,
75
+ state_key: state.stateKey
76
+ }));
77
+ baseConfig = baseConfig || {};
78
+ return {
79
+ ...baseConfig,
80
+ metadata
81
+ };
82
+ } catch (error) {
83
+ throw new _copilotkit_shared.CopilotKitMisuseError({ message: `Failed to customize config: ${error instanceof Error ? error.message : String(error)}` });
84
+ }
85
+ }
86
+ /**
87
+ * Exits the current agent after the run completes. Calling copilotkit_exit() will
88
+ * not immediately stop the agent. Instead, it signals to CopilotKit to stop the agent after
89
+ * the run completes.
90
+ *
91
+ * ### Examples
92
+ *
93
+ * ```typescript
94
+ * import { copilotkitExit } from "@copilotkit/sdk-js";
95
+ *
96
+ * async function myNode(state: Any):
97
+ * await copilotkitExit(config)
98
+ * return state
99
+ * ```
100
+ */
101
+ async function copilotkitExit(config) {
102
+ if (!config) throw new _copilotkit_shared.CopilotKitMisuseError({ message: "LangGraph configuration is required for copilotkitExit" });
103
+ try {
104
+ await (0, _langchain_core_callbacks_dispatch.dispatchCustomEvent)("copilotkit_exit", {}, config);
105
+ } catch (error) {
106
+ throw new _copilotkit_shared.CopilotKitMisuseError({ message: `Failed to dispatch exit event: ${error instanceof Error ? error.message : String(error)}` });
107
+ }
108
+ }
109
+ /**
110
+ * Emits intermediate state to CopilotKit. Useful if you have a longer running node and you want to
111
+ * update the user with the current state of the node.
112
+ *
113
+ * ### Examples
114
+ *
115
+ * ```typescript
116
+ * import { copilotkitEmitState } from "@copilotkit/sdk-js";
117
+ *
118
+ * for (let i = 0; i < 10; i++) {
119
+ * await someLongRunningOperation(i);
120
+ * await copilotkitEmitState(config, { progress: i });
121
+ * }
122
+ * ```
123
+ */
124
+ async function copilotkitEmitState(config, state) {
125
+ if (!config) throw new _copilotkit_shared.CopilotKitMisuseError({ message: "LangGraph configuration is required for copilotkitEmitState" });
126
+ if (state === void 0) throw new _copilotkit_shared.CopilotKitMisuseError({ message: "State is required for copilotkitEmitState" });
127
+ try {
128
+ await (0, _langchain_core_callbacks_dispatch.dispatchCustomEvent)("copilotkit_manually_emit_intermediate_state", state, config);
129
+ } catch (error) {
130
+ throw new _copilotkit_shared.CopilotKitMisuseError({ message: `Failed to emit state: ${error instanceof Error ? error.message : String(error)}` });
131
+ }
132
+ }
133
+ /**
134
+ * Manually emits a message to CopilotKit. Useful in longer running nodes to update the user.
135
+ * Important: You still need to return the messages from the node.
136
+ *
137
+ * ### Examples
138
+ *
139
+ * ```typescript
140
+ * import { copilotkitEmitMessage } from "@copilotkit/sdk-js";
141
+ *
142
+ * const message = "Step 1 of 10 complete";
143
+ * await copilotkitEmitMessage(config, message);
144
+ *
145
+ * // Return the message from the node
146
+ * return {
147
+ * "messages": [AIMessage(content=message)]
148
+ * }
149
+ * ```
150
+ */
151
+ async function copilotkitEmitMessage(config, message) {
152
+ if (!config) throw new _copilotkit_shared.CopilotKitMisuseError({ message: "LangGraph configuration is required for copilotkitEmitMessage" });
153
+ if (!message || typeof message !== "string") throw new _copilotkit_shared.CopilotKitMisuseError({ message: "Message must be a non-empty string for copilotkitEmitMessage" });
154
+ try {
155
+ await (0, _langchain_core_callbacks_dispatch.dispatchCustomEvent)("copilotkit_manually_emit_message", {
156
+ message,
157
+ message_id: (0, _copilotkit_shared.randomId)(),
158
+ role: "assistant"
159
+ }, config);
160
+ } catch (error) {
161
+ throw new _copilotkit_shared.CopilotKitMisuseError({ message: `Failed to emit message: ${error instanceof Error ? error.message : String(error)}` });
162
+ }
163
+ }
164
+ /**
165
+ * Manually emits a tool call to CopilotKit.
166
+ *
167
+ * ### Examples
168
+ *
169
+ * ```typescript
170
+ * import { copilotkitEmitToolCall } from "@copilotkit/sdk-js";
171
+ *
172
+ * await copilotkitEmitToolCall(config, name="SearchTool", args={"steps": 10})
173
+ * ```
174
+ */
175
+ async function copilotkitEmitToolCall(config, name, args) {
176
+ if (!config) throw new _copilotkit_shared.CopilotKitMisuseError({ message: "LangGraph configuration is required for copilotkitEmitToolCall" });
177
+ if (!name || typeof name !== "string") throw new _copilotkit_shared.CopilotKitMisuseError({ message: "Tool name must be a non-empty string for copilotkitEmitToolCall" });
178
+ if (args === void 0) throw new _copilotkit_shared.CopilotKitMisuseError({ message: "Tool arguments are required for copilotkitEmitToolCall" });
179
+ try {
180
+ await (0, _langchain_core_callbacks_dispatch.dispatchCustomEvent)("copilotkit_manually_emit_tool_call", {
181
+ name,
182
+ args,
183
+ id: (0, _copilotkit_shared.randomId)()
184
+ }, config);
185
+ } catch (error) {
186
+ throw new _copilotkit_shared.CopilotKitMisuseError({ message: `Failed to emit tool call '${name}': ${error instanceof Error ? error.message : String(error)}` });
187
+ }
188
+ }
189
+ function convertActionToDynamicStructuredTool(actionInput) {
190
+ if (!actionInput) throw new _copilotkit_shared.CopilotKitMisuseError({ message: "Action input is required but was not provided" });
191
+ if (!actionInput.name || typeof actionInput.name !== "string") throw new _copilotkit_shared.CopilotKitMisuseError({ message: "Action must have a valid 'name' property of type string" });
192
+ if (actionInput.description == void 0 || actionInput.description == null || typeof actionInput.description !== "string") throw new _copilotkit_shared.CopilotKitMisuseError({ message: `Action '${actionInput.name}' must have a valid 'description' property of type string` });
193
+ if (!actionInput.parameters) throw new _copilotkit_shared.CopilotKitMisuseError({ message: `Action '${actionInput.name}' must have a 'parameters' property` });
194
+ try {
195
+ return new _langchain_core_tools.DynamicStructuredTool({
196
+ name: actionInput.name,
197
+ description: actionInput.description,
198
+ schema: (0, _copilotkit_shared.convertJsonSchemaToZodSchema)(actionInput.parameters, true),
199
+ func: async () => {
200
+ return "";
201
+ }
202
+ });
203
+ } catch (error) {
204
+ throw new _copilotkit_shared.CopilotKitMisuseError({ message: `Failed to convert action '${actionInput.name}' to DynamicStructuredTool: ${error instanceof Error ? error.message : String(error)}` });
205
+ }
206
+ }
207
+ /**
208
+ * Use this function to convert a list of actions you get from state
209
+ * to a list of dynamic structured tools.
210
+ *
211
+ * ### Examples
212
+ *
213
+ * ```typescript
214
+ * import { convertActionsToDynamicStructuredTools } from "@copilotkit/sdk-js";
215
+ *
216
+ * const tools = convertActionsToDynamicStructuredTools(state.copilotkit.actions);
217
+ * ```
218
+ */
219
+ function convertActionsToDynamicStructuredTools(actions) {
220
+ if (!Array.isArray(actions)) throw new _copilotkit_shared.CopilotKitMisuseError({ message: "Actions must be an array" });
221
+ return actions.map((action, index) => {
222
+ try {
223
+ return convertActionToDynamicStructuredTool(action.type === "function" ? action.function : action);
224
+ } catch (error) {
225
+ throw new _copilotkit_shared.CopilotKitMisuseError({ message: `Failed to convert action at index ${index}: ${error instanceof Error ? error.message : String(error)}` });
226
+ }
227
+ });
228
+ }
229
+ function copilotKitInterrupt({ message, action, args }) {
230
+ if (!message && !action) throw new _copilotkit_shared.CopilotKitMisuseError({ message: "Either message or action (and optional arguments) must be provided for copilotKitInterrupt" });
231
+ if (action && typeof action !== "string") throw new _copilotkit_shared.CopilotKitMisuseError({ message: "Action must be a string when provided to copilotKitInterrupt" });
232
+ if (message && typeof message !== "string") throw new _copilotkit_shared.CopilotKitMisuseError({ message: "Message must be a string when provided to copilotKitInterrupt" });
233
+ if (args && typeof args !== "object") throw new _copilotkit_shared.CopilotKitMisuseError({ message: "Args must be an object when provided to copilotKitInterrupt" });
234
+ let interruptValues = null;
235
+ let interruptMessage = null;
236
+ let answer = null;
237
+ try {
238
+ if (message) {
239
+ interruptValues = message;
240
+ interruptMessage = new _langchain_core_messages.AIMessage({
241
+ content: message,
242
+ id: (0, _copilotkit_shared.randomId)()
243
+ });
244
+ } else {
245
+ interruptMessage = new _langchain_core_messages.AIMessage({
246
+ content: "",
247
+ tool_calls: [{
248
+ id: (0, _copilotkit_shared.randomId)(),
249
+ name: action,
250
+ args: args ?? {}
251
+ }]
252
+ });
253
+ interruptValues = {
254
+ action,
255
+ args: args ?? {}
256
+ };
257
+ }
258
+ const response = (0, _langchain_langgraph.interrupt)({
259
+ __copilotkit_interrupt_value__: interruptValues,
260
+ __copilotkit_messages__: [interruptMessage]
261
+ });
262
+ answer = response[response.length - 1].content;
263
+ return {
264
+ answer,
265
+ messages: response
266
+ };
267
+ } catch (error) {
268
+ throw new _copilotkit_shared.CopilotKitMisuseError({ message: `Failed to create interrupt: ${error instanceof Error ? error.message : String(error)}` });
269
+ }
270
+ }
271
+
272
+ //#endregion
273
+ exports.convertActionToDynamicStructuredTool = convertActionToDynamicStructuredTool;
274
+ exports.convertActionsToDynamicStructuredTools = convertActionsToDynamicStructuredTools;
275
+ exports.copilotKitInterrupt = copilotKitInterrupt;
276
+ exports.copilotkitCustomizeConfig = copilotkitCustomizeConfig;
277
+ exports.copilotkitEmitMessage = copilotkitEmitMessage;
278
+ exports.copilotkitEmitState = copilotkitEmitState;
279
+ exports.copilotkitEmitToolCall = copilotkitEmitToolCall;
280
+ exports.copilotkitExit = copilotkitExit;
281
+ //# sourceMappingURL=utils.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.cjs","names":["CopilotKitMisuseError","DynamicStructuredTool","AIMessage"],"sources":["../../src/langgraph/utils.ts"],"sourcesContent":["import { RunnableConfig } from \"@langchain/core/runnables\";\nimport { dispatchCustomEvent } from \"@langchain/core/callbacks/dispatch\";\nimport {\n convertJsonSchemaToZodSchema,\n randomId,\n CopilotKitMisuseError,\n} from \"@copilotkit/shared\";\nimport { interrupt } from \"@langchain/langgraph\";\nimport { DynamicStructuredTool } from \"@langchain/core/tools\";\nimport { AIMessage } from \"@langchain/core/messages\";\nimport { OptionsConfig } from \"./types\";\n\n/**\n * Customize the LangGraph configuration for use in CopilotKit.\n *\n * To the CopilotKit SDK, run:\n *\n * ```bash\n * npm install @copilotkit/sdk-js\n * ```\n *\n * ### Examples\n *\n * Disable emitting messages and tool calls:\n *\n * ```typescript\n * import { copilotkitCustomizeConfig } from \"@copilotkit/sdk-js\";\n *\n * config = copilotkitCustomizeConfig(\n * config,\n * emitMessages=false,\n * emitToolCalls=false\n * )\n * ```\n *\n * To emit a tool call as streaming LangGraph state, pass the destination key in state,\n * the tool name and optionally the tool argument. (If you don't pass the argument name,\n * all arguments are emitted under the state key.)\n *\n * ```typescript\n * import { copilotkitCustomizeConfig } from \"@copilotkit/sdk-js\";\n *\n * config = copilotkitCustomizeConfig(\n * config,\n * emitIntermediateState=[\n * {\n * \"stateKey\": \"steps\",\n * \"tool\": \"SearchTool\",\n * \"toolArgument\": \"steps\",\n * },\n * ],\n * )\n * ```\n */\nexport function copilotkitCustomizeConfig(\n /**\n * The LangChain/LangGraph configuration to customize.\n */\n baseConfig: RunnableConfig,\n /**\n * Configuration options:\n * - `emitMessages: boolean?`\n * Configure how messages are emitted. By default, all messages are emitted. Pass false to\n * disable emitting messages.\n * - `emitToolCalls: boolean | string | string[]?`\n * Configure how tool calls are emitted. By default, all tool calls are emitted. Pass false to\n * disable emitting tool calls. Pass a string or list of strings to emit only specific tool calls.\n * - `emitIntermediateState: IntermediateStateConfig[]?`\n * Lets you emit tool calls as streaming LangGraph state.\n */\n options?: OptionsConfig,\n): RunnableConfig {\n if (baseConfig && typeof baseConfig !== \"object\") {\n throw new CopilotKitMisuseError({\n message: \"baseConfig must be an object or null/undefined\",\n });\n }\n\n if (options && typeof options !== \"object\") {\n throw new CopilotKitMisuseError({\n message: \"options must be an object when provided\",\n });\n }\n\n // Validate emitIntermediateState structure\n if (options?.emitIntermediateState) {\n if (!Array.isArray(options.emitIntermediateState)) {\n throw new CopilotKitMisuseError({\n message: \"emitIntermediateState must be an array when provided\",\n });\n }\n\n options.emitIntermediateState.forEach((state, index) => {\n if (!state || typeof state !== \"object\") {\n throw new CopilotKitMisuseError({\n message: `emitIntermediateState[${index}] must be an object`,\n });\n }\n\n if (!state.stateKey || typeof state.stateKey !== \"string\") {\n throw new CopilotKitMisuseError({\n message: `emitIntermediateState[${index}] must have a valid 'stateKey' string property`,\n });\n }\n\n if (!state.tool || typeof state.tool !== \"string\") {\n throw new CopilotKitMisuseError({\n message: `emitIntermediateState[${index}] must have a valid 'tool' string property`,\n });\n }\n\n if (state.toolArgument && typeof state.toolArgument !== \"string\") {\n throw new CopilotKitMisuseError({\n message: `emitIntermediateState[${index}].toolArgument must be a string when provided`,\n });\n }\n });\n }\n\n try {\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(\n (state) => ({\n tool: state.tool,\n tool_argument: state.toolArgument,\n state_key: state.stateKey,\n }),\n );\n\n metadata[\"copilotkit:emit-intermediate-state\"] =\n snakeCaseIntermediateState;\n }\n\n baseConfig = baseConfig || {};\n\n return {\n ...baseConfig,\n metadata: metadata,\n };\n } catch (error) {\n throw new CopilotKitMisuseError({\n message: `Failed to customize config: ${error instanceof Error ? error.message : String(error)}`,\n });\n }\n}\n/**\n * Exits the current agent after the run completes. Calling copilotkit_exit() will\n * not immediately stop the agent. Instead, it signals to CopilotKit to stop the agent after\n * the run completes.\n *\n * ### Examples\n *\n * ```typescript\n * import { copilotkitExit } from \"@copilotkit/sdk-js\";\n *\n * async function myNode(state: Any):\n * await copilotkitExit(config)\n * return state\n * ```\n */\nexport async function copilotkitExit(\n /**\n * The LangChain/LangGraph configuration.\n */\n config: RunnableConfig,\n) {\n if (!config) {\n throw new CopilotKitMisuseError({\n message: \"LangGraph configuration is required for copilotkitExit\",\n });\n }\n\n try {\n await dispatchCustomEvent(\"copilotkit_exit\", {}, config);\n } catch (error) {\n throw new CopilotKitMisuseError({\n message: `Failed to dispatch exit event: ${error instanceof Error ? error.message : String(error)}`,\n });\n }\n}\n/**\n * Emits intermediate state to CopilotKit. Useful if you have a longer running node and you want to\n * update the user with the current state of the node.\n *\n * ### Examples\n *\n * ```typescript\n * import { copilotkitEmitState } from \"@copilotkit/sdk-js\";\n *\n * for (let i = 0; i < 10; i++) {\n * await someLongRunningOperation(i);\n * await copilotkitEmitState(config, { progress: i });\n * }\n * ```\n */\nexport async function copilotkitEmitState(\n /**\n * The LangChain/LangGraph configuration.\n */\n config: RunnableConfig,\n /**\n * The state to emit.\n */\n state: any,\n) {\n if (!config) {\n throw new CopilotKitMisuseError({\n message: \"LangGraph configuration is required for copilotkitEmitState\",\n });\n }\n\n if (state === undefined) {\n throw new CopilotKitMisuseError({\n message: \"State is required for copilotkitEmitState\",\n });\n }\n\n try {\n await dispatchCustomEvent(\n \"copilotkit_manually_emit_intermediate_state\",\n state,\n config,\n );\n } catch (error) {\n throw new CopilotKitMisuseError({\n message: `Failed to emit state: ${error instanceof Error ? error.message : String(error)}`,\n });\n }\n}\n/**\n * Manually emits a message to CopilotKit. Useful in longer running nodes to update the user.\n * Important: You still need to return the messages from the node.\n *\n * ### Examples\n *\n * ```typescript\n * import { copilotkitEmitMessage } from \"@copilotkit/sdk-js\";\n *\n * const message = \"Step 1 of 10 complete\";\n * await copilotkitEmitMessage(config, message);\n *\n * // Return the message from the node\n * return {\n * \"messages\": [AIMessage(content=message)]\n * }\n * ```\n */\nexport async function copilotkitEmitMessage(\n /**\n * The LangChain/LangGraph configuration.\n */\n config: RunnableConfig,\n /**\n * The message to emit.\n */\n message: string,\n) {\n if (!config) {\n throw new CopilotKitMisuseError({\n message: \"LangGraph configuration is required for copilotkitEmitMessage\",\n });\n }\n\n if (!message || typeof message !== \"string\") {\n throw new CopilotKitMisuseError({\n message: \"Message must be a non-empty string for copilotkitEmitMessage\",\n });\n }\n\n try {\n await dispatchCustomEvent(\n \"copilotkit_manually_emit_message\",\n { message, message_id: randomId(), role: \"assistant\" },\n config,\n );\n } catch (error) {\n throw new CopilotKitMisuseError({\n message: `Failed to emit message: ${error instanceof Error ? error.message : String(error)}`,\n });\n }\n}\n/**\n * Manually emits a tool call to CopilotKit.\n *\n * ### Examples\n *\n * ```typescript\n * import { copilotkitEmitToolCall } from \"@copilotkit/sdk-js\";\n *\n * await copilotkitEmitToolCall(config, name=\"SearchTool\", args={\"steps\": 10})\n * ```\n */\nexport async function copilotkitEmitToolCall(\n /**\n * The LangChain/LangGraph configuration.\n */\n config: RunnableConfig,\n /**\n * The name of the tool to emit.\n */\n name: string,\n /**\n * The arguments to emit.\n */\n args: any,\n) {\n if (!config) {\n throw new CopilotKitMisuseError({\n message: \"LangGraph configuration is required for copilotkitEmitToolCall\",\n });\n }\n\n if (!name || typeof name !== \"string\") {\n throw new CopilotKitMisuseError({\n message:\n \"Tool name must be a non-empty string for copilotkitEmitToolCall\",\n });\n }\n\n if (args === undefined) {\n throw new CopilotKitMisuseError({\n message: \"Tool arguments are required for copilotkitEmitToolCall\",\n });\n }\n\n try {\n await dispatchCustomEvent(\n \"copilotkit_manually_emit_tool_call\",\n { name, args, id: randomId() },\n config,\n );\n } catch (error) {\n throw new CopilotKitMisuseError({\n message: `Failed to emit tool call '${name}': ${error instanceof Error ? error.message : String(error)}`,\n });\n }\n}\n\nexport function convertActionToDynamicStructuredTool(\n actionInput: any,\n): DynamicStructuredTool<any> {\n if (!actionInput) {\n throw new CopilotKitMisuseError({\n message: \"Action input is required but was not provided\",\n });\n }\n\n if (!actionInput.name || typeof actionInput.name !== \"string\") {\n throw new CopilotKitMisuseError({\n message: \"Action must have a valid 'name' property of type string\",\n });\n }\n\n if (\n actionInput.description == undefined ||\n actionInput.description == null ||\n typeof actionInput.description !== \"string\"\n ) {\n throw new CopilotKitMisuseError({\n message: `Action '${actionInput.name}' must have a valid 'description' property of type string`,\n });\n }\n\n if (!actionInput.parameters) {\n throw new CopilotKitMisuseError({\n message: `Action '${actionInput.name}' must have a 'parameters' property`,\n });\n }\n\n try {\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 } catch (error) {\n throw new CopilotKitMisuseError({\n message: `Failed to convert action '${actionInput.name}' to DynamicStructuredTool: ${error instanceof Error ? error.message : String(error)}`,\n });\n }\n}\n/**\n * Use this function to convert a list of actions you get from state\n * to a list of dynamic structured tools.\n *\n * ### Examples\n *\n * ```typescript\n * import { convertActionsToDynamicStructuredTools } from \"@copilotkit/sdk-js\";\n *\n * const tools = convertActionsToDynamicStructuredTools(state.copilotkit.actions);\n * ```\n */\nexport function convertActionsToDynamicStructuredTools(\n /**\n * The list of actions to convert.\n */\n actions: any[],\n): DynamicStructuredTool<any>[] {\n if (!Array.isArray(actions)) {\n throw new CopilotKitMisuseError({\n message: \"Actions must be an array\",\n });\n }\n\n return actions.map((action, index) => {\n try {\n return convertActionToDynamicStructuredTool(\n action.type === \"function\" ? action.function : action,\n );\n } catch (error) {\n throw new CopilotKitMisuseError({\n message: `Failed to convert action at index ${index}: ${error instanceof Error ? error.message : String(error)}`,\n });\n }\n });\n}\n\nexport function copilotKitInterrupt({\n message,\n action,\n args,\n}: {\n message?: string;\n action?: string;\n args?: Record<string, any>;\n}) {\n if (!message && !action) {\n throw new CopilotKitMisuseError({\n message:\n \"Either message or action (and optional arguments) must be provided for copilotKitInterrupt\",\n });\n }\n\n if (action && typeof action !== \"string\") {\n throw new CopilotKitMisuseError({\n message: \"Action must be a string when provided to copilotKitInterrupt\",\n });\n }\n\n if (message && typeof message !== \"string\") {\n throw new CopilotKitMisuseError({\n message: \"Message must be a string when provided to copilotKitInterrupt\",\n });\n }\n\n if (args && typeof args !== \"object\") {\n throw new CopilotKitMisuseError({\n message: \"Args must be an object when provided to copilotKitInterrupt\",\n });\n }\n\n let interruptValues = null;\n let interruptMessage = null;\n let answer = null;\n\n try {\n if (message) {\n interruptValues = message;\n interruptMessage = new AIMessage({ content: message, id: randomId() });\n } else {\n const toolId = randomId();\n interruptMessage = new AIMessage({\n content: \"\",\n tool_calls: [{ id: toolId, name: action, args: args ?? {} }],\n });\n interruptValues = {\n action,\n args: args ?? {},\n };\n }\n\n const response = interrupt({\n __copilotkit_interrupt_value__: interruptValues,\n __copilotkit_messages__: [interruptMessage],\n });\n answer = response[response.length - 1].content;\n\n return {\n answer,\n messages: response,\n };\n } catch (error) {\n throw new CopilotKitMisuseError({\n message: `Failed to create interrupt: ${error instanceof Error ? error.message : String(error)}`,\n });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsDA,SAAgB,0BAId,YAYA,SACgB;AAChB,KAAI,cAAc,OAAO,eAAe,SACtC,OAAM,IAAIA,yCAAsB,EAC9B,SAAS,kDACV,CAAC;AAGJ,KAAI,WAAW,OAAO,YAAY,SAChC,OAAM,IAAIA,yCAAsB,EAC9B,SAAS,2CACV,CAAC;AAIJ,KAAI,SAAS,uBAAuB;AAClC,MAAI,CAAC,MAAM,QAAQ,QAAQ,sBAAsB,CAC/C,OAAM,IAAIA,yCAAsB,EAC9B,SAAS,wDACV,CAAC;AAGJ,UAAQ,sBAAsB,SAAS,OAAO,UAAU;AACtD,OAAI,CAAC,SAAS,OAAO,UAAU,SAC7B,OAAM,IAAIA,yCAAsB,EAC9B,SAAS,yBAAyB,MAAM,sBACzC,CAAC;AAGJ,OAAI,CAAC,MAAM,YAAY,OAAO,MAAM,aAAa,SAC/C,OAAM,IAAIA,yCAAsB,EAC9B,SAAS,yBAAyB,MAAM,iDACzC,CAAC;AAGJ,OAAI,CAAC,MAAM,QAAQ,OAAO,MAAM,SAAS,SACvC,OAAM,IAAIA,yCAAsB,EAC9B,SAAS,yBAAyB,MAAM,6CACzC,CAAC;AAGJ,OAAI,MAAM,gBAAgB,OAAO,MAAM,iBAAiB,SACtD,OAAM,IAAIA,yCAAsB,EAC9B,SAAS,yBAAyB,MAAM,gDACzC,CAAC;IAEJ;;AAGJ,KAAI;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,sBAAmB,IAAIA,mCAAU;IAC/B,SAAS;IACT,YAAY,CAAC;KAAE,sCAHQ;KAGI,MAAM;KAAQ,MAAM,QAAQ,EAAE;KAAE,CAAC;IAC7D,CAAC;AACF,qBAAkB;IAChB;IACA,MAAM,QAAQ,EAAE;IACjB;;EAGH,MAAM,+CAAqB;GACzB,gCAAgC;GAChC,yBAAyB,CAAC,iBAAiB;GAC5C,CAAC;AACF,WAAS,SAAS,SAAS,SAAS,GAAG;AAEvC,SAAO;GACL;GACA,UAAU;GACX;UACM,OAAO;AACd,QAAM,IAAIF,yCAAsB,EAC9B,SAAS,+BAA+B,iBAAiB,QAAQ,MAAM,UAAU,OAAO,MAAM,IAC/F,CAAC"}
@@ -0,0 +1,192 @@
1
+ import { OptionsConfig } from "./types.cjs";
2
+ import { RunnableConfig } from "@langchain/core/runnables";
3
+ import { DynamicStructuredTool } from "@langchain/core/tools";
4
+
5
+ //#region src/langgraph/utils.d.ts
6
+ /**
7
+ * Customize the LangGraph configuration for use in CopilotKit.
8
+ *
9
+ * To the CopilotKit SDK, run:
10
+ *
11
+ * ```bash
12
+ * npm install @copilotkit/sdk-js
13
+ * ```
14
+ *
15
+ * ### Examples
16
+ *
17
+ * Disable emitting messages and tool calls:
18
+ *
19
+ * ```typescript
20
+ * import { copilotkitCustomizeConfig } from "@copilotkit/sdk-js";
21
+ *
22
+ * config = copilotkitCustomizeConfig(
23
+ * config,
24
+ * emitMessages=false,
25
+ * emitToolCalls=false
26
+ * )
27
+ * ```
28
+ *
29
+ * To emit a tool call as streaming LangGraph state, pass the destination key in state,
30
+ * the tool name and optionally the tool argument. (If you don't pass the argument name,
31
+ * all arguments are emitted under the state key.)
32
+ *
33
+ * ```typescript
34
+ * import { copilotkitCustomizeConfig } from "@copilotkit/sdk-js";
35
+ *
36
+ * config = copilotkitCustomizeConfig(
37
+ * config,
38
+ * emitIntermediateState=[
39
+ * {
40
+ * "stateKey": "steps",
41
+ * "tool": "SearchTool",
42
+ * "toolArgument": "steps",
43
+ * },
44
+ * ],
45
+ * )
46
+ * ```
47
+ */
48
+ declare function copilotkitCustomizeConfig(
49
+ /**
50
+ * The LangChain/LangGraph configuration to customize.
51
+ */
52
+ baseConfig: RunnableConfig,
53
+ /**
54
+ * Configuration options:
55
+ * - `emitMessages: boolean?`
56
+ * Configure how messages are emitted. By default, all messages are emitted. Pass false to
57
+ * disable emitting messages.
58
+ * - `emitToolCalls: boolean | string | string[]?`
59
+ * Configure how tool calls are emitted. By default, all tool calls are emitted. Pass false to
60
+ * disable emitting tool calls. Pass a string or list of strings to emit only specific tool calls.
61
+ * - `emitIntermediateState: IntermediateStateConfig[]?`
62
+ * Lets you emit tool calls as streaming LangGraph state.
63
+ */
64
+ options?: OptionsConfig): RunnableConfig;
65
+ /**
66
+ * Exits the current agent after the run completes. Calling copilotkit_exit() will
67
+ * not immediately stop the agent. Instead, it signals to CopilotKit to stop the agent after
68
+ * the run completes.
69
+ *
70
+ * ### Examples
71
+ *
72
+ * ```typescript
73
+ * import { copilotkitExit } from "@copilotkit/sdk-js";
74
+ *
75
+ * async function myNode(state: Any):
76
+ * await copilotkitExit(config)
77
+ * return state
78
+ * ```
79
+ */
80
+ declare function copilotkitExit(
81
+ /**
82
+ * The LangChain/LangGraph configuration.
83
+ */
84
+ config: RunnableConfig): Promise<void>;
85
+ /**
86
+ * Emits intermediate state to CopilotKit. Useful if you have a longer running node and you want to
87
+ * update the user with the current state of the node.
88
+ *
89
+ * ### Examples
90
+ *
91
+ * ```typescript
92
+ * import { copilotkitEmitState } from "@copilotkit/sdk-js";
93
+ *
94
+ * for (let i = 0; i < 10; i++) {
95
+ * await someLongRunningOperation(i);
96
+ * await copilotkitEmitState(config, { progress: i });
97
+ * }
98
+ * ```
99
+ */
100
+ declare function copilotkitEmitState(
101
+ /**
102
+ * The LangChain/LangGraph configuration.
103
+ */
104
+ config: RunnableConfig,
105
+ /**
106
+ * The state to emit.
107
+ */
108
+ state: any): Promise<void>;
109
+ /**
110
+ * Manually emits a message to CopilotKit. Useful in longer running nodes to update the user.
111
+ * Important: You still need to return the messages from the node.
112
+ *
113
+ * ### Examples
114
+ *
115
+ * ```typescript
116
+ * import { copilotkitEmitMessage } from "@copilotkit/sdk-js";
117
+ *
118
+ * const message = "Step 1 of 10 complete";
119
+ * await copilotkitEmitMessage(config, message);
120
+ *
121
+ * // Return the message from the node
122
+ * return {
123
+ * "messages": [AIMessage(content=message)]
124
+ * }
125
+ * ```
126
+ */
127
+ declare function copilotkitEmitMessage(
128
+ /**
129
+ * The LangChain/LangGraph configuration.
130
+ */
131
+ config: RunnableConfig,
132
+ /**
133
+ * The message to emit.
134
+ */
135
+ message: string): Promise<void>;
136
+ /**
137
+ * Manually emits a tool call to CopilotKit.
138
+ *
139
+ * ### Examples
140
+ *
141
+ * ```typescript
142
+ * import { copilotkitEmitToolCall } from "@copilotkit/sdk-js";
143
+ *
144
+ * await copilotkitEmitToolCall(config, name="SearchTool", args={"steps": 10})
145
+ * ```
146
+ */
147
+ declare function copilotkitEmitToolCall(
148
+ /**
149
+ * The LangChain/LangGraph configuration.
150
+ */
151
+ config: RunnableConfig,
152
+ /**
153
+ * The name of the tool to emit.
154
+ */
155
+ name: string,
156
+ /**
157
+ * The arguments to emit.
158
+ */
159
+ args: any): Promise<void>;
160
+ declare function convertActionToDynamicStructuredTool(actionInput: any): DynamicStructuredTool<any>;
161
+ /**
162
+ * Use this function to convert a list of actions you get from state
163
+ * to a list of dynamic structured tools.
164
+ *
165
+ * ### Examples
166
+ *
167
+ * ```typescript
168
+ * import { convertActionsToDynamicStructuredTools } from "@copilotkit/sdk-js";
169
+ *
170
+ * const tools = convertActionsToDynamicStructuredTools(state.copilotkit.actions);
171
+ * ```
172
+ */
173
+ declare function convertActionsToDynamicStructuredTools(
174
+ /**
175
+ * The list of actions to convert.
176
+ */
177
+ actions: any[]): DynamicStructuredTool<any>[];
178
+ declare function copilotKitInterrupt({
179
+ message,
180
+ action,
181
+ args
182
+ }: {
183
+ message?: string;
184
+ action?: string;
185
+ args?: Record<string, any>;
186
+ }): {
187
+ answer: any;
188
+ messages: any;
189
+ };
190
+ //#endregion
191
+ export { convertActionToDynamicStructuredTool, convertActionsToDynamicStructuredTools, copilotKitInterrupt, copilotkitCustomizeConfig, copilotkitEmitMessage, copilotkitEmitState, copilotkitEmitToolCall, copilotkitExit };
192
+ //# sourceMappingURL=utils.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.cts","names":[],"sources":["../../src/langgraph/utils.ts"],"mappings":";;;;;;;AAsDA;;;;;;;;;;;;;;;AAwHA;;;;;;;;;AAmCA;;;;;;;;;;AAoDA;;;;;;iBA/MgB,yBAAA;;;;AAId,UAAA,EAAY,cAAA;;;;;;;;;;;AAsSd;AA1RE,OAAA,GAAU,aAAA,GACT,cAAA;;;;AAmVH;;;;;AAyBA;;;;;;;iBArQsB,cAAA;;;;AAIpB,MAAA,EAAQ,cAAA,GAAc,OAAA;;;;;;;;;;;;;;;;iBA+BF,mBAAA;;;;AAIpB,MAAA,EAAQ,cAAA;;;;AAIR,KAAA,QAAU,OAAA;;;;;;;;;;;;;;;;;;;iBA4CU,qBAAA;;;;AAIpB,MAAA,EAAQ,cAAA;;;;AAIR,OAAA,WAAe,OAAA;;;;;;;;;;;;iBAqCK,sBAAA;;;;AAIpB,MAAA,EAAQ,cAAA;;;;AAIR,IAAA;;;;AAIA,IAAA,QAAS,OAAA;AAAA,iBAkCK,oCAAA,CACd,WAAA,QACC,qBAAA;;;;;;;;;;;;;iBAwDa,sCAAA;;;;AAId,OAAA,UACC,qBAAA;AAAA,iBAoBa,mBAAA,CAAA;EACd,OAAA;EACA,MAAA;EACA;AAAA;EAEA,OAAA;EACA,MAAA;EACA,IAAA,GAAO,MAAA;AAAA"}