Control plane
The embedded dashboard — a React SPA served by NestJS that lists runs and renders each one as a graph across local and remote steps, with retry and cancel.
@dudousxd/nestjs-durable-dashboard mounts a control plane at /durable: a bundled React SPA
plus its JSON API. It reads straight from the state store, so it works without an
OpenTelemetry collector.
pnpm add @dudousxd/nestjs-durable-dashboard @dudousxd/nestjs-filter@dudousxd/nestjs-filter (>=1.33.0 <2.0.0) is a peer dependency: the runs API filters through it,
and it has to be the same copy your app uses, because filter state lives in that package's
module-level AsyncLocalStorage. Install it even if your app does not use the filter library itself.
import { DurableDashboardModule } from '@dudousxd/nestjs-durable-dashboard';
@Module({
imports: [
DurableModule.forRoot({ store, transport }),
DurableDashboardModule.forRoot({
authorize: (ctx) => ctx.switchToHttp().getRequest().user?.isAdmin === true,
}),
],
})
export class AppModule {}DurableModule is global, so the dashboard resolves the engine and store automatically.
Set authorize before you ship: without it, the console answers 403 to
every request when NODE_ENV=production.
Where it mounts
forRoot() defaults to /durable (SPA at /durable, JSON API at /durable/api). Pass basePath
to move it — e.g. under your app's /api prefix so the same auth/proxy rules cover the dashboard API:
DurableDashboardModule.forRoot({ basePath: '/api/durable' });
// SPA at /api/durable, API at /api/durable/apiThe SPA's asset URLs and its API base are derived from basePath at serve time, so the bundle works
at any mount point. If your app sets a global prefix (app.setGlobalPrefix('api')), exclude the base
route so the path isn't prefixed twice — or fold it in by setting basePath to include the prefix.
Serving it from an API pod (without processing there)
When you split your app into API and driving pods, you usually want the dashboard served from
the API (it handles HTTP) while only the driving pods process runs. Set drive: false on the API
instance's DurableModule:
DurableModule.forRoot({
store,
transport,
drive: process.env.APP_TYPE === 'API' ? false : true, // driving pods process; the API only serves the dashboard
});With drive: false the engine is still fully available — the dashboard can dispatch retries and
cancels, and reads work — but the instance does not drive: it won't register @Step
handlers (so it never consumes the task queue), won't recover incomplete runs on boot, and won't poll
due timers. Leave that to the driving pods. So a retry clicked in the UI on an API pod still
works: the API dispatches the step, a driving pod picks it up and runs it. Only the processing is
gated, not the control plane. (Default is drive: true, so single-process apps need nothing.)
Protecting the console
The console (the SPA at basePath, its JSON API at apiBasePath and the run stream) can retry,
cancel and replay runs. Who may use it is decided by one option, authorize:
DurableDashboardModule.forRoot({
authorize: (ctx) => ctx.switchToHttp().getRequest().user?.isAdmin === true,
});It takes one of five forms:
// 1. A function (may be async)
authorize: (ctx) => ctx.switchToHttp().getRequest().user?.isAdmin === true,
// 2. A class: an @Injectable() that implements ConsoleAuthorizer (constructor injection works)
authorize: ConsoleAccess,
// 3. A lazy import of such a class (its default export)
authorize: () => import('./console-access.js'),
// 4. An @nestjs/authorization policy
authorize: { policy: ConsolePolicy, ability: 'view' },
// 5. A gate name, resolved by @dudousxd/nestjs-authz's AuthzModule
authorize: 'console.durable',import { type ExecutionContext, Injectable } from '@nestjs/common';
import type { ConsoleAuthorizer } from '@dudousxd/nestjs-durable-dashboard';
@Injectable()
export default class ConsoleAccess implements ConsoleAuthorizer {
constructor(private readonly audit: AuditService) {}
async authorize(ctx: ExecutionContext) {
const user = ctx.switchToHttp().getRequest().user;
if (!user) return { redirectTo: '/login' };
await this.audit.record(user, 'console');
return user.roles.includes('ops');
}
}A class's dependencies resolve from a global module or from the imports option. The policy form
needs @nestjs/authorization installed and AuthorizationModule.forRoot() imported in the app. It
reads the user with the module's getUser: null or false is a guest (401), undefined falls
back to request.user. A gate name needs @dudousxd/nestjs-authz's AuthzModule. Either one
missing fails the boot with a message saying so.
What authorize returns
| Result | Page navigation (GET of the UI with Accept: text/html) | API call |
|---|---|---|
true / { allowed: true } | served | served |
false / { allowed: false } | 403 "Access denied" page | 403 { "error": "forbidden" } |
{ allowed: false, reason: 'unauthenticated' } | 401 "Sign in required" page | 401 { "error": "unauthenticated" } |
{ redirectTo: '/login' } | 302 to /login | 401 { "error": "unauthenticated", "redirectTo": "/login" } |
| throws | 403 (logged as a warning) | 403 |
The SPA follows a 401 that carries redirectTo by navigating to it; any other 401 or 403 from
the API replaces the console with an access-denied screen.
The console has no sign-in of its own. Sign in with your app's own authentication, and return
{ redirectTo: '/login' } for a guest.
Confining a viewer to some apps
On a control plane, an allow may name the tenant apps (partitions) the viewer may see:
authorize: (ctx) => {
const user = ctx.switchToHttp().getRequest().user;
if (!user) return { redirectTo: '/login' };
return { allowed: true, apps: user.isAdmin ? '*' : user.apps };
},apps: '*' (or no apps) is every app plus the control plane's own runs. A list confines the console
to those apps: the run list, its counts and facets, the filter pickers, run reads and the live tail
(another app's run answers 404), every action including bulk ones, worker health (<name>@<app>
groups) and schedules (by namespace). /metrics answers 403, since its counters span every app,
and a workflow's lifecycle page lists only the subscriptions of those apps, without the process-wide
trigger counts. anyAuthorize keeps the grant
of the form that allowed.
A bearer token
authorizeByToken allows a request carrying Authorization: Bearer <token>, compared in constant
time. Anything else is unauthenticated. Only the header is read (no query string). An empty or
missing token throws when the module is configured, so a missing env var never opens the console.
import { authorizeByToken } from '@dudousxd/nestjs-durable-dashboard';
DurableDashboardModule.forRoot({
authorize: authorizeByToken({ token: process.env.CONSOLE_TOKEN }),
});A token suits callers you script (the JSON API). The SPA in a browser sends no
Authorization header, so a console protected by a token alone answers 401 to its own UI. For
browser use, sign in with your app's authentication (in decorators) and use a function, a class,
a policy or a gate name.
An allow can also name who it let in: { allowed: true, caller: 'user:42' }. The MCP tools
log that name as the caller of each call. Never put a secret in it. authorizeByToken names its caller
token:<hash>.
A token or a session: anyAuthorize
anyAuthorize(...forms) allows a request when any of its forms allows it. If none does, the result
is unauthenticated when any form said so, and forbidden otherwise. Each form is any of the five
authorize forms.
import { anyAuthorize, authorizeByToken } from '@dudousxd/nestjs-durable-dashboard';
DurableDashboardModule.forRoot({
authorize: anyAuthorize(authorizeByToken({ token: process.env.CONSOLE_TOKEN }), AdminAuthorizer),
});Without authorize
- Outside production (
NODE_ENVis notproduction) the console is open. - With
NODE_ENV=production, every console request (UI, API, run stream) is answered403{ "error": "forbidden" }. The webhook callback still works. - Either way, one warning is logged at boot:
[@dudousxd/nestjs-durable-dashboard] console has no `authorize` configured: it is open outside production and denies every request in production. Set `authorize` in DurableDashboardModule.forRoot().NODE_ENV is read when the app boots.
decorators: what runs before authorize
decorators takes class decorators and applies them to both controllers the module mounts, the way
@nestjs/mcp's decorators option works. authorize runs after them, so put authentication there
and authorize sees request.user:
import { AuthenticationGuard } from '@nestjs/authentication';
import { UseGuards } from '@nestjs/common';
DurableDashboardModule.forRoot({
decorators: [UseGuards(AuthenticationGuard)],
authorize: { policy: ConsolePolicy, ability: 'view' },
});decoratorsdoes not replaceauthorize. Withoutauthorizethe default above applies, with or withoutdecorators. ACan(...)passed indecoratorsis still enforced, in addition toauthorize.- Guard dependencies. A guard named in
UseGuards(...)is instantiated in the dashboard's own module, so its dependencies must come from a global module or from theimportsoption (forRoot({ imports: [AuthModule], decorators: [...] })). - Fresh controllers per registration. Each
forRootcall mounts its own subclasses ofDurableApiController/DurableUiController(same class names), so its decorators andauthorizenever stick to another registration.app.get(DurableApiController)does not find the mounted instance. @nestjs/authorization's global guard.AuthorizationModule.forRoot()refuses every route that declares no@Can(), so every controller the module mounts is markedCan.Anyone()and access is left toauthorize.
Mount it yourself: routes: false
routes: false registers every provider (the run read/action service, the run filter, the SPA's
paths and the resolved authorize) but mounts no controllers. Serve the console from your own
controllers by extending DurableUiControllerBase (the SPA shell and its assets) and
DurableApiControllerBase (the JSON API). Apply authorize to them with @UseConsoleAuthorize(),
listed above your authentication guard. Nest applies class decorators bottom-up, so the guard
listed lower runs first: your authentication sets request.user, then authorize reads it.
import { AuthenticationGuard } from '@nestjs/authentication';
import { Can } from '@nestjs/authorization';
import { Controller, Module, UseGuards } from '@nestjs/common';
import {
DurableApiControllerBase,
DurableDashboardModule,
DurableUiControllerBase,
UseConsoleAuthorize,
} from '@dudousxd/nestjs-durable-dashboard';
@Controller('ops/durable')
@UseConsoleAuthorize()
@UseGuards(AuthenticationGuard)
@Can.Anyone()
export class ConsoleUiController extends DurableUiControllerBase {}
@Controller('ops/durable/api')
@UseConsoleAuthorize()
@UseGuards(AuthenticationGuard)
@Can.Anyone()
export class ConsoleApiController extends DurableApiControllerBase {}
@Module({
imports: [
DurableDashboardModule.forRoot({
routes: false,
// Where YOU mounted them: the SPA loads its assets from `basePath` and fetches `apiBasePath`.
basePath: '/ops/durable',
apiBasePath: '/ops/durable/api',
authorize: (ctx) => ctx.switchToHttp().getRequest().user?.roles.includes('ops') === true,
}),
],
controllers: [ConsoleUiController, ConsoleApiController],
})
export class OpsConsoleModule {}@UseConsoleAuthorize() is UseGuards(ConsoleAuthorizeGuard) plus UseFilters(ConsoleAuthorizeFilter)
(the filter writes the page answers: the redirect and the access-denied page); both are exported if
you prefer to list them yourself.
You can also protect the controllers with ordinary decorators only (@UseGuards,
@Can(ConsolePolicy, 'view')), like any other route you write. Without authorize the boot warning
is still logged; set authorize: () => true to say the access is decided by your decorators.
- The bases are bare. They carry no guards and no
Can.Anyone()mark, so under@nestjs/authorization's global guard a subclass needs a@Can()or@Can.Anyone(). - The default still applies. Without
authorize, a controller that uses@UseConsoleAuthorize()is open outside production and answers403in production, and the boot warning is logged once. decoratorsis refused. It only decorates routes the module mounts, so combining it withroutes: falsethrows at boot.- A module of their own. In this mode the module exports what the bases inject
(
DashboardService, its privateFilterRunner, the two path tokens). Declare the console controllers in their own module, as above, not next to controllers that use your app's own@dudousxd/nestjs-filtersetup.
Protection is mount-level and role-agnostic: nothing in the console changes with who signed in,
and it has no notion of the control-plane vs tenant topology (the GET topology route behind the
header badge, described below).
Migrating from the boot refusal
Earlier versions refused to boot in production when the mounted console had no decorators
(UNPROTECTED_CONSOLE_IN_PRODUCTION). That check is gone: decorators no longer counts as
protection, and an app without authorize now boots and answers 403 in production.
| Before | Now |
|---|---|
decorators: [UseGuards(AuthenticationGuard), Can(ConsolePolicy, 'view')] | decorators: [UseGuards(AuthenticationGuard)], authorize: { policy: ConsolePolicy, ability: 'view' } |
decorators: [UseGuards(MyTokenGuard)] | authorize: authorizeByToken({ token: process.env.CONSOLE_TOKEN }) |
decorators: [UseGuards(ProxyAuthGuard)] (protected upstream) | authorize: () => true |
routes: false + @UseGuards(...) @Can(...) on your subclasses | add authorize: () => true (no boot warning), or @UseConsoleAuthorize() with authorize |
catching UNPROTECTED_CONSOLE_IN_PRODUCTION / DASHBOARD_PROTECTION_CHECK | removed; watch the boot warning instead |
guards, dashboardAuth, token / DURABLE_DASHBOARD_TOKEN and allowUnauthenticated were removed
earlier: use decorators for guards that must run first, and authorize (or authorizeByToken) for
access.
Idempotent retries — @nestjs/idempotency
A client that retries a POST (a flaky network, a proxy replaying a request, a third party
re-sending a webhook) would retry, cancel or resume a run twice. The official
@nestjs/idempotency solves that, and it fits
the console with no durable option: its Idempotent() decorator, put on a class, covers every
state-changing handler and skips GET/HEAD/OPTIONS. Pass it through decorators:
import { IdempotencyModule, Idempotent } from '@nestjs/idempotency';
@Module({
imports: [
IdempotencyModule.forRoot(), // the store, ttl, header, scope: see the official docs
DurableDashboardModule.forRoot({
decorators: [UseGuards(AuthenticationGuard), Idempotent()],
authorize: { policy: ConsolePolicy, ability: 'view' },
}),
],
})
export class AppModule {}Every POST the console mounts (retry, retry-with-input, cancel, bulk, continue, redispatch,
republish-lifecycle, schedule pause/resume/trigger, ctx.onUpdate deliveries, and the
ctx.webhook() receiver at webhooks/:token) then runs once per
Idempotency-Key, and a replay gets the stored response. A request without the header runs as
before, unless you set required: true. With routes: false, put @Idempotent() on your own
subclass of DurableApiControllerBase instead.
- It is not protection. Access is still decided by
authorize. - Scope. Without
scope, keys share one namespace; with signed-in operators, scope them per user (Idempotent({ scope: (req) => req.user?.id })). For the webhook receiver, the provider's event id is a natural key, andscope: falsefits it. - Durable does not depend on
@nestjs/idempotency; install it in your app.
Migrating from the removed options
guards, dashboardAuth (with its login page, session cookie, forRootAsync/useDashboardAuth,
and the ./react / openDurableConsole launcher that minted the cookie), token /
DURABLE_DASHBOARD_TOKEN and allowUnauthenticated are gone:
| Before | Now |
|---|---|
guards: [JwtAuthGuard] | decorators: [UseGuards(JwtAuthGuard)] (keep imports for its dependencies) |
dashboardAuth: { secret, session | login } | @nestjs/authentication (your sign-in) + decorators: [UseGuards(AuthenticationGuard), Can(ConsolePolicy, 'view')] |
forRootAsync({ useDashboardAuth }) | forRoot({ decorators }): a guard gets its services by DI |
token / DURABLE_DASHBOARD_TOKEN | a guard of your own that checks the header, through decorators |
allowUnauthenticated: true (protected by a proxy or global guard) | say so with a decorator that states it, e.g. decorators: [UseGuards(ProxyAuthGuard)], or mount it yourself |
What it shows
- Runs — every run with its stored status (pending / running / suspended / cancelling /
completed / failed / cancelled / dead), filterable.
pendingis a run that's been created and enqueued but not yet picked up by a worker — you'll see it briefly on every run, and persistently on an API pod (drive: false) whose runs execute on separate driving pods.cancellingis a transient, durable status for acancel(runId, { compensate: true })whose saga undo is still running in the background — it survives a crash mid-compensation and finalizes tocancelled. The status filter is a row of chips, including adeadchip for the dead-letter state; a dead run carries a distinct badge so a poison pill is easy to spot. The genericsuspendedstatus covers very different situations — sleeping on a timer, waiting on a signal, blocked with no worker, queued behind a singleton leader — so the list and detail views refine it into a more legible display state; see Waiting states below. Alongside status the list narrows by tag, search attribute, tenant and the library that declared the workflow — the last two answer "whose run is this" and "whose code is this", and both have a default worth understanding; see Tenant and origin filters. The tag, tenant and attribute controls are pickers over what the runs actually contain, and each takes several values — see Filter pickers. - Timeline as a graph — the selected run rendered with
react-flow: a node pipeline from start through each step to the terminal state, tagged by kind (local / remote / sleep / signal), with worker group and duration. This is the "see the whole flow" view — a workflow whose steps span apps shown as one rail. In-flight steps show up here while they run, not only on completion: a remote step in flight reads aspendingand a local step's executing body asrunning(both rendered as an in-flight node). Local in-flight visibility is on by default — it's the engine'strackStepStartoption — so a longctx.stepis visible the moment it begins. - Step timing — click a step to inspect it. A remote step shows its queued time (how long it sat in the queue before a worker picked it up) next to its processing duration, so you can tell a slow handler apart from a backed-up worker pool. Queue-wait is reported by every transport and every language SDK (including the Python worker).
- Live-tail — the run view streams new lifecycle events as they happen (see below) instead of polling, so a running workflow updates in place.
- Actions — retry a failed/suspended/dead run, cancel a running one, cancel + undo (cancel
with saga compensation), and continue a run paused at a breakpoint.
These are non-blocking: retry re-enqueues the run (
engine.requeue(runId)→pending+ dispatch) and cancel + undo runs the saga compensation in the background — neither replays the workflow inline in the HTTP request, so the dashboard action returns immediately and a worker does the work. (Previously an inline replay could hang the request.)
Filter pickers
The tag, tenant and search-attribute filters list the values the runs actually carry, with a count each, and take several of them.
They used to be free-text boxes, and that made them usable only by an operator who already knew a tenant name or a tag: a typo returned an empty list, which reads exactly like "no runs match". Search attributes were worst — both the key and the value are data nobody memorises.
# [ etl ×] [ nightly ×] ← several values, ORed
@ [ acme ×] ← tenant
⛃ [ tier is any of pro, enterprise ×] [+ attribute]Three things make them worth the machinery:
- The options are counted over the runs the OTHER filters already select. Pick a tenant, and the tag picker offers that tenant's tags. A picker never offers a value whose result set is empty.
- Several values on one axis are ORed, and the axes are ANDed — "these two tenants, tagged either
of these two ways". On search attributes that needs a set operator (
is any of), because two equality predicates on one key are ANDed like every other pair and no run has one attribute with two values. - Typed text still works. The offered list is a bounded top-N (tag cardinality grows with the
data — a
singleton:<key>tag is minted per key), so a rare value can be real and absent; Enter takes it as typed.
A tag or tenant chip on a run row adds to the selection rather than replacing it, which is how a "these two kinds of run" view gets built by clicking.
The values come from GET runs/values, backed by StateStore.runValueFacets. A store that does not
implement it answers [], and the pickers degrade to free-text entry — no error, no empty console.
Counts on the run-table axes (tenant, workflow, status, origin) are exact GROUP BYs over the whole
matching set. Tag and search-attribute counts are taken over a bounded scan of recent matching
runs — their values live inside a JSON array column and a side table rather than in the row being
counted — so treat those numbers as "how common, roughly", not as a total.
Tenant and origin filters
Two of the run-list filters are about provenance rather than state, and they are wired differently on purpose — one pushes down to the store, the other cannot.
Tenant is a sidebar picker matched exactly against the run's namespace — the same field the engine
partitions worker pools by, conventionally fed from DURABLE_TENANT (see
Tenancy). It is sent to the store as the namespace param on GET runs
and POST bulk/:action, so a narrowed list is narrowed in SQL.
Its default is every namespace, and that is a decision rather than an omission: read paths (the
dashboard, getRun) are deliberately not namespace-scoped, so defaulting the console to one tenant
would have silently removed runs that every existing operator had been looking at. This is a filter an
operator chooses, not a scope imposed on them — and it is not an authorization boundary either
(Console protection is mount-level and role-agnostic).
An empty selection is treated as absent, not as an exact match on a tenant named "", so clearing
it returns the all-tenants view rather than an empty one. Selecting several compares them side by
side (RunQuery.namespaces). The tenant chip on a run row adds itself to the selection, like the tag
chips.
Origin — which package declared the run's workflow — is a row of facet chips above the list:
all, one chip per package (labelled without the npm scope, full name in the tooltip), and app
when any run in the list has none, each with a count. The row only appears once at least one run has a
named package origin; when every run lacks one there is nothing to choose between, so it stays hidden. It is derived, never declared: @Workflow
resolves the file it is applied in to the nearest enclosing package.json, so a library is attributed
without opting into anything and nothing a caller passes to start can claim another library's name.
The registrar warns once at boot naming whatever it could not attribute, because a wrong origin is
worse than an absent one.
Which makes undefined a real value meaning "no package origin", not a blank to be tidied away.
The console labels that bucket app: the app's own workflows, not declared by any library. Runs created
before the field existed have none; so do registerRemote, convention routing, and any workflow whose
declaring package couldn't be resolved with confidence. RunQuery.origin is plain equality, so those
runs match no origin value at all — picking a package hides them rather than folding them into a
bucket. Hence the shape of the facet: all is the default and never goes away, the app count
stays on screen while a package is selected, and an origin filter that comes back empty says which of
the two things happened ("nothing matched" vs "these N runs cannot be matched by any package filter")
and offers a jump into the app's own runs. A run's detail header states origin app outright for the
same reason, instead of leaving the field blank.
Both filters push down to the store, including the app (no-origin) one. RunQuery.origin accepts null
for exactly that bucket (origin IS NULL), which the console sends as filter[unattributed]=true — its own
filter field rather than a reserved origin value, because any reserved string is a package name someone can
legitimately publish. The chips' counts come from GET runs/facets, not
from the rows on screen, so the app count stays visible and exact while a package is selected —
the property the facet exists for. Retry all / cancel all send the same predicate, so a bulk
action is scoped to precisely the set the list was showing, unattributed runs included.
The Drizzle adapter needs the origin column added by hand. It has no auto-schema, and Drizzle
SELECTs every column its schema declares, so on an existing database every run query fails until
ALTER TABLE durable_workflow_runs ADD COLUMN origin TEXT; has run — see
Drizzle · Schema is owned by drizzle-kit. The
MikroORM and TypeORM adapters add it on boot, and Prisma emits it through Migrate.
Filters in the URL
The board's filters live in the URL, so copy the link to share a filtered view, bookmark it or reload it. /durable#?status=failed&tag=vip opens the board on failed runs tagged vip, /durable#/run/<id>?status=failed opens a run with that filter kept, and Back/Forward step through your picks. The params are status, tag, namespace, attr (comma-separated sets) and origin (a package name, or (app) for the app's own runs). A filter at its default is left out, so plain #/run/<id> links open as before, and the filters still survive a trip to Workers and back.
At scale: paging, facets and what the numbers mean
A control plane accumulates runs for as long as its retention policy keeps them, so "list the runs" is not a bounded request. The console treats it as a page:
GET runstakespage/size(default 100, at most 500) and answers{ data, meta: { total, perPage, currentPage, lastPage, firstPage } }. The SPA loads page 1, then appends the next page as the last rows scroll into view. The load starts a lookahead before the bottom, so the list reads as continuous rather than stalling at each boundary, and it is gated on the fetch in flight and on the count the page was last requested at — otherwise a control plane whosetotalbriefly runs ahead of its own listing would request pages on every render. New runs arriving between two page fetches shift the offsets, so the SPA drops a run it already holds.- The list is virtualised: only the rows in the viewport are mounted, so a deep page costs the same DOM as a shallow one.
GET runsreturns list rows, not whole runs —input,outputanderrorare omitted, because no row renders them and on a busy deployment they are most of the bytes.GET runs/:idis unchanged and still carries all three; that is where they are displayed.
The numbers behind the design, measured against a deployment holding 9,533 runs: the unpaged listing
was 12.24 MB every three seconds, of which 63% was error — a stack trace on every failed run,
which the list never shows. Rendering it mounted 115,636 DOM nodes and blocked the tab's main thread
for 26.9 out of every 30 seconds.
The list endpoint is always bounded: no size means 100 rows, and a larger size is clamped to
500. Walk page up to meta.lastPage to read every matching run.
Counting without listing
Paging the list raises an obvious question: if the console holds 100 rows, where do the status and
origin chips get their numbers? Not from the page — from GET runs/facets, one
GROUP BY status, origin aggregate over the same tag / tenant / attribute predicates the listing uses:
const facets = await durableClient.facets(tag, attrs, namespace);
// → [{ status: 'failed', origin: '@acme/billing', count: 3658 }, { status: 'failed', origin: null, count: 12 }, …]Over HTTP the route answers { data: [...] } with the same cells. origin: null is the unattributed
bucket — a real, countable cell rather than the absence a value match cannot express.
filter[status], filter[origin] and filter[unattributed] are accepted but dropped before
counting: they are the axes being counted, so narrowing by them would report the answer back to
itself.
It is backed by StateStore.runFacets (optional on the port; a store without it falls back to counting
a listing) and RunGateway.runFacets, which a tenant deployment round-trips to the control plane the
same way it does listRuns.
Wide fans
A run with a 40,000-member fan, whether from ctx.all over children or over a @Step, cannot be
shown member by member. Its full detail is megabytes of JSON, and a row, a graph node and a child
fetch per member would stall the tab. So the console draws each wide fan as one node.
The server summarizes. GET runs/:id folds every parallelGroup with more than 50 members, or
declared wider than 50, into a FanSummary and leaves its members out of timeline. A fan sent in
small waves is summarized from its first wave, because the group carries the fan's declared size.
children is capped at 200 ids, with childCount carrying the total. Pass ?full=true for the
whole timeline and every child id.
The store aggregates. When the store implements checkpointStats and queryCheckpoints (every
bundled store does), the summary is built from one GROUP BY parallel_group, status over the run's
checkpoints. Only the rows the response carries are loaded: the checkpoints outside wide fans, each
wide fan's first 20 failures, the folded fan: checkpoints, and the first child edges. A child fan
still in flight also loads its completed signal:child: rows, because only their payload says
whether the child failed. On a 40,000-member step fan a poll reads 21 rows instead of 40,001. A
custom store without the two methods gets the same response from a full read.
Polls revalidate. GET runs/:id and GET runs/:id/fans/:group send an ETag with
Cache-Control: private, no-cache. The ETag is derived from the run row and the checkpoint
aggregates: a new checkpoint, a status change, a retry or any run update moves it. The browser adds
If-None-Match to the console's next fetch by itself. While nothing has changed, the server
answers 304 after reading the run row and the aggregate, and the browser gives TanStack Query the
body it already has. Over a tenant proxy the operator makes the same check, so an unchanged
tenant's poll costs it no timeline read either. A gateway that cannot version the detail, such as an
older operator, a store without the aggregates, or ?full=true, answers in full every time.
One row and one node per fan. In the spans panel a summarized fan is a single row labelled with
the members' step name (or child runs) and ×<total>. Under it are a segmented progress bar and a
legend with a count for each state that is present:
| Segment | Meaning |
|---|---|
| done | the member completed |
| failed | a step that failed after its retries, or a child run that failed |
| running / pending | in flight, while the run is live |
| not started | not sent yet, while waves are still to go out under concurrency |
| interrupted | still running or pending when the run finished |
| never ran | never sent, once the run has finished. Marked (failFast) when a failFast fan stopped early. |
When fewer members have started than the fan declares, the legend leads with
<started> of <total> started, for example 5100 of 20000 started · 4800 done · 300 pending · 14900 not started. The
first 20 failures are listed under the row, so a failure is visible without opening the fan. The
graph shows the same fan as one card node, with the label, ×<total> (or <started> of <total>),
the progress bar, the legend and the seq range.
A run counts as finished for this purpose only when it is completed, failed, cancelled or
dead. A blocked or suspended run is still in flight, so its unsent members read as
not started rather than never ran.
Members open by page. Expanding the row lists the members in a virtualized list. Only the
100-member pages under the visible rows are fetched from GET runs/:id/fans/:group, and they are
refreshed while the fan is in flight. A failed only toggle narrows the list to failed members.
The typed client calls the same routes:
import { durableClient } from '@dudousxd/nestjs-durable-dashboard/client';
const detail = await durableClient.run(runId); // summarized: detail.fans, detail.childCount
for (const fan of detail.fans ?? []) {
const page = await durableClient.fanMembers(runId, fan.group, { page: 1, size: 100, failed: true });
console.log(fan.label, `${page.meta.total} failed`, page.data.map((cp) => cp.seq));
}Other caps. The header lists 12 child chips plus +N more. The console fetches no child detail
for the members of a summarized fan, and fetches at most 50 child details for the rest of the run.
Live events trigger a refetch at most every 1.5 s.
The summary is computed by the RunGateway
after it loads the run's checkpoints, so every poll still reads the whole run from the store. It
trims what goes over the wire and what the browser renders, not the store read.
Waiting states
The engine only ever persists one generic suspended status for a durably-parked run — that's what
drives recovery, timers, and queries, and it never changes. But why a run is parked reads very
differently depending on what it's waiting on, so the run list and the run detail header refine it into
a more legible display state (both derive it the same way, so they always agree):
| Display state | Means |
|---|---|
sleeping | Parked on a durable ctx.sleep timer. |
awaiting | Waiting on a signal, webhook, awaited child, or a ctx.breakpoint() pause — named e.g. signal approve, webhook stripe-cb, child run-xyz, or breakpoint. |
no-worker | Blocked: the run's next step is queued but its worker group has a real backlog (depth > 0) with zero live workers to consume it. |
queued | A singleton run gated behind another run holding its key's slot — shown as "behind leader <id>". |
running | Everything else open/in-flight, including a settled step waiting to be replayed with nothing currently blocking it. |
The awaiting label is a RunWaiting ({ on: 'signal' | 'webhook' | 'child' | 'breakpoint', name }),
resolved from the run's pending signal waiters and classified by the waiter token's prefix — wh: →
webhook, child: → child, bp: → breakpoint, anything else → a named signal. A ctx.breakpoint()
pause is implemented as a signal wait under the hood, so it's classified and shown as breakpoint
rather than a raw signal bp:<runId>:<seq> token.
no-worker is gated on a real backlog, not bare zero live workers. A worker only heartbeats for a
group while it's actively serving it, so a group that's simply idle right now — a suspended run parked
on its reconcile timer with nothing enqueued, or a scheduled workflow between cron runs — legitimately
reports zero live workers without anything being blocked. Flagging that no-worker was a false
positive, fixed in dashboard 0.29.6: the check is depth > 0 && liveWorkers.length === 0 (the same
alert condition GroupHealth documents, see below) — a real backlog
with no consumer. A parked/settled run with nothing enqueued now reads running (open, in flight) and
only flips to no-worker once its resume actually enqueues behind a stalled queue. This also fixed the
header banner, which used to count completed-work orphans as stalled.
Bulk-resolving waiting state — RunGateway.waitingFor: if you're building your own filtered/
paginated run list and need to know which of your runs are parked on a breakpoint (or any other
event wait) without re-deriving the waiter scan yourself or querying checkpoints directly, call
waitingFor on the injected RunGateway:
import { RunGateway } from '@dudousxd/nestjs-durable';
constructor(private readonly runGateway: RunGateway) {}
async whichAreStuck(runIds: string[]) {
return this.runGateway.waitingFor(runIds);
// { 'run-1': { on: 'breakpoint', name: 'breakpoint' }, 'run-3': { on: 'signal', name: 'approve' } }
}It resolves in two bulk store scans (never one query per id), and on a tenant deployment it proxies over the control-plane transport in a single request for the whole id list, scoped to runs the requesting tenant actually owns.
Live-tail over SSE
The run view tails a run's lifecycle events over Server-Sent Events rather than re-fetching. The
server exposes an @Sse route, GET runs/:id/stream, and the client subscribes with
durableClient.streamRun(id, onEvent):
import { durableClient } from '@dudousxd/nestjs-durable-dashboard/client';
const close = durableClient.streamRun(runId, (event) => {
// event: { type: 'step.completed' | 'run.failed' | …, runId, seq, name, … }
console.log(event.type, event.name);
});
// later: close();This is cross-pod when the engine has a control plane: an event produced by a worker pod is broadcast over the control plane, and a dashboard-only API pod re-delivers it to its SSE subscribers. So you can live-tail a run on the API pod even though the work runs elsewhere. Without a control plane, the stream still works for runs executing on the same instance (single-process apps).
The run view keeps the stream open for as long as the run is open, settled or not, and lists what it
delivers in an Events panel: each event's type and UTC time, newest first, the last 200 kept in
memory. Nothing is stored, so the panel starts empty on every load and shows only what arrives while
the page is open. A run.triggered names its subscriber (linked to its workflow page) and links the
run it started; a run.trigger_failed names its subscriber and its error; a child step's events link
the child run; and the run's own run.started links back to the run whose lifecycle event started it
and to its parent. The stream is the same tenant-scoped one, so the panel shows nothing another
tenant could not already read. An in-flight run's detail refetches on each event (throttled to one per
1.5s); a settled run's only on run.triggered and run.trigger_failed.
Cancel + Undo (saga compensation)
The run actions include both a plain Cancel and a Cancel + Undo. Plain cancel is immediate —
the run is marked cancelled and a late worker result is dropped. Cancel + Undo instead asks the
engine to compensate the saga — in the background, not in the HTTP request: the run is resumed
on a worker so its completed steps' compensate callbacks run in reverse order (each visible as a
compensate:<step> step event in the timeline), then the run is marked cancelled. The HTTP action
returns immediately. The UI sends this as cancel with ?compensate=true:
await durableClient.cancel(runId); // immediate, no undo
await durableClient.cancel(runId, { compensate: true }); // ?compensate=true — undo firstUse Cancel + Undo when the run has already done outside-world work (a charge, a reservation) that must be reversed; use plain Cancel to just stop it.
Dead-letter runs and their links
A run that crash-recovery gives up on — after exceeding maxRecoveryAttempts — is moved to the
dead dead-letter state (a poison pill that would otherwise crash the process every boot). The
dashboard surfaces these as a first-class status: a dead filter chip and a badge on the run.
A dead run is terminal but inspectable, and still retriable from the UI once you've fixed the
cause.
When you configure a deadLetterWorkflow, dead-lettering also starts a handler run (idempotent by
a dlq:<runId> id) carrying { deadRunId, workflow, input, error }. The dashboard renders the
relationship both ways: the dead run links forward to its dlq:<id> handler, and the handler links
back to the dead run it was started for — so you can jump between the failure and whatever your DLQ
workflow did about it (alert, compensate, queue for review).
Runs started by another run finishing
A run started by a lifecycle event
(@OnWorkflowCompleted / @OnWorkflowFailed) is linked both ways in the run header: the settled run
lists the runs it triggered, and each started run shows the run it was started by, how that
run ended (on completed / on failed), its current status and, when the source run recorded its
span's traceparent (with the OTel bridge), the source trace id with a
copy button. They are not parent and child, so neither cancels nor waits for the other. The links come from the run rows themselves (the settled run's durable:triggered:<workflow>
tags and the started run's evt:<runId>:<kind>:<workflow> id), so the dashboard shows them without
registering the subscribing workflows. A settled run still tagged durable:lifecycle:pending has not
published its event to every subscriber yet: its durable:lifecycle:owed:<workflow> tags name the
ones left, and the timer poller's sweep on an instance that has each one picks it up.
A settled run with subscribers lists them under Lifecycle subscribers, one row each with where its
event stands (RunDetail.lifecycleDeliveries, a LifecycleDelivery per subscriber):
- started — the subscriber's run, linked, with its current status;
- owed for N — still owed since the run settled; orphan in N when no live instance
registers or announces the subscriber for the run's namespace, which is when the sweep drops it and
reports
run.trigger_failed; - coalesced — handed to the subscriber's debounce/batch accumulator (the run carries
durable:coalesced:<subscriber>,LIFECYCLE_COALESCED_TAG_PREFIX), linked when its run id can be derived (for a keyed subscriber, from the subscription'swhere,inputandkeyapplied to the event); - failed — its start failed: its
wherethrew, its input was rejected, its start threw, or the sweep dropped it as an orphan. The run carriesdurable:trigger_failed:<subscriber>(LIFECYCLE_TRIGGER_FAILED_TAG_PREFIX), written in the same update that drops its owed tag. The row's Republish button retries that subscriber alone, and a successful start removes the tag; - not started — none of the above: its
wheredeclined the event, or it subscribed after the run settled. Republish starts it.
The tag records only that the start failed. The message is not stored (tags are short and indexed,
and search attributes are indexed into the attribute pickers and checked against the workflow's
schema), so a failed row shows it only when the run.trigger_failed event arrived while the page
was open (see the Events panel); otherwise its tooltip points there. The
Telescope "Failed triggers" table keeps the messages.
To find owed runs, the lifecycle pending chip under the tag picker filters the run list on the
durable:lifecycle:pending tag.
Runs waiting for another run
A run suspended in ctx.waitForRun shows Waiting for run id in its
header, linked, with that run's current status, and the run waited for shows Awaited by with the
waiting runs (RunDetail.waitsFor / awaitedBy, each a RunWaitLink). The run list names the wait
too (RunWaiting { on: 'run', name: <id> }, shown as awaiting run <id>), and a delivered wait's
step in the timeline links to the run it waited for. The links cost the detail one read of the run's
own waiters while it is suspended, one prefix read of the waiters on it, and one batched read of the
linked runs; the summarized detail's ETag covers what they read, so a linked run changing status is
not hidden behind a 304. Through the tenant proxy, waiting runs of other namespaces are left out,
and a linked run in another namespace keeps its id but not its status, namespace or trace id.
A settled run whose workflow has subscribers (registered on the dashboard's instance, or announced by
a live worker) gets a Republish lifecycle event action. After a confirmation it publishes the
run's event again to the subscribers that have not started from it, and shows how many it started
and which failed. It calls POST <apiBasePath>/runs/:id/republish-lifecycle, behind the same gate as
retry and cancel. A subscriber only a worker has is re-marked as owed, so that worker's sweep starts
it. On a tenant deployment it goes through the tenant proxy to the operator, which refuses another
tenant's run; an operator too old for the verb answers "not supported by this server" (501).
A workflow's page: who starts whom
The workflow name in a run's header links to the workflow's page (#/workflow/<name>), and a run
whose workflow starts or is started by another shows the same two lists under its header:
- Starts when it settles — the subscribers of
run.completed:<workflow>andrun.failed:<workflow>, each with its kind (on completed/on failed) and what the subscription does:where(filters payloads),input(maps the payload),debounce/batch(by keywhen keyed), andannouncedfor a subscriber only live workers announce, such as a Python workflow (which has nowhereorinput). - Started by — the workflows whose settling starts this one.
On the control plane, each entry of "Starts when it settles" also shows how many runs it was started
for and how many starts failed (12 started · 1 failed), counted by the dashboard's server process
since it started (triggerCounts on the response, from the metrics collector's
triggeredBySubscriber and triggerFailedBySubscriber); a tenant deployment shows none.
Each entry links to that workflow's page. The lists come from the dashboard instance's registry plus
the subscriptions the fleet announces (the engines' lifecycle registry runs in the state store, and
subscribes on worker descriptors), so a subscriber that runs only on another instance shows up too. The page reads GET <apiBasePath>/workflows/:name/lifecycle
(engine.workflowLifecycle(name), RunGateway.workflowLifecycle), and the run detail carries the
same object as workflowLifecycle when it is not empty; older consoles ignore the field. A tenant
deployment reads it from the operator through the tenant proxy, which lists only the subscribers of
the tenant's namespace (501 when the operator is too old for the verb).
The engines' lifecycle registry runs (workflow __lifecycle_registry) are bookkeeping, not runs
anyone started: the run list, its status and origin counts and its filter pickers leave them out,
unless you filter on that workflow by name.
Recovering a lost remote step dispatch
A remote step with no timeoutMs dispatches its task, persists a pending checkpoint, and suspends
until the worker's result resumes it. If the worker crashed mid-step or the transport dropped the job
(a Redis flush/eviction, or a stalled BullMQ job moved to failed and removed), the result never
comes — and reconcile re-drives, by design, just re-suspend a still-pending step rather than
re-dispatching it (so a merely-slow worker is never double-run). Left alone, the run hangs on pending
forever.
The dashboard flags this instead of masquerading it as a healthy in-flight step: a remote step
pending past 10 minutes (STALE_PENDING_MS) shows in the timeline as "awaiting worker result —
dispatched Nm ago (possibly lost)". From there:
-
Re-dispatch action —
POST runs/:id/redispatch(durableClient.redispatch(id), or the dashboard's "Re-dispatch" button) re-enqueues the run's stuckpendingremote steps, bumping theirattemptsso the idempotent step re-runs and its result resumes the run — the manual escape hatch, equivalent toWorkflowEngine.redispatchPending(runId). -
BullMQ self-heals for free — if the CONSUMER bridges. The BullMQ transport bridges a crashed/stalled task job's terminal failure into a synthetic failed
StepResult(via the worker's'failed'event), so the engine marks the checkpointfailedand its normal durable retry re-dispatches. That bridge belongs to the SDK consuming the queue: the TypeScript transport and the Pythondurable-worker(recent releases) have it; a worker on any other SDK does not, and its steps do get stuck onpending. -
Opt-in self-heal —
remoteRedispatchMs(any transport, any consumer). Set this engine option and a dispatched remote step carries a lease on itspendingcheckpoint: a result — or a step-scoped heartbeat, which renews the lease (throttled to one write per half-window, not one per beat) — must land before it lapses, and a lapsed lease re-dispatches the step automatically, bounded byremoteRedispatchMax(default 10) so a step that never settles fails as aremote_step_losterror instead of looping forever. Covers a polyglot workflow'sctx.gather_callsfan-out as well as an in-processctx.step(core 0.71+):DurableModule.forRoot({ store, transport, remoteRedispatchMs: 15 * 60_000, // self-heal a remote step still pending after 15 minutes remoteRedispatchMax: 10, });Off by default — re-dispatch can double-run a step whose original job is merely slow and sends no heartbeat, so the window must exceed the longest such step's real duration and the step must be idempotent. A re-drive is distinguishable from a retry: the
step.startedevent carriesredispatched: trueand the checkpoint's event trail gets awarnstep.redispatched. Prefer a per-steptimeoutMswhere you can (tighter, heartbeat-aware — see Retries & backoff);remoteRedispatchMsis the store-driven net for the no-timeout steps that must still survive a lost dispatch.
Webhook callbacks
A ctx.webhook() hands a third party a callback URL (built by your webhookUrl option). When they
POST it, the dashboard's POST webhooks/:token endpoint turns that body into the signal the waiting
run resumes on. The token embeds runId:seq, so treat it as a secret, and front it with signature
verification in your own middleware.
The route is not part of the console: authorize does not apply to it, because the third party
cannot sign in and the token is the secret. A production app with no authorize still receives
callbacks while its console answers 403. The guards in decorators do apply, as on every route
the module mounts, so do not put a guard there that a third party cannot pass, or mount the callback
yourself (see Delivering the callback yourself).
Live queries and updates
Two more endpoints expose a run's query/update surface over HTTP:
GET runs/:id/events/:key— read the latest value a run published withctx.setEvent(key, …), a side-effect-free live query of an in-flight (or finished) run's state (progress, a partial result). Returnsundefinedif the run never published that key.POST runs/:id/updates/:name— deliver a validated update to a run waiting atctx.onUpdate(name); the request body is the update argument. Any validator registered viaengine.registerUpdateValidatorruns first, so a rejected update never reaches the run.
Fleet health
When you run a split or polyglot cluster, the dashboard grows a health / compatibility panel fed by the handshake descriptors and diagnostics events:
- Per pod — its protocol version, negotiated level (compatible / degraded / incompatible), and a red flag with the exact reason on a mismatch (e.g. "worker speaks protocol 2, control-plane speaks 1 → stopped").
- Blocked runs — runs parked because no live worker advertises a required capability ("requires capability X, no worker"), so a stuck fleet is diagnosable at a glance rather than a silent hang.
A store-less tenant api/dashboard pod serves this same view — its reads proxy to the control
plane over the wire, so the panel looks identical whether or not the pod owns a store.
Engine health & admin surface
The dashboard's Workers panel and its retry/cancel actions are a thin layer over methods
WorkflowEngine exposes directly — useful when you're scripting an operational task instead of
clicking through the SPA.
Worker liveness and adaptive concurrency — engine.workerHealth(extra?: string[]) returns one
GroupHealth per worker group (the same call the dashboard's /durable/api/workers route and the
Telescope worker panels use):
interface GroupHealth {
group: string;
/** Outstanding jobs in the group's task queue (waiting + active + delayed + prioritized). */
depth: number;
/** Workers with a non-expired heartbeat for this group. */
liveWorkers: WorkerHeartbeat[];
}
interface WorkerHeartbeat {
group: string;
/** Stable per-process id (host + pid) — N replicas of a group each show as a distinct worker. */
instanceId: string;
lastBeatAt: number;
/** Present on newer SDKs: concurrency mode/limit, in-flight, RAM %/CPU %, throughput, p95, last adjust. */
status?: WorkerStatus;
}depth > 0 && liveWorkers.length === 0 is the actionable alert — work queued with nothing consuming
it. Pass extra to include local-step groups the engine can't derive from its registrations (they
have no heartbeat to discover otherwise). Only a groupHealth-capable transport (BullMQ) returns
non-empty results.
Bulk operations:
engine.cancelWhere(filter, opts?)— cancel every run matching aRunQuery(workflow / status / tag / search-attribute predicates) — the same matching the dashboard's run list uses. Each match runs through the normalcancelpath (child cascade, optional sagacompensate, cancel listeners, control-plane broadcast), so it's the scriptable form of selecting rows and hitting Cancel. Returns oneRunResultper matched run.engine.deleteRun(runId)— hard-delete a run and its entire subtree (checkpoints, signal waiters, search-attribute rows), cascading depth-first viagetRunChildren. Unlikecancel, the run vanishes fromgetRun/listRunsentirely. Returns the number of runs deleted. Prefercancelfor a still-live run — deleting one mid-flight orphans its worker.engine.getRunChildren(parentRunId)— the ids a run spawned viactx.child(awaited) orctx.startChild(fire-and-forget), the same parent→children edgecancelWhere's cascade and the dashboard's run-tree both walk.
Graceful shutdown — engine.drain(timeoutMs = 10_000) stops the engine picking up new runs
(recovery and the timer poller become no-ops) and waits for in-flight executions to settle, up to
timeoutMs. Call it from your app's shutdown hook so a deploy hands off cleanly instead of leaving
runs to time out their lease.
Cross-instance hooks — onEnqueued/onCancel let a worker react to activity from other
instances over the control plane, without polling:
// Wire a worker to pick up a run the instant another pod enqueues it. `runEnqueued` is bounded and
// skips a run another instance already took.
const stopEnqueued = engine.onEnqueued((runId) => engine.runEnqueued(runId));
// Cooperative cancellation: abort in-flight work instead of finishing it just to
// have the result discarded.
const stopCancel = engine.onCancel((runId) => myWorkerBridge.abort(runId));Both return an unsubscribe function. onEnqueued is only useful on instances that should execute
runs (workers); onCancel is for a worker bridge doing cooperative cancellation of long in-flight
work (a subprocess, a remote call) that a plain status flip can't interrupt.
API
The SPA is backed by a small JSON API you can also call directly. A codegen-emitted typed client
ships at the ./client subpath as durableClient, so an external dashboard or script can call the
same routes with full types instead of hand-rolling fetch:
import { durableClient } from '@dudousxd/nestjs-durable-dashboard/client';
const { data: runs, meta } = await durableClient.runs('failed', undefined, undefined, { page: 1, size: 100 });
const detail = await durableClient.run(runs[0].id); // meta.total counts every failed run
await durableClient.retry(detail.run.id);| Method | Route | |
|---|---|---|
GET | /durable/api/runs | one page of runs, newest first, as { data, meta }. Filters: filter[status], filter[workflow], filter[namespace], filter[tag], filter[origin] (each takes one value, a,b or filter[x][]=a&filter[x][]=b for a SET, or [eq] / [in]), filter[unattributed]=true, and filter[attr.<key>][op]=value with op one of eq, ne, gt, gte, lt, lte, in. Paging: page (default 1) and size (default 100, at most 500). sort accepts only -createdAt. An unknown field or operator is a 400. Returns list ROWS: no input / output / error |
GET | /durable/api/runs/facets | (status, origin) counts over the same tag / tenant / attribute predicates, as { data } — the chips' numbers, whole-set rather than per-page |
GET | /durable/api/runs/values | the distinct values of one filter field over the runs the other filter[...] predicates select — ?groupByCount[field]=tag&groupByCount[limit]=20 (nestjs-filter's own facet wire). Answers { value, count }[]; this is what fills the pickers |
GET | /durable/api/runs/:id | run + step timeline, payloads included. Fans wider than 50 come back as fans: FanSummary[] instead of their members, and children is capped at 200 with childCount as the total; ?full=true returns everything. Sends an ETag when the gateway can version it, and answers a matching If-None-Match with 304. See Wide fans |
GET | /durable/api/runs/:id/fans/:group | one page of a fan's members in seq order, { data, meta } — page (default 1), size (default 100, at most 500), filter[failed]=true for failed members only. :group is the fan's URL-encoded parallelGroup. 404 for an unknown run, or when the gateway cannot page fans. ETag / 304 as above |
GET | /durable/api/schedules | the persisted schedules, soonest-due first, as { data } — filter[namespace], filter[workflow], filter[tag], filter[paused]=true|false, and size (default 200, at most 1000). Not paged: the store cannot count schedules, and the soonest-due order moves each time one fires |
GET (SSE) | /durable/api/runs/:id/stream | live-tail the run's lifecycle events |
POST | /durable/api/runs/:id/retry | re-enqueue the run (→ pending, a worker resumes it) |
POST | /durable/api/runs/:id/retry-with-input | fix-and-replay: start a fresh linked run from a dead/failed run with a corrected input (body: { input }) |
POST | /durable/api/runs/:id/redispatch | re-enqueue a run's stuck pending remote steps (a lost dispatch) |
POST | /durable/api/runs/:id/cancel | cancel the run (?compensate=true to undo the saga first) |
POST | /durable/api/runs/:id/continue | resume a run paused at a breakpoint |
POST | /durable/api/webhooks/:token | deliver a ctx.webhook() callback (body resumes the run) |
GET | /durable/api/runs/:id/events/:key | read a live query value (ctx.setEvent) |
POST | /durable/api/runs/:id/updates/:name | deliver an update (ctx.onUpdate); body is the arg |
GET | /durable/api/consoles | the other Aviary consoles this viewer may open (see Switching between consoles) |
GET | /durable/api/consoles/search?q= | global search across this console and the others the viewer may open (see Searching all consoles) |
MCP tools
When the app imports the agent's MCP server (AgentMcpServerModule from
@dudousxd/nestjs-agent-mcp-server), the console is also served as developer tools on its dev
endpoint, /mcp/aviary. Each call is gated by this console's authorize and goes through
DashboardService, the same service the console's API uses, so tenancy applies as it does in the
console.
| Tool | Kind | Input |
|---|---|---|
durable_list_runs | read | status?, workflow?, tag?, namespace?, origin?, attr? (key:op:value), cursor?, limit? |
durable_get_run | read | id, full?, field? (one top-level field only, e.g. steps) |
durable_list_fan_members | read | id, group, failed?, cursor?, limit? |
durable_count_runs_by | read | field (status, workflow, origin, namespace, tag, attributeKey, attributeValue with key), workflow?, tag?, namespace?, attr?, cursor?, limit? |
durable_get_health | read | — (run counts by status, backlog, dead and blocked runs, starved queues, live workers) |
durable_list_workers | read | — |
durable_list_schedules | read | workflow?, tag?, namespace?, paused?, cursor?, limit? |
durable_get_run_event | read | id, key |
durable_retry_run | action | id, or ids (1 to 100) |
durable_cancel_run | action, destructive | id, or ids (1 to 100); compensate? |
durable_continue_run | action | id |
durable_signal_run | action | token, payload? (JSON text) |
durable_trigger_schedule | action | key (the schedule id) |
durable_pause_schedule | action | key, paused? (false resumes it) |
Lists return { items, next }; pass next back as cursor. A cursor no page returned is an error.
An unknown run, fan or schedule is an error that says "not found". durable_list_runs leaves out a
run's input and output and keeps the first line of its error; durable_get_run returns them.
With ids, retry and cancel act on the runs in order and stop at the first that fails, answering
{ applied, failed: { id, error }, skipped }. durable_signal_run answers { delivered: false }
when no run you can see waits on the token yet; the engine then holds the payload for the run that
waits on it next.
The signal, run event and schedule tools need the control plane: on a tenant deployment they are not offered. The actions are offered only when the MCP server lists actions.
The tools are registered while the console's routes are mounted. devTools: true keeps them with
routes: false, and devTools: false turns them off:
DurableDashboardModule.forRoot({ authorize: AdminAuthorizer, devTools: false });Switching between consoles
When the app mounts other Aviary consoles too (Telescope, Agents, Media), the console's brand
becomes a menu that lists the ones the viewer may open, and links to them. Each is listed only when
its own authorize allows the viewer. That authorize then also runs once each time the page
loads. With no other console, or none the viewer may open, the brand stays as it is. There is
nothing to configure. The Workflows console is listed in the other consoles' menus while its routes
are mounted.
Searching all consoles
Ctrl/Cmd+K (the Search button in the top bar, or Search all consoles in the menu) opens one search box over every console the viewer may open. Here it finds a run by its exact id and workflows whose name contains the text; the other consoles add their own hits (Telescope entries, agent threads, media files). The console's own pages (Runs, Workers, Schedules) are listed first. Each console gets 300 ms and shows at most 5 hits.
Each console is asked on its own, so its group appears as soon as it answers, while the box shows "Searching N consoles…" for the rest. Earlier hits stay on screen, dimmed, while a new query runs, and "Nothing found" appears only once every console has answered. A console that fails to answer is named under the results with a Retry.
The endpoint is GET <api>/consoles/search?q= (&console=<id> for one console). It sits behind this
console's own authorize like the rest of the API, and asks another console only after that
console's authorize allowed the viewer.
Skipping audit logs for switcher checks
To list the other consoles, and before searching them, the switcher runs their authorize on the
current request. That's a check, not a visit. While it runs, the request carries
aviaryProbe: true, so an authorize that writes an audit trail can skip it:
DurableDashboardModule.forRoot({
authorize: async (ctx) => {
const req = ctx.switchToHttp().getRequest();
const allowed = req.user?.isAdmin === true;
if (!req.aviaryProbe) await audit.log('durable-console', req.user, allowed);
return allowed;
},
});Who is signed in, and signing out
The console's sidebar ends with the signed-in user (name, role), a light/dark theme toggle (kept per
browser) and a sign-out button. Both the user row and the sign-out are optional and come from two
forRoot options:
DurableDashboardModule.forRoot({
decorators: [UseGuards(AuthenticationGuard)],
authorize: (ctx) => ctx.switchToHttp().getRequest().user?.isAdmin === true,
// Who the footer shows. Sync or async; null, undefined or a throw shows no user row.
viewer: (req) => ({ label: req.user.displayName, email: req.user.email, role: 'admin' }),
// How the footer signs out.
signOut: { action: '/auth/logout', csrfToken: (req) => req.csrfToken?.() },
});viewer — (request) => { label, email?, role? }. Without it the console reads request.user
(whatever your guards in decorators already set): fullName, then name, then email for the
label, and role or the first of roles (a string or { name }). Reading it never starts an
authentication; no user means no user row.
signOut — one of:
| Value | The footer renders |
|---|---|
'/logout' | a POST form to /logout, with _csrf when the request has req.csrfToken() |
{ href: '/logout' } | a plain link |
{ action: '/logout', csrfToken: (req) => token } | a POST form with your token as _csrf |
false | no sign-out button |
Without it, the console uses the sign-out an account console announced on the shared Aviary
consoles registry (account.signOut: a path, { action } or { href }), and otherwise shows none.
Only same-origin paths (/x) are ever sent to the page; anything else is dropped.
Both land in the page's JSON config block (durable-dashboard-config) as data, so a strict CSP
still allows them. The console UI itself follows the shared Aviary console kit (light and dark,
phone-width drawer); see docs/AVIARY-UI.md in the repository.
Observability
Seeing what your workflows are doing — the embedded control-plane dashboard, OpenTelemetry spans, dependency-free metrics, the Telescope watcher, and the raw diagnostics bus underneath them.
Federated console
One durable console on a central app that shows the runs of several apps. Each app keeps its own store and executes its own runs; the console reads their stores and sends actions to them over their brokers.