Skip to main content

agent_first_http/sdk/fetch/artifacts/
text.rs

1//! `document.body.innerText` artifact. Mechanical projection; not an
2//! interpretation, via CDP `Runtime.evaluate`.
3
4use std::path::PathBuf;
5
6use crate::sdk::fetch::writer;
7use crate::shared::artifacts::{Artifact, ArtifactPaths};
8use crate::shared::error::Error;
9
10pub async fn write(paths: &ArtifactPaths, text: &str) -> Result<PathBuf, Error> {
11    let target = paths.file_for(Artifact::Text);
12    writer::write_bytes(&target, text.as_bytes()).await?;
13    Ok(target)
14}