Skip to content

Commit d16ae1f

Browse files
committed
bash truncate character max instead of line max
1 parent 14e00a0 commit d16ae1f

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

packages/opencode/src/tool/bash.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { Wildcard } from "../util/wildcard"
1212
import { $ } from "bun"
1313
import { Agent } from "../agent/agent"
1414

15+
const MAX_OUTPUT_LENGTH = 30_000
1516
const DEFAULT_TIMEOUT = 1 * 60 * 1000
1617
const MAX_TIMEOUT = 10 * 60 * 1000
1718

@@ -153,10 +154,9 @@ export const BashTool = Tool.define("bash", {
153154
},
154155
})
155156

156-
const lines = output.split("\n")
157-
if (lines.length > 1000) {
158-
output = lines.slice(0, 1000).join("\n")
159-
output += "\n\n(Ouput was truncated)"
157+
if (output.length > MAX_OUTPUT_LENGTH) {
158+
output = output.slice(0, MAX_OUTPUT_LENGTH)
159+
output += "\n\n(Output was truncated due to length limit)"
160160
}
161161

162162
return {

0 commit comments

Comments
 (0)