pub struct ChatState {
pub history: Vec<ChatHistoryEntry>,
pub tool_call_format: ToolCallFormat,
pub tool_descriptions: HashMap<String, String>,
pub pending_tool_calls: usize,
/* private fields */
}Expand description
Core chat orchestration state.
Owns conversation history, token parsing, tool call detection,
and the agentic loop. No I/O — all communication is via
handle_command() → Vec<ChatEvent>.
Fields§
§history: Vec<ChatHistoryEntry>§tool_call_format: ToolCallFormat§tool_descriptions: HashMap<String, String>§pending_tool_calls: usizeImplementations§
Source§impl ChatState
impl ChatState
pub fn new(format: ToolCallFormat) -> Self
Sourcepub fn handle_command(&mut self, cmd: ChatCommand) -> Vec<ChatEvent>
pub fn handle_command(&mut self, cmd: ChatCommand) -> Vec<ChatEvent>
Process a command and return events to emit.
Sourcepub fn ingest_token(&mut self, token: &str) -> Vec<ChatEvent>
pub fn ingest_token(&mut self, token: &str) -> Vec<ChatEvent>
Process a streaming token. Handles <think>, <tool_call>, and
content separation. Returns events to emit.
Mirrors the TUI’s ChatApp::ingest_token but returns events
instead of mutating UI state.
Sourcepub fn needs_reinvoke(&self) -> bool
pub fn needs_reinvoke(&self) -> bool
Whether the state machine needs inference to be re-invoked (e.g. after all tool results have been received). Whether the state machine needs inference to be re-invoked (after all tool results received and a new empty assistant entry is ready).
Auto Trait Implementations§
impl Freeze for ChatState
impl RefUnwindSafe for ChatState
impl Send for ChatState
impl Sync for ChatState
impl Unpin for ChatState
impl UnsafeUnpin for ChatState
impl UnwindSafe for ChatState
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more