@copilotkit/sdk-js 1.4.1-pre.2 → 1.4.1-pre.5
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 +27 -3
- package/dist/langchain.d.ts +2 -6
- package/dist/langchain.js +1 -21
- package/dist/langchain.js.map +1 -1
- package/dist/langchain.mjs +2 -20
- package/dist/langchain.mjs.map +1 -1
- package/package.json +4 -4
- package/src/langchain.ts +2 -18
package/CHANGELOG.md
CHANGED
|
@@ -1,10 +1,34 @@
|
|
|
1
1
|
# @copilotkit/sdk-js
|
|
2
2
|
|
|
3
|
+
## 1.4.1-pre.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- bump
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
- @copilotkit/shared@1.4.1-pre.5
|
|
10
|
+
|
|
11
|
+
## 1.4.1-pre.4
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- bump
|
|
16
|
+
- Updated dependencies
|
|
17
|
+
- @copilotkit/shared@1.4.1-pre.4
|
|
18
|
+
|
|
19
|
+
## 1.4.1-pre.3
|
|
20
|
+
|
|
21
|
+
### Patch Changes
|
|
22
|
+
|
|
23
|
+
- bump
|
|
24
|
+
- Updated dependencies
|
|
25
|
+
- @copilotkit/shared@1.4.1-pre.3
|
|
26
|
+
|
|
3
27
|
## 1.4.1-pre.2
|
|
4
28
|
|
|
5
29
|
### Patch Changes
|
|
6
30
|
|
|
7
|
-
-
|
|
31
|
+
- bump
|
|
8
32
|
- Updated dependencies
|
|
9
33
|
- @copilotkit/shared@1.4.1-pre.2
|
|
10
34
|
|
|
@@ -12,7 +36,7 @@
|
|
|
12
36
|
|
|
13
37
|
### Patch Changes
|
|
14
38
|
|
|
15
|
-
-
|
|
39
|
+
- bump
|
|
16
40
|
- Updated dependencies
|
|
17
41
|
- @copilotkit/shared@1.4.1-pre.1
|
|
18
42
|
|
|
@@ -20,7 +44,7 @@
|
|
|
20
44
|
|
|
21
45
|
### Patch Changes
|
|
22
46
|
|
|
23
|
-
-
|
|
47
|
+
- New prerelease
|
|
24
48
|
- Updated dependencies
|
|
25
49
|
- @copilotkit/shared@1.4.1-pre.0
|
|
26
50
|
|
package/dist/langchain.d.ts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import * as zod from 'zod';
|
|
2
1
|
import * as _langchain_core_messages from '@langchain/core/messages';
|
|
3
2
|
import * as _langchain_langgraph from '@langchain/langgraph';
|
|
4
3
|
import { RunnableConfig } from '@langchain/core/runnables';
|
|
5
|
-
import { DynamicStructuredTool } from '@langchain/core/tools';
|
|
6
4
|
|
|
7
5
|
interface IntermediateStateConfig {
|
|
8
6
|
stateKey: string;
|
|
@@ -24,7 +22,7 @@ declare const CopilotKitPropertiesAnnotation: _langchain_langgraph._INTERNAL_ANN
|
|
|
24
22
|
}>;
|
|
25
23
|
declare const CopilotKitStateAnnotation: _langchain_langgraph._INTERNAL_ANNOTATION_ROOT<{
|
|
26
24
|
messages: _langchain_langgraph.BinaryOperatorAggregate<_langchain_core_messages.BaseMessage[], _langchain_langgraph.Messages>;
|
|
27
|
-
|
|
25
|
+
copilotKit: {
|
|
28
26
|
(): _langchain_langgraph.LastValue<_langchain_langgraph.StateType<{
|
|
29
27
|
actions: {
|
|
30
28
|
(): _langchain_langgraph.LastValue<any[]>;
|
|
@@ -67,7 +65,5 @@ declare function copilotKitExit(config: RunnableConfig): Promise<void>;
|
|
|
67
65
|
declare function copilotKitEmitState(config: RunnableConfig, state: any): Promise<void>;
|
|
68
66
|
declare function copilotKitEmitMessage(config: RunnableConfig, message: string): Promise<void>;
|
|
69
67
|
declare function copilotKitEmitToolCall(config: RunnableConfig, name: string, args: any): Promise<void>;
|
|
70
|
-
declare function convertActionToDynamicStructuredTool(actionInput: any): DynamicStructuredTool<zod.ZodType<any, zod.ZodTypeDef, any>>;
|
|
71
|
-
declare function convertActionsToDynamicStructuredTools(actions: any[]): DynamicStructuredTool<zod.ZodType<any, zod.ZodTypeDef, any>>[];
|
|
72
68
|
|
|
73
|
-
export { CopilotKitProperties, CopilotKitPropertiesAnnotation, CopilotKitState, CopilotKitStateAnnotation,
|
|
69
|
+
export { CopilotKitProperties, CopilotKitPropertiesAnnotation, CopilotKitState, CopilotKitStateAnnotation, copilotKitCustomizeConfig, copilotKitEmitMessage, copilotKitEmitState, copilotKitEmitToolCall, copilotKitExit };
|
package/dist/langchain.js
CHANGED
|
@@ -22,8 +22,6 @@ var langchain_exports = {};
|
|
|
22
22
|
__export(langchain_exports, {
|
|
23
23
|
CopilotKitPropertiesAnnotation: () => CopilotKitPropertiesAnnotation,
|
|
24
24
|
CopilotKitStateAnnotation: () => CopilotKitStateAnnotation,
|
|
25
|
-
convertActionToDynamicStructuredTool: () => convertActionToDynamicStructuredTool,
|
|
26
|
-
convertActionsToDynamicStructuredTools: () => convertActionsToDynamicStructuredTools,
|
|
27
25
|
copilotKitCustomizeConfig: () => copilotKitCustomizeConfig,
|
|
28
26
|
copilotKitEmitMessage: () => copilotKitEmitMessage,
|
|
29
27
|
copilotKitEmitState: () => copilotKitEmitState,
|
|
@@ -34,12 +32,11 @@ module.exports = __toCommonJS(langchain_exports);
|
|
|
34
32
|
var import_dispatch = require("@langchain/core/callbacks/dispatch");
|
|
35
33
|
var import_shared = require("@copilotkit/shared");
|
|
36
34
|
var import_langgraph = require("@langchain/langgraph");
|
|
37
|
-
var import_tools = require("@langchain/core/tools");
|
|
38
35
|
var CopilotKitPropertiesAnnotation = import_langgraph.Annotation.Root({
|
|
39
36
|
actions: import_langgraph.Annotation
|
|
40
37
|
});
|
|
41
38
|
var CopilotKitStateAnnotation = import_langgraph.Annotation.Root({
|
|
42
|
-
|
|
39
|
+
copilotKit: import_langgraph.Annotation,
|
|
43
40
|
...import_langgraph.MessagesAnnotation.spec
|
|
44
41
|
});
|
|
45
42
|
function copilotKitCustomizeConfig(baseConfig, options) {
|
|
@@ -94,27 +91,10 @@ async function copilotKitEmitToolCall(config, name, args) {
|
|
|
94
91
|
}, config);
|
|
95
92
|
}
|
|
96
93
|
__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
94
|
// Annotate the CommonJS export names for ESM import in node:
|
|
113
95
|
0 && (module.exports = {
|
|
114
96
|
CopilotKitPropertiesAnnotation,
|
|
115
97
|
CopilotKitStateAnnotation,
|
|
116
|
-
convertActionToDynamicStructuredTool,
|
|
117
|
-
convertActionsToDynamicStructuredTools,
|
|
118
98
|
copilotKitCustomizeConfig,
|
|
119
99
|
copilotKitEmitMessage,
|
|
120
100
|
copilotKitEmitState,
|
package/dist/langchain.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/langchain.ts"],"sourcesContent":["import { RunnableConfig } from \"@langchain/core/runnables\";\nimport { dispatchCustomEvent } from \"@langchain/core/callbacks/dispatch\";\nimport {
|
|
1
|
+
{"version":3,"sources":["../src/langchain.ts"],"sourcesContent":["import { RunnableConfig } from \"@langchain/core/runnables\";\nimport { dispatchCustomEvent } from \"@langchain/core/callbacks/dispatch\";\nimport { randomId } from \"@copilotkit/shared\";\nimport { Annotation, MessagesAnnotation } from \"@langchain/langgraph\";\n\ninterface IntermediateStateConfig {\n stateKey: string;\n tool: string;\n toolArgument?: string;\n}\n\ninterface OptionsConfig {\n emitToolCalls?: boolean | string | string[];\n emitMessages?: boolean;\n emitAll?: boolean;\n emitIntermediateState?: IntermediateStateConfig[];\n}\n\nexport const CopilotKitPropertiesAnnotation = Annotation.Root({\n actions: Annotation<any[]>,\n});\n\nexport const CopilotKitStateAnnotation = Annotation.Root({\n copilotKit: Annotation<typeof CopilotKitPropertiesAnnotation.State>,\n ...MessagesAnnotation.spec,\n});\n\nexport type CopilotKitState = typeof CopilotKitStateAnnotation.State;\nexport type CopilotKitProperties = typeof CopilotKitPropertiesAnnotation.State;\n\nexport function copilotKitCustomizeConfig(\n baseConfig: RunnableConfig,\n options?: OptionsConfig,\n): RunnableConfig {\n const metadata = baseConfig?.metadata || {};\n\n if (options?.emitAll) {\n metadata[\"copilotkit:emit-tool-calls\"] = true;\n metadata[\"copilotkit:emit-messages\"] = true;\n } else {\n if (options?.emitToolCalls !== undefined) {\n metadata[\"copilotkit:emit-tool-calls\"] = options.emitToolCalls;\n }\n if (options?.emitMessages !== undefined) {\n metadata[\"copilotkit:emit-messages\"] = options.emitMessages;\n }\n }\n\n if (options?.emitIntermediateState) {\n const snakeCaseIntermediateState = options.emitIntermediateState.map((state) => ({\n tool: state.tool,\n tool_argument: state.toolArgument,\n state_key: state.stateKey,\n }));\n\n metadata[\"copilotkit:emit-intermediate-state\"] = snakeCaseIntermediateState;\n }\n\n baseConfig = baseConfig || {};\n\n return {\n ...baseConfig,\n metadata: metadata,\n };\n}\n\nexport async function copilotKitExit(config: RunnableConfig) {\n await dispatchCustomEvent(\"copilotkit_exit\", {}, config);\n}\n\nexport async function copilotKitEmitState(config: RunnableConfig, state: any) {\n await dispatchCustomEvent(\"copilotkit_manually_emit_intermediate_state\", state, config);\n}\n\nexport async function copilotKitEmitMessage(config: RunnableConfig, message: string) {\n await dispatchCustomEvent(\n \"copilotkit_manually_emit_message\",\n { message, message_id: randomId(), role: \"assistant\" },\n config,\n );\n}\n\nexport async function copilotKitEmitToolCall(config: RunnableConfig, name: string, args: any) {\n await dispatchCustomEvent(\n \"copilotkit_manually_emit_tool_call\",\n { name, args, id: randomId() },\n config,\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AACA;;;;;;;;;;;sBAAoC;AACpC,oBAAyB;AACzB,uBAA+C;AAexC,IAAMA,iCAAiCC,4BAAWC,KAAK;EAC5DC,SAASF;AACX,CAAA;AAEO,IAAMG,4BAA4BH,4BAAWC,KAAK;EACvDG,YAAYJ;EACZ,GAAGK,oCAAmBC;AACxB,CAAA;AAKO,SAASC,0BACdC,YACAC,SAAuB;AAEvB,QAAMC,YAAWF,yCAAYE,aAAY,CAAC;AAE1C,MAAID,mCAASE,SAAS;AACpBD,aAAS,4BAAA,IAAgC;AACzCA,aAAS,0BAAA,IAA8B;EACzC,OAAO;AACL,SAAID,mCAASG,mBAAkBC,QAAW;AACxCH,eAAS,4BAAA,IAAgCD,QAAQG;IACnD;AACA,SAAIH,mCAASK,kBAAiBD,QAAW;AACvCH,eAAS,0BAAA,IAA8BD,QAAQK;IACjD;EACF;AAEA,MAAIL,mCAASM,uBAAuB;AAClC,UAAMC,6BAA6BP,QAAQM,sBAAsBE,IAAI,CAACC,WAAW;MAC/EC,MAAMD,MAAMC;MACZC,eAAeF,MAAMG;MACrBC,WAAWJ,MAAMK;IACnB,EAAA;AAEAb,aAAS,oCAAA,IAAwCM;EACnD;AAEAR,eAAaA,cAAc,CAAC;AAE5B,SAAO;IACL,GAAGA;IACHE;EACF;AACF;AAlCgBH;AAoChB,eAAsBiB,eAAeC,QAAsB;AACzD,YAAMC,qCAAoB,mBAAmB,CAAC,GAAGD,MAAAA;AACnD;AAFsBD;AAItB,eAAsBG,oBAAoBF,QAAwBP,OAAU;AAC1E,YAAMQ,qCAAoB,+CAA+CR,OAAOO,MAAAA;AAClF;AAFsBE;AAItB,eAAsBC,sBAAsBH,QAAwBI,SAAe;AACjF,YAAMH,qCACJ,oCACA;IAAEG;IAASC,gBAAYC,wBAAAA;IAAYC,MAAM;EAAY,GACrDP,MAAAA;AAEJ;AANsBG;AAQtB,eAAsBK,uBAAuBR,QAAwBS,MAAcC,MAAS;AAC1F,YAAMT,qCACJ,sCACA;IAAEQ;IAAMC;IAAMC,QAAIL,wBAAAA;EAAW,GAC7BN,MAAAA;AAEJ;AANsBQ;","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"]}
|
package/dist/langchain.mjs
CHANGED
|
@@ -3,14 +3,13 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
3
3
|
|
|
4
4
|
// src/langchain.ts
|
|
5
5
|
import { dispatchCustomEvent } from "@langchain/core/callbacks/dispatch";
|
|
6
|
-
import {
|
|
6
|
+
import { randomId } from "@copilotkit/shared";
|
|
7
7
|
import { Annotation, MessagesAnnotation } from "@langchain/langgraph";
|
|
8
|
-
import { DynamicStructuredTool } from "@langchain/core/tools";
|
|
9
8
|
var CopilotKitPropertiesAnnotation = Annotation.Root({
|
|
10
9
|
actions: Annotation
|
|
11
10
|
});
|
|
12
11
|
var CopilotKitStateAnnotation = Annotation.Root({
|
|
13
|
-
|
|
12
|
+
copilotKit: Annotation,
|
|
14
13
|
...MessagesAnnotation.spec
|
|
15
14
|
});
|
|
16
15
|
function copilotKitCustomizeConfig(baseConfig, options) {
|
|
@@ -65,26 +64,9 @@ async function copilotKitEmitToolCall(config, name, args) {
|
|
|
65
64
|
}, config);
|
|
66
65
|
}
|
|
67
66
|
__name(copilotKitEmitToolCall, "copilotKitEmitToolCall");
|
|
68
|
-
function convertActionToDynamicStructuredTool(actionInput) {
|
|
69
|
-
return new DynamicStructuredTool({
|
|
70
|
-
name: actionInput.name,
|
|
71
|
-
description: actionInput.description,
|
|
72
|
-
schema: convertJsonSchemaToZodSchema(actionInput.parameters, true),
|
|
73
|
-
func: async () => {
|
|
74
|
-
return "";
|
|
75
|
-
}
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
__name(convertActionToDynamicStructuredTool, "convertActionToDynamicStructuredTool");
|
|
79
|
-
function convertActionsToDynamicStructuredTools(actions) {
|
|
80
|
-
return actions.map((action) => convertActionToDynamicStructuredTool(action));
|
|
81
|
-
}
|
|
82
|
-
__name(convertActionsToDynamicStructuredTools, "convertActionsToDynamicStructuredTools");
|
|
83
67
|
export {
|
|
84
68
|
CopilotKitPropertiesAnnotation,
|
|
85
69
|
CopilotKitStateAnnotation,
|
|
86
|
-
convertActionToDynamicStructuredTool,
|
|
87
|
-
convertActionsToDynamicStructuredTools,
|
|
88
70
|
copilotKitCustomizeConfig,
|
|
89
71
|
copilotKitEmitMessage,
|
|
90
72
|
copilotKitEmitState,
|
package/dist/langchain.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/langchain.ts"],"sourcesContent":["import { RunnableConfig } from \"@langchain/core/runnables\";\nimport { dispatchCustomEvent } from \"@langchain/core/callbacks/dispatch\";\nimport {
|
|
1
|
+
{"version":3,"sources":["../src/langchain.ts"],"sourcesContent":["import { RunnableConfig } from \"@langchain/core/runnables\";\nimport { dispatchCustomEvent } from \"@langchain/core/callbacks/dispatch\";\nimport { randomId } from \"@copilotkit/shared\";\nimport { Annotation, MessagesAnnotation } from \"@langchain/langgraph\";\n\ninterface IntermediateStateConfig {\n stateKey: string;\n tool: string;\n toolArgument?: string;\n}\n\ninterface OptionsConfig {\n emitToolCalls?: boolean | string | string[];\n emitMessages?: boolean;\n emitAll?: boolean;\n emitIntermediateState?: IntermediateStateConfig[];\n}\n\nexport const CopilotKitPropertiesAnnotation = Annotation.Root({\n actions: Annotation<any[]>,\n});\n\nexport const CopilotKitStateAnnotation = Annotation.Root({\n copilotKit: Annotation<typeof CopilotKitPropertiesAnnotation.State>,\n ...MessagesAnnotation.spec,\n});\n\nexport type CopilotKitState = typeof CopilotKitStateAnnotation.State;\nexport type CopilotKitProperties = typeof CopilotKitPropertiesAnnotation.State;\n\nexport function copilotKitCustomizeConfig(\n baseConfig: RunnableConfig,\n options?: OptionsConfig,\n): RunnableConfig {\n const metadata = baseConfig?.metadata || {};\n\n if (options?.emitAll) {\n metadata[\"copilotkit:emit-tool-calls\"] = true;\n metadata[\"copilotkit:emit-messages\"] = true;\n } else {\n if (options?.emitToolCalls !== undefined) {\n metadata[\"copilotkit:emit-tool-calls\"] = options.emitToolCalls;\n }\n if (options?.emitMessages !== undefined) {\n metadata[\"copilotkit:emit-messages\"] = options.emitMessages;\n }\n }\n\n if (options?.emitIntermediateState) {\n const snakeCaseIntermediateState = options.emitIntermediateState.map((state) => ({\n tool: state.tool,\n tool_argument: state.toolArgument,\n state_key: state.stateKey,\n }));\n\n metadata[\"copilotkit:emit-intermediate-state\"] = snakeCaseIntermediateState;\n }\n\n baseConfig = baseConfig || {};\n\n return {\n ...baseConfig,\n metadata: metadata,\n };\n}\n\nexport async function copilotKitExit(config: RunnableConfig) {\n await dispatchCustomEvent(\"copilotkit_exit\", {}, config);\n}\n\nexport async function copilotKitEmitState(config: RunnableConfig, state: any) {\n await dispatchCustomEvent(\"copilotkit_manually_emit_intermediate_state\", state, config);\n}\n\nexport async function copilotKitEmitMessage(config: RunnableConfig, message: string) {\n await dispatchCustomEvent(\n \"copilotkit_manually_emit_message\",\n { message, message_id: randomId(), role: \"assistant\" },\n config,\n );\n}\n\nexport async function copilotKitEmitToolCall(config: RunnableConfig, name: string, args: any) {\n await dispatchCustomEvent(\n \"copilotkit_manually_emit_tool_call\",\n { name, args, id: randomId() },\n config,\n );\n}\n"],"mappings":";;;;AACA,SAASA,2BAA2B;AACpC,SAASC,gBAAgB;AACzB,SAASC,YAAYC,0BAA0B;AAexC,IAAMC,iCAAiCC,WAAWC,KAAK;EAC5DC,SAASF;AACX,CAAA;AAEO,IAAMG,4BAA4BH,WAAWC,KAAK;EACvDG,YAAYJ;EACZ,GAAGK,mBAAmBC;AACxB,CAAA;AAKO,SAASC,0BACdC,YACAC,SAAuB;AAEvB,QAAMC,YAAWF,yCAAYE,aAAY,CAAC;AAE1C,MAAID,mCAASE,SAAS;AACpBD,aAAS,4BAAA,IAAgC;AACzCA,aAAS,0BAAA,IAA8B;EACzC,OAAO;AACL,SAAID,mCAASG,mBAAkBC,QAAW;AACxCH,eAAS,4BAAA,IAAgCD,QAAQG;IACnD;AACA,SAAIH,mCAASK,kBAAiBD,QAAW;AACvCH,eAAS,0BAAA,IAA8BD,QAAQK;IACjD;EACF;AAEA,MAAIL,mCAASM,uBAAuB;AAClC,UAAMC,6BAA6BP,QAAQM,sBAAsBE,IAAI,CAACC,WAAW;MAC/EC,MAAMD,MAAMC;MACZC,eAAeF,MAAMG;MACrBC,WAAWJ,MAAMK;IACnB,EAAA;AAEAb,aAAS,oCAAA,IAAwCM;EACnD;AAEAR,eAAaA,cAAc,CAAC;AAE5B,SAAO;IACL,GAAGA;IACHE;EACF;AACF;AAlCgBH;AAoChB,eAAsBiB,eAAeC,QAAsB;AACzD,QAAMC,oBAAoB,mBAAmB,CAAC,GAAGD,MAAAA;AACnD;AAFsBD;AAItB,eAAsBG,oBAAoBF,QAAwBP,OAAU;AAC1E,QAAMQ,oBAAoB,+CAA+CR,OAAOO,MAAAA;AAClF;AAFsBE;AAItB,eAAsBC,sBAAsBH,QAAwBI,SAAe;AACjF,QAAMH,oBACJ,oCACA;IAAEG;IAASC,YAAYC,SAAAA;IAAYC,MAAM;EAAY,GACrDP,MAAAA;AAEJ;AANsBG;AAQtB,eAAsBK,uBAAuBR,QAAwBS,MAAcC,MAAS;AAC1F,QAAMT,oBACJ,sCACA;IAAEQ;IAAMC;IAAMC,IAAIL,SAAAA;EAAW,GAC7BN,MAAAA;AAEJ;AANsBQ;","names":["dispatchCustomEvent","randomId","Annotation","MessagesAnnotation","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"]}
|
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"publishConfig": {
|
|
10
10
|
"access": "public"
|
|
11
11
|
},
|
|
12
|
-
"version": "1.4.1-pre.
|
|
12
|
+
"version": "1.4.1-pre.5",
|
|
13
13
|
"sideEffects": false,
|
|
14
14
|
"main": "./dist/index.js",
|
|
15
15
|
"module": "./dist/index.mjs",
|
|
@@ -49,8 +49,8 @@
|
|
|
49
49
|
"tsup": "^6.7.0",
|
|
50
50
|
"typescript": "^5.2.3",
|
|
51
51
|
"zod-to-json-schema": "^3.23.5",
|
|
52
|
-
"eslint-config-custom": "1.4.1-pre.
|
|
53
|
-
"tsconfig": "1.4.1-pre.
|
|
52
|
+
"eslint-config-custom": "1.4.1-pre.5",
|
|
53
|
+
"tsconfig": "1.4.1-pre.5"
|
|
54
54
|
},
|
|
55
55
|
"dependencies": {
|
|
56
56
|
"@langchain/community": "^0.0.53",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"@langchain/langgraph-sdk": "^0.0.16",
|
|
60
60
|
"langchain": "^0.3.3",
|
|
61
61
|
"zod": "^3.23.3",
|
|
62
|
-
"@copilotkit/shared": "1.4.1-pre.
|
|
62
|
+
"@copilotkit/shared": "1.4.1-pre.5"
|
|
63
63
|
},
|
|
64
64
|
"keywords": [
|
|
65
65
|
"copilotkit",
|
package/src/langchain.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { RunnableConfig } from "@langchain/core/runnables";
|
|
2
2
|
import { dispatchCustomEvent } from "@langchain/core/callbacks/dispatch";
|
|
3
|
-
import {
|
|
3
|
+
import { randomId } from "@copilotkit/shared";
|
|
4
4
|
import { Annotation, MessagesAnnotation } from "@langchain/langgraph";
|
|
5
|
-
import { DynamicStructuredTool } from "@langchain/core/tools";
|
|
6
5
|
|
|
7
6
|
interface IntermediateStateConfig {
|
|
8
7
|
stateKey: string;
|
|
@@ -22,7 +21,7 @@ export const CopilotKitPropertiesAnnotation = Annotation.Root({
|
|
|
22
21
|
});
|
|
23
22
|
|
|
24
23
|
export const CopilotKitStateAnnotation = Annotation.Root({
|
|
25
|
-
|
|
24
|
+
copilotKit: Annotation<typeof CopilotKitPropertiesAnnotation.State>,
|
|
26
25
|
...MessagesAnnotation.spec,
|
|
27
26
|
});
|
|
28
27
|
|
|
@@ -88,18 +87,3 @@ export async function copilotKitEmitToolCall(config: RunnableConfig, name: strin
|
|
|
88
87
|
config,
|
|
89
88
|
);
|
|
90
89
|
}
|
|
91
|
-
|
|
92
|
-
export function convertActionToDynamicStructuredTool(actionInput: any) {
|
|
93
|
-
return new DynamicStructuredTool({
|
|
94
|
-
name: actionInput.name,
|
|
95
|
-
description: actionInput.description,
|
|
96
|
-
schema: convertJsonSchemaToZodSchema(actionInput.parameters, true),
|
|
97
|
-
func: async () => {
|
|
98
|
-
return "";
|
|
99
|
-
},
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
export function convertActionsToDynamicStructuredTools(actions: any[]) {
|
|
104
|
-
return actions.map((action) => convertActionToDynamicStructuredTool(action));
|
|
105
|
-
}
|