Skip to content

Add embedding seams: BrowserManager::from_client, output capture, pluggable artifact writer - #2

Closed
Glavin001 wants to merge 4 commits into
devin/1786050474-wasm-corefrom
devin/1786054261-embed-seams
Closed

Add embedding seams: BrowserManager::from_client, output capture, pluggable artifact writer#2
Glavin001 wants to merge 4 commits into
devin/1786050474-wasm-corefrom
devin/1786054261-embed-seams

Conversation

@Glavin001

@Glavin001 Glavin001 commented Aug 6, 2026

Copy link
Copy Markdown

Summary

Stacked on #1. Adds the three remaining seams a library host needs to embed the browser-automation core without a filesystem, a spawnable Chrome, or a process stdout. No behavior change on the native CLI path: every seam defaults to exactly what the code did before.

BrowserManager::from_client (native/browser.rs) — the body of connect_cdp_inner after the WebSocket connect, extracted so hosts that build a CdpClient via CdpClient::from_transport (#1) can get a fully initialized manager (target discovery/attach or direct-page setup) without a native WebSocket:

pub async fn from_client(client: Arc<CdpClient>, ws_url: String, direct_page: bool) -> Result<Self, String>

Output capture (output.rs) — all printing in the output module now goes through outln!/out!/errln! macros that write to the process streams by default, or into a buffer while a capture is active:

output::begin_capture();
let resp = execute_command(&cmd, &mut state).await;
output::print_response_with_opts(&resp, action, &opts);
let CapturedOutput { stdout, stderr } = output::end_capture();

This is what gives embedders byte-for-byte CLI stdout parity: they reuse the real formatting code instead of reimplementing it. The macro conversion is mechanical (println!outln! etc., 139 sites, same format strings).

Pluggable artifact writer (artifacts.rs, new) — screenshot/PDF/HAR/diff-image writes route through artifacts::write(path, bytes), which falls back to std::fs::write unless a host installs a writer via set_artifact_writer (e.g. to persist into object storage on wasm, where std::fs fails at runtime). Path selection and response shapes ({ "path": ... }) are unchanged.

Verification

From cli/: cargo check --all-targets, cargo check --lib --target wasm32-unknown-unknown, cargo clippy --all-targets -- -D warnings, cargo fmt -- --check, cargo test (1065 passed, 0 failed) all green.

Link to Devin session: https://app.devin.ai/sessions/3a5dcc4bfa3d492dbe280f24b4de6cc0
Requested by: @Glavin001


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.


Open in Devin Review

devin-ai-integration Bot and others added 3 commits August 6, 2026 22:20
Co-Authored-By: glavin@coframe.com <glavin.wiechert@gmail.com>
Co-Authored-By: glavin@coframe.com <glavin.wiechert@gmail.com>
Co-Authored-By: glavin@coframe.com <glavin.wiechert@gmail.com>
@Glavin001 Glavin001 self-assigned this Aug 6, 2026
@devin-ai-integration

Copy link
Copy Markdown

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 1 additional finding.

Open in Devin Review

Co-Authored-By: glavin@coframe.com <glavin.wiechert@gmail.com>
@devin-ai-integration

Copy link
Copy Markdown

Folded into #1 (commits ded7c22/b1c7aa4/07e807f now live on devin/1786050474-wasm-core as 3c715a9/1be33dd + polish). Closing to keep a single agent-browser PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant