refactor: drop legacy session store keys
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user