Files
patriothacks/scripts/dev-all.mjs
T
OmO Orchestrator d22361a613 feat: persist synced event-log history across server runs (SQLite relay)
The event relay was an in-memory array that started empty on every process, so
synced history vanished on every API-server restart. Persist it to a gitignored
.data/events.sqlite3 via node:sqlite like the blob store (EVENT_DB_PATH override;
seq rowid pull cursor; UNIQUE(authorPubkey,signature) push idempotency), keeping
the exact exported API. Synced history now survives restarts and keeps growing,
and a fresh device pulls the whole lived-in history on load; ShellLayout adds a
light 6s poll for live cross-device reflection. Adds a dev:all script, isolates
the two integration tests to a temp EVENT_DB_PATH, documents EVENT_DB_PATH.
2026-11-20 02:30:03 -05:00

25 lines
622 B
JavaScript

import { spawn } from "node:child_process";
const children = [
spawn("npm", ["run", "dev:api"], { stdio: "inherit", env: process.env }),
spawn("npm", ["run", "dev"], { stdio: "inherit", env: process.env }),
];
let shuttingDown = false;
function shutdown(signal) {
if (shuttingDown) return;
shuttingDown = true;
for (const child of children) {
child.kill(signal ?? "SIGTERM");
}
}
process.on("SIGINT", () => shutdown("SIGINT"));
process.on("SIGTERM", () => shutdown("SIGTERM"));
for (const child of children) {
child.on("exit", (code) => {
shutdown("SIGTERM");
process.exit(code ?? 0);
});
}