@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
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  LangGraphEventTypes
3
- } from "./chunk-FOXQPOXW.mjs";
3
+ } from "./chunk-G3STE4EL.mjs";
4
4
  import {
5
5
  __name
6
6
  } from "./chunk-FHD4JECV.mjs";
@@ -168,4 +168,4 @@ export {
168
168
  CustomEventNames,
169
169
  LangGraphAgent
170
170
  };
171
- //# sourceMappingURL=chunk-H6QUY5ZQ.mjs.map
171
+ //# sourceMappingURL=chunk-H5ZYJ27F.mjs.map
@@ -2,7 +2,7 @@ import {
2
2
  getCommonConfig,
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";
@@ -77,4 +77,4 @@ export {
77
77
  config,
78
78
  copilotRuntimeNextJSPagesRouterEndpoint
79
79
  };
80
- //# sourceMappingURL=chunk-CX4GADTM.mjs.map
80
+ //# sourceMappingURL=chunk-IONJJRU6.mjs.map
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export { G as GoogleGenerativeAIAdapter, f as GroqAdapter, e as GroqAdapterParams, L as LangChainAdapter, a as OpenAIAdapter, O as OpenAIAdapterParams, c as OpenAIAssistantAdapter, b as OpenAIAssistantAdapterParams, d as UnifyAdapter, U as UnifyAdapterParams } from './groq-adapter-c8aec5c5.js';
2
- export { e as CommonConfig, C as CopilotRequestContextProperties, k as CopilotRuntime, j as CopilotRuntimeConstructorParams, f as CopilotRuntimeLogger, i as CopilotRuntimeRequest, b as CreateCopilotRuntimeServerOptions, G as GraphQLContext, L as LogLevel, o as MCPClient, p as MCPEndpointConfig, M as MCPTool, a as addCustomHeaderPlugin, d as buildSchema, s as convertMCPToolsToActions, m as copilotKitEndpoint, c as createContext, h as createLogger, q as extractParametersFromSchema, l as flattenToolCallsNoDuplicates, t as generateMcpToolInstructions, g as getCommonConfig, n as langGraphPlatformEndpoint, r as resolveEndpointType } from './shared-35015e40.js';
2
+ export { e as CommonConfig, C as CopilotRequestContextProperties, k as CopilotRuntime, j as CopilotRuntimeConstructorParams, f as CopilotRuntimeLogger, i as CopilotRuntimeRequest, b as CreateCopilotRuntimeServerOptions, G as GraphQLContext, L as LogLevel, o as MCPClient, p as MCPEndpointConfig, M as MCPTool, a as addCustomHeaderPlugin, d as buildSchema, s as convertMCPToolsToActions, m as copilotKitEndpoint, c as createContext, h as createLogger, q as extractParametersFromSchema, l as flattenToolCallsNoDuplicates, t as generateMcpToolInstructions, g as getCommonConfig, n as langGraphPlatformEndpoint, r as resolveEndpointType } from './shared-0a7346ce.js';
3
3
  export { CopilotRuntimeServerInstance, config, copilotRuntimeNextJSAppRouterEndpoint, copilotRuntimeNextJSPagesRouterEndpoint } from './lib/integrations/index.js';
4
4
  export { copilotRuntimeNodeHttpEndpoint } from './lib/integrations/node-http/index.js';
5
5
  export { copilotRuntimeNodeExpressEndpoint } from './lib/integrations/node-express/index.js';
package/dist/index.js CHANGED
@@ -44,7 +44,7 @@ var require_package = __commonJS({
44
44
  publishConfig: {
45
45
  access: "public"
46
46
  },
47
- version: "1.10.5-next.1",
47
+ version: "1.10.5-next.2",
48
48
  sideEffects: false,
49
49
  main: "./dist/index.js",
50
50
  module: "./dist/index.mjs",
@@ -4853,6 +4853,7 @@ var CopilotRuntime = class {
4853
4853
  langserve = [];
4854
4854
  onBeforeRequest;
4855
4855
  onAfterRequest;
4856
+ onStopGeneration;
4856
4857
  delegateAgentProcessingToServiceAdapter;
4857
4858
  observability;
4858
4859
  availableAgents;
@@ -4880,6 +4881,7 @@ var CopilotRuntime = class {
4880
4881
  this.remoteEndpointDefinitions = (params == null ? void 0 : params.remoteEndpoints) ?? (params == null ? void 0 : params.remoteActions) ?? [];
4881
4882
  this.onBeforeRequest = (_a = params == null ? void 0 : params.middleware) == null ? void 0 : _a.onBeforeRequest;
4882
4883
  this.onAfterRequest = (_b = params == null ? void 0 : params.middleware) == null ? void 0 : _b.onAfterRequest;
4884
+ this.onStopGeneration = params == null ? void 0 : params.onStopGeneration;
4883
4885
  this.delegateAgentProcessingToServiceAdapter = (params == null ? void 0 : params.delegateAgentProcessingToServiceAdapter) || false;
4884
4886
  this.observability = params == null ? void 0 : params.observability_c;
4885
4887
  this.agents = (params == null ? void 0 : params.agents) ?? {};
@@ -4959,6 +4961,18 @@ var CopilotRuntime = class {
4959
4961
  async processRuntimeRequest(request) {
4960
4962
  var _a, _b, _c, _d, _e;
4961
4963
  const { serviceAdapter, messages: rawMessages, actions: clientSideActionsInput, threadId, runId, outputMessagesPromise, graphqlContext, forwardedParameters, url, extensions, agentSession, agentStates, publicApiKey, context } = request;
4964
+ graphqlContext.request.signal.addEventListener("abort", () => {
4965
+ var _a2;
4966
+ return (_a2 = this.onStopGeneration) == null ? void 0 : _a2.call(this, {
4967
+ threadId,
4968
+ runId,
4969
+ url,
4970
+ agentName: agentSession == null ? void 0 : agentSession.agentName,
4971
+ lastMessage: rawMessages[rawMessages.length - 1]
4972
+ });
4973
+ }, {
4974
+ once: true
4975
+ });
4962
4976
  const eventSource = new RuntimeEventSource({
4963
4977
  errorHandler: async (error, context2) => {
4964
4978
  await this.error("error", context2, error, publicApiKey);
@@ -6461,6 +6475,11 @@ function constructAGUIRemoteAction({ logger: logger2, messages, agentStates, age
6461
6475
  },
6462
6476
  remoteAgentHandler: async ({ actionInputsWithoutAgents, threadId }) => {
6463
6477
  var _a;
6478
+ graphqlContext.request.signal.addEventListener("abort", () => {
6479
+ agent.abortRun();
6480
+ }, {
6481
+ once: true
6482
+ });
6464
6483
  logger2.debug({
6465
6484
  actionName: agent.agentId
6466
6485
  }, "Executing remote agent");