diff --git a/extensions/memory-core/src/memory/manager-sync-ops.ts b/extensions/memory-core/src/memory/manager-sync-ops.ts index b29d33a069bf..779757cbcc8e 100644 --- a/extensions/memory-core/src/memory/manager-sync-ops.ts +++ b/extensions/memory-core/src/memory/manager-sync-ops.ts @@ -1059,13 +1059,13 @@ export abstract class MemoryManagerSyncOps { agentId: string; sessionId: string; sessionKey: string; - targetKind?: string; + targetKind: "active-session-file" | "runtime-session"; }; }): MemorySessionSyncTarget | null { if (update.sessionFile && isSessionArchiveArtifactName(path.basename(update.sessionFile))) { return null; } - if (update.target && update.target.targetKind !== "active-session-file") { + if (update.target?.targetKind === "runtime-session") { const agentId = update.target.agentId.trim(); const sessionId = update.target.sessionId.trim(); const sessionKey = update.target.sessionKey.trim(); diff --git a/src/sessions/transcript-events.test.ts b/src/sessions/transcript-events.test.ts index 52fd7b71e036..699763754f19 100644 --- a/src/sessions/transcript-events.test.ts +++ b/src/sessions/transcript-events.test.ts @@ -87,7 +87,7 @@ describe("transcript events", () => { agentId: "main", sessionId: "sess-1", sessionKey: "agent:main:main", - targetKind: "runtime-session", + targetKind: "active-session-file", }, agentId: "main", sessionId: "sess-1", diff --git a/src/sessions/transcript-events.ts b/src/sessions/transcript-events.ts index fffbdde0f04d..b49ccab1e537 100644 --- a/src/sessions/transcript-events.ts +++ b/src/sessions/transcript-events.ts @@ -80,6 +80,7 @@ function normalizeUpdateTarget(update: { agentId?: string; sessionId?: string; sessionKey?: string; + sessionFile?: string; target?: SessionTranscriptUpdate["target"]; }): SessionTranscriptUpdateTarget | undefined { const sessionKey = @@ -93,7 +94,11 @@ function normalizeUpdateTarget(update: { normalizeOptionalString(update.target?.sessionId) ?? normalizeOptionalString(update.sessionId); const targetKind = normalizeTargetKind(update.target?.targetKind) ?? - (agentId && sessionId && sessionKey ? "runtime-session" : undefined); + (agentId && sessionId && sessionKey + ? normalizeOptionalString(update.sessionFile) + ? "active-session-file" + : "runtime-session" + : undefined); if (!agentId || !sessionId || !sessionKey || !targetKind) { return undefined; }