openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
19 lines (18 loc) • 967 B
JavaScript
import { n as buildAgentMainSessionKey } from "./session-key-DW1jcHbM.mjs";
import "./session-key-CqAyZeVk.mjs";
//#region src/config/sessions/main-session-key.ts
/** Resolves the configured main session identity for one agent and session scope. */
function resolveCanonicalMainSessionKey(e) {
return e.sessionScope === "global" ? "global" : buildAgentMainSessionKey(e);
}
/** Preserve canonical-first lookup order while checking requested and legacy main aliases. */
function collectCanonicalSessionLookupKeys(e) {
const t = /* @__PURE__ */ new Set();
if (e.canonicalKey) t.add(e.canonicalKey);
if (e.requestedKey && e.requestedKey !== e.canonicalKey) t.add(e.requestedKey);
if (e.canonicalKey === "global" || e.canonicalKey === "unknown") return [...t];
if (e.canonicalKey === buildAgentMainSessionKey(e)) t.add(`agent:${e.agentId}:main`);
return [...t];
}
//#endregion
export { resolveCanonicalMainSessionKey as n, collectCanonicalSessionLookupKeys as t };