@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/dist/index.mjs CHANGED
@@ -2,18 +2,18 @@ import {
2
2
  CustomEventNames,
3
3
  LangGraphAgent,
4
4
  LangGraphHttpAgent
5
- } from "./chunk-H6QUY5ZQ.mjs";
5
+ } from "./chunk-H5ZYJ27F.mjs";
6
6
  import {
7
7
  config,
8
8
  copilotRuntimeNextJSAppRouterEndpoint,
9
9
  copilotRuntimeNextJSPagesRouterEndpoint
10
- } from "./chunk-CX4GADTM.mjs";
10
+ } from "./chunk-IONJJRU6.mjs";
11
11
  import {
12
12
  copilotRuntimeNestEndpoint
13
- } from "./chunk-T4NLPBCY.mjs";
13
+ } from "./chunk-AJIPGTPV.mjs";
14
14
  import {
15
15
  copilotRuntimeNodeExpressEndpoint
16
- } from "./chunk-C56AVUZI.mjs";
16
+ } from "./chunk-AK5H4K5T.mjs";
17
17
  import {
18
18
  CopilotRuntime,
19
19
  addCustomHeaderPlugin,
@@ -29,7 +29,7 @@ import {
29
29
  getCommonConfig,
30
30
  langGraphPlatformEndpoint,
31
31
  resolveEndpointType
32
- } from "./chunk-FOXQPOXW.mjs";
32
+ } from "./chunk-G3STE4EL.mjs";
33
33
  import "./chunk-SHBDMA63.mjs";
34
34
  import {
35
35
  AnthropicAdapter,
@@ -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 './integrations/index.js';
4
4
  export { copilotRuntimeNodeHttpEndpoint } from './integrations/node-http/index.js';
5
5
  export { copilotRuntimeNodeExpressEndpoint } from './integrations/node-express/index.js';
package/dist/lib/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",
@@ -4339,6 +4339,7 @@ var CopilotRuntime = class {
4339
4339
  langserve = [];
4340
4340
  onBeforeRequest;
4341
4341
  onAfterRequest;
4342
+ onStopGeneration;
4342
4343
  delegateAgentProcessingToServiceAdapter;
4343
4344
  observability;
4344
4345
  availableAgents;
@@ -4366,6 +4367,7 @@ var CopilotRuntime = class {
4366
4367
  this.remoteEndpointDefinitions = (params == null ? void 0 : params.remoteEndpoints) ?? (params == null ? void 0 : params.remoteActions) ?? [];
4367
4368
  this.onBeforeRequest = (_a = params == null ? void 0 : params.middleware) == null ? void 0 : _a.onBeforeRequest;
4368
4369
  this.onAfterRequest = (_b = params == null ? void 0 : params.middleware) == null ? void 0 : _b.onAfterRequest;
4370
+ this.onStopGeneration = params == null ? void 0 : params.onStopGeneration;
4369
4371
  this.delegateAgentProcessingToServiceAdapter = (params == null ? void 0 : params.delegateAgentProcessingToServiceAdapter) || false;
4370
4372
  this.observability = params == null ? void 0 : params.observability_c;
4371
4373
  this.agents = (params == null ? void 0 : params.agents) ?? {};
@@ -4445,6 +4447,18 @@ var CopilotRuntime = class {
4445
4447
  async processRuntimeRequest(request) {
4446
4448
  var _a, _b, _c, _d, _e;
4447
4449
  const { serviceAdapter, messages: rawMessages, actions: clientSideActionsInput, threadId, runId, outputMessagesPromise, graphqlContext, forwardedParameters, url, extensions, agentSession, agentStates, publicApiKey, context } = request;
4450
+ graphqlContext.request.signal.addEventListener("abort", () => {
4451
+ var _a2;
4452
+ return (_a2 = this.onStopGeneration) == null ? void 0 : _a2.call(this, {
4453
+ threadId,
4454
+ runId,
4455
+ url,
4456
+ agentName: agentSession == null ? void 0 : agentSession.agentName,
4457
+ lastMessage: rawMessages[rawMessages.length - 1]
4458
+ });
4459
+ }, {
4460
+ once: true
4461
+ });
4448
4462
  const eventSource = new RuntimeEventSource({
4449
4463
  errorHandler: async (error, context2) => {
4450
4464
  await this.error("error", context2, error, publicApiKey);
@@ -5947,6 +5961,11 @@ function constructAGUIRemoteAction({ logger: logger2, messages, agentStates, age
5947
5961
  },
5948
5962
  remoteAgentHandler: async ({ actionInputsWithoutAgents, threadId }) => {
5949
5963
  var _a;
5964
+ graphqlContext.request.signal.addEventListener("abort", () => {
5965
+ agent.abortRun();
5966
+ }, {
5967
+ once: true
5968
+ });
5950
5969
  logger2.debug({
5951
5970
  actionName: agent.agentId
5952
5971
  }, "Executing remote agent");