mirror of
https://github.com/sst/opencode.git
synced 2025-12-23 10:11:41 +00:00
tweak: bash tool messages regarding timeouts and truncation more clear for agent (#5066)
This commit is contained in:
parent
350a32274a
commit
a607f33552
1 changed files with 10 additions and 3 deletions
|
|
@ -316,17 +316,24 @@ export const BashTool = Tool.define("bash", async () => {
|
|||
})
|
||||
})
|
||||
|
||||
let resultMetadata: String[] = ["<bash_metadata>"]
|
||||
|
||||
if (output.length > MAX_OUTPUT_LENGTH) {
|
||||
output = output.slice(0, MAX_OUTPUT_LENGTH)
|
||||
output += "\n\n(Output was truncated due to length limit)"
|
||||
resultMetadata.push(`Output exceeded length limit of ${MAX_OUTPUT_LENGTH} chars`)
|
||||
}
|
||||
|
||||
if (timedOut) {
|
||||
output += `\n\n(Command timed out after ${timeout} ms)`
|
||||
resultMetadata.push(`Command terminated after exceeding timeout ${timeout} ms`)
|
||||
}
|
||||
|
||||
if (aborted) {
|
||||
output += "\n\n(Command was aborted)"
|
||||
resultMetadata.push("Command aborted by user")
|
||||
}
|
||||
|
||||
if (resultMetadata.length > 1) {
|
||||
resultMetadata.push("</bash_metadata>")
|
||||
output += "\n\n" + resultMetadata.join("\n")
|
||||
}
|
||||
|
||||
return {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue