fix(core): allow toolkit replacement to retain tool names
Replacing a toolkit with the same toolkit name and tool names returns false, leaving the old schema and implementation in use. addToolkit() checks the incoming names against the toolkit it is supposed to replace, even though its documented behavior permits replacement.
Check standalone user/provider tools and other toolkits for conflicts, excluding only the toolkit being replaced. Validate before mutating the registry so a rejected replacement preserves the existing toolkit. Include a patch changeset for @voltagent/core.
Validation:
- Five new regressions cover same-name user/provider replacement, executing the updated user tool, other-toolkit conflicts, and standalone user/provider conflicts added after the original toolkit.
- On unchanged main, the two replacement regressions fail (24 manager tests pass); with the fix, all 55 tests across tool construction, tool management, and UI tool parsing pass.
- Core
tsc --noEmit, a separate strict type check including the changed spec, and Biome checks for both changed TypeScript files pass.
Tests use Node 22.18.0, Vitest 3.2.4 and isolated dependencies with the affected AI SDK versions taken from the upstream lockfile. Vitest uses --configLoader runner to avoid a Windows config-bundling access error. The full monorepo build/test suite was not run.
AI assistance was used for the implementation and tests; the final change and conflict boundaries were reviewed and the real repository tests rerun.
Summary by cubic
Fixes addToolkit() so replacing a toolkit with the same name and tool names succeeds instead of returning false and leaving the old schema and implementation in use.
Conflict checks now exclude only the toolkit being replaced, while still rejecting collisions with standalone user/provider tools and other toolkits. Validation runs before the registry is mutated, so a rejected replacement preserves the existing toolkit. Five regression tests cover user and provider tool replacement plus conflict cases, and a patch changeset is added for @voltagent/core.
Summary by CodeRabbit
- Bug Fixes
- Replacing a toolkit now succeeds when its tools retain the same names, including names shared with provider-defined tools.
- Replacements are rejected if they conflict with tools from another toolkit or standalone tools. Existing toolkits remain intact when a replacement is rejected.