Skip to main content

scema_tools/
lib.rs

1//! # scema-tools — perception
2//!
3//! The only crate in the read path allowed to touch the outside world. [`Observer`] is the
4//! interface; [`RepoObserver`] is the first implementation, and the browser extension will
5//! be the second — a content script that produces the same [`scema_world::WorldState`] JSON
6//! from a page is indistinguishable to everything above it.
7//!
8//! [`Workspace`] lives here too, and it belongs to the *read* path for a reason that is easy
9//! to miss: the CLI has an operator typing paths and needs no confinement, but the daemon
10//! and the MCP server take paths from a browser extension and a language model. "Observe
11//! this directory" from either of those is an instruction from somewhere the operator is
12//! not looking.
13//!
14//! Actuators (the write path) are not here yet. That is deliberate rather than unfinished:
15//! the loop is worth trusting with a keyboard only after the decision layer above it has
16//! been watched abstaining on real inputs for a while, and `scema execute` says so rather
17//! than pretending.
18
19pub mod observer;
20pub mod repo;
21pub mod workspace;
22
23pub use observer::{resolve, Observer};
24pub use repo::RepoObserver;
25pub use workspace::Workspace;
26
27/// The observers compiled into this build, in resolution order.
28///
29/// Ordered, not scored: [`resolve`] takes the first that claims a locator. `RepoObserver`
30/// is last because it accepts almost any non-URL string, so a more specific observer added
31/// later must go in front of it.
32pub fn default_observers() -> Vec<&'static dyn Observer> {
33    static REPO: RepoObserver = RepoObserver;
34    vec![&REPO]
35}