weave-browser-engine · observation
Source declarations, signatures and documentation for observation.
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/observation.rs. SHA-256: df411b753d71496e80ccff1bbd15a6992365bb9f22b30a5e11703becdb9b5765.
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.
observation::ObservationOptions
Caller-supplied context for an observation frame.
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
pub struct ObservationOptions {
/// Active browser profile.
pub profile_id: String,
/// Browser tab being observed.
pub tab_id: String,
/// Frame identifier within the tab.
pub frame_id: String,
/// Navigation that produced this document.
pub navigation_id: String,
/// Monotonic frame generation.
pub generation: u64,
/// Observation timestamp in Unix milliseconds.
pub timestamp_ms: u64
}Source line: 17.
observation::ObservationFrame
Agent-native observation frame for a browser document.
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct ObservationFrame {
pub version: String,
pub profile_id: String,
pub tab_id: String,
pub frame_id: String,
pub url: String,
pub origin: String,
pub site: String,
pub navigation_id: String,
pub generation: u64,
pub timestamp_ms: u64,
pub trees: ObservationTrees,
pub events: ObservationEvents,
pub capabilities: ObservationCapabilities
}Source line: 34.
observation::ObservationTrees
Structured page trees exposed to agents.
#[derive(Debug, Clone, Default, Serialize, Deserialize, PartialEq)]
pub struct ObservationTrees {
pub semantic: Vec<SemanticNode>,
pub accessibility: Vec<SemanticNode>,
pub layout: Vec<SemanticNode>
}Source line: 52.
observation::ObservationEvents
Event streams captured alongside the snapshot.
#[derive(Debug, Clone, Default, Serialize, Deserialize, PartialEq)]
pub struct ObservationEvents {
pub network: Vec<serde_json::Value>,
pub console: Vec<serde_json::Value>,
pub storage: Vec<serde_json::Value>
}Source line: 60.
observation::ObservationCapabilities
High-level actions supported for this observation.
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
pub struct ObservationCapabilities {
pub can_navigate: bool,
pub can_click: bool,
pub can_type: bool,
pub can_submit: bool,
pub requires_approval: Vec<String>
}Source line: 68.
observation::NodeId
Stable node identity within an observation generation.
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, Hash)]
pub struct NodeId {
pub frame_id: String,
pub local_id: String,
pub generation: u64
}Source line: 78.
observation::SemanticNode
Semantic node exposed to agents.
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct SemanticNode {
pub id: NodeId,
pub role: String,
pub name: Option<String>,
pub text: Option<String>,
pub bounds: Option<[f32; 4]>,
pub actionable: bool,
pub attributes: BTreeMap<String, String>
}Source line: 86.
observation::observe_html
Build an agent observation frame from static HTML.
pub fn observe_html(
raw_url: &str,
html: &str,
options: ObservationOptions,
) -> BrowserResult<ObservationFrame>;Source line: 97.