openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
1 lines • 1.36 kB
JavaScript
import"./transcript-sqlite-post-commit-BDZjIt2B.mjs";import"./transcript-openclaw-agent-db-schema-read-0j86l7zG.mjs";import"./transcript-openclaw-state-db-cache-DY0tZ0IC.mjs";import"./transcript-openclaw-state-db-readonly-wvpVS-us.mjs";import{a as e,i as t,o as n,t as r}from"./transcript-user-profile-identity.read-DBG9zmer.mjs";import"node:util";function requireResidentProfileCatalog(e){let t=i.get(r(e));if(!t?.valid)throw Error(`User profile catalog is not ready`);return t.rows}const i=/* @__PURE__ */ new Map;function getResidentUserProfileDisplay(r,i={}){let a=e(requireResidentProfileCatalog(i),r);if(!a)throw new n(r);return t(a)}function normalizeControlUiBasePath(e){let t=e?.trim()??``;if(!t||t===`/`)return``;let n=t.startsWith(`/`)?t:`/${t}`;return n.endsWith(`/`)?n.slice(0,-1):n}const a=`/api/users/`;function buildControlUiUserAvatarPath(e,t,n){let r=`${normalizeControlUiBasePath(n)}${a}${encodeURIComponent(e)}/avatar`;return t===void 0?r:`${r}?v=${encodeURIComponent(String(t))}`}a.slice(0,-1);function resolveCurrentUserProfileDisplay(e,t=getResidentUserProfileDisplay){try{let n=t(e);if(!n)return{kind:`unresolved`};let r=n.displayName??void 0;return{kind:`resolved`,profileId:n.id,...r?{label:r}:{},avatarUrl:buildControlUiUserAvatarPath(n.id,n.avatarRevision)}}catch{return{kind:`unresolved`}}}export{resolveCurrentUserProfileDisplay};