TypeScript SDK
One file, no dependencies, any runtime with fetch. Download flashbox.ts (or flashbox.js) into your project.
import { Flashbox } from "./flashbox.ts";
const fb = new Flashbox({ apiKey: process.env.FLASHBOX_API_KEY, baseUrl: "https://flashbox.app" });
const sb = await fb.create({ network: { allow: ["api.github.com"] } });
const r = await sb.run("curl -s https://api.github.com/repos/nodejs/node | jq .stargazers_count", { changes: true });
r.exitCode; r.stdout; r.checkpoint.id; r.cost.usd;
await sb.files.write("notes.md", "# Notes\n");
const text = await sb.files.readText("notes.md");
const p = await sb.processes.start("python3 -u worker.py");
const { data } = await sb.processes.logs(p.id, { waitMs: 2000 });
const history = await sb.checkpoints({ limit: 20 });
await sb.rollback(history[3].id);
const [copy] = await fb.fork(history[3].id);
await sb.hibernate(); // stops now; the next call resumes it
await sb.destroy();
Errors throw FlashboxError with status, code and message (see Errors).