Manages asynchronous chat generation using background processes. Handles IPC for streaming tokens and tool call bridging.
processThe background callr process
ipc_dirTemp directory for inter-process communication
last_read_posLast position read from output file
new()Initialize a new ChatManager
ChatManager$new()
start_generation()Start async text generation
ChatManager$start_generation(model, messages, system = NULL, tools = NULL)modelThe model (will be serialized for bg process)
messagesThe message history
systemThe system prompt
toolsThe tools list
poll()Poll for new output and status
ChatManager$poll()List with text, done, waiting_tool, tool_call, error
resolve_tool()Resolve a tool call with result
ChatManager$resolve_tool(result)resultThe tool execution result
cleanup()Cleanup resources
ChatManager$cleanup()
clone()The objects of this class are cloneable with this method.
ChatManager$clone(deep = FALSE)deepWhether to make a deep clone.