Module history
Structs§
Constants§
- DEFAULT_
MAX_ HISTORY_ MESSAGES - Default trigger for auto-compaction when non-system message count exceeds this threshold.
Prefer passing the config-driven value via
run_tool_call_loop; this constant is only used when callers omit the parameter.
Functions§
- append_
or_ merge_ system_ message - canonicalize_
tool_ result_ media_ markers - Rewrite real local image file paths in tool output into
[IMAGE:...]markers so the multimodal pipeline can normalize them before the next provider call. This targets shell/skill outputs that print filesystem paths directly rather than returning explicit media markers. - canonicalize_
tool_ result_ media_ markers_ for - context_
floor_ remediation - estimate_
history_ tokens - Estimate token count for a message history using ~4 chars/token heuristic. Includes a small overhead per message for role/framing tokens.
- estimate_
system_ floor_ tokens - floor_
char_ boundary - Find the largest byte index
<= ithat is a valid char boundary. MSRV-compatible replacement forstr::floor_char_boundary(stable in 1.91). - load_
interactive_ session_ history - normalize_
system_ messages - save_
interactive_ session_ history - trim_
history - truncate_
tool_ message - Truncate a tool message’s content, preserving JSON structure when the
message stores
tool_call_idalongsidecontent(native tool-call format). Without this,truncate_tool_resultdestroys the JSON envelope and downstream model_providers receive anullcall_id. - truncate_
tool_ result