code wiki / (root) / nx_assets_lib.nx

nx_assets_lib.nx

buildroot/runtime/nx_assets_lib.nx

17804 B393 linesdepth 3pulls 3 transitivereach 33 importersview sourcekind library
docsdependenciesstructsconstsfunctions

about

nx_assets_lib.nx -- THE ONE READER of <dom>.assets (2026-09-16): every FOREIGN ASSET a board's run path or candidate arms depend on, as data, with its licence, its bytes, where it is used, the rung that replaces it with ours, and the three-point lift to get there. WHY. Operator 2026-09-16, after choosing "open weights now, ours over time": "yes if we need 3rd party today then id like to know via the /compare capabilities what the lift would be to replace a 3rd party we are using thats open source etc with our own in cost" -- "the goal always being a reduction in 3rd parties from the first byte up but a focus on capability". The sovereignty ledger (nx_selfsuff) measures outside HOSTS and CARRIERS from what the code dials; it has no row for a DATA asset the code reads -- a model's weights, a font, a benchmark corpus, a vendor driver behind a door -- and those are exactly the foreign bytes the standing order admits ("DATA assets are the only foreign bytes allowed inside, and each carries its license beside it"). This lib gives them a row, a state, and a price. ROW (14 fields, no pipes in prose): asset|<key>|<state>|<kind>|<name>|<licence>|<bytes>|<used_by>|<rung>|<p10>|<p50>|<p90>|<basis>|<note> state: runpath (read by an organ on the serving or scoring lane today) | candidate (a licensed asset the board intends to run on the sovereign engines, not yet in the run path) | oracle (a benchmark or reference outside the build and run path, never a dependency) | unavailable (named by the field but not obtainable: a licence tag over an empty repository is the honest example) kind: weights | font | dataset | door | spec | card bytes: the measured size, or - when not measured (counted as UNKNOWN, never as zero) rung: the plan rung that replaces the asset with ours; <dom>:<rung> for a rung on another board (XBOARD, not verifiable here); - is a DEFECT on a runpath or candidate row (NORUNG: a foreign asset with no path to replacing it is what this ledger exists to expose) and correct on an oracle row p10 p50 p90: the lift in u (the board's own unit, one fractional digit) to land the replacement rung; - on an oracle or unavailable row; on a runpath or candidate row a missing lift is LIFT-MISSING basis: the components the estimate was built from (named, so a reader can dispute one) One verdict per row, the first failing rule wins: OK FIELDS BADSTATE BADKIND BADLIFT LIFT-MISSING NORUNG BADRUNG. Totals partition by state and by verdict and both partitions SUM to rows; the run-path lift is aggregated through nx_costest_lib ces_agg3 (root-sum-square band beside the correlated sum). license_tier: ORIGINAL No hw writes (Rule 26).

dependencies 2 imports · 2 importers

nx_syscalls.nx nx_costest_lib.nx nx_assets_lib.nx nx_assets_gate.nx nx_swcompare_lib.nx

imports: nx_syscalls.nxnx_costest_lib.nx

imported by: nx_assets_gate.nxnx_swcompare_lib.nx

structs

none

consts

35const FAS_I64: i64 = 8
36const FAS_STRIDE: i64 = 32
37const FAS_KEY_O: i64 = 0
38const FAS_KEY_L: i64 = 1
39const FAS_STATE_O: i64 = 2
40const FAS_STATE_L: i64 = 3
41const FAS_KIND_O: i64 = 4
42const FAS_KIND_L: i64 = 5
43const FAS_NAME_O: i64 = 6
44const FAS_NAME_L: i64 = 7
45const FAS_LIC_O: i64 = 8
46const FAS_LIC_L: i64 = 9
47const FAS_USED_O: i64 = 10
48const FAS_USED_L: i64 = 11
49const FAS_RUNG_O: i64 = 12
50const FAS_RUNG_L: i64 = 13
51const FAS_BASIS_O: i64 = 14
52const FAS_BASIS_L: i64 = 15
53const FAS_NOTE_O: i64 = 16
54const FAS_NOTE_L: i64 = 17
55const FAS_BYTES: i64 = 18
56const FAS_P10: i64 = 19
57const FAS_P50: i64 = 20
58const FAS_P90: i64 = 21
59const FAS_STATE: i64 = 22
60const FAS_KIND: i64 = 23
61const FAS_VERDICT: i64 = 24
62const FAS_RUNGST: i64 = 25
63const FAS_NF: i64 = 26
64const FAS_LINE: i64 = 27
66const FAS_TAG: *u8 = "asset"
67const FAS_F_KEY: i64 = 1
68const FAS_F_STATE: i64 = 2
69const FAS_F_KIND: i64 = 3
70const FAS_F_NAME: i64 = 4
71const FAS_F_LIC: i64 = 5
72const FAS_F_BYTES: i64 = 6
73const FAS_F_USED: i64 = 7
74const FAS_F_RUNG: i64 = 8
75const FAS_F_P10: i64 = 9
76const FAS_F_P50: i64 = 10
77const FAS_F_P90: i64 = 11
78const FAS_F_BASIS: i64 = 12
79const FAS_F_NOTE: i64 = 13
80const FAS_NF_ROW: i64 = 14
81const FAS_MIN_ROW: i64 = 19 // "asset" plus thirteen pipes plus a newline: the shortest row, so bytes/19+1 bounds the count
83const FAS_ST_BAD: i64 = 0
84const FAS_ST_RUNPATH: i64 = 1
85const FAS_ST_CANDIDATE: i64 = 2
86const FAS_ST_ORACLE: i64 = 3
87const FAS_ST_UNAVAILABLE: i64 = 4
88const FAS_ST_N: i64 = 5
90const FAS_K_BAD: i64 = 0
91const FAS_K_WEIGHTS: i64 = 1
92const FAS_K_FONT: i64 = 2
93const FAS_K_DATASET: i64 = 3
94const FAS_K_DOOR: i64 = 4
95const FAS_K_SPEC: i64 = 5
96const FAS_K_CARD: i64 = 6
97const FAS_K_N: i64 = 7
99const FAS_V_OK: i64 = 0
100const FAS_V_FIELDS: i64 = 1
101const FAS_V_BADSTATE: i64 = 2
102const FAS_V_BADKIND: i64 = 3
103const FAS_V_BADLIFT: i64 = 4
104const FAS_V_LIFTMISSING: i64 = 5
105const FAS_V_NORUNG: i64 = 6
106const FAS_V_BADRUNG: i64 = 7
107const FAS_V_N: i64 = 8
109const FAS_R_NONE: i64 = 0
110const FAS_R_LOCAL: i64 = 1
111const FAS_R_MISSING: i64 = 2
112const FAS_R_XBOARD: i64 = 3
114const FAS_T_ROWS: i64 = 0
115const FAS_T_ST0: i64 = 1 // + state code
116const FAS_T_V0: i64 = 6 // + verdict code
117const FAS_T_RP_BYTES: i64 = 14
118const FAS_T_RP_UNKNOWN: i64 = 15
119const FAS_T_RP_AGG: i64 = 16 // + CES_A_* (8 slots)
120const FAS_T_CA_AGG: i64 = 24 // + CES_A_* (8 slots)
121const FAS_T_DEFECTS: i64 = 32
122const FAS_T_XBOARD: i64 = 33
123const FAS_T_RP_PRICED: i64 = 34
124const FAS_T_CA_PRICED: i64 = 35
125const FAS_T_SLOTS: i64 = 40
126const FAS_CH_DASH: i64 = 45
127const FAS_CH_COLON: i64 = 58
128const FAS_CH_HASH: i64 = 35
129const FAS_CH_PIPE: i64 = 124
130const FAS_RUNG_TAG: *u8 = "rung"
131const FAS_RUNG_F_ID: i64 = 1

functions

133func fas_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
134func fas_cap(bytes: i64) -> i64 { return bytes / FAS_MIN_ROW + 1 }
called by 1: main
136func fas_state_code(buf: *u8, off: i64, len: i64) -> i64
called by 1: fas_load calls 1: ces_span_is
143func fas_kind_code(buf: *u8, off: i64, len: i64) -> i64
called by 1: fas_load calls 1: ces_span_is
152func fas_state_name(c: i64) -> *u8
159func fas_kind_name(c: i64) -> *u8
168func fas_verdict_name(v: i64) -> *u8
179func fas_rungstate_name(r: i64) -> *u8
188func fas_span_has_colon(buf: *u8, off: i64, len: i64) -> i64
called by 1: fas_load
195func fas_take(buf: *u8, p: i64, e: i64, k: i64, tab: *i64, b: i64, oslot: i64, lslot: i64, off: *i64) -> i64
called by 1: fas_load calls 1: ces_field
204func fas_load(buf: *u8, n: i64, tab: *i64, cap: i64) -> i64
296func fas_plan_has_rung(plan: *u8, pn: i64, buf: *u8, roff: i64, rlen: i64) -> i64
317func fas_judge_rungs(tab: *i64, rows: i64, buf: *u8, plan: *u8, pn: i64) -> i64
called by 1: main calls 1: fas_plan_has_rung
335func fas_totals(tab: *i64, rows: i64, out: *i64) -> i64
called by 1: main calls 2: sys_mmapces_agg3
382func fas_state_sum(out: *i64) -> i64
called by 1: main
388func fas_verdict_sum(out: *i64) -> i64
called by 1: main