mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-04-29 04:00:36 +00:00
Implement preCompact and add test
This commit is contained in:
parent
a5212123dc
commit
1ee871fc60
7 changed files with 1498 additions and 7 deletions
|
|
@ -19,6 +19,7 @@ import type {
|
|||
SessionEndReason,
|
||||
AgentType,
|
||||
PermissionMode,
|
||||
PreCompactTrigger,
|
||||
} from './types.js';
|
||||
|
||||
const debugLogger = createDebugLogger('TRUSTED_HOOKS');
|
||||
|
|
@ -198,4 +199,20 @@ export class HookSystem {
|
|||
? createHookOutput('PostToolUseFailure', result.finalOutput)
|
||||
: undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fire a PreCompact event - called before conversation compaction
|
||||
*/
|
||||
async firePreCompactEvent(
|
||||
trigger: PreCompactTrigger,
|
||||
customInstructions: string = '',
|
||||
): Promise<DefaultHookOutput | undefined> {
|
||||
const result = await this.hookEventHandler.firePreCompactEvent(
|
||||
trigger,
|
||||
customInstructions,
|
||||
);
|
||||
return result.finalOutput
|
||||
? createHookOutput('PreCompact', result.finalOutput)
|
||||
: undefined;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue