@copilotkit/runtime 1.3.16-mme-lgc-langgraph-package.11 → 1.3.16-mme-revert-rxjs-changes.10
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 +33 -95
- package/dist/{chunk-SMHGZXIT.mjs → chunk-3EIBEZQI.mjs} +4 -3
- package/dist/chunk-3EIBEZQI.mjs.map +1 -0
- package/dist/{chunk-TTVQTORT.mjs → chunk-4MX7GDLS.mjs} +4 -3
- package/dist/chunk-4MX7GDLS.mjs.map +1 -0
- package/dist/chunk-DFOKBSIS.mjs +1 -0
- package/dist/chunk-DFOKBSIS.mjs.map +1 -0
- package/dist/{chunk-HZ2XTQUC.mjs → chunk-UO2QXEDA.mjs} +5 -4
- package/dist/chunk-UO2QXEDA.mjs.map +1 -0
- package/dist/{chunk-BNQDVBQH.mjs → chunk-WHJ3DAYL.mjs} +251 -34
- package/dist/chunk-WHJ3DAYL.mjs.map +1 -0
- package/dist/{chunk-JTVWJUZP.mjs → chunk-YSCTOGKC.mjs} +419 -50
- package/dist/chunk-YSCTOGKC.mjs.map +1 -0
- package/dist/{copilot-runtime-8d3f40c7.d.ts → copilot-runtime-335a610d.d.ts} +10 -10
- package/dist/{groq-adapter-dbfba3eb.d.ts → groq-adapter-2f8fd767.d.ts} +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +215 -98
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +22 -22
- package/dist/index.mjs.map +1 -1
- package/dist/{langserve-f00629d2.d.ts → langserve-cc06e76e.d.ts} +1 -0
- package/dist/lib/index.d.ts +3 -3
- package/dist/lib/index.js +215 -98
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/index.mjs +21 -21
- package/dist/lib/integrations/index.d.ts +3 -3
- package/dist/lib/integrations/index.js +153 -85
- 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 +2 -2
- package/dist/lib/integrations/nest/index.js +150 -82
- 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 +2 -2
- package/dist/lib/integrations/node-express/index.js +150 -82
- 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 +2 -2
- package/dist/lib/integrations/node-http/index.js +149 -81
- 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 +3 -3
- package/dist/service-adapters/index.js +31 -18
- package/dist/service-adapters/index.js.map +1 -1
- package/dist/service-adapters/index.mjs +1 -2
- package/package.json +4 -4
- package/src/agents/langgraph/event-source.ts +2 -2
- package/src/agents/langgraph/events.ts +2 -0
- package/src/lib/integrations/nest/index.ts +5 -2
- package/src/lib/integrations/nextjs/app-router.ts +5 -2
- package/src/lib/integrations/nextjs/pages-router.ts +5 -2
- package/src/lib/integrations/node-express/index.ts +5 -2
- package/src/lib/integrations/node-http/index.ts +5 -2
- package/src/lib/runtime/copilot-runtime.ts +53 -47
- package/src/lib/runtime/remote-action-constructors.ts +23 -9
- package/src/lib/runtime/remote-actions.ts +9 -9
- package/src/lib/runtime/{remote-lg-cloud-action.ts → remote-lg-action.ts} +59 -33
- package/src/lib/telemetry-client.ts +43 -0
- package/src/service-adapters/events.ts +13 -1
- package/src/service-adapters/google/google-genai-adapter.ts +2 -2
- package/src/service-adapters/langchain/langchain-adapter.ts +22 -16
- package/src/service-adapters/openai/openai-adapter.ts +5 -0
- package/dist/chunk-BNQDVBQH.mjs.map +0 -1
- package/dist/chunk-GWP2VADN.mjs +0 -288
- package/dist/chunk-GWP2VADN.mjs.map +0 -1
- package/dist/chunk-HZ2XTQUC.mjs.map +0 -1
- package/dist/chunk-JTVWJUZP.mjs.map +0 -1
- package/dist/chunk-MXXPWWBF.mjs +0 -218
- package/dist/chunk-MXXPWWBF.mjs.map +0 -1
- package/dist/chunk-SMHGZXIT.mjs.map +0 -1
- package/dist/chunk-TTVQTORT.mjs.map +0 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
|
+
RemoteChain,
|
|
2
3
|
streamLangChainResponse
|
|
3
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-WHJ3DAYL.mjs";
|
|
4
5
|
import {
|
|
5
6
|
GuardrailsValidationFailureResponse,
|
|
6
7
|
MessageStreamInterruptedResponse,
|
|
@@ -36,7 +37,7 @@ var require_package = __commonJS({
|
|
|
36
37
|
publishConfig: {
|
|
37
38
|
access: "public"
|
|
38
39
|
},
|
|
39
|
-
version: "1.3.16-mme-
|
|
40
|
+
version: "1.3.16-mme-revert-rxjs-changes.10",
|
|
40
41
|
sideEffects: false,
|
|
41
42
|
main: "./dist/index.js",
|
|
42
43
|
module: "./dist/index.mjs",
|
|
@@ -1023,16 +1024,14 @@ CopilotResponse = _ts_decorate11([
|
|
|
1023
1024
|
import { Repeater } from "graphql-yoga";
|
|
1024
1025
|
|
|
1025
1026
|
// src/service-adapters/events.ts
|
|
1026
|
-
import {
|
|
1027
|
+
import { randomId as randomId3 } from "@copilotkit/shared";
|
|
1028
|
+
import { of, concat, map, scan as scan2, concatMap, ReplaySubject as ReplaySubject2, firstValueFrom, from as from2 } from "rxjs";
|
|
1027
1029
|
|
|
1028
1030
|
// src/lib/telemetry-client.ts
|
|
1029
1031
|
import { TelemetryClient } from "@copilotkit/shared";
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
packageVersion: packageJson.version
|
|
1034
|
-
});
|
|
1035
|
-
var telemetry_client_default = telemetryClient;
|
|
1032
|
+
|
|
1033
|
+
// src/lib/runtime/remote-action-constructors.ts
|
|
1034
|
+
import { createHash as createHash2 } from "crypto";
|
|
1036
1035
|
|
|
1037
1036
|
// src/agents/langgraph/event-source.ts
|
|
1038
1037
|
import { ReplaySubject, scan, mergeMap, catchError } from "rxjs";
|
|
@@ -1049,6 +1048,8 @@ var LangGraphEventTypes;
|
|
|
1049
1048
|
LangGraphEventTypes2["OnToolStart"] = "on_tool_start";
|
|
1050
1049
|
LangGraphEventTypes2["OnToolEnd"] = "on_tool_end";
|
|
1051
1050
|
LangGraphEventTypes2["OnCopilotKitStateSync"] = "on_copilotkit_state_sync";
|
|
1051
|
+
LangGraphEventTypes2["OnCopilotKitEmitMessage"] = "on_copilotkit_emit_message";
|
|
1052
|
+
LangGraphEventTypes2["OnCopilotKitEmitToolCall"] = "on_copilotkit_emit_tool_call";
|
|
1052
1053
|
LangGraphEventTypes2["OnCustomEvent"] = "on_custom_event";
|
|
1053
1054
|
})(LangGraphEventTypes || (LangGraphEventTypes = {}));
|
|
1054
1055
|
var CustomEventNames;
|
|
@@ -1086,7 +1087,7 @@ var RemoteLangGraphEventSource = class {
|
|
|
1086
1087
|
acc.content = null;
|
|
1087
1088
|
}
|
|
1088
1089
|
const toolCallChunks = (
|
|
1089
|
-
// @ts-expect-error -- LangGraph
|
|
1090
|
+
// @ts-expect-error -- LangGraph Platform implementation stores data outside of kwargs
|
|
1090
1091
|
((_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)
|
|
1091
1092
|
);
|
|
1092
1093
|
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);
|
|
@@ -1264,9 +1265,9 @@ var RemoteLangGraphEventSource = class {
|
|
|
1264
1265
|
};
|
|
1265
1266
|
__name(RemoteLangGraphEventSource, "RemoteLangGraphEventSource");
|
|
1266
1267
|
|
|
1267
|
-
// src/lib/runtime/remote-lg-
|
|
1268
|
+
// src/lib/runtime/remote-lg-action.ts
|
|
1268
1269
|
import { Client } from "@langchain/langgraph-sdk";
|
|
1269
|
-
import { randomUUID } from "crypto";
|
|
1270
|
+
import { createHash, randomUUID } from "crypto";
|
|
1270
1271
|
import { parse as parsePartialJson } from "partial-json";
|
|
1271
1272
|
async function execute(args) {
|
|
1272
1273
|
return new ReadableStream({
|
|
@@ -1281,6 +1282,7 @@ async function execute(args) {
|
|
|
1281
1282
|
}
|
|
1282
1283
|
__name(execute, "execute");
|
|
1283
1284
|
async function streamEvents(controller, args) {
|
|
1285
|
+
var _a, _b, _c, _d, _e, _f;
|
|
1284
1286
|
const { deploymentUrl, langsmithApiKey, threadId: agrsInitialThreadId, agent, nodeName: initialNodeName, state: initialState, messages, actions, logger: logger2 } = args;
|
|
1285
1287
|
let nodeName = initialNodeName;
|
|
1286
1288
|
let state = initialState;
|
|
@@ -1330,7 +1332,7 @@ async function streamEvents(controller, args) {
|
|
|
1330
1332
|
if (!assistantId) {
|
|
1331
1333
|
console.error(`
|
|
1332
1334
|
No agent found for the agent name specified in CopilotKit provider
|
|
1333
|
-
Please check your available agents or provide an agent ID in the LangGraph
|
|
1335
|
+
Please check your available agents or provide an agent ID in the LangGraph Platform endpoint definition.
|
|
1334
1336
|
|
|
1335
1337
|
|
|
1336
1338
|
These are the available agents: [${assistants.map((a) => `${a.name} (ID: ${a.assistant_id})`).join(", ")}]
|
|
@@ -1354,7 +1356,14 @@ async function streamEvents(controller, args) {
|
|
|
1354
1356
|
const emit = /* @__PURE__ */ __name((message) => controller.enqueue(new TextEncoder().encode(message)), "emit");
|
|
1355
1357
|
let latestStateValues = {};
|
|
1356
1358
|
let updatedState = state;
|
|
1359
|
+
let manuallyEmittedState = null;
|
|
1360
|
+
let streamInfo = {
|
|
1361
|
+
hashedLgcKey: createHash("sha256").update(langsmithApiKey).digest("hex")
|
|
1362
|
+
};
|
|
1357
1363
|
try {
|
|
1364
|
+
telemetry_client_default.capture("oss.runtime.agent_execution_stream_started", {
|
|
1365
|
+
hashedLgcKey: streamInfo.hashedLgcKey
|
|
1366
|
+
});
|
|
1358
1367
|
for await (const chunk of streamResponse2) {
|
|
1359
1368
|
if (![
|
|
1360
1369
|
"events",
|
|
@@ -1376,26 +1385,37 @@ async function streamEvents(controller, args) {
|
|
|
1376
1385
|
const runId = event.metadata.run_id;
|
|
1377
1386
|
externalRunId = runId;
|
|
1378
1387
|
const metadata = event.metadata;
|
|
1388
|
+
if (((_b = (_a = event.data) == null ? void 0 : _a.output) == null ? void 0 : _b.model) != null && ((_d = (_c = event.data) == null ? void 0 : _c.output) == null ? void 0 : _d.model) != "") {
|
|
1389
|
+
streamInfo.provider = (_f = (_e = event.data) == null ? void 0 : _e.output) == null ? void 0 : _f.model;
|
|
1390
|
+
}
|
|
1391
|
+
if (metadata.langgraph_host != null && metadata.langgraph_host != "") {
|
|
1392
|
+
streamInfo.langGraphHost = metadata.langgraph_host;
|
|
1393
|
+
}
|
|
1394
|
+
if (metadata.langgraph_version != null && metadata.langgraph_version != "") {
|
|
1395
|
+
streamInfo.langGraphVersion = metadata.langgraph_version;
|
|
1396
|
+
}
|
|
1379
1397
|
shouldExit = shouldExit || eventType === LangGraphEventTypes.OnCustomEvent && event.name === CustomEventNames.CopilotKitExit;
|
|
1380
1398
|
const emitIntermediateState = metadata["copilotkit:emit-intermediate-state"];
|
|
1381
1399
|
const manuallyEmitIntermediateState = eventType === LangGraphEventTypes.OnCustomEvent && event.name === CustomEventNames.CopilotKitManuallyEmitIntermediateState;
|
|
1400
|
+
const exitingNode = nodeName === currentNodeName && eventType === LangGraphEventTypes.OnChainEnd;
|
|
1401
|
+
if (exitingNode) {
|
|
1402
|
+
manuallyEmittedState = null;
|
|
1403
|
+
}
|
|
1382
1404
|
if (graphInfo["nodes"].some((node) => node.id === currentNodeName)) {
|
|
1383
1405
|
nodeName = currentNodeName;
|
|
1384
|
-
if (eventType === LangGraphEventTypes.OnChainStart || eventType === LangGraphEventTypes.OnChainEnd) {
|
|
1385
|
-
updatedState = latestStateValues;
|
|
1386
|
-
}
|
|
1387
1406
|
}
|
|
1407
|
+
updatedState = manuallyEmittedState ?? latestStateValues;
|
|
1388
1408
|
if (!nodeName) {
|
|
1389
1409
|
continue;
|
|
1390
1410
|
}
|
|
1391
1411
|
if (manuallyEmitIntermediateState) {
|
|
1392
|
-
|
|
1412
|
+
manuallyEmittedState = event.data;
|
|
1393
1413
|
emit(getStateSyncEvent({
|
|
1394
1414
|
threadId,
|
|
1395
1415
|
runId,
|
|
1396
1416
|
agentName: agent.name,
|
|
1397
1417
|
nodeName,
|
|
1398
|
-
state:
|
|
1418
|
+
state: manuallyEmittedState,
|
|
1399
1419
|
running: true,
|
|
1400
1420
|
active: true
|
|
1401
1421
|
}));
|
|
@@ -1419,7 +1439,6 @@ async function streamEvents(controller, args) {
|
|
|
1419
1439
|
if (!emitIntermediateState && currentNodeName === emitIntermediateStateUntilEnd && eventType === LangGraphEventTypes.OnChainEnd) {
|
|
1420
1440
|
emitIntermediateStateUntilEnd = null;
|
|
1421
1441
|
}
|
|
1422
|
-
const exitingNode = nodeName === currentNodeName && eventType === LangGraphEventTypes.OnChainEnd;
|
|
1423
1442
|
if (JSON.stringify(updatedState) !== JSON.stringify(state) || prevNodeName != nodeName || exitingNode) {
|
|
1424
1443
|
state = updatedState;
|
|
1425
1444
|
prevNodeName = nodeName;
|
|
@@ -1438,6 +1457,7 @@ async function streamEvents(controller, args) {
|
|
|
1438
1457
|
state = await client.threads.getState(threadId);
|
|
1439
1458
|
const isEndNode = state.next.length === 0;
|
|
1440
1459
|
nodeName = Object.keys(state.metadata.writes)[0];
|
|
1460
|
+
telemetry_client_default.capture("oss.runtime.agent_execution_stream_ended", streamInfo);
|
|
1441
1461
|
emit(getStateSyncEvent({
|
|
1442
1462
|
threadId,
|
|
1443
1463
|
runId: externalRunId,
|
|
@@ -1684,8 +1704,13 @@ function constructLGCRemoteAction({ endpoint, graphqlContext, logger: logger2, m
|
|
|
1684
1704
|
var _a;
|
|
1685
1705
|
logger2.debug({
|
|
1686
1706
|
actionName: agent.name
|
|
1687
|
-
}, "Executing LangGraph
|
|
1688
|
-
telemetry_client_default.capture("oss.runtime.remote_action_executed", {
|
|
1707
|
+
}, "Executing LangGraph Platform agent");
|
|
1708
|
+
telemetry_client_default.capture("oss.runtime.remote_action_executed", {
|
|
1709
|
+
agentExecution: true,
|
|
1710
|
+
type: "langgraph-platform",
|
|
1711
|
+
agentsAmount: endpoint.agents.length,
|
|
1712
|
+
hashedLgcKey: createHash2("sha256").update(endpoint.langsmithApiKey).digest("hex")
|
|
1713
|
+
});
|
|
1689
1714
|
let state = {};
|
|
1690
1715
|
if (agentStates) {
|
|
1691
1716
|
const jsonState = (_a = agentStates.find((state2) => state2.agentName === name)) == null ? void 0 : _a.state;
|
|
@@ -1718,8 +1743,8 @@ function constructLGCRemoteAction({ endpoint, graphqlContext, logger: logger2, m
|
|
|
1718
1743
|
url: endpoint.deploymentUrl,
|
|
1719
1744
|
status: 500,
|
|
1720
1745
|
body: error.message
|
|
1721
|
-
}, "Failed to execute LangGraph
|
|
1722
|
-
throw new Error("Failed to execute LangGraph
|
|
1746
|
+
}, "Failed to execute LangGraph Platform agent");
|
|
1747
|
+
throw new Error("Failed to execute LangGraph Platform agent");
|
|
1723
1748
|
}
|
|
1724
1749
|
}
|
|
1725
1750
|
}));
|
|
@@ -1739,7 +1764,11 @@ function constructRemoteActions({ json, url, onBeforeRequest, graphqlContext, lo
|
|
|
1739
1764
|
args
|
|
1740
1765
|
}, "Executing remote action");
|
|
1741
1766
|
const headers = createHeaders(onBeforeRequest, graphqlContext);
|
|
1742
|
-
telemetry_client_default.capture("oss.runtime.remote_action_executed", {
|
|
1767
|
+
telemetry_client_default.capture("oss.runtime.remote_action_executed", {
|
|
1768
|
+
agentExecution: false,
|
|
1769
|
+
type: "self-hosted",
|
|
1770
|
+
agentsAmount: json["agents"].length
|
|
1771
|
+
});
|
|
1743
1772
|
try {
|
|
1744
1773
|
const response = await fetch(`${url}/actions/execute`, {
|
|
1745
1774
|
method: "POST",
|
|
@@ -1785,7 +1814,11 @@ function constructRemoteActions({ json, url, onBeforeRequest, graphqlContext, lo
|
|
|
1785
1814
|
actionName: agent.name
|
|
1786
1815
|
}, "Executing remote agent");
|
|
1787
1816
|
const headers = createHeaders(onBeforeRequest, graphqlContext);
|
|
1788
|
-
telemetry_client_default.capture("oss.runtime.remote_action_executed", {
|
|
1817
|
+
telemetry_client_default.capture("oss.runtime.remote_action_executed", {
|
|
1818
|
+
agentExecution: true,
|
|
1819
|
+
type: "self-hosted",
|
|
1820
|
+
agentsAmount: json["agents"].length
|
|
1821
|
+
});
|
|
1789
1822
|
let state = {};
|
|
1790
1823
|
if (agentStates) {
|
|
1791
1824
|
const jsonState = (_a = agentStates.find((state2) => state2.agentName === name)) == null ? void 0 : _a.state;
|
|
@@ -1893,7 +1926,7 @@ __name(createHeaders, "createHeaders");
|
|
|
1893
1926
|
var EndpointType;
|
|
1894
1927
|
(function(EndpointType2) {
|
|
1895
1928
|
EndpointType2["CopilotKit"] = "copilotKit";
|
|
1896
|
-
EndpointType2["
|
|
1929
|
+
EndpointType2["LangGraphPlatform"] = "langgraph-platform";
|
|
1897
1930
|
})(EndpointType || (EndpointType = {}));
|
|
1898
1931
|
function isLangGraphAgentAction(action) {
|
|
1899
1932
|
if (!action) {
|
|
@@ -1951,13 +1984,13 @@ async function setupRemoteActions({ remoteEndpointDefinitions, graphqlContext, m
|
|
|
1951
1984
|
remoteEndpointDefinitions
|
|
1952
1985
|
}, "Fetching from remote endpoints");
|
|
1953
1986
|
const filtered = remoteEndpointDefinitions.filter((value, index, self) => {
|
|
1954
|
-
if (value.type === "langgraph-
|
|
1987
|
+
if (value.type === "langgraph-platform") {
|
|
1955
1988
|
return value;
|
|
1956
1989
|
}
|
|
1957
1990
|
return index === self.findIndex((t) => t.url === value.url);
|
|
1958
1991
|
});
|
|
1959
1992
|
const result = await Promise.all(filtered.map(async (endpoint) => {
|
|
1960
|
-
if (endpoint.type === "langgraph-
|
|
1993
|
+
if (endpoint.type === "langgraph-platform") {
|
|
1961
1994
|
return constructLGCRemoteAction({
|
|
1962
1995
|
endpoint,
|
|
1963
1996
|
messages,
|
|
@@ -1996,6 +2029,329 @@ async function setupRemoteActions({ remoteEndpointDefinitions, graphqlContext, m
|
|
|
1996
2029
|
}
|
|
1997
2030
|
__name(setupRemoteActions, "setupRemoteActions");
|
|
1998
2031
|
|
|
2032
|
+
// src/lib/telemetry-client.ts
|
|
2033
|
+
import { createHash as createHash3 } from "crypto";
|
|
2034
|
+
|
|
2035
|
+
// src/lib/runtime/copilot-runtime.ts
|
|
2036
|
+
import { actionParametersToJsonSchema, randomId as randomId2 } from "@copilotkit/shared";
|
|
2037
|
+
|
|
2038
|
+
// src/service-adapters/conversion.ts
|
|
2039
|
+
import { plainToInstance } from "class-transformer";
|
|
2040
|
+
function convertGqlInputToMessages(inputMessages) {
|
|
2041
|
+
const messages = [];
|
|
2042
|
+
for (const message of inputMessages) {
|
|
2043
|
+
if (message.textMessage) {
|
|
2044
|
+
messages.push(plainToInstance(TextMessage, {
|
|
2045
|
+
id: message.id,
|
|
2046
|
+
createdAt: message.createdAt,
|
|
2047
|
+
role: message.textMessage.role,
|
|
2048
|
+
content: message.textMessage.content
|
|
2049
|
+
}));
|
|
2050
|
+
} else if (message.actionExecutionMessage) {
|
|
2051
|
+
messages.push(plainToInstance(ActionExecutionMessage, {
|
|
2052
|
+
id: message.id,
|
|
2053
|
+
createdAt: message.createdAt,
|
|
2054
|
+
name: message.actionExecutionMessage.name,
|
|
2055
|
+
arguments: JSON.parse(message.actionExecutionMessage.arguments),
|
|
2056
|
+
scope: message.actionExecutionMessage.scope
|
|
2057
|
+
}));
|
|
2058
|
+
} else if (message.resultMessage) {
|
|
2059
|
+
messages.push(plainToInstance(ResultMessage, {
|
|
2060
|
+
id: message.id,
|
|
2061
|
+
createdAt: message.createdAt,
|
|
2062
|
+
actionExecutionId: message.resultMessage.actionExecutionId,
|
|
2063
|
+
actionName: message.resultMessage.actionName,
|
|
2064
|
+
result: message.resultMessage.result
|
|
2065
|
+
}));
|
|
2066
|
+
} else if (message.agentStateMessage) {
|
|
2067
|
+
messages.push(plainToInstance(AgentStateMessage, {
|
|
2068
|
+
id: message.id,
|
|
2069
|
+
threadId: message.agentStateMessage.threadId,
|
|
2070
|
+
createdAt: message.createdAt,
|
|
2071
|
+
agentName: message.agentStateMessage.agentName,
|
|
2072
|
+
nodeName: message.agentStateMessage.nodeName,
|
|
2073
|
+
runId: message.agentStateMessage.runId,
|
|
2074
|
+
active: message.agentStateMessage.active,
|
|
2075
|
+
role: message.agentStateMessage.role,
|
|
2076
|
+
state: JSON.parse(message.agentStateMessage.state),
|
|
2077
|
+
running: message.agentStateMessage.running
|
|
2078
|
+
}));
|
|
2079
|
+
}
|
|
2080
|
+
}
|
|
2081
|
+
return messages;
|
|
2082
|
+
}
|
|
2083
|
+
__name(convertGqlInputToMessages, "convertGqlInputToMessages");
|
|
2084
|
+
|
|
2085
|
+
// src/lib/runtime/copilot-runtime.ts
|
|
2086
|
+
import { from } from "rxjs";
|
|
2087
|
+
var CopilotRuntime = class {
|
|
2088
|
+
actions;
|
|
2089
|
+
remoteEndpointDefinitions;
|
|
2090
|
+
langserve = [];
|
|
2091
|
+
onBeforeRequest;
|
|
2092
|
+
onAfterRequest;
|
|
2093
|
+
constructor(params) {
|
|
2094
|
+
var _a, _b;
|
|
2095
|
+
this.actions = (params == null ? void 0 : params.actions) || [];
|
|
2096
|
+
for (const chain of (params == null ? void 0 : params.langserve) || []) {
|
|
2097
|
+
const remoteChain = new RemoteChain(chain);
|
|
2098
|
+
this.langserve.push(remoteChain.toAction());
|
|
2099
|
+
}
|
|
2100
|
+
this.remoteEndpointDefinitions = (params == null ? void 0 : params.remoteEndpoints) ?? (params == null ? void 0 : params.remoteActions) ?? [];
|
|
2101
|
+
this.onBeforeRequest = (_a = params == null ? void 0 : params.middleware) == null ? void 0 : _a.onBeforeRequest;
|
|
2102
|
+
this.onAfterRequest = (_b = params == null ? void 0 : params.middleware) == null ? void 0 : _b.onAfterRequest;
|
|
2103
|
+
}
|
|
2104
|
+
async processRuntimeRequest(request) {
|
|
2105
|
+
var _a;
|
|
2106
|
+
const { serviceAdapter, messages: rawMessages, actions: clientSideActionsInput, threadId, runId, outputMessagesPromise, graphqlContext, forwardedParameters, agentSession, url } = request;
|
|
2107
|
+
const eventSource = new RuntimeEventSource();
|
|
2108
|
+
try {
|
|
2109
|
+
if (agentSession) {
|
|
2110
|
+
return await this.processAgentRequest(request);
|
|
2111
|
+
}
|
|
2112
|
+
const messages = rawMessages.filter((message) => !message.agentStateMessage);
|
|
2113
|
+
const inputMessages = convertGqlInputToMessages(messages);
|
|
2114
|
+
const serverSideActions = await this.getServerSideActions(request);
|
|
2115
|
+
const serverSideActionsInput = serverSideActions.map((action) => ({
|
|
2116
|
+
name: action.name,
|
|
2117
|
+
description: action.description,
|
|
2118
|
+
jsonSchema: JSON.stringify(actionParametersToJsonSchema(action.parameters))
|
|
2119
|
+
}));
|
|
2120
|
+
const actionInputs = flattenToolCallsNoDuplicates([
|
|
2121
|
+
...serverSideActionsInput,
|
|
2122
|
+
...clientSideActionsInput
|
|
2123
|
+
]);
|
|
2124
|
+
await ((_a = this.onBeforeRequest) == null ? void 0 : _a.call(this, {
|
|
2125
|
+
threadId,
|
|
2126
|
+
runId,
|
|
2127
|
+
inputMessages,
|
|
2128
|
+
properties: graphqlContext.properties,
|
|
2129
|
+
url
|
|
2130
|
+
}));
|
|
2131
|
+
const result = await serviceAdapter.process({
|
|
2132
|
+
messages: inputMessages,
|
|
2133
|
+
actions: actionInputs,
|
|
2134
|
+
threadId,
|
|
2135
|
+
runId,
|
|
2136
|
+
eventSource,
|
|
2137
|
+
forwardedParameters
|
|
2138
|
+
});
|
|
2139
|
+
outputMessagesPromise.then((outputMessages) => {
|
|
2140
|
+
var _a2;
|
|
2141
|
+
(_a2 = this.onAfterRequest) == null ? void 0 : _a2.call(this, {
|
|
2142
|
+
threadId: result.threadId,
|
|
2143
|
+
runId: result.runId,
|
|
2144
|
+
inputMessages,
|
|
2145
|
+
outputMessages,
|
|
2146
|
+
properties: graphqlContext.properties,
|
|
2147
|
+
url
|
|
2148
|
+
});
|
|
2149
|
+
}).catch((_error) => {
|
|
2150
|
+
});
|
|
2151
|
+
return {
|
|
2152
|
+
threadId: result.threadId,
|
|
2153
|
+
runId: result.runId,
|
|
2154
|
+
eventSource,
|
|
2155
|
+
serverSideActions,
|
|
2156
|
+
actionInputsWithoutAgents: actionInputs.filter((action) => (
|
|
2157
|
+
// TODO-AGENTS: do not exclude ALL server side actions
|
|
2158
|
+
!serverSideActions.find((serverSideAction) => serverSideAction.name == action.name)
|
|
2159
|
+
))
|
|
2160
|
+
};
|
|
2161
|
+
} catch (error) {
|
|
2162
|
+
console.error("Error getting response:", error);
|
|
2163
|
+
eventSource.sendErrorMessageToChat();
|
|
2164
|
+
return {
|
|
2165
|
+
threadId: threadId || randomId2(),
|
|
2166
|
+
runId: runId || randomId2(),
|
|
2167
|
+
eventSource,
|
|
2168
|
+
serverSideActions: [],
|
|
2169
|
+
actionInputsWithoutAgents: []
|
|
2170
|
+
};
|
|
2171
|
+
}
|
|
2172
|
+
}
|
|
2173
|
+
async processAgentRequest(request) {
|
|
2174
|
+
var _a;
|
|
2175
|
+
const { messages: rawMessages, outputMessagesPromise, graphqlContext, agentSession } = request;
|
|
2176
|
+
const { threadId, agentName, nodeName } = agentSession;
|
|
2177
|
+
const serverSideActions = await this.getServerSideActions(request);
|
|
2178
|
+
const messages = convertGqlInputToMessages(rawMessages);
|
|
2179
|
+
const agent = serverSideActions.find((action) => action.name === agentName && isLangGraphAgentAction(action));
|
|
2180
|
+
if (!agent) {
|
|
2181
|
+
throw new Error(`Agent ${agentName} not found`);
|
|
2182
|
+
}
|
|
2183
|
+
const serverSideActionsInput = serverSideActions.filter((action) => !isLangGraphAgentAction(action)).map((action) => ({
|
|
2184
|
+
name: action.name,
|
|
2185
|
+
description: action.description,
|
|
2186
|
+
jsonSchema: JSON.stringify(actionParametersToJsonSchema(action.parameters))
|
|
2187
|
+
}));
|
|
2188
|
+
const actionInputsWithoutAgents = flattenToolCallsNoDuplicates([
|
|
2189
|
+
...serverSideActionsInput,
|
|
2190
|
+
...request.actions
|
|
2191
|
+
]);
|
|
2192
|
+
await ((_a = this.onBeforeRequest) == null ? void 0 : _a.call(this, {
|
|
2193
|
+
threadId,
|
|
2194
|
+
runId: void 0,
|
|
2195
|
+
inputMessages: messages,
|
|
2196
|
+
properties: graphqlContext.properties
|
|
2197
|
+
}));
|
|
2198
|
+
try {
|
|
2199
|
+
const eventSource = new RuntimeEventSource();
|
|
2200
|
+
const stream = await agent.langGraphAgentHandler({
|
|
2201
|
+
name: agentName,
|
|
2202
|
+
threadId,
|
|
2203
|
+
nodeName,
|
|
2204
|
+
actionInputsWithoutAgents
|
|
2205
|
+
});
|
|
2206
|
+
eventSource.stream(async (eventStream$) => {
|
|
2207
|
+
from(stream).subscribe({
|
|
2208
|
+
next: (event) => eventStream$.next(event),
|
|
2209
|
+
error: (err) => console.error("Error in stream", err),
|
|
2210
|
+
complete: () => eventStream$.complete()
|
|
2211
|
+
});
|
|
2212
|
+
});
|
|
2213
|
+
outputMessagesPromise.then((outputMessages) => {
|
|
2214
|
+
var _a2;
|
|
2215
|
+
(_a2 = this.onAfterRequest) == null ? void 0 : _a2.call(this, {
|
|
2216
|
+
threadId,
|
|
2217
|
+
runId: void 0,
|
|
2218
|
+
inputMessages: messages,
|
|
2219
|
+
outputMessages,
|
|
2220
|
+
properties: graphqlContext.properties
|
|
2221
|
+
});
|
|
2222
|
+
}).catch((_error) => {
|
|
2223
|
+
});
|
|
2224
|
+
return {
|
|
2225
|
+
threadId,
|
|
2226
|
+
runId: void 0,
|
|
2227
|
+
eventSource,
|
|
2228
|
+
serverSideActions: [],
|
|
2229
|
+
actionInputsWithoutAgents
|
|
2230
|
+
};
|
|
2231
|
+
} catch (error) {
|
|
2232
|
+
console.error("Error getting response:", error);
|
|
2233
|
+
throw error;
|
|
2234
|
+
}
|
|
2235
|
+
}
|
|
2236
|
+
async getServerSideActions(request) {
|
|
2237
|
+
const { messages: rawMessages, graphqlContext, agentStates, url } = request;
|
|
2238
|
+
const inputMessages = convertGqlInputToMessages(rawMessages);
|
|
2239
|
+
const langserveFunctions = [];
|
|
2240
|
+
for (const chainPromise of this.langserve) {
|
|
2241
|
+
try {
|
|
2242
|
+
const chain = await chainPromise;
|
|
2243
|
+
langserveFunctions.push(chain);
|
|
2244
|
+
} catch (error) {
|
|
2245
|
+
console.error("Error loading langserve chain:", error);
|
|
2246
|
+
}
|
|
2247
|
+
}
|
|
2248
|
+
const remoteEndpointDefinitions = this.remoteEndpointDefinitions.map((endpoint) => ({
|
|
2249
|
+
...endpoint,
|
|
2250
|
+
type: resolveEndpointType(endpoint)
|
|
2251
|
+
}));
|
|
2252
|
+
const remoteActions = await setupRemoteActions({
|
|
2253
|
+
remoteEndpointDefinitions,
|
|
2254
|
+
graphqlContext,
|
|
2255
|
+
messages: inputMessages,
|
|
2256
|
+
agentStates,
|
|
2257
|
+
frontendUrl: url
|
|
2258
|
+
});
|
|
2259
|
+
const configuredActions = typeof this.actions === "function" ? this.actions({
|
|
2260
|
+
properties: graphqlContext.properties,
|
|
2261
|
+
url
|
|
2262
|
+
}) : this.actions;
|
|
2263
|
+
return [
|
|
2264
|
+
...configuredActions,
|
|
2265
|
+
...langserveFunctions,
|
|
2266
|
+
...remoteActions
|
|
2267
|
+
];
|
|
2268
|
+
}
|
|
2269
|
+
};
|
|
2270
|
+
__name(CopilotRuntime, "CopilotRuntime");
|
|
2271
|
+
function flattenToolCallsNoDuplicates(toolsByPriority) {
|
|
2272
|
+
let allTools = [];
|
|
2273
|
+
const allToolNames = [];
|
|
2274
|
+
for (const tool of toolsByPriority) {
|
|
2275
|
+
if (!allToolNames.includes(tool.name)) {
|
|
2276
|
+
allTools.push(tool);
|
|
2277
|
+
allToolNames.push(tool.name);
|
|
2278
|
+
}
|
|
2279
|
+
}
|
|
2280
|
+
return allTools;
|
|
2281
|
+
}
|
|
2282
|
+
__name(flattenToolCallsNoDuplicates, "flattenToolCallsNoDuplicates");
|
|
2283
|
+
function copilotKitEndpoint(config) {
|
|
2284
|
+
return {
|
|
2285
|
+
...config,
|
|
2286
|
+
type: EndpointType.CopilotKit
|
|
2287
|
+
};
|
|
2288
|
+
}
|
|
2289
|
+
__name(copilotKitEndpoint, "copilotKitEndpoint");
|
|
2290
|
+
function langGraphPlatformEndpoint(config) {
|
|
2291
|
+
return {
|
|
2292
|
+
...config,
|
|
2293
|
+
type: EndpointType.LangGraphPlatform
|
|
2294
|
+
};
|
|
2295
|
+
}
|
|
2296
|
+
__name(langGraphPlatformEndpoint, "langGraphPlatformEndpoint");
|
|
2297
|
+
function resolveEndpointType(endpoint) {
|
|
2298
|
+
if (!endpoint.type) {
|
|
2299
|
+
if ("langsmithApiKey" in endpoint && "deploymentUrl" in endpoint && "agents" in endpoint) {
|
|
2300
|
+
return EndpointType.LangGraphPlatform;
|
|
2301
|
+
} else {
|
|
2302
|
+
return EndpointType.CopilotKit;
|
|
2303
|
+
}
|
|
2304
|
+
}
|
|
2305
|
+
return endpoint.type;
|
|
2306
|
+
}
|
|
2307
|
+
__name(resolveEndpointType, "resolveEndpointType");
|
|
2308
|
+
|
|
2309
|
+
// src/lib/telemetry-client.ts
|
|
2310
|
+
var packageJson = require_package();
|
|
2311
|
+
var telemetryClient = new TelemetryClient({
|
|
2312
|
+
packageName: packageJson.name,
|
|
2313
|
+
packageVersion: packageJson.version
|
|
2314
|
+
});
|
|
2315
|
+
function getRuntimeInstanceTelemetryInfo(runtime) {
|
|
2316
|
+
const endpointsInfo = runtime.remoteEndpointDefinitions.reduce((acc, endpoint) => {
|
|
2317
|
+
let info = {
|
|
2318
|
+
...acc
|
|
2319
|
+
};
|
|
2320
|
+
const endpointType = resolveEndpointType(endpoint);
|
|
2321
|
+
if (!info.endpointTypes.includes(endpointType)) {
|
|
2322
|
+
info = {
|
|
2323
|
+
...info,
|
|
2324
|
+
endpointTypes: [
|
|
2325
|
+
...info.endpointTypes,
|
|
2326
|
+
endpointType
|
|
2327
|
+
]
|
|
2328
|
+
};
|
|
2329
|
+
}
|
|
2330
|
+
if (endpointType === EndpointType.LangGraphPlatform) {
|
|
2331
|
+
const ep = endpoint;
|
|
2332
|
+
info = {
|
|
2333
|
+
...info,
|
|
2334
|
+
agentsAmount: ep.agents.length,
|
|
2335
|
+
hashedKey: createHash3("sha256").update(ep.langsmithApiKey).digest("hex")
|
|
2336
|
+
};
|
|
2337
|
+
}
|
|
2338
|
+
return info;
|
|
2339
|
+
}, {
|
|
2340
|
+
endpointTypes: [],
|
|
2341
|
+
agentsAmount: null,
|
|
2342
|
+
hashedKey: null
|
|
2343
|
+
});
|
|
2344
|
+
return {
|
|
2345
|
+
actionsAmount: runtime.actions.length,
|
|
2346
|
+
endpointsAmount: runtime.remoteEndpointDefinitions.length,
|
|
2347
|
+
endpointTypes: endpointsInfo.endpointTypes,
|
|
2348
|
+
agentsAmount: endpointsInfo.agentsAmount,
|
|
2349
|
+
hashedLgcKey: endpointsInfo.hashedKey
|
|
2350
|
+
};
|
|
2351
|
+
}
|
|
2352
|
+
__name(getRuntimeInstanceTelemetryInfo, "getRuntimeInstanceTelemetryInfo");
|
|
2353
|
+
var telemetry_client_default = telemetryClient;
|
|
2354
|
+
|
|
1999
2355
|
// src/service-adapters/events.ts
|
|
2000
2356
|
var RuntimeEventTypes;
|
|
2001
2357
|
(function(RuntimeEventTypes2) {
|
|
@@ -2086,9 +2442,20 @@ var RuntimeEventSource = class {
|
|
|
2086
2442
|
async stream(callback) {
|
|
2087
2443
|
this.callback = callback;
|
|
2088
2444
|
}
|
|
2445
|
+
sendErrorMessageToChat() {
|
|
2446
|
+
const errorMessage = "\u274C An error occurred. Please try again.";
|
|
2447
|
+
if (!this.callback) {
|
|
2448
|
+
this.stream(async (eventStream$) => {
|
|
2449
|
+
eventStream$.sendTextMessage(randomId3(), errorMessage);
|
|
2450
|
+
});
|
|
2451
|
+
} else {
|
|
2452
|
+
this.eventStream$.sendTextMessage(randomId3(), errorMessage);
|
|
2453
|
+
}
|
|
2454
|
+
}
|
|
2089
2455
|
processRuntimeEvents({ serverSideActions, guardrailsResult$, actionInputsWithoutAgents }) {
|
|
2090
2456
|
this.callback(this.eventStream$).catch((error) => {
|
|
2091
2457
|
console.error("Error in event source callback", error);
|
|
2458
|
+
this.sendErrorMessageToChat();
|
|
2092
2459
|
});
|
|
2093
2460
|
return this.eventStream$.pipe(
|
|
2094
2461
|
// mark tools for server side execution
|
|
@@ -2165,7 +2532,7 @@ async function executeAction(eventStream$, guardrailsResult$, action, actionArgu
|
|
|
2165
2532
|
name: action.name,
|
|
2166
2533
|
actionInputsWithoutAgents
|
|
2167
2534
|
});
|
|
2168
|
-
|
|
2535
|
+
from2(stream).subscribe({
|
|
2169
2536
|
next: (event) => eventStream$.next(event),
|
|
2170
2537
|
error: (err) => console.error("Error in stream", err),
|
|
2171
2538
|
complete: () => eventStream$.complete()
|
|
@@ -2186,9 +2553,9 @@ __name(executeAction, "executeAction");
|
|
|
2186
2553
|
|
|
2187
2554
|
// src/graphql/resolvers/copilot.resolver.ts
|
|
2188
2555
|
import { GraphQLJSONObject } from "graphql-scalars";
|
|
2189
|
-
import { plainToInstance } from "class-transformer";
|
|
2556
|
+
import { plainToInstance as plainToInstance2 } from "class-transformer";
|
|
2190
2557
|
import { GraphQLError } from "graphql";
|
|
2191
|
-
import { randomId as
|
|
2558
|
+
import { randomId as randomId4 } from "@copilotkit/shared";
|
|
2192
2559
|
function _ts_decorate12(decorators, target, key, desc) {
|
|
2193
2560
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2194
2561
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
@@ -2305,7 +2672,7 @@ var CopilotResolver = class {
|
|
|
2305
2672
|
rejectOutputMessagesPromise = reject;
|
|
2306
2673
|
});
|
|
2307
2674
|
logger2.debug("Processing");
|
|
2308
|
-
const { eventSource, threadId =
|
|
2675
|
+
const { eventSource, threadId = randomId4(), runId, serverSideActions, actionInputsWithoutAgents } = await copilotRuntime.processRuntimeRequest({
|
|
2309
2676
|
serviceAdapter,
|
|
2310
2677
|
messages: data.messages,
|
|
2311
2678
|
actions: data.frontend.actions,
|
|
@@ -2349,8 +2716,8 @@ var CopilotResolver = class {
|
|
|
2349
2716
|
reason: `Interrupted due to Guardrails validation failure. Reason: ${result.reason}`
|
|
2350
2717
|
});
|
|
2351
2718
|
outputMessages = [
|
|
2352
|
-
|
|
2353
|
-
id:
|
|
2719
|
+
plainToInstance2(TextMessage, {
|
|
2720
|
+
id: randomId4(),
|
|
2354
2721
|
createdAt: /* @__PURE__ */ new Date(),
|
|
2355
2722
|
content: result.reason,
|
|
2356
2723
|
role: MessageRole.assistant
|
|
@@ -2416,7 +2783,7 @@ var CopilotResolver = class {
|
|
|
2416
2783
|
reason,
|
|
2417
2784
|
messageId: messageId2
|
|
2418
2785
|
}, "Text streaming interrupted");
|
|
2419
|
-
streamingTextStatus.next(
|
|
2786
|
+
streamingTextStatus.next(plainToInstance2(FailedMessageStatus, {
|
|
2420
2787
|
reason
|
|
2421
2788
|
}));
|
|
2422
2789
|
responseStatus$.next(new MessageStreamInterruptedResponse({
|
|
@@ -2449,7 +2816,7 @@ var CopilotResolver = class {
|
|
|
2449
2816
|
streamingTextStatus.next(new SuccessMessageStatus());
|
|
2450
2817
|
stopStreamingText();
|
|
2451
2818
|
textSubscription == null ? void 0 : textSubscription.unsubscribe();
|
|
2452
|
-
outputMessages.push(
|
|
2819
|
+
outputMessages.push(plainToInstance2(TextMessage, {
|
|
2453
2820
|
id: messageId,
|
|
2454
2821
|
createdAt: /* @__PURE__ */ new Date(),
|
|
2455
2822
|
content: textChunks.join(""),
|
|
@@ -2485,7 +2852,7 @@ var CopilotResolver = class {
|
|
|
2485
2852
|
logger2.error({
|
|
2486
2853
|
err
|
|
2487
2854
|
}, "Error in action execution argument stream");
|
|
2488
|
-
streamingArgumentsStatus.next(
|
|
2855
|
+
streamingArgumentsStatus.next(plainToInstance2(FailedMessageStatus, {
|
|
2489
2856
|
reason: "An unknown error has occurred in the action execution argument stream"
|
|
2490
2857
|
}));
|
|
2491
2858
|
stopStreamingArguments();
|
|
@@ -2496,7 +2863,7 @@ var CopilotResolver = class {
|
|
|
2496
2863
|
streamingArgumentsStatus.next(new SuccessMessageStatus());
|
|
2497
2864
|
stopStreamingArguments();
|
|
2498
2865
|
actionExecutionArgumentSubscription == null ? void 0 : actionExecutionArgumentSubscription.unsubscribe();
|
|
2499
|
-
outputMessages.push(
|
|
2866
|
+
outputMessages.push(plainToInstance2(ActionExecutionMessage, {
|
|
2500
2867
|
id: event.actionExecutionId,
|
|
2501
2868
|
createdAt: /* @__PURE__ */ new Date(),
|
|
2502
2869
|
name: event.actionName,
|
|
@@ -2513,15 +2880,15 @@ var CopilotResolver = class {
|
|
|
2513
2880
|
result: event.result
|
|
2514
2881
|
}, "Action execution result event received");
|
|
2515
2882
|
pushMessage({
|
|
2516
|
-
id:
|
|
2883
|
+
id: randomId4(),
|
|
2517
2884
|
status: new SuccessMessageStatus(),
|
|
2518
2885
|
createdAt: /* @__PURE__ */ new Date(),
|
|
2519
2886
|
actionExecutionId: event.actionExecutionId,
|
|
2520
2887
|
actionName: event.actionName,
|
|
2521
2888
|
result: event.result
|
|
2522
2889
|
});
|
|
2523
|
-
outputMessages.push(
|
|
2524
|
-
id:
|
|
2890
|
+
outputMessages.push(plainToInstance2(ResultMessage, {
|
|
2891
|
+
id: randomId4(),
|
|
2525
2892
|
createdAt: /* @__PURE__ */ new Date(),
|
|
2526
2893
|
actionExecutionId: event.actionExecutionId,
|
|
2527
2894
|
actionName: event.actionName,
|
|
@@ -2533,7 +2900,7 @@ var CopilotResolver = class {
|
|
|
2533
2900
|
event
|
|
2534
2901
|
}, "Agent message event received");
|
|
2535
2902
|
pushMessage({
|
|
2536
|
-
id:
|
|
2903
|
+
id: randomId4(),
|
|
2537
2904
|
status: new SuccessMessageStatus(),
|
|
2538
2905
|
threadId: event.threadId,
|
|
2539
2906
|
agentName: event.agentName,
|
|
@@ -2545,8 +2912,8 @@ var CopilotResolver = class {
|
|
|
2545
2912
|
role: MessageRole.assistant,
|
|
2546
2913
|
createdAt: /* @__PURE__ */ new Date()
|
|
2547
2914
|
});
|
|
2548
|
-
outputMessages.push(
|
|
2549
|
-
id:
|
|
2915
|
+
outputMessages.push(plainToInstance2(AgentStateMessage, {
|
|
2916
|
+
id: randomId4(),
|
|
2550
2917
|
threadId: event.threadId,
|
|
2551
2918
|
agentName: event.agentName,
|
|
2552
2919
|
nodeName: event.nodeName,
|
|
@@ -2733,7 +3100,7 @@ function copilotRuntimeNodeHttpEndpoint(options) {
|
|
|
2733
3100
|
_copilotkit: options.properties._copilotkit
|
|
2734
3101
|
});
|
|
2735
3102
|
}
|
|
2736
|
-
telemetry_client_default.capture("oss.runtime.instance_created",
|
|
3103
|
+
telemetry_client_default.capture("oss.runtime.instance_created", getRuntimeInstanceTelemetryInfo(options.runtime));
|
|
2737
3104
|
const logger2 = commonConfig.logging;
|
|
2738
3105
|
logger2.debug("Creating Node HTTP endpoint");
|
|
2739
3106
|
const yoga = createYoga({
|
|
@@ -2745,14 +3112,16 @@ function copilotRuntimeNodeHttpEndpoint(options) {
|
|
|
2745
3112
|
__name(copilotRuntimeNodeHttpEndpoint, "copilotRuntimeNodeHttpEndpoint");
|
|
2746
3113
|
|
|
2747
3114
|
export {
|
|
3115
|
+
getRuntimeInstanceTelemetryInfo,
|
|
2748
3116
|
telemetry_client_default,
|
|
2749
|
-
|
|
2750
|
-
|
|
2751
|
-
|
|
2752
|
-
|
|
3117
|
+
CopilotRuntime,
|
|
3118
|
+
flattenToolCallsNoDuplicates,
|
|
3119
|
+
copilotKitEndpoint,
|
|
3120
|
+
langGraphPlatformEndpoint,
|
|
3121
|
+
resolveEndpointType,
|
|
2753
3122
|
createContext,
|
|
2754
3123
|
buildSchema,
|
|
2755
3124
|
getCommonConfig,
|
|
2756
3125
|
copilotRuntimeNodeHttpEndpoint
|
|
2757
3126
|
};
|
|
2758
|
-
//# sourceMappingURL=chunk-
|
|
3127
|
+
//# sourceMappingURL=chunk-YSCTOGKC.mjs.map
|