@copilotkit/runtime 1.50.0-beta.10 → 1.50.0-beta.11
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 +11 -0
- package/dist/index.js +25 -10
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +26 -11
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/lib/runtime/copilot-runtime.ts +38 -4
package/CHANGELOG.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -72,7 +72,7 @@ var require_package = __commonJS({
|
|
|
72
72
|
publishConfig: {
|
|
73
73
|
access: "public"
|
|
74
74
|
},
|
|
75
|
-
version: "1.50.0-beta.
|
|
75
|
+
version: "1.50.0-beta.10",
|
|
76
76
|
sideEffects: false,
|
|
77
77
|
main: "./dist/index.js",
|
|
78
78
|
module: "./dist/index.mjs",
|
|
@@ -3469,14 +3469,16 @@ var CopilotRuntime = class {
|
|
|
3469
3469
|
constructor(params) {
|
|
3470
3470
|
const agents = (params == null ? void 0 : params.agents) ?? {};
|
|
3471
3471
|
const endpointAgents = this.assignEndpointsToAgents((params == null ? void 0 : params.remoteEndpoints) ?? []);
|
|
3472
|
+
const baseRunner = (params == null ? void 0 : params.runner) ?? new runtime.InMemoryAgentRunner();
|
|
3473
|
+
const runner = shared.isTelemetryDisabled() ? baseRunner : new TelemetryAgentRunner({
|
|
3474
|
+
runner: baseRunner
|
|
3475
|
+
});
|
|
3472
3476
|
this.runtimeArgs = {
|
|
3473
3477
|
agents: {
|
|
3474
3478
|
...endpointAgents,
|
|
3475
3479
|
...agents
|
|
3476
3480
|
},
|
|
3477
|
-
|
|
3478
|
-
// Users can pass their own runner which will be wrapped for telemetry
|
|
3479
|
-
runner: (params == null ? void 0 : params.runner) ?? new TelemetryAgentRunner(),
|
|
3481
|
+
runner,
|
|
3480
3482
|
// TODO: add support for transcriptionService from CopilotRuntimeOptionsVNext once it is ready
|
|
3481
3483
|
// transcriptionService: params?.transcriptionService,
|
|
3482
3484
|
beforeRequestMiddleware: this.createOnBeforeRequestHandler(params).bind(this),
|
|
@@ -3569,11 +3571,24 @@ var CopilotRuntime = class {
|
|
|
3569
3571
|
}
|
|
3570
3572
|
createOnBeforeRequestHandler(params) {
|
|
3571
3573
|
return async (hookParams) => {
|
|
3572
|
-
var _a, _b;
|
|
3573
|
-
|
|
3574
|
-
|
|
3575
|
-
|
|
3576
|
-
|
|
3574
|
+
var _a, _b, _c, _d;
|
|
3575
|
+
const { request } = hookParams;
|
|
3576
|
+
const publicApiKey = request.headers.get("x-copilotcloud-public-api-key");
|
|
3577
|
+
const body = await shared.readBody(request);
|
|
3578
|
+
const forwardedProps = body.forwardedProps;
|
|
3579
|
+
const cloudBaseUrl = process.env.COPILOT_CLOUD_BASE_URL || "https://api.cloud.copilotkit.ai";
|
|
3580
|
+
telemetry_client_default.capture("oss.runtime.copilot_request_created", {
|
|
3581
|
+
"cloud.guardrails.enabled": ((_a = forwardedProps == null ? void 0 : forwardedProps.cloud) == null ? void 0 : _a.guardrails) !== void 0,
|
|
3582
|
+
requestType: ((_b = forwardedProps == null ? void 0 : forwardedProps.metadata) == null ? void 0 : _b.requestType) ?? "unknown",
|
|
3583
|
+
"cloud.api_key_provided": !!publicApiKey,
|
|
3584
|
+
...publicApiKey ? {
|
|
3585
|
+
"cloud.public_api_key": publicApiKey
|
|
3586
|
+
} : {},
|
|
3587
|
+
"cloud.base_url": cloudBaseUrl
|
|
3588
|
+
});
|
|
3589
|
+
(_c = params == null ? void 0 : params.beforeRequestMiddleware) == null ? void 0 : _c.call(params, hookParams);
|
|
3590
|
+
if ((_d = params == null ? void 0 : params.middleware) == null ? void 0 : _d.onBeforeRequest) {
|
|
3591
|
+
const { request: request2, runtime, path } = hookParams;
|
|
3577
3592
|
const gqlMessages = aguiToGQL(body.messages).reduce((acc, msg) => {
|
|
3578
3593
|
if ("role" in msg && msg.role === "user") {
|
|
3579
3594
|
acc.inputMessages.push(msg);
|
|
@@ -3591,7 +3606,7 @@ var CopilotRuntime = class {
|
|
|
3591
3606
|
runId: body.runId,
|
|
3592
3607
|
inputMessages,
|
|
3593
3608
|
properties: body.forwardedProps,
|
|
3594
|
-
url:
|
|
3609
|
+
url: request2.url
|
|
3595
3610
|
});
|
|
3596
3611
|
}
|
|
3597
3612
|
};
|