pub struct Client { /* private fields */ }Implementations§
Source§impl Client
impl Client
Sourcepub async fn connect_default() -> Result<Self, ClientError>
pub async fn connect_default() -> Result<Self, ClientError>
Connect using default config (default CLI).
Side effects: spawns <cli_bin> app-server.
Allocation: runtime buffers + internal channels.
Sourcepub async fn connect(config: ClientConfig) -> Result<Self, ClientError>
pub async fn connect(config: ClientConfig) -> Result<Self, ClientError>
Connect using explicit client config.
Side effects: spawns <cli_bin> app-server and validates initialize compatibility guard.
Allocation: runtime buffers + internal channels.
Sourcepub async fn run(
&self,
cwd: impl Into<String>,
prompt: impl Into<String>,
) -> Result<PromptRunResult, PromptRunError>
pub async fn run( &self, cwd: impl Into<String>, prompt: impl Into<String>, ) -> Result<PromptRunResult, PromptRunError>
Run one prompt using default policies (approval=never, sandbox=read-only). Side effects: sends thread/turn RPC calls to app-server.
Sourcepub async fn run_with(
&self,
params: PromptRunParams,
) -> Result<PromptRunResult, PromptRunError>
pub async fn run_with( &self, params: PromptRunParams, ) -> Result<PromptRunResult, PromptRunError>
Run one prompt with explicit model/policy/attachment options. Side effects: sends thread/turn RPC calls to app-server.
Sourcepub async fn run_with_profile(
&self,
cwd: impl Into<String>,
prompt: impl Into<String>,
profile: RunProfile,
) -> Result<PromptRunResult, PromptRunError>
pub async fn run_with_profile( &self, cwd: impl Into<String>, prompt: impl Into<String>, profile: RunProfile, ) -> Result<PromptRunResult, PromptRunError>
Run one prompt with one reusable profile (model/effort/policy/attachments/timeout). Side effects: sends thread/turn RPC calls to app-server. Allocation: moves profile-owned Strings/vectors + one prompt String. Complexity: O(n), n = attachment count + field sizes.
Sourcepub async fn start_session(
&self,
config: SessionConfig,
) -> Result<Session, PromptRunError>
pub async fn start_session( &self, config: SessionConfig, ) -> Result<Session, PromptRunError>
Start a prepared session and return a reusable handle. Side effects: sends thread/start RPC call to app-server. Allocation: clones model/cwd/sandbox into thread-start payload. Complexity: O(n), n = total field sizes.
Sourcepub async fn resume_session(
&self,
thread_id: &str,
config: SessionConfig,
) -> Result<Session, PromptRunError>
pub async fn resume_session( &self, thread_id: &str, config: SessionConfig, ) -> Result<Session, PromptRunError>
Resume an existing session id with prepared defaults. Side effects: sends thread/resume RPC call to app-server. Allocation: clones model/cwd/sandbox into thread-resume payload. Complexity: O(n), n = total field sizes.
Sourcepub fn runtime(&self) -> &Runtime
pub fn runtime(&self) -> &Runtime
Borrow underlying runtime for full low-level control. Allocation: none. Complexity: O(1).
Sourcepub fn config(&self) -> &ClientConfig
pub fn config(&self) -> &ClientConfig
Return connect-time client config snapshot. Allocation: none. Complexity: O(1).
Sourcepub async fn shutdown(&self) -> Result<(), RuntimeError>
pub async fn shutdown(&self) -> Result<(), RuntimeError>
Shutdown child process and background tasks. Side effects: closes channels and terminates child process.