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 display;
27mod executor;
28mod expressions;
29mod output_config;
30mod protocol;
31mod reporter;
32mod runner;
33mod state;
34mod step_info;
35mod system_info;
36pub mod test_support;
37mod transcript;
38mod transcript_sink;
39
40// Execution
41pub use executor::ExecutionError;
42
43// Actions
44pub use actions::{ActionCategory, ActionMetadata, ArtifactValue, KeyFormat};
45
46// Backend registry (traits live in `rite-sdk`, not here)
47pub use backend::{BackendFactory, BackendRegistry};
48
49// Channel vocabulary for the runtime ↔ frontend boundary.
50// Persisted transcript types (`StepFact`, `Prompt`, `ResponseRecord`, …)
51// live in `rite_model::transcript` and are not re-exported here.
52pub use protocol::{
53    ExecEvent, Icon, MaterialOverview, MaterialOverviewKind, PromptId, Response, UiCommand,
54    UiSignal,
55};
56
57// Structured machine/build/environment facts carried by UI signals.
58pub use system_info::{
59    BackendVersion, BuildInfo, Disk, Environment, FeatureCheck, FeatureStatus, Hardening, HostInfo,
60    ParseError as SystemInfoParseError, StartupSnapshot, SystemInfo,
61};
62
63// Shared formatter for live frontends.
64pub use display::{fact_summary, signal_summary, truncate_for_display};
65
66// Reporter: action-facing handle for facts, signals, and prompts.
67pub use reporter::{Reporter, ReporterError};
68
69// Executor and its action trait.
70pub use runner::{Action, ActionError, ActionRegistry, ExecutionSummary, Executor, parse_params};
71
72// Transcript sink, the durable consumer of `StepFact`s.
73pub use transcript_sink::{
74    InMemorySink, JsonlFileSink, LoadedTranscript, TranscriptFingerprint, TranscriptSink,
75    TranscriptVerified, VerifyError, read_verified_transcript,
76    verify_transcript as verify_step_fact_transcript,
77};
78
79// State (needed by `Action` implementors in downstream crates).
80pub use state::{ExecutionState, HandlerContext, StepResult};
81pub use step_info::StepInfo;
82
83// Output / fingerprint helpers.
84pub use output_config::OutputConfig;
85pub use transcript::{compute_file_fingerprint, compute_fingerprint};
86
87// Expression evaluation (used by action implementors).
88pub use expressions::{
89    evaluate, evaluate_expr_value, evaluate_expr_value_to_string, value_to_json,
90};
91
92// Artifact resolution (used by action implementors).
93pub use artifact_resolver::{resolve_artifact_bytes, resolve_backend_key};