mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-23 02:45:38 -06:00
895b691c55
* fix(daemon): block duplicate launchd owners Co-authored-by: Harjoth Khara <harjoth.khara@gmail.com> * fix(ci): satisfy launchd docs and lint gates * fix(ci): remove unused launchd exports * docs: refresh gateway map --------- Co-authored-by: Peter Steinberger <steipete@gmail.com>
19 lines
734 B
TypeScript
19 lines
734 B
TypeScript
/** Resolves the one effective launchd label shared by lifecycle and diagnostics. */
|
|
import { sanitizeForLog } from "../../packages/terminal-core/src/ansi.js";
|
|
import { resolveGatewayLaunchAgentLabel } from "./constants.js";
|
|
|
|
export function assertValidLaunchAgentLabel(label: string): string {
|
|
const trimmed = label.trim();
|
|
if (!/^[A-Za-z0-9._-]+$/.test(trimmed)) {
|
|
throw new Error(`Invalid launchd label: ${sanitizeForLog(trimmed)}`);
|
|
}
|
|
return trimmed;
|
|
}
|
|
|
|
export function resolveLaunchAgentLabel(env?: Record<string, string | undefined>): string {
|
|
const override = env?.OPENCLAW_LAUNCHD_LABEL?.trim();
|
|
return assertValidLaunchAgentLabel(
|
|
override || resolveGatewayLaunchAgentLabel(env?.OPENCLAW_PROFILE),
|
|
);
|
|
}
|