Skip to main content

sim_lib_intent/
lib.rs

1//! Intent value model, gesture algebra, and `codec:intent`.
2//!
3//! An Intent is a user (or agent) gesture expressed as a SIM value and decoded
4//! into a checked operation. An Intent says *what the operator wants*, in terms
5//! an editor can validate against a Shape before it ever touches runtime state.
6//! Intents round-trip through `codec:intent` and carry an `origin.operator`
7//! (human or agent) plus a logical tick for audit.
8//!
9//! This crate provides:
10//!
11//! - the Intent [`kinds`] and their required fields (open metadata);
12//! - a [`model`] of origin, builders, accessors, fail-closed validation, and
13//!   target resolution against a caller-supplied predicate;
14//! - the [`gesture`] algebra folding raw browser gestures into one Intent;
15//! - the [`glasses`] reducer folding gaze, head, hand, tap, button, and
16//!   controller input into standard Intent values;
17//! - the [`wrist`] reducer folding watch buttons, touch, tap, raise, and crown
18//!   input into standard Intent values;
19//! - the [`codec`] `codec:intent` plus Intent kind [`shapes`].
20
21#![forbid(unsafe_code)]
22#![deny(missing_docs)]
23
24mod citizen;
25pub mod codec;
26pub mod cookbook;
27pub mod gesture;
28pub mod glasses;
29pub mod kinds;
30pub mod model;
31pub mod shapes;
32pub mod wrist;
33
34pub use citizen::{IntentDescriptor, intent_descriptor_class_symbol};
35pub use codec::{IntentCodec, IntentCodecLib, intent_codec_symbol};
36pub use cookbook::select_intent_demo;
37pub use gesture::{
38    GestureRecognizer, Hit, HitRole, PointerEvent, PointerPhase, RawGesture, intent_from_gesture,
39};
40pub use glasses::{
41    ControllerAction, GazePhase, GlassesInputCapabilities, GlassesInputTiming,
42    GlassesIntentReducer, GlassesRawInput, HeadGesture,
43};
44pub use kinds::{INTENT_KINDS, INTENT_NAMESPACE, intent_kind, is_known_kind, required_fields};
45pub use model::{
46    IntentError, Operator, Origin, field, intent, intent_kind_of, origin, referenced_targets,
47    resolve_targets, validate_intent,
48};
49pub use shapes::{intent_shape_specs, intent_shape_symbol};
50pub use wrist::{WristInputCapabilities, WristInputTiming, WristIntentReducer, WristRawInput};
51
52/// Embedded cookbook recipe books shipped with this library.
53pub static RECIPES: sim_cookbook::EmbeddedDir =
54    include!(concat!(env!("OUT_DIR"), "/cookbook_recipes.rs"));
55
56#[cfg(test)]
57mod tests;
58
59#[cfg(test)]
60mod glasses_tests;
61
62#[cfg(test)]
63mod wrist_tests;