pub struct DaemonScriptHost { /* private fields */ }Expand description
The daemon’s script host: enforces permissions + workdir confinement, then
delegates the actual work to a ScriptIo.
Implementations§
Source§impl DaemonScriptHost
impl DaemonScriptHost
Sourcepub fn with_io(
allow: ScriptAllow,
workdir: PathBuf,
io: Arc<dyn ScriptIo>,
) -> Self
pub fn with_io( allow: ScriptAllow, workdir: PathBuf, io: Arc<dyn ScriptIo>, ) -> Self
Build a host with an explicit I/O backend (used by tests). Defaults to no
sandbox and the built-in shell tool’s 60-second timeout; override with
with_shell.
Sourcepub fn with_local_network(self, allow: bool) -> Self
pub fn with_local_network(self, allow: bool) -> Self
Permit fetches to loopback / private / link-local addresses, from
[security] allow_local_network. Consuming builder used at spawn.
Sourcepub fn with_env_allowlist(self, names: Vec<String>) -> Self
pub fn with_env_allowlist(self, names: Vec<String>) -> Self
Permit scripts to read these credential-shaped environment variables,
from [security] allow_env_vars. Consuming builder used at spawn.
Sourcepub fn new(allow: ScriptAllow, workdir: PathBuf) -> Self
pub fn new(allow: ScriptAllow, workdir: PathBuf) -> Self
Build a host wired to the real network/process/filesystem/env backend.
Sourcepub fn with_shell(
self,
sandbox: Option<Arc<SandboxManager>>,
shell_timeout: Duration,
) -> Self
pub fn with_shell( self, sandbox: Option<Arc<SandboxManager>>, shell_timeout: Duration, ) -> Self
Route shell() through sandbox (the agent’s per-stage isolation) and cap
each call at shell_timeout. Consuming builder used at spawn.
Trait Implementations§
Source§impl ScriptHost for DaemonScriptHost
impl ScriptHost for DaemonScriptHost
Source§fn http_get(
&self,
url: &str,
headers: BTreeMap<String, String>,
) -> Result<String, String>
fn http_get( &self, url: &str, headers: BTreeMap<String, String>, ) -> Result<String, String>
HTTP GET
url with the given request headers, returning the response body.Source§fn http_post(
&self,
url: &str,
body: &str,
headers: BTreeMap<String, String>,
) -> Result<String, String>
fn http_post( &self, url: &str, body: &str, headers: BTreeMap<String, String>, ) -> Result<String, String>
HTTP POST
body to url with the given headers, returning the response body.Source§fn shell(&self, command: &str) -> Result<String, String>
fn shell(&self, command: &str) -> Result<String, String>
Run a shell command, returning its combined output.
Source§fn read_file(&self, path: &str) -> Result<String, String>
fn read_file(&self, path: &str) -> Result<String, String>
Read a file (confined to the agent workdir by the implementor).
Auto Trait Implementations§
impl !RefUnwindSafe for DaemonScriptHost
impl !UnwindSafe for DaemonScriptHost
impl Freeze for DaemonScriptHost
impl Send for DaemonScriptHost
impl Sync for DaemonScriptHost
impl Unpin for DaemonScriptHost
impl UnsafeUnpin for DaemonScriptHost
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
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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>
Converts
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>
Converts
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)
Converts
&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)
Converts
&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>
Converts
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>
Converts
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 moreSource§impl<T> IntoResult<T> for T
impl<T> IntoResult<T> for T
Source§fn into_result(self) -> Result<T, RunSystemError>
fn into_result(self) -> Result<T, RunSystemError>
Converts this type into the system output type.