Quick Start
CLI
# Launch a command in a virtual terminal and drive it from a REPL.
kou launch bash --cols 80 --rows 24
# > echo hello
# > screen # prints the current screen text
Library
use kou::{FontCache, FontSet, VttyManager, render_png};
#[tokio::main]
async fn main() -> anyhow::Result<()> {
let mgr = VttyManager::new();
let id = mgr.launch("bash", None, 80, 24).await?;
mgr.send_text(&id, "echo hello\n").await?;
// Plain text.
println!("{}", mgr.screenshot(&id).await?);
// A real PNG, rendered with auto-fetched fonts (Latin + CJK fallback).
let fonts = FontCache::load(&FontSet::from_env(), 16.0);
let screen = mgr.screen(&id).await?;
let png = render_png(&screen, &fonts, 16.0)?;
std::fs::write("screen.png", png)?;
Ok(())
}
See Graphics Protocols for inline image rendering and Fonts for the ort-style font pipeline.