UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

5 lines • 1.72 kB
import{l as normalizeOptionalString}from"./string-coerce-CpTFcSwY.mjs";import{a as getBundledChannelSetupSecrets,i as getBundledChannelSetupPlugin,n as getBundledChannelPlugin,r as getBundledChannelSecrets}from"./bundled-CcedQErj.mjs"; //!src/channels/plugins/merge-plugin-section.ts function mergeChannelPluginSection(e,t){if(e&&t&&typeof e===`object`&&typeof t===`object`){const n={...e};for(const[e,r]of Object.entries(t))if(r!==void 0)n[e]=r;return n}return t??e}function mergeChannelPlugins(e,t,n){return{...e,...t,meta:mergeChannelPluginSection(e.meta,t.meta),capabilities:mergeChannelPluginSection(e.capabilities,t.capabilities),commands:mergeChannelPluginSection(e.commands,t.commands),doctor:mergeChannelPluginSection(e.doctor,t.doctor),reload:mergeChannelPluginSection(e.reload,t.reload),config:mergeChannelPluginSection(e.config,t.config),...n===`merge`?{setup:mergeChannelPluginSection(e.setup,t.setup)}:{},messaging:mergeChannelPluginSection(e.messaging,t.messaging),actions:mergeChannelPluginSection(e.actions,t.actions),secrets:mergeChannelPluginSection(e.secrets,t.secrets)}} //!src/channels/plugins/bootstrap-registry.ts function getBootstrapChannelPlugin(e){const t=normalizeOptionalString(e);if(!t)return;let n;let r;try{n=getBundledChannelPlugin(t);r=getBundledChannelSetupPlugin(t)}catch{return}return n&&r?mergeChannelPlugins(n,r,`override`):r??n}function getBootstrapChannelSecrets(e){const t=normalizeOptionalString(e);if(!t)return;try{const e=getBundledChannelSecrets(t);const n=getBundledChannelSetupSecrets(t);return mergeChannelPluginSection(e,n)}catch{return}}export{mergeChannelPlugins as i,getBootstrapChannelSecrets as n,mergeChannelPluginSection as r,getBootstrapChannelPlugin as t};