openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
50 lines (49 loc) • 1.53 kB
JavaScript
import { o as LEGACY_GATEWAY_SYSTEMD_SERVICE_NAMES } from "./constants-BZisy3jr.mjs";
import { a as uninstallLegacySystemdUnits } from "./systemd-lifecycle-yGkIpc48.mjs";
import "./systemd-k-QLc2ED.mjs";
//#region src/commands/doctor-gateway-legacy-services.ts
function classifyLegacyServices(e) {
const t = [];
const n = [];
const r = [];
for (const i of e) {
const e = i.platform === "darwin" ? t : i.platform === "linux" ? n : void 0;
if (e && i.scope === "user") {
if (i.platform === "linux" && !LEGACY_GATEWAY_SYSTEMD_SERVICE_NAMES.some((e) => i.label === `${e}.service`)) r.push(`${i.label} (legacy unit name not recognized)`);
else e.push(i);
} else r.push(`${i.label} (${e ? i.scope : i.platform})`);
}
return {
darwinUserServices: t,
linuxUserServices: n,
failed: r
};
}
async function cleanupLegacyLinuxUserServices(e, t) {
const n = [];
const r = [];
try {
const t = await uninstallLegacySystemdUnits({
env: process.env,
stdout: process.stdout
});
const i = new Map(t.map((e) => [`${e.name}.service`, e]));
for (const t of e) {
const e = i.get(t.label);
if (!e) {
r.push(`${t.label} (legacy unit name not recognized)`);
continue;
}
n.push(`${t.label} -> ${e.unitPath}`);
}
} catch (n) {
t.error(`Legacy Linux gateway cleanup failed: ${String(n)}`);
for (const t of e) r.push(`${t.label} (linux cleanup failed)`);
}
return {
removed: n,
failed: r
};
}
//#endregion
export { cleanupLegacyLinuxUserServices as n, classifyLegacyServices as t };