nx_mesh_gen.nx
buildroot/runtime/nx_mesh_gen.nx
about
nx_mesh_gen.nx -- WORKER MESH R2: the SOVEREIGN end-to-end actuator. Retires the curl/base64 shell from the
dispatch loop. Runs on the orchestrator (NAS): given a prompt, it POSTs a gen job to a GPU worker over sovereign
TCP (nx_http_client), drains the OpenAI-compat response, extracts the base64 image, DECODES it (nx_base64), and
WRITES the PNG to the gallery docroot -- a complete NAS-organ -> worker -> gallery loop with ZERO shell.
CLI: (no args) -> self-test GATE (b64 round-trip + JSON body build + response extraction)
gen <prompt> <outpath> -> live: POST to the gpu-image worker (laptop 5080), decode, write <outpath>
gen <prompt> <outpath> <a> <b> <c> <d> -> same, to an explicit worker ipv4 a.b.c.d:7861
The capability enforcement is nx_worker_dispatch's job (proven, deny-by-default); this is the ACTUATION it calls.
NO fake greens: the gate proves decode correctness + that the extractor pulls the value from a real JSON shape.
license_tier: ORIGINAL
dependencies 5 imports · 0 importers
imports: nx_syscalls.nxnx_connect.nxnx_runtime.nxnx_http_client.nxnx_base64.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
| 17 | const MG_MAGIC_8192: i64 = 8192 |
| 18 | const MG_MAGIC_16384: i64 = 16384 |
| 19 | const MG_MAGIC_8388608: i64 = 8388608 |
| 20 | const MG_MAGIC_4096: i64 = 4096 |
| 21 | const MG_MAGIC_5080: i64 = 5080 |
| 23 | const MG_PORT: i64 = 7861 |
| 24 | const MG_RESP_CAP: i64 = 2097152 // 2 MB (image response ~550KB base64) |
functions
| 26 | func mg_w(fd: i64, s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(fd, s, n); return 0 } |
| 27 | func mg_wn(fd: i64, v: i64) -> i64 |
| 40 | func mg_p(s: *u8) -> i64 { return mg_w(1, s) } |
| 41 | func mg_pn(v: i64) -> i64 { return mg_wn(1, v) } |
| 42 | func mg_strlen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } |
| 43 | func mg_lit(buf: *u8, o: i64, s: *u8) -> i64 { var i: i64 = 0; while s[i] != (0 as u8) { buf[o+i] = s[i]; i = i + 1 } return o + i } |
| 44 | func mg_atoi(s: *u8) -> i64 { var v: i64 = 0; var i: i64 = 0; while s[i] != (0 as u8) { let c: i64 = s[i] as i64; if c >= 48 { if c <= 57 { v = v * 10 + (c - 48) } } i = i + 1 } return v } called by 1: main |
| 48 | func mg_body(buf: *u8, prompt: *u8) -> i64 |
| 62 | func mg_find(buf: *u8, n: i64, pat: *u8, pl: i64) -> i64 |
| 74 | func mg_extract_b64(buf: *u8, n: i64, vstartbox: *i64, vlenbox: *i64) -> i64 |
| 93 | func mg_drain(fd: i64, buf: *u8, cap: i64) -> i64 |
| 107 | func mg_gen(a: i64, b: i64, c: i64, d: i64, prompt: *u8, outpath: *u8) -> i64 called by 1: main calls 14: sys_mmapnx_http_client_sockaddr_ipv4sys_socketnx_connect_boundedsys_closemg_body+8 |
| 140 | func mg_num_buf(buf: *u8, o: i64, v: i64) -> i64 |
| 150 | func mg_body_n(buf: *u8, prompt: *u8, nval: i64) -> i64 |
| 162 | func mg_find_from(buf: *u8, n: i64, pat: *u8, pl: i64, start: i64) -> i64 called by 1: mg_extract_from |
| 174 | func mg_extract_from(buf: *u8, n: i64, start: i64, vsb: *i64, vlb: *i64) -> i64 |
| 191 | func mg_genbatch(a: i64, b: i64, c: i64, d: i64, prompt: *u8, kk: i64, outprefix: *u8) -> i64 called by 1: main calls 16: sys_mmapnx_http_client_sockaddr_ipv4sys_socketnx_connect_boundedsys_closemg_body_n+10 |
| 233 | func mg_gate() -> i64 |
| 304 | func main(argc: i64, argv: *i64) -> i64 |