Skip to main content

Crate chat_core

Crate chat_core 

Source
Expand description

Chat orchestration state machine.

Owns conversation state, token parsing, tool call detection, and the agentic loop. Used by both the TUI and web GUI — they are thin renderers over this core.

This crate has no I/O, no platform deps, no async runtime. It is pure state machine logic that can be compiled to any target (native, WASI, wasm32).

Modules§

capnp
Minimal Cap’n Proto builder for ChatCoreOut messages.

Structs§

ChatHistoryEntry
A single message in the conversation history.
ChatState
Core chat orchestration state.
ToolCallRecord
A recorded tool call and its result (or in-flight state).

Enums§

ChatCommand
Commands sent to the chat state machine.
ChatEvent
Events emitted by the chat state machine. These are structured — clients never see raw <think> or <tool_call> tags.
ChatRole
Role of a chat history entry.
ToolCallFormat
Model-specific tool call syntax.

Functions§

parse_tool_call_buf
Parse a tool call buffer. Tries JSON first (Qwen3/Hermes), then Qwen3.5 XML parameter format.
parse_xml_param_tool_call
Parse a Qwen3.5 XML parameter-format tool call block.