code wiki / _hdl_build / nx_ale_gap_filer.nx
nx_ale_gap_filer.nx
buildroot/runtime/_hdl_build/nx_ale_gap_filer.nx
about
nx_ale_gap_filer.nx -- ALE-R5 autonomy: turns the flywheel's gap LEDGER (knowledge/status/
ale_gaps.tsv lines "ALEGAP<TAB>task=<path><TAB>exit=<rc><TAB>score=<n>") into queue RUNGS so the
RSI loop spins itself HANDS-OFF: flywheel detects a gap -> ledgers it -> THIS files a NOVEL
"ALE-GAP-<id>" assignment (id = ALE-GAP- + sanitized task basename) -> the team builds the missing
capability -> re-attempt closes the gap. IDEMPOTENT: an ALE-GAP-<id> already in the queue is
skipped, and duplicate ledger lines collapse to ONE rung (so re-running every beat adds 0 dupes).
LOCK-PROTECTED append (shared assignment_queue.tsv.lock) so it never races the beat.
argv[1] = queue-path override (a scratch queue, no lock) for dry-run; no-arg => LIVE.
BAKED SELF-TEST FIRST (scratch ledger w/ a DUP + scratch queue): control_pos files exactly 1,
control_idem re-run files 0; mismatch -> RED + nonzero exit, the real queue UNTOUCHED.
MAINLESS-LIB import convention (nx_registry_lock pulls nx_syscalls transitively; do NOT also
import nx_syscalls). license_tier: ORIGINAL
module: nishi-core.ale.gap_filer
depends: nishi-core.autonomy.registry_lock
capability: ALE_GAP_AUTOFILE
dependencies 2 imports · 0 importers
imports: nx_registry_lock.nxnx_itoa_lib.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 19 | const GF_MAGIC_262144: i64 = 262144 |
| 20 | const GF_MAGIC_131072: i64 = 131072 |
| 21 | const GF_MAGIC_2048: i64 = 2048 |
| 22 | const GF_MAGIC_65536: i64 = 65536 |
| 24 | const GF_QCAP: i64 = 1048576 |
functions
| 26 | func gf_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 } |
| 31 | func gf_wn(fd: i64, v: i64) -> i64 { nxi_fd(fd, v); return 0 } |
| 32 | func gf_len(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } |
| 34 | func gf_read(path: *u8, buf: *u8, cap: i64) -> i64 |
| 48 | func gf_write_file(path: *u8, s: *u8) -> i64 |
| 58 | func gf_basename_id(path: *u8, out: *u8) -> i64 |
| 89 | func gf_id_present(buf: *u8, n: i64, id: *u8) -> i64 |
| 111 | func gf_extract_task(buf: *u8, ls: i64, le: i64, out: *u8) -> i64 called by 1: gf_process |
| 132 | func gf_process(ledgerpath: *u8, qpath: *u8) -> i64 called by 2: gf_selftestmain calls 7: gf_readsys_openat_appendgf_extract_taskgf_lengf_basename_idgf_id_present+1 |
| 180 | func gf_selftest() -> i64 |
| 203 | func main(argc: i64, argv: *i64) -> i64 |