@copilotkit/core 1.72.0 → 1.72.1-canary.sp-longthread-perf

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.
package/dist/index.umd.js CHANGED
@@ -751,11 +751,11 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
751
751
  var _ProxiedCopilotRuntimeAgent_brand = /* @__PURE__ */ new WeakSet();
752
752
  var ProxiedCopilotRuntimeAgent = class ProxiedCopilotRuntimeAgent extends _ag_ui_client.HttpAgent {
753
753
  constructor(config) {
754
- var _config$transport, _ref, _config$runtimeAgentI, _ref2, _config$runtimeMode;
754
+ var _config$transport, _ref, _config$runtimeAgentI, _config$runtimeUrl, _config$runtimeMode;
755
755
  const normalizedRuntimeUrl = config.runtimeUrl ? config.runtimeUrl.replace(/\/$/, "") : void 0;
756
756
  const transport = (_config$transport = config.transport) !== null && _config$transport !== void 0 ? _config$transport : "auto";
757
757
  const routedId = (_ref = (_config$runtimeAgentI = config.runtimeAgentId) !== null && _config$runtimeAgentI !== void 0 ? _config$runtimeAgentI : config.agentId) !== null && _ref !== void 0 ? _ref : "";
758
- const runUrl = transport === "single" ? (_ref2 = normalizedRuntimeUrl !== null && normalizedRuntimeUrl !== void 0 ? normalizedRuntimeUrl : config.runtimeUrl) !== null && _ref2 !== void 0 ? _ref2 : "" : `${normalizedRuntimeUrl !== null && normalizedRuntimeUrl !== void 0 ? normalizedRuntimeUrl : config.runtimeUrl}/agent/${encodeURIComponent(routedId)}/run`;
758
+ const runUrl = transport === "single" ? (_config$runtimeUrl = config.runtimeUrl) !== null && _config$runtimeUrl !== void 0 ? _config$runtimeUrl : "" : `${normalizedRuntimeUrl !== null && normalizedRuntimeUrl !== void 0 ? normalizedRuntimeUrl : config.runtimeUrl}/agent/${encodeURIComponent(routedId)}/run`;
759
759
  if (!runUrl) throw new Error("ProxiedCopilotRuntimeAgent requires a runtimeUrl when transport is set to 'single'.");
760
760
  super({
761
761
  ...config,
@@ -766,6 +766,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
766
766
  _defineProperty(this, "credentials", void 0);
767
767
  _defineProperty(this, "runtimeAgentId", void 0);
768
768
  _defineProperty(this, "transport", void 0);
769
+ _defineProperty(this, "runtimeEndpointUrl", void 0);
769
770
  _defineProperty(this, "singleEndpointUrl", void 0);
770
771
  _defineProperty(this, "runtimeMode", void 0);
771
772
  _defineProperty(this, "intelligence", void 0);
@@ -773,6 +774,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
773
774
  _defineProperty(this, "delegate", void 0);
774
775
  _defineProperty(this, "runtimeInfoPromise", void 0);
775
776
  this.runtimeUrl = normalizedRuntimeUrl !== null && normalizedRuntimeUrl !== void 0 ? normalizedRuntimeUrl : config.runtimeUrl;
777
+ this.runtimeEndpointUrl = config.runtimeUrl;
776
778
  this.credentials = config.credentials;
777
779
  this.runtimeAgentId = config.runtimeAgentId;
778
780
  this.transport = transport;
@@ -780,7 +782,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
780
782
  this.intelligence = config.intelligence;
781
783
  this._capabilities = config.capabilities;
782
784
  if (config.debug) this.debug = config.debug;
783
- if (this.transport === "single") this.singleEndpointUrl = this.runtimeUrl;
785
+ if (this.transport === "single") this.singleEndpointUrl = this.runtimeEndpointUrl;
784
786
  }
785
787
  /**
786
788
  * The agent id used for outbound runtime requests — `runtimeAgentId` when
@@ -911,8 +913,9 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
911
913
  return _assertClassBrand(_ProxiedCopilotRuntimeAgent_brand, this, _runViaHttp).call(this, input);
912
914
  }
913
915
  clone() {
916
+ var _this$runtimeEndpoint;
914
917
  const cloned = new ProxiedCopilotRuntimeAgent({
915
- runtimeUrl: this.runtimeUrl,
918
+ runtimeUrl: (_this$runtimeEndpoint = this.runtimeEndpointUrl) !== null && _this$runtimeEndpoint !== void 0 ? _this$runtimeEndpoint : this.runtimeUrl,
916
919
  agentId: this.agentId,
917
920
  runtimeAgentId: this.runtimeAgentId,
918
921
  description: this.description,
@@ -988,7 +991,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
988
991
  if (this.transport === "single") {
989
992
  if (!this.singleEndpointUrl) throw new Error("Single endpoint transport requires a runtimeUrl");
990
993
  if (!headers["Content-Type"]) headers["Content-Type"] = "application/json";
991
- url = this.runtimeUrl;
994
+ url = this.singleEndpointUrl;
992
995
  init = {
993
996
  method: "POST",
994
997
  body: JSON.stringify({ method: "info" })
@@ -1006,6 +1009,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
1006
1009
  return await response.json();
1007
1010
  }
1008
1011
  async fetchRuntimeInfoAutoDetect(headers) {
1012
+ var _this$runtimeEndpoint2;
1009
1013
  try {
1010
1014
  const response = await this.fetch(`${this.runtimeUrl}/info`, {
1011
1015
  headers: { ...headers },
@@ -1018,7 +1022,8 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
1018
1022
  } catch (_unused) {}
1019
1023
  const singleHeaders = { ...headers };
1020
1024
  if (!singleHeaders["Content-Type"]) singleHeaders["Content-Type"] = "application/json";
1021
- const response = await this.fetch(this.runtimeUrl, {
1025
+ const endpointUrl = (_this$runtimeEndpoint2 = this.runtimeEndpointUrl) !== null && _this$runtimeEndpoint2 !== void 0 ? _this$runtimeEndpoint2 : this.runtimeUrl;
1026
+ const response = await this.fetch(endpointUrl, {
1022
1027
  method: "POST",
1023
1028
  headers: singleHeaders,
1024
1029
  body: JSON.stringify({ method: "info" }),
@@ -1026,7 +1031,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
1026
1031
  });
1027
1032
  if (!response.ok) throw await runtimeInfoError(response);
1028
1033
  this.transport = "single";
1029
- this.singleEndpointUrl = this.runtimeUrl;
1034
+ this.singleEndpointUrl = endpointUrl;
1030
1035
  return await response.json();
1031
1036
  }
1032
1037
  createSingleRouteRequestInit(input, method, params) {
@@ -1223,6 +1228,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
1223
1228
  _defineProperty(this, "remoteAgents", {});
1224
1229
  _defineProperty(this, "mintedThreadIds", /* @__PURE__ */ new WeakMap());
1225
1230
  _defineProperty(this, "_runtimeUrl", void 0);
1231
+ _defineProperty(this, "_runtimeEndpointUrl", void 0);
1226
1232
  _defineProperty(this, "_connectionInFlight", void 0);
1227
1233
  _defineProperty(this, "_runtimeConnectionGeneration", 0);
1228
1234
  _defineProperty(this, "_activeRuntimeConnectionAttempt", void 0);
@@ -1345,7 +1351,8 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
1345
1351
  */
1346
1352
  setRuntimeUrl(runtimeUrl, options) {
1347
1353
  const normalizedRuntimeUrl = runtimeUrl ? runtimeUrl.replace(/\/$/, "") : void 0;
1348
- if (this._runtimeUrl === normalizedRuntimeUrl) return;
1354
+ const runtimeEndpointUrl = runtimeUrl || void 0;
1355
+ if (this._runtimeUrl === normalizedRuntimeUrl && this._runtimeEndpointUrl === runtimeEndpointUrl) return;
1349
1356
  this.invalidateInspectorMetadataConnection();
1350
1357
  this.abandonRuntimeHealthProbe();
1351
1358
  this.resetRuntimeEntitlementRetry();
@@ -1353,6 +1360,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
1353
1360
  this._runtimeEntitlements = void 0;
1354
1361
  this._singleRouteResourceOperations = false;
1355
1362
  this._runtimeUrl = normalizedRuntimeUrl;
1363
+ this._runtimeEndpointUrl = runtimeEndpointUrl;
1356
1364
  if (options === null || options === void 0 ? void 0 : options.deferConnection) return;
1357
1365
  this.updateRuntimeConnection({ preserveOnFailure: this.hasLiveRuntimeKnowledgeToProtect() });
1358
1366
  }
@@ -1468,11 +1476,12 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
1468
1476
  * from the registry and emits `onAgentsChanged`.
1469
1477
  */
1470
1478
  registerProxiedAgent({ agentId, runtimeAgentId }) {
1479
+ var _this$_runtimeEndpoin;
1471
1480
  if (Object.prototype.hasOwnProperty.call(this._agents, agentId)) throw new Error(`CopilotKitCore.registerProxiedAgent: agentId "${agentId}" is already registered. Pick a different agentId, or unregister the existing agent first.`);
1472
1481
  const friends = this.core;
1473
1482
  const debug = friends.debug;
1474
1483
  const agent = new ProxiedCopilotRuntimeAgent({
1475
- runtimeUrl: this._runtimeUrl,
1484
+ runtimeUrl: (_this$_runtimeEndpoin = this._runtimeEndpointUrl) !== null && _this$_runtimeEndpoin !== void 0 ? _this$_runtimeEndpoin : this._runtimeUrl,
1476
1485
  agentId,
1477
1486
  runtimeAgentId,
1478
1487
  transport: this._runtimeTransport,
@@ -1553,8 +1562,8 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
1553
1562
  const meta = () => runtimeRequestMeta(init);
1554
1563
  const watchdog = this.armRuntimeRequestWatchdog(meta());
1555
1564
  try {
1556
- var _meta;
1557
- const singleRouteRequest = this._runtimeTransport === "single" && this._singleRouteResourceOperations && this._runtimeUrl ? await createSingleRouteResourceRequest(input, init, this._runtimeUrl) : null;
1565
+ var _this$_runtimeEndpoin2, _meta;
1566
+ const singleRouteRequest = this._runtimeTransport === "single" && this._singleRouteResourceOperations && this._runtimeUrl ? await createSingleRouteResourceRequest(input, init, (_this$_runtimeEndpoin2 = this._runtimeEndpointUrl) !== null && _this$_runtimeEndpoin2 !== void 0 ? _this$_runtimeEndpoin2 : this._runtimeUrl) : null;
1558
1567
  const response = singleRouteRequest ? await fetch(singleRouteRequest.input, singleRouteRequest.init) : await fetch(input, init);
1559
1568
  watchdog.clear();
1560
1569
  this.handleRuntimeRequestOutcome(response.ok ? "ok" : ((_meta = meta()) === null || _meta === void 0 ? void 0 : _meta.nonCritical) ? "ignored" : "failed", watchdog.checked);
@@ -1646,7 +1655,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
1646
1655
  try {
1647
1656
  const request = (async () => {
1648
1657
  const response = resolvedTransport === "single" ? await this.fetchInspectorMetadataSingle({
1649
- runtimeUrl,
1658
+ runtimeUrl: this.singleEndpointUrlFor(runtimeUrl),
1650
1659
  headers,
1651
1660
  credentials,
1652
1661
  signal: abortController.signal
@@ -1845,14 +1854,14 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
1845
1854
  }
1846
1855
  /** Return the stable key that scopes connection and entitlement retries. */
1847
1856
  runtimeConnectionKey() {
1848
- var _this$_runtimeUrl;
1849
- return `${(_this$_runtimeUrl = this._runtimeUrl) !== null && _this$_runtimeUrl !== void 0 ? _this$_runtimeUrl : ""}::${this._requestedTransport}`;
1857
+ var _ref, _this$_runtimeEndpoin3;
1858
+ return `${(_ref = (_this$_runtimeEndpoin3 = this._runtimeEndpointUrl) !== null && _this$_runtimeEndpoin3 !== void 0 ? _this$_runtimeEndpoin3 : this._runtimeUrl) !== null && _ref !== void 0 ? _ref : ""}::${this._requestedTransport}`;
1850
1859
  }
1851
1860
  /** Return whether a proxy still targets this Runtime connection. */
1852
1861
  canReuseRuntimeAgent(agent, runtimeUrl, transport) {
1853
1862
  if (!runtimeUrl) return false;
1854
1863
  const connection = this.remoteAgentConnections.get(agent);
1855
- return (connection === null || connection === void 0 ? void 0 : connection.runtimeUrl) === runtimeUrl.replace(/\/$/, "") && connection.transport === transport;
1864
+ return (connection === null || connection === void 0 ? void 0 : connection.runtimeUrl) === runtimeUrl.replace(/\/$/, "") && connection.endpointUrl === this._runtimeEndpointUrl && connection.transport === transport;
1856
1865
  }
1857
1866
  /** Return whether an async attempt still owns the active Runtime state. */
1858
1867
  isCurrentRuntimeConnection(attempt) {
@@ -1929,7 +1938,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
1929
1938
  await this.notifyRuntimeStatusChanged(CopilotKitCoreRuntimeConnectionStatus.Connecting);
1930
1939
  if (!this.isCurrentRuntimeConnection(attempt)) return;
1931
1940
  try {
1932
- var _runtimeInfoResponse$2, _runtimeInfoResponse$3, _runtimeInfoResponse$4, _runtimeInfoResponse$5, _ref, _a2uiInfo$enabled, _runtimeInfoResponse$6, _runtimeInfoResponse$7;
1941
+ var _runtimeInfoResponse$2, _runtimeInfoResponse$3, _runtimeInfoResponse$4, _runtimeInfoResponse$5, _ref2, _a2uiInfo$enabled, _runtimeInfoResponse$6, _runtimeInfoResponse$7;
1933
1942
  if (inspectorMetadataConnectionGeneration !== this.inspectorMetadataConnectionGeneration) return;
1934
1943
  const { runtimeInfo: runtimeInfoResponse, resolvedTransport } = (options === null || options === void 0 ? void 0 : options.recovery) ? await this.fetchRuntimeInfoWithTimeout(new AbortController(), runtimeUrl, transport) : await this.fetchRuntimeInfo(runtimeUrl, transport);
1935
1944
  if (!this.isCurrentRuntimeConnection(attempt) || inspectorMetadataConnectionGeneration !== this.inspectorMetadataConnectionGeneration) return;
@@ -1938,7 +1947,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
1938
1947
  const credentials = this.core.credentials;
1939
1948
  const rawDebug = this.core.debug;
1940
1949
  const agents = Object.fromEntries(Object.entries(runtimeInfo.agents).map(([id, { description, capabilities }]) => {
1941
- var _runtimeInfoResponse$;
1950
+ var _this$_runtimeEndpoin4, _runtimeInfoResponse$;
1942
1951
  const existing = Object.prototype.hasOwnProperty.call(this.remoteAgents, id) ? this.remoteAgents[id] : void 0;
1943
1952
  if (existing instanceof ProxiedCopilotRuntimeAgent && this.canReuseRuntimeAgent(existing, runtimeUrl, this._runtimeTransport)) {
1944
1953
  this.applyHeadersToAgent(existing);
@@ -1947,7 +1956,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
1947
1956
  return [id, existing];
1948
1957
  }
1949
1958
  const agent = new ProxiedCopilotRuntimeAgent({
1950
- runtimeUrl,
1959
+ runtimeUrl: (_this$_runtimeEndpoin4 = this._runtimeEndpointUrl) !== null && _this$_runtimeEndpoin4 !== void 0 ? _this$_runtimeEndpoin4 : runtimeUrl,
1951
1960
  agentId: id,
1952
1961
  description,
1953
1962
  transport: this._runtimeTransport,
@@ -1967,6 +1976,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
1967
1976
  }
1968
1977
  this.remoteAgentConnections.set(agent, {
1969
1978
  runtimeUrl,
1979
+ endpointUrl: this._runtimeEndpointUrl,
1970
1980
  transport: this._runtimeTransport
1971
1981
  });
1972
1982
  return [id, agent];
@@ -1989,7 +1999,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
1989
1999
  this.inspectorMetadataRefreshReady = false;
1990
2000
  if (!this._inspectorMetadataSupported) this.setInspectorMetadata(void 0);
1991
2001
  const a2uiInfo = runtimeInfoResponse.a2ui;
1992
- this._a2uiEnabled = (_ref = (_a2uiInfo$enabled = a2uiInfo === null || a2uiInfo === void 0 ? void 0 : a2uiInfo.enabled) !== null && _a2uiInfo$enabled !== void 0 ? _a2uiInfo$enabled : runtimeInfoResponse.a2uiEnabled) !== null && _ref !== void 0 ? _ref : false;
2002
+ this._a2uiEnabled = (_ref2 = (_a2uiInfo$enabled = a2uiInfo === null || a2uiInfo === void 0 ? void 0 : a2uiInfo.enabled) !== null && _a2uiInfo$enabled !== void 0 ? _a2uiInfo$enabled : runtimeInfoResponse.a2uiEnabled) !== null && _ref2 !== void 0 ? _ref2 : false;
1993
2003
  this._a2uiAgents = (a2uiInfo === null || a2uiInfo === void 0 ? void 0 : a2uiInfo.enabled) ? a2uiInfo.agents : void 0;
1994
2004
  this._openGenerativeUIEnabled = (_runtimeInfoResponse$6 = runtimeInfoResponse.openGenerativeUIEnabled) !== null && _runtimeInfoResponse$6 !== void 0 ? _runtimeInfoResponse$6 : false;
1995
2005
  this._licenseStatus = runtimeInfoResponse.licenseStatus;
@@ -2048,7 +2058,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2048
2058
  const credentials = this.core.credentials;
2049
2059
  const headers = { ...baseHeaders };
2050
2060
  if (runtimeTransport === "single") return {
2051
- runtimeInfo: await this.fetchRuntimeInfoSingle(runtimeUrl, headers, credentials, signal),
2061
+ runtimeInfo: await this.fetchRuntimeInfoSingle(this.singleEndpointUrlFor(runtimeUrl), headers, credentials, signal),
2052
2062
  resolvedTransport: "single"
2053
2063
  };
2054
2064
  if (runtimeTransport === "auto") return this.fetchRuntimeInfoAutoDetect(runtimeUrl, headers, credentials, signal);
@@ -2063,6 +2073,15 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2063
2073
  resolvedTransport: "rest"
2064
2074
  };
2065
2075
  }
2076
+ /**
2077
+ * The URL a single-route request targets: the runtime URL as the caller
2078
+ * supplied it. `runtimeUrl` is the slash-stripped form used for path joins;
2079
+ * a trailing slash can select a different proxy location, so the endpoint
2080
+ * itself keeps it.
2081
+ */
2082
+ singleEndpointUrlFor(runtimeUrl) {
2083
+ return this._runtimeEndpointUrl !== void 0 && this._runtimeUrl === runtimeUrl ? this._runtimeEndpointUrl : runtimeUrl;
2084
+ }
2066
2085
  async fetchRuntimeInfoSingle(runtimeUrl, headers, credentials, signal) {
2067
2086
  const response = await fetch(runtimeUrl, {
2068
2087
  method: "POST",
@@ -2092,7 +2111,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2092
2111
  };
2093
2112
  } catch (_unused2) {}
2094
2113
  return {
2095
- runtimeInfo: await this.fetchRuntimeInfoSingle(runtimeUrl, { ...headers }, credentials, signal),
2114
+ runtimeInfo: await this.fetchRuntimeInfoSingle(this.singleEndpointUrlFor(runtimeUrl), { ...headers }, credentials, signal),
2096
2115
  resolvedTransport: "single"
2097
2116
  };
2098
2117
  }
@@ -2767,6 +2786,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2767
2786
  _defineProperty(this, "_catalogComponents", []);
2768
2787
  _defineProperty(this, "_disabledCatalogComponents", /* @__PURE__ */ new Set());
2769
2788
  _defineProperty(this, "_disabledToolKeys", /* @__PURE__ */ new Set());
2789
+ _defineProperty(this, "_warnedMissingToolParameters", /* @__PURE__ */ new Set());
2770
2790
  _defineProperty(this, "_runAbortController", null);
2771
2791
  _defineProperty(this, "_runDepth", 0);
2772
2792
  _defineProperty(this, "_webmcpRegistry", new WebMCPRegistry());
@@ -2824,6 +2844,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2824
2844
  initialize(tools) {
2825
2845
  this._propTools = [...tools];
2826
2846
  this._cachedMergedTools = null;
2847
+ this.warnOnMissingToolParameters(this._propTools);
2827
2848
  this.syncWebMCP();
2828
2849
  }
2829
2850
  /**
@@ -2838,9 +2859,39 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2838
2859
  }
2839
2860
  this._hookTools.set(key, tool);
2840
2861
  this._cachedMergedTools = null;
2862
+ this.warnOnMissingToolParameters([tool]);
2841
2863
  this.syncWebMCP();
2842
2864
  }
2843
2865
  /**
2866
+ * Report, once per tool and at development time only, a tool registered with
2867
+ * no `parameters` schema.
2868
+ *
2869
+ * `createToolSchema` substitutes `{ type: "object", properties: {} }` for a
2870
+ * missing `parameters` and returns silently, and `parameters` is optional on
2871
+ * `FrontendTool`, so nothing — not the compiler, not the runtime — tells the
2872
+ * developer that the model was handed a tool with nothing to fill in. It then
2873
+ * calls the tool with no arguments. `useComponent`, `useFrontendTool` and
2874
+ * `useHumanInTheLoop` all funnel into {@link addTool}; the provider's `tools`
2875
+ * prop funnels into {@link initialize} and {@link setTools}.
2876
+ *
2877
+ * A parameterless tool is legitimate (a HITL confirm dialog, say), so this
2878
+ * stays a warning rather than an error. An explicit empty schema
2879
+ * (`parameters: z.object({})`) is the way to say "takes none on purpose": it
2880
+ * satisfies the check below and `createToolSchema` reduces it to the same
2881
+ * advertised `{ type: "object", properties: {} }` that omitting `parameters`
2882
+ * produces, so silencing the warning costs nothing on the wire.
2883
+ */
2884
+ warnOnMissingToolParameters(tools) {
2885
+ if (process.env.NODE_ENV === "production") return;
2886
+ for (const tool of tools) {
2887
+ if (tool.parameters) continue;
2888
+ const key = this.capabilityKey(tool.name, tool.agentId);
2889
+ if (this._warnedMissingToolParameters.has(key)) continue;
2890
+ this._warnedMissingToolParameters.add(key);
2891
+ _copilotkit_shared.logger.warn(`Tool has no parameters schema: '${tool.name}' for agent '${tool.agentId || "global"}'. The model is told it takes no arguments and will call it with none. Add \`parameters\` (a Zod or Standard Schema object) if it should receive arguments, or \`parameters: z.object({})\` to declare that it takes none and silence this warning.`);
2892
+ }
2893
+ }
2894
+ /**
2844
2895
  * Remove a tool by name and optionally by agentId
2845
2896
  */
2846
2897
  removeTool(id, agentId) {
@@ -2873,6 +2924,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2873
2924
  setTools(tools) {
2874
2925
  this._propTools = [...tools];
2875
2926
  this._cachedMergedTools = null;
2927
+ this.warnOnMissingToolParameters(this._propTools);
2876
2928
  this.syncWebMCP();
2877
2929
  }
2878
2930
  /**