mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 11:40:42 +00:00
refactor: trim daemon service manager exports
This commit is contained in:
@@ -8,15 +8,15 @@ import { sanitizeForLog } from "../terminal/ansi.js";
|
||||
import { resolveGatewayLaunchAgentLabel } from "./constants.js";
|
||||
import { renderPosixRestartLogSetup } from "./restart-logs.js";
|
||||
|
||||
export type LaunchdRestartHandoffMode = "kickstart" | "start-after-exit";
|
||||
type LaunchdRestartHandoffMode = "kickstart" | "start-after-exit";
|
||||
|
||||
export type LaunchdRestartHandoffResult = {
|
||||
type LaunchdRestartHandoffResult = {
|
||||
ok: boolean;
|
||||
pid?: number;
|
||||
detail?: string;
|
||||
};
|
||||
|
||||
export type LaunchdRestartTarget = {
|
||||
type LaunchdRestartTarget = {
|
||||
domain: string;
|
||||
label: string;
|
||||
plistPath: string;
|
||||
@@ -77,7 +77,7 @@ function resolveLaunchAgentLabel(env?: Record<string, string | undefined>): stri
|
||||
return assertValidLaunchAgentLabel(resolveGatewayLaunchAgentLabel(env?.OPENCLAW_PROFILE));
|
||||
}
|
||||
|
||||
export function resolveLaunchdRestartTarget(
|
||||
function resolveLaunchdRestartTarget(
|
||||
env: Record<string, string | undefined> = process.env,
|
||||
): LaunchdRestartTarget {
|
||||
const domain = resolveGuiDomain();
|
||||
|
||||
@@ -181,7 +181,7 @@ export async function readLaunchAgentProgramArguments(
|
||||
return readLaunchAgentProgramArgumentsFromFile(plistPath);
|
||||
}
|
||||
|
||||
export function buildLaunchAgentPlist({
|
||||
function buildLaunchAgentPlist({
|
||||
label = GATEWAY_LAUNCH_AGENT_LABEL,
|
||||
comment,
|
||||
programArguments,
|
||||
@@ -344,7 +344,7 @@ async function ensureLaunchAgentEnvironmentDirectories(
|
||||
}
|
||||
}
|
||||
|
||||
export type LaunchctlPrintInfo = {
|
||||
type LaunchctlPrintInfo = {
|
||||
state?: string;
|
||||
pid?: number;
|
||||
lastExitStatus?: number;
|
||||
@@ -433,7 +433,7 @@ export async function readLaunchAgentRuntime(
|
||||
};
|
||||
}
|
||||
|
||||
export type LaunchAgentBootstrapRepairResult =
|
||||
type LaunchAgentBootstrapRepairResult =
|
||||
| { ok: true; status: "repaired" | "already-loaded" }
|
||||
| { ok: false; status: "bootstrap-failed" | "kickstart-failed"; detail?: string };
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ function resolveLoginctlUser(env: Record<string, string | undefined>): string |
|
||||
}
|
||||
}
|
||||
|
||||
export type SystemdUserLingerStatus = {
|
||||
type SystemdUserLingerStatus = {
|
||||
user: string;
|
||||
linger: "yes" | "no";
|
||||
};
|
||||
|
||||
@@ -27,11 +27,7 @@ import type {
|
||||
GatewayServiceManageArgs,
|
||||
GatewayServiceRestartResult,
|
||||
} from "./service-types.js";
|
||||
import {
|
||||
enableSystemdUserLinger,
|
||||
readSystemdUserLingerStatus,
|
||||
type SystemdUserLingerStatus,
|
||||
} from "./systemd-linger.js";
|
||||
import { enableSystemdUserLinger, readSystemdUserLingerStatus } from "./systemd-linger.js";
|
||||
import {
|
||||
classifySystemdUnavailableDetail,
|
||||
isSystemctlMissingDetail,
|
||||
@@ -67,7 +63,6 @@ export function resolveSystemdUserUnitPath(env: GatewayServiceEnv): string {
|
||||
}
|
||||
|
||||
export { enableSystemdUserLinger, readSystemdUserLingerStatus };
|
||||
export type { SystemdUserLingerStatus };
|
||||
|
||||
// Unit file parsing/rendering: see systemd-unit.ts
|
||||
|
||||
@@ -235,7 +230,7 @@ async function resolveSystemdEnvironmentFiles(params: {
|
||||
return { environment: resolved };
|
||||
}
|
||||
|
||||
export type SystemdServiceInfo = {
|
||||
type SystemdServiceInfo = {
|
||||
activeState?: string;
|
||||
subState?: string;
|
||||
mainPid?: number;
|
||||
@@ -804,7 +799,7 @@ export async function readSystemdServiceRuntime(
|
||||
lastExitReason: parsed.execMainCode,
|
||||
};
|
||||
}
|
||||
export type LegacySystemdUnit = {
|
||||
type LegacySystemdUnit = {
|
||||
name: string;
|
||||
unitPath: string;
|
||||
enabled: boolean;
|
||||
@@ -819,7 +814,7 @@ async function isSystemctlAvailable(env: GatewayServiceEnv): Promise<boolean> {
|
||||
return !isSystemctlMissing(readSystemctlDetail(res));
|
||||
}
|
||||
|
||||
export async function findLegacySystemdUnits(env: GatewayServiceEnv): Promise<LegacySystemdUnit[]> {
|
||||
async function findLegacySystemdUnits(env: GatewayServiceEnv): Promise<LegacySystemdUnit[]> {
|
||||
const results: LegacySystemdUnit[] = [];
|
||||
const systemctlAvailable = await isSystemctlAvailable(env);
|
||||
for (const name of LEGACY_GATEWAY_SYSTEMD_SERVICE_NAMES) {
|
||||
|
||||
Reference in New Issue
Block a user