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
impl NativeRuntime
pub fn new( catalog: AgentRegistry, config: NativeRuntimeConfig, ) -> (Gate4AgentHandle, Self)
pub fn new_with_history( catalog: AgentRegistry, config: NativeRuntimeConfig, history: NativeHistoryConfig, ) -> (Gate4AgentHandle, Self)
pub fn new_with_tool_providers( catalog: AgentRegistry, config: NativeRuntimeConfig, providers: impl IntoIterator<Item = CapabilityProviderDescriptor>, ) -> Result<(Gate4AgentHandle, Self), ToolEngineError>
pub fn new_with_history_and_tool_providers( catalog: AgentRegistry, config: NativeRuntimeConfig, history: NativeHistoryConfig, providers: impl IntoIterator<Item = CapabilityProviderDescriptor>, ) -> Result<(Gate4AgentHandle, Self), ToolEngineError>
pub fn install_native_provider( &mut self, provider_id: &ToolProviderId, work_capacity: usize, executor: Box<dyn NativeProviderExecutor>, ) -> Result<ProviderBindingId, NativeProviderControlError>
pub fn retire_native_provider( &mut self, provider_id: &ToolProviderId, ) -> Result<(), NativeProviderControlError>
Sourcepub fn retire_all_native_providers(
&mut self,
) -> Result<(), NativeProviderControlError>
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.
Sourcepub fn native_provider_shutdown_complete(&self) -> bool
pub fn native_provider_shutdown_complete(&self) -> bool
Returns true only after every installed provider supervisor is closed.
Sourcepub async fn shutdown_native_providers(
&mut self,
) -> Result<(), NativeProviderShutdownError>
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.
pub fn native_provider_snapshot( &self, provider_id: &ToolProviderId, ) -> Option<ProviderSupervisorSnapshot>
pub fn drain_provider_exit_acks(&mut self, limit: usize) -> Vec<PhysicalExitAck>
pub fn drain_provider_faults( &mut self, limit: usize, ) -> Vec<ProviderSupervisorFault>
pub fn history_enabled(&self) -> bool
Sourcepub async fn tick(&mut self) -> NativeRuntimeTick
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.
Sourcepub fn tick_profile_snapshot(&self) -> TickProfileSnapshot
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.
Sourcepub fn shell_efficiency_snapshot(&self) -> ShellEfficiencyProfileSnapshot
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.
Sourcepub fn shell_efficiency_profile(&self) -> Arc<Mutex<ShellEfficiencyProfile>> ⓘ
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.
pub fn active_native_sessions(&self) -> usize
Sourcepub fn upsert_native_launch_profile(
&mut self,
profile: NativeLaunchProfile,
) -> Result<(), NativeLaunchProfileError>
pub fn upsert_native_launch_profile( &mut self, profile: NativeLaunchProfile, ) -> Result<(), NativeLaunchProfileError>
Installs or replaces a bounded host-only profile for future spawns.
Sourcepub fn remove_native_launch_profile(
&mut self,
profile_id: &NativeLaunchProfileId,
) -> Result<bool, NativeLaunchProfileError>
pub fn remove_native_launch_profile( &mut self, profile_id: &NativeLaunchProfileId, ) -> Result<bool, NativeLaunchProfileError>
Removes an unselected host-only profile.
Sourcepub fn select_native_launch_profile(
&mut self,
instance_id: AgentInstanceId,
profile_id: NativeLaunchProfileId,
) -> Result<(), NativeLaunchProfileError>
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.
Sourcepub fn clear_native_launch_profile_selection(
&mut self,
instance_id: AgentInstanceId,
) -> bool
pub fn clear_native_launch_profile_selection( &mut self, instance_id: AgentInstanceId, ) -> bool
Clears one instance selection for future spawns only.
Sourcepub fn native_launch_profile_control(&self) -> NativeLaunchProfileControl
pub fn native_launch_profile_control(&self) -> NativeLaunchProfileControl
Returns a clonable selector for future native launch-profile spawns.