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
@@ -50,6 +50,9 @@ const MockedGeminiClientClass = vi.hoisted(() =>
this.startChat = mockStartChat;
this.sendMessageStream = mockSendMessageStream;
this.addHistory = vi.fn();
this.getChat = vi.fn().mockReturnValue({
recordCompletedToolCalls: vi.fn(),
});
this.getChatRecordingService = vi.fn().mockReturnValue({
recordThought: vi.fn(),
initialize: vi.fn(),
@@ -137,6 +137,24 @@ export const useGeminiStream = (
Date.now(),
);
// Record tool calls with full metadata before sending responses.
try {
const currentModel =
config.getGeminiClient().getCurrentSequenceModel() ??
config.getModel();
config
.getGeminiClient()
.getChat()
.recordCompletedToolCalls(
currentModel,
completedToolCallsFromScheduler,
);
} catch (error) {
console.error(
`Error recording completed tool call information: ${error}`,
);
}
// Handle tool response submission immediately when tools complete
await handleCompletedTools(
completedToolCallsFromScheduler as TrackedToolCall[],