Skip to main content

sim_lib_exec/
lib.rs

1#![forbid(unsafe_code)]
2#![deny(missing_docs)]
3//! Capability-gated bounded host-process execution for the SIM runtime.
4//!
5//! This crate supplies a general host `exec` operation for libraries that need
6//! to run an external process under explicit authority. The operation accepts a
7//! structured argv vector, never inserts a shell, captures stdout and stderr,
8//! enforces a mandatory timeout, and truncates captured output at a caller-set
9//! byte cap. [`CommandSpec`] identifies exact installed checker commands,
10//! including unchanged interpreter bytes, resources, output and cleanup policy;
11//! [`LocalCheckPort`] keeps packet tooling outside the native process boundary.
12//! It is a host operation, not SIM evaluation.
13
14mod command;
15#[cfg(test)]
16mod command_tests;
17mod command_wire;
18mod exec;
19mod sandbox;
20
21pub use command::{
22    BuildSourceRef, CapabilityGrantRef, CleanupContract, CommandId, CommandInvocation,
23    CommandReplayPolicy, CommandResource, CommandRoute, CommandSpec, LocalCheckLease,
24    LocalCheckPort, LocalCheckRequest, LocalCheckResult, LocalCheckStatus, NetworkAccess,
25    OutputContract, OutputExpectation, OutputState, PacketRef, ResourceAccess,
26};
27
28pub use exec::{
29    ArgAtom, BindingValue, DispatchEvidence, ExecOptions, PrivateArtifactRef, ProcResult,
30    ProcessAttempt, ProcessBudget, ProcessCancellation, ProcessPort, ProcessReceipt,
31    ProcessRefusal, ProcessRequest, ProgramRef, ProjectRootRef, SealedBindings, StopReceipt, exec,
32    exec_capability, proc_result_symbol,
33};
34pub use sandbox::{
35    LauncherRegistry, MountAccess, SandboxAttempt, SandboxControl, SandboxEvidence,
36    SandboxLauncher, SandboxLimits, SandboxMount, SandboxPolicy, SandboxRefusal, SandboxReport,
37    SandboxRequest, SandboxRequirement, SandboxResult, sandbox_exec,
38};
39
40/// Cookbook recipes for this lib, embedded at build time.
41pub static RECIPES: sim_cookbook::EmbeddedDir =
42    include!(concat!(env!("OUT_DIR"), "/cookbook_recipes.rs"));
43
44#[cfg(test)]
45mod tests;