pub struct Session {
pub thread_id: String,
pub config: SessionConfig,
/* private fields */
}Fields§
§thread_id: String§config: SessionConfigImplementations§
Source§impl Session
impl Session
Sourcepub fn is_closed(&self) -> bool
pub fn is_closed(&self) -> bool
Returns true when this local session handle is closed. Allocation: none. Complexity: O(1).
Sourcepub async fn ask(
&self,
prompt: impl Into<String>,
) -> Result<PromptRunResult, PromptRunError>
pub async fn ask( &self, prompt: impl Into<String>, ) -> Result<PromptRunResult, PromptRunError>
Continue this session with one prompt. Side effects: sends turn/start RPC calls on one already-loaded thread. Allocation: PromptRunParams clone payloads (cwd/model/sandbox/attachments). Complexity: O(n), n = attachment count + prompt length.
Sourcepub async fn ask_stream(
&self,
prompt: impl Into<String>,
) -> Result<PromptRunStream, PromptRunError>
pub async fn ask_stream( &self, prompt: impl Into<String>, ) -> Result<PromptRunStream, PromptRunError>
Continue this session with one prompt and receive scoped typed turn events. Side effects: sends turn/start RPC calls on one already-loaded thread and consumes only matching live events.
Sourcepub async fn ask_wait(
&self,
prompt: impl Into<String>,
) -> Result<PromptRunResult, PromptRunError>
pub async fn ask_wait( &self, prompt: impl Into<String>, ) -> Result<PromptRunResult, PromptRunError>
Continue this session with one prompt and wait for the scoped stream to finish. Side effects: sends turn/start RPC calls on one already-loaded thread and drains the matching turn stream to completion. Allocation: PromptRunParams clone payloads (cwd/model/sandbox/attachments). Complexity: O(n), n = attachment count + prompt length.
Sourcepub async fn ask_with(
&self,
params: PromptRunParams,
) -> Result<PromptRunResult, PromptRunError>
pub async fn ask_with( &self, params: PromptRunParams, ) -> Result<PromptRunResult, PromptRunError>
Continue this session with one prompt while overriding selected turn options. Side effects: sends turn/start RPC calls on one already-loaded thread. Allocation: depends on caller-provided params. Complexity: O(1) wrapper.
Sourcepub async fn ask_with_profile(
&self,
prompt: impl Into<String>,
profile: RunProfile,
) -> Result<PromptRunResult, PromptRunError>
pub async fn ask_with_profile( &self, prompt: impl Into<String>, profile: RunProfile, ) -> Result<PromptRunResult, PromptRunError>
Continue this session with one prompt using one explicit profile override. Side effects: sends turn/start RPC calls on one already-loaded thread. Allocation: moves profile-owned Strings/vectors + one prompt String. Complexity: O(n), n = attachment count + field sizes.
Sourcepub fn profile(&self) -> RunProfile
pub fn profile(&self) -> RunProfile
Return current session default profile snapshot. Allocation: clones Strings/attachments. Complexity: O(n), n = attachment count + string sizes.