Expand description
Interactive stdin/stdout REPL with slash commands.
Repl::run drives the I/O loop: print a banner on stderr, prompt with > ,
and feed each non-slash line to a caller-supplied async callback. Slash
commands (/help, /quit, /tools, /reset) are handled here; /tools
and /reset defer to caller-supplied callbacks for their text + side
effects (history clearing, tool-list assembly). EOF (Ctrl-D) and /quit
exit cleanly. SIGINT during a callback cancels the in-flight future,
prints [outrig] interrupted, and returns to the prompt; a second
consecutive SIGINT (no input typed in between) exits.
Strict stream separation: assistant text goes to stdout; everything else –
banner, prompt, slash-command output, interrupt notice – goes to stderr.
That way outrig run > out.txt captures only the model’s replies.
Repl::run_with is the generic form: it takes any AsyncBufRead /
AsyncWrite streams plus an interrupt-future factory, so integration tests
can substitute tokio::io::duplex halves and a tokio::sync::Notify-driven
interrupt source.