@x12i/ai-tools 2.1.5 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/catalog/index.cjs +4 -4
- package/dist/catalog/index.js +3 -3
- package/dist/{chunk-U3BAEJ2C.cjs → chunk-33AAM7KQ.cjs} +3 -3
- package/dist/{chunk-U3BAEJ2C.cjs.map → chunk-33AAM7KQ.cjs.map} +1 -1
- package/dist/{chunk-4ILJWO64.js → chunk-3CUSLNEV.js} +8 -1
- package/dist/chunk-3CUSLNEV.js.map +1 -0
- package/dist/{chunk-SYDW33AL.cjs → chunk-EDZOFPLV.cjs} +8 -1
- package/dist/chunk-EDZOFPLV.cjs.map +1 -0
- package/dist/{chunk-IYRZYLUP.cjs → chunk-FWPH5YE6.cjs} +11 -11
- package/dist/{chunk-IYRZYLUP.cjs.map → chunk-FWPH5YE6.cjs.map} +1 -1
- package/dist/{chunk-5IZ7PLY2.cjs → chunk-FYRPN3N2.cjs} +3 -3
- package/dist/chunk-FYRPN3N2.cjs.map +1 -0
- package/dist/{chunk-4UA2V5R2.cjs → chunk-GHRUS5UF.cjs} +14 -14
- package/dist/{chunk-4UA2V5R2.cjs.map → chunk-GHRUS5UF.cjs.map} +1 -1
- package/dist/{chunk-WJFOQS6I.js → chunk-M35MNKDY.js} +3 -3
- package/dist/{chunk-YQVY7CWT.js → chunk-MLMQ5LGW.js} +2 -2
- package/dist/{chunk-YQVY7CWT.js.map → chunk-MLMQ5LGW.js.map} +1 -1
- package/dist/{chunk-DYVCBK2C.js → chunk-PP75SWKY.js} +2 -2
- package/dist/{chunk-RK4QKTQ2.cjs → chunk-QILRLRA4.cjs} +5 -5
- package/dist/{chunk-RK4QKTQ2.cjs.map → chunk-QILRLRA4.cjs.map} +1 -1
- package/dist/{chunk-OZHZUMNR.js → chunk-TFQUMP2O.js} +2 -2
- package/dist/{chunk-WBHH3JEK.js → chunk-TLUM25FM.js} +8 -3
- package/dist/chunk-TLUM25FM.js.map +1 -0
- package/dist/{chunk-YY2AGHRV.cjs → chunk-UIDCBJXR.cjs} +7 -7
- package/dist/{chunk-YY2AGHRV.cjs.map → chunk-UIDCBJXR.cjs.map} +1 -1
- package/dist/{chunk-MN6K2YHF.js → chunk-WMB3YEQQ.js} +3 -3
- package/dist/{chunk-CM3GY62V.cjs → chunk-XD5RQKYL.cjs} +10 -5
- package/dist/chunk-XD5RQKYL.cjs.map +1 -0
- package/dist/{chunk-DIVRTJUA.js → chunk-XJQODPN6.js} +2 -2
- package/dist/cli/index.cjs +16 -16
- package/dist/cli/index.js +7 -7
- package/dist/cost/index.cjs +5 -5
- package/dist/cost/index.js +4 -4
- package/dist/index.cjs +9 -9
- package/dist/index.js +8 -8
- package/dist/models/index.cjs +6 -6
- package/dist/models/index.js +5 -5
- package/dist/profiles/index.cjs +2 -2
- package/dist/profiles/index.js +1 -1
- package/dist/sync/index.cjs +2 -2
- package/dist/sync/index.js +1 -1
- package/package.json +2 -2
- package/dist/chunk-4ILJWO64.js.map +0 -1
- package/dist/chunk-5IZ7PLY2.cjs.map +0 -1
- package/dist/chunk-CM3GY62V.cjs.map +0 -1
- package/dist/chunk-SYDW33AL.cjs.map +0 -1
- package/dist/chunk-WBHH3JEK.js.map +0 -1
- /package/dist/{chunk-WJFOQS6I.js.map → chunk-M35MNKDY.js.map} +0 -0
- /package/dist/{chunk-DYVCBK2C.js.map → chunk-PP75SWKY.js.map} +0 -0
- /package/dist/{chunk-OZHZUMNR.js.map → chunk-TFQUMP2O.js.map} +0 -0
- /package/dist/{chunk-MN6K2YHF.js.map → chunk-WMB3YEQQ.js.map} +0 -0
- /package/dist/{chunk-DIVRTJUA.js.map → chunk-XJQODPN6.js.map} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/ami/Documents/prometheus/x12i/ai-tools/dist/chunk-
|
|
1
|
+
{"version":3,"sources":["/Users/ami/Documents/prometheus/x12i/ai-tools/dist/chunk-QILRLRA4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chunk-QILRLRA4.cjs","sourcesContent":[null,"import type { AiModelRecord, ModelListFilters } from \"./types.js\";\n\nfunction matchesSearch(record: AiModelRecord, search: string): boolean {\n const q = search.toLowerCase();\n return (\n record.modelId.toLowerCase().includes(q) ||\n record.name.toLowerCase().includes(q) ||\n record.description.toLowerCase().includes(q) ||\n record.canonicalSlug.toLowerCase().includes(q) ||\n record.aliases.some((a) => a.toLowerCase().includes(q))\n );\n}\n\nexport function filterModels(\n models: Iterable<AiModelRecord>,\n filters: ModelListFilters = {},\n): AiModelRecord[] {\n let list = [...models];\n\n if (filters.providerId) {\n list = list.filter((m) => m.providerId === filters.providerId);\n }\n if (filters.status) {\n list = list.filter((m) => m.status === filters.status);\n }\n if (filters.outputModality) {\n list = list.filter((m) => m.outputModalities.includes(filters.outputModality!));\n }\n if (filters.inputModality) {\n list = list.filter((m) => m.inputModalities.includes(filters.inputModality!));\n }\n if (filters.supportedParameter) {\n list = list.filter((m) => m.supportedParameters.includes(filters.supportedParameter!));\n }\n if (filters.supportsTools !== undefined) {\n list = list.filter((m) => m.supportsTools === filters.supportsTools);\n }\n if (filters.supportsReasoning !== undefined) {\n list = list.filter((m) => m.supportsReasoning === filters.supportsReasoning);\n }\n if (filters.search) {\n list = list.filter((m) => matchesSearch(m, filters.search!));\n }\n\n list.sort((a, b) => a.name.localeCompare(b.name));\n\n const offset = filters.offset ?? 0;\n const limit = filters.limit ?? list.length;\n return list.slice(offset, offset + limit);\n}\n\nexport function countModels(\n models: Iterable<AiModelRecord>,\n filters: Omit<ModelListFilters, \"limit\" | \"offset\"> = {},\n): number {\n return filterModels(models, { ...filters, limit: Number.MAX_SAFE_INTEGER, offset: 0 }).length;\n}\n","import { AiModelsCatalogClient } from \"../catalog/AiModelsCatalogClient.js\";\nimport type { AiModelsCatalogClientOptions } from \"../catalog/AiModelsCatalogClient.js\";\nimport { countModels, filterModels } from \"./filterModels.js\";\nimport type { AiModelRecord, ModelListFilters, ModelListResult } from \"./types.js\";\nimport {\n resolveModelVendor,\n type ModelVendorRef,\n type ResolveModelVendorOptions,\n} from \"../cost/resolveModelVendor.js\";\n\nexport type AiModelsServiceOptions = AiModelsCatalogClientOptions;\n\n/**\n * High-level model catalog API — list, filter, count, and get full model info.\n */\nexport class AiModelsService {\n private readonly client: AiModelsCatalogClient;\n\n constructor(options: AiModelsServiceOptions = {}) {\n this.client = new AiModelsCatalogClient(options);\n }\n\n async getAllModels(): Promise<Map<string, AiModelRecord>> {\n return this.client.getAllModels();\n }\n\n async listModels(filters: ModelListFilters = {}): Promise<ModelListResult> {\n const all = await this.getAllModels();\n const total = countModels(all.values(), filters);\n const limit = filters.limit ?? 50;\n const offset = filters.offset ?? 0;\n const models = filterModels(all.values(), { ...filters, limit, offset });\n return { models, total, limit, offset };\n }\n\n async countModels(filters: Omit<ModelListFilters, \"limit\" | \"offset\"> = {}): Promise<number> {\n const all = await this.getAllModels();\n return countModels(all.values(), filters);\n }\n\n async getModelInfo(modelIdOrAlias: string, provider?: string): Promise<AiModelRecord | null> {\n return this.client.getModel(modelIdOrAlias, provider);\n }\n\n async resolve(\n modelIdOrAlias: string,\n provider?: string,\n ): Promise<import(\"../sync/modelNameResolver/types.js\").ModelResolutionResult> {\n return this.client.resolveModel({ model: modelIdOrAlias, provider });\n }\n\n async resolveVendor(\n model: string,\n options?: ResolveModelVendorOptions,\n ): Promise<ModelVendorRef | null> {\n return resolveModelVendor(model, this.client, options);\n }\n\n async refresh(): Promise<void> {\n await this.client.refresh();\n }\n}\n\nexport async function getModelInfo(\n modelIdOrAlias: string,\n options: AiModelsServiceOptions = {},\n provider?: string,\n): Promise<AiModelRecord | null> {\n return new AiModelsService(options).getModelInfo(modelIdOrAlias, provider);\n}\n"]}
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
matchModelInAiProfiles,
|
|
6
6
|
resolveFromCatalogAttempts,
|
|
7
7
|
resolveRoutedViaOpenRouter
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-TLUM25FM.js";
|
|
9
9
|
import {
|
|
10
10
|
normalizeString,
|
|
11
11
|
stripModelVersionSuffix
|
|
@@ -702,4 +702,4 @@ export {
|
|
|
702
702
|
resolveUsageModel,
|
|
703
703
|
CostCalculator
|
|
704
704
|
};
|
|
705
|
-
//# sourceMappingURL=chunk-
|
|
705
|
+
//# sourceMappingURL=chunk-TFQUMP2O.js.map
|
|
@@ -180,6 +180,9 @@ function pickBest(candidates, model, providerHint) {
|
|
|
180
180
|
}
|
|
181
181
|
return best;
|
|
182
182
|
}
|
|
183
|
+
function isLowConfidenceModelResolution(resolved) {
|
|
184
|
+
return resolved.resolutionKind === "model" && resolved.warnings?.some((w) => w.code === "MODEL_INPUT_FALLBACK_GUESS") === true;
|
|
185
|
+
}
|
|
183
186
|
function resolvedToMatch(resolved) {
|
|
184
187
|
const direct = resolved.invocation.direct;
|
|
185
188
|
const canonical = resolved.invocation.openrouter?.modelId ?? buildOpenRouterModelId(direct.provider, direct.modelId);
|
|
@@ -190,7 +193,7 @@ function resolvedToMatch(resolved) {
|
|
|
190
193
|
pricing: resolved.pricing,
|
|
191
194
|
instructionTier: resolved.instructionTier,
|
|
192
195
|
backend: resolved.backend,
|
|
193
|
-
matchedVia: resolved.shortcut ? "shortcut" : "profile",
|
|
196
|
+
matchedVia: resolved.resolutionKind === "model" ? "model-id" : resolved.shortcut ? "shortcut" : "profile",
|
|
194
197
|
profile: resolved.profile,
|
|
195
198
|
choice: resolved.choice
|
|
196
199
|
};
|
|
@@ -247,7 +250,9 @@ async function matchModelInAiProfiles(model, provider, options) {
|
|
|
247
250
|
const resolveOpts = profileResolveOptions(source);
|
|
248
251
|
try {
|
|
249
252
|
const resolved = await resolveAIProfile(model, resolveOpts);
|
|
250
|
-
|
|
253
|
+
if (!isLowConfidenceModelResolution(resolved)) {
|
|
254
|
+
return resolvedToMatch(resolved);
|
|
255
|
+
}
|
|
251
256
|
} catch (err) {
|
|
252
257
|
if (!(err instanceof AIProfilesError) || err.code !== "UNKNOWN_PROFILE") {
|
|
253
258
|
throw err;
|
|
@@ -277,4 +282,4 @@ export {
|
|
|
277
282
|
resolveRoutedViaOpenRouter,
|
|
278
283
|
matchModelInAiProfiles
|
|
279
284
|
};
|
|
280
|
-
//# sourceMappingURL=chunk-
|
|
285
|
+
//# sourceMappingURL=chunk-TLUM25FM.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/cost/costModelResolution.ts","../src/cost/aiProfilesMatch.ts"],"sourcesContent":["import type { AiModelsCatalogClient } from \"../catalog/AiModelsCatalogClient.js\";\nimport { LOCAL_PROVIDERS } from \"../sync/modelNameResolver/constants.js\";\nimport {\n loadOpenRouterRoutingEnv,\n shouldDefaultRouteViaOpenRouter,\n} from \"../sync/openRouterRoutingEnv.js\";\nimport { normalizeProvider, normalizeString } from \"../sync/modelNameResolver/normalize.js\";\nimport type {\n ModelResolutionInput,\n ModelResolutionResult,\n ModelResolverOptions,\n} from \"../sync/modelNameResolver/types.js\";\nimport type { OpenRouterRoutingConfig } from \"../sync/openRouterRoutingEnv.js\";\n\nexport function isOpenRouterProvider(provider?: string): boolean {\n return normalizeProvider(provider) === \"openrouter\";\n}\n\nexport function isLocalProvider(provider?: string): boolean {\n const p = normalizeProvider(provider) ?? normalizeString(provider ?? \"\");\n return LOCAL_PROVIDERS.has(p);\n}\n\n/** Catalog resolver returned success without a priced record (Ollama, LM Studio, …). */\nexport function isLocalProviderResolution(\n resolved: ModelResolutionResult | null,\n inputProvider?: string,\n): boolean {\n if (!resolved?.found || resolved.record) return false;\n if (resolved.resolvedVia.includes(\"local-provider-passthrough\")) return true;\n return isLocalProvider(inputProvider);\n}\n\n/**\n * Vendor id for a model slug (`openai/gpt-4o` → `openai`).\n * Ignores `openrouter` as a provider hint — it is a routing layer, not the model owner.\n */\nexport function underlyingProviderFromModel(\n model: string,\n providerHint?: string,\n): string | undefined {\n const normalized = normalizeString(model);\n if (normalized.includes(\"/\")) {\n const prefix = normalized.split(\"/\")[0]!;\n if (!isOpenRouterProvider(prefix)) return prefix;\n }\n if (providerHint && !isOpenRouterProvider(providerHint)) {\n return normalizeProvider(providerHint);\n }\n return undefined;\n}\n\n/** Provider hint for ai-profiles index lookup (openrouter → underlying vendor). */\nexport function providerHintForProfiles(\n model: string,\n provider?: string,\n): string | undefined {\n if (isOpenRouterProvider(provider)) {\n return underlyingProviderFromModel(model, provider);\n }\n return normalizeProvider(provider);\n}\n\n/**\n * Catalog resolve attempts for direct API and OpenRouter usage.\n * Tries the caller hint, inferred vendor, no hint, and openrouter routing.\n */\nexport function buildCatalogResolveAttempts(\n model: string,\n provider?: string,\n): ModelResolutionInput[] {\n const attempts: ModelResolutionInput[] = [];\n const seen = new Set<string>();\n const add = (m: string, p?: string) => {\n const key = `${p ?? \"\"}\\0${normalizeString(m)}`;\n if (seen.has(key)) return;\n seen.add(key);\n attempts.push({ model: m, provider: p });\n };\n\n add(model, provider);\n\n const underlying = underlyingProviderFromModel(model, provider);\n if (provider) add(model, undefined);\n if (underlying) add(model, underlying);\n if (!isOpenRouterProvider(provider)) {\n add(model, \"openrouter\");\n }\n\n return attempts;\n}\n\nexport async function resolveFromCatalogAttempts(\n catalog: AiModelsCatalogClient,\n attempts: ModelResolutionInput[],\n options?: ModelResolverOptions,\n): Promise<ModelResolutionResult | null> {\n let last: ModelResolutionResult | null = null;\n let localPassthrough: ModelResolutionResult | null = null;\n\n for (const attempt of attempts) {\n const result = await catalog.resolveModel(attempt, options);\n last = result;\n if (result.found && result.record) return result;\n if (\n result.found &&\n !result.record &&\n isLocalProviderResolution(result, attempt.provider)\n ) {\n localPassthrough = result;\n }\n }\n\n return localPassthrough ?? last;\n}\n\nexport function resolveRoutedViaOpenRouter(\n inputProvider: string | undefined,\n resolved: ModelResolutionResult | null,\n modelId?: string,\n routingEnv?: OpenRouterRoutingConfig,\n): boolean {\n const env = routingEnv ?? loadOpenRouterRoutingEnv();\n\n if (isOpenRouterProvider(inputProvider)) return true;\n\n if (resolved?.found) {\n return resolved.routedViaOpenRouter;\n }\n\n const vendor = underlyingProviderFromModel(\n modelId ?? (resolved?.found ? resolved.modelId : \"\") ?? \"\",\n inputProvider,\n );\n if (vendor && shouldDefaultRouteViaOpenRouter(vendor, env)) {\n return true;\n }\n\n return false;\n}\n","import {\n AIProfilesError,\n buildOpenRouterModelId,\n getChoiceOpenRouterModelId,\n getChoicePricing,\n getChoiceVendorModelId,\n loadAIProfilesRegistry,\n resolveAIProfile,\n} from \"@x12i/ai-profiles\";\nimport type {\n AIProfileBackend,\n AIProfileChoice,\n AIModelPricing,\n AIProfilesRegistry,\n InstructionTier,\n RegistrySourceMode,\n ResolvedAIProfile,\n} from \"@x12i/ai-profiles\";\nimport { providerHintForProfiles } from \"./costModelResolution.js\";\nimport { normalizeProvider, normalizeString } from \"../sync/modelNameResolver/normalize.js\";\nimport { stripModelVersionSuffix } from \"../sync/modelNameResolver/stripVersionSuffix.js\";\n\nexport type AiProfilesModelMatch = {\n provider: string;\n modelId: string;\n canonicalModelId: string;\n pricing?: AIModelPricing;\n instructionTier: InstructionTier;\n backend: AIProfileBackend;\n matchedVia: \"profile\" | \"shortcut\" | \"profile-alias\" | \"model-id\";\n profile?: string;\n choice?: string;\n};\n\nfunction profileKey(value: string): string {\n return value.trim().toLowerCase();\n}\n\nfunction canonicalModelId(provider: string, modelId: string): string {\n const normalized = normalizeString(modelId);\n if (normalized.includes(\"/\")) return normalized;\n return buildOpenRouterModelId(provider, normalized);\n}\n\ntype IndexedChoice = {\n provider: string;\n modelId: string;\n canonicalModelId: string;\n pricing?: AIModelPricing;\n profile: string;\n choice: string;\n};\n\nlet cachedIndex: {\n cacheKey: string;\n byKey: Map<string, IndexedChoice[]>;\n} | null = null;\n\nexport type MatchModelInAiProfilesOptions = {\n source?: RegistrySourceMode;\n};\n\n/** When set (tests), overrides default `auto` registry/catalog source. */\nlet registrySourceOverride: RegistrySourceMode | undefined;\n\nfunction registrySource(options?: MatchModelInAiProfilesOptions): RegistrySourceMode {\n return options?.source ?? registrySourceOverride ?? \"auto\";\n}\n\n/** ai-profiles returns a valid in-memory cache before honoring `source`; refresh on explicit sources. */\nfunction profileResolveOptions(source: RegistrySourceMode) {\n return source === \"auto\" ? { source } : { source, refresh: true as const };\n}\n\n/** Index bare model ids only — profile/shortcut names resolve via {@link resolveAIProfile}. */\nfunction indexRegistry(registry: AIProfilesRegistry): Map<string, IndexedChoice[]> {\n const byKey = new Map<string, IndexedChoice[]>();\n\n const add = (key: string, entry: IndexedChoice) => {\n const k = profileKey(key);\n if (!k) return;\n const list = byKey.get(k) ?? [];\n if (\n list.some(\n (e) =>\n e.canonicalModelId === entry.canonicalModelId &&\n e.choice === entry.choice &&\n e.profile === entry.profile,\n )\n ) {\n return;\n }\n list.push(entry);\n byKey.set(k, list);\n };\n\n for (const profile of Object.values(registry.profiles)) {\n for (const [choiceKey, choice] of Object.entries(profile.choices)) {\n const entry = choiceEntry(choice, profile.profile, choiceKey);\n add(getChoiceVendorModelId(choice), entry);\n add(canonicalModelId(choice.provider, getChoiceVendorModelId(choice)), entry);\n }\n }\n\n return byKey;\n}\n\nfunction choiceEntry(\n choice: AIProfileChoice,\n profile: string,\n choiceKey: string,\n): IndexedChoice {\n const vendorModelId = getChoiceVendorModelId(choice);\n const provider = normalizeProvider(choice.provider) ?? choice.provider;\n const canonical =\n getChoiceOpenRouterModelId(choice) ??\n canonicalModelId(choice.provider, vendorModelId);\n return {\n provider,\n modelId: normalizeString(vendorModelId),\n canonicalModelId: canonical,\n pricing: getChoicePricing(choice),\n profile,\n choice: choiceKey,\n };\n}\n\nasync function getProfileIndex(\n source: RegistrySourceMode,\n): Promise<Map<string, IndexedChoice[]>> {\n const registry = await loadAIProfilesRegistry(profileResolveOptions(source));\n const cacheKey = `${source}:${registry.version}:${registry.generatedAt ?? \"\"}:${registry.source}`;\n if (cachedIndex?.cacheKey === cacheKey) {\n return cachedIndex.byKey;\n }\n const byKey = indexRegistry(registry);\n cachedIndex = { cacheKey, byKey };\n return byKey;\n}\n\nfunction scoreCandidate(\n entry: IndexedChoice,\n model: string,\n providerHint?: string,\n): number {\n const normalized = normalizeString(model);\n let score = 0;\n\n if (normalized === entry.canonicalModelId) score += 100;\n if (normalized === entry.modelId) score += 80;\n if (providerHint && entry.provider === providerHint) score += 50;\n if (entry.pricing) score += 2;\n\n return score;\n}\n\nfunction pickBest(\n candidates: IndexedChoice[],\n model: string,\n providerHint?: string,\n): IndexedChoice | null {\n if (candidates.length === 0) return null;\n if (candidates.length === 1) return candidates[0]!;\n\n let best = candidates[0]!;\n let bestScore = scoreCandidate(best, model, providerHint);\n for (let i = 1; i < candidates.length; i++) {\n const c = candidates[i]!;\n const s = scoreCandidate(c, model, providerHint);\n if (s > bestScore) {\n best = c;\n bestScore = s;\n }\n }\n return best;\n}\n\nfunction isLowConfidenceModelResolution(resolved: ResolvedAIProfile): boolean {\n return (\n resolved.resolutionKind === \"model\" &&\n resolved.warnings?.some((w) => w.code === \"MODEL_INPUT_FALLBACK_GUESS\") === true\n );\n}\n\nfunction resolvedToMatch(resolved: ResolvedAIProfile): AiProfilesModelMatch {\n const direct = resolved.invocation.direct;\n const canonical =\n resolved.invocation.openrouter?.modelId ??\n buildOpenRouterModelId(direct.provider, direct.modelId);\n return {\n provider: normalizeProvider(direct.provider) ?? direct.provider,\n modelId: normalizeString(direct.modelId),\n canonicalModelId: canonical,\n pricing: resolved.pricing,\n instructionTier: resolved.instructionTier,\n backend: resolved.backend,\n matchedVia:\n resolved.resolutionKind === \"model\"\n ? \"model-id\"\n : resolved.shortcut\n ? \"shortcut\"\n : \"profile\",\n profile: resolved.profile,\n choice: resolved.choice,\n };\n}\n\nasync function fromIndexed(\n entry: IndexedChoice,\n source: RegistrySourceMode,\n): Promise<AiProfilesModelMatch> {\n const resolved = await resolveAIProfile(entry.profile, {\n choice: entry.choice,\n ...profileResolveOptions(source),\n });\n const direct = resolved.invocation.direct;\n return {\n provider: normalizeProvider(direct.provider) ?? direct.provider,\n modelId: normalizeString(direct.modelId),\n canonicalModelId:\n resolved.invocation.openrouter?.modelId ??\n buildOpenRouterModelId(direct.provider, direct.modelId),\n pricing: resolved.pricing ?? entry.pricing,\n instructionTier: resolved.instructionTier,\n backend: resolved.backend,\n matchedVia: \"model-id\",\n profile: resolved.profile,\n choice: resolved.choice,\n };\n}\n\nasync function lookupInIndex(\n index: Map<string, IndexedChoice[]>,\n model: string,\n source: RegistrySourceMode,\n provider?: string,\n): Promise<AiProfilesModelMatch | null> {\n const providerHint = provider ? normalizeProvider(provider) : undefined;\n const keys = [\n profileKey(model),\n profileKey(normalizeString(model)),\n ];\n if (providerHint) {\n keys.push(profileKey(canonicalModelId(providerHint, model)));\n }\n\n const pooled: IndexedChoice[] = [];\n for (const key of keys) {\n const hits = index.get(key);\n if (hits) pooled.push(...hits);\n }\n\n const bare = normalizeString(model);\n if (!bare.includes(\"/\")) {\n for (const list of index.values()) {\n for (const entry of list) {\n if (entry.modelId === bare) pooled.push(entry);\n }\n }\n }\n\n const unique = new Map<string, IndexedChoice>();\n for (const e of pooled) {\n unique.set(`${e.profile}:${e.choice}:${e.canonicalModelId}`, e);\n }\n\n const best = pickBest([...unique.values()], model, providerHint);\n return best ? fromIndexed(best, source) : null;\n}\n\n/**\n * Resolve a model string via @x12i/ai-profiles — profile/shortcut names, aliases,\n * or a concrete model id that appears on a profile choice.\n */\nexport async function matchModelInAiProfiles(\n model: string,\n provider?: string,\n options?: MatchModelInAiProfilesOptions,\n): Promise<AiProfilesModelMatch | null> {\n const source = registrySource(options);\n const resolveOpts = profileResolveOptions(source);\n\n try {\n const resolved = await resolveAIProfile(model, resolveOpts);\n if (!isLowConfidenceModelResolution(resolved)) {\n return resolvedToMatch(resolved);\n }\n } catch (err) {\n if (!(err instanceof AIProfilesError) || err.code !== \"UNKNOWN_PROFILE\") {\n throw err;\n }\n }\n\n const index = await getProfileIndex(source);\n const hint = providerHintForProfiles(model, provider);\n const direct = await lookupInIndex(index, model, source, hint);\n if (direct) return direct;\n\n const stripped = stripModelVersionSuffix(model);\n if (stripped && stripped !== normalizeString(model)) {\n return lookupInIndex(\n index,\n stripped,\n source,\n providerHintForProfiles(stripped, provider),\n );\n }\n\n return null;\n}\n\n/** @internal Test-only — reset module cache between tests. */\nexport function resetAiProfilesMatchCacheForTests(\n options?: { source?: RegistrySourceMode },\n): void {\n cachedIndex = null;\n registrySourceOverride = options?.source ?? \"bundled\";\n}\n"],"mappings":";;;;;;;;;;AAcO,SAAS,qBAAqB,UAA4B;AAC/D,SAAO,kBAAkB,QAAQ,MAAM;AACzC;AAEO,SAAS,gBAAgB,UAA4B;AAC1D,QAAM,IAAI,kBAAkB,QAAQ,KAAK,gBAAgB,YAAY,EAAE;AACvE,SAAO,gBAAgB,IAAI,CAAC;AAC9B;AAGO,SAAS,0BACd,UACA,eACS;AACT,MAAI,CAAC,UAAU,SAAS,SAAS,OAAQ,QAAO;AAChD,MAAI,SAAS,YAAY,SAAS,4BAA4B,EAAG,QAAO;AACxE,SAAO,gBAAgB,aAAa;AACtC;AAMO,SAAS,4BACd,OACA,cACoB;AACpB,QAAM,aAAa,gBAAgB,KAAK;AACxC,MAAI,WAAW,SAAS,GAAG,GAAG;AAC5B,UAAM,SAAS,WAAW,MAAM,GAAG,EAAE,CAAC;AACtC,QAAI,CAAC,qBAAqB,MAAM,EAAG,QAAO;AAAA,EAC5C;AACA,MAAI,gBAAgB,CAAC,qBAAqB,YAAY,GAAG;AACvD,WAAO,kBAAkB,YAAY;AAAA,EACvC;AACA,SAAO;AACT;AAGO,SAAS,wBACd,OACA,UACoB;AACpB,MAAI,qBAAqB,QAAQ,GAAG;AAClC,WAAO,4BAA4B,OAAO,QAAQ;AAAA,EACpD;AACA,SAAO,kBAAkB,QAAQ;AACnC;AAMO,SAAS,4BACd,OACA,UACwB;AACxB,QAAM,WAAmC,CAAC;AAC1C,QAAM,OAAO,oBAAI,IAAY;AAC7B,QAAM,MAAM,CAAC,GAAW,MAAe;AACrC,UAAM,MAAM,GAAG,KAAK,EAAE,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AAI,YAAY,aAAa,gBAAgB,KAAK,GAAG;AACnD,WAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MACA,wBAAwB,UAAU,QAAQ;AAAA,IAC5C;AAAA,EACF;AAEA,SAAO;AACT;","names":[]}
|
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunk33AAM7KQcjs = require('./chunk-33AAM7KQ.cjs');
|
|
7
7
|
|
|
8
8
|
// src/catalog/catalogMaintenance.ts
|
|
9
9
|
async function refreshAiModelsCatalog(options = {}) {
|
|
10
|
-
const client = new (0,
|
|
10
|
+
const client = new (0, _chunk33AAM7KQcjs.AiModelsCatalogClient)(options);
|
|
11
11
|
await client.refresh();
|
|
12
|
-
const loaded = await
|
|
12
|
+
const loaded = await _chunk33AAM7KQcjs.loadCatalogSourcesCached.call(void 0, options, {
|
|
13
13
|
cacheKey: options.cacheKey,
|
|
14
14
|
ttlMs: options.cacheTtlMs,
|
|
15
15
|
forceRefresh: false
|
|
@@ -23,7 +23,7 @@ async function refreshAiModelsCatalog(options = {}) {
|
|
|
23
23
|
};
|
|
24
24
|
}
|
|
25
25
|
async function verifyAiModelsCatalog(options = {}) {
|
|
26
|
-
const loaded = await
|
|
26
|
+
const loaded = await _chunk33AAM7KQcjs.loadCatalogSourcesCached.call(void 0, options, {
|
|
27
27
|
cacheKey: options.cacheKey,
|
|
28
28
|
ttlMs: options.cacheTtlMs,
|
|
29
29
|
forceRefresh: _nullishCoalesce(options.forceRefresh, () => ( options.bundledOnly === true))
|
|
@@ -34,8 +34,8 @@ async function verifyAiModelsCatalog(options = {}) {
|
|
|
34
34
|
openRouterCount: loaded.meta.openRouterCount,
|
|
35
35
|
directSource: loaded.meta.directSource,
|
|
36
36
|
openRouterSource: loaded.meta.openRouterSource,
|
|
37
|
-
directUrl: _nullishCoalesce(options.directCatalogUrl, () => (
|
|
38
|
-
openRouterUrl: _nullishCoalesce(options.openRouterCatalogUrl, () => (
|
|
37
|
+
directUrl: _nullishCoalesce(options.directCatalogUrl, () => ( _chunk33AAM7KQcjs.DEFAULT_DIRECT_CATALOG_URL)),
|
|
38
|
+
openRouterUrl: _nullishCoalesce(options.openRouterCatalogUrl, () => ( _chunk33AAM7KQcjs.DEFAULT_OPENROUTER_CATALOG_URL))
|
|
39
39
|
};
|
|
40
40
|
}
|
|
41
41
|
|
|
@@ -43,4 +43,4 @@ async function verifyAiModelsCatalog(options = {}) {
|
|
|
43
43
|
|
|
44
44
|
|
|
45
45
|
exports.refreshAiModelsCatalog = refreshAiModelsCatalog; exports.verifyAiModelsCatalog = verifyAiModelsCatalog;
|
|
46
|
-
//# sourceMappingURL=chunk-
|
|
46
|
+
//# sourceMappingURL=chunk-UIDCBJXR.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/ami/Documents/prometheus/x12i/ai-tools/dist/chunk-
|
|
1
|
+
{"version":3,"sources":["/Users/ami/Documents/prometheus/x12i/ai-tools/dist/chunk-UIDCBJXR.cjs","../src/catalog/catalogMaintenance.ts"],"names":[],"mappings":"AAAA;AACE;AACA;AACA;AACA;AACF,wDAA6B;AAC7B;AACA;ACeA,MAAA,SAAsB,sBAAA,CACpB,QAAA,EAAiC,CAAC,CAAA,EACH;AAC/B,EAAA,MAAM,OAAA,EAAS,IAAI,4CAAA,CAAsB,OAAO,CAAA;AAChD,EAAA,MAAM,MAAA,CAAO,OAAA,CAAQ,CAAA;AACrB,EAAA,MAAM,OAAA,EAAS,MAAM,wDAAA,OAAyB,EAAS;AAAA,IACrD,QAAA,EAAU,OAAA,CAAQ,QAAA;AAAA,IAClB,KAAA,EAAO,OAAA,CAAQ,UAAA;AAAA,IACf,YAAA,EAAc;AAAA,EAChB,CAAC,CAAA;AACD,EAAA,OAAO;AAAA,IACL,EAAA,EAAI,IAAA;AAAA,IACJ,WAAA,EAAa,MAAA,CAAO,IAAA,CAAK,WAAA;AAAA,IACzB,eAAA,EAAiB,MAAA,CAAO,IAAA,CAAK,eAAA;AAAA,IAC7B,YAAA,EAAc,MAAA,CAAO,IAAA,CAAK,YAAA;AAAA,IAC1B,gBAAA,EAAkB,MAAA,CAAO,IAAA,CAAK;AAAA,EAChC,CAAA;AACF;AAkBA,MAAA,SAAsB,qBAAA,CACpB,QAAA,EAA6D,CAAC,CAAA,EAChC;AAC9B,EAAA,MAAM,OAAA,EAAS,MAAM,wDAAA,OAAyB,EAAS;AAAA,IACrD,QAAA,EAAU,OAAA,CAAQ,QAAA;AAAA,IAClB,KAAA,EAAO,OAAA,CAAQ,UAAA;AAAA,IACf,YAAA,mBAAc,OAAA,CAAQ,YAAA,UAAgB,OAAA,CAAQ,YAAA,IAAgB;AAAA,EAChE,CAAC,CAAA;AACD,EAAA,OAAO;AAAA,IACL,EAAA,EAAI,MAAA,CAAO,MAAA,CAAO,KAAA,EAAO,EAAA,GAAK,MAAA,CAAO,UAAA,CAAW,KAAA,EAAO,CAAA;AAAA,IACvD,WAAA,EAAa,MAAA,CAAO,IAAA,CAAK,WAAA;AAAA,IACzB,eAAA,EAAiB,MAAA,CAAO,IAAA,CAAK,eAAA;AAAA,IAC7B,YAAA,EAAc,MAAA,CAAO,IAAA,CAAK,YAAA;AAAA,IAC1B,gBAAA,EAAkB,MAAA,CAAO,IAAA,CAAK,gBAAA;AAAA,IAC9B,SAAA,mBAAW,OAAA,CAAQ,gBAAA,UAAoB,8CAAA;AAAA,IACvC,aAAA,mBAAe,OAAA,CAAQ,oBAAA,UAAwB;AAAA,EACjD,CAAA;AACF;ADlCA;AACA;AACE;AACA;AACF,+GAAC","file":"/Users/ami/Documents/prometheus/x12i/ai-tools/dist/chunk-UIDCBJXR.cjs","sourcesContent":[null,"import {\n DEFAULT_DIRECT_CATALOG_URL,\n DEFAULT_OPENROUTER_CATALOG_URL,\n type LoadCatalogOptions,\n} from \"./loadCatalogSources.js\";\nimport { loadCatalogSourcesCached } from \"./catalogLoadCache.js\";\nimport { AiModelsCatalogClient } from \"./AiModelsCatalogClient.js\";\n\nexport type CatalogRefreshOptions = LoadCatalogOptions & {\n cacheKey?: string;\n cacheTtlMs?: number;\n};\n\nexport type CatalogRefreshResult = {\n ok: true;\n directCount: number;\n openRouterCount: number;\n directSource: \"remote\" | \"bundled\";\n openRouterSource: \"remote\" | \"bundled\";\n};\n\n/** Fetch remote catalogs and warm the in-memory cache (forces a network load). */\nexport async function refreshAiModelsCatalog(\n options: CatalogRefreshOptions = {},\n): Promise<CatalogRefreshResult> {\n const client = new AiModelsCatalogClient(options);\n await client.refresh();\n const loaded = await loadCatalogSourcesCached(options, {\n cacheKey: options.cacheKey,\n ttlMs: options.cacheTtlMs,\n forceRefresh: false,\n });\n return {\n ok: true,\n directCount: loaded.meta.directCount,\n openRouterCount: loaded.meta.openRouterCount,\n directSource: loaded.meta.directSource,\n openRouterSource: loaded.meta.openRouterSource,\n };\n}\n\nexport type CatalogVerifyOptions = LoadCatalogOptions & {\n cacheKey?: string;\n cacheTtlMs?: number;\n};\n\nexport type CatalogVerifyReport = {\n ok: boolean;\n directCount: number;\n openRouterCount: number;\n directSource: \"remote\" | \"bundled\";\n openRouterSource: \"remote\" | \"bundled\";\n directUrl: string;\n openRouterUrl: string;\n};\n\n/** Load and validate both catalogs (uses cache unless `forceRefresh`). */\nexport async function verifyAiModelsCatalog(\n options: CatalogVerifyOptions & { forceRefresh?: boolean } = {},\n): Promise<CatalogVerifyReport> {\n const loaded = await loadCatalogSourcesCached(options, {\n cacheKey: options.cacheKey,\n ttlMs: options.cacheTtlMs,\n forceRefresh: options.forceRefresh ?? options.bundledOnly === true,\n });\n return {\n ok: loaded.direct.size > 0 && loaded.openrouter.size > 0,\n directCount: loaded.meta.directCount,\n openRouterCount: loaded.meta.openRouterCount,\n directSource: loaded.meta.directSource,\n openRouterSource: loaded.meta.openRouterSource,\n directUrl: options.directCatalogUrl ?? DEFAULT_DIRECT_CATALOG_URL,\n openRouterUrl: options.openRouterCatalogUrl ?? DEFAULT_OPENROUTER_CATALOG_URL,\n };\n}\n"]}
|
|
@@ -3,12 +3,12 @@ import {
|
|
|
3
3
|
modelVendorRefFromVendorAndSlug,
|
|
4
4
|
resolveModelVendorFromResolution,
|
|
5
5
|
resolveModelVendorLastResort
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-3CUSLNEV.js";
|
|
7
7
|
import {
|
|
8
8
|
buildCatalogResolveAttempts,
|
|
9
9
|
matchModelInAiProfiles,
|
|
10
10
|
resolveFromCatalogAttempts
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-TLUM25FM.js";
|
|
12
12
|
|
|
13
13
|
// src/cost/resolveModelVendor.ts
|
|
14
14
|
async function resolveModelVendor(model, catalog, options) {
|
|
@@ -38,4 +38,4 @@ async function resolveModelVendor(model, catalog, options) {
|
|
|
38
38
|
export {
|
|
39
39
|
resolveModelVendor
|
|
40
40
|
};
|
|
41
|
-
//# sourceMappingURL=chunk-
|
|
41
|
+
//# sourceMappingURL=chunk-WMB3YEQQ.js.map
|
|
@@ -180,9 +180,12 @@ function pickBest(candidates, model, providerHint) {
|
|
|
180
180
|
}
|
|
181
181
|
return best;
|
|
182
182
|
}
|
|
183
|
+
function isLowConfidenceModelResolution(resolved) {
|
|
184
|
+
return resolved.resolutionKind === "model" && _optionalChain([resolved, 'access', _6 => _6.warnings, 'optionalAccess', _7 => _7.some, 'call', _8 => _8((w) => w.code === "MODEL_INPUT_FALLBACK_GUESS")]) === true;
|
|
185
|
+
}
|
|
183
186
|
function resolvedToMatch(resolved) {
|
|
184
187
|
const direct = resolved.invocation.direct;
|
|
185
|
-
const canonical = _nullishCoalesce(_optionalChain([resolved, 'access',
|
|
188
|
+
const canonical = _nullishCoalesce(_optionalChain([resolved, 'access', _9 => _9.invocation, 'access', _10 => _10.openrouter, 'optionalAccess', _11 => _11.modelId]), () => ( _aiprofiles.buildOpenRouterModelId.call(void 0, direct.provider, direct.modelId)));
|
|
186
189
|
return {
|
|
187
190
|
provider: _nullishCoalesce(_chunkOZE336BLcjs.normalizeProvider.call(void 0, direct.provider), () => ( direct.provider)),
|
|
188
191
|
modelId: _chunkOZE336BLcjs.normalizeString.call(void 0, direct.modelId),
|
|
@@ -190,7 +193,7 @@ function resolvedToMatch(resolved) {
|
|
|
190
193
|
pricing: resolved.pricing,
|
|
191
194
|
instructionTier: resolved.instructionTier,
|
|
192
195
|
backend: resolved.backend,
|
|
193
|
-
matchedVia: resolved.shortcut ? "shortcut" : "profile",
|
|
196
|
+
matchedVia: resolved.resolutionKind === "model" ? "model-id" : resolved.shortcut ? "shortcut" : "profile",
|
|
194
197
|
profile: resolved.profile,
|
|
195
198
|
choice: resolved.choice
|
|
196
199
|
};
|
|
@@ -204,7 +207,7 @@ async function fromIndexed(entry, source) {
|
|
|
204
207
|
return {
|
|
205
208
|
provider: _nullishCoalesce(_chunkOZE336BLcjs.normalizeProvider.call(void 0, direct.provider), () => ( direct.provider)),
|
|
206
209
|
modelId: _chunkOZE336BLcjs.normalizeString.call(void 0, direct.modelId),
|
|
207
|
-
canonicalModelId: _nullishCoalesce(_optionalChain([resolved, 'access',
|
|
210
|
+
canonicalModelId: _nullishCoalesce(_optionalChain([resolved, 'access', _12 => _12.invocation, 'access', _13 => _13.openrouter, 'optionalAccess', _14 => _14.modelId]), () => ( _aiprofiles.buildOpenRouterModelId.call(void 0, direct.provider, direct.modelId))),
|
|
208
211
|
pricing: _nullishCoalesce(resolved.pricing, () => ( entry.pricing)),
|
|
209
212
|
instructionTier: resolved.instructionTier,
|
|
210
213
|
backend: resolved.backend,
|
|
@@ -247,7 +250,9 @@ async function matchModelInAiProfiles(model, provider, options) {
|
|
|
247
250
|
const resolveOpts = profileResolveOptions(source);
|
|
248
251
|
try {
|
|
249
252
|
const resolved = await _aiprofiles.resolveAIProfile.call(void 0, model, resolveOpts);
|
|
250
|
-
|
|
253
|
+
if (!isLowConfidenceModelResolution(resolved)) {
|
|
254
|
+
return resolvedToMatch(resolved);
|
|
255
|
+
}
|
|
251
256
|
} catch (err) {
|
|
252
257
|
if (!(err instanceof _aiprofiles.AIProfilesError) || err.code !== "UNKNOWN_PROFILE") {
|
|
253
258
|
throw err;
|
|
@@ -277,4 +282,4 @@ async function matchModelInAiProfiles(model, provider, options) {
|
|
|
277
282
|
|
|
278
283
|
|
|
279
284
|
exports.isLocalProvider = isLocalProvider; exports.isLocalProviderResolution = isLocalProviderResolution; exports.buildCatalogResolveAttempts = buildCatalogResolveAttempts; exports.resolveFromCatalogAttempts = resolveFromCatalogAttempts; exports.resolveRoutedViaOpenRouter = resolveRoutedViaOpenRouter; exports.matchModelInAiProfiles = matchModelInAiProfiles;
|
|
280
|
-
//# sourceMappingURL=chunk-
|
|
285
|
+
//# sourceMappingURL=chunk-XD5RQKYL.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/ami/Documents/prometheus/x12i/ai-tools/dist/chunk-XD5RQKYL.cjs","../src/cost/costModelResolution.ts","../src/cost/aiProfilesMatch.ts"],"names":[],"mappings":"AAAA;AACE;AACA;AACA;AACA;AACA;AACA;AACF,wDAA6B;AAC7B;AACA;ACKO,SAAS,oBAAA,CAAqB,QAAA,EAA4B;AAC/D,EAAA,OAAO,iDAAA,QAA0B,EAAA,IAAM,YAAA;AACzC;AAEO,SAAS,eAAA,CAAgB,QAAA,EAA4B;AAC1D,EAAA,MAAM,EAAA,mBAAI,iDAAA,QAA0B,CAAA,UAAK,+CAAA,iBAAgB,QAAA,UAAY,IAAE,GAAA;AACvE,EAAA,OAAO,iCAAA,CAAgB,GAAA,CAAI,CAAC,CAAA;AAC9B;AAGO,SAAS,yBAAA,CACd,QAAA,EACA,aAAA,EACS;AACT,EAAA,GAAA,CAAI,iBAAC,QAAA,2BAAU,QAAA,GAAS,QAAA,CAAS,MAAA,EAAQ,OAAO,KAAA;AAChD,EAAA,GAAA,CAAI,QAAA,CAAS,WAAA,CAAY,QAAA,CAAS,4BAA4B,CAAA,EAAG,OAAO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AACS,IAAA;AACT,IAAA;AACS,IAAA;AAEP,IAAA;AAKO,IAAA;AACD,IAAA;AACV,EAAA;AACF;AAEe;AAIP,EAAA;AACI,IAAA;AACL,IAAA;AACJ,EAAA;AACc,EAAA;AACR,EAAA;AACK,IAAA;AACD,IAAA;AACT,IAAA;AAGS,IAAA;AACT,IAAA;AACS,IAAA;AACG,IAAA;AACH,IAAA;AACD,IAAA;AACV,EAAA;AACF;AAEe;AAMP,EAAA;AACO,EAAA;AACA,IAAA;AACA,IAAA;AACb,EAAA;AACI,EAAA;AACQ,IAAA;AACZ,EAAA;AAEgC,EAAA;AACrB,EAAA;AACI,IAAA;AACH,IAAA;AACZ,EAAA;AAEa,EAAA;AACH,EAAA;AACG,IAAA;AACE,MAAA;AACL,QAAA;AACN,MAAA;AACF,IAAA;AACF,EAAA;AAEe,EAAA;AACJ,EAAA;AACE,IAAA;AACb,EAAA;AAEa,EAAA;AACC,EAAA;AAChB;AAMsB;AAKL,EAAA;AACT,EAAA;AAEF,EAAA;AACI,IAAA;AACD,IAAA;AACI,MAAA;AACT,IAAA;AACY,EAAA;AACN,IAAA;AACE,MAAA;AACR,IAAA;AACF,EAAA;AAEc,EAAA;AACD,EAAA;AACE,EAAA;AACH,EAAA;AAEN,EAAA;AACF,EAAA;AACK,IAAA;AACL,MAAA;AACA,MAAA;AACA,MAAA;AACA,MAAA;AACF,IAAA;AACF,EAAA;AAEO,EAAA;AACT;AFlCiB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"/Users/ami/Documents/prometheus/x12i/ai-tools/dist/chunk-XD5RQKYL.cjs","sourcesContent":[null,"import type { AiModelsCatalogClient } from \"../catalog/AiModelsCatalogClient.js\";\nimport { LOCAL_PROVIDERS } from \"../sync/modelNameResolver/constants.js\";\nimport {\n loadOpenRouterRoutingEnv,\n shouldDefaultRouteViaOpenRouter,\n} from \"../sync/openRouterRoutingEnv.js\";\nimport { normalizeProvider, normalizeString } from \"../sync/modelNameResolver/normalize.js\";\nimport type {\n ModelResolutionInput,\n ModelResolutionResult,\n ModelResolverOptions,\n} from \"../sync/modelNameResolver/types.js\";\nimport type { OpenRouterRoutingConfig } from \"../sync/openRouterRoutingEnv.js\";\n\nexport function isOpenRouterProvider(provider?: string): boolean {\n return normalizeProvider(provider) === \"openrouter\";\n}\n\nexport function isLocalProvider(provider?: string): boolean {\n const p = normalizeProvider(provider) ?? normalizeString(provider ?? \"\");\n return LOCAL_PROVIDERS.has(p);\n}\n\n/** Catalog resolver returned success without a priced record (Ollama, LM Studio, …). */\nexport function isLocalProviderResolution(\n resolved: ModelResolutionResult | null,\n inputProvider?: string,\n): boolean {\n if (!resolved?.found || resolved.record) return false;\n if (resolved.resolvedVia.includes(\"local-provider-passthrough\")) return true;\n return isLocalProvider(inputProvider);\n}\n\n/**\n * Vendor id for a model slug (`openai/gpt-4o` → `openai`).\n * Ignores `openrouter` as a provider hint — it is a routing layer, not the model owner.\n */\nexport function underlyingProviderFromModel(\n model: string,\n providerHint?: string,\n): string | undefined {\n const normalized = normalizeString(model);\n if (normalized.includes(\"/\")) {\n const prefix = normalized.split(\"/\")[0]!;\n if (!isOpenRouterProvider(prefix)) return prefix;\n }\n if (providerHint && !isOpenRouterProvider(providerHint)) {\n return normalizeProvider(providerHint);\n }\n return undefined;\n}\n\n/** Provider hint for ai-profiles index lookup (openrouter → underlying vendor). */\nexport function providerHintForProfiles(\n model: string,\n provider?: string,\n): string | undefined {\n if (isOpenRouterProvider(provider)) {\n return underlyingProviderFromModel(model, provider);\n }\n return normalizeProvider(provider);\n}\n\n/**\n * Catalog resolve attempts for direct API and OpenRouter usage.\n * Tries the caller hint, inferred vendor, no hint, and openrouter routing.\n */\nexport function buildCatalogResolveAttempts(\n model: string,\n provider?: string,\n): ModelResolutionInput[] {\n const attempts: ModelResolutionInput[] = [];\n const seen = new Set<string>();\n const add = (m: string, p?: string) => {\n const key = `${p ?? \"\"}\\0${normalizeString(m)}`;\n if (seen.has(key)) return;\n seen.add(key);\n attempts.push({ model: m, provider: p });\n };\n\n add(model, provider);\n\n const underlying = underlyingProviderFromModel(model, provider);\n if (provider) add(model, undefined);\n if (underlying) add(model, underlying);\n if (!isOpenRouterProvider(provider)) {\n add(model, \"openrouter\");\n }\n\n return attempts;\n}\n\nexport async function resolveFromCatalogAttempts(\n catalog: AiModelsCatalogClient,\n attempts: ModelResolutionInput[],\n options?: ModelResolverOptions,\n): Promise<ModelResolutionResult | null> {\n let last: ModelResolutionResult | null = null;\n let localPassthrough: ModelResolutionResult | null = null;\n\n for (const attempt of attempts) {\n const result = await catalog.resolveModel(attempt, options);\n last = result;\n if (result.found && result.record) return result;\n if (\n result.found &&\n !result.record &&\n isLocalProviderResolution(result, attempt.provider)\n ) {\n localPassthrough = result;\n }\n }\n\n return localPassthrough ?? last;\n}\n\nexport function resolveRoutedViaOpenRouter(\n inputProvider: string | undefined,\n resolved: ModelResolutionResult | null,\n modelId?: string,\n routingEnv?: OpenRouterRoutingConfig,\n): boolean {\n const env = routingEnv ?? loadOpenRouterRoutingEnv();\n\n if (isOpenRouterProvider(inputProvider)) return true;\n\n if (resolved?.found) {\n return resolved.routedViaOpenRouter;\n }\n\n const vendor = underlyingProviderFromModel(\n modelId ?? (resolved?.found ? resolved.modelId : \"\") ?? \"\",\n inputProvider,\n );\n if (vendor && shouldDefaultRouteViaOpenRouter(vendor, env)) {\n return true;\n }\n\n return false;\n}\n","import {\n AIProfilesError,\n buildOpenRouterModelId,\n getChoiceOpenRouterModelId,\n getChoicePricing,\n getChoiceVendorModelId,\n loadAIProfilesRegistry,\n resolveAIProfile,\n} from \"@x12i/ai-profiles\";\nimport type {\n AIProfileBackend,\n AIProfileChoice,\n AIModelPricing,\n AIProfilesRegistry,\n InstructionTier,\n RegistrySourceMode,\n ResolvedAIProfile,\n} from \"@x12i/ai-profiles\";\nimport { providerHintForProfiles } from \"./costModelResolution.js\";\nimport { normalizeProvider, normalizeString } from \"../sync/modelNameResolver/normalize.js\";\nimport { stripModelVersionSuffix } from \"../sync/modelNameResolver/stripVersionSuffix.js\";\n\nexport type AiProfilesModelMatch = {\n provider: string;\n modelId: string;\n canonicalModelId: string;\n pricing?: AIModelPricing;\n instructionTier: InstructionTier;\n backend: AIProfileBackend;\n matchedVia: \"profile\" | \"shortcut\" | \"profile-alias\" | \"model-id\";\n profile?: string;\n choice?: string;\n};\n\nfunction profileKey(value: string): string {\n return value.trim().toLowerCase();\n}\n\nfunction canonicalModelId(provider: string, modelId: string): string {\n const normalized = normalizeString(modelId);\n if (normalized.includes(\"/\")) return normalized;\n return buildOpenRouterModelId(provider, normalized);\n}\n\ntype IndexedChoice = {\n provider: string;\n modelId: string;\n canonicalModelId: string;\n pricing?: AIModelPricing;\n profile: string;\n choice: string;\n};\n\nlet cachedIndex: {\n cacheKey: string;\n byKey: Map<string, IndexedChoice[]>;\n} | null = null;\n\nexport type MatchModelInAiProfilesOptions = {\n source?: RegistrySourceMode;\n};\n\n/** When set (tests), overrides default `auto` registry/catalog source. */\nlet registrySourceOverride: RegistrySourceMode | undefined;\n\nfunction registrySource(options?: MatchModelInAiProfilesOptions): RegistrySourceMode {\n return options?.source ?? registrySourceOverride ?? \"auto\";\n}\n\n/** ai-profiles returns a valid in-memory cache before honoring `source`; refresh on explicit sources. */\nfunction profileResolveOptions(source: RegistrySourceMode) {\n return source === \"auto\" ? { source } : { source, refresh: true as const };\n}\n\n/** Index bare model ids only — profile/shortcut names resolve via {@link resolveAIProfile}. */\nfunction indexRegistry(registry: AIProfilesRegistry): Map<string, IndexedChoice[]> {\n const byKey = new Map<string, IndexedChoice[]>();\n\n const add = (key: string, entry: IndexedChoice) => {\n const k = profileKey(key);\n if (!k) return;\n const list = byKey.get(k) ?? [];\n if (\n list.some(\n (e) =>\n e.canonicalModelId === entry.canonicalModelId &&\n e.choice === entry.choice &&\n e.profile === entry.profile,\n )\n ) {\n return;\n }\n list.push(entry);\n byKey.set(k, list);\n };\n\n for (const profile of Object.values(registry.profiles)) {\n for (const [choiceKey, choice] of Object.entries(profile.choices)) {\n const entry = choiceEntry(choice, profile.profile, choiceKey);\n add(getChoiceVendorModelId(choice), entry);\n add(canonicalModelId(choice.provider, getChoiceVendorModelId(choice)), entry);\n }\n }\n\n return byKey;\n}\n\nfunction choiceEntry(\n choice: AIProfileChoice,\n profile: string,\n choiceKey: string,\n): IndexedChoice {\n const vendorModelId = getChoiceVendorModelId(choice);\n const provider = normalizeProvider(choice.provider) ?? choice.provider;\n const canonical =\n getChoiceOpenRouterModelId(choice) ??\n canonicalModelId(choice.provider, vendorModelId);\n return {\n provider,\n modelId: normalizeString(vendorModelId),\n canonicalModelId: canonical,\n pricing: getChoicePricing(choice),\n profile,\n choice: choiceKey,\n };\n}\n\nasync function getProfileIndex(\n source: RegistrySourceMode,\n): Promise<Map<string, IndexedChoice[]>> {\n const registry = await loadAIProfilesRegistry(profileResolveOptions(source));\n const cacheKey = `${source}:${registry.version}:${registry.generatedAt ?? \"\"}:${registry.source}`;\n if (cachedIndex?.cacheKey === cacheKey) {\n return cachedIndex.byKey;\n }\n const byKey = indexRegistry(registry);\n cachedIndex = { cacheKey, byKey };\n return byKey;\n}\n\nfunction scoreCandidate(\n entry: IndexedChoice,\n model: string,\n providerHint?: string,\n): number {\n const normalized = normalizeString(model);\n let score = 0;\n\n if (normalized === entry.canonicalModelId) score += 100;\n if (normalized === entry.modelId) score += 80;\n if (providerHint && entry.provider === providerHint) score += 50;\n if (entry.pricing) score += 2;\n\n return score;\n}\n\nfunction pickBest(\n candidates: IndexedChoice[],\n model: string,\n providerHint?: string,\n): IndexedChoice | null {\n if (candidates.length === 0) return null;\n if (candidates.length === 1) return candidates[0]!;\n\n let best = candidates[0]!;\n let bestScore = scoreCandidate(best, model, providerHint);\n for (let i = 1; i < candidates.length; i++) {\n const c = candidates[i]!;\n const s = scoreCandidate(c, model, providerHint);\n if (s > bestScore) {\n best = c;\n bestScore = s;\n }\n }\n return best;\n}\n\nfunction isLowConfidenceModelResolution(resolved: ResolvedAIProfile): boolean {\n return (\n resolved.resolutionKind === \"model\" &&\n resolved.warnings?.some((w) => w.code === \"MODEL_INPUT_FALLBACK_GUESS\") === true\n );\n}\n\nfunction resolvedToMatch(resolved: ResolvedAIProfile): AiProfilesModelMatch {\n const direct = resolved.invocation.direct;\n const canonical =\n resolved.invocation.openrouter?.modelId ??\n buildOpenRouterModelId(direct.provider, direct.modelId);\n return {\n provider: normalizeProvider(direct.provider) ?? direct.provider,\n modelId: normalizeString(direct.modelId),\n canonicalModelId: canonical,\n pricing: resolved.pricing,\n instructionTier: resolved.instructionTier,\n backend: resolved.backend,\n matchedVia:\n resolved.resolutionKind === \"model\"\n ? \"model-id\"\n : resolved.shortcut\n ? \"shortcut\"\n : \"profile\",\n profile: resolved.profile,\n choice: resolved.choice,\n };\n}\n\nasync function fromIndexed(\n entry: IndexedChoice,\n source: RegistrySourceMode,\n): Promise<AiProfilesModelMatch> {\n const resolved = await resolveAIProfile(entry.profile, {\n choice: entry.choice,\n ...profileResolveOptions(source),\n });\n const direct = resolved.invocation.direct;\n return {\n provider: normalizeProvider(direct.provider) ?? direct.provider,\n modelId: normalizeString(direct.modelId),\n canonicalModelId:\n resolved.invocation.openrouter?.modelId ??\n buildOpenRouterModelId(direct.provider, direct.modelId),\n pricing: resolved.pricing ?? entry.pricing,\n instructionTier: resolved.instructionTier,\n backend: resolved.backend,\n matchedVia: \"model-id\",\n profile: resolved.profile,\n choice: resolved.choice,\n };\n}\n\nasync function lookupInIndex(\n index: Map<string, IndexedChoice[]>,\n model: string,\n source: RegistrySourceMode,\n provider?: string,\n): Promise<AiProfilesModelMatch | null> {\n const providerHint = provider ? normalizeProvider(provider) : undefined;\n const keys = [\n profileKey(model),\n profileKey(normalizeString(model)),\n ];\n if (providerHint) {\n keys.push(profileKey(canonicalModelId(providerHint, model)));\n }\n\n const pooled: IndexedChoice[] = [];\n for (const key of keys) {\n const hits = index.get(key);\n if (hits) pooled.push(...hits);\n }\n\n const bare = normalizeString(model);\n if (!bare.includes(\"/\")) {\n for (const list of index.values()) {\n for (const entry of list) {\n if (entry.modelId === bare) pooled.push(entry);\n }\n }\n }\n\n const unique = new Map<string, IndexedChoice>();\n for (const e of pooled) {\n unique.set(`${e.profile}:${e.choice}:${e.canonicalModelId}`, e);\n }\n\n const best = pickBest([...unique.values()], model, providerHint);\n return best ? fromIndexed(best, source) : null;\n}\n\n/**\n * Resolve a model string via @x12i/ai-profiles — profile/shortcut names, aliases,\n * or a concrete model id that appears on a profile choice.\n */\nexport async function matchModelInAiProfiles(\n model: string,\n provider?: string,\n options?: MatchModelInAiProfilesOptions,\n): Promise<AiProfilesModelMatch | null> {\n const source = registrySource(options);\n const resolveOpts = profileResolveOptions(source);\n\n try {\n const resolved = await resolveAIProfile(model, resolveOpts);\n if (!isLowConfidenceModelResolution(resolved)) {\n return resolvedToMatch(resolved);\n }\n } catch (err) {\n if (!(err instanceof AIProfilesError) || err.code !== \"UNKNOWN_PROFILE\") {\n throw err;\n }\n }\n\n const index = await getProfileIndex(source);\n const hint = providerHintForProfiles(model, provider);\n const direct = await lookupInIndex(index, model, source, hint);\n if (direct) return direct;\n\n const stripped = stripModelVersionSuffix(model);\n if (stripped && stripped !== normalizeString(model)) {\n return lookupInIndex(\n index,\n stripped,\n source,\n providerHintForProfiles(stripped, provider),\n );\n }\n\n return null;\n}\n\n/** @internal Test-only — reset module cache between tests. */\nexport function resetAiProfilesMatchCacheForTests(\n options?: { source?: RegistrySourceMode },\n): void {\n cachedIndex = null;\n registrySourceOverride = options?.source ?? \"bundled\";\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
matchModelInAiProfiles
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-TLUM25FM.js";
|
|
4
4
|
import {
|
|
5
5
|
computeSupportsReasoning
|
|
6
6
|
} from "./chunk-SQ6NOF4Z.js";
|
|
@@ -2094,4 +2094,4 @@ export {
|
|
|
2094
2094
|
loadCatalogSourcesCached,
|
|
2095
2095
|
AiModelsCatalogClient
|
|
2096
2096
|
};
|
|
2097
|
-
//# sourceMappingURL=chunk-
|
|
2097
|
+
//# sourceMappingURL=chunk-XJQODPN6.js.map
|
package/dist/cli/index.cjs
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
"use strict"; function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _chunkGHRUS5UFcjs = require('../chunk-GHRUS5UF.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
var _chunkBAHBDADJcjs = require('../chunk-BAHBDADJ.cjs');
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
var
|
|
12
|
-
require('../chunk-
|
|
13
|
-
require('../chunk-
|
|
11
|
+
var _chunkQILRLRA4cjs = require('../chunk-QILRLRA4.cjs');
|
|
12
|
+
require('../chunk-FWPH5YE6.cjs');
|
|
13
|
+
require('../chunk-EDZOFPLV.cjs');
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
|
|
17
|
-
var
|
|
17
|
+
var _chunkUIDCBJXRcjs = require('../chunk-UIDCBJXR.cjs');
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
|
|
21
|
-
var
|
|
22
|
-
require('../chunk-
|
|
21
|
+
var _chunk33AAM7KQcjs = require('../chunk-33AAM7KQ.cjs');
|
|
22
|
+
require('../chunk-XD5RQKYL.cjs');
|
|
23
23
|
require('../chunk-2KPWVOOT.cjs');
|
|
24
24
|
require('../chunk-OZE336BL.cjs');
|
|
25
25
|
require('../chunk-PADNCGZB.cjs');
|
|
@@ -38,8 +38,8 @@ function registry(path) {
|
|
|
38
38
|
function resolver(path) {
|
|
39
39
|
return new (0, _chunkBAHBDADJcjs.AliasResolver)({
|
|
40
40
|
registry: registry(path),
|
|
41
|
-
catalogClient: new (0,
|
|
42
|
-
cacheTtlMs:
|
|
41
|
+
catalogClient: new (0, _chunk33AAM7KQcjs.AiModelsCatalogClient)({
|
|
42
|
+
cacheTtlMs: _chunk33AAM7KQcjs.resolveCatalogCacheTtlMs.call(void 0, )
|
|
43
43
|
})
|
|
44
44
|
});
|
|
45
45
|
}
|
|
@@ -164,7 +164,7 @@ function emitHuman(lines) {
|
|
|
164
164
|
function registerCatalogCommand(program2) {
|
|
165
165
|
const catalog = program2.command("catalog").description("Model catalog load and health commands");
|
|
166
166
|
catalog.command("refresh").description("Fetch catalogs from open-assets.x12i.com and warm the cache").option("--bundled-only", "Use bundled src/data catalogs only (no HTTP)").option("--json", "Machine-readable JSON on stdout").action(async (opts) => {
|
|
167
|
-
const result = await
|
|
167
|
+
const result = await _chunkUIDCBJXRcjs.refreshAiModelsCatalog.call(void 0, { bundledOnly: opts.bundledOnly });
|
|
168
168
|
if (opts.json) {
|
|
169
169
|
emitJson(result);
|
|
170
170
|
} else {
|
|
@@ -176,7 +176,7 @@ function registerCatalogCommand(program2) {
|
|
|
176
176
|
}
|
|
177
177
|
});
|
|
178
178
|
catalog.command("verify").description("Validate direct + OpenRouter catalogs load successfully").option("--bundled-only", "Use bundled src/data catalogs only (no HTTP)").option("--json", "Machine-readable JSON on stdout").action(async (opts) => {
|
|
179
|
-
const report = await
|
|
179
|
+
const report = await _chunkUIDCBJXRcjs.verifyAiModelsCatalog.call(void 0, { bundledOnly: opts.bundledOnly });
|
|
180
180
|
if (opts.json) {
|
|
181
181
|
emitJson(report);
|
|
182
182
|
} else {
|
|
@@ -204,11 +204,11 @@ function registerCostCommand(program2) {
|
|
|
204
204
|
"Completion token count",
|
|
205
205
|
(v) => Number.parseInt(v, 10)
|
|
206
206
|
).option("--cached-tokens <n>", "Cached token count", (v) => Number.parseInt(v, 10)).option("--reasoning-tokens <n>", "Reasoning token count", (v) => Number.parseInt(v, 10)).option("--provider <id>", "Provider for pricing selection", "openrouter").option("--json", "Output raw AiCostResult JSON").option("--bundled-only", "Use src/data catalogs only (no HTTP)").action(async (opts) => {
|
|
207
|
-
const catalogClient = new (0,
|
|
208
|
-
cacheTtlMs:
|
|
207
|
+
const catalogClient = new (0, _chunk33AAM7KQcjs.AiModelsCatalogClient)({
|
|
208
|
+
cacheTtlMs: _chunk33AAM7KQcjs.resolveCatalogCacheTtlMs.call(void 0, ),
|
|
209
209
|
bundledOnly: opts.bundledOnly
|
|
210
210
|
});
|
|
211
|
-
const calculator = new (0,
|
|
211
|
+
const calculator = new (0, _chunkGHRUS5UFcjs.CostCalculator)(catalogClient, {
|
|
212
212
|
aliasRegistry: new (0, _chunkBAHBDADJcjs.AliasRegistry)()
|
|
213
213
|
});
|
|
214
214
|
const result = await calculator.calculate({
|
|
@@ -250,8 +250,8 @@ function registerCostCommand(program2) {
|
|
|
250
250
|
|
|
251
251
|
// src/cli/commands/models.ts
|
|
252
252
|
function service(opts) {
|
|
253
|
-
return new (0,
|
|
254
|
-
cacheTtlMs:
|
|
253
|
+
return new (0, _chunkQILRLRA4cjs.AiModelsService)({
|
|
254
|
+
cacheTtlMs: _chunk33AAM7KQcjs.resolveCatalogCacheTtlMs.call(void 0, ),
|
|
255
255
|
bundledOnly: opts.bundledOnly
|
|
256
256
|
});
|
|
257
257
|
}
|
package/dist/cli/index.js
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
CostCalculator
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-TFQUMP2O.js";
|
|
5
5
|
import {
|
|
6
6
|
AliasRegistry,
|
|
7
7
|
AliasResolver
|
|
8
8
|
} from "../chunk-ANVONYJF.js";
|
|
9
9
|
import {
|
|
10
10
|
AiModelsService
|
|
11
|
-
} from "../chunk-
|
|
12
|
-
import "../chunk-
|
|
13
|
-
import "../chunk-
|
|
11
|
+
} from "../chunk-M35MNKDY.js";
|
|
12
|
+
import "../chunk-WMB3YEQQ.js";
|
|
13
|
+
import "../chunk-3CUSLNEV.js";
|
|
14
14
|
import {
|
|
15
15
|
refreshAiModelsCatalog,
|
|
16
16
|
verifyAiModelsCatalog
|
|
17
|
-
} from "../chunk-
|
|
17
|
+
} from "../chunk-PP75SWKY.js";
|
|
18
18
|
import {
|
|
19
19
|
AiModelsCatalogClient,
|
|
20
20
|
resolveCatalogCacheTtlMs
|
|
21
|
-
} from "../chunk-
|
|
22
|
-
import "../chunk-
|
|
21
|
+
} from "../chunk-XJQODPN6.js";
|
|
22
|
+
import "../chunk-TLUM25FM.js";
|
|
23
23
|
import "../chunk-SQ6NOF4Z.js";
|
|
24
24
|
import "../chunk-OB44D7RG.js";
|
|
25
25
|
import "../chunk-2PTCWPHV.js";
|
package/dist/cost/index.cjs
CHANGED
|
@@ -7,18 +7,18 @@
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _chunkGHRUS5UFcjs = require('../chunk-GHRUS5UF.cjs');
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
var
|
|
13
|
+
var _chunkFWPH5YE6cjs = require('../chunk-FWPH5YE6.cjs');
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
|
|
20
|
-
var
|
|
21
|
-
require('../chunk-
|
|
20
|
+
var _chunkEDZOFPLVcjs = require('../chunk-EDZOFPLV.cjs');
|
|
21
|
+
require('../chunk-XD5RQKYL.cjs');
|
|
22
22
|
require('../chunk-OZE336BL.cjs');
|
|
23
23
|
require('../chunk-PADNCGZB.cjs');
|
|
24
24
|
require('../chunk-GS7T56RP.cjs');
|
|
@@ -36,5 +36,5 @@ require('../chunk-GS7T56RP.cjs');
|
|
|
36
36
|
|
|
37
37
|
|
|
38
38
|
|
|
39
|
-
exports.CostCalculator =
|
|
39
|
+
exports.CostCalculator = _chunkGHRUS5UFcjs.CostCalculator; exports.DEFAULT_OPENROUTER_MARKUP_RATE = _chunkGHRUS5UFcjs.DEFAULT_OPENROUTER_MARKUP_RATE; exports.MODEL_FIELD_PRIORITY = _chunkGHRUS5UFcjs.MODEL_FIELD_PRIORITY; exports.enrichCostResult = _chunkGHRUS5UFcjs.enrichCostResult; exports.extractUsageInput = _chunkGHRUS5UFcjs.extractUsageInput; exports.modelVendorRefFromIdentity = _chunkEDZOFPLVcjs.modelVendorRefFromIdentity; exports.modelVendorRefFromVendorAndSlug = _chunkEDZOFPLVcjs.modelVendorRefFromVendorAndSlug; exports.resolveModelVendor = _chunkFWPH5YE6cjs.resolveModelVendor; exports.resolveModelVendorFromResolution = _chunkEDZOFPLVcjs.resolveModelVendorFromResolution; exports.resolveModelVendorLastResort = _chunkEDZOFPLVcjs.resolveModelVendorLastResort; exports.resolveModelVendorSync = _chunkEDZOFPLVcjs.resolveModelVendorSync; exports.resolveUsageModel = _chunkGHRUS5UFcjs.resolveUsageModel; exports.toCostExtraction = _chunkGHRUS5UFcjs.toCostExtraction;
|
|
40
40
|
//# sourceMappingURL=index.cjs.map
|
package/dist/cost/index.js
CHANGED
|
@@ -7,18 +7,18 @@ import {
|
|
|
7
7
|
extractUsageInput,
|
|
8
8
|
resolveUsageModel,
|
|
9
9
|
toCostExtraction
|
|
10
|
-
} from "../chunk-
|
|
10
|
+
} from "../chunk-TFQUMP2O.js";
|
|
11
11
|
import {
|
|
12
12
|
resolveModelVendor
|
|
13
|
-
} from "../chunk-
|
|
13
|
+
} from "../chunk-WMB3YEQQ.js";
|
|
14
14
|
import {
|
|
15
15
|
modelVendorRefFromIdentity,
|
|
16
16
|
modelVendorRefFromVendorAndSlug,
|
|
17
17
|
resolveModelVendorFromResolution,
|
|
18
18
|
resolveModelVendorLastResort,
|
|
19
19
|
resolveModelVendorSync
|
|
20
|
-
} from "../chunk-
|
|
21
|
-
import "../chunk-
|
|
20
|
+
} from "../chunk-3CUSLNEV.js";
|
|
21
|
+
import "../chunk-TLUM25FM.js";
|
|
22
22
|
import "../chunk-OB44D7RG.js";
|
|
23
23
|
import "../chunk-2PTCWPHV.js";
|
|
24
24
|
export {
|
package/dist/index.cjs
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _chunkGHRUS5UFcjs = require('./chunk-GHRUS5UF.cjs');
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
var _chunk5HNFAYTOcjs = require('./chunk-5HNFAYTO.cjs');
|
|
@@ -25,10 +25,10 @@ require('./chunk-2PYACSZ5.cjs');
|
|
|
25
25
|
|
|
26
26
|
|
|
27
27
|
|
|
28
|
-
var
|
|
28
|
+
var _chunkQILRLRA4cjs = require('./chunk-QILRLRA4.cjs');
|
|
29
29
|
|
|
30
30
|
|
|
31
|
-
var
|
|
31
|
+
var _chunkFWPH5YE6cjs = require('./chunk-FWPH5YE6.cjs');
|
|
32
32
|
|
|
33
33
|
|
|
34
34
|
var _chunkYO7AJ5Z3cjs = require('./chunk-YO7AJ5Z3.cjs');
|
|
@@ -38,11 +38,11 @@ var _chunkYO7AJ5Z3cjs = require('./chunk-YO7AJ5Z3.cjs');
|
|
|
38
38
|
|
|
39
39
|
|
|
40
40
|
|
|
41
|
-
var
|
|
41
|
+
var _chunkEDZOFPLVcjs = require('./chunk-EDZOFPLV.cjs');
|
|
42
42
|
|
|
43
43
|
|
|
44
44
|
|
|
45
|
-
var
|
|
45
|
+
var _chunkUIDCBJXRcjs = require('./chunk-UIDCBJXR.cjs');
|
|
46
46
|
|
|
47
47
|
|
|
48
48
|
|
|
@@ -52,8 +52,8 @@ var _chunkYY2AGHRVcjs = require('./chunk-YY2AGHRV.cjs');
|
|
|
52
52
|
|
|
53
53
|
|
|
54
54
|
|
|
55
|
-
var
|
|
56
|
-
require('./chunk-
|
|
55
|
+
var _chunk33AAM7KQcjs = require('./chunk-33AAM7KQ.cjs');
|
|
56
|
+
require('./chunk-XD5RQKYL.cjs');
|
|
57
57
|
|
|
58
58
|
|
|
59
59
|
|
|
@@ -89,7 +89,7 @@ var _chunkPADNCGZBcjs = require('./chunk-PADNCGZB.cjs');
|
|
|
89
89
|
|
|
90
90
|
|
|
91
91
|
|
|
92
|
-
var
|
|
92
|
+
var _chunkFYRPN3N2cjs = require('./chunk-FYRPN3N2.cjs');
|
|
93
93
|
require('./chunk-GS7T56RP.cjs');
|
|
94
94
|
|
|
95
95
|
|
|
@@ -152,5 +152,5 @@ require('./chunk-GS7T56RP.cjs');
|
|
|
152
152
|
|
|
153
153
|
|
|
154
154
|
|
|
155
|
-
exports.AIToolbox = _chunk5HNFAYTOcjs.AIToolbox; exports.AiModelsCatalogClient =
|
|
155
|
+
exports.AIToolbox = _chunk5HNFAYTOcjs.AIToolbox; exports.AiModelsCatalogClient = _chunk33AAM7KQcjs.AiModelsCatalogClient; exports.AiModelsService = _chunkQILRLRA4cjs.AiModelsService; exports.AiToolsError = _chunkPADNCGZBcjs.AiToolsError; exports.AliasConflictError = _chunkPADNCGZBcjs.AliasConflictError; exports.AliasFileParseError = _chunkPADNCGZBcjs.AliasFileParseError; exports.AliasFileWriteError = _chunkPADNCGZBcjs.AliasFileWriteError; exports.AliasInvalidNameError = _chunkPADNCGZBcjs.AliasInvalidNameError; exports.AliasNotFoundError = _chunkPADNCGZBcjs.AliasNotFoundError; exports.AliasRegistry = _chunkBAHBDADJcjs.AliasRegistry; exports.AliasResolver = _chunkBAHBDADJcjs.AliasResolver; exports.CostCalculationError = _chunkPADNCGZBcjs.CostCalculationError; exports.CostCalculator = _chunkGHRUS5UFcjs.CostCalculator; exports.DEFAULT_CATALOG_CACHE_TTL_MS = _chunk33AAM7KQcjs.DEFAULT_CATALOG_CACHE_TTL_MS; exports.DEFAULT_DIRECT_CATALOG_URL = _chunk33AAM7KQcjs.DEFAULT_DIRECT_CATALOG_URL; exports.DEFAULT_OPENROUTER_CATALOG_URL = _chunk33AAM7KQcjs.DEFAULT_OPENROUTER_CATALOG_URL; exports.MODEL_FIELD_PRIORITY = _chunkGHRUS5UFcjs.MODEL_FIELD_PRIORITY; exports.ModelNameResolver = _chunkOZE336BLcjs.ModelNameResolver; exports.ModelNotFoundError = _chunkPADNCGZBcjs.ModelNotFoundError; exports.ModelResolutionError = _chunkPADNCGZBcjs.ModelResolutionError; exports.OpenRouterSyncProvider = _chunkJDOFFZJAcjs.OpenRouterSyncProvider; exports.REASONING_SUPPORTED_PARAMETERS = _chunk2KPWVOOTcjs.REASONING_SUPPORTED_PARAMETERS; exports.SyncError = _chunkPADNCGZBcjs.SyncError; exports.UnknownModelCostError = _chunkPADNCGZBcjs.UnknownModelCostError; exports.computeSupportsReasoning = _chunk2KPWVOOTcjs.computeSupportsReasoning; exports.countModels = _chunkQILRLRA4cjs.countModels; exports.createModelNameResolver = _chunkJDOFFZJAcjs.createModelNameResolver; exports.extractUsageInput = _chunkGHRUS5UFcjs.extractUsageInput; exports.filterModels = _chunkQILRLRA4cjs.filterModels; exports.getModelInfo = _chunkQILRLRA4cjs.getModelInfo; exports.hasReasoningPricing = _chunk2KPWVOOTcjs.hasReasoningPricing; exports.invalidateCatalogLoadCache = _chunk33AAM7KQcjs.invalidateCatalogLoadCache; exports.isEffectiveOpenRouterTransport = _chunkOZE336BLcjs.isEffectiveOpenRouterTransport; exports.isKnownProfileOrShortcut = _chunkFYRPN3N2cjs.isKnownProfileOrShortcut; exports.isReasoningModel = _chunk2KPWVOOTcjs.isReasoningModel; exports.isRoutedViaOpenRouter = _chunkJDOFFZJAcjs.isRoutedViaOpenRouter; exports.listAIProfiles = _chunkFYRPN3N2cjs.listAIProfiles; exports.listAIShortcuts = _chunkFYRPN3N2cjs.listAIShortcuts; exports.loadCatalogSources = _chunk33AAM7KQcjs.loadCatalogSources; exports.loadCatalogSourcesCached = _chunk33AAM7KQcjs.loadCatalogSourcesCached; exports.loadOpenRouterRoutingEnv = _chunkOZE336BLcjs.loadOpenRouterRoutingEnv; exports.modelVendorRefFromIdentity = _chunkEDZOFPLVcjs.modelVendorRefFromIdentity; exports.modelVendorRefFromVendorAndSlug = _chunkEDZOFPLVcjs.modelVendorRefFromVendorAndSlug; exports.normalizeOpenRouterModel = _chunkYO7AJ5Z3cjs.normalizeOpenRouterModel; exports.profileConfigFromResolved = _chunkFYRPN3N2cjs.profileConfigFromResolved; exports.providerIdToEnvKeyPrefix = _chunkOZE336BLcjs.providerIdToEnvKeyPrefix; exports.refreshAiModelsCatalog = _chunkUIDCBJXRcjs.refreshAiModelsCatalog; exports.resolveAIProfile = _chunkFYRPN3N2cjs.resolveAIProfile; exports.resolveCatalogCacheTtlMs = _chunk33AAM7KQcjs.resolveCatalogCacheTtlMs; exports.resolveModel = _chunkJDOFFZJAcjs.resolveModel; exports.resolveModelVendor = _chunkFWPH5YE6cjs.resolveModelVendor; exports.resolveModelVendorFromResolution = _chunkEDZOFPLVcjs.resolveModelVendorFromResolution; exports.resolveModelVendorLastResort = _chunkEDZOFPLVcjs.resolveModelVendorLastResort; exports.resolveModelVendorSync = _chunkEDZOFPLVcjs.resolveModelVendorSync; exports.resolveProfileForAsk = _chunkFYRPN3N2cjs.resolveProfileForAsk; exports.resolveUsageModel = _chunkGHRUS5UFcjs.resolveUsageModel; exports.shouldDefaultRouteViaOpenRouter = _chunkOZE336BLcjs.shouldDefaultRouteViaOpenRouter; exports.supportsReasoningParameter = _chunk2KPWVOOTcjs.supportsReasoningParameter; exports.vendorApiKeyEnvName = _chunkOZE336BLcjs.vendorApiKeyEnvName; exports.verifyAiModelsCatalog = _chunkUIDCBJXRcjs.verifyAiModelsCatalog;
|
|
156
156
|
//# sourceMappingURL=index.cjs.map
|