Skip to main content

InProcessRuntime

Struct InProcessRuntime 

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

Public in-process runtime backed by either in-memory or custom stores.

This runtime is intended for embedders who want to execute Everruns harnesses inside their own process while controlling capabilities, harness definitions, and driver registrations directly in Rust.

Implementations§

Source§

impl InProcessRuntime

Source

pub fn host_event_emitter(&self) -> Arc<HostEventEmitter>

Clone the canonical emitter used by this runtime.

Facades may retain it to append a correlated terminal event after an in-flight turn future is dropped. Calls still commit before observation.

Source

pub fn event_log(&self) -> Arc<dyn EventLog>

Coherent canonical event log backing this runtime.

Source

pub fn builder() -> InProcessRuntimeBuilder

Create a builder for the in-process runtime.

Source

pub fn default_session_id(&self) -> Option<SessionId>

Return the default session id seeded by InProcessRuntimeBuilder::single_session, if one was configured.

Source

pub fn plugin_warnings(&self) -> &[String]

Return non-fatal warnings collected during plugin compilation.

Warnings are also emitted at tracing::warn! level when InProcessRuntimeBuilder::with_plugin_dir is called.

Source

pub fn register_capability(&self, capability: Arc<dyn Capability>) -> Result<()>

Register a capability on a running runtime (EVE-917).

Takes &self, so a host holding Arc<InProcessRuntime> can make a capability discovered after composition — an extension installed mid-conversation, say — resolvable without rebuilding the runtime.

Registration is not activation. Afterwards the id resolves and InProcessRuntime::activate_capability behaves exactly as it does for a capability present at startup, including per-session enablement and the surface invalidation that follows it. Sessions that never activate the id are unaffected.

A duplicate canonical id or an alias that collides with a registered id is rejected, and the existing capability is left untouched. Use InProcessRuntime::is_capability_registered to skip registration for something already present.

Source

pub fn is_capability_registered(&self, capability_id: &str) -> bool

Whether a canonical id or alias already resolves on this runtime.

Source

pub async fn activate_capability( &self, session_id: SessionId, capability: impl Into<CapabilityRef>, ) -> Result<CapabilityDelta>

Activate a registered capability on a running session.

The capability is validated and dependency-resolved before the session overlay changes. Conversation history and the session identity are untouched. Re-activating an already-effective capability is a no-op.

Source

pub async fn deactivate_capability( &self, session_id: SessionId, capability_id: &str, ) -> Result<CapabilityDelta>

Deactivate a capability previously activated on this running session.

Capabilities inherited from the agent or harness cannot be removed by a session-scoped operation; callers must change their owning layer.

Source

pub async fn run_turn( &self, session_id: SessionId, input: impl Into<InputMessage>, ) -> Result<TurnResult>

Execute one turn for an existing session.

The input message is appended as the canonical input.message event; EventHistory derives the read projection from that one write. The turn then runs input -> reason -> act as planned step-by-step by everruns_engine — the same planner the durable worker drives.

Source

pub async fn run_steerable_turn( &self, session_id: SessionId, input: AcceptedTurnInput, turn_id: TurnId, steering: TurnSteering, ) -> Result<TurnResult>

Execute one turn while accepting additional user messages at reason boundaries.

Part of the steering contract described on TurnSteering.

Source

pub async fn run_text_turn( &self, session_id: SessionId, text: impl Into<String>, ) -> Result<TurnResult>

Source

pub async fn append_accepted_inputs( &self, session_id: SessionId, turn_id: TurnId, inputs: Vec<AcceptedTurnInput>, ) -> Result<()>

Persist accepted steering that could not reach another reason boundary.

Part of the steering contract described on TurnSteering. Adding the turn_id parameter here under a host patch release is what broke the published facade (everruns/yolop#665).

Source

pub async fn messages(&self, session_id: SessionId) -> Result<Vec<Message>>

Load the current message history for a session.

Source

pub async fn read_file( &self, session_id: SessionId, path: &str, ) -> Result<Option<SessionFile>>

Read a file from the in-memory session filesystem.

Source

pub async fn load_context( &self, session_id: SessionId, ) -> Result<AssembledTurnContext>

Assemble the current runtime context for a session without executing a turn.

Source

pub async fn events(&self) -> Result<Vec<Event>>

Return canonical durable events collected by this runtime’s log.

This 0.17 convenience paginates through the bounded host SPI and fails once crate::events::MAX_EVENT_HISTORY_REPLAY envelopes are reached.

Source

pub async fn execute_command( &self, session_id: SessionId, request: ExecuteCommandRequest, ) -> Result<CommandResult>

Execute a system command declared by a registered capability.

Looks up the first capability whose commands() includes the named command (in capability-resolution order) and delegates to its execute_command. Returns an error if no capability declares the requested name. The coding-CLI example uses this for /model (provided by ModelSwitcherCapability) so the dispatch path stays inside the capability instead of the TUI’s local handle_command branches.

Source

pub async fn list_commands( &self, session_id: SessionId, ) -> Result<Vec<CommandDescriptor>>

List slash commands available for a session.

Resolves the session’s harness/agent capability chain and aggregates commands declared via Capability::commands, deduplicated by name (first occurrence wins, matching the order of resolved capabilities). This is the embedded equivalent of the server’s GET /v1/sessions/{id}/commands system-commands list — skill commands are not included here because skills are discovered via the platform filesystem rather than the capability registry.

Trait Implementations§

Source§

impl Clone for InProcessRuntime

Source§

fn clone(&self) -> InProcessRuntime

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 RuntimeHostAdapter for InProcessRuntime

Source§

fn set_session_status<'life0, 'async_trait>( &'life0 self, _org_id: i64, session_id: SessionId, _status: SessionExecutionState, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Session status mutation is a host effect, separate from execution inputs: it exposes no stored Session record to the engine.
Source§

fn load_resolved_turn<'life0, 'async_trait>( &'life0 self, _org_id: i64, session_id: SessionId, ) -> Pin<Box<dyn Future<Output = Result<ResolvedTurnInputs>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Load and resolve the turn’s execution inputs. Read more
Source§

fn capability_registry(&self) -> CapabilityRegistry

Source§

fn driver_registry(&self) -> DriverRegistry

Source§

fn harness_store(&self, _org_id: i64) -> Arc<dyn HarnessStore>

Source§

fn agent_store(&self, _org_id: i64) -> Arc<dyn AgentStore>

Source§

fn session_store(&self, _org_id: i64) -> Arc<dyn SessionStore>

Source§

fn session_mutator(&self, _org_id: i64) -> Arc<dyn SessionMutator>

Source§

fn provider_store(&self, _org_id: i64) -> Arc<dyn ProviderStore>

Source§

fn message_store(&self) -> Arc<dyn MessageRetriever>

Source§

fn native_async_store(&self) -> Option<Arc<dyn NativeAsyncStore>>

Source§

fn compaction_checkpoint_store( &self, ) -> Option<Arc<dyn CompactionCheckpointStore>>

Source§

fn event_emitter(&self) -> Arc<dyn EventEmitter>

Source§

fn file_store(&self) -> Arc<dyn SessionFileSystem>

Source§

fn storage_store(&self) -> Option<Arc<dyn SessionStorageStore>>

Source§

fn connection_resolver(&self) -> Option<Arc<dyn UserConnectionResolver>>

Source§

fn session_task_registry(&self) -> Option<Arc<dyn SessionTaskRegistry>>

Source§

fn schedule_store(&self, org_id: i64) -> Option<Arc<dyn SessionScheduleStore>>

Source§

fn tool_context_extensions( &self, org_id: i64, session_id: SessionId, ) -> ToolContextExtensions

Type-erased tool services supplied by layers above the host.
Source§

fn subagent_delegate( &self, org_id: i64, session_id: SessionId, ) -> Option<Arc<dyn SubagentSessionDelegate>>

Neutral subagent delegation supplied by layers above the host.
Source§

fn tool_augmentor(&self) -> Option<Arc<dyn HostToolAugmentor>>

Turn-dependent tools supplied by layers above the host.
Source§

fn utility_llm_service(&self) -> Option<Arc<dyn UtilityLlmService>>

Source§

fn egress_service(&self) -> Option<Arc<dyn EgressService>>

Source§

fn provider_retry_config(&self) -> Option<LlmRetryConfig>

Bounded automatic-recovery policy for provider failures. Default: None (use the provider policy defaults).
Source§

fn provider_stall_timeout(&self) -> Option<Duration>

Provider stall timeout for the Reason activity (EVE-531). Default: None (use built-in 120s default).
Source§

fn turn_cancellation(&self) -> Option<Receiver<bool>>

Durable task cancellation/ownership loss, scoped to this execution.
Source§

fn image_resolver(&self, _org_id: i64) -> Option<Arc<dyn ImageResolver>>

Source§

fn file_resolver(&self, _org_id: i64) -> Option<Arc<dyn FileResolver>>

Source§

fn image_artifact_store( &self, _org_id: i64, ) -> Option<Arc<dyn ImageArtifactStore>>

Source§

fn provider_credential_store( &self, _org_id: i64, ) -> Option<Arc<dyn ProviderCredentialStore>>

Source§

fn leased_resource_store(&self) -> Option<Arc<dyn LeasedResourceStore>>

Source§

fn session_resource_registry(&self) -> Option<Arc<dyn SessionResourceRegistry>>

Source§

fn budget_checker( &self, _org_id: i64, _agent_id: Option<AgentId>, ) -> Option<Arc<dyn BudgetChecker>>

Source§

fn payment_authority( &self, _org_id: i64, _agent_id: Option<AgentId>, ) -> Option<Arc<dyn PaymentAuthority>>

Source§

fn session_creation_authority( &self, _org_id: i64, _session_id: SessionId, ) -> Option<Arc<dyn SessionCreationAuthority>>

Source§

fn outbound_tool_rate_limiter( &self, _org_id: i64, ) -> Option<Arc<dyn OutboundToolRateLimiter>>

Per-org outbound tool-call rate limiter (TM-TOOL-009). Default: None (no rate limiting — suitable for in-process / test environments).
Source§

fn durable_tool_result_store(&self) -> Option<Arc<dyn DurableToolResultStore>>

Per-turn durable tool result store for act-activity idempotency (EVE-530). Default: None (no durable claim/settle — every execution runs tools fresh).
Source§

fn subagent_spawn_store(&self) -> Option<Arc<dyn SubagentSpawnStore>>

Durable subagent spawn handle store for reattach on reclaim (EVE-535). Default: None (no spawn dedup — dev/test mode or hosts without durable execution).
Source§

fn stream_heartbeater(&self) -> Option<Arc<dyn StreamHeartbeater>>

Stream-liveness heartbeater for the Reason activity (EVE-531). Default: None (no heartbeats sent — durable workers supply one).
Source§

fn partial_stream_store(&self) -> Option<Arc<dyn PartialStreamStore>>

Partial-stream store for ContinuePartial recovery (EVE-532). Default: None (no recovery; in-memory and dev hosts use this default).
Source§

fn reasoning_effort_handle( &self, _session_id: SessionId, ) -> Option<ReasoningEffortHandle>

Live, turn-scoped reasoning-effort handle for the given session (EVE-595). Read more
Source§

fn mcp_executor<'life0, 'async_trait>( &'life0 self, _org_id: i64, _session_id: SessionId, ) -> Pin<Box<dyn Future<Output = Option<Arc<dyn McpToolInvoker>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

MCP executor routing mcp_* tool calls for this session, if the host configures MCP (knowledge/integrations/runtime-mcp.md D4). Default: None, so hosts without scoped MCP servers keep the plain tool registry unchanged.

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

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. 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 = !

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