nx_worker_dispatch.nx
buildroot/runtime/nx_worker_dispatch.nx
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
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
structs
| none |
consts
| 26 | const K_MAGIC_7861: i64 = 7861 |
| 27 | const K_MAGIC_5080: i64 = 5080 |
functions
| 29 | func 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 } |
| 30 | func wd_wn(fd: i64, v: i64) -> i64 |
| 43 | func wd_p(s: *u8) -> i64 { return wd_w(1, s) } |
| 44 | func wd_pn(v: i64) -> i64 { return wd_wn(1, v) } |
| 45 | func wd_streq(a: *u8, b: *u8) -> i64 |
| 53 | func wd_route(jtype: *u8) -> i64 |
| 63 | func wd_worker_name(id: i64) -> *u8 |
| 72 | func wd_where_role(role: *u8, label: *u8) -> *u8 |
| 82 | func wd_worker_where(id: i64) -> *u8 |
| 89 | func wd_worker_addr(id: i64, ip: *i64, portbox: *i64) -> i64 |
| 94 | func wd_worker_id_by_name(nm: *u8) -> i64 |
| 102 | func wd_field_eq(csv: *u8, s: i64, e: i64, token: *u8, tl: i64) -> i64 called by 1: wd_caps_has |
| 108 | func wd_caps_has(csv: *u8, token: *u8) -> i64 |
| 132 | func wd_authorize(jtype: *u8, storage: *u8, caps: *u8) -> i64 |
| 142 | func wd_storage_where(storage: *u8) -> *u8 |
| 149 | func wd_resp_2xx(buf: *u8, n: i64) -> i64 |
| 159 | func wd_probe(id: i64) -> i64 |
| 169 | func wd_gate() -> i64 |
| 227 | func main(argc: i64, argv: *i64) -> i64 |