@copilotkit/runtime 1.9.0-next.2 → 1.9.1-next.0

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.
Files changed (41) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/dist/{chunk-XB3TW5NJ.mjs → chunk-32OC2CBT.mjs} +2 -2
  3. package/dist/{chunk-S5TNKSNR.mjs → chunk-5CY2MEHT.mjs} +3 -3
  4. package/dist/chunk-5CY2MEHT.mjs.map +1 -0
  5. package/dist/{chunk-G4NOAQUA.mjs → chunk-MKAQQQ7D.mjs} +4 -4
  6. package/dist/chunk-MKAQQQ7D.mjs.map +1 -0
  7. package/dist/{chunk-XPTVSVNM.mjs → chunk-T3HIFVU2.mjs} +3 -3
  8. package/dist/chunk-T3HIFVU2.mjs.map +1 -0
  9. package/dist/{chunk-6A27R7IP.mjs → chunk-YVZCIKZM.mjs} +26 -6
  10. package/dist/chunk-YVZCIKZM.mjs.map +1 -0
  11. package/dist/index.js +29 -9
  12. package/dist/index.js.map +1 -1
  13. package/dist/index.mjs +5 -5
  14. package/dist/lib/index.js +29 -9
  15. package/dist/lib/index.js.map +1 -1
  16. package/dist/lib/index.mjs +5 -5
  17. package/dist/lib/integrations/index.js +29 -9
  18. package/dist/lib/integrations/index.js.map +1 -1
  19. package/dist/lib/integrations/index.mjs +4 -4
  20. package/dist/lib/integrations/nest/index.js +26 -6
  21. package/dist/lib/integrations/nest/index.js.map +1 -1
  22. package/dist/lib/integrations/nest/index.mjs +2 -2
  23. package/dist/lib/integrations/node-express/index.js +26 -6
  24. package/dist/lib/integrations/node-express/index.js.map +1 -1
  25. package/dist/lib/integrations/node-express/index.mjs +2 -2
  26. package/dist/lib/integrations/node-http/index.js +25 -5
  27. package/dist/lib/integrations/node-http/index.js.map +1 -1
  28. package/dist/lib/integrations/node-http/index.mjs +1 -1
  29. package/package.json +2 -2
  30. package/src/graphql/resolvers/copilot.resolver.ts +13 -0
  31. package/src/lib/integrations/nest/index.ts +1 -4
  32. package/src/lib/integrations/nextjs/app-router.ts +1 -4
  33. package/src/lib/integrations/nextjs/pages-router.ts +1 -4
  34. package/src/lib/integrations/node-express/index.ts +1 -4
  35. package/src/lib/integrations/node-http/index.ts +1 -4
  36. package/src/lib/telemetry-client.ts +11 -2
  37. package/dist/chunk-6A27R7IP.mjs.map +0 -1
  38. package/dist/chunk-G4NOAQUA.mjs.map +0 -1
  39. package/dist/chunk-S5TNKSNR.mjs.map +0 -1
  40. package/dist/chunk-XPTVSVNM.mjs.map +0 -1
  41. /package/dist/{chunk-XB3TW5NJ.mjs.map → chunk-32OC2CBT.mjs.map} +0 -0
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  copilotRuntimeNodeHttpEndpoint
3
- } from "../../../chunk-6A27R7IP.mjs";
3
+ } from "../../../chunk-YVZCIKZM.mjs";
4
4
  import "../../../chunk-IIXJVVTV.mjs";
5
5
  import "../../../chunk-5BIEM2UU.mjs";
6
6
  import "../../../chunk-SHBDMA63.mjs";
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "publishConfig": {
10
10
  "access": "public"
11
11
  },
12
- "version": "1.9.0-next.2",
12
+ "version": "1.9.1-next.0",
13
13
  "sideEffects": false,
14
14
  "main": "./dist/index.js",
15
15
  "module": "./dist/index.mjs",
@@ -66,7 +66,7 @@
66
66
  "rxjs": "^7.8.1",
67
67
  "type-graphql": "2.0.0-rc.1",
68
68
  "zod": "^3.23.3",
69
- "@copilotkit/shared": "1.9.0-next.2"
69
+ "@copilotkit/shared": "1.9.1-next.0"
70
70
  },
71
71
  "peerDependencies": {
72
72
  "@ag-ui/client": ">=0.0.28",
@@ -144,6 +144,19 @@ export class CopilotResolver {
144
144
  telemetry.capture("oss.runtime.copilot_request_created", {
145
145
  "cloud.guardrails.enabled": data.cloud?.guardrails !== undefined,
146
146
  requestType: data.metadata.requestType,
147
+ "cloud.api_key_provided": !!ctx.request.headers.get("x-copilotcloud-public-api-key"),
148
+ ...(ctx.request.headers.get("x-copilotcloud-public-api-key")
149
+ ? {
150
+ "cloud.public_api_key": ctx.request.headers.get("x-copilotcloud-public-api-key"),
151
+ }
152
+ : {}),
153
+ ...(ctx._copilotkit.baseUrl
154
+ ? {
155
+ "cloud.base_url": ctx._copilotkit.baseUrl,
156
+ }
157
+ : {
158
+ "cloud.base_url": "https://api.cloud.copilotkit.ai",
159
+ }),
147
160
  });
148
161
 
149
162
  let logger = ctx.logger.child({ component: "CopilotResolver.generateCopilotResponse" });
@@ -9,9 +9,6 @@ export function copilotRuntimeNestEndpoint(options: CreateCopilotRuntimeServerOp
9
9
  },
10
10
  });
11
11
 
12
- telemetry.capture(
13
- "oss.runtime.instance_created",
14
- getRuntimeInstanceTelemetryInfo(options.runtime),
15
- );
12
+ telemetry.capture("oss.runtime.instance_created", getRuntimeInstanceTelemetryInfo(options));
16
13
  return copilotRuntimeNodeHttpEndpoint(options);
17
14
  }
@@ -17,10 +17,7 @@ export function copilotRuntimeNextJSAppRouterEndpoint(options: CreateCopilotRunt
17
17
  });
18
18
  }
19
19
 
20
- telemetry.capture(
21
- "oss.runtime.instance_created",
22
- getRuntimeInstanceTelemetryInfo(options.runtime),
23
- );
20
+ telemetry.capture("oss.runtime.instance_created", getRuntimeInstanceTelemetryInfo(options));
24
21
 
25
22
  const logger = commonConfig.logging;
26
23
  logger.debug("Creating NextJS App Router endpoint");
@@ -32,10 +32,7 @@ export function copilotRuntimeNextJSPagesRouterEndpoint(
32
32
  });
33
33
  }
34
34
 
35
- telemetry.capture(
36
- "oss.runtime.instance_created",
37
- getRuntimeInstanceTelemetryInfo(options.runtime),
38
- );
35
+ telemetry.capture("oss.runtime.instance_created", getRuntimeInstanceTelemetryInfo(options));
39
36
 
40
37
  const logger = commonConfig.logging;
41
38
  logger.debug("Creating NextJS Pages Router endpoint");
@@ -9,9 +9,6 @@ export function copilotRuntimeNodeExpressEndpoint(options: CreateCopilotRuntimeS
9
9
  },
10
10
  });
11
11
 
12
- telemetry.capture(
13
- "oss.runtime.instance_created",
14
- getRuntimeInstanceTelemetryInfo(options.runtime),
15
- );
12
+ telemetry.capture("oss.runtime.instance_created", getRuntimeInstanceTelemetryInfo(options));
16
13
  return copilotRuntimeNodeHttpEndpoint(options);
17
14
  }
@@ -17,10 +17,7 @@ export function copilotRuntimeNodeHttpEndpoint(options: CreateCopilotRuntimeServ
17
17
  });
18
18
  }
19
19
 
20
- telemetry.capture(
21
- "oss.runtime.instance_created",
22
- getRuntimeInstanceTelemetryInfo(options.runtime),
23
- );
20
+ telemetry.capture("oss.runtime.instance_created", getRuntimeInstanceTelemetryInfo(options));
24
21
 
25
22
  const logger = commonConfig.logging;
26
23
  logger.debug("Creating Node HTTP endpoint");
@@ -3,6 +3,7 @@ import { EndpointType, LangGraphPlatformEndpoint } from "./runtime/remote-action
3
3
  import { createHash } from "node:crypto";
4
4
  import { CopilotRuntime, resolveEndpointType } from "./runtime/copilot-runtime";
5
5
  import { RuntimeInstanceCreatedInfo } from "@copilotkit/shared/src/telemetry/events";
6
+ import { CreateCopilotRuntimeServerOptions } from "./integrations/shared";
6
7
  const packageJson = require("../../package.json");
7
8
 
8
9
  const telemetryClient = new TelemetryClient({
@@ -11,8 +12,9 @@ const telemetryClient = new TelemetryClient({
11
12
  });
12
13
 
13
14
  export function getRuntimeInstanceTelemetryInfo(
14
- runtime: CopilotRuntime,
15
+ options: CreateCopilotRuntimeServerOptions,
15
16
  ): RuntimeInstanceCreatedInfo {
17
+ const runtime = options.runtime;
16
18
  const endpointsInfo = runtime.remoteEndpointDefinitions.reduce(
17
19
  (acc, endpoint) => {
18
20
  let info = { ...acc };
@@ -42,13 +44,20 @@ export function getRuntimeInstanceTelemetryInfo(
42
44
  { endpointTypes: [], agentsAmount: null, hashedKey: null },
43
45
  );
44
46
 
47
+ // Get public API key from options.cloud.publicApiKey
48
+ const publicApiKey = options.cloud?.publicApiKey;
49
+ const apiKeyProvided = !!publicApiKey && publicApiKey.trim().length > 0;
50
+
45
51
  return {
46
52
  actionsAmount: runtime.actions.length,
47
53
  endpointsAmount: runtime.remoteEndpointDefinitions.length,
48
54
  endpointTypes: endpointsInfo.endpointTypes,
49
55
  agentsAmount: endpointsInfo.agentsAmount,
50
56
  hashedLgcKey: endpointsInfo.hashedKey,
51
- };
57
+ "cloud.api_key_provided": apiKeyProvided,
58
+ ...(apiKeyProvided ? { "cloud.public_api_key": publicApiKey } : {}),
59
+ ...(options.cloud?.baseUrl ? { "cloud.base_url": options.cloud.baseUrl } : {}),
60
+ } as RuntimeInstanceCreatedInfo;
52
61
  }
53
62
 
54
63
  export default telemetryClient;