code wiki / (root) / nx_crew_page.nx

nx_crew_page.nx source

↩ module page · 137 lines · 13068 B

1// nx_crew_page.nx -- GENERATOR (not hand-authored HTML, per build-generators-not-artifacts) for the CREW CAPABILITY 2// DIRECTORY UI surface (operator "use our harshest standards": tools-must-surface-in-UI). Reads knowledge/registry/ 3// crew_capabilities.data (role|activity|organ|mcp_tool|status) + emits ONE self-contained /compare/crew page: the live 4// MCP-exposure coverage + every role grouped by HOW its accountable capability is reached over MCP -- its own tool, or 5// the exact `nishi_crew <role> <activity>` dispatch call (so the tools are DISCOVERABLE + INVOCABLE from the page). 6// Data-driven: a role's status changes -> re-run -> the page moves it, zero code. NOTE: no '#'/'!' in string literals 7// (nx_cc trap) -> rgb() colors + DOCTYPE '!' as a byte. Zero JS, zero trackers, both color schemes, responsive. 8// license_tier: ORIGINAL expect_exit: 0 9import "nx_syscalls.nx" 10const K_MAGIC_65536: i64 = 65536 11 12func 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 } 13func wc(fd: i64, code: i64) -> i64 { let t: *u8 = sys_mmap(2); t[0] = code as u8; sys_write(fd, t, 1); return 0 } 14func wn(fd: i64, v: i64) -> i64 { 15 var m: i64 = v; if m < 0 { w(fd, "-" as *u8); m = 0 - m } 16 let t: *u8 = sys_mmap(24); var k: i64 = 0; if m == 0 { t[0] = 48 as u8; k = 1 } 17 while m > 0 { t[k] = (48 + (m % 10)) as u8; m = m / 10; k = k + 1 } 18 let o: *u8 = sys_mmap(24); var i: i64 = 0; while i < k { o[i] = t[k-1-i]; i = i + 1 } sys_write(fd, o, k); return 0 19} 20func c_read(path: *u8, buf: *u8, cap: i64) -> i64 { 21 let fd: i64 = sys_openat_rd(path); if fd < 0 { return 0 - 1 } 22 var tot: i64 = 0 23 while tot < cap { let r: i64 = sys_read(fd, (buf as i64 + tot) as *u8, cap - tot); if r <= 0 { break } tot = tot + r } 24 sys_close(fd); return tot 25} 26func streq(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 splitpipe(s: *u8, fld: *i64, maxf: i64) -> i64 { 28 var c: i64 = 1; fld[0] = s as i64; var i: i64 = 0 29 while s[i] != (0 as u8) { if s[i] == (124 as u8) { s[i] = 0 as u8; if c < maxf { fld[c] = (s as i64) + i + 1; c = c + 1 } } i = i + 1 } 30 return c 31} 32// emit the rows whose status == filter. mode: 0 mcp (tool badge) · 1 dispatch (invocation code) · 2 organ/concept (organ note). 33func emit_rows(rp: *i64, ap: *i64, op: *i64, tp: *i64, sp: *i64, nr: i64, filter: *u8, mode: i64) -> i64 { 34 var i: i64 = 0 35 while i < nr { 36 if streq(sp[i] as *u8, filter) == 1 { 37 w(1, "<div class='row'><span class='rn'>" as *u8); w(1, rp[i] as *u8) 38 w(1, "</span><span class='act'>" as *u8); w(1, ap[i] as *u8); w(1, "</span>" as *u8) 39 if mode == 0 { w(1, "<span class='via tool'>" as *u8); w(1, tp[i] as *u8); w(1, "</span>" as *u8) } 40 if mode == 1 { w(1, "<code class='via inv'>nishi_crew " as *u8); w(1, rp[i] as *u8); w(1, " " as *u8); w(1, ap[i] as *u8); w(1, "</code>" as *u8) } 41 if mode == 2 { w(1, "<span class='via org'>" as *u8); w(1, op[i] as *u8); w(1, "</span>" as *u8) } 42 w(1, "</div>\n" as *u8) 43 } 44 i = i + 1 45 } 46 return 0 47} 48func section(rp: *i64, ap: *i64, op: *i64, tp: *i64, sp: *i64, nr: i64, cls: *u8, filter: *u8, mode: i64, title: *u8, desc: *u8, count: i64) -> i64 { 49 w(1, "<section class='grp " as *u8); w(1, cls); w(1, "'><h2>" as *u8); w(1, title) 50 w(1, " <span class='cnt'>" as *u8); wn(1, count); w(1, "</span></h2><p class='gd'>" as *u8); w(1, desc); w(1, "</p>\n" as *u8) 51 emit_rows(rp, ap, op, tp, sp, nr, filter, mode) 52 w(1, "</section>\n" as *u8) 53 return 0 54} 55 56func main() -> i64 { 57 let cap: i64 = K_MAGIC_65536 58 let buf: *u8 = sys_mmap(cap) 59 let n: i64 = c_read("knowledge/registry/crew_capabilities.data" as *u8, buf, cap) 60 if n <= 0 { w(1, "CREW CAPABILITIES DATA MISSING\n" as *u8); sys_exit(1); return 1 } 61 62 let MAXR: i64 = 64 63 let rp: *i64 = sys_mmap(MAXR*8) as *i64 64 let ap: *i64 = sys_mmap(MAXR*8) as *i64 65 let op: *i64 = sys_mmap(MAXR*8) as *i64 66 let tp: *i64 = sys_mmap(MAXR*8) as *i64 67 let sp: *i64 = sys_mmap(MAXR*8) as *i64 68 let fld: *i64 = sys_mmap(8*8) as *i64 69 var nr: i64 = 0 70 var p: i64 = 0 71 while p < n { 72 var e: i64 = p 73 while e < n { if buf[e] == (10 as u8) { break } e = e + 1 } 74 buf[e] = 0 as u8 75 let line: *u8 = (buf as i64 + p) as *u8 76 p = e + 1 77 if line[0] == (0 as u8) { } else { if line[0] == (35 as u8) { } else { 78 let cnt: i64 = splitpipe(line, fld, 8) 79 if cnt >= 5 { if nr < MAXR { 80 rp[nr]=fld[0]; ap[nr]=fld[1]; op[nr]=fld[2]; tp[nr]=fld[3]; sp[nr]=fld[4]; nr = nr + 1 81 } } 82 } } 83 } 84 // counts 85 var mcp: i64=0; var disp: i64=0; var org: i64=0; var con: i64=0; var hum: i64=0 86 var i: i64 = 0 87 while i < nr { let s: *u8 = sp[i] as *u8 88 if streq(s,"mcp" as *u8)==1 { mcp=mcp+1 } else { if streq(s,"dispatch" as *u8)==1 { disp=disp+1 } else { if streq(s,"organ" as *u8)==1 { org=org+1 } else { if streq(s,"concept" as *u8)==1 { con=con+1 } else { hum=hum+1 } } } } 89 i = i + 1 } 90 let denom: i64 = nr - hum 91 let served: i64 = mcp + disp 92 var permil: i64 = 0; if denom > 0 { permil = (served * 1000) / denom } 93 94 w(1, "<" as *u8); wc(1, 33); w(1, "DOCTYPE html>\n<html lang=" as *u8); wc(1, 34); w(1, "en" as *u8); wc(1, 34); w(1, "><head><meta charset='utf-8'><meta name='viewport' content='width=device-width, initial-scale=1'>\n" as *u8) 95 w(1, "<title>Nishi Crew -- Capability Directory</title>\n<style>\n" as *u8) 96 w(1, ":root{--nx-bg:rgb(255,255,255);--nx-fg:rgb(22,22,34);--nx-mut:rgb(98,98,110);--nx-ac:rgb(42,77,143);--nx-line:rgb(226,226,234);--nx-soft:rgb(247,248,251);--nx-g:rgb(26,120,55);--nx-gs:rgb(232,245,236);--nx-a:rgb(150,92,0);--nx-as:rgb(250,243,228);--nx-n:rgb(112,112,124);--nx-ns:rgb(238,238,243);--nx-code:rgb(240,240,246);--nx-space:16px;--nx-radius:14px;--nx-shadow:0 1px 2px rgba(20,20,40,.05),0 6px 20px rgba(20,20,40,.05)}\n" as *u8) 97 w(1, "*{box-sizing:border-box}body{background:var(--nx-bg);color:var(--nx-fg);font-family:-apple-system,Segoe UI,Roboto,sans-serif;max-width:920px;margin:0 auto;padding:4vh 20px 8vh;line-height:1.55}\n" as *u8) 98 w(1, ".skip-link{position:absolute;left:-999px;top:0}.skip-link:focus{left:8px;top:8px;background:var(--nx-fg);color:var(--nx-bg);padding:8px 14px;border-radius:8px;z-index:9}\n" as *u8) 99 w(1, ".crumb{font-size:.85rem;margin-bottom:14px;color:var(--nx-mut)}a{color:var(--nx-ac);text-decoration:none}a:hover{text-decoration:underline}a:focus-visible{outline:2px solid var(--nx-ac);outline-offset:3px;border-radius:3px}\n" as *u8) 100 w(1, "h1{font-size:clamp(1.6rem,1.1rem+2.4vw,2.1rem);margin:0 0 6px;letter-spacing:-.015em;line-height:1.15}.sub{color:var(--nx-mut);font-size:1.02rem;margin:0 0 22px;max-width:60ch}\n" as *u8) 101 w(1, ".hero{display:flex;align-items:center;gap:22px;flex-wrap:wrap;background:linear-gradient(135deg,var(--nx-soft),var(--nx-bg));border:1px solid var(--nx-line);border-radius:var(--nx-radius);padding:20px 24px;margin:0 0 10px;box-shadow:var(--nx-shadow)}\n" as *u8) 102 w(1, ".big{font-size:clamp(2.4rem,1.6rem+3vw,3.1rem);font-weight:800;line-height:1;color:var(--nx-g);font-variant-numeric:tabular-nums}.big small{font-size:1rem;font-weight:600;color:var(--nx-mut);margin-left:2px}\n" as *u8) 103 w(1, ".herotxt{flex:1;min-width:240px}.herotxt b{font-size:1.05rem}.bar{height:9px;border-radius:6px;background:var(--nx-ns);overflow:hidden;margin:9px 0 6px}.bar i{display:block;height:100%;background:linear-gradient(90deg,var(--nx-g),rgb(86,196,120))}\n" as *u8) 104 w(1, ".pills{display:flex;gap:8px;flex-wrap:wrap;font-size:.78rem}.pill{padding:3px 9px;border-radius:20px;font-weight:600}.pill.m{background:var(--nx-gs);color:var(--nx-g)}.pill.d{background:var(--nx-gs);color:var(--nx-g)}.pill.o{background:var(--nx-as);color:var(--nx-a)}.pill.c{background:var(--nx-ns);color:var(--nx-n)}\n" as *u8) 105 w(1, ".meth{background:var(--nx-soft);border:1px solid var(--nx-line);border-radius:12px;padding:12px 16px;margin:16px 0;font-size:.86rem;color:var(--nx-mut)}\n" as *u8) 106 w(1, ".grp{margin:26px 0 0}.grp h2{font-size:1.15rem;margin:0 0 3px;display:flex;align-items:center;gap:9px}.grp .cnt{font-size:.8rem;font-weight:700;padding:1px 9px;border-radius:20px;background:var(--nx-ns);color:var(--nx-mut)}\n" as *u8) 107 w(1, ".grp.mcp h2,.grp.dispatch h2{color:var(--nx-g)}.grp.organ h2{color:var(--nx-a)}.grp.concept h2{color:var(--nx-n)}.gd{color:var(--nx-mut);font-size:.88rem;margin:0 0 10px}\n" as *u8) 108 w(1, ".row{display:flex;align-items:center;gap:10px;flex-wrap:wrap;padding:9px 12px;border-top:1px solid var(--nx-line);border-radius:8px}.row:nth-child(even){background:var(--nx-soft)}.rn{font-weight:700;min-width:118px}.act{color:var(--nx-mut);font-size:.85rem;flex:1;min-width:90px}\n" as *u8) 109 w(1, ".via{font-size:.8rem;padding:3px 10px;border-radius:8px;font-family:ui-monospace,Menlo,Consolas,monospace}.via.tool{background:var(--nx-gs);color:var(--nx-g);font-weight:600}.via.inv{background:var(--nx-code)}.via.org{background:var(--nx-as);color:var(--nx-a)}.grp.concept .via.org{background:var(--nx-ns);color:var(--nx-n)}\n" as *u8) 110 w(1, ".foot{margin-top:34px;color:var(--nx-mut);font-size:.78rem;border-top:1px solid var(--nx-line);padding-top:14px}\n" as *u8) 111 w(1, "@media(max-width:560px){body{padding:3vh 14px 6vh}.hero{padding:16px}.rn{min-width:100%}}\n" as *u8) 112 w(1, "@media(prefers-reduced-motion:reduce){*{transition:none;animation:none}}\n" as *u8) 113 w(1, "@media(prefers-color-scheme:dark){:root{--nx-bg:rgb(15,15,20);--nx-fg:rgb(232,232,240);--nx-mut:rgb(152,152,166);--nx-line:rgb(38,38,48);--nx-soft:rgb(23,23,31);--nx-g:rgb(96,206,130);--nx-gs:rgb(22,42,30);--nx-a:rgb(216,160,78);--nx-as:rgb(44,36,20);--nx-n:rgb(152,152,166);--nx-ns:rgb(34,34,44);--nx-code:rgb(32,32,42);--nx-shadow:0 1px 2px rgba(0,0,0,.4),0 6px 20px rgba(0,0,0,.3)}}\n" as *u8) 114 w(1, "</style></head><body>\n" as *u8) 115 w(1, "<a class='skip-link' href='" as *u8); wc(1, 35); w(1, "main'>Skip to content</a>\n" as *u8) 116 w(1, "<nav class='crumb' aria-label='Breadcrumb'><a href='/'>Nishi Family</a> &rsaquo; <a href='/compare'>Compare</a> &rsaquo; Crew</nav>\n" as *u8) 117 w(1, "<main id='main'>\n" as *u8) 118 w(1, "<h1>Nishi Crew &mdash; Capability Directory</h1>\n" as *u8) 119 w(1, "<p class='sub'>Every crew role owns exactly one accountable RACI activity. This is which of those capabilities are callable RIGHT NOW over the sovereign MCP plane &mdash; and the exact call for each.</p>\n" as *u8) 120 121 // hero: coverage 122 w(1, "<div class='hero'><div class='big'>" as *u8); wn(1, permil); w(1, "<small>&permil;</small></div>\n" as *u8) 123 w(1, "<div class='herotxt'><b>" as *u8); wn(1, served); w(1, " of " as *u8); wn(1, denom); w(1, " non-human roles are callable over MCP.</b>\n" as *u8) 124 w(1, "<div class='bar'><i style='width:" as *u8); wn(1, permil/10); w(1, "%'></i></div>\n" as *u8) 125 w(1, "<div class='pills'><span class='pill m'>" as *u8); wn(1, mcp); w(1, " own tool</span><span class='pill d'>" as *u8); wn(1, disp); w(1, " nishi_crew dispatch</span><span class='pill o'>" as *u8); wn(1, org); w(1, " organ, not yet MCP</span><span class='pill c'>" as *u8); wn(1, con); w(1, " concept</span></div>\n" as *u8) 126 w(1, "</div></div>\n" as *u8) 127 w(1, "<div class='meth'>Every claim here is <b>liar-killed</b>: <code>nx_crew_capability_gate</code> re-executes each dispatch row and refuses to count any that does not return a clean result. The whole plane is verified bits-up over the public edge (our TLS, our parser &mdash; no WebFetch, no curl) by <code>nx_crew_live_verify</code> (GREEN 4/4). Generated by <code>nx_crew_page</code> from knowledge/registry/crew_capabilities.data.</div>\n" as *u8) 128 129 section(rp,ap,op,tp,sp,nr, "mcp" as *u8, "mcp" as *u8, 0, "Own MCP tool" as *u8, "Registered directly in /api/tools &mdash; call the named tool over /mcp." as *u8, mcp) 130 section(rp,ap,op,tp,sp,nr, "dispatch" as *u8, "dispatch" as *u8, 1, "Callable via nishi_crew dispatch" as *u8, "One consolidated tool routes to the role's organ after a RACI-accountability check. Copy the call:" as *u8, disp) 131 section(rp,ap,op,tp,sp,nr, "organ" as *u8, "organ" as *u8, 2, "Organ built &mdash; not yet on MCP" as *u8, "A real organ exists; it needs a serve-wrapper or deps to become dispatchable. The drive-to-1000 queue." as *u8, org) 132 section(rp,ap,op,tp,sp,nr, "concept" as *u8, "concept" as *u8, 2, "Concept &mdash; no organ yet" as *u8, "Accountable in the RACI, but no organ built. Earliest-stage roles." as *u8, con) 133 134 w(1, "<p class='foot'>Generated by nx_crew_page (sovereign NishiLang organ) from knowledge/registry/crew_capabilities.data &mdash; " as *u8); wn(1, nr); w(1, " crew roles. Coverage rises only when a capability is proven live. Zero JS, zero trackers.</p>\n" as *u8) 135 w(1, "</main>\n</body></html>\n" as *u8) 136 sys_exit(0); return 0 137}