@copilotkit/runtime 1.8.7-next.0 → 1.8.8-next.0

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 (37) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/dist/{chunk-RU5CS42E.mjs → chunk-5TUGSSSM.mjs} +2 -2
  3. package/dist/{chunk-CWPYW7XE.mjs → chunk-62XKONGF.mjs} +2 -2
  4. package/dist/{chunk-JSV26III.mjs → chunk-XXKM3PJL.mjs} +22 -14
  5. package/dist/chunk-XXKM3PJL.mjs.map +1 -0
  6. package/dist/{chunk-BXJZ5GEO.mjs → chunk-YM7JEVJF.mjs} +2 -2
  7. package/dist/index.d.ts +1 -1
  8. package/dist/index.js +21 -13
  9. package/dist/index.js.map +1 -1
  10. package/dist/index.mjs +4 -4
  11. package/dist/lib/index.d.ts +1 -1
  12. package/dist/lib/index.js +21 -13
  13. package/dist/lib/index.js.map +1 -1
  14. package/dist/lib/index.mjs +4 -4
  15. package/dist/lib/integrations/index.d.ts +2 -2
  16. package/dist/lib/integrations/index.js +1 -1
  17. package/dist/lib/integrations/index.js.map +1 -1
  18. package/dist/lib/integrations/index.mjs +4 -4
  19. package/dist/lib/integrations/nest/index.d.ts +1 -1
  20. package/dist/lib/integrations/nest/index.js +1 -1
  21. package/dist/lib/integrations/nest/index.js.map +1 -1
  22. package/dist/lib/integrations/nest/index.mjs +2 -2
  23. package/dist/lib/integrations/node-express/index.d.ts +1 -1
  24. package/dist/lib/integrations/node-express/index.js +1 -1
  25. package/dist/lib/integrations/node-express/index.js.map +1 -1
  26. package/dist/lib/integrations/node-express/index.mjs +2 -2
  27. package/dist/lib/integrations/node-http/index.d.ts +1 -1
  28. package/dist/lib/integrations/node-http/index.js +1 -1
  29. package/dist/lib/integrations/node-http/index.js.map +1 -1
  30. package/dist/lib/integrations/node-http/index.mjs +1 -1
  31. package/dist/{shared-350db43f.d.ts → shared-e61e0ebb.d.ts} +4 -4
  32. package/package.json +2 -2
  33. package/src/lib/runtime/copilot-runtime.ts +34 -24
  34. package/dist/chunk-JSV26III.mjs.map +0 -1
  35. /package/dist/{chunk-RU5CS42E.mjs.map → chunk-5TUGSSSM.mjs.map} +0 -0
  36. /package/dist/{chunk-CWPYW7XE.mjs.map → chunk-62XKONGF.mjs.map} +0 -0
  37. /package/dist/{chunk-BXJZ5GEO.mjs.map → chunk-YM7JEVJF.mjs.map} +0 -0
@@ -2,7 +2,7 @@ import {
2
2
  copilotRuntimeNodeHttpEndpoint,
3
3
  getRuntimeInstanceTelemetryInfo,
4
4
  telemetry_client_default
5
- } from "./chunk-JSV26III.mjs";
5
+ } from "./chunk-XXKM3PJL.mjs";
6
6
  import {
7
7
  __name
8
8
  } from "./chunk-FHD4JECV.mjs";
@@ -22,4 +22,4 @@ __name(copilotRuntimeNestEndpoint, "copilotRuntimeNestEndpoint");
22
22
  export {
23
23
  copilotRuntimeNestEndpoint
24
24
  };
25
- //# sourceMappingURL=chunk-BXJZ5GEO.mjs.map
25
+ //# sourceMappingURL=chunk-YM7JEVJF.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-53d3fa48.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, g as getCommonConfig, n as langGraphPlatformEndpoint, r as resolveEndpointType } from './shared-350db43f.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, g as getCommonConfig, n as langGraphPlatformEndpoint, r as resolveEndpointType } from './shared-e61e0ebb.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.8.7-next.0",
47
+ version: "1.8.8-next.0",
48
48
  sideEffects: false,
49
49
  main: "./dist/index.js",
50
50
  module: "./dist/index.mjs",
@@ -4809,7 +4809,7 @@ var CopilotRuntime = class {
4809
4809
  observability;
4810
4810
  availableAgents;
4811
4811
  // +++ MCP Properties +++
4812
- mcpEndpointsConfig;
4812
+ mcpServersConfig;
4813
4813
  mcpActionCache = /* @__PURE__ */ new Map();
4814
4814
  // --- MCP Properties ---
4815
4815
  // +++ MCP Client Factory +++
@@ -4832,14 +4832,14 @@ var CopilotRuntime = class {
4832
4832
  this.delegateAgentProcessingToServiceAdapter = (params == null ? void 0 : params.delegateAgentProcessingToServiceAdapter) || false;
4833
4833
  this.observability = params == null ? void 0 : params.observability_c;
4834
4834
  this.agents = (params == null ? void 0 : params.agents) ?? {};
4835
- this.mcpEndpointsConfig = params == null ? void 0 : params.mcpEndpoints;
4835
+ this.mcpServersConfig = params == null ? void 0 : params.mcpServers;
4836
4836
  this.createMCPClientImpl = params == null ? void 0 : params.createMCPClient;
4837
- if (this.mcpEndpointsConfig && this.mcpEndpointsConfig.length > 0 && !this.createMCPClientImpl) {
4837
+ if (this.mcpServersConfig && this.mcpServersConfig.length > 0 && !this.createMCPClientImpl) {
4838
4838
  throw new import_shared20.CopilotKitMisuseError({
4839
- message: "MCP Integration Error: `mcpEndpoints` were provided, but the `createMCPClient` function was not passed to the CopilotRuntime constructor. Please provide an implementation for `createMCPClient`."
4839
+ message: "MCP Integration Error: `mcpServers` were provided, but the `createMCPClient` function was not passed to the CopilotRuntime constructor. Please provide an implementation for `createMCPClient`."
4840
4840
  });
4841
4841
  }
4842
- if ((params == null ? void 0 : params.actions) && (((_c = params == null ? void 0 : params.remoteEndpoints) == null ? void 0 : _c.some((e) => e.type === EndpointType.LangGraphPlatform)) || ((_d = this.mcpEndpointsConfig) == null ? void 0 : _d.length))) {
4842
+ if ((params == null ? void 0 : params.actions) && (((_c = params == null ? void 0 : params.remoteEndpoints) == null ? void 0 : _c.some((e) => e.type === EndpointType.LangGraphPlatform)) || ((_d = this.mcpServersConfig) == null ? void 0 : _d.length))) {
4843
4843
  console.warn("Local 'actions' defined in CopilotRuntime might not be available to remote agents (LangGraph, MCP). Consider defining actions closer to the agent implementation if needed.");
4844
4844
  }
4845
4845
  }
@@ -4849,7 +4849,11 @@ var CopilotRuntime = class {
4849
4849
  if (!mcpActionsForRequest || mcpActionsForRequest.length === 0) {
4850
4850
  return messages;
4851
4851
  }
4852
- const mcpToolInstructions = mcpActionsForRequest.map((action) => {
4852
+ const uniqueMcpTools = /* @__PURE__ */ new Map();
4853
+ mcpActionsForRequest.forEach((action) => {
4854
+ uniqueMcpTools.set(action.name, action);
4855
+ });
4856
+ const mcpToolInstructions = Array.from(uniqueMcpTools.values()).map((action) => {
4853
4857
  const paramsString = action.parameters && action.parameters.length > 0 ? ` Parameters: ${action.parameters.map((p) => `${p.name}${p.required ? "*" : ""}(${p.type})`).join(", ")}` : "";
4854
4858
  return `- ${action.name}:${paramsString} ${action.description || ""}`;
4855
4859
  }).join("\n");
@@ -5432,7 +5436,7 @@ please use an LLM adapter instead.`
5432
5436
  }
5433
5437
  }
5434
5438
  async getServerSideActions(request) {
5435
- var _a;
5439
+ var _a, _b;
5436
5440
  const { graphqlContext, messages: rawMessages, agentStates, url } = request;
5437
5441
  const inputMessages = convertGqlInputToMessages(rawMessages);
5438
5442
  const langserveFunctions = [];
@@ -5462,11 +5466,17 @@ please use an LLM adapter instead.`
5462
5466
  }) : this.actions;
5463
5467
  const requestSpecificMCPActions = [];
5464
5468
  if (this.createMCPClientImpl) {
5465
- const baseEndpoints = this.mcpEndpointsConfig || [];
5466
- const requestEndpoints = ((_a = graphqlContext.properties) == null ? void 0 : _a.mcpEndpoints) || [];
5469
+ const baseEndpoints = this.mcpServersConfig || [];
5470
+ const requestEndpoints = ((_a = graphqlContext.properties) == null ? void 0 : _a.mcpServers) || ((_b = graphqlContext.properties) == null ? void 0 : _b.mcpEndpoints) || [];
5467
5471
  const effectiveEndpointsMap = /* @__PURE__ */ new Map();
5468
5472
  [
5469
- ...baseEndpoints,
5473
+ ...baseEndpoints
5474
+ ].forEach((ep) => {
5475
+ if (ep && ep.endpoint) {
5476
+ effectiveEndpointsMap.set(ep.endpoint, ep);
5477
+ }
5478
+ });
5479
+ [
5470
5480
  ...requestEndpoints
5471
5481
  ].forEach((ep) => {
5472
5482
  if (ep && ep.endpoint) {
@@ -5480,12 +5490,10 @@ please use an LLM adapter instead.`
5480
5490
  if (!actionsForEndpoint) {
5481
5491
  let client = null;
5482
5492
  try {
5483
- console.log(`MCP: Cache miss. Fetching tools for endpoint: ${endpointUrl}`);
5484
5493
  client = await this.createMCPClientImpl(config2);
5485
5494
  const tools = await client.tools();
5486
5495
  actionsForEndpoint = convertMCPToolsToActions(tools, endpointUrl);
5487
5496
  this.mcpActionCache.set(endpointUrl, actionsForEndpoint);
5488
- console.log(`MCP: Fetched and cached ${actionsForEndpoint.length} tools for ${endpointUrl}`);
5489
5497
  } catch (error) {
5490
5498
  console.error(`MCP: Failed to fetch tools from endpoint ${endpointUrl}. Skipping. Error:`, error);
5491
5499
  actionsForEndpoint = [];