code wiki / _hdl_build / nx_uigen_census.nx

nx_uigen_census.nx source

↩ module page · 144 lines · 10835 B

1// nx_uigen_census.nx -- census of AUTONOMOUS UI GENERATION capability vs SOTA (operator: benchmark the real 2// thing + review Claude's optimism + real roadmap). Reads knowledge/registry/uigen_features.conf. LIAR-KILL: 3// every HAVE/PARTIAL/EXCEED opens runtime/<organ> (missing -> UNGROUNDED). ★THE ADVERSARIAL MOVE: it computes 4// a GENERATION sub-score SEPARATE from a CRAFT sub-score, so "the kit scores 941 therefore we're good" is 5// REFUTED by construction (craft-high, generation-low). Then emits the graded roadmap L0->L4 (no cliff). 6// expect_exit: 0 license_tier: ORIGINAL 7import "nx_syscalls.nx" 8const K_MAGIC_262144: i64 = 262144 9const K_MAGIC_1024: i64 = 1024 10 11func cp(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 } 12func cn(v: i64) -> i64 { if v==0 { sys_write(1,"0" as *u8,1); return 0 } var m: i64=v; if m<0 { sys_write(1,"-" as *u8,1); m=0-m } let t: *u8=sys_mmap(28); var k: i64=0; while m>0 { t[k]=(48+(m%10)) as u8; m=m/10; k=k+1 } while k>0 { k=k-1; sys_write(1,(((t as i64)+k) as *u8),1) } return 0 } 13func cseq(buf: *u8, off: i64, len: i64, lit: *u8) -> i64 { var i: i64=0; while i<len { if lit[i]==(0 as u8) { return 0 } if buf[off+i]!=lit[i] { return 0 } i=i+1 } if lit[len]!=(0 as u8) { return 0 } return 1 } 14func cwrite(buf: *u8, off: i64, len: i64) -> i64 { sys_write(1, (((buf as i64)+off) as *u8), len); return 0 } 15// score = (have*2 + exc*2 + part)*1000 / (tot*2) 16func cscore(have: i64, part: i64, exc: i64, tot: i64) -> i64 { if tot==0 { return 0 } return (have*2 + exc*2 + part)*1000/(tot*2) } 17 18func main() -> i64 { 19 let cap: i64 = K_MAGIC_262144; let buf: *u8 = sys_mmap(cap) 20 let fd: i64 = sys_openat_rd("knowledge/registry/uigen_features.conf" as *u8) 21 if fd < 0 { cp("cannot open uigen_features.conf\n" as *u8); sys_exit(1); return 1 } 22 var n: i64=0; var r: i64=1 23 while r>0 { if n>=cap { r=0 } else { r=sys_read(fd, (((buf as i64)+n) as *u8), cap-n); if r>0 { n=n+r } } } 24 sys_close(fd) 25 26 cp("=== NX-UIGEN-CENSUS -- AUTONOMOUS UI GENERATION vs SOTA (Design2Code / WebDev-Arena / v0 / GLM 5.2) ===\n" as *u8) 27 cp("The page-judge (nx_ui_judge) grades a FINISHED page's craft; it is BLIND to generation. This splits\n" as *u8) 28 cp("GENERATION (the real capability) from CRAFT (finished-page quality) so the 'kit=941 therefore good'\n" as *u8) 29 cp("optimism is measured, not asserted.\n\n" as *u8) 30 31 let offs: *i64 = sys_mmap(64) as *i64; let lens: *i64 = sys_mmap(64) as *i64 32 // per-tier tallies: [0]=generation [1]=craft [2]=measurement ; each stores have/part/gap/exc via 4 slots 33 let gh: *i64 = sys_mmap(64) as *i64 // have per tier 34 let gp: *i64 = sys_mmap(64) as *i64 // partial per tier 35 let gg: *i64 = sys_mmap(64) as *i64 // gap per tier 36 let ge: *i64 = sys_mmap(64) as *i64 // exceed per tier 37 var ti: i64=0; while ti<3 { gh[ti]=0; gp[ti]=0; gg[ti]=0; ge[ti]=0; ti=ti+1 } 38 var ungrounded: i64=0 39 var sota_gap: i64=0 40 var ls: i64=0 41 while ls < n { 42 var le: i64=ls; var eol: i64=0 43 while eol==0 { if le>=n { eol=1 } else { if buf[le]==(10 as u8) { eol=1 } else { le=le+1 } } } 44 if le>ls { if buf[ls]!=(35 as u8) { 45 // split on TAB into fields 46 var nf: i64=0; var fs: i64=ls; var i: i64=ls 47 while i<=le { var cut: i64=0; if i==le { cut=1 } else { if buf[i]==(9 as u8) { cut=1 } } if cut==1 { if nf<8 { offs[nf]=fs; lens[nf]=i-fs; nf=nf+1 } fs=i+1 } i=i+1 } 48 if nf>=4 { 49 let to: i64=offs[1]; let tl: i64=lens[1] // tier 50 let so: i64=offs[2]; let sl: i64=lens[2] // status 51 let oo: i64=offs[3]; let ol: i64=lens[3] // organ 52 var tier: i64=0-1 53 if cseq(buf,to,tl,"generation" as *u8)==1 { tier=0 } 54 if cseq(buf,to,tl,"craft" as *u8)==1 { tier=1 } 55 if cseq(buf,to,tl,"measurement" as *u8)==1 { tier=2 } 56 var st: i64=0 57 if cseq(buf,so,sl,"HAVE" as *u8)==1 { st=1 } if cseq(buf,so,sl,"PARTIAL" as *u8)==1 { st=2 } if cseq(buf,so,sl,"GAP" as *u8)==1 { st=3 } if cseq(buf,so,sl,"EXCEED" as *u8)==1 { st=4 } 58 if tier>=0 { if st>0 { 59 if st==1 { gh[tier]=gh[tier]+1 } if st==2 { gp[tier]=gp[tier]+1 } if st==3 { gg[tier]=gg[tier]+1 } if st==4 { ge[tier]=ge[tier]+1 } 60 // SOTA-defining axes: while ANY is GAP, no score can flip the adversary verdict 61 if tier==0 { if st==3 { 62 if cseq(buf,offs[0],lens[0],"learned-generation" as *u8)==1 { sota_gap=sota_gap+1 } 63 if cseq(buf,offs[0],lens[0],"autonomy-prompt-to-ui" as *u8)==1 { sota_gap=sota_gap+1 } 64 if cseq(buf,offs[0],lens[0],"visual-fidelity" as *u8)==1 { sota_gap=sota_gap+1 } 65 } } 66 // liar-kill: non-GAP must open runtime/<organ> (unless '-') 67 if st!=3 { 68 var dash: i64=0; if ol==1 { if buf[oo]==(45 as u8) { dash=1 } } 69 if dash==0 { 70 let op: *u8=sys_mmap(K_MAGIC_1024); var q: i64=0; let pre: *u8="runtime/" as *u8 71 var pj: i64=0; while pre[pj]!=(0 as u8){op[q]=pre[pj];q=q+1;pj=pj+1} 72 var oj: i64=0; while oj<ol { op[q]=buf[oo+oj]; q=q+1; oj=oj+1 } op[q]=0 as u8 73 let ofd: i64=sys_openat_rd(op) 74 if ofd<0 { ungrounded=ungrounded+1; cp(" [UNGROUNDED] " as *u8); cwrite(buf, offs[0], lens[0]); cp(" -> missing " as *u8); cp(op); cp("\n" as *u8) } else { sys_close(ofd) } 75 } 76 } 77 }} 78 } 79 } } 80 ls=le+1 81 } 82 83 let gtot: i64=gh[0]+gp[0]+gg[0]+ge[0] 84 let ctot: i64=gh[1]+gp[1]+gg[1]+ge[1] 85 let mtot: i64=gh[2]+gp[2]+gg[2]+ge[2] 86 let gscore: i64=cscore(gh[0],gp[0],ge[0],gtot) 87 let cscore_v: i64=cscore(gh[1],gp[1],ge[1],ctot) 88 89 cp("-- GENERATION (intent->UI, the capability GLM/v0 have): HAVE=" as *u8); cn(gh[0]); cp(" PARTIAL=" as *u8); cn(gp[0]); cp(" GAP=" as *u8); cn(gg[0]); cp(" EXCEED=" as *u8); cn(ge[0]); cp(" of " as *u8); cn(gtot) 90 cp(" => GENERATION-score=" as *u8); cn(gscore); cp("/1000\n" as *u8) 91 cp("-- CRAFT (finished-page quality, what nx_ui_judge sees): HAVE=" as *u8); cn(gh[1]); cp(" PARTIAL=" as *u8); cn(gp[1]); cp(" GAP=" as *u8); cn(gg[1]); cp(" EXCEED=" as *u8); cn(ge[1]); cp(" of " as *u8); cn(ctot) 92 cp(" => CRAFT-score=" as *u8); cn(cscore_v); cp("/1000\n" as *u8) 93 cp("-- MEASUREMENT (the yardstick): HAVE=" as *u8); cn(gh[2]); cp(" PARTIAL=" as *u8); cn(gp[2]); cp(" GAP=" as *u8); cn(gg[2]); cp(" of " as *u8); cn(mtot); cp("\n" as *u8) 94 cp("-- LIAR-KILL: " as *u8); cn(ungrounded); cp(" ungrounded\n\n" as *u8) 95 96 // ★ THE ADVERSARIAL OPTIMISM REVIEW (load-bearing). REFUTED-STANDS RULE: while any SOTA-defining axis 97 // (learned-generation / autonomy-prompt-to-ui / visual-fidelity) is GAP, a rising generation-score can 98 // NEVER flip the verdict -- rules are not NLU, a grammar is not a model. And if those axes ever close, 99 // SOTA is claimable ONLY from an EXTERNAL head-to-head (Design2Code-class bench), never self-certified. 100 cp("=== ADVERSARIAL OPTIMISM REVIEW ===\n" as *u8) 101 cp("page-judge (craft, incl. GENERATED pages) = 941..1000. GENERATION capability = " as *u8); cn(gscore); cp("/1000.\n" as *u8) 102 cp("SOTA-defining axes still GAP (learned / autonomy / visual-fidelity): " as *u8); cn(sota_gap); cp("\n" as *u8) 103 var review_ok: i64=0 104 if sota_gap > 0 { review_ok=1 } 105 if review_ok==0 { if gscore < 400 { review_ok=1 } } 106 if review_ok==1 { 107 cp("VERDICT: REFUTED stands. Rungs L1-L3 are real and MEASURED (spec->palette, brief->structure, grammar->\n" as *u8) 108 cp("many-valid-designs, spec-delta refine) -- but autonomous-generation SOTA means a LEARNED prompt->UI\n" as *u8) 109 cp("with visual fidelity. Keyword rules are not NLU; a bounded grammar is not a model. The score may rise;\n" as *u8) 110 cp("the claim may not, while any SOTA axis is open.\n\n" as *u8) 111 } else { 112 cp("VERDICT: all SOTA axes closed AND score high -- but SOTA is claimable ONLY from an EXTERNAL h2h\n" as *u8) 113 cp("(Design2Code-class bench vs the actual tool). Run it. Self-certification is REFUSED (stays RED).\n\n" as *u8) 114 } 115 116 // ★ THE REAL ROADMAP (no cliff): graded rungs from where-we-ARE to SOTA, each a measurable step. 117 cp("=== REAL ROADMAP -- autonomous UI generation, graded rungs (no kit->model cliff) ===\n" as *u8) 118 cp(" L0 FIXED TEMPLATE [DONE] nx_sclass_kit content-tier: one look, S-class by construction. A human composes it.\n" as *u8) 119 cp(" L1 PARAMETERIZED [DONE] nx_uigen_l1: GENERATES palette+theme+layout from a compact spec. PROVEN by\n" as *u8) 120 cp(" nx_uigen_l1_gate: 6 specs -> 6 distinct both-theme-accessible pages; judge 941.\n" as *u8) 121 cp(" L2 INTENT->MAPPING [DONE] nx_uigen_l2: a natural-language brief -> the RIGHT structure+palette by rule.\n" as *u8) 122 cp(" PROVEN by nx_uigen_l2_gate: 6/6 held-out briefs appropriate (form vs dashboard\n" as *u8) 123 cp(" vs landing vs doc); judge 917 on a system-generated form.\n" as *u8) 124 cp(" L3 DESIGN-GRAMMAR [DONE] nx_uigen_l3: constrained grammar (palette-relations x radius x density x 7-band\n" as *u8) 125 cp(" composition). PROVEN by nx_uigen_l3_gate: 32 seeds -> 32/32 distinct designs,\n" as *u8) 126 cp(" EVERY one valid (independent byte-parser) + both-theme accessible; judge\n" as *u8) 127 cp(" 1000+1000 on samples. REFINE: spec-delta commands 8/8 (change+preserve+refuse).\n" as *u8) 128 cp(" L4 LEARNED [NEXT=ceiling] a TRAINED UI-generation model (GLM 5.2 / v0 / Design2Code topline). MEASURE: a\n" as *u8) 129 cp(" Design2Code/WebDev-Arena-class bench (visual fidelity + human-preference Elo).\n" as *u8) 130 cp(" Honest: this is the deepest gap (train-our-own-model); L1-L3 are the real work.\n\n" as *u8) 131 132 // honesty gate 133 var honest_ok: i64=1 134 if ungrounded!=0 { honest_ok=0 } 135 if gtot<4 { honest_ok=0 } 136 if honest_ok==1 { if review_ok==1 { 137 cp("=== UIGEN-CENSUS verdict=GREEN. Generation-score " as *u8); cn(gscore); cp(" << craft 941 -> the real gap is GENERATION,\n" as *u8) 138 cp("and the roadmap L1->L4 is the honest work (was: a kit->model cliff). Yardsticks named, liar-kill armed.\n" as *u8) 139 sys_exit(0); return 0 140 } } 141 cp("=== UIGEN-CENSUS verdict=RED (ungrounded or review failed)\n" as *u8) 142 sys_exit(1) 143 return 1 144}