summaryrefslogtreecommitdiff
path: root/packages/cli/src/ui/hooks
diff options
context:
space:
mode:
authorjerop <[email protected]>2025-06-11 04:46:39 +0000
committerJerop Kipruto <[email protected]>2025-06-11 01:18:40 -0400
commitd1e23b7c71e6a0e1c7d920e147ec15a0dbbf689c (patch)
tree80242ba70949c1e8b982ee1c827147ff387ea7b5 /packages/cli/src/ui/hooks
parent95fdc66e7d719eae731c1afd61103f94f7fe3131 (diff)
refactor: Centralize session ID generation and propagation
Diffstat (limited to 'packages/cli/src/ui/hooks')
-rw-r--r--packages/cli/src/ui/hooks/slashCommandProcessor.ts4
-rw-r--r--packages/cli/src/ui/hooks/useLogger.ts3
2 files changed, 4 insertions, 3 deletions
diff --git a/packages/cli/src/ui/hooks/slashCommandProcessor.ts b/packages/cli/src/ui/hooks/slashCommandProcessor.ts
index 4d677f1e..69fb6d06 100644
--- a/packages/cli/src/ui/hooks/slashCommandProcessor.ts
+++ b/packages/cli/src/ui/hooks/slashCommandProcessor.ts
@@ -493,7 +493,7 @@ Add any other context about the problem here.
description: 'save conversation checkpoint. Usage: /save [tag]',
action: async (_mainCommand, subCommand, _args) => {
const tag = (subCommand || '').trim();
- const logger = new Logger();
+ const logger = new Logger(config?.getSessionId() || '');
await logger.initialize();
const chat = await config?.getGeminiClient()?.getChat();
const history = chat?.getHistory() || [];
@@ -519,7 +519,7 @@ Add any other context about the problem here.
'resume from conversation checkpoint. Usage: /resume [tag]',
action: async (_mainCommand, subCommand, _args) => {
const tag = (subCommand || '').trim();
- const logger = new Logger();
+ const logger = new Logger(config?.getSessionId() || '');
await logger.initialize();
const conversation = await logger.loadCheckpoint(tag);
if (conversation.length === 0) {
diff --git a/packages/cli/src/ui/hooks/useLogger.ts b/packages/cli/src/ui/hooks/useLogger.ts
index ea6227ce..ea6d6057 100644
--- a/packages/cli/src/ui/hooks/useLogger.ts
+++ b/packages/cli/src/ui/hooks/useLogger.ts
@@ -5,6 +5,7 @@
*/
import { useState, useEffect } from 'react';
+import { sessionId } from '@gemini-cli/core';
import { Logger } from '@gemini-cli/core';
/**
@@ -14,7 +15,7 @@ export const useLogger = () => {
const [logger, setLogger] = useState<Logger | null>(null);
useEffect(() => {
- const newLogger = new Logger();
+ const newLogger = new Logger(sessionId);
/**
* Start async initialization, no need to await. Using await slows down the
* time from launch to see the gemini-cli prompt and it's better to not save