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
impl InProcessRuntime
Sourcepub fn host_event_emitter(&self) -> Arc<HostEventEmitter> ⓘ
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.
Sourcepub fn event_log(&self) -> Arc<dyn EventLog> ⓘ
pub fn event_log(&self) -> Arc<dyn EventLog> ⓘ
Coherent canonical event log backing this runtime.
Sourcepub fn builder() -> InProcessRuntimeBuilder
pub fn builder() -> InProcessRuntimeBuilder
Create a builder for the in-process runtime.
Sourcepub fn default_session_id(&self) -> Option<SessionId>
pub fn default_session_id(&self) -> Option<SessionId>
Return the default session id seeded by
InProcessRuntimeBuilder::single_session, if one was configured.
Sourcepub fn plugin_warnings(&self) -> &[String]
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.
Sourcepub fn register_capability(&self, capability: Arc<dyn Capability>) -> Result<()>
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.
Sourcepub fn is_capability_registered(&self, capability_id: &str) -> bool
pub fn is_capability_registered(&self, capability_id: &str) -> bool
Whether a canonical id or alias already resolves on this runtime.
Sourcepub async fn activate_capability(
&self,
session_id: SessionId,
capability: impl Into<CapabilityRef>,
) -> Result<CapabilityDelta>
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.
Sourcepub async fn deactivate_capability(
&self,
session_id: SessionId,
capability_id: &str,
) -> Result<CapabilityDelta>
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.
Sourcepub async fn run_turn(
&self,
session_id: SessionId,
input: impl Into<InputMessage>,
) -> Result<TurnResult>
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.
Sourcepub async fn run_steerable_turn(
&self,
session_id: SessionId,
input: AcceptedTurnInput,
turn_id: TurnId,
steering: TurnSteering,
) -> Result<TurnResult>
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.
pub async fn run_text_turn( &self, session_id: SessionId, text: impl Into<String>, ) -> Result<TurnResult>
Sourcepub async fn append_accepted_inputs(
&self,
session_id: SessionId,
turn_id: TurnId,
inputs: Vec<AcceptedTurnInput>,
) -> Result<()>
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).
Sourcepub async fn messages(&self, session_id: SessionId) -> Result<Vec<Message>>
pub async fn messages(&self, session_id: SessionId) -> Result<Vec<Message>>
Load the current message history for a session.
Sourcepub async fn read_file(
&self,
session_id: SessionId,
path: &str,
) -> Result<Option<SessionFile>>
pub async fn read_file( &self, session_id: SessionId, path: &str, ) -> Result<Option<SessionFile>>
Read a file from the in-memory session filesystem.
Sourcepub async fn load_context(
&self,
session_id: SessionId,
) -> Result<AssembledTurnContext>
pub async fn load_context( &self, session_id: SessionId, ) -> Result<AssembledTurnContext>
Assemble the current runtime context for a session without executing a turn.
Sourcepub async fn events(&self) -> Result<Vec<Event>>
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.
Sourcepub async fn execute_command(
&self,
session_id: SessionId,
request: ExecuteCommandRequest,
) -> Result<CommandResult>
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.
Sourcepub async fn list_commands(
&self,
session_id: SessionId,
) -> Result<Vec<CommandDescriptor>>
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
impl Clone for InProcessRuntime
Source§fn clone(&self) -> InProcessRuntime
fn clone(&self) -> InProcessRuntime
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl RuntimeHostAdapter for InProcessRuntime
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,
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,
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,
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,
fn capability_registry(&self) -> CapabilityRegistry
fn driver_registry(&self) -> DriverRegistry
fn harness_store(&self, _org_id: i64) -> Arc<dyn HarnessStore> ⓘ
fn agent_store(&self, _org_id: i64) -> Arc<dyn AgentStore> ⓘ
fn session_store(&self, _org_id: i64) -> Arc<dyn SessionStore> ⓘ
fn session_mutator(&self, _org_id: i64) -> Arc<dyn SessionMutator> ⓘ
fn provider_store(&self, _org_id: i64) -> Arc<dyn ProviderStore> ⓘ
fn message_store(&self) -> Arc<dyn MessageRetriever> ⓘ
fn native_async_store(&self) -> Option<Arc<dyn NativeAsyncStore>>
fn compaction_checkpoint_store( &self, ) -> Option<Arc<dyn CompactionCheckpointStore>>
fn event_emitter(&self) -> Arc<dyn EventEmitter> ⓘ
fn file_store(&self) -> Arc<dyn SessionFileSystem> ⓘ
fn storage_store(&self) -> Option<Arc<dyn SessionStorageStore>>
fn connection_resolver(&self) -> Option<Arc<dyn UserConnectionResolver>>
fn session_task_registry(&self) -> Option<Arc<dyn SessionTaskRegistry>>
fn schedule_store(&self, org_id: i64) -> Option<Arc<dyn SessionScheduleStore>>
Source§fn tool_context_extensions(
&self,
org_id: i64,
session_id: SessionId,
) -> ToolContextExtensions
fn tool_context_extensions( &self, org_id: i64, session_id: SessionId, ) -> ToolContextExtensions
Source§fn subagent_delegate(
&self,
org_id: i64,
session_id: SessionId,
) -> Option<Arc<dyn SubagentSessionDelegate>>
fn subagent_delegate( &self, org_id: i64, session_id: SessionId, ) -> Option<Arc<dyn SubagentSessionDelegate>>
Source§fn tool_augmentor(&self) -> Option<Arc<dyn HostToolAugmentor>>
fn tool_augmentor(&self) -> Option<Arc<dyn HostToolAugmentor>>
fn utility_llm_service(&self) -> Option<Arc<dyn UtilityLlmService>>
fn egress_service(&self) -> Option<Arc<dyn EgressService>>
Source§fn provider_retry_config(&self) -> Option<LlmRetryConfig>
fn provider_retry_config(&self) -> Option<LlmRetryConfig>
None (use the provider policy defaults).Source§fn provider_stall_timeout(&self) -> Option<Duration>
fn provider_stall_timeout(&self) -> Option<Duration>
None (use built-in 120s default).Source§fn turn_cancellation(&self) -> Option<Receiver<bool>>
fn turn_cancellation(&self) -> Option<Receiver<bool>>
fn image_resolver(&self, _org_id: i64) -> Option<Arc<dyn ImageResolver>>
fn file_resolver(&self, _org_id: i64) -> Option<Arc<dyn FileResolver>>
fn image_artifact_store( &self, _org_id: i64, ) -> Option<Arc<dyn ImageArtifactStore>>
fn provider_credential_store( &self, _org_id: i64, ) -> Option<Arc<dyn ProviderCredentialStore>>
fn leased_resource_store(&self) -> Option<Arc<dyn LeasedResourceStore>>
fn session_resource_registry(&self) -> Option<Arc<dyn SessionResourceRegistry>>
fn budget_checker( &self, _org_id: i64, _agent_id: Option<AgentId>, ) -> Option<Arc<dyn BudgetChecker>>
Source§fn outbound_tool_rate_limiter(
&self,
_org_id: i64,
) -> Option<Arc<dyn OutboundToolRateLimiter>>
fn outbound_tool_rate_limiter( &self, _org_id: i64, ) -> Option<Arc<dyn OutboundToolRateLimiter>>
None (no rate limiting — suitable for in-process / test environments).Source§fn durable_tool_result_store(&self) -> Option<Arc<dyn DurableToolResultStore>>
fn durable_tool_result_store(&self) -> Option<Arc<dyn DurableToolResultStore>>
None (no durable claim/settle — every execution runs tools fresh).Source§fn subagent_spawn_store(&self) -> Option<Arc<dyn SubagentSpawnStore>>
fn subagent_spawn_store(&self) -> Option<Arc<dyn SubagentSpawnStore>>
None (no spawn dedup — dev/test mode or hosts without durable execution).Source§fn stream_heartbeater(&self) -> Option<Arc<dyn StreamHeartbeater>>
fn stream_heartbeater(&self) -> Option<Arc<dyn StreamHeartbeater>>
None (no heartbeats sent — durable workers supply one).Source§fn partial_stream_store(&self) -> Option<Arc<dyn PartialStreamStore>>
fn partial_stream_store(&self) -> Option<Arc<dyn PartialStreamStore>>
None (no recovery; in-memory and dev hosts use this default).Source§fn reasoning_effort_handle(
&self,
_session_id: SessionId,
) -> Option<ReasoningEffortHandle>
fn reasoning_effort_handle( &self, _session_id: SessionId, ) -> Option<ReasoningEffortHandle>
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,
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_* 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.