nx_chat_swipe_gate.nx
buildroot/runtime/nx_chat_swipe_gate.nx
about
nx_chat_swipe_gate.nx -- the REFEREE for companionchat CC4 (the swipe loop in nx_companion_persona.nx): the chat log stays
append-only and branch-aware -- a swipe is a SIBLING reply (never an overwrite) and shows by default, a select picks a
sibling and persists, an edit overrides the displayed text while the original row remains, the regenerate path loads
history WITHOUT the turn being re-answered, the partition (rows = users+assistants+swipes+selects+edits+other) sums and
is printed, and a plain user/assistant log loads to the byte-identical legacy shape. GPU-free, in-process; the fixture
log lives under /tmp/<gate>/ (the lib reads elara_mem.log from the cwd, so the gate chdirs into its scratch dir).
license_tier: ORIGINAL expect_exit: 0
dependencies 3 imports · 0 importers
imports: nx_syscalls.nxnx_gate_verdict.nxnx_companion_persona.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
| 12 | const SG_DIR: *u8 = "/tmp/nx_chat_swipe_gate" as *u8 |
| 13 | const SG_LOG: *u8 = "/tmp/nx_chat_swipe_gate/elara_mem.log" as *u8 |
| 14 | const SG_MODE_DIR: i64 = 511 |
| 15 | const SG_MODE_FILE: i64 = 420 |
| 16 | const SG_OUT_CAP: i64 = 65536 |
| 17 | const SG_INFO_CAP: i64 = 64 |
| 18 | const SG_MAXLINES: i64 = 32 |
| 19 | const SG_PLAIN: *u8 = "user\thi elara\nassistant\they you, missed you\nuser\thow was the beach\nassistant\tgolden and warm, wish you were there\n" as *u8 |
| 20 | const SG_PLAIN_JSON: *u8 = ",{\"role\":\"user\",\"content\":\"hi elara\"},{\"role\":\"assistant\",\"content\":\"hey you, missed you\"},{\"role\":\"user\",\"content\":\"how was the beach\"},{\"role\":\"assistant\",\"content\":\"golden and warm, wish you were there\"}" as *u8 |
| 21 | const SG_T2_ORIG: *u8 = "golden and warm, wish you were there" as *u8 |
| 22 | const SG_T2_SWIPE: *u8 = "quiet today, I found a shell for you" as *u8 |
| 23 | const SG_T2_EDIT: *u8 = "golden and warm -- next time you come with me" as *u8 |
| 24 | const SG_T1_REPLY: *u8 = "hey you, missed you" as *u8 |
| 25 | const SG_T1_USER: *u8 = "hi elara" as *u8 |
| 26 | const SG_T2_USER: *u8 = "how was the beach" as *u8 |
| 27 | const SG_ORPHAN_LOG: *u8 = "assistant\ta reply with no turn\nuser\thello\nassistant\thi\n" as *u8 |
| 28 | const SG_OUT_OF_RANGE: *u8 = "7" as *u8 |
| 29 | const SG_SELECT_FIRST: *u8 = "0" as *u8 |
functions
| 31 | func sg_len(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } |
| 32 | func sg_eqn(a: *u8, an: i64, b: *u8) -> i64 |
| 38 | func sg_find(buf: *u8, n: i64, needle: *u8) -> i64 |
| 52 | func sg_write(path: *u8, body: *u8) -> i64 |
| 60 | func sg_log_bytes(bp: *i64) -> i64 |
| 69 | func sg_is_prefix(a: *u8, an: i64, b: *u8, bn: i64) -> i64 called by 1: main |
| 76 | func sg_field(buf: *u8, n: i64, key: *u8) -> i64 |
| 93 | func main() -> i64 |