Weave documentation
Rust referenceweave-browser-engine

weave-browser-engine · crate

Source declarations, signatures and documentation for crate.

Reviewed implementation boundary: The serve path warns but still binds when WEAVE_API_KEY is absent; the authentication check then allows requests. Configure and verify authorization before exposing a server. See /libraries/weave-browser-engine/research-server.

Source: sigil/weave/libs/weave-browser-engine/src/lib.rs. SHA-256: 06277b915597eadf0e80abeb4c6ed11b3521a634f967f3f608c7737ebb5fbfa1.

This reference follows declared source modules, retains conditional attributes, and includes public declarations and implementation methods. Private-module re-exports and trait resolution require the compiler; this is a source reference, not a claim that every listed item is a root import. Function bodies and constant values are omitted.

error

Weave Browser Engine

Shared browser engine crate for the Weave P2P agent network. Provides URL fetching, HTML parsing, web search, file perception, deep research, protocol resolution, and an HTTP API server — all designed for agent consumption.

Architecture

The engine is split into independent, composable modules:

ModulePurpose
[fetch]Fetch URLs (HTTP/HTTPS/weave://) and parse into structured JSON
[observation]Agent-native semantic observation frames for pages
[parse]HTML parsing primitives: text/link/image extraction, CSS selectors
[search]Web search via pluggable [search::SearchEngine] trait
[perceive]Multi-modal file analysis via [perceive::PerceptionBackend] trait
[research]Iterative deep research: search, fetch, extract, synthesize
[protocol]Protocol resolver trait and built-in weave://, hns://, http(s)://
[serve]HTTP API server (axum) exposing all capabilities
[error]Typed error enum for the whole crate

Key Traits

  • [protocol::ProtocolResolver] — implement to add support for new URL schemes
  • [search::SearchEngine] — implement to add new search providers
  • [perceive::PerceptionBackend] — implement for advanced file analysis

Consumers

  • dcli — headless CLI browser for agents
  • dBrowser — Tauri desktop browser
  • Any Rust service via the library API or HTTP API

Example

use weave_browser_engine::fetch::{fetch_url, FetchOptions};
use weave_browser_engine::search;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    // Fetch a page
    let options = FetchOptions { extract_links: true, ..Default::default() };
    let page = fetch_url("https://example.com", &options).await?;
    println!("{}", serde_json::to_string_pretty(&page)?);

    // Search the web
    let results = search::search("Rust P2P", 5, "duckduckgo").await?;
    println!("{}", serde_json::to_string_pretty(&results)?);

    Ok(())
}
pub mod error;

Source line: 57.

fetch

pub mod fetch;

Source line: 58.

observation

pub mod observation;

Source line: 59.

parse

pub mod parse;

Source line: 60.

perceive

pub mod perceive;

Source line: 61.

protocol

pub mod protocol;

Source line: 62.

research

pub mod research;

Source line: 63.

pub mod search;

Source line: 64.

serve

pub mod serve;

Source line: 65.

::USER_AGENT

User-Agent string used for all outgoing HTTP requests.

pub const USER_AGENT: &str;

Source line: 68.

On this page