CLI
| Flag | Default | Description |
|---|---|---|
--serve | false | Enable HTTP server mode |
--port | 7331 | TCP port |
--host | 127.0.0.1 | Bind address |
--auth-token | SMITHERS_API_KEY env | Bearer token for auth |
--metrics | true | Expose /metrics Prometheus endpoint |
Programmatic
createServeApp returns a standard Hono app. Mount it with Bun.serve, pass it to another Hono app via app.route(), or use app.fetch directly in tests.
ServeOptions
| Option | Type | Description |
|---|---|---|
workflow | SmithersWorkflow | Loaded workflow instance |
adapter | SmithersDb | Database adapter for the workflow |
runId | string | Active run ID |
abort | AbortController | Shared abort controller for cancellation |
authToken | string | Bearer token. Falls back to SMITHERS_API_KEY. Disabled if unset. |
metrics | boolean | Expose /metrics endpoint. Default: true. |
Authentication
WhenauthToken is configured, every route except /health requires:
Authorization: Bearer <token>, orx-smithers-key: <token>
401.
Routes
GET /health
Always returns200 regardless of auth.
GET /
Run status and node summary.GET /events
SSE stream of lifecycle events. Same format as the multi-workflow server.| Parameter | Type | Default | Description |
|---|---|---|---|
afterSeq | number | -1 | Only events after this sequence |
- Polls every 500ms.
- Auto-closes when the run reaches a terminal state.
- Reconnect with
?afterSeq=Nto resume from a known position.
GET /frames
Rendered workflow frames.| Parameter | Type | Default | Description |
|---|---|---|---|
limit | number | 50 | Max frames |
afterFrameNo | number | — | Frames after this number |
POST /approve/:nodeId
Approve a pending approval gate.{ "runId": "run-1234" }.
POST /deny/:nodeId
Deny a pending approval gate. Same body as/approve/:nodeId.
POST /cancel
Cancel the running workflow.| Status | Code | Condition |
|---|---|---|
| 200 | — | Cancelled successfully |
| 409 | RUN_NOT_ACTIVE | Run already finished/failed/cancelled |
GET /metrics
Prometheus text exposition. Same metrics as the multi-workflow server.Error Format
404 with code NOT_FOUND.
Serve Mode vs Multi-Workflow Server
| Serve mode | Multi-workflow server | |
|---|---|---|
| Scope | Single workflow, single run | Any workflow, multiple concurrent runs |
| Start | smithers up --serve or createServeApp() | startServer() |
| Routes | /, /events, /approve/:nodeId, … | /v1/runs, /v1/runs/:runId, … |
| Framework | Hono | Node.js http |
| Use case | Development, single-purpose services | Production API gateway |