pub struct Engine<O, P, G, D>{ /* private fields */ }Expand description
Aria Engine — the Spec state machine with pluggable backends.
Implementations§
Source§impl<O, P, GB, D> Engine<O, P, GB, D>
impl<O, P, GB, D> Engine<O, P, GB, D>
Sourcepub fn new(
config: AriaConfig,
optical: O,
predictor: P,
graph_backend: GB,
diffuser: D,
) -> Self
pub fn new( config: AriaConfig, optical: O, predictor: P, graph_backend: GB, diffuser: D, ) -> Self
Create a new engine with backends and config.
Sourcepub fn init(
&self,
psi0: Vec<Complex64>,
g0: Graph,
a0: Condition,
) -> Result<State, AriaError>
pub fn init( &self, psi0: Vec<Complex64>, g0: Graph, a0: Condition, ) -> Result<State, AriaError>
Init: create the initial state per FORMAL_SPEC §5.
ψ = ψ₀, z = I(ψ₀), G = G₀, t = 0, prevRes = d(I(ψ₀), P(I(ψ₀), a(0)))
Validates shapes up front: a field of the wrong length is a config error, not a downstream panic or a silently truncated mat-vec.
Sourcepub fn apply(
&self,
state: State,
action: Action,
a: Condition,
) -> Result<State, AriaError>
pub fn apply( &self, state: State, action: Action, a: Condition, ) -> Result<State, AriaError>
Apply a single named action to the state.
Returns the new state on success, or an invariant violation. This is the Spec’s Next relation turned into a deterministic function.
Sourcepub fn step_phi(&self, state: State, a: Condition) -> Result<State, AriaError>
pub fn step_phi(&self, state: State, a: Condition) -> Result<State, AriaError>
Step one full Φ-cycle: OpticalStep → Predict → Match → Diffuse (𝐂4).
This is the preferred schedule. Each sub-step checks invariants. Returns the state after the full cycle, or the first invariant violation.
Sourcepub fn run(
&self,
state: State,
scheduler: &mut Scheduler,
steps: u64,
a: Condition,
) -> Result<(State, Trace), AriaError>
pub fn run( &self, state: State, scheduler: &mut Scheduler, steps: u64, a: Condition, ) -> Result<(State, Trace), AriaError>
Run the engine for a number of steps with a scheduler.
Returns the final state and a trace of all steps.
Sourcepub fn run_monitored(
&self,
state: State,
scheduler: &mut Scheduler,
steps: u64,
a: Condition,
) -> Result<(State, Trace, GateReport), AriaError>
pub fn run_monitored( &self, state: State, scheduler: &mut Scheduler, steps: u64, a: Condition, ) -> Result<(State, Trace, GateReport), AriaError>
Run the engine, additionally monitoring the optional Inv5–Inv11 gates.
The monitor is a passive observer: it sees each completed step and can
only report. Enabling a gate never changes which actions are taken, so
the set of admissible behaviors is exactly the same as for [run].
Sourcepub fn run_monitored_with_latents(
&self,
state: State,
scheduler: &mut Scheduler,
steps: u64,
a: Condition,
) -> Result<MonitoredLatents, AriaError>
pub fn run_monitored_with_latents( &self, state: State, scheduler: &mut Scheduler, steps: u64, a: Condition, ) -> Result<MonitoredLatents, AriaError>
Same loop as Self::run_monitored, plus the post-step latent z.
Used by the post-hoc aria emit surface to recover the z-sequence of
a completed run without writing z into the JSONL — so the default
trace stays byte-stable and emit cannot feed anything back into Φ.
Collecting z is state observation, not a Φ operator.
Sourcepub fn run_monitored_fields(
&self,
state: State,
scheduler: &mut Scheduler,
steps: u64,
a: Condition,
) -> Result<MonitoredFields, AriaError>
pub fn run_monitored_fields( &self, state: State, scheduler: &mut Scheduler, steps: u64, a: Condition, ) -> Result<MonitoredFields, AriaError>
Same loop as Self::run_monitored_with_latents, plus (\arg\psi_0)
after each step. The extra scalars are observer fields. They do not
enter JSONL and they do not change apply.
Sourcepub fn check(&self, state: &State, a: Condition) -> InvariantReport
pub fn check(&self, state: &State, a: Condition) -> InvariantReport
Check all invariants on the current state without applying an action.
Sourcepub fn residual(&self, state: &State, a: Condition) -> f64
pub fn residual(&self, state: &State, a: Condition) -> f64
JEPA residual Res(ψ, z, t) = d(z, P(I(ψ), a_t)).
Public so the WS6 streaming verifier can audit Inv2 / X4 without
retaining a full in-memory crate::trace::Trace.
Sourcepub fn config(&self) -> &AriaConfig
pub fn config(&self) -> &AriaConfig
Access config.
Sourcepub fn graph_backend(&self) -> &GB
pub fn graph_backend(&self) -> &GB
Access the graph backend.
Read-only: the backend owns policy-layer state (the metric index) whose
consistency with G is maintained through commit_ops/revert_ops, so
callers may inspect it but never mutate it behind the engine’s back.