Skip to content

Graphorin API reference v0.7.0


Graphorin API reference / @graphorin/workflow / / WorkflowConfig

Interface: WorkflowConfig<TState>

Defined in: packages/workflow/src/types.ts:280

Configuration accepted by createWorkflow. The shape is the single point of contact between a consumer's workflow definition and the runtime - every other public type derives from it.

Stable

Type Parameters

Type ParameterDefault type
TState extends objectRecord<string, unknown>

Properties

PropertyModifierTypeDescriptionDefined in
cancelGraceMs?readonlynumberGrace window (in milliseconds) applied after AbortSignal.abort() before in-flight task promises are considered orphaned. Default: 100 ms.packages/workflow/src/types.ts:314
channelsreadonlyReadonly&lt;{ [K in keyof TState]: Channel<TState[K]> }&gt;-packages/workflow/src/types.ts:284
checkpointStorereadonlyCheckpointStore-packages/workflow/src/types.ts:288
durability?readonlyDurabilityModeDefault durability mode. Defaults to sync.packages/workflow/src/types.ts:290
edgesreadonlyreadonly WorkflowEdge&lt;TState&gt;[]-packages/workflow/src/types.ts:283
initialState?readonlyPartial&lt;TState&gt;Optional initial state - merged with the input on execute(...).packages/workflow/src/types.ts:286
journalSteps?readonlybooleanStep-result journaling (D1 / workflow-04, opt-in). When true, the engine journals a step-intent record plus each completed task's channel writes against the PARENT checkpoint as tasks finish, so a crash between task completion and the step checkpoint no longer re-runs completed side effects: crash recovery replays the journaled writes and re-runs only the unfinished tasks. Default false (one extra store write per completed task when on).packages/workflow/src/types.ts:353
maxConcurrentTasks?readonlynumberCap on tasks executing concurrently within one step (D1 / workflow-10). Planned tasks beyond the cap queue and start as slots free up; Dispatch fan-outs are bounded the same way. Absent ⇒ unbounded (the pre-D1 behaviour).packages/workflow/src/types.ts:335
maxSteps?readonlynumberMaximum number of execution steps before the engine bails out - an infinite-loop safeguard that surfaces as a structured error. W-122: counted PER INVOCATION of execute/resume/retry/tick - a durable thread that cycles through timers and approvals for months never trips it, and a capped-out invocation is retryable (retry starts a fresh counter). Default: 200.packages/workflow/src/types.ts:301
maxTotalSteps?readonlynumberW-122: opt-in LIFETIME quota over the cumulative step number across every invocation of the thread. Default: undefined (no lifetime cap). Fails with the same max-steps-exceeded code but a distinct message.packages/workflow/src/types.ts:308
namereadonlystring-packages/workflow/src/types.ts:281
nodeDefaults?readonly{ retry?: WorkflowNodeRetryPolicy; timeoutMs?: number; }Default per-node execution policy (D1 / workflow-03), overridden by the same fields on an individual WorkflowNode.packages/workflow/src/types.ts:325
nodeDefaults.retry?readonlyWorkflowNodeRetryPolicy-packages/workflow/src/types.ts:327
nodeDefaults.timeoutMs?readonlynumber-packages/workflow/src/types.ts:326
nodesreadonlyReadonly<Record<string, WorkflowNode&lt;TState&gt;>>-packages/workflow/src/types.ts:282
pauseAt?readonlyWorkflowPauseAt-packages/workflow/src/types.ts:287
tracer?readonlyTracerOptional tracer; defaults to the framework's NOOP_TRACER.packages/workflow/src/types.ts:292
validateState?readonly(state) => voidOptional state validator. When provided, the engine calls it after applying every step's writes; any thrown error produces a state-validation-failed workflow error and aborts the run.packages/workflow/src/types.ts:320
version?readonlystringWorkflow definition version pin (D1 / workflow-14). Stamped into every persisted frontier; a resume whose stored version differs fails loudly with workflow-version-mismatch (opt out per call via WorkflowResumeOptions.allowVersionMismatch). Absent ⇒ no pinning.packages/workflow/src/types.ts:343