mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-03-16 00:51:25 -07:00
feat(core): implement session learnings summary hook
This commit is contained in:
@@ -33,6 +33,7 @@ import type {
|
||||
ToolListUnion,
|
||||
} from '@google/genai';
|
||||
import type { ToolCallConfirmationDetails } from '../tools/tools.js';
|
||||
import { SessionLearningsService } from '../services/sessionLearningsService.js';
|
||||
|
||||
/**
|
||||
* Main hook system that coordinates all hook-related functionality
|
||||
@@ -151,6 +152,7 @@ export class HookSystem {
|
||||
private readonly hookAggregator: HookAggregator;
|
||||
private readonly hookPlanner: HookPlanner;
|
||||
private readonly hookEventHandler: HookEventHandler;
|
||||
private readonly sessionLearningsService: SessionLearningsService;
|
||||
|
||||
constructor(config: Config) {
|
||||
// Initialize components
|
||||
@@ -164,6 +166,7 @@ export class HookSystem {
|
||||
this.hookRunner,
|
||||
this.hookAggregator,
|
||||
);
|
||||
this.sessionLearningsService = new SessionLearningsService(config);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -215,7 +218,14 @@ export class HookSystem {
|
||||
async fireSessionEndEvent(
|
||||
reason: SessionEndReason,
|
||||
): Promise<AggregatedHookResult | undefined> {
|
||||
return this.hookEventHandler.fireSessionEndEvent(reason);
|
||||
const result = await this.hookEventHandler.fireSessionEndEvent(reason);
|
||||
|
||||
// Built-in system hook for session learnings
|
||||
if (reason === 'exit' || reason === 'logout') {
|
||||
await this.sessionLearningsService.generateAndSaveLearnings();
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
async firePreCompressEvent(
|
||||
|
||||
Reference in New Issue
Block a user