Merge PR #7080: fix(ai): add authenticated Bedrock Mantle routing (@anatoli-tsinovoy)
# Conflicts: # packages/ai/src/registry/registry.ts # packages/catalog/scripts/generated-policies.ts # packages/catalog/src/models.json
This commit is contained in:
@@ -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 { buildGitLabDuoWorkflowFallbackModel } from "../src/discovery/gitlab-duo-workflow";
|
||||
@@ -31,6 +32,7 @@ import {
|
||||
AIAND_STATIC_MODELS,
|
||||
ALIBABA_TOKEN_PLAN_STATIC_MODELS,
|
||||
ANTHROPIC_CURATED_FALLBACK_MODELS,
|
||||
BEDROCK_MANTLE_STATIC_MODELS,
|
||||
buildFireworksFastSeed,
|
||||
buildXaiOAuthStaticSeed,
|
||||
clampFireworksKimiMaxTokens,
|
||||
@@ -57,6 +59,7 @@ import {
|
||||
applyGeneratedModelPolicies,
|
||||
applyOllamaCloudOutputCap,
|
||||
CLOUDFLARE_FALLBACK_MODEL,
|
||||
dropBedrockMantleOpenAIModels,
|
||||
dropUnsupportedBedrockGeoIds,
|
||||
hasBillableCost,
|
||||
linkOpenAIPromotionTargets,
|
||||
@@ -126,7 +129,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
|
||||
@@ -554,6 +560,9 @@ 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);
|
||||
// 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,
|
||||
// Sakana is authoritative and stale seed IDs must stay out.
|
||||
@@ -657,6 +666,7 @@ async function generateModels() {
|
||||
allModels = dropUnusableZaiContextTierIds(allModels);
|
||||
allModels = dropXiaomiAudioOnlyIds(allModels);
|
||||
allModels = dropUnsupportedBedrockGeoIds(allModels);
|
||||
allModels = dropBedrockMantleOpenAIModels(allModels);
|
||||
allModels = normalizeAntigravityEndpoint(allModels);
|
||||
// Normalize display names: gateway author prefixes ("OpenAI: …"), alias
|
||||
// markers ("(latest)"), provider attribution ("(Antigravity)"), and
|
||||
|
||||
Reference in New Issue
Block a user