Skip to main content

looprs_core/ports/
user_output.rs

1//! UserOutput port — abstraction over user-facing terminal/UI output.
2
3// TODO: hex refactor Phase 1 — Agent currently calls ui::* static functions
4// directly. Replace with this port. Add write_chunk(&str) for streaming (idea #2).
5// Wire the terminal adapter in looprs-cli; inject NullOutput in tests.
6/// Port: emit structured output to the user.
7///
8/// Implementations may render to a terminal, a log file, a TUI widget,
9/// or a machine-readable JSON stream.
10pub trait UserOutput: Send + Sync {
11    fn info(&self, msg: &str);
12    fn warn(&self, msg: &str);
13    fn error(&self, msg: &str);
14    fn assistant_text(&self, text: &str);
15    fn tool_call(&self, tool_name: &str, input_preview: &str);
16    fn tool_ok(&self);
17    fn tool_err(&self, err_msg: &str);
18}