fix(ai): address Bedrock Mantle review feedback

This commit is contained in:
Anatoli Tsinovoy
2026-08-01 12:29:07 +03:00
parent 7aa772beee
commit e5541a577a
24 changed files with 1997 additions and 670 deletions
+7 -2
View File
@@ -14,6 +14,7 @@ import { discoverAuthStorage } from "@oh-my-pi/pi-ai/auth-broker/discover";
import type { OAuthAccess } from "@oh-my-pi/pi-ai/auth-storage";
import type { OAuthProvider } from "@oh-my-pi/pi-ai/oauth/types";
import { getGitLabDuoModels } from "@oh-my-pi/pi-ai/providers/gitlab-duo";
import { getProviderDefinition } from "@oh-my-pi/pi-ai/registry";
import { $env } from "@oh-my-pi/pi-utils";
import { ANTIGRAVITY_PRIMARY_ENDPOINT, fetchAntigravityDiscoveryModels } from "../src/discovery/antigravity";
import { fetchCodexModels } from "../src/discovery/codex";
@@ -123,7 +124,10 @@ async function fetchProviderModelsFromCatalog(
try {
console.log(`Fetching models from ${descriptor.catalogDiscovery.label} model manager...`);
const managerOptions = descriptor.createModelManagerOptions({ apiKey });
const discoveryConfig = { apiKey };
const preparedConfig =
getProviderDefinition(descriptor.providerId)?.prepareModelDiscovery?.(discoveryConfig) ?? discoveryConfig;
const managerOptions = descriptor.createModelManagerOptions(preparedConfig);
const manager = createModelManager(managerOptions);
const result = await manager.refresh("online");
// `stale: true` means the dynamic fetch failed and the manager fell back
@@ -555,7 +559,8 @@ async function generateModels() {
// Seed Meta's documented Muse model so first-run selection does not depend on
// credentials or live discovery.
allModels.push(...META_MUSE_STATIC_MODELS);
// Bedrock Mantle has no catalog endpoint used by generation.
// Mantle's catalog endpoint is account/API-key scoped. Keep the generated
// bundle deterministic; authenticated runtime discovery may replace this seed.
allModels.push(...BEDROCK_MANTLE_STATIC_MODELS);
// Seed Sakana's documented Fugu models so the provider is usable when
// catalog generation has no live API key. If live `/v1/models` succeeds,