refactor(messages): centralize per-agent prefixes

This commit is contained in:
Peter Steinberger
2026-01-09 16:52:25 +01:00
parent 8341b662af
commit 36bdec0f2c
14 changed files with 144 additions and 48 deletions

View File

@@ -11,7 +11,7 @@ import {
DEFAULT_AGENT_ID,
DEFAULT_MAIN_KEY,
normalizeAgentId,
parseAgentSessionKey,
resolveAgentIdFromSessionKey,
} from "../routing/session-key.js";
import { normalizeE164 } from "../utils.js";
import {
@@ -232,12 +232,7 @@ export function resolveMainSessionKey(cfg?: {
return buildAgentMainSessionKey({ agentId, mainKey });
}
export function resolveAgentIdFromSessionKey(
sessionKey?: string | null,
): string {
const parsed = parseAgentSessionKey(sessionKey);
return normalizeAgentId(parsed?.agentId ?? DEFAULT_AGENT_ID);
}
export { resolveAgentIdFromSessionKey };
export function resolveAgentMainSessionKey(params: {
cfg?: { session?: { mainKey?: string } };