Improve before_compact hook: add messagesToKeep, replace apiKey with resolveApiKey

This commit is contained in:
Mario Zechner 2025-12-24 12:41:22 +01:00
parent e4283294c8
commit d9a542763a
8 changed files with 51 additions and 24 deletions

View file

@ -130,11 +130,13 @@ export type SessionEvent =
| (SessionEventBase & {
reason: "before_compact";
cutPoint: CutPointResult;
/** Messages that will be summarized and discarded */
messagesToSummarize: AppMessage[];
/** Messages that will be kept after the summary (recent turns) */
messagesToKeep: AppMessage[];
tokensBefore: number;
customInstructions?: string;
model: Model<any>;
apiKey: string;
/** Resolve API key for any model (checks settings, OAuth, env vars) */
resolveApiKey: (model: Model<any>) => Promise<string | undefined>;
})