pub struct Repl;Implementations§
Source§impl Repl
impl Repl
Sourcepub async fn run<P, PFut, T, TFut, R, RFut>(
banner: &str,
on_prompt: P,
on_tools: T,
on_reset: R,
) -> Result<()>
pub async fn run<P, PFut, T, TFut, R, RFut>( banner: &str, on_prompt: P, on_tools: T, on_reset: R, ) -> Result<()>
Run the REPL against real stdin/stdout/stderr, treating
tokio::signal::ctrl_c() as the interrupt source. The banner is
printed once to stderr before the first prompt; on_prompt is invoked
for every non-slash, non-empty input line and its non-empty returned
text is printed to stdout. Streaming callers may write incrementally
during the callback and return an empty string to suppress trailing
reprint. on_tools and on_reset produce the stderr text for /tools
and /reset respectively (and on_reset is the side-effect site for
clearing whatever conversation state the caller owns).
Sourcepub async fn run_with<RD, W, E, I, IFut, P, PFut, T, TFut, R, RFut>(
stdin: RD,
stdout: W,
stderr: E,
interrupt: I,
banner: &str,
on_prompt: P,
on_tools: T,
on_reset: R,
) -> Result<()>
pub async fn run_with<RD, W, E, I, IFut, P, PFut, T, TFut, R, RFut>( stdin: RD, stdout: W, stderr: E, interrupt: I, banner: &str, on_prompt: P, on_tools: T, on_reset: R, ) -> Result<()>
Generic form parameterized over the I/O streams and interrupt source.
Production calls this with real handles via Repl::run; integration
tests call it with tokio::io::duplex halves and a Notify-driven
interrupt closure to exercise EOF, slash commands, and SIGINT
handling without touching real signals or terminals.