refactor: drop legacy session store keys

This commit is contained in:
Peter Steinberger
2026-01-17 06:48:34 +00:00
parent 353d778988
commit 37a2eee837
22 changed files with 65 additions and 93 deletions

View File

@@ -1,6 +1,7 @@
import { loadConfig } from "../config/config.js";
import { loadSessionStore, resolveStorePath } from "../config/sessions.js";
import { getAgentRunContext, registerAgentRunContext } from "../infra/agent-events.js";
import { parseAgentSessionKey } from "../routing/session-key.js";
export function resolveSessionKeyForRun(runId: string) {
const cached = getAgentRunContext(runId)?.sessionKey;
@@ -9,9 +10,12 @@ export function resolveSessionKeyForRun(runId: string) {
const storePath = resolveStorePath(cfg.session?.store);
const store = loadSessionStore(storePath);
const found = Object.entries(store).find(([, entry]) => entry?.sessionId === runId);
const sessionKey = found?.[0];
if (sessionKey) {
const storeKey = found?.[0];
if (storeKey) {
const parsed = parseAgentSessionKey(storeKey);
const sessionKey = parsed?.rest ?? storeKey;
registerAgentRunContext(runId, { sessionKey });
return sessionKey;
}
return sessionKey;
return undefined;
}