Plain chat
runChatTui() is a chat on Node's readline: the reply streams as plain lines, tool calls are [action] lines, and checkpoints are asked at the prompt. It takes the same options as runChatInk() (the Ink-only ones are ignored) and the same session opener.
function runChatTui(options: Options | SessionOpener, tuiOptions?: ChatTuiOptions): Promise<void>;
runChatInk() falls back to it by itself without a TTY or with plain: true, so most agents never call it directly. Use it when:
- the agent runs behind a pipe or in a CI job:
echo "summarize" | npx tsx agent.ts; - the terminal doesn't handle Ink well;
- you want output that's easy to capture or copy.
await runChatInk(opener, { runsDir, plain: process.env.MY_AGENT_PLAIN === "1" });
What it looks like
Scout is ready. /exit to leave.
you> what's new in TypeScript?
[action] Searching the web for "TypeScript release notes"
[action] Fetching https://devblogs.microsoft.com/typescript/…
Scout> TypeScript 6.0 shipped in March…
you>
agentLabelis printed before each reply, and colors it.- Esc interrupts the turn; Ctrl+C interrupts it, or leaves at an idle prompt.
- ↑/↓ go through the history (
historyPath). - An unknown
/commandis caught before it reaches the model. /resumeprints a numbered list of runs and asks for a number./planswitches into plan mode and back, with themodeControloption or a session opener (the plain chat has no Shift+Tab).
Checkpoints
The chat registers its readline interface with setSharedReadline(), so a checkpoint asks on the same line editor instead of a second one fighting it for the keyboard:
=== Human confirmation required before publishing ===
Summary: post the weekly summary
Allow this to continue? [Y/n/q]
Without a TTY, checkpoints are only answered through the response file.
Driving it from another program
Lines written to its standard input are sent as messages, one per line:
printf 'summarize the news\n/exit\n' | npx tsx agent.ts
Give the chat a moment to start before writing: a line that arrives before the prompt is ready is dropped.