phi_cap/lib.rs
1//! # phi-cap
2//!
3//! Capability vocabulary for the phi family: **one declaration language, one
4//! decision vocabulary.**
5//!
6//! Two layers, one refinement point:
7//!
8//! ```text
9//! CapabilitySpec (scoped declaration) --class_of--> Capability (coarse decision)
10//! fs:read{paths} read_fs
11//! net:http{hosts} net
12//! process:spawn{programs} process
13//! device:input{targets} device
14//! device:capture{targets} device
15//! ```
16//!
17//! * Declaration layer — what a plugin manifest or capability pack *writes*.
18//! Scopes are mandatory; undeclared = not granted (fail-closed).
19//! * Decision layer — what `Policy` *matches on*. Coarse action-surface
20//! classes; never data semantics (a remote DB query is `net`, the same
21//! query on a local file is `read_fs`).
22//!
23//! The only translation is [`class_of`]. New dimensions extend
24//! [`CapabilitySpec`] variants — never a third enum (iron rule 2).
25//!
26//! Zero hard dependencies; enable `serde` for wire formats (plugin
27//! manifests). Wire tags keep the dotted `face:scope` names
28//! (`"fs:read"`, `"net:http"`, …).
29//!
30//! O7 cross-class rule: a method carrying several capabilities resolves to
31//! the **highest-risk** class (`device > process > net > write_fs > read_fs
32//! > pure`) — see [`class_of_all`].
33
34mod capability;
35mod resolved;
36mod spec;
37
38pub use capability::Capability;
39pub use resolved::{ResolvedCapability, ScopeKind, class_of, class_of_all, resolve, scope_kind};
40pub use spec::{
41 CapabilitySpec, DeviceCaptureSpec, DeviceInputSpec, FsReadSpec, NetHttpSpec, ProcessSpawnSpec,
42 device_capture, device_input, fs_read, net_http, process_spawn, process_spawn_programs,
43};