refactor(shell): centralize shell tool identity

Move shell tool ID checks behind shared helpers so runtime code and tests stop duplicating bash, pwsh, and powershell branches. This keeps shell-specific behavior aligned across consumers and makes follow-on shell changes less error-prone.
This commit is contained in:
LukeParkerDev 2026-04-03 14:56:40 +10:00
commit 2eb9ae4d34
19 changed files with 99 additions and 92 deletions

View file

@ -278,6 +278,14 @@ function agentTitle(i18n: UiI18n, type?: string) {
export function getToolInfo(tool: string, input: any = {}): ToolInfo {
const i18n = useI18n()
if (SHELL.has(tool)) {
return {
icon: "console",
title: i18n.t("ui.tool.shell"),
subtitle: input.description,
}
}
switch (tool) {
case "read":
return {
@ -332,14 +340,6 @@ export function getToolInfo(tool: string, input: any = {}): ToolInfo {
subtitle: input.description,
}
}
case "bash":
case "pwsh":
case "powershell":
return {
icon: "console",
title: i18n.t("ui.tool.shell"),
subtitle: input.description,
}
case "edit":
return {
icon: "code-lines",