UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

54 lines (53 loc) • 1.74 kB
import { i as DEFAULT_PROVIDER, n as DEFAULT_MODEL } from "./defaults-BWyoTPqn.mjs"; import { t as splitTrailingAuthProfile } from "./model-ref-profile-C7DWqVP0.mjs"; import { h as resolveConfiguredModelRef, i as buildModelAliasIndex, y as resolveModelRefFromString } from "./model-selection-shared-9Kz63Hhm.mjs"; //#region src/commands/doctor/shared/model-reference-resolver.ts function createDoctorModelRefResolver(e) { const t = /* @__PURE__ */ new Map(); return (n, r) => { let resolve = t.get(r); if (!resolve) { const n = { cfg: e, agentId: r, allowPluginNormalization: false, allowManifestNormalization: false }; const i = resolveConfiguredModelRef({ ...n, defaultProvider: DEFAULT_PROVIDER, defaultModel: DEFAULT_MODEL }).provider; const a = buildModelAliasIndex({ ...n, defaultProvider: i }); resolve = (e) => { const t = resolveModelRefFromString({ ...n, raw: splitTrailingAuthProfile(e).model, defaultProvider: i, aliasIndex: a })?.ref; return t ? t.provider + "/" + t.model : void 0; }; t.set(r, resolve); } return resolve(n); }; } //#endregion //#region src/commands/doctor/shared/model-alias-canonicalization.ts /** Materialize the old identity before moving an alias; this changes no model or Access choice. */ function createModelAliasCanonicalizer(e, t) { const n = createDoctorModelRefResolver(e); const r = new Set(t.map((e) => e.from)); return (e, t) => { const i = splitTrailingAuthProfile(e); const a = n(e, t); if (!a || !r.has(a) || i.model === a) return; return i.profile ? a + "@" + i.profile : a; }; } //#endregion export { createDoctorModelRefResolver as n, createModelAliasCanonicalizer as t };