pub struct WorkflowConfig {
pub cwd: String,
pub client_config: ClientConfig,
pub run_profile: RunProfile,
}Expand description
One explicit data model for reusable workflow defaults. This keeps simple and advanced paths on a single concrete structure.
Fields§
§cwd: String§client_config: ClientConfig§run_profile: RunProfileImplementations§
Source§impl WorkflowConfig
impl WorkflowConfig
Sourcepub fn new(cwd: impl Into<String>) -> Self
pub fn new(cwd: impl Into<String>) -> Self
Create config with safe defaults:
- runtime discovery via
ClientConfig::new() - model unset, effort medium, approval never, sandbox read-only
- cwd normalized to absolute path without filesystem existence checks (non-utf8 absolute paths fall back to caller-provided UTF-8 input without lossy conversion)
Sourcepub fn with_client_config(self, client_config: ClientConfig) -> Self
pub fn with_client_config(self, client_config: ClientConfig) -> Self
Replace whole client config.
Sourcepub fn with_run_profile(self, run_profile: RunProfile) -> Self
pub fn with_run_profile(self, run_profile: RunProfile) -> Self
Replace whole run profile.
Sourcepub fn with_cli_bin(self, cli_bin: impl Into<PathBuf>) -> Self
pub fn with_cli_bin(self, cli_bin: impl Into<PathBuf>) -> Self
Override codex binary location.
Sourcepub fn with_compatibility_guard(self, guard: CompatibilityGuard) -> Self
pub fn with_compatibility_guard(self, guard: CompatibilityGuard) -> Self
Override runtime compatibility policy.
Sourcepub fn without_compatibility_guard(self) -> Self
pub fn without_compatibility_guard(self) -> Self
Disable compatibility guard.
Sourcepub fn with_initialize_capabilities(
self,
initialize_capabilities: InitializeCapabilities,
) -> Self
pub fn with_initialize_capabilities( self, initialize_capabilities: InitializeCapabilities, ) -> Self
Override initialize capability switches.
Sourcepub fn enable_experimental_api(self) -> Self
pub fn enable_experimental_api(self) -> Self
Opt into Codex experimental app-server methods and fields.
Sourcepub fn with_global_hooks(self, hooks: RuntimeHookConfig) -> Self
pub fn with_global_hooks(self, hooks: RuntimeHookConfig) -> Self
Replace global runtime hooks (connect-time).
Sourcepub fn with_global_pre_hook(self, hook: Arc<dyn PreHook>) -> Self
pub fn with_global_pre_hook(self, hook: Arc<dyn PreHook>) -> Self
Register one global runtime pre hook (connect-time).
Sourcepub fn with_global_post_hook(self, hook: Arc<dyn PostHook>) -> Self
pub fn with_global_post_hook(self, hook: Arc<dyn PostHook>) -> Self
Register one global runtime post hook (connect-time).
Sourcepub fn with_global_pre_tool_use_hook(self, hook: Arc<dyn PreHook>) -> Self
pub fn with_global_pre_tool_use_hook(self, hook: Arc<dyn PreHook>) -> Self
Register one global pre-tool-use hook (fires via the internal approval loop). The runtime manages the approval channel and auto-escalates ApprovalPolicy → Untrusted. Allocation: amortized O(1) push. Complexity: O(1).
Sourcepub fn with_shell_pre_hook(
self,
name: &'static str,
command: impl Into<String>,
) -> Self
pub fn with_shell_pre_hook( self, name: &'static str, command: impl Into<String>, ) -> Self
Register an external shell command as a global pre-hook (connect-time).
The command is run via sh -c. Default timeout: 5 seconds.
On exit 0 → Noop or Mutate. On exit 2 → Block. On other exit → HookIssue.
Allocation: two Strings.
Sourcepub fn with_shell_post_hook(
self,
name: &'static str,
command: impl Into<String>,
) -> Self
pub fn with_shell_post_hook( self, name: &'static str, command: impl Into<String>, ) -> Self
Register an external shell command as a global post-hook (connect-time).
The command is run via sh -c. Default timeout: 5 seconds.
On exit 0 → Ok(()). On other exit → HookIssue (non-fatal, logged in report).
Allocation: two Strings.
Sourcepub fn with_shell_pre_hook_timeout(
self,
name: &'static str,
command: impl Into<String>,
timeout: Duration,
) -> Self
pub fn with_shell_pre_hook_timeout( self, name: &'static str, command: impl Into<String>, timeout: Duration, ) -> Self
Register an external shell command as a global pre-hook with explicit timeout. Allocation: two Strings.
Sourcepub fn to_session_config(&self) -> SessionConfig
pub fn to_session_config(&self) -> SessionConfig
Build session config with the same cwd/profile defaults.
Trait Implementations§
Source§impl Clone for WorkflowConfig
impl Clone for WorkflowConfig
Source§fn clone(&self) -> WorkflowConfig
fn clone(&self) -> WorkflowConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more