nx_gen_promptweight_gate.nx
buildroot/runtime/nx_gen_promptweight_gate.nx
about
nx_gen_promptweight_gate.nx -- the REFEREE for gen G13 (cw_prompt_weight): prompt weighting as DATA on the shared
photo-prompt composer, on the contract knowledge/gen_prompt_weight.conf declared before the code existed: PERMIL
units, a permitted ENVELOPE [min,max] as the first two ints, out-of-envelope REFUSED by named code (never clamped),
slot weights as ADDITIVE ints 3..5 with 1000 the identity. IN-PROCESS over nx_companion_wardrobe.nx, GPU-free: the
verb emits the engine's own A1111 syntax, 1.000 is the byte-identical identity (feature OFF by default), the parser
keeps order and survives bad data, the free-text admission scanner names the first offending group, and -- the
compose-level teeth -- the REAL composer run from a scratch cwd with a planted conf produces byte-different prompts
for 1000 vs 1300 on the trigger slot, reproduces the off bytes exactly when set back, and falls back to the off bytes
(the baseline, never a mutated render) when a DATA slot is out of envelope.
FIXTURE LAW: scratch under /tmp/<gate>/ (a planted knowledge/gen_prompt_weight.conf + a planted elara_trigger.txt),
recreated at SETUP; the gate chdirs into it so the composer's RELATIVE reads see the fixture and never production.
The live-conf tooth runs BEFORE the plant (relative path absent -> the nishihost conf) and asserts only sanity, never
a value, so an operator edit to production weights can never turn this gate RED.
license_tier: ORIGINAL expect_exit: 0
dependencies 3 imports · 0 importers
imports: nx_syscalls.nxnx_gate_verdict.nxnx_companion_wardrobe.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 PW_DIR: *u8 = "/tmp/nx_gen_promptweight_gate" |
| 20 | const PW_KDIR: *u8 = "/tmp/nx_gen_promptweight_gate/knowledge" |
| 21 | const PW_CONF: *u8 = "/tmp/nx_gen_promptweight_gate/knowledge/gen_prompt_weight.conf" |
| 22 | const PW_TRIG: *u8 = "/tmp/nx_gen_promptweight_gate/elara_trigger.txt" |
| 23 | const PW_MODE_DIR: i64 = 511 |
| 24 | const PW_MODE_FILE: i64 = 420 |
| 25 | const PW_CAP: i64 = 32768 |
| 26 | const PW_SENTINEL: i64 = 126 |
| 27 | const PW_SCENE: *u8 = "on the kitchen counter" |
| 28 | const PW_TRIGGER_WORD: *u8 = "rawphotoword" |
| 29 | const PW_SEED: i64 = 7 |
| 30 | const PW_CONF_OFF: *u8 = "# planted by nx_gen_promptweight_gate\n100 2000\n1000 1000 1000\n" |
| 31 | const PW_CONF_ON: *u8 = "# planted by nx_gen_promptweight_gate\n100 2000\n1300 1000 1000\n" |
| 32 | const PW_CONF_BAD: *u8 = "# planted by nx_gen_promptweight_gate\n100 2000\n9000 1000 1000\n" |
functions
| 34 | func pw_len(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } |
| 35 | func pw_find(buf: *u8, n: i64, needle: *u8) -> i64 |
| 49 | func pw_same(a: *u8, na: i64, b: *u8, nb: i64) -> i64 |
| 56 | func pw_eq(buf: *u8, n: i64, lit: *u8) -> i64 { return pw_same(buf, n, lit, pw_len(lit)) } |
| 57 | func pw_fill(buf: *u8) -> i64 { var i: i64 = 0; while i < PW_CAP { buf[i] = PW_SENTINEL as u8; i = i + 1 } return 0 } called by 1: main |
| 58 | func pw_write(path: *u8, s: *u8) -> i64 |
| 67 | func pw_compose(out: *u8) -> i64 { return go_compose_photo_prompt(PW_SCENE, pw_len(PW_SCENE), "" as *u8, PW_SEED, out) } |
| 68 | func pw_env5(e: *i64, mn: i64, mx: i64, t: i64, c: i64, id: i64) -> i64 { e[CW_W_MIN] = mn; e[CW_W_MAX] = mx; e[CW_W_TRIGGER] = t; e[CW_W_CAMERA] = c; e[CW_W_IDENTITY] = id; return 0 } called by 1: main |
| 70 | func main() -> i64 |