Skip to main content

KernelRuntime

Struct KernelRuntime 

Source
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

Source

pub fn new(policy: SchedulerBudget) -> Self

Source

pub fn snapshot(&self) -> Result<KernelSnapshot, KernelFault>

Capture a portable ABI-v2 checkpoint without exposing private scheduler representation.

Source

pub fn snapshot_json(&self) -> Result<String, KernelFault>

Source

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.

Source

pub fn restore_snapshot_json(snapshot_json: &str) -> Result<Self, KernelFault>

Source

pub fn is_terminal(&self) -> bool

Source

pub fn diagnostics(&self) -> KernelDiagnostics

Source

pub fn lifecycle(&self) -> KernelLifecycle

Source

pub fn turn(&self) -> u32

Source

pub fn recovery_content_bytes(&self) -> usize

Source

pub fn render(&self) -> RenderedContext

Source

pub fn drain_new_messages(&mut self) -> Vec<Message>

Source

pub fn preserved_refs(&self) -> Vec<String>

Source

pub fn count_tokens(&self, text: &str) -> u32

Source

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).

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn step(&mut self, input: KernelInput) -> KernelStep

Trait Implementations§

Source§

impl Deref for KernelRuntime

Source§

type Target = KernelRuntimeState

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl DerefMut for KernelRuntime

Source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.