import path from "node:path";
import os from "node:os";
//#region src/daemon/constants.ts
/**
* Daemon Constants - Service labels, paths, and configuration values
*/
const SERVICE_BASE_LABEL = "ai.xopc.gateway";
function resolveGatewayLaunchAgentLabel(profile) {
	const normalized = normalizeProfile(profile);
	return normalized ? `${SERVICE_BASE_LABEL}.${normalized}` : SERVICE_BASE_LABEL;
}
function resolveGatewaySystemdServiceName(profile) {
	const normalized = normalizeProfile(profile);
	return normalized ? `xopc-gateway-${normalized}` : "xopc-gateway";
}
function resolveGatewayWindowsTaskName(profile) {
	const normalized = normalizeProfile(profile);
	return normalized ? `xopc-gateway-${normalized}` : "xopc-gateway";
}
function resolveLaunchAgentPlistPath(profile) {
	const label = resolveGatewayLaunchAgentLabel(profile);
	return path.join(os.homedir(), "Library", "LaunchAgents", `${label}.plist`);
}
function resolveSystemdUnitPath(profile) {
	const name = resolveGatewaySystemdServiceName(profile);
	return path.join(os.homedir(), ".config", "systemd", "user", `${name}.service`);
}
function formatGatewayServiceDescription(params) {
	const profile = normalizeProfile(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 "xopc Gateway";
	return `xopc Gateway (${parts.join(", ")})`;
}
function normalizeProfile(profile) {
	const trimmed = profile?.trim();
	if (!trimmed || trimmed.toLowerCase() === "default") return null;
	return trimmed;
}
const DEFAULT_GATEWAY_PORT = 18790;
const LAUNCH_AGENT_THROTTLE_INTERVAL_SECONDS = 10;
const LAUNCH_AGENT_EXIT_TIMEOUT_SECONDS = 20;
const SYSTEMD_RESTART_SEC = 5;
const SYSTEMD_START_LIMIT_BURST = 5;
const SYSTEMD_START_LIMIT_INTERVAL_SEC = 60;
const SERVICE_VERSION_ENV_KEY = "XOPC_SERVICE_VERSION";
//#endregion
export { DEFAULT_GATEWAY_PORT, LAUNCH_AGENT_EXIT_TIMEOUT_SECONDS, LAUNCH_AGENT_THROTTLE_INTERVAL_SECONDS, SERVICE_VERSION_ENV_KEY, SYSTEMD_RESTART_SEC, SYSTEMD_START_LIMIT_BURST, SYSTEMD_START_LIMIT_INTERVAL_SEC, formatGatewayServiceDescription, resolveGatewayLaunchAgentLabel, resolveGatewaySystemdServiceName, resolveGatewayWindowsTaskName, resolveLaunchAgentPlistPath, resolveSystemdUnitPath };

//# sourceMappingURL=constants.js.map