Merge branch 'dev' into bash-tweaks

This commit is contained in:
Aiden Cline
2025-12-05 14:42:23 -06:00
82 changed files with 1427 additions and 275 deletions
+13 -11
View File
@@ -239,13 +239,15 @@ export const BashTool = Tool.define("bash", async () => {
})
const append = (chunk: Buffer) => {
output += chunk.toString()
ctx.metadata({
metadata: {
output,
description: params.description,
},
})
if (output.length <= MAX_OUTPUT_LENGTH) {
output += chunk.toString()
ctx.metadata({
metadata: {
output,
description: params.description,
},
})
}
}
proc.stdout?.on("data", append)
@@ -300,7 +302,7 @@ export const BashTool = Tool.define("bash", async () => {
const timeoutTimer = setTimeout(() => {
timedOut = true
void killTree()
}, timeout)
}, timeout + 100)
await new Promise<void>((resolve, reject) => {
const cleanup = () => {
@@ -325,15 +327,15 @@ export const BashTool = Tool.define("bash", async () => {
if (output.length > MAX_OUTPUT_LENGTH) {
output = output.slice(0, MAX_OUTPUT_LENGTH)
resultMetadata.push(`Output exceeded length limit of ${MAX_OUTPUT_LENGTH} chars`)
resultMetadata.push(`bash tool truncated output as it exceeded ${MAX_OUTPUT_LENGTH} char limit`)
}
if (timedOut) {
resultMetadata.push(`Command terminated after exceeding timeout ${timeout} ms`)
resultMetadata.push(`bash tool terminated commmand after exceeding timeout ${timeout} ms`)
}
if (aborted) {
resultMetadata.push("Command aborted by user")
resultMetadata.push("User aborted the command")
}
if (resultMetadata.length > 1) {