UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

51 lines (50 loc) • 2.11 kB
import { t as UI_APPEARANCE_PREFERENCE_KEYS } from "./ui-appearance-preferences-ChMwEYlu.mjs"; import { n as authorizeOperatorScopesForMethod } from "./method-scopes-Dpyb0Ck-.mjs"; import { t as getCanonicalUserPreferences } from "./user-preferences-Bj_2vk3E.mjs"; import { t as redactConfigObject } from "./redact-snapshot-HHllfRSn.mjs"; import { n as computeBaseConfigUiHints } from "./schema-base-DaoQa2-g.mjs"; //#region 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 }, 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 } : {} }; } //#endregion export { prepareControlUiBootstrapPreferences };