openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
29 lines (28 loc) • 1.25 kB
JavaScript
import { n as loadCombinedSessionStoreForGatewayCore } from "./combined-store-gateway-DGm4nZAJ.js";
import { n as resolveSessionIdMatchSelection } from "./session-id-resolution-BbcM7Och.js";
import { f as resolveGatewaySessionStoreTargetWithStore, s as resolveCanonicalSessionEntryFromStoreKeys } from "./session-utils-store-CInT2loy.js";
import "./session-utils-Cai0_C6U.js";
//#region src/gateway/worker-environments/session-target.ts
function resolveWorkerSessionTarget(cfg, sessionId) {
const { store } = loadCombinedSessionStoreForGatewayCore(cfg);
const matches = Object.entries(store).filter(([, entry]) => entry.sessionId === sessionId);
const selection = resolveSessionIdMatchSelection(matches, sessionId);
if (selection.kind !== "selected") return;
const target = resolveGatewaySessionStoreTargetWithStore({
cfg,
key: selection.sessionKey,
clone: false
});
const entry = resolveCanonicalSessionEntryFromStoreKeys(target.store, target.storeKeys);
if (!entry || entry.sessionId !== sessionId) return;
return {
agentId: target.agentId,
sessionEntry: entry,
sessionId,
sessionKey: target.canonicalKey,
sessionStore: target.store,
storePath: target.storePath
};
}
//#endregion
export { resolveWorkerSessionTarget as t };