TerminalProvider

Trait TerminalProvider 

Source
pub trait TerminalProvider:
    Environment
    + Send
    + Sync {
    // Required methods
    fn CreateTerminal<'life0, 'async_trait>(
        &'life0 self,
        OptionsValue: Value,
    ) -> Pin<Box<dyn Future<Output = Result<Value, CommonError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn SendTextToTerminal<'life0, 'async_trait>(
        &'life0 self,
        TerminalId: u64,
        Text: String,
    ) -> Pin<Box<dyn Future<Output = Result<(), CommonError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn DisposeTerminal<'life0, 'async_trait>(
        &'life0 self,
        TerminalId: u64,
    ) -> Pin<Box<dyn Future<Output = Result<(), CommonError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn ShowTerminal<'life0, 'async_trait>(
        &'life0 self,
        TerminalId: u64,
        PreserveFocus: bool,
    ) -> Pin<Box<dyn Future<Output = Result<(), CommonError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn HideTerminal<'life0, 'async_trait>(
        &'life0 self,
        TerminalId: u64,
    ) -> Pin<Box<dyn Future<Output = Result<(), CommonError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn GetTerminalProcessId<'life0, 'async_trait>(
        &'life0 self,
        TerminalId: u64,
    ) -> Pin<Box<dyn Future<Output = Result<Option<u32>, CommonError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

An abstract service contract for an environment component that can manage integrated terminal processes.

This trait is implemented by MountainEnvironment, and its methods are responsible for spawning and managing native pseudo-terminal (PTY) processes, handling their I/O, and managing their lifecycle.

Required Methods§

Source

fn CreateTerminal<'life0, 'async_trait>( &'life0 self, OptionsValue: Value, ) -> Pin<Box<dyn Future<Output = Result<Value, CommonError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Creates a new terminal instance with the given options.

§Parameters
  • OptionsValue: A serde_json::Value DTO representing TerminalOptions, which can specify the name, shell path, arguments, etc.
§Returns

A Result containing a JSON Value with details of the created terminal (e.g., its ID and process ID), or a CommonError on failure.

Source

fn SendTextToTerminal<'life0, 'async_trait>( &'life0 self, TerminalId: u64, Text: String, ) -> Pin<Box<dyn Future<Output = Result<(), CommonError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Sends a string of text as input to a specific terminal instance’s underlying pseudo-terminal process.

§Parameters
  • TerminalId: The unique identifier of the target terminal.
  • Text: The text to send to the terminal’s standard input.
Source

fn DisposeTerminal<'life0, 'async_trait>( &'life0 self, TerminalId: u64, ) -> Pin<Box<dyn Future<Output = Result<(), CommonError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Disposes of a specific terminal instance. This involves terminating the underlying shell process and cleaning up any associated resources.

§Parameters
  • TerminalId: The unique identifier of the terminal to dispose of.
Source

fn ShowTerminal<'life0, 'async_trait>( &'life0 self, TerminalId: u64, PreserveFocus: bool, ) -> Pin<Box<dyn Future<Output = Result<(), CommonError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Shows a terminal in the UI, optionally giving it focus.

§Parameters
  • TerminalId: The unique identifier of the terminal to show.
  • PreserveFocus: If true, the terminal panel is revealed but focus is not given to it.
Source

fn HideTerminal<'life0, 'async_trait>( &'life0 self, TerminalId: u64, ) -> Pin<Box<dyn Future<Output = Result<(), CommonError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Hides the terminal panel if the specified terminal is active.

§Parameters
  • TerminalId: The unique identifier of the terminal to hide.
Source

fn GetTerminalProcessId<'life0, 'async_trait>( &'life0 self, TerminalId: u64, ) -> Pin<Box<dyn Future<Output = Result<Option<u32>, CommonError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Gets the process ID (PID) of the underlying shell process for a terminal.

§Parameters
  • TerminalId: The unique identifier of the terminal to query.
§Returns

An Option<u32> with the PID if the process is running, or None.

Implementors§