code wiki / _hdl_build / nx_atlas_discover.nx

nx_atlas_discover.nx source

↩ module page · 436 lines · 20858 B

1// nx_atlas_discover.nx -- ATLAS RECOMBINATION DISCOVERY (operator 2026-07-18: "novel design via 2// recombinations of the atlas especially as we do discovery work to find new unproven opportunities"). 3// The eco graph sees STATIC import edges; plans compose tools at RUNTIME -- edges the graph cannot 4// see. This organ GENERATES candidate composition edges: it scans the commontask catalog for 5// MCP-live capabilities, EXCLUDES pairs already proven together in a plan plane, scores the novel 6// pairs (data-adjacency: both notes mention plane/store; cross-lane: different owners), and emits 7// the top proposals to the discovery- plane as rows a human or nx_plan_run can pick up and TRY. 8// nx_atlas_discover [catalog-prefix] [exclusion-plan-prefix] [out-prefix] [minscore] 9// defaults: knowledge/store/commontask- knowledge/store/plan-loopcheck- knowledge/store/discovery- 2 10// out row: DSC<n> <organA>-><organB> <score> proposed atlas <verbA>+<verbB> try: plan 10 <A> / 20 <B> 11// Fail-closed on unseeded catalog. Proposals are HYPOTHESES (status=proposed) -- promotion to the 12// catalog happens only after a plan run PROVES the combo (the honest exceed discipline). 13// license_tier: ORIGINAL No hw writes (Rule 26). expect_exit: 0 14import "nx_store_seed_lib.nx" 15import "nx_seg_store.nx" 16import "nx_syscalls.nx" 17 18const AD_CAP: i64 = 1048576 19const AD_NL: i64 = 10 20const AD_TAB: i64 = 9 21const AD_MAXCOL: i64 = 16 22const AD_PAIR: i64 = 2 23const AD_SPB: i64 = 256 24const AD_MAXORG: i64 = 48 25const AD_MAXOUT: i64 = 40 26const AD_MINSCORE_DEF: i64 = 2 27// Capability KIND. The atlas scored only DATA adjacency and OWNER difference, so it was blind to the 28// single most valuable recombination this program has: a MAKER that no RULER measures. Unmeasured is 29// unproven, so that pair is worth more than either existing axis and is weighted accordingly. 30const AD_KIND_UNKNOWN: i64 = 0 31const AD_KIND_MAKER: i64 = 1 32const AD_KIND_RULER: i64 = 2 33const AD_W_DATA_ADJACENCY: i64 = 2 34const AD_W_CROSS_LANE: i64 = 1 35const AD_W_MEASURE_GAP: i64 = 3 36const AD_SRC_NONE: i64 = 0 37const AD_SRC_NAME: i64 = 1 38const AD_SRC_TASK: i64 = 2 39const AD_SRC_NOTE: i64 = 3 40const AD_SRC_DECLARED: i64 = 4 41// Column 7, additive: existing readers index 0..6 and are unaffected (Rule 19). Absent on every row 42// today -- see the measured finding below for why that matters more than the heuristic. 43const CT_KIND: i64 = 7 44const AD_STDERR: i64 = 2 45const AD_EXIT_IO: i64 = 1 46const AD_ZERO: i64 = 48 47const AD_NINE: i64 = 57 48const AD_B10: i64 = 10 49// catalog cols: task organ owner exposure state dups note 50const CT_TASK: i64 = 0 51const CT_ORGAN: i64 = 1 52const CT_OWNER: i64 = 2 53const CT_EXPO: i64 = 3 54const CT_STATE: i64 = 4 55const CT_NOTE: i64 = 6 56 57func ad_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } 58func ad_werr(s: *u8) -> i64 { sys_write(AD_STDERR, s, ad_slen(s)); return 0 } 59func ad_cols(q: *u8, ls: i64, le: i64, sp: *i64) -> i64 { 60 var c: i64 = 0 61 var p: i64 = ls 62 while c < AD_MAXCOL { 63 var e: i64 = p 64 var s: i64 = 1 65 while s == 1 { if e >= le { s = 0 } else { if q[e] == (AD_TAB as u8) { s = 0 } else { e = e + 1 } } } 66 sp[c*AD_PAIR] = p 67 sp[c*AD_PAIR+1] = e 68 c = c + 1 69 if e >= le { return c } 70 p = e + 1 71 } 72 return c 73} 74// slice contains C-string? 75func ad_has(q: *u8, a: i64, b: i64, s: *u8) -> i64 { 76 let sn: i64 = ad_slen(s) 77 if sn == 0 { return 1 } 78 var i: i64 = a 79 while i + sn <= b { 80 var hit: i64 = 1 81 var j: i64 = 0 82 while j < sn { if q[i+j] != s[j] { hit = 0; j = sn } else { j = j + 1 } } 83 if hit == 1 { return 1 } 84 i = i + 1 85 } 86 return 0 87} 88func ad_slice_eq2(q: *u8, a: i64, b: i64, r: *u8, c: i64, d: i64) -> i64 { 89 if b - a != d - c { return 0 } 90 var i: i64 = 0 91 while a + i < b { if q[a+i] != r[c+i] { return 0 } i = i + 1 } 92 return 1 93} 94func ad_atoi(s: *u8) -> i64 { 95 var v: i64 = 0 96 var i: i64 = 0 97 while s[i] != (0 as u8) { let c: i64 = s[i]; if c >= AD_ZERO { if c <= AD_NINE { v = v * AD_B10 + (c - AD_ZERO) } } i = i + 1 } 98 return v 99} 100func ad_cat_slice(d: *u8, o: i64, q: *u8, a: i64, b: i64) -> i64 { 101 var oo: i64 = o 102 var i: i64 = a 103 while i < b { d[oo] = q[i]; oo = oo + 1; i = i + 1 } 104 return oo 105} 106 107// Classify a catalog text slice as maker / ruler / unknown. RULER is tested FIRST: an organ that both 108// generates and measures (nx_gamebench emits fixtures) is a ruler for recombination purposes, because 109// what makes it valuable to pair is that it can GRADE the other side. 110func ad_kind_of(cat: *u8, s0: i64, s1: i64) -> i64 { 111 if ad_has(cat, s0, s1, "bench" as *u8) == 1 { return AD_KIND_RULER } 112 if ad_has(cat, s0, s1, "judge" as *u8) == 1 { return AD_KIND_RULER } 113 if ad_has(cat, s0, s1, "grade" as *u8) == 1 { return AD_KIND_RULER } 114 if ad_has(cat, s0, s1, "verify" as *u8) == 1 { return AD_KIND_RULER } 115 if ad_has(cat, s0, s1, "check" as *u8) == 1 { return AD_KIND_RULER } 116 if ad_has(cat, s0, s1, "gate" as *u8) == 1 { return AD_KIND_RULER } 117 if ad_has(cat, s0, s1, "score" as *u8) == 1 { return AD_KIND_RULER } 118 if ad_has(cat, s0, s1, "measure" as *u8) == 1 { return AD_KIND_RULER } 119 if ad_has(cat, s0, s1, "audit" as *u8) == 1 { return AD_KIND_RULER } 120 if ad_has(cat, s0, s1, "emit" as *u8) == 1 { return AD_KIND_MAKER } 121 if ad_has(cat, s0, s1, "render" as *u8) == 1 { return AD_KIND_MAKER } 122 if ad_has(cat, s0, s1, "gen" as *u8) == 1 { return AD_KIND_MAKER } 123 if ad_has(cat, s0, s1, "build" as *u8) == 1 { return AD_KIND_MAKER } 124 if ad_has(cat, s0, s1, "make" as *u8) == 1 { return AD_KIND_MAKER } 125 if ad_has(cat, s0, s1, "compose" as *u8) == 1 { return AD_KIND_MAKER } 126 if ad_has(cat, s0, s1, "synth" as *u8) == 1 { return AD_KIND_MAKER } 127 if ad_has(cat, s0, s1, "forge" as *u8) == 1 { return AD_KIND_MAKER } 128 if ad_has(cat, s0, s1, "engine" as *u8) == 1 { return AD_KIND_MAKER } 129 return AD_KIND_UNKNOWN 130} 131 132func ad_streq(a: *u8, b: *u8) -> i64 { 133 var i: i64 = 0 134 while a[i] != (0 as u8) { if a[i] != b[i] { return 0 } i = i + 1 } 135 if b[i] != (0 as u8) { return 0 } 136 return 1 137} 138 139// Classify a NUL-terminated literal (selftest path only; the live path classifies catalog slices). 140func ad_trusted(src: i64) -> i64 { 141 if src == AD_SRC_DECLARED { return 1 } 142 if src == AD_SRC_NAME { return 1 } 143 if src == AD_SRC_TASK { return 1 } 144 return 0 145} 146 147func ad_kind_lit(s: *u8) -> i64 { 148 var n: i64 = 0 149 while s[n] != (0 as u8) { n = n + 1 } 150 return ad_kind_of(s, 0, n) 151} 152 153func ad_kexp(s: *u8, want: i64, label: *u8) -> i64 { 154 let got: i64 = ad_kind_lit(s) 155 if got == want { ad_werr(" [PASS] " as *u8) } else { ad_werr(" [FAIL] " as *u8) } 156 ad_werr(label) 157 ad_werr("\n" as *u8) 158 if got == want { return 1 } 159 return 0 160} 161 162func ad_selftest() -> i64 { 163 var p: i64 = 0 164 var n: i64 = 0 165 n=n+1; p=p+ad_kexp("nx_refbench" as *u8, AD_KIND_RULER, "nx_refbench -> RULER (bench)" as *u8) 166 n=n+1; p=p+ad_kexp("nx_editjudge" as *u8, AD_KIND_RULER, "nx_editjudge -> RULER (judge)" as *u8) 167 n=n+1; p=p+ad_kexp("nx_sweepcheck" as *u8, AD_KIND_RULER, "nx_sweepcheck -> RULER (check)" as *u8) 168 n=n+1; p=p+ad_kexp("nx_coc_engine" as *u8, AD_KIND_MAKER, "nx_coc_engine -> MAKER (engine)" as *u8) 169 n=n+1; p=p+ad_kexp("nx_uigen" as *u8, AD_KIND_MAKER, "nx_uigen -> MAKER (gen)" as *u8) 170 // PRECEDENCE, pinned: something that both generates AND measures is a RULER for recombination, 171 // because what makes it worth pairing is that it can GRADE the other side. Order-dependent. 172 n=n+1; p=p+ad_kexp("nx_gen_bench" as *u8, AD_KIND_RULER, "gen+bench -> RULER wins precedence" as *u8) 173 // SCOPE HONESTY: name-level classification is deliberately conservative. nx_recolor IS a maker but 174 // says so nowhere in its name, so by NAME it is UNKNOWN and only the task/note fallback can catch 175 // it. Pinning UNKNOWN stops a keyword being bolted on later without someone reading this note. 176 n=n+1; p=p+ad_kexp("nx_recolor" as *u8, AD_KIND_UNKNOWN, "nx_recolor -> UNKNOWN by name (a maker that is not named like one)" as *u8) 177 n=n+1; p=p+ad_kexp("nx_qqq" as *u8, AD_KIND_UNKNOWN, "nx_qqq -> UNKNOWN, no false positive on a nonsense name" as *u8) 178 n=n+1 179 if ad_trusted(AD_SRC_NOTE) == 0 { p=p+1; ad_werr(" [PASS] " as *u8) } else { ad_werr(" [FAIL] " as *u8) } 180 ad_werr("a NOTE-derived kind is a GUESS and must never earn the measure-gap bonus\n" as *u8) 181 n=n+1 182 if ad_trusted(AD_SRC_DECLARED) == 1 { p=p+1; ad_werr(" [PASS] " as *u8) } else { ad_werr(" [FAIL] " as *u8) } 183 ad_werr("a DECLARED kind is trusted\n" as *u8) 184 n=n+1 185 if ad_trusted(AD_SRC_NONE) == 0 { p=p+1; ad_werr(" [PASS] " as *u8) } else { ad_werr(" [FAIL] " as *u8) } 186 ad_werr("an UNCLASSIFIED organ is never trusted\n" as *u8) 187 ad_werr("\n=== nx_atlas_discover kind-classifier " as *u8) 188 let b: *u8 = sys_mmap(64) 189 var o: i64 = ss_catn(b, 0, p) 190 o = ss_cat(b, o, "/" as *u8) 191 o = ss_catn(b, o, n) 192 b[o] = (0 as u8) 193 ad_werr(b) 194 if p == n { ad_werr(" verdict=GREEN\n" as *u8); return 0 } 195 ad_werr(" verdict=RED\n" as *u8) 196 return 1 197} 198 199func main(argc: i64, argv: *i64) -> i64 { 200 var dumpk: i64 = 0 201 if argc > 2 { if ad_streq(argv[1] as *u8, "seedkinds" as *u8) == 1 { 202 let sb: *u8 = sys_mmap(AD_SPB*4) 203 var so: i64 = 0 204 so = ss_cat(sb, so, "render\x09nx_alpha_bench\x09laneA\x09mcp-live\x09LIVE\x090\x09emits frames onto a plane store\x09MAKER\n" as *u8) 205 so = ss_cat(sb, so, "grade\x09nx_beta_gen\x09laneB\x09mcp-live\x09LIVE\x090\x09grades frames from a plane store\x09RULER\n" as *u8) 206 if sts_seed(argv[2] as *u8, sb, so) < 0 { 207 ad_werr("seedkinds: commit error\n" as *u8) 208 sys_exit(AD_EXIT_IO) 209 return AD_EXIT_IO 210 } 211 ad_werr("SEEDED 2 rows WITH declared kinds (alpha_bench=MAKER, beta_gen=RULER -- both named the opposite on purpose)\n" as *u8) 212 sys_exit(0) 213 return 0 214 } } 215 if argc > 1 { if ad_streq(argv[1] as *u8, "kinds" as *u8) == 1 { dumpk = 1 } } 216 if argc > 1 { if ad_streq(argv[1] as *u8, "selftest" as *u8) == 1 { 217 let sf: i64 = ad_selftest() 218 sys_exit(sf) 219 return sf 220 } } 221 var catp: *u8 = "knowledge/store/commontask-" as *u8 222 var excp: *u8 = "knowledge/store/plan-loopcheck-" as *u8 223 var outp: *u8 = "knowledge/store/discovery-" as *u8 224 var minsc: i64 = AD_MINSCORE_DEF 225 var ab: i64 = 0 226 if dumpk == 1 { ab = 1 } 227 if argc > 1+ab { catp = argv[1+ab] as *u8 } 228 if argc > 2+ab { excp = argv[2+ab] as *u8 } 229 if argc > 3+ab { outp = argv[3+ab] as *u8 } 230 if argc > 4+ab { minsc = ad_atoi(argv[4+ab] as *u8) } 231 232 let cat: *u8 = sys_mmap(AD_CAP) 233 let cn: i64 = sts_load(catp, cat, AD_CAP) 234 if cn <= 0 { ad_werr("catalog plane EMPTY / unseeded (fail-closed)\ 235" as *u8); sys_exit(AD_EXIT_IO); return AD_EXIT_IO } 236 let exc: *u8 = sys_mmap(AD_CAP) 237 var en: i64 = sts_load(excp, exc, AD_CAP) 238 if en < 0 { en = 0 } 239 240 // collect MCP-live organs: organ slice + verb slice + owner slice + data-adjacency flag 241 let oa: *i64 = sys_mmap(AD_MAXORG*8) as *i64 242 let ob: *i64 = sys_mmap(AD_MAXORG*8) as *i64 243 let va: *i64 = sys_mmap(AD_MAXORG*8) as *i64 244 let vb: *i64 = sys_mmap(AD_MAXORG*8) as *i64 245 let wa: *i64 = sys_mmap(AD_MAXORG*8) as *i64 246 let wb: *i64 = sys_mmap(AD_MAXORG*8) as *i64 247 let dj: *i64 = sys_mmap(AD_MAXORG*8) as *i64 248 let kd: *i64 = sys_mmap(AD_MAXORG*8) as *i64 249 let ks: *i64 = sys_mmap(AD_MAXORG*8) as *i64 250 let sp: *i64 = sys_mmap(AD_SPB) as *i64 251 var norg: i64 = 0 252 var i: i64 = 0 253 while i < cn { 254 var le: i64 = i 255 var s: i64 = 1 256 while s == 1 { if le >= cn { s = 0 } else { if cat[le] == (AD_NL as u8) { s = 0 } else { le = le + 1 } } } 257 if le > i { if norg < AD_MAXORG { 258 let nc: i64 = ad_cols(cat, i, le, sp) 259 if nc >= 7 { 260 if ad_has(cat, sp[CT_EXPO*AD_PAIR], sp[CT_EXPO*AD_PAIR+1], "mcp" as *u8) == 1 { 261 if ad_has(cat, sp[CT_STATE*AD_PAIR], sp[CT_STATE*AD_PAIR+1], "LIVE" as *u8) == 1 { 262 oa[norg] = sp[CT_ORGAN*AD_PAIR] 263 ob[norg] = sp[CT_ORGAN*AD_PAIR+1] 264 va[norg] = sp[CT_TASK*AD_PAIR] 265 vb[norg] = sp[CT_TASK*AD_PAIR+1] 266 wa[norg] = sp[CT_OWNER*AD_PAIR] 267 wb[norg] = sp[CT_OWNER*AD_PAIR+1] 268 dj[norg] = 0 269 if ad_has(cat, sp[CT_NOTE*AD_PAIR], sp[CT_NOTE*AD_PAIR+1], "plane" as *u8) == 1 { dj[norg] = 1 } 270 if ad_has(cat, sp[CT_NOTE*AD_PAIR], sp[CT_NOTE*AD_PAIR+1], "store" as *u8) == 1 { dj[norg] = 1 } 271 var kk: i64 = AD_KIND_UNKNOWN 272 var kk_src: i64 = AD_SRC_DECLARED 273 if nc > CT_KIND { 274 if ad_has(cat, sp[CT_KIND*AD_PAIR], sp[CT_KIND*AD_PAIR+1], "MAKER" as *u8) == 1 { kk = AD_KIND_MAKER } 275 if ad_has(cat, sp[CT_KIND*AD_PAIR], sp[CT_KIND*AD_PAIR+1], "RULER" as *u8) == 1 { kk = AD_KIND_RULER } 276 } 277 if kk == AD_KIND_UNKNOWN { 278 kk = ad_kind_of(cat, sp[CT_ORGAN*AD_PAIR], sp[CT_ORGAN*AD_PAIR+1]) 279 kk_src = AD_SRC_NAME 280 } 281 if kk == AD_KIND_UNKNOWN { 282 kk = ad_kind_of(cat, sp[CT_TASK*AD_PAIR], sp[CT_TASK*AD_PAIR+1]) 283 kk_src = AD_SRC_TASK 284 } 285 if kk == AD_KIND_UNKNOWN { 286 kk = ad_kind_of(cat, sp[CT_NOTE*AD_PAIR], sp[CT_NOTE*AD_PAIR+1]) 287 kk_src = AD_SRC_NOTE 288 } 289 if kk == AD_KIND_UNKNOWN { kk_src = AD_SRC_NONE } 290 kd[norg] = kk 291 ks[norg] = kk_src 292 norg = norg + 1 293 } 294 } 295 } 296 } } 297 i = le + 1 298 } 299 300 // propose novel ordered pairs 301 let out: *u8 = sys_mmap(AD_CAP) 302 var oo: i64 = 0 303 var nout: i64 = 0 304 var ai: i64 = 0 305 while ai < norg { 306 var bi: i64 = 0 307 while bi < norg { 308 if ai != bi { if nout < AD_MAXOUT { 309 if ad_slice_eq2(cat, oa[ai], ob[ai], cat, oa[bi], ob[bi]) == 0 { 310 // exclusion: both organ names present in the exclusion plan -> already composed 311 var known: i64 = 0 312 if en > 0 { 313 var ha: i64 = 0 314 var hb: i64 = 0 315 var t0: i64 = oa[ai] 316 // copy A organ into a small buf for ad_has (needs C-string) -- use direct window scan instead 317 // scan exc for slice A and slice B 318 var x: i64 = 0 319 let alen: i64 = ob[ai] - oa[ai] 320 while x + alen <= en { if ad_slice_eq2(exc, x, x+alen, cat, oa[ai], ob[ai]) == 1 { ha = 1; x = en } else { x = x + 1 } } 321 x = 0 322 let blen: i64 = ob[bi] - oa[bi] 323 while x + blen <= en { if ad_slice_eq2(exc, x, x+blen, cat, oa[bi], ob[bi]) == 1 { hb = 1; x = en } else { x = x + 1 } } 324 if ha == 1 { if hb == 1 { known = 1 } } 325 if t0 == 0 { known = known } 326 } 327 if known == 0 { 328 var score: i64 = 0 329 if dj[ai] == 1 { if dj[bi] == 1 { score = score + AD_W_DATA_ADJACENCY } } 330 if ad_slice_eq2(cat, wa[ai], wb[ai], cat, wa[bi], wb[bi]) == 0 { score = score + AD_W_CROSS_LANE } 331 var mg: i64 = 0 332 if kd[ai] == AD_KIND_MAKER { if kd[bi] == AD_KIND_RULER { 333 if ad_trusted(ks[ai]) == 1 { if ad_trusted(ks[bi]) == 1 { mg = 1 } } 334 } } 335 if mg == 1 { score = score + AD_W_MEASURE_GAP } 336 if score >= minsc { 337 oo = ss_cat(out, oo, "DSC" as *u8) 338 oo = ss_catn(out, oo, nout) 339 out[oo] = AD_TAB as u8 340 oo = oo + 1 341 oo = ad_cat_slice(out, oo, cat, oa[ai], ob[ai]) 342 oo = ss_cat(out, oo, "->" as *u8) 343 oo = ad_cat_slice(out, oo, cat, oa[bi], ob[bi]) 344 out[oo] = AD_TAB as u8 345 oo = oo + 1 346 oo = ss_catn(out, oo, score) 347 oo = ss_cat(out, oo, "\x09proposed\x09atlas\x09" as *u8) 348 oo = ad_cat_slice(out, oo, cat, va[ai], vb[ai]) 349 oo = ss_cat(out, oo, "+" as *u8) 350 oo = ad_cat_slice(out, oo, cat, va[bi], vb[bi]) 351 oo = ss_cat(out, oo, "\x09try: plan 10 " as *u8) 352 oo = ad_cat_slice(out, oo, cat, oa[ai], ob[ai]) 353 oo = ss_cat(out, oo, " then 20 " as *u8) 354 oo = ad_cat_slice(out, oo, cat, oa[bi], ob[bi]) 355 out[oo] = AD_TAB as u8 356 oo = oo + 1 357 if mg == 1 { oo = ss_cat(out, oo, "axis=measure-gap MAKER->RULER: this maker has no proven ruler, so its results are unproven by construction" as *u8) } else { oo = ss_cat(out, oo, "axis=data+lane" as *u8) } 358 out[oo] = AD_NL as u8 359 oo = oo + 1 360 nout = nout + 1 361 } 362 } 363 } 364 } } 365 bi = bi + 1 366 } 367 ai = ai + 1 368 } 369 if dumpk == 1 { 370 let db: *u8 = sys_mmap(AD_SPB*4) 371 var di: i64 = 0 372 while di < norg { 373 var d: i64 = 0 374 d = ad_cat_slice(db, d, cat, oa[di], ob[di]) 375 d = ss_cat(db, d, "\x09" as *u8) 376 if kd[di] == AD_KIND_MAKER { d = ss_cat(db, d, "MAKER" as *u8) } 377 if kd[di] == AD_KIND_RULER { d = ss_cat(db, d, "RULER" as *u8) } 378 if kd[di] == AD_KIND_UNKNOWN { d = ss_cat(db, d, "unknown" as *u8) } 379 d = ss_cat(db, d, "\x09by=" as *u8) 380 if ks[di] == AD_SRC_DECLARED { d = ss_cat(db, d, "DECLARED (column 7, strongest)" as *u8) } 381 if ks[di] == AD_SRC_NAME { d = ss_cat(db, d, "name" as *u8) } 382 if ks[di] == AD_SRC_TASK { d = ss_cat(db, d, "task" as *u8) } 383 if ks[di] == AD_SRC_NOTE { d = ss_cat(db, d, "NOTE(free text -- weakest evidence)" as *u8) } 384 if ks[di] == AD_SRC_NONE { d = ss_cat(db, d, "-" as *u8) } 385 d = ss_cat(db, d, "\n" as *u8) 386 db[d] = (0 as u8) 387 ad_werr(db) 388 di = di + 1 389 } 390 sys_exit(0) 391 return 0 392 } 393 if nout == 0 { ad_werr("no novel proposals above minscore (atlas saturated at this threshold)\ 394" as *u8); sys_exit(0); return 0 } 395 if sts_seed(outp, out, oo) < 0 { ad_werr("discovery plane commit error\ 396" as *u8); sys_exit(AD_EXIT_IO); return AD_EXIT_IO } 397 let msg: *u8 = sys_mmap(128) 398 var mo: i64 = ss_cat(msg, 0, "DISCOVERED proposals=" as *u8) 399 mo = ss_catn(msg, mo, nout) 400 mo = ss_cat(msg, mo, " organs=" as *u8) 401 mo = ss_catn(msg, mo, norg) 402 var nmk: i64 = 0 403 var nrl: i64 = 0 404 var kx: i64 = 0 405 while kx < norg { 406 if kd[kx] == AD_KIND_MAKER { nmk = nmk + 1 } 407 if kd[kx] == AD_KIND_RULER { nrl = nrl + 1 } 408 kx = kx + 1 409 } 410 mo = ss_cat(msg, mo, " makers=" as *u8) 411 mo = ss_catn(msg, mo, nmk) 412 mo = ss_cat(msg, mo, " rulers=" as *u8) 413 mo = ss_catn(msg, mo, nrl) 414 mo = ss_cat(msg, mo, " unclassified=" as *u8) 415 mo = ss_catn(msg, mo, norg - nmk - nrl) 416 var ndec: i64 = 0 417 var ntru: i64 = 0 418 kx = 0 419 while kx < norg { 420 if ks[kx] == AD_SRC_DECLARED { ndec = ndec + 1 } 421 if ad_trusted(ks[kx]) == 1 { ntru = ntru + 1 } 422 kx = kx + 1 423 } 424 mo = ss_cat(msg, mo, " declared=" as *u8) 425 mo = ss_catn(msg, mo, ndec) 426 mo = ss_cat(msg, mo, " trusted=" as *u8) 427 mo = ss_catn(msg, mo, ntru) 428 mo = ss_cat(msg, mo, " guessed=" as *u8) 429 mo = ss_catn(msg, mo, norg - ntru) 430 if ndec == 0 { mo = ss_cat(msg, mo, " NOTE: no row declares a kind (catalog has no column 7), so the measure-gap axis is DORMANT by design rather than guessing from free text" as *u8) } 431 msg[mo] = AD_NL as u8 432 mo = mo + 1 433 sys_write(1, msg, mo) 434 sys_exit(0) 435 return 0 436}