agent-first-http 0.7.0

Give an AI agent its own isolated browser to actually open a URL — running JavaScript when the page needs it and returning the page as files the agent can read — so it works from the real page instead of a search guess, an empty app shell, or a login wall, all without touching the browser you use every day.
Documentation
//! Opt-in network response body capture under `network-bodies/`.

use std::path::PathBuf;

use crate::sdk::fetch::writer;
use crate::shared::artifacts::ArtifactPaths;
use crate::shared::error::Error;

/// Write a single response body. `request_id` is the CDP-assigned id used
/// as the filename stem; callers pick the extension from the mime type.
pub async fn write(
    paths: &ArtifactPaths,
    request_id: &str,
    ext: &str,
    bytes: &[u8],
) -> Result<PathBuf, Error> {
    let dir = paths.network_bodies_dir();
    writer::ensure_dir(&dir).await?;
    let target = dir.join(format!("{request_id}.{ext}"));
    writer::write_bytes(&target, bytes).await?;
    Ok(target)
}