interplane-mv
INTERPLANE: open interoperability protocol between AI models and agent runtimes. Models express intent. Runtimes retain authority.
Brought by drakestapleton
interplane-mv / rust / crates / interplane-crossveil / src / lib.rs
| 1 | //! Crossveil: the authority boundary. A runtime adapter supplies `decide` and `execute`; the |
| 2 | //! [`Pipeline`] enforces the CORE.md / CROSSVEIL.md invariants around them and never fabricates, |
| 3 | //! caches, upgrades or reuses a decision. |
| 4 | use interplane_core::{CapabilityRequest, Catalog, Decision, Exposure, Party, ToolResult}; |
| 5 | use serde_json::Value; |
| 6 | |
| 7 | pub mod mock; |
| 8 | pub mod pipeline; |
| 9 | |
| 10 | pub use mock::{mock_mapping_table, mock_mapping_table_stale, mock_table_by_name, MockRuntime}; |
| 11 | pub use pipeline::{ |
| 12 | capability_request_digest, ObservedRecord, PendingApproval, Pipeline, Refusal, TurnOutcome, |
| 13 | }; |
| 14 | |
| 15 | /// What the pipeline passes through, untouched, to the runtime callbacks. |
| 16 | #[derive(Debug, Clone)] |
| 17 | pub struct CallContext { |
| 18 | pub trace_id: String, |
| 19 | pub message_id: String, |
| 20 | pub parent_id: Option<String>, |
| 21 | pub model: Party, |
| 22 | /// Runtime-local session handle the adapter may attach. |
| 23 | pub session: Option<Value>, |
| 24 | /// What the model could see when it produced this request (0.3 cut P3). Always computed by |
| 25 | /// the pipeline from its own input ledger, never read from the model or the envelope. |
| 26 | pub exposure: Option<Exposure>, |
| 27 | } |
| 28 | |
| 29 | /// The two callbacks that touch a runtime, plus its catalog. |
| 30 | pub trait RuntimeAuthority { |
| 31 | fn runtime_id(&self) -> &str; |
| 32 | /// The runtime's authority decision. Called for every mapped request. |
| 33 | fn decide(&mut self, req: &CapabilityRequest, ctx: &CallContext) -> Decision; |
| 34 | /// Called only after `decide` returned `authorized` for this exact request. |
| 35 | fn execute( |
| 36 | &mut self, |
| 37 | req: &CapabilityRequest, |
| 38 | decision: &Decision, |
| 39 | ctx: &CallContext, |
| 40 | ) -> ToolResult; |
| 41 | fn catalog(&self) -> Catalog; |
| 42 | } |