openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
21 lines (20 loc) • 714 B
JavaScript
import { t as hasErrnoCode } from "./errno-DFcoqIT9.mjs";
import path from "node:path";
import fs from "node:fs/promises";
//#region src/state/agent-database-path-discovery.ts
/** Keep directory spellings until the consuming owner validates database identity. */
async function listDefaultAgentDatabasePaths(e) {
let t;
try {
t = await fs.readdir(path.join(e, "agents"), { withFileTypes: true });
} catch (e) {
if (hasErrnoCode(e, "ENOENT")) return [];
throw e;
}
return t.filter((e) => e.isDirectory() || e.isSymbolicLink()).map((t) => ({
agentId: t.name,
path: path.resolve(e, "agents", t.name, "agent", "openclaw-agent.sqlite")
}));
}
//#endregion
export { listDefaultAgentDatabasePaths as t };