Skip to main content

resolve_os_call

Function resolve_os_call 

Source
pub fn resolve_os_call(
    call: OsFunctionCall,
    environ: &BTreeMap<String, String>,
    system_clock: bool,
    mounts: &mut MountTable,
) -> ExtFunctionResult
Available on crate features code and embedded-python only.
Expand description

Service one Monty OS call against a host-authored policy: an explicit environment map, a clock grant, and a MountTable for filesystem operations.

This is the shared servicing kernel used by every Monty integration in the workspace (the executors here and adk-codeact-monty’s MontyRuntime):

  • os.getenv(name) / os.environ read environ only — the host process environment is never consulted;
  • date.today() / datetime.now() read the host clock when system_clock is true, and otherwise raise a catchable OSError;
  • everything else is a filesystem operation routed through mounts. When no mount covers the path, existence checks return False (CPython semantics) and any other access raises PermissionError.

The call is consumed: MountTable::handle_os_call moves a covered write’s payload into the backend without a copy, and hands the call back (MountCallOutcome::NotHandled) when no mount covers it so the fallback can render it.