UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

4 lines • 2.15 kB
import{n as sanitizeTerminalText}from"./safe-text-B_QTgn0s.mjs";import{o as isDefaultInstallIdentity}from"./paths-D_FOvGon.mjs";import{t as formatErrorMessage}from"./errors-D37BJTfI.mjs";import{t as formatCliCommand}from"./command-format-D7KhNLP0.mjs";import{t as note}from"./note-e4DtVgg2.mjs";import{n as formatForeignLaunchdJobs,r as repairForeignLaunchdJob,t as findForeignLaunchdJobs}from"./launchd-foreign-jobs-yY1Wvn0L.mjs";import{t as readGatewayForcedRestartSummary}from"./restart-storm-xV7KaJPm.mjs";import{a as isServiceRepairDeferred,l as shouldManageGatewayService,s as resolveServiceRepairPolicy}from"./doctor-service-repair-policy-gYXaFNLg.mjs"; //!src/commands/doctor-foreign-launchd-jobs.ts async function noteMacForeignLaunchdJobs(e,t,n=process.env){if(process.platform!==`darwin`)return;let r;try{r=await findForeignLaunchdJobs(n)}catch(e){note(`Could not inspect foreign launchd jobs: ${sanitizeTerminalText(formatErrorMessage(e))}. No jobs were removed.`,`Foreign launchd jobs (macOS)`);return}if(r.length===0)return;const i=[formatForeignLaunchdJobs(r)];const a=readGatewayForcedRestartSummary(n);if(a.count>0)i.push(`${a.count} external forced Gateway restart(s) in the last ${Math.round(a.windowMs/6e4)} minutes. Listed lifecycle jobs may be responsible; this is not proof of attribution.`);const o=r.filter(e=>e.safeToRemove);if(o.length>0)i.push(`Run ${formatCliCommand(`openclaw doctor --fix`,n)} to remove confirmed stray Gateway lifecycle jobs.`);note(i.join(` `),`Foreign launchd jobs (macOS)`);if(e.repair!==true||o.length===0)return;if(!isDefaultInstallIdentity(n)||isServiceRepairDeferred(resolveServiceRepairPolicy(n))||!await shouldManageGatewayService(n)){t.log(`Foreign launchd job repair skipped: this Doctor invocation does not own service repair or an update is in progress. No jobs were removed.`);return}for(const e of o)try{const r=await repairForeignLaunchdJob(e,n);t.log(r.removed?r.detail:`Removal not confirmed for launchd job ${e.label}: ${r.detail}`)}catch(n){t.log(`Removal not confirmed for launchd job ${e.label}: ${sanitizeTerminalText(formatErrorMessage(n))}`)}}export{noteMacForeignLaunchdJobs};