pub struct SessionConfig {
pub cwd: String,
pub model: Option<String>,
pub effort: ReasoningEffort,
pub approval_policy: ApprovalPolicy,
pub sandbox_policy: SandboxPolicy,
pub privileged_escalation_approved: bool,
pub attachments: Vec<PromptAttachment>,
pub timeout: Duration,
pub output_schema: Option<Value>,
pub hooks: RuntimeHookConfig,
}Fields§
§cwd: String§model: Option<String>§effort: ReasoningEffort§approval_policy: ApprovalPolicy§sandbox_policy: SandboxPolicy§privileged_escalation_approved: boolExplicit opt-in gate for privileged sandbox usage (SEC-004).
attachments: Vec<PromptAttachment>§timeout: Duration§output_schema: Option<Value>§hooks: RuntimeHookConfigImplementations§
Source§impl SessionConfig
impl SessionConfig
Sourcepub fn new(cwd: impl Into<String>) -> Self
pub fn new(cwd: impl Into<String>) -> Self
Create session config with safe defaults. Allocation: one String for cwd. Complexity: O(cwd length).
Sourcepub fn from_profile(cwd: impl Into<String>, profile: RunProfile) -> Self
pub fn from_profile(cwd: impl Into<String>, profile: RunProfile) -> Self
Create session config from one reusable run profile. Allocation: one String for cwd + profile field moves. Complexity: O(cwd length).
Sourcepub fn profile(&self) -> RunProfile
pub fn profile(&self) -> RunProfile
Materialize profile view of this session defaults. Allocation: clones Strings/attachments. Complexity: O(n), n = attachment count + string sizes.
Sourcepub fn with_model(self, model: impl Into<String>) -> Self
pub fn with_model(self, model: impl Into<String>) -> Self
Set explicit model override. Allocation: one String. Complexity: O(model length).
Sourcepub fn with_effort(self, effort: ReasoningEffort) -> Self
pub fn with_effort(self, effort: ReasoningEffort) -> Self
Set explicit reasoning effort. Allocation: none. Complexity: O(1).
Sourcepub fn with_approval_policy(self, approval_policy: ApprovalPolicy) -> Self
pub fn with_approval_policy(self, approval_policy: ApprovalPolicy) -> Self
Set approval policy override. Allocation: none. Complexity: O(1).
Sourcepub fn with_sandbox_policy(self, sandbox_policy: SandboxPolicy) -> Self
pub fn with_sandbox_policy(self, sandbox_policy: SandboxPolicy) -> Self
Set sandbox policy override. Allocation: depends on payload move/clone at callsite. Complexity: O(1).
Sourcepub fn allow_privileged_escalation(self) -> Self
pub fn allow_privileged_escalation(self) -> Self
Explicitly approve privileged sandbox escalation.
Sourcepub fn with_timeout(self, timeout: Duration) -> Self
pub fn with_timeout(self, timeout: Duration) -> Self
Set timeout. Allocation: none. Complexity: O(1).
Sourcepub fn with_output_schema(self, output_schema: Value) -> Self
pub fn with_output_schema(self, output_schema: Value) -> Self
Set one optional JSON Schema for the final assistant message.
Sourcepub fn with_attachment(self, attachment: PromptAttachment) -> Self
pub fn with_attachment(self, attachment: PromptAttachment) -> Self
Add one generic attachment. Allocation: amortized O(1) push. Complexity: O(1).
Sourcepub fn attach_path(self, path: impl Into<String>) -> Self
pub fn attach_path(self, path: impl Into<String>) -> Self
Add one @path attachment.
Allocation: one String. Complexity: O(path length).
Sourcepub fn attach_path_with_placeholder(
self,
path: impl Into<String>,
placeholder: impl Into<String>,
) -> Self
pub fn attach_path_with_placeholder( self, path: impl Into<String>, placeholder: impl Into<String>, ) -> Self
Add one @path attachment with placeholder.
Allocation: two Strings. Complexity: O(path + placeholder length).
Sourcepub fn attach_image_url(self, url: impl Into<String>) -> Self
pub fn attach_image_url(self, url: impl Into<String>) -> Self
Add one remote image attachment. Allocation: one String. Complexity: O(url length).
Sourcepub fn attach_local_image(self, path: impl Into<String>) -> Self
pub fn attach_local_image(self, path: impl Into<String>) -> Self
Add one local image attachment. Allocation: one String. Complexity: O(path length).
Sourcepub fn attach_skill(
self,
name: impl Into<String>,
path: impl Into<String>,
) -> Self
pub fn attach_skill( self, name: impl Into<String>, path: impl Into<String>, ) -> Self
Add one skill attachment. Allocation: two Strings. Complexity: O(name + path length).
Sourcepub fn with_hooks(self, hooks: RuntimeHookConfig) -> Self
pub fn with_hooks(self, hooks: RuntimeHookConfig) -> Self
Replace hook configuration. Allocation: O(h), h = hook count. Complexity: O(1) move.
Sourcepub fn with_pre_hook(self, hook: Arc<dyn PreHook>) -> Self
pub fn with_pre_hook(self, hook: Arc<dyn PreHook>) -> Self
Register one pre hook. Allocation: amortized O(1) push. Complexity: O(1).
Sourcepub fn with_post_hook(self, hook: Arc<dyn PostHook>) -> Self
pub fn with_post_hook(self, hook: Arc<dyn PostHook>) -> Self
Register one post hook. Allocation: amortized O(1) push. Complexity: O(1).
Sourcepub fn with_pre_tool_use_hook(self, hook: Arc<dyn PreHook>) -> Self
pub fn with_pre_tool_use_hook(self, hook: Arc<dyn PreHook>) -> Self
Register one pre-tool-use hook (fires via the internal approval loop). Allocation: amortized O(1) push. Complexity: O(1).
Trait Implementations§
Source§impl Clone for SessionConfig
impl Clone for SessionConfig
Source§fn clone(&self) -> SessionConfig
fn clone(&self) -> SessionConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more