@copilotkit/runtime 1.3.16-mme-lgc-langgraph-package.10 → 1.3.16-mme-reset-chat.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 +45 -63
- package/dist/{chunk-JE2DM46O.mjs → chunk-2S6JGN2A.mjs} +4 -3
- package/dist/chunk-2S6JGN2A.mjs.map +1 -0
- package/dist/{chunk-SM3JAVXQ.mjs → chunk-3XICZ4K2.mjs} +5 -4
- package/dist/chunk-3XICZ4K2.mjs.map +1 -0
- package/dist/chunk-DFOKBSIS.mjs +1 -0
- package/dist/chunk-DFOKBSIS.mjs.map +1 -0
- package/dist/{chunk-PGK7SFLR.mjs → chunk-ODOSADGH.mjs} +376 -28
- package/dist/chunk-ODOSADGH.mjs.map +1 -0
- package/dist/{chunk-JCC4W3AU.mjs → chunk-TBNMKEWV.mjs} +4 -3
- package/dist/chunk-TBNMKEWV.mjs.map +1 -0
- package/dist/{chunk-BNQDVBQH.mjs → chunk-WHJ3DAYL.mjs} +251 -34
- package/dist/chunk-WHJ3DAYL.mjs.map +1 -0
- package/dist/{copilot-runtime-8d3f40c7.d.ts → copilot-runtime-b9715bd4.d.ts} +3 -3
- package/dist/index.d.ts +1 -1
- package/dist/index.js +141 -45
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +22 -22
- package/dist/index.mjs.map +1 -1
- package/dist/lib/index.d.ts +1 -1
- package/dist/lib/index.js +141 -45
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/index.mjs +21 -21
- package/dist/lib/integrations/index.d.ts +2 -2
- package/dist/lib/integrations/index.js +152 -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 +1 -1
- package/dist/lib/integrations/nest/index.js +149 -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 +1 -1
- package/dist/lib/integrations/node-express/index.js +149 -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 +1 -1
- package/dist/lib/integrations/node-http/index.js +148 -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.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/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 +14 -15
- package/src/lib/runtime/remote-action-constructors.ts +17 -3
- package/src/lib/runtime/remote-lg-cloud-action.ts +25 -2
- package/src/lib/telemetry-client.ts +43 -0
- 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-H3C6UCKB.mjs +0 -288
- package/dist/chunk-H3C6UCKB.mjs.map +0 -1
- package/dist/chunk-JCC4W3AU.mjs.map +0 -1
- package/dist/chunk-JE2DM46O.mjs.map +0 -1
- package/dist/chunk-MXXPWWBF.mjs +0 -218
- package/dist/chunk-MXXPWWBF.mjs.map +0 -1
- package/dist/chunk-PGK7SFLR.mjs.map +0 -1
- package/dist/chunk-SM3JAVXQ.mjs.map +0 -1
package/dist/lib/index.mjs
CHANGED
|
@@ -1,35 +1,34 @@
|
|
|
1
|
-
import
|
|
2
|
-
CopilotRuntime,
|
|
3
|
-
copilotKitEndpoint,
|
|
4
|
-
flattenToolCallsNoDuplicates,
|
|
5
|
-
langGraphCloudEndpoint
|
|
6
|
-
} from "../chunk-H3C6UCKB.mjs";
|
|
7
|
-
import {
|
|
8
|
-
GoogleGenerativeAIAdapter,
|
|
9
|
-
GroqAdapter,
|
|
10
|
-
LangChainAdapter,
|
|
11
|
-
OpenAIAdapter,
|
|
12
|
-
OpenAIAssistantAdapter,
|
|
13
|
-
UnifyAdapter
|
|
14
|
-
} from "../chunk-BNQDVBQH.mjs";
|
|
1
|
+
import "../chunk-DFOKBSIS.mjs";
|
|
15
2
|
import {
|
|
16
3
|
config,
|
|
17
4
|
copilotRuntimeNextJSAppRouterEndpoint,
|
|
18
5
|
copilotRuntimeNextJSPagesRouterEndpoint
|
|
19
|
-
} from "../chunk-
|
|
6
|
+
} from "../chunk-3XICZ4K2.mjs";
|
|
20
7
|
import {
|
|
21
8
|
copilotRuntimeNestEndpoint
|
|
22
|
-
} from "../chunk-
|
|
9
|
+
} from "../chunk-TBNMKEWV.mjs";
|
|
23
10
|
import {
|
|
24
11
|
copilotRuntimeNodeExpressEndpoint
|
|
25
|
-
} from "../chunk-
|
|
12
|
+
} from "../chunk-2S6JGN2A.mjs";
|
|
26
13
|
import {
|
|
14
|
+
CopilotRuntime,
|
|
27
15
|
buildSchema,
|
|
16
|
+
copilotKitEndpoint,
|
|
28
17
|
copilotRuntimeNodeHttpEndpoint,
|
|
29
18
|
createContext,
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
19
|
+
flattenToolCallsNoDuplicates,
|
|
20
|
+
getCommonConfig,
|
|
21
|
+
langGraphCloudEndpoint,
|
|
22
|
+
resolveEndpointType
|
|
23
|
+
} from "../chunk-ODOSADGH.mjs";
|
|
24
|
+
import {
|
|
25
|
+
GoogleGenerativeAIAdapter,
|
|
26
|
+
GroqAdapter,
|
|
27
|
+
LangChainAdapter,
|
|
28
|
+
OpenAIAdapter,
|
|
29
|
+
OpenAIAssistantAdapter,
|
|
30
|
+
UnifyAdapter
|
|
31
|
+
} from "../chunk-WHJ3DAYL.mjs";
|
|
33
32
|
import "../chunk-U3V2BCGI.mjs";
|
|
34
33
|
import "../chunk-B74M7FXG.mjs";
|
|
35
34
|
import "../chunk-D2WLFQS6.mjs";
|
|
@@ -53,6 +52,7 @@ export {
|
|
|
53
52
|
createContext,
|
|
54
53
|
flattenToolCallsNoDuplicates,
|
|
55
54
|
getCommonConfig,
|
|
56
|
-
langGraphCloudEndpoint
|
|
55
|
+
langGraphCloudEndpoint,
|
|
56
|
+
resolveEndpointType
|
|
57
57
|
};
|
|
58
58
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { d as CreateCopilotRuntimeServerOptions, G as GraphQLContext } from '../../copilot-runtime-
|
|
2
|
-
export { h as CommonConfig, b as CopilotRequestContextProperties, g as buildSchema, e as createContext, i as getCommonConfig } from '../../copilot-runtime-
|
|
1
|
+
import { d as CreateCopilotRuntimeServerOptions, G as GraphQLContext } from '../../copilot-runtime-b9715bd4.js';
|
|
2
|
+
export { h as CommonConfig, b as CopilotRequestContextProperties, g as buildSchema, e as createContext, i as getCommonConfig } from '../../copilot-runtime-b9715bd4.js';
|
|
3
3
|
import * as graphql_yoga from 'graphql-yoga';
|
|
4
4
|
import { YogaServerInstance } from 'graphql-yoga';
|
|
5
5
|
export { copilotRuntimeNodeHttpEndpoint } from './node-http/index.js';
|
|
@@ -12,11 +12,11 @@ var __export = (target, all) => {
|
|
|
12
12
|
for (var name in all)
|
|
13
13
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
14
14
|
};
|
|
15
|
-
var __copyProps = (to,
|
|
16
|
-
if (
|
|
17
|
-
for (let key of __getOwnPropNames(
|
|
15
|
+
var __copyProps = (to, from3, except, desc) => {
|
|
16
|
+
if (from3 && typeof from3 === "object" || typeof from3 === "function") {
|
|
17
|
+
for (let key of __getOwnPropNames(from3))
|
|
18
18
|
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
19
|
-
__defProp(to, key, { get: () =>
|
|
19
|
+
__defProp(to, key, { get: () => from3[key], enumerable: !(desc = __getOwnPropDesc(from3, key)) || desc.enumerable });
|
|
20
20
|
}
|
|
21
21
|
return to;
|
|
22
22
|
};
|
|
@@ -44,7 +44,7 @@ var require_package = __commonJS({
|
|
|
44
44
|
publishConfig: {
|
|
45
45
|
access: "public"
|
|
46
46
|
},
|
|
47
|
-
version: "1.3.16-mme-
|
|
47
|
+
version: "1.3.16-mme-reset-chat.10",
|
|
48
48
|
sideEffects: false,
|
|
49
49
|
main: "./dist/index.js",
|
|
50
50
|
module: "./dist/index.mjs",
|
|
@@ -141,7 +141,7 @@ var import_type_graphql16 = require("type-graphql");
|
|
|
141
141
|
|
|
142
142
|
// src/graphql/resolvers/copilot.resolver.ts
|
|
143
143
|
var import_type_graphql15 = require("type-graphql");
|
|
144
|
-
var
|
|
144
|
+
var import_rxjs3 = require("rxjs");
|
|
145
145
|
|
|
146
146
|
// src/graphql/inputs/generate-copilot-response.input.ts
|
|
147
147
|
var import_type_graphql11 = require("type-graphql");
|
|
@@ -1185,15 +1185,132 @@ CopilotResponse = _ts_decorate13([
|
|
|
1185
1185
|
var import_graphql_yoga = require("graphql-yoga");
|
|
1186
1186
|
|
|
1187
1187
|
// src/service-adapters/events.ts
|
|
1188
|
-
var
|
|
1188
|
+
var import_rxjs2 = require("rxjs");
|
|
1189
|
+
|
|
1190
|
+
// src/lib/telemetry-client.ts
|
|
1191
|
+
var import_shared2 = require("@copilotkit/shared");
|
|
1192
|
+
|
|
1193
|
+
// src/lib/runtime/remote-actions.ts
|
|
1194
|
+
var EndpointType;
|
|
1195
|
+
(function(EndpointType2) {
|
|
1196
|
+
EndpointType2["CopilotKit"] = "copilotKit";
|
|
1197
|
+
EndpointType2["LangGraphCloud"] = "langgraph-cloud";
|
|
1198
|
+
})(EndpointType || (EndpointType = {}));
|
|
1189
1199
|
|
|
1190
1200
|
// src/lib/telemetry-client.ts
|
|
1201
|
+
var import_node_crypto = require("crypto");
|
|
1202
|
+
|
|
1203
|
+
// src/lib/runtime/copilot-runtime.ts
|
|
1191
1204
|
var import_shared = require("@copilotkit/shared");
|
|
1205
|
+
|
|
1206
|
+
// src/graphql/types/converted/index.ts
|
|
1207
|
+
var Message = class extends BaseMessageInput {
|
|
1208
|
+
type;
|
|
1209
|
+
isTextMessage() {
|
|
1210
|
+
return this.type === "TextMessage";
|
|
1211
|
+
}
|
|
1212
|
+
isActionExecutionMessage() {
|
|
1213
|
+
return this.type === "ActionExecutionMessage";
|
|
1214
|
+
}
|
|
1215
|
+
isResultMessage() {
|
|
1216
|
+
return this.type === "ResultMessage";
|
|
1217
|
+
}
|
|
1218
|
+
isAgentStateMessage() {
|
|
1219
|
+
return this.type === "AgentStateMessage";
|
|
1220
|
+
}
|
|
1221
|
+
};
|
|
1222
|
+
__name(Message, "Message");
|
|
1223
|
+
var TextMessage = class extends Message {
|
|
1224
|
+
type = "TextMessage";
|
|
1225
|
+
content;
|
|
1226
|
+
role;
|
|
1227
|
+
};
|
|
1228
|
+
__name(TextMessage, "TextMessage");
|
|
1229
|
+
var ActionExecutionMessage = class extends Message {
|
|
1230
|
+
type = "ActionExecutionMessage";
|
|
1231
|
+
name;
|
|
1232
|
+
arguments;
|
|
1233
|
+
scope;
|
|
1234
|
+
};
|
|
1235
|
+
__name(ActionExecutionMessage, "ActionExecutionMessage");
|
|
1236
|
+
var ResultMessage = class extends Message {
|
|
1237
|
+
type = "ResultMessage";
|
|
1238
|
+
actionExecutionId;
|
|
1239
|
+
actionName;
|
|
1240
|
+
result;
|
|
1241
|
+
};
|
|
1242
|
+
__name(ResultMessage, "ResultMessage");
|
|
1243
|
+
var AgentStateMessage = class extends Message {
|
|
1244
|
+
type = "AgentStateMessage";
|
|
1245
|
+
threadId;
|
|
1246
|
+
agentName;
|
|
1247
|
+
nodeName;
|
|
1248
|
+
runId;
|
|
1249
|
+
active;
|
|
1250
|
+
role;
|
|
1251
|
+
state;
|
|
1252
|
+
running;
|
|
1253
|
+
};
|
|
1254
|
+
__name(AgentStateMessage, "AgentStateMessage");
|
|
1255
|
+
|
|
1256
|
+
// src/lib/runtime/copilot-runtime.ts
|
|
1257
|
+
var import_rxjs = require("rxjs");
|
|
1258
|
+
function resolveEndpointType(endpoint) {
|
|
1259
|
+
if (!endpoint.type) {
|
|
1260
|
+
if ("langsmithApiKey" in endpoint && "deploymentUrl" in endpoint && "agents" in endpoint) {
|
|
1261
|
+
return EndpointType.LangGraphCloud;
|
|
1262
|
+
} else {
|
|
1263
|
+
return EndpointType.CopilotKit;
|
|
1264
|
+
}
|
|
1265
|
+
}
|
|
1266
|
+
return endpoint.type;
|
|
1267
|
+
}
|
|
1268
|
+
__name(resolveEndpointType, "resolveEndpointType");
|
|
1269
|
+
|
|
1270
|
+
// src/lib/telemetry-client.ts
|
|
1192
1271
|
var packageJson = require_package();
|
|
1193
|
-
var telemetryClient = new
|
|
1272
|
+
var telemetryClient = new import_shared2.TelemetryClient({
|
|
1194
1273
|
packageName: packageJson.name,
|
|
1195
1274
|
packageVersion: packageJson.version
|
|
1196
1275
|
});
|
|
1276
|
+
function getRuntimeInstanceTelemetryInfo(runtime) {
|
|
1277
|
+
const endpointsInfo = runtime.remoteEndpointDefinitions.reduce((acc, endpoint) => {
|
|
1278
|
+
let info = {
|
|
1279
|
+
...acc
|
|
1280
|
+
};
|
|
1281
|
+
const endpointType = resolveEndpointType(endpoint);
|
|
1282
|
+
if (!info.endpointTypes.includes(endpointType)) {
|
|
1283
|
+
info = {
|
|
1284
|
+
...info,
|
|
1285
|
+
endpointTypes: [
|
|
1286
|
+
...info.endpointTypes,
|
|
1287
|
+
endpointType
|
|
1288
|
+
]
|
|
1289
|
+
};
|
|
1290
|
+
}
|
|
1291
|
+
if (endpointType === EndpointType.LangGraphCloud) {
|
|
1292
|
+
const ep = endpoint;
|
|
1293
|
+
info = {
|
|
1294
|
+
...info,
|
|
1295
|
+
agentsAmount: ep.agents.length,
|
|
1296
|
+
hashedKey: (0, import_node_crypto.createHash)("sha256").update(ep.langsmithApiKey).digest("hex")
|
|
1297
|
+
};
|
|
1298
|
+
}
|
|
1299
|
+
return info;
|
|
1300
|
+
}, {
|
|
1301
|
+
endpointTypes: [],
|
|
1302
|
+
agentsAmount: null,
|
|
1303
|
+
hashedKey: null
|
|
1304
|
+
});
|
|
1305
|
+
return {
|
|
1306
|
+
actionsAmount: runtime.actions.length,
|
|
1307
|
+
endpointsAmount: runtime.remoteEndpointDefinitions.length,
|
|
1308
|
+
endpointTypes: endpointsInfo.endpointTypes,
|
|
1309
|
+
agentsAmount: endpointsInfo.agentsAmount,
|
|
1310
|
+
hashedLgcKey: endpointsInfo.hashedKey
|
|
1311
|
+
};
|
|
1312
|
+
}
|
|
1313
|
+
__name(getRuntimeInstanceTelemetryInfo, "getRuntimeInstanceTelemetryInfo");
|
|
1197
1314
|
var telemetry_client_default = telemetryClient;
|
|
1198
1315
|
|
|
1199
1316
|
// src/service-adapters/events.ts
|
|
@@ -1247,58 +1364,8 @@ var UnknownErrorResponse = class extends FailedResponseStatus {
|
|
|
1247
1364
|
};
|
|
1248
1365
|
__name(UnknownErrorResponse, "UnknownErrorResponse");
|
|
1249
1366
|
|
|
1250
|
-
// src/graphql/types/converted/index.ts
|
|
1251
|
-
var Message = class extends BaseMessageInput {
|
|
1252
|
-
type;
|
|
1253
|
-
isTextMessage() {
|
|
1254
|
-
return this.type === "TextMessage";
|
|
1255
|
-
}
|
|
1256
|
-
isActionExecutionMessage() {
|
|
1257
|
-
return this.type === "ActionExecutionMessage";
|
|
1258
|
-
}
|
|
1259
|
-
isResultMessage() {
|
|
1260
|
-
return this.type === "ResultMessage";
|
|
1261
|
-
}
|
|
1262
|
-
isAgentStateMessage() {
|
|
1263
|
-
return this.type === "AgentStateMessage";
|
|
1264
|
-
}
|
|
1265
|
-
};
|
|
1266
|
-
__name(Message, "Message");
|
|
1267
|
-
var TextMessage = class extends Message {
|
|
1268
|
-
type = "TextMessage";
|
|
1269
|
-
content;
|
|
1270
|
-
role;
|
|
1271
|
-
};
|
|
1272
|
-
__name(TextMessage, "TextMessage");
|
|
1273
|
-
var ActionExecutionMessage = class extends Message {
|
|
1274
|
-
type = "ActionExecutionMessage";
|
|
1275
|
-
name;
|
|
1276
|
-
arguments;
|
|
1277
|
-
scope;
|
|
1278
|
-
};
|
|
1279
|
-
__name(ActionExecutionMessage, "ActionExecutionMessage");
|
|
1280
|
-
var ResultMessage = class extends Message {
|
|
1281
|
-
type = "ResultMessage";
|
|
1282
|
-
actionExecutionId;
|
|
1283
|
-
actionName;
|
|
1284
|
-
result;
|
|
1285
|
-
};
|
|
1286
|
-
__name(ResultMessage, "ResultMessage");
|
|
1287
|
-
var AgentStateMessage = class extends Message {
|
|
1288
|
-
type = "AgentStateMessage";
|
|
1289
|
-
threadId;
|
|
1290
|
-
agentName;
|
|
1291
|
-
nodeName;
|
|
1292
|
-
runId;
|
|
1293
|
-
active;
|
|
1294
|
-
role;
|
|
1295
|
-
state;
|
|
1296
|
-
running;
|
|
1297
|
-
};
|
|
1298
|
-
__name(AgentStateMessage, "AgentStateMessage");
|
|
1299
|
-
|
|
1300
1367
|
// src/graphql/resolvers/copilot.resolver.ts
|
|
1301
|
-
var
|
|
1368
|
+
var import_shared3 = require("@copilotkit/shared");
|
|
1302
1369
|
function _ts_decorate14(decorators, target, key, desc) {
|
|
1303
1370
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1304
1371
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
@@ -1404,9 +1471,9 @@ var CopilotResolver = class {
|
|
|
1404
1471
|
});
|
|
1405
1472
|
}
|
|
1406
1473
|
logger2.debug("Setting up subjects");
|
|
1407
|
-
const responseStatus$ = new
|
|
1408
|
-
const interruptStreaming$ = new
|
|
1409
|
-
const guardrailsResult$ = new
|
|
1474
|
+
const responseStatus$ = new import_rxjs3.ReplaySubject();
|
|
1475
|
+
const interruptStreaming$ = new import_rxjs3.ReplaySubject();
|
|
1476
|
+
const guardrailsResult$ = new import_rxjs3.ReplaySubject();
|
|
1410
1477
|
let outputMessages = [];
|
|
1411
1478
|
let resolveOutputMessagesPromise;
|
|
1412
1479
|
let rejectOutputMessagesPromise;
|
|
@@ -1415,7 +1482,7 @@ var CopilotResolver = class {
|
|
|
1415
1482
|
rejectOutputMessagesPromise = reject;
|
|
1416
1483
|
});
|
|
1417
1484
|
logger2.debug("Processing");
|
|
1418
|
-
const { eventSource, threadId = (0,
|
|
1485
|
+
const { eventSource, threadId = (0, import_shared3.randomId)(), runId, serverSideActions, actionInputsWithoutAgents } = await copilotRuntime.processRuntimeRequest({
|
|
1419
1486
|
serviceAdapter,
|
|
1420
1487
|
messages: data.messages,
|
|
1421
1488
|
actions: data.frontend.actions,
|
|
@@ -1433,7 +1500,7 @@ var CopilotResolver = class {
|
|
|
1433
1500
|
const response = {
|
|
1434
1501
|
threadId,
|
|
1435
1502
|
runId,
|
|
1436
|
-
status: (0,
|
|
1503
|
+
status: (0, import_rxjs3.firstValueFrom)(responseStatus$),
|
|
1437
1504
|
messages: new import_graphql_yoga.Repeater(async (pushMessage, stopStreamingMessages) => {
|
|
1438
1505
|
var _a2, _b2;
|
|
1439
1506
|
logger2.debug("Messages repeater created");
|
|
@@ -1460,7 +1527,7 @@ var CopilotResolver = class {
|
|
|
1460
1527
|
});
|
|
1461
1528
|
outputMessages = [
|
|
1462
1529
|
(0, import_class_transformer.plainToInstance)(TextMessage, {
|
|
1463
|
-
id: (0,
|
|
1530
|
+
id: (0, import_shared3.randomId)(),
|
|
1464
1531
|
createdAt: /* @__PURE__ */ new Date(),
|
|
1465
1532
|
content: result.reason,
|
|
1466
1533
|
role: MessageRole.assistant
|
|
@@ -1494,8 +1561,8 @@ var CopilotResolver = class {
|
|
|
1494
1561
|
}).pipe(
|
|
1495
1562
|
// shareReplay() ensures that later subscribers will see the whole stream instead of
|
|
1496
1563
|
// just the events that were emitted after the subscriber was added.
|
|
1497
|
-
(0,
|
|
1498
|
-
(0,
|
|
1564
|
+
(0, import_rxjs3.shareReplay)(),
|
|
1565
|
+
(0, import_rxjs3.finalize)(() => {
|
|
1499
1566
|
logger2.debug("Event stream finalized");
|
|
1500
1567
|
})
|
|
1501
1568
|
);
|
|
@@ -1506,22 +1573,22 @@ var CopilotResolver = class {
|
|
|
1506
1573
|
case RuntimeEventTypes.TextMessageStart:
|
|
1507
1574
|
const textMessageContentStream = eventStream.pipe(
|
|
1508
1575
|
// skip until this message start event
|
|
1509
|
-
(0,
|
|
1576
|
+
(0, import_rxjs3.skipWhile)((e) => e !== event),
|
|
1510
1577
|
// take until the message end event
|
|
1511
|
-
(0,
|
|
1578
|
+
(0, import_rxjs3.takeWhile)((e) => e.type != RuntimeEventTypes.TextMessageEnd)
|
|
1512
1579
|
);
|
|
1513
|
-
const streamingTextStatus = new
|
|
1580
|
+
const streamingTextStatus = new import_rxjs3.Subject();
|
|
1514
1581
|
const messageId = event.messageId;
|
|
1515
1582
|
pushMessage({
|
|
1516
1583
|
id: messageId,
|
|
1517
|
-
status: (0,
|
|
1584
|
+
status: (0, import_rxjs3.firstValueFrom)(streamingTextStatus),
|
|
1518
1585
|
createdAt: /* @__PURE__ */ new Date(),
|
|
1519
1586
|
role: MessageRole.assistant,
|
|
1520
1587
|
content: new import_graphql_yoga.Repeater(async (pushTextChunk, stopStreamingText) => {
|
|
1521
1588
|
logger2.debug("Text message content repeater created");
|
|
1522
1589
|
const textChunks = [];
|
|
1523
1590
|
let textSubscription;
|
|
1524
|
-
interruptStreaming$.pipe((0,
|
|
1591
|
+
interruptStreaming$.pipe((0, import_rxjs3.shareReplay)(), (0, import_rxjs3.take)(1), (0, import_rxjs3.tap)(({ reason, messageId: messageId2 }) => {
|
|
1525
1592
|
logger2.debug({
|
|
1526
1593
|
reason,
|
|
1527
1594
|
messageId: messageId2
|
|
@@ -1572,11 +1639,11 @@ var CopilotResolver = class {
|
|
|
1572
1639
|
break;
|
|
1573
1640
|
case RuntimeEventTypes.ActionExecutionStart:
|
|
1574
1641
|
logger2.debug("Action execution start event received");
|
|
1575
|
-
const actionExecutionArgumentStream = eventStream.pipe((0,
|
|
1576
|
-
const streamingArgumentsStatus = new
|
|
1642
|
+
const actionExecutionArgumentStream = eventStream.pipe((0, import_rxjs3.skipWhile)((e) => e !== event), (0, import_rxjs3.takeWhile)((e) => e.type != RuntimeEventTypes.ActionExecutionEnd));
|
|
1643
|
+
const streamingArgumentsStatus = new import_rxjs3.Subject();
|
|
1577
1644
|
pushMessage({
|
|
1578
1645
|
id: event.actionExecutionId,
|
|
1579
|
-
status: (0,
|
|
1646
|
+
status: (0, import_rxjs3.firstValueFrom)(streamingArgumentsStatus),
|
|
1580
1647
|
createdAt: /* @__PURE__ */ new Date(),
|
|
1581
1648
|
name: event.actionName,
|
|
1582
1649
|
scope: event.scope,
|
|
@@ -1623,7 +1690,7 @@ var CopilotResolver = class {
|
|
|
1623
1690
|
result: event.result
|
|
1624
1691
|
}, "Action execution result event received");
|
|
1625
1692
|
pushMessage({
|
|
1626
|
-
id: (0,
|
|
1693
|
+
id: (0, import_shared3.randomId)(),
|
|
1627
1694
|
status: new SuccessMessageStatus(),
|
|
1628
1695
|
createdAt: /* @__PURE__ */ new Date(),
|
|
1629
1696
|
actionExecutionId: event.actionExecutionId,
|
|
@@ -1631,7 +1698,7 @@ var CopilotResolver = class {
|
|
|
1631
1698
|
result: event.result
|
|
1632
1699
|
});
|
|
1633
1700
|
outputMessages.push((0, import_class_transformer.plainToInstance)(ResultMessage, {
|
|
1634
|
-
id: (0,
|
|
1701
|
+
id: (0, import_shared3.randomId)(),
|
|
1635
1702
|
createdAt: /* @__PURE__ */ new Date(),
|
|
1636
1703
|
actionExecutionId: event.actionExecutionId,
|
|
1637
1704
|
actionName: event.actionName,
|
|
@@ -1643,7 +1710,7 @@ var CopilotResolver = class {
|
|
|
1643
1710
|
event
|
|
1644
1711
|
}, "Agent message event received");
|
|
1645
1712
|
pushMessage({
|
|
1646
|
-
id: (0,
|
|
1713
|
+
id: (0, import_shared3.randomId)(),
|
|
1647
1714
|
status: new SuccessMessageStatus(),
|
|
1648
1715
|
threadId: event.threadId,
|
|
1649
1716
|
agentName: event.agentName,
|
|
@@ -1656,7 +1723,7 @@ var CopilotResolver = class {
|
|
|
1656
1723
|
createdAt: /* @__PURE__ */ new Date()
|
|
1657
1724
|
});
|
|
1658
1725
|
outputMessages.push((0, import_class_transformer.plainToInstance)(AgentStateMessage, {
|
|
1659
|
-
id: (0,
|
|
1726
|
+
id: (0, import_shared3.randomId)(),
|
|
1660
1727
|
threadId: event.threadId,
|
|
1661
1728
|
agentName: event.agentName,
|
|
1662
1729
|
nodeName: event.nodeName,
|
|
@@ -1686,7 +1753,7 @@ var CopilotResolver = class {
|
|
|
1686
1753
|
logger2.debug("Event stream completed");
|
|
1687
1754
|
if ((_a3 = data.cloud) == null ? void 0 : _a3.guardrails) {
|
|
1688
1755
|
logger2.debug("Guardrails is enabled, waiting for guardrails result");
|
|
1689
|
-
await (0,
|
|
1756
|
+
await (0, import_rxjs3.firstValueFrom)(guardrailsResult$);
|
|
1690
1757
|
}
|
|
1691
1758
|
responseStatus$.next(new SuccessResponseStatus());
|
|
1692
1759
|
eventStreamSubscription == null ? void 0 : eventStreamSubscription.unsubscribe();
|
|
@@ -1844,7 +1911,7 @@ function copilotRuntimeNextJSAppRouterEndpoint(options) {
|
|
|
1844
1911
|
_copilotkit: options.properties._copilotkit
|
|
1845
1912
|
});
|
|
1846
1913
|
}
|
|
1847
|
-
telemetry_client_default.capture("oss.runtime.instance_created",
|
|
1914
|
+
telemetry_client_default.capture("oss.runtime.instance_created", getRuntimeInstanceTelemetryInfo(options.runtime));
|
|
1848
1915
|
const logger2 = commonConfig.logging;
|
|
1849
1916
|
logger2.debug("Creating NextJS App Router endpoint");
|
|
1850
1917
|
const yoga = (0, import_graphql_yoga2.createYoga)({
|
|
@@ -1883,7 +1950,7 @@ function copilotRuntimeNextJSPagesRouterEndpoint(options) {
|
|
|
1883
1950
|
_copilotkit: options.properties._copilotkit
|
|
1884
1951
|
});
|
|
1885
1952
|
}
|
|
1886
|
-
telemetry_client_default.capture("oss.runtime.instance_created",
|
|
1953
|
+
telemetry_client_default.capture("oss.runtime.instance_created", getRuntimeInstanceTelemetryInfo(options.runtime));
|
|
1887
1954
|
const logger2 = commonConfig.logging;
|
|
1888
1955
|
logger2.debug("Creating NextJS Pages Router endpoint");
|
|
1889
1956
|
const yoga = (0, import_graphql_yoga3.createYoga)({
|
|
@@ -1909,7 +1976,7 @@ function copilotRuntimeNodeHttpEndpoint(options) {
|
|
|
1909
1976
|
_copilotkit: options.properties._copilotkit
|
|
1910
1977
|
});
|
|
1911
1978
|
}
|
|
1912
|
-
telemetry_client_default.capture("oss.runtime.instance_created",
|
|
1979
|
+
telemetry_client_default.capture("oss.runtime.instance_created", getRuntimeInstanceTelemetryInfo(options.runtime));
|
|
1913
1980
|
const logger2 = commonConfig.logging;
|
|
1914
1981
|
logger2.debug("Creating Node HTTP endpoint");
|
|
1915
1982
|
const yoga = (0, import_graphql_yoga4.createYoga)({
|
|
@@ -1927,7 +1994,7 @@ function copilotRuntimeNodeExpressEndpoint(options) {
|
|
|
1927
1994
|
framework: "node-express"
|
|
1928
1995
|
}
|
|
1929
1996
|
});
|
|
1930
|
-
telemetry_client_default.capture("oss.runtime.instance_created",
|
|
1997
|
+
telemetry_client_default.capture("oss.runtime.instance_created", getRuntimeInstanceTelemetryInfo(options.runtime));
|
|
1931
1998
|
return copilotRuntimeNodeHttpEndpoint(options);
|
|
1932
1999
|
}
|
|
1933
2000
|
__name(copilotRuntimeNodeExpressEndpoint, "copilotRuntimeNodeExpressEndpoint");
|
|
@@ -1939,7 +2006,7 @@ function copilotRuntimeNestEndpoint(options) {
|
|
|
1939
2006
|
framework: "nest"
|
|
1940
2007
|
}
|
|
1941
2008
|
});
|
|
1942
|
-
telemetry_client_default.capture("oss.runtime.instance_created",
|
|
2009
|
+
telemetry_client_default.capture("oss.runtime.instance_created", getRuntimeInstanceTelemetryInfo(options.runtime));
|
|
1943
2010
|
return copilotRuntimeNodeHttpEndpoint(options);
|
|
1944
2011
|
}
|
|
1945
2012
|
__name(copilotRuntimeNestEndpoint, "copilotRuntimeNestEndpoint");
|