code wiki / _hdl_build / nx_connect_api_lib.nx

nx_connect_api_lib.nx

buildroot/runtime/_hdl_build/nx_connect_api_lib.nx

20182 B368 linesdepth 3pulls 12 transitivereach 2 importersview sourcekind librarytopic connect
docsdependenciesstructsconstsfunctions

about

nx_connect_api_lib.nx -- the CONNECT FRONT DOOR: one stateless verb dispatcher over all 8 capability engines, emitting versioned JSON. This is what makes CONNECT MCP-ready, API-ready, agent-ready, workflow-ready, and horizontally scalable in ONE surface: * OBJECT-ORIENTED: the 8 `nx_connect_*_lib.nx` organs ARE the objects -- each encapsulates one capability's state contract and operations (single responsibility). THIS file is the facade/registry over them; it owns no capability logic, only routing + serialization. * MCP + API: a thin CLI (nx_connect_api.nx) wraps ca_dispatch and is registered via POST /api/tools/register, so it appears as mcp__nishi__nx_connect and is drivable over the mgmt API. * AGENTIC + WORKFLOW: the `help` verb returns a machine-readable catalog of every verb and its argument shape, so an agent or a Workflow can DISCOVER the interface at runtime instead of being told it. * SCALE: every verb is a PURE function of its arguments -- no shared mutable state, no session, no disk. Any number of calls run independently and in parallel; the tool can be replicated with zero coordination. * CONTRACT STABILITY (rule 19): every response carries {"v":1,...}; new fields are additive. * STRUCTURED ERRORS (rule 6): a bad call returns {"ok":0,"error":<slug>,"detail":<human>}, never a crash. PURE CORE: no main (so the gate imports it and drives ca_dispatch with synthetic argv). license_tier: ORIGINAL

dependencies 10 imports · 2 importers

nx_connect_match_lib.nx nx_connect_lds_reconnect_lib.nx nx_connect_youth_lib.nx nx_connect_wards_lib.nx nx_connect_lanes_lib.nx nx_connect_events_lib.nx nx_connect_polls_lib.nx nx_connect_group_lib.nx nx_connect_graph_lib.nx nx_mt_multi.nx nx_connect_api_lib.nx nx_connect_api.nx nx_connect_api_gate.nx

imports: nx_connect_match_lib.nxnx_connect_lds_reconnect_lib.nxnx_connect_youth_lib.nxnx_connect_wards_lib.nxnx_connect_lanes_lib.nxnx_connect_events_lib.nxnx_connect_polls_lib.nxnx_connect_group_lib.nxnx_connect_graph_lib.nxnx_mt_multi.nx

imported by: nx_connect_api.nxnx_connect_api_gate.nx

structs

none

consts

28const CA_MAGIC_4096: i64 = 4096
29const CA_MAGIC_4095: i64 = 4095
31const CA_VER: i64 = 1
32const CA_LANG_MAX: i64 = 4 // MM_EN=0 MM_RU=1 MM_BE=2 MM_UK=3 MM_PL=4

functions

35func ca_slen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n }
36func ca_puts(o: *u8, off: i64, s: *u8) -> i64 { var p: i64=off; var i: i64=0; while s[i]!=(0 as u8){o[p]=s[i]; p=p+1; i=i+1} return p }
38func ca_putn(o: *u8, off: i64, v: i64) -> i64
49func ca_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 }
called by 1: ca_dispatch
51func ca_atoi(s: *u8) -> i64
called by 1: ca_ia
61func ca_ia(argv: *i64, argc: i64, i: i64) -> i64 { if i>=argc { return 0 } return ca_atoi(argv[i] as *u8) }
64func ca_open(o: *u8, off: i64, verb: *u8) -> i64
73func ca_err(o: *u8, off: i64, verb: *u8, slug: *u8, detail: *u8) -> i64
86func ca_esc_json(o: *u8, off: i64, s: *u8) -> i64
called by 1: ca_v_translate
100func ca_kv(o: *u8, off: i64, key: *u8, v: i64) -> i64
109func ca_help(o: *u8, off: i64) -> i64
called by 1: ca_dispatch calls 2: ca_openca_puts
129func ca_v_graph(o: *u8, off: i64, argv: *i64, argc: i64) -> i64
147func ca_v_translate(o: *u8, off: i64, argv: *i64, argc: i64) -> i64
170func ca_v_match(o: *u8, off: i64, argv: *i64, argc: i64) -> i64
182func ca_v_reconnect(o: *u8, off: i64, argv: *i64, argc: i64) -> i64
198func ca_v_lane(o: *u8, off: i64, argv: *i64, argc: i64) -> i64
210func ca_v_youth(o: *u8, off: i64, argv: *i64, argc: i64) -> i64
220func ca_v_wards(o: *u8, off: i64, argv: *i64, argc: i64) -> i64
240func ca_v_events(o: *u8, off: i64, argv: *i64, argc: i64) -> i64
292func ca_v_poll(o: *u8, off: i64, argv: *i64, argc: i64) -> i64
327func ca_v_group(o: *u8, off: i64, argv: *i64, argc: i64) -> i64
352func ca_dispatch(argc: i64, argv: *i64, out: *u8) -> i64