()
| 369 | // ─── Dynamic model catalog from cloud ───────────────────── |
| 370 | |
| 371 | async function fetchAndMergeModelCatalog() { |
| 372 | // Use the first active account to fetch the catalog. |
| 373 | const acct = accounts.find(a => a.status === 'active' && a.apiKey); |
| 374 | if (!acct) { |
| 375 | log.debug('No active account for model catalog fetch'); |
| 376 | return; |
| 377 | } |
| 378 | try { |
| 379 | const { getCascadeModelConfigs } = await import('./windsurf-api.js'); |
| 380 | const { mergeCloudModels } = await import('./models.js'); |
| 381 | const proxy = getEffectiveProxy(acct.id) || null; |
| 382 | const { configs } = await getCascadeModelConfigs(acct.apiKey, proxy); |
| 383 | const added = mergeCloudModels(configs); |
| 384 | log.info(`Model catalog: ${configs.length} cloud models, ${added} new entries merged`); |
| 385 | } catch (e) { |
| 386 | log.warn(`Model catalog fetch failed: ${e.message}`); |
| 387 | } |
| 388 | } |
| 389 | |
| 390 | async function registerWithCodeium(idToken) { |
| 391 | const { WindsurfClient } = await import('./client.js'); |
no test coverage detected