code wiki / (root) / nx_container_census.nx

nx_container_census.nx source

↩ module page · 173 lines · 10680 B

1// nx_container_census.nx -- SOVEREIGN depth+breadth census: Nishi Container Host vs the June-2026 container landscape. 2// Operator 2026-06-24: "nishi researcher pass + census pass loops on Docker + other container stuff so we can be sure 3// on DEPTH and BREADTH we can run Elder AI s-class-exceed." DEPTH = per-capability-axis grade (HAVE/PARTIAL/MISSING), 4// GROUNDED in real on-disk evidence (organs, gate logs, artifacts) -- a HAVE claimed without evidence is flagged LIAR. 5// BREADTH = how much of the landscape we have RESEARCHED+banked (knowledge/library/ctr_*.txt from nx_fetch). 6// Liar-killed: cc_has must find the marker in the real file (neg-controls: missing file -> 0, wrong marker -> 0). 7// NO fake greens. license_tier: ORIGINAL 8import "nx_syscalls.nx" 9import "nx_runtime.nx" 10const CC_MAGIC_262144: i64 = 262144 11const CC_MAGIC_262143: i64 = 262143 12 13const CC_TSV: *u8 = "knowledge/status/container_census.tsv" 14 15func cc_w(fd: i64, s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(fd, s, n); return 0 } 16func cc_wn(fd: i64, v: i64) -> i64 { 17 let bb: *u8 = sys_mmap(28) 18 var m: i64 = v 19 if m < 0 { sys_write(fd, "-" as *u8, 1); m = 0 - m } 20 let tt: *u8 = sys_mmap(28) 21 var k: i64 = 0 22 if m == 0 { tt[0] = 48 as u8; k = 1 } 23 while m > 0 { tt[k] = (48 + (m % 10)) as u8; m = m / 10; k = k + 1 } 24 var i: i64 = 0 25 while i < k { bb[i] = tt[k-1-i]; i = i + 1 } 26 sys_write(fd, bb, k) 27 return 0 28} 29func cc_p(s: *u8) -> i64 { return cc_w(1, s) } 30func cc_pn(v: i64) -> i64 { return cc_wn(1, v) } 31func cc_strlen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } 32func cc_read(path: *u8, buf: *u8, cap: i64) -> i64 { 33 let fd: i64 = sys_openat_rd(path) 34 if fd < 0 { return 0 } 35 var tot: i64 = 0 36 var go: i64 = 1 37 while go == 1 { 38 let r: i64 = sys_read(fd, (buf as i64 + tot) as *u8, cap - tot) 39 if r <= 0 { go = 0 } else { tot = tot + r } 40 if tot >= cap { go = 0 } 41 } 42 sys_close(fd) 43 return tot 44} 45func cc_find(buf: *u8, n: i64, pat: *u8, pl: i64) -> i64 { 46 if pl <= 0 { return 0 - 1 } 47 var i: i64 = 0 48 while i + pl <= n { 49 var k: i64 = 0 50 var hit: i64 = 1 51 while k < pl { if buf[i+k] != pat[k] { hit = 0; k = pl } else { k = k + 1 } } 52 if hit == 1 { return i + pl } 53 i = i + 1 54 } 55 return 0 - 1 56} 57func cc_has(path: *u8, marker: *u8) -> i64 { 58 let buf: *u8 = sys_mmap(CC_MAGIC_262144) 59 let n: i64 = cc_read(path, buf, CC_MAGIC_262143) 60 if n <= 0 { return 0 } 61 let ml: i64 = cc_strlen(marker) 62 if cc_find(buf, n, marker, ml) >= 0 { return 1 } 63 return 0 64} 65func cc_exists(path: *u8) -> i64 { let b: *u8 = sys_mmap(64); let n: i64 = cc_read(path, b, 64); if n > 0 { return 1 } return 0 } 66func cc_gname(fd: i64, g: i64) -> i64 { 67 if g == 1 { cc_w(fd, "HAVE" as *u8); return 0 } 68 if g == 0 { cc_w(fd, "PARTIAL" as *u8); return 0 } 69 if g == (0 - 2) { cc_w(fd, "LIAR(HAVE-no-evidence)" as *u8); return 0 } 70 cc_w(fd, "MISSING" as *u8) 71 return 0 72} 73// grade one axis: verify evidence (for HAVE/PARTIAL), print row, return confirmed grade. 74func cc_axis(name: *u8, exemplar: *u8, claimed: i64, path: *u8, marker: *u8) -> i64 { 75 var ev: i64 = 0 76 if claimed != (0 - 1) { ev = cc_has(path, marker) } 77 var confirmed: i64 = claimed 78 if claimed == 1 { if ev == 0 { confirmed = 0 - 2 } } 79 cc_p(" "); cc_p(name); cc_p(" ["); cc_p(exemplar); cc_p("] claimed="); cc_gname(1, claimed) 80 cc_p(" evidence="); cc_pn(ev); cc_p(" -> "); cc_gname(1, confirmed); cc_p("\n") 81 return confirmed 82} 83 84func main() -> i64 { 85 cc_p("=== nx_container_census: Nishi Container Host vs June-2026 container landscape (depth + breadth) ===\n" as *u8) 86 87 // ---- liar-kill neg-controls (the judge must read reality) ---- 88 var neg1: i64 = 0 89 if cc_has("knowledge/status/__no_such_file__.zzz" as *u8, "x" as *u8) == 0 { neg1 = 1 } 90 var neg2: i64 = 0 91 if cc_has("knowledge/containers/elderai.spec" as *u8, "MARKER_DEFINITELY_NOT_PRESENT_9Z" as *u8) == 0 { neg2 = 1 } 92 93 // ---- BREADTH: landscape systems researched + banked (knowledge/library/ctr_*.txt) ---- 94 var nb: i64 = 0 95 nb = nb + cc_exists("knowledge/library/ctr_docker.txt" as *u8) 96 nb = nb + cc_exists("knowledge/library/ctr_containerd.txt" as *u8) 97 nb = nb + cc_exists("knowledge/library/ctr_oci.txt" as *u8) 98 nb = nb + cc_exists("knowledge/library/ctr_lxc.txt" as *u8) 99 nb = nb + cc_exists("knowledge/library/ctr_namespaces.txt" as *u8) 100 nb = nb + cc_exists("knowledge/library/ctr_cgroups.txt" as *u8) 101 nb = nb + cc_exists("knowledge/library/ctr_osvirt.txt" as *u8) 102 nb = nb + cc_exists("knowledge/library/ctr_podman.txt" as *u8) 103 nb = nb + cc_exists("knowledge/library/ctr_k8s.txt" as *u8) 104 nb = nb + cc_exists("knowledge/library/ctr_gvisor.txt" as *u8) 105 nb = nb + cc_exists("knowledge/library/ctr_firecracker.txt" as *u8) 106 nb = nb + cc_exists("knowledge/library/ctr_wsl.txt" as *u8) 107 nb = nb + cc_exists("knowledge/library/ctr_runc_readme.txt" as *u8) 108 nb = nb + cc_exists("knowledge/library/ctr_crio_readme.txt" as *u8) 109 110 // ---- DEPTH: capability axes graded vs the landscape, grounded in evidence ---- 111 cc_p("DEPTH (capability axes; HAVE requires real on-disk evidence or it is flagged LIAR):\n" as *u8) 112 var nh: i64 = 0 113 var np: i64 = 0 114 var nm: i64 = 0 115 var nl: i64 = 0 116 let g01: i64 = cc_axis("process_isolation " as *u8, "Docker=namespaces; us=JobObject" as *u8, 1, "runtime/nx_pe_container_sdserver.nx" as *u8, "CreateJobObjectW" as *u8) 117 let g02: i64 = cc_axis("lifecycle_govern " as *u8, "Docker=run/wait/reap; us=Wait+ExitCode" as *u8, 1, "runtime/nx_pe_container_sdserver.nx" as *u8, "WaitForSingleObject" as *u8) 118 let g03: i64 = cc_axis("declarative_spec " as *u8, "Docker=compose; us=ContainerSpec" as *u8, 1, "knowledge/containers/elderai.spec" as *u8, "cmdline=" as *u8) 119 let g04: i64 = cc_axis("build_from_spec " as *u8, "Docker=docker build; us=spec_emit" as *u8, 1, "runtime/nx_container_spec_emit.nx" as *u8, "CONTAINERSPECGATE" as *u8) 120 let g05: i64 = cc_axis("daemonless " as *u8, "Docker=daemon; us=NONE(measured 0)" as *u8, 1, "knowledge/status/container_bench.tsv" as *u8, "idle_procs" as *u8) 121 let g06: i64 = cc_axis("native_no_vm " as *u8, "Docker/Win=WSL2 VM; us=native" as *u8, 1, "knowledge/status/container_bench.tsv" as *u8, "isolation_vm_tax" as *u8) 122 let g07: i64 = cc_axis("gpu_access " as *u8, "Docker=--gpus via VM; us=native CUDA" as *u8, 1, "knowledge/status/container_bench_measured.dat" as *u8, "nishi_gpu_ms" as *u8) 123 let g08: i64 = cc_axis("measured_exceed " as *u8, "(unique) us=nx_container_bench" as *u8, 1, "knowledge/status/container_bench.log" as *u8, "verdict=GREEN" as *u8) 124 let g09: i64 = cc_axis("resource_limits " as *u8, "Docker=cgroups cpu/io/mem; us=Job mem" as *u8, 0, "runtime/nx_pe_container_sdserver.nx" as *u8, "SetInformationJobObject" as *u8) 125 let g10: i64 = cc_axis("networking_portmap " as *u8, "Docker=-p NAT; us=host-native port" as *u8, 0, "knowledge/containers/elderai.spec" as *u8, "--listen-port" as *u8) 126 let g11: i64 = cc_axis("image_layering " as *u8, "Docker=layers; us=template+spec" as *u8, 0, "runtime/nx_container_spec_emit.nx" as *u8, "TEMPLATE" as *u8) 127 let g12: i64 = cc_axis("security_sandbox " as *u8, "gVisor/seccomp; us=JobObject only" as *u8, 0, "runtime/nx_pe_container_sdserver.nx" as *u8, "Job" as *u8) 128 let g13: i64 = cc_axis("cross_platform " as *u8, "Docker=Linux+Win/VM; us=Win-native" as *u8, 0, "runtime/nx_container_spec_emit.nx" as *u8, "csp_stamp" as *u8) 129 let g14: i64 = cc_axis("rootless " as *u8, "podman=rootless; us=user,no daemon" as *u8, 0, "knowledge/status/container_bench.tsv" as *u8, "idle_procs" as *u8) 130 let g15: i64 = cc_axis("orchestration_multi " as *u8, "Docker=compose/k8s; us=nx_container_compose" as *u8, 1, "runtime/nx_container_compose.nx" as *u8, "CONTAINERCOMPOSEGATE" as *u8) 131 let g16: i64 = cc_axis("health_restart " as *u8, "Docker=healthcheck/restart; us=Job-PE respawn loop (M1a) + NAS hostctl supervise" as *u8, 1, "runtime/nx_pe_container_win_sup.nx" as *u8, "RESTART-LOOP" as *u8) 132 let g17: i64 = cc_axis("registry_distribution " as *u8, "Docker=registry/pull; us=content-addressed CAS + integrity pull-by-name" as *u8, 1, "runtime/nx_container_registry.nx" as *u8, "CONTAINERREGISTRYGATE" as *u8) 133 134 // ---- tally ---- 135 let gs: *i64 = sys_mmap(17 * 8) as *i64 136 gs[0]=g01; gs[1]=g02; gs[2]=g03; gs[3]=g04; gs[4]=g05; gs[5]=g06; gs[6]=g07; gs[7]=g08; gs[8]=g09 137 gs[9]=g10; gs[10]=g11; gs[11]=g12; gs[12]=g13; gs[13]=g14; gs[14]=g15; gs[15]=g16; gs[16]=g17 138 var i: i64 = 0 139 while i < 17 { 140 if gs[i] == 1 { nh = nh + 1 } 141 if gs[i] == 0 { np = np + 1 } 142 if gs[i] == (0 - 1) { nm = nm + 1 } 143 if gs[i] == (0 - 2) { nl = nl + 1 } 144 i = i + 1 145 } 146 147 cc_p("\nBREADTH (landscape researched+banked): " as *u8); cc_pn(nb); cc_p(" / 14 key systems in knowledge/library/ctr_*.txt\n" as *u8) 148 cc_p("DEPTH tally (of 17 axes): HAVE=" as *u8); cc_pn(nh); cc_p(" PARTIAL=" as *u8); cc_pn(np); cc_p(" MISSING=" as *u8); cc_pn(nm); cc_p(" LIAR=" as *u8); cc_pn(nl); cc_p("\n" as *u8) 149 cc_p("neg1=" as *u8); cc_pn(neg1); cc_p(" neg2=" as *u8); cc_pn(neg2); cc_p("\n" as *u8) 150 151 // ---- durable summary ---- 152 let tfd: i64 = sys_openat_wr(CC_TSV, 0x1a4) 153 if tfd >= 0 { 154 cc_w(tfd, "# nx_container_census -- Nishi Container Host vs June-2026 landscape (depth+breadth), grounded+liar-killed\n" as *u8) 155 cc_w(tfd, "breadth_banked\t" as *u8); cc_wn(tfd, nb); cc_w(tfd, "\t/14\n" as *u8) 156 cc_w(tfd, "depth_have\t" as *u8); cc_wn(tfd, nh); cc_w(tfd, "\n" as *u8) 157 cc_w(tfd, "depth_partial\t" as *u8); cc_wn(tfd, np); cc_w(tfd, "\n" as *u8) 158 cc_w(tfd, "depth_missing\t" as *u8); cc_wn(tfd, nm); cc_w(tfd, "\n" as *u8) 159 cc_w(tfd, "depth_liar\t" as *u8); cc_wn(tfd, nl); cc_w(tfd, "\n" as *u8) 160 sys_close(tfd) 161 } 162 163 // ---- gate: grounded (liar-kill works), no false HAVE, breadth banked ---- 164 var pass: i64 = 0 165 if neg1 == 1 { if neg2 == 1 { if nl == 0 { if nb >= 12 { if nh >= 8 { pass = 1 } } } } } 166 if pass == 1 { 167 cc_p("CONTAINERCENSUSGATE verdict=GREEN (grounded; liar-kill fired; no false HAVE; landscape breadth banked)\n" as *u8) 168 cc_p("census -> knowledge/status/container_census.tsv\n" as *u8) 169 return 0 170 } 171 cc_p("CONTAINERCENSUSGATE verdict=RED (liar/evidence/breadth check failed)\n" as *u8) 172 return 1 173}