UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

4 lines • 2.64 kB
import{r as resolveStateDir}from"./state-dir-BwIClCab.mjs";import{a as getOpenClawDatabaseMaintenanceScope}from"./openclaw-state-maintenance-context-D-pYfco8.mjs";import"./openclaw-state-db-async-lifecycle-DlV0ztcV.mjs";import{t as quoteCliArg}from"./quote-cli-arg-BUHoGELl.mjs";import{t as note}from"./note-e4DtVgg2.mjs";import{n as formatBytes}from"./doctor-disk-space-wOo27Exa.mjs";import{t as inspectOtherOpenClawProcesses}from"./openclaw-process-census-WzSOREbV.mjs";import{n as pruneLegacyPluginSourceCaptures,r as pruneUnreferencedPluginNativeCaptures,t as inspectLegacyPluginSourceCaptureRoots}from"./plugin-source-capture-report-ks471uiR.mjs";import{t as inspectDoctorTemporaryDirectories}from"./temporary-directories-B7kVk3bo.mjs"; //!src/commands/doctor-plugin-source-captures.ts async function noteLegacyPluginSourceCaptures(e,t=false){const{directories:n,warnings:r}=await inspectDoctorTemporaryDirectories(e);const i=await inspectLegacyPluginSourceCaptureRoots(resolveStateDir(e),n);r.push(...i.warnings);const a=[];const o=getOpenClawDatabaseMaintenanceScope();const assertCurrent=()=>{if(!o?.ownsSchemaMaintenance)throw new Error(`Doctor does not hold Gateway maintenance; captures were preserved.`);o.assertAdmission()};const assertLegacyUnowned=()=>{assertCurrent();const e=inspectOtherOpenClawProcesses();if(`error`in e)throw new Error(e.error);if(e.pids.length>0)throw new Error(`Other OpenClaw processes are still running (PIDs: ${e.pids.join(`, `)}).`);assertCurrent()};if(i.roots.length>0){a.push(`${i.roots.length} legacy plugin capture root(s), ${formatBytes(i.totalBytes)} in known regular files.`,...i.roots.map(e=>`- ${quoteCliArg(e.path)} (${formatBytes(e.bytes)})`),`They will be reclaimed at the next maintenance.`);if(t){const e=await pruneLegacyPluginSourceCaptures(i,assertLegacyUnowned);if(e.removed.length>0)a.push(`Removed ${e.removed.length} legacy plugin capture root(s), ${formatBytes(e.removed.reduce((e,t)=>e+t.bytes,0))}.`,...e.removed.map(e=>`Removed ${quoteCliArg(e.path)} (${formatBytes(e.bytes)}).`));if(e.blockedReason)a.push(`Legacy capture cleanup skipped: ${e.blockedReason}`);a.push(...e.skipped.map(e=>`Kept ${quoteCliArg(e.path)}: ${e.reason}.`));r.push(...e.warnings)}}if(t){const t=await pruneUnreferencedPluginNativeCaptures(resolveStateDir(e),assertCurrent,e);if(t.removed.length>0)a.push(`Removed ${t.removed.length} unreferenced native plugin capture root(s).`);r.push(...t.warnings)}if(r.length>0)a.push(`Legacy capture inspection or cleanup was incomplete; sizes may be partial.`,...r);if(a.length>0)note(a.join(` `),`Legacy plugin captures`)}export{noteLegacyPluginSourceCaptures};