Skip to main content

AsyncRun

Struct AsyncRun 

Source
pub struct AsyncRun { /* private fields */ }

Methods from Deref<Target = Run>§

Source

pub async fn amodel_call<F, Fut>( &mut self, payload: Value, options: CallOptions, handler: F, ) -> Result<Node>
where F: FnOnce(Value) -> Fut, Fut: Future<Output = Result<Value>>,

Await a model callback only after replay, identity and budget checks. Dropping the future after dispatch settles a conservative unknown-outcome recording, so uncertainty cannot silently become a reusable result.

Source

pub async fn atool_call<F, Fut>( &mut self, name: &str, args: Value, options: CallOptions, handler: F, ) -> Result<Node>
where F: FnOnce(Value) -> Fut, Fut: Future<Output = Result<Value>>,

Await an unfenced tool. Registered runtimes reject this escape hatch.

Source

pub fn model_stream<F, I, O>( &mut self, payload: Value, options: CallOptions, keep_chunks: bool, handler: F, on_delta: O, ) -> Result<Node>
where F: FnOnce(Value) -> Result<I>, I: IntoIterator<Item = Result<Value>>, O: FnMut(&Value) -> Result<()>,

Consume a native iterator of chunks. Replay reemits retained snapshots.

Source

pub fn tool_stream<F, I, O>( &mut self, name: &str, args: Value, options: CallOptions, keep_chunks: bool, handler: F, on_delta: O, ) -> Result<Node>
where F: FnOnce(Value) -> Result<I>, I: IntoIterator<Item = Result<Value>>, O: FnMut(&Value) -> Result<()>,

Source

pub async fn amodel_stream<F, Fut, O, OFut>( &mut self, payload: Value, options: CallOptions, keep_chunks: bool, next_chunk: F, on_delta: O, ) -> Result<Node>
where F: FnMut() -> Fut, Fut: Future<Output = Result<Option<Value>>>, O: FnMut(Value) -> OFut, OFut: Future<Output = Result<()>>,

Pull chunks from an async producer. None ends the stream. The closure can own a network stream without requiring a particular executor crate.

Source

pub async fn atool_stream<F, Fut, O, OFut>( &mut self, name: &str, args: Value, options: CallOptions, keep_chunks: bool, next_chunk: F, on_delta: O, ) -> Result<Node>
where F: FnMut() -> Fut, Fut: Future<Output = Result<Option<Value>>>, O: FnMut(Value) -> OFut, OFut: Future<Output = Result<()>>,

Source

pub fn root_id(&self) -> &str

Source

pub fn cursor_id(&self) -> &str

Source

pub fn cursor(&self) -> Result<Node>

Source

pub fn spent(&self) -> Result<Charges>

Source

pub fn avoided(&self) -> Charges

Source

pub fn report(&self) -> Result<RunReport>

Source

pub fn prune(&mut self) -> Result<()>

Source

pub fn rollback_steps(&mut self, steps: usize) -> Result<Node>

Source

pub fn model_call<F>( &mut self, payload: Value, options: CallOptions, handler: F, ) -> Result<Node>
where F: FnOnce(Value) -> Result<Value>,

Source

pub fn revalidate_model_call<F>( &mut self, payload: Value, contract: &ReplayContract, options: RevalidationOptions, handler: F, ) -> Result<RevalidationReport>
where F: FnOnce(Value) -> Result<Value>,

Compare a stored model result with a separately recorded live observation. The continuation cursor returns to the original recording after comparison.

Source

pub fn revalidate_model_call_with_comparator<F>( &mut self, payload: Value, contract: &ReplayContract, options: RevalidationOptions, comparator: &dyn RevalidationComparator, handler: F, ) -> Result<RevalidationReport>
where F: FnOnce(Value) -> Result<Value>,

Source

pub async fn revalidate_model_call_async<F, Fut>( &mut self, payload: Value, contract: &ReplayContract, options: RevalidationOptions, handler: F, ) -> Result<RevalidationReport>
where F: FnOnce(Value) -> Fut, Fut: Future<Output = Result<Value>>,

Source

pub async fn revalidate_model_call_async_with_comparator<F, Fut>( &mut self, payload: Value, contract: &ReplayContract, options: RevalidationOptions, comparator: &dyn RevalidationComparator, handler: F, ) -> Result<RevalidationReport>
where F: FnOnce(Value) -> Fut, Fut: Future<Output = Result<Value>>,

Source

pub fn revalidate_model_stream<F, I, O>( &mut self, payload: Value, contract: &ReplayContract, options: RevalidationOptions, handler: F, on_delta: O, ) -> Result<RevalidationReport>
where F: FnOnce(Value) -> Result<I>, I: IntoIterator<Item = Result<Value>>, O: FnMut(&Value) -> Result<()>,

Stream a live observation, then compare it without replacing the golden recording.

Source

pub fn revalidate_model_stream_with_comparator<F, I, O>( &mut self, payload: Value, contract: &ReplayContract, options: RevalidationOptions, comparator: &dyn RevalidationComparator, handler: F, on_delta: O, ) -> Result<RevalidationReport>
where F: FnOnce(Value) -> Result<I>, I: IntoIterator<Item = Result<Value>>, O: FnMut(&Value) -> Result<()>,

Source

pub async fn revalidate_model_stream_async<F, N, Fut, O, OFut>( &mut self, payload: Value, contract: &ReplayContract, options: RevalidationOptions, handler: F, on_delta: O, ) -> Result<RevalidationReport>
where F: FnOnce(Value) -> Result<N>, N: FnMut() -> Fut, Fut: Future<Output = Result<Option<Value>>>, O: FnMut(Value) -> OFut, OFut: Future<Output = Result<()>>,

Construct the asynchronous pull stream only after governance gates pass.

Source

pub async fn revalidate_model_stream_async_with_comparator<F, N, Fut, O, OFut>( &mut self, payload: Value, contract: &ReplayContract, options: RevalidationOptions, comparator: &dyn RevalidationComparator, handler: F, on_delta: O, ) -> Result<RevalidationReport>
where F: FnOnce(Value) -> Result<N>, N: FnMut() -> Fut, Fut: Future<Output = Result<Option<Value>>>, O: FnMut(Value) -> OFut, OFut: Future<Output = Result<()>>,

Source

pub fn tool_call<F>( &mut self, name: &str, args: Value, options: CallOptions, handler: F, ) -> Result<Node>
where F: FnOnce(Value) -> Result<Value>,

Unfenced tool callback. Disallowed when a registry is attached.

Source

pub fn registered_tool_call( &mut self, name: &str, version: Option<&str>, args: Value, options: CallOptions, ) -> Result<Node>

Source

pub async fn registered_tool_call_async( &mut self, name: &str, version: Option<&str>, args: Value, options: CallOptions, ) -> Result<Node>

Source

pub fn confirm(&mut self, token: &str) -> Result<Node>

Consume a policy-issued token exactly once at its original cursor.

Source

pub async fn confirm_async(&mut self, token: &str) -> Result<Node>

Source

pub fn note(&mut self, payload: Value, attempt: u64) -> Result<Node>

Source

pub fn branch(&mut self, attempt: u64, budget: Option<Budget>) -> Result<Self>

Branch shares stored charges and budget scopes. Adopt explicitly to move the parent’s cursor; abandoning a branch never refunds dispatched work.

Source

pub fn branch_with_meters( &mut self, attempt: u64, budget: Option<Budget>, meter_budget: MeterBudget, ) -> Result<Self>

Source

pub fn adopt(&mut self, branch: &Self) -> Result<Node>

Source

pub fn rollback(&mut self, target: &str) -> Result<Node>

Trait Implementations§

Source§

impl Deref for AsyncRun

Source§

type Target = Run

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Run

Dereferences the value.
Source§

impl DerefMut for AsyncRun

Source§

fn deref_mut(&mut self) -> &mut Run

Mutably dereferences the value.
Source§

impl From<Run> for AsyncRun

Source§

fn from(inner: Run) -> Self

Converts to this type from the input type.

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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> 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 = !

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

fn try_from(value: U) -> Result<T, !>

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.