code wiki / _hdl_build / nx_mirror_census.nx

nx_mirror_census.nx source

↩ module page · 132 lines · 11358 B

1// nx_mirror_census.nx -- HONEST MEASURED census of Nishi's "download & MIRROR a published open artifact onto 2// the NAS" capability vs the S-class bar (aria2 / HuggingFace-hub / BitTorrent-client / rsync-mirror level). 3// Drives the GENERAL nx_capability_census engine: each axis = DATA ROW (competitor TERM + our organ + our 4// exceed-gate), graded NEVER self-scored against the sovereign-banked knowledge/fetched/mirror_*.raw corpus. 5// The honest finding it encodes: the download PRIMITIVES already exist and several are sovereign-AHEAD (own-TLS 6// fetch replacing curl/wget/aria2; a full BitTorrent+DHT+magnet swarm client; CAS/CID + SHA-256 integrity; 7// provenance receipts; self-healing torrent durability; NAS transport) -- but the UNIFYING "mirror an 8// open-model onto the NAS + emit a receipt" orchestrator, HuggingFace-repo-aware fetch, plain-HTTP single-file 9// RANGE-RESUME, and rsync-style incremental refresh are GENUINE GAPS today = the build ladder to S-class-exceed. 10// GREEN = measurement honest + grounded (liar-kill armed; real banked corpus), NOT "we win". 11// Sovereign nx_cc->nxasm (no gcc, no 3rd-party). expect_exit: 0 license_tier: ORIGINAL 12import "nx_capability_census.nx" 13import "nx_syscalls.nx" 14const K_MAGIC_2097152: i64 = 2097152 15 16func w(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 } 17func wn(v: i64) -> i64 { var m: i64=v; if m<0{w("-" as *u8);m=0-m} let t:*u8=sys_mmap(24); var k:i64=0; if m==0{t[0]=48 as u8;k=1} while m>0{t[k]=(48+(m%10)) as u8;m=m/10;k=k+1} var i:i64=0; let o:*u8=sys_mmap(24); while i<k{o[i]=t[k-1-i];i=i+1} sys_write(1,o,k); return 0 } 18 19// st[0]=total st[1]=have(our>=3) st[2]=exceeds(our==4) st[3]=ahead st[4]=parity st[5]=gap st[6]=bothabsent st[7]=comp_sum 20func row(label: *u8, term: *u8, organ: *u8, exceed: *u8, subj: *i64, ns: i64, buf: *u8, cap: i64, st: *i64) -> i64 { 21 let comp: i64 = cc_comp_attest(subj, ns, term, buf, cap) 22 let our: i64 = cc_our_grade(organ, exceed) 23 let v: i64 = cc_verdict(comp, our) 24 w(" "); w(cc_verdict_str(v)); w(" us="); w(cc_grade_str(our)); w(" them(src="); wn(comp); w(") "); w(label); w("\n") 25 st[0]=st[0]+1 26 if our>=3 { st[1]=st[1]+1 } 27 if our==4 { st[2]=st[2]+1 } 28 if v==3 { st[3]=st[3]+1 } 29 if v==2 { st[4]=st[4]+1 } 30 if v==1 { st[5]=st[5]+1 } 31 if v==0 { st[6]=st[6]+1 } 32 st[7]=st[7]+comp 33 return 0 34} 35 36func main() -> i64 { 37 w("=== NISHI DOWNLOAD-&-MIRROR-TO-NAS vs S-class (aria2 / HF-hub / BitTorrent / rsync) -- CENSUS ===\n" as *u8) 38 w("them(src) = sovereign-banked knowledge/fetched/mirror_*.raw attestation (0 = run nx_mirror_research_fetch)\n" as *u8) 39 w("us = EXCEEDS(exceed-gate on disk) > PRESENT(organ on disk) > ABSENT. Never self-scored.\n\n" as *u8) 40 41 let cap: i64 = K_MAGIC_2097152 42 let buf: *u8 = sys_mmap(cap) 43 let st: *i64 = sys_mmap(128) as *i64 44 var z: i64 = 0; while z < 8 { st[z]=0; z=z+1 } 45 46 let subj: *i64 = sys_mmap(8 * 24) as *i64 47 subj[0] = "knowledge/fetched/mirror_a_download_manager.raw" as *u8 as i64 48 subj[1] = "knowledge/fetched/mirror_a_aria2.raw" as *u8 as i64 49 subj[2] = "knowledge/fetched/mirror_a_wget.raw" as *u8 as i64 50 subj[3] = "knowledge/fetched/mirror_a_byte_serving.raw" as *u8 as i64 51 subj[4] = "knowledge/fetched/mirror_b_bittorrent.raw" as *u8 as i64 52 subj[5] = "knowledge/fetched/mirror_b_magnet.raw" as *u8 as i64 53 subj[6] = "knowledge/fetched/mirror_b_dht.raw" as *u8 as i64 54 subj[7] = "knowledge/fetched/mirror_b_academic_torrents.raw" as *u8 as i64 55 subj[8] = "knowledge/fetched/mirror_c_cas.raw" as *u8 as i64 56 subj[9] = "knowledge/fetched/mirror_c_ipfs.raw" as *u8 as i64 57 subj[10] = "knowledge/fetched/mirror_c_checksum.raw" as *u8 as i64 58 subj[11] = "knowledge/fetched/mirror_c_sha2.raw" as *u8 as i64 59 subj[12] = "knowledge/fetched/mirror_d_huggingface.raw" as *u8 as i64 60 subj[13] = "knowledge/fetched/mirror_d_rsync.raw" as *u8 as i64 61 subj[14] = "knowledge/fetched/mirror_d_mirror_site.raw" as *u8 as i64 62 subj[15] = "knowledge/fetched/mirror_e_nas.raw" as *u8 as i64 63 subj[16] = "knowledge/fetched/mirror_e_dedup.raw" as *u8 as i64 64 subj[17] = "knowledge/fetched/mirror_e_data_integrity.raw" as *u8 as i64 65 subj[18] = "knowledge/fetched/mirror_f_digital_signature.raw" as *u8 as i64 66 subj[19] = "knowledge/fetched/mirror_f_supply_chain.raw" as *u8 as i64 67 let ns: i64 = 20 68 69 let none: *u8 = "runtime/nx_DOES_NOT_EXIST_zzqq.nx" as *u8 70 71 // ============ SECTION 1: THE S-CLASS DOWNLOAD PRIMITIVES (expect PARITY/AHEAD -- pieces exist) ============ 72 w(" -- SECTION 1: S-class download primitives (resumable/parallel/torrent/checksum/CAS/NAS) --\n" as *u8) 73 row("RESUMABLE piece-based download (crash-safe)" as *u8, "resume" as *u8, "runtime/nx_torrent_peer_dl.nx" as *u8, none, subj, ns, buf, cap, st) 74 row("PARALLEL / multi-source ingest" as *u8, "parallel" as *u8, "runtime/_hdl_build/nx_parallel_ingest.nx" as *u8, none, subj, ns, buf, cap, st) 75 row("BITTORRENT swarm client (peers/pieces)" as *u8, "BitTorrent" as *u8, "runtime/nx_torrent_get.nx" as *u8, none, subj, ns, buf, cap, st) 76 row("MAGNET link + DHT peer discovery" as *u8, "magnet" as *u8, "runtime/nx_dht_get_peers.nx" as *u8, none, subj, ns, buf, cap, st) 77 row("CHECKSUM integrity verify (SHA-256)" as *u8, "checksum" as *u8, "runtime/nx_sha256.nx" as *u8, none, subj, ns, buf, cap, st) 78 row("CONTENT-ADDRESSED store (CID)" as *u8, "content-addr" as *u8, "runtime/nx_module_cas.nx" as *u8, none, subj, ns, buf, cap, st) 79 row("DEDUPLICATION (store once by hash)" as *u8, "deduplication" as *u8, "runtime/nx_module_cas.nx" as *u8, none, subj, ns, buf, cap, st) 80 row("NAS additive transport (land + keep)" as *u8, "storage" as *u8, "runtime/_hdl_build/nx_aw_send.nx" as *u8, none, subj, ns, buf, cap, st) 81 row("THROUGHPUT / seed bench" as *u8, "throughput" as *u8, "runtime/nx_torrent_bench.nx" as *u8, none, subj, ns, buf, cap, st) 82 row("HTTP fetch of a large file over TLS" as *u8, "download" as *u8, "runtime/nx_https_fetch_follow.nx" as *u8, none, subj, ns, buf, cap, st) 83 84 // ============ SECTION 2: THE SOVEREIGN + DETERMINISM MOAT (expect AHEAD) ============ 85 w("\n -- SECTION 2: sovereign + determinism moat (own-TLS, receipts, deterministic verify, self-heal) --\n" as *u8) 86 row("SOVEREIGN own-TLS fetch (NO curl/wget/aria2)" as *u8, "wget" as *u8, "runtime/nx_https_fetch_follow.nx" as *u8, "runtime/_hdl_build/nx_portability_proof_census.nx" as *u8, subj, ns, buf, cap, st) 87 row("PROVENANCE RECEIPT per mirrored artifact" as *u8, "signature" as *u8, "runtime/_hdl_build/nx_pub_receipt.nx" as *u8, "runtime/_hdl_build/nx_pub_receipt_gate.nx" as *u8, subj, ns, buf, cap, st) 88 row("SUPPLY-CHAIN provenance case (who/where/when)" as *u8, "supply chain" as *u8, "runtime/_hdl_build/nx_supplychain_case.nx" as *u8, none, subj, ns, buf, cap, st) 89 row("DETERMINISTIC byte-exact integrity (SHA KAT)" as *u8, "integrity" as *u8, "runtime/nx_sha256.nx" as *u8, none, subj, ns, buf, cap, st) 90 row("SELF-HEALING durability (health/seed-eval)" as *u8, "durability" as *u8, "runtime/nx_torrent_health.nx" as *u8, none, subj, ns, buf, cap, st) 91 row("ADDITIVE-ONLY never-delete (keep/seed)" as *u8, "availability" as *u8, "runtime/nx_torrent_keep.nx" as *u8, none, subj, ns, buf, cap, st) 92 93 // ============ SECTION 3: GENUINE GAPS -> the build ladder for the mirror capability ============ 94 w("\n -- SECTION 3: CLOSED since (built + proven mirroring the full 16GB Apertus, byte-verified) --\n" as *u8) 95 row("UNIFIED mirror-orchestrator (open-model -> NAS + receipt)" as *u8, "mirror" as *u8,"runtime/_hdl_build/nx_mirror_orchestrator.nx" as *u8, none, subj, ns, buf, cap, st) 96 row("HuggingFace / model-HUB repo-aware enumerate (per-file digest)" as *u8, "Hugging Face" as *u8, "runtime/_hdl_build/nx_apertus_tree_parse.nx" as *u8, none, subj, ns, buf, cap, st) 97 row("HTTP-RANGE resume for a huge file (continue partials)" as *u8, "byte serving" as *u8, "runtime/nx_https_get_stream.nx" as *u8, none, subj, ns, buf, cap, st) 98 w("\n -- SECTION 3b: STILL-OPEN GAP --\n" as *u8) 99 row("rsync-style INCREMENTAL mirror refresh (re-mirror only changed files)" as *u8, "rsync" as *u8, "runtime/nx_rsync_mirror.nx" as *u8, none, subj, ns, buf, cap, st) 100 101 let total: i64 = st[0] 102 let have: i64 = st[1] 103 let permil: i64 = (have * 1000) / total 104 w("\n TALLY: axes=" as *u8); wn(total) 105 w(" HAVE(organ on disk)=" as *u8); wn(have); w(" (" as *u8); wn(permil); w("permil)" as *u8) 106 w(" EXCEEDS-measured=" as *u8); wn(st[2]) 107 w("\n verdicts: AHEAD=" as *u8); wn(st[3]); w(" PARITY=" as *u8); wn(st[4]); w(" GAP=" as *u8); wn(st[5]); w(" BOTH-ABSENT=" as *u8); wn(st[6]) 108 w("\n corpus attestations summed=" as *u8); wn(st[7]); w("\n" as *u8) 109 110 let g_real: i64 = cc_our_grade("runtime/nx_sha256.nx" as *u8, none) 111 let g_fake: i64 = cc_our_grade(none, none) 112 var liar_ok: i64 = 1 113 if g_real != 3 { liar_ok = 0 } 114 if g_fake != 0 { liar_ok = 0 } 115 var corpus_ok: i64 = 0 116 if st[7] > 0 { corpus_ok = 1 } 117 118 w("\n honesty: liar-kill(real=" as *u8); wn(g_real); w(" fake=" as *u8); wn(g_fake); w(")=" as *u8) 119 if liar_ok==1 { w("ARMED" as *u8) } else { w("DISARMED" as *u8) } 120 w(" corpus-grounded=" as *u8) 121 if corpus_ok==1 { w("YES" as *u8) } else { w("NO(run researcher)" as *u8) } 122 w("\n" as *u8) 123 124 w("\n=== MIRROR-CENSUS verdict=" as *u8) 125 if liar_ok==1 { if corpus_ok==1 { 126 w("GREEN (measurement honest + grounded). Read: download PRIMITIVES sovereign-AHEAD (" as *u8); wn(st[2]) 127 w(" measured exceed-gates); " as *u8); wn(st[5]); w(" GAP(s) = mirror-orchestrator + HF-repo + HTTP-range-resume + rsync-refresh = the ladder.\n" as *u8) 128 sys_exit(0); return 0 129 } } 130 w("RED (a real row faked PRESENT, or the corpus is unbanked -> run nx_mirror_research_fetch)\n" as *u8) 131 sys_exit(1); return 1 132}