feat(sessions): Add automatic session cleanup and retention policy (#7662)

This commit is contained in:
bl-ue
2025-10-06 13:34:00 -06:00
committed by GitHub
parent abe4045c63
commit 974ab66b7a
14 changed files with 2473 additions and 46 deletions
@@ -16,6 +16,8 @@ import type {
GenerateContentResponseUsageMetadata,
} from '@google/genai';
export const SESSION_FILE_PREFIX = 'session-';
/**
* Token usage summary for a message or conversation.
*/
@@ -149,7 +151,7 @@ export class ChatRecordingService {
.toISOString()
.slice(0, 16)
.replace(/:/g, '-');
const filename = `session-${timestamp}-${this.sessionId.slice(
const filename = `${SESSION_FILE_PREFIX}${timestamp}-${this.sessionId.slice(
0,
8,
)}.json`;
@@ -195,7 +197,7 @@ export class ChatRecordingService {
* Records a message in the conversation.
*/
recordMessage(message: {
model: string;
model: string | undefined;
type: ConversationRecordExtra['type'];
content: PartListUnion;
}): void {