Skip to main content

pointlock_ir/
lib.rs

1//! # pointlock-ir
2//!
3//! All Typed IR types of Pointlock as Rust DTOs (serde + schemars) — the
4//! **single source of truth for types** (spine R12). CI generates from this
5//! crate: the JSON Schema (Draft 2020-12), the type-only npm package
6//! `@pointlock/ir-types`, and golden fixtures.
7//!
8//! Authoritative design documents:
9//! - `docs/design/00-architecture-spine.md` §3/§7/§9 and Appendix A
10//! - `docs/design/02-typed-ir.md` (the anchor document for IR semantics)
11//! - `schema/flow-ir.v0.1.schema.json` (acceptance baseline for the wire
12//!   shape; the generated schema must be *behaviorally equivalent* to it
13//!   over the golden fixture corpus, 02 §1.1)
14//!
15//! ## Serde discipline
16//!
17//! - Wire shape is camelCase (`rename_all`); enum literals align verbatim
18//!   with spine Appendix A.4 (error classes and canonical verbs are
19//!   snake_case by decree).
20//! - Objects the baseline closes with `additionalProperties: false` carry
21//!   `#[serde(deny_unknown_fields)]`. The seven step variants compose
22//!   [`StepBase`] via `#[serde(flatten)]`, which serde cannot combine with
23//!   `deny_unknown_fields`; there the schema-only
24//!   `#[schemars(deny_unknown_fields)]` closes the *generated schema*
25//!   (mirroring the baseline's `unevaluatedProperties: false`) while the
26//!   serde loader stays lenient — see the note in [`step`].
27//! - Absent optional fields are omitted (`skip_serializing_if`), never
28//!   `null` — the single-representation rule that content addressing
29//!   depends on (02 §2.4/§12.1).
30//!
31//! The golden fixture corpus lives in `schema/fixtures/` (positive +
32//! negative), and `tests/behavioral_equivalence.rs` judges the generated
33//! schema against the acceptance baseline over it (accept/reject parity,
34//! 02 §1.1) plus the serde round-trip guarantee. Normalization and hashing
35//! (irHash/effectHash/judgeHash) live in [`canonical`] and [`hash`]; the
36//! canonical RunPath string rendering and parsing (07 §2.1) live in
37//! [`run_path`].
38
39pub mod assertion;
40pub mod canonical;
41pub mod expr;
42pub mod flow;
43pub mod handler;
44pub mod hash;
45pub mod primitives;
46pub mod record;
47pub mod run_log;
48pub mod run_path;
49pub mod runtime;
50pub mod schema_gen;
51pub mod selector;
52pub mod source_map;
53pub mod step;
54pub mod vocab;
55
56pub use assertion::{AssertionIR, PredicateIR};
57pub use canonical::to_canonical_json;
58pub use expr::{Expr, ExprMap, FnExpr, LitExpr, PureFn, RefExpr};
59pub use flow::{FlowIR, FlowRef, OutputDecl, ParamDecl, ProviderRef};
60pub use handler::{BackoffMs, BackoffSchedule, HandlerAction, HandlerBinding, RetryPolicy};
61pub use hash::{
62    domain_hash, effect_hash, effect_hash_domain_tag, ir_hash, ir_hash_domain_tag, judge_hash,
63    judge_hash_domain_tag, judge_subdomain_sans_preflight,
64};
65pub use primitives::{
66    ActionName, AssertId, FeatureId, FlowId, Hash, Identifier, IrVersion, JsonPointer,
67    JsonSchemaDocument, OnMissingInput, OnTimeout, Protection, ProviderName, RefPath, StepId,
68    ValidationError,
69};
70pub use record::{
71    ActionOutcomeKind, AlignmentEntry, AlignmentReport, AssertionOutcomeRecord, AttemptRecord,
72    AttestationSnapshot, BindingState, CallFrame, CheckpointView, EventCursor, Frontier,
73    HumanPending, IterState, ObservationRecord, PendingIntent, ProviderStateSummary,
74    RequiresConfirmation, SessionHealthSnapshot, StepRecord, VisionJudgeRecord,
75};
76pub use run_log::{RunLogEvent, RunLogPayload};
77pub use run_path::{
78    ParsedPathFrame, PathFrame, RunPath, RunPathParseError, parse_run_path, render_parsed_run_path,
79    render_run_path,
80};
81pub use runtime::{
82    ActionExecution, ActionOutcome, ActionResult, AssetRef, ErrorInfo, EvidenceGap, EvidenceRef,
83    Observation, ReconcileResult, StepVerdict, UiContextRef, UiNodeRef, UiSnapshotRef, Verdict,
84    Viewport,
85};
86pub use selector::{ElementSelectorIR, RectIR, SelectorContext, TextMatchIR};
87pub use source_map::{MacroOriginFrame, SourceMapEntry, SourceSpan};
88pub use step::{
89    ActionBinding, ActionStepIR, AssertStepIR, BoundAttempt, CallStepIR, ForeachStepIR,
90    HumanStepIR, IfStepIR, LetStepIR, ObservationFromStep, ObservationSource, StepBase, StepIR,
91};
92pub use vocab::{
93    ActChannel, AlignmentClass, CanonicalVerb, Channel, CoordinateFallbackReason, EffectClass,
94    EffectClassAction, ElementState, ErrorClass, ExecutionMode, HandlerHook, HumanMode,
95    HumanPurpose, ObservationWhich, Phase, ScreenshotOmissionReason, StepState, SupervisePolicy,
96    SupervisionDecision, TextMatchMode, UiContextKind, UiSnapshotOmissionReason, VerdictPolicy,
97    VerdictStatus, VerifyChannel,
98};