import { loadBuiltInModels, mergeCustomModels } from "./model-registry-builtins.js";
import { loadCustomModelsFromPaths } from "./model-registry-custom-loader.js";
export function loadModelRegistryModels(authStorage, modelsJsonPaths) {
    const { models: customModels, overrides, modelOverrides, providerRequestConfigs, modelRequestHeaders, error, } = loadCustomModelsFromPaths(modelsJsonPaths);
    const builtInModels = loadBuiltInModels(overrides, modelOverrides);
    let combined = mergeCustomModels(builtInModels, customModels);
    for (const oauthProvider of authStorage.getOAuthProviders()) {
        const cred = authStorage.get(oauthProvider.id);
        if (cred?.type === "oauth" && oauthProvider.modifyModels) {
            combined = oauthProvider.modifyModels(combined, cred);
        }
    }
    return {
        models: combined,
        providerRequestConfigs,
        modelRequestHeaders,
        loadError: error,
    };
}
//# sourceMappingURL=model-registry-loader.js.map