Skip to main content

NativeRuntime

Struct NativeRuntime 

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

Owns the kernel tick and all native effect workers. Product apps retain only the bounded handle returned by NativeRuntime::new.

Implementations§

Source§

impl NativeRuntime

Source

pub fn new( catalog: AgentRegistry, config: NativeRuntimeConfig, ) -> (Gate4AgentHandle, Self)

Source

pub fn new_with_history( catalog: AgentRegistry, config: NativeRuntimeConfig, history: NativeHistoryConfig, ) -> (Gate4AgentHandle, Self)

Source

pub fn new_with_tool_providers( catalog: AgentRegistry, config: NativeRuntimeConfig, providers: impl IntoIterator<Item = CapabilityProviderDescriptor>, ) -> Result<(Gate4AgentHandle, Self), ToolEngineError>

Source

pub fn new_with_history_and_tool_providers( catalog: AgentRegistry, config: NativeRuntimeConfig, history: NativeHistoryConfig, providers: impl IntoIterator<Item = CapabilityProviderDescriptor>, ) -> Result<(Gate4AgentHandle, Self), ToolEngineError>

Source

pub fn tool_authority(&self) -> ToolAuthorityHandle

Source

pub fn install_native_provider( &mut self, provider_id: &ToolProviderId, work_capacity: usize, executor: Box<dyn NativeProviderExecutor>, ) -> Result<ProviderBindingId, NativeProviderControlError>

Source

pub fn retire_native_provider( &mut self, provider_id: &ToolProviderId, ) -> Result<(), NativeProviderControlError>

Source

pub fn retire_all_native_providers( &mut self, ) -> Result<(), NativeProviderControlError>

Begins non-blocking retirement for every installed native provider.

The owner must keep calling NativeRuntime::tick until NativeRuntime::native_provider_shutdown_complete returns true before dropping the runtime. Dropping the runtime does not acknowledge physical provider exit or complete coordinated shutdown.

Source

pub fn native_provider_shutdown_complete(&self) -> bool

Returns true only after every installed provider supervisor is closed.

Source

pub async fn shutdown_native_providers( &mut self, ) -> Result<(), NativeProviderShutdownError>

Drives the canonical runtime path until every native provider has detached after physical teardown, or returns the still-owned snapshots at the configured shutdown deadline. Lifecycle events remain buffered for explicit operator drain after this method returns.

Source

pub fn native_provider_snapshot( &self, provider_id: &ToolProviderId, ) -> Option<ProviderSupervisorSnapshot>

Source

pub fn drain_provider_exit_acks(&mut self, limit: usize) -> Vec<PhysicalExitAck>

Source

pub fn drain_provider_faults( &mut self, limit: usize, ) -> Vec<ProviderSupervisorFault>

Source

pub fn history_enabled(&self) -> bool

Source

pub async fn tick(&mut self) -> NativeRuntimeTick

Run one non-blocking host tick. Effects are dispatched in session order to per-instance workers; their observations enter later ticks.

Source

pub fn tick_profile_snapshot(&self) -> TickProfileSnapshot

Snapshot of the last tick_profile::SAMPLE_WINDOW ticks’ own per-phase timing distributions – the number /metrics reads to name which piece of an otherwise-idle Self::tick is spending the CPU.

Source

pub fn shell_efficiency_snapshot(&self) -> ShellEfficiencyProfileSnapshot

Snapshot of every shell-efficiency series folded in from the per-instance worker loops – see shell_efficiency’s own doc comment. Locked only for this read, mirroring tick_profile_snapshot.

Source

pub fn shell_efficiency_profile(&self) -> Arc<Mutex<ShellEfficiencyProfile>> ⓘ

The live profile, for a consumer that wants to decide WHEN to pay for a snapshot.

snapshot() sorts every ring it reads to produce percentiles, and both this module and tick_profile state that the sort belongs on the read rather than on the tick. Handing out the Arc lets GET /metrics pay it per request instead of the node’s drive loop paying it ninety times a second to keep a copy nobody has asked for warm.

Source

pub fn active_native_sessions(&self) -> usize

Source

pub fn upsert_native_launch_profile( &mut self, profile: NativeLaunchProfile, ) -> Result<(), NativeLaunchProfileError>

Installs or replaces a bounded host-only profile for future spawns.

Source

pub fn remove_native_launch_profile( &mut self, profile_id: &NativeLaunchProfileId, ) -> Result<bool, NativeLaunchProfileError>

Removes an unselected host-only profile.

Source

pub fn select_native_launch_profile( &mut self, instance_id: AgentInstanceId, profile_id: NativeLaunchProfileId, ) -> Result<(), NativeLaunchProfileError>

Selects a profile for future spawns of one exact instance.

Spawn dispatch is the linearization point: a selection change does not alter a child that was already dispatched or started.

Source

pub fn clear_native_launch_profile_selection( &mut self, instance_id: AgentInstanceId, ) -> bool

Clears one instance selection for future spawns only.

Source

pub fn native_launch_profile_control(&self) -> NativeLaunchProfileControl

Returns a clonable selector for future native launch-profile spawns.

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