nx_asset_prov_lib.nx
buildroot/runtime/nx_asset_prov_lib.nx
about
nx_asset_prov_lib.nx -- THE PER-ASSET PROVENANCE ROW AND ITS FAIL-CLOSED VERDICT (/compare/modding MD9, 2026-09-06).
ONE rights table in this estate (knowledge/model_license.conf, read by nx_licgate_lib) and ONE journal of ingested assets:
a row is `asset<TAB>sha256<TAB>source<TAB>licence_id<TAB>origin<TAB>epoch`, APPEND-ONLY -- a later row for the same sha
SUPERSEDES the earlier one (a relicence is a new row, never an edit) and the LAST row wins. Field bytes are sanitised on
write (a tab or newline inside a source url becomes a space) so no caller can forge a licence column through a url.
THE VERDICT IS FAIL-CLOSED BY CONSTRUCTION: no journal or no row -> REFUSE (NO-JOURNAL / NO-ROW); a licence id the rights
table does not carry -> REFUSE (UNKNOWN-LICENCE), so "unknown" is never a table row, it is the absence of one; a licence
whose weights_redist right is NO -> REFUSE (NON-REDISTRIBUTABLE); CONDITIONAL -> REVIEW; an UNVERIFIED licence is capped
at CONDITIONAL, the same law nx_licgate_lib applies to models (a licence nobody read cannot grant an outright YES).
Every export and publish door asks pv_verdict in-process; PRIVATE USE IS ALWAYS ALLOWED (res[PV_RES_PRIVATE]=1) -- the
refusal is about redistribution, never about looking at what you downloaded.
The journal path is a PARAMETER: a gate drives this lib on its own scratch journal and never on the production one.
license_tier: ORIGINAL No hw writes (Rule 26).
dependencies 3 imports · 7 importers
imports: nx_syscalls.nxnx_licgate_lib.nxnx_sha256.nx
imported by: nx_asset_prov.nxnx_asset_prov_gate.nxnx_bundle_ingest.nxnx_bundle_ingest_cli_candidate_t144.nxnx_mesh2glb.nxnx_mesh2glb_neutral_candidate_t346.nxnx_mod_manifest_lib.nx
structs
| none |
consts
| 18 | const PV_JRNL_DEFAULT: *u8 = "knowledge/provenance/assets.jrnl" |
| 19 | const PV_DIR_MODE: i64 = 493 |
| 20 | const PV_FILE_MODE: i64 = 420 |
| 21 | const PV_OPEN_APPEND: i64 = 1089 // O_WRONLY | O_CREAT | O_APPEND |
| 22 | const PV_SYS_OPENAT: i64 = 257 |
| 23 | const PV_SYS_TIME: i64 = 201 |
| 24 | const PV_SHA_BYTES: i64 = 32 |
| 25 | const PV_SHA_HEX: i64 = 64 |
| 26 | const PV_TAG: *u8 = "asset" |
| 27 | const PV_TAB: i64 = 9 |
| 28 | const PV_NL: i64 = 10 |
| 29 | const PV_SPACE: i64 = 32 |
| 30 | const PV_SLASH: i64 = 47 |
| 31 | const PV_LIC_CAP: i64 = 128 |
| 32 | const PV_LINE_CAP: i64 = 4096 |
| 33 | const PV_PATH_CAP: i64 = 1024 |
| 34 | const PV_F_TAG: i64 = 0 |
| 35 | const PV_F_SHA: i64 = 1 |
| 36 | const PV_F_SOURCE: i64 = 2 |
| 37 | const PV_F_LIC: i64 = 3 |
| 38 | const PV_F_ORIGIN: i64 = 4 |
| 39 | const PV_F_EPOCH: i64 = 5 |
| 41 | const PV_R_OK: i64 = 0 |
| 42 | const PV_R_NO_ROW: i64 = 1 |
| 43 | const PV_R_UNKNOWN_LIC: i64 = 2 |
| 44 | const PV_R_NON_REDIST: i64 = 3 |
| 45 | const PV_R_CONDITIONAL: i64 = 4 |
| 46 | const PV_R_UNVERIFIED: i64 = 5 |
| 47 | const PV_R_TABLE_UNREADABLE: i64 = 6 |
| 48 | const PV_R_NO_JOURNAL: i64 = 7 |
| 49 | const PV_RES_REASON: i64 = 0 |
| 50 | const PV_RES_REDIST: i64 = 1 |
| 51 | const PV_RES_LICIDX: i64 = 2 |
| 52 | const PV_RES_PRIVATE: i64 = 3 |
| 53 | const PV_RES_ROWS: i64 = 4 |
| 54 | const PV_RES_N: i64 = 8 |
| 56 | const PV_BOX_BUF: i64 = 0 |
| 57 | const PV_BOX_S: i64 = 1 |
| 58 | const PV_BOX_E: i64 = 2 |
| 59 | const PV_BOX_ROWS: i64 = 3 |
| 60 | const PV_BOX_N: i64 = 4 |
functions
| 62 | func pv_len(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } |
| 63 | func pv_puts(s: *u8) -> i64 { sys_write(1, s, pv_len(s)); return 0 } |
| 64 | func pv_putn(v: i64) -> i64 { let t: *u8 = sys_mmap(32); var e: i64 = 0; if v < 0 { t[0] = 45 as u8; e = lg_putd(t, 1, 0 - v) } else { e = lg_putd(t, 0, v) } sys_write(1, t, e); return 0 } |
| 65 | func pv_hexdig(v: i64) -> u8 { if v < 10 { return (48 + v) as u8 } return (87 + v) as u8 } called by 1: pv_hex |
| 66 | func pv_hex(dig: *u8, out: *u8) -> i64 |
| 77 | func pv_hash_bytes(b: *u8, n: i64, out: *u8) -> i64 called by 7: pv_hash_filebic_provenancebix_mainbic_provenancebix_mainmg_provenance+1 calls 3: sys_mmapsha256_digestpv_hex |
| 83 | func pv_hash_file(path: *u8, out: *u8) -> i64 |
| 90 | func pv_now() -> i64 { return __syscall(PV_SYS_TIME, 0, 0, 0, 0, 0, 0) } |
| 91 | func pv_is_sha_hex(s: *u8) -> i64 |
| 105 | func pv_put_field(o: *u8, at: i64, s: *u8, cap: i64) -> i64 called by 1: pv_row_write |
| 118 | func pv_mkdir_of(jrnl: *u8) -> i64 |
| 131 | func pv_row_write(jrnl: *u8, sha: *u8, source: *u8, lic: *u8, origin: *u8, epoch: i64) -> i64 called by 4: mainmainbic_provenancebic_provenance calls 7: pv_mkdir_ofsys_mmaplg_putpv_put_fieldlg_putdsys_write+1 |
| 154 | func pv_row_find(jrnl: *u8, sha: *u8, box: *i64) -> i64 |
| 182 | func pv_field_copy(buf: *u8, s: i64, e: i64, idx: i64, out: *u8, cap: i64) -> i64 |
| 194 | func pv_verdict(jrnl: *u8, sha: *u8, res: *i64) -> i64 |
| 221 | func pv_verdict_name(rc: i64) -> *u8 |
| 226 | func pv_reason_name(r: i64) -> *u8 |
| 238 | func pv_print(sha: *u8, rc: i64, res: *i64) -> i64 |