XAP — the experience layer
XAP is the experience layer at the top of the CX web stack. It composes the cx-stdlib primitives — bus, journal, authz, session, sched, over http — into one orchestrator, so you build a capability once and surface it through many clients (CLI, TUI, web, agent) without rewriting it.
The cascade
Every intent commits through one synchronous, server-authoritative, journal-folded path. The bus is the single enforcement point: it calls the policy decision once, appends to the hash-chained journal, and re-folds state. A rejected intent is a value on the failure channel — not a crash. Reads are a deterministic fold over the log, always live and present.
Agent-parity
Agents are first-class peers. They emit the same intents as humans and are gated by the same authz dial — a delegation you can attenuate, time-bound, or revoke. Surfaces are medium-agnostic, so the same capability renders for a terminal, a browser, or an agent.
Using it
[?lib 'cx-xap' :as xap] imports the runtime — it is bundled in the binary, no install. The four demos below are a ladder: one capability, surfaced through progressively more clients — each rung turns on exactly one more subsystem. Run each with the command on its page.
The demo ladder
- D1 · Greeting CLI — The smallest real XAP — a parameterized view rendered by a one-shot CLI, exercising only the pure component / surface / panel / render constructors. No journal, no bus, no socket.
- D2 · Guestbook (the cascade) — Adds state and one control: signs the guestbook twice — each committing once to the journal — then renders the surface from the resulting fold. This is the committed cascade (run / emit / state).
- D3 · Guestbook on the web — Attaches a browser and a live terminal client to the SAME runtime: the surface materializes as HTML while a TUI rides an SSE feed of the same fold. Same capability, same intents, new media. [$xap:serve] holds GET /events open and pushes a frame on every committed intent.
- D4 · Guestbook + agent — Adds an agent as a fourth peer alongside the human clients. It emits the SAME [do :sign …] intents (agent-parity); the dial — an authz delegation — governs how much it does on its own.