Runtime
runtime.march — Persistent March REPL management for notebook sessions.
Instead of spawning a fresh OS process per cell run, Runtime maintains one long-lived march repl process per session. Cell source is written to the REPL's stdin; output is captured in a temp file and polled for a per-session sentinel token emitted when MARCH_SCROLL_MODE=1.
Execution model for "run cell N":
- start_runtime spawns the REPL and generates a random sentinel token,
stored in Vault and passed to the REPL via MARCH_SCROLL_SENTINEL.
2. Write `:reset` to clear prior state, then write all code cells 0..N
to stdin in sequence — the REPL evaluates them one by one.
3. Each evaluation emits `<sentinel_token>\n` to the output file.
We wait for (1 + code_cells_before_N + 1) sentinels:
sentinel 0 = `:reset` acknowledgement
sentinels 1..M = cells 0..N-1 (context; output ignored)
sentinel M+1 = cell N (the output we show the user)
4. poll_result extracts the output between sentinel M and M+1.The REPL process persists between cell runs so actors spawned in one cell remain alive across subsequent cell evaluations in the same session.
Using a per-session random sentinel (rather than the fixed "__SCROLL_DONE__") prevents user output that happens to contain that string from corrupting the sentinel counter.
Public API (fn): start_runtime/3 : start (or reuse) the REPL for a session write_cells/4 : feed cells 0..run_through_idx to REPL stdin poll_result/1 : check whether the target cell is done poll_live/1 : return partial output while cell is running stop_runtime/1 : kill the REPL and clean up Vault entries