Skip to main content

Module runtime

Module runtime 

Source
Expand description

Runtime view of the active context policy pack (GL #673 / #489 enforcement).

active refreshes bounded policy and organization trust bytes on every admission. Identical snapshots reuse prepared rules; changed or unreadable inputs never reuse a stale authorization. One bounded worker serializes file resolution and compilation without accumulating timed-out reader threads.

Opt-in & backward-compatible: with no project pack present, active returns None and nothing is gated — existing behavior is preserved exactly. An invalid local pack activates a deny-all policy so enforcement never fails open.

Local-Free Invariant: enforcement derived from this view only ever constrains the agent pipeline; it never gates a human’s own local reads.

Structs§

ActivePolicy
A resolved policy plus its precompiled redaction regexes — the cached, hot-path-ready form.
PublicationAuthority
Revalidate buffered CLI data at its output and persistence boundaries. This does not lock policy files against a concurrent administrator write.
SourceView
StoredLifetime
The stored lifetime of a view: its signed horizon, None for a view bound to a lifted requirement, which has none.
StoredPublicationAuthority
The stored form of a PublicationAuthority: project root, policy and role fingerprints and the lifetime of the view it was captured from. Content-free.

Constants§

REQUIRED_POLICY_DIGEST_ENV
REQUIRED_POLICY_ROOT_ENV
Process-scoped pin set by explicit protected launchers; absent in Community.

Statics§

REQUEST_PROJECT
Per-request project authority; never mutate process CWD for MCP roots.

Functions§

active
The active resolved policy, or None when no project or org pack exists. Fresh source bytes are mandatory even when compiled rules are cached.
bind_request_project
detached_project_root
Resolve the project root for a detached worker without retaining request- lifetime policy or capture state. The worker must reopen a fresh source view from this root when it stores output.
for_project
Resolve the explicit runtime project without using the process-global cache. Configured local/org errors remain errors rather than granting admission.
in_project
Run operation as part of a request for project.
inherited_source_view
Capture the pinned view when propagating a synchronous worker scope.
is_active
Current “is a policy active?” probe; refresh failure requires protection.
protected_authority_paths
The launcher’s kernel write boundary covers the same file authorities as the bounded admission snapshot, including absent optional inputs.
protected_policy_digest
The launcher and admission worker use exactly the same bounded snapshot. A deliberate authority update requires a new protected launch; changing files within the old session never silently grants the new authority.
reload
Re-read the project pack (e.g. after a policy edit). Idempotent.
spawn_for_project
Start operation on its own thread as part of a request for project. A spawned thread inherits no task-local: without this it reads the configuration and admission state of the process’s own project (AP04-G3).
with_explicit_project_source_view
Run an egress preparation for one explicitly selected project. Unlike the source-view fallback helper, this rejects a conflicting trusted request root and revalidates authority after the operation before its result is published.
with_governed_source_view
with_source_view, entered only when the verification the view is pinned to established something to act under: a policy, or an observed organization decision (a signed unpin leaves no policy and is one all the same). Ok(None): it established neither, no view was opened and operation did not run.
with_project_source_view
Run a source operation with an explicit fallback project root. An existing request project remains authoritative; the fallback only fills an unbound request scope.
with_source_view
Run a synchronous source operation against one freshly verified policy snapshot. Publish the returned value only if the same authority still holds. Nested calls reuse the parent snapshot; they never refresh into a weaker view.