code wiki / _hdl_build / nx_ng2_census.nx
nx_ng2_census.nx source
↩ module page · 111 lines · 7569 B
1// nx_ng2_census.nx -- SOVEREIGN coverage census for the ROUND-2 applied/perception/avatar/voice frontier
2// (operator 2026-06-23: "make sure we didn't miss anything like qwen camera angle, hololive-type avatars, own-voice
3// translation, beauty evaluation, OCR/what-are-we-seeing"). Grounded on REAL organ existence (org_resolve) so it
4// CAN'T be fiction: a family classifies HAVE iff a real organ file exists, MISSING otherwise. The MISSING set is
5// the honest worklist = what we actually missed. Data in the sovereign nx_seg_store (NO TSV). Mirrors nx_ng_gap.
6// Gate: neg-control has teeth (a real organ -> 1, a fake -> 0); verdict GREEN if grounded + teeth (HAVE>=1).
7// expect_exit: 0 license_tier: ORIGINAL
8import "nx_seg_store.nx"
9import "nx_syscalls.nx"
10const AP_MAGIC_2048: i64 = 2048
11
12const AP_STORE: *u8 = "knowledge/store/ngfx_applied"
13const NSTEPS: i64 = 12
14
15func cp(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 }
16func clen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
17func cpn(v: i64) -> i64 {
18 let bb: *u8 = sys_mmap(28); var m: i64 = v
19 if m < 0 { sys_write(1, "-" as *u8, 1); m = 0 - m }
20 let t: *u8 = sys_mmap(28); var k: i64 = 0
21 if m == 0 { t[0] = 48 as u8; k = 1 }
22 while m > 0 { t[k] = (48 + (m % 10)) as u8; m = m / 10; k = k + 1 }
23 var i: i64 = 0; while i < k { bb[i] = t[k - 1 - i]; i = i + 1 }
24 sys_write(1, bb, k); return 0
25}
26func cstreq(a: *u8, b: *u8) -> i64 { var i: i64 = 0; while a[i] != (0 as u8) { if a[i] != b[i] { return 0 } i = i + 1 } if b[i] != (0 as u8) { return 0 } return 1 }
27func cexists(path: *u8) -> i64 { let fd: i64 = sys_openat_rd(path); if fd < 0 { return 0 } sys_close(fd); return 1 }
28func cjoin(pfx: *u8, name: *u8, out: *u8) -> i64 { var o: i64 = 0; var i: i64 = 0; while pfx[i] != (0 as u8) { out[o] = pfx[i]; o = o + 1; i = i + 1 } i = 0; while name[i] != (0 as u8) { out[o] = name[i]; o = o + 1; i = i + 1 } out[o] = 0 as u8; return 0 }
29func org_resolve(name: *u8) -> i64 {
30 if cstreq(name, "-" as *u8) == 1 { return 0 }
31 let p: *u8 = sys_mmap(512)
32 cjoin("runtime/_hdl_build/" as *u8, name, p); if cexists(p) == 1 { return 1 }
33 cjoin("runtime/" as *u8, name, p); if cexists(p) == 1 { return 1 }
34 cjoin("runtime/wiki/" as *u8, name, p); if cexists(p) == 1 { return 1 }
35 return 0
36}
37func ap_key(k: i64, out: *u8) -> i64 {
38 var o: i64 = 0; let pfx: *u8 = "cap:APP:" as *u8; var i: i64 = 0
39 while pfx[i] != (0 as u8) { out[o] = pfx[i]; o = o + 1; i = i + 1 }
40 if k == 0 { out[o] = 48 as u8; o = o + 1 } else { let t: *u8 = sys_mmap(16); var m: i64 = k; var n: i64 = 0; while m > 0 { t[n] = (48 + (m % 10)) as u8; m = m / 10; n = n + 1 } var j: i64 = 0; while j < n { out[o] = t[n - 1 - j]; o = o + 1; j = j + 1 } }
41 out[o] = 0 as u8; return 0
42}
43func ap_field(src: *u8, slen: i64, idx: i64, out: *u8) -> i64 {
44 var f: i64 = 0; var i: i64 = 0
45 while f < idx { if i >= slen { out[0] = 0 as u8; return 0 } if src[i] == (124 as u8) { f = f + 1 } i = i + 1 }
46 var o: i64 = 0; var g: i64 = 1
47 while g == 1 { if i >= slen { g = 0 } else { if src[i] == (124 as u8) { g = 0 } else { out[o] = src[i]; o = o + 1; i = i + 1 } } }
48 out[o] = 0 as u8; return 1
49}
50func sa(w: *i64, key: *u8, val: *u8) -> i64 { ss_add(w, 1, key, val, clen(val)); return 0 }
51
52// SEED the round-2 family coverage. value = "family|organ_file|note". organ "-" = genuinely missing (the worklist).
53// Organ names GROUNDED by a live runtime/ probe 2026-06-23 (not guessed).
54func ap_seed() -> i64 {
55 let w: *i64 = ss_begin()
56 sa(w, "cap:APP:1" as *u8, "CAMERA-CONTROL|nx_camera_q14.nx|virtual camera (Q14 fixed-pt projection) HAVE; learned camera-ANGLE control in gen (Qwen-style) = partial/extend" as *u8)
57 sa(w, "cap:APP:2" as *u8, "AVATAR-DEFORM|nx_ng_avatar.nx|animatable avatar (pose-deform, generalizes) HAVE (built this arc)" as *u8)
58 sa(w, "cap:APP:3" as *u8, "VTUBER-LIVE|-|MISSING: real-time FACE-DRIVEN avatar puppeteering (compose nx_face_probe + nx_ng_avatar + tracking)" as *u8)
59 sa(w, "cap:APP:4" as *u8, "VOICE-CLONE|nx_voice_clone_synth.nx|voice cloning / synth HAVE" as *u8)
60 sa(w, "cap:APP:5" as *u8, "VOICEPRINT|nx_voiceprint.nx|speaker embedding / voiceprint HAVE" as *u8)
61 sa(w, "cap:APP:6" as *u8, "MACHINE-TRANSLATE|nx_mt_core.nx|text machine translation HAVE (nx_mt_core + nx_translate_daemon)" as *u8)
62 sa(w, "cap:APP:7" as *u8, "OWNVOICE-TRANSLATE|-|MISSING: the COMPOSITION operator wants -- speech->translate->resynth in the SAME voice (wire nx_voiceprint + nx_mt_core + nx_voice_clone_synth + nx_voice_codec)" as *u8)
63 sa(w, "cap:APP:8" as *u8, "AESTHETIC-EVAL|nx_aesthetics.nx|aesthetic evaluation HAVE (nx_aesthetics + nx_aesthetic_vocabulary)" as *u8)
64 sa(w, "cap:APP:9" as *u8, "BEAUTY-SCORE|nx_beauty_score.nx|beauty scoring HAVE" as *u8)
65 sa(w, "cap:APP:10" as *u8, "OCR|-|MISSING: optical character recognition (what TEXT are we seeing) -- no organ found" as *u8)
66 sa(w, "cap:APP:11" as *u8, "VLM-WHAT-AM-I-SEEING|-|MISSING: open-ended vision-language understanding / VQA (general what-are-we-seeing); have only narrow nx_face_probe/nx_aesthetics" as *u8)
67 sa(w, "cap:APP:12" as *u8, "FACE-ANALYSIS|nx_face_probe.nx|face detect/analyze HAVE (nx_face_probe + nx_face_count + nx_face_novelty)" as *u8)
68 ss_commit(AP_STORE, w, sys_now_realtime_sec())
69 return 0
70}
71
72func main() -> i64 {
73 cp("=== nx_ng2_census: ROUND-2 applied/perception/avatar/voice coverage (status from REAL organs, no TSV) ===\n" as *u8)
74 ap_seed()
75 let h: *i64 = ss_open(AP_STORE)
76 let pq: *i64 = sys_mmap(16) as *i64
77 let lq: *i64 = sys_mmap(16) as *i64
78 var have: i64 = 0; var missing: i64 = 0
79 let miss_buf: *u8 = sys_mmap(AP_MAGIC_2048); var mo: i64 = 0
80 var k: i64 = 1
81 while k <= NSTEPS {
82 let key: *u8 = sys_mmap(64); ap_key(k, key)
83 if ss_hget(h, key, pq, lq) == 1 {
84 let val: *u8 = pq[0] as *u8; let vl: i64 = lq[0]
85 let node: *u8 = sys_mmap(96); let organ: *u8 = sys_mmap(96); let note: *u8 = sys_mmap(220)
86 ap_field(val, vl, 0, node); ap_field(val, vl, 1, organ); ap_field(val, vl, 2, note)
87 let isb: i64 = org_resolve(organ)
88 if isb == 1 { have = have + 1; cp(" [HAVE] " as *u8) }
89 else { missing = missing + 1; cp(" [MISSING] " as *u8); var z: i64 = 0; while node[z] != (0 as u8) { miss_buf[mo] = node[z]; mo = mo + 1; z = z + 1 } miss_buf[mo] = 32 as u8; mo = mo + 1 }
90 cp(node); cp(" <= " as *u8); cp(organ); cp(" -- " as *u8); cp(note); cp("\n" as *u8)
91 }
92 k = k + 1
93 }
94 miss_buf[mo] = 0 as u8
95 cp(" COVERAGE: HAVE=" as *u8); cpn(have); cp(" MISSING=" as *u8); cpn(missing); cp(" of " as *u8); cpn(NSTEPS); cp("\n" as *u8)
96 cp(" >> WORKLIST (what we missed, the next builds) = " as *u8); cp(miss_buf); cp("\n" as *u8)
97
98 // neg-control: org-existence has teeth
99 let ncr: i64 = org_resolve("nx_voice_clone_synth.nx" as *u8)
100 let ncf: i64 = org_resolve("nx_zzz_nonexistent.nx" as *u8)
101 cp(" neg-control: built(nx_voice_clone_synth.nx)=" as *u8); cpn(ncr); cp(" (expect 1) built(fake)=" as *u8); cpn(ncf); cp(" (expect 0)\n" as *u8)
102
103 var ok: i64 = 1
104 if have < 1 { ok = 0 }
105 if ncr != 1 { ok = 0 }
106 if ncf != 0 { ok = 0 }
107 cp(" verdict=" as *u8)
108 if ok == 1 { cp("GREEN (coverage grounded on real organs; HAVE + the MISSING worklist are both real; teeth)\n" as *u8); sys_exit(0); return 0 }
109 cp("RED\n" as *u8)
110 sys_exit(1); return 1
111}