code wiki / (root) / nx_tools_api_serve.nx

nx_tools_api_serve.nx

buildroot/runtime/nx_tools_api_serve.nx

11717 B162 linesdepth 10pulls 27 transitivereach 0 importersview sourcekind servicetopic tools
docsdependenciesstructsconstsfunctions

about

nx_tools_api_serve.nx -- standalone loopback HTTP server for the R0 agent-facing API (nx_tools_api). Composes nx_http_server (bind/listen/accept, loopback-default) + nx_tools_api (ta_handle). ADDITIVE + ISOLATED: a NEW service on a caller-chosen port that touches NOTHING existing -> never-brick by construction. nx_tools_api_serve serve [port] -- bootstrap-register a few real tools (idempotent), then accept-loop nx_tools_api_serve probe <port> <p> -- sovereign plain-HTTP GET client (self-test the live round-trip) license_tier: ORIGINAL

dependencies 3 imports · 0 importers

nx_http_server.nx nx_connect.nx nx_api_edge.nx nx_tools_api_serve.nx

imports: nx_http_server.nxnx_connect.nxnx_api_edge.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main tsv_puts ta_streq_n tsv_atoi_cstr tsv_serve sys_ignore_sigpipe sys_mmap tsv_seed tool_register tool_register_pfx tr_cat tr_tab reg_put reg_put_x nx_http_server_addr_loopba nx_http_server_make_sockad nx_http_server_listen_hot sys_ignore_sigpipe ↻ sys_socket sys_mmap ↻ sys_setsockopt sys_bind sys_close sys_listen tsv_puts ↻ ta_catn ta_cat sys_wait4 nx_http_server_accept_one sys_accept sys_fork tsv_serve_one sys_read nx_api_edge_handle sys_mmap ↻ ta_reqline ta_streq_n ↻ ta_cat ↻ edge_origin_allowed edge_find_header

structs

none

consts

10const TSV_MAGIC_2048: i64 = 2048
12const TSV_PORT_DEFAULT: i64 = 8799
13const TSV_REQ_CAP: i64 = 65536
14const TSV_RESP_CAP: i64 = 1048576
55const TSV_MAXKIDS: i64 = 16
56const TSV_WNOHANG: i64 = 1

functions

16func tsv_puts(s: *u8) -> i64 { sys_write(1, s, ta_slen(s)); return 0 }
17func tsv_atoi_cstr(s: *u8) -> i64 { return tr_atoi(s, 0, ta_slen(s)) }
called by 1: main
21func tsv_seed() -> i64
called by 1: tsv_serve calls 1: tool_register
59func tsv_serve_one(cfd: i64, req: *u8, out: *u8) -> i64
68func tsv_serve(port: i64) -> i64
122func tsv_probe(port: i64, path: *u8) -> i64
146func main(argc: i64, argv: *i64) -> i64