Expand description
Output modes. Mirrors the v1-relevant slice of the TS
packages/coding-agent/src/modes/{print-mode,json-event,rpc-mode}.ts — the
three run shapes a harness-backed CLI needs:
- [
print] — single-shot: send the prompt(s), print the final assistant text (or the error) to stdout, exit. Mirrors TSrunPrintMode(text mode). json— single-shot streaming: emit each harness event as a JSON line on stdout, then the final outcome. Mirrors TSrunPrintMode(mode === "json") + [json_event::toJsonEvent].interactive— a minimal line-oriented REPL: read prompts from stdin, run each, print the assistant text, loop until EOF //exit. v1 does NOT port the TSInteractiveModeTUI (modes/interactive/*— a full terminal UI with Ink/React components); this is a deliberately minimal replacement, documented indocs/m6-cli-open-questions.md.
All three drive the same AgentHarness via AgentLane::prompt_text.
Functions§
- assistant_
text - Extract the concatenated text content from an assistant message. Mirrors the
TS print-mode loop (
for content of assistantMsg.content if type===text). - interactive
interactivemode: uses TUI if terminal supports it, falls back to minimal REPL.- interactive_
repl - Simple REPL-based interactive mode (fallback for non-TTY environments).
- json
jsonmode: emit each harness event as a JSON line on stdout, run the prompts, then emit a terminalresultline carrying the outcome + final text. Mirrors TSrunPrintMode(mode === "json") streaming every event.- outcome_
exit_ code - The exit code a run’s outcome maps to. Mirrors TS print mode: error/aborted ⇒ exit 1; everything else ⇒ 0.
printmode: send the initial message (prompt text + inline@fileexpansions), then any follow-up messages, print the final assistant text, return the exit code. Mirrors TSrunPrintMode(text).