import { a as normalizeLowercaseStringOrEmpty } from "./string-coerce-DKw2K5wM.js";
//#region src/daemon/constants.ts
const GATEWAY_LAUNCH_AGENT_LABEL = "ai.nodmix.gateway";
const GATEWAY_SYSTEMD_SERVICE_NAME = "nodmix-gateway";
const GATEWAY_WINDOWS_TASK_NAME = "Nodmix Gateway";
const GATEWAY_SERVICE_MARKER = "nodmix";
const GATEWAY_SERVICE_KIND = "gateway";
const GATEWAY_SERVICE_RUNTIME_PID_ENV = "NODMIX_GATEWAY_SERVICE_PID";
const NODE_LAUNCH_AGENT_LABEL = "ai.nodmix.node";
const NODE_SYSTEMD_SERVICE_NAME = "nodmix-node";
const NODE_WINDOWS_TASK_NAME = "Nodmix Node";
const NODE_SERVICE_MARKER = "nodmix";
const NODE_SERVICE_KIND = "node";
const NODE_WINDOWS_TASK_SCRIPT_NAME = "node.cmd";
const LEGACY_GATEWAY_SYSTEMD_SERVICE_NAMES = ["clawdbot-gateway"];
function normalizeGatewayProfile(profile) {
	const trimmed = profile?.trim();
	if (!trimmed || normalizeLowercaseStringOrEmpty(trimmed) === "default") return null;
	return trimmed;
}
function resolveGatewayProfileSuffix(profile) {
	const normalized = normalizeGatewayProfile(profile);
	return normalized ? `-${normalized}` : "";
}
function resolveGatewayLaunchAgentLabel(profile) {
	const normalized = normalizeGatewayProfile(profile);
	if (!normalized) return GATEWAY_LAUNCH_AGENT_LABEL;
	return `ai.nodmix.${normalized}`;
}
function resolveLegacyGatewayLaunchAgentLabels(profile) {
	return [];
}
function resolveGatewaySystemdServiceName(profile) {
	const suffix = resolveGatewayProfileSuffix(profile);
	if (!suffix) return GATEWAY_SYSTEMD_SERVICE_NAME;
	return `nodmix-gateway${suffix}`;
}
function resolveGatewayWindowsTaskName(profile) {
	const normalized = normalizeGatewayProfile(profile);
	if (!normalized) return GATEWAY_WINDOWS_TASK_NAME;
	return `Nodmix Gateway (${normalized})`;
}
function formatGatewayServiceDescription(params) {
	const profile = normalizeGatewayProfile(params?.profile);
	const version = params?.version?.trim();
	const parts = [];
	if (profile) parts.push(`profile: ${profile}`);
	if (version) parts.push(`v${version}`);
	if (parts.length === 0) return "Nodmix Gateway";
	return `Nodmix Gateway (${parts.join(", ")})`;
}
function resolveGatewayServiceDescription(params) {
	return params.description ?? formatGatewayServiceDescription({
		profile: params.env.NODMIX_PROFILE,
		version: params.environment?.NODMIX_SERVICE_VERSION ?? params.env.NODMIX_SERVICE_VERSION
	});
}
function resolveNodeLaunchAgentLabel() {
	return NODE_LAUNCH_AGENT_LABEL;
}
function resolveNodeSystemdServiceName() {
	return NODE_SYSTEMD_SERVICE_NAME;
}
function resolveNodeWindowsTaskName() {
	return NODE_WINDOWS_TASK_NAME;
}
function formatNodeServiceDescription(params) {
	const version = params?.version?.trim();
	if (!version) return "Nodmix Node Host";
	return `Nodmix Node Host (v${version})`;
}
//#endregion
export { resolveNodeSystemdServiceName as _, LEGACY_GATEWAY_SYSTEMD_SERVICE_NAMES as a, NODE_WINDOWS_TASK_SCRIPT_NAME as c, resolveGatewayProfileSuffix as d, resolveGatewayServiceDescription as f, resolveNodeLaunchAgentLabel as g, resolveLegacyGatewayLaunchAgentLabels as h, GATEWAY_SERVICE_RUNTIME_PID_ENV as i, formatNodeServiceDescription as l, resolveGatewayWindowsTaskName as m, GATEWAY_SERVICE_KIND as n, NODE_SERVICE_KIND as o, resolveGatewaySystemdServiceName as p, GATEWAY_SERVICE_MARKER as r, NODE_SERVICE_MARKER as s, GATEWAY_LAUNCH_AGENT_LABEL as t, resolveGatewayLaunchAgentLabel as u, resolveNodeWindowsTaskName as v };
