Expand description
Shared truncation utilities (core/tools/truncate.ts).
Tools return bounded output: read/write/ls use head-truncation,
bash uses tail-truncation (keep the most recent output), and grep
truncates long individual lines.
Structs§
Constants§
- DEFAULT_
MAX_ BYTES - Default byte cap for tool output (50 KiB). Matches pi’s
core/tools/truncate.ts. - DEFAULT_
MAX_ LINES - Default line cap for tool output (matches Claude Code / pi).
- GREP_
MAX_ LINE_ LENGTH - Maximum length of a single grep result line. Matches pi’s
GREP_MAX_LINE_LENGTH.
Functions§
- format_
size - Human-readable byte size, e.g. “12.3KB”.
- truncate_
head - Truncate from the head (keep the first lines), used by read/write/ls.
Stops at whichever limit is hit first:
max_linesormax_bytes. - truncate_
line - Truncate a single (possibly very long) line for grep output.
- truncate_
tail - Truncate from the tail (keep the most recent output), used by bash.