nx_session.nx
buildroot/runtime/nx_session.nx
about
nx_session.nx -- composite substrate session for parallel-companion scenes.
Bundles the five core runtime primitives every parallel-companion
scene needs into one constructor:
- NxActorScheduler actor lifecycle + cooperative scheduling
- NxMessageBus typed inter-actor mailboxes + pub/sub
- NxStreamMultiplexer priority-ordered output stream interleave
- NxResourceArbiter VRAM / RAM / CPU budget arbitration
- NxInterruptBroker sub-50ms preemption for operator inputs
Replaces the ~30 lines of wiring boilerplate that nx_companion_compose,
nx_dual_companion_compose, nx_triple_companion_compose, and
nx_quad_companion_compose each currently duplicate.
One call -> entire substrate ready:
let s: *NxSession = nx_session_new(
n_actors_capacity, mailbox_capacity, mux_capacity,
arb_capacity, broker_capacity,
starvation_threshold_us, quantum_per_actor, epoch_quantum_us,
now_us)
Convenience funcs bundle common patterns (spawn-actor-and-register-
mailbox, subscribe-to-kind, etc.) so a 4-modality scene fits in
fewer lines than the wiring it composes.
Composes feedback-build-intelligence-never-strip-features (build
the composite once, reuse everywhere) + feedback-no-false-ok-
substrate-honesty-audit (each sub-primitive's own smoke proves it
works; this primitive's smoke proves the WIRING composes).
dependencies 7 imports · 16 importers
diagram shows first 10 each side; +0 more imports, +6 more importers in the complete lists below.
imports: nx_syscalls.nxnx_tier.nxnx_actor.nxnx_message.nxnx_stream_multiplexer.nxnx_resource_arbiter.nxnx_interrupt_broker.nx
imported by: nx_bench_companion.nxnx_bench_companion_test.nxnx_bench_companion_timed.nxnx_bench_companion_timed_test.nxnx_bench_dist_emit_test.nxnx_bench_dist_persist_test.nxnx_bench_scale_dist_emit_test.nxnx_bench_scale_test.nxnx_bench_stress_autoreg_test.nxnx_bench_stress_emit_test.nxnx_bench_v1_vs_v2_test.nxnx_dual_real_llm_compose_test.nxnx_dual_real_llm_emit_test.nxnx_quad_real_emit_test.nxnx_session_real_llm_compose_test.nxnx_session_test.nx
structs
| 57 | struct NxSession |
consts
| 42 | const NX_SE_V_OK: nx_int = 0 |
| 43 | const NX_SE_V_BAD_CAPACITY: nx_int = 1 |
| 44 | const NX_SE_V_BAD_QUANTUM: nx_int = 2 |
| 45 | const NX_SE_V_NULL: nx_int = 3 |
| 46 | const NX_SE_V_INVALID: nx_int = 4 |
| 47 | const NX_SE_V_N: nx_int = 5 |
| 67 | const NX_SE_BYTES: nx_int = 56 // 7 fields * 8 |
functions
| 49 | func nx_se_v_is_valid(v: nx_int) -> nx_int called by 1: main |
| 74 | func nx_session_new(n_actors_capacity: nx_int, |
| 116 | func nx_session_new_default(now_us: nx_size) -> *NxSession called by 14: mainmain_drive_one_run_drive_one_run_drive_one_run_run_scale+8 calls 1: nx_session_new |
| 133 | func nx_session_spawn_actor(s: *NxSession, called by 14: mainmain_drive_one_run_drive_one_run_drive_one_run_run_scale+8 calls 2: nx_ac_spawnnx_ms_register |
| 148 | func nx_session_subscribe(s: *NxSession, |
| 160 | func nx_session_verdict(s: *NxSession) -> nx_int called by 1: main |
| 165 | func nx_session_is_ready(s: *NxSession) -> nx_int |
| 176 | func nx_session_actor_count(s: *NxSession) -> nx_int |