nx_gpu_ctl.nx
buildroot/runtime/nx_gpu_ctl.nx
about
nx_gpu_ctl.nx -- SOVEREIGN GPU-provider CONTROL PLANE (Vast.ai) over our OWN TLS-1.2 stack (console.vast.ai is
TLS-1.2-only; the shipped stack is 1.3-only). Retires the curl+ssh provisioning dance: every verb is one
authenticated request via t12_request (nx_tls12_req.nx) -- Bearer key read from a vault FILE, never argv.
The MCP-ready capability the operator asked for: turn a GPU ON/OFF, provision, check, destroy -- all sovereign.
nx_gpu_ctl me <keyfile> GET /api/v0/users/current/ -> account (auth proof)
nx_gpu_ctl find <keyfile> GET /api/v0/bundles/?q=<vm 5090> -> offer list
nx_gpu_ctl up <offer_id> <keyfile> PUT /api/v0/asks/<id>/ {vm KVM} -> {new_contract:<inst>}
nx_gpu_ctl status <instance_id> <keyfile> GET /api/v0/instances/<id>/ -> state + ssh + $/hr
nx_gpu_ctl off <instance_id> <keyfile> PUT /api/v0/instances/<id>/ {stopped}-> stop billing, keep disk
nx_gpu_ctl on <instance_id> <keyfile> PUT /api/v0/instances/<id>/ {running}-> resume
nx_gpu_ctl destroy <instance_id> <keyfile> DELETE /api/v0/instances/<id>/ -> tear down (billing ends)
OPERATOR-DRIVEN by design (nothing acts autonomously). license_tier: ORIGINAL expect_exit: 0
dependencies 1 imports · 0 importers
imports: nx_tls12_req.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
| 14 | const GC_MAGIC_262144: i64 = 262144 |
| 15 | const GC_MAGIC_4096: i64 = 4096 |
| 16 | const GC_MAGIC_4095: i64 = 4095 |
| 17 | const GC_MAGIC_2048: i64 = 2048 |
| 19 | const GC_VM_BODY: *u8 = "{\"image\":\"docker.io/vastai/kvm:ubuntu_terminal\",\"disk\":50,\"runtype\":\"ssh_direct\",\"vm\":true,\"label\":\"nishi-sovereign-gpu\",\"target_state\":\"running\"}" as *u8 |
| 20 | const GC_FIND_URL: *u8 = "https://console.vast.ai/api/v0/bundles/?q=%7B%22gpu_name%22%3A%7B%22eq%22%3A%22RTX%205090%22%7D%2C%22num_gpus%22%3A%7B%22eq%22%3A1%7D%2C%22rentable%22%3A%7B%22eq%22%3Atrue%7D%2C%22vms_enabled%22%3A%7B%22eq%22%3Atrue%7D%2C%22order%22%3A%5B%5B%22dph_total%22%2C%22asc%22%5D%5D%2C%22limit%22%3A40%7D" as *u8 |
functions
| 22 | func gc_puts(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 } |
| 23 | func gc_putn(v: i64) -> i64 { let b: *u8=sys_mmap(28); var m: i64=v; if m<0{m=0-m;sys_write(1,"-" as *u8,1)} let t: *u8=sys_mmap(28); var k: i64=0; if m==0{t[0]=48;k=1} while m>0{t[k]=(48+(m%10)) as u8;m=m/10;k=k+1} var i: i64=0; while i<k{b[i]=t[k-1-i];i=i+1} sys_write(1,b,k); return 0 } |
| 24 | func gc_streq(a: *u8, b: *u8) -> i64 { var i: i64=0; while a[i]!=(0 as u8){ if a[i]!=b[i]{return 0} i=i+1 } if b[i]!=(0 as u8){return 0} return 1 } |
| 25 | func gc_cat(d: *u8, o: i64, s: *u8) -> i64 { var i: i64=0; while s[i]!=(0 as u8){ d[o+i]=s[i]; i=i+1 } return o+i } |
| 26 | func gc_readfile(path: *u8, out: *u8, cap: i64) -> i64 |
| 36 | func gc_url(prefix: *u8, id: *u8, out: *u8) -> i64 |
| 44 | func gc_bodylen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n } |
| 46 | func gc_usage() -> i64 |
| 52 | func gc_run(url: *u8, method: *u8, mlen: i64, tok: *u8, tn: i64, body: *u8, blen: i64) -> i64 |
| 63 | func main(argc: i64, argv: *i64) -> i64 |