@copilotkit/runtime 1.9.1 → 1.9.2-next.1

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 (47) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/{chunk-2CND6WGV.mjs → chunk-C3SWOFLO.mjs} +2 -2
  3. package/dist/{chunk-EVF3MXEK.mjs → chunk-KPFOAXRX.mjs} +2 -2
  4. package/dist/{chunk-RVLXQ2V5.mjs → chunk-RIPQZJB5.mjs} +2 -2
  5. package/dist/{chunk-GOPTDPPB.mjs → chunk-XGBY45FP.mjs} +265 -61
  6. package/dist/chunk-XGBY45FP.mjs.map +1 -0
  7. package/dist/{chunk-BHNTR222.mjs → chunk-YV3YXRMR.mjs} +2 -2
  8. package/dist/index.d.ts +1 -1
  9. package/dist/index.js +310 -106
  10. package/dist/index.js.map +1 -1
  11. package/dist/index.mjs +5 -5
  12. package/dist/lib/index.d.ts +1 -1
  13. package/dist/lib/index.js +303 -99
  14. package/dist/lib/index.js.map +1 -1
  15. package/dist/lib/index.mjs +5 -5
  16. package/dist/lib/integrations/index.d.ts +2 -2
  17. package/dist/lib/integrations/index.js +16 -7
  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.d.ts +1 -1
  21. package/dist/lib/integrations/nest/index.js +16 -7
  22. package/dist/lib/integrations/nest/index.js.map +1 -1
  23. package/dist/lib/integrations/nest/index.mjs +2 -2
  24. package/dist/lib/integrations/node-express/index.d.ts +1 -1
  25. package/dist/lib/integrations/node-express/index.js +16 -7
  26. package/dist/lib/integrations/node-express/index.js.map +1 -1
  27. package/dist/lib/integrations/node-express/index.mjs +2 -2
  28. package/dist/lib/integrations/node-http/index.d.ts +1 -1
  29. package/dist/lib/integrations/node-http/index.js +16 -7
  30. package/dist/lib/integrations/node-http/index.js.map +1 -1
  31. package/dist/lib/integrations/node-http/index.mjs +1 -1
  32. package/dist/{shared-0c31d7c5.d.ts → shared-e272b15a.d.ts} +1 -0
  33. package/package.json +2 -2
  34. package/src/agents/langgraph/event-source.ts +10 -1
  35. package/src/graphql/resolvers/copilot.resolver.ts +13 -0
  36. package/src/graphql/resolvers/state.resolver.ts +5 -7
  37. package/src/lib/runtime/copilot-runtime.ts +70 -6
  38. package/src/lib/runtime/remote-action-constructors.ts +37 -28
  39. package/src/lib/runtime/remote-lg-action.ts +45 -24
  40. package/src/lib/runtime/retry-utils.ts +96 -0
  41. package/src/lib/streaming.ts +54 -1
  42. package/src/service-adapters/events.ts +101 -6
  43. package/dist/chunk-GOPTDPPB.mjs.map +0 -1
  44. /package/dist/{chunk-2CND6WGV.mjs.map → chunk-C3SWOFLO.mjs.map} +0 -0
  45. /package/dist/{chunk-EVF3MXEK.mjs.map → chunk-KPFOAXRX.mjs.map} +0 -0
  46. /package/dist/{chunk-RVLXQ2V5.mjs.map → chunk-RIPQZJB5.mjs.map} +0 -0
  47. /package/dist/{chunk-BHNTR222.mjs.map → chunk-YV3YXRMR.mjs.map} +0 -0
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  copilotRuntimeNestEndpoint
3
- } from "../../../chunk-2CND6WGV.mjs";
4
- import "../../../chunk-GOPTDPPB.mjs";
3
+ } from "../../../chunk-C3SWOFLO.mjs";
4
+ import "../../../chunk-XGBY45FP.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-0c31d7c5.js';
2
+ import { b as CreateCopilotRuntimeServerOptions, G as GraphQLContext } from '../../../shared-e272b15a.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.1",
47
+ version: "1.9.2-next.1",
48
48
  sideEffects: false,
49
49
  main: "./dist/index.js",
50
50
  module: "./dist/index.mjs",
@@ -1997,6 +1997,7 @@ AgentsResponse = _ts_decorate18([
1997
1997
  ], AgentsResponse);
1998
1998
 
1999
1999
  // src/graphql/resolvers/copilot.resolver.ts
2000
+ var import_shared7 = require("@copilotkit/shared");
2000
2001
  function _ts_decorate19(decorators, target, key, desc) {
2001
2002
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
2002
2003
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
@@ -2488,6 +2489,12 @@ var CopilotResolver = class {
2488
2489
  logger2.error({
2489
2490
  err
2490
2491
  }, "Error in event stream");
2492
+ if (err instanceof import_shared7.CopilotKitError || err instanceof Error && err.name && err.name.includes("CopilotKit")) {
2493
+ eventStreamSubscription == null ? void 0 : eventStreamSubscription.unsubscribe();
2494
+ rejectOutputMessagesPromise(err);
2495
+ stopStreamingMessages(err);
2496
+ return;
2497
+ }
2491
2498
  responseStatus$.next(new UnknownErrorResponse({
2492
2499
  description: `An unknown error has occurred in the event stream`
2493
2500
  }));
@@ -2665,6 +2672,7 @@ LoadAgentStateInput = _ts_decorate21([
2665
2672
  ], LoadAgentStateInput);
2666
2673
 
2667
2674
  // src/graphql/resolvers/state.resolver.ts
2675
+ var import_shared8 = require("@copilotkit/shared");
2668
2676
  function _ts_decorate22(decorators, target, key, desc) {
2669
2677
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
2670
2678
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
@@ -2692,12 +2700,13 @@ var StateResolver = class {
2692
2700
  const agents = await ctx._copilotkit.runtime.discoverAgentsFromEndpoints(ctx);
2693
2701
  const agent = agents.find((agent2) => agent2.name === data.agentName);
2694
2702
  if (!agent) {
2695
- return {
2696
- threadId: data.threadId || "",
2697
- threadExists: false,
2698
- state: JSON.stringify({}),
2699
- messages: JSON.stringify([])
2700
- };
2703
+ throw new import_shared8.CopilotKitAgentDiscoveryError({
2704
+ agentName: data.agentName,
2705
+ availableAgents: agents.map((a) => ({
2706
+ name: a.name,
2707
+ id: a.name
2708
+ }))
2709
+ });
2701
2710
  }
2702
2711
  const state = await ctx._copilotkit.runtime.loadAgentState(ctx, data.threadId, data.agentName);
2703
2712
  return state;