code wiki / _hdl_build / nx_accesswall_research.nx
nx_accesswall_research.nx source
↩ module page · 142 lines · 6663 B
1// nx_accesswall_research.nx -- drive the SOVEREIGN NISHI RESEARCHER over the access-provisioning-wall gap
2// research (identity + network-context + device/IP provisioning + DDoS/abuse resistance) vs best-in-class
3// (zero-trust/BeyondCorp, Cloudflare Access, Tailscale/WireGuard, AWS WAF+Shield).
4//
5// module: nishi-core.research.accesswall
6// capability: CORE_COMPUTE (turn delegated access-control research into a verified reproducible gap-task backlog)
7//
8// Reads knowledge/registry/accesswall_research.tsv (the delegated fetch+extract: claims + 3 adversarial votes
9// each, grounded in real authoritative sources) and runs nx_researcher's DETERMINISTIC verify (>=2 confirm =>
10// CONFIRMED) + synthesize (CONFIRMED+actionable => gap-task). Prints the verdict census + the ranked gap-task
11// backlog + the REPRODUCIBILITY proof (same evidence -> same tasks). Refuted/contested => ZERO tasks (the
12// no-wasted-work exceed over a one-shot LLM report). Sovereign: nx_syscalls + nx_researcher. license_tier: ORIGINAL
13import "nx_sovjson_lib.nx"
14import "nx_itoa_lib.nx" // shared MSB-first emitter (zero-alloc)
15import "nx_syscalls.nx"
16import "nx_researcher.nx"
17
18const AW_FILE: *u8 = "knowledge/registry/accesswall_research.tsv"
19
20static AW_N: i64
21static AW_FID: i64
22static AW_CLAIM: i64
23static AW_CV: i64
24static AW_RV: i64
25static AW_ACT: i64
26static AW_ORGAN: i64
27static AW_NOTE: i64
28
29func aw_puts(s: *u8) -> i64 { return sj_puts(s) }
30// MIGRATED to the shared emitter (debt 1785563586). The old body mmapped a scratch buffer
31// per call and never freed it. At PAGE granularity that is 4096B leaked PER CALL -- the
32// defect that took 28.5GB of a 36GB host in nx_ts_lumadiff (2MB input, ~3.66M calls).
33// nxi_* is MSB-first, allocates NOTHING, and emits identical bytes including the sign.
34func aw_putn(v: i64) -> i64 { nxi_out(v); return 0 }
35func aw_field(b: *u8, ls: i64, le: i64, f: i64) -> *u8 {
36 var cur: i64 = 0; var i: i64 = ls
37 while cur < f { if i >= le { let e: *u8 = sys_mmap(2); e[0] = 0 as u8; return e } if b[i] == 9 as u8 { cur = cur + 1 } i = i + 1 }
38 let out: *u8 = sys_mmap(512); var o: i64 = 0
39 while i < le { if b[i] == 9 as u8 { i = le } else { if o < 511 { out[o] = b[i]; o = o + 1 } i = i + 1 } }
40 out[o] = 0 as u8
41 return out
42}
43func aw_atoi(s: *u8) -> i64 { if s[0] >= 48 as u8 { if s[0] <= 57 as u8 { return (s[0] - 48 as u8) as i64 } } return 0 }
44
45func aw_parse() -> i64 {
46 let lenbox: *i64 = sys_mmap(16) as *i64; lenbox[0] = 0
47 let data: *u8 = sys_read_file(AW_FILE, lenbox)
48 if (data as i64) == 0 { return 0 - 1 }
49 let n: i64 = lenbox[0]
50 var rows: i64 = 0; var ls: i64 = 0; var i: i64 = 0
51 while i <= n {
52 var atend: i64 = 0
53 if i == n { atend = 1 }
54 if i < n { if data[i] == 10 as u8 { atend = 1 } }
55 if atend == 1 { if i > ls { if data[ls] != 35 as u8 { rows = rows + 1 } } ls = i + 1 }
56 i = i + 1
57 }
58 let fid: *i64 = sys_mmap(8 * (rows + 1)) as *i64
59 let claim: *i64 = sys_mmap(8 * (rows + 1)) as *i64
60 let cv: *i64 = sys_mmap(8 * (rows + 1)) as *i64
61 let rv: *i64 = sys_mmap(8 * (rows + 1)) as *i64
62 let act: *i64 = sys_mmap(8 * (rows + 1)) as *i64
63 let organ: *i64 = sys_mmap(8 * (rows + 1)) as *i64
64 let note: *i64 = sys_mmap(8 * (rows + 1)) as *i64
65 var r: i64 = 0; ls = 0; i = 0
66 while i <= n {
67 var atend: i64 = 0
68 if i == n { atend = 1 }
69 if i < n { if data[i] == 10 as u8 { atend = 1 } }
70 if atend == 1 {
71 if i > ls { if data[ls] != 35 as u8 {
72 fid[r] = aw_field(data, ls, i, 0) as i64
73 claim[r] = aw_field(data, ls, i, 1) as i64
74 cv[r] = aw_atoi(aw_field(data, ls, i, 2))
75 rv[r] = aw_atoi(aw_field(data, ls, i, 3))
76 act[r] = aw_atoi(aw_field(data, ls, i, 4))
77 organ[r] = aw_field(data, ls, i, 5) as i64
78 note[r] = aw_field(data, ls, i, 6) as i64
79 r = r + 1
80 } }
81 ls = i + 1
82 }
83 i = i + 1
84 }
85 AW_N = r
86 AW_FID = fid as i64; AW_CLAIM = claim as i64; AW_CV = cv as i64; AW_RV = rv as i64
87 AW_ACT = act as i64; AW_ORGAN = organ as i64; AW_NOTE = note as i64
88 return 0
89}
90
91func main() -> i64 {
92 aw_puts("=== NISHI RESEARCHER: access-provisioning wall vs best-in-class -- verified gap-task backlog ===\n")
93 if aw_parse() != 0 { aw_puts("FATAL: accesswall_research.tsv unreadable\n"); sys_exit(1); return 1 }
94 let cv: *i64 = AW_CV as *i64
95 let rv: *i64 = AW_RV as *i64
96 let act: *i64 = AW_ACT as *i64
97 let fid: *i64 = AW_FID as *i64
98 let claim: *i64 = AW_CLAIM as *i64
99 let organ: *i64 = AW_ORGAN as *i64
100 let note: *i64 = AW_NOTE as *i64
101
102 let oid: *i64 = sys_mmap(8 * (AW_N + 4)) as *i64
103 var z: i64 = 0; while z < AW_N { oid[z] = z; z = z + 1 }
104
105 let confirmed: i64 = res_count_verdict(AW_N, cv, rv, RES_CONFIRMED)
106 let refuted: i64 = res_count_verdict(AW_N, cv, rv, RES_REFUTED)
107 let contested: i64 = res_count_verdict(AW_N, cv, rv, RES_CONTESTED)
108 let repro: i64 = res_is_reproducible(AW_N, cv, rv, act, oid)
109
110 let out_idx: *i64 = sys_mmap(8 * (AW_N + 4)) as *i64
111 let out_org: *i64 = sys_mmap(8 * (AW_N + 4)) as *i64
112 let tasks: i64 = res_synthesize(AW_N, cv, rv, act, oid, out_idx, out_org)
113
114 aw_puts(" findings="); aw_putn(AW_N)
115 aw_puts(" CONFIRMED="); aw_putn(confirmed)
116 aw_puts(" REFUTED="); aw_putn(refuted)
117 aw_puts(" CONTESTED="); aw_putn(contested)
118 aw_puts(" -> gap-tasks="); aw_putn(tasks)
119 aw_puts(" (refuted/contested -> 0 tasks, the no-wasted-work exceed)\n")
120 aw_puts(" reproducible(same evidence -> same tasks)="); aw_putn(repro); aw_puts(" (an LLM one-shot cannot guarantee this)\n\n")
121
122 aw_puts(" GAP-TASK BACKLOG (CONFIRMED + actionable, ranked source order):\n")
123 var t: i64 = 0
124 while t < tasks {
125 let i: i64 = out_idx[t]
126 aw_puts(" ["); aw_putn(res_confidence_permil(cv[i])); aw_puts("permil] ")
127 aw_puts(fid[i] as *u8); aw_puts(" -> "); aw_puts(organ[i] as *u8); aw_puts("\n")
128 aw_puts(" "); aw_puts(claim[i] as *u8); aw_puts("\n")
129 t = t + 1
130 }
131 aw_puts("\n KILLED (not built -- the researcher refused them, incl. the honest sovereign limit):\n")
132 var j: i64 = 0
133 while j < AW_N {
134 let v: i64 = res_verify(cv[j], rv[j])
135 if v != RES_CONFIRMED {
136 aw_puts(" ["); if v == RES_REFUTED { aw_puts("REFUTED ") } else { aw_puts("CONTESTED") }
137 aw_puts("] "); aw_puts(fid[j] as *u8); aw_puts(" -- "); aw_puts(note[j] as *u8); aw_puts("\n")
138 }
139 j = j + 1
140 }
141 sys_exit(0); return 0
142}