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
aien-sovereign-core-mv / crates / aien-runtime / examples / om_world_reference.rs
| 1 | //! Reference side of the .om world-check parity test (om/effects/run.sh). |
| 2 | //! |
| 3 | //! Usage: om_world_reference TARGET CONTENT_SHA256 PRIOR_SHA256|- INTENT AUTHORIZATION BY |
| 4 | //! |
| 5 | //! Runs the reference world check (`effects::world_state`, not the confined production |
| 6 | //! path `confined_world_state`) on TARGET and prints |
| 7 | //! the reconcile record text (`effects::reconcile_text`) on one line, then the |
| 8 | //! sha256 of those text bytes (the `text_sha256` that `append` reports). |
| 9 | use aien_runtime::effects::{reconcile_text, world_state, EffectState, IntentRow}; |
| 10 | use sha2::{Digest, Sha256}; |
| 11 | |
| 12 | fn main() { |
| 13 | let a: Vec<String> = std::env::args().collect(); |
| 14 | if a.len() != 7 { |
| 15 | eprintln!("usage: om_world_reference TARGET CONTENT PRIOR|- INTENT AUTHORIZATION BY"); |
| 16 | std::process::exit(2); |
| 17 | } |
| 18 | let row = IntentRow { |
| 19 | id: a[4].parse().expect("intent"), |
| 20 | authorization: a[5].parse().expect("authorization"), |
| 21 | path: a[1].clone(), |
| 22 | target: a[1].clone(), |
| 23 | content_sha256: a[2].clone(), |
| 24 | prior_sha256: (a[3] != "-").then(|| a[3].clone()), |
| 25 | executor_pid: 0, |
| 26 | executor_start: 0, |
| 27 | state: EffectState::Open, |
| 28 | state_record: 0, |
| 29 | unresolved_digest: None, |
| 30 | objective_id: None, |
| 31 | }; |
| 32 | let (world, disk) = world_state(&row); |
| 33 | let text = reconcile_text(&row, world, world, &disk, &a[6], None).to_string(); |
| 34 | let d = Sha256::digest(text.as_bytes()); |
| 35 | let hex: String = d.iter().map(|b| format!("{b:02x}")).collect(); |
| 36 | println!("{text}"); |
| 37 | println!("{hex}"); |
| 38 | } |