UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

28 lines (27 loc) • 1.23 kB
import { o as normalizeLowercaseStringOrEmpty } from "./string-coerce-CCIiB4H7.mjs"; import { o as normalizeModelRef } from "./model-ref-shared-DqE2RqZv.mjs"; import { n as findNormalizedProviderValue$1 } from "./provider-id-b5XGSf9C.mjs"; //#region src/agents/model-selection-normalize.ts /** * Internal declaration anchor for parser and lookup exports consumed by the * public Plugin SDK barrel. Provider/model normalization lives in model-ref-shared. */ const OPENROUTER_AUTO_COMPAT_ALIAS = "openrouter:auto"; /** Find a provider value by normalized provider ID. */ function findNormalizedProviderValue(e, t) { return findNormalizedProviderValue$1(e, t); } /** Parse `provider/model` or bare model text using a default provider. */ function parseModelRef(e, t, n) { const r = e.trim(); if (!r) return null; if (normalizeLowercaseStringOrEmpty(r) === OPENROUTER_AUTO_COMPAT_ALIAS) return normalizeModelRef("openrouter", "auto", n); const i = r.indexOf("/"); if (i === -1) return normalizeModelRef(t, r, n); const a = r.slice(0, i).trim(); const o = r.slice(i + 1).trim(); if (!a || !o) return null; return normalizeModelRef(a, o, n); } //#endregion export { parseModelRef as n, findNormalizedProviderValue as t };