openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
35 lines (34 loc) • 1.65 kB
JavaScript
import { _ as isNeverActivatedFailedUpdate } from "./update-run-write-gdMM-b0r.mjs";
import { i as getUpdateRun } from "./update-run-reader-7kFqqMpW.mjs";
import "./update-run-ledger-kQmrTutl.mjs";
import { l as withOwnedManagedUpdateEnv } from "./update-command-service-env-C5gMcu_2.mjs";
import { i as recordAutomaticRecoveryCleanup, n as automaticRecoveryCleanupWarning } from "./update-automatic-cleanup-result-Dtvku2re.mjs";
import { t as runWithLocalStateOwner } from "./local-state-owner-DTl7OHpC.mjs";
import { t as cleanupCompletedUpdateRecovery } from "./update-automatic-cleanup-PSYDwhon.mjs";
//#region src/cli/update-cli/automatic-cleanup.ts
/** A durably failed run that never activated retires its own original-state capture. */
function failedBeforeActivation(e, t) {
try {
const n = getUpdateRun(e, { env: t });
return n !== void 0 && isNeverActivatedFailedUpdate(n);
} catch {
return false;
}
}
/** Route to a live Gateway rather than borrowing its lock or stopping it a second time. */
async function automaticallyCleanUpdateRecovery(e, t) {
try {
return await withOwnedManagedUpdateEnv(t, () => runWithLocalStateOwner({
method: "update.recovery.cleanup",
params: { runId: e },
target: "completed update recovery artifacts",
recoveryCommand: "openclaw update cleanup --dry-run",
timeoutMs: 3e5,
runLocal: async ({ env: t, assertCurrent: n }) => recordAutomaticRecoveryCleanup(e, await cleanupCompletedUpdateRecovery(e, t, n), t, n)
}));
} catch (e) {
return automaticRecoveryCleanupWarning(e);
}
}
//#endregion
export { failedBeforeActivation as n, automaticallyCleanUpdateRecovery as t };