Skip to main content

sim_lib_web_bridge/
lib.rs

1//! Session and transport bridge over `realize`/`EvalFabric` for the
2//! Intent/Scene bus.
3//!
4//! The bridge connects the browser shell to any runtime, location-transparently,
5//! by targeting `realize_events`/`realize_final` rather than a transport-specific
6//! API. Four interchangeable transports sit behind one trait: in-browser wasm,
7//! local server, remote server, and fixture/cassette sessions for deterministic
8//! tests. Both a human (through the browser) and an agent (through the agent
9//! runner) are peers on this same bus.
10//!
11//! This crate provides the [`transport`] contract and session status, the
12//! deterministic [`fixture`] transport, the network [`remote`] transports, and
13//! the [`session`] bus with per-pane subscriptions and Scene-diff streaming.
14
15#![forbid(unsafe_code)]
16#![deny(missing_docs)]
17
18pub mod cookbook;
19mod device_peer;
20pub mod fabric;
21pub mod fixture;
22pub mod glasses;
23pub mod glasses_session;
24pub mod history;
25pub mod host;
26pub mod placement;
27pub mod remote;
28pub mod session;
29pub mod sync;
30pub mod transport;
31
32pub use cookbook::session_fixture_demo;
33pub use device_peer::{device_peer_surface, register_device_peer, register_device_peer_with_role};
34pub use fabric::{FabricTransport, operation_to_request};
35pub use fixture::FixtureTransport;
36pub use glasses::{GlassesViewport, HaloPreviewClient, VitureSceneClient};
37pub use glasses_session::{GlassesCoUseSession, glasses_surface};
38pub use history::{History, SessionLog, Snapshots, annotate};
39pub use host::{DesktopHost, PHONE_PANE, PhoneHost};
40pub use placement::{
41    BrowserBridgeLane, BrowserPlacementReport, BrowserPlacementRequest, BrowserWasmEngine,
42    BrowserWasmEntryPoints, browser_audio_worklet_entry_symbol,
43    browser_server_only_refusal_diagnostic, browser_wasm_engine_entry_symbol,
44    browser_wasm_site_symbol,
45};
46pub use remote::RemoteTransport;
47pub use session::{SceneUpdate, Session};
48pub use sim_lib_view_spatial::GlassesPeer;
49pub use sync::{Broadcast, EditRow, SurfaceBinding, SurfaceHub, SurfaceRole, replay};
50pub use transport::{
51    BrowserStreamStatus, ChangeEvent, SessionStatus, StreamInspectorRecord, Transport,
52    TransportKind, WebStreamOperation, web_stream_operation_capability_names,
53    web_stream_operation_symbols,
54};
55
56/// Stable symbol for the session value carried on the bus.
57pub const SESSION_CLASS: &str = "web:Session";
58
59/// Embedded cookbook recipe books shipped with this library.
60pub static RECIPES: sim_cookbook::EmbeddedDir =
61    include!(concat!(env!("OUT_DIR"), "/cookbook_recipes.rs"));
62
63#[cfg(test)]
64mod glasses_client_tests;
65#[cfg(test)]
66mod history_tests;
67#[cfg(test)]
68mod placement_tests;
69#[cfg(test)]
70mod remote_tests;
71#[cfg(test)]
72mod replay_tests;
73#[cfg(test)]
74mod surface_session_tests;
75#[cfg(test)]
76mod tests;