* feat: add tool prompt overrides support in YAML model config
Adds per-model tool prompt overrides under chatOptions in YAML config:
```yaml
models:
- name: my-model
chatOptions:
toolPromptOverrides:
run_terminal_command:
description: "Custom description"
view_diff:
disabled: true
```
This replaces the JSON-only implementation with YAML-only support as
requested by maintainers. The JSON implementation is preserved on the
`feature/tool-prompt-overrides-json` branch for reference.
Changes:
- Add toolOverrideSchema to chatOptionsSchema (packages/config-yaml)
- Add ToolOverride interface and toolPromptOverrides to LLMOptions (core)
- Store and apply overrides in BaseLLM.streamChat()
- Add applyToolOverrides utility with comprehensive tests
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* feat(cli): add tool prompt overrides support for CLI parity
Apply toolPromptOverrides from YAML model config in CLI,
ensuring feature parity with VS Code extension.
- Add applyChatCompletionToolOverrides helper for CLI tool format
- Apply overrides in streamChatResponse before LLM calls
- Support description changes and disabling tools
- Add unit tests for override logic
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* chore: package lock update
* ci: retrigger after hub 502
* refactor: rename toolPromptOverrides to toolOverrides
- Rename property across core, config-yaml, and CLI
- Consolidate ToolOverride type to extend ToolOverrideConfig from
config-yaml instead of duplicating 7 fields
- Inline record-to-array conversion to match file patterns
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* chore: retrigger CI (clean run)
* chore: revert gui package-lock to main
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Co-authored-by: Dallin Romney <dallinromney@gmail.com>
69 lines
2 KiB
TypeScript
69 lines
2 KiB
TypeScript
import { ConfigValidationError } from "@continuedev/config-yaml";
|
|
import { Tool, ToolOverride } from "..";
|
|
|
|
export interface ApplyToolOverridesResult {
|
|
tools: Tool[];
|
|
errors: ConfigValidationError[];
|
|
}
|
|
|
|
/**
|
|
* Applies tool overrides from config to the list of tools.
|
|
* Overrides can modify tool descriptions, display titles, action phrases,
|
|
* system message descriptions, or disable tools entirely.
|
|
*/
|
|
export function applyToolOverrides(
|
|
tools: Tool[],
|
|
overrides: ToolOverride[] | undefined,
|
|
): ApplyToolOverridesResult {
|
|
if (!overrides?.length) {
|
|
return { tools, errors: [] };
|
|
}
|
|
|
|
const errors: ConfigValidationError[] = [];
|
|
const toolsByName = new Map(tools.map((t) => [t.function.name, t]));
|
|
|
|
for (const override of overrides) {
|
|
const tool = toolsByName.get(override.name);
|
|
|
|
if (!tool) {
|
|
errors.push({
|
|
fatal: false,
|
|
message: `Tool override "${override.name}" does not match any known tool. Available tools: ${Array.from(toolsByName.keys()).join(", ")}`,
|
|
});
|
|
continue;
|
|
}
|
|
|
|
if (override.disabled) {
|
|
toolsByName.delete(override.name);
|
|
continue;
|
|
}
|
|
|
|
const updatedTool: Tool = {
|
|
...tool,
|
|
function: {
|
|
...tool.function,
|
|
description: override.description ?? tool.function.description,
|
|
},
|
|
displayTitle: override.displayTitle ?? tool.displayTitle,
|
|
wouldLikeTo: override.wouldLikeTo ?? tool.wouldLikeTo,
|
|
isCurrently: override.isCurrently ?? tool.isCurrently,
|
|
hasAlready: override.hasAlready ?? tool.hasAlready,
|
|
};
|
|
|
|
if (override.systemMessageDescription) {
|
|
updatedTool.systemMessageDescription = {
|
|
prefix:
|
|
override.systemMessageDescription.prefix ??
|
|
tool.systemMessageDescription?.prefix ??
|
|
"",
|
|
exampleArgs:
|
|
override.systemMessageDescription.exampleArgs ??
|
|
tool.systemMessageDescription?.exampleArgs,
|
|
};
|
|
}
|
|
|
|
toolsByName.set(override.name, updatedTool);
|
|
}
|
|
|
|
return { tools: Array.from(toolsByName.values()), errors };
|
|
}
|