@copilotkit/runtime 1.5.16-next.0 → 1.5.16-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 (56) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/dist/{chunk-D2WLFQS6.mjs → chunk-2OZAGFV3.mjs} +2 -2
  3. package/dist/{chunk-U3V2BCGI.mjs → chunk-5BIEM2UU.mjs} +2 -2
  4. package/dist/chunk-FHD4JECV.mjs +33 -0
  5. package/dist/{chunk-4TED7LNT.mjs → chunk-ISPCKW3E.mjs} +3 -3
  6. package/dist/{chunk-S3KKBII4.mjs → chunk-OS5YD32G.mjs} +2 -2
  7. package/dist/{chunk-HNUNXFTW.mjs → chunk-RTFJTJMA.mjs} +3 -3
  8. package/dist/{chunk-COJRNPCX.mjs → chunk-TBPOHFA4.mjs} +3 -3
  9. package/dist/{chunk-P5J3JGOI.mjs → chunk-U5OA7VEB.mjs} +35 -18
  10. package/dist/chunk-U5OA7VEB.mjs.map +1 -0
  11. package/dist/{chunk-PIUZJXE7.mjs → chunk-UHUC2NVB.mjs} +3 -3
  12. package/dist/{copilot-runtime-3e7f1c7b.d.ts → copilot-runtime-084fb9c7.d.ts} +6 -1
  13. package/dist/graphql/types/base/index.mjs +2 -2
  14. package/dist/graphql/types/converted/index.mjs +3 -3
  15. package/dist/index.d.ts +1 -1
  16. package/dist/index.js +28 -11
  17. package/dist/index.js.map +1 -1
  18. package/dist/index.mjs +11 -9
  19. package/dist/index.mjs.map +1 -1
  20. package/dist/lib/index.d.ts +1 -1
  21. package/dist/lib/index.js +28 -11
  22. package/dist/lib/index.js.map +1 -1
  23. package/dist/lib/index.mjs +11 -9
  24. package/dist/lib/integrations/index.d.ts +2 -2
  25. package/dist/lib/integrations/index.js +15 -6
  26. package/dist/lib/integrations/index.js.map +1 -1
  27. package/dist/lib/integrations/index.mjs +11 -9
  28. package/dist/lib/integrations/nest/index.d.ts +1 -1
  29. package/dist/lib/integrations/nest/index.js +13 -6
  30. package/dist/lib/integrations/nest/index.js.map +1 -1
  31. package/dist/lib/integrations/nest/index.mjs +7 -7
  32. package/dist/lib/integrations/node-express/index.d.ts +1 -1
  33. package/dist/lib/integrations/node-express/index.js +13 -6
  34. package/dist/lib/integrations/node-express/index.js.map +1 -1
  35. package/dist/lib/integrations/node-express/index.mjs +7 -7
  36. package/dist/lib/integrations/node-http/index.d.ts +1 -1
  37. package/dist/lib/integrations/node-http/index.js +13 -6
  38. package/dist/lib/integrations/node-http/index.js.map +1 -1
  39. package/dist/lib/integrations/node-http/index.mjs +6 -6
  40. package/dist/service-adapters/index.mjs +2 -2
  41. package/dist/utils/index.mjs +2 -2
  42. package/package.json +5 -5
  43. package/src/graphql/resolvers/copilot.resolver.ts +1 -4
  44. package/src/lib/integrations/shared.ts +9 -1
  45. package/src/lib/runtime/remote-lg-action.ts +13 -3
  46. package/tsconfig.json +1 -0
  47. package/dist/chunk-44O2JGUY.mjs +0 -12
  48. package/dist/chunk-P5J3JGOI.mjs.map +0 -1
  49. /package/dist/{chunk-D2WLFQS6.mjs.map → chunk-2OZAGFV3.mjs.map} +0 -0
  50. /package/dist/{chunk-U3V2BCGI.mjs.map → chunk-5BIEM2UU.mjs.map} +0 -0
  51. /package/dist/{chunk-44O2JGUY.mjs.map → chunk-FHD4JECV.mjs.map} +0 -0
  52. /package/dist/{chunk-4TED7LNT.mjs.map → chunk-ISPCKW3E.mjs.map} +0 -0
  53. /package/dist/{chunk-S3KKBII4.mjs.map → chunk-OS5YD32G.mjs.map} +0 -0
  54. /package/dist/{chunk-HNUNXFTW.mjs.map → chunk-RTFJTJMA.mjs.map} +0 -0
  55. /package/dist/{chunk-COJRNPCX.mjs.map → chunk-TBPOHFA4.mjs.map} +0 -0
  56. /package/dist/{chunk-PIUZJXE7.mjs.map → chunk-UHUC2NVB.mjs.map} +0 -0
@@ -2,10 +2,10 @@ import {
2
2
  getCommonConfig,
3
3
  getRuntimeInstanceTelemetryInfo,
4
4
  telemetry_client_default
5
- } from "./chunk-P5J3JGOI.mjs";
5
+ } from "./chunk-U5OA7VEB.mjs";
6
6
  import {
7
7
  __name
8
- } from "./chunk-44O2JGUY.mjs";
8
+ } from "./chunk-FHD4JECV.mjs";
9
9
 
10
10
  // src/lib/integrations/nextjs/app-router.ts
11
11
  import { createYoga } from "graphql-yoga";
@@ -77,4 +77,4 @@ export {
77
77
  config,
78
78
  copilotRuntimeNextJSPagesRouterEndpoint
79
79
  };
80
- //# sourceMappingURL=chunk-PIUZJXE7.mjs.map
80
+ //# sourceMappingURL=chunk-UHUC2NVB.mjs.map
@@ -9,6 +9,11 @@ import { CopilotCloudOptions } from './lib/cloud/index.js';
9
9
  type LogLevel = "debug" | "info" | "warn" | "error";
10
10
 
11
11
  declare const logger: pino.Logger<never>;
12
+ declare const addCustomHeaderPlugin: {
13
+ onResponse({ response }: {
14
+ response: any;
15
+ }): void;
16
+ };
12
17
  type AnyPrimitive = string | boolean | number | null;
13
18
  type CopilotRequestContextProperties = Record<string, AnyPrimitive | Record<string, AnyPrimitive>>;
14
19
  type GraphQLContext = YogaInitialContext & {
@@ -210,4 +215,4 @@ declare function copilotKitEndpoint(config: Omit<CopilotKitEndpoint, "type">): C
210
215
  declare function langGraphPlatformEndpoint(config: Omit<LangGraphPlatformEndpoint, "type">): LangGraphPlatformEndpoint;
211
216
  declare function resolveEndpointType(endpoint: EndpointDefinition): EndpointType;
212
217
 
213
- export { CopilotRuntimeConstructorParams as C, GraphQLContext as G, CopilotRuntime as a, CopilotRequestContextProperties as b, copilotKitEndpoint as c, CreateCopilotRuntimeServerOptions as d, createContext as e, flattenToolCallsNoDuplicates as f, buildSchema as g, CommonConfig as h, getCommonConfig as i, langGraphPlatformEndpoint as l, resolveEndpointType as r };
218
+ export { CopilotRuntimeConstructorParams as C, GraphQLContext as G, CopilotRuntime as a, addCustomHeaderPlugin as b, copilotKitEndpoint as c, CopilotRequestContextProperties as d, CreateCopilotRuntimeServerOptions as e, flattenToolCallsNoDuplicates as f, createContext as g, buildSchema as h, CommonConfig as i, getCommonConfig as j, langGraphPlatformEndpoint as l, resolveEndpointType as r };
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  BaseMessageInput
3
- } from "../../../chunk-D2WLFQS6.mjs";
4
- import "../../../chunk-44O2JGUY.mjs";
3
+ } from "../../../chunk-2OZAGFV3.mjs";
4
+ import "../../../chunk-FHD4JECV.mjs";
5
5
  export {
6
6
  BaseMessageInput
7
7
  };
@@ -4,9 +4,9 @@ import {
4
4
  Message,
5
5
  ResultMessage,
6
6
  TextMessage
7
- } from "../../../chunk-HNUNXFTW.mjs";
8
- import "../../../chunk-D2WLFQS6.mjs";
9
- import "../../../chunk-44O2JGUY.mjs";
7
+ } from "../../../chunk-RTFJTJMA.mjs";
8
+ import "../../../chunk-2OZAGFV3.mjs";
9
+ import "../../../chunk-FHD4JECV.mjs";
10
10
  export {
11
11
  ActionExecutionMessage,
12
12
  AgentStateMessage,
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { h as CommonConfig, b as CopilotRequestContextProperties, a as CopilotRuntime, C as CopilotRuntimeConstructorParams, d as CreateCopilotRuntimeServerOptions, G as GraphQLContext, g as buildSchema, c as copilotKitEndpoint, e as createContext, f as flattenToolCallsNoDuplicates, i as getCommonConfig, l as langGraphPlatformEndpoint, r as resolveEndpointType } from './copilot-runtime-3e7f1c7b.js';
1
+ export { i as CommonConfig, d as CopilotRequestContextProperties, a as CopilotRuntime, C as CopilotRuntimeConstructorParams, e as CreateCopilotRuntimeServerOptions, G as GraphQLContext, b as addCustomHeaderPlugin, h as buildSchema, c as copilotKitEndpoint, g as createContext, f as flattenToolCallsNoDuplicates, j as getCommonConfig, l as langGraphPlatformEndpoint, r as resolveEndpointType } from './copilot-runtime-084fb9c7.js';
2
2
  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-3b894689.js';
3
3
  export { CopilotRuntimeServerInstance, config, copilotRuntimeNextJSAppRouterEndpoint, copilotRuntimeNextJSPagesRouterEndpoint } from './lib/integrations/index.js';
4
4
  export { copilotRuntimeNodeHttpEndpoint } from './lib/integrations/node-http/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.5.16-next.0",
47
+ version: "1.5.16-next.2",
48
48
  sideEffects: false,
49
49
  main: "./dist/index.js",
50
50
  module: "./dist/index.mjs",
@@ -84,11 +84,11 @@ var require_package = __commonJS({
84
84
  "@anthropic-ai/sdk": "^0.27.3",
85
85
  "@copilotkit/shared": "workspace:*",
86
86
  "@graphql-yoga/plugin-defer-stream": "^3.3.1",
87
- "@langchain/community": "^0.0.53",
88
- "@langchain/core": "^0.3.13",
87
+ "@langchain/community": "^0.3.29",
88
+ "@langchain/core": "^0.3.38",
89
89
  "@langchain/google-gauth": "^0.1.0",
90
90
  "@langchain/langgraph-sdk": "^0.0.36",
91
- "@langchain/openai": "^0.0.28",
91
+ "@langchain/openai": "^0.4.2",
92
92
  "class-transformer": "^0.5.1",
93
93
  express: "^4.19.2",
94
94
  graphql: "^16.8.1",
@@ -139,6 +139,7 @@ __export(src_exports, {
139
139
  RemoteChain: () => RemoteChain,
140
140
  UnifyAdapter: () => UnifyAdapter,
141
141
  UnknownErrorResponse: () => UnknownErrorResponse,
142
+ addCustomHeaderPlugin: () => addCustomHeaderPlugin,
142
143
  buildSchema: () => buildSchema,
143
144
  config: () => config,
144
145
  copilotKitEndpoint: () => copilotKitEndpoint,
@@ -2543,9 +2544,16 @@ async function streamEvents(controller, args) {
2543
2544
  };
2544
2545
  }
2545
2546
  if (lgInterruptMetaEvent == null ? void 0 : lgInterruptMetaEvent.response) {
2546
- payload.command = {
2547
- resume: lgInterruptMetaEvent.response
2548
- };
2547
+ let response = lgInterruptMetaEvent.response;
2548
+ try {
2549
+ payload.command = {
2550
+ resume: JSON.parse(response)
2551
+ };
2552
+ } catch (e) {
2553
+ payload.command = {
2554
+ resume: response
2555
+ };
2556
+ }
2549
2557
  }
2550
2558
  if (mode === "continue" && !activeInterruptEvent) {
2551
2559
  await client.threads.updateState(threadId, {
@@ -2605,17 +2613,18 @@ async function streamEvents(controller, args) {
2605
2613
  activeInterruptEvent = true;
2606
2614
  const interruptValue = interruptEvents == null ? void 0 : interruptEvents[0].value;
2607
2615
  if (typeof interruptValue != "string" && "__copilotkit_interrupt_value__" in interruptValue) {
2616
+ const evValue = interruptValue.__copilotkit_interrupt_value__;
2608
2617
  emit(JSON.stringify({
2609
2618
  event: LangGraphEventTypes.OnCopilotKitInterrupt,
2610
2619
  data: {
2611
- value: interruptValue.__copilotkit_interrupt_value__,
2620
+ value: typeof evValue === "string" ? evValue : JSON.stringify(evValue),
2612
2621
  messages: langchainMessagesToCopilotKit(interruptValue.__copilotkit_messages__)
2613
2622
  }
2614
2623
  }) + "\n");
2615
2624
  } else {
2616
2625
  emit(JSON.stringify({
2617
2626
  event: LangGraphEventTypes.OnInterrupt,
2618
- value: interruptValue
2627
+ value: typeof interruptValue === "string" ? interruptValue : JSON.stringify(interruptValue)
2619
2628
  }) + "\n");
2620
2629
  }
2621
2630
  continue;
@@ -5280,7 +5289,7 @@ var CopilotResolver = class {
5280
5289
  type: event.type,
5281
5290
  name: event.name,
5282
5291
  data: {
5283
- value: typeof event.data.value === "string" ? event.data.value : JSON.stringify(event.data.value),
5292
+ value: event.data.value,
5284
5293
  messages: event.data.messages.map((message) => {
5285
5294
  if (message.type === "TextMessage" || "content" in message && "role" in message) {
5286
5295
  return (0, import_class_transformer3.plainToInstance)(TextMessage, {
@@ -5791,7 +5800,13 @@ StateResolver = _ts_decorate22([
5791
5800
  ], StateResolver);
5792
5801
 
5793
5802
  // src/lib/integrations/shared.ts
5803
+ var packageJson2 = __toESM(require_package());
5794
5804
  var logger = createLogger();
5805
+ var addCustomHeaderPlugin = {
5806
+ onResponse({ response }) {
5807
+ response.headers.set("X-CopilotKit-Runtime-Version", packageJson2.version);
5808
+ }
5809
+ };
5795
5810
  async function createContext(initialContext, copilotKitContext, contextLogger, properties = {}) {
5796
5811
  logger.debug({
5797
5812
  copilotKitContext
@@ -5857,7 +5872,8 @@ function getCommonConfig(options) {
5857
5872
  }),
5858
5873
  schema: buildSchema(),
5859
5874
  plugins: [
5860
- (0, import_plugin_defer_stream.useDeferStream)()
5875
+ (0, import_plugin_defer_stream.useDeferStream)(),
5876
+ addCustomHeaderPlugin
5861
5877
  ],
5862
5878
  context: (ctx) => createContext(ctx, options, contextLogger, options.properties)
5863
5879
  };
@@ -5995,6 +6011,7 @@ __name(copilotRuntimeNestEndpoint, "copilotRuntimeNestEndpoint");
5995
6011
  RemoteChain,
5996
6012
  UnifyAdapter,
5997
6013
  UnknownErrorResponse,
6014
+ addCustomHeaderPlugin,
5998
6015
  buildSchema,
5999
6016
  config,
6000
6017
  copilotKitEndpoint,