MockDaemon foundation: an in-browser virtual backend
The shared foundation for both Tier 1 and Tier 2. Everything the demo shows flows through here, so both tiers become thin presentation layers on top of one live event stream.
What it is
A fake backend that runs entirely in the browser and speaks the real wire protocol. It satisfies the same interface useDeckdSocket produces — a send() that dispatches client messages, and an emitter that pushes ServerMessages back into the existing callbacks (onLayout, onWidgetUpdate, onMediaState, onChromeMedia, onRunningWindows, …). App.tsx must not be able to tell it apart from the real socket.
Pieces
- MockSocket / MockDaemon: implements the client→server + server→client contract.
- Clock: a single tick source (
setInterval/rAF) driving all virtual apps; deterministic (no Math.random, no wall-clock) so the same demo can back tests.
- Virtual-app abstraction: a small
tick(dt) + handle(clientMessage) interface that individual apps implement (see sub-issue for the apps themselves).
- Reuse existing
demo.ts fixtures/seeds (METER_DEMO_SEEDS, MEDIA_DEMO_STATES, MPRIS_DEMO_STATES, EDITOR_DEMO_LAYOUTS) rather than inventing parallel data.
Hard constraints
- Bundle isolation: none of this may ship in the production client bundle. Treat like
gallery.html / screenshots — a demo/dev-only entry, tree-shaken out of prod. Decide the boundary here.
- Honesty: the mock may only emit messages that validate against the real protocol schema (
protocol.generated.ts). See the drift-guard sub-issue.
Part of the mocked-demo epic. Blocks Tier 1 and Tier 2.
MockDaemon foundation: an in-browser virtual backend
The shared foundation for both Tier 1 and Tier 2. Everything the demo shows flows through here, so both tiers become thin presentation layers on top of one live event stream.
What it is
A fake backend that runs entirely in the browser and speaks the real wire protocol. It satisfies the same interface
useDeckdSocketproduces — asend()that dispatches client messages, and an emitter that pushesServerMessages back into the existing callbacks (onLayout,onWidgetUpdate,onMediaState,onChromeMedia,onRunningWindows, …).App.tsxmust not be able to tell it apart from the real socket.Pieces
setInterval/rAF) driving all virtual apps; deterministic (noMath.random, no wall-clock) so the same demo can back tests.tick(dt)+handle(clientMessage)interface that individual apps implement (see sub-issue for the apps themselves).demo.tsfixtures/seeds (METER_DEMO_SEEDS,MEDIA_DEMO_STATES,MPRIS_DEMO_STATES,EDITOR_DEMO_LAYOUTS) rather than inventing parallel data.Hard constraints
gallery.html/screenshots— a demo/dev-only entry, tree-shaken out of prod. Decide the boundary here.protocol.generated.ts). See the drift-guard sub-issue.Part of the mocked-demo epic. Blocks Tier 1 and Tier 2.