//#region src/daemon/constants.ts
const GATEWAY_LAUNCH_AGENT_LABEL = "ai.fased.gateway";
const GATEWAY_SYSTEMD_SERVICE_NAME = "fased-gateway";
const GATEWAY_WINDOWS_TASK_NAME = "FasedAgent Gateway";
const GATEWAY_SERVICE_MARKER = "fased";
const GATEWAY_SERVICE_KIND = "gateway";
const NODE_LAUNCH_AGENT_LABEL = "ai.fased.node";
const NODE_SYSTEMD_SERVICE_NAME = "fased-node";
const NODE_WINDOWS_TASK_NAME = "FasedAgent Node";
const NODE_SERVICE_MARKER = "fased";
const NODE_SERVICE_KIND = "node";
const NODE_WINDOWS_TASK_SCRIPT_NAME = "node.cmd";
const TASK_WORKER_LAUNCH_AGENT_LABEL = "ai.fased.task-worker";
const TASK_WORKER_SYSTEMD_SERVICE_NAME = "fased-task-worker";
const TASK_WORKER_WINDOWS_TASK_NAME = "FasedAgent Task Worker";
const TASK_WORKER_SERVICE_MARKER = "fased";
const TASK_WORKER_SERVICE_KIND = "task-worker";
const TASK_WORKER_WINDOWS_TASK_SCRIPT_NAME = "task-worker.cmd";
const LEGACY_GATEWAY_SYSTEMD_SERVICE_NAMES = [];
function normalizeGatewayProfile(profile) {
	const trimmed = profile?.trim();
	if (!trimmed || trimmed.toLowerCase() === "default") return null;
	return trimmed;
}
function normalizeServiceSegment(value) {
	const trimmed = value?.trim();
	if (!trimmed || trimmed.toLowerCase() === "default") return null;
	return trimmed.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 48) || null;
}
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.fased.${normalized}`;
}
function resolveLegacyGatewayLaunchAgentLabels(profile) {
	return [];
}
function resolveGatewaySystemdServiceName(profile) {
	const suffix = resolveGatewayProfileSuffix(profile);
	if (!suffix) return GATEWAY_SYSTEMD_SERVICE_NAME;
	return `fased-gateway${suffix}`;
}
function resolveGatewayWindowsTaskName(profile) {
	const normalized = normalizeGatewayProfile(profile);
	if (!normalized) return GATEWAY_WINDOWS_TASK_NAME;
	return `FasedAgent 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 "FasedAgent Gateway";
	return `FasedAgent Gateway (${parts.join(", ")})`;
}
function resolveGatewayServiceDescription(params) {
	return params.description ?? formatGatewayServiceDescription({
		profile: params.env.FASED_PROFILE,
		version: params.environment?.FASED_SERVICE_VERSION ?? params.env.FASED_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 "FasedAgent Node Host";
	return `FasedAgent Node Host (v${version})`;
}
function resolveTaskWorkerSegments(params) {
	return [normalizeServiceSegment(params?.profile), normalizeServiceSegment(params?.name)].filter((value) => Boolean(value));
}
function normalizeTaskWorkerName(name) {
	return normalizeServiceSegment(name);
}
function resolveTaskWorkerLaunchAgentLabel(params) {
	const segments = resolveTaskWorkerSegments(params);
	return segments.length > 0 ? `${TASK_WORKER_LAUNCH_AGENT_LABEL}.${segments.join(".")}` : TASK_WORKER_LAUNCH_AGENT_LABEL;
}
function resolveTaskWorkerSystemdServiceName(params) {
	const segments = resolveTaskWorkerSegments(params);
	return segments.length > 0 ? `${TASK_WORKER_SYSTEMD_SERVICE_NAME}-${segments.join("-")}` : TASK_WORKER_SYSTEMD_SERVICE_NAME;
}
function resolveTaskWorkerWindowsTaskName(params) {
	const segments = resolveTaskWorkerSegments(params);
	return segments.length > 0 ? `${TASK_WORKER_WINDOWS_TASK_NAME} (${segments.join(", ")})` : TASK_WORKER_WINDOWS_TASK_NAME;
}
function resolveTaskWorkerWindowsTaskScriptName(params) {
	const segments = resolveTaskWorkerSegments(params);
	return segments.length > 0 ? `task-worker-${segments.join("-")}.cmd` : TASK_WORKER_WINDOWS_TASK_SCRIPT_NAME;
}
function formatTaskWorkerServiceDescription(params) {
	const parts = [];
	const profile = normalizeServiceSegment(params?.profile);
	const name = normalizeServiceSegment(params?.name);
	const version = params?.version?.trim();
	if (profile) parts.push(`profile: ${profile}`);
	if (name) parts.push(`worker: ${name}`);
	if (version) parts.push(`v${version}`);
	return parts.length > 0 ? `FasedAgent Task Worker (${parts.join(", ")})` : "FasedAgent Task Worker";
}

//#endregion
export { resolveTaskWorkerSystemdServiceName as C, resolveTaskWorkerLaunchAgentLabel as S, resolveTaskWorkerWindowsTaskScriptName as T, resolveGatewayWindowsTaskName as _, NODE_SERVICE_KIND as a, resolveNodeSystemdServiceName as b, TASK_WORKER_SERVICE_KIND as c, formatTaskWorkerServiceDescription as d, normalizeTaskWorkerName as f, resolveGatewaySystemdServiceName as g, resolveGatewayServiceDescription as h, LEGACY_GATEWAY_SYSTEMD_SERVICE_NAMES as i, TASK_WORKER_SERVICE_MARKER as l, resolveGatewayProfileSuffix as m, GATEWAY_SERVICE_KIND as n, NODE_SERVICE_MARKER as o, resolveGatewayLaunchAgentLabel as p, GATEWAY_SERVICE_MARKER as r, NODE_WINDOWS_TASK_SCRIPT_NAME as s, GATEWAY_LAUNCH_AGENT_LABEL as t, formatNodeServiceDescription as u, resolveLegacyGatewayLaunchAgentLabels as v, resolveTaskWorkerWindowsTaskName as w, resolveNodeWindowsTaskName as x, resolveNodeLaunchAgentLabel as y };