interplane.Get Omega
Read in your language

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

branch main Branches Tags History

aien-sovereign-core-mv / crates / aien-runtime / examples / np1_edit_merge.rs

61 lines · 2545 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//! NEXT-PHASE-1 v8 edit-merge re-derivation (ACCEPTANCE-v8 row <launch>-A).
17//! Recomputes the proposal the Skill hands to AEGIS for one parsed edit reply,
18//! `edit_proposal(reply, Some((path, prior)))` (compose/bridge.rs), from the reply text
19//! recorded in the S3 report and the pre-seed file, without a model or a GPU.
20//! Prints one JSON object: the proposal's sha256 (compared with the S4
21//! authorization's `proposal_sha256`) and the merged content's sha256
22//! (compared with its `content_sha256`), or the refusal.
23//!
24//! usage: np1_edit_merge <path> <prior_file> <reply_file>
25use sha2::Digest;
26
27fn hex(b: &[u8]) -> String {
28 format!("{:x}", sha2::Sha256::digest(b))
29}
30
31fn main() {
32 let a: Vec<String> = std::env::args().collect();
33 if a.len() != 4 {
34 eprintln!("usage: np1_edit_merge <path> <prior_file> <reply_file>");
35 std::process::exit(2);
36 }
37 let prior = std::fs::read_to_string(&a[2]).expect("prior file");
38 let reply = std::fs::read_to_string(&a[3]).expect("reply file");
39 let out = match aien_runtime::compose::rederive::edit_proposal(
40 &reply,
41 Some((a[1].as_str(), prior.as_str())),
42 ) {
43 Ok(text) => {
44 let content = aien_runtime::check_file_proposal(&text)
45 .map(|p| p.content)
46 .unwrap_or_default();
47 serde_json::json!({
48 "ok": true, "path": a[1],
49 "prior_sha256": hex(prior.as_bytes()), "reply_sha256": hex(reply.as_bytes()),
50 "proposal_sha256": hex(text.as_bytes()), "content_sha256": hex(content.as_bytes()),
51 "merged": text != reply,
52 })
53 }
54 Err(e) => serde_json::json!({
55 "ok": false, "path": a[1],
56 "prior_sha256": hex(prior.as_bytes()), "reply_sha256": hex(reply.as_bytes()),
57 "error": e,
58 }),
59 };
60 println!("{out}");
61}