@copilotkit/runtime 1.9.2-next.17 → 1.9.2-next.19

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 (50) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/{chunk-CORCJNXR.mjs → chunk-BTV2RM2X.mjs} +2 -2
  3. package/dist/{chunk-H3ML2MWF.mjs → chunk-EEARRKK3.mjs} +28 -28
  4. package/dist/chunk-EEARRKK3.mjs.map +1 -0
  5. package/dist/{chunk-7EDOHCIU.mjs → chunk-OVIDH7IH.mjs} +2 -2
  6. package/dist/{chunk-JTFQ5GIL.mjs → chunk-QLLV2QVK.mjs} +2 -1
  7. package/dist/chunk-QLLV2QVK.mjs.map +1 -0
  8. package/dist/{chunk-WXNKOOVD.mjs → chunk-QPMGUSMZ.mjs} +2 -2
  9. package/dist/{chunk-6QK2NO6W.mjs → chunk-ZNDOT3YP.mjs} +2 -2
  10. package/dist/{groq-adapter-172a2ca4.d.ts → groq-adapter-098f97f6.d.ts} +4 -0
  11. package/dist/index.d.ts +2 -2
  12. package/dist/index.js +27 -26
  13. package/dist/index.js.map +1 -1
  14. package/dist/index.mjs +6 -6
  15. package/dist/lib/index.d.ts +2 -2
  16. package/dist/lib/index.js +27 -26
  17. package/dist/lib/index.js.map +1 -1
  18. package/dist/lib/index.mjs +6 -6
  19. package/dist/lib/integrations/index.d.ts +2 -2
  20. package/dist/lib/integrations/index.js +2 -2
  21. package/dist/lib/integrations/index.js.map +1 -1
  22. package/dist/lib/integrations/index.mjs +5 -5
  23. package/dist/lib/integrations/nest/index.d.ts +1 -1
  24. package/dist/lib/integrations/nest/index.js +2 -2
  25. package/dist/lib/integrations/nest/index.js.map +1 -1
  26. package/dist/lib/integrations/nest/index.mjs +3 -3
  27. package/dist/lib/integrations/node-express/index.d.ts +1 -1
  28. package/dist/lib/integrations/node-express/index.js +2 -2
  29. package/dist/lib/integrations/node-express/index.js.map +1 -1
  30. package/dist/lib/integrations/node-express/index.mjs +3 -3
  31. package/dist/lib/integrations/node-http/index.d.ts +1 -1
  32. package/dist/lib/integrations/node-http/index.js +2 -2
  33. package/dist/lib/integrations/node-http/index.js.map +1 -1
  34. package/dist/lib/integrations/node-http/index.mjs +2 -2
  35. package/dist/service-adapters/index.d.ts +2 -2
  36. package/dist/service-adapters/index.js +1 -0
  37. package/dist/service-adapters/index.js.map +1 -1
  38. package/dist/service-adapters/index.mjs +1 -1
  39. package/dist/{shared-4164c674.d.ts → shared-41d4988d.d.ts} +13 -13
  40. package/package.json +4 -4
  41. package/src/graphql/resolvers/copilot.resolver.ts +1 -2
  42. package/src/lib/runtime/__tests__/{copilot-runtime-trace.test.ts → copilot-runtime-error.test.ts} +27 -27
  43. package/src/lib/runtime/copilot-runtime.ts +41 -42
  44. package/src/service-adapters/google/google-genai-adapter.ts +5 -0
  45. package/dist/chunk-H3ML2MWF.mjs.map +0 -1
  46. package/dist/chunk-JTFQ5GIL.mjs.map +0 -1
  47. /package/dist/{chunk-CORCJNXR.mjs.map → chunk-BTV2RM2X.mjs.map} +0 -0
  48. /package/dist/{chunk-7EDOHCIU.mjs.map → chunk-OVIDH7IH.mjs.map} +0 -0
  49. /package/dist/{chunk-WXNKOOVD.mjs.map → chunk-QPMGUSMZ.mjs.map} +0 -0
  50. /package/dist/{chunk-6QK2NO6W.mjs.map → chunk-ZNDOT3YP.mjs.map} +0 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # @copilotkit/runtime
2
2
 
3
+ ## 1.9.2-next.19
4
+
5
+ ### Patch Changes
6
+
7
+ - 8e67158: - fixes gemini adapter
8
+ - @copilotkit/shared@1.9.2-next.19
9
+
10
+ ## 1.9.2-next.18
11
+
12
+ ### Patch Changes
13
+
14
+ - fac89c2: - refactor: rename onTrace to onError throughout codebase
15
+
16
+ - Rename CopilotTraceEvent to CopilotErrorEvent and CopilotTraceHandler to CopilotErrorHandler
17
+
18
+ - Updated dependencies [fac89c2]
19
+ - @copilotkit/shared@1.9.2-next.18
20
+
3
21
  ## 1.9.2-next.17
4
22
 
5
23
  ### Patch Changes
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  LangGraphEventTypes
3
- } from "./chunk-H3ML2MWF.mjs";
3
+ } from "./chunk-EEARRKK3.mjs";
4
4
  import {
5
5
  __name
6
6
  } from "./chunk-FHD4JECV.mjs";
@@ -155,4 +155,4 @@ export {
155
155
  CustomEventNames,
156
156
  LangGraphAgent
157
157
  };
158
- //# sourceMappingURL=chunk-CORCJNXR.mjs.map
158
+ //# sourceMappingURL=chunk-BTV2RM2X.mjs.map
@@ -9,7 +9,7 @@ import {
9
9
  EmptyAdapter,
10
10
  RemoteChain,
11
11
  streamLangChainResponse
12
- } from "./chunk-JTFQ5GIL.mjs";
12
+ } from "./chunk-QLLV2QVK.mjs";
13
13
  import {
14
14
  GuardrailsValidationFailureResponse,
15
15
  MessageStreamInterruptedResponse,
@@ -40,7 +40,7 @@ var require_package = __commonJS({
40
40
  publishConfig: {
41
41
  access: "public"
42
42
  },
43
- version: "1.9.2-next.17",
43
+ version: "1.9.2-next.19",
44
44
  sideEffects: false,
45
45
  main: "./dist/index.js",
46
46
  module: "./dist/index.mjs",
@@ -2735,8 +2735,8 @@ var CopilotRuntime = class {
2735
2735
  delegateAgentProcessingToServiceAdapter;
2736
2736
  observability;
2737
2737
  availableAgents;
2738
- onTrace;
2739
- hasWarnedAboutTracing = false;
2738
+ onError;
2739
+ hasWarnedAboutError = false;
2740
2740
  // +++ MCP Properties +++
2741
2741
  mcpServersConfig;
2742
2742
  mcpActionCache = /* @__PURE__ */ new Map();
@@ -2762,7 +2762,7 @@ var CopilotRuntime = class {
2762
2762
  this.delegateAgentProcessingToServiceAdapter = (params == null ? void 0 : params.delegateAgentProcessingToServiceAdapter) || false;
2763
2763
  this.observability = params == null ? void 0 : params.observability_c;
2764
2764
  this.agents = (params == null ? void 0 : params.agents) ?? {};
2765
- this.onTrace = params == null ? void 0 : params.onTrace;
2765
+ this.onError = params == null ? void 0 : params.onError;
2766
2766
  this.mcpServersConfig = params == null ? void 0 : params.mcpServers;
2767
2767
  this.createMCPClientImpl = params == null ? void 0 : params.createMCPClient;
2768
2768
  if (this.mcpServersConfig && this.mcpServersConfig.length > 0 && !this.createMCPClientImpl) {
@@ -2841,7 +2841,7 @@ var CopilotRuntime = class {
2841
2841
  const eventSource = new RuntimeEventSource();
2842
2842
  const requestStartTime = Date.now();
2843
2843
  const streamedChunks = [];
2844
- await this.trace("request", {
2844
+ await this.error("request", {
2845
2845
  threadId,
2846
2846
  runId,
2847
2847
  source: "runtime",
@@ -3037,7 +3037,7 @@ please use an LLM adapter instead.`
3037
3037
  } else {
3038
3038
  structuredError = ensureStructuredError2(error, (err) => this.convertStreamingErrorToStructured(err));
3039
3039
  }
3040
- await this.trace("error", {
3040
+ await this.error("error", {
3041
3041
  threadId,
3042
3042
  runId,
3043
3043
  source: "runtime",
@@ -3285,7 +3285,7 @@ please use an LLM adapter instead.`
3285
3285
  const requestStartTime = Date.now();
3286
3286
  const streamedChunks = [];
3287
3287
  const threadId = threadIdFromRequest ?? agentSession.threadId;
3288
- await this.trace("agent_state", {
3288
+ await this.error("agent_state", {
3289
3289
  threadId,
3290
3290
  source: "agent",
3291
3291
  request: {
@@ -3421,7 +3421,7 @@ please use an LLM adapter instead.`
3421
3421
  }
3422
3422
  }
3423
3423
  const structuredError = ensureStructuredError2(err, (error) => this.convertStreamingErrorToStructured(error));
3424
- await this.trace("error", {
3424
+ await this.error("error", {
3425
3425
  threadId,
3426
3426
  source: "agent",
3427
3427
  request: {
@@ -3510,7 +3510,7 @@ please use an LLM adapter instead.`
3510
3510
  }
3511
3511
  }
3512
3512
  const structuredError = ensureStructuredError2(error, (err) => this.convertStreamingErrorToStructured(err));
3513
- await this.trace("error", {
3513
+ await this.error("error", {
3514
3514
  threadId,
3515
3515
  source: "agent",
3516
3516
  request: {
@@ -3642,18 +3642,18 @@ please use an LLM adapter instead.`
3642
3642
  code: CopilotKitErrorCode2.UNKNOWN
3643
3643
  });
3644
3644
  }
3645
- async trace(type, context, error, publicApiKey) {
3646
- if (!this.onTrace)
3645
+ async error(type, context, error, publicApiKey) {
3646
+ if (!this.onError)
3647
3647
  return;
3648
3648
  if (!publicApiKey) {
3649
- if (!this.hasWarnedAboutTracing) {
3650
- console.warn("CopilotKit: onTrace handler provided but requires publicApiKey to be defined for tracing to work.");
3651
- this.hasWarnedAboutTracing = true;
3649
+ if (!this.hasWarnedAboutError) {
3650
+ console.warn("CopilotKit: onError handler provided but requires publicApiKey to be defined for error handling to work.");
3651
+ this.hasWarnedAboutError = true;
3652
3652
  }
3653
3653
  return;
3654
3654
  }
3655
3655
  try {
3656
- const traceEvent = {
3656
+ const errorEvent = {
3657
3657
  type,
3658
3658
  timestamp: Date.now(),
3659
3659
  context,
@@ -3661,20 +3661,20 @@ please use an LLM adapter instead.`
3661
3661
  error
3662
3662
  }
3663
3663
  };
3664
- await this.onTrace(traceEvent);
3665
- } catch (traceError) {
3666
- console.error("Error in onTrace handler:", traceError);
3664
+ await this.onError(errorEvent);
3665
+ } catch (errorHandlerError) {
3666
+ console.error("Error in onError handler:", errorHandlerError);
3667
3667
  }
3668
3668
  }
3669
3669
  /**
3670
- * Public method to trace GraphQL validation errors
3671
- * This allows the GraphQL resolver to send validation errors through the trace system
3670
+ * Public method to handle GraphQL validation errors
3671
+ * This allows the GraphQL resolver to send validation errors through the error system
3672
3672
  */
3673
- async traceGraphQLError(error, context) {
3674
- if (!this.onTrace)
3673
+ async errorGraphQLError(error, context) {
3674
+ if (!this.onError)
3675
3675
  return;
3676
3676
  try {
3677
- await this.onTrace({
3677
+ await this.onError({
3678
3678
  type: "error",
3679
3679
  timestamp: Date.now(),
3680
3680
  context: {
@@ -3694,8 +3694,8 @@ please use an LLM adapter instead.`
3694
3694
  },
3695
3695
  error
3696
3696
  });
3697
- } catch (traceError) {
3698
- console.error("Error in onTrace handler:", traceError);
3697
+ } catch (errorHandlerError) {
3698
+ console.error("Error in onError handler:", errorHandlerError);
3699
3699
  }
3700
3700
  }
3701
3701
  };
@@ -5016,7 +5016,7 @@ var CopilotResolver = class {
5016
5016
  logger2.debug("Cloud configuration provided, checking for public API key in headers");
5017
5017
  if (!copilotCloudPublicApiKey) {
5018
5018
  logger2.error("Public API key not found in headers");
5019
- await copilotRuntime.traceGraphQLError({
5019
+ await copilotRuntime.errorGraphQLError({
5020
5020
  message: "X-CopilotCloud-Public-API-Key header is required",
5021
5021
  code: "MISSING_PUBLIC_API_KEY",
5022
5022
  type: "GraphQLError"
@@ -5824,4 +5824,4 @@ export {
5824
5824
  getCommonConfig,
5825
5825
  copilotRuntimeNodeHttpEndpoint
5826
5826
  };
5827
- //# sourceMappingURL=chunk-H3ML2MWF.mjs.map
5827
+ //# sourceMappingURL=chunk-EEARRKK3.mjs.map