code wiki / _hdl_build / nx_companion_state.nx

nx_companion_state.nx

buildroot/runtime/_hdl_build/nx_companion_state.nx

6948 B113 linesdepth 2pulls 2 transitivereach 7 importersview sourcekind librarytopic companion
docsdependenciesstructsconstsfunctions

about

nx_companion_state.nx -- the CompanionState object: the COGNITIVE CORE / neuro-chemical state (the evolving self). State = 4 ints 0-100 in elara_state.txt [affection,dopamine,cortisol,oxytocin], updated per turn from sentiment + decays to baseline, projected into her VOICE (mood line) + BODY (photo expression tokens) + a real-clock DAY-ARC. Extracted from nx_gen_orchestrator (monolith -> objects); behaviour-preserving (bodies byte-identical except private cs_* helpers; go_clamp100 stays internal). Object model: companion_arch.md. license_tier: ORIGINAL

dependencies 1 imports · 1 importers

nx_syscalls.nx nx_companion_state.nx nx_gen_orchestrator.nx

imports: nx_syscalls.nx

imported by: nx_gen_orchestrator.nx

structs

none

consts

none

functions

8func cs_cat(dst: *u8, off: i64, s: *u8) -> i64 { var o: i64=off; var i: i64=0; while s[i]!=(0 as u8){dst[o]=s[i]; o=o+1; i=i+1} return o }
9func cs_itoa(dst: *u8, off: i64, v: i64) -> i64 { let t: *u8=sys_mmap(28); var m: i64=v; var k: i64=0; if m==0{t[0]=48 as u8;k=1} while m>0{t[k]=(48+(m%10)) as u8;m=m/10;k=k+1} var o: i64=off; var q: i64=k-1; while q>=0{dst[o]=t[q];o=o+1;q=q-1} return o }
called by 1: go_state_save calls 1: sys_mmap
10func cs_contains_ci(hay: *u8, hlen: i64, needle: *u8) -> i64
called by 1: go_state_update
28func go_clamp100(v: i64) -> i64 { if v < 0 { return 0 } if v > 100 { return 100 } return v }
called by 1: go_state_update
29func go_state_load(st: *i64) -> i64
45func go_state_save(st: *i64) -> i64
55func go_state_update(st: *i64, msg: *u8, mlen: i64) -> i64
81func go_mood_line(st: *i64, out: *u8) -> i64
called by 1: go_handle_chat calls 1: cs_cat
90func go_expr_tokens(st: *i64, out: *u8) -> i64
called by 1: go_handle_chat calls 1: cs_cat
99func go_day_scene(out: *u8, off: i64) -> i64