nx_field_beat_lib.nx
buildroot/runtime/nx_field_beat_lib.nx
about
nx_field_beat_lib.nx -- THE DECISION CORE OF THE FIELD BEAT (/compare/fieldwatch FW4, 2026-09-05). Pure functions
only, so nx_field_beat_gate drives every decision in-process on fixtures assembled at runtime: which domains a list
names, what a discover receipt says, how one run is classified, where the stamp goes and what it says. The program
(nx_field_beat) owns the forks and the file writes; nothing here touches the network or the evidence store.
license_tier: ORIGINAL No hw writes (Rule 26).
dependencies 1 imports · 3 importers
imports: nx_syscalls.nx
imported by: nx_field_beat.nxnx_field_beat_gate.nxnx_field_seedgen_lib.nx
structs
| none |
consts
| 8 | const FB_NAME_CAP: i64 = 64 // one domain name slot; the longest name on regen.list is 16 bytes, a longer one is cut and the cut is visible in the stamp's domains= count staying honest |
| 9 | const FB_MAX_DOMAINS: i64 = 256 // regen.list carries 111 domains today; a list past this sets capped=1 (a FLOOR, announced), never a silent cut |
| 10 | const FB_CH_NL: i64 = 10 |
| 11 | const FB_CH_CR: i64 = 13 |
| 12 | const FB_CH_HASH: i64 = 35 |
| 13 | const FB_CH_SP: i64 = 32 |
| 14 | const FB_CH_EQ: i64 = 61 |
| 15 | const FB_CH_MINUS: i64 = 45 |
| 16 | const FB_CH_0: i64 = 48 |
| 17 | const FB_CH_9: i64 = 57 |
| 18 | const FB_NUM_BASE: i64 = 10 |
| 19 | const FB_NUM_W: i64 = 24 |
| 20 | const FB_UNPARSED: i64 = 0 - 1 // a field the receipt did not carry: its own bucket, never a zero |
| 21 | const FB_CLASS_OK: i64 = 1 |
| 22 | const FB_CLASS_SKIP: i64 = 2 // no seeds file: the domain has declared no field yet, so there is nothing to re-read |
| 23 | const FB_CLASS_FAIL: i64 = 3 |
| 24 | const FB_STAMP_DEFAULT: *u8 = "knowledge/status/fieldbeat.stamp" |
| 25 | const FB_STAMP_SUFFIX: *u8 = ".stamp" |
| 26 | const FB_OK_LINE: *u8 = "FIELD-OK " |
| 27 | const FB_STAMP_HEAD: *u8 = "fieldbeat" // every stamp key is space-preceded, so one span reader serves receipt and stamp |
functions
| 29 | func fb_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } |
| 30 | func fb_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 } |
| 31 | func fb_puts(fd: i64, s: *u8) -> i64 { sys_write(fd, s, fb_slen(s)); return 0 } |
| 32 | func fb_putn(fd: i64, v: i64) -> i64 |
| 44 | func fb_cat(dst: *u8, off: i64, s: *u8, cap: i64) -> i64 |
| 52 | func fb_domain_at(names: *u8, i: i64) -> *u8 { return ((names as i64) + i * FB_NAME_CAP) as *u8 } |
| 56 | func fb_list_domains(b: *u8, n: i64, names: *u8, capped: *i64) -> i64 |
| 87 | func fb_prefix_at(b: *u8, s: i64, e: i64, lit: *u8) -> i64 |
| 94 | func fb_ok_line(cap: *u8, n: i64, s_out: *i64, e_out: *i64) -> i64 |
| 106 | func fb_span_int(b: *u8, s: i64, e: i64, key: *u8) -> i64 |
| 129 | func fb_receipt_ok(cap: *u8, n: i64) -> i64 |
| 134 | func fb_receipt_int(cap: *u8, n: i64, key: *u8) -> i64 |
| 142 | func fb_classify(rc: i64, ok: i64, seeds_present: i64) -> i64 |
| 147 | func fb_class_name(c: i64) -> *u8 |
| 154 | func fb_stamp_path(list: *u8, is_default: i64, dst: *u8, cap: i64) -> i64 |
| 159 | func fb_stamp_verdict(ok: i64, failed: i64) -> *u8 |
| 165 | func fb_stamp_write(fd: i64, ts: i64, list: *u8, domains: i64, ok: i64, failed: i64, skipped: i64, cands: i64, capped: i64, drifted: i64) -> i64 |
| 183 | func fb_jrnl_row(fd: i64, ts: i64, dom: *u8, cls: i64, rc: i64, cands: i64, named: i64, failed_seeds: i64) -> i64 |