openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
43 lines (42 loc) • 2.06 kB
JavaScript
//#region src/channels/plugins/exposure.ts
function resolveChannelExposure(e) {
return {
configured: e.exposure?.configured ?? true,
setup: e.exposure?.setup ?? true,
docs: e.exposure?.docs ?? true
};
}
function isChannelVisibleInConfiguredLists(e) {
return resolveChannelExposure(e).configured;
}
function isChannelVisibleInSetup(e) {
return resolveChannelExposure(e).setup;
}
//#endregion
//#region src/channels/plugins/channel-meta.ts
function buildManifestChannelMeta(e) {
const hasArrayField = (t) => e.arrayFieldMode === "defined" ? t !== void 0 : Boolean(t?.length);
return {
id: e.id,
label: e.label,
selectionLabel: e.selectionLabel,
docsPath: e.docsPath,
docsLabel: e.docsLabel,
blurb: e.blurb,
...hasArrayField(e.channel.aliases) ? { aliases: e.channel.aliases } : {},
...e.channel.order !== void 0 ? { order: e.channel.order } : {},
...typeof e.channel.selectionDocsPrefix === "string" ? { selectionDocsPrefix: e.channel.selectionDocsPrefix } : {},
...e.channel.selectionDocsOmitLabel !== void 0 ? { selectionDocsOmitLabel: e.channel.selectionDocsOmitLabel } : {},
...hasArrayField(e.channel.selectionExtras) ? { selectionExtras: e.channel.selectionExtras } : {},
...e.detailLabel ? { detailLabel: e.detailLabel } : {},
...e.systemImage ? { systemImage: e.systemImage } : {},
...e.channel.markdownCapable !== void 0 ? { markdownCapable: e.channel.markdownCapable } : {},
exposure: resolveChannelExposure(e.channel),
...e.channel.quickstartAllowFrom !== void 0 ? { quickstartAllowFrom: e.channel.quickstartAllowFrom } : {},
...e.channel.forceAccountBinding !== void 0 ? { forceAccountBinding: e.channel.forceAccountBinding } : {},
...e.channel.preferSessionLookupForAnnounceTarget !== void 0 ? { preferSessionLookupForAnnounceTarget: e.channel.preferSessionLookupForAnnounceTarget } : {},
...hasArrayField(e.channel.preferOver) ? { preferOver: e.channel.preferOver } : {}
};
}
//#endregion
export { isChannelVisibleInConfiguredLists as n, isChannelVisibleInSetup as r, buildManifestChannelMeta as t };