openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
22 lines (21 loc) • 880 B
JavaScript
import fs from "node:fs";
//#region extensions/memory-core/src/memory/manager-shadow-task.ts
function readMemoryShadowIdentity(e) {
const t = fs.statSync(e, { bigint: true });
if (!t.isFile()) throw new Error("Memory reindex shadow is not a regular file");
return {
device: String(t.dev),
inode: String(t.ino)
};
}
function assertMemoryShadowIdentity(e, t) {
const n = readMemoryShadowIdentity(e);
if (n.device !== t.device || n.inode !== t.inode) throw new Error("Memory reindex shadow file changed during its owned lifetime");
}
function readMemoryConnectionPragmas(e, t) {
const n = e.prepare("PRAGMA foreign_keys").get()?.foreign_keys;
if (typeof n !== "number" || !Number.isSafeInteger(n)) throw new Error(t);
return { foreign_keys: n };
}
//#endregion
export { readMemoryConnectionPragmas as n, readMemoryShadowIdentity as r, assertMemoryShadowIdentity as t };