- Renamed the `find` and `search` tools to `glob` and `grep` respectively across the codebase to improve command clarity. - Implemented full-stack support for the renamed tools, including CLI arguments, system prompts, SDK exports, and tool registration. - Added automated migration logic in `settings` to transform legacy `find` and `search` configuration keys to their new equivalents. - Updated the `collab-web` renderer registry to ensure backwards compatibility with legacy tool outputs.
59 lines
1.2 KiB
TypeScript
59 lines
1.2 KiB
TypeScript
export const BUILTIN_TOOL_NAMES = [
|
|
"read",
|
|
"bash",
|
|
"edit",
|
|
"ast_grep",
|
|
"ast_edit",
|
|
"ask",
|
|
"debug",
|
|
"eval",
|
|
"ssh",
|
|
"github",
|
|
"glob",
|
|
"grep",
|
|
"lsp",
|
|
"inspect_image",
|
|
"browser",
|
|
"checkpoint",
|
|
"rewind",
|
|
"task",
|
|
"job",
|
|
"irc",
|
|
"todo",
|
|
"web_search",
|
|
"search_tool_bm25",
|
|
"write",
|
|
"memory_edit",
|
|
"retain",
|
|
"recall",
|
|
"reflect",
|
|
"learn",
|
|
"manage_skill",
|
|
] as const;
|
|
|
|
export type BuiltinToolName = (typeof BUILTIN_TOOL_NAMES)[number];
|
|
|
|
const LEGACY_BUILTIN_TOOL_NAME_ALIASES: ReadonlyMap<string, BuiltinToolName> = new Map([
|
|
["search", "grep"],
|
|
["find", "glob"],
|
|
]);
|
|
|
|
/** Return the canonical tool name for current and legacy built-in tool IDs. */
|
|
export function normalizeToolName(name: string): string {
|
|
const normalized = name.toLowerCase();
|
|
return LEGACY_BUILTIN_TOOL_NAME_ALIASES.get(normalized) ?? normalized;
|
|
}
|
|
|
|
/** Normalize and deduplicate tool names while preserving first-seen order. */
|
|
export function normalizeToolNames(names: Iterable<string>): string[] {
|
|
const out: string[] = [];
|
|
const seen = new Set<string>();
|
|
for (const name of names) {
|
|
const normalized = normalizeToolName(name);
|
|
if (seen.has(normalized)) continue;
|
|
seen.add(normalized);
|
|
out.push(normalized);
|
|
}
|
|
return out;
|
|
}
|