@copilotkit/runtime 1.3.16-mme-improve-langsmith.0 → 1.4.0-pre-1-4-0.0
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 +6 -3
- package/dist/{chunk-QJB3CIHI.mjs → chunk-3SXVSM2J.mjs} +2 -2
- package/dist/{chunk-YGFQK4XG.mjs → chunk-5DFP5VJV.mjs} +2 -2
- package/dist/{chunk-TD3UMHBH.mjs → chunk-5LEQEQFA.mjs} +689 -151
- package/dist/chunk-5LEQEQFA.mjs.map +1 -0
- package/dist/{chunk-MYZHUCL6.mjs → chunk-B74M7FXG.mjs} +1 -1
- package/dist/chunk-B74M7FXG.mjs.map +1 -0
- package/dist/{chunk-KCW3B5UA.mjs → chunk-KDT43TMW.mjs} +37 -10
- package/dist/chunk-KDT43TMW.mjs.map +1 -0
- package/dist/{chunk-E75MOZGE.mjs → chunk-SBNW3ABC.mjs} +2 -2
- package/dist/{chunk-UHFZPBA5.mjs → chunk-VGYN7TGZ.mjs} +5 -10
- package/dist/chunk-VGYN7TGZ.mjs.map +1 -0
- package/dist/{copilot-runtime-df3527ad.d.ts → copilot-runtime-68acb673.d.ts} +29 -7
- package/dist/graphql/types/converted/index.d.ts +1 -1
- package/dist/graphql/types/converted/index.js.map +1 -1
- package/dist/graphql/types/converted/index.mjs +1 -1
- package/dist/{groq-adapter-b122e71f.d.ts → groq-adapter-c30654bd.d.ts} +4 -2
- package/dist/{index-cff31380.d.ts → index-439dfa2a.d.ts} +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.js +765 -205
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +13 -9
- package/dist/index.mjs.map +1 -1
- package/dist/{langserve-a14a6849.d.ts → langserve-0d844922.d.ts} +1 -1
- package/dist/lib/index.d.ts +4 -4
- package/dist/lib/index.js +765 -205
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/index.mjs +13 -9
- package/dist/lib/integrations/index.d.ts +4 -4
- package/dist/lib/integrations/index.js +3 -1
- package/dist/lib/integrations/index.js.map +1 -1
- package/dist/lib/integrations/index.mjs +5 -5
- package/dist/lib/integrations/nest/index.d.ts +3 -3
- package/dist/lib/integrations/nest/index.js +3 -1
- package/dist/lib/integrations/nest/index.js.map +1 -1
- package/dist/lib/integrations/nest/index.mjs +3 -3
- package/dist/lib/integrations/node-express/index.d.ts +3 -3
- package/dist/lib/integrations/node-express/index.js +3 -1
- package/dist/lib/integrations/node-express/index.js.map +1 -1
- package/dist/lib/integrations/node-express/index.mjs +3 -3
- package/dist/lib/integrations/node-http/index.d.ts +3 -3
- package/dist/lib/integrations/node-http/index.js +3 -1
- package/dist/lib/integrations/node-http/index.js.map +1 -1
- package/dist/lib/integrations/node-http/index.mjs +2 -2
- package/dist/service-adapters/index.d.ts +4 -4
- package/dist/service-adapters/index.js +4 -9
- package/dist/service-adapters/index.js.map +1 -1
- package/dist/service-adapters/index.mjs +1 -1
- package/package.json +6 -4
- package/src/agents/langgraph/event-source.ts +62 -94
- package/src/agents/langgraph/events.ts +26 -17
- package/src/graphql/types/converted/index.ts +5 -1
- package/src/lib/runtime/copilot-runtime.ts +58 -11
- package/src/lib/runtime/remote-action-constructors.ts +284 -0
- package/src/lib/runtime/remote-actions.ts +65 -159
- package/src/lib/runtime/remote-lg-cloud-action.ts +624 -0
- package/src/service-adapters/google/google-genai-adapter.ts +2 -2
- package/src/service-adapters/langchain/langchain-adapter.ts +5 -4
- package/dist/chunk-KCW3B5UA.mjs.map +0 -1
- package/dist/chunk-MYZHUCL6.mjs.map +0 -1
- package/dist/chunk-TD3UMHBH.mjs.map +0 -1
- package/dist/chunk-UHFZPBA5.mjs.map +0 -1
- /package/dist/{chunk-QJB3CIHI.mjs.map → chunk-3SXVSM2J.mjs.map} +0 -0
- /package/dist/{chunk-YGFQK4XG.mjs.map → chunk-5DFP5VJV.mjs.map} +0 -0
- /package/dist/{chunk-E75MOZGE.mjs.map → chunk-SBNW3ABC.mjs.map} +0 -0
package/dist/lib/index.js
CHANGED
|
@@ -44,7 +44,7 @@ var require_package = __commonJS({
|
|
|
44
44
|
publishConfig: {
|
|
45
45
|
access: "public"
|
|
46
46
|
},
|
|
47
|
-
version: "1.
|
|
47
|
+
version: "1.4.0-pre-1-4-0.0",
|
|
48
48
|
sideEffects: false,
|
|
49
49
|
main: "./dist/index.js",
|
|
50
50
|
module: "./dist/index.mjs",
|
|
@@ -87,6 +87,7 @@ var require_package = __commonJS({
|
|
|
87
87
|
"@langchain/community": "^0.0.53",
|
|
88
88
|
"@langchain/core": "^0.3.13",
|
|
89
89
|
"@langchain/google-gauth": "^0.1.0",
|
|
90
|
+
"@langchain/langgraph-sdk": "^0.0.16",
|
|
90
91
|
"@langchain/openai": "^0.0.28",
|
|
91
92
|
"class-transformer": "^0.5.1",
|
|
92
93
|
express: "^4.19.2",
|
|
@@ -96,6 +97,7 @@ var require_package = __commonJS({
|
|
|
96
97
|
"groq-sdk": "^0.5.0",
|
|
97
98
|
langchain: "^0.3.3",
|
|
98
99
|
openai: "^4.50.0",
|
|
100
|
+
"partial-json": "^0.1.7",
|
|
99
101
|
pino: "^9.2.0",
|
|
100
102
|
"pino-pretty": "^11.2.1",
|
|
101
103
|
"reflect-metadata": "^0.2.2",
|
|
@@ -131,6 +133,7 @@ __export(lib_exports, {
|
|
|
131
133
|
UnifyAdapter: () => UnifyAdapter,
|
|
132
134
|
buildSchema: () => buildSchema,
|
|
133
135
|
config: () => config,
|
|
136
|
+
copilotKitEndpoint: () => copilotKitEndpoint,
|
|
134
137
|
copilotRuntimeNestEndpoint: () => copilotRuntimeNestEndpoint,
|
|
135
138
|
copilotRuntimeNextJSAppRouterEndpoint: () => copilotRuntimeNextJSAppRouterEndpoint,
|
|
136
139
|
copilotRuntimeNextJSPagesRouterEndpoint: () => copilotRuntimeNextJSPagesRouterEndpoint,
|
|
@@ -138,7 +141,8 @@ __export(lib_exports, {
|
|
|
138
141
|
copilotRuntimeNodeHttpEndpoint: () => copilotRuntimeNodeHttpEndpoint,
|
|
139
142
|
createContext: () => createContext,
|
|
140
143
|
flattenToolCallsNoDuplicates: () => flattenToolCallsNoDuplicates,
|
|
141
|
-
getCommonConfig: () => getCommonConfig
|
|
144
|
+
getCommonConfig: () => getCommonConfig,
|
|
145
|
+
langGraphCloudEndpoint: () => langGraphCloudEndpoint
|
|
142
146
|
});
|
|
143
147
|
module.exports = __toCommonJS(lib_exports);
|
|
144
148
|
|
|
@@ -677,8 +681,7 @@ var LangChainAdapter = class {
|
|
|
677
681
|
this.options = options;
|
|
678
682
|
}
|
|
679
683
|
async process(request) {
|
|
680
|
-
const { eventSource, model, actions, messages, runId } = request;
|
|
681
|
-
const threadId = request.threadId ?? (0, import_shared3.randomId)();
|
|
684
|
+
const { eventSource, model, actions, messages, threadId, runId } = request;
|
|
682
685
|
const result = await this.options.chainFn({
|
|
683
686
|
messages: messages.map(convertMessageToLangChainMessage),
|
|
684
687
|
tools: actions.map(convertActionInputToLangChainTool),
|
|
@@ -693,7 +696,7 @@ var LangChainAdapter = class {
|
|
|
693
696
|
});
|
|
694
697
|
});
|
|
695
698
|
return {
|
|
696
|
-
threadId
|
|
699
|
+
threadId: threadId || (0, import_shared3.randomId)()
|
|
697
700
|
};
|
|
698
701
|
}
|
|
699
702
|
};
|
|
@@ -704,16 +707,12 @@ var import_google_gauth = require("@langchain/google-gauth");
|
|
|
704
707
|
var GoogleGenerativeAIAdapter = class extends LangChainAdapter {
|
|
705
708
|
constructor(options) {
|
|
706
709
|
super({
|
|
707
|
-
chainFn: async ({ messages, tools
|
|
710
|
+
chainFn: async ({ messages, tools }) => {
|
|
708
711
|
const model = new import_google_gauth.ChatGoogle({
|
|
709
712
|
modelName: (options == null ? void 0 : options.model) ?? "gemini-1.5-pro",
|
|
710
713
|
apiVersion: "v1beta"
|
|
711
714
|
}).bindTools(tools);
|
|
712
|
-
return model.stream(messages
|
|
713
|
-
metadata: {
|
|
714
|
-
conversation_id: threadId
|
|
715
|
-
}
|
|
716
|
-
});
|
|
715
|
+
return model.stream(messages);
|
|
717
716
|
}
|
|
718
717
|
});
|
|
719
718
|
}
|
|
@@ -1085,58 +1084,19 @@ var LangGraphEventTypes;
|
|
|
1085
1084
|
LangGraphEventTypes2["OnToolStart"] = "on_tool_start";
|
|
1086
1085
|
LangGraphEventTypes2["OnToolEnd"] = "on_tool_end";
|
|
1087
1086
|
LangGraphEventTypes2["OnCopilotKitStateSync"] = "on_copilotkit_state_sync";
|
|
1088
|
-
LangGraphEventTypes2["
|
|
1089
|
-
LangGraphEventTypes2["OnCopilotKitEmitToolCall"] = "on_copilotkit_emit_tool_call";
|
|
1087
|
+
LangGraphEventTypes2["OnCustomEvent"] = "on_custom_event";
|
|
1090
1088
|
})(LangGraphEventTypes || (LangGraphEventTypes = {}));
|
|
1089
|
+
var CustomEventNames;
|
|
1090
|
+
(function(CustomEventNames2) {
|
|
1091
|
+
CustomEventNames2["CopilotKitManuallyEmitMessage"] = "copilotkit_manually_emit_message";
|
|
1092
|
+
CustomEventNames2["CopilotKitManuallyEmitToolCall"] = "copilotkit_manually_emit_tool_call";
|
|
1093
|
+
CustomEventNames2["CopilotKitManuallyEmitIntermediateState"] = "copilotkit_manually_emit_intermediate_state";
|
|
1094
|
+
})(CustomEventNames || (CustomEventNames = {}));
|
|
1091
1095
|
|
|
1092
1096
|
// src/agents/langgraph/event-source.ts
|
|
1093
1097
|
var import_shared7 = require("@copilotkit/shared");
|
|
1094
1098
|
var RemoteLangGraphEventSource = class {
|
|
1095
1099
|
eventStream$ = new import_rxjs.ReplaySubject();
|
|
1096
|
-
async streamResponse(response) {
|
|
1097
|
-
const reader = response.body.getReader();
|
|
1098
|
-
const decoder = new TextDecoder();
|
|
1099
|
-
let buffer = [];
|
|
1100
|
-
const eventStream$ = this.eventStream$;
|
|
1101
|
-
function flushBuffer() {
|
|
1102
|
-
const currentBuffer = buffer.join("");
|
|
1103
|
-
if (currentBuffer.trim().length === 0) {
|
|
1104
|
-
return;
|
|
1105
|
-
}
|
|
1106
|
-
const parts = currentBuffer.split("\n");
|
|
1107
|
-
if (parts.length === 0) {
|
|
1108
|
-
return;
|
|
1109
|
-
}
|
|
1110
|
-
const lastPartIsComplete = currentBuffer.endsWith("\n");
|
|
1111
|
-
buffer = [];
|
|
1112
|
-
if (!lastPartIsComplete) {
|
|
1113
|
-
buffer.push(parts.pop());
|
|
1114
|
-
}
|
|
1115
|
-
parts.map((part) => part.trim()).filter((part) => part != "").forEach((part) => {
|
|
1116
|
-
eventStream$.next(JSON.parse(part));
|
|
1117
|
-
});
|
|
1118
|
-
}
|
|
1119
|
-
__name(flushBuffer, "flushBuffer");
|
|
1120
|
-
try {
|
|
1121
|
-
while (true) {
|
|
1122
|
-
const { done, value } = await reader.read();
|
|
1123
|
-
if (!done) {
|
|
1124
|
-
buffer.push(decoder.decode(value, {
|
|
1125
|
-
stream: true
|
|
1126
|
-
}));
|
|
1127
|
-
}
|
|
1128
|
-
flushBuffer();
|
|
1129
|
-
if (done) {
|
|
1130
|
-
break;
|
|
1131
|
-
}
|
|
1132
|
-
}
|
|
1133
|
-
} catch (error) {
|
|
1134
|
-
console.error("Error in stream", error);
|
|
1135
|
-
eventStream$.error(error);
|
|
1136
|
-
return;
|
|
1137
|
-
}
|
|
1138
|
-
eventStream$.complete();
|
|
1139
|
-
}
|
|
1140
1100
|
shouldEmitToolCall(shouldEmitToolCalls, toolCallName) {
|
|
1141
1101
|
if (typeof shouldEmitToolCalls === "boolean") {
|
|
1142
1102
|
return shouldEmitToolCalls;
|
|
@@ -1159,20 +1119,25 @@ var RemoteLangGraphEventSource = class {
|
|
|
1159
1119
|
} else {
|
|
1160
1120
|
acc.content = null;
|
|
1161
1121
|
}
|
|
1162
|
-
|
|
1122
|
+
const toolCallChunks = (
|
|
1123
|
+
// @ts-expect-error -- LangGraph Cloud implementation stores data outside of kwargs
|
|
1124
|
+
((_h = (_g = (_f = event.data) == null ? void 0 : _f.chunk) == null ? void 0 : _g.kwargs) == null ? void 0 : _h.tool_call_chunks) ?? ((_j = (_i = event.data) == null ? void 0 : _i.chunk) == null ? void 0 : _j.tool_call_chunks)
|
|
1125
|
+
);
|
|
1126
|
+
const toolCallMessageId = ((_m = (_l = (_k = event.data) == null ? void 0 : _k.chunk) == null ? void 0 : _l.kwargs) == null ? void 0 : _m.id) ?? ((_o = (_n = event.data) == null ? void 0 : _n.chunk) == null ? void 0 : _o.id);
|
|
1127
|
+
if (toolCallChunks && toolCallChunks.length > 0) {
|
|
1163
1128
|
acc.prevToolCallMessageId = acc.toolCallMessageId;
|
|
1164
|
-
acc.toolCallMessageId =
|
|
1165
|
-
if ((
|
|
1166
|
-
acc.toolCallName =
|
|
1129
|
+
acc.toolCallMessageId = toolCallMessageId;
|
|
1130
|
+
if ((_p = toolCallChunks[0]) == null ? void 0 : _p.name) {
|
|
1131
|
+
acc.toolCallName = toolCallChunks[0].name;
|
|
1167
1132
|
}
|
|
1168
|
-
if ((
|
|
1169
|
-
acc.toolCallId =
|
|
1133
|
+
if ((_q = toolCallChunks[0]) == null ? void 0 : _q.id) {
|
|
1134
|
+
acc.toolCallId = toolCallChunks[0].id;
|
|
1170
1135
|
}
|
|
1171
1136
|
acc.prevMessageId = acc.messageId;
|
|
1172
|
-
acc.messageId =
|
|
1137
|
+
acc.messageId = toolCallMessageId;
|
|
1173
1138
|
} else if (acc.content && acc.content != "") {
|
|
1174
1139
|
acc.prevMessageId = acc.messageId;
|
|
1175
|
-
acc.messageId =
|
|
1140
|
+
acc.messageId = toolCallMessageId;
|
|
1176
1141
|
} else {
|
|
1177
1142
|
acc.prevToolCallMessageId = acc.toolCallMessageId;
|
|
1178
1143
|
acc.prevMessageId = acc.messageId;
|
|
@@ -1197,7 +1162,7 @@ var RemoteLangGraphEventSource = class {
|
|
|
1197
1162
|
prevMessageId: null,
|
|
1198
1163
|
content: null
|
|
1199
1164
|
}), (0, import_rxjs.mergeMap)((eventWithState) => {
|
|
1200
|
-
var _a, _b, _c, _d, _e;
|
|
1165
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
1201
1166
|
const events = [];
|
|
1202
1167
|
let shouldEmitMessages = true;
|
|
1203
1168
|
let shouldEmitToolCalls = false;
|
|
@@ -1220,32 +1185,33 @@ var RemoteLangGraphEventSource = class {
|
|
|
1220
1185
|
});
|
|
1221
1186
|
}
|
|
1222
1187
|
switch (eventWithState.event.event) {
|
|
1223
|
-
case LangGraphEventTypes.
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1188
|
+
case LangGraphEventTypes.OnCustomEvent:
|
|
1189
|
+
if (eventWithState.event.name === CustomEventNames.CopilotKitManuallyEmitMessage) {
|
|
1190
|
+
events.push({
|
|
1191
|
+
type: RuntimeEventTypes.TextMessageStart,
|
|
1192
|
+
messageId: eventWithState.event.data.message_id
|
|
1193
|
+
});
|
|
1194
|
+
events.push({
|
|
1195
|
+
type: RuntimeEventTypes.TextMessageContent,
|
|
1196
|
+
content: eventWithState.event.data.message
|
|
1197
|
+
});
|
|
1198
|
+
events.push({
|
|
1199
|
+
type: RuntimeEventTypes.TextMessageEnd
|
|
1200
|
+
});
|
|
1201
|
+
} else if (eventWithState.event.name === CustomEventNames.CopilotKitManuallyEmitToolCall) {
|
|
1202
|
+
events.push({
|
|
1203
|
+
type: RuntimeEventTypes.ActionExecutionStart,
|
|
1204
|
+
actionExecutionId: eventWithState.event.data.id,
|
|
1205
|
+
actionName: eventWithState.event.data.name
|
|
1206
|
+
});
|
|
1207
|
+
events.push({
|
|
1208
|
+
type: RuntimeEventTypes.ActionExecutionArgs,
|
|
1209
|
+
args: JSON.stringify(eventWithState.event.data.args)
|
|
1210
|
+
});
|
|
1211
|
+
events.push({
|
|
1212
|
+
type: RuntimeEventTypes.ActionExecutionEnd
|
|
1213
|
+
});
|
|
1214
|
+
}
|
|
1249
1215
|
break;
|
|
1250
1216
|
case LangGraphEventTypes.OnCopilotKitStateSync:
|
|
1251
1217
|
events.push({
|
|
@@ -1280,7 +1246,8 @@ var RemoteLangGraphEventSource = class {
|
|
|
1280
1246
|
});
|
|
1281
1247
|
}
|
|
1282
1248
|
}
|
|
1283
|
-
const args = (_e = (_d = (_c = (_b = (_a = eventWithState.event.data) == null ? void 0 : _a.chunk) == null ? void 0 : _b.kwargs) == null ? void 0 : _c.tool_call_chunks) == null ? void 0 : _d[0]) == null ? void 0 : _e.args
|
|
1249
|
+
const args = ((_e = (_d = (_c = (_b = (_a = eventWithState.event.data) == null ? void 0 : _a.chunk) == null ? void 0 : _b.kwargs) == null ? void 0 : _c.tool_call_chunks) == null ? void 0 : _d[0]) == null ? void 0 : _e.args) ?? // @ts-expect-error -- sdf
|
|
1250
|
+
((_i = (_h = (_g = (_f = eventWithState.event.data) == null ? void 0 : _f.chunk) == null ? void 0 : _g.tool_call_chunks) == null ? void 0 : _h[0]) == null ? void 0 : _i.args);
|
|
1284
1251
|
const content = eventWithState.content;
|
|
1285
1252
|
if (args) {
|
|
1286
1253
|
if (this.shouldEmitToolCall(shouldEmitToolCalls, eventWithState.toolCallName)) {
|
|
@@ -1331,70 +1298,543 @@ var RemoteLangGraphEventSource = class {
|
|
|
1331
1298
|
};
|
|
1332
1299
|
__name(RemoteLangGraphEventSource, "RemoteLangGraphEventSource");
|
|
1333
1300
|
|
|
1334
|
-
// src/lib/runtime/remote-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1301
|
+
// src/lib/runtime/remote-lg-cloud-action.ts
|
|
1302
|
+
var import_langgraph_sdk = require("@langchain/langgraph-sdk");
|
|
1303
|
+
var import_node_crypto = require("crypto");
|
|
1304
|
+
var import_partial_json = require("partial-json");
|
|
1305
|
+
|
|
1306
|
+
// src/graphql/types/enums.ts
|
|
1307
|
+
var import_type_graphql = require("type-graphql");
|
|
1308
|
+
var MessageRole;
|
|
1309
|
+
(function(MessageRole2) {
|
|
1310
|
+
MessageRole2["user"] = "user";
|
|
1311
|
+
MessageRole2["assistant"] = "assistant";
|
|
1312
|
+
MessageRole2["system"] = "system";
|
|
1313
|
+
})(MessageRole || (MessageRole = {}));
|
|
1314
|
+
var ActionExecutionScope;
|
|
1315
|
+
(function(ActionExecutionScope2) {
|
|
1316
|
+
ActionExecutionScope2["server"] = "server";
|
|
1317
|
+
ActionExecutionScope2["client"] = "client";
|
|
1318
|
+
ActionExecutionScope2["passThrough"] = "passThrough";
|
|
1319
|
+
})(ActionExecutionScope || (ActionExecutionScope = {}));
|
|
1320
|
+
var CopilotRequestType;
|
|
1321
|
+
(function(CopilotRequestType2) {
|
|
1322
|
+
CopilotRequestType2["Chat"] = "Chat";
|
|
1323
|
+
CopilotRequestType2["Task"] = "Task";
|
|
1324
|
+
CopilotRequestType2["TextareaCompletion"] = "TextareaCompletion";
|
|
1325
|
+
CopilotRequestType2["TextareaPopover"] = "TextareaPopover";
|
|
1326
|
+
CopilotRequestType2["Suggestion"] = "Suggestion";
|
|
1327
|
+
})(CopilotRequestType || (CopilotRequestType = {}));
|
|
1328
|
+
(0, import_type_graphql.registerEnumType)(MessageRole, {
|
|
1329
|
+
name: "MessageRole",
|
|
1330
|
+
description: "The role of the message"
|
|
1331
|
+
});
|
|
1332
|
+
(0, import_type_graphql.registerEnumType)(ActionExecutionScope, {
|
|
1333
|
+
name: "ActionExecutionScope",
|
|
1334
|
+
description: "The scope of the action"
|
|
1335
|
+
});
|
|
1336
|
+
(0, import_type_graphql.registerEnumType)(CopilotRequestType, {
|
|
1337
|
+
name: "CopilotRequestType",
|
|
1338
|
+
description: "The type of Copilot request"
|
|
1339
|
+
});
|
|
1340
|
+
|
|
1341
|
+
// src/lib/runtime/remote-lg-cloud-action.ts
|
|
1342
|
+
async function execute(args) {
|
|
1343
|
+
return new ReadableStream({
|
|
1344
|
+
async start(controller) {
|
|
1345
|
+
try {
|
|
1346
|
+
await streamEvents(controller, args);
|
|
1347
|
+
controller.close();
|
|
1348
|
+
} catch (err) {
|
|
1349
|
+
}
|
|
1350
|
+
}
|
|
1351
|
+
});
|
|
1340
1352
|
}
|
|
1341
|
-
__name(
|
|
1342
|
-
function
|
|
1343
|
-
const
|
|
1344
|
-
|
|
1353
|
+
__name(execute, "execute");
|
|
1354
|
+
async function streamEvents(controller, args) {
|
|
1355
|
+
const { deploymentUrl, langsmithApiKey, threadId: agrsInitialThreadId, agent, nodeName: initialNodeName, state: initialState, messages, actions, logger: logger2 } = args;
|
|
1356
|
+
let nodeName = initialNodeName;
|
|
1357
|
+
let state = initialState;
|
|
1358
|
+
const { name, assistantId: initialAssistantId } = agent;
|
|
1359
|
+
const client = new import_langgraph_sdk.Client({
|
|
1360
|
+
apiUrl: deploymentUrl,
|
|
1361
|
+
apiKey: langsmithApiKey
|
|
1362
|
+
});
|
|
1363
|
+
let initialThreadId = agrsInitialThreadId;
|
|
1364
|
+
const wasInitiatedWithExistingThread = !!initialThreadId;
|
|
1365
|
+
if (initialThreadId && initialThreadId.startsWith("ck-")) {
|
|
1366
|
+
initialThreadId = initialThreadId.substring(3);
|
|
1367
|
+
}
|
|
1368
|
+
const assistants = await client.assistants.search();
|
|
1369
|
+
const retrievedAssistant = assistants.find((a) => a.name === name);
|
|
1370
|
+
const threadId = initialThreadId ?? (0, import_node_crypto.randomUUID)();
|
|
1371
|
+
if (initialThreadId === threadId) {
|
|
1372
|
+
await client.threads.get(threadId);
|
|
1373
|
+
} else {
|
|
1374
|
+
await client.threads.create({
|
|
1375
|
+
threadId
|
|
1376
|
+
});
|
|
1377
|
+
}
|
|
1378
|
+
let agentState = {
|
|
1379
|
+
values: {}
|
|
1345
1380
|
};
|
|
1346
|
-
if (
|
|
1347
|
-
|
|
1348
|
-
|
|
1381
|
+
if (wasInitiatedWithExistingThread) {
|
|
1382
|
+
agentState = await client.threads.getState(threadId);
|
|
1383
|
+
}
|
|
1384
|
+
const agentStateValues = agentState.values;
|
|
1385
|
+
state.messages = agentStateValues.messages;
|
|
1386
|
+
const mode = wasInitiatedWithExistingThread && nodeName != "__end__" ? "continue" : "start";
|
|
1387
|
+
state = langGraphDefaultMergeState(state, formatMessages(messages), actions, name);
|
|
1388
|
+
if (mode === "continue") {
|
|
1389
|
+
await client.threads.updateState(threadId, {
|
|
1390
|
+
values: state,
|
|
1391
|
+
asNode: nodeName
|
|
1349
1392
|
});
|
|
1350
|
-
|
|
1351
|
-
|
|
1393
|
+
}
|
|
1394
|
+
const assistantId = initialAssistantId ?? (retrievedAssistant == null ? void 0 : retrievedAssistant.assistant_id);
|
|
1395
|
+
if (!assistantId) {
|
|
1396
|
+
console.error(`
|
|
1397
|
+
No agent found for the agent name specified in CopilotKit provider
|
|
1398
|
+
Please check your available agents or provide an agent ID in the LangGraph Cloud endpoint definition.
|
|
1399
|
+
|
|
1400
|
+
|
|
1401
|
+
These are the available agents: [${assistants.map((a) => `${a.name} (ID: ${a.assistant_id})`).join(", ")}]
|
|
1402
|
+
`);
|
|
1403
|
+
throw new Error("No agent id found");
|
|
1404
|
+
}
|
|
1405
|
+
const graphInfo = await client.assistants.getGraph(assistantId);
|
|
1406
|
+
const streamInput = mode === "start" ? state : null;
|
|
1407
|
+
let streamingStateExtractor = new StreamingStateExtractor([]);
|
|
1408
|
+
let prevNodeName = null;
|
|
1409
|
+
let emitIntermediateStateUntilEnd = null;
|
|
1410
|
+
let shouldExit = null;
|
|
1411
|
+
let externalRunId = null;
|
|
1412
|
+
const streamResponse2 = client.runs.stream(threadId, assistantId, {
|
|
1413
|
+
input: streamInput,
|
|
1414
|
+
streamMode: [
|
|
1415
|
+
"events",
|
|
1416
|
+
"values"
|
|
1417
|
+
]
|
|
1418
|
+
});
|
|
1419
|
+
const emit = /* @__PURE__ */ __name((message) => controller.enqueue(new TextEncoder().encode(message)), "emit");
|
|
1420
|
+
let latestStateValues = {};
|
|
1421
|
+
for await (const chunk of streamResponse2) {
|
|
1422
|
+
if (![
|
|
1423
|
+
"events",
|
|
1424
|
+
"values",
|
|
1425
|
+
"error"
|
|
1426
|
+
].includes(chunk.event))
|
|
1427
|
+
continue;
|
|
1428
|
+
if (chunk.event === "error") {
|
|
1429
|
+
logger2.error(chunk, `Error event thrown: ${chunk.data.message}`);
|
|
1430
|
+
throw new Error(`Error event thrown: ${chunk.data.message}`);
|
|
1431
|
+
}
|
|
1432
|
+
if (chunk.event === "values") {
|
|
1433
|
+
latestStateValues = chunk.data;
|
|
1434
|
+
continue;
|
|
1435
|
+
}
|
|
1436
|
+
const event = chunk.data;
|
|
1437
|
+
const currentNodeName = event.name;
|
|
1438
|
+
const eventType = event.event;
|
|
1439
|
+
const runId = event.metadata.run_id;
|
|
1440
|
+
externalRunId = runId;
|
|
1441
|
+
const metadata = event.metadata;
|
|
1442
|
+
shouldExit = shouldExit != null ? shouldExit : metadata["copilotkit:exit"];
|
|
1443
|
+
const emitIntermediateState = metadata["copilotkit:emit-intermediate-state"];
|
|
1444
|
+
const forceEmitIntermediateState = metadata["copilotkit:force-emit-intermediate-state"];
|
|
1445
|
+
const manuallyEmitMessage = metadata["copilotkit:manually-emit-messages"];
|
|
1446
|
+
const manuallyEmitToolCall = metadata["copilotkit:manually-emit-tool-calls"];
|
|
1447
|
+
if (graphInfo["nodes"].some((node) => node.id === currentNodeName)) {
|
|
1448
|
+
nodeName = currentNodeName;
|
|
1449
|
+
}
|
|
1450
|
+
if (!nodeName) {
|
|
1451
|
+
continue;
|
|
1452
|
+
}
|
|
1453
|
+
if (forceEmitIntermediateState) {
|
|
1454
|
+
if (eventType === "on_chain_end") {
|
|
1455
|
+
state = event.data.output;
|
|
1456
|
+
emit(getStateSyncEvent({
|
|
1457
|
+
threadId,
|
|
1458
|
+
runId,
|
|
1459
|
+
agentName: agent.name,
|
|
1460
|
+
nodeName,
|
|
1461
|
+
state: event.data.output,
|
|
1462
|
+
running: true,
|
|
1463
|
+
active: true
|
|
1464
|
+
}));
|
|
1465
|
+
}
|
|
1466
|
+
continue;
|
|
1467
|
+
}
|
|
1468
|
+
if (manuallyEmitMessage) {
|
|
1469
|
+
if (eventType === "on_chain_end") {
|
|
1470
|
+
state = event.data.output;
|
|
1471
|
+
emit(JSON.stringify({
|
|
1472
|
+
event: "on_copilotkit_emit_message",
|
|
1473
|
+
message: event.data.output,
|
|
1474
|
+
messageId: (0, import_node_crypto.randomUUID)(),
|
|
1475
|
+
role: MessageRole.assistant
|
|
1476
|
+
}) + "\n");
|
|
1477
|
+
}
|
|
1478
|
+
continue;
|
|
1479
|
+
}
|
|
1480
|
+
if (manuallyEmitToolCall) {
|
|
1481
|
+
if (eventType === "on_chain_end") {
|
|
1482
|
+
state = event.data.output;
|
|
1483
|
+
emit(JSON.stringify({
|
|
1484
|
+
event: "on_copilotkit_emit_tool_call",
|
|
1485
|
+
name: event.data.output.name,
|
|
1486
|
+
args: event.data.output.args,
|
|
1487
|
+
id: event.data.output.id
|
|
1488
|
+
}) + "\n");
|
|
1489
|
+
}
|
|
1490
|
+
continue;
|
|
1491
|
+
}
|
|
1492
|
+
if (emitIntermediateState && emitIntermediateStateUntilEnd == null) {
|
|
1493
|
+
emitIntermediateStateUntilEnd = nodeName;
|
|
1352
1494
|
}
|
|
1495
|
+
if (emitIntermediateState && eventType === "on_chat_model_start") {
|
|
1496
|
+
streamingStateExtractor = new StreamingStateExtractor(emitIntermediateState);
|
|
1497
|
+
}
|
|
1498
|
+
let updatedState = latestStateValues;
|
|
1499
|
+
if (emitIntermediateState && eventType === "on_chat_model_stream") {
|
|
1500
|
+
streamingStateExtractor.bufferToolCalls(event);
|
|
1501
|
+
}
|
|
1502
|
+
if (emitIntermediateStateUntilEnd !== null) {
|
|
1503
|
+
updatedState = {
|
|
1504
|
+
...updatedState,
|
|
1505
|
+
...streamingStateExtractor.extractState()
|
|
1506
|
+
};
|
|
1507
|
+
}
|
|
1508
|
+
if (!emitIntermediateState && currentNodeName === emitIntermediateStateUntilEnd && eventType === "on_chain_end") {
|
|
1509
|
+
emitIntermediateStateUntilEnd = null;
|
|
1510
|
+
}
|
|
1511
|
+
const exitingNode = nodeName === currentNodeName && eventType === "on_chain_end";
|
|
1512
|
+
if (JSON.stringify(updatedState) !== JSON.stringify(state) || prevNodeName != nodeName || exitingNode) {
|
|
1513
|
+
state = updatedState;
|
|
1514
|
+
prevNodeName = nodeName;
|
|
1515
|
+
emit(getStateSyncEvent({
|
|
1516
|
+
threadId,
|
|
1517
|
+
runId,
|
|
1518
|
+
agentName: agent.name,
|
|
1519
|
+
nodeName,
|
|
1520
|
+
state,
|
|
1521
|
+
running: true,
|
|
1522
|
+
active: !exitingNode
|
|
1523
|
+
}));
|
|
1524
|
+
}
|
|
1525
|
+
emit(JSON.stringify(event) + "\n");
|
|
1353
1526
|
}
|
|
1354
|
-
|
|
1527
|
+
state = await client.threads.getState(threadId);
|
|
1528
|
+
const isEndNode = state.next.length === 0;
|
|
1529
|
+
nodeName = Object.keys(state.metadata.writes)[0];
|
|
1530
|
+
emit(getStateSyncEvent({
|
|
1531
|
+
threadId,
|
|
1532
|
+
runId: externalRunId,
|
|
1533
|
+
agentName: agent.name,
|
|
1534
|
+
nodeName: isEndNode ? "__end__" : nodeName,
|
|
1535
|
+
state: state.values,
|
|
1536
|
+
running: !shouldExit,
|
|
1537
|
+
active: false
|
|
1538
|
+
}));
|
|
1539
|
+
return Promise.resolve();
|
|
1355
1540
|
}
|
|
1356
|
-
__name(
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1541
|
+
__name(streamEvents, "streamEvents");
|
|
1542
|
+
function getStateSyncEvent({ threadId, runId, agentName, nodeName, state, running, active }) {
|
|
1543
|
+
const stateWithoutMessages = Object.keys(state).reduce((acc, key) => {
|
|
1544
|
+
if (key !== "messages") {
|
|
1545
|
+
acc[key] = state[key];
|
|
1546
|
+
}
|
|
1547
|
+
return acc;
|
|
1548
|
+
}, {});
|
|
1549
|
+
return JSON.stringify({
|
|
1550
|
+
event: "on_copilotkit_state_sync",
|
|
1551
|
+
thread_id: threadId,
|
|
1552
|
+
run_id: runId,
|
|
1553
|
+
agent_name: agentName,
|
|
1554
|
+
node_name: nodeName,
|
|
1555
|
+
active,
|
|
1556
|
+
state: stateWithoutMessages,
|
|
1557
|
+
running,
|
|
1558
|
+
role: "assistant"
|
|
1559
|
+
}) + "\n";
|
|
1560
|
+
}
|
|
1561
|
+
__name(getStateSyncEvent, "getStateSyncEvent");
|
|
1562
|
+
var StreamingStateExtractor = /* @__PURE__ */ __name(class StreamingStateExtractor2 {
|
|
1563
|
+
emitIntermediateState;
|
|
1564
|
+
toolCallBuffer;
|
|
1565
|
+
currentToolCall;
|
|
1566
|
+
previouslyParsableState;
|
|
1567
|
+
constructor(emitIntermediateState) {
|
|
1568
|
+
this.emitIntermediateState = emitIntermediateState;
|
|
1569
|
+
this.toolCallBuffer = {};
|
|
1570
|
+
this.currentToolCall = null;
|
|
1571
|
+
this.previouslyParsableState = {};
|
|
1572
|
+
}
|
|
1573
|
+
bufferToolCalls(event) {
|
|
1574
|
+
if (event.data.chunk.tool_call_chunks.length > 0) {
|
|
1575
|
+
const chunk = event.data.chunk.tool_call_chunks[0];
|
|
1576
|
+
if (chunk.name !== null) {
|
|
1577
|
+
this.currentToolCall = chunk.name;
|
|
1578
|
+
this.toolCallBuffer[this.currentToolCall] = chunk.args;
|
|
1579
|
+
} else if (this.currentToolCall !== null) {
|
|
1580
|
+
this.toolCallBuffer[this.currentToolCall] += chunk.args;
|
|
1581
|
+
}
|
|
1582
|
+
}
|
|
1583
|
+
}
|
|
1584
|
+
getEmitStateConfig(currentToolName) {
|
|
1585
|
+
for (const config2 of this.emitIntermediateState) {
|
|
1586
|
+
const stateKey = config2["state_key"];
|
|
1587
|
+
const tool = config2["tool"];
|
|
1588
|
+
const toolArgument = config2["tool_argument"];
|
|
1589
|
+
if (currentToolName === tool) {
|
|
1590
|
+
return [
|
|
1591
|
+
toolArgument,
|
|
1592
|
+
stateKey
|
|
1593
|
+
];
|
|
1594
|
+
}
|
|
1595
|
+
}
|
|
1596
|
+
return [
|
|
1597
|
+
null,
|
|
1598
|
+
null
|
|
1599
|
+
];
|
|
1600
|
+
}
|
|
1601
|
+
extractState() {
|
|
1602
|
+
const state = {};
|
|
1603
|
+
for (const [key, value] of Object.entries(this.toolCallBuffer)) {
|
|
1604
|
+
const [argumentName, stateKey] = this.getEmitStateConfig(key);
|
|
1605
|
+
if (stateKey === null) {
|
|
1606
|
+
continue;
|
|
1607
|
+
}
|
|
1608
|
+
let parsedValue;
|
|
1609
|
+
try {
|
|
1610
|
+
parsedValue = (0, import_partial_json.parse)(value);
|
|
1611
|
+
} catch (error) {
|
|
1612
|
+
if (key in this.previouslyParsableState) {
|
|
1613
|
+
parsedValue = this.previouslyParsableState[key];
|
|
1614
|
+
} else {
|
|
1615
|
+
continue;
|
|
1616
|
+
}
|
|
1617
|
+
}
|
|
1618
|
+
this.previouslyParsableState[key] = parsedValue;
|
|
1619
|
+
if (!argumentName) {
|
|
1620
|
+
state[stateKey] = parsedValue;
|
|
1621
|
+
} else {
|
|
1622
|
+
state[stateKey] = parsedValue[argumentName];
|
|
1623
|
+
}
|
|
1624
|
+
}
|
|
1625
|
+
return state;
|
|
1626
|
+
}
|
|
1627
|
+
}, "StreamingStateExtractor");
|
|
1628
|
+
function langGraphDefaultMergeState(state, messages, actions, agentName) {
|
|
1629
|
+
if (messages.length > 0 && "role" in messages[0] && messages[0].role === "system") {
|
|
1630
|
+
messages = messages.slice(1);
|
|
1631
|
+
}
|
|
1632
|
+
const mergedMessages = state.messages || [];
|
|
1633
|
+
const existingMessageIds = new Set(mergedMessages.map((message) => message.id));
|
|
1634
|
+
const existingToolCallResults = /* @__PURE__ */ new Set();
|
|
1635
|
+
for (const message of mergedMessages) {
|
|
1636
|
+
if ("tool_call_id" in message) {
|
|
1637
|
+
existingToolCallResults.add(message.tool_call_id);
|
|
1638
|
+
}
|
|
1639
|
+
}
|
|
1640
|
+
for (const message of messages) {
|
|
1641
|
+
if ("tool_calls" in message && message.tool_calls.length > 0 && message.tool_calls[0].name === agentName) {
|
|
1642
|
+
continue;
|
|
1643
|
+
}
|
|
1644
|
+
if ("name" in message && message.name === agentName) {
|
|
1645
|
+
continue;
|
|
1646
|
+
}
|
|
1647
|
+
if (!existingMessageIds.has(message.id)) {
|
|
1648
|
+
if ("tool_call_id" in message && existingToolCallResults.has(message.tool_call_id)) {
|
|
1649
|
+
console.warn("Warning: Duplicate tool call result, skipping:", message.tool_call_id);
|
|
1650
|
+
continue;
|
|
1651
|
+
}
|
|
1652
|
+
mergedMessages.push(message);
|
|
1653
|
+
} else {
|
|
1654
|
+
for (let i = 0; i < mergedMessages.length; i++) {
|
|
1655
|
+
if (mergedMessages[i].id === message.id) {
|
|
1656
|
+
if ("tool_calls" in message) {
|
|
1657
|
+
if (("tool_calls" in mergedMessages[i] || "additional_kwargs" in mergedMessages[i]) && mergedMessages[i].content) {
|
|
1658
|
+
message.tool_calls = mergedMessages[i]["tool_calls"];
|
|
1659
|
+
message.additional_kwargs = mergedMessages[i].additional_kwargs;
|
|
1660
|
+
}
|
|
1661
|
+
}
|
|
1662
|
+
mergedMessages[i] = message;
|
|
1663
|
+
}
|
|
1664
|
+
}
|
|
1665
|
+
}
|
|
1666
|
+
}
|
|
1667
|
+
for (let i = 0; i < mergedMessages.length - 1; i++) {
|
|
1668
|
+
const currentMessage = mergedMessages[i];
|
|
1669
|
+
const nextMessage = mergedMessages[i + 1];
|
|
1670
|
+
if ("tool_calls" in currentMessage && currentMessage.tool_calls.length > 0 && "tool_call_id" in nextMessage) {
|
|
1671
|
+
nextMessage.tool_call_id = currentMessage.tool_calls[0].id;
|
|
1672
|
+
}
|
|
1673
|
+
}
|
|
1674
|
+
const correctedMessages = [];
|
|
1675
|
+
for (let i = 0; i < mergedMessages.length; i++) {
|
|
1676
|
+
const currentMessage = mergedMessages[i];
|
|
1677
|
+
const nextMessage = mergedMessages[i + 1] || null;
|
|
1678
|
+
const prevMessage = mergedMessages[i - 1] || null;
|
|
1679
|
+
if ("tool_calls" in currentMessage && currentMessage.tool_calls.length > 0) {
|
|
1680
|
+
if (!nextMessage) {
|
|
1681
|
+
console.warn("No next message to auto-correct tool call, skipping:", currentMessage.tool_calls[0].id);
|
|
1682
|
+
continue;
|
|
1683
|
+
}
|
|
1684
|
+
if (!("tool_call_id" in nextMessage) || nextMessage.tool_call_id !== currentMessage.tool_calls[0].id) {
|
|
1685
|
+
const toolMessage = mergedMessages.find((m) => "tool_call_id" in m && m.tool_call_id === currentMessage.tool_calls[0].id);
|
|
1686
|
+
if (toolMessage) {
|
|
1687
|
+
console.warn("Auto-corrected tool call alignment issue:", currentMessage.tool_calls[0].id);
|
|
1688
|
+
correctedMessages.push(currentMessage, toolMessage);
|
|
1689
|
+
continue;
|
|
1690
|
+
} else {
|
|
1691
|
+
console.warn("No corresponding tool call result found for tool call, skipping:", currentMessage.tool_calls[0].id);
|
|
1692
|
+
continue;
|
|
1693
|
+
}
|
|
1694
|
+
}
|
|
1695
|
+
correctedMessages.push(currentMessage);
|
|
1696
|
+
continue;
|
|
1697
|
+
}
|
|
1698
|
+
if ("tool_call_id" in currentMessage) {
|
|
1699
|
+
if (!prevMessage || !("tool_calls" in prevMessage)) {
|
|
1700
|
+
console.warn("No previous tool call, skipping tool call result:", currentMessage.id);
|
|
1701
|
+
continue;
|
|
1702
|
+
}
|
|
1703
|
+
if (prevMessage.tool_calls && prevMessage.tool_calls[0].id !== currentMessage.tool_call_id) {
|
|
1704
|
+
console.warn("Tool call id is incorrect, skipping tool call result:", currentMessage.id);
|
|
1705
|
+
continue;
|
|
1706
|
+
}
|
|
1707
|
+
correctedMessages.push(currentMessage);
|
|
1708
|
+
continue;
|
|
1709
|
+
}
|
|
1710
|
+
correctedMessages.push(currentMessage);
|
|
1711
|
+
}
|
|
1712
|
+
return deepMerge(state, {
|
|
1713
|
+
messages: correctedMessages,
|
|
1714
|
+
copilotkit: {
|
|
1715
|
+
actions
|
|
1716
|
+
}
|
|
1717
|
+
});
|
|
1718
|
+
}
|
|
1719
|
+
__name(langGraphDefaultMergeState, "langGraphDefaultMergeState");
|
|
1720
|
+
function deepMerge(obj1, obj2) {
|
|
1721
|
+
let result = {
|
|
1722
|
+
...obj1
|
|
1723
|
+
};
|
|
1724
|
+
for (let key in obj2) {
|
|
1725
|
+
if (typeof obj2[key] === "object" && !Array.isArray(obj2[key])) {
|
|
1726
|
+
if (obj1[key]) {
|
|
1727
|
+
result[key] = deepMerge(obj1[key], obj2[key]);
|
|
1728
|
+
} else {
|
|
1729
|
+
result[key] = {
|
|
1730
|
+
...obj2[key]
|
|
1731
|
+
};
|
|
1732
|
+
}
|
|
1733
|
+
} else {
|
|
1734
|
+
result[key] = obj2[key];
|
|
1735
|
+
}
|
|
1736
|
+
}
|
|
1737
|
+
return result;
|
|
1738
|
+
}
|
|
1739
|
+
__name(deepMerge, "deepMerge");
|
|
1740
|
+
function formatMessages(messages) {
|
|
1741
|
+
return messages.map((message) => {
|
|
1742
|
+
if (message.isTextMessage() && message.role === "assistant") {
|
|
1743
|
+
return message;
|
|
1744
|
+
}
|
|
1745
|
+
if (message.isTextMessage() && message.role === "system") {
|
|
1746
|
+
return message;
|
|
1747
|
+
}
|
|
1748
|
+
if (message.isTextMessage() && message.role === "user") {
|
|
1749
|
+
return message;
|
|
1750
|
+
}
|
|
1751
|
+
if (message.isActionExecutionMessage()) {
|
|
1752
|
+
const toolCall = {
|
|
1753
|
+
name: message.name,
|
|
1754
|
+
args: message.arguments,
|
|
1755
|
+
id: message.id
|
|
1756
|
+
};
|
|
1377
1757
|
return {
|
|
1378
|
-
|
|
1379
|
-
|
|
1758
|
+
type: message.type,
|
|
1759
|
+
content: "",
|
|
1760
|
+
tool_calls: [
|
|
1761
|
+
toolCall
|
|
1762
|
+
],
|
|
1763
|
+
role: MessageRole.assistant,
|
|
1764
|
+
id: message.id
|
|
1380
1765
|
};
|
|
1381
1766
|
}
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
};
|
|
1395
|
-
}
|
|
1767
|
+
if (message.isResultMessage()) {
|
|
1768
|
+
return {
|
|
1769
|
+
type: message.type,
|
|
1770
|
+
content: message.result,
|
|
1771
|
+
id: message.id,
|
|
1772
|
+
tool_call_id: message.actionExecutionId,
|
|
1773
|
+
name: message.actionName,
|
|
1774
|
+
role: MessageRole.assistant
|
|
1775
|
+
};
|
|
1776
|
+
}
|
|
1777
|
+
throw new Error(`Unknown message type ${message.type}`);
|
|
1778
|
+
});
|
|
1396
1779
|
}
|
|
1397
|
-
__name(
|
|
1780
|
+
__name(formatMessages, "formatMessages");
|
|
1781
|
+
|
|
1782
|
+
// src/lib/runtime/remote-action-constructors.ts
|
|
1783
|
+
function constructLGCRemoteAction({ endpoint, graphqlContext, logger: logger2, messages, agentStates }) {
|
|
1784
|
+
const agents = endpoint.agents.map((agent) => ({
|
|
1785
|
+
name: agent.name,
|
|
1786
|
+
description: agent.description,
|
|
1787
|
+
parameters: [],
|
|
1788
|
+
handler: async (_args) => {
|
|
1789
|
+
},
|
|
1790
|
+
langGraphAgentHandler: async ({ name, actionInputsWithoutAgents, threadId, nodeName }) => {
|
|
1791
|
+
var _a;
|
|
1792
|
+
logger2.debug({
|
|
1793
|
+
actionName: agent.name
|
|
1794
|
+
}, "Executing LangGraph Cloud agent");
|
|
1795
|
+
telemetry_client_default.capture("oss.runtime.remote_action_executed", {});
|
|
1796
|
+
let state = {};
|
|
1797
|
+
if (agentStates) {
|
|
1798
|
+
const jsonState = (_a = agentStates.find((state2) => state2.agentName === name)) == null ? void 0 : _a.state;
|
|
1799
|
+
if (jsonState) {
|
|
1800
|
+
state = JSON.parse(jsonState);
|
|
1801
|
+
}
|
|
1802
|
+
}
|
|
1803
|
+
try {
|
|
1804
|
+
const response = await execute({
|
|
1805
|
+
logger: logger2,
|
|
1806
|
+
deploymentUrl: endpoint.deploymentUrl,
|
|
1807
|
+
langsmithApiKey: endpoint.langsmithApiKey,
|
|
1808
|
+
agent,
|
|
1809
|
+
threadId,
|
|
1810
|
+
nodeName,
|
|
1811
|
+
messages,
|
|
1812
|
+
state,
|
|
1813
|
+
properties: graphqlContext.properties,
|
|
1814
|
+
actions: actionInputsWithoutAgents.map((action) => ({
|
|
1815
|
+
name: action.name,
|
|
1816
|
+
description: action.description,
|
|
1817
|
+
parameters: JSON.parse(action.jsonSchema)
|
|
1818
|
+
}))
|
|
1819
|
+
});
|
|
1820
|
+
const eventSource = new RemoteLangGraphEventSource();
|
|
1821
|
+
streamResponse(response, eventSource.eventStream$);
|
|
1822
|
+
return eventSource.processLangGraphEvents();
|
|
1823
|
+
} catch (error) {
|
|
1824
|
+
logger2.error({
|
|
1825
|
+
url: endpoint.deploymentUrl,
|
|
1826
|
+
status: 500,
|
|
1827
|
+
body: error.message
|
|
1828
|
+
}, "Failed to execute LangGraph Cloud agent");
|
|
1829
|
+
throw new Error("Failed to execute LangGraph Cloud agent");
|
|
1830
|
+
}
|
|
1831
|
+
}
|
|
1832
|
+
}));
|
|
1833
|
+
return [
|
|
1834
|
+
...agents
|
|
1835
|
+
];
|
|
1836
|
+
}
|
|
1837
|
+
__name(constructLGCRemoteAction, "constructLGCRemoteAction");
|
|
1398
1838
|
function constructRemoteActions({ json, url, onBeforeRequest, graphqlContext, logger: logger2, messages, agentStates }) {
|
|
1399
1839
|
const actions = json["actions"].map((action) => ({
|
|
1400
1840
|
name: action.name,
|
|
@@ -1486,7 +1926,7 @@ function constructRemoteActions({ json, url, onBeforeRequest, graphqlContext, lo
|
|
|
1486
1926
|
throw new Error("Failed to execute remote agent");
|
|
1487
1927
|
}
|
|
1488
1928
|
const eventSource = new RemoteLangGraphEventSource();
|
|
1489
|
-
|
|
1929
|
+
streamResponse(response.body, eventSource.eventStream$);
|
|
1490
1930
|
return eventSource.processLangGraphEvents();
|
|
1491
1931
|
}
|
|
1492
1932
|
}));
|
|
@@ -1496,34 +1936,165 @@ function constructRemoteActions({ json, url, onBeforeRequest, graphqlContext, lo
|
|
|
1496
1936
|
];
|
|
1497
1937
|
}
|
|
1498
1938
|
__name(constructRemoteActions, "constructRemoteActions");
|
|
1499
|
-
async function
|
|
1939
|
+
async function streamResponse(response, eventStream$) {
|
|
1940
|
+
const reader = response.getReader();
|
|
1941
|
+
const decoder = new TextDecoder();
|
|
1942
|
+
let buffer = [];
|
|
1943
|
+
function flushBuffer() {
|
|
1944
|
+
const currentBuffer = buffer.join("");
|
|
1945
|
+
if (currentBuffer.trim().length === 0) {
|
|
1946
|
+
return;
|
|
1947
|
+
}
|
|
1948
|
+
const parts = currentBuffer.split("\n");
|
|
1949
|
+
if (parts.length === 0) {
|
|
1950
|
+
return;
|
|
1951
|
+
}
|
|
1952
|
+
const lastPartIsComplete = currentBuffer.endsWith("\n");
|
|
1953
|
+
buffer = [];
|
|
1954
|
+
if (!lastPartIsComplete) {
|
|
1955
|
+
buffer.push(parts.pop());
|
|
1956
|
+
}
|
|
1957
|
+
parts.map((part) => part.trim()).filter((part) => part != "").forEach((part) => {
|
|
1958
|
+
eventStream$.next(JSON.parse(part));
|
|
1959
|
+
});
|
|
1960
|
+
}
|
|
1961
|
+
__name(flushBuffer, "flushBuffer");
|
|
1962
|
+
try {
|
|
1963
|
+
while (true) {
|
|
1964
|
+
const { done, value } = await reader.read();
|
|
1965
|
+
if (!done) {
|
|
1966
|
+
buffer.push(decoder.decode(value, {
|
|
1967
|
+
stream: true
|
|
1968
|
+
}));
|
|
1969
|
+
}
|
|
1970
|
+
flushBuffer();
|
|
1971
|
+
if (done) {
|
|
1972
|
+
break;
|
|
1973
|
+
}
|
|
1974
|
+
}
|
|
1975
|
+
} catch (error) {
|
|
1976
|
+
console.error("Error in stream", error);
|
|
1977
|
+
eventStream$.error(error);
|
|
1978
|
+
return;
|
|
1979
|
+
}
|
|
1980
|
+
eventStream$.complete();
|
|
1981
|
+
}
|
|
1982
|
+
__name(streamResponse, "streamResponse");
|
|
1983
|
+
function createHeaders(onBeforeRequest, graphqlContext) {
|
|
1984
|
+
const headers = {
|
|
1985
|
+
"Content-Type": "application/json"
|
|
1986
|
+
};
|
|
1987
|
+
if (onBeforeRequest) {
|
|
1988
|
+
const { headers: additionalHeaders } = onBeforeRequest({
|
|
1989
|
+
ctx: graphqlContext
|
|
1990
|
+
});
|
|
1991
|
+
if (additionalHeaders) {
|
|
1992
|
+
Object.assign(headers, additionalHeaders);
|
|
1993
|
+
}
|
|
1994
|
+
}
|
|
1995
|
+
return headers;
|
|
1996
|
+
}
|
|
1997
|
+
__name(createHeaders, "createHeaders");
|
|
1998
|
+
|
|
1999
|
+
// src/lib/runtime/remote-actions.ts
|
|
2000
|
+
var EndpointType;
|
|
2001
|
+
(function(EndpointType2) {
|
|
2002
|
+
EndpointType2["CopilotKit"] = "copilotKit";
|
|
2003
|
+
EndpointType2["LangGraphCloud"] = "langgraph-cloud";
|
|
2004
|
+
})(EndpointType || (EndpointType = {}));
|
|
2005
|
+
function isLangGraphAgentAction(action) {
|
|
2006
|
+
if (!action) {
|
|
2007
|
+
return false;
|
|
2008
|
+
}
|
|
2009
|
+
return typeof action.langGraphAgentHandler === "function";
|
|
2010
|
+
}
|
|
2011
|
+
__name(isLangGraphAgentAction, "isLangGraphAgentAction");
|
|
2012
|
+
async function fetchRemoteInfo({ url, onBeforeRequest, graphqlContext, logger: logger2, frontendUrl }) {
|
|
2013
|
+
logger2.debug({
|
|
2014
|
+
url
|
|
2015
|
+
}, "Fetching actions from url");
|
|
2016
|
+
const headers = createHeaders(onBeforeRequest, graphqlContext);
|
|
2017
|
+
try {
|
|
2018
|
+
const response = await fetch(`${url}/info`, {
|
|
2019
|
+
method: "POST",
|
|
2020
|
+
headers,
|
|
2021
|
+
body: JSON.stringify({
|
|
2022
|
+
properties: graphqlContext.properties,
|
|
2023
|
+
frontendUrl
|
|
2024
|
+
})
|
|
2025
|
+
});
|
|
2026
|
+
if (!response.ok) {
|
|
2027
|
+
logger2.error({
|
|
2028
|
+
url,
|
|
2029
|
+
status: response.status,
|
|
2030
|
+
body: await response.text()
|
|
2031
|
+
}, "Failed to fetch actions from url");
|
|
2032
|
+
return {
|
|
2033
|
+
actions: [],
|
|
2034
|
+
agents: []
|
|
2035
|
+
};
|
|
2036
|
+
}
|
|
2037
|
+
const json = await response.json();
|
|
2038
|
+
logger2.debug({
|
|
2039
|
+
json
|
|
2040
|
+
}, "Fetched actions from url");
|
|
2041
|
+
return json;
|
|
2042
|
+
} catch (error) {
|
|
2043
|
+
logger2.error({
|
|
2044
|
+
error: error.message ? error.message : error + ""
|
|
2045
|
+
}, "Failed to fetch actions from url");
|
|
2046
|
+
return {
|
|
2047
|
+
actions: [],
|
|
2048
|
+
agents: []
|
|
2049
|
+
};
|
|
2050
|
+
}
|
|
2051
|
+
}
|
|
2052
|
+
__name(fetchRemoteInfo, "fetchRemoteInfo");
|
|
2053
|
+
async function setupRemoteActions({ remoteEndpointDefinitions, graphqlContext, messages, agentStates, frontendUrl }) {
|
|
1500
2054
|
const logger2 = graphqlContext.logger.child({
|
|
1501
2055
|
component: "remote-actions.fetchRemoteActions"
|
|
1502
2056
|
});
|
|
1503
2057
|
logger2.debug({
|
|
1504
|
-
|
|
1505
|
-
}, "Fetching remote
|
|
1506
|
-
const filtered =
|
|
1507
|
-
|
|
2058
|
+
remoteEndpointDefinitions
|
|
2059
|
+
}, "Fetching from remote endpoints");
|
|
2060
|
+
const filtered = remoteEndpointDefinitions.filter((value, index, self) => {
|
|
2061
|
+
if (value.type === "langgraph-cloud") {
|
|
2062
|
+
return value;
|
|
2063
|
+
}
|
|
2064
|
+
return index === self.findIndex((t) => t.url === value.url);
|
|
2065
|
+
});
|
|
2066
|
+
const result = await Promise.all(filtered.map(async (endpoint) => {
|
|
2067
|
+
if (endpoint.type === "langgraph-cloud") {
|
|
2068
|
+
return constructLGCRemoteAction({
|
|
2069
|
+
endpoint,
|
|
2070
|
+
messages,
|
|
2071
|
+
graphqlContext,
|
|
2072
|
+
logger: logger2.child({
|
|
2073
|
+
component: "remote-actions.constructLGCRemoteAction",
|
|
2074
|
+
endpoint
|
|
2075
|
+
}),
|
|
2076
|
+
agentStates
|
|
2077
|
+
});
|
|
2078
|
+
}
|
|
1508
2079
|
const json = await fetchRemoteInfo({
|
|
1509
|
-
url:
|
|
1510
|
-
onBeforeRequest:
|
|
2080
|
+
url: endpoint.url,
|
|
2081
|
+
onBeforeRequest: endpoint.onBeforeRequest,
|
|
1511
2082
|
graphqlContext,
|
|
1512
2083
|
logger: logger2.child({
|
|
1513
2084
|
component: "remote-actions.fetchActionsFromUrl",
|
|
1514
|
-
|
|
2085
|
+
endpoint
|
|
1515
2086
|
}),
|
|
1516
2087
|
frontendUrl
|
|
1517
2088
|
});
|
|
1518
2089
|
return constructRemoteActions({
|
|
1519
2090
|
json,
|
|
1520
2091
|
messages,
|
|
1521
|
-
url:
|
|
1522
|
-
onBeforeRequest:
|
|
2092
|
+
url: endpoint.url,
|
|
2093
|
+
onBeforeRequest: endpoint.onBeforeRequest,
|
|
1523
2094
|
graphqlContext,
|
|
1524
2095
|
logger: logger2.child({
|
|
1525
2096
|
component: "remote-actions.constructActions",
|
|
1526
|
-
|
|
2097
|
+
endpoint
|
|
1527
2098
|
}),
|
|
1528
2099
|
agentStates
|
|
1529
2100
|
});
|
|
@@ -1721,7 +2292,7 @@ async function executeAction(eventStream$, guardrailsResult$, action, actionArgu
|
|
|
1721
2292
|
__name(executeAction, "executeAction");
|
|
1722
2293
|
|
|
1723
2294
|
// src/graphql/types/base/index.ts
|
|
1724
|
-
var
|
|
2295
|
+
var import_type_graphql2 = require("type-graphql");
|
|
1725
2296
|
function _ts_decorate(decorators, target, key, desc) {
|
|
1726
2297
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1727
2298
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
@@ -1744,15 +2315,15 @@ var BaseMessageInput = class {
|
|
|
1744
2315
|
};
|
|
1745
2316
|
__name(BaseMessageInput, "BaseMessageInput");
|
|
1746
2317
|
_ts_decorate([
|
|
1747
|
-
(0,
|
|
2318
|
+
(0, import_type_graphql2.Field)(() => String),
|
|
1748
2319
|
_ts_metadata("design:type", String)
|
|
1749
2320
|
], BaseMessageInput.prototype, "id", void 0);
|
|
1750
2321
|
_ts_decorate([
|
|
1751
|
-
(0,
|
|
2322
|
+
(0, import_type_graphql2.Field)(() => Date),
|
|
1752
2323
|
_ts_metadata("design:type", typeof Date === "undefined" ? Object : Date)
|
|
1753
2324
|
], BaseMessageInput.prototype, "createdAt", void 0);
|
|
1754
2325
|
BaseMessageInput = _ts_decorate([
|
|
1755
|
-
(0,
|
|
2326
|
+
(0, import_type_graphql2.InputType)()
|
|
1756
2327
|
], BaseMessageInput);
|
|
1757
2328
|
|
|
1758
2329
|
// src/graphql/types/converted/index.ts
|
|
@@ -1856,7 +2427,7 @@ __name(convertGqlInputToMessages, "convertGqlInputToMessages");
|
|
|
1856
2427
|
var import_rxjs3 = require("rxjs");
|
|
1857
2428
|
var CopilotRuntime = class {
|
|
1858
2429
|
actions;
|
|
1859
|
-
|
|
2430
|
+
remoteEndpointDefinitions;
|
|
1860
2431
|
langserve = [];
|
|
1861
2432
|
onBeforeRequest;
|
|
1862
2433
|
onAfterRequest;
|
|
@@ -1867,7 +2438,7 @@ var CopilotRuntime = class {
|
|
|
1867
2438
|
const remoteChain = new RemoteChain(chain);
|
|
1868
2439
|
this.langserve.push(remoteChain.toAction());
|
|
1869
2440
|
}
|
|
1870
|
-
this.
|
|
2441
|
+
this.remoteEndpointDefinitions = (params == null ? void 0 : params.remoteEndpoints) || [];
|
|
1871
2442
|
this.onBeforeRequest = (_a = params == null ? void 0 : params.middleware) == null ? void 0 : _a.onBeforeRequest;
|
|
1872
2443
|
this.onAfterRequest = (_b = params == null ? void 0 : params.middleware) == null ? void 0 : _b.onAfterRequest;
|
|
1873
2444
|
}
|
|
@@ -1936,7 +2507,7 @@ var CopilotRuntime = class {
|
|
|
1936
2507
|
async processAgentRequest(request) {
|
|
1937
2508
|
var _a;
|
|
1938
2509
|
const { messages: rawMessages, outputMessagesPromise, graphqlContext, agentSession } = request;
|
|
1939
|
-
const { threadId
|
|
2510
|
+
const { threadId, agentName, nodeName } = agentSession;
|
|
1940
2511
|
const serverSideActions = await this.getServerSideActions(request);
|
|
1941
2512
|
const messages = convertGqlInputToMessages(rawMessages);
|
|
1942
2513
|
const agent = serverSideActions.find((action) => action.name === agentName && isLangGraphAgentAction(action));
|
|
@@ -2008,8 +2579,12 @@ var CopilotRuntime = class {
|
|
|
2008
2579
|
console.error("Error loading langserve chain:", error);
|
|
2009
2580
|
}
|
|
2010
2581
|
}
|
|
2582
|
+
const remoteEndpointDefinitions = this.remoteEndpointDefinitions.map((endpoint) => ({
|
|
2583
|
+
...endpoint,
|
|
2584
|
+
type: this.resolveEndpointType(endpoint)
|
|
2585
|
+
}));
|
|
2011
2586
|
const remoteActions = await setupRemoteActions({
|
|
2012
|
-
|
|
2587
|
+
remoteEndpointDefinitions,
|
|
2013
2588
|
graphqlContext,
|
|
2014
2589
|
messages: inputMessages,
|
|
2015
2590
|
agentStates,
|
|
@@ -2025,6 +2600,12 @@ var CopilotRuntime = class {
|
|
|
2025
2600
|
...remoteActions
|
|
2026
2601
|
];
|
|
2027
2602
|
}
|
|
2603
|
+
resolveEndpointType(endpoint) {
|
|
2604
|
+
if (!endpoint.type && "langsmithApiKey" in endpoint && "deploymentUrl" in endpoint && "agents" in endpoint) {
|
|
2605
|
+
return EndpointType.LangGraphCloud;
|
|
2606
|
+
}
|
|
2607
|
+
return endpoint.type;
|
|
2608
|
+
}
|
|
2028
2609
|
};
|
|
2029
2610
|
__name(CopilotRuntime, "CopilotRuntime");
|
|
2030
2611
|
function flattenToolCallsNoDuplicates(toolsByPriority) {
|
|
@@ -2039,6 +2620,20 @@ function flattenToolCallsNoDuplicates(toolsByPriority) {
|
|
|
2039
2620
|
return allTools;
|
|
2040
2621
|
}
|
|
2041
2622
|
__name(flattenToolCallsNoDuplicates, "flattenToolCallsNoDuplicates");
|
|
2623
|
+
function copilotKitEndpoint(config2) {
|
|
2624
|
+
return {
|
|
2625
|
+
...config2,
|
|
2626
|
+
type: EndpointType.CopilotKit
|
|
2627
|
+
};
|
|
2628
|
+
}
|
|
2629
|
+
__name(copilotKitEndpoint, "copilotKitEndpoint");
|
|
2630
|
+
function langGraphCloudEndpoint(config2) {
|
|
2631
|
+
return {
|
|
2632
|
+
...config2,
|
|
2633
|
+
type: EndpointType.LangGraphCloud
|
|
2634
|
+
};
|
|
2635
|
+
}
|
|
2636
|
+
__name(langGraphCloudEndpoint, "langGraphCloudEndpoint");
|
|
2042
2637
|
|
|
2043
2638
|
// src/lib/integrations/shared.ts
|
|
2044
2639
|
var import_type_graphql16 = require("type-graphql");
|
|
@@ -2052,43 +2647,6 @@ var import_type_graphql11 = require("type-graphql");
|
|
|
2052
2647
|
|
|
2053
2648
|
// src/graphql/inputs/message.input.ts
|
|
2054
2649
|
var import_type_graphql3 = require("type-graphql");
|
|
2055
|
-
|
|
2056
|
-
// src/graphql/types/enums.ts
|
|
2057
|
-
var import_type_graphql2 = require("type-graphql");
|
|
2058
|
-
var MessageRole;
|
|
2059
|
-
(function(MessageRole2) {
|
|
2060
|
-
MessageRole2["user"] = "user";
|
|
2061
|
-
MessageRole2["assistant"] = "assistant";
|
|
2062
|
-
MessageRole2["system"] = "system";
|
|
2063
|
-
})(MessageRole || (MessageRole = {}));
|
|
2064
|
-
var ActionExecutionScope;
|
|
2065
|
-
(function(ActionExecutionScope2) {
|
|
2066
|
-
ActionExecutionScope2["server"] = "server";
|
|
2067
|
-
ActionExecutionScope2["client"] = "client";
|
|
2068
|
-
ActionExecutionScope2["passThrough"] = "passThrough";
|
|
2069
|
-
})(ActionExecutionScope || (ActionExecutionScope = {}));
|
|
2070
|
-
var CopilotRequestType;
|
|
2071
|
-
(function(CopilotRequestType2) {
|
|
2072
|
-
CopilotRequestType2["Chat"] = "Chat";
|
|
2073
|
-
CopilotRequestType2["Task"] = "Task";
|
|
2074
|
-
CopilotRequestType2["TextareaCompletion"] = "TextareaCompletion";
|
|
2075
|
-
CopilotRequestType2["TextareaPopover"] = "TextareaPopover";
|
|
2076
|
-
CopilotRequestType2["Suggestion"] = "Suggestion";
|
|
2077
|
-
})(CopilotRequestType || (CopilotRequestType = {}));
|
|
2078
|
-
(0, import_type_graphql2.registerEnumType)(MessageRole, {
|
|
2079
|
-
name: "MessageRole",
|
|
2080
|
-
description: "The role of the message"
|
|
2081
|
-
});
|
|
2082
|
-
(0, import_type_graphql2.registerEnumType)(ActionExecutionScope, {
|
|
2083
|
-
name: "ActionExecutionScope",
|
|
2084
|
-
description: "The scope of the action"
|
|
2085
|
-
});
|
|
2086
|
-
(0, import_type_graphql2.registerEnumType)(CopilotRequestType, {
|
|
2087
|
-
name: "CopilotRequestType",
|
|
2088
|
-
description: "The type of Copilot request"
|
|
2089
|
-
});
|
|
2090
|
-
|
|
2091
|
-
// src/graphql/inputs/message.input.ts
|
|
2092
2650
|
function _ts_decorate2(decorators, target, key, desc) {
|
|
2093
2651
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2094
2652
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
@@ -3745,6 +4303,7 @@ __name(copilotRuntimeNestEndpoint, "copilotRuntimeNestEndpoint");
|
|
|
3745
4303
|
UnifyAdapter,
|
|
3746
4304
|
buildSchema,
|
|
3747
4305
|
config,
|
|
4306
|
+
copilotKitEndpoint,
|
|
3748
4307
|
copilotRuntimeNestEndpoint,
|
|
3749
4308
|
copilotRuntimeNextJSAppRouterEndpoint,
|
|
3750
4309
|
copilotRuntimeNextJSPagesRouterEndpoint,
|
|
@@ -3752,6 +4311,7 @@ __name(copilotRuntimeNestEndpoint, "copilotRuntimeNestEndpoint");
|
|
|
3752
4311
|
copilotRuntimeNodeHttpEndpoint,
|
|
3753
4312
|
createContext,
|
|
3754
4313
|
flattenToolCallsNoDuplicates,
|
|
3755
|
-
getCommonConfig
|
|
4314
|
+
getCommonConfig,
|
|
4315
|
+
langGraphCloudEndpoint
|
|
3756
4316
|
});
|
|
3757
4317
|
//# sourceMappingURL=index.js.map
|