thread_engine/lib.rs
1//! # Loom — the embeddable engine for the Thread
2//!
3//! Loom is to the Thread what a rendering engine (Chromium) is to a browser
4//! (Chrome): the reusable, renderer-agnostic core that *any* Thread browser can
5//! build on. **Infinite** is the reference browser — winit + wgpu + egui — but
6//! it holds no monopoly: everything a browser needs to reach, parse, and stay
7//! present in worlds lives here, behind a rendering seam, so a second browser
8//! (a different renderer, a different UI, an embedded view) can be built without
9//! re-implementing the network core.
10//!
11//! What Loom owns (all renderer-agnostic):
12//! - [`resolver`] — Locator → world manifest ("DNS"): registry → the host's own
13//! `.well-known/thread` → local file. This is what lets *anyone* host a world
14//! on their domain with zero contact.
15//! - [`navigator`] — **veilwalking**: the renderer-agnostic navigation state
16//! machine (which world is active, when to step through a veil, what's in
17//! focus), driving a renderer through the [`navigator::WorldLoader`] seam.
18//! - [`engine`] — [`Loom`], the one-call facade that owns your loader and reduces
19//! a whole browser to `new` + `open` + `update` each frame.
20//! - [`walk`] — scripted walks: drive the engine through a recorded path over a
21//! corpus (headless) and report where it landed — the engine as its own oracle.
22//! - [`bookmarks`] — kept places (a personal constellation), persisted as one
23//! human-readable JSON file.
24//! - [`home`] — the home-space (`thread://home`): a local world the traveler
25//! owns, seeded on first launch, where bookmarks materialize as veils and
26//! build mode persists blocks.
27//! - [`mesh`] — Tier-1 **serverless P2P presence**: a transport-agnostic mesh
28//! coordinator so small worlds are shared with no relay at all.
29//! - [`codex`] — canonical-meaning lookups against the live Codex.
30//! - [`commerce`] — server-authoritative purchases (`commerce.buy` → the
31//! Thread's purchase endpoint) and entitlement reads, Passport-bearer signed.
32//! - [`passport`] — the traveler's held identity (token + fetched descriptor),
33//! presented on presence join and portal handoff, never persisted by hosts.
34//! - [`directory`] — the worlds directory (discovery / jump-to).
35//! - [`web`] — the in-world reader for the *old* 2D web (transclusion), so
36//! visitors never have to leave the Thread.
37//! - [`presence`] — the presence relay client (WebSocket), feeding
38//! [`traveler::PresenceState`].
39//!
40//! What Loom deliberately does **not** own: windowing, the GPU, meshes, the HUD.
41//! Those belong to the browser. The world *runtime* (physics, chunks, player,
42//! camera, actors) lives in the host application, and the
43//! world *format* in [`infinite_manifest`]; Loom re-exports both so an embedder
44//! depends on one crate.
45
46pub mod assets;
47pub mod behavior;
48#[cfg(feature = "behaviors")]
49pub mod behavior_wasm;
50pub mod behavior_weft;
51pub mod bookmarks;
52pub mod codex;
53pub mod commerce;
54pub mod directory;
55pub mod engine;
56pub mod home;
57pub mod host;
58pub mod mesh;
59#[cfg(feature = "p2p")]
60pub mod mesh_webrtc;
61pub mod navigator;
62pub mod passport;
63pub mod presence;
64pub mod recents;
65pub mod resolver;
66pub mod walk;
67pub mod web;
68
69// Re-export the lower layers + math so an embedder pulls in one crate and can
70// name the vector type that appears in Loom's public API.
71pub use glam;
72pub mod traveler;
73pub use traveler::{Instance, PoseSample, PresenceState, TravelerPose};
74pub use infinite_avatar;
75pub use infinite_manifest;
76
77// The most-used types, promoted to the crate root for ergonomic embedding.
78pub use assets::AssetSource;
79pub use behavior::{Action, ActionList, Behavior, InteractEvent};
80pub use bookmarks::{Bookmark, Bookmarks};
81pub use codex::CodexClient;
82pub use commerce::CommerceClient;
83pub use directory::Directory;
84pub use engine::Loom;
85pub use mesh::{MeshCoordinator, MeshEvent, MeshPose, MeshTransport, Signal};
86pub use navigator::{Focus, Navigator, WorldLoader};
87pub use passport::Passport;
88pub use presence::PresenceClient;
89pub use resolver::{fetch_world, TravelResult};
90pub use walk::{walk, Script, Step, WalkOutcome};
91pub use web::WebReader;