code wiki / (root) / nx_immune.nx

nx_immune.nx

buildroot/runtime/nx_immune.nx

10944 B288 linesdepth 5pulls 9 transitivereach 2 importersview sourcekind library
docsdependenciesstructsconstsfunctions

about

nx_immune.nx -- Tier-2 colony-level adaptive immune coordinator. Per [[feedback-unified-immune-architecture-three-tier]] Tier 2: "ADAPTIVE / MULTICELLULAR -- specialized cells + learning + memory; existing nx_thymus (substrate audit) + nx_immune (runtime defense)." nx_antibody is the per-cell defense-generation primitive (Tier 1+); nx_immune is the COLONY-LEVEL orchestrator that: 1. Tracks which cells in the host are currently HEALTHY/ALERTED/ RESPONDING/COMPROMISED 2. Propagates antibody discoveries (clonal-expansion analog): when one cell's antibody matures to MEMORY state, immune distributes a copy to every other cell so the same threat is detected colony-wide on first encounter 3. Coordinates lysis-response: when any cell calls for lysis on a foreign entity touching multiple cells, immune issues a colony-wide enforcement (vs each cell deciding alone) 4. Surfaces a COLONY STATUS to the operator (HEALTHY when all cells healthy; ALERTED when any cell sees a hit; RESPONDING when active lysis ongoing; COMPROMISED when any cell entered the abortive-terminal state) Per [[feedback-captain-moroni-doctrine]]: defensive-only. Colony response is to PROTECT remaining cells, never to attack. Composes: nx_antibody -- per-cell antibodies clone-expand via immune nx_lysis -- colony-wide enforcement decision nx_xenocell -- intrusions observed across cells aggregate here nx_abortive -- cell-state-machine; immune watches transitions nx_evict_journal -- colony events logged nx_pollinate (queued) -- cross-host community distribution V1 ships: - struct NxImmune holding cell registry + antibody clone-store - cell-state tracking - antibody clonal-expansion broadcast - colony status aggregation Gap list (V1 honest perf verdict):

dependencies 5 imports · 2 importers

nx_syscalls.nx nx_tier.nx nx_evict_journal.nx nx_antibody.nx nx_lysis.nx nx_immune.nx nx_immune_test.nx nx_tier2_immune_compose_test.nx

imports: nx_syscalls.nxnx_tier.nxnx_evict_journal.nxnx_antibody.nxnx_lysis.nx

imported by: nx_immune_test.nxnx_tier2_immune_compose_test.nx

structs

89struct NxImmuneCellRow
103struct NxImmune

consts

69const NX_COL_HEALTHY: nx_int = 0
70const NX_COL_ALERTED: nx_int = 1 // at least one cell saw a hit
71const NX_COL_RESPONDING: nx_int = 2 // active lysis ongoing
72const NX_COL_COMPROMISED: nx_int = 3 // at least one cell terminal
73const NX_COL_N_STATUSES: nx_int = 4
77const NX_IM_OK: nx_int = 0
78const NX_IM_ERR_FULL: nx_int = 1
79const NX_IM_ERR_BAD_CELL: nx_int = 2
80const NX_IM_ERR_BAD_STATUS: nx_int = 3
111const NX_IM_CELL_BYTES: nx_size = 40

functions

115func nx_col_status_is_valid(s: nx_int) -> nx_int
123func nx_immune_new(cell_capacity: nx_size, journal: *NxEvictJournal) -> *NxImmune
called by 2: mainmain calls 1: sys_mmap
136func _immune_at(i: *NxImmune, idx: nx_size) -> *NxImmuneCellRow
142func _immune_find_cell(i: *NxImmune, cell_id: nx_int) -> nx_int
158func nx_immune_register_cell(i: *NxImmune,
175func nx_immune_set_cell_status(i: *NxImmune,
196func nx_immune_global_status(i: *NxImmune) -> nx_int
called by 2: mainmain calls 1: _immune_at
220func nx_immune_clonal_expand(i: *NxImmune,
251func nx_immune_alert_count(i: *NxImmune, cell_id: nx_int) -> nx_int
260func nx_immune_count_cells_in_status(i: *NxImmune, status: nx_int) -> nx_size
278func nx_immune_should_quarantine_host(i: *NxImmune) -> nx_int