resonate-state-bus-pattern-typescript
Installation
SKILL.md
Resonate State Bus Pattern (TypeScript)
Overview
A long-running Resonate workflow often needs to surface progress to a live UI. If the worker is short-lived (Cloud Function, Lambda) or scales to zero, holding an SSE or WebSocket connection for the workflow's lifetime isn't an option — the connection outlives the worker process.
The state bus pattern decouples the two sides:
- The workflow writes its current state to an external realtime bus via
ctx.run. - The browser (or any subscriber) subscribes to that bus directly.
The worker stays stateless, progress becomes durable (ctx.run guarantees it), and the UI becomes a pure read view — the workflow can run with or without anyone watching.