pub struct KernelRuntime { /* private fields */ }Expand description
Pure kernel runtime wrapper. SDKs should migrate toward feeding
KernelInput values here instead of directly driving LoopStateMachine.
Implementations§
Source§impl KernelRuntime
impl KernelRuntime
pub fn new(policy: SchedulerBudget) -> Self
Sourcepub fn snapshot(&self) -> Result<KernelSnapshot, KernelFault>
pub fn snapshot(&self) -> Result<KernelSnapshot, KernelFault>
Capture a portable ABI-v2 checkpoint without exposing private scheduler representation.
pub fn snapshot_json(&self) -> Result<String, KernelFault>
Sourcepub fn restore_snapshot(snapshot: KernelSnapshot) -> Result<Self, KernelFault>
pub fn restore_snapshot(snapshot: KernelSnapshot) -> Result<Self, KernelFault>
Restore by deterministically replaying accepted public ABI transactions, then fail closed if any checkpoint metadata differs from the rebuilt runtime.
pub fn restore_snapshot_json(snapshot_json: &str) -> Result<Self, KernelFault>
pub fn is_terminal(&self) -> bool
pub fn diagnostics(&self) -> KernelDiagnostics
pub fn lifecycle(&self) -> KernelLifecycle
pub fn turn(&self) -> u32
pub fn recovery_content_bytes(&self) -> usize
pub fn render(&self) -> RenderedContext
pub fn drain_new_messages(&mut self) -> Vec<Message>
pub fn preserved_refs(&self) -> Vec<String>
pub fn count_tokens(&self, text: &str) -> u32
Sourcepub fn local_subagents_spawned(&self) -> u32
pub fn local_subagents_spawned(&self) -> u32
L1 (RunGroup): this vehicle’s cumulative sub-agent spawns this run, read back by the SDK at run end to charge the group ledger (so the next member’s cumulative spawn cap is seeded correctly).
Sourcepub fn prepare_step(&mut self, input: KernelInput) -> KernelPreparedStep
pub fn prepare_step(&mut self, input: KernelInput) -> KernelPreparedStep
Stage one transition without publishing it as committed runtime state. A newly accepted transition returns an opaque one-shot token; exact event replay and rejected inputs return no token because neither requires a new durable transaction.
Sourcepub fn commit_prepared(
&mut self,
token: &str,
) -> Result<KernelStep, KernelFault>
pub fn commit_prepared( &mut self, token: &str, ) -> Result<KernelStep, KernelFault>
Publish the candidate selected by prepare_step. A token mismatch invalidates this runtime;
the host must discard it and rebuild from the authoritative committed stream.
Sourcepub fn abort_prepared(&mut self, token: &str) -> Result<(), KernelFault>
pub fn abort_prepared(&mut self, token: &str) -> Result<(), KernelFault>
Abort a staged transition after durable append failure. Rollback is intentionally paid only on this failure path: the committed prefix is deterministically rebuilt from its journal, while the normal prepare/commit path moves the candidate state without cloning history.
Sourcepub fn step_json(&mut self, input_json: &str) -> Result<KernelStep, Error>
pub fn step_json(&mut self, input_json: &str) -> Result<KernelStep, Error>
Decode and execute one wire input. The version is probed before decoding the v2 envelope so a v1 payload receives a structured kernel fault rather than a host-language deserialization error.
Sourcepub fn prepare_step_json(
&mut self,
input_json: &str,
) -> Result<KernelPreparedStep, Error>
pub fn prepare_step_json( &mut self, input_json: &str, ) -> Result<KernelPreparedStep, Error>
Decode and stage one wire input for a host-controlled durable commit boundary.