diff --git a/packages/core/src/hooks/hookEventHandler.test.ts b/packages/core/src/hooks/hookEventHandler.test.ts index 3ee9c8d43e..107ad132a1 100644 --- a/packages/core/src/hooks/hookEventHandler.test.ts +++ b/packages/core/src/hooks/hookEventHandler.test.ts @@ -45,6 +45,13 @@ describe('HookEventHandler', () => { mockConfig = { getSessionId: vi.fn().mockReturnValue('test-session'), getWorkingDir: vi.fn().mockReturnValue('/test/project'), + getGeminiClient: vi.fn().mockReturnValue({ + getChatRecordingService: vi.fn().mockReturnValue({ + getConversationFilePath: vi + .fn() + .mockReturnValue('/test/project/.gemini/tmp/chats/session.json'), + }), + }), } as unknown as Config; mockLogger = {} as Logger; @@ -513,7 +520,7 @@ describe('HookEventHandler', () => { HookEventName.BeforeTool, expect.objectContaining({ session_id: 'test-session', - transcript_path: '', + transcript_path: '/test/project/.gemini/tmp/chats/session.json', cwd: '/test/project', hook_event_name: 'BeforeTool', timestamp: expect.any(String), diff --git a/packages/core/src/hooks/hookEventHandler.ts b/packages/core/src/hooks/hookEventHandler.ts index 1b7820a401..e0b2eb0cbd 100644 --- a/packages/core/src/hooks/hookEventHandler.ts +++ b/packages/core/src/hooks/hookEventHandler.ts @@ -548,9 +548,16 @@ export class HookEventHandler { * Create base hook input with common fields */ private createBaseInput(eventName: HookEventName): HookInput { + // Get the transcript path from the ChatRecordingService if available + const transcriptPath = + this.config + .getGeminiClient() + ?.getChatRecordingService() + ?.getConversationFilePath() ?? ''; + return { session_id: this.config.getSessionId(), - transcript_path: '', // TODO: Implement transcript path when supported + transcript_path: transcriptPath, cwd: this.config.getWorkingDir(), hook_event_name: eventName, timestamp: new Date().toISOString(), diff --git a/packages/core/src/services/chatRecordingService.ts b/packages/core/src/services/chatRecordingService.ts index 26186899f0..0f4dab0f49 100644 --- a/packages/core/src/services/chatRecordingService.ts +++ b/packages/core/src/services/chatRecordingService.ts @@ -468,6 +468,14 @@ export class ChatRecordingService { } } + /** + * Gets the path to the current conversation file. + * Returns null if the service hasn't been initialized yet. + */ + getConversationFilePath(): string | null { + return this.conversationFile; + } + /** * Deletes a session file by session ID. */