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 Parameter | Default type |
|---|---|
TState extends object | Record<string, unknown> |
Properties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
dispatchArgs? | readonly | unknown | Args supplied to Dispatch when this task was scheduled. | packages/workflow/src/types.ts:103 |
emit | readonly | (name, payload?) => void | Emit 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 |
signal | readonly | AbortSignal | AbortSignal 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 |
state | readonly | Readonly<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 |
stepNumber | readonly | number | Monotonically increasing execution-step counter (0-based). | packages/workflow/src/types.ts:80 |
taskId | readonly | string | Per-task identifier — unique within a single execution step. | packages/workflow/src/types.ts:82 |
threadId | readonly | string | Stable thread identifier for the current run. | packages/workflow/src/types.ts:78 |