code wiki / (root) / nx_worker_dispatch.nx

nx_worker_dispatch.nx

buildroot/runtime/nx_worker_dispatch.nx

13755 B262 linesdepth 7pulls 11 transitivereach 0 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

about

nx_worker_dispatch.nx -- WORKER MESH keystone: capability-scoped job dispatch across a sovereign GPU/compute mesh. The operator architecture: the NAS runs the orchestration container; it dispatches jobs BY API to compute WORKERS (this laptop's RTX 5080 for image gen, the west server's dual 3090s for video, the cloud for other work). Each job runs under a SCOPED CAPABILITY -- MCP-client style, it may ONLY touch the workers + storage it was granted, "trusted to do work" enforced deny-by-default. Results are pushed to consumable storage (nishifamily.com/gallery). This organ is the DISPATCH BRAIN + the capability enforcement. It: * ROUTES a job by type -> worker class (image->gpu-image / video->gpu-video / llm|embed|other->cloud) * ENFORCES the capability: a job is AUTHORIZED only if its caps grant BOTH the routed worker AND the storage target (missing either -> DENY). This is the "real MCP-type capability to access trusted resources". * RESOLVES the worker endpoint (ip:port:path) + the storage target (gallery ingest). * ACTUATES: for an authorized job it can CALL the live worker over sovereign TCP (nx_http_client) to prove the authorized call reaches real compute -- the first leg of NAS -> worker -> gallery. CLI: (no args) -> self-test GATE (routing + capability enforcement + neg-controls) probe <worker-class> -> live: GET the worker's /v1/models, report reachability dispatch <type> <storage> <caps> -> authorize (deny-by-default) + probe the routed worker + report Worker classes: gpu-image gpu-video cloud. caps = comma list e.g. "gpu-image,gallery". NO fake greens: the gate mechanically proves the capability check DISCRIMINATES (grant->allow, missing->deny). license_tier: ORIGINAL

dependencies 4 imports · 0 importers

nx_syscalls.nx nx_runtime.nx nx_mesh_probe.nx nx_swarm_endpoint_lib.nx nx_worker_dispatch.nx

imports: nx_syscalls.nxnx_runtime.nxnx_mesh_probe.nxnx_swarm_endpoint_lib.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main wd_streq wd_w sys_write wd_worker_id_by_name wd_streq ↻ wd_p wd_w ↻ wd_worker_name wd_worker_where wd_where_role se_addr se_ctx sys_mmap se_slurp sys_openat_rd sys_read sys_close se_field se_find se_seq se_len sys_mmap ↻ se_putn sys_mmap ↻ se_put wd_probe sys_mmap ↻ wd_worker_addr wd_p ↻ mp_probe sys_mmap ↻ nx_http_client_sockaddr_ip sys_socket nx_connect_bounded nx_fcntl sys_connect sys_mmap ↻ sys_poll mp_pollfd

structs

none

consts

26const K_MAGIC_7861: i64 = 7861
27const K_MAGIC_5080: i64 = 5080

functions

29func wd_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 }
called by 3: wd_pwd_gatemain calls 1: sys_write
30func wd_wn(fd: i64, v: i64) -> i64
called by 2: wd_pnwd_gate calls 2: sys_mmapsys_write
43func wd_p(s: *u8) -> i64 { return wd_w(1, s) }
called by 3: wd_probewd_gatemain calls 1: wd_w
44func wd_pn(v: i64) -> i64 { return wd_wn(1, v) }
called by 2: wd_gatemain calls 1: wd_wn
45func wd_streq(a: *u8, b: *u8) -> i64
53func wd_route(jtype: *u8) -> i64
called by 3: wd_authorizewd_gatemain calls 1: wd_streq
63func wd_worker_name(id: i64) -> *u8
called by 2: wd_authorizemain
72func wd_where_role(role: *u8, label: *u8) -> *u8
82func wd_worker_where(id: i64) -> *u8
called by 1: main calls 1: wd_where_role
89func wd_worker_addr(id: i64, ip: *i64, portbox: *i64) -> i64
called by 2: wd_probewd_gate
94func wd_worker_id_by_name(nm: *u8) -> i64
called by 1: main calls 1: wd_streq
102func wd_field_eq(csv: *u8, s: i64, e: i64, token: *u8, tl: i64) -> i64
called by 1: wd_caps_has
108func wd_caps_has(csv: *u8, token: *u8) -> i64
called by 1: wd_authorize calls 1: wd_field_eq
132func wd_authorize(jtype: *u8, storage: *u8, caps: *u8) -> i64
142func wd_storage_where(storage: *u8) -> *u8
called by 1: main calls 1: wd_streq
149func wd_resp_2xx(buf: *u8, n: i64) -> i64
159func wd_probe(id: i64) -> i64
169func wd_gate() -> i64
227func main(argc: i64, argv: *i64) -> i64