code wiki / (root) / nx_observatory.nx

nx_observatory.nx

buildroot/runtime/nx_observatory.nx

8028 B211 linesdepth 4pulls 4 transitivereach 2 importersview sourcekind library
docsdependenciesstructsconstsfunctions

about

nx_observatory.nx -- external watcher for paired-cell dyads. Astronomical observatories watch celestial bodies from a distance without touching them. Nishi observatory watches nx_dyad pairs (or organism-level cell sets) from outside the cells' isolation boundaries -- it READS what cells emit but never writes into them. Per [[feedback-cell-immune-system-ransomware-judo-ddos-by-bit]]: "verify D observer received parallel telemetry without vacuole bytes crossing." Observatory is the substrate primitive for that "parallel telemetry without crossing." Sees both A's and B's outputs side by side; computes a comparison metric; surfaces divergence + agreement counts. Naming: nx_observer is too generic (Observer pattern in nearly every framework). nx_observatory keeps biology/science-domain distance and matches the "external scientific instrument" semantic exactly. Composes: nx_dyad -- the paired cells being watched nx_provenance_chain -- observatory's reading is a transform; chain-logged nx_evict_journal -- significant divergence events logged nx_xenocell -- when one cell of the dyad turns hostile, the observatory catches the deviation before it spreads V1 ships: - struct NxObservatory with dyad pointer + sample ring + agreement_count / divergence_count - sample(): grab one reading of A and B's outputs, compute diff bytes, increment agree-or-diverge counter - agreement_q10(): Q10 ratio of agreements to total samples - is_divergent(): predicate firing when divergence_count exceeds caller-supplied threshold Gap list (V1 honest perf verdict): - byte-equality diff is coarse (V2 supports semantic-diff callbacks for structured outputs)

dependencies 3 imports · 2 importers

nx_syscalls.nx nx_tier.nx nx_dyad.nx nx_observatory.nx nx_failover_compose_test.nx nx_observatory_test.nx

imports: nx_syscalls.nxnx_tier.nxnx_dyad.nx

imported by: nx_failover_compose_test.nxnx_observatory_test.nx

structs

74struct NxObservatorySample
89struct NxObservatory

consts

60const NX_MAGIC_1024: i64 = 1024
64const NX_OBS_OK: nx_int = 0
65const NX_OBS_ERR_BAD_DYAD: nx_int = 1
66const NX_OBS_ERR_OUT_OF_RANGE: nx_int = 2
99const NX_OBS_SAMPLE_BYTES: nx_size = 40

functions

103func nx_observatory_new(dyad: *NxDyad, capacity: nx_size) -> *NxObservatory
called by 2: mainmain calls 1: sys_mmap
119func _obs_at(o: *NxObservatory, idx: nx_size) -> *NxObservatorySample
130func nx_observatory_sample(o: *NxObservatory,
169func nx_observatory_agreement_q10(o: *NxObservatory) -> nx_int
called by 2: mainmain
181func nx_observatory_is_divergent(o: *NxObservatory, threshold_q10: nx_int) -> nx_int
called by 2: mainmain
191func nx_observatory_sample_count(o: *NxObservatory) -> nx_size
called by 1: main
200func nx_observatory_total_diff_bytes(o: *NxObservatory) -> nx_size
called by 1: main calls 1: _obs_at