Skip to main content

Module truncation

Module truncation 

Source
Expand description

Tool output truncation with temp file overflow.

When tool output exceeds size limits (lines or bytes), the full output is saved to a temp file under ~/.opendev/tool-output/ and the agent receives a truncated preview plus the file path for follow-up reads.

Mirrors OpenCode’s Truncate system.

Structs§

TruncateResult
Result of a truncation attempt.

Enums§

TruncateDirection
Direction from which to keep lines when truncating.

Constants§

MAX_BYTES
Maximum output size in bytes before truncation (50 KB).
MAX_LINES
Maximum number of lines before truncation.

Functions§

cleanup_old_files
Clean up overflow files older than the retention period (7 days).
output_dir
Get the directory for storing truncated tool output.
truncate_output
Truncate tool output if it exceeds size limits.