UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

5 lines • 1.96 kB
import{o as hasConfiguredSecretInput}from"./types.secrets-UWdyCdE6.mjs";import{n as normalizeAccountId}from"./account-id-3yqrEsRn.mjs";import{n as resolveAccountKey}from"./account-lookup-DXbrh7Os.mjs";import{t as mergeAccountConfig}from"./channel-account-config-DFPObbzi.mjs";import{t as createAccountListHelpers}from"./account-helpers-Brjsp5C9.mjs";import"./secret-input-FyvkT2mt.mjs";import"./account-helpers-D5kWqyL0.mjs";import"./account-resolution-ChjbGxUY.mjs"; //!extensions/x/src/cost-limits.ts function resolveXCostLimits(e){return{dailyUsd:e?.dailyUsd??100,monthlyUsd:e?.monthlyUsd??1e3,cycleStartDay:e?.cycleStartDay??1}} //!extensions/x/src/accounts.ts const accounts=createAccountListHelpers(`x`,{omitKeys:[`defaultAccount`],nestedObjectKeys:[`guests`,`costLimits`,`verifiedFromGitHub`],implicitDefaultAccount:{channelKeys:[`userId`,`clientId`,`refreshToken`]}});const listXAccountIds=accounts.listAccountIds;const listXRuntimeAccountIds=e=>[...new Set(listXAccountIds(e).map(normalizeAccountId))];const resolveDefaultXAccountId=accounts.resolveDefaultAccountId;function resolveXAccountKey(e,t){const n=normalizeAccountId(t);return resolveAccountKey(e.channels?.x?.accounts,n,void 0,void 0,{channelId:`x`})}function resolveXAccount(e,t){const n=normalizeAccountId(t??resolveDefaultXAccountId(e));const r=accounts.resolveAccountConfig(e,n);if(r.guests)r.guests=mergeAccountConfig({channelConfig:e.channels?.x?.guests,accountConfig:r.guests,nestedObjectKeys:[`tools`]});const i=e.channels?.x?.enabled!==false&&r.enabled!==false;const a=Boolean(r.userId&&r.username&&r.clientId&&hasConfiguredSecretInput(r.clientSecret)&&hasConfiguredSecretInput(r.refreshToken));return{accountId:n,config:r,costLimits:resolveXCostLimits(r.costLimits),enabled:i,configured:a,userId:r.userId??``,username:r.username??``,name:r.name}}export{resolveXAccountKey as a,resolveXAccount as i,listXRuntimeAccountIds as n,resolveDefaultXAccountId as r,listXAccountIds as t};