32 lines
1.2 KiB
JavaScript
32 lines
1.2 KiB
JavaScript
import { Q as CHAT_CHANNEL_ORDER, n as isTruthyEnvValue } from "./entry.js";
|
|
import { i as listChannelPluginCatalogEntries } from "./plugin-auto-enable-CIVp3SAp.js";
|
|
import { n as listChannelPlugins } from "./plugins-TrKFfrLt.js";
|
|
import { n as ensurePluginRegistryLoaded } from "./command-options-D-7lJZEz.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.OPENCLAW_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
|
|
export { resolveCliChannelOptions as n, formatCliChannelOptions as t }; |