mundane-sdk
v0.1.0
Published
Tiny durable-execution: one workflow run is one SQLite file.
Readme
mundane-sdk (TypeScript)
See ../SPEC.md for the cross-runtime contract.
import { run } from "mundane-sdk";
await run("task.db", async (ctx) => {
const user = await ctx.step("fetch", async () => ({ name: "alice" }));
await ctx.sleep("cool-off", "100ms");
await ctx.step("notify", async () => `hi ${user.name}`);
});Implementation notes
- Locking. The runtime opens the SQLite file and takes
flock(LOCK_EX | LOCK_NB)on its fd via thefs-extnative binding — no subprocess. It is the sameflock(2)the bash, Go, and Python runtimes use, so a lock held by one is visible to the rest, and the kernel drops it automatically if the process dies. - No redundant SQLite locking. The DB is opened with the
unix-noneVFS (file:…?vfs=unix-none), which turns off SQLite's own file locking. Ourflockalready guarantees a single writer for the whole run, so SQLite's locking is redundant — and on platforms where SQLite locks viaflock(2)(e.g. macOS) it would collide with ours on the same file and deadlock.unix-noneleaves our flock as the sole authority. - DB binding. Built on
node-sqlite3, wrapped in a thin promise layer (seesrc/db.ts).
