@@ -10,8 +10,8 @@ import {
1010 BASH_MAX_LINE_BYTES ,
1111 BASH_MAX_TOTAL_BYTES ,
1212 BASH_MAX_FILE_BYTES ,
13- BASH_TRUNCATE_HARD_MAX_LINES ,
1413 BASH_TRUNCATE_MAX_TOTAL_BYTES ,
14+ BASH_TRUNCATE_MAX_FILE_BYTES ,
1515} from "@/constants/toolLimits" ;
1616
1717import type { BashToolResult } from "@/types/tools" ;
@@ -62,13 +62,14 @@ class DisposableProcess implements Disposable {
6262 */
6363export const createBashTool : ToolFactory = ( config : ToolConfiguration ) => {
6464 // Select limits based on overflow policy
65- // truncate = IPC calls (generous limits for UI features)
65+ // truncate = IPC calls (generous limits for UI features, no line limit )
6666 // tmpfile = AI agent calls (conservative limits for LLM context)
6767 const overflowPolicy = config . overflow_policy ?? "tmpfile" ;
6868 const maxTotalBytes =
6969 overflowPolicy === "truncate" ? BASH_TRUNCATE_MAX_TOTAL_BYTES : BASH_MAX_TOTAL_BYTES ;
70- const maxLines =
71- overflowPolicy === "truncate" ? BASH_TRUNCATE_HARD_MAX_LINES : BASH_HARD_MAX_LINES ;
70+ const maxFileBytes =
71+ overflowPolicy === "truncate" ? BASH_TRUNCATE_MAX_FILE_BYTES : BASH_MAX_FILE_BYTES ;
72+ const maxLines = overflowPolicy === "truncate" ? Infinity : BASH_HARD_MAX_LINES ;
7273
7374 return tool ( {
7475 description : TOOL_DEFINITIONS . bash . description + "\nRuns in " + config . cwd + " - no cd needed" ,
@@ -248,9 +249,9 @@ export const createBashTool: ToolFactory = (config: ToolConfiguration) => {
248249 totalBytesAccumulated += lineBytes + 1 ; // +1 for newline
249250
250251 // Check file limit first (hard stop)
251- if ( totalBytesAccumulated > BASH_MAX_FILE_BYTES ) {
252+ if ( totalBytesAccumulated > maxFileBytes ) {
252253 triggerFileTruncation (
253- `Total output exceeded file preservation limit: ${ totalBytesAccumulated } bytes > ${ BASH_MAX_FILE_BYTES } bytes (at line ${ lines . length } )`
254+ `Total output exceeded file preservation limit: ${ totalBytesAccumulated } bytes > ${ maxFileBytes } bytes (at line ${ lines . length } )`
254255 ) ;
255256 return ;
256257 }
@@ -290,9 +291,9 @@ export const createBashTool: ToolFactory = (config: ToolConfiguration) => {
290291 totalBytesAccumulated += lineBytes + 1 ; // +1 for newline
291292
292293 // Check file limit first (hard stop)
293- if ( totalBytesAccumulated > BASH_MAX_FILE_BYTES ) {
294+ if ( totalBytesAccumulated > maxFileBytes ) {
294295 triggerFileTruncation (
295- `Total output exceeded file preservation limit: ${ totalBytesAccumulated } bytes > ${ BASH_MAX_FILE_BYTES } bytes (at line ${ lines . length } )`
296+ `Total output exceeded file preservation limit: ${ totalBytesAccumulated } bytes > ${ maxFileBytes } bytes (at line ${ lines . length } )`
296297 ) ;
297298 return ;
298299 }
0 commit comments