pub struct ExecRequest { /* private fields */ }Expand description
Structured child execution request independent from CLI parsing.
Built via new followed by builder methods. Validates that the working
directory exists and that a command is provided.
Implementations§
Source§impl ExecRequest
impl ExecRequest
Sourcepub fn new(
cwd: impl Into<PathBuf>,
argv: Vec<String>,
allowed_env: Vec<String>,
) -> Result<Self>
pub fn new( cwd: impl Into<PathBuf>, argv: Vec<String>, allowed_env: Vec<String>, ) -> Result<Self>
Create a validated execution request.
Returns Error::MissingCommand when argv is empty and
Error::InvalidCwd when cwd is not an existing directory.
Sourcepub const fn with_stdio_policy(self, stdio_policy: StdioPolicy) -> Self
pub const fn with_stdio_policy(self, stdio_policy: StdioPolicy) -> Self
Set the child stdio handling policy.
Sourcepub fn with_env_policy(
self,
env_policy: EnvPolicy,
denied_env: Vec<String>,
) -> Self
pub fn with_env_policy( self, env_policy: EnvPolicy, denied_env: Vec<String>, ) -> Self
Set the environment policy and denied keys.
Sourcepub fn with_env(self, allowed_env: Vec<String>, denied_env: Vec<String>) -> Self
pub fn with_env(self, allowed_env: Vec<String>, denied_env: Vec<String>) -> Self
Set both allowed and denied environment keys.
Sets the policy to EnvPolicy::Allowlist.
Sourcepub const fn with_network_mode(self, network_mode: NetworkMode) -> Self
pub const fn with_network_mode(self, network_mode: NetworkMode) -> Self
Set the child network isolation mode.
Sourcepub fn with_filesystem_policy(
self,
filesystem_policy: Option<FilesystemPolicy>,
) -> Result<Self>
pub fn with_filesystem_policy( self, filesystem_policy: Option<FilesystemPolicy>, ) -> Result<Self>
Set the filesystem sandbox policy.
Some declares confinement, where an empty value confines read-only.
None leaves the child unconfined by filesystem rules unless another
isolation request applies. Returns an error when filesystem policy
validation fails.
Sourcepub const fn with_proc_mode(self, proc_mode: ProcMode) -> Self
pub const fn with_proc_mode(self, proc_mode: ProcMode) -> Self
Set the /proc mount policy.
Sourcepub const fn with_agent_policy(self, agent_policy: AgentPolicy) -> Self
pub const fn with_agent_policy(self, agent_policy: AgentPolicy) -> Self
Set the host agent socket mount policy.
Sourcepub fn needs_isolation(&self) -> bool
pub fn needs_isolation(&self) -> bool
Whether this request needs OS-level isolation.
Returns true when network isolation, a declared filesystem stance
(an empty block confines read-only), or host agent socket access is
requested.
Sourcepub fn allowed_env(&self) -> &[String]
pub fn allowed_env(&self) -> &[String]
Parent environment keys allowed in the child environment.
Sourcepub fn denied_env(&self) -> &[String]
pub fn denied_env(&self) -> &[String]
Parent environment keys denied in blocklist mode.
Sourcepub const fn env_policy(&self) -> EnvPolicy
pub const fn env_policy(&self) -> EnvPolicy
Child environment filtering policy.
Sourcepub const fn stdio_policy(&self) -> StdioPolicy
pub const fn stdio_policy(&self) -> StdioPolicy
Child stdio handling policy.
Sourcepub const fn network_mode(&self) -> NetworkMode
pub const fn network_mode(&self) -> NetworkMode
Child network isolation policy.
Sourcepub fn filesystem_policy(&self) -> Option<&FilesystemPolicy>
pub fn filesystem_policy(&self) -> Option<&FilesystemPolicy>
Filesystem stance declared by the caller.
None means no filesystem confinement was declared; Some carries
the controls, where an empty value confines read-only.
Sourcepub fn effective_filesystem_policy(&self) -> Cow<'_, FilesystemPolicy>
pub fn effective_filesystem_policy(&self) -> Cow<'_, FilesystemPolicy>
Filesystem controls in force under isolation.
Isolation paths call this after needs_isolation() returns true; a
request that declared no filesystem block confines read-only through
the empty policy, which both renderers treat as their closed-by-default
base profile.
Sourcepub const fn agent_policy(&self) -> AgentPolicy
pub const fn agent_policy(&self) -> AgentPolicy
Host agent socket mount policy.