Skip to main content

rite_runtime/
lib.rs

1//! Execution runtime for Rite ceremonies.
2//!
3//! `rite-runtime` defines the protocol that frontends use to drive a
4//! ceremony to completion, the executor that walks the ceremony plan,
5//! and the supporting machinery for transcripts and action handlers.
6//!
7//! # Key types
8//!
9//! - [`Executor`], channel-driven engine that walks a ceremony plan.
10//! - [`Action`] / [`ActionRegistry`], the handler trait and registry.
11//! - [`BackendRegistry`] / [`BackendFactory`], lazy backend store.
12//! - [`Reporter`], action-facing handle for facts, signals, and prompts.
13//! - [`TranscriptSink`], durable JSONL audit log with hash chaining.
14//!
15//! # Stability
16//!
17//! Internal crate. This is an implementation detail of the `rite` CLI, with no
18//! stable API and no semver guarantees across releases. Build against the
19//! public `rite-sdk`, `rite-model`, or `rite-resolver` crates instead.
20
21#![warn(missing_docs)]
22
23mod actions;
24mod artifact_resolver;
25mod backend;
26mod clock;
27mod display;
28mod entropy;
29mod executor;
30mod expressions;
31mod output_config;
32mod protocol;
33mod reporter;
34mod runner;
35mod state;
36mod step_info;
37mod system_info;
38pub mod test_support;
39mod transcript;
40mod transcript_sink;
41
42// Execution
43pub use executor::ExecutionError;
44
45// Actions
46pub use actions::{ActionCategory, ActionMetadata, ArtifactValue};
47
48// Backend registry (traits live in `rite-sdk`, not here)
49pub use backend::{BackendFactory, BackendRegistry};
50
51pub use clock::{Clock, SystemClock};
52
53// Channel vocabulary for the runtime ↔ frontend boundary.
54// Persisted transcript types (`StepFact`, `Prompt`, `ResponseRecord`, …)
55// live in `rite_model::transcript` and are not re-exported here.
56pub use protocol::{
57    ExecEvent, Icon, MaterialOverview, MaterialOverviewKind, PromptId, Response, UiCommand,
58    UiSignal,
59};
60
61// Structured machine/build/environment facts carried by UI signals.
62pub use system_info::{
63    BackendVersion, BuildInfo, Disk, Environment, FeatureCheck, FeatureStatus, Hardening, HostInfo,
64    ParseError as SystemInfoParseError, StartupSnapshot, SystemInfo,
65};
66
67// Shared formatter for live frontends.
68pub use display::{fact_summary, signal_summary, truncate_for_display};
69
70// Entropy source: the single auditable source of ceremony randomness, plus
71// the pure `rite-kdf/v1` derivation used by both the draw path and `rite verify`.
72pub use entropy::{
73    CeremonyRandom, DERIVATION_V1, Draw, MAX_DRAW_LEN, build_path, derive_value, fold_seed,
74    initial_seed,
75};
76
77// Reporter: action-facing handle for facts, signals, and prompts.
78pub use reporter::{Reporter, ReporterError};
79
80// Executor and its action trait.
81pub use runner::{Action, ActionError, ActionRegistry, ExecutionSummary, Executor, parse_params};
82
83// Transcript sink, the durable consumer of `StepFact`s.
84pub use transcript_sink::{
85    EntropyVerified, InMemorySink, JsonlFileSink, LoadedTranscript, TimedFact,
86    TranscriptFingerprint, TranscriptSink, TranscriptVerified, VerifyError,
87    read_verified_transcript, verify_entropy, verify_transcript as verify_step_fact_transcript,
88};
89
90// State (needed by `Action` implementors in downstream crates).
91pub use state::{ExecutionState, HandlerContext, StepResult};
92pub use step_info::StepInfo;
93
94// Output / fingerprint helpers.
95pub use output_config::OutputConfig;
96pub use transcript::{compute_file_fingerprint, compute_fingerprint};
97
98// Expression evaluation (used by action implementors).
99pub use expressions::{
100    evaluate, evaluate_expr_value, evaluate_expr_value_to_string, value_to_json,
101};
102
103// Artifact resolution (used by action implementors).
104pub use artifact_resolver::{BackendKeyMeta, resolve_artifact_bytes, resolve_backend_key};