code wiki / (root) / nx_extllm_call.nx

nx_extllm_call.nx

buildroot/runtime/nx_extllm_call.nx

25515 B455 linesdepth 19pulls 129 transitivereach 0 importersview sourcekind tooltopic extllm
docsdependenciesstructsconstsfunctions

about

nx_extllm_call.nx -- RUNG XL3: the ONLY door through which estate bytes may reach an external model. Every conjunct is checked BEFORE a socket is opened, and each refusal names the rule that fired. 1 TERMS xl_use_verdict on the pinned provider ledger. UNKNOWN refuses. An unpinned row admits nothing. 2 CLASSIFY every prompt byte must come from a file the operator DECLARED public, and whose sha256 still matches that declaration. C by default; a stale hash admits nothing. 3 KEY read from a FILE, never argv -- argv is visible in /proc and in every transcript. 4 CALL our own TLS 1.3 + Mozilla trust store, the same send/recv core the InnerTube POST path uses. 5 LEDGER one appended row per call, so "how much has provider P seen, in total, across all time?" is a read and not an investigation. This is the half a per-call check structurally cannot do. The request sets provider.data_collection=deny and zdr=true, which the router documents as a per-request switch -- belt and braces beside the terms row, never instead of it. license_tier: ORIGINAL No hw writes (Rule 26). exit 0 ALLOW / 1 REFUSE / 3 UNKNOWN / 2 usage / 4 transport

dependencies 14 imports · 0 importers

nx_extllm_lib.nx nx_estate_path.nx nx_sha256.nx nx_sovjson_lib.nx nx_gate_verdict.nx nx_x509_trust_store.nx nx_trust_store_load_from_certdata. nx_tls13_client_validate_certifica nx_tls13_client_session_run.nx nx_https_url_for_fetch.nx nx_extllm_call.nx

diagram shows first 10 each side; +4 more imports, +0 more importers in the complete lists below.

imports: nx_extllm_lib.nxnx_estate_path.nxnx_sha256.nxnx_sovjson_lib.nxnx_gate_verdict.nxnx_x509_trust_store.nxnx_trust_store_load_from_certdata.nxnx_tls13_client_validate_certificate.nxnx_tls13_client_session_run.nxnx_https_url_for_fetch.nxnx_https_url_connect.nxnx_https_get_complete.nxnx_http_response_parse.nxnx_syscalls.nx

imported by: nobody (leaf or entry point)

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

main xc_w sj_werr sys_write sys_exit sj_lit_eq sj_vlen 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 sys_write ↻ nxa_dump_sizes sys_write ↻ xl_call sys_mmap ↻ xc_read_estate sys_mmap ↻ ep_artifact_path sys_openat_rd sys_close ep_join sys_read_file sys_openat_rd ↻ sys_lseek sys_mmap ↻ sys_read sys_munmap sys_close ↻ xl_terms_path xc_w ↻ xl_use_verdict

structs

none

consts

28const XC_RESP_CAP: i64 = 262144
29const XC_REQ_CAP: i64 = 65536
30const XC_PROMPT_CAP: i64 = 16384
31const XC_KEY_CAP: i64 = 4096
32const XC_PATH_CAP: i64 = 1024
33const XC_DIGEST_BYTES: i64 = 32
34const XC_HEX_PER_BYTE: i64 = 2
35const XC_CERT_ROOTS_MIN: i64 = 300
36const XC_CERT_ARENA: i64 = 4194304
37const XC_SOCK_TIMEOUT_S: i64 = 30
38const XC_TLS_RAND_BYTES: i64 = 32
39const XC_ESC_PROMPT: i64 = 12000
40const XC_ESC_FIELD: i64 = 128
41const XC_USAGE: i64 = 2
42const XC_TRANSPORT: i64 = 4
43const XC_ASCII_0: i64 = 48
44const XC_ASCII_a_MINUS_10: i64 = 87
45const XC_NIBBLE_HI_SHIFT: i64 = 16
46const XC_NIBBLE_MASK: i64 = 15
49const XC_LEDGER_MODE: i64 = 420
50const XC_HDR_SLOTS: i64 = 128
51const XC_BODY_CHUNKED: i64 = 2
52const XC_HTTP_OK: i64 = 200
58const XC_PROVIDER_REFUSED: i64 = 5
135const XC_BYTE_SLASH: i64 = 47
164const XE_EP_PROVIDER: i64 = 0
165const XE_EP_HOST: i64 = 1
166const XE_EP_PATH: i64 = 2
167const XE_EP_AUTHHDR: i64 = 3
168const XE_EP_AUTHSCHEME: i64 = 4
169const XE_EP_COLS: i64 = 6
170const XE_URL_CAP: i64 = 512

functions

60func xc_w(s: *u8) -> i64 { return sj_werr(s) }
called by 2: xl_callmain calls 1: sj_werr
63func xc_hex(dig: *u8, out: *u8) -> i64
called by 1: xc_pin_of
78func xc_pin_of(buf: *u8, n: i64, out: *u8) -> i64
called by 1: xl_call calls 3: sys_mmapsha256_digestxc_hex
86func xc_trim(buf: *u8, n: i64) -> i64
called by 1: xl_call
99func xc_read_estate(p: *u8, out_len: *i64) -> *u8
106func xc_ledger_row(out: *u8, provider: *u8, tier: *u8, subsystem: *u8, bytes: i64, pin: *u8, verdict: *u8) -> i64
120func xc_ledger_append(path: *u8, row: *u8, n: i64) -> i64
136func xc_keypath_outside_estate(p: *u8) -> i64
called by 1: xl_call
151func xc_skip_ws(b: *u8, n: i64) -> i64
called by 1: xl_call
172func xc_endpoint_path() -> *u8 { return "knowledge/extllm_endpoint.conf" as *u8 }
called by 1: xl_call
174func xc_ep_row(q: *u8, n: i64, provider: *u8, out: *i64) -> i64
192func xc_ep_field(q: *u8, ls: i64, le: i64, col: i64, out: *u8) -> i64
called by 1: xl_call calls 2: sys_mmapxl_col
204func xl_call(provider: *u8, tier: *u8, model: *u8, prompt_path: *u8, keypath: *u8,
377func xc_selftest() -> i64
421func main(argc: i64, argv: *i64) -> i64