code wiki / (root) / nx_lorebook_gate.nx

nx_lorebook_gate.nx

buildroot/runtime/nx_lorebook_gate.nx

7538 B111 linesdepth 3pulls 4 transitivereach 0 importersview sourcekind gate/proof
docsdependenciesstructsconstsfunctions

about

nx_lorebook_gate.nx -- the REFEREE for companionchat CC3 (em_lorebook in nx_lorebook.nx): a keyed entry is injected only when the turn touches one of its triggers; the match is ASCII case-insensitive; an entry fires once per turn; a turn touching nothing writes zero bytes; a malformed row is counted and never fires; and an over-budget turn REFUSES LOUDLY with the numbers, injecting no partial entry. GPU-free, in-process, fixture confs under /tmp/<gate>/ written at run time. license_tier: ORIGINAL expect_exit: 0

dependencies 3 imports · 0 importers

nx_syscalls.nx nx_gate_verdict.nx nx_lorebook.nx nx_lorebook_gate.nx

imports: nx_syscalls.nxnx_gate_verdict.nxnx_lorebook.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main gv_head gv_puts sys_write gv_ctr sys_mmap nxa_die sys_write ↻ sys_exit nxa_lock_take nxa_lock_addr sys_write ↻ nxa_lock_give nxa_lock_addr ↻ nxa_report_overrun sys_write ↻ nxa_dump_printable sys_write ↻ nxa_dump_sizes sys_write ↻ sys_mkdir sys_unlinkat lg_write sys_openat_wr sys_write ↻ lg_len sys_close gv_check gv_puts ↻ sys_mmap ↻ lg_run em_lorebook_from sys_mmap ↻ sys_read_file sys_openat_rd sys_lseek sys_mmap ↻ sys_read sys_munmap sys_close ↻

structs

none

consts

10const LG_DIR: *u8 = "/tmp/nx_lorebook_gate" as *u8
11const LG_CONF: *u8 = "/tmp/nx_lorebook_gate/lore.conf" as *u8
12const LG_CONF_TIGHT: *u8 = "/tmp/nx_lorebook_gate/lore_tight.conf" as *u8
13const LG_CONF_NOBUDGET: *u8 = "/tmp/nx_lorebook_gate/lore_nobudget.conf" as *u8
14const LG_CONF_ABSENT: *u8 = "/tmp/nx_lorebook_gate/does_not_exist.conf" as *u8
15const LG_MODE_DIR: i64 = 511
16const LG_MODE_FILE: i64 = 420
17const LG_OUT_CAP: i64 = 8192
18const LG_STATS_CAP: i64 = 64
19const LG_ROWS: *u8 = "# fixture lorebook\n@budget 600\nbeach|beach, shore|The cove west of the house has black sand and a tide pool she loves.\ncafe|cafe,coffee|Marisol's cafe on the corner does the cardamom latte she orders.\nbroken|only two fields\n" as *u8
20const LG_ROWS_TIGHT: *u8 = "@budget 40\nbeach|beach|The cove west of the house has black sand and a tide pool she loves.\n" as *u8
21const LG_ROWS_NOBUDGET: *u8 = "beach|beach|The cove west of the house has black sand and a tide pool she loves.\n" as *u8
22const LG_BEACH_TELL: *u8 = "black sand" as *u8
23const LG_CAFE_TELL: *u8 = "cardamom" as *u8
24const LG_REFUSED_TELL: *u8 = "[WORLD refused" as *u8
25const LG_HEAD_TELL: *u8 = "[WORLD --" as *u8
26const LG_TIGHT_BUDGET_TEXT: *u8 = " budget of 40 " as *u8

functions

28func lg_len(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
29func lg_find(buf: *u8, n: i64, needle: *u8) -> i64
called by 1: main calls 1: lg_len
43func lg_write(path: *u8, body: *u8) -> i64
51func lg_run(conf: *u8, turn: *u8, out: *u8, stats: *i64) -> i64
called by 1: main calls 2: em_lorebook_fromlg_len
55func main() -> i64