workflow
Installation
SKILL.md
@falcondev-oss/workflow
A long-running async process — send an email, sleep three days, send a follow-up — dies with the process that runs it. This library makes it survivable: the workflow body is an ordinary async function, but every step it takes is persisted to Redis, so a crash, deploy, or retry replays the function from the top and skips straight past the steps that already finished.
Three layers, each minted by the one above:
| Layer | Owns |
|---|---|
WorkflowNamespace |
The redis connection, the pub/sub connection, a cross-workflow concurrency cap |
WorkflowDefinition |
One queue + one job type: input schema and options. Enqueues, schedules, inspects |
Workflow |
A definition plus its run handler, so it can also work() |
WorkflowJob |
One enqueued run: id, groupId, wait() |
Everything is exported from the package root: WorkflowNamespace, createRedis, expBackoff, TimeoutError, ResultExpiredError, JobAlreadyExistsError, NonRecoverableError. Always mint workflows through the namespace (createWorkflow / defineWorkflow), never new Workflow().
Setting up
import { createRedis, WorkflowNamespace } from '@falcondev-oss/workflow'