Skip to main content

Crate lonca_policy

Crate lonca_policy 

Source
Expand description

Lonca’s deterministic decision layer.

  • state::State is a pure fold over the operation log.
  • decide::decide is a pure function from (state, request, recorded evidence, time, policy) to a decision.
  • chain::Chain combines both into the single-writer sequencer the daemon runs; the auditor replays the same functions over a stored log.
  • whatif::compare decides a log again with another policy.

Re-exports§

pub use chain::Chain;
pub use config::Config;
pub use config::PolicyBundle;
pub use decide::Ctx;
pub use decide::decide;
pub use state::State;

Modules§

chain
The single-writer sequencer: decide, sign, apply.
config
Policy bundle: lonca.toml (limits and switches) plus policy.cedar (rules). Both live in the commit that refs/lonca/policy points to, never in a code branch.
decide
The decision function.
details
What a client reads to recover from a lease denial, or to avoid one.
events
A session’s inbox: what happened that it should know of, derived from the log and the state. Nothing is written for it, so the single writer stays the only way into the log, and decide() never reads it.
harness
Harness profiles: what Lonca needs to know about an agent harness, as data. Which events it sends, what its tools do, and how it wants an answer. A new harness is a table in lonca.toml, not a change to Lonca, as long as it can run a command with a JSON event on stdin.
human
Verification of human signatures.
refs
Which refs a repository may hold, and what the log says each must name. The daemon’s reconcile() and the auditor ask the same function, so a write behind the daemon’s back reads the same to both.
state
Repository state as a pure fold over the operation log.
symbols
Symbol ids and their containment hierarchy.
whatif
What another policy would have decided: every entry of a log decided again with a candidate policy, and the decisions that come out different.