Skip to main content

VifuRuntime

Struct VifuRuntime 

Source
pub struct VifuRuntime { /* private fields */ }
Expand description

A self-contained runtime for one application or project.

One runtime may register multiple providers, agents, and stable named endpoints. It can run directly inside a Rust host; Vifu Server and Agent Gateway are optional deployment components.

Implementations§

Source§

impl VifuRuntime

Source

pub fn new(project_id: impl Into<String>) -> Result<Self, RuntimeError>

Source

pub fn with_store( project_id: impl Into<String>, store: Arc<dyn RuntimeStore>, ) -> Result<Self, RuntimeError>

Source

pub fn project_id(&self) -> &str

Source

pub fn set_monitor_observer( &self, observer: Option<RuntimeMonitorObserver>, ) -> Result<(), RuntimeError>

Installs or clears the payload-safe runtime lifecycle observer.

Source

pub fn set_monitor_io_observer( &self, observer: Option<RuntimeMonitorIoObserver>, ) -> Result<(), RuntimeError>

Installs or clears the opt-in bounded invocation I/O observer.

Source

pub fn register_provider( &self, name: impl Into<String>, provider: Arc<dyn AgentProvider>, ) -> Result<(), RuntimeError>

Source

pub fn unregister_provider(&self, name: &str) -> Result<bool, RuntimeError>

Removes a provider from the runtime registry.

An invocation that already acquired the provider keeps its own Arc until that invocation finishes. New invocations fail normally until a provider with the same name is registered again.

Source

pub fn unregister_agent(&self, id: &str) -> Result<bool, RuntimeError>

Source

pub fn unregister_endpoint(&self, name: &str) -> Result<bool, RuntimeError>

Source

pub fn register_agent(&self, agent: AgentDefinition) -> Result<(), RuntimeError>

Source

pub fn register_endpoint( &self, endpoint: EndpointDefinition, ) -> Result<(), RuntimeError>

Source

pub fn agent_definitions(&self) -> Result<Vec<AgentDefinition>, RuntimeError>

Source

pub fn endpoint_definitions( &self, ) -> Result<Vec<EndpointDefinition>, RuntimeError>

Source

pub fn apply_manifest( &self, manifest: RuntimeManifest, ) -> Result<(), RuntimeError>

Replaces the portable agent and endpoint graph with a validated manifest. Provider implementations must be registered locally before activation.

Source

pub fn apply_project_settings( &self, settings: ProjectSettings, ) -> Result<(), RuntimeError>

Source

pub fn current_manifest(&self) -> Result<Option<RuntimeManifest>, RuntimeError>

Source

pub fn current_project_settings( &self, ) -> Result<Option<ProjectSettings>, RuntimeError>

Source

pub fn install_release( &self, release: &RuntimeRelease, ) -> Result<(), RuntimeError>

Source

pub fn releases(&self) -> Result<Vec<RuntimeRelease>, RuntimeError>

Source

pub fn active_release_version(&self) -> Result<Option<u64>, RuntimeError>

Source

pub fn activate_release( &self, version: u64, ) -> Result<RuntimeRelease, RuntimeError>

Source

pub fn restore_active_release( &self, ) -> Result<Option<RuntimeRelease>, RuntimeError>

Source

pub fn bootstrap_release( &self, manifest: RuntimeManifest, ) -> Result<RuntimeRelease, RuntimeError>

Source

pub fn bootstrap_project_settings( &self, settings: ProjectSettings, ) -> Result<RuntimeRelease, RuntimeError>

Source

pub fn save_local_provider_binding( &self, binding: &LocalProviderBinding, ) -> Result<(), RuntimeError>

Source

pub fn local_provider_bindings( &self, ) -> Result<Vec<LocalProviderBinding>, RuntimeError>

Source

pub fn pending_traces( &self, limit: usize, ) -> Result<Vec<RuntimeTraceRecord>, RuntimeError>

Source

pub fn acknowledge_traces( &self, trace_ids: &[String], ) -> Result<(), RuntimeError>

Source

pub fn session( &self, session_id: impl Into<String>, ) -> Result<RuntimeSession, RuntimeError>

Source

pub async fn invoke( &self, input: InvocationInput, ) -> Result<InvocationOutput, RuntimeError>

Source

pub async fn invoke_with_cancellation( &self, input: InvocationInput, cancellation: CancellationToken, ) -> Result<InvocationOutput, RuntimeError>

Invokes an endpoint while honoring a cancellation signal owned by the embedding host.

Source

pub async fn invoke_with_events_and_cancellation( &self, input: InvocationInput, cancellation: CancellationToken, events: ProviderEventSink, ) -> Result<InvocationOutput, RuntimeError>

Invokes an endpoint while forwarding real provider progress to an embedding host and honoring the host’s cancellation signal.

Source

pub fn start_invoke( &self, input: InvocationInput, ) -> Result<InvocationHandle, RuntimeError>

Source

pub fn poll_invocation( &self, handle: &InvocationHandle, ) -> Result<InvocationPoll, RuntimeError>

Source

pub fn drain_invocation_events( &self, handle: &InvocationHandle, ) -> Result<Vec<InvocationEvent>, RuntimeError>

Drains incremental events produced since the previous call.

Source

pub fn take_invocation( &self, handle: &InvocationHandle, ) -> Result<InvocationPoll, RuntimeError>

Returns the current poll state and removes it once it is terminal.

Pending and running invocations remain registered so callers can keep polling the same handle.

Source

pub fn cancel_invocation( &self, handle: &InvocationHandle, ) -> Result<(), RuntimeError>

Source

pub async fn execute_effects( &self, effects: Vec<EffectRequest>, ) -> Result<EffectExecution, RuntimeError>

Source

pub async fn execute_effects_with_limit( &self, effects: Vec<EffectRequest>, limit: usize, ) -> Result<EffectExecution, RuntimeError>

Source

pub fn export_snapshot(&self) -> Result<Vec<u8>, RuntimeError>

Source

pub fn restore_snapshot(&self, bytes: &[u8]) -> Result<(), RuntimeError>

Trait Implementations§

Source§

impl Clone for VifuRuntime

Source§

fn clone(&self) -> VifuRuntime

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for VifuRuntime

Source§

fn fmt(&self, formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> ConditionalSend for T
where T: Send,

Source§

impl<T> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Converts Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Converts Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
Source§

fn as_any(&self) -> &(dyn Any + 'static)

Converts &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Converts &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> DowncastSend for T
where T: Any + Send,

Source§

fn into_any_send(self: Box<T>) -> Box<dyn Any + Send>

Converts Box<Trait> (where Trait: DowncastSend) to Box<dyn Any + Send>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoResult<T> for T

Source§

fn into_result(self) -> Result<T, RunSystemError>

Converts this type into the system output type.
Source§

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

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more