@copilotkit/runtime 1.5.15-next.0 → 1.5.15-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 (41) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/{chunk-R4IWQ7LJ.mjs → chunk-4KT3HMC3.mjs} +9 -5
  3. package/dist/{chunk-R4IWQ7LJ.mjs.map → chunk-4KT3HMC3.mjs.map} +1 -1
  4. package/dist/{chunk-3BDPYDPV.mjs → chunk-C2HNOETE.mjs} +2 -2
  5. package/dist/{chunk-YHARJIII.mjs → chunk-I33ESKDS.mjs} +2 -2
  6. package/dist/{chunk-EXFQ543B.mjs → chunk-OTB2F27M.mjs} +2 -2
  7. package/dist/{copilot-runtime-8c442d65.d.ts → copilot-runtime-e6c34790.d.ts} +4 -13
  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/lib/runtime/remote-actions.ts +1 -1
  38. package/src/service-adapters/service-adapter.ts +4 -0
  39. /package/dist/{chunk-3BDPYDPV.mjs.map → chunk-C2HNOETE.mjs.map} +0 -0
  40. /package/dist/{chunk-YHARJIII.mjs.map → chunk-I33ESKDS.mjs.map} +0 -0
  41. /package/dist/{chunk-EXFQ543B.mjs.map → chunk-OTB2F27M.mjs.map} +0 -0
@@ -2,7 +2,7 @@ import {
2
2
  copilotRuntimeNodeHttpEndpoint,
3
3
  getRuntimeInstanceTelemetryInfo,
4
4
  telemetry_client_default
5
- } from "./chunk-R4IWQ7LJ.mjs";
5
+ } from "./chunk-4KT3HMC3.mjs";
6
6
  import {
7
7
  __name
8
8
  } from "./chunk-44O2JGUY.mjs";
@@ -22,4 +22,4 @@ __name(copilotRuntimeNestEndpoint, "copilotRuntimeNestEndpoint");
22
22
  export {
23
23
  copilotRuntimeNestEndpoint
24
24
  };
25
- //# sourceMappingURL=chunk-3BDPYDPV.mjs.map
25
+ //# sourceMappingURL=chunk-C2HNOETE.mjs.map
@@ -2,7 +2,7 @@ import {
2
2
  getCommonConfig,
3
3
  getRuntimeInstanceTelemetryInfo,
4
4
  telemetry_client_default
5
- } from "./chunk-R4IWQ7LJ.mjs";
5
+ } from "./chunk-4KT3HMC3.mjs";
6
6
  import {
7
7
  __name
8
8
  } from "./chunk-44O2JGUY.mjs";
@@ -77,4 +77,4 @@ export {
77
77
  config,
78
78
  copilotRuntimeNextJSPagesRouterEndpoint
79
79
  };
80
- //# sourceMappingURL=chunk-YHARJIII.mjs.map
80
+ //# sourceMappingURL=chunk-I33ESKDS.mjs.map
@@ -2,7 +2,7 @@ import {
2
2
  copilotRuntimeNodeHttpEndpoint,
3
3
  getRuntimeInstanceTelemetryInfo,
4
4
  telemetry_client_default
5
- } from "./chunk-R4IWQ7LJ.mjs";
5
+ } from "./chunk-4KT3HMC3.mjs";
6
6
  import {
7
7
  __name
8
8
  } from "./chunk-44O2JGUY.mjs";
@@ -22,4 +22,4 @@ __name(copilotRuntimeNodeExpressEndpoint, "copilotRuntimeNodeExpressEndpoint");
22
22
  export {
23
23
  copilotRuntimeNodeExpressEndpoint
24
24
  };
25
- //# sourceMappingURL=chunk-EXFQ543B.mjs.map
25
+ //# sourceMappingURL=chunk-OTB2F27M.mjs.map
@@ -1,5 +1,5 @@
1
1
  import { Parameter, Action } from '@copilotkit/shared';
2
- import { b as CopilotServiceAdapter, R as RemoteChainParameters, A as ActionInput, F as ForwardedParametersInput, E as ExtensionsInput, d as RuntimeEventSource, e as ExtensionsResponse } from './langserve-e308c437.js';
2
+ import { b as CopilotServiceAdapter, R as RemoteChainParameters, A as ActionInput, d as AgentSessionInput, e as AgentStateInput, F as ForwardedParametersInput, E as ExtensionsInput, f as RuntimeEventSource, g as ExtensionsResponse } from './langserve-9614171f.js';
3
3
  import { M as MessageInput, a as Message } from './index-a7f37670.js';
4
4
  import * as graphql from 'graphql';
5
5
  import * as pino from 'pino';
@@ -37,11 +37,6 @@ type CommonConfig = {
37
37
  };
38
38
  declare function getCommonConfig(options: CreateCopilotRuntimeServerOptions): CommonConfig;
39
39
 
40
- declare class AgentStateInput {
41
- agentName: string;
42
- state: string;
43
- }
44
-
45
40
  type EndpointDefinition = CopilotKitEndpoint | LangGraphPlatformEndpoint;
46
41
  declare enum EndpointType {
47
42
  CopilotKit = "copilotKit",
@@ -65,16 +60,10 @@ interface LangGraphPlatformAgent {
65
60
  }
66
61
  interface LangGraphPlatformEndpoint extends BaseEndpointDefinition<EndpointType.LangGraphPlatform> {
67
62
  deploymentUrl: string;
68
- langsmithApiKey: string;
63
+ langsmithApiKey?: string;
69
64
  agents: LangGraphPlatformAgent[];
70
65
  }
71
66
 
72
- declare class AgentSessionInput {
73
- agentName: string;
74
- threadId?: string;
75
- nodeName?: string;
76
- }
77
-
78
67
  declare class Agent {
79
68
  id: string;
80
69
  name: string;
@@ -187,6 +176,7 @@ interface CopilotRuntimeConstructorParams<T extends Parameter[] | [] = []> {
187
176
  remoteActions?: CopilotKitEndpoint[];
188
177
  remoteEndpoints?: EndpointDefinition[];
189
178
  langserve?: RemoteChainParameters[];
179
+ delegateAgentProcessingToServiceAdapter?: boolean;
190
180
  }
191
181
  declare class CopilotRuntime<const T extends Parameter[] | [] = []> {
192
182
  actions: ActionsConfiguration<T>;
@@ -194,6 +184,7 @@ declare class CopilotRuntime<const T extends Parameter[] | [] = []> {
194
184
  private langserve;
195
185
  private onBeforeRequest?;
196
186
  private onAfterRequest?;
187
+ private delegateAgentProcessingToServiceAdapter;
197
188
  constructor(params?: CopilotRuntimeConstructorParams<T>);
198
189
  processRuntimeRequest(request: CopilotRuntimeRequest): Promise<CopilotRuntimeResponse>;
199
190
  discoverAgentsFromEndpoints(graphqlContext: GraphQLContext): Promise<AgentWithEndpoint[]>;
@@ -1,5 +1,5 @@
1
1
  import OpenAI from 'openai';
2
- import { b as CopilotServiceAdapter, C as CopilotRuntimeChatCompletionRequest, a as CopilotRuntimeChatCompletionResponse } from './langserve-e308c437.js';
2
+ import { b as CopilotServiceAdapter, C as CopilotRuntimeChatCompletionRequest, a as CopilotRuntimeChatCompletionResponse } from './langserve-9614171f.js';
3
3
  import { BaseMessageChunk, AIMessage, AIMessageChunk, BaseMessage } from '@langchain/core/messages';
4
4
  import { DynamicStructuredTool } from '@langchain/core/tools';
5
5
  import { IterableReadableStream, IterableReadableStreamInterface } from '@langchain/core/utils/stream';
package/dist/index.d.ts CHANGED
@@ -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-e6c34790.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 './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';
6
6
  export { copilotRuntimeNestEndpoint } from './lib/integrations/nest/index.js';
7
7
  export { GuardrailsValidationFailureResponse, MessageStreamInterruptedResponse, UnknownErrorResponse } from './utils/index.js';
8
- export { C as CopilotRuntimeChatCompletionRequest, a as CopilotRuntimeChatCompletionResponse, b as CopilotServiceAdapter, c as RemoteChain, R as RemoteChainParameters } from './langserve-e308c437.js';
8
+ export { C as CopilotRuntimeChatCompletionRequest, a as CopilotRuntimeChatCompletionResponse, b as CopilotServiceAdapter, c as RemoteChain, R as RemoteChainParameters } from './langserve-9614171f.js';
9
9
  export { AnthropicAdapter, AnthropicAdapterParams, EmptyAdapter, ExperimentalEmptyAdapter, ExperimentalOllamaAdapter } from './service-adapters/index.js';
10
10
  import '@copilotkit/shared';
11
11
  import './index-a7f37670.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.15-next.0",
47
+ version: "1.5.15-next.2",
48
48
  sideEffects: false,
49
49
  main: "./dist/index.js",
50
50
  module: "./dist/index.mjs",
@@ -3212,6 +3212,7 @@ var CopilotRuntime = class {
3212
3212
  langserve = [];
3213
3213
  onBeforeRequest;
3214
3214
  onAfterRequest;
3215
+ delegateAgentProcessingToServiceAdapter;
3215
3216
  constructor(params) {
3216
3217
  var _a, _b;
3217
3218
  this.actions = (params == null ? void 0 : params.actions) || [];
@@ -3222,13 +3223,14 @@ var CopilotRuntime = class {
3222
3223
  this.remoteEndpointDefinitions = (params == null ? void 0 : params.remoteEndpoints) ?? (params == null ? void 0 : params.remoteActions) ?? [];
3223
3224
  this.onBeforeRequest = (_a = params == null ? void 0 : params.middleware) == null ? void 0 : _a.onBeforeRequest;
3224
3225
  this.onAfterRequest = (_b = params == null ? void 0 : params.middleware) == null ? void 0 : _b.onAfterRequest;
3226
+ this.delegateAgentProcessingToServiceAdapter = (params == null ? void 0 : params.delegateAgentProcessingToServiceAdapter) || false;
3225
3227
  }
3226
3228
  async processRuntimeRequest(request) {
3227
3229
  var _a;
3228
- const { serviceAdapter, messages: rawMessages, actions: clientSideActionsInput, threadId, runId, outputMessagesPromise, graphqlContext, forwardedParameters, agentSession, url, extensions } = request;
3230
+ const { serviceAdapter, messages: rawMessages, actions: clientSideActionsInput, threadId, runId, outputMessagesPromise, graphqlContext, forwardedParameters, url, extensions, agentSession, agentStates } = request;
3229
3231
  const eventSource = new RuntimeEventSource();
3230
3232
  try {
3231
- if (agentSession) {
3233
+ if (agentSession && !this.delegateAgentProcessingToServiceAdapter) {
3232
3234
  return await this.processAgentRequest(request);
3233
3235
  }
3234
3236
  if (serviceAdapter instanceof EmptyAdapter) {
@@ -3267,7 +3269,9 @@ please use an LLM adapter instead.`
3267
3269
  runId,
3268
3270
  eventSource,
3269
3271
  forwardedParameters,
3270
- extensions
3272
+ extensions,
3273
+ agentSession,
3274
+ agentStates
3271
3275
  });
3272
3276
  const nonEmptyThreadId = threadId ?? result.threadId;
3273
3277
  outputMessagesPromise.then((outputMessages) => {