Expand description
Console-pushed policy bundles.
The daemon never calls the console. pvctl console-sync --watch --pull-policies, running on the same host, pulls the org’s policy
bundle (GET /api/v1/ingest/policies) and writes it atomically to the
file named by policy_bundle_file. The daemon loads that file at boot
and polls it for changes; each new bundle is compiled into
pv_sandbox::PushedRules plus token-rate rules and swapped in whole.
After every attempt the daemon writes its own answer next to the
bundle (<policy_bundle_file>.status.json): the etag it applied, the
policy ids it now enforces and the ones it could not enforce, with a
reason. pvctl reports that file to the console, so the console’s
“Enforced by N of M daemons” reflects what daemons actually run, not
what was sent to them.
Pushed rules only add restrictions (see pv_sandbox::pushed). A
bundle that cannot be read or parsed leaves the rules already in
force unchanged — at boot that means the daemon refuses to start,
because running without rules the operator expects to be there would
fail open.
Kinds: budget, allowlist, schema (tool calls) and rate
(per-principal token velocity on model traffic) are enforced.
guardrail and transform policies document intent and attribute
the daemon’s own guard hits; the daemon neither enforces nor reports
them. Anything else is reported unsupported.
Structs§
- Bundle
Policy - One policy entry of the console bundle (contract:
server/src/lib/ policy-bundle.ts). - Compiled
Bundle - A compiled bundle, ready to swap in.
- Policy
Bundle - The console bundle file.
- Policy
Push - Applies bundle files to a running daemon.
- Policy
Status - The daemon’s own answer for the last bundle it processed; the body
pvctlposts toPOST /api/v1/ingest/policy-status. - Rate
Limits - Per-principal token-rate limits from the pushed bundle.
- Rate
Refusal - A request a token-rate rule refused: which console policy, and the message the client and the audit event carry.
- Rate
Rule - One per-principal token-rate rule.
- Unsupported
- One policy the daemon could not enforce.
Functions§
- compile
- Compile a bundle. Never fails as a whole: a policy the daemon cannot
enforce is listed in
unsupportedand the rest still apply. - read_
bundle - Read and parse the bundle file.
Ok(None)when it does not exist yet (nothing was ever pushed). - status_
path - Path of the status file the daemon writes next to the bundle file.