Core
@taskbox/core
The runtime-agnostic engine. runTask validates a TaskSpec, mints a
disposable workspace under os.tmpdir()/taskbox-runs/<taskId>, hands control
to a RuntimeAdapter (e.g. @taskbox/podman), and parses the
adapter's result.json back into a typed TaskResult. All lifecycle events
flow through an EventBus that simultaneously appends to events.jsonl and
fans out to subscribers.
- Stability: beta
- Platforms: node
Install
npm i @taskbox/core @taskbox/schemasYou also need a runtime adapter — for now that's @taskbox/podman.
Run a task
import { runTask } from "@taskbox/core";
import { podman } from "@taskbox/podman";
const result = await runTask(
{
tool: "media.downloadSubtitles",
input: { url: "https://youtu.be/jNQXAC9IVRw", languages: ["en"] },
network: { mode: "direct" },
},
podman({ pullPolicy: "if-missing" }),
{ onEvent: (e) => console.log(e.type) },
);
if (!result.ok) throw new Error(result.error?.code);Subscribe to events without driving a task
import { createWorkspace, EventBus } from "@taskbox/core";
const ws = createWorkspace();
const bus = new EventBus(ws.eventsJsonlPath);
bus.on((e) => console.log(e.type, e.ts));
for await (const ev of bus) {
if (ev.type === "task.completed" || ev.type === "task.failed") break;
}See API for the full export list.