import {
normalizeAgentId,
normalizeMainKey,
resolveAgentIdFromSessionKey,
} from "../../routing/session-key.js"; import type { SessionScope } from "./types.js";
const FALLBACK_DEFAULT_AGENT_ID = "main";
function buildMainSessionKey(agentId: string, mainKey?: string): string { return `agent:${normalizeAgentId(agentId)}:${normalizeMainKey(mainKey)}`;
}
// Also recognize legacy keys built with the hardcoded DEFAULT_AGENT_ID ("main") // when the configured agent differs. resolveSessionKey() historically used // DEFAULT_AGENT_ID="main" for all write paths, producing "agent:main:<mainKey>" // even when the configured agent is e.g. "ops". See #29683. const legacyMainKey = buildMainSessionKey(FALLBACK_DEFAULT_AGENT_ID, mainKey); const legacyMainAliasKey = buildMainSessionKey(FALLBACK_DEFAULT_AGENT_ID, "main");
const isMainAlias =
raw === "main" ||
raw === mainKey ||
raw === agentMainSessionKey ||
raw === agentMainAliasKey ||
raw === legacyMainKey ||
raw === legacyMainAliasKey;
if (params.cfg?.session?.scope === "global" && isMainAlias) { return"global";
} if (isMainAlias) { return agentMainSessionKey;
} return raw;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.