pub struct SessionConfigBuilder { /* private fields */ }Expand description
Builder for SessionConfig with fluent API
Implementations§
Source§impl SessionConfigBuilder
impl SessionConfigBuilder
pub fn new(query: impl Into<String>) -> Self
Sourcepub fn resume_session_id(self, id: impl Into<String>) -> Self
pub fn resume_session_id(self, id: impl Into<String>) -> Self
Resume a specific session by ID (maps to –resume)
Sourcepub fn explicit_session_id(self, id: impl Into<String>) -> Self
pub fn explicit_session_id(self, id: impl Into<String>) -> Self
Use a specific session ID (maps to –session-id)
Sourcepub fn continue_last_session(self, yes: bool) -> Self
pub fn continue_last_session(self, yes: bool) -> Self
Continue the last session (maps to –continue)
Sourcepub fn fork_session(self, yes: bool) -> Self
pub fn fork_session(self, yes: bool) -> Self
Fork an existing session (maps to –fork-session)
Sourcepub fn fallback_model(self, model: Model) -> Self
pub fn fallback_model(self, model: Model) -> Self
Set the fallback model (maps to –fallback-model)
Sourcepub fn output_format(self, format: OutputFormat) -> Self
pub fn output_format(self, format: OutputFormat) -> Self
Set the output format
Sourcepub fn input_format(self, format: InputFormat) -> Self
pub fn input_format(self, format: InputFormat) -> Self
Set the input format (maps to –input-format)
Sourcepub fn mcp_config(self, config: MCPConfig) -> Self
pub fn mcp_config(self, config: MCPConfig) -> Self
Set MCP server configuration
Sourcepub fn strict_mcp_config(self, yes: bool) -> Self
pub fn strict_mcp_config(self, yes: bool) -> Self
Enable strict MCP config validation (maps to –strict-mcp-config)
Sourcepub fn permission_mode(self, mode: PermissionMode) -> Self
pub fn permission_mode(self, mode: PermissionMode) -> Self
Set permission mode (maps to –permission-mode)
Sourcepub fn enable_dangerous_permissions(self) -> Self
pub fn enable_dangerous_permissions(self) -> Self
Enable dangerous permission skipping. This sets both –allow-dangerously-skip-permissions and –dangerously-skip-permissions. Use with extreme caution.
Sourcepub fn system_prompt(self, prompt: impl Into<String>) -> Self
pub fn system_prompt(self, prompt: impl Into<String>) -> Self
Set system prompt override (maps to –system-prompt)
Sourcepub fn append_system_prompt(self, prompt: impl Into<String>) -> Self
pub fn append_system_prompt(self, prompt: impl Into<String>) -> Self
Append to system prompt (maps to –append-system-prompt)
Sourcepub fn allowed_tools(self, tools: Vec<String>) -> Self
pub fn allowed_tools(self, tools: Vec<String>) -> Self
Set allowed tools (maps to –allowedTools)
Sourcepub fn disallowed_tools(self, tools: Vec<String>) -> Self
pub fn disallowed_tools(self, tools: Vec<String>) -> Self
Set disallowed tools (maps to –disallowedTools)
Sourcepub fn allow_tool(self, tool: impl Into<String>) -> Self
pub fn allow_tool(self, tool: impl Into<String>) -> Self
Add a single tool to allowed list
Sourcepub fn disallow_tool(self, tool: impl Into<String>) -> Self
pub fn disallow_tool(self, tool: impl Into<String>) -> Self
Add a single tool to disallowed list
Sourcepub fn json_schema(self, schema: impl Into<String>) -> Self
pub fn json_schema(self, schema: impl Into<String>) -> Self
Set JSON schema for structured output (maps to –json-schema)
Sourcepub fn include_partial_messages(self, yes: bool) -> Self
pub fn include_partial_messages(self, yes: bool) -> Self
Include partial messages in stream (maps to –include-partial-messages)
Sourcepub fn replay_user_messages(self, yes: bool) -> Self
pub fn replay_user_messages(self, yes: bool) -> Self
Replay user messages (maps to –replay-user-messages)
Sourcepub fn setting_sources(self, sources: Vec<String>) -> Self
pub fn setting_sources(self, sources: Vec<String>) -> Self
Set setting sources (maps to –setting-sources)
Sourcepub fn add_dir(self, dir: impl Into<PathBuf>) -> Self
pub fn add_dir(self, dir: impl Into<PathBuf>) -> Self
Add a directory to context (maps to –add-dir, repeatable)
Sourcepub fn plugin_dir(self, dir: impl Into<PathBuf>) -> Self
pub fn plugin_dir(self, dir: impl Into<PathBuf>) -> Self
Add a plugin directory (maps to –plugin-dir, repeatable)
Sourcepub fn agents(self, json: impl Into<String>) -> Self
pub fn agents(self, json: impl Into<String>) -> Self
Set agents configuration JSON (maps to –agents)
Sourcepub fn debug_filter(self, filter: impl Into<String>) -> Self
pub fn debug_filter(self, filter: impl Into<String>) -> Self
Set debug filter pattern
Sourcepub fn working_dir(self, dir: impl Into<PathBuf>) -> Self
pub fn working_dir(self, dir: impl Into<PathBuf>) -> Self
Set working directory for the Claude process
Sourcepub fn env(self, env: HashMap<String, String>) -> Self
pub fn env(self, env: HashMap<String, String>) -> Self
Set environment variables to inject into the Claude process
Sourcepub fn env_var(self, key: impl Into<String>, val: impl Into<String>) -> Self
pub fn env_var(self, key: impl Into<String>, val: impl Into<String>) -> Self
Add a single environment variable
Sourcepub fn build(self) -> Result<SessionConfig>
pub fn build(self) -> Result<SessionConfig>
Build the SessionConfig, validating all settings
Auto Trait Implementations§
impl Freeze for SessionConfigBuilder
impl RefUnwindSafe for SessionConfigBuilder
impl Send for SessionConfigBuilder
impl Sync for SessionConfigBuilder
impl Unpin for SessionConfigBuilder
impl UnsafeUnpin for SessionConfigBuilder
impl UnwindSafe for SessionConfigBuilder
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> 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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more