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
//! Post-JS DOM serialized to HTML, emitted via CDP
//! `DOM.getOuterHTML` on the document node when a browser was used.

use std::path::PathBuf;

use crate::sdk::fetch::writer;
use crate::shared::artifacts::{Artifact, ArtifactPaths};
use crate::shared::error::Error;

pub async fn write(paths: &ArtifactPaths, html: &str) -> Result<PathBuf, Error> {
    let target = paths.file_for(Artifact::RenderedHtml);
    writer::write_bytes(&target, html.as_bytes()).await?;
    Ok(target)
}