@x12i/ai-profiles 2.1.0 → 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/README.md +51 -1
- package/dist/gatewayWireId.d.ts +22 -0
- package/dist/gatewayWireId.d.ts.map +1 -0
- package/dist/gatewayWireId.js +42 -0
- package/dist/gatewayWireId.js.map +1 -0
- package/dist/index.d.ts +17 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -2
- package/dist/index.js.map +1 -1
- package/dist/isKnownProfileInput.d.ts +9 -0
- package/dist/isKnownProfileInput.d.ts.map +1 -0
- package/dist/isKnownProfileInput.js +14 -0
- package/dist/isKnownProfileInput.js.map +1 -0
- package/dist/lookupBundledCatalogCaps.d.ts +17 -0
- package/dist/lookupBundledCatalogCaps.d.ts.map +1 -0
- package/dist/lookupBundledCatalogCaps.js +22 -0
- package/dist/lookupBundledCatalogCaps.js.map +1 -0
- package/dist/normalizeKey.d.ts +6 -0
- package/dist/normalizeKey.d.ts.map +1 -1
- package/dist/normalizeKey.js +16 -0
- package/dist/normalizeKey.js.map +1 -1
- package/dist/profileChoiceKey.d.ts +29 -2
- package/dist/profileChoiceKey.d.ts.map +1 -1
- package/dist/profileChoiceKey.js +92 -26
- package/dist/profileChoiceKey.js.map +1 -1
- package/dist/profileDiscoveryMatch.d.ts.map +1 -1
- package/dist/profileDiscoveryMatch.js +5 -4
- package/dist/profileDiscoveryMatch.js.map +1 -1
- package/dist/resolveBundledAIProfile.d.ts +11 -0
- package/dist/resolveBundledAIProfile.d.ts.map +1 -0
- package/dist/resolveBundledAIProfile.js +16 -0
- package/dist/resolveBundledAIProfile.js.map +1 -0
- package/dist/resolveBundledCatalogModel.d.ts +14 -0
- package/dist/resolveBundledCatalogModel.d.ts.map +1 -0
- package/dist/resolveBundledCatalogModel.js +74 -0
- package/dist/resolveBundledCatalogModel.js.map +1 -0
- package/dist/resolveBundledInput.d.ts +18 -0
- package/dist/resolveBundledInput.d.ts.map +1 -0
- package/dist/resolveBundledInput.js +29 -0
- package/dist/resolveBundledInput.js.map +1 -0
- package/dist/resolveProfileInputCore.d.ts +4 -0
- package/dist/resolveProfileInputCore.d.ts.map +1 -0
- package/dist/resolveProfileInputCore.js +145 -0
- package/dist/resolveProfileInputCore.js.map +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -217,6 +217,12 @@ npm install @x12i/ai-profiles
|
|
|
217
217
|
| `listAIProfileChoices(options?)` | No (async) | List explicit `profile/choice` keys for strict pickers and stored config |
|
|
218
218
|
| `listAIShortcuts()` | Yes | Shortcut table: `{ key, profile, choice, description? }[]` |
|
|
219
219
|
| `isKnownProfileChoice(input)` | Yes (bundled only) | Whether input is a known `profile/choice` key or shortcut |
|
|
220
|
+
| `isKnownProfileInput(input)` | Yes (bundled only) | Whether input is registry-side: `profile/choice`, shortcut, bare profile, or alias (not a concrete slug or gateway wire) |
|
|
221
|
+
| `getBundledRegistry()` | Yes | Sync bundled profiles + shortcuts (no network) |
|
|
222
|
+
| `resolveBundledAIProfile(input, options)` | Yes | Same rules as `resolveAIProfile` with `source: "bundled"`, plus bare profiles and aliases → `defaultChoice` |
|
|
223
|
+
| `resolveBundledInput(input, options)` | Yes | Unified resolver: profile inputs → registry; concrete slugs / gateway wires / `{ provider, modelId }` → catalog |
|
|
224
|
+
| `resolveBundledCatalogModel(input, options?)` | Yes | Sync catalog resolution for vendor slugs and gateway wire ids |
|
|
225
|
+
| `lookupBundledCatalogCaps({ provider, modelId })` | Yes | Sync `{ contextWindow, maxOutputTokens, supportsReasoning }` from bundled catalog |
|
|
220
226
|
| `resolveAIProfile(input, options?)` | No (async) | Resolve an explicit `profile/choice` key (or shortcut) → model, pricing, runtime. Pass `includeSecondary: true` to attach `secondary`. |
|
|
221
227
|
| `resolveSecondaryModel(input, options?)` | No (async) | Resolve primary choice + optional companion `secondary` from profile `secondary` refs |
|
|
222
228
|
| `getSecondaryForResolvedProfile(resolved, registry, catalog?)` | Yes | Secondary for an already-resolved primary (no extra I/O when catalog is passed) |
|
|
@@ -249,6 +255,8 @@ Use these when callers pass **raw model ids or OpenRouter slugs**, not profile n
|
|
|
249
255
|
| Export | Sync? | Purpose |
|
|
250
256
|
|--------|-------|---------|
|
|
251
257
|
| `resolveUseOpenRouter(explicit?)` | Yes | Resolve OpenRouter vs vendor-direct routing (option → env → default) |
|
|
258
|
+
| `applyModelRouting(choice, backend, useOpenRouter, catalog?)` | Yes | Turn a registry choice into invoke-time `{ provider, modelId, routing }` (same rules as `resolveAIProfile`) |
|
|
259
|
+
| `normalizeGatewayWireId(input)` | Yes | `openrouter/openai/gpt-5.5` → `{ provider: "openrouter", modelId: "openai/gpt-5.5" }` (profile keys like `cheap/default` are not gateway wires) |
|
|
252
260
|
| `validateBundledProfileVendorCoverage(options?)` | Yes | Advisory report of leading-vendor coverage per profile |
|
|
253
261
|
| `validateBundledProfileModalityCoverage(options?)` | Yes | Advisory report of profile choice vs required input/output media |
|
|
254
262
|
| `isProfileVendorTrimReady(profile, allowedProviders)` | Yes | Whether auto-pick can satisfy a vendor filter |
|
|
@@ -269,6 +277,48 @@ Registry JSON lives in four bundled assets:
|
|
|
269
277
|
|
|
270
278
|
Validate with `src/data/models-profiles.schema.json`. Maintainer scripts: `npm run migrate:profiles-v3`, `npm run registry:finish` (catalog supplement + verified defaults + linkage rebuild).
|
|
271
279
|
|
|
280
|
+
## Sync bundled resolution (predict / invoke)
|
|
281
|
+
|
|
282
|
+
For consumers that need **no network** and a single entry point:
|
|
283
|
+
|
|
284
|
+
```ts
|
|
285
|
+
import {
|
|
286
|
+
isKnownProfileInput,
|
|
287
|
+
resolveBundledInput,
|
|
288
|
+
resolveBundledAIProfile,
|
|
289
|
+
applyModelRouting,
|
|
290
|
+
normalizeGatewayWireId,
|
|
291
|
+
lookupBundledCatalogCaps,
|
|
292
|
+
getBundledRegistry,
|
|
293
|
+
} from "@x12i/ai-profiles";
|
|
294
|
+
|
|
295
|
+
// Resolution order in resolveBundledInput (registry keys and catalog ids do not overlap):
|
|
296
|
+
// 1. Profile input (isKnownProfileInput) → registry — requires catalogLane
|
|
297
|
+
// 2. Concrete model slug, gateway wire, or { provider, modelId } → catalog
|
|
298
|
+
|
|
299
|
+
if (isKnownProfileInput("cheap")) {
|
|
300
|
+
const resolved = resolveBundledInput("cheap", { catalogLane: "text" });
|
|
301
|
+
// → cheap/default, routed provider + modelId, limits, modelSignals.isReasoningModel
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
const wire = normalizeGatewayWireId("openrouter/openai/gpt-5.5");
|
|
305
|
+
// → { provider: "openrouter", modelId: "openai/gpt-5.5" }
|
|
306
|
+
|
|
307
|
+
const caps = lookupBundledCatalogCaps({
|
|
308
|
+
provider: "openrouter",
|
|
309
|
+
modelId: "google/gemini-2.5-flash-lite",
|
|
310
|
+
});
|
|
311
|
+
|
|
312
|
+
const registry = getBundledRegistry();
|
|
313
|
+
const routed = applyModelRouting(
|
|
314
|
+
registry.profiles.cheap.choices.default,
|
|
315
|
+
"openrouter",
|
|
316
|
+
true,
|
|
317
|
+
);
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
`isKnownProfileInput` returns **false** for `google/gemini-2.5-flash-lite` and `openrouter/openai/gpt-5.5` so predict paths skip profile resolution on concrete model strings.
|
|
321
|
+
|
|
272
322
|
## Basic usage
|
|
273
323
|
|
|
274
324
|
```ts
|
|
@@ -355,7 +405,7 @@ The same string can appear as both an alias and a shortcut. That is intentional.
|
|
|
355
405
|
|
|
356
406
|
Profile-only inputs and profile aliases are **discovery-only**; they are not valid for `resolveAIProfile`.
|
|
357
407
|
|
|
358
|
-
Input is normalized (trimmed, lowercased) before matching.
|
|
408
|
+
Input is normalized (trimmed, lowercased) before matching. Composite keys accept **`/` or `\`** as the separator on input (`cyber\default` → `cyber/default`); listed and resolved keys always use `/`. **Profile, choice, and shortcut segment names treat `-` and `_` as equivalent** (`cheap/google-floor` → `cheap/google_floor`).
|
|
359
409
|
|
|
360
410
|
### Examples
|
|
361
411
|
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { AIProvider } from "./types.js";
|
|
2
|
+
/** Gateway providers that prefix invoke-time wire ids (`openrouter/openai/gpt-5.5`). */
|
|
3
|
+
export declare const GATEWAY_PROVIDERS: readonly ["openrouter"];
|
|
4
|
+
export type GatewayProvider = (typeof GATEWAY_PROVIDERS)[number];
|
|
5
|
+
export interface NormalizedGatewayWireId {
|
|
6
|
+
provider: GatewayProvider;
|
|
7
|
+
modelId: string;
|
|
8
|
+
}
|
|
9
|
+
export declare function isGatewayProvider(value: string): value is GatewayProvider;
|
|
10
|
+
/**
|
|
11
|
+
* Split a gateway-prefixed wire id into `{ provider, modelId }`.
|
|
12
|
+
* `openrouter/openai/gpt-5.5` → `{ provider: "openrouter", modelId: "openai/gpt-5.5" }`.
|
|
13
|
+
*
|
|
14
|
+
* Profile keys like `cheap/default` are not gateway wires (first segment is not a gateway provider).
|
|
15
|
+
*/
|
|
16
|
+
export declare function normalizeGatewayWireId(input: string): NormalizedGatewayWireId | null;
|
|
17
|
+
/** Whether `input` is a gateway wire id (not a vendor slug like `google/gemini-2.5-flash-lite`). */
|
|
18
|
+
export declare function isGatewayWireId(input: string): boolean;
|
|
19
|
+
export declare function formatGatewayWireId(provider: GatewayProvider, modelId: string): string;
|
|
20
|
+
/** Invoke-time provider after gateway normalization (openrouter stays openrouter). */
|
|
21
|
+
export declare function gatewayInvokeProvider(provider: string): AIProvider;
|
|
22
|
+
//# sourceMappingURL=gatewayWireId.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gatewayWireId.d.ts","sourceRoot":"","sources":["../src/gatewayWireId.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7C,wFAAwF;AACxF,eAAO,MAAM,iBAAiB,yBAA0B,CAAC;AAEzD,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEjE,MAAM,WAAW,uBAAuB;IACtC,QAAQ,EAAE,eAAe,CAAC;IAC1B,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,eAAe,CAEzE;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,MAAM,GAAG,uBAAuB,GAAG,IAAI,CAqBpF;AAED,oGAAoG;AACpG,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAEtD;AAED,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAEtF;AAED,sFAAsF;AACtF,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,GAAG,UAAU,CAElE"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/** Gateway providers that prefix invoke-time wire ids (`openrouter/openai/gpt-5.5`). */
|
|
2
|
+
export const GATEWAY_PROVIDERS = ["openrouter"];
|
|
3
|
+
export function isGatewayProvider(value) {
|
|
4
|
+
return GATEWAY_PROVIDERS.includes(value.trim().toLowerCase());
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Split a gateway-prefixed wire id into `{ provider, modelId }`.
|
|
8
|
+
* `openrouter/openai/gpt-5.5` → `{ provider: "openrouter", modelId: "openai/gpt-5.5" }`.
|
|
9
|
+
*
|
|
10
|
+
* Profile keys like `cheap/default` are not gateway wires (first segment is not a gateway provider).
|
|
11
|
+
*/
|
|
12
|
+
export function normalizeGatewayWireId(input) {
|
|
13
|
+
const trimmed = input.trim();
|
|
14
|
+
if (!trimmed.includes("/")) {
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
const slash = trimmed.indexOf("/");
|
|
18
|
+
const prefix = trimmed.slice(0, slash).toLowerCase();
|
|
19
|
+
if (!isGatewayProvider(prefix)) {
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
const modelId = trimmed.slice(slash + 1).trim();
|
|
23
|
+
if (!modelId) {
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
return {
|
|
27
|
+
provider: prefix,
|
|
28
|
+
modelId,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
/** Whether `input` is a gateway wire id (not a vendor slug like `google/gemini-2.5-flash-lite`). */
|
|
32
|
+
export function isGatewayWireId(input) {
|
|
33
|
+
return normalizeGatewayWireId(input) !== null;
|
|
34
|
+
}
|
|
35
|
+
export function formatGatewayWireId(provider, modelId) {
|
|
36
|
+
return `${provider}/${modelId}`;
|
|
37
|
+
}
|
|
38
|
+
/** Invoke-time provider after gateway normalization (openrouter stays openrouter). */
|
|
39
|
+
export function gatewayInvokeProvider(provider) {
|
|
40
|
+
return isGatewayProvider(provider) ? provider : provider;
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=gatewayWireId.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gatewayWireId.js","sourceRoot":"","sources":["../src/gatewayWireId.ts"],"names":[],"mappings":"AAEA,wFAAwF;AACxF,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,YAAY,CAAU,CAAC;AASzD,MAAM,UAAU,iBAAiB,CAAC,KAAa;IAC7C,OAAQ,iBAAuC,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,CAAC;AACvF,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,sBAAsB,CAAC,KAAa;IAClD,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;IAC7B,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QAC3B,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACnC,MAAM,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,WAAW,EAAE,CAAC;IACrD,IAAI,CAAC,iBAAiB,CAAC,MAAM,CAAC,EAAE,CAAC;QAC/B,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,OAAO,GAAG,OAAO,CAAC,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;IAChD,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO;QACL,QAAQ,EAAE,MAAM;QAChB,OAAO;KACR,CAAC;AACJ,CAAC;AAED,oGAAoG;AACpG,MAAM,UAAU,eAAe,CAAC,KAAa;IAC3C,OAAO,sBAAsB,CAAC,KAAK,CAAC,KAAK,IAAI,CAAC;AAChD,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,QAAyB,EAAE,OAAe;IAC5E,OAAO,GAAG,QAAQ,IAAI,OAAO,EAAE,CAAC;AAClC,CAAC;AAED,sFAAsF;AACtF,MAAM,UAAU,qBAAqB,CAAC,QAAgB;IACpD,OAAO,iBAAiB,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAE,QAAuB,CAAC;AAC3E,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -10,6 +10,9 @@ export { getAIRegistryStatistics } from "./getAIRegistryStatistics.js";
|
|
|
10
10
|
export { computeProfilesStatistics, computeCatalogStatistics, computeLinkageStatistics, computeShortcutsStatistics, buildRegistryStatistics, } from "./computeRegistryStatistics.js";
|
|
11
11
|
export { formatRegistryStatistics } from "./formatRegistryStatistics.js";
|
|
12
12
|
export { resolveAIProfile } from "./resolveAIProfile.js";
|
|
13
|
+
export { resolveBundledAIProfile } from "./resolveBundledAIProfile.js";
|
|
14
|
+
export { resolveBundledInput } from "./resolveBundledInput.js";
|
|
15
|
+
export { resolveBundledCatalogModel } from "./resolveBundledCatalogModel.js";
|
|
13
16
|
export { resolveCatalogModel } from "./resolveCatalogModel.js";
|
|
14
17
|
export { resolveAIProfileWithCostAlternatives, type ResolveAIProfileWithCostAlternativesResult, } from "./resolveAIProfileWithCostAlternatives.js";
|
|
15
18
|
export { resolveSecondaryModel, getSecondaryForResolvedProfile, } from "./resolveSecondaryModel.js";
|
|
@@ -17,11 +20,17 @@ export { listProfileSecondaries } from "./secondaryModel.js";
|
|
|
17
20
|
export { validateIntentLayerName, validateProfileTagLength, FORBIDDEN_INTENT_VENDOR_TOKENS, } from "./validation/profileIntentPolicy.js";
|
|
18
21
|
export { validateUniqueProfileTagSets } from "./validation/validateModelsProfilesJson.js";
|
|
19
22
|
export { isKnownProfileChoice } from "./isKnownProfileChoice.js";
|
|
20
|
-
export {
|
|
21
|
-
export
|
|
23
|
+
export { isKnownProfileInput } from "./isKnownProfileInput.js";
|
|
24
|
+
export { getBundledRegistry } from "./bundledRegistry.js";
|
|
25
|
+
export { lookupBundledCatalogCaps } from "./lookupBundledCatalogCaps.js";
|
|
26
|
+
export { PROFILE_CHOICE_KEY_SEP, formatProfileChoiceKey, parseProfileChoiceKey, isProfileChoiceKeyFormat, matchStrictProfileInput, matchBundledProfileInput, listRegistryProfileChoiceKeys, isKnownProfileChoiceInput, isKnownProfileInputForRegistry, } from "./profileChoiceKey.js";
|
|
27
|
+
export type { ProfileChoiceRef, StrictProfileInputMatch, BundledProfileInputMatch, } from "./profileChoiceKey.js";
|
|
22
28
|
export { matchDiscoveryProfileInput } from "./profileDiscoveryMatch.js";
|
|
23
29
|
export type { DiscoveryProfileMatch } from "./profileDiscoveryMatch.js";
|
|
24
|
-
export { resolveUseOpenRouter, readUseOpenRouterFromEnv, buildOpenRouterModelId, } from "./resolveModelRouting.js";
|
|
30
|
+
export { resolveUseOpenRouter, readUseOpenRouterFromEnv, buildOpenRouterModelId, applyModelRouting, isRemoteProfileChoice, } from "./resolveModelRouting.js";
|
|
31
|
+
export type { AppliedModelRouting } from "./resolveModelRouting.js";
|
|
32
|
+
export { GATEWAY_PROVIDERS, isGatewayProvider, isGatewayWireId, normalizeGatewayWireId, formatGatewayWireId, gatewayInvokeProvider, } from "./gatewayWireId.js";
|
|
33
|
+
export type { GatewayProvider, NormalizedGatewayWireId } from "./gatewayWireId.js";
|
|
25
34
|
export { buildModelInvocation, buildDirectInvocation, buildRegistryKey, matchOpenRouterCatalog, normalizeAnthropicVersionSlug, openRouterResolutionCandidates, } from "./modelIdentity.js";
|
|
26
35
|
export { resolveModelIdentity } from "./resolveModelIdentity.js";
|
|
27
36
|
export type { ModelVendorRef, ResolveModelIdentityOptions, } from "./resolveModelIdentity.js";
|
|
@@ -52,6 +61,11 @@ export type { GetAIRegistryStatisticsResult } from "./getAIRegistryStatistics.js
|
|
|
52
61
|
export type { LoadCatalogResult } from "./loader/loadModelsCatalog.js";
|
|
53
62
|
export type { LoadRegistryOptions, LoadRegistryResult, } from "./types.js";
|
|
54
63
|
export type { AIModelRoutingMode } from "./resolveModelRouting.js";
|
|
64
|
+
export type { ResolveProfileInputCoreOptions } from "./resolveProfileInputCore.js";
|
|
65
|
+
export type { ResolveBundledInput, ResolveBundledInputOptions, } from "./resolveBundledInput.js";
|
|
66
|
+
export type { BundledCatalogModelInput, ResolveBundledCatalogModelOptions, } from "./resolveBundledCatalogModel.js";
|
|
67
|
+
export type { BundledCatalogCaps } from "./lookupBundledCatalogCaps.js";
|
|
68
|
+
export { normalizeKey, normalizeSegmentKey, resolveSegmentKey } from "./normalizeKey.js";
|
|
55
69
|
export { AIProfilesError } from "./errors.js";
|
|
56
70
|
export type { AIProfilesErrorCode } from "./errors.js";
|
|
57
71
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,oBAAoB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AY,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -8,6 +8,9 @@ export { getAIRegistryStatistics } from "./getAIRegistryStatistics.js";
|
|
|
8
8
|
export { computeProfilesStatistics, computeCatalogStatistics, computeLinkageStatistics, computeShortcutsStatistics, buildRegistryStatistics, } from "./computeRegistryStatistics.js";
|
|
9
9
|
export { formatRegistryStatistics } from "./formatRegistryStatistics.js";
|
|
10
10
|
export { resolveAIProfile } from "./resolveAIProfile.js";
|
|
11
|
+
export { resolveBundledAIProfile } from "./resolveBundledAIProfile.js";
|
|
12
|
+
export { resolveBundledInput } from "./resolveBundledInput.js";
|
|
13
|
+
export { resolveBundledCatalogModel } from "./resolveBundledCatalogModel.js";
|
|
11
14
|
export { resolveCatalogModel } from "./resolveCatalogModel.js";
|
|
12
15
|
export { resolveAIProfileWithCostAlternatives, } from "./resolveAIProfileWithCostAlternatives.js";
|
|
13
16
|
export { resolveSecondaryModel, getSecondaryForResolvedProfile, } from "./resolveSecondaryModel.js";
|
|
@@ -15,9 +18,13 @@ export { listProfileSecondaries } from "./secondaryModel.js";
|
|
|
15
18
|
export { validateIntentLayerName, validateProfileTagLength, FORBIDDEN_INTENT_VENDOR_TOKENS, } from "./validation/profileIntentPolicy.js";
|
|
16
19
|
export { validateUniqueProfileTagSets } from "./validation/validateModelsProfilesJson.js";
|
|
17
20
|
export { isKnownProfileChoice } from "./isKnownProfileChoice.js";
|
|
18
|
-
export {
|
|
21
|
+
export { isKnownProfileInput } from "./isKnownProfileInput.js";
|
|
22
|
+
export { getBundledRegistry } from "./bundledRegistry.js";
|
|
23
|
+
export { lookupBundledCatalogCaps } from "./lookupBundledCatalogCaps.js";
|
|
24
|
+
export { PROFILE_CHOICE_KEY_SEP, formatProfileChoiceKey, parseProfileChoiceKey, isProfileChoiceKeyFormat, matchStrictProfileInput, matchBundledProfileInput, listRegistryProfileChoiceKeys, isKnownProfileChoiceInput, isKnownProfileInputForRegistry, } from "./profileChoiceKey.js";
|
|
19
25
|
export { matchDiscoveryProfileInput } from "./profileDiscoveryMatch.js";
|
|
20
|
-
export { resolveUseOpenRouter, readUseOpenRouterFromEnv, buildOpenRouterModelId, } from "./resolveModelRouting.js";
|
|
26
|
+
export { resolveUseOpenRouter, readUseOpenRouterFromEnv, buildOpenRouterModelId, applyModelRouting, isRemoteProfileChoice, } from "./resolveModelRouting.js";
|
|
27
|
+
export { GATEWAY_PROVIDERS, isGatewayProvider, isGatewayWireId, normalizeGatewayWireId, formatGatewayWireId, gatewayInvokeProvider, } from "./gatewayWireId.js";
|
|
21
28
|
export { buildModelInvocation, buildDirectInvocation, buildRegistryKey, matchOpenRouterCatalog, normalizeAnthropicVersionSlug, openRouterResolutionCandidates, } from "./modelIdentity.js";
|
|
22
29
|
export { resolveModelIdentity } from "./resolveModelIdentity.js";
|
|
23
30
|
export { buildModelInvocationFromChoice, getChoiceVendorModelId, getChoiceOpenRouterModelId, getChoicePricing, flattenChoicePricing, fixVendorModelId, } from "./profileRegistryV2.js";
|
|
@@ -42,5 +49,6 @@ export { loadModelsCatalog, loadModelsCatalogWithWarnings } from "./loader/loadM
|
|
|
42
49
|
export { loadBundledModelsCatalog } from "./loader/loadBundledModelsCatalog.js";
|
|
43
50
|
export { buildModelsCatalogFromOpenRouterApi, buildLegacyCatalogFromOpenRouterApi, } from "./buildCatalogFromOpenRouterApi.js";
|
|
44
51
|
export { REMOTE_MODELS_CATALOG_URL, OPENROUTER_MODELS_API_URL } from "./constants.js";
|
|
52
|
+
export { normalizeKey, normalizeSegmentKey, resolveSegmentKey } from "./normalizeKey.js";
|
|
45
53
|
export { AIProfilesError } from "./errors.js";
|
|
46
54
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACr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,EACL,2BAA2B,EAC3B,gBAAgB,EAChB,iBAAiB,EACjB,sBAAsB,EACtB,8BAA8B,EAC9B,8BAA8B,GAC/B,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EACL,uBAAuB,EACvB,yBAAyB,EACzB,qBAAqB,EACrB,sBAAsB,EACtB,uBAAuB,EACvB,6BAA6B,GAC9B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,sBAAsB,EACtB,kCAAkC,GACnC,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,6BAA6B,EAAE,MAAM,+BAA+B,CAAC;AACjG,OAAO,EAAE,wBAAwB,EAAE,MAAM,sCAAsC,CAAC;AAChF,OAAO,EACL,mCAAmC,EACnC,mCAAmC,GACpC,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,yBAAyB,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAC;AA2EtF,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAEzF,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether `input` is a registry-side profile reference (not a concrete model slug).
|
|
3
|
+
*
|
|
4
|
+
* Returns true for `profile/choice`, shortcuts, bare profiles, and profile aliases.
|
|
5
|
+
* Returns false for vendor slugs (`google/gemini-2.5-flash-lite`) and gateway wires
|
|
6
|
+
* (`openrouter/openai/gpt-5.5`). Sync — bundled registry only.
|
|
7
|
+
*/
|
|
8
|
+
export declare function isKnownProfileInput(input: string): boolean;
|
|
9
|
+
//# sourceMappingURL=isKnownProfileInput.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isKnownProfileInput.d.ts","sourceRoot":"","sources":["../src/isKnownProfileInput.ts"],"names":[],"mappings":"AAGA;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAG1D"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { getBundledRegistry } from "./bundledRegistry.js";
|
|
2
|
+
import { isKnownProfileInputForRegistry } from "./profileChoiceKey.js";
|
|
3
|
+
/**
|
|
4
|
+
* Whether `input` is a registry-side profile reference (not a concrete model slug).
|
|
5
|
+
*
|
|
6
|
+
* Returns true for `profile/choice`, shortcuts, bare profiles, and profile aliases.
|
|
7
|
+
* Returns false for vendor slugs (`google/gemini-2.5-flash-lite`) and gateway wires
|
|
8
|
+
* (`openrouter/openai/gpt-5.5`). Sync — bundled registry only.
|
|
9
|
+
*/
|
|
10
|
+
export function isKnownProfileInput(input) {
|
|
11
|
+
const registry = getBundledRegistry();
|
|
12
|
+
return isKnownProfileInputForRegistry(registry, input);
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=isKnownProfileInput.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isKnownProfileInput.js","sourceRoot":"","sources":["../src/isKnownProfileInput.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,8BAA8B,EAAE,MAAM,uBAAuB,CAAC;AAEvE;;;;;;GAMG;AACH,MAAM,UAAU,mBAAmB,CAAC,KAAa;IAC/C,MAAM,QAAQ,GAAG,kBAAkB,EAAE,CAAC;IACtC,OAAO,8BAA8B,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;AACzD,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { AIProvider } from "./types.js";
|
|
2
|
+
export interface BundledCatalogCaps {
|
|
3
|
+
contextWindow?: number;
|
|
4
|
+
maxOutputTokens?: number;
|
|
5
|
+
supportsReasoning?: boolean;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Sync bundled lookup of catalog limits and reasoning capability for a routed model.
|
|
9
|
+
* Tries `openRouterModelId`, `provider/modelId`, and bare `modelId` (same order as
|
|
10
|
+
* {@link findCatalogModelEntry}).
|
|
11
|
+
*/
|
|
12
|
+
export declare function lookupBundledCatalogCaps(params: {
|
|
13
|
+
provider: AIProvider;
|
|
14
|
+
modelId: string;
|
|
15
|
+
openRouterModelId?: string | null;
|
|
16
|
+
}): BundledCatalogCaps | undefined;
|
|
17
|
+
//# sourceMappingURL=lookupBundledCatalogCaps.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lookupBundledCatalogCaps.d.ts","sourceRoot":"","sources":["../src/lookupBundledCatalogCaps.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7C,MAAM,WAAW,kBAAkB;IACjC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,MAAM,EAAE;IAC/C,QAAQ,EAAE,UAAU,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,iBAAiB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACnC,GAAG,kBAAkB,GAAG,SAAS,CAejC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { loadBundledModelsCatalog } from "./loader/loadBundledModelsCatalog.js";
|
|
2
|
+
import { capabilitiesFromCatalogEntry, findCatalogModelEntry, limitsFromCatalogEntry, } from "./catalogEnrichment.js";
|
|
3
|
+
/**
|
|
4
|
+
* Sync bundled lookup of catalog limits and reasoning capability for a routed model.
|
|
5
|
+
* Tries `openRouterModelId`, `provider/modelId`, and bare `modelId` (same order as
|
|
6
|
+
* {@link findCatalogModelEntry}).
|
|
7
|
+
*/
|
|
8
|
+
export function lookupBundledCatalogCaps(params) {
|
|
9
|
+
const catalog = loadBundledModelsCatalog();
|
|
10
|
+
const entry = findCatalogModelEntry(catalog, params);
|
|
11
|
+
if (!entry) {
|
|
12
|
+
return undefined;
|
|
13
|
+
}
|
|
14
|
+
const limits = limitsFromCatalogEntry(entry);
|
|
15
|
+
const capabilities = capabilitiesFromCatalogEntry(entry);
|
|
16
|
+
return {
|
|
17
|
+
contextWindow: limits.contextWindow,
|
|
18
|
+
maxOutputTokens: limits.maxOutputTokens,
|
|
19
|
+
supportsReasoning: capabilities.supportsReasoning,
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=lookupBundledCatalogCaps.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lookupBundledCatalogCaps.js","sourceRoot":"","sources":["../src/lookupBundledCatalogCaps.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,sCAAsC,CAAC;AAChF,OAAO,EACL,4BAA4B,EAC5B,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,wBAAwB,CAAC;AAShC;;;;GAIG;AACH,MAAM,UAAU,wBAAwB,CAAC,MAIxC;IACC,MAAM,OAAO,GAAG,wBAAwB,EAAE,CAAC;IAC3C,MAAM,KAAK,GAAG,qBAAqB,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IACrD,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,MAAM,GAAG,sBAAsB,CAAC,KAAK,CAAC,CAAC;IAC7C,MAAM,YAAY,GAAG,4BAA4B,CAAC,KAAK,CAAC,CAAC;IAEzD,OAAO;QACL,aAAa,EAAE,MAAM,CAAC,aAAa;QACnC,eAAe,EAAE,MAAM,CAAC,eAAe;QACvC,iBAAiB,EAAE,YAAY,CAAC,iBAAiB;KAClD,CAAC;AACJ,CAAC"}
|
package/dist/normalizeKey.d.ts
CHANGED
|
@@ -1,2 +1,8 @@
|
|
|
1
1
|
export declare function normalizeKey(value: string): string;
|
|
2
|
+
/**
|
|
3
|
+
* Profile, choice, and shortcut keys treat `-` and `_` as equivalent (canonical: `_`).
|
|
4
|
+
*/
|
|
5
|
+
export declare function normalizeSegmentKey(value: string): string;
|
|
6
|
+
/** Resolve an input segment to the registry's canonical object key, if any. */
|
|
7
|
+
export declare function resolveSegmentKey(keys: Iterable<string>, input: string): string | undefined;
|
|
2
8
|
//# sourceMappingURL=normalizeKey.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"normalizeKey.d.ts","sourceRoot":"","sources":["../src/normalizeKey.ts"],"names":[],"mappings":"AAAA,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAElD"}
|
|
1
|
+
{"version":3,"file":"normalizeKey.d.ts","sourceRoot":"","sources":["../src/normalizeKey.ts"],"names":[],"mappings":"AAAA,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAElD;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEzD;AAED,+EAA+E;AAC/E,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,EACtB,KAAK,EAAE,MAAM,GACZ,MAAM,GAAG,SAAS,CAQpB"}
|
package/dist/normalizeKey.js
CHANGED
|
@@ -1,4 +1,20 @@
|
|
|
1
1
|
export function normalizeKey(value) {
|
|
2
2
|
return value.trim().toLowerCase();
|
|
3
3
|
}
|
|
4
|
+
/**
|
|
5
|
+
* Profile, choice, and shortcut keys treat `-` and `_` as equivalent (canonical: `_`).
|
|
6
|
+
*/
|
|
7
|
+
export function normalizeSegmentKey(value) {
|
|
8
|
+
return normalizeKey(value).replace(/-/g, "_");
|
|
9
|
+
}
|
|
10
|
+
/** Resolve an input segment to the registry's canonical object key, if any. */
|
|
11
|
+
export function resolveSegmentKey(keys, input) {
|
|
12
|
+
const normalized = normalizeSegmentKey(input);
|
|
13
|
+
for (const key of keys) {
|
|
14
|
+
if (normalizeSegmentKey(key) === normalized) {
|
|
15
|
+
return key;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
return undefined;
|
|
19
|
+
}
|
|
4
20
|
//# sourceMappingURL=normalizeKey.js.map
|
package/dist/normalizeKey.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"normalizeKey.js","sourceRoot":"","sources":["../src/normalizeKey.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,YAAY,CAAC,KAAa;IACxC,OAAO,KAAK,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;AACpC,CAAC"}
|
|
1
|
+
{"version":3,"file":"normalizeKey.js","sourceRoot":"","sources":["../src/normalizeKey.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,YAAY,CAAC,KAAa;IACxC,OAAO,KAAK,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;AACpC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,mBAAmB,CAAC,KAAa;IAC/C,OAAO,YAAY,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;AAChD,CAAC;AAED,+EAA+E;AAC/E,MAAM,UAAU,iBAAiB,CAC/B,IAAsB,EACtB,KAAa;IAEb,MAAM,UAAU,GAAG,mBAAmB,CAAC,KAAK,CAAC,CAAC;IAC9C,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;QACvB,IAAI,mBAAmB,CAAC,GAAG,CAAC,KAAK,UAAU,EAAE,CAAC;YAC5C,OAAO,GAAG,CAAC;QACb,CAAC;IACH,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
|
@@ -7,7 +7,9 @@ export interface ProfileChoiceRef {
|
|
|
7
7
|
}
|
|
8
8
|
export declare function formatProfileChoiceKey(profile: string, choice: string): string;
|
|
9
9
|
/**
|
|
10
|
-
* Parse `profile/choice
|
|
10
|
+
* Parse `profile/choice` (also accepts `profile\choice` on input).
|
|
11
|
+
* Rejects empty segments and keys with more than one separator.
|
|
12
|
+
* Segment names accept `-` or `_` interchangeably at lookup time.
|
|
11
13
|
*/
|
|
12
14
|
export declare function parseProfileChoiceKey(input: string): ProfileChoiceRef | undefined;
|
|
13
15
|
export declare function isProfileChoiceKeyFormat(input: string): boolean;
|
|
@@ -27,9 +29,34 @@ export type StrictProfileInputMatch = {
|
|
|
27
29
|
};
|
|
28
30
|
/**
|
|
29
31
|
* Resolve input to an explicit profile+choice pair.
|
|
30
|
-
* Accepts
|
|
32
|
+
* Accepts `profile/choice` or `profile\choice` composite keys, or shortcuts that pin both fields.
|
|
31
33
|
*/
|
|
32
34
|
export declare function matchStrictProfileInput(registry: Pick<AIProfilesRegistry, "profiles" | "shortcuts">, input: string): StrictProfileInputMatch | undefined;
|
|
33
35
|
export declare function listRegistryProfileChoiceKeys(registry: Pick<AIProfilesRegistry, "profiles">): ProfileChoiceRef[];
|
|
34
36
|
export declare function isKnownProfileChoiceInput(registry: Pick<AIProfilesRegistry, "profiles" | "shortcuts">, input: string): boolean;
|
|
37
|
+
export type BundledProfileInputMatch = {
|
|
38
|
+
kind: "profileChoice";
|
|
39
|
+
profile: string;
|
|
40
|
+
choice: string;
|
|
41
|
+
shortcutKey?: string;
|
|
42
|
+
} | {
|
|
43
|
+
kind: "bareProfile";
|
|
44
|
+
profile: string;
|
|
45
|
+
choice: string;
|
|
46
|
+
} | {
|
|
47
|
+
kind: "alias";
|
|
48
|
+
profile: string;
|
|
49
|
+
choice: string;
|
|
50
|
+
alias: string;
|
|
51
|
+
} | {
|
|
52
|
+
kind: "invalidChoice";
|
|
53
|
+
profile: string;
|
|
54
|
+
choice: string;
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* Bundled profile resolution match: strict keys, shortcuts, bare profiles, and aliases.
|
|
58
|
+
* Bare profiles and aliases resolve to `defaultChoice`.
|
|
59
|
+
*/
|
|
60
|
+
export declare function matchBundledProfileInput(registry: Pick<AIProfilesRegistry, "profiles" | "shortcuts">, input: string): BundledProfileInputMatch | undefined;
|
|
61
|
+
export declare function isKnownProfileInputForRegistry(registry: Pick<AIProfilesRegistry, "profiles" | "shortcuts">, input: string): boolean;
|
|
35
62
|
//# sourceMappingURL=profileChoiceKey.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profileChoiceKey.d.ts","sourceRoot":"","sources":["../src/profileChoiceKey.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"profileChoiceKey.d.ts","sourceRoot":"","sources":["../src/profileChoiceKey.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAErD,+EAA+E;AAC/E,eAAO,MAAM,sBAAsB,EAAG,GAAY,CAAC;AAOnD,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAE9E;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,GAAG,gBAAgB,GAAG,SAAS,CAejF;AAED,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAE/D;AAED,MAAM,MAAM,uBAAuB,GAC/B;IAAE,IAAI,EAAE,eAAe,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAC1D;IAAE,IAAI,EAAE,eAAe,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAC1D;IACE,IAAI,EAAE,UAAU,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AA6BN;;;GAGG;AACH,wBAAgB,uBAAuB,CACrC,QAAQ,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
import { normalizeKey } from "./normalizeKey.js";
|
|
1
|
+
import { normalizeKey, normalizeSegmentKey, resolveSegmentKey, } from "./normalizeKey.js";
|
|
2
|
+
import { matchDiscoveryProfileInput } from "./profileDiscoveryMatch.js";
|
|
2
3
|
/** Separator for the canonical profile+choice lookup key (`cheap/default`). */
|
|
3
4
|
export const PROFILE_CHOICE_KEY_SEP = "/";
|
|
5
|
+
/** Normalize composite input: trim/lowercase and treat `\` like `/`. */
|
|
6
|
+
function normalizeProfileChoiceInput(input) {
|
|
7
|
+
return normalizeKey(input).replace(/\\/g, PROFILE_CHOICE_KEY_SEP);
|
|
8
|
+
}
|
|
4
9
|
export function formatProfileChoiceKey(profile, choice) {
|
|
5
10
|
return `${profile}${PROFILE_CHOICE_KEY_SEP}${choice}`;
|
|
6
11
|
}
|
|
7
12
|
/**
|
|
8
|
-
* Parse `profile/choice
|
|
13
|
+
* Parse `profile/choice` (also accepts `profile\choice` on input).
|
|
14
|
+
* Rejects empty segments and keys with more than one separator.
|
|
15
|
+
* Segment names accept `-` or `_` interchangeably at lookup time.
|
|
9
16
|
*/
|
|
10
17
|
export function parseProfileChoiceKey(input) {
|
|
11
|
-
const normalized =
|
|
18
|
+
const normalized = normalizeProfileChoiceInput(input);
|
|
12
19
|
if (!normalized.includes(PROFILE_CHOICE_KEY_SEP)) {
|
|
13
20
|
return undefined;
|
|
14
21
|
}
|
|
@@ -23,9 +30,29 @@ export function parseProfileChoiceKey(input) {
|
|
|
23
30
|
export function isProfileChoiceKeyFormat(input) {
|
|
24
31
|
return parseProfileChoiceKey(input) !== undefined;
|
|
25
32
|
}
|
|
33
|
+
function resolveProfileChoiceSegments(registry, profileSegment, choiceSegment) {
|
|
34
|
+
const profileKey = resolveSegmentKey(Object.keys(registry.profiles), profileSegment);
|
|
35
|
+
if (!profileKey) {
|
|
36
|
+
return undefined;
|
|
37
|
+
}
|
|
38
|
+
const profile = registry.profiles[profileKey];
|
|
39
|
+
const choiceKey = resolveSegmentKey(Object.keys(profile.choices), choiceSegment);
|
|
40
|
+
if (!choiceKey) {
|
|
41
|
+
return {
|
|
42
|
+
kind: "invalidChoice",
|
|
43
|
+
profile: profileKey,
|
|
44
|
+
choice: normalizeSegmentKey(choiceSegment),
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
return {
|
|
48
|
+
kind: "profileChoice",
|
|
49
|
+
profile: profileKey,
|
|
50
|
+
choice: choiceKey,
|
|
51
|
+
};
|
|
52
|
+
}
|
|
26
53
|
/**
|
|
27
54
|
* Resolve input to an explicit profile+choice pair.
|
|
28
|
-
* Accepts
|
|
55
|
+
* Accepts `profile/choice` or `profile\choice` composite keys, or shortcuts that pin both fields.
|
|
29
56
|
*/
|
|
30
57
|
export function matchStrictProfileInput(registry, input) {
|
|
31
58
|
const key = normalizeKey(input);
|
|
@@ -34,34 +61,23 @@ export function matchStrictProfileInput(registry, input) {
|
|
|
34
61
|
}
|
|
35
62
|
const composite = parseProfileChoiceKey(key);
|
|
36
63
|
if (composite) {
|
|
37
|
-
|
|
38
|
-
|
|
64
|
+
return resolveProfileChoiceSegments(registry, composite.profile, composite.choice);
|
|
65
|
+
}
|
|
66
|
+
const shortcutKey = resolveSegmentKey(Object.keys(registry.shortcuts), key);
|
|
67
|
+
if (shortcutKey) {
|
|
68
|
+
const shortcut = registry.shortcuts[shortcutKey];
|
|
69
|
+
if (!shortcut.choice) {
|
|
39
70
|
return undefined;
|
|
40
71
|
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
kind: "invalidChoice",
|
|
44
|
-
profile: composite.profile,
|
|
45
|
-
choice: composite.choice,
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
return {
|
|
49
|
-
kind: "profileChoice",
|
|
50
|
-
profile: composite.profile,
|
|
51
|
-
choice: composite.choice,
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
const shortcut = registry.shortcuts[key];
|
|
55
|
-
if (shortcut?.choice) {
|
|
56
|
-
const profile = registry.profiles[shortcut.profile];
|
|
57
|
-
if (!profile?.choices[shortcut.choice]) {
|
|
72
|
+
const resolved = resolveProfileChoiceSegments(registry, shortcut.profile, shortcut.choice);
|
|
73
|
+
if (!resolved || resolved.kind === "invalidChoice") {
|
|
58
74
|
return undefined;
|
|
59
75
|
}
|
|
60
76
|
return {
|
|
61
77
|
kind: "shortcut",
|
|
62
|
-
shortcutKey
|
|
63
|
-
profile:
|
|
64
|
-
choice:
|
|
78
|
+
shortcutKey,
|
|
79
|
+
profile: resolved.profile,
|
|
80
|
+
choice: resolved.choice,
|
|
65
81
|
};
|
|
66
82
|
}
|
|
67
83
|
return undefined;
|
|
@@ -78,4 +94,54 @@ export function listRegistryProfileChoiceKeys(registry) {
|
|
|
78
94
|
export function isKnownProfileChoiceInput(registry, input) {
|
|
79
95
|
return matchStrictProfileInput(registry, input) !== undefined;
|
|
80
96
|
}
|
|
97
|
+
/**
|
|
98
|
+
* Bundled profile resolution match: strict keys, shortcuts, bare profiles, and aliases.
|
|
99
|
+
* Bare profiles and aliases resolve to `defaultChoice`.
|
|
100
|
+
*/
|
|
101
|
+
export function matchBundledProfileInput(registry, input) {
|
|
102
|
+
const strict = matchStrictProfileInput(registry, input);
|
|
103
|
+
if (strict) {
|
|
104
|
+
if (strict.kind === "invalidChoice") {
|
|
105
|
+
return strict;
|
|
106
|
+
}
|
|
107
|
+
if (strict.kind === "shortcut") {
|
|
108
|
+
return {
|
|
109
|
+
kind: "profileChoice",
|
|
110
|
+
profile: strict.profile,
|
|
111
|
+
choice: strict.choice,
|
|
112
|
+
shortcutKey: strict.shortcutKey,
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
return {
|
|
116
|
+
kind: "profileChoice",
|
|
117
|
+
profile: strict.profile,
|
|
118
|
+
choice: strict.choice,
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
const discovery = matchDiscoveryProfileInput(registry, input);
|
|
122
|
+
if (!discovery) {
|
|
123
|
+
return undefined;
|
|
124
|
+
}
|
|
125
|
+
const profile = registry.profiles[discovery.profileKey];
|
|
126
|
+
if (!profile) {
|
|
127
|
+
return undefined;
|
|
128
|
+
}
|
|
129
|
+
if (discovery.kind === "alias") {
|
|
130
|
+
return {
|
|
131
|
+
kind: "alias",
|
|
132
|
+
profile: discovery.profileKey,
|
|
133
|
+
choice: profile.defaultChoice,
|
|
134
|
+
alias: discovery.alias,
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
return {
|
|
138
|
+
kind: "bareProfile",
|
|
139
|
+
profile: discovery.profileKey,
|
|
140
|
+
choice: profile.defaultChoice,
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
export function isKnownProfileInputForRegistry(registry, input) {
|
|
144
|
+
const match = matchBundledProfileInput(registry, input);
|
|
145
|
+
return match !== undefined && match.kind !== "invalidChoice";
|
|
146
|
+
}
|
|
81
147
|
//# sourceMappingURL=profileChoiceKey.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profileChoiceKey.js","sourceRoot":"","sources":["../src/profileChoiceKey.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"profileChoiceKey.js","sourceRoot":"","sources":["../src/profileChoiceKey.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,mBAAmB,EACnB,iBAAiB,GAClB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,0BAA0B,EAAE,MAAM,4BAA4B,CAAC;AAGxE,+EAA+E;AAC/E,MAAM,CAAC,MAAM,sBAAsB,GAAG,GAAY,CAAC;AAEnD,wEAAwE;AACxE,SAAS,2BAA2B,CAAC,KAAa;IAChD,OAAO,YAAY,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,sBAAsB,CAAC,CAAC;AACpE,CAAC;AAOD,MAAM,UAAU,sBAAsB,CAAC,OAAe,EAAE,MAAc;IACpE,OAAO,GAAG,OAAO,GAAG,sBAAsB,GAAG,MAAM,EAAE,CAAC;AACxD,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AM,CAAA;CAAE,CAAC;AAEzD,wBAAgB,0BAA0B,CACxC,QAAQ,EAAE,IAAI,CAAC,kBAAkB,EAAE,UAAU,CAAC,EAC9C,KAAK,EAAE,MAAM,GACZ,qBAAqB,GAAG,SAAS,
|
|
1
|
+
{"version":3,"file":"profileDiscoveryMatch.d.ts","sourceRoot":"","sources":["../src/profileDiscoveryMatch.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAErD;;;GAGG;AACH,MAAM,MAAM,qBAAqB,GAC7B;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,GACvC;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAEzD,wBAAgB,0BAA0B,CACxC,QAAQ,EAAE,IAAI,CAAC,kBAAkB,EAAE,UAAU,CAAC,EAC9C,KAAK,EAAE,MAAM,GACZ,qBAAqB,GAAG,SAAS,CAsBnC"}
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import { normalizeKey } from "./normalizeKey.js";
|
|
1
|
+
import { normalizeKey, normalizeSegmentKey, resolveSegmentKey } from "./normalizeKey.js";
|
|
2
2
|
export function matchDiscoveryProfileInput(registry, input) {
|
|
3
3
|
const key = normalizeKey(input);
|
|
4
4
|
if (!key) {
|
|
5
5
|
return undefined;
|
|
6
6
|
}
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
const profileKey = resolveSegmentKey(Object.keys(registry.profiles), key);
|
|
8
|
+
if (profileKey) {
|
|
9
|
+
return { kind: "profile", profileKey };
|
|
9
10
|
}
|
|
10
11
|
for (const [profileKey, profile] of Object.entries(registry.profiles)) {
|
|
11
|
-
if (profile.aliases?.some((alias) =>
|
|
12
|
+
if (profile.aliases?.some((alias) => normalizeSegmentKey(alias) === normalizeSegmentKey(key))) {
|
|
12
13
|
return { kind: "alias", profileKey, alias: key };
|
|
13
14
|
}
|
|
14
15
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profileDiscoveryMatch.js","sourceRoot":"","sources":["../src/profileDiscoveryMatch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"profileDiscoveryMatch.js","sourceRoot":"","sources":["../src/profileDiscoveryMatch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAWzF,MAAM,UAAU,0BAA0B,CACxC,QAA8C,EAC9C,KAAa;IAEb,MAAM,GAAG,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC;IAChC,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,UAAU,GAAG,iBAAiB,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,GAAG,CAAC,CAAC;IAC1E,IAAI,UAAU,EAAE,CAAC;QACf,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,UAAU,EAAE,CAAC;IACzC,CAAC;IAED,KAAK,MAAM,CAAC,UAAU,EAAE,OAAO,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;QACtE,IACE,OAAO,CAAC,OAAO,EAAE,IAAI,CACnB,CAAC,KAAK,EAAE,EAAE,CAAC,mBAAmB,CAAC,KAAK,CAAC,KAAK,mBAAmB,CAAC,GAAG,CAAC,CACnE,EACD,CAAC;YACD,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC;QACnD,CAAC;IACH,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type ResolveProfileInputCoreOptions } from "./resolveProfileInputCore.js";
|
|
2
|
+
import type { ResolvedAIProfile } from "./types.js";
|
|
3
|
+
/**
|
|
4
|
+
* Sync bundled profile+choice resolution — same rules as
|
|
5
|
+
* `resolveAIProfile(input, { source: "bundled", catalogLane })`, without network.
|
|
6
|
+
*
|
|
7
|
+
* Accepts `profile/choice`, shortcuts, bare profiles (`cheap` → `defaultChoice`),
|
|
8
|
+
* and profile aliases.
|
|
9
|
+
*/
|
|
10
|
+
export declare function resolveBundledAIProfile(input: string, options: ResolveProfileInputCoreOptions): ResolvedAIProfile;
|
|
11
|
+
//# sourceMappingURL=resolveBundledAIProfile.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveBundledAIProfile.d.ts","sourceRoot":"","sources":["../src/resolveBundledAIProfile.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,8BAA8B,EACpC,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAEpD;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,8BAA8B,GACtC,iBAAiB,CAInB"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { getBundledRegistry } from "./bundledRegistry.js";
|
|
2
|
+
import { loadBundledModelsCatalog } from "./loader/loadBundledModelsCatalog.js";
|
|
3
|
+
import { resolveProfileInputCore, } from "./resolveProfileInputCore.js";
|
|
4
|
+
/**
|
|
5
|
+
* Sync bundled profile+choice resolution — same rules as
|
|
6
|
+
* `resolveAIProfile(input, { source: "bundled", catalogLane })`, without network.
|
|
7
|
+
*
|
|
8
|
+
* Accepts `profile/choice`, shortcuts, bare profiles (`cheap` → `defaultChoice`),
|
|
9
|
+
* and profile aliases.
|
|
10
|
+
*/
|
|
11
|
+
export function resolveBundledAIProfile(input, options) {
|
|
12
|
+
const registry = getBundledRegistry();
|
|
13
|
+
const catalog = loadBundledModelsCatalog();
|
|
14
|
+
return resolveProfileInputCore(input, options, registry, catalog);
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=resolveBundledAIProfile.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveBundledAIProfile.js","sourceRoot":"","sources":["../src/resolveBundledAIProfile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,wBAAwB,EAAE,MAAM,sCAAsC,CAAC;AAChF,OAAO,EACL,uBAAuB,GAExB,MAAM,8BAA8B,CAAC;AAGtC;;;;;;GAMG;AACH,MAAM,UAAU,uBAAuB,CACrC,KAAa,EACb,OAAuC;IAEvC,MAAM,QAAQ,GAAG,kBAAkB,EAAE,CAAC;IACtC,MAAM,OAAO,GAAG,wBAAwB,EAAE,CAAC;IAC3C,OAAO,uBAAuB,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;AACpE,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ResolvedAIProfile } from "./types.js";
|
|
2
|
+
export interface ResolveBundledCatalogModelOptions {
|
|
3
|
+
useOpenRouter?: boolean;
|
|
4
|
+
}
|
|
5
|
+
export type BundledCatalogModelInput = string | {
|
|
6
|
+
provider: string;
|
|
7
|
+
modelId: string;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Sync bundled catalog resolution for concrete model slugs and gateway wire ids.
|
|
11
|
+
* Use {@link resolveBundledAIProfile} for profile/choice inputs.
|
|
12
|
+
*/
|
|
13
|
+
export declare function resolveBundledCatalogModel(input: BundledCatalogModelInput, options?: ResolveBundledCatalogModelOptions): ResolvedAIProfile;
|
|
14
|
+
//# sourceMappingURL=resolveBundledCatalogModel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveBundledCatalogModel.d.ts","sourceRoot":"","sources":["../src/resolveBundledCatalogModel.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAEpD,MAAM,WAAW,iCAAiC;IAChD,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED,MAAM,MAAM,wBAAwB,GAChC,MAAM,GACN;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAmC1C;;;GAGG;AACH,wBAAgB,0BAA0B,CACxC,KAAK,EAAE,wBAAwB,EAC/B,OAAO,GAAE,iCAAsC,GAC9C,iBAAiB,CA8CnB"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { getBundledRegistry } from "./bundledRegistry.js";
|
|
2
|
+
import { loadBundledModelsCatalog } from "./loader/loadBundledModelsCatalog.js";
|
|
3
|
+
import { AIProfilesError } from "./errors.js";
|
|
4
|
+
import { formatGatewayWireId, gatewayInvokeProvider, isGatewayProvider, normalizeGatewayWireId, } from "./gatewayWireId.js";
|
|
5
|
+
import { buildResolvedModelInput, resolveModelFromInput, } from "./modelInputFallback.js";
|
|
6
|
+
function catalogLookupKey(input) {
|
|
7
|
+
if (typeof input === "string") {
|
|
8
|
+
const gateway = normalizeGatewayWireId(input);
|
|
9
|
+
if (gateway) {
|
|
10
|
+
return {
|
|
11
|
+
lookupInput: gateway.modelId,
|
|
12
|
+
displayInput: formatGatewayWireId(gateway.provider, gateway.modelId),
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
return { lookupInput: input, displayInput: input };
|
|
16
|
+
}
|
|
17
|
+
const provider = input.provider.trim();
|
|
18
|
+
const modelId = input.modelId.trim();
|
|
19
|
+
if (isGatewayProvider(provider)) {
|
|
20
|
+
return {
|
|
21
|
+
lookupInput: modelId,
|
|
22
|
+
displayInput: formatGatewayWireId(provider, modelId),
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
const combined = modelId.includes("/") && !modelId.startsWith(`${provider}/`)
|
|
26
|
+
? `${provider}/${modelId}`
|
|
27
|
+
: modelId.includes("/")
|
|
28
|
+
? modelId
|
|
29
|
+
: `${provider}/${modelId}`;
|
|
30
|
+
return { lookupInput: combined, displayInput: combined };
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Sync bundled catalog resolution for concrete model slugs and gateway wire ids.
|
|
34
|
+
* Use {@link resolveBundledAIProfile} for profile/choice inputs.
|
|
35
|
+
*/
|
|
36
|
+
export function resolveBundledCatalogModel(input, options = {}) {
|
|
37
|
+
const registry = getBundledRegistry();
|
|
38
|
+
const catalog = loadBundledModelsCatalog();
|
|
39
|
+
const { lookupInput, displayInput } = catalogLookupKey(input);
|
|
40
|
+
const match = resolveModelFromInput(lookupInput, catalog);
|
|
41
|
+
if (!match || (match.confidence !== "exact" && match.confidence !== "high")) {
|
|
42
|
+
throw new AIProfilesError("UNKNOWN_MODEL", `Unknown catalog model: ${displayInput}`, { input: displayInput });
|
|
43
|
+
}
|
|
44
|
+
const resolved = buildResolvedModelInput({
|
|
45
|
+
input: displayInput,
|
|
46
|
+
match,
|
|
47
|
+
registry,
|
|
48
|
+
useOpenRouter: options.useOpenRouter,
|
|
49
|
+
});
|
|
50
|
+
if (typeof input === "object" && isGatewayProvider(input.provider)) {
|
|
51
|
+
const useOpenRouter = options.useOpenRouter ?? true;
|
|
52
|
+
if (useOpenRouter) {
|
|
53
|
+
return {
|
|
54
|
+
...resolved,
|
|
55
|
+
provider: gatewayInvokeProvider(input.provider),
|
|
56
|
+
modelId: input.modelId.trim(),
|
|
57
|
+
routing: "openrouter",
|
|
58
|
+
backend: "openrouter",
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
const gateway = typeof input === "string" ? normalizeGatewayWireId(input) : null;
|
|
63
|
+
if (gateway && (options.useOpenRouter ?? true)) {
|
|
64
|
+
return {
|
|
65
|
+
...resolved,
|
|
66
|
+
provider: gateway.provider,
|
|
67
|
+
modelId: gateway.modelId,
|
|
68
|
+
routing: "openrouter",
|
|
69
|
+
backend: "openrouter",
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
return resolved;
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=resolveBundledCatalogModel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveBundledCatalogModel.js","sourceRoot":"","sources":["../src/resolveBundledCatalogModel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,wBAAwB,EAAE,MAAM,sCAAsC,CAAC;AAChF,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EACL,mBAAmB,EACnB,qBAAqB,EACrB,iBAAiB,EACjB,sBAAsB,GACvB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,uBAAuB,EACvB,qBAAqB,GACtB,MAAM,yBAAyB,CAAC;AAWjC,SAAS,gBAAgB,CACvB,KAA+B;IAE/B,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,MAAM,OAAO,GAAG,sBAAsB,CAAC,KAAK,CAAC,CAAC;QAC9C,IAAI,OAAO,EAAE,CAAC;YACZ,OAAO;gBACL,WAAW,EAAE,OAAO,CAAC,OAAO;gBAC5B,YAAY,EAAE,mBAAmB,CAAC,OAAO,CAAC,QAAQ,EAAE,OAAO,CAAC,OAAO,CAAC;aACrE,CAAC;QACJ,CAAC;QACD,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,CAAC;IACrD,CAAC;IAED,MAAM,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;IACvC,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;IACrC,IAAI,iBAAiB,CAAC,QAAQ,CAAC,EAAE,CAAC;QAChC,OAAO;YACL,WAAW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I,iBAAiB,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC;QACnE,MAAM,aAAa,GAAG,OAAO,CAAC,aAAa,IAAI,IAAI,CAAC;QACpD,IAAI,aAAa,EAAE,CAAC;YAClB,OAAO;gBACL,GAAG,QAAQ;gBACX,QAAQ,EAAE,qBAAqB,CAAC,KAAK,CAAC,QAAQ,CAAC;gBAC/C,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE;gBAC7B,OAAO,EAAE,YAAY;gBACrB,OAAO,EAAE,YAAY;aACtB,CAAC;QACJ,CAAC;IACH,CAAC;IAED,MAAM,OAAO,GAAG,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,sBAAsB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IACjF,IAAI,OAAO,IAAI,CAAC,OAAO,CAAC,aAAa,IAAI,IAAI,CAAC,EAAE,CAAC;QAC/C,OAAO;YACL,GAAG,QAAQ;YACX,QAAQ,EAAE,OAAO,CAAC,QAAQ;YAC1B,OAAO,EAAE,OAAO,CAAC,OAAO;YACxB,OAAO,EAAE,YAAY;YACrB,OAAO,EAAE,YAAY;SACtB,CAAC;IACJ,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type BundledCatalogModelInput, type ResolveBundledCatalogModelOptions } from "./resolveBundledCatalogModel.js";
|
|
2
|
+
import type { ResolveProfileInputCoreOptions } from "./resolveProfileInputCore.js";
|
|
3
|
+
import type { ResolvedAIProfile } from "./types.js";
|
|
4
|
+
export type ResolveBundledInput = BundledCatalogModelInput;
|
|
5
|
+
export interface ResolveBundledInputOptions extends ResolveProfileInputCoreOptions, ResolveBundledCatalogModelOptions {
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Unified sync bundled resolver for predict consumers.
|
|
9
|
+
*
|
|
10
|
+
* **Resolution order** (registry keys and catalog ids do not overlap):
|
|
11
|
+
* 1. **String profile input** — when {@link isKnownProfileInput} is true: shortcuts,
|
|
12
|
+
* `profile/choice`, bare profiles, and aliases → bundled registry
|
|
13
|
+
* (requires `options.catalogLane`).
|
|
14
|
+
* 2. **Concrete model** — vendor slugs (`google/gemini-2.5-flash-lite`), gateway wire ids
|
|
15
|
+
* (`openrouter/openai/gpt-5.5`), or `{ provider, modelId }` → bundled catalog.
|
|
16
|
+
*/
|
|
17
|
+
export declare function resolveBundledInput(input: ResolveBundledInput, options: ResolveBundledInputOptions): ResolvedAIProfile;
|
|
18
|
+
//# sourceMappingURL=resolveBundledInput.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveBundledInput.d.ts","sourceRoot":"","sources":["../src/resolveBundledInput.ts"],"names":[],"mappings":"AAIA,OAAO,EAEL,KAAK,wBAAwB,EAC7B,KAAK,iCAAiC,EACvC,MAAM,iCAAiC,CAAC;AACzC,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,8BAA8B,CAAC;AACnF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAEpD,MAAM,MAAM,mBAAmB,GAAG,wBAAwB,CAAC;AAE3D,MAAM,WAAW,0BACf,SAAQ,8BAA8B,EACpC,iCAAiC;CAAG;AAExC;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,mBAAmB,EAC1B,OAAO,EAAE,0BAA0B,GAClC,iBAAiB,CAiBnB"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { AIProfilesError } from "./errors.js";
|
|
2
|
+
import { isKnownProfileInputForRegistry } from "./profileChoiceKey.js";
|
|
3
|
+
import { getBundledRegistry } from "./bundledRegistry.js";
|
|
4
|
+
import { resolveBundledAIProfile } from "./resolveBundledAIProfile.js";
|
|
5
|
+
import { resolveBundledCatalogModel, } from "./resolveBundledCatalogModel.js";
|
|
6
|
+
/**
|
|
7
|
+
* Unified sync bundled resolver for predict consumers.
|
|
8
|
+
*
|
|
9
|
+
* **Resolution order** (registry keys and catalog ids do not overlap):
|
|
10
|
+
* 1. **String profile input** — when {@link isKnownProfileInput} is true: shortcuts,
|
|
11
|
+
* `profile/choice`, bare profiles, and aliases → bundled registry
|
|
12
|
+
* (requires `options.catalogLane`).
|
|
13
|
+
* 2. **Concrete model** — vendor slugs (`google/gemini-2.5-flash-lite`), gateway wire ids
|
|
14
|
+
* (`openrouter/openai/gpt-5.5`), or `{ provider, modelId }` → bundled catalog.
|
|
15
|
+
*/
|
|
16
|
+
export function resolveBundledInput(input, options) {
|
|
17
|
+
if (typeof input === "string") {
|
|
18
|
+
const registry = getBundledRegistry();
|
|
19
|
+
if (isKnownProfileInputForRegistry(registry, input)) {
|
|
20
|
+
if (!options.catalogLane) {
|
|
21
|
+
throw new AIProfilesError("MISSING_CATALOG_LANE", "Profile input requires options.catalogLane (e.g. \"text\", \"image\")", { input });
|
|
22
|
+
}
|
|
23
|
+
return resolveBundledAIProfile(input, options);
|
|
24
|
+
}
|
|
25
|
+
return resolveBundledCatalogModel(input, options);
|
|
26
|
+
}
|
|
27
|
+
return resolveBundledCatalogModel(input, options);
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=resolveBundledInput.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveBundledInput.js","sourceRoot":"","sources":["../src/resolveBundledInput.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,8BAA8B,EAAE,MAAM,uBAAuB,CAAC;AACvE,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EACL,0BAA0B,GAG3B,MAAM,iCAAiC,CAAC;AAUzC;;;;;;;;;GASG;AACH,MAAM,UAAU,mBAAmB,CACjC,KAA0B,EAC1B,OAAmC;IAEnC,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,MAAM,QAAQ,GAAG,kBAAkB,EAAE,CAAC;QACtC,IAAI,8BAA8B,CAAC,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC;YACpD,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC;gBACzB,MAAM,IAAI,eAAe,CACvB,sBAAsB,EACtB,uEAAuE,EACvE,EAAE,KAAK,EAAE,CACV,CAAC;YACJ,CAAC;YACD,OAAO,uBAAuB,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;QACjD,CAAC;QACD,OAAO,0BAA0B,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IACpD,CAAC;IAED,OAAO,0BAA0B,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;AACpD,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { AIProfileWarning, AIProfilesRegistry, ModelsCatalogJson, ResolveAIProfileOptions, ResolvedAIProfile } from "./types.js";
|
|
2
|
+
export type ResolveProfileInputCoreOptions = Omit<ResolveAIProfileOptions, "source" | "refresh" | "includeSecondary">;
|
|
3
|
+
export declare function resolveProfileInputCore(input: string, options: ResolveProfileInputCoreOptions, registry: AIProfilesRegistry, catalog: ModelsCatalogJson, loaderWarnings?: AIProfileWarning[]): ResolvedAIProfile;
|
|
4
|
+
//# sourceMappingURL=resolveProfileInputCore.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveProfileInputCore.d.ts","sourceRoot":"","sources":["../src/resolveProfileInputCore.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EACV,gBAAgB,EAChB,kBAAkB,EAClB,iBAAiB,EACjB,uBAAuB,EACvB,iBAAiB,EAClB,MAAM,YAAY,CAAC;AAEpB,MAAM,MAAM,8BAA8B,GAAG,IAAI,CAC/C,uBAAuB,EACvB,QAAQ,GAAG,SAAS,GAAG,kBAAkB,CAC1C,CAAC;AAEF,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,8BAA8B,EACvC,QAAQ,EAAE,kBAAkB,EAC5B,OAAO,EAAE,iBAAiB,EAC1B,cAAc,GAAE,gBAAgB,EAAO,GACtC,iBAAiB,CA8KnB"}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { buildResolvedProfile } from "./buildResolvedProfile.js";
|
|
2
|
+
import { AIProfilesError } from "./errors.js";
|
|
3
|
+
import { formatProfileChoiceKey, matchBundledProfileInput, } from "./profileChoiceKey.js";
|
|
4
|
+
import { pickProfileChoiceWithConstraints } from "./modalityPolicy.js";
|
|
5
|
+
import { normalizeCostCap } from "./costPolicy.js";
|
|
6
|
+
import { resolveCostTierCap } from "./costTiers.js";
|
|
7
|
+
import { assertOpenRouterCatalogCoverage, assertProfileCatalogLane, } from "./profileCatalogLane.js";
|
|
8
|
+
export function resolveProfileInputCore(input, options, registry, catalog, loaderWarnings = []) {
|
|
9
|
+
if (!options.catalogLane) {
|
|
10
|
+
throw new AIProfilesError("MISSING_CATALOG_LANE", "Profile resolution requires options.catalogLane (e.g. \"text\", \"image\")", { input });
|
|
11
|
+
}
|
|
12
|
+
const match = matchBundledProfileInput(registry, input);
|
|
13
|
+
if (!match) {
|
|
14
|
+
throw new AIProfilesError("UNKNOWN_PROFILE_CHOICE", `Unknown profile/choice key: ${input}. Use "profile/choice" (e.g. "cheap/default"), a shortcut, a profile key, or a profile alias.`, { input });
|
|
15
|
+
}
|
|
16
|
+
if (match.kind === "invalidChoice") {
|
|
17
|
+
throw new AIProfilesError("UNKNOWN_CHOICE", `Unknown choice '${match.choice}' for AI profile '${match.profile}'`, { input, profile: match.profile, choice: match.choice });
|
|
18
|
+
}
|
|
19
|
+
const profileKey = match.profile;
|
|
20
|
+
const requestedChoiceKey = match.choice;
|
|
21
|
+
const matchedShortcut = match.kind === "profileChoice" && match.shortcutKey
|
|
22
|
+
? registry.shortcuts[match.shortcutKey]
|
|
23
|
+
: undefined;
|
|
24
|
+
const profile = registry.profiles[profileKey];
|
|
25
|
+
if (!profile) {
|
|
26
|
+
throw new AIProfilesError("UNKNOWN_PROFILE", `Unknown AI profile: ${profileKey}`, { input, profile: profileKey });
|
|
27
|
+
}
|
|
28
|
+
try {
|
|
29
|
+
assertProfileCatalogLane({
|
|
30
|
+
profileKey,
|
|
31
|
+
profile,
|
|
32
|
+
requestedLane: options.catalogLane,
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
catch (error) {
|
|
36
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
37
|
+
throw new AIProfilesError("CATALOG_LANE_MISMATCH", message, {
|
|
38
|
+
input,
|
|
39
|
+
profile: profileKey,
|
|
40
|
+
catalogLane: options.catalogLane,
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
const costCapPer1M = options.costCapPer1M ??
|
|
44
|
+
resolveCostTierCap(options.costTier, options.costTiers);
|
|
45
|
+
let finalChoiceKey;
|
|
46
|
+
let choice;
|
|
47
|
+
try {
|
|
48
|
+
const picked = pickProfileChoiceWithConstraints(profileKey, profile, {
|
|
49
|
+
choiceKey: requestedChoiceKey,
|
|
50
|
+
allowedProviders: options.allowedProviders,
|
|
51
|
+
preferLeadingVendors: options.preferLeadingVendors ?? true,
|
|
52
|
+
explicitChoiceRequested: true,
|
|
53
|
+
inputModalities: options.inputModalities,
|
|
54
|
+
outputModalities: options.outputModalities,
|
|
55
|
+
costCapPer1M,
|
|
56
|
+
capabilityFilter: options.capabilityFilter,
|
|
57
|
+
focus: options.focus,
|
|
58
|
+
catalog,
|
|
59
|
+
});
|
|
60
|
+
finalChoiceKey = picked.choiceKey;
|
|
61
|
+
choice = picked.choice;
|
|
62
|
+
}
|
|
63
|
+
catch (error) {
|
|
64
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
65
|
+
if (message.includes("allowedProviders")) {
|
|
66
|
+
throw new AIProfilesError("NO_ALLOWED_VENDOR", message, {
|
|
67
|
+
input,
|
|
68
|
+
profile: profileKey,
|
|
69
|
+
choice: requestedChoiceKey,
|
|
70
|
+
allowedProviders: options.allowedProviders,
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
if (message.includes("required modalities")) {
|
|
74
|
+
throw new AIProfilesError("NO_MODALITY_MATCH", message, {
|
|
75
|
+
input,
|
|
76
|
+
profile: profileKey,
|
|
77
|
+
choice: requestedChoiceKey,
|
|
78
|
+
inputModalities: options.inputModalities,
|
|
79
|
+
outputModalities: options.outputModalities,
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
if (message.includes("cost cap")) {
|
|
83
|
+
throw new AIProfilesError("NO_COST_CAP_MATCH", message, {
|
|
84
|
+
input,
|
|
85
|
+
profile: profileKey,
|
|
86
|
+
choice: requestedChoiceKey,
|
|
87
|
+
costCapPer1M,
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
if (message.startsWith("Unknown choice")) {
|
|
91
|
+
throw new AIProfilesError("UNKNOWN_CHOICE", message, {
|
|
92
|
+
input,
|
|
93
|
+
profile: profileKey,
|
|
94
|
+
choice: requestedChoiceKey,
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
throw error;
|
|
98
|
+
}
|
|
99
|
+
if (finalChoiceKey !== requestedChoiceKey) {
|
|
100
|
+
throw new AIProfilesError("CHOICE_SUBSTITUTED", `Explicit choice '${requestedChoiceKey}' was replaced with '${finalChoiceKey}' for profile '${profileKey}'. Use a different profile/choice key or discovery APIs.`, {
|
|
101
|
+
input,
|
|
102
|
+
profile: profileKey,
|
|
103
|
+
choice: requestedChoiceKey,
|
|
104
|
+
resolvedChoice: finalChoiceKey,
|
|
105
|
+
expectedKey: formatProfileChoiceKey(profileKey, requestedChoiceKey),
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
const enforceOpenRouterCatalog = profileKey === "local"
|
|
109
|
+
? options.requireOpenRouterCatalog === true
|
|
110
|
+
: options.requireOpenRouterCatalog !== false;
|
|
111
|
+
if (enforceOpenRouterCatalog) {
|
|
112
|
+
try {
|
|
113
|
+
assertOpenRouterCatalogCoverage({
|
|
114
|
+
profileKey,
|
|
115
|
+
choiceKey: finalChoiceKey,
|
|
116
|
+
choice,
|
|
117
|
+
catalog,
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
catch (error) {
|
|
121
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
122
|
+
throw new AIProfilesError("NO_OPENROUTER_CATALOG", message, {
|
|
123
|
+
input,
|
|
124
|
+
profile: profileKey,
|
|
125
|
+
choice: finalChoiceKey,
|
|
126
|
+
provider: choice.provider,
|
|
127
|
+
modelId: choice.modelId,
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
return buildResolvedProfile({
|
|
132
|
+
input,
|
|
133
|
+
shortcutKey: match.kind === "profileChoice" ? match.shortcutKey : undefined,
|
|
134
|
+
profile,
|
|
135
|
+
choice,
|
|
136
|
+
choiceKey: finalChoiceKey,
|
|
137
|
+
shortcut: matchedShortcut,
|
|
138
|
+
registry,
|
|
139
|
+
loaderWarnings,
|
|
140
|
+
useOpenRouter: options.useOpenRouter,
|
|
141
|
+
catalog,
|
|
142
|
+
costCapApplied: normalizeCostCap(costCapPer1M),
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
//# sourceMappingURL=resolveProfileInputCore.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveProfileInputCore.js","sourceRoot":"","sources":["../src/resolveProfileInputCore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EACL,sBAAsB,EACtB,wBAAwB,GACzB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,gCAAgC,EAAE,MAAM,qBAAqB,CAAC;AACvE,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD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