import { Cd as isTruthyEnvValue, Nu as listChannelPlugins, jf as CHAT_CHANNEL_ORDER } from "./agent-scope-CLn_Ws3B.js";
import { c as listChannelPluginCatalogEntries } from "./dangerous-name-matching-B2YH8EDF.js";
import { t as ensurePluginRegistryLoaded } from "./plugin-registry-2aqMgXpl.js";

//#region src/cli/channel-options.ts
function dedupe(values) {
	const seen = /* @__PURE__ */ new Set();
	const resolved = [];
	for (const value of values) {
		if (!value || seen.has(value)) continue;
		seen.add(value);
		resolved.push(value);
	}
	return resolved;
}
function resolveCliChannelOptions() {
	const catalog = listChannelPluginCatalogEntries().map((entry) => entry.id);
	const base = dedupe([...CHAT_CHANNEL_ORDER, ...catalog]);
	if (isTruthyEnvValue(process.env.FASED_EAGER_CHANNEL_OPTIONS)) {
		ensurePluginRegistryLoaded();
		const pluginIds = listChannelPlugins().map((plugin) => plugin.id);
		return dedupe([...base, ...pluginIds]);
	}
	return base;
}
function formatCliChannelOptions(extra = []) {
	return [...extra, ...resolveCliChannelOptions()].join("|");
}

//#endregion
//#region src/cli/program/parent-default-help.ts
const parentDefaultHelpCommands = /* @__PURE__ */ new WeakSet();
function applyParentDefaultHelpAction(parent) {
	parentDefaultHelpCommands.add(parent);
	parent.action(() => {
		parent.outputHelp();
		process.exitCode = 0;
	});
}
function isParentDefaultHelpAction(parent) {
	return parentDefaultHelpCommands.has(parent);
}

//#endregion
export { resolveCliChannelOptions as i, isParentDefaultHelpAction as n, formatCliChannelOptions as r, applyParentDefaultHelpAction as t };