openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
21 lines (20 loc) • 1.13 kB
JavaScript
import { y as requireOpenClawStateDatabaseIdentity } from "./openclaw-state-db-cache-BEArcjbO.mjs";
import { i as requestSqliteWorkerOperationAdmission } from "./sqlite-worker-operation-admission-DqFz0WIG.mjs";
import { l as runOpenClawStateWriteTransaction } from "./openclaw-state-db-VZFEEleX.mjs";
import { h as releaseExitedOpenClawAgentDatabaseLeaseInDatabase } from "./openclaw-agent-db-lease-BALzR11f.mjs";
//#region src/state/openclaw-agent-execution-cleanup.worker.ts
function executeAgentDatabaseCleanupCommand(command, database, env) {
runOpenClawStateWriteTransaction((current) => {
if (current.path !== command.input.sharedStatePath || requireOpenClawStateDatabaseIdentity(current).key !== command.input.sharedStateIdentity) throw new Error("Retired agent cleanup cannot adopt a replacement shared database");
releaseExitedOpenClawAgentDatabaseLeaseInDatabase(current.db, command.input, () => requestSqliteWorkerOperationAdmission({
stage: "prepare",
facts: "agent-integrity-invalidated"
}));
}, {
database,
path: database.path,
env
});
}
//#endregion
export { executeAgentDatabaseCleanupCommand };