@copilotkit/runtime 1.10.5-next.1 → 1.10.5-next.2

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 (40) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/{chunk-T4NLPBCY.mjs → chunk-AJIPGTPV.mjs} +2 -2
  3. package/dist/{chunk-C56AVUZI.mjs → chunk-AK5H4K5T.mjs} +2 -2
  4. package/dist/{chunk-FOXQPOXW.mjs → chunk-G3STE4EL.mjs} +21 -2
  5. package/dist/chunk-G3STE4EL.mjs.map +1 -0
  6. package/dist/{chunk-H6QUY5ZQ.mjs → chunk-H5ZYJ27F.mjs} +2 -2
  7. package/dist/{chunk-CX4GADTM.mjs → chunk-IONJJRU6.mjs} +2 -2
  8. package/dist/index.d.ts +1 -1
  9. package/dist/index.js +20 -1
  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 +20 -1
  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 +1 -1
  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 +1 -1
  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 +1 -1
  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 +1 -1
  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-35015e40.d.ts → shared-0a7346ce.d.ts} +10 -0
  33. package/package.json +2 -2
  34. package/src/lib/runtime/agui-action.ts +7 -0
  35. package/src/lib/runtime/copilot-runtime.ts +25 -0
  36. package/dist/chunk-FOXQPOXW.mjs.map +0 -1
  37. /package/dist/{chunk-T4NLPBCY.mjs.map → chunk-AJIPGTPV.mjs.map} +0 -0
  38. /package/dist/{chunk-C56AVUZI.mjs.map → chunk-AK5H4K5T.mjs.map} +0 -0
  39. /package/dist/{chunk-H6QUY5ZQ.mjs.map → chunk-H5ZYJ27F.mjs.map} +0 -0
  40. /package/dist/{chunk-CX4GADTM.mjs.map → chunk-IONJJRU6.mjs.map} +0 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # @copilotkit/runtime
2
2
 
3
+ ## 1.10.5-next.2
4
+
5
+ ### Patch Changes
6
+
7
+ - 7467f97: - feat: add stop generation callback and call abort agui agent
8
+ - @copilotkit/shared@1.10.5-next.2
9
+
3
10
  ## 1.10.5-next.1
4
11
 
5
12
  ### Patch Changes
@@ -2,7 +2,7 @@ import {
2
2
  copilotRuntimeNodeHttpEndpoint,
3
3
  getRuntimeInstanceTelemetryInfo,
4
4
  telemetry_client_default
5
- } from "./chunk-FOXQPOXW.mjs";
5
+ } from "./chunk-G3STE4EL.mjs";
6
6
  import {
7
7
  __name
8
8
  } from "./chunk-FHD4JECV.mjs";
@@ -22,4 +22,4 @@ __name(copilotRuntimeNestEndpoint, "copilotRuntimeNestEndpoint");
22
22
  export {
23
23
  copilotRuntimeNestEndpoint
24
24
  };
25
- //# sourceMappingURL=chunk-T4NLPBCY.mjs.map
25
+ //# sourceMappingURL=chunk-AJIPGTPV.mjs.map
@@ -2,7 +2,7 @@ import {
2
2
  copilotRuntimeNodeHttpEndpoint,
3
3
  getRuntimeInstanceTelemetryInfo,
4
4
  telemetry_client_default
5
- } from "./chunk-FOXQPOXW.mjs";
5
+ } from "./chunk-G3STE4EL.mjs";
6
6
  import {
7
7
  __name
8
8
  } from "./chunk-FHD4JECV.mjs";
@@ -22,4 +22,4 @@ __name(copilotRuntimeNodeExpressEndpoint, "copilotRuntimeNodeExpressEndpoint");
22
22
  export {
23
23
  copilotRuntimeNodeExpressEndpoint
24
24
  };
25
- //# sourceMappingURL=chunk-C56AVUZI.mjs.map
25
+ //# sourceMappingURL=chunk-AK5H4K5T.mjs.map
@@ -40,7 +40,7 @@ var require_package = __commonJS({
40
40
  publishConfig: {
41
41
  access: "public"
42
42
  },
43
- version: "1.10.5-next.1",
43
+ version: "1.10.5-next.2",
44
44
  sideEffects: false,
45
45
  main: "./dist/index.js",
46
46
  module: "./dist/index.mjs",
@@ -2821,6 +2821,7 @@ var CopilotRuntime = class {
2821
2821
  langserve = [];
2822
2822
  onBeforeRequest;
2823
2823
  onAfterRequest;
2824
+ onStopGeneration;
2824
2825
  delegateAgentProcessingToServiceAdapter;
2825
2826
  observability;
2826
2827
  availableAgents;
@@ -2848,6 +2849,7 @@ var CopilotRuntime = class {
2848
2849
  this.remoteEndpointDefinitions = (params == null ? void 0 : params.remoteEndpoints) ?? (params == null ? void 0 : params.remoteActions) ?? [];
2849
2850
  this.onBeforeRequest = (_a = params == null ? void 0 : params.middleware) == null ? void 0 : _a.onBeforeRequest;
2850
2851
  this.onAfterRequest = (_b = params == null ? void 0 : params.middleware) == null ? void 0 : _b.onAfterRequest;
2852
+ this.onStopGeneration = params == null ? void 0 : params.onStopGeneration;
2851
2853
  this.delegateAgentProcessingToServiceAdapter = (params == null ? void 0 : params.delegateAgentProcessingToServiceAdapter) || false;
2852
2854
  this.observability = params == null ? void 0 : params.observability_c;
2853
2855
  this.agents = (params == null ? void 0 : params.agents) ?? {};
@@ -2927,6 +2929,18 @@ var CopilotRuntime = class {
2927
2929
  async processRuntimeRequest(request) {
2928
2930
  var _a, _b, _c, _d, _e;
2929
2931
  const { serviceAdapter, messages: rawMessages, actions: clientSideActionsInput, threadId, runId, outputMessagesPromise, graphqlContext, forwardedParameters, url, extensions, agentSession, agentStates, publicApiKey, context } = request;
2932
+ graphqlContext.request.signal.addEventListener("abort", () => {
2933
+ var _a2;
2934
+ return (_a2 = this.onStopGeneration) == null ? void 0 : _a2.call(this, {
2935
+ threadId,
2936
+ runId,
2937
+ url,
2938
+ agentName: agentSession == null ? void 0 : agentSession.agentName,
2939
+ lastMessage: rawMessages[rawMessages.length - 1]
2940
+ });
2941
+ }, {
2942
+ once: true
2943
+ });
2930
2944
  const eventSource = new RuntimeEventSource({
2931
2945
  errorHandler: async (error, context2) => {
2932
2946
  await this.error("error", context2, error, publicApiKey);
@@ -4429,6 +4443,11 @@ function constructAGUIRemoteAction({ logger: logger2, messages, agentStates, age
4429
4443
  },
4430
4444
  remoteAgentHandler: async ({ actionInputsWithoutAgents, threadId }) => {
4431
4445
  var _a;
4446
+ graphqlContext.request.signal.addEventListener("abort", () => {
4447
+ agent.abortRun();
4448
+ }, {
4449
+ once: true
4450
+ });
4432
4451
  logger2.debug({
4433
4452
  actionName: agent.agentId
4434
4453
  }, "Executing remote agent");
@@ -5995,4 +6014,4 @@ export {
5995
6014
  getCommonConfig,
5996
6015
  copilotRuntimeNodeHttpEndpoint
5997
6016
  };
5998
- //# sourceMappingURL=chunk-FOXQPOXW.mjs.map
6017
+ //# sourceMappingURL=chunk-G3STE4EL.mjs.map