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