limit bash tool to 1000 lines of output
This commit is contained in:
@@ -12,7 +12,6 @@ import { Wildcard } from "../util/wildcard"
|
|||||||
import { $ } from "bun"
|
import { $ } from "bun"
|
||||||
import { Agent } from "../agent/agent"
|
import { Agent } from "../agent/agent"
|
||||||
|
|
||||||
const MAX_OUTPUT_LENGTH = 30000
|
|
||||||
const DEFAULT_TIMEOUT = 1 * 60 * 1000
|
const DEFAULT_TIMEOUT = 1 * 60 * 1000
|
||||||
const MAX_TIMEOUT = 10 * 60 * 1000
|
const MAX_TIMEOUT = 10 * 60 * 1000
|
||||||
|
|
||||||
@@ -107,7 +106,6 @@ export const BashTool = Tool.define("bash", {
|
|||||||
const process = exec(params.command, {
|
const process = exec(params.command, {
|
||||||
cwd: app.path.cwd,
|
cwd: app.path.cwd,
|
||||||
signal: ctx.abort,
|
signal: ctx.abort,
|
||||||
maxBuffer: MAX_OUTPUT_LENGTH,
|
|
||||||
timeout,
|
timeout,
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -155,6 +153,12 @@ export const BashTool = Tool.define("bash", {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const lines = output.split("\n")
|
||||||
|
if (lines.length > 1000) {
|
||||||
|
output = lines.slice(0, 1000).join("\n")
|
||||||
|
output += "\n\n(Ouput was truncated)"
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
title: params.command,
|
title: params.command,
|
||||||
metadata: {
|
metadata: {
|
||||||
|
|||||||
Reference in New Issue
Block a user