code wiki / _hdl_build / nx_gen_worker.nx
nx_gen_worker.nx
buildroot/runtime/_hdl_build/nx_gen_worker.nx
about
nx_gen_worker.nx -- the GenWorker object: the GPU-worker CLIENT. Owns dispatch to a worker (a.b.c.d:port) for
image gen (/v1/images/generations) and chat (/v1/chat/completions), plus the non-blocking TCP health-check that
makes multi-worker availability-based selection + failover safe (a powered-off worker must never hang a dispatch).
Extracted from nx_gen_orchestrator (monolith -> objects); behaviour-preserving. THIS is where ER-8 model-select-by-
intent will land (route SFW->controlled model, explicit->turbo). Self-contained (private gw_* helpers). Object
model: companion_arch.md. license_tier: ORIGINAL
dependencies 3 imports · 2 importers
imports: nx_syscalls.nxnx_netprobe_lib.nxnx_gen_conf_lib.nx
imported by: nx_gen_inpaint_gate.nxnx_gen_orchestrator.nx
structs
| none |
consts
| 95 | const GW_CHAT_BUDGET_FALLBACK_S: i64 = 25 |
| 96 | const GW_CHAT_BUDGET_CEIL_S: i64 = 300 |
| 128 | const GW_MASK_EMPTY: i64 = 0 - 1 |
| 129 | const GW_MASK_NOT_B64: i64 = 0 - 2 |
| 130 | const GW_MASK_BAD_INVERT: i64 = 0 - 3 |
| 131 | const GW_CH_UP_A: i64 = 65 |
| 132 | const GW_CH_UP_Z: i64 = 90 |
| 133 | const GW_CH_LO_A: i64 = 97 |
| 134 | const GW_CH_LO_Z: i64 = 122 |
| 135 | const GW_CH_D0: i64 = 48 |
| 136 | const GW_CH_D9: i64 = 57 |
| 137 | const GW_CH_PLUS: i64 = 43 |
| 138 | const GW_CH_SLASH: i64 = 47 |
| 139 | const GW_CH_EQ: i64 = 61 |
functions
| 11 | func gw_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 } |
| 12 | func gw_catb(dst: *u8, off: i64, src: *u8, n: i64) -> i64 { var o: i64=off; var i: i64=0; while i<n {dst[o]=src[i]; o=o+1; i=i+1} return o } |
| 13 | func gw_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 } |
| 30 | func gw_read_full(fd: i64, respbuf: *u8, respcap: i64) -> i64 |
| 43 | func go_worker_dispatch(ha: i64, hb: i64, hc: i64, hd: i64, port: i64, body: *u8, blen: i64, respbuf: *u8, respcap: i64) -> i64 called by 2: go_handle_generatego_handle_chat_mode calls 10: sys_socketsys_set_socket_timeoutsys_mmapsys_connectsys_closegw_cat+4 |
| 65 | func go_worker_img2img(ha: i64, hb: i64, hc: i64, hd: i64, port: i64, body: *u8, blen: i64, respbuf: *u8, respcap: i64) -> i64 called by 1: go_handle_img2img calls 9: sys_socketsys_set_socket_timeoutsys_mmapsys_connectsys_closegw_cat+3 |
| 89 | func go_worker_up(ha: i64, hb: i64, hc: i64, hd: i64, port: i64) -> i64 { return np_probe_up(ha, hb, hc, hd, port) } called by 5: maingo_handle_generatego_handle_chat_modego_handle_writego_handle_img2img calls 1: np_probe_up |
| 97 | func gw_chat_budget_s() -> i64 |
| 140 | func gw_b64_byte_ok(c: i64) -> i64 called by 1: gw_inpaint_mask |
| 149 | func gw_inpaint_mask(dst: *u8, off: i64, mask_b64: *u8, mlen: i64, invert: i64) -> i64 |
| 162 | func go_chat_dispatch(ha: i64, hb: i64, hc: i64, hd: i64, port: i64, body: *u8, blen: i64, respbuf: *u8, respcap: i64) -> i64 |