fix: apply extension provider registrations before model resolution

- Extensions register providers via pendingProviderRegistrations
- These were only applied in bindCore() during AgentSession creation
- But model resolution in main.ts happens before session creation
- Fix: apply pending registrations immediately after loading extensions
- Also fix gitlab-duo to pass Authorization header instead of apiKey
This commit is contained in:
Mario Zechner 2026-01-25 00:13:20 +01:00
parent dd01d83e64
commit 7a5cfdaed0
3 changed files with 316 additions and 2 deletions

View file

@ -465,6 +465,13 @@ export async function main(args: string[]) {
console.error(chalk.red(`Failed to load extension "${path}": ${error}`));
}
// Apply pending provider registrations from extensions immediately
// so they're available for model resolution before AgentSession is created
for (const { name, config } of extensionsResult.runtime.pendingProviderRegistrations) {
modelRegistry.registerProvider(name, config);
}
extensionsResult.runtime.pendingProviderRegistrations = [];
const extensionFlags = new Map<string, { type: "boolean" | "string" }>();
for (const ext of extensionsResult.extensions) {
for (const [name, flag] of ext.flags) {