Skip to content

Graphorin API reference v0.1.0


Graphorin API reference / @graphorin/workflow / / WorkflowContext

Interface: WorkflowContext<TState>

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

Argument shape passed to a node's run(...) callback. The runtime supplies a fresh context per task with the writer-bound emit helper plus per-task identifiers.

Stable

Type Parameters

Type ParameterDefault type
TState extends objectRecord<string, unknown>

Properties

PropertyModifierTypeDescriptionDefined in
dispatchArgs?readonlyunknownArgs supplied to Dispatch when this task was scheduled.packages/workflow/src/types.ts:103
emitreadonly(name, payload?) => voidEmit a WorkflowCustomEvent into the run's event stream. Visible to callers that opted in via stream: 'custom' or stream: 'debug'.packages/workflow/src/types.ts:95
signalreadonlyAbortSignalAbortSignal propagated from the caller (or generated by the runtime when an internal abort fires). Honour this in long-running node bodies — the workflow engine waits up to 100 ms after abort before treating the task as orphaned.packages/workflow/src/types.ts:89
statereadonlyReadonly<TState>Frozen snapshot of the workflow state visible to this task. The runtime hands every parallel task the same snapshot to keep channel writes free of cross-task ordering surprises.packages/workflow/src/types.ts:101
stepNumberreadonlynumberMonotonically increasing execution-step counter (0-based).packages/workflow/src/types.ts:80
taskIdreadonlystringPer-task identifier — unique within a single execution step.packages/workflow/src/types.ts:82
threadIdreadonlystringStable thread identifier for the current run.packages/workflow/src/types.ts:78