nx_assets_lib.nx
buildroot/runtime/nx_assets_lib.nx
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
imports: nx_syscalls.nxnx_costest_lib.nx
imported by: nx_assets_gate.nxnx_swcompare_lib.nx
structs
| none |
consts
| 35 | const FAS_I64: i64 = 8 |
| 36 | const FAS_STRIDE: i64 = 32 |
| 37 | const FAS_KEY_O: i64 = 0 |
| 38 | const FAS_KEY_L: i64 = 1 |
| 39 | const FAS_STATE_O: i64 = 2 |
| 40 | const FAS_STATE_L: i64 = 3 |
| 41 | const FAS_KIND_O: i64 = 4 |
| 42 | const FAS_KIND_L: i64 = 5 |
| 43 | const FAS_NAME_O: i64 = 6 |
| 44 | const FAS_NAME_L: i64 = 7 |
| 45 | const FAS_LIC_O: i64 = 8 |
| 46 | const FAS_LIC_L: i64 = 9 |
| 47 | const FAS_USED_O: i64 = 10 |
| 48 | const FAS_USED_L: i64 = 11 |
| 49 | const FAS_RUNG_O: i64 = 12 |
| 50 | const FAS_RUNG_L: i64 = 13 |
| 51 | const FAS_BASIS_O: i64 = 14 |
| 52 | const FAS_BASIS_L: i64 = 15 |
| 53 | const FAS_NOTE_O: i64 = 16 |
| 54 | const FAS_NOTE_L: i64 = 17 |
| 55 | const FAS_BYTES: i64 = 18 |
| 56 | const FAS_P10: i64 = 19 |
| 57 | const FAS_P50: i64 = 20 |
| 58 | const FAS_P90: i64 = 21 |
| 59 | const FAS_STATE: i64 = 22 |
| 60 | const FAS_KIND: i64 = 23 |
| 61 | const FAS_VERDICT: i64 = 24 |
| 62 | const FAS_RUNGST: i64 = 25 |
| 63 | const FAS_NF: i64 = 26 |
| 64 | const FAS_LINE: i64 = 27 |
| 66 | const FAS_TAG: *u8 = "asset" |
| 67 | const FAS_F_KEY: i64 = 1 |
| 68 | const FAS_F_STATE: i64 = 2 |
| 69 | const FAS_F_KIND: i64 = 3 |
| 70 | const FAS_F_NAME: i64 = 4 |
| 71 | const FAS_F_LIC: i64 = 5 |
| 72 | const FAS_F_BYTES: i64 = 6 |
| 73 | const FAS_F_USED: i64 = 7 |
| 74 | const FAS_F_RUNG: i64 = 8 |
| 75 | const FAS_F_P10: i64 = 9 |
| 76 | const FAS_F_P50: i64 = 10 |
| 77 | const FAS_F_P90: i64 = 11 |
| 78 | const FAS_F_BASIS: i64 = 12 |
| 79 | const FAS_F_NOTE: i64 = 13 |
| 80 | const FAS_NF_ROW: i64 = 14 |
| 81 | const FAS_MIN_ROW: i64 = 19 // "asset" plus thirteen pipes plus a newline: the shortest row, so bytes/19+1 bounds the count |
| 83 | const FAS_ST_BAD: i64 = 0 |
| 84 | const FAS_ST_RUNPATH: i64 = 1 |
| 85 | const FAS_ST_CANDIDATE: i64 = 2 |
| 86 | const FAS_ST_ORACLE: i64 = 3 |
| 87 | const FAS_ST_UNAVAILABLE: i64 = 4 |
| 88 | const FAS_ST_N: i64 = 5 |
| 90 | const FAS_K_BAD: i64 = 0 |
| 91 | const FAS_K_WEIGHTS: i64 = 1 |
| 92 | const FAS_K_FONT: i64 = 2 |
| 93 | const FAS_K_DATASET: i64 = 3 |
| 94 | const FAS_K_DOOR: i64 = 4 |
| 95 | const FAS_K_SPEC: i64 = 5 |
| 96 | const FAS_K_CARD: i64 = 6 |
| 97 | const FAS_K_N: i64 = 7 |
| 99 | const FAS_V_OK: i64 = 0 |
| 100 | const FAS_V_FIELDS: i64 = 1 |
| 101 | const FAS_V_BADSTATE: i64 = 2 |
| 102 | const FAS_V_BADKIND: i64 = 3 |
| 103 | const FAS_V_BADLIFT: i64 = 4 |
| 104 | const FAS_V_LIFTMISSING: i64 = 5 |
| 105 | const FAS_V_NORUNG: i64 = 6 |
| 106 | const FAS_V_BADRUNG: i64 = 7 |
| 107 | const FAS_V_N: i64 = 8 |
| 109 | const FAS_R_NONE: i64 = 0 |
| 110 | const FAS_R_LOCAL: i64 = 1 |
| 111 | const FAS_R_MISSING: i64 = 2 |
| 112 | const FAS_R_XBOARD: i64 = 3 |
| 114 | const FAS_T_ROWS: i64 = 0 |
| 115 | const FAS_T_ST0: i64 = 1 // + state code |
| 116 | const FAS_T_V0: i64 = 6 // + verdict code |
| 117 | const FAS_T_RP_BYTES: i64 = 14 |
| 118 | const FAS_T_RP_UNKNOWN: i64 = 15 |
| 119 | const FAS_T_RP_AGG: i64 = 16 // + CES_A_* (8 slots) |
| 120 | const FAS_T_CA_AGG: i64 = 24 // + CES_A_* (8 slots) |
| 121 | const FAS_T_DEFECTS: i64 = 32 |
| 122 | const FAS_T_XBOARD: i64 = 33 |
| 123 | const FAS_T_RP_PRICED: i64 = 34 |
| 124 | const FAS_T_CA_PRICED: i64 = 35 |
| 125 | const FAS_T_SLOTS: i64 = 40 |
| 126 | const FAS_CH_DASH: i64 = 45 |
| 127 | const FAS_CH_COLON: i64 = 58 |
| 128 | const FAS_CH_HASH: i64 = 35 |
| 129 | const FAS_CH_PIPE: i64 = 124 |
| 130 | const FAS_RUNG_TAG: *u8 = "rung" |
| 131 | const FAS_RUNG_F_ID: i64 = 1 |
functions
| 133 | func fas_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } |
| 134 | func fas_cap(bytes: i64) -> i64 { return bytes / FAS_MIN_ROW + 1 } called by 1: main |
| 136 | func fas_state_code(buf: *u8, off: i64, len: i64) -> i64 |
| 143 | func fas_kind_code(buf: *u8, off: i64, len: i64) -> i64 |
| 152 | func fas_state_name(c: i64) -> *u8 |
| 159 | func fas_kind_name(c: i64) -> *u8 |
| 168 | func fas_verdict_name(v: i64) -> *u8 |
| 179 | func fas_rungstate_name(r: i64) -> *u8 |
| 188 | func fas_span_has_colon(buf: *u8, off: i64, len: i64) -> i64 called by 1: fas_load |
| 195 | func fas_take(buf: *u8, p: i64, e: i64, k: i64, tab: *i64, b: i64, oslot: i64, lslot: i64, off: *i64) -> i64 |
| 204 | func fas_load(buf: *u8, n: i64, tab: *i64, cap: i64) -> i64 |
| 296 | func fas_plan_has_rung(plan: *u8, pn: i64, buf: *u8, roff: i64, rlen: i64) -> i64 |
| 317 | func fas_judge_rungs(tab: *i64, rows: i64, buf: *u8, plan: *u8, pn: i64) -> i64 |
| 335 | func fas_totals(tab: *i64, rows: i64, out: *i64) -> i64 |
| 382 | func fas_state_sum(out: *i64) -> i64 called by 1: main |
| 388 | func fas_verdict_sum(out: *i64) -> i64 called by 1: main |