Skip to main content

Runtime

Struct Runtime 

Source
pub struct Runtime {
    pub role: String,
    pub session: Option<String>,
    /* private fields */
}
Expand description

The live agent for ONE role: program + session state + commitment lifecycle + transcript.

Fields§

§role: String§session: Option<String>

public session id (set by SessionHost)

Implementations§

Source§

impl Runtime

Source

pub fn new(prog: &ProtocolProgram, role: &str) -> Result<Self, IdlError>

Source

pub fn state(&self, name: &str) -> Option<&StateValue>

Source

pub fn set_state(&mut self, name: &str, v: StateValue) -> Result<(), String>

Source

pub fn now_phase(&self) -> &str

§53: the current conversation phase (instance-scoped)

Source

pub fn now_ms(&self) -> i64

§49: the runtime clock (absolute, host-injected) — replay equality

Source

pub fn states_snapshot(&self) -> BTreeMap<String, StateValue>

§35.9: full state snapshot (for replay verification)

Source

pub fn enforce_dialogue(&mut self, on: bool)

§16: enable strict dialogue-matrix enforcement for this runtime

Source

pub fn commitment(&self) -> CommitmentStatus

Source

pub fn commitment_status(&self, id: &str) -> Option<CommitmentStatus>

§51: lifecycle status of a NAMED commitment (Unset = unknown id)

Source

pub fn transcript(&self) -> &[LogEntry]

Source

pub fn deliver_internal_error(&mut self, reason: String) -> Vec<OutEvent>

§38.7: route an internal failure to the session’s on error handler. The failure is always logged; the handler runs at most one level deep (failures inside it are logged only — no error loops).

Source

pub fn deliver(&mut self, ev: Event) -> Vec<OutEvent>

Deliver an event: find the FIRST handler whose trigger matches and execute its actions in order. Returns what the agent emits.

Source

pub fn tick(&mut self, elapsed_ms: i64) -> Vec<OutEvent>

Host-injected time (§34): the runtime stays clock-free; the transport host calls tick() with elapsed milliseconds and due timer handlers fire here, deterministically.

Source

pub fn ended(&self) -> bool

Session end check: end when clause against builtins or states.

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<T> Same for T

Source§

type Output = T

Should always be Self
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.