1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
//! Policy primitive for AgentStateGraph.
//!
//! Fourth-primitive sibling crate, parallel to `agentstategraph-tasks`.
//! Implements the authorization + change-cost primitive of the Policy v1
//! design (§§2-7 and §22; user guide: `docs/POLICY_GUIDE.md`). Ships the engine
//! surface only — MCP tools, CLI, and Lens UI live in their respective
//! consumer crates.
//!
//! # What this crate is
//!
//! - `Policy` schema (situation-matching rules + procedure + change-cost
//! gating fields)
//! - `PolicyStore` — a handle bound to a `Repository` + prefix with
//! `propose` / `ratify` / `supersede` / `evaluate` / `evaluate_change`
//! - `Selector` — a tagged-enum boolean expression over a `Situation`
//! - `Decision` — the evaluator's result, including `RequireApproval`
//! with a `FallbackAction` ("what to do while it waits")
//!
//! # What this crate is NOT
//!
//! - Not an enforcement layer (soft model — see POLICY_V1.md §11)
//! - Not a Rego/Cedar clone (the selector is a minimal DSL; external
//! policy engines are a future escape hatch)
//! - Not an MCP tool or CLI — those belong to consumers
//!
//! # Example
//!
//! ```rust,no_run
//! use agentstategraph::Repository;
//! use agentstategraph_storage::SqliteStorage;
//! use agentstategraph_policy::{PolicyStore, Situation, Selector};
//! use std::sync::Arc;
//!
//! let repo = Arc::new(Repository::new(Box::new(SqliteStorage::in_memory().expect("in-memory sqlite"))));
//! repo.init().unwrap();
//! let store = PolicyStore::new(repo, "/policies", "claude-code");
//! // propose, ratify, evaluate ...
//! let _ = store.evaluate("main", &Situation::new(), "restart_pod", "agent-1");
//! ```
pub use PolicyError;
pub use ;
pub use ;
pub use PolicyStore;
pub use ;
pub use ;