Skip to main content

ShellRuntime

Trait ShellRuntime 

Source
pub trait ShellRuntime: Send + Sync {
    // Required methods
    fn configure_session<'a>(
        &'a self,
        bash_state: &'a mut BashState,
        transition: ShellSessionTransition,
    ) -> ShellRuntimeConfigureFuture<'a>;
    fn run_action<'a>(
        &'a self,
        bash_state: &'a Arc<Mutex<Option<BashState>>>,
        command: BashCommand,
    ) -> ShellRuntimeFuture<'a>;
    fn interrupt<'a>(
        &'a self,
        bash_state: &'a Arc<Mutex<Option<BashState>>>,
    ) -> ShellRuntimeUnitFuture<'a>;
    fn terminate_session<'a>(
        &'a self,
        thread_id: &'a str,
    ) -> ShellRuntimeUnitFuture<'a>;

    // Provided methods
    fn attach_session<'a>(
        &'a self,
        bash_state: &'a mut BashState,
    ) -> ShellRuntimeConfigureFuture<'a> { ... }
    fn run_action_detailed<'a>(
        &'a self,
        bash_state: &'a Arc<Mutex<Option<BashState>>>,
        command: BashCommand,
        _options: ShellActionOptions,
    ) -> ShellRuntimeDetailedFuture<'a> { ... }
    fn supports_generation_bound_actions(&self) -> ShellRuntimeBoolFuture<'_> { ... }
    fn supports_generation_bound_actions_for<'a>(
        &'a self,
        _bash_state: &'a Arc<Mutex<Option<BashState>>>,
    ) -> ShellRuntimeBoolFuture<'a> { ... }
    fn describe_session<'a>(
        &'a self,
        bash_state: &'a Arc<Mutex<Option<BashState>>>,
    ) -> ShellRuntimeStatusFuture<'a> { ... }
    fn interrupt_generation<'a>(
        &'a self,
        bash_state: &'a Arc<Mutex<Option<BashState>>>,
        expected_generation: Option<u64>,
    ) -> ShellRuntimeBoolFuture<'a> { ... }
    fn interrupt_execution<'a>(
        &'a self,
        bash_state: &'a Arc<Mutex<Option<BashState>>>,
        expected: Option<ShellExecutionToken>,
    ) -> ShellRuntimeBoolFuture<'a> { ... }
    fn cancel_pending_action<'a>(
        &'a self,
        _bash_state: &'a Arc<Mutex<Option<BashState>>>,
        _cancellation_key: &'a str,
    ) -> ShellRuntimeBoolFuture<'a> { ... }
}
Expand description

Narrow process-agnostic boundary for BashCommand execution.

Required Methods§

Source

fn configure_session<'a>( &'a self, bash_state: &'a mut BashState, transition: ShellSessionTransition, ) -> ShellRuntimeConfigureFuture<'a>

Source

fn run_action<'a>( &'a self, bash_state: &'a Arc<Mutex<Option<BashState>>>, command: BashCommand, ) -> ShellRuntimeFuture<'a>

Source

fn interrupt<'a>( &'a self, bash_state: &'a Arc<Mutex<Option<BashState>>>, ) -> ShellRuntimeUnitFuture<'a>

Source

fn terminate_session<'a>( &'a self, thread_id: &'a str, ) -> ShellRuntimeUnitFuture<'a>

Release the runtime-owned resources for one logical session.

Provided Methods§

Source

fn attach_session<'a>( &'a self, bash_state: &'a mut BashState, ) -> ShellRuntimeConfigureFuture<'a>

Reattach an adapter to its existing session. External runtimes retain their historical mode-refresh behavior; native runtimes override this with a non-mutating fast path.

Source

fn run_action_detailed<'a>( &'a self, bash_state: &'a Arc<Mutex<Option<BashState>>>, command: BashCommand, _options: ShellActionOptions, ) -> ShellRuntimeDetailedFuture<'a>

Rich adapter path used by MCP orchestration. External runtime implementations remain source-compatible through this default.

Source

fn supports_generation_bound_actions(&self) -> ShellRuntimeBoolFuture<'_>

Source

fn supports_generation_bound_actions_for<'a>( &'a self, _bash_state: &'a Arc<Mutex<Option<BashState>>>, ) -> ShellRuntimeBoolFuture<'a>

Session-aware capability probe. Daemon-backed runtimes override this so the answer comes from the guardian that owns this shell, not merely from the stable control process in front of it.

Source

fn describe_session<'a>( &'a self, bash_state: &'a Arc<Mutex<Option<BashState>>>, ) -> ShellRuntimeStatusFuture<'a>

Describe the session without mutating it. The default inspects the in-process PTY; daemon-backed runtimes ask the guardian that owns it.

Source

fn interrupt_generation<'a>( &'a self, bash_state: &'a Arc<Mutex<Option<BashState>>>, expected_generation: Option<u64>, ) -> ShellRuntimeBoolFuture<'a>

Interrupt only the exact command generation owned by a Task. The conservative default refuses generation-bound interruption.

Source

fn interrupt_execution<'a>( &'a self, bash_state: &'a Arc<Mutex<Option<BashState>>>, expected: Option<ShellExecutionToken>, ) -> ShellRuntimeBoolFuture<'a>

Interrupt only the complete execution identity. External runtimes keep working through the generation-only conservative default.

Source

fn cancel_pending_action<'a>( &'a self, _bash_state: &'a Arc<Mutex<Option<BashState>>>, _cancellation_key: &'a str, ) -> ShellRuntimeBoolFuture<'a>

Cancel a command that is reserved remotely but has not reached the PTY. Embedded runtimes use the in-process cancellation flag and need no additional reservation protocol.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§