refactor: trim daemon service manager exports

This commit is contained in:
Peter Steinberger
2026-05-02 02:51:00 +01:00
parent d6f84a4114
commit bdda14e170
4 changed files with 12 additions and 17 deletions

View File

@@ -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();

View File

@@ -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 };

View File

@@ -18,7 +18,7 @@ function resolveLoginctlUser(env: Record<string, string | undefined>): string |
}
}
export type SystemdUserLingerStatus = {
type SystemdUserLingerStatus = {
user: string;
linger: "yes" | "no";
};

View File

@@ -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) {