Expand description
Tool-call / region watcher.
Mirrors libcodec’s codec_tool_watcher, the .NET ToolWatcher,
and @codecai/web’s ToolWatcher — same state-machine semantics.
Detects delimited regions (tool calls, reasoning blocks, vision
spans, sandbox regions, channel headers) in a token-ID stream
without ever decoding. The hot loop is a u32 compare against two
cached IDs; no vocab read, no detokenize call, no string allocation.
State survives across ToolWatcher::feed calls — a region split
between network frames buffers internally until the end marker
arrives.
Structs§
- Tool
Watcher - Stateful watcher for delimited regions in a token-ID stream.
- Watcher
Event - One event from
ToolWatcher::feed.
Enums§
- Tool
Watcher Error - Errors raised when constructing a
ToolWatcher. - Watcher
Event Kind - Kind of event emitted by
ToolWatcher::feed.