DurableWorkerDeps
@forge/monorepo / backend/src / DurableWorkerDeps
Type Alias: DurableWorkerDeps
DurableWorkerDeps =
object
Defined in: backend/src/runtime/worker.ts:76
Properties
buildContext
readonlybuildContext: (run) =>ExecutionContext|Promise<ExecutionContext>
Defined in: backend/src/runtime/worker.ts:87
Host builds the execution context; identity never comes from model output.
Parameters
run
Returns
ExecutionContext | Promise<ExecutionContext>
channelFor?
readonlyoptionalchannelFor?: (run) =>string
Defined in: backend/src/runtime/worker.ts:96
Realtime channel for a run's events. Defaults to conversation:<id>.
Parameters
run
Returns
string
checkpoints
readonlycheckpoints:CheckpointStore
Defined in: backend/src/runtime/worker.ts:78
clock?
readonlyoptionalclock?: () =>string
Defined in: backend/src/runtime/worker.ts:91
Returns
string
concurrencyFor?
readonlyoptionalconcurrencyFor?: (tenantId) =>Promise<number|undefined> |number|undefined
Defined in: backend/src/runtime/worker.ts:133
The tenant's concurrent-run limit, or undefined for unlimited — REQ-058 (#246), task #265.
A function rather than a value, for the reason RateLimitGuardDeps.policyFor gives: limits are per tenant
and change without a redeploy, and a value captured at construction would be the limits of whoever booted
the process.
Absent or non-positive means unlimited, which is the branch that matters on the day this ships. A deployment upgrading into the feature with nothing configured must keep working; the alternative is an outage caused by adding a safety feature, which is how safety features get removed.
Parameters
tenantId
Run["tenantId"]
Returns
Promise<number | undefined> | number | undefined
deferralBackoffMs?
readonlyoptionaldeferralBackoffMs?:number
Defined in: backend/src/runtime/worker.ts:141
How long a deferred run waits before its next attempt. Default one second.
Not zero, and not the lease length. Zero spins a worker against the cap, burning capacity on the check itself; a full lease is longer than most runs, so a freed slot would sit idle. A second is short enough that a slot is picked up promptly and long enough that the retry is not the load.
engine
readonlyengine:AgentEngine
Defined in: backend/src/runtime/worker.ts:80
eventLog?
readonlyoptionaleventLog?:RunEventLog
Defined in: backend/src/runtime/worker.ts:82
Durable per-run event log for reconnect catch-up. Optional but required for gap-free reconnect.
keepaliveEveryMs?
readonlyoptionalkeepaliveEveryMs?:number
Defined in: backend/src/runtime/worker.ts:94
leaseMs?
readonlyoptionalleaseMs?:number
Defined in: backend/src/runtime/worker.ts:93
locks?
readonlyoptionallocks?:DistributedLockStore
Defined in: backend/src/runtime/worker.ts:90
Optional belt-and-suspenders mutual exclusion around the atomic claim.
messages?
readonlyoptionalmessages?:MessageStore
Defined in: backend/src/runtime/worker.ts:109
Records the assistant's turn when a run reaches a terminal state — #157.
Optional, because a host that reads history from the event log instead does not need it. Supply it and the
next run's loadHistory sees what the assistant said; leave it out and the agent has amnesia between runs
unless the host reconstructs the turn itself. That reconstruction was the gap: MessageStore was
read-only, so the user's turn was persisted and the assistant's never was, and every host had to fold the
event log to paper over the asymmetry.
Writes are idempotent on a message id derived from the run id, so a resumed run that completes after a restart records one turn, not two.
now?
readonlyoptionalnow?: () =>number
Defined in: backend/src/runtime/worker.ts:92
Returns
number
onRunSettled?
readonlyoptionalonRunSettled?: (input) =>Promise<void> |void
Defined in: backend/src/runtime/worker.ts:142
Parameters
input
context
outcome
"completed" | "failed" | "cancelled"
run
Returns
Promise<void> | void
publisher
readonlypublisher:RealtimePublisher
Defined in: backend/src/runtime/worker.ts:79
runs
readonlyruns:RunStore
Defined in: backend/src/runtime/worker.ts:77
usage?
readonlyoptionalusage?:UsageRecorder
Defined in: backend/src/runtime/worker.ts:85
Records durable usage per realized step (doc 12). Recorded as usage is realized, so a later failure never loses the usage already consumed — and idempotently, so recovery never double-counts.
workerId
readonlyworkerId:string
Defined in: backend/src/runtime/worker.ts:88