# ReplServer


Typed REPL-server vocabulary built on the locked runtime.* algebra.

- **Smart constructor** `replServer.define { protocol; mode;
  registration?; port?; portEnvVar?; interface?; lifecycle?;
  enable?; shortLivedFlags?; extra?; }` proxies to
  `mb.operations.replServer`. Port and `portEnvVar` default from
  the protocol's `defaultPort`/`portEnvVar`. Registration defaults
  from `mode` via the inference rule
  `Foreground → ServiceSpec`, `Background → XDG`.
  Lifecycle defaults to `LongRunning`.

- **Closed-sum re-exports** for consumer ergonomics:
  `Mode = Foreground | Background`,
  `Registration = XDG | Global | ServiceSpec | None`,
  `Lifecycle = LongRunning | OneShot`.

- **Built-in protocols** as typed `ProtocolSpec` values:
  `protocols.{swank,nrepl,dap}`. Each carries a baseline
  `CapabilitySet` of `lifecycle` only; consumers extend via
  `capabilitySet { categories = [...] }`. The legacy string-keyed
  taxonomy (`universal`/`common`/`discovery`/...) is intentionally
  absent.

Registration backend names map to runtime conventions:
`XDG` → `$XDG_RUNTIME_DIR/repl/<protocol>/<name>.json`,
`Global` → `$XDG_RUNTIME_DIR/repl/<protocol>/shared/<name>.json`,
`ServiceSpec` → discovery via NixOS configuration,
`None` → no automatic registration.

