UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

30 lines (29 loc) • 1.43 kB
import { n as normalizeAgentId } from "./agent-id-CQjtp2ft.mjs"; import { j as tryResolveLegacyDataOwnerAgentId } from "./agent-scope-config-DmXgFGKP.mjs"; //#region src/config/legacy.default-agent-owner-state.ts const legacyDefaultAgentIdByConfig = /* @__PURE__ */ new WeakMap(); function setRetainedLegacyDefaultAgentId(e, t) { if (t) legacyDefaultAgentIdByConfig.set(e, t); else legacyDefaultAgentIdByConfig.delete(e); } function getRetainedLegacyDefaultAgentId(e) { return legacyDefaultAgentIdByConfig.get(e); } //#endregion //#region src/config/legacy.default-agent-owner.ts function retainLegacyDefaultAgentId(e, t) { setRetainedLegacyDefaultAgentId(e, t ? normalizeAgentId(t) : void 0); return e; } function inheritLegacyDefaultAgentId(e, t) { return retainLegacyDefaultAgentId(t, tryGetLegacyDefaultAgentId(e)); } function tryGetLegacyDefaultAgentId(e) { return typeof e === "object" && e !== null || typeof e === "function" ? getRetainedLegacyDefaultAgentId(e) : void 0; } function resolveSessionStoreCompatibilityAgentId(e) { const t = e.agents?.defaults?.sessionStore?.agentId?.trim(); return t ? normalizeAgentId(t) : tryResolveLegacyDataOwnerAgentId(e) ?? "main"; } //#endregion export { getRetainedLegacyDefaultAgentId as a, tryGetLegacyDefaultAgentId as i, resolveSessionStoreCompatibilityAgentId as n, setRetainedLegacyDefaultAgentId as o, retainLegacyDefaultAgentId as r, inheritLegacyDefaultAgentId as t };