@copilotkit/runtime 1.5.14 → 1.5.15-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 (41) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/{chunk-EKESUZN7.mjs → chunk-2CH7MDMH.mjs} +2 -2
  3. package/dist/{chunk-CBI52XPL.mjs → chunk-3QMRQQKK.mjs} +9 -5
  4. package/dist/chunk-3QMRQQKK.mjs.map +1 -0
  5. package/dist/{chunk-NKTCGE5C.mjs → chunk-5KOKNRAO.mjs} +2 -2
  6. package/dist/{chunk-H3A6C24Z.mjs → chunk-DATHT2T2.mjs} +2 -2
  7. package/dist/{copilot-runtime-8c442d65.d.ts → copilot-runtime-628cc60c.d.ts} +3 -12
  8. package/dist/{groq-adapter-7a82cd22.d.ts → groq-adapter-acb6ed0b.d.ts} +1 -1
  9. package/dist/index.d.ts +3 -3
  10. package/dist/index.js +8 -4
  11. package/dist/index.js.map +1 -1
  12. package/dist/index.mjs +4 -4
  13. package/dist/{langserve-e308c437.d.ts → langserve-9614171f.d.ts} +14 -1
  14. package/dist/lib/index.d.ts +3 -3
  15. package/dist/lib/index.js +8 -4
  16. package/dist/lib/index.js.map +1 -1
  17. package/dist/lib/index.mjs +4 -4
  18. package/dist/lib/integrations/index.d.ts +3 -3
  19. package/dist/lib/integrations/index.js +1 -1
  20. package/dist/lib/integrations/index.js.map +1 -1
  21. package/dist/lib/integrations/index.mjs +4 -4
  22. package/dist/lib/integrations/nest/index.d.ts +2 -2
  23. package/dist/lib/integrations/nest/index.js +1 -1
  24. package/dist/lib/integrations/nest/index.js.map +1 -1
  25. package/dist/lib/integrations/nest/index.mjs +2 -2
  26. package/dist/lib/integrations/node-express/index.d.ts +2 -2
  27. package/dist/lib/integrations/node-express/index.js +1 -1
  28. package/dist/lib/integrations/node-express/index.js.map +1 -1
  29. package/dist/lib/integrations/node-express/index.mjs +2 -2
  30. package/dist/lib/integrations/node-http/index.d.ts +2 -2
  31. package/dist/lib/integrations/node-http/index.js +1 -1
  32. package/dist/lib/integrations/node-http/index.js.map +1 -1
  33. package/dist/lib/integrations/node-http/index.mjs +1 -1
  34. package/dist/service-adapters/index.d.ts +3 -3
  35. package/package.json +2 -2
  36. package/src/lib/runtime/copilot-runtime.ts +16 -3
  37. package/src/service-adapters/service-adapter.ts +4 -0
  38. package/dist/chunk-CBI52XPL.mjs.map +0 -1
  39. /package/dist/{chunk-EKESUZN7.mjs.map → chunk-2CH7MDMH.mjs.map} +0 -0
  40. /package/dist/{chunk-NKTCGE5C.mjs.map → chunk-5KOKNRAO.mjs.map} +0 -0
  41. /package/dist/{chunk-H3A6C24Z.mjs.map → chunk-DATHT2T2.mjs.map} +0 -0
package/dist/index.mjs CHANGED
@@ -3,13 +3,13 @@ import {
3
3
  config,
4
4
  copilotRuntimeNextJSAppRouterEndpoint,
5
5
  copilotRuntimeNextJSPagesRouterEndpoint
6
- } from "./chunk-H3A6C24Z.mjs";
6
+ } from "./chunk-DATHT2T2.mjs";
7
7
  import {
8
8
  copilotRuntimeNestEndpoint
9
- } from "./chunk-EKESUZN7.mjs";
9
+ } from "./chunk-2CH7MDMH.mjs";
10
10
  import {
11
11
  copilotRuntimeNodeExpressEndpoint
12
- } from "./chunk-NKTCGE5C.mjs";
12
+ } from "./chunk-5KOKNRAO.mjs";
13
13
  import {
14
14
  CopilotRuntime,
15
15
  buildSchema,
@@ -20,7 +20,7 @@ import {
20
20
  getCommonConfig,
21
21
  langGraphPlatformEndpoint,
22
22
  resolveEndpointType
23
- } from "./chunk-CBI52XPL.mjs";
23
+ } from "./chunk-3QMRQQKK.mjs";
24
24
  import {
25
25
  AnthropicAdapter,
26
26
  EmptyAdapter,
@@ -169,6 +169,17 @@ declare class OpenAIApiAssistantAPIResponse {
169
169
  threadId?: string;
170
170
  }
171
171
 
172
+ declare class AgentSessionInput {
173
+ agentName: string;
174
+ threadId?: string;
175
+ nodeName?: string;
176
+ }
177
+
178
+ declare class AgentStateInput {
179
+ agentName: string;
180
+ state: string;
181
+ }
182
+
172
183
  interface CopilotRuntimeChatCompletionRequest {
173
184
  eventSource: RuntimeEventSource;
174
185
  messages: Message[];
@@ -178,6 +189,8 @@ interface CopilotRuntimeChatCompletionRequest {
178
189
  runId?: string;
179
190
  forwardedParameters?: ForwardedParametersInput;
180
191
  extensions?: ExtensionsInput;
192
+ agentSession?: AgentSessionInput;
193
+ agentStates?: AgentStateInput[];
181
194
  }
182
195
  interface CopilotRuntimeChatCompletionResponse {
183
196
  threadId: string;
@@ -206,4 +219,4 @@ declare class RemoteChain {
206
219
  inferLangServeParameters(): Promise<void>;
207
220
  }
208
221
 
209
- export { ActionInput as A, CopilotRuntimeChatCompletionRequest as C, ExtensionsInput as E, ForwardedParametersInput as F, RemoteChainParameters as R, CopilotRuntimeChatCompletionResponse as a, CopilotServiceAdapter as b, RemoteChain as c, RuntimeEventSource as d, ExtensionsResponse as e };
222
+ export { ActionInput as A, CopilotRuntimeChatCompletionRequest as C, ExtensionsInput as E, ForwardedParametersInput as F, RemoteChainParameters as R, CopilotRuntimeChatCompletionResponse as a, CopilotServiceAdapter as b, RemoteChain as c, AgentSessionInput as d, AgentStateInput as e, RuntimeEventSource as f, ExtensionsResponse as g };
@@ -1,11 +1,11 @@
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-8c442d65.js';
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-7a82cd22.js';
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-628cc60c.js';
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-acb6ed0b.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';
6
6
  export { copilotRuntimeNestEndpoint } from './integrations/nest/index.js';
7
7
  import '@copilotkit/shared';
8
- import '../langserve-e308c437.js';
8
+ import '../langserve-9614171f.js';
9
9
  import '../index-a7f37670.js';
10
10
  import '../graphql/types/base/index.js';
11
11
  import 'rxjs';
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.5.14",
47
+ version: "1.5.15-next.1",
48
48
  sideEffects: false,
49
49
  main: "./dist/index.js",
50
50
  module: "./dist/index.mjs",
@@ -2876,6 +2876,7 @@ var CopilotRuntime = class {
2876
2876
  langserve = [];
2877
2877
  onBeforeRequest;
2878
2878
  onAfterRequest;
2879
+ delegateAgentProcessingToServiceAdapter;
2879
2880
  constructor(params) {
2880
2881
  var _a, _b;
2881
2882
  this.actions = (params == null ? void 0 : params.actions) || [];
@@ -2886,13 +2887,14 @@ var CopilotRuntime = class {
2886
2887
  this.remoteEndpointDefinitions = (params == null ? void 0 : params.remoteEndpoints) ?? (params == null ? void 0 : params.remoteActions) ?? [];
2887
2888
  this.onBeforeRequest = (_a = params == null ? void 0 : params.middleware) == null ? void 0 : _a.onBeforeRequest;
2888
2889
  this.onAfterRequest = (_b = params == null ? void 0 : params.middleware) == null ? void 0 : _b.onAfterRequest;
2890
+ this.delegateAgentProcessingToServiceAdapter = (params == null ? void 0 : params.delegateAgentProcessingToServiceAdapter) || false;
2889
2891
  }
2890
2892
  async processRuntimeRequest(request) {
2891
2893
  var _a;
2892
- const { serviceAdapter, messages: rawMessages, actions: clientSideActionsInput, threadId, runId, outputMessagesPromise, graphqlContext, forwardedParameters, agentSession, url, extensions } = request;
2894
+ const { serviceAdapter, messages: rawMessages, actions: clientSideActionsInput, threadId, runId, outputMessagesPromise, graphqlContext, forwardedParameters, url, extensions, agentSession, agentStates } = request;
2893
2895
  const eventSource = new RuntimeEventSource();
2894
2896
  try {
2895
- if (agentSession) {
2897
+ if (agentSession && !this.delegateAgentProcessingToServiceAdapter) {
2896
2898
  return await this.processAgentRequest(request);
2897
2899
  }
2898
2900
  if (serviceAdapter instanceof EmptyAdapter) {
@@ -2931,7 +2933,9 @@ please use an LLM adapter instead.`
2931
2933
  runId,
2932
2934
  eventSource,
2933
2935
  forwardedParameters,
2934
- extensions
2936
+ extensions,
2937
+ agentSession,
2938
+ agentStates
2935
2939
  });
2936
2940
  const nonEmptyThreadId = threadId ?? result.threadId;
2937
2941
  outputMessagesPromise.then((outputMessages) => {