code wiki / (root) / nx_elder_supervisor_main.nx

nx_elder_supervisor_main.nx

buildroot/runtime/nx_elder_supervisor_main.nx

6963 B182 linesdepth 3pulls 4 transitivereach 0 importersview sourcekind orphan librarytopic elder
docsdependenciesstructsconstsfunctions

about

nx_elder_supervisor_main.nx -- substrate-side Elder AI supervisor. Cardinal 2026-05-21 dual-mandate (top-down + bottom-up): the SUBSTRATE owns the service-lifecycle decision (which services exist, which ports, which healthchecks). The OS adapter (bench/nx_elder_supervise.sh) is now a dumb pipe -- read the substrate-emitted manifest, launch python, poll the URL. V1 contract -- emit one tab-separated line per registered service on stdout (fd 1): SVC<TAB>service_name<TAB>port<TAB>healthcheck_url<NEWLINE> Lines prefixed by anything other than "SVC" are diagnostic (logged by the adapter, not parsed as service entries). V1 mechanics: builds an nx_elder_registry with the services the substrate currently knows how to host (svc-config today; svc-discovery + the data-* + orch-* tier when those are wired), then iterates and writes one manifest line per service. Adapter reads stdin, parses, launches. Why not bash-only? Because then bash owns the source of truth about services + ports + healthchecks, and as Elder AI's 150- service inventory ports over, that bash table becomes the substrate's most important policy artifact -- shadow state. Putting it in nx_elder_registry means the registry IS the policy, with canary protection + sealed-enum validation + the supervisor state machine attached. genealogy_id: erlang_otp_application_start_1996 + systemd_unit_files_2010 + docker_compose_v3_2021 + cardinal_2026-05-21_top_down_bottom_up_dual_mandate lineage_id: substrate_elder_supervisor_main_v1

dependencies 3 imports · 0 importers

nx_syscalls.nx nx_hal.nx nx_elder_registry.nx nx_elder_supervisor_main.nx

imports: nx_syscalls.nxnx_hal.nxnx_elder_registry.nx

imported by: nobody (leaf or entry point)

structs

none

consts

40const K_MAGIC_8423: i64 = 8423
41const K_MAGIC_8600: i64 = 8600
42const K_MAGIC_8100: i64 = 8100
43const K_MAGIC_8101: i64 = 8101
44const K_MAGIC_8102: i64 = 8102

functions

50func _emit_line(buf: *u8, len: i64) -> i64
called by 1: _emit_manifest_line calls 1: sys_write
54func _emit_byte(b: i64) -> i64
62func _emit_i64(n: i64) -> i64
91func _emit_manifest_line(name: *u8, name_len: i64, port: i64, hc: *u8, hc_len: i64) -> i64
109func _build_registry(r: *NxElderRegistry) -> i64
151func _emit_banner() -> i64
158func main() -> i64