pub struct TerminalClient { /* private fields */ }Expand description
Terminal API client for sending terminal requests to the ACP Client
The Client (editor like Zed) manages the actual PTY, and this client sends requests through the ACP protocol to create, manage, and interact with terminals.
Implementations§
Source§impl TerminalClient
impl TerminalClient
Sourcepub fn new(
connection_cx: JrConnectionCx<AgentToClient>,
session_id: impl Into<SessionId>,
) -> Self
pub fn new( connection_cx: JrConnectionCx<AgentToClient>, session_id: impl Into<SessionId>, ) -> Self
Create a new Terminal API client
Sourcepub async fn create(
&self,
command: impl Into<String>,
args: Vec<String>,
cwd: Option<PathBuf>,
output_byte_limit: Option<u64>,
) -> Result<TerminalId, AgentError>
pub async fn create( &self, command: impl Into<String>, args: Vec<String>, cwd: Option<PathBuf>, output_byte_limit: Option<u64>, ) -> Result<TerminalId, AgentError>
Create a new terminal and execute a command
Returns a TerminalId that can be used with other terminal methods.
The terminal will execute the specified command and capture output.
§Arguments
command- The command to executeargs- Command argumentscwd- Optional working directory (uses session cwd if not specified)output_byte_limit- Optional limit on output bytes to retain
Sourcepub async fn output(
&self,
terminal_id: impl Into<TerminalId>,
) -> Result<TerminalOutputResponse, AgentError>
pub async fn output( &self, terminal_id: impl Into<TerminalId>, ) -> Result<TerminalOutputResponse, AgentError>
Get the current output and status of a terminal
Returns the output captured so far and the exit status if completed.
Sourcepub async fn wait_for_exit(
&self,
terminal_id: impl Into<TerminalId>,
) -> Result<WaitForTerminalExitResponse, AgentError>
pub async fn wait_for_exit( &self, terminal_id: impl Into<TerminalId>, ) -> Result<WaitForTerminalExitResponse, AgentError>
Wait for a terminal command to exit
Blocks until the command completes and returns the exit status.
Sourcepub async fn kill(
&self,
terminal_id: impl Into<TerminalId>,
) -> Result<KillTerminalCommandResponse, AgentError>
pub async fn kill( &self, terminal_id: impl Into<TerminalId>, ) -> Result<KillTerminalCommandResponse, AgentError>
Kill a terminal command
Sends SIGTERM to terminate the command. The terminal remains valid and can be queried for output or released.
Sourcepub async fn release(
&self,
terminal_id: impl Into<TerminalId>,
) -> Result<ReleaseTerminalResponse, AgentError>
pub async fn release( &self, terminal_id: impl Into<TerminalId>, ) -> Result<ReleaseTerminalResponse, AgentError>
Release a terminal and free its resources
After release, the TerminalId can no longer be used.
Any unretrieved output will be lost.
Sourcepub fn session_id(&self) -> &SessionId
pub fn session_id(&self) -> &SessionId
Get the session ID
Trait Implementations§
Source§impl Clone for TerminalClient
impl Clone for TerminalClient
Source§fn clone(&self) -> TerminalClient
fn clone(&self) -> TerminalClient
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for TerminalClient
impl !RefUnwindSafe for TerminalClient
impl Send for TerminalClient
impl Sync for TerminalClient
impl Unpin for TerminalClient
impl !UnwindSafe for TerminalClient
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoMaybeUndefined<T> for T
impl<T> IntoMaybeUndefined<T> for T
fn into_maybe_undefined(self) -> MaybeUndefined<T>
Source§impl<T> IntoOption<T> for T
impl<T> IntoOption<T> for T
fn into_option(self) -> Option<T>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request