Skip to main content

AgentControl

Trait AgentControl 

Source
pub trait AgentControl: Send + Sync {
    // Required methods
    fn send_input(&self, text: &str) -> Result<()>;
    fn cancel(&self) -> Result<()>;
    fn kill(&self) -> Result<()>;
    fn resolve_permission(&self, req: &str, decision: Decision) -> Result<()>;
    fn transport(&self) -> &'static str;

    // Provided methods
    fn send_input_with(
        &self,
        text: &str,
        attachments: &[Attachment],
    ) -> Result<()> { ... }
    fn sleep(&self) -> Result<()> { ... }
    fn wake(&self) -> Result<()> { ... }
    fn resolve_question(&self, id: &str, answers: &[String]) -> Result<()> { ... }
    fn pid(&self) -> Option<u32> { ... }
    fn set_config(
        &self,
        model: Option<&str>,
        effort: Option<&str>,
    ) -> Result<Option<String>> { ... }
}
Expand description

Control handle for a running session.

Required Methods§

Source

fn send_input(&self, text: &str) -> Result<()>

Sends user input / prompt text.

Source

fn cancel(&self) -> Result<()>

Interrupts the current turn (without killing the process).

Source

fn kill(&self) -> Result<()>

Terminates and kills the process.

Source

fn resolve_permission(&self, req: &str, decision: Decision) -> Result<()>

Resolves a permission request.

Source

fn transport(&self) -> &'static str

Actual transport used by this session (for display).

Provided Methods§

Source

fn send_input_with(&self, text: &str, attachments: &[Attachment]) -> Result<()>

Sends a prompt with files/images attached. By default inlines attachments into text; adapters supporting image blocks override this.

Source

fn sleep(&self) -> Result<()>

Pauses child processes (SIGSTOP, used for idle sleep).

Source

fn wake(&self) -> Result<()>

Wakes child processes (SIGCONT).

Source

fn resolve_question(&self, id: &str, answers: &[String]) -> Result<()>

Resolves an interactive user question.

Source

fn pid(&self) -> Option<u32>

Gets the agent main process PID.

Source

fn set_config( &self, model: Option<&str>, effort: Option<&str>, ) -> Result<Option<String>>

Switches model and/or effort at runtime (takes effect from the next turn). On success returns the model actually in effect (if reported by the agent); unsupported adapters return a clear error.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§