code wiki / (root) / nx_hypha.nx

nx_hypha.nx

buildroot/runtime/nx_hypha.nx

15732 B375 linesdepth 2pulls 2 transitivereach 2 importersview sourcekind library
docsdependenciesstructsconstsfunctions

about

nx_hypha.nx -- bidirectional peer share + receive (point-to-point mycelium / wood-wide-web). Per META-CARDINAL feedback-forest-meta-vision-drift-lifecycle: every EXCHANGE_* mode has a paired RECEIVE_* mode at the same peer. Pure consumers are throttled per [[feedback-west-industrial-build- replenish-not-buy-consume]]. A new node gets a "starter quota" of EXCHANGE_* capability proportional to its niche -- no node arrives with literally nothing to offer. Distinct from nx_fruiting (queued): nx_hypha is POINT-TO-POINT peer share between two specific Nishi nodes. nx_fruiting is MANY-TO-MANY content-addressed broadcast (mushroom spore release). Both compose to give the complete underground-mycelium-plus-fruiting-body distribution architecture. V1 ships sealed enum of exchange modes + reciprocity discipline predicate + niche-aware capability gating + per-peer trust state. Composes: nx_methyl -- peer-attestation Ed25519 chain (caller-supplied) nx_niche -- niche gates which EXCHANGE_* modes a peer can offer nx_attest_silicon -- silicon-trust gates sovereignty-critical exchanges nx_immune -- runtime defense composes on suspicious-peer signal Gap list (V1 honest perf verdict): - actual byte transport is caller-supplied (V2 wires nx_chromatin content-addressed blocks + nx_http3 / libp2p-class re-derived transport) - reciprocity ratio thresholds are operator-tuneable per niche (V2 makes data-driven) - "starter quota" for new peer is the niche-default + first 100 interactions; V1 marks the quota; V2 enforces decay genealogy_id: nishi_metacardinal_2026-05-19_forest_drift_lifecycle lineage_id: substrate_hypha_v1 nx_safety_envelope: intended_use: "Bidirectional point-to-point peer exchange with reciprocity discipline + niche-aware

dependencies 2 imports · 2 importers

nx_syscalls.nx nx_tier.nx nx_hypha.nx nx_commons_units_gate.nx nx_hypha_test.nx

imports: nx_syscalls.nxnx_tier.nx

imported by: nx_commons_units_gate.nxnx_hypha_test.nx

structs

90struct NxPeerExchangeState

consts

57const NX_EM_COMPUTE: nx_int = 0 // VRAM / cores / NPU borrow
58const NX_EM_STORAGE: nx_int = 1 // content-addressed blocks
59const NX_EM_SIGNAL: nx_int = 2 // telemetry / alerts / niche-correction
60const NX_EM_CHROMATIN: nx_int = 3 // organelle updates + audit-labels
61const NX_EM_PATHWAY: nx_int = 4 // cooperative sub-graph execution
62const NX_EM_LABEL: nx_int = 5 // triangulated audit-consensus
63const NX_EM_KNOWLEDGE: nx_int = 6 // federated-averaged small-model weights
64const NX_EM_INGEST: nx_int = 7 // one-directional consume from foreign substrate
65const NX_EM_N_MODES: nx_int = 8
69const NX_EM_DIR_SHARE: nx_int = 0
70const NX_EM_DIR_RECEIVE: nx_int = 1
71const NX_EM_DIR_N_DIRS: nx_int = 2
75const NX_HY_OK: nx_int = 0
76const NX_HY_ERR_INVALID_MODE: nx_int = 1
77const NX_HY_ERR_INVALID_DIRECTION: nx_int = 2
78const NX_HY_ERR_RECIPROCITY_VIOLATION: nx_int = 3 // pure consumer; throttled
79const NX_HY_ERR_NICHE_INCAPABLE: nx_int = 4 // this niche can't offer this mode
80const NX_HY_ERR_TRUST_INSUFFICIENT: nx_int = 5 // silicon trust below requirement
81const NX_HY_ERR_NULL_INPUT: nx_int = 6
82const NX_HY_N_VERDICTS: nx_int = 7
100const NX_HY_PEER_BYTES: nx_int = 56
101const NX_HY_PER_MODE_BYTES: nx_int = 8
102const NX_HY_STARTER_QUOTA_DEFAULT: nx_int = 100

functions

106func nx_em_mode_is_valid(m: nx_int) -> nx_int
114func nx_em_dir_is_valid(d: nx_int) -> nx_int
122func nx_hy_verdict_is_valid(v: nx_int) -> nx_int
called by 1: main
138func nx_em_niche_can_offer(niche: nx_int, mode: nx_int) -> nx_int
called by 1: main calls 1: nx_em_mode_is_valid
192func nx_hy_peer_state_new(peer_id: nx_int,
called by 3: ug_seasoned_peermainmain calls 1: sys_mmap
222func nx_hy_record_exchange(p: *NxPeerExchangeState,
247func nx_hy_share_count(p: *NxPeerExchangeState, mode: nx_int) -> nx_int
257func nx_hy_receive_count(p: *NxPeerExchangeState, mode: nx_int) -> nx_int
267func nx_hy_total_shared(p: *NxPeerExchangeState) -> nx_int
280func nx_hy_total_received(p: *NxPeerExchangeState) -> nx_int
301func nx_hy_reciprocity_verdict(p: *NxPeerExchangeState) -> nx_int
332func nx_hy_reciprocity_verdict_units(p: *NxPeerExchangeState,
called by 1: main
356func nx_hy_can_initiate_share(p: *NxPeerExchangeState,