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 orphan library
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)

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 }
30func wd_wn(fd: i64, v: i64) -> i64
43func wd_p(s: *u8) -> i64 { return wd_w(1, s) }
44func wd_pn(v: i64) -> i64 { return wd_wn(1, v) }
45func wd_streq(a: *u8, b: *u8) -> i64
53func wd_route(jtype: *u8) -> i64
63func wd_worker_name(id: i64) -> *u8
72func wd_where_role(role: *u8, label: *u8) -> *u8
82func wd_worker_where(id: i64) -> *u8
89func wd_worker_addr(id: i64, ip: *i64, portbox: *i64) -> i64
94func wd_worker_id_by_name(nm: *u8) -> i64
102func wd_field_eq(csv: *u8, s: i64, e: i64, token: *u8, tl: i64) -> i64
108func wd_caps_has(csv: *u8, token: *u8) -> i64
132func wd_authorize(jtype: *u8, storage: *u8, caps: *u8) -> i64
142func wd_storage_where(storage: *u8) -> *u8
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