code wiki / (root) / nx_world_telemetry.nx

nx_world_telemetry.nx

buildroot/runtime/nx_world_telemetry.nx

25879 B390 linesdepth 8pulls 22 transitivereach 0 importersview sourcekind orphan librarytopic world
docsdependenciesstructsconstsfunctions

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

nx_syscalls.nx nx_http_server.nx nx_json_lib.nx nx_frame_pacing_lib.nx nx_world_capture_meta.nx nx_capture_append_lib.nx nx_gpu_capture_http_lib.nx nx_world_telemetry.nx

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

33const WT_GPU_ROUTE:*u8="/world/__telemetry/gpu/v1"
34const WT_GPU_PLANE:*u8="knowledge/store/gpu-capture-v1-"
35const WT_PORT_DEFAULT: i64 = 18104
36const WT_BACKLOG: i64 = 16
37const WT_REQ_CAP: i64 = 65536 // NETWORK BODY BOUND -- refused loudly at 400 when exceeded, never trimmed
38const WT_RESP_CAP: i64 = 262144
39const WT_WORLD_CAP: i64 = 64
41const WT_NUMBER_TEXT_CAP: i64 = 21
42const WT_ROW_CAP: i64 = (PF_N + FPC_COLS * 3) * WT_NUMBER_TEXT_CAP + WT_WORLD_CAP * 2
43const WT_TMO_S: i64 = 5
44const WT_ROUTE: *u8 = "/world/__telemetry"
45const WT_ROUTE_V2: *u8 = "/world/__telemetry/v2"
46const WT_SPINE_V2: *u8 = "/world/__telemetry/v2/spine"
47const WT_PLANE_V2: *u8 = "knowledge/store/frametrace-v2-"
48const WT_HEALTH: *u8 = "/world/__telemetry/health"
49const WT_SPINE_ROUTE: *u8 = "/world/__telemetry/spine"
50const WT_QUERY_W: *u8 = "w="
51const WT_METHOD_GET: i64 = 1
52const WT_METHOD_POST: i64 = 2
53const WT_HTTP_OK: i64 = 200
54const WT_HTTP_NOCONTENT: i64 = 204
55const WT_HTTP_BAD: i64 = 400
56const WT_HTTP_NOTFOUND: i64 = 404
57const WT_HTTP_UNAVAILABLE: i64 = 503
58const WT_CT_TEXT: *u8 = "text/plain; charset=utf-8"
59const WT_CH_QMARK: i64 = 63
60const WT_CH_AMP: i64 = 38
61const WT_CH_TAB: i64 = 9
62const WT_CH_NL: i64 = 10
63const WT_CH_SLASH: i64 = 47
64const WT_CH_COLON: i64 = 58
65const WT_CH_COMMA: i64 = 44
66const WT_CH_UNDERSCORE: i64 = 95
67const WT_PARTIAL_HEAD: i64 = 256
69const WT_C_BEACONS: i64 = 0
70const WT_C_ROWS: i64 = 1
71const WT_C_REFUSED: i64 = 2
72const WT_C_DISAGREE: i64 = 3
73const WT_C_N: i64 = 4

functions

75func wt_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
76func 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 }
77func 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 }
78func wt_num(d: *u8, o: i64, v: i64) -> i64
91func wt_ch(d: *u8, o: i64, c: i64) -> i64 { d[o] = c as u8; return o + 1 }
94func wt_route_len(req: *u8, off: i64, len: i64) -> i64
101func wt_route_is(req: *u8, off: i64, rlen: i64, lit: *u8) -> i64
109func wt_query_world(req: *u8, off: i64, len: i64, out: *u8, cap: i64) -> i64
138func wt_text(cfd: i64, code: i64, msg: *u8) -> i64
143func wt_body(cfd: i64, code: i64, body: *u8, n: i64) -> i64
149func wt_triple(d: *u8, o: i64, a: i64, b: i64, c: i64) -> i64
153func main(argc: i64, argv: *i64) -> i64