UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

38 lines (37 loc) • 1.41 kB
import { L as retireSqliteDatabaseAdmissionForPath } from "./sqlite-database-admission-DQIqro3d.mjs"; import { i as encodeAgentDatabaseReaderRequest, t as applyAgentDatabaseReaderRequest } from "./agent-database-readers-kAORIt-A.mjs"; import { t as closeWorkerTaskPoolResources } from "./worker-task-pool-registry-CNIgRpUN.mjs"; import path from "node:path"; //#region src/state/openclaw-agent-db-readers.ts async function applyAcrossProcess(e) { await applyAgentDatabaseReaderRequest(e); await closeWorkerTaskPoolResources(encodeAgentDatabaseReaderRequest(e)); } /** Deletion closes the databases everywhere and refuses reopening them until the agent returns. */ async function closeDeletedAgentDatabases(e, t, n) { await n.assertCurrentAsync(); const r = [...new Set(t.map((e) => path.resolve(e)))].map((e) => ({ path: e })); if (r.length > 0) { await applyAcrossProcess({ kind: "close", candidates: r, deleted: true, agentId: e }); for (const e of r) { n.assertCurrentFinal(); retireSqliteDatabaseAdmissionForPath(e.path); } } await n.assertCurrentAsync(); } /** Re-admission revives only the physical paths captured for these deleted owners. */ async function reviveAgentDatabases(e) { const t = [...new Set(e)]; if (t.length > 0) await applyAcrossProcess({ kind: "revive", agentIds: t }); } //#endregion export { closeDeletedAgentDatabases, reviveAgentDatabases };