agent-first-http 0.5.0

Give an AI agent any URL and get back a usable page — fetched directly, or rendered in a real browser when the page needs one — with a human able to take over the same browser for a login, captcha, or 2FA.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
//! Output glue. The single seam through which CLI subcommands write their
//! one line of JSON to stdout.

use serde::Serialize;
use std::io::Write;

use crate::shared::error::Error;

/// Emit a payload to stdout as one line of JSON. Wraps
/// `shared::envelope::emit` and is the single seam through which CLI
/// subcommands produce output.
pub fn emit<T: Serialize>(code: &str, payload: &T) -> Result<(), Error> {
    let stdout = std::io::stdout();
    let mut handle = stdout.lock();
    crate::shared::envelope::emit(&mut handle, code, payload)?;
    handle.flush().ok();
    Ok(())
}