code wiki / (root) / nx_uxf_cid.nx

nx_uxf_cid.nx

buildroot/runtime/nx_uxf_cid.nx

3173 B70 linesdepth 6pulls 6 transitivereach 71 importersview sourcekind librarytopic uxf
docsdependenciesstructsconstsfunctions

about

nx_uxf_cid.nx -- UXF arc R1c: the SELF-DESCRIBING multicodec/profile CID, built ON TOP of nx_canon_cid (do NOT touch the foundation -- Rule 19 additive, Rule 3 no patch cascade). The substrate spec (knowledge/specs/2026-06-09-tutoring-storage-substrate-rung1.md) defines CID = multihash + a multicodec(record-type) tag, but the shipped cid_of() omits the multicodec. This adds it. The profiled CID carries a PROFILE/codec id that is: (a) FOLDED INTO the hash -> same bytes under different profiles => different CID (no cross-profile collision; still fully content-addressed within a profile), AND (b) READABLE from the CID string -> an endpoint can pick the right view WITHOUT any out-of-band schema = Law-1 endpoint-adaptive ; new profiles = new codec ids with NO format change = Law-4 extensible (Rule 25: add an id, never a new format). Profiled CID: "nxc1-" <2hex codec> "-" <64hex sha256(codec_byte || canon_bytes)> NUL (len 72) No hardware/persistent writes (Rule 26). license_tier: ORIGINAL

dependencies 3 imports · 29 importers

nx_syscalls.nx nx_sha256.nx nx_canon_cid.nx nx_uxf_cid.nx nx_asset_record.nx nx_audio_gate.nx nx_benchmark_ref.nx nx_estate_search_lib.nx nx_fb2_book_gate.nx nx_lib_uxf_ingest.nx nx_library_exceed.nx nx_m4b_gate.nx nx_nmz.nx nx_nmz_author.nx

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

imports: nx_syscalls.nxnx_sha256.nxnx_canon_cid.nx

imported by: nx_asset_record.nxnx_audio_gate.nxnx_benchmark_ref.nxnx_estate_search_lib.nxnx_fb2_book_gate.nxnx_lib_uxf_ingest.nxnx_library_exceed.nxnx_m4b_gate.nxnx_nmz.nxnx_nmz_author.nxnx_nmz_comic_gate.nxnx_nmz_gate.nxnx_nmz_index.nxnx_nmz_native_gate.nxnx_nmz_pack.nxnx_uxf_cid_gate.nxnx_uxf_cid_test.nxnx_uxf_config_gate.nxnx_uxf_config_test.nxnx_uxf_corpus_migrate.nxnx_uxf_corpus_persist.nxnx_uxf_decode_gate.nxnx_uxf_decode_test.nxnx_uxf_media_asset_gate.nxnx_uxf_media_asset_test.nxnx_uxf_tsv_migrate.nxnx_uxf_tsv_persist.nxnx_uxf_tsv_persist_gate.nxnx_uxf_wms_bridge_test.nx

structs

none

consts

20const UXF_DATA: i64 = 1
21const UXF_DOC: i64 = 2
22const UXF_MEDIA: i64 = 3
23const UXF_CONFIG: i64 = 4
24const UXF_ARCHIVE: i64 = 5
25const UXF_SEARCH: i64 = 6 // a search answer (search rung E8, 2026-09-14): query, corpus, hits -- JSON and text are its projections
26const UXF_CID_LEN: i64 = 72 // the profiled CID's width, derived: 5 (nxc1-) + 2 (codec hex) + 1 (-) + 64 (sha256 hex); callers size cid buffers UXF_CID_LEN + 1

functions

28func uxf_nib_hex(v: i64) -> i64
called by 1: uxf_cid_profiled
33func uxf_hex_nib(b: i64) -> i64
called by 1: uxf_codec_of_cid
41func uxf_cid_profiled(codec: i64, canon: *u8, n: i64, cid: *u8) -> i64
64func uxf_codec_of_cid(cid: *u8) -> i64
called by 12: mainmainmainmainmainmain+6 calls 1: uxf_hex_nib