Skip to main content

Module shared

Module shared 

Source
Expand description

Helpers shared across stdlib libraries.

Constants§

MAX_DESCRIPTION_CHARS
Characters a Model.description may carry into a guest model’s model-selection reasoning.

Functions§

check_security
Call at the top of each gated host fn body — after argument parsing, before any I/O. Attributes the call to whoever’s code is running, via [running_package]. A denial surfaces to the guest as a catchable PermissionDeniedError.
contain_trap
The single translation from a containment failure to a guest-visible trap. Every escape reaches the guest as the same diagnostic regardless of which operation hit it, so an LLM reading one recognises the rest.
resolve_content_or_trap
Resolve a guest path for an operation that reaches its contents — every component, including the last, traversed under containment.
resolve_link_or_trap
Resolve a guest path for an operation that acts on the link itself — the final component is never followed.
write_target_trap
Distinguish a missing parent from an escaping one at the point a write first touches the filesystem.