nx_asset_signals.nx
buildroot/runtime/nx_asset_signals.nx
about
nx_asset_signals.nx -- "WHAT WE NEED TO DO" pillar (R4 of the universal organization-tooling arc).
Derives TASK SIGNALS from CATALOG STATE -- "what to do" is not a hand-maintained list, it is a set of
PREDICATES evaluated over the inventory snapshot (org_research.tsv CONFIRMED: task-signals-derived,
dam-lifecycle). A signal is a deterministic fact about a record that implies follow-up work
(provenance missing, untagged, metadata gap, near-duplicate, stale, orphaned, un-transcoded). The
derived signals are then EMITTED as work items into a DEDICATED, NAMESPACED workstream store so the
live 1265-stream production board (prefix "knowledge/store/ws-") is NEVER disturbed (ADDITIVE law #13).
ZERO NEW STORAGE / ZERO NEW IDENTITY / ZERO NEW CRYPTO -- pure COMPOSITION (Rule 15, DRY):
* catalog enumeration + bytes -> nx_asset_catalog (cat_list / cat_get / cat_count)
* record field access -> nx_asset_record (ar_decode / ar_get : tags, is_current,
relations, type, width, height,
encoding_format, lifecycle_stage)
* cryptographic provenance check -> nx_asset_provenance(prov_verify : a record HAS a verifiable
R2 credential iff prov_verify==1)
* perceptual near-dup grouping -> nx_asset_autotag (at_neardup over per-record dHashes)
* work-item write/list (NAMESPACED)-> nx_seg_store (ss_get / ss_begin / ss_add / ss_commit /
ss_open / ss_hget) into a DEDICATED prefix
WMS WIRING / PRODUCTION CUTOVER SEAM:
The emitted work items use the EXACT record contract of nx_workstream_store (key "sig:<cid>:<code>",
a TAB-separated value record, and a "ws:ids" enumeration index), written over the SAME substrate the
WMS itself is built on (ss_*). We do NOT import nx_workstream_store directly: it lives in
runtime/_hdl_build/ and the sovereign import resolver resolves transitive imports relative to the
importing file's directory, so a runtime/ organ cannot reach a _hdl_build/ organ (verified: importing
it -> "expand_imports failed"). Emitting straight onto ss_* with the dedicated prefix is therefore
the clean isolation: the live board store (WS_PREFIX="knowledge/store/ws-") is a DIFFERENT store and
is never opened, read, or written here. THE CUTOVER: when the signals organ is co-located with the
WMS (move both under one dir, or expose nx_workstream_store from runtime/), as_emit's ss_* calls map
1:1 onto ws_put_p(AS_PREFIX(), key, val) and as_list onto ws_manifest_p(AS_PREFIX(), ...) -- same
keys, same TAB record, same ws:ids index -- so the production daemon can adopt them unchanged.
PURITY: as_scan is a pure/deterministic function of the catalog snapshot PLUS caller-supplied parallel
auxiliary arrays (perceptual hashes + provenance credentials), because two of the seven predicates
CANNOT be answered from the record bytes alone and we refuse to fabricate the answer (Rule 4 / honesty):
* NEAR_DUP needs a PERCEPTUAL fingerprint -- the record stores none (a dHash is over the pixels, the
decode step is the caller's, per nx_asset_autotag's documented boundary). phashes[i] is record i's
dHash, or 0 to mean "no fingerprint available -> cannot be a near-dup".
* MISSING_PROVENANCE needs the record's CREDENTIAL + the trusted platform pubkey -- a record alone is
dependencies 6 imports · 3 importers
imports: nx_syscalls.nxnx_asset_record.nxnx_asset_catalog.nxnx_asset_provenance.nxnx_asset_autotag.nxnx_seg_store.nx
imported by: nx_asset_signals_gate.nxnx_asset_status.nxnx_asset_status_gate.nx
structs
| none |
consts
| 53 | const K_MAGIC_4096: i64 = 4096 |
functions
| 57 | func SIG_MISSING_PROVENANCE() -> *u8 { return "MISSING_PROVENANCE\x00" as *u8 } |
| 58 | func SIG_UNTAGGED() -> *u8 { return "UNTAGGED\x00" as *u8 } |
| 59 | func SIG_MISSING_METADATA() -> *u8 { return "MISSING_METADATA\x00" as *u8 } |
| 60 | func SIG_NEAR_DUP() -> *u8 { return "NEAR_DUP\x00" as *u8 } |
| 61 | func SIG_STALE() -> *u8 { return "STALE\x00" as *u8 } |
| 62 | func SIG_ORPHANED() -> *u8 { return "ORPHANED\x00" as *u8 } |
| 63 | func SIG_UNTRANSCODED() -> *u8 { return "UNTRANSCODED\x00" as *u8 } |
| 67 | func AS_NEARDUP_THRESHOLD() -> i64 { return 1 } called by 1: as_scan |
| 72 | func AS_PREFIX() -> *u8 { return "knowledge/store/asset-signals-\x00" as *u8 } |
| 75 | func as_len(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } |
| 76 | func as_streq(a: *u8, b: *u8) -> i64 called by 1: as_scan |
| 86 | func as_present(v: *u8) -> i64 called by 1: as_scan |
| 92 | func as_cpy(dst: *u8, src: *u8) -> i64 called by 1: as_emit_one |
| 99 | func as_cat(dst: *u8, off: i64, src: *u8) -> i64 called by 1: as_emit |
| 109 | func as_seg_next(prefix: *u8) -> i64 |
| 118 | func as_put(prefix: *u8, key: *u8, val: *u8) -> i64 |
| 139 | func as_member(list: *u8, llen: i64, tok: *u8) -> i64 |
| 174 | func as_sig_cid(out_signals: *i64, cap: i64, k: i64) -> *u8 { return out_signals[0 * cap + k] as *u8 } |
| 175 | func as_sig_code(out_signals: *i64, cap: i64, k: i64) -> *u8 { return out_signals[1 * cap + k] as *u8 } |
| 176 | func as_sig_detail(out_signals: *i64, cap: i64, k: i64) -> *u8 { return out_signals[2 * cap + k] as *u8 } called by 1: as_emit |
| 179 | func as_emit_one(out_signals: *i64, cap: i64, k: i64, cid: *u8, code: *u8, detail: *u8) -> i64 |
| 201 | func as_scan(prefix: *u8, phashes: *i64, cred_ptr: *i64, cred_len: *i64, pubkey: *u8, called by 2: mainst_compute calls 18: sys_mmapcat_listat_neardupAS_NEARDUP_THRESHOLDcat_getar_decode+12 |
| 328 | func as_emit(out_signals: *i64, cap: i64, count: i64) -> i64 |
| 390 | func as_list(out_keys: *i64, cap: i64) -> i64 |
| 418 | func as_get(key: *u8, ptrout: *i64, lenout: *i64) -> i64 |
| 424 | func as_field(rec: *u8, rlen: i64, f: i64, out: *u8) -> i64 called by 1: main |