Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/aien-sovereign-core-mv/blob/main/crates/aien-allen/src/lib.rs # aien-sovereign-core-mv AienOS host runtime: inference scheduling, paged KV state, the aien CLI and Spark verification tooling. Its inference engine is in alpha testing (DGX Spark GB10); Omega is the implementation destination. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `aien-sovereign-core-mv / crates / aien-allen / src / lib.rs` 57 lines ยท 2343 bytes Raw Blame History 1 // SPDX-License-Identifier: Apache-2.0 2 // Copyright 2026 Drake Stapleton (AIEN / aien-dev) 3 // 4 // Licensed under the Apache License, Version 2.0 (the "License"); 5 // you may not use this file except in compliance with the License. 6 // You may obtain a copy of the License at 7 // 8 // http://www.apache.org/licenses/LICENSE-2.0 9 // 10 // Unless required by applicable law or agreed to in writing, software 11 // distributed under the License is distributed on an "AS IS" BASIS, 12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 // See the License for the specific language governing permissions and 14 // limitations under the License. 15 16 //! ALLEN identity gate (aien-architecture ADR 0035, aienos ADR 0018). 17 //! 18 //! RESOLVE ONLY. This crate reads a kind-24 SubjectState object that Aienux 19 //! provisioned and exported; it never creates, encodes or edits one (I8: ALLEN 20 //! is never created implicitly). The logical agent identity, the machine id 21 //! (host pin record) and the model binding (deployment record) are three 22 //! separate records; KV state is in none of them. 23 //! 24 //! Opt-in: engaged only when `AIEN_ALLEN_SUBJECT` is set. When engaged every 25 //! refusal is fatal (see [`EXIT_REFUSED`]); there is never a silent fallback. 26 pub mod binding; 27 pub mod deployment; 28 pub mod resolve; 29 pub mod subject_v0; 30 31 pub use resolve::{gate, Context, Engagement, Gate, Refusal, Resolved, SubjectSource}; 32 33 /// Environment variable naming the exported subject (a head object file, or a 34 /// directory of raw objects named `.bin`). 35 pub const ENV_SUBJECT: &str = "AIEN_ALLEN_SUBJECT"; 36 /// One-time operator adoption: the expected logical agent id (64 hex). 37 pub const ENV_ADOPT: &str = "AIEN_ALLEN_ADOPT"; 38 /// Process exit code when an engaged ALLEN gate refuses (EX_CONFIG). 39 pub const EXIT_REFUSED: i32 = 78; 40 /// The one log line when the gate is not engaged. 41 pub const NOT_ENGAGED_LINE: &str = 42 "ALLEN: not engaged (AIEN_ALLEN_SUBJECT unset); no identity claim"; 43 44 pub fn hex(b: &[u8]) -> String { 45 b.iter().map(|x| format!("{x:02x}")).collect() 46 } 47 48 pub fn unhex32(s: &str) -> Option<[u8; 32]> { 49 if s.len() != 64 || !s.is_ascii() { 50 return None; 51 } 52 let mut out = [0u8; 32]; 53 for (i, o) in out.iter_mut().enumerate() { 54 *o = u8::from_str_radix(&s[2 * i..2 * i + 2], 16).ok()?; 55 } 56 Some(out) 57 }