Add resolveApiKey to before_compact hook event

This commit is contained in:
Mario Zechner 2025-12-24 12:28:51 +01:00
parent 5aa53ded11
commit 43a5447a80
4 changed files with 9 additions and 0 deletions

View file

@ -772,6 +772,7 @@ export class AgentSession {
customInstructions,
model: this.model,
apiKey,
resolveApiKey: this._resolveApiKey,
})) as SessionEventResult | undefined;
if (result?.cancel) {
@ -922,6 +923,7 @@ export class AgentSession {
customInstructions: undefined,
model: this.model,
apiKey,
resolveApiKey: this._resolveApiKey,
})) as SessionEventResult | undefined;
if (hookResult?.cancel) {

View file

@ -135,6 +135,8 @@ export type SessionEvent =
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>;
})
| (SessionEventBase & {
reason: "compact";