( r: ExecuteResult, stdoutCap: number, stderrCap: number, )
| 523 | } |
| 524 | |
| 525 | function buildTruncationNote( |
| 526 | r: ExecuteResult, |
| 527 | stdoutCap: number, |
| 528 | stderrCap: number, |
| 529 | ): string | undefined { |
| 530 | if (!r.stdoutTruncated && !r.stderrTruncated && !r.killedForOversize) { |
| 531 | return undefined; |
| 532 | } |
| 533 | const parts: string[] = []; |
| 534 | if (r.stdoutTruncated) { |
| 535 | parts.push( |
| 536 | `stdout exceeded ${formatBytes(stdoutCap)} cap (${formatBytes(r.stdoutTotalBytes)} total)`, |
| 537 | ); |
| 538 | } |
| 539 | if (r.stderrTruncated) { |
| 540 | parts.push( |
| 541 | `stderr exceeded ${formatBytes(stderrCap)} cap (${formatBytes(r.stderrTotalBytes)} total)`, |
| 542 | ); |
| 543 | } |
| 544 | if (r.killedForOversize) { |
| 545 | parts.push('command was killed for runaway output'); |
| 546 | } |
| 547 | return ( |
| 548 | parts.join('; ') + |
| 549 | '. Use head/tail/grep/sed -n to narrow the next call, or redirect to a file and read a slice.' |
| 550 | ); |
| 551 | } |
| 552 | |
| 553 | // ============ Tool Execution ============ |
| 554 |
no test coverage detected