Skip to main content

SessionOptions

Struct SessionOptions 

Source
pub struct SessionOptions { /* private fields */ }
Expand description

Creation-time settings for Runtime::open.

Implementations§

Source§

impl SessionOptions

Source

pub fn in_dir(cwd: impl Into<PathBuf>) -> Self

Working directory the agent runs in. Required. A relative path is made absolute (lexically, no disk access): some agents reject a relative cwd.

Source

pub fn configure( self, id: impl Into<ConfigId>, value: impl Into<ConfigValue>, ) -> Self

Set an advertised config option at creation — the path for options with live: false (e.g. a non-live model). open fails with InvalidConfiguration when the agent refuses the value.

Source

pub fn resume(self, token: ResumeToken) -> Self

Resume a provider session instead of creating a new one.

Source

pub fn fork_from(self, token: ResumeToken, at: Option<MessageId>) -> Self

Branch a provider session into a new one that starts with its conversation; the original stays untouched. None forks at the tip. at cuts the copied history after that message, in the id currency the adapter documents (claude: the claude/fork_point extension on MessageEnded). Requires Capability::Fork; open fails typed without it.

Source

pub fn mcp_server(self, server: McpServer) -> Self

Forward a client-owned MCP server. open fails with UnsupportedFeature when the agent lacks the server’s transport.

Source

pub fn permission_mode(self, mode: PermissionMode) -> Self

How tool permission requests are handled; Ask by default.

Source

pub fn config_home(self, dir: impl Into<PathBuf>) -> Self

Point the agent at a separate config directory so one machine can hold several logins side by side (claude: CLAUDE_CONFIG_DIR, codex: CODEX_HOME). This is the supported way to keep logins apart; credential copying stays the application’s job. open fails with InvalidConfiguration on an agent that has no known config-home variable, rather than silently ignoring the request.

Source

pub fn record_wire(self, path: impl Into<PathBuf>) -> Self

Tee every raw protocol frame, both directions, to path for bug reports: one JSON object per line, {"dir":"in"|"out","frame":<frame>}, append-only and flushed per line. A recording failure never fails a turn. Unset (the default) records nothing.

The file is unredacted — prompts, file contents, command output, and possibly secrets — so treat it as sensitive and delete it after use.

Source

pub fn quiet_window(self, window: Duration) -> Self

Overrides the quiet window used to infer turn end on agents whose wire does not end turns deterministically. Diagnostics only.

Source

pub fn stall_after(self, after: Duration) -> Self

How long the agent may stay silent mid-turn before a stall warning Diagnostic (default 120 s). It warns once per silence; never ends the turn.

Source

pub fn cwd(&self) -> &PathBuf

The working directory the agent runs in.

Trait Implementations§

Source§

impl Clone for SessionOptions

Source§

fn clone(&self) -> SessionOptions

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SessionOptions

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoMaybeUndefined<T> for T

Source§

fn into_maybe_undefined(self) -> MaybeUndefined<T>

Converts this value into a three-state builder argument.
Source§

impl<T> IntoOption<T> for T

Source§

fn into_option(self) -> Option<T>

Converts this value into an optional builder argument.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.