Expand description
Configurable output size limits for agent safety.
When output exceeds the threshold the result is capped and ExecResult.out
is replaced with a head+tail preview. Two strategies, selected at runtime by
SpillMode:
SpillMode::Disk(default): the full output is written to a spill file on the real filesystem and the preview points at it. The agent can then selectively read the file.SpillMode::Memory: the output is truncated in memory only — no disk I/O, no recoverable file. For runtime read-only kernels (e.g. kaibo) that must not touch the host filesystem even whenlocalfsis compiled in. Memory stays bounded regardless of how much the command produces.
Either way the exit code is remapped to 3 (did_spill) so callers can tell
the output was capped.
Per-mode defaults: MCP kernels get an 8KB limit, REPL/test kernels
are unlimited. Runtime-switchable via the kaish-output-limit builtin.
Structs§
- Output
Limit Config - Configurable output size limit.
- Spill
Result - Result of a spill operation.
Enums§
- Spill
Mode - Where overflow output goes when it exceeds the limit.
Functions§
- parse_
size - Parse a size string with optional K/M suffix into bytes.
- spill_
if_ needed - Check if the result output exceeds the limit and spill to disk if so.