@copilotkit/sdk-js 1.9.2-next.10 → 1.9.2-next.2

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 CHANGED
@@ -1,57 +1,5 @@
1
1
  # @copilotkit/sdk-js
2
2
 
3
- ## 1.9.2-next.10
4
-
5
- ### Patch Changes
6
-
7
- - @copilotkit/shared@1.9.2-next.10
8
-
9
- ## 1.9.2-next.9
10
-
11
- ### Patch Changes
12
-
13
- - 1d1c51d: - feat: surface all errors in structured format
14
- - Updated dependencies [1d1c51d]
15
- - @copilotkit/shared@1.9.2-next.9
16
-
17
- ## 1.9.2-next.8
18
-
19
- ### Patch Changes
20
-
21
- - @copilotkit/shared@1.9.2-next.8
22
-
23
- ## 1.9.2-next.7
24
-
25
- ### Patch Changes
26
-
27
- - @copilotkit/shared@1.9.2-next.7
28
-
29
- ## 1.9.2-next.6
30
-
31
- ### Patch Changes
32
-
33
- - @copilotkit/shared@1.9.2-next.6
34
-
35
- ## 1.9.2-next.5
36
-
37
- ### Patch Changes
38
-
39
- - @copilotkit/shared@1.9.2-next.5
40
-
41
- ## 1.9.2-next.4
42
-
43
- ### Patch Changes
44
-
45
- - Updated dependencies [9169ad7]
46
- - Updated dependencies [9169ad7]
47
- - @copilotkit/shared@1.9.2-next.4
48
-
49
- ## 1.9.2-next.3
50
-
51
- ### Patch Changes
52
-
53
- - @copilotkit/shared@1.9.2-next.3
54
-
55
3
  ## 1.9.2-next.2
56
4
 
57
5
  ### Patch Changes
@@ -0,0 +1,140 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+
4
+ // src/langgraph.ts
5
+ import { dispatchCustomEvent } from "@langchain/core/callbacks/dispatch";
6
+ import { convertJsonSchemaToZodSchema, randomId } from "@copilotkit/shared";
7
+ import { Annotation, MessagesAnnotation, interrupt } from "@langchain/langgraph";
8
+ import { DynamicStructuredTool } from "@langchain/core/tools";
9
+ import { AIMessage } from "@langchain/core/messages";
10
+ var CopilotKitPropertiesAnnotation = Annotation.Root({
11
+ actions: Annotation
12
+ });
13
+ var CopilotKitStateAnnotation = Annotation.Root({
14
+ copilotkit: Annotation,
15
+ ...MessagesAnnotation.spec
16
+ });
17
+ function copilotkitCustomizeConfig(baseConfig, options) {
18
+ const metadata = (baseConfig == null ? void 0 : baseConfig.metadata) || {};
19
+ if (options == null ? void 0 : options.emitAll) {
20
+ metadata["copilotkit:emit-tool-calls"] = true;
21
+ metadata["copilotkit:emit-messages"] = true;
22
+ } else {
23
+ if ((options == null ? void 0 : options.emitToolCalls) !== void 0) {
24
+ metadata["copilotkit:emit-tool-calls"] = options.emitToolCalls;
25
+ }
26
+ if ((options == null ? void 0 : options.emitMessages) !== void 0) {
27
+ metadata["copilotkit:emit-messages"] = options.emitMessages;
28
+ }
29
+ }
30
+ if (options == null ? void 0 : options.emitIntermediateState) {
31
+ const snakeCaseIntermediateState = options.emitIntermediateState.map((state) => ({
32
+ tool: state.tool,
33
+ tool_argument: state.toolArgument,
34
+ state_key: state.stateKey
35
+ }));
36
+ metadata["copilotkit:emit-intermediate-state"] = snakeCaseIntermediateState;
37
+ }
38
+ baseConfig = baseConfig || {};
39
+ return {
40
+ ...baseConfig,
41
+ metadata
42
+ };
43
+ }
44
+ __name(copilotkitCustomizeConfig, "copilotkitCustomizeConfig");
45
+ async function copilotkitExit(config) {
46
+ await dispatchCustomEvent("copilotkit_exit", {}, config);
47
+ }
48
+ __name(copilotkitExit, "copilotkitExit");
49
+ async function copilotkitEmitState(config, state) {
50
+ await dispatchCustomEvent("copilotkit_manually_emit_intermediate_state", state, config);
51
+ }
52
+ __name(copilotkitEmitState, "copilotkitEmitState");
53
+ async function copilotkitEmitMessage(config, message) {
54
+ await dispatchCustomEvent("copilotkit_manually_emit_message", {
55
+ message,
56
+ message_id: randomId(),
57
+ role: "assistant"
58
+ }, config);
59
+ }
60
+ __name(copilotkitEmitMessage, "copilotkitEmitMessage");
61
+ async function copilotkitEmitToolCall(config, name, args) {
62
+ await dispatchCustomEvent("copilotkit_manually_emit_tool_call", {
63
+ name,
64
+ args,
65
+ id: randomId()
66
+ }, config);
67
+ }
68
+ __name(copilotkitEmitToolCall, "copilotkitEmitToolCall");
69
+ function convertActionToDynamicStructuredTool(actionInput) {
70
+ return new DynamicStructuredTool({
71
+ name: actionInput.name,
72
+ description: actionInput.description,
73
+ schema: convertJsonSchemaToZodSchema(actionInput.parameters, true),
74
+ func: async () => {
75
+ return "";
76
+ }
77
+ });
78
+ }
79
+ __name(convertActionToDynamicStructuredTool, "convertActionToDynamicStructuredTool");
80
+ function convertActionsToDynamicStructuredTools(actions) {
81
+ return actions.map((action) => convertActionToDynamicStructuredTool(action));
82
+ }
83
+ __name(convertActionsToDynamicStructuredTools, "convertActionsToDynamicStructuredTools");
84
+ function copilotKitInterrupt({ message, action, args }) {
85
+ if (!message && !action) {
86
+ throw new Error("Either message or action (and optional arguments) must be provided");
87
+ }
88
+ let interruptValues = null;
89
+ let interruptMessage = null;
90
+ let answer = null;
91
+ if (message) {
92
+ interruptValues = message;
93
+ interruptMessage = new AIMessage({
94
+ content: message,
95
+ id: randomId()
96
+ });
97
+ } else {
98
+ const toolId = randomId();
99
+ interruptMessage = new AIMessage({
100
+ content: "",
101
+ tool_calls: [
102
+ {
103
+ id: toolId,
104
+ name: action,
105
+ args: args ?? {}
106
+ }
107
+ ]
108
+ });
109
+ interruptValues = {
110
+ action,
111
+ args: args ?? {}
112
+ };
113
+ }
114
+ const response = interrupt({
115
+ __copilotkit_interrupt_value__: interruptValues,
116
+ __copilotkit_messages__: [
117
+ interruptMessage
118
+ ]
119
+ });
120
+ answer = response[response.length - 1].content;
121
+ return {
122
+ answer,
123
+ messages: response
124
+ };
125
+ }
126
+ __name(copilotKitInterrupt, "copilotKitInterrupt");
127
+
128
+ export {
129
+ CopilotKitPropertiesAnnotation,
130
+ CopilotKitStateAnnotation,
131
+ copilotkitCustomizeConfig,
132
+ copilotkitExit,
133
+ copilotkitEmitState,
134
+ copilotkitEmitMessage,
135
+ copilotkitEmitToolCall,
136
+ convertActionToDynamicStructuredTool,
137
+ convertActionsToDynamicStructuredTools,
138
+ copilotKitInterrupt
139
+ };
140
+ //# sourceMappingURL=chunk-PMVIZ7R2.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/langgraph.ts"],"sourcesContent":["import { RunnableConfig } from \"@langchain/core/runnables\";\nimport { dispatchCustomEvent } from \"@langchain/core/callbacks/dispatch\";\nimport { convertJsonSchemaToZodSchema, randomId } from \"@copilotkit/shared\";\nimport { Annotation, MessagesAnnotation, interrupt } from \"@langchain/langgraph\";\nimport { DynamicStructuredTool } from \"@langchain/core/tools\";\nimport { AIMessage } from \"@langchain/core/messages\";\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\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 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/**\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 await dispatchCustomEvent(\"copilotkit_exit\", {}, config);\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 await dispatchCustomEvent(\"copilotkit_manually_emit_intermediate_state\", state, config);\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 await dispatchCustomEvent(\n \"copilotkit_manually_emit_message\",\n { message, message_id: randomId(), role: \"assistant\" },\n config,\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 await dispatchCustomEvent(\n \"copilotkit_manually_emit_tool_call\",\n { name, args, id: randomId() },\n config,\n );\n}\n\nexport function convertActionToDynamicStructuredTool(actionInput: any): DynamicStructuredTool<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/**\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 return actions.map((action) => convertActionToDynamicStructuredTool(action));\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 Error(\"Either message or action (and optional arguments) must be provided\");\n }\n\n let interruptValues = null;\n let interruptMessage = null;\n let answer = null;\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}\n"],"mappings":";;;;AACA,SAASA,2BAA2B;AACpC,SAASC,8BAA8BC,gBAAgB;AACvD,SAASC,YAAYC,oBAAoBC,iBAAiB;AAC1D,SAASC,6BAA6B;AACtC,SAASC,iBAAiB;AAenB,IAAMC,iCAAiCC,WAAWC,KAAK;EAC5DC,SAASF;AACX,CAAA;AAEO,IAAMG,4BAA4B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MAAMI,YAAYJ;IAClBM,aAAaF,YAAYE;IACzBC,QAAQC,6BAA6BJ,YAAYK,YAAY,IAAA;IAC7DC,MAAM,YAAA;AACJ,aAAO;IACT;EACF,CAAA;AACF;AATgBP;AAsBT,SAASQ,uCAId3C,SAAc;AAEd,SAAOA,QAAQe,IAAI,CAAC6B,WAAWT,qCAAqCS,MAAAA,CAAAA;AACtE;AAPgBD;AAST,SAASE,oBAAoB,EAClClB,SACAiB,QACAX,KAAI,GAKL;AACC,MAAI,CAACN,WAAW,CAACiB,QAAQ;AACvB,UAAM,IAAIE,MAAM,oEAAA;EAClB;AAEA,MAAIC,kBAAkB;AACtB,MAAIC,mBAAmB;AACvB,MAAIC,SAAS;AACb,MAAItB,SAAS;AACXoB,sBAAkBpB;AAClBqB,uBAAmB,IAAIE,UAAU;MAAEC,SAASxB;MAASO,IAAIL,SAAAA;IAAW,CAAA;EACtE,OAAO;AACL,UAAMuB,SAASvB,SAAAA;AACfmB,uBAAmB,IAAIE,UAAU;MAC/BC,SAAS;MACTE,YAAY;QAAC;UAAEnB,IAAIkB;UAAQpB,MAAMY;UAAQX,MAAMA,QAAQ,CAAC;QAAE;;IAC5D,CAAA;AACAc,sBAAkB;MAChBH;MACAX,MAAMA,QAAQ,CAAC;IACjB;EACF;AAEA,QAAMqB,WAAWC,UAAU;IACzBC,gCAAgCT;IAChCU,yBAAyB;MAACT;;EAC5B,CAAA;AACAC,WAASK,SAASA,SAASI,SAAS,CAAA,EAAGP;AAEvC,SAAO;IACLF;IACAU,UAAUL;EACZ;AACF;AAzCgBT;","names":["dispatchCustomEvent","convertJsonSchemaToZodSchema","randomId","Annotation","MessagesAnnotation","interrupt","DynamicStructuredTool","AIMessage","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","copilotKitInterrupt","Error","interruptValues","interruptMessage","answer","AIMessage","content","toolId","tool_calls","response","interrupt","__copilotkit_interrupt_value__","__copilotkit_messages__","length","messages"]}
package/dist/langchain.js CHANGED
@@ -46,218 +46,70 @@ var CopilotKitStateAnnotation = import_langgraph.Annotation.Root({
46
46
  ...import_langgraph.MessagesAnnotation.spec
47
47
  });
48
48
  function copilotkitCustomizeConfig(baseConfig, options) {
49
- if (baseConfig && typeof baseConfig !== "object") {
50
- throw new import_shared.CopilotKitMisuseError({
51
- message: "baseConfig must be an object or null/undefined"
52
- });
53
- }
54
- if (options && typeof options !== "object") {
55
- throw new import_shared.CopilotKitMisuseError({
56
- message: "options must be an object when provided"
57
- });
58
- }
59
- if (options == null ? void 0 : options.emitIntermediateState) {
60
- if (!Array.isArray(options.emitIntermediateState)) {
61
- throw new import_shared.CopilotKitMisuseError({
62
- message: "emitIntermediateState must be an array when provided"
63
- });
49
+ const metadata = (baseConfig == null ? void 0 : baseConfig.metadata) || {};
50
+ if (options == null ? void 0 : options.emitAll) {
51
+ metadata["copilotkit:emit-tool-calls"] = true;
52
+ metadata["copilotkit:emit-messages"] = true;
53
+ } else {
54
+ if ((options == null ? void 0 : options.emitToolCalls) !== void 0) {
55
+ metadata["copilotkit:emit-tool-calls"] = options.emitToolCalls;
64
56
  }
65
- options.emitIntermediateState.forEach((state, index) => {
66
- if (!state || typeof state !== "object") {
67
- throw new import_shared.CopilotKitMisuseError({
68
- message: `emitIntermediateState[${index}] must be an object`
69
- });
70
- }
71
- if (!state.stateKey || typeof state.stateKey !== "string") {
72
- throw new import_shared.CopilotKitMisuseError({
73
- message: `emitIntermediateState[${index}] must have a valid 'stateKey' string property`
74
- });
75
- }
76
- if (!state.tool || typeof state.tool !== "string") {
77
- throw new import_shared.CopilotKitMisuseError({
78
- message: `emitIntermediateState[${index}] must have a valid 'tool' string property`
79
- });
80
- }
81
- if (state.toolArgument && typeof state.toolArgument !== "string") {
82
- throw new import_shared.CopilotKitMisuseError({
83
- message: `emitIntermediateState[${index}].toolArgument must be a string when provided`
84
- });
85
- }
86
- });
87
- }
88
- try {
89
- const metadata = (baseConfig == null ? void 0 : baseConfig.metadata) || {};
90
- if (options == null ? void 0 : options.emitAll) {
91
- metadata["copilotkit:emit-tool-calls"] = true;
92
- metadata["copilotkit:emit-messages"] = true;
93
- } else {
94
- if ((options == null ? void 0 : options.emitToolCalls) !== void 0) {
95
- metadata["copilotkit:emit-tool-calls"] = options.emitToolCalls;
96
- }
97
- if ((options == null ? void 0 : options.emitMessages) !== void 0) {
98
- metadata["copilotkit:emit-messages"] = options.emitMessages;
99
- }
57
+ if ((options == null ? void 0 : options.emitMessages) !== void 0) {
58
+ metadata["copilotkit:emit-messages"] = options.emitMessages;
100
59
  }
101
- if (options == null ? void 0 : options.emitIntermediateState) {
102
- const snakeCaseIntermediateState = options.emitIntermediateState.map((state) => ({
103
- tool: state.tool,
104
- tool_argument: state.toolArgument,
105
- state_key: state.stateKey
106
- }));
107
- metadata["copilotkit:emit-intermediate-state"] = snakeCaseIntermediateState;
108
- }
109
- baseConfig = baseConfig || {};
110
- return {
111
- ...baseConfig,
112
- metadata
113
- };
114
- } catch (error) {
115
- throw new import_shared.CopilotKitMisuseError({
116
- message: `Failed to customize config: ${error instanceof Error ? error.message : String(error)}`
117
- });
118
60
  }
61
+ if (options == null ? void 0 : options.emitIntermediateState) {
62
+ const snakeCaseIntermediateState = options.emitIntermediateState.map((state) => ({
63
+ tool: state.tool,
64
+ tool_argument: state.toolArgument,
65
+ state_key: state.stateKey
66
+ }));
67
+ metadata["copilotkit:emit-intermediate-state"] = snakeCaseIntermediateState;
68
+ }
69
+ baseConfig = baseConfig || {};
70
+ return {
71
+ ...baseConfig,
72
+ metadata
73
+ };
119
74
  }
120
75
  __name(copilotkitCustomizeConfig, "copilotkitCustomizeConfig");
121
76
  async function copilotkitExit(config) {
122
- if (!config) {
123
- throw new import_shared.CopilotKitMisuseError({
124
- message: "LangGraph configuration is required for copilotkitExit"
125
- });
126
- }
127
- try {
128
- await (0, import_dispatch.dispatchCustomEvent)("copilotkit_exit", {}, config);
129
- } catch (error) {
130
- throw new import_shared.CopilotKitMisuseError({
131
- message: `Failed to dispatch exit event: ${error instanceof Error ? error.message : String(error)}`
132
- });
133
- }
77
+ await (0, import_dispatch.dispatchCustomEvent)("copilotkit_exit", {}, config);
134
78
  }
135
79
  __name(copilotkitExit, "copilotkitExit");
136
80
  async function copilotkitEmitState(config, state) {
137
- if (!config) {
138
- throw new import_shared.CopilotKitMisuseError({
139
- message: "LangGraph configuration is required for copilotkitEmitState"
140
- });
141
- }
142
- if (state === void 0) {
143
- throw new import_shared.CopilotKitMisuseError({
144
- message: "State is required for copilotkitEmitState"
145
- });
146
- }
147
- try {
148
- await (0, import_dispatch.dispatchCustomEvent)("copilotkit_manually_emit_intermediate_state", state, config);
149
- } catch (error) {
150
- throw new import_shared.CopilotKitMisuseError({
151
- message: `Failed to emit state: ${error instanceof Error ? error.message : String(error)}`
152
- });
153
- }
81
+ await (0, import_dispatch.dispatchCustomEvent)("copilotkit_manually_emit_intermediate_state", state, config);
154
82
  }
155
83
  __name(copilotkitEmitState, "copilotkitEmitState");
156
84
  async function copilotkitEmitMessage(config, message) {
157
- if (!config) {
158
- throw new import_shared.CopilotKitMisuseError({
159
- message: "LangGraph configuration is required for copilotkitEmitMessage"
160
- });
161
- }
162
- if (!message || typeof message !== "string") {
163
- throw new import_shared.CopilotKitMisuseError({
164
- message: "Message must be a non-empty string for copilotkitEmitMessage"
165
- });
166
- }
167
- try {
168
- await (0, import_dispatch.dispatchCustomEvent)("copilotkit_manually_emit_message", {
169
- message,
170
- message_id: (0, import_shared.randomId)(),
171
- role: "assistant"
172
- }, config);
173
- } catch (error) {
174
- throw new import_shared.CopilotKitMisuseError({
175
- message: `Failed to emit message: ${error instanceof Error ? error.message : String(error)}`
176
- });
177
- }
85
+ await (0, import_dispatch.dispatchCustomEvent)("copilotkit_manually_emit_message", {
86
+ message,
87
+ message_id: (0, import_shared.randomId)(),
88
+ role: "assistant"
89
+ }, config);
178
90
  }
179
91
  __name(copilotkitEmitMessage, "copilotkitEmitMessage");
180
92
  async function copilotkitEmitToolCall(config, name, args) {
181
- if (!config) {
182
- throw new import_shared.CopilotKitMisuseError({
183
- message: "LangGraph configuration is required for copilotkitEmitToolCall"
184
- });
185
- }
186
- if (!name || typeof name !== "string") {
187
- throw new import_shared.CopilotKitMisuseError({
188
- message: "Tool name must be a non-empty string for copilotkitEmitToolCall"
189
- });
190
- }
191
- if (args === void 0) {
192
- throw new import_shared.CopilotKitMisuseError({
193
- message: "Tool arguments are required for copilotkitEmitToolCall"
194
- });
195
- }
196
- try {
197
- await (0, import_dispatch.dispatchCustomEvent)("copilotkit_manually_emit_tool_call", {
198
- name,
199
- args,
200
- id: (0, import_shared.randomId)()
201
- }, config);
202
- } catch (error) {
203
- throw new import_shared.CopilotKitMisuseError({
204
- message: `Failed to emit tool call '${name}': ${error instanceof Error ? error.message : String(error)}`
205
- });
206
- }
93
+ await (0, import_dispatch.dispatchCustomEvent)("copilotkit_manually_emit_tool_call", {
94
+ name,
95
+ args,
96
+ id: (0, import_shared.randomId)()
97
+ }, config);
207
98
  }
208
99
  __name(copilotkitEmitToolCall, "copilotkitEmitToolCall");
209
100
  function convertActionToDynamicStructuredTool(actionInput) {
210
- if (!actionInput) {
211
- throw new import_shared.CopilotKitMisuseError({
212
- message: "Action input is required but was not provided"
213
- });
214
- }
215
- if (!actionInput.name || typeof actionInput.name !== "string") {
216
- throw new import_shared.CopilotKitMisuseError({
217
- message: "Action must have a valid 'name' property of type string"
218
- });
219
- }
220
- if (!actionInput.description || typeof actionInput.description !== "string") {
221
- throw new import_shared.CopilotKitMisuseError({
222
- message: `Action '${actionInput.name}' must have a valid 'description' property of type string`
223
- });
224
- }
225
- if (!actionInput.parameters) {
226
- throw new import_shared.CopilotKitMisuseError({
227
- message: `Action '${actionInput.name}' must have a 'parameters' property`
228
- });
229
- }
230
- try {
231
- return new import_tools.DynamicStructuredTool({
232
- name: actionInput.name,
233
- description: actionInput.description,
234
- schema: (0, import_shared.convertJsonSchemaToZodSchema)(actionInput.parameters, true),
235
- func: async () => {
236
- return "";
237
- }
238
- });
239
- } catch (error) {
240
- throw new import_shared.CopilotKitMisuseError({
241
- message: `Failed to convert action '${actionInput.name}' to DynamicStructuredTool: ${error instanceof Error ? error.message : String(error)}`
242
- });
243
- }
101
+ return new import_tools.DynamicStructuredTool({
102
+ name: actionInput.name,
103
+ description: actionInput.description,
104
+ schema: (0, import_shared.convertJsonSchemaToZodSchema)(actionInput.parameters, true),
105
+ func: async () => {
106
+ return "";
107
+ }
108
+ });
244
109
  }
245
110
  __name(convertActionToDynamicStructuredTool, "convertActionToDynamicStructuredTool");
246
111
  function convertActionsToDynamicStructuredTools(actions) {
247
- if (!Array.isArray(actions)) {
248
- throw new import_shared.CopilotKitMisuseError({
249
- message: "Actions must be an array"
250
- });
251
- }
252
- return actions.map((action, index) => {
253
- try {
254
- return convertActionToDynamicStructuredTool(action);
255
- } catch (error) {
256
- throw new import_shared.CopilotKitMisuseError({
257
- message: `Failed to convert action at index ${index}: ${error instanceof Error ? error.message : String(error)}`
258
- });
259
- }
260
- });
112
+ return actions.map((action) => convertActionToDynamicStructuredTool(action));
261
113
  }
262
114
  __name(convertActionsToDynamicStructuredTools, "convertActionsToDynamicStructuredTools");
263
115
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/langchain.ts","../src/langgraph.ts"],"sourcesContent":["console.warn(\n \"Warning: '@copilotkit/sdk-js/langchain' is deprecated and will be removed in a future release. Please use '@copilotkit/sdk-js/langgraph' instead.\",\n);\n\nexport {\n CopilotKitPropertiesAnnotation,\n CopilotKitStateAnnotation,\n type CopilotKitState,\n type CopilotKitProperties,\n copilotkitCustomizeConfig as copilotKitCustomizeConfig,\n copilotkitExit as copilotKitExit,\n copilotkitEmitState as copilotKitEmitState,\n copilotkitEmitMessage as copilotKitEmitMessage,\n copilotkitEmitToolCall as copilotKitEmitToolCall,\n convertActionToDynamicStructuredTool,\n convertActionsToDynamicStructuredTools,\n} from \"./langgraph\";\n","import { RunnableConfig } from \"@langchain/core/runnables\";\nimport { dispatchCustomEvent } from \"@langchain/core/callbacks/dispatch\";\nimport { convertJsonSchemaToZodSchema, randomId, CopilotKitMisuseError } from \"@copilotkit/shared\";\nimport { Annotation, MessagesAnnotation, interrupt } from \"@langchain/langgraph\";\nimport { DynamicStructuredTool } from \"@langchain/core/tools\";\nimport { AIMessage } from \"@langchain/core/messages\";\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\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((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 } 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(\"copilotkit_manually_emit_intermediate_state\", state, config);\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: \"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(actionInput: any): 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 (!actionInput.description || typeof actionInput.description !== \"string\") {\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(action);\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":";;;;;;;;;;;;;;;;;;;;AAAAA;;;;;;;;;;;;;;;ACCA,sBAAoC;AACpC,oBAA8E;AAC9E,uBAA0D;AAC1D,mBAAsC;AACtC,sBAA0B;AAenB,IAAMC,iCAAiCC,4BAAWC,KAAK;EAC5DC,SAASF;AACX,CAAA;AAEO,IAAMG,4BAA4BH,4BAAWC,KAAK;EACvDG,YAAYJ;EACZ,GAAGK,oCAAmBC;AACxB,CAAA;AA+CO,SAASC,0BAIdC,YAYAC,SAAuB;AAEvB,MAAID,cAAc,OAAOA,eAAe,UAAU;AAChD,UAAM,IAAIE,oCAAsB;MAC9BC,SAAS;IACX,CAAA;EACF;AAEA,MAAIF,WAAW,OAAOA,YAAY,UAAU;AAC1C,UAAM,IAAIC,oCAAsB;MAC9BC,SAAS;IACX,CAAA;EACF;AAGA,MAAIF,mCAASG,uBAAuB;AAClC,QAAI,CAACC,MAAMC,QAAQL,QAAQG,qBAAqB,GAAG;AACjD,YAAM,IAAIF,oCAAsB;QAC9BC,SAAS;MACX,CAAA;IACF;AAEAF,YAAQG,sBAAsBG,QAAQ,CAACC,OAAOC,UAAAA;AAC5C,UAAI,CAACD,SAAS,OAAOA,UAAU,UAAU;AACvC,cAAM,IAAIN,oCAAsB;UAC9BC,SAAS,yBAAyBM;QACpC,CAAA;MACF;AAEA,UAAI,CAACD,MAAME,YAAY,OAAOF,MAAME,aAAa,UAAU;AACzD,cAAM,IAAIR,oCAAsB;UAC9BC,SAAS,yBAAyBM;QACpC,CAAA;MACF;AAEA,UAAI,CAACD,MAAMG,QAAQ,OAAOH,MAAMG,SAAS,UAAU;AACjD,cAAM,IAAIT,oCAAsB;UAC9BC,SAAS,yBAAyBM;QACpC,CAAA;MACF;AAEA,UAAID,MAAMI,gBAAgB,OAAOJ,MA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qCAAqCS,MAAAA;IAC9C,SAASxB,OAAP;AACA,YAAM,IAAIpB,oCAAsB;QAC9BC,SAAS,qCAAqCM,UAAUa,iBAAiBC,QAAQD,MAAMnB,UAAUqB,OAAOF,KAAAA;MAC1G,CAAA;IACF;EACF,CAAA;AACF;AArBgBuB;;;ADhahBE,QAAQC,KACN,mJAAA;","names":["console","CopilotKitPropertiesAnnotation","Annotation","Root","actions","CopilotKitStateAnnotation","copilotkit","MessagesAnnotation","spec","copilotkitCustomizeConfig","baseConfig","options","CopilotKitMisuseError","message","emitIntermediateState","Array","isArray","forEach","state","index","stateKey","tool","toolArgument","metadata","emitAll","emitToolCalls","undefined","emitMessages","snakeCaseIntermediateState","map","tool_argument","state_key","error","Error","String","copilotkitExit","config","dispatchCustomEvent","copilotkitEmitState","copilotkitEmitMessage","message_id","randomId","role","copilotkitEmitToolCall","name","args","id","convertActionToDynamicStructuredTool","actionInput","description","parameters","DynamicStructuredTool","schema","convertJsonSchemaToZodSchema","func","convertActionsToDynamicStructuredTools","action","console","warn"]}
1
+ {"version":3,"sources":["../src/langchain.ts","../src/langgraph.ts"],"sourcesContent":["console.warn(\n \"Warning: '@copilotkit/sdk-js/langchain' is deprecated and will be removed in a future release. Please use '@copilotkit/sdk-js/langgraph' instead.\",\n);\n\nexport {\n CopilotKitPropertiesAnnotation,\n CopilotKitStateAnnotation,\n type CopilotKitState,\n type CopilotKitProperties,\n copilotkitCustomizeConfig as copilotKitCustomizeConfig,\n copilotkitExit as copilotKitExit,\n copilotkitEmitState as copilotKitEmitState,\n copilotkitEmitMessage as copilotKitEmitMessage,\n copilotkitEmitToolCall as copilotKitEmitToolCall,\n convertActionToDynamicStructuredTool,\n convertActionsToDynamicStructuredTools,\n} from \"./langgraph\";\n","import { RunnableConfig } from \"@langchain/core/runnables\";\nimport { dispatchCustomEvent } from \"@langchain/core/callbacks/dispatch\";\nimport { convertJsonSchemaToZodSchema, randomId } from \"@copilotkit/shared\";\nimport { Annotation, MessagesAnnotation, interrupt } from \"@langchain/langgraph\";\nimport { DynamicStructuredTool } from \"@langchain/core/tools\";\nimport { AIMessage } from \"@langchain/core/messages\";\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\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 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/**\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 await dispatchCustomEvent(\"copilotkit_exit\", {}, config);\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 await dispatchCustomEvent(\"copilotkit_manually_emit_intermediate_state\", state, config);\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 await dispatchCustomEvent(\n \"copilotkit_manually_emit_message\",\n { message, message_id: randomId(), role: \"assistant\" },\n config,\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 await dispatchCustomEvent(\n \"copilotkit_manually_emit_tool_call\",\n { name, args, id: randomId() },\n config,\n );\n}\n\nexport function convertActionToDynamicStructuredTool(actionInput: any): DynamicStructuredTool<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/**\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 return actions.map((action) => convertActionToDynamicStructuredTool(action));\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 Error(\"Either message or action (and optional arguments) must be provided\");\n }\n\n let interruptValues = null;\n let interruptMessage = null;\n let answer = null;\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}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAAA;;;;;;;;;;;;;;;ACCA,sBAAoC;AACpC,oBAAuD;AACvD,uBAA0D;AAC1D,mBAAsC;AACtC,sBAA0B;AAenB,IAAMC,iCAAiCC,4BAAWC,KAAK;EAC5DC,SAASF;AACX,CAAA;AAEO,IAAMG,4BAA4BH,4BAAWC,KAAK;EACvDG,YAAYJ;EACZ,GAAGK,oCAAmBC;AACxB,CAAA;AA+CO,SAASC,0BAIdC,YAYAC,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;AAhDgBH;AAgEhB,eAAsBiB,eAIpBC,QAAsB;AAEtB,YAAMC,qCAAoB,mBAAmB,CAAC,GAAGD,MAAAA;AACnD;AAPsBD;AAuBtB,eAAsBG,oBAIpBF,QAIAP,OAAU;AAEV,YAAMQ,qCAAoB,+CAA+CR,OAAOO,MAAAA;AAClF;AAXsBE;AA8BtB,eAAsBC,sBAIpBH,QAIAI,SAAe;AAEf,YAAMH,qCACJ,oCACA;IAAEG;IAASC,gBAAYC,wBAAAA;IAAYC,MAAM;EAAY,GACrDP,MAAAA;AAEJ;AAfsBG;AA2BtB,eAAsBK,uBAIpBR,QAIAS,MAIAC,MAAS;AAET,YAAMT,qCACJ,sCACA;IAAEQ;IAAMC;IAAMC,QAAIL,wBAAAA;EAAW,GAC7BN,MAAAA;AAEJ;AAnBsBQ;AAqBf,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;AAsBT,SAASQ,uCAId3C,SAAc;AAEd,SAAOA,QAAQe,IAAI,CAAC6B,WAAWT,qCAAqCS,MAAAA,CAAAA;AACtE;AAPgBD;;;ADrQhBE,QAAQC,KACN,mJAAA;","names":["console","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","console","warn"]}
@@ -8,7 +8,7 @@ import {
8
8
  copilotkitEmitState,
9
9
  copilotkitEmitToolCall,
10
10
  copilotkitExit
11
- } from "./chunk-Q5S2AURJ.mjs";
11
+ } from "./chunk-PMVIZ7R2.mjs";
12
12
 
13
13
  // src/langchain.ts
14
14
  console.warn("Warning: '@copilotkit/sdk-js/langchain' is deprecated and will be removed in a future release. Please use '@copilotkit/sdk-js/langgraph' instead.");