Skip to main content

Module tool_output

Module tool_output 

Source
Expand description

Tool output truncation with head+tail sampling.

When tool output exceeds configured limits, the content is truncated using a head+tail sampling strategy: the first half of allowed lines and the last half are preserved, with a truncation marker in between. Full output is written to a file for later inspection.

Ported from OpenCode V2’s ToolOutputStore.bound().

Structs§

ToolOutputConfig
Configuration for tool output truncation.
TruncationResult
Result of tool output truncation.

Constants§

DEFAULT_MAX_BYTES
Maximum bytes before truncation applies (default).
DEFAULT_MAX_LINES
Maximum lines before truncation applies (default).

Functions§

truncate_output
Applies head+tail sampling truncation to tool output.