nx_world_telemetry_gpu_candidate.nx
buildroot/runtime/nx_world_telemetry_gpu_candidate.nx
about
nx_world_telemetry.nx -- THE WORLD TELEMETRY SINK (gameengine GE33 wt_telemetry_sink, 2026-09-02): the loopback
daemon behind nishifamily.com/world/__telemetry that turns a visitor's frame-budget beacon into DURABLE evidence
IN THE SOVEREIGN STORE PLANE -- never a file beside it.
WHAT ARRIVES: the served world pages (nx_game_page_emit, GE32 HUD) read every frame statistic from an engine door
(nx_perf_lib inside the wasm) and beacon the window on pagehide and on a slow beat:
POST /world/__telemetry?w=<world> body = JSON {budget_ms,n,total,p50,p95,p99,worst,worst_ever,spikes,over,
frames:[ms,ms,...]} (one PF_N-frame window, ~1.5 KB)
WHAT IS WRITTEN: ONE ROW appended to the plane knowledge/store/frametrace- (nx_frame_pacing_lib fpc_plane_append ->
nx_store_seed_lib's locked append, the same write every board uses; the first beacon bootstraps the plane):
id=<world>_<ts> | world | ts | budget(ms:src) | n | total | page p50/p95/p99 | sink p50/p95/p99 | worst |
worst_ever | spikes | over | verdict:why | twins | frames_csv
The plane is append-only, so it IS the time spine: the latest row for a world is the current window the pacing
gate (GE15) judges, and every earlier row is history -- readable by any seat, AI or human, through
`nx_store_put knowledge/store/frametrace- load`, and served here at GET /world/__telemetry/spine for a browser.
TWO RULERS, ONE ARITHMETIC: the wasm engine and this daemon both compute the percentiles with nx_perf_lib. If the
page's numbers and the sink's disagree on the same window, the wasm/native twins have drifted, and every row says
so in its `twins` column -- a consistency check nobody has to remember to run.
BOUNDS, NAMED: WT_REQ_CAP is the one legitimate cap (a network body's size is unknowable in advance); a body past it
is REFUSED with the cap named, never silently cut. The world name is [a-z0-9_]{1,32} because it keys a plane row.
HARDENING inherited from nx_http_server_listen by construction: FD_CLOEXEC on the listener, SIGPIPE ignored,
SO_REUSEADDR; this daemon binds 127.0.0.1 only (the edge reaches it through the sites proxy), never forks, allocates
every buffer once before the accept loop (flat footprint), and answers GET /world/__telemetry/health for the deploy
probe. license_tier: ORIGINAL No hw writes (Rule 26).
dependencies 7 imports · 0 importers
imports: nx_syscalls.nxnx_http_server.nxnx_json_lib.nxnx_frame_pacing_lib.nxnx_world_capture_meta.nxnx_capture_append_lib.nxnx_gpu_capture_http_lib.nx
imported by: nobody (leaf or entry point)
structs
| none |
consts
| 33 | const WT_GPU_ROUTE:*u8="/world/__telemetry/gpu/v1" |
| 34 | const WT_GPU_PLANE:*u8="knowledge/store/gpu-capture-v1-" |
| 35 | const WT_PORT_DEFAULT: i64 = 18104 |
| 36 | const WT_BACKLOG: i64 = 16 |
| 37 | const WT_REQ_CAP: i64 = 65536 // NETWORK BODY BOUND -- refused loudly at 400 when exceeded, never trimmed |
| 38 | const WT_RESP_CAP: i64 = 262144 |
| 39 | const WT_WORLD_CAP: i64 = 64 |
| 41 | const WT_NUMBER_TEXT_CAP: i64 = 21 |
| 42 | const WT_ROW_CAP: i64 = (PF_N + FPC_COLS * 3) * WT_NUMBER_TEXT_CAP + WT_WORLD_CAP * 2 |
| 43 | const WT_TMO_S: i64 = 5 |
| 44 | const WT_ROUTE: *u8 = "/world/__telemetry" |
| 45 | const WT_ROUTE_V2: *u8 = "/world/__telemetry/v2" |
| 46 | const WT_SPINE_V2: *u8 = "/world/__telemetry/v2/spine" |
| 47 | const WT_PLANE_V2: *u8 = "knowledge/store/frametrace-v2-" |
| 48 | const WT_HEALTH: *u8 = "/world/__telemetry/health" |
| 49 | const WT_SPINE_ROUTE: *u8 = "/world/__telemetry/spine" |
| 50 | const WT_QUERY_W: *u8 = "w=" |
| 51 | const WT_METHOD_GET: i64 = 1 |
| 52 | const WT_METHOD_POST: i64 = 2 |
| 53 | const WT_HTTP_OK: i64 = 200 |
| 54 | const WT_HTTP_NOCONTENT: i64 = 204 |
| 55 | const WT_HTTP_BAD: i64 = 400 |
| 56 | const WT_HTTP_NOTFOUND: i64 = 404 |
| 57 | const WT_HTTP_UNAVAILABLE: i64 = 503 |
| 58 | const WT_CT_TEXT: *u8 = "text/plain; charset=utf-8" |
| 59 | const WT_CH_QMARK: i64 = 63 |
| 60 | const WT_CH_AMP: i64 = 38 |
| 61 | const WT_CH_TAB: i64 = 9 |
| 62 | const WT_CH_NL: i64 = 10 |
| 63 | const WT_CH_SLASH: i64 = 47 |
| 64 | const WT_CH_COLON: i64 = 58 |
| 65 | const WT_CH_COMMA: i64 = 44 |
| 66 | const WT_CH_UNDERSCORE: i64 = 95 |
| 67 | const WT_PARTIAL_HEAD: i64 = 256 |
| 69 | const WT_C_BEACONS: i64 = 0 |
| 70 | const WT_C_ROWS: i64 = 1 |
| 71 | const WT_C_REFUSED: i64 = 2 |
| 72 | const WT_C_DISAGREE: i64 = 3 |
| 73 | const WT_C_N: i64 = 4 |
functions
| 75 | func wt_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } |
| 76 | func wt_cat(d: *u8, o: i64, s: *u8) -> i64 { var i: i64 = 0; var p: i64 = o; while s[i] != (0 as u8) { d[p] = s[i]; p = p + 1; i = i + 1 } return p } |
| 77 | func wt_catn(d: *u8, o: i64, s: *u8, n: i64) -> i64 { var i: i64 = 0; var p: i64 = o; while i < n { d[p] = s[i]; p = p + 1; i = i + 1 } return p } |
| 78 | func wt_num(d: *u8, o: i64, v: i64) -> i64 |
| 91 | func wt_ch(d: *u8, o: i64, c: i64) -> i64 { d[o] = c as u8; return o + 1 } |
| 94 | func wt_route_len(req: *u8, off: i64, len: i64) -> i64 |
| 101 | func wt_route_is(req: *u8, off: i64, rlen: i64, lit: *u8) -> i64 |
| 109 | func wt_query_world(req: *u8, off: i64, len: i64, out: *u8, cap: i64) -> i64 |
| 138 | func wt_text(cfd: i64, code: i64, msg: *u8) -> i64 |
| 143 | func wt_body(cfd: i64, code: i64, body: *u8, n: i64) -> i64 |
| 149 | func wt_triple(d: *u8, o: i64, a: i64, b: i64, c: i64) -> i64 |
| 153 | func main(argc: i64, argv: *i64) -> i64 |