Critical Flow: Headless SDK Print Mode Request To Streamed Output
This flow matters whenever the client is embedded in another product, used as a subprocess, or expected to return structured output instead of rendering the REPL.
Flow Overview
main.tsxidentifies non-interactive mode from flags or non-TTY output.- Shared init and setup still run, but trust is treated as implicit and output is structured instead of Ink-rendered.
cli/print.tsbecomes the top-level session runner.- A headless store is created with app state, MCP state, permission context, agents, and tools.
QueryEngine.tsowns the conversation across turns.