feat(core): refine shell tool description display logic (#24903)

This commit is contained in:
Jarrod Whelan
2026-04-08 16:40:43 -07:00
committed by GitHub
parent 9c4e17b7ce
commit bc3ed61adb
2 changed files with 47 additions and 29 deletions
+7 -3
View File
@@ -63,6 +63,7 @@ export const OUTPUT_UPDATE_INTERVAL_MS = 1000;
// Delay so user does not see the output of the process before the process is moved to the background.
const BACKGROUND_DELAY_MS = 200;
const SHOW_NL_DESCRIPTION_THRESHOLD = 150;
export interface ShellToolParams {
command: string;
@@ -136,9 +137,12 @@ export class ShellToolInvocation extends BaseToolInvocation<
}
getDescription(): string {
return this.params.description?.trim()
? this.params.description
: this.params.command;
const descStr = this.params.description?.trim();
const commandStr = this.params.command;
return Array.from(commandStr).length <= SHOW_NL_DESCRIPTION_THRESHOLD ||
!descStr
? commandStr
: descStr;
}
private simplifyPaths(paths: Set<string>): string[] {