interplane.Get Omega
Read in your language

aien-protocols-mv

Canonical specifications, wire protocols, and schemas for the AIEN sovereign ecosystem

Brought by drakestapleton

GitHub aien-dev/aien-protocols-mv#2 (code only)

closed derived 750e98e73b08b917 #2

Imported from GitHub aien-dev/aien-protocols-mv#2 (code only)

GitHub's metadata for this pull request is unavailable: its state is DERIVED from the commits (merged: the head is reachable from this project's main; open: GitHub kept a merge ref; else closed).

Base 6df80a61ce5ef27ef0edbb024ce7f310f839f9e7 · Head 5ee475e53820facf5f1f8123e060973fc7643368

Apply it

git checkout -b patch-750e98e73b08b917 6df80a61ce5ef27ef0edbb024ce7f310f839f9e7
curl -fsSL https://interplane.io/drakestapleton/aien-protocols-mv/patches/750e98e73b08b917.patch | git am

Raw patch (mbox) · Diff

Provenance

This proposal is imported from GitHub; it is not signed by its author. Its import statement and source record:

github-import 1
aien-dev/aien-protocols-mv
2
5ee475e53820facf5f1f8123e060973fc7643368
{"kind":"github-import","owner":"aien-dev","repo":"aien-protocols-mv","number":2,"url":"https://github.com/aien-dev/aien-protocols-mv/pull/2","export_sha256":"967c79e26a893657b5cdaa45efd442be5dbd2ecfe68e25f9a8c1b5da4d60d452","imported_utc":"2026-11-18T16:39:43Z","metadata":"unavailable","state_derived":true}

Changes

diff --git a/ANTI_ENCLOSURE.md b/ANTI_ENCLOSURE.md
index 2698773..27cdb29 100644
--- a/ANTI_ENCLOSURE.md
+++ b/ANTI_ENCLOSURE.md
@@ -9,3 +9,4 @@ These commitments govern the AIEN standards process and protocol ecosystem:
 5. AIEN trademarks indicate authentic conformance, provenance, and interoperability, not exclusive implementation rights.
 6. No entity or vendor receives privileged access to secret versions of the canonical ABI.
 7. Canonical specifications, schemas, conformance suites, and version history remain publicly accessible to humanity.
+8. Anti-Enclosure Covenant on Model Weights: Any derivative model weights, adapters, or distilled artifacts trained or optimized using canonical AIEN ABI implementations or protocols must remain openly accessible and cannot be locked behind proprietary gating, closed API enclosures, or exclusive paywalls. Conformant implementations must reject enclosures that restrict model weight distribution to the sovereign commons.
diff --git a/crates/aien-inference-client/Cargo.toml b/crates/aien-inference-client/Cargo.toml
index 8c328cd..23fed7d 100644
--- a/crates/aien-inference-client/Cargo.toml
+++ b/crates/aien-inference-client/Cargo.toml
@@ -10,3 +10,6 @@ aien-protocol-types = { path = "../aien-protocol-types" }
 aien-inference-protocol = { path = "../aien-inference-protocol" }
 async-trait = { workspace = true }
 thiserror = { workspace = true }
+serde = { workspace = true }
+serde_json = { workspace = true }
+uuid = { workspace = true }
diff --git a/crates/aien-inference-client/src/lib.rs b/crates/aien-inference-client/src/lib.rs
index fd00249..5e26a3c 100644
--- a/crates/aien-inference-client/src/lib.rs
+++ b/crates/aien-inference-client/src/lib.rs
@@ -3,6 +3,64 @@ use aien_protocol_types::ProtocolVersion;
 use async_trait::async_trait;
 use std::sync::Arc;
 
+pub struct LocalInferenceClient {
+    service: Arc<dyn InferenceService>,
+}
+
+impl LocalInferenceClient {
+    pub fn new(service: Arc<dyn InferenceService>) -> Self {
+        Self { service }
+    }
+}
+
+#[async_trait]
+impl InferenceService for LocalInferenceClient {
+    async fn infer(&self, req: InferenceRequest) -> Result<InferenceResponse, InferenceError> {
+        self.service.infer(req).await
+    }
+
+    async fn branch_context(&self, req: BranchContextRequest) -> Result<BranchContextReceipt, InferenceError> {
+        self.service.branch_context(req).await
+    }
+
+    async fn get_capabilities(&self) -> Result<InferenceCapabilities, InferenceError> {
+        self.service.get_capabilities().await
+    }
+}
+
+pub struct HttpInferenceClient {
+    pub endpoint: String,
+    pub auth_token: Option<String>,
+}
+
+impl HttpInferenceClient {
+    pub fn new(endpoint: String, auth_token: Option<String>) -> Self {
+        Self { endpoint, auth_token }
+    }
+}
+
+#[async_trait]
+impl InferenceService for HttpInferenceClient {
+    async fn infer(&self, _req: InferenceRequest) -> Result<InferenceResponse, InferenceError> {
+        Err(InferenceError::Internal(format!("HTTP transport connecting to {} not configured", self.endpoint)))
+    }
+
+    async fn branch_context(&self, _req: BranchContextRequest) -> Result<BranchContextReceipt, InferenceError> {
+        Err(InferenceError::Internal(format!("HTTP transport connecting to {} not configured", self.endpoint)))
+    }
+
+    async fn get_capabilities(&self) -> Result<InferenceCapabilities, InferenceError> {
+        Ok(InferenceCapabilities {
+            protocol: ProtocolVersion::new(1, 0),
+            context_branching: true,
+            physical_cow: true,
+            streaming: true,
+            cancellation: true,
+            max_context_tokens: Some(32768),
+        })
+    }
+}
+
 pub struct MockInferenceClient {
     capabilities: InferenceCapabilities,
 }
diff --git a/crates/aien-provenance/Cargo.toml b/crates/aien-provenance/Cargo.toml
index 5b4e74d..4ac3ff1 100644
--- a/crates/aien-provenance/Cargo.toml
+++ b/crates/aien-provenance/Cargo.toml
@@ -12,3 +12,5 @@ serde_json = { workspace = true }
 sha2 = { workspace = true }
 hex = { workspace = true }
 thiserror = { workspace = true }
+uuid = { workspace = true }
+bitflags = { workspace = true }
diff --git a/crates/aien-provenance/src/lib.rs b/crates/aien-provenance/src/lib.rs
index b12a12b..1456621 100644
--- a/crates/aien-provenance/src/lib.rs
+++ b/crates/aien-provenance/src/lib.rs
@@ -1,5 +1,9 @@
 use aien_protocol_types::Digest32;
+use bitflags::bitflags;
+use serde::{Deserialize, Serialize};
 use sha2::{Digest, Sha256};
+use thiserror::Error;
+use uuid::Uuid;
 
 pub fn compute_sha256(bytes: &[u8]) -> Digest32 {
     let mut hasher = Sha256::new();
@@ -10,7 +14,7 @@ pub fn compute_sha256(bytes: &[u8]) -> Digest32 {
     Digest32::from_bytes(arr)
 }
 
-pub fn compute_canonical_json_digest<T: serde::Serialize>(val: &T) -> Result<Digest32, serde_json::Error> {
+pub fn compute_canonical_json_digest<T: Serialize>(val: &T) -> Result<Digest32, serde_json::Error> {
     let json_bytes = serde_json::to_vec(val)?;
     Ok(compute_sha256(&json_bytes))
 }
@@ -25,6 +29,83 @@ pub fn combine_digests(d1: &Digest32, d2: &Digest32) -> Digest32 {
     Digest32::from_bytes(arr)
 }
 
+bitflags! {
+    #[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)]
+    pub struct GrantPermissions: u32 {
+        const READ = 0b0000_0001;
+        const EVALUATE = 0b0000_0010;
+        const TRAIN = 0b0000_0100;
+        const DISTILL = 0b0000_1000;
+        const REDISTRIBUTE = 0b0001_0000;
+        const COMMERCIAL = 0b0010_0000;
+    }
+}
+
+#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
+pub struct SourceGrant {
+    pub grant_id: Uuid,
+    pub source_uri: String,
+    pub license_spdx: String,
+    pub permissions: GrantPermissions,
+    pub issuer: String,
+    pub issuer_signature: Option<Vec<u8>>,
+    pub expires_at_epoch_sec: Option<u64>,
+}
+
+#[derive(Error, Debug, PartialEq, Eq)]
+pub enum ProvenanceError {
+    #[error("Source grant permission denied: required {required:?}, granted {granted:?}")]
+    PermissionDenied {
+        required: GrantPermissions,
+        granted: GrantPermissions,
+    },
+    #[error("Incompatible license: {license} not in allowed set")]
+    IncompatibleLicense { license: String },
+    #[error("Grant has expired at {0}")]
+    GrantExpired(u64),
+    #[error("Missing signature from authority")]
+    MissingSignature,
+}
+
+impl SourceGrant {
+    pub fn new(source_uri: String, license_spdx: String, permissions: GrantPermissions, issuer: String) -> Self {
+        Self {
+            grant_id: Uuid::new_v4(),
+            source_uri,
+            license_spdx,
+            permissions,
+            issuer,
+            issuer_signature: None,
+            expires_at_epoch_sec: None,
+        }
+    }
+
+    pub fn verify_permission(&self, required: GrantPermissions) -> Result<(), ProvenanceError> {
+        if self.permissions.contains(required) {
+            Ok(())
+        } else {
+            Err(ProvenanceError::PermissionDenied {
+                required,
+                granted: self.permissions,
+            })
+        }
+    }
+
+    pub fn verify_license(&self, allowed_licenses: &[&str]) -> Result<(), ProvenanceError> {
+        if allowed_licenses.iter().any(|&l| l.eq_ignore_ascii_case(&self.license_spdx)) {
+            Ok(())
+        } else {
+            Err(ProvenanceError::IncompatibleLicense {
+                license: self.license_spdx.clone(),
+            })
+        }
+    }
+
+    pub fn compute_digest(&self) -> Digest32 {
+        compute_canonical_json_digest(self).unwrap_or(Digest32::ZERO)
+    }
+}
+
 #[cfg(test)]
 mod tests {
     use super::*;
@@ -36,4 +117,19 @@ mod tests {
         assert_eq!(d1, d2);
         assert_ne!(d1, Digest32::ZERO);
     }
+
+    #[test]
+    fn test_source_grant_permissions_and_licensing() {
+        let grant = SourceGrant::new(
+            "https://huggingface.co/datasets/aien/benchmark".to_string(),
+            "Apache-2.0".to_string(),
+            GrantPermissions::READ | GrantPermissions::EVALUATE | GrantPermissions::TRAIN,
+            "Atlas Authority".to_string(),
+        );
+
+        assert!(grant.verify_permission(GrantPermissions::TRAIN).is_ok());
+        assert!(grant.verify_permission(GrantPermissions::DISTILL).is_err());
+        assert!(grant.verify_license(&["Apache-2.0", "MIT"]).is_ok());
+        assert!(grant.verify_license(&["GPL-3.0"]).is_err());
+    }
 }