openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
3 lines • 1.9 kB
JavaScript
import{t as UI_APPEARANCE_PREFERENCE_KEYS}from"./ui-appearance-preferences-DydS-zFB.mjs";import{n as authorizeOperatorScopesForMethod}from"./method-scopes-Dalbwzsv.mjs";import{t as getCanonicalUserPreferences}from"./user-preferences-ChMh2QRU.mjs";import{t as redactConfigObject}from"./redact-snapshot-B-h1qJ6D.mjs";import{n as computeBaseConfigUiHints}from"./schema-base-CvuIDv_v.mjs";
//!src/gateway/control-ui-bootstrap-preferences.ts
let bootstrapUiHints;async function prepareControlUiBootstrapPreferences(e,t){const n=t.authenticatedUserProfile?.profileId;const r=n?getCanonicalUserPreferences(n,[...Object.values(UI_APPEARANCE_PREFERENCE_KEYS),`ui.railShortcuts`,`ui.personalSessionGroups`]).catch(()=>void 0):void 0;const i=e&&authorizeOperatorScopesForMethod(`config.get`,t.operatorScopes).allowed?redactConfigObject({ui:{prefs:e.ui?.prefs},gateway:{publicOrigin:e.gateway?.publicOrigin,controlUi:{experimental:{templates:e.gateway?.controlUi?.experimental?.templates===true}}},messages:{queue:e.messages?.queue},tts:e.tts?{maxTextLength:e.tts.maxTextLength}:null,tools:{swarm:e.tools?.swarm,web:{search:{enabled:e.tools?.web?.search?.enabled}}},agents:{entries:Object.fromEntries(Object.entries(e.agents?.entries??{}).map(([e,t])=>[e,{tools:{swarm:t.tools?.swarm}}]))},mcp:{servers:Object.fromEntries(Object.entries(e.mcp?.servers??{}).map(([e,t])=>[e,{enabled:t.enabled,command:t.command,url:t.url,transport:t.transport,auth:t.auth,oauth:t.oauth?{authProfileId:t.oauth.authProfileId,identity:t.oauth.identity}:void 0,toolFilter:Boolean(t.toolFilter),supportsParallelToolCalls:t.supportsParallelToolCalls,sslVerify:t.sslVerify,clientCert:Boolean(t.clientCert),clientKey:Boolean(t.clientKey)}]))}},bootstrapUiHints??=computeBaseConfigUiHints()):void 0;const a=await r;return{...n?{profileId:n}:{},...i?{config:i}:{},...a?{entries:a.entries}:{}}}export{prepareControlUiBootstrapPreferences};