Development
Development and debugging middleware. Trace the full agent lifecycle in the terminal during development.
dev.console()
Section titled “dev.console()”Prints the full agent lifecycle to stderr in a tree-structured format. Useful for development and debugging.
function devConsole(config?: DevConsoleConfig): Middlewareagent.use(dev.console())Output example:
┌ session s-abc123│ → turn #0│ │ → model.call sonnet tokens:150→85 847ms│ │ → tool.exec search 234ms│ │ → model.call sonnet tokens:320→120 612ms│ → turn #0 done 1693ms└ session done 1693msConfig options:
| Option | Type | Default | Description |
|---|---|---|---|
format | (entry: ConsoleEntry) => string | built-in tree formatter | Custom format function |
Each ConsoleEntry has:
interface ConsoleEntry { type: string // "session:start", "turn:start", "model:call", etc. depth: number // 0=session, 1=turn, 2=model/tool summary: string // Human-readable summary line data?: Record<string, unknown> // Event-specific data}Hooks: session, turn, model, tool — logs start/end events for each.