@copilotkit/sdk-js 0.0.0-mme-load-agent-state-20250117154700
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 +578 -0
- package/README.md +46 -0
- package/dist/chunk-HGYWIU6Y.mjs +95 -0
- package/dist/chunk-HGYWIU6Y.mjs.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +1 -0
- package/dist/index.mjs.map +1 -0
- package/dist/langchain.d.ts +6 -0
- package/dist/langchain.js +129 -0
- package/dist/langchain.js.map +1 -0
- package/dist/langchain.mjs +26 -0
- package/dist/langchain.mjs.map +1 -0
- package/dist/langgraph.d.ts +238 -0
- package/dist/langgraph.js +124 -0
- package/dist/langgraph.js.map +1 -0
- package/dist/langgraph.mjs +23 -0
- package/dist/langgraph.mjs.map +1 -0
- package/jest.config.js +5 -0
- package/package.json +92 -0
- package/src/index.ts +0 -0
- package/src/langchain.ts +17 -0
- package/src/langgraph.ts +268 -0
- package/tsconfig.json +11 -0
- package/tsup.config.ts +23 -0
- package/typedoc.json +4 -0
|
@@ -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 } from \"@langchain/langgraph\";\nimport { DynamicStructuredTool } from \"@langchain/core/tools\";\n\ninterface IntermediateStateConfig {\n stateKey: string;\n tool: string;\n toolArgument?: string;\n}\n\ninterface OptionsConfig {\n emitToolCalls?: boolean | string | string[];\n emitMessages?: boolean;\n emitAll?: boolean;\n emitIntermediateState?: IntermediateStateConfig[];\n}\n\nexport const CopilotKitPropertiesAnnotation = Annotation.Root({\n actions: Annotation<any[]>,\n});\n\nexport const CopilotKitStateAnnotation = Annotation.Root({\n copilotkit: Annotation<typeof CopilotKitPropertiesAnnotation.State>,\n ...MessagesAnnotation.spec,\n});\n\nexport type CopilotKitState = typeof CopilotKitStateAnnotation.State;\nexport type CopilotKitProperties = typeof CopilotKitPropertiesAnnotation.State;\n\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) {\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) {\n return actions.map((action) => convertActionToDynamicStructuredTool(action));\n}\n"],"mappings":";;;;AACA,SAASA,2BAA2B;AACpC,SAASC,8BAA8BC,gBAAgB;AACvD,SAASC,YAAYC,0BAA0B;AAC/C,SAASC,6BAA6B;AAe/B,IAAMC,iCAAiCC,WAAWC,KAAK;EAC5DC,SAASF;AACX,CAAA;AAEO,IAAMG,4BAA4BH,WAAWC,KAAK;EACvDG,YAAYJ;EACZ,GAAGK,mBAAmBC;AACxB,CAAA;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,QAAMC,oBAAoB,mBAAmB,CAAC,GAAGD,MAAAA;AACnD;AAPsBD;AAuBtB,eAAsBG,oBAIpBF,QAIAP,OAAU;AAEV,QAAMQ,oBAAoB,+CAA+CR,OAAOO,MAAAA;AAClF;AAXsBE;AA8BtB,eAAsBC,sBAIpBH,QAIAI,SAAe;AAEf,QAAMH,oBACJ,oCACA;IAAEG;IAASC,YAAYC,SAAAA;IAAYC,MAAM;EAAY,GACrDP,MAAAA;AAEJ;AAfsBG;AA2BtB,eAAsBK,uBAIpBR,QAIAS,MAIAC,MAAS;AAET,QAAMT,oBACJ,sCACA;IAAEQ;IAAMC;IAAMC,IAAIL,SAAAA;EAAW,GAC7BN,MAAAA;AAEJ;AAnBsBQ;AAqBf,SAASI,qCAAqCC,aAAgB;AACnE,SAAO,IAAIC,sBAAsB;IAC/BL,MAAMI,YAAYJ;IAClBM,aAAaF,YAAYE;IACzBC,QAAQC,6BAA6BJ,YAAYK,YAAY,IAAA;IAC7DC,MAAM,YAAA;AACJ,aAAO;IACT;EACF,CAAA;AACF;AATgBP;AAsBT,SAASQ,uCAId3C,SAAc;AAEd,SAAOA,QAAQe,IAAI,CAAC6B,WAAWT,qCAAqCS,MAAAA,CAAAA;AACtE;AAPgBD;","names":["dispatchCustomEvent","convertJsonSchemaToZodSchema","randomId","Annotation","MessagesAnnotation","DynamicStructuredTool","CopilotKitPropertiesAnnotation","Annotation","Root","actions","CopilotKitStateAnnotation","copilotkit","MessagesAnnotation","spec","copilotkitCustomizeConfig","baseConfig","options","metadata","emitAll","emitToolCalls","undefined","emitMessages","emitIntermediateState","snakeCaseIntermediateState","map","state","tool","tool_argument","toolArgument","state_key","stateKey","copilotkitExit","config","dispatchCustomEvent","copilotkitEmitState","copilotkitEmitMessage","message","message_id","randomId","role","copilotkitEmitToolCall","name","args","id","convertActionToDynamicStructuredTool","actionInput","DynamicStructuredTool","description","schema","convertJsonSchemaToZodSchema","parameters","func","convertActionsToDynamicStructuredTools","action"]}
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { CopilotKitProperties, CopilotKitPropertiesAnnotation, CopilotKitState, CopilotKitStateAnnotation, convertActionToDynamicStructuredTool, convertActionsToDynamicStructuredTools, copilotkitCustomizeConfig as copilotKitCustomizeConfig, copilotkitEmitMessage as copilotKitEmitMessage, copilotkitEmitState as copilotKitEmitState, copilotkitEmitToolCall as copilotKitEmitToolCall, copilotkitExit as copilotKitExit } from './langgraph.js';
|
|
2
|
+
import 'zod';
|
|
3
|
+
import '@langchain/core/messages';
|
|
4
|
+
import '@langchain/langgraph';
|
|
5
|
+
import '@langchain/core/runnables';
|
|
6
|
+
import '@langchain/core/tools';
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/langchain.ts
|
|
21
|
+
var langchain_exports = {};
|
|
22
|
+
__export(langchain_exports, {
|
|
23
|
+
CopilotKitPropertiesAnnotation: () => CopilotKitPropertiesAnnotation,
|
|
24
|
+
CopilotKitStateAnnotation: () => CopilotKitStateAnnotation,
|
|
25
|
+
convertActionToDynamicStructuredTool: () => convertActionToDynamicStructuredTool,
|
|
26
|
+
convertActionsToDynamicStructuredTools: () => convertActionsToDynamicStructuredTools,
|
|
27
|
+
copilotKitCustomizeConfig: () => copilotkitCustomizeConfig,
|
|
28
|
+
copilotKitEmitMessage: () => copilotkitEmitMessage,
|
|
29
|
+
copilotKitEmitState: () => copilotkitEmitState,
|
|
30
|
+
copilotKitEmitToolCall: () => copilotkitEmitToolCall,
|
|
31
|
+
copilotKitExit: () => copilotkitExit
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(langchain_exports);
|
|
34
|
+
|
|
35
|
+
// src/langgraph.ts
|
|
36
|
+
var import_dispatch = require("@langchain/core/callbacks/dispatch");
|
|
37
|
+
var import_shared = require("@copilotkit/shared");
|
|
38
|
+
var import_langgraph = require("@langchain/langgraph");
|
|
39
|
+
var import_tools = require("@langchain/core/tools");
|
|
40
|
+
var CopilotKitPropertiesAnnotation = import_langgraph.Annotation.Root({
|
|
41
|
+
actions: import_langgraph.Annotation
|
|
42
|
+
});
|
|
43
|
+
var CopilotKitStateAnnotation = import_langgraph.Annotation.Root({
|
|
44
|
+
copilotkit: import_langgraph.Annotation,
|
|
45
|
+
...import_langgraph.MessagesAnnotation.spec
|
|
46
|
+
});
|
|
47
|
+
function copilotkitCustomizeConfig(baseConfig, options) {
|
|
48
|
+
const metadata = (baseConfig == null ? void 0 : baseConfig.metadata) || {};
|
|
49
|
+
if (options == null ? void 0 : options.emitAll) {
|
|
50
|
+
metadata["copilotkit:emit-tool-calls"] = true;
|
|
51
|
+
metadata["copilotkit:emit-messages"] = true;
|
|
52
|
+
} else {
|
|
53
|
+
if ((options == null ? void 0 : options.emitToolCalls) !== void 0) {
|
|
54
|
+
metadata["copilotkit:emit-tool-calls"] = options.emitToolCalls;
|
|
55
|
+
}
|
|
56
|
+
if ((options == null ? void 0 : options.emitMessages) !== void 0) {
|
|
57
|
+
metadata["copilotkit:emit-messages"] = options.emitMessages;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
if (options == null ? void 0 : options.emitIntermediateState) {
|
|
61
|
+
const snakeCaseIntermediateState = options.emitIntermediateState.map((state) => ({
|
|
62
|
+
tool: state.tool,
|
|
63
|
+
tool_argument: state.toolArgument,
|
|
64
|
+
state_key: state.stateKey
|
|
65
|
+
}));
|
|
66
|
+
metadata["copilotkit:emit-intermediate-state"] = snakeCaseIntermediateState;
|
|
67
|
+
}
|
|
68
|
+
baseConfig = baseConfig || {};
|
|
69
|
+
return {
|
|
70
|
+
...baseConfig,
|
|
71
|
+
metadata
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
__name(copilotkitCustomizeConfig, "copilotkitCustomizeConfig");
|
|
75
|
+
async function copilotkitExit(config) {
|
|
76
|
+
await (0, import_dispatch.dispatchCustomEvent)("copilotkit_exit", {}, config);
|
|
77
|
+
}
|
|
78
|
+
__name(copilotkitExit, "copilotkitExit");
|
|
79
|
+
async function copilotkitEmitState(config, state) {
|
|
80
|
+
await (0, import_dispatch.dispatchCustomEvent)("copilotkit_manually_emit_intermediate_state", state, config);
|
|
81
|
+
}
|
|
82
|
+
__name(copilotkitEmitState, "copilotkitEmitState");
|
|
83
|
+
async function copilotkitEmitMessage(config, message) {
|
|
84
|
+
await (0, import_dispatch.dispatchCustomEvent)("copilotkit_manually_emit_message", {
|
|
85
|
+
message,
|
|
86
|
+
message_id: (0, import_shared.randomId)(),
|
|
87
|
+
role: "assistant"
|
|
88
|
+
}, config);
|
|
89
|
+
}
|
|
90
|
+
__name(copilotkitEmitMessage, "copilotkitEmitMessage");
|
|
91
|
+
async function copilotkitEmitToolCall(config, name, args) {
|
|
92
|
+
await (0, import_dispatch.dispatchCustomEvent)("copilotkit_manually_emit_tool_call", {
|
|
93
|
+
name,
|
|
94
|
+
args,
|
|
95
|
+
id: (0, import_shared.randomId)()
|
|
96
|
+
}, config);
|
|
97
|
+
}
|
|
98
|
+
__name(copilotkitEmitToolCall, "copilotkitEmitToolCall");
|
|
99
|
+
function convertActionToDynamicStructuredTool(actionInput) {
|
|
100
|
+
return new import_tools.DynamicStructuredTool({
|
|
101
|
+
name: actionInput.name,
|
|
102
|
+
description: actionInput.description,
|
|
103
|
+
schema: (0, import_shared.convertJsonSchemaToZodSchema)(actionInput.parameters, true),
|
|
104
|
+
func: async () => {
|
|
105
|
+
return "";
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
__name(convertActionToDynamicStructuredTool, "convertActionToDynamicStructuredTool");
|
|
110
|
+
function convertActionsToDynamicStructuredTools(actions) {
|
|
111
|
+
return actions.map((action) => convertActionToDynamicStructuredTool(action));
|
|
112
|
+
}
|
|
113
|
+
__name(convertActionsToDynamicStructuredTools, "convertActionsToDynamicStructuredTools");
|
|
114
|
+
|
|
115
|
+
// src/langchain.ts
|
|
116
|
+
console.warn("Warning: '@copilotkit/sdk-js/langchain' is deprecated and will be removed in a future release. Please use '@copilotkit/sdk-js/langgraph' instead.");
|
|
117
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
118
|
+
0 && (module.exports = {
|
|
119
|
+
CopilotKitPropertiesAnnotation,
|
|
120
|
+
CopilotKitStateAnnotation,
|
|
121
|
+
convertActionToDynamicStructuredTool,
|
|
122
|
+
convertActionsToDynamicStructuredTools,
|
|
123
|
+
copilotKitCustomizeConfig,
|
|
124
|
+
copilotKitEmitMessage,
|
|
125
|
+
copilotKitEmitState,
|
|
126
|
+
copilotKitEmitToolCall,
|
|
127
|
+
copilotKitExit
|
|
128
|
+
});
|
|
129
|
+
//# sourceMappingURL=langchain.js.map
|
|
@@ -0,0 +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 } from \"@copilotkit/shared\";\nimport { Annotation, MessagesAnnotation } from \"@langchain/langgraph\";\nimport { DynamicStructuredTool } from \"@langchain/core/tools\";\n\ninterface IntermediateStateConfig {\n stateKey: string;\n tool: string;\n toolArgument?: string;\n}\n\ninterface OptionsConfig {\n emitToolCalls?: boolean | string | string[];\n emitMessages?: boolean;\n emitAll?: boolean;\n emitIntermediateState?: IntermediateStateConfig[];\n}\n\nexport const CopilotKitPropertiesAnnotation = Annotation.Root({\n actions: Annotation<any[]>,\n});\n\nexport const CopilotKitStateAnnotation = Annotation.Root({\n copilotkit: Annotation<typeof CopilotKitPropertiesAnnotation.State>,\n ...MessagesAnnotation.spec,\n});\n\nexport type CopilotKitState = typeof CopilotKitStateAnnotation.State;\nexport type CopilotKitProperties = typeof CopilotKitPropertiesAnnotation.State;\n\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) {\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) {\n return actions.map((action) => convertActionToDynamicStructuredTool(action));\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAAA;;;;;;;;;;;;;;;ACCA,sBAAoC;AACpC,oBAAuD;AACvD,uBAA+C;AAC/C,mBAAsC;AAe/B,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;;;ADpQhBE,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"]}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import {
|
|
2
|
+
CopilotKitPropertiesAnnotation,
|
|
3
|
+
CopilotKitStateAnnotation,
|
|
4
|
+
convertActionToDynamicStructuredTool,
|
|
5
|
+
convertActionsToDynamicStructuredTools,
|
|
6
|
+
copilotkitCustomizeConfig,
|
|
7
|
+
copilotkitEmitMessage,
|
|
8
|
+
copilotkitEmitState,
|
|
9
|
+
copilotkitEmitToolCall,
|
|
10
|
+
copilotkitExit
|
|
11
|
+
} from "./chunk-HGYWIU6Y.mjs";
|
|
12
|
+
|
|
13
|
+
// src/langchain.ts
|
|
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.");
|
|
15
|
+
export {
|
|
16
|
+
CopilotKitPropertiesAnnotation,
|
|
17
|
+
CopilotKitStateAnnotation,
|
|
18
|
+
convertActionToDynamicStructuredTool,
|
|
19
|
+
convertActionsToDynamicStructuredTools,
|
|
20
|
+
copilotkitCustomizeConfig as copilotKitCustomizeConfig,
|
|
21
|
+
copilotkitEmitMessage as copilotKitEmitMessage,
|
|
22
|
+
copilotkitEmitState as copilotKitEmitState,
|
|
23
|
+
copilotkitEmitToolCall as copilotKitEmitToolCall,
|
|
24
|
+
copilotkitExit as copilotKitExit
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=langchain.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/langchain.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"],"mappings":";;;;;;;;;;;;;AAAAA,QAAQC,KACN,mJAAA;","names":["console","warn"]}
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
import * as zod from 'zod';
|
|
2
|
+
import * as _langchain_core_messages from '@langchain/core/messages';
|
|
3
|
+
import * as _langchain_langgraph from '@langchain/langgraph';
|
|
4
|
+
import { RunnableConfig } from '@langchain/core/runnables';
|
|
5
|
+
import { DynamicStructuredTool } from '@langchain/core/tools';
|
|
6
|
+
|
|
7
|
+
interface IntermediateStateConfig {
|
|
8
|
+
stateKey: string;
|
|
9
|
+
tool: string;
|
|
10
|
+
toolArgument?: string;
|
|
11
|
+
}
|
|
12
|
+
interface OptionsConfig {
|
|
13
|
+
emitToolCalls?: boolean | string | string[];
|
|
14
|
+
emitMessages?: boolean;
|
|
15
|
+
emitAll?: boolean;
|
|
16
|
+
emitIntermediateState?: IntermediateStateConfig[];
|
|
17
|
+
}
|
|
18
|
+
declare const CopilotKitPropertiesAnnotation: _langchain_langgraph._INTERNAL_ANNOTATION_ROOT<{
|
|
19
|
+
actions: {
|
|
20
|
+
(): _langchain_langgraph.LastValue<any[]>;
|
|
21
|
+
(annotation: _langchain_langgraph.SingleReducer<any[], any[]>): _langchain_langgraph.BinaryOperatorAggregate<any[], any[]>;
|
|
22
|
+
Root: <S extends _langchain_langgraph.StateDefinition>(sd: S) => _langchain_langgraph._INTERNAL_ANNOTATION_ROOT<S>;
|
|
23
|
+
};
|
|
24
|
+
}>;
|
|
25
|
+
declare const CopilotKitStateAnnotation: _langchain_langgraph._INTERNAL_ANNOTATION_ROOT<{
|
|
26
|
+
messages: _langchain_langgraph.BinaryOperatorAggregate<_langchain_core_messages.BaseMessage[], _langchain_langgraph.Messages>;
|
|
27
|
+
copilotkit: {
|
|
28
|
+
(): _langchain_langgraph.LastValue<_langchain_langgraph.StateType<{
|
|
29
|
+
actions: {
|
|
30
|
+
(): _langchain_langgraph.LastValue<any[]>;
|
|
31
|
+
(annotation: _langchain_langgraph.SingleReducer<any[], any[]>): _langchain_langgraph.BinaryOperatorAggregate<any[], any[]>;
|
|
32
|
+
Root: <S extends _langchain_langgraph.StateDefinition>(sd: S) => _langchain_langgraph._INTERNAL_ANNOTATION_ROOT<S>;
|
|
33
|
+
};
|
|
34
|
+
}>>;
|
|
35
|
+
(annotation: _langchain_langgraph.SingleReducer<_langchain_langgraph.StateType<{
|
|
36
|
+
actions: {
|
|
37
|
+
(): _langchain_langgraph.LastValue<any[]>;
|
|
38
|
+
(annotation: _langchain_langgraph.SingleReducer<any[], any[]>): _langchain_langgraph.BinaryOperatorAggregate<any[], any[]>;
|
|
39
|
+
Root: <S extends _langchain_langgraph.StateDefinition>(sd: S) => _langchain_langgraph._INTERNAL_ANNOTATION_ROOT<S>;
|
|
40
|
+
};
|
|
41
|
+
}>, _langchain_langgraph.StateType<{
|
|
42
|
+
actions: {
|
|
43
|
+
(): _langchain_langgraph.LastValue<any[]>;
|
|
44
|
+
(annotation: _langchain_langgraph.SingleReducer<any[], any[]>): _langchain_langgraph.BinaryOperatorAggregate<any[], any[]>;
|
|
45
|
+
Root: <S extends _langchain_langgraph.StateDefinition>(sd: S) => _langchain_langgraph._INTERNAL_ANNOTATION_ROOT<S>;
|
|
46
|
+
};
|
|
47
|
+
}>>): _langchain_langgraph.BinaryOperatorAggregate<_langchain_langgraph.StateType<{
|
|
48
|
+
actions: {
|
|
49
|
+
(): _langchain_langgraph.LastValue<any[]>;
|
|
50
|
+
(annotation: _langchain_langgraph.SingleReducer<any[], any[]>): _langchain_langgraph.BinaryOperatorAggregate<any[], any[]>;
|
|
51
|
+
Root: <S extends _langchain_langgraph.StateDefinition>(sd: S) => _langchain_langgraph._INTERNAL_ANNOTATION_ROOT<S>;
|
|
52
|
+
};
|
|
53
|
+
}>, _langchain_langgraph.StateType<{
|
|
54
|
+
actions: {
|
|
55
|
+
(): _langchain_langgraph.LastValue<any[]>;
|
|
56
|
+
(annotation: _langchain_langgraph.SingleReducer<any[], any[]>): _langchain_langgraph.BinaryOperatorAggregate<any[], any[]>;
|
|
57
|
+
Root: <S extends _langchain_langgraph.StateDefinition>(sd: S) => _langchain_langgraph._INTERNAL_ANNOTATION_ROOT<S>;
|
|
58
|
+
};
|
|
59
|
+
}>>;
|
|
60
|
+
Root: <S extends _langchain_langgraph.StateDefinition>(sd: S) => _langchain_langgraph._INTERNAL_ANNOTATION_ROOT<S>;
|
|
61
|
+
};
|
|
62
|
+
}>;
|
|
63
|
+
type CopilotKitState = typeof CopilotKitStateAnnotation.State;
|
|
64
|
+
type CopilotKitProperties = typeof CopilotKitPropertiesAnnotation.State;
|
|
65
|
+
/**
|
|
66
|
+
* Customize the LangGraph configuration for use in CopilotKit.
|
|
67
|
+
*
|
|
68
|
+
* To the CopilotKit SDK, run:
|
|
69
|
+
*
|
|
70
|
+
* ```bash
|
|
71
|
+
* npm install @copilotkit/sdk-js
|
|
72
|
+
* ```
|
|
73
|
+
*
|
|
74
|
+
* ### Examples
|
|
75
|
+
*
|
|
76
|
+
* Disable emitting messages and tool calls:
|
|
77
|
+
*
|
|
78
|
+
* ```typescript
|
|
79
|
+
* import { copilotkitCustomizeConfig } from "@copilotkit/sdk-js";
|
|
80
|
+
*
|
|
81
|
+
* config = copilotkitCustomizeConfig(
|
|
82
|
+
* config,
|
|
83
|
+
* emitMessages=false,
|
|
84
|
+
* emitToolCalls=false
|
|
85
|
+
* )
|
|
86
|
+
* ```
|
|
87
|
+
*
|
|
88
|
+
* To emit a tool call as streaming LangGraph state, pass the destination key in state,
|
|
89
|
+
* the tool name and optionally the tool argument. (If you don't pass the argument name,
|
|
90
|
+
* all arguments are emitted under the state key.)
|
|
91
|
+
*
|
|
92
|
+
* ```typescript
|
|
93
|
+
* import { copilotkitCustomizeConfig } from "@copilotkit/sdk-js";
|
|
94
|
+
*
|
|
95
|
+
* config = copilotkitCustomizeConfig(
|
|
96
|
+
* config,
|
|
97
|
+
* emitIntermediateState=[
|
|
98
|
+
* {
|
|
99
|
+
* "stateKey": "steps",
|
|
100
|
+
* "tool": "SearchTool",
|
|
101
|
+
* "toolArgument": "steps",
|
|
102
|
+
* },
|
|
103
|
+
* ],
|
|
104
|
+
* )
|
|
105
|
+
* ```
|
|
106
|
+
*/
|
|
107
|
+
declare function copilotkitCustomizeConfig(
|
|
108
|
+
/**
|
|
109
|
+
* The LangChain/LangGraph configuration to customize.
|
|
110
|
+
*/
|
|
111
|
+
baseConfig: RunnableConfig,
|
|
112
|
+
/**
|
|
113
|
+
* Configuration options:
|
|
114
|
+
* - `emitMessages: boolean?`
|
|
115
|
+
* Configure how messages are emitted. By default, all messages are emitted. Pass false to
|
|
116
|
+
* disable emitting messages.
|
|
117
|
+
* - `emitToolCalls: boolean | string | string[]?`
|
|
118
|
+
* Configure how tool calls are emitted. By default, all tool calls are emitted. Pass false to
|
|
119
|
+
* disable emitting tool calls. Pass a string or list of strings to emit only specific tool calls.
|
|
120
|
+
* - `emitIntermediateState: IntermediateStateConfig[]?`
|
|
121
|
+
* Lets you emit tool calls as streaming LangGraph state.
|
|
122
|
+
*/
|
|
123
|
+
options?: OptionsConfig): RunnableConfig;
|
|
124
|
+
/**
|
|
125
|
+
* Exits the current agent after the run completes. Calling copilotkit_exit() will
|
|
126
|
+
* not immediately stop the agent. Instead, it signals to CopilotKit to stop the agent after
|
|
127
|
+
* the run completes.
|
|
128
|
+
*
|
|
129
|
+
* ### Examples
|
|
130
|
+
*
|
|
131
|
+
* ```typescript
|
|
132
|
+
* import { copilotkitExit } from "@copilotkit/sdk-js";
|
|
133
|
+
*
|
|
134
|
+
* async function myNode(state: Any):
|
|
135
|
+
* await copilotkitExit(config)
|
|
136
|
+
* return state
|
|
137
|
+
* ```
|
|
138
|
+
*/
|
|
139
|
+
declare function copilotkitExit(
|
|
140
|
+
/**
|
|
141
|
+
* The LangChain/LangGraph configuration.
|
|
142
|
+
*/
|
|
143
|
+
config: RunnableConfig): Promise<void>;
|
|
144
|
+
/**
|
|
145
|
+
* Emits intermediate state to CopilotKit. Useful if you have a longer running node and you want to
|
|
146
|
+
* update the user with the current state of the node.
|
|
147
|
+
*
|
|
148
|
+
* ### Examples
|
|
149
|
+
*
|
|
150
|
+
* ```typescript
|
|
151
|
+
* import { copilotkitEmitState } from "@copilotkit/sdk-js";
|
|
152
|
+
*
|
|
153
|
+
* for (let i = 0; i < 10; i++) {
|
|
154
|
+
* await someLongRunningOperation(i);
|
|
155
|
+
* await copilotkitEmitState(config, { progress: i });
|
|
156
|
+
* }
|
|
157
|
+
* ```
|
|
158
|
+
*/
|
|
159
|
+
declare function copilotkitEmitState(
|
|
160
|
+
/**
|
|
161
|
+
* The LangChain/LangGraph configuration.
|
|
162
|
+
*/
|
|
163
|
+
config: RunnableConfig,
|
|
164
|
+
/**
|
|
165
|
+
* The state to emit.
|
|
166
|
+
*/
|
|
167
|
+
state: any): Promise<void>;
|
|
168
|
+
/**
|
|
169
|
+
* Manually emits a message to CopilotKit. Useful in longer running nodes to update the user.
|
|
170
|
+
* Important: You still need to return the messages from the node.
|
|
171
|
+
*
|
|
172
|
+
* ### Examples
|
|
173
|
+
*
|
|
174
|
+
* ```typescript
|
|
175
|
+
* import { copilotkitEmitMessage } from "@copilotkit/sdk-js";
|
|
176
|
+
*
|
|
177
|
+
* const message = "Step 1 of 10 complete";
|
|
178
|
+
* await copilotkitEmitMessage(config, message);
|
|
179
|
+
*
|
|
180
|
+
* // Return the message from the node
|
|
181
|
+
* return {
|
|
182
|
+
* "messages": [AIMessage(content=message)]
|
|
183
|
+
* }
|
|
184
|
+
* ```
|
|
185
|
+
*/
|
|
186
|
+
declare function copilotkitEmitMessage(
|
|
187
|
+
/**
|
|
188
|
+
* The LangChain/LangGraph configuration.
|
|
189
|
+
*/
|
|
190
|
+
config: RunnableConfig,
|
|
191
|
+
/**
|
|
192
|
+
* The message to emit.
|
|
193
|
+
*/
|
|
194
|
+
message: string): Promise<void>;
|
|
195
|
+
/**
|
|
196
|
+
* Manually emits a tool call to CopilotKit.
|
|
197
|
+
*
|
|
198
|
+
* ### Examples
|
|
199
|
+
*
|
|
200
|
+
* ```typescript
|
|
201
|
+
* import { copilotkitEmitToolCall } from "@copilotkit/sdk-js";
|
|
202
|
+
*
|
|
203
|
+
* await copilotkitEmitToolCall(config, name="SearchTool", args={"steps": 10})
|
|
204
|
+
* ```
|
|
205
|
+
*/
|
|
206
|
+
declare function copilotkitEmitToolCall(
|
|
207
|
+
/**
|
|
208
|
+
* The LangChain/LangGraph configuration.
|
|
209
|
+
*/
|
|
210
|
+
config: RunnableConfig,
|
|
211
|
+
/**
|
|
212
|
+
* The name of the tool to emit.
|
|
213
|
+
*/
|
|
214
|
+
name: string,
|
|
215
|
+
/**
|
|
216
|
+
* The arguments to emit.
|
|
217
|
+
*/
|
|
218
|
+
args: any): Promise<void>;
|
|
219
|
+
declare function convertActionToDynamicStructuredTool(actionInput: any): DynamicStructuredTool<zod.ZodType<any, zod.ZodTypeDef, any>>;
|
|
220
|
+
/**
|
|
221
|
+
* Use this function to convert a list of actions you get from state
|
|
222
|
+
* to a list of dynamic structured tools.
|
|
223
|
+
*
|
|
224
|
+
* ### Examples
|
|
225
|
+
*
|
|
226
|
+
* ```typescript
|
|
227
|
+
* import { convertActionsToDynamicStructuredTools } from "@copilotkit/sdk-js";
|
|
228
|
+
*
|
|
229
|
+
* const tools = convertActionsToDynamicStructuredTools(state.copilotkit.actions);
|
|
230
|
+
* ```
|
|
231
|
+
*/
|
|
232
|
+
declare function convertActionsToDynamicStructuredTools(
|
|
233
|
+
/**
|
|
234
|
+
* The list of actions to convert.
|
|
235
|
+
*/
|
|
236
|
+
actions: any[]): DynamicStructuredTool<zod.ZodType<any, zod.ZodTypeDef, any>>[];
|
|
237
|
+
|
|
238
|
+
export { CopilotKitProperties, CopilotKitPropertiesAnnotation, CopilotKitState, CopilotKitStateAnnotation, convertActionToDynamicStructuredTool, convertActionsToDynamicStructuredTools, copilotkitCustomizeConfig, copilotkitEmitMessage, copilotkitEmitState, copilotkitEmitToolCall, copilotkitExit };
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/langgraph.ts
|
|
21
|
+
var langgraph_exports = {};
|
|
22
|
+
__export(langgraph_exports, {
|
|
23
|
+
CopilotKitPropertiesAnnotation: () => CopilotKitPropertiesAnnotation,
|
|
24
|
+
CopilotKitStateAnnotation: () => CopilotKitStateAnnotation,
|
|
25
|
+
convertActionToDynamicStructuredTool: () => convertActionToDynamicStructuredTool,
|
|
26
|
+
convertActionsToDynamicStructuredTools: () => convertActionsToDynamicStructuredTools,
|
|
27
|
+
copilotkitCustomizeConfig: () => copilotkitCustomizeConfig,
|
|
28
|
+
copilotkitEmitMessage: () => copilotkitEmitMessage,
|
|
29
|
+
copilotkitEmitState: () => copilotkitEmitState,
|
|
30
|
+
copilotkitEmitToolCall: () => copilotkitEmitToolCall,
|
|
31
|
+
copilotkitExit: () => copilotkitExit
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(langgraph_exports);
|
|
34
|
+
var import_dispatch = require("@langchain/core/callbacks/dispatch");
|
|
35
|
+
var import_shared = require("@copilotkit/shared");
|
|
36
|
+
var import_langgraph = require("@langchain/langgraph");
|
|
37
|
+
var import_tools = require("@langchain/core/tools");
|
|
38
|
+
var CopilotKitPropertiesAnnotation = import_langgraph.Annotation.Root({
|
|
39
|
+
actions: import_langgraph.Annotation
|
|
40
|
+
});
|
|
41
|
+
var CopilotKitStateAnnotation = import_langgraph.Annotation.Root({
|
|
42
|
+
copilotkit: import_langgraph.Annotation,
|
|
43
|
+
...import_langgraph.MessagesAnnotation.spec
|
|
44
|
+
});
|
|
45
|
+
function copilotkitCustomizeConfig(baseConfig, options) {
|
|
46
|
+
const metadata = (baseConfig == null ? void 0 : baseConfig.metadata) || {};
|
|
47
|
+
if (options == null ? void 0 : options.emitAll) {
|
|
48
|
+
metadata["copilotkit:emit-tool-calls"] = true;
|
|
49
|
+
metadata["copilotkit:emit-messages"] = true;
|
|
50
|
+
} else {
|
|
51
|
+
if ((options == null ? void 0 : options.emitToolCalls) !== void 0) {
|
|
52
|
+
metadata["copilotkit:emit-tool-calls"] = options.emitToolCalls;
|
|
53
|
+
}
|
|
54
|
+
if ((options == null ? void 0 : options.emitMessages) !== void 0) {
|
|
55
|
+
metadata["copilotkit:emit-messages"] = options.emitMessages;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
if (options == null ? void 0 : options.emitIntermediateState) {
|
|
59
|
+
const snakeCaseIntermediateState = options.emitIntermediateState.map((state) => ({
|
|
60
|
+
tool: state.tool,
|
|
61
|
+
tool_argument: state.toolArgument,
|
|
62
|
+
state_key: state.stateKey
|
|
63
|
+
}));
|
|
64
|
+
metadata["copilotkit:emit-intermediate-state"] = snakeCaseIntermediateState;
|
|
65
|
+
}
|
|
66
|
+
baseConfig = baseConfig || {};
|
|
67
|
+
return {
|
|
68
|
+
...baseConfig,
|
|
69
|
+
metadata
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
__name(copilotkitCustomizeConfig, "copilotkitCustomizeConfig");
|
|
73
|
+
async function copilotkitExit(config) {
|
|
74
|
+
await (0, import_dispatch.dispatchCustomEvent)("copilotkit_exit", {}, config);
|
|
75
|
+
}
|
|
76
|
+
__name(copilotkitExit, "copilotkitExit");
|
|
77
|
+
async function copilotkitEmitState(config, state) {
|
|
78
|
+
await (0, import_dispatch.dispatchCustomEvent)("copilotkit_manually_emit_intermediate_state", state, config);
|
|
79
|
+
}
|
|
80
|
+
__name(copilotkitEmitState, "copilotkitEmitState");
|
|
81
|
+
async function copilotkitEmitMessage(config, message) {
|
|
82
|
+
await (0, import_dispatch.dispatchCustomEvent)("copilotkit_manually_emit_message", {
|
|
83
|
+
message,
|
|
84
|
+
message_id: (0, import_shared.randomId)(),
|
|
85
|
+
role: "assistant"
|
|
86
|
+
}, config);
|
|
87
|
+
}
|
|
88
|
+
__name(copilotkitEmitMessage, "copilotkitEmitMessage");
|
|
89
|
+
async function copilotkitEmitToolCall(config, name, args) {
|
|
90
|
+
await (0, import_dispatch.dispatchCustomEvent)("copilotkit_manually_emit_tool_call", {
|
|
91
|
+
name,
|
|
92
|
+
args,
|
|
93
|
+
id: (0, import_shared.randomId)()
|
|
94
|
+
}, config);
|
|
95
|
+
}
|
|
96
|
+
__name(copilotkitEmitToolCall, "copilotkitEmitToolCall");
|
|
97
|
+
function convertActionToDynamicStructuredTool(actionInput) {
|
|
98
|
+
return new import_tools.DynamicStructuredTool({
|
|
99
|
+
name: actionInput.name,
|
|
100
|
+
description: actionInput.description,
|
|
101
|
+
schema: (0, import_shared.convertJsonSchemaToZodSchema)(actionInput.parameters, true),
|
|
102
|
+
func: async () => {
|
|
103
|
+
return "";
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
__name(convertActionToDynamicStructuredTool, "convertActionToDynamicStructuredTool");
|
|
108
|
+
function convertActionsToDynamicStructuredTools(actions) {
|
|
109
|
+
return actions.map((action) => convertActionToDynamicStructuredTool(action));
|
|
110
|
+
}
|
|
111
|
+
__name(convertActionsToDynamicStructuredTools, "convertActionsToDynamicStructuredTools");
|
|
112
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
113
|
+
0 && (module.exports = {
|
|
114
|
+
CopilotKitPropertiesAnnotation,
|
|
115
|
+
CopilotKitStateAnnotation,
|
|
116
|
+
convertActionToDynamicStructuredTool,
|
|
117
|
+
convertActionsToDynamicStructuredTools,
|
|
118
|
+
copilotkitCustomizeConfig,
|
|
119
|
+
copilotkitEmitMessage,
|
|
120
|
+
copilotkitEmitState,
|
|
121
|
+
copilotkitEmitToolCall,
|
|
122
|
+
copilotkitExit
|
|
123
|
+
});
|
|
124
|
+
//# sourceMappingURL=langgraph.js.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 } from \"@langchain/langgraph\";\nimport { DynamicStructuredTool } from \"@langchain/core/tools\";\n\ninterface IntermediateStateConfig {\n stateKey: string;\n tool: string;\n toolArgument?: string;\n}\n\ninterface OptionsConfig {\n emitToolCalls?: boolean | string | string[];\n emitMessages?: boolean;\n emitAll?: boolean;\n emitIntermediateState?: IntermediateStateConfig[];\n}\n\nexport const CopilotKitPropertiesAnnotation = Annotation.Root({\n actions: Annotation<any[]>,\n});\n\nexport const CopilotKitStateAnnotation = Annotation.Root({\n copilotkit: Annotation<typeof CopilotKitPropertiesAnnotation.State>,\n ...MessagesAnnotation.spec,\n});\n\nexport type CopilotKitState = typeof CopilotKitStateAnnotation.State;\nexport type CopilotKitProperties = typeof CopilotKitPropertiesAnnotation.State;\n\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) {\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) {\n return actions.map((action) => convertActionToDynamicStructuredTool(action));\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AACA;;;;;;;;;;;;;sBAAoC;AACpC,oBAAuD;AACvD,uBAA+C;AAC/C,mBAAsC;AAe/B,IAAMA,iCAAiCC,4BAAWC,KAAK;EAC5DC,SAASF;AACX,CAAA;AAEO,IAAMG,4BAA4BH,4BAAWC,KAAK;EACvDG,YAAYJ;EACZ,GAAGK,oCAAmBC;AACxB,CAAA;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;","names":["CopilotKitPropertiesAnnotation","Annotation","Root","actions","CopilotKitStateAnnotation","copilotkit","MessagesAnnotation","spec","copilotkitCustomizeConfig","baseConfig","options","metadata","emitAll","emitToolCalls","undefined","emitMessages","emitIntermediateState","snakeCaseIntermediateState","map","state","tool","tool_argument","toolArgument","state_key","stateKey","copilotkitExit","config","dispatchCustomEvent","copilotkitEmitState","copilotkitEmitMessage","message","message_id","randomId","role","copilotkitEmitToolCall","name","args","id","convertActionToDynamicStructuredTool","actionInput","DynamicStructuredTool","description","schema","convertJsonSchemaToZodSchema","parameters","func","convertActionsToDynamicStructuredTools","action"]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import {
|
|
2
|
+
CopilotKitPropertiesAnnotation,
|
|
3
|
+
CopilotKitStateAnnotation,
|
|
4
|
+
convertActionToDynamicStructuredTool,
|
|
5
|
+
convertActionsToDynamicStructuredTools,
|
|
6
|
+
copilotkitCustomizeConfig,
|
|
7
|
+
copilotkitEmitMessage,
|
|
8
|
+
copilotkitEmitState,
|
|
9
|
+
copilotkitEmitToolCall,
|
|
10
|
+
copilotkitExit
|
|
11
|
+
} from "./chunk-HGYWIU6Y.mjs";
|
|
12
|
+
export {
|
|
13
|
+
CopilotKitPropertiesAnnotation,
|
|
14
|
+
CopilotKitStateAnnotation,
|
|
15
|
+
convertActionToDynamicStructuredTool,
|
|
16
|
+
convertActionsToDynamicStructuredTools,
|
|
17
|
+
copilotkitCustomizeConfig,
|
|
18
|
+
copilotkitEmitMessage,
|
|
19
|
+
copilotkitEmitState,
|
|
20
|
+
copilotkitEmitToolCall,
|
|
21
|
+
copilotkitExit
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=langgraph.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|