diff --git a/packages/opencode/src/tool/bash.ts b/packages/opencode/src/tool/bash.ts index 50ae4abac8d..916ea88d9d1 100644 --- a/packages/opencode/src/tool/bash.ts +++ b/packages/opencode/src/tool/bash.ts @@ -73,9 +73,11 @@ export const BashTool = Tool.define("bash", async () => { .string() .describe( "Clear, concise description of what this command does in 5-10 words. Examples:\nInput: ls\nOutput: Lists files in current directory\n\nInput: git status\nOutput: Shows working tree status\n\nInput: npm install\nOutput: Installs package dependencies\n\nInput: mkdir foo\nOutput: Creates directory 'foo'", - ), + ) + .optional(), }), async execute(params, ctx) { + const description = params.description ?? params.command const cwd = params.workdir || Instance.directory if (params.timeout !== undefined && params.timeout < 0) { throw new Error(`Invalid timeout value: ${params.timeout}. Timeout must be a positive number.`) @@ -182,7 +184,7 @@ export const BashTool = Tool.define("bash", async () => { ctx.metadata({ metadata: { output: "", - description: params.description, + description: description, }, }) @@ -192,7 +194,7 @@ export const BashTool = Tool.define("bash", async () => { metadata: { // truncate the metadata to avoid GIANT blobs of data (has nothing to do w/ what agent can access) output: output.length > MAX_METADATA_LENGTH ? output.slice(0, MAX_METADATA_LENGTH) + "\n\n..." : output, - description: params.description, + description: description, }, }) } @@ -257,11 +259,11 @@ export const BashTool = Tool.define("bash", async () => { } return { - title: params.description, + title: description, metadata: { output: output.length > MAX_METADATA_LENGTH ? output.slice(0, MAX_METADATA_LENGTH) + "\n\n..." : output, exit: proc.exitCode, - description: params.description, + description: description, }, output, }