code wiki / (root) / nx_tools_api_serve.nx

nx_tools_api_serve.nx

buildroot/runtime/nx_tools_api_serve.nx

25023 B347 linesdepth 10pulls 36 transitivereach 2 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 · 2 importers

nx_http_server.nx nx_connect.nx nx_api_edge.nx nx_tools_api_serve.nx nx_tools_listener_child_gate.nx nx_tools_timing_serve_gate.nx

imports: nx_http_server.nxnx_connect.nxnx_api_edge.nx

imported by: nx_tools_listener_child_gate.nxnx_tools_timing_serve_gate.nx

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

main tsv_puts tsv_atoi_cstr tsv_serve nx_http_server_addr_loopba nx_http_server_make_sockad nx_http_server_listen_hot sys_ignore_sigpipe sys_mmap nxa_die sys_write sys_exit nxa_lock_take nxa_lock_addr sys_write ↻ nxa_lock_give nxa_lock_addr ↻ nxa_report_overrun sys_write ↻ nxa_dump_printable nxa_dump_sizes sys_socket sys_mmap ↻ sys_setsockopt sys_bind sys_close sys_listen tsv_puts ↻ tsv_seed tool_register tool_register_pfx tr_cat tr_tab reg_put reg_put_x tsv_load_reserve nx_http_server_accept_one sys_accept tsv_serve_child tsv_serve_one

structs

none

consts

10const TSV_MAGIC_2048: i64 = 2048
12const TSV_PORT_DEFAULT: i64 = 8799
21const TSV_REQ_CAP: i64 = 65536
22const TSV_RESP_CAP: i64 = 1048576
23const TSV_RESERVE_CONF: *u8 = "knowledge/tools_req_reserve.conf" as *u8
64const TSV_MAXKIDS: i64 = 16
65const TSV_WNOHANG: i64 = 1
73const TSV_BACKLOG: i64 = 64

functions

25func tsv_puts(s: *u8) -> i64 { sys_write(1, s, ta_slen(s)); return 0 }
26func tsv_atoi_cstr(s: *u8) -> i64 { return tr_atoi(s, 0, ta_slen(s)) }
called by 1: main
30func tsv_seed() -> i64
called by 1: tsv_serve calls 1: tool_register
80func tsv_load_reserve() -> i64
called by 1: tsv_serve
109func tsv_emit_413(out: *u8, limit: i64, received: i64) -> i64
called by 1: tsv_serve_one
124func tsv_serve_one(cfd: i64, req: *u8, out: *u8, reserve: i64) -> i64
167func tsv_serve_child(lfd: i64, cfd: i64, req: *u8, out: *u8, reserve: i64) -> i64
called by 2: tsv_servemain calls 1: tsv_serve_one
174func tsv_serve(port: i64) -> i64
307func tsv_probe(port: i64, path: *u8) -> i64
331func main(argc: i64, argv: *i64) -> i64