code wiki / (root) / nx_sovereign_page_emit.nx

nx_sovereign_page_emit.nx source

↩ module page · 143 lines · 8313 B

1// nx_sovereign_page_emit.nx -- sovereign emitter: content/sovereign.rows -> dist/sovereign/index.html. 2// THE apertvs.ai-analog: a PUBLISHED, sovereign page that surfaces the nx_openpub_census verdict matrix 3// (Nishi vs apertvs.ai / Apertus) so the capability is SEEN, not just proven on disk ([[feedback-tools-must-surface-in-ui]]). 4// Data-driven: the verdict rows live in the pipe-delimited manifest content/sovereign.rows (the SSOT); 5// editing it + re-running this organ regenerates the page. Mirrors the proven nx_hub_emit pattern EXACTLY 6// (same he_* helpers, same read->line-parse->split->emit->write spine, same /assets/style.css chrome, HTML-escaped 7// text fields, no dead links). File-I/O only -> imports the leaf x86_64 syscall layer ONLY (builds clean around 8// the syscall-dup gotcha, [[nishi-serving-syscall-dup-gotcha]]). Run from the nishi-pages checkout (content/ + dist/ 9// resolve); dist/sovereign must exist. 10// Build: nx_sov_build_run nx_sovereign_page_emit --install (sovereign nx_cc->nxasm, no gcc; installs to _offc) 11// Run: cd nishi-pages && mkdir -p dist/sovereign && _offc/nx_sovereign_page_emit.elf 12// 13// nx_capability_claims: 14// needs: [x86_64_syscalls, pipe_delimited_parse] 15// provides: [sovereign_page_emit, census_matrix_publish, data_driven_verdicts] 16// safety: [html_escape_text_fields, no_floating_point, fixed_output_path, no_dead_links] 17// verdict: [exit_0_ok] 18// license: ORIGINAL 19// kind: nishi_pages_specialist 20// raci: [R=nishi_pages_builder, A=elder_west, C=openpub_census_owner, I=conductor] 21 22import "nx_syscalls_x86_64.nx" 23const K_MAGIC_262144: i64 = 262144 24 25// Append NUL-terminated s to buf at off; return new off. 26func he_puts(buf: *u8, off: i64, s: *u8) -> i64 { 27 var o: i64 = off 28 var i: i64 = 0 29 while s[i] != 0 { buf[o] = s[i]; o = o + 1; i = i + 1 } 30 return o 31} 32// Append n raw bytes from src to buf at off; return new off. 33func he_putb(buf: *u8, off: i64, src: *u8, n: i64) -> i64 { 34 var o: i64 = off 35 var i: i64 = 0 36 while i < n { buf[o] = src[i]; o = o + 1; i = i + 1 } 37 return o 38} 39// Append src[0..n), HTML-escaping & < > (UTF-8 multibyte passes through). 40func he_put_esc(buf: *u8, off: i64, src: *u8, n: i64) -> i64 { 41 var o: i64 = off 42 var i: i64 = 0 43 while i < n { 44 let c: i64 = src[i] as i64 45 if c == 0x26 { o = he_puts(buf, o, "&amp;" as *u8) } 46 else { if c == 0x3c { o = he_puts(buf, o, "&lt;" as *u8) } 47 else { if c == 0x3e { o = he_puts(buf, o, "&gt;" as *u8) } 48 else { buf[o] = src[i]; o = o + 1 } } } 49 i = i + 1 50 } 51 return o 52} 53// True if buf[off..off+n) equals the NUL-terminated literal lit. 54func he_eq(buf: *u8, off: i64, n: i64, lit: *u8) -> i64 { 55 var i: i64 = 0 56 while lit[i] != 0 { 57 if i >= n { return 0 } 58 if (buf[off + i] as i64) != (lit[i] as i64) { return 0 } 59 i = i + 1 60 } 61 if i != n { return 0 } 62 return 1 63} 64// Split buf[ls..le) on '|' into foff[]/flen[] (up to 4 fields). Returns the field count. 65func he_split(buf: *u8, ls: i64, le: i64, foff: *i64, flen: *i64) -> i64 { 66 var fi: i64 = 0 67 var s: i64 = ls 68 var i: i64 = ls 69 while i < le { 70 if (buf[i] as i64) == 0x7c { 71 if fi < 4 { foff[fi] = s; flen[fi] = i - s; fi = fi + 1 } 72 s = i + 1 73 } 74 i = i + 1 75 } 76 if fi < 4 { foff[fi] = s; flen[fi] = le - s; fi = fi + 1 } 77 return fi 78} 79 80func main() -> i64 { 81 let len_p: *i64 = sys_mmap(8) as *i64 82 let data: *u8 = sys_read_file_x86_64("content/sovereign.rows" as *u8, len_p) 83 if data == (0 as *u8) { return 5 } 84 let dn: i64 = len_p[0] 85 86 let out: *u8 = sys_mmap(K_MAGIC_262144) 87 var o: i64 = 0 88 89 o = he_puts(out, o, "<!DOCTYPE html><html lang=\"en\"><head><meta charset=\"utf-8\"><meta name=\"viewport\" content=\"width=device-width, initial-scale=1\"><title>Open &middot; Sovereign &middot; Deterministic &middot; Nishi</title><link rel=\"stylesheet\" href=\"/assets/style.css\"><style>.matrix{max-width:1000px;margin:0 auto;padding:1rem}.thesis{max-width:820px;margin:0 auto 1rem;color:#c7cad3;line-height:1.5}.measured{max-width:820px;margin:0 auto 1.5rem;color:#8a8d98;font-size:.85rem}.cap{display:flex;align-items:center;gap:.75rem;padding:.55rem .8rem;border-radius:8px;margin:.35rem 0;background:#12141a;border:1px solid #232634}.vbadge{font-weight:700;font-size:.7rem;letter-spacing:.04em;padding:.2rem .5rem;border-radius:999px;min-width:62px;text-align:center}.v-ahead .vbadge{background:#0d3b1e;color:#4ade80}.v-parity .vbadge{background:#0d2a4a;color:#60a5fa}.v-gap .vbadge{background:#3b2f0d;color:#fbbf24}.grade{font-size:.7rem;color:#8a8d98;min-width:60px}.ctitle{flex:1;font-weight:600}.eviden{font-size:.76rem;color:#8a8d98;font-family:ui-monospace,monospace}@media(max-width:640px){.eviden{display:none}.grade{min-width:44px}}</style></head><body><header class=\"site-header\"><a class=\"site-title\" href=\"/\">Nishi Family</a><nav><a href=\"/hub\">Hub</a><a href=\"/games\">Games</a><a href=\"/sovereign\">Sovereign</a><a href=\"/pages/about\">About</a></nav></header><main><section class=\"hero\"><h1>Open. Sovereign. Deterministic.</h1><p class=\"tagline\">apertvs.ai lets you <em>see</em> the model. Nishi lets you <em>reproduce</em> the whole stack &mdash; byte-exact, from silicon up, with no third-party runtime.</p></section><section class=\"matrix\"><p class=\"thesis\">Apertus (the Swiss AI Initiative's &ldquo;Fully Open Foundation Model for Sovereign AI&rdquo;) reaches sovereignty through <strong>openness</strong>. Nishi exceeds on the axis openness can&rsquo;t touch &mdash; <strong>determinism</strong>: every capability below is a real organ on disk, and the moat rows are proven byte-exact by a measured exceed-gate.</p><p class=\"measured\">Measured by <code>nx_openpub_census</code>: 913&#8240; HAVE &middot; 7 verified exceed-gates &middot; 2 honest gaps &middot; graded against sovereign-fetched sources, never self-scored. Honest gaps are shown, not hidden.</p>" as *u8) 90 91 let foff: *i64 = sys_mmap(64) as *i64 92 let flen: *i64 = sys_mmap(64) as *i64 93 94 var ls: i64 = 0 95 while ls < dn { 96 var le: i64 = 0 - 1 97 var k: i64 = ls 98 while k < dn { 99 if le < 0 { if (data[k] as i64) == 0x0a { le = k } } 100 k = k + 1 101 } 102 if le < 0 { le = dn } 103 104 var skip: i64 = 0 105 if le <= ls { skip = 1 } 106 if skip == 0 { if (data[ls] as i64) == 0x23 { skip = 1 } } 107 108 if skip == 0 { 109 let nf: i64 = he_split(data, ls, le, foff, flen) 110 if nf >= 4 { 111 let is_ahead: i64 = he_eq(data, foff[0], flen[0], "AHEAD" as *u8) 112 let is_gap: i64 = he_eq(data, foff[0], flen[0], "GAP" as *u8) 113 o = he_puts(out, o, "<div class=\"cap " as *u8) 114 if is_ahead == 1 { o = he_puts(out, o, "v-ahead" as *u8) } 115 else { if is_gap == 1 { o = he_puts(out, o, "v-gap" as *u8) } 116 else { o = he_puts(out, o, "v-parity" as *u8) } } 117 o = he_puts(out, o, "\"><span class=\"vbadge\">" as *u8) 118 o = he_putb(out, o, ((data as i64) + foff[0]) as *u8, flen[0]) 119 o = he_puts(out, o, "</span><span class=\"grade\">" as *u8) 120 o = he_putb(out, o, ((data as i64) + foff[1]) as *u8, flen[1]) 121 o = he_puts(out, o, "</span><span class=\"ctitle\">" as *u8) 122 o = he_put_esc(out, o, ((data as i64) + foff[2]) as *u8, flen[2]) 123 o = he_puts(out, o, "</span><span class=\"eviden\">" as *u8) 124 o = he_put_esc(out, o, ((data as i64) + foff[3]) as *u8, flen[3]) 125 o = he_puts(out, o, "</span></div>" as *u8) 126 } 127 } 128 ls = le + 1 129 } 130 131 o = he_puts(out, o, "</section></main><footer><p>&copy; 2026 Elder West &middot; Served by NishiVM &mdash; sovereign substrate, reproducible byte-for-byte.</p></footer></body></html>" as *u8) 132 133 let fd: i64 = sys_openat_wr("dist/sovereign/index.html" as *u8, 420) 134 if fd < 0 { return 6 } 135 sys_write(fd, out, o) 136 sys_close(fd) 137 138 let banner: *u8 = "nx_sovereign_page_emit: wrote dist/sovereign/index.html\n" as *u8 139 var bn: i64 = 0 140 while banner[bn] != 0 { bn = bn + 1 } 141 sys_write(1, banner, bn) 142 return 0 143}