@copilotkit/runtime 1.9.2-next.2 → 1.9.2-next.4
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 +17 -0
- package/dist/{chunk-ODF35LFG.mjs → chunk-5FNEYAWH.mjs} +2 -2
- package/dist/{chunk-CD2SZGIZ.mjs → chunk-6W7TKZNY.mjs} +2 -2
- package/dist/{chunk-6TQCQ3WJ.mjs → chunk-CJ44W4R2.mjs} +2 -2
- package/dist/{chunk-D3SPXEVJ.mjs → chunk-NK2XARWT.mjs} +2 -2
- package/dist/{chunk-DOWRU5U6.mjs → chunk-ZUF3A5TW.mjs} +197 -16
- package/dist/chunk-ZUF3A5TW.mjs.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +196 -15
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +5 -5
- package/dist/lib/index.d.ts +1 -1
- package/dist/lib/index.js +196 -15
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/index.mjs +5 -5
- package/dist/lib/integrations/index.d.ts +2 -2
- package/dist/lib/integrations/index.js +19 -10
- package/dist/lib/integrations/index.js.map +1 -1
- package/dist/lib/integrations/index.mjs +4 -4
- package/dist/lib/integrations/nest/index.d.ts +1 -1
- package/dist/lib/integrations/nest/index.js +19 -10
- package/dist/lib/integrations/nest/index.js.map +1 -1
- package/dist/lib/integrations/nest/index.mjs +2 -2
- package/dist/lib/integrations/node-express/index.d.ts +1 -1
- package/dist/lib/integrations/node-express/index.js +19 -10
- package/dist/lib/integrations/node-express/index.js.map +1 -1
- package/dist/lib/integrations/node-express/index.mjs +2 -2
- package/dist/lib/integrations/node-http/index.d.ts +1 -1
- package/dist/lib/integrations/node-http/index.js +19 -10
- package/dist/lib/integrations/node-http/index.js.map +1 -1
- package/dist/lib/integrations/node-http/index.mjs +1 -1
- package/dist/{shared-e272b15a.d.ts → shared-ba062831.d.ts} +35 -1
- package/package.json +2 -2
- package/src/graphql/resolvers/copilot.resolver.ts +24 -5
- package/src/lib/runtime/__tests__/copilot-runtime-trace.test.ts +169 -0
- package/src/lib/runtime/copilot-runtime.ts +254 -6
- package/dist/chunk-DOWRU5U6.mjs.map +0 -1
- /package/dist/{chunk-ODF35LFG.mjs.map → chunk-5FNEYAWH.mjs.map} +0 -0
- /package/dist/{chunk-CD2SZGIZ.mjs.map → chunk-6W7TKZNY.mjs.map} +0 -0
- /package/dist/{chunk-6TQCQ3WJ.mjs.map → chunk-CJ44W4R2.mjs.map} +0 -0
- /package/dist/{chunk-D3SPXEVJ.mjs.map → chunk-NK2XARWT.mjs.map} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
copilotRuntimeNodeExpressEndpoint
|
|
3
|
-
} from "../../../chunk-
|
|
4
|
-
import "../../../chunk-
|
|
3
|
+
} from "../../../chunk-6W7TKZNY.mjs";
|
|
4
|
+
import "../../../chunk-ZUF3A5TW.mjs";
|
|
5
5
|
import "../../../chunk-IIXJVVTV.mjs";
|
|
6
6
|
import "../../../chunk-5BIEM2UU.mjs";
|
|
7
7
|
import "../../../chunk-SHBDMA63.mjs";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as graphql_yoga from 'graphql-yoga';
|
|
2
|
-
import { b as CreateCopilotRuntimeServerOptions, G as GraphQLContext } from '../../../shared-
|
|
2
|
+
import { b as CreateCopilotRuntimeServerOptions, G as GraphQLContext } from '../../../shared-ba062831.js';
|
|
3
3
|
import 'graphql';
|
|
4
4
|
import 'pino';
|
|
5
5
|
import '@copilotkit/shared';
|
|
@@ -44,7 +44,7 @@ var require_package = __commonJS({
|
|
|
44
44
|
publishConfig: {
|
|
45
45
|
access: "public"
|
|
46
46
|
},
|
|
47
|
-
version: "1.9.2-next.
|
|
47
|
+
version: "1.9.2-next.4",
|
|
48
48
|
sideEffects: false,
|
|
49
49
|
main: "./dist/index.js",
|
|
50
50
|
module: "./dist/index.mjs",
|
|
@@ -2065,7 +2065,7 @@ var CopilotResolver = class {
|
|
|
2065
2065
|
};
|
|
2066
2066
|
}
|
|
2067
2067
|
async generateCopilotResponse(ctx, data, properties) {
|
|
2068
|
-
var _a, _b, _c, _d;
|
|
2068
|
+
var _a, _b, _c, _d, _e;
|
|
2069
2069
|
telemetry_client_default.capture("oss.runtime.copilot_request_created", {
|
|
2070
2070
|
"cloud.guardrails.enabled": ((_a = data.cloud) == null ? void 0 : _a.guardrails) !== void 0,
|
|
2071
2071
|
requestType: data.metadata.requestType,
|
|
@@ -2096,23 +2096,32 @@ var CopilotResolver = class {
|
|
|
2096
2096
|
const serviceAdapter = ctx._copilotkit.serviceAdapter;
|
|
2097
2097
|
let copilotCloudPublicApiKey = null;
|
|
2098
2098
|
let copilotCloudBaseUrl;
|
|
2099
|
+
const publicApiKeyFromHeaders = ctx.request.headers.get("x-copilotcloud-public-api-key");
|
|
2100
|
+
if (publicApiKeyFromHeaders) {
|
|
2101
|
+
copilotCloudPublicApiKey = publicApiKeyFromHeaders;
|
|
2102
|
+
}
|
|
2099
2103
|
if (data.cloud) {
|
|
2100
2104
|
logger2 = logger2.child({
|
|
2101
2105
|
cloud: true
|
|
2102
2106
|
});
|
|
2103
2107
|
logger2.debug("Cloud configuration provided, checking for public API key in headers");
|
|
2104
|
-
|
|
2105
|
-
if (key) {
|
|
2106
|
-
logger2.debug("Public API key found in headers");
|
|
2107
|
-
copilotCloudPublicApiKey = key;
|
|
2108
|
-
} else {
|
|
2108
|
+
if (!copilotCloudPublicApiKey) {
|
|
2109
2109
|
logger2.error("Public API key not found in headers");
|
|
2110
|
+
await copilotRuntime.traceGraphQLError({
|
|
2111
|
+
message: "X-CopilotCloud-Public-API-Key header is required",
|
|
2112
|
+
code: "MISSING_PUBLIC_API_KEY",
|
|
2113
|
+
type: "GraphQLError"
|
|
2114
|
+
}, {
|
|
2115
|
+
operation: "generateCopilotResponse",
|
|
2116
|
+
cloudConfigPresent: Boolean(data.cloud),
|
|
2117
|
+
guardrailsEnabled: Boolean((_b = data.cloud) == null ? void 0 : _b.guardrails)
|
|
2118
|
+
});
|
|
2110
2119
|
throw new import_graphql.GraphQLError("X-CopilotCloud-Public-API-Key header is required");
|
|
2111
2120
|
}
|
|
2112
2121
|
if (process.env.COPILOT_CLOUD_BASE_URL) {
|
|
2113
2122
|
copilotCloudBaseUrl = process.env.COPILOT_CLOUD_BASE_URL;
|
|
2114
|
-
} else if ((
|
|
2115
|
-
copilotCloudBaseUrl = (
|
|
2123
|
+
} else if ((_c = ctx._copilotkit.cloud) == null ? void 0 : _c.baseUrl) {
|
|
2124
|
+
copilotCloudBaseUrl = (_d = ctx._copilotkit.cloud) == null ? void 0 : _d.baseUrl;
|
|
2116
2125
|
} else {
|
|
2117
2126
|
copilotCloudBaseUrl = "https://api.cloud.copilotkit.ai";
|
|
2118
2127
|
}
|
|
@@ -2154,7 +2163,7 @@ var CopilotResolver = class {
|
|
|
2154
2163
|
logger2.debug("Event source created, creating response");
|
|
2155
2164
|
const eventStream = eventSource.processRuntimeEvents({
|
|
2156
2165
|
serverSideActions,
|
|
2157
|
-
guardrailsResult$: ((
|
|
2166
|
+
guardrailsResult$: ((_e = data.cloud) == null ? void 0 : _e.guardrails) ? guardrailsResult$ : null,
|
|
2158
2167
|
actionInputsWithoutAgents: actionInputsWithoutAgents.filter(
|
|
2159
2168
|
// TODO-AGENTS: do not exclude ALL server side actions
|
|
2160
2169
|
(action) => !serverSideActions.find((serverSideAction) => serverSideAction.name == action.name)
|