refactor: dedupe pi model discovery record helper

This commit is contained in:
Peter Steinberger
2026-04-06 23:24:22 +01:00
parent 5c9ec970b8
commit bd2798ec5f

View File

@@ -15,6 +15,7 @@ import {
resolveProviderSyntheticAuthWithPlugin,
} from "../plugins/provider-runtime.js";
import type { ProviderRuntimeModel } from "../plugins/types.js";
import { isRecord } from "../utils.js";
import { ensureAuthProfileStore } from "./auth-profiles.js";
import { resolveProviderEnvApiKeyCandidates } from "./model-auth-env-vars.js";
import { resolveEnvApiKey } from "./model-auth-env.js";
@@ -54,10 +55,6 @@ function createInMemoryAuthStorageBackend(
};
}
function isRecord(value: unknown): value is Record<string, unknown> {
return typeof value === "object" && value !== null && !Array.isArray(value);
}
function normalizeRegistryModel<T>(value: T, agentDir: string): T {
if (!isRecord(value)) {
return value;