@voltagent/core 2.6.1 → 2.6.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.
package/dist/index.js CHANGED
@@ -33802,18 +33802,18 @@ ${retrieverContext}`;
33802
33802
  const toolRouting = this.resolveToolRouting(options);
33803
33803
  oc.systemContext.set(TOOL_ROUTING_CONTEXT_KEY, toolRouting);
33804
33804
  if (toolRouting === false) {
33805
- const supportNames = this.getToolRoutingSupportToolNames();
33806
- const allNames = /* @__PURE__ */ new Set([
33807
- ...Object.keys(preparedStaticTools),
33808
- ...Object.keys(preparedDynamicTools)
33809
- ]);
33810
- const conflicts = [...allNames].filter((name) => supportNames.has(name));
33811
- if (conflicts.length > 0) {
33805
+ const conflicts = /* @__PURE__ */ new Set();
33806
+ for (const tool2 of [...this.toolManager.getAllTools(), ...tempManager.getAllTools()]) {
33807
+ if (this.isToolRoutingSupportTool(tool2)) {
33808
+ conflicts.add(tool2.name);
33809
+ }
33810
+ }
33811
+ if (conflicts.size > 0) {
33812
33812
  throw new Error(
33813
33813
  [
33814
- "toolRouting is disabled but reserved routing tool names are in use:",
33815
- conflicts.join(", "),
33816
- "Rename these tools or enable toolRouting to use the built-in names."
33814
+ "toolRouting is disabled but internal routing support tools are in use:",
33815
+ Array.from(conflicts).join(", "),
33816
+ "Enable toolRouting or remove internal routing tools before disabling it for this request."
33817
33817
  ].join(" ")
33818
33818
  );
33819
33819
  }
@@ -34086,10 +34086,7 @@ ${retrieverContext}`;
34086
34086
  if (!tool2 || typeof tool2 !== "object") {
34087
34087
  return false;
34088
34088
  }
34089
- if (TOOL_ROUTING_INTERNAL_TOOL_SYMBOL in tool2) {
34090
- return true;
34091
- }
34092
- return tool2.name === TOOL_ROUTING_SEARCH_TOOL_NAME || tool2.name === TOOL_ROUTING_CALL_TOOL_NAME;
34089
+ return Object.prototype.hasOwnProperty.call(tool2, TOOL_ROUTING_INTERNAL_TOOL_SYMBOL);
34093
34090
  }
34094
34091
  isToolExecutableForRouting(tool2) {
34095
34092
  if (isProviderTool(tool2)) {
@@ -35165,12 +35162,12 @@ ${retrieverContext}`;
35165
35162
  const memoryInstance = activeMemory || void 0;
35166
35163
  const toolRoutingConfig = this.toolRouting && typeof this.toolRouting === "object" ? this.toolRouting : void 0;
35167
35164
  const toolRoutingState = toolRoutingConfig ? (() => {
35168
- const supportNames = this.getToolRoutingSupportToolNames();
35169
35165
  const searchTool = this.toolManager.getToolByName(TOOL_ROUTING_SEARCH_TOOL_NAME);
35170
35166
  const callTool = this.toolManager.getToolByName(TOOL_ROUTING_CALL_TOOL_NAME);
35171
35167
  const searchApiTool = searchTool && this.isToolRoutingSupportTool(searchTool) ? new ToolManager([searchTool], this.logger).getToolsForApi()[0] : void 0;
35172
35168
  const callApiTool = callTool && this.isToolRoutingSupportTool(callTool) ? new ToolManager([callTool], this.logger).getToolsForApi()[0] : void 0;
35173
- const poolApiTools = this.toolPoolManager.getToolsForApi().filter((tool2) => !supportNames.has(tool2.name));
35169
+ const poolTools = this.toolPoolManager.getAllTools().filter((tool2) => !this.isToolRoutingSupportTool(tool2));
35170
+ const poolApiTools = poolTools.length > 0 ? new ToolManager(poolTools, this.logger).getToolsForApi() : [];
35174
35171
  const exposeApiTools = toolRoutingConfig.expose && toolRoutingConfig.expose.length > 0 ? new ToolManager(toolRoutingConfig.expose, this.logger).getToolsForApi() : [];
35175
35172
  return {
35176
35173
  search: searchApiTool,
@@ -35476,9 +35473,10 @@ ${retrieverContext}`;
35476
35473
  upsertToolRoutingSupportTool(tool2) {
35477
35474
  const existing = this.toolManager.getToolByName(tool2.name);
35478
35475
  if (existing && !this.isToolRoutingSupportTool(existing)) {
35479
- throw new Error(
35480
- `Tool routing requires reserved tool name "${tool2.name}". Rename the conflicting tool to enable tool routing.`
35476
+ this.logger.debug(
35477
+ `Tool routing support tool "${tool2.name}" not added because a user-defined tool with the same name exists.`
35481
35478
  );
35479
+ return;
35482
35480
  }
35483
35481
  if (existing && this.isToolRoutingSupportTool(existing)) {
35484
35482
  this.toolManager.removeTool(tool2.name);