Taskbox
Core

API

Running tasks

ExportSignatureSummary
runTask(spec: unknown, adapter: RuntimeAdapter, opts?: RunTaskOptions) => Promise<TaskResult>Validates spec, mints a workspace, dispatches to the adapter, parses result.json, returns a typed TaskResult.
RunTaskOptions{ bus?: EventBus; onEvent?: (e: TaskEvent) => void; signal?: AbortSignal }Optional event sink and cancellation.

Workspace

ExportSignatureSummary
createWorkspace(opts?: WorkspaceOptions) => WorkspaceCreates in/, out/, logs/ under TASKBOX_WORKSPACE_DIR (or os.tmpdir()/taskbox-runs/<taskId>).
Workspace{ taskId, root, inputDir, outputDir, logsDir, taskJsonPath, resultJsonPath, eventsJsonlPath, cleanup() }The handle returned by createWorkspace.
WorkspaceOptions{ taskId?: string; root?: string; keep?: boolean }Override id/root or suppress cleanup.

Events

ExportSignatureSummary
EventBusclass EventBus(eventsJsonlPath: string)Validates and appends TaskEvents to JSONL while fanning out to listeners and async iterators.
EventBus#emit(event: unknown) => voidValidate via TaskEventSchema, append, broadcast.
EventBus#on(cb: (e: TaskEvent) => void) => () => voidSubscribe; returns an unsubscribe.
EventBus#events() => AsyncIterableIterator<TaskEvent>Drain events as they arrive; closes when bus.close() is called.
EventBus#close() => voidWakes pending iterators with done: true.

Errors

ExportSignatureSummary
TaskboxErrorclass TaskboxError(init: TaskboxErrorInit)Throwable error with stable code + category. serialize() returns the wire shape.
TaskboxErrorInit{ code, message, category, retryable?, details?, stderrTail?, suggestions? }Constructor input.
wrap(err: unknown, fallback: { code; category }) => TaskboxErrorPromotes any error to a TaskboxError, preserving stack as details.stack.
TaskboxErrorCodetypeRe-export of the enum from @taskbox/schemas.
TaskboxErrorCategorytypeRe-export of the enum from @taskbox/schemas.

Identifiers

ExportSignatureSummary
newTaskId() => string16-char uppercase task id (compact UUID). Used as workspace folder name.

Proxy

ExportSignatureSummary
proxyToEnv(p: ProxyConfig) => Record<string, string>Expands a ProxyConfig into HTTP_PROXY, HTTPS_PROXY, NO_PROXY, etc.
redactProxyUrl(url: string) => stringRe-export from @taskbox/schemas — strips userinfo for logging.

Runtime contract

ExportSignatureSummary
defaultImageRef"taskbox/kitchen-sink:0.1.0"Default image when a TaskSpec doesn't pin one.
RuntimeAdapter{ name, available(), prepareImage(ref), runTask({spec, workspace, bus, signal?}) }Interface every adapter implements (see @taskbox/podman).

See the generated JSDoc reference for the full surface.

On this page