use crate::ports::UserOutput;
pub struct TerminalOutput;
impl UserOutput for TerminalOutput {
fn info(&self, msg: &str) {
println!("{msg}");
}
fn warn(&self, msg: &str) {
eprintln!("warning: {msg}");
}
fn error(&self, msg: &str) {
eprintln!("error: {msg}");
}
fn assistant_text(&self, text: &str) {
println!("{text}");
}
fn tool_call(&self, tool_name: &str, input_preview: &str) {
println!("tool: {tool_name}({input_preview})");
}
fn tool_ok(&self) {
println!(" ok");
}
fn tool_err(&self, err_msg: &str) {
println!(" error: {err_msg}");
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn conformance() {
crate::ports::test_contracts::assert_user_output_contract(&TerminalOutput);
}
}