@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
  copilotRuntimeNodeExpressEndpoint
3
- } from "../../../chunk-EVF3MXEK.mjs";
4
- import "../../../chunk-GOPTDPPB.mjs";
3
+ } from "../../../chunk-KPFOAXRX.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",
@@ -1995,6 +1995,7 @@ AgentsResponse = _ts_decorate18([
1995
1995
  ], AgentsResponse);
1996
1996
 
1997
1997
  // src/graphql/resolvers/copilot.resolver.ts
1998
+ var import_shared7 = require("@copilotkit/shared");
1998
1999
  function _ts_decorate19(decorators, target, key, desc) {
1999
2000
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
2000
2001
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
@@ -2486,6 +2487,12 @@ var CopilotResolver = class {
2486
2487
  logger2.error({
2487
2488
  err
2488
2489
  }, "Error in event stream");
2490
+ if (err instanceof import_shared7.CopilotKitError || err instanceof Error && err.name && err.name.includes("CopilotKit")) {
2491
+ eventStreamSubscription == null ? void 0 : eventStreamSubscription.unsubscribe();
2492
+ rejectOutputMessagesPromise(err);
2493
+ stopStreamingMessages(err);
2494
+ return;
2495
+ }
2489
2496
  responseStatus$.next(new UnknownErrorResponse({
2490
2497
  description: `An unknown error has occurred in the event stream`
2491
2498
  }));
@@ -2663,6 +2670,7 @@ LoadAgentStateInput = _ts_decorate21([
2663
2670
  ], LoadAgentStateInput);
2664
2671
 
2665
2672
  // src/graphql/resolvers/state.resolver.ts
2673
+ var import_shared8 = require("@copilotkit/shared");
2666
2674
  function _ts_decorate22(decorators, target, key, desc) {
2667
2675
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
2668
2676
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
@@ -2690,12 +2698,13 @@ var StateResolver = class {
2690
2698
  const agents = await ctx._copilotkit.runtime.discoverAgentsFromEndpoints(ctx);
2691
2699
  const agent = agents.find((agent2) => agent2.name === data.agentName);
2692
2700
  if (!agent) {
2693
- return {
2694
- threadId: data.threadId || "",
2695
- threadExists: false,
2696
- state: JSON.stringify({}),
2697
- messages: JSON.stringify([])
2698
- };
2701
+ throw new import_shared8.CopilotKitAgentDiscoveryError({
2702
+ agentName: data.agentName,
2703
+ availableAgents: agents.map((a) => ({
2704
+ name: a.name,
2705
+ id: a.name
2706
+ }))
2707
+ });
2699
2708
  }
2700
2709
  const state = await ctx._copilotkit.runtime.loadAgentState(ctx, data.threadId, data.agentName);
2701
2710
  return state;