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 [`wrist`] reducer folding watch buttons, touch, tap, raise, and crown
16//! input into standard Intent values;
17//! - the [`codec`] `codec:intent` plus Intent kind [`shapes`].
18
19#![forbid(unsafe_code)]
20#![deny(missing_docs)]
21
22mod citizen;
23pub mod codec;
24pub mod cookbook;
25pub mod gesture;
26pub mod kinds;
27pub mod model;
28pub mod shapes;
29pub mod wrist;
30
31pub use citizen::{IntentDescriptor, intent_descriptor_class_symbol};
32pub use codec::{IntentCodec, IntentCodecLib, intent_codec_symbol};
33pub use cookbook::select_intent_demo;
34pub use gesture::{
35 GestureRecognizer, Hit, HitRole, PointerEvent, PointerPhase, RawGesture, intent_from_gesture,
36};
37pub use kinds::{INTENT_KINDS, INTENT_NAMESPACE, intent_kind, is_known_kind, required_fields};
38pub use model::{
39 IntentError, Operator, Origin, field, intent, intent_kind_of, origin, referenced_targets,
40 resolve_targets, validate_intent,
41};
42pub use shapes::{intent_shape_specs, intent_shape_symbol};
43pub use wrist::{WristInputCapabilities, WristInputTiming, WristIntentReducer, WristRawInput};
44
45/// Embedded cookbook recipe books shipped with this library.
46pub static RECIPES: sim_cookbook::EmbeddedDir =
47 include!(concat!(env!("OUT_DIR"), "/cookbook_recipes.rs"));
48
49#[cfg(test)]
50mod tests;
51
52#[cfg(test)]
53mod wrist_tests;