smithers-orchestrator unless noted otherwise.
Additional public type families are also exported for adjacent surfaces:
| Family | Exports |
|---|---|
| Workflow builder | CreateSmithersApi |
| Serve app | ServeOptions |
| Observability | ResolvedSmithersObservabilityOptions, SmithersLogFormat, SmithersObservabilityOptions, SmithersObservabilityService |
| Agents | AnthropicAgentOptions, OpenAIAgentOptions, PiAgentOptions, PiExtensionUiRequest, PiExtensionUiResponse |
| Scorers | ScoreResult, ScorerInput, ScorerFn, Scorer, SamplingConfig, ScorerBinding, ScorersMap, ScoreRow, AggregateScore, ScorerContext, CreateScorerConfig, LlmJudgeConfig, AggregateOptions from smithers-orchestrator/scorers |
| Renderer / builder internals | HostContainer, SmithersSqliteOptions |
| VCS helpers | RunJjOptions, RunJjResult, JjRevertResult, WorkspaceAddOptions, WorkspaceResult, WorkspaceInfo |
Workflow Types
SmithersWorkflow<Schema>
| Field | Type | Description |
|---|---|---|
db | unknown | Drizzle ORM database instance |
build | (ctx: SmithersCtx<Schema>) => ReactElement | Renders the workflow JSX tree |
opts | SmithersWorkflowOptions | Workflow-level options |
schemaRegistry | Map<string, SchemaRegistryEntry> | Output table names to schema entries |
SmithersWorkflowOptions
| Field | Type | Default | Description |
|---|---|---|---|
cache | boolean | undefined | Enable task output caching across runs |
SchemaRegistryEntry
| Field | Type | Description |
|---|---|---|
table | any | Drizzle ORM table definition |
zodSchema | ZodObject<any> | Zod schema for output validation |
Context Types
SmithersCtx<Schema>
| Field / Method | Type | Description |
|---|---|---|
runId | string | Current run ID |
iteration | number | Current Loop iteration (0 outside loops) |
iterations | Record<string, number> | Loop ID to current iteration count |
input | Inferred from Schema | Typed input data |
outputs | OutputAccessor<Schema> | Accessor for all output rows |
output(table, key) | InferRow<T> | Get output row. Throws if missing. |
outputMaybe(table, key) | InferRow<T> | undefined | Get output row or undefined |
latest(table, nodeId) | any | Latest output row (highest iteration) |
latestArray(value, schema) | any[] | Parse array field with Zod, drop invalid items |
iterationCount(table, nodeId) | number | Distinct iteration count for a node |
OutputKey
| Field | Type | Default | Description |
|---|---|---|---|
nodeId | string | — | Task node ID |
iteration | number | 0 | Loop iteration |
OutputAccessor<Schema>
Callable object that retrieves output rows. Can be called as a function or accessed as a property.InferRow<TTable>
Extracts the select row type from a Drizzle table.Run Types
RunOptions
| Field | Type | Default | Description |
|---|---|---|---|
runId | string | Auto-generated | Custom run identifier |
input | Record<string, unknown> | — | Input data (required) |
maxConcurrency | number | undefined | Max parallel tasks |
onProgress | (e: SmithersEvent) => void | undefined | Lifecycle event callback |
signal | AbortSignal | undefined | Cancellation signal |
resume | boolean | false | Resume from last checkpoint |
workflowPath | string | undefined | Workflow file path (for tool context) |
rootDir | string | undefined | Sandbox root for tools |
logDir | string | null | undefined | Event log directory (null to disable) |
allowNetwork | boolean | false | Allow bash network access |
maxOutputBytes | number | 200000 | Max output bytes per tool call |
toolTimeoutMs | number | 60000 | Tool execution timeout (ms) |
hot | boolean | HotReloadOptions | undefined | Hot-reload mode |
HotReloadOptions
| Field | Type | Default | Description |
|---|---|---|---|
rootDir | string | Auto-detect | Directory to watch |
outDir | string | .smithers/hmr/<runId> | Generation overlay directory |
maxGenerations | number | 3 | Max overlay generations |
cancelUnmounted | boolean | false | Cancel unmounted tasks after reload |
debounceMs | number | 100 | File change debounce (ms) |
RunResult
| Field | Type | Description |
|---|---|---|
runId | string | Run identifier |
status | string | Terminal status |
output | unknown | Final output (if finished) |
error | unknown | Error details (if failed) |
RunStatus
| Value | Description |
|---|---|
"running" | Actively executing |
"waiting-approval" | Awaiting human approval |
"finished" | All tasks completed |
"failed" | Unrecoverable task failure |
"cancelled" | Cancelled via AbortSignal or API |
Task Types
TaskDescriptor
Internal representation of a task extracted from the JSX tree. Scheduled and executed by the engine.| Field | Type | Description |
|---|---|---|
nodeId | string | Unique task identifier (from id prop) |
ordinal | number | Execution order position (depth-first) |
iteration | number | Current Loop iteration |
ralphId | string | Parent Loop ID |
dependsOn | string[] | Explicit dependency node IDs |
needs | Record<string, string> | Named dependencies (keys = context keys, values = node IDs) |
worktreeId | string | Assigned git worktree ID |
worktreePath | string | Worktree filesystem path |
worktreeBranch | string | Worktree branch name |
outputTable | Table | null | Drizzle table for output persistence |
outputTableName | string | Output table name |
outputRef | ZodObject<any> | Zod schema reference from output prop |
outputSchema | ZodObject<any> | Zod schema for validating agent output |
parallelGroupId | string | Parent <Parallel> group ID |
parallelMaxConcurrency | number | Concurrency limit from parent <Parallel> |
needsApproval | boolean | Requires human approval |
approvalMode | "gate" | "decision" | "gate" pauses before execution; "decision" records a decision |
approvalOnDeny | "fail" | "continue" | "skip" | Behavior on denial |
skipIf | boolean | Skip this task |
retries | number | Retry attempts on failure |
retryPolicy | RetryPolicy | Backoff configuration |
timeoutMs | number | null | Task timeout (ms) |
continueOnFail | boolean | Continue workflow on failure |
cachePolicy | CachePolicy | Cache configuration |
agent | AgentLike | AgentLike[] | Agent or fallback chain |
prompt | string | Prompt text (from children) |
staticPayload | unknown | Pre-computed payload (non-agent tasks) |
computeFn | () => unknown | Promise<unknown> | Compute callback |
label | string | Display label |
meta | Record<string, unknown> | Arbitrary metadata |
AgentLike
RetryPolicy
| Field | Type | Default | Description |
|---|---|---|---|
backoff | "fixed" | "linear" | "exponential" | undefined | Backoff strategy |
initialDelayMs | number | undefined | Initial delay before first retry (ms) |
CachePolicy
| Field | Type | Default | Description |
|---|---|---|---|
by | (ctx: Ctx) => unknown | undefined | Cache key function. Same key reuses cached output. |
version | string | undefined | Cache version. Changing it invalidates cached outputs. |
Graph Types
GraphSnapshot
| Field | Type | Description |
|---|---|---|
runId | string | Run identifier |
frameNo | number | Render frame number (monotonically increasing) |
xml | XmlNode | null | Rendered XML tree |
tasks | TaskDescriptor[] | Ordered task list |
XmlNode
XmlElement
| Field | Type | Description |
|---|---|---|
kind | "element" | Discriminant |
tag | string | Tag name ("Workflow", "Task", "Parallel", etc.) |
props | Record<string, string> | Attributes |
children | XmlNode[] | Child nodes |
XmlText
| Field | Type | Description |
|---|---|---|
kind | "text" | Discriminant |
text | string | Content |
Event Types
SmithersEvent
Discriminated union of all lifecycle events. Every event includesrunId and timestampMs.
Run Events
| Event | Fields | Description |
|---|---|---|
RunStarted | runId, timestampMs | Execution began |
RunStatusChanged | runId, status: RunStatus, timestampMs | Status transition |
RunFinished | runId, timestampMs | All tasks completed |
RunFailed | runId, error: unknown, timestampMs | Failed |
RunCancelled | runId, timestampMs | Cancelled |
Frame Events
| Event | Fields | Description |
|---|---|---|
FrameCommitted | runId, frameNo, xmlHash, timestampMs | Frame persisted |
Node Events
| Event | Fields | Description |
|---|---|---|
NodePending | runId, nodeId, iteration, timestampMs | Queued |
NodeStarted | runId, nodeId, iteration, attempt, timestampMs | Execution began |
NodeFinished | runId, nodeId, iteration, attempt, timestampMs | Completed |
NodeFailed | runId, nodeId, iteration, attempt, error, timestampMs | Failed |
NodeCancelled | runId, nodeId, iteration, attempt?, reason?, timestampMs | Cancelled |
NodeSkipped | runId, nodeId, iteration, timestampMs | Skipped |
NodeRetrying | runId, nodeId, iteration, attempt, timestampMs | Retrying |
Approval Events
| Event | Fields | Description |
|---|---|---|
NodeWaitingApproval | runId, nodeId, iteration, timestampMs | Awaiting approval |
ApprovalRequested | runId, nodeId, iteration, timestampMs | Approval requested |
ApprovalGranted | runId, nodeId, iteration, timestampMs | Approved |
ApprovalDenied | runId, nodeId, iteration, timestampMs | Denied |
Tool Events
| Event | Fields | Description |
|---|---|---|
ToolCallStarted | runId, nodeId, iteration, attempt, toolName, seq, timestampMs | Tool call began |
ToolCallFinished | runId, nodeId, iteration, attempt, toolName, seq, status, timestampMs | Tool call completed |
Output Events
| Event | Fields | Description |
|---|---|---|
NodeOutput | runId, nodeId, iteration, attempt, text, stream, timestampMs | Agent output text |
Revert Events
| Event | Fields | Description |
|---|---|---|
RevertStarted | runId, nodeId, iteration, attempt, jjPointer, timestampMs | VCS revert started |
RevertFinished | runId, nodeId, iteration, attempt, jjPointer, success, error?, timestampMs | VCS revert completed |
Component Props
WorkflowProps
| Prop | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Workflow name for logging and database |
cache | boolean | No | Enable output caching |
children | ReactNode | No | Child components |
TaskProps<Row, D>
| Prop | Type | Required | Description |
|---|---|---|---|
id | string | Yes | Unique task identifier |
output | ZodObject<any> | Table | string | Yes | Output target: Zod schema from outputs (recommended), Drizzle table, or string key |
outputSchema | ZodObject<any> | No | Zod schema for agent output validation |
agent | AgentLike | AgentLike[] | No | Agent or fallback chain |
fallbackAgent | AgentLike | No | Append one fallback agent |
dependsOn | string[] | No | Explicit dependency node IDs |
needs | Record<string, string> | No | Named dependencies (keys = context keys, values = node IDs) |
deps | Record<string, OutputTarget> | No | Typed render-time dependencies. Keys resolve from task ids or needs entries. |
skipIf | boolean | No | Skip when true |
needsApproval | boolean | No | Pause for human approval |
timeoutMs | number | No | Timeout (ms) |
retries | number | No | Retry attempts (default: 0) |
retryPolicy | RetryPolicy | No | Retry timing |
continueOnFail | boolean | No | Continue workflow on failure |
cache | CachePolicy | No | Cache configuration |
scorers | ScorersMap | No | Scorers to evaluate task output after completion |
label | string | No | Display label |
meta | Record<string, unknown> | No | Arbitrary metadata |
children | string | Row | (() => Row) | ReactNode | ((deps) => Row | ReactNode) | Yes | Prompt, compute callback, static payload, deps function, or nested elements |
SequenceProps
| Prop | Type | Required | Description |
|---|---|---|---|
skipIf | boolean | No | Skip entire sequence when true |
children | ReactNode | No | Child tasks |
ParallelProps
| Prop | Type | Required | Description |
|---|---|---|---|
id | string | No | Group identifier |
maxConcurrency | number | No | Max concurrent tasks |
skipIf | boolean | No | Skip entire group when true |
children | ReactNode | No | Child tasks |
BranchProps
| Prop | Type | Required | Description |
|---|---|---|---|
if | boolean | Yes | Condition |
then | ReactElement | Yes | Rendered when true |
else | ReactElement | No | Rendered when false |
skipIf | boolean | No | Skip entirely when true |
LoopProps
| Prop | Type | Required | Description |
|---|---|---|---|
id | string | No | Loop identifier (auto-generated if omitted) |
until | boolean | Yes | Exit when true |
maxIterations | number | No | Max iterations |
onMaxReached | "fail" | "return-last" | No | Behavior on limit: fail or return last output |
skipIf | boolean | No | Skip loop when true |
children | ReactNode | No | Tasks per iteration |
RalphProps
Deprecated: Use LoopProps.
ApprovalProps<Row>
| Prop | Type | Required | Description |
|---|---|---|---|
id | string | Yes | Approval node identifier |
output | ZodObject<any> | Table | string | Yes | Persistence target for decision |
outputSchema | ZodObject<any> | No | Decision output validation |
request | ApprovalRequest | Yes | Title, summary, metadata |
onDeny | "fail" | "continue" | "skip" | No | Behavior on denial |
dependsOn | string[] | No | Dependency node IDs |
needs | Record<string, string> | No | Named dependencies |
skipIf | boolean | No | Skip when true |
timeoutMs | number | No | Timeout (ms) |
retries | number | No | Retry attempts |
retryPolicy | RetryPolicy | No | Retry backoff |
continueOnFail | boolean | No | Continue on failure |
cache | CachePolicy | No | Cache configuration |
label | string | No | Display label (defaults to request.title) |
meta | Record<string, unknown> | No | Arbitrary metadata |
children | ReactNode | No | Child elements |
Error Types
SmithersError
| Field | Type | Description |
|---|---|---|
code | SmithersErrorCode | Machine-readable error code |
message | string | Error description |
summary | string | Short error summary without docs URL suffixing |
docsUrl | string | Documentation URL for the error reference |
details | Record<string, unknown> | Additional context |
cause | unknown | Original nested cause when one is preserved |
SmithersErrorCode
KnownSmithersErrorCode when you want exhaustive switching over built-in Smithers failures. See Error Reference for the full built-in list.
KnownSmithersErrorCode
switch statements over built-in Smithers errors.
Server Types
ServerOptions
See HTTP Server for details.ServeOptions
Options forcreateServeApp(...), the single-run Hono app exported from the root package.
Tool Context Types
ToolContext
Internal context provided to tools viaAsyncLocalStorage. Not typically used directly.