nx_teacher_serve.nx
buildroot/runtime/nx_teacher_serve.nx
about
nx_teacher_serve.nx -- SERVE-WRAPPER making the TEACHER role's capability MCP-callable (operator 2026-07-10). Library-role
pattern (4th): nx_teacher is a LIBRARY (no main; nx_teacher_ingest reads FILES + appends registries = side-effecting). This
wrapper exercises the teacher's real STRUCTURE-VALIDATION primitives (mem_eq + sec_bounds) on SYNTHETIC in-memory lessons --
NO files, NO side effects: a well-formed lesson (title + CONTEXT/TAKEAWAYS/EVIDENCE/CARDINALS/DRILLS) PASSES, one missing a
required section FAILS -> the teacher's S-class gate discriminates. Clean exit 0 + JSON so nishi_crew dispatches `teacher train`.
Import ONLY nx_teacher.nx (brings nx_syscalls). NOTE: nx_teacher already ships these '##' literals + compiles, so the '#'
lexer note does not bite here. JSON trick: tsv_w2 converts ' -> ". license_tier: ORIGINAL expect_exit: 0
dependencies 2 imports · 0 importers
imports: nx_teacher.nxnx_teacher_lesson.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
| none |
functions
| 11 | func tsv_raw(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 } |
| 12 | func tsv_w2(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){ if s[n]==(39 as u8) { let q: *u8=sys_mmap(1); q[0]=34 as u8; sys_write(1,q,1) } else { sys_write(1,(s as i64+n) as *u8,1) } n=n+1 } return 0 } called by 1: main |
| 13 | func tsv_bit(b: i64) -> i64 { let d: *u8=sys_mmap(1); d[0]=(48+b) as u8; sys_write(1,d,1); return 0 } called by 1: main |
| 14 | func tsv_slen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n } called by 1: main |
| 17 | func tsv_valid(body: *u8, n: i64) -> i64 |
| 28 | func main() -> i64 |