feat(coach): inject the rolling summary + enqueue memory refresh

fetchConversationWithMessages now returns the decrypted rolling summary
(fail-closed → null), and buildHistoryWindow substitutes it for the dead
placeholder so a long conversation keeps memory of its elided turns.
Once a conversation grows past the turn cap the chat turn fires a
fire-and-forget coach-memory-refresh so the next long turn is fresh,
without adding a provider round-trip to the interactive reply.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Marc-André BombeckandClaude Opus 4.8 committed 2026-06-04 10:21:19 +02:00
1 parent 7e29595a71
commit 9a0ea1be56
3 files changed
+55 -15

No files matched your search

+13
View File
@@ -218,6 +218,18 @@ export async function fetchConversationWithMessages(
promptVersion: m.promptVersion,
}));
// v1.11.1 — decrypt the rolling conversation summary (fail-closed: an
// undecryptable row is treated as absent so the chat turn never throws and
// simply falls back to the placeholder).
let summary: string | null = null;
if (row.summaryEncrypted && row.summaryEncrypted.byteLength > 0) {
try {
summary = decryptFromBytes(row.summaryEncrypted);
} catch {
summary = null;
}
}
return {
id: row.id,
title: row.title,
@@ -225,6 +237,7 @@ export async function fetchConversationWithMessages(
updatedAt: row.updatedAt.toISOString(),
messageCount: messages.length,
messages,
summary,
};
}
+5
View File
@@ -299,6 +299,11 @@ export interface CoachMessageDTO {
export interface CoachConversationDetailDTO extends CoachConversationDTO {
messages: CoachMessageDTO[];
/**
* v1.11.1 — decrypted rolling summary of the turns elided past the history
* window, or null when none is on file / it could not be decrypted.
*/
summary?: string | null;
}
/**