Skip to main content

Module history

Module history 

Structs§

InteractiveSessionState

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 <= i that is a valid char boundary. MSRV-compatible replacement for str::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_id alongside content (native tool-call format). Without this, truncate_tool_result destroys the JSON envelope and downstream model_providers receive a null call_id.
truncate_tool_result