mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-02 17:51:38 +00:00
* fix(fs): centralize directory durability * chore: keep release notes in PR body * test(sqlite): canonicalize read-only race paths * test(fs): clean durability fixtures * chore(lint): prune sqlite snapshot baseline * fix(backup): reject unsupported commit sync * fix(fs): enforce strict durability outcomes * refactor(tls): flatten preserved-output failures * fix(reef): require durable journal commits * fix(fs): route durability through policy boundaries * fix(reef): preserve Windows journal compatibility * fix(fs): bind publication to canonical directories * fix(ci): align durability boundary fixtures
23 lines
720 B
TypeScript
23 lines
720 B
TypeScript
import fs from "node:fs";
|
|
import path from "node:path";
|
|
import { resolvePreferredOpenClawTmpDir } from "openclaw/plugin-sdk/file-access-runtime";
|
|
|
|
export function useReefTempDirs(registerCleanup: (cleanup: () => void) => unknown): {
|
|
make(prefix: string): string;
|
|
} {
|
|
const directories = new Set<string>();
|
|
registerCleanup(() => {
|
|
for (const directory of directories) {
|
|
fs.rmSync(directory, { force: true, maxRetries: 5, recursive: true, retryDelay: 20 });
|
|
}
|
|
directories.clear();
|
|
});
|
|
return {
|
|
make(prefix: string): string {
|
|
const directory = fs.mkdtempSync(path.join(resolvePreferredOpenClawTmpDir(), prefix));
|
|
directories.add(directory);
|
|
return directory;
|
|
},
|
|
};
|
|
}
|