mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-22 19:14:33 -07:00
refactor: migrate chatCompressionService to use HookSystem (#16259)
Co-authored-by: Tommaso Sciortino <sciortino@gmail.com>
This commit is contained in:
@@ -22,7 +22,6 @@ import {
|
||||
PREVIEW_GEMINI_MODEL,
|
||||
PREVIEW_GEMINI_FLASH_MODEL,
|
||||
} from '../config/models.js';
|
||||
import { firePreCompressHook } from '../core/sessionHookTriggers.js';
|
||||
import { PreCompressTrigger } from '../hooks/types.js';
|
||||
|
||||
/**
|
||||
@@ -128,16 +127,10 @@ export class ChatCompressionService {
|
||||
};
|
||||
}
|
||||
|
||||
// Fire PreCompress hook before compression (only if hooks are enabled)
|
||||
// Fire PreCompress hook before compression
|
||||
// This fires for both manual and auto compression attempts
|
||||
const hooksEnabled = config.getEnableHooks();
|
||||
const messageBus = config.getMessageBus();
|
||||
if (hooksEnabled && messageBus) {
|
||||
const trigger = force
|
||||
? PreCompressTrigger.Manual
|
||||
: PreCompressTrigger.Auto;
|
||||
await firePreCompressHook(messageBus, trigger);
|
||||
}
|
||||
const trigger = force ? PreCompressTrigger.Manual : PreCompressTrigger.Auto;
|
||||
await config.getHookSystem()?.firePreCompressEvent(trigger);
|
||||
|
||||
const originalTokenCount = chat.getLastPromptTokenCount();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user