@x12i/ai-profiles 2.2.2 → 3.1.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 +107 -66
- package/dist/buildResolvedProfile.d.ts +1 -3
- package/dist/buildResolvedProfile.d.ts.map +1 -1
- package/dist/buildResolvedProfile.js +1 -8
- package/dist/buildResolvedProfile.js.map +1 -1
- package/dist/computeRegistryStatistics.d.ts +0 -1
- package/dist/computeRegistryStatistics.d.ts.map +1 -1
- package/dist/computeRegistryStatistics.js +0 -9
- package/dist/computeRegistryStatistics.js.map +1 -1
- package/dist/constants.d.ts +0 -2
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +0 -2
- package/dist/constants.js.map +1 -1
- package/dist/data/models-profiles.json +37 -113
- package/dist/data/models-profiles.schema.json +0 -1
- package/dist/ensureConcreteModel.d.ts +27 -0
- package/dist/ensureConcreteModel.d.ts.map +1 -0
- package/dist/ensureConcreteModel.js +38 -0
- package/dist/ensureConcreteModel.js.map +1 -0
- package/dist/errors.d.ts +1 -1
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js.map +1 -1
- package/dist/formatRegistryStatistics.d.ts.map +1 -1
- package/dist/formatRegistryStatistics.js +0 -2
- package/dist/formatRegistryStatistics.js.map +1 -1
- package/dist/index.d.ts +9 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -5
- package/dist/index.js.map +1 -1
- package/dist/isKnownProfileChoice.d.ts +1 -1
- package/dist/isKnownProfileChoice.js +1 -1
- package/dist/isReasoningModel.d.ts +5 -8
- package/dist/isReasoningModel.d.ts.map +1 -1
- package/dist/isReasoningModel.js +4 -4
- package/dist/isReasoningModel.js.map +1 -1
- package/dist/listAIProfiles.d.ts +1 -1
- package/dist/listAIProfiles.d.ts.map +1 -1
- package/dist/listAIProfiles.js +1 -2
- package/dist/listAIProfiles.js.map +1 -1
- package/dist/loader/combineRegistry.d.ts +2 -2
- package/dist/loader/combineRegistry.d.ts.map +1 -1
- package/dist/loader/combineRegistry.js +2 -3
- package/dist/loader/combineRegistry.js.map +1 -1
- package/dist/loader/loadBundledRegistry.d.ts.map +1 -1
- package/dist/loader/loadBundledRegistry.js +2 -4
- package/dist/loader/loadBundledRegistry.js.map +1 -1
- package/dist/loader/loadRemoteRegistry.d.ts.map +1 -1
- package/dist/loader/loadRemoteRegistry.js +4 -8
- package/dist/loader/loadRemoteRegistry.js.map +1 -1
- package/dist/modelInputFallback.d.ts +1 -0
- package/dist/modelInputFallback.d.ts.map +1 -1
- package/dist/modelInputFallback.js +1 -1
- package/dist/modelInputFallback.js.map +1 -1
- package/dist/normalizeInvokeModel.d.ts +40 -0
- package/dist/normalizeInvokeModel.d.ts.map +1 -0
- package/dist/normalizeInvokeModel.js +176 -0
- package/dist/normalizeInvokeModel.js.map +1 -0
- package/dist/normalizeKey.d.ts +1 -1
- package/dist/normalizeKey.js +1 -1
- package/dist/profileChoiceKey.d.ts +3 -33
- package/dist/profileChoiceKey.d.ts.map +1 -1
- package/dist/profileChoiceKey.js +6 -73
- package/dist/profileChoiceKey.js.map +1 -1
- package/dist/profileDiscovery.d.ts +1 -1
- package/dist/profileDiscovery.d.ts.map +1 -1
- package/dist/profileDiscovery.js +1 -2
- package/dist/profileDiscovery.js.map +1 -1
- package/dist/profileRegistryV3.d.ts.map +1 -1
- package/dist/profileRegistryV3.js +0 -3
- package/dist/profileRegistryV3.js.map +1 -1
- package/dist/resolveAIProfile.d.ts +1 -1
- package/dist/resolveAIProfile.d.ts.map +1 -1
- package/dist/resolveAIProfile.js +2 -7
- package/dist/resolveAIProfile.js.map +1 -1
- package/dist/resolveAIProfileWithCostAlternatives.d.ts.map +1 -1
- package/dist/resolveAIProfileWithCostAlternatives.js +0 -5
- package/dist/resolveAIProfileWithCostAlternatives.js.map +1 -1
- package/dist/resolveBundledAIProfile.d.ts +1 -4
- package/dist/resolveBundledAIProfile.d.ts.map +1 -1
- package/dist/resolveBundledAIProfile.js +1 -4
- package/dist/resolveBundledAIProfile.js.map +1 -1
- package/dist/resolveBundledCatalogModel.d.ts +13 -2
- package/dist/resolveBundledCatalogModel.d.ts.map +1 -1
- package/dist/resolveBundledCatalogModel.js +59 -22
- package/dist/resolveBundledCatalogModel.js.map +1 -1
- package/dist/resolveBundledInput.d.ts +4 -7
- package/dist/resolveBundledInput.d.ts.map +1 -1
- package/dist/resolveBundledInput.js +6 -13
- package/dist/resolveBundledInput.js.map +1 -1
- package/dist/resolveProfileInputCore.d.ts.map +1 -1
- package/dist/resolveProfileInputCore.js +3 -8
- package/dist/resolveProfileInputCore.js.map +1 -1
- package/dist/types.d.ts +1 -34
- package/dist/types.d.ts.map +1 -1
- package/dist/validation/profileIntentPolicy.d.ts +1 -1
- package/dist/validation/profileIntentPolicy.d.ts.map +1 -1
- package/dist/validation/profileIntentPolicy.js +1 -1
- package/dist/validation/profileIntentPolicy.js.map +1 -1
- package/dist/validation/validateModelsProfilesJson.d.ts +1 -2
- package/dist/validation/validateModelsProfilesJson.d.ts.map +1 -1
- package/dist/validation/validateModelsProfilesJson.js +1 -50
- package/dist/validation/validateModelsProfilesJson.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
Resolve AI profile names into concrete model choices. The package ships JSON in `src/data/` as the offline fallback. By default, registry data is fetched from public assets, validated, and cached in memory.
|
|
4
4
|
|
|
5
|
-
> **
|
|
5
|
+
> **v3.0** removes legacy resolution inputs: shortcuts, bare profiles, and aliases. Only four forms are accepted — `profile/choice`, vendor slug, gateway wire, and `{ provider, modelId }`. See [CHANGELOG.md](CHANGELOG.md).
|
|
6
|
+
>
|
|
7
|
+
> **v2.0** (still relevant): every `resolveAIProfile` call must pass `catalogLane` (`"text"`, `"image"`, …). Profile keys `deepseek` and `summarization` are gone — use `vol` and `sum`.
|
|
6
8
|
|
|
7
9
|
## Why AI profiles
|
|
8
10
|
|
|
@@ -31,9 +33,7 @@ Every profile has a **`defaultChoice`** (recommended) and typically **two altern
|
|
|
31
33
|
- **Execution mode** — e.g. `cheap` + `google_floor` with `executionMode: batch` for background bulk work.
|
|
32
34
|
- **Resilience** — swap choice or fall back within the same profile when a provider is down or rate-limited.
|
|
33
35
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
Tasks should declare **requirements** (`profile` + optional `choice`), not model names. Profiles are the vocabulary; choices are how that vocabulary is implemented under different constraints.
|
|
36
|
+
Tasks should declare **requirements** as explicit `profile/choice` keys (e.g. `cheap/default`), not model names. Use discovery APIs (`listAIProfiles`, `resolveAIProfileByTags`) to pick a profile when the caller does not already have a composite key.
|
|
37
37
|
|
|
38
38
|
### Profile catalog (bundled)
|
|
39
39
|
|
|
@@ -81,8 +81,6 @@ Each profile’s `choices` in `models-profiles.json` follow a consistent pattern
|
|
|
81
81
|
| `vision` | `default`, `document_ocr` | General multimodal vs schema OCR from scans/PDFs |
|
|
82
82
|
| `local` | `llama_cpp_gguf`, `transformersjs_default` | **CPU / offline** — GGUF via llama.cpp vs Hugging Face Transformers.js (no cloud LLM) |
|
|
83
83
|
|
|
84
|
-
Bundled **shortcuts** that pin a choice include `cheapest`, `absolute-floor`, `final-answer`, `hard-reason`, `mm-coding`, `fast-cheap`, `cheap-json`, `audit`, `intel-cyber`, `pseo`, `ocr`, and FuncX-style `weak` / `normal` / `strong` / `ultra` (see [Profile matrix](#profile-matrix-funcx-contract)). Shortcut keys are **intent names only** — never vendor or model SKU strings.
|
|
85
|
-
|
|
86
84
|
Every **remote** profile choice must resolve to an active OpenRouter catalog id. Profiles without OpenRouter support are not included (use vendor APIs outside this registry, or add catalog coverage first). The only exception is the **`local`** profile, which is explicitly CPU / self-hosted.
|
|
87
85
|
|
|
88
86
|
### OpenRouter-only and catalog lanes
|
|
@@ -96,7 +94,7 @@ Not every profile is OpenRouter-backed: **`local`** is CPU/self-hosted only (2 c
|
|
|
96
94
|
| `listAIProfiles({ catalogLane: "image" })` | List only lane-matching profiles. |
|
|
97
95
|
|
|
98
96
|
```ts
|
|
99
|
-
await resolveAIProfile("cyber", {
|
|
97
|
+
await resolveAIProfile("cyber/default", {
|
|
100
98
|
catalogLane: "text",
|
|
101
99
|
requireOpenRouterCatalog: true,
|
|
102
100
|
});
|
|
@@ -112,7 +110,7 @@ If you want to restrict model selection by price, you can either set an explicit
|
|
|
112
110
|
import { resolveAIProfile } from "@x12i/ai-profiles";
|
|
113
111
|
|
|
114
112
|
// Tier-based (default tiers: tier1=$0.5/1M output, tier2=$3, tier3=$10, tier4=$30)
|
|
115
|
-
const cheapTier1 = await resolveAIProfile("balanced", {
|
|
113
|
+
const cheapTier1 = await resolveAIProfile("balanced/default", {
|
|
116
114
|
catalogLane: "text",
|
|
117
115
|
costTier: "tier1",
|
|
118
116
|
});
|
|
@@ -183,7 +181,7 @@ const reasoningProfiles = await listAIProfiles({
|
|
|
183
181
|
Every resolved primary and secondary includes a stable boolean:
|
|
184
182
|
|
|
185
183
|
```ts
|
|
186
|
-
const resolved = await resolveAIProfile("cheap", {
|
|
184
|
+
const resolved = await resolveAIProfile("cheap/default", {
|
|
187
185
|
catalogLane: "text",
|
|
188
186
|
includeSecondary: true,
|
|
189
187
|
});
|
|
@@ -206,25 +204,27 @@ npm install @x12i/ai-profiles
|
|
|
206
204
|
|
|
207
205
|
| Export | Sync? | Purpose |
|
|
208
206
|
|--------|-------|---------|
|
|
209
|
-
| `listAIProfiles(options?)` | No (async) | Profile summaries: primary `profile` key,
|
|
210
|
-
| `getAIRegistryStatistics(options?)` | No (async) | Counts: profiles, choices, providers,
|
|
207
|
+
| `listAIProfiles(options?)` | No (async) | Profile summaries: primary `profile` key, tags, choices, defaults |
|
|
208
|
+
| `getAIRegistryStatistics(options?)` | No (async) | Counts: profiles, choices, providers, catalog models, linkage health |
|
|
211
209
|
| `formatRegistryStatistics(stats)` | Yes | Human-readable summary for logs / CLI |
|
|
212
|
-
| `loadAIProfilesRegistry(options?)` | No (async) | Raw profiles
|
|
210
|
+
| `loadAIProfilesRegistry(options?)` | No (async) | Raw profiles registry (`auto` / `remote` / `bundled`, 24h memory cache) |
|
|
213
211
|
| `loadAIProfilesRegistryWithWarnings(options?)` | No (async) | Same as above, plus `warnings[]` (stale cache, bundled fallback, etc.) |
|
|
214
212
|
| `loadModelsCatalog(options?)` | No (async) | Unified models catalog (`auto` / `remote` / `bundled`, same cache pattern as profiles) |
|
|
215
213
|
| `loadBundledModelsCatalog()` | Yes | Package-shipped `models-catalog.json` only |
|
|
216
214
|
| `loadBundledModelsRegistry()` | Yes | Package-shipped `models-registry.json` (linkage index) |
|
|
217
215
|
| `listAIProfileChoices(options?)` | No (async) | List explicit `profile/choice` keys for strict pickers and stored config |
|
|
218
|
-
| `
|
|
219
|
-
| `
|
|
220
|
-
| `
|
|
221
|
-
| `
|
|
222
|
-
| `
|
|
223
|
-
| `
|
|
224
|
-
| `
|
|
216
|
+
| `isKnownProfileChoice(input)` | Yes (bundled only) | Whether input is a known valid `profile/choice` key |
|
|
217
|
+
| `getBundledRegistry()` | Yes | Sync bundled profiles registry (no network) |
|
|
218
|
+
| `resolveBundledAIProfile(input, options)` | Yes | Strict `profile/choice` → model, pricing, runtime (`source: "bundled"`) |
|
|
219
|
+
| `resolveBundledInput(input, options)` | Yes | Unified resolver: `profile/choice` → registry; vendor slug / gateway wire / `{ provider, modelId }` → catalog |
|
|
220
|
+
| `resolveBundledCatalogModel(input, options?)` | Yes | Sync strict catalog resolution (exact/high confidence only) |
|
|
221
|
+
| `ensureConcreteModel(input, options?)` | Yes | String normalizer: `profile/choice` (strict) or concrete model (catalog best-effort) → invoke-time `{ provider, modelId }` |
|
|
222
|
+
| `normalizeInvokeModel(input, options?)` | Yes | Idempotent gateway invoke tuple: strips `openrouter/` display slugs; rejects unresolved `profile/choice` aliases |
|
|
223
|
+
| `resolveAndNormalizeInvokeModel(alias, options)` | No (async) | `resolveAIProfile` → `normalizeInvokeModel` for MAIN / handoff paths |
|
|
224
|
+
| `resolveAndNormalizeBundledInvokeModel(alias, options)` | Yes | Bundled `resolveAIProfile` → `normalizeInvokeModel` (no network) |
|
|
225
225
|
| `lookupBundledCatalogCaps({ provider, modelId })` | Yes | Sync `{ contextWindow, maxOutputTokens, supportsReasoning }` from bundled catalog |
|
|
226
|
-
| `isReasoningModel(input, options?)` | Yes | `true`/`false` for
|
|
227
|
-
| `resolveAIProfile(input, options?)` | No (async) | Resolve an explicit `profile/choice` key
|
|
226
|
+
| `isReasoningModel(input, options?)` | Yes | `true`/`false` for supported inputs (throws `UNKNOWN_MODEL` on unknown concrete models) |
|
|
227
|
+
| `resolveAIProfile(input, options?)` | No (async) | Resolve an explicit `profile/choice` key → model, pricing, runtime. Pass `includeSecondary: true` to attach `secondary`. |
|
|
228
228
|
| `resolveSecondaryModel(input, options?)` | No (async) | Resolve primary choice + optional companion `secondary` from profile `secondary` refs |
|
|
229
229
|
| `getSecondaryForResolvedProfile(resolved, registry, catalog?)` | Yes | Secondary for an already-resolved primary (no extra I/O when catalog is passed) |
|
|
230
230
|
| `listProfileSecondaries(profileKey, registry)` | Yes | List per-choice `secondary` declarations on a profile |
|
|
@@ -272,7 +272,6 @@ Registry JSON lives in four bundled assets:
|
|
|
272
272
|
| `models-profiles.json` | `x12i.ai-profiles.model-registry.v3` | Profile intent, choices, `requiredCapabilities`, `modelStatus` — **no embedded pricing** |
|
|
273
273
|
| `models-catalog.json` | `x12i.ai-profiles.models-catalog` | Per-model pricing, context window, capabilities (OpenRouter-normalized) |
|
|
274
274
|
| `models-registry.json` | `x12i.ai-profiles.models-registry` | Built linkage index: vendor keys, OpenRouter slugs, `invocation` pairs |
|
|
275
|
-
| `profiles-shortcuts.json` | `x12i.ai-profiles.shortcuts` | Named entry points |
|
|
276
275
|
|
|
277
276
|
**v3 contract:** Each profile choice stores only `provider` + **vendor-native** `modelId` as a pointer into `models-catalog.json`, which owns the `direct` and `openrouter` listings. Never embed `api`, `defaultTransport`, or OpenRouter slugs on profile choices. `resolveAIProfile` picks transport via env/options and merges catalog pricing, limits, and capabilities — the client-facing shape is unchanged. Run `npm run registry:finish` to strip legacy fields, verify linkage, and rebuild `models-registry.json`.
|
|
278
277
|
|
|
@@ -284,7 +283,8 @@ For consumers that need **no network** and a single entry point:
|
|
|
284
283
|
|
|
285
284
|
```ts
|
|
286
285
|
import {
|
|
287
|
-
|
|
286
|
+
ensureConcreteModel,
|
|
287
|
+
isKnownProfileChoice,
|
|
288
288
|
isReasoningModel,
|
|
289
289
|
resolveBundledInput,
|
|
290
290
|
resolveBundledAIProfile,
|
|
@@ -294,13 +294,23 @@ import {
|
|
|
294
294
|
getBundledRegistry,
|
|
295
295
|
} from "@x12i/ai-profiles";
|
|
296
296
|
|
|
297
|
-
//
|
|
298
|
-
// 1.
|
|
299
|
-
// 2.
|
|
297
|
+
// Four supported resolution forms:
|
|
298
|
+
// 1. profile/choice → registry (strict)
|
|
299
|
+
// 2. vendor slug → catalog (strict in resolveBundledCatalogModel; best-effort in ensureConcreteModel)
|
|
300
|
+
// 3. gateway wire → catalog
|
|
301
|
+
// 4. { provider, modelId } → catalog
|
|
302
|
+
|
|
303
|
+
ensureConcreteModel("cheap/default");
|
|
304
|
+
// → { provider: "openrouter", modelId: "google/gemini-2.5-flash-lite", profileChoice: { profile: "cheap", choice: "default" } }
|
|
305
|
+
|
|
306
|
+
ensureConcreteModel("google/gemini-2.5-flash-lite");
|
|
307
|
+
// → { provider: "openrouter", modelId: "google/gemini-2.5-flash-lite", matchConfidence: "exact" }
|
|
308
|
+
|
|
309
|
+
ensureConcreteModel("openrouter/openai/gpt-5.5");
|
|
310
|
+
// → { provider: "openrouter", modelId: "openai/gpt-5.5" }
|
|
300
311
|
|
|
301
|
-
if (
|
|
302
|
-
const resolved = resolveBundledInput("cheap", { catalogLane: "text" });
|
|
303
|
-
// → cheap/default, routed provider + modelId, limits, modelSignals.isReasoningModel
|
|
312
|
+
if (isKnownProfileChoice("cheap/default")) {
|
|
313
|
+
const resolved = resolveBundledInput("cheap/default", { catalogLane: "text" });
|
|
304
314
|
}
|
|
305
315
|
|
|
306
316
|
const wire = normalizeGatewayWireId("openrouter/openai/gpt-5.5");
|
|
@@ -308,7 +318,7 @@ const wire = normalizeGatewayWireId("openrouter/openai/gpt-5.5");
|
|
|
308
318
|
|
|
309
319
|
isReasoningModel("deep/default"); // true
|
|
310
320
|
isReasoningModel("cheap/default"); // true (catalog marks gemini-2.5-flash-lite reasoning-capable)
|
|
311
|
-
isReasoningModel("
|
|
321
|
+
isReasoningModel("google/gemini-2.5-flash-lite"); // false
|
|
312
322
|
|
|
313
323
|
const caps = lookupBundledCatalogCaps({
|
|
314
324
|
provider: "openrouter",
|
|
@@ -323,7 +333,7 @@ const routed = applyModelRouting(
|
|
|
323
333
|
);
|
|
324
334
|
```
|
|
325
335
|
|
|
326
|
-
`
|
|
336
|
+
`isKnownProfileChoice` returns **false** for bare profiles (`cheap`), legacy shortcuts (`cheapest`), and concrete slugs (`google/gemini-2.5-flash-lite`).
|
|
327
337
|
|
|
328
338
|
## Basic usage
|
|
329
339
|
|
|
@@ -331,7 +341,6 @@ const routed = applyModelRouting(
|
|
|
331
341
|
import {
|
|
332
342
|
listAIProfiles,
|
|
333
343
|
listAIProfileChoices,
|
|
334
|
-
listAIShortcuts,
|
|
335
344
|
isKnownProfileChoice,
|
|
336
345
|
resolveAIProfile,
|
|
337
346
|
resolveCatalogModel,
|
|
@@ -390,46 +399,78 @@ console.log(formatRegistryStatistics(statistics));
|
|
|
390
399
|
|
|
391
400
|
CLI (after build): `npm run stats` (text) or `npm run stats:json`.
|
|
392
401
|
|
|
393
|
-
##
|
|
402
|
+
## Supported resolution inputs
|
|
394
403
|
|
|
395
|
-
|
|
404
|
+
Resolution accepts exactly **four** input forms:
|
|
396
405
|
|
|
397
|
-
|
|
406
|
+
| Form | Example | Resolver |
|
|
407
|
+
|------|---------|----------|
|
|
408
|
+
| Profile + choice | `cheap/default` | Registry (`resolveAIProfile`, `resolveBundledAIProfile`) |
|
|
409
|
+
| Vendor slug | `google/gemini-2.5-flash-lite` | Catalog (`resolveCatalogModel`, `resolveBundledCatalogModel`) |
|
|
410
|
+
| Gateway wire | `openrouter/openai/gpt-5.5` | Catalog (gateway normalization) |
|
|
411
|
+
| Object | `{ provider: "google", modelId: "gemini-2.5-flash-lite" }` | Catalog |
|
|
398
412
|
|
|
399
|
-
**
|
|
413
|
+
**Not supported:** shortcuts (`cheapest`), bare profiles (`cheap`), aliases (`cost-sensitive`). Use discovery to pick a profile, then resolve an explicit `profile/choice`.
|
|
400
414
|
|
|
401
|
-
|
|
415
|
+
**Tags** are short (2–4 chars), many per profile (`cyb`, `eco`, `ds`, …). Use `listAIProfiles({ tags })` or `resolveAIProfileByTags(['cyb', 'eco'])` for discovery — partial overlap is OK; the profile with the most matching tags wins, then an explicit choice is resolved.
|
|
402
416
|
|
|
403
|
-
|
|
417
|
+
Input is normalized (trimmed, lowercased) before matching. Composite keys accept **`/` or `\`** as the separator (`cyber\default` → `cyber/default`). **Profile and choice segment names treat `-` and `_` as equivalent** (`cheap/google-floor` → `cheap/google_floor`).
|
|
404
418
|
|
|
405
|
-
###
|
|
419
|
+
### Examples
|
|
406
420
|
|
|
407
|
-
|
|
421
|
+
```ts
|
|
422
|
+
// Composite key
|
|
423
|
+
await resolveAIProfile("balanced/default", { catalogLane: "text" });
|
|
408
424
|
|
|
409
|
-
|
|
410
|
-
|
|
425
|
+
// Tag-based pick (partial overlap OK) → explicit profile/choice
|
|
426
|
+
await resolveAIProfileByTags(["cyb", "eco", "ds"], { catalogLane: "text" });
|
|
411
427
|
|
|
412
|
-
|
|
428
|
+
// Model SKU → catalog, not a profile
|
|
429
|
+
await resolveCatalogModel("google/gemini-2.5-flash-lite", { source: "bundled" });
|
|
413
430
|
|
|
414
|
-
|
|
431
|
+
// String normalizer for invoke-time routing
|
|
432
|
+
ensureConcreteModel("cheap/default");
|
|
433
|
+
ensureConcreteModel("google/gemini-2.5-flash-lite");
|
|
434
|
+
```
|
|
415
435
|
|
|
416
|
-
|
|
436
|
+
`listAIProfiles()` returns profile keys, tags, and choices for pickers. `listAIProfileChoices()` lists every valid `profile/choice` composite key.
|
|
437
|
+
|
|
438
|
+
## Invoke wire shape (gateway / HTTP)
|
|
439
|
+
|
|
440
|
+
Downstream packages (`ai-tasks`, `ai-skills`, `ai-gateway`, `xynthesis`, `optimixer`) must agree on what is sent on the wire **after** semantic resolution:
|
|
441
|
+
|
|
442
|
+
| Shape | Example | Use |
|
|
443
|
+
|-------|---------|-----|
|
|
444
|
+
| **Display slug** | `openrouter/deepseek/deepseek-v4-pro` | Studio UI, plan logs, human preview only |
|
|
445
|
+
| **Invoke tuple** | `{ provider: "openrouter", model: "deepseek/deepseek-v4-pro" }` | `ai-gateway` catalog lookup, OpenRouter HTTP, funcx PRE/POST |
|
|
446
|
+
|
|
447
|
+
Call **`normalizeInvokeModel`** at every boundary before catalog lookup or HTTP (idempotent). Profile intent still goes through **`resolveAIProfile`** first (or **`resolveAndNormalizeInvokeModel`** for the combined path).
|
|
417
448
|
|
|
418
449
|
```ts
|
|
419
|
-
|
|
420
|
-
|
|
450
|
+
import {
|
|
451
|
+
normalizeInvokeModel,
|
|
452
|
+
resolveAndNormalizeInvokeModel,
|
|
453
|
+
} from "@x12i/ai-profiles";
|
|
421
454
|
|
|
422
|
-
//
|
|
423
|
-
|
|
455
|
+
// Display slug → invoke tuple (MAIN handoff fix)
|
|
456
|
+
normalizeInvokeModel("openrouter/deepseek/deepseek-v4-pro");
|
|
457
|
+
// → { provider: "openrouter", model: "deepseek/deepseek-v4-pro", routing: "openrouter", displaySlug: "..." }
|
|
424
458
|
|
|
425
|
-
//
|
|
426
|
-
|
|
459
|
+
// Already-correct tuple → unchanged
|
|
460
|
+
normalizeInvokeModel({ provider: "openrouter", model: "deepseek/deepseek-v4-pro" });
|
|
427
461
|
|
|
428
|
-
//
|
|
429
|
-
|
|
462
|
+
// Alias at gateway without resolution → INVOKE_MODEL_ALIAS_AT_GATEWAY
|
|
463
|
+
normalizeInvokeModel("cyber/deep_forensics"); // throws
|
|
464
|
+
|
|
465
|
+
// Profile/choice → resolve, then normalize
|
|
466
|
+
await resolveAndNormalizeInvokeModel("cyber/deep_forensics", {
|
|
467
|
+
catalogLane: "text",
|
|
468
|
+
useOpenRouter: true,
|
|
469
|
+
});
|
|
470
|
+
// → { provider: "openrouter", model: "deepseek/deepseek-v4-pro", ... }
|
|
430
471
|
```
|
|
431
472
|
|
|
432
|
-
`
|
|
473
|
+
Errors: `INVOKE_MODEL_ALIAS_AT_GATEWAY` (unresolved `profile/choice`), `INVOKE_MODEL_SHAPE_INVALID` (unparseable composite or missing provider).
|
|
433
474
|
|
|
434
475
|
## Sync validation (bundled registry)
|
|
435
476
|
|
|
@@ -441,15 +482,15 @@ const canRun =
|
|
|
441
482
|
isKnownProfileChoice(fallbackKey);
|
|
442
483
|
```
|
|
443
484
|
|
|
444
|
-
Accepts
|
|
485
|
+
Accepts **valid `profile/choice` keys only**. Unknown strings return `false`.
|
|
445
486
|
|
|
446
487
|
After validation, call `resolveAIProfile` (usually `source: "auto"` or `"bundled"`) to get the canonical `resolved.profile` and the concrete model details.
|
|
447
488
|
|
|
448
489
|
### UI guidance
|
|
449
490
|
|
|
450
|
-
- **Profile picker**: `await listAIProfiles()` → use each row’s `profile` as the value; show `displayName`
|
|
451
|
-
- **
|
|
452
|
-
- **Stored config**:
|
|
491
|
+
- **Profile picker**: `await listAIProfiles()` → use each row’s `profile` as the value; show `displayName` as the label.
|
|
492
|
+
- **Choice picker**: `await listAIProfileChoices({ profile: "cheap" })` or list choices from the profile summary.
|
|
493
|
+
- **Stored config**: store `profile/choice` composite keys (e.g. `cheap/default`).
|
|
453
494
|
|
|
454
495
|
## Pick a specific model implementation (choice)
|
|
455
496
|
|
|
@@ -486,7 +527,7 @@ await resolveAIProfile("cheap/default", { catalogLane: "text", useOpenRouter: tr
|
|
|
486
527
|
|
|
487
528
|
Registry choices store vendor-native ids (e.g. `gpt-5.4`, `gemini-2.5-flash-lite`). When routing via OpenRouter, this package rewrites them to full slugs: `{vendor}/{model}` (e.g. `openai/gpt-5.4`, `anthropic/claude-sonnet-4.6`). Anthropic version segments are normalized to dotted form (`4.6`, not `4-6`).
|
|
488
529
|
|
|
489
|
-
This applies to
|
|
530
|
+
This applies to any `profile/choice` input that resolves to a remote profile choice.
|
|
490
531
|
|
|
491
532
|
### Avoid hardcoded OpenRouter slugs (especially dated previews)
|
|
492
533
|
|
|
@@ -569,7 +610,8 @@ Tests: `test/resolveModelRouting.test.ts`, `test/modelIdentity.test.ts`, `test/r
|
|
|
569
610
|
## Use bundled only
|
|
570
611
|
|
|
571
612
|
```ts
|
|
572
|
-
const model = await resolveAIProfile("balanced", {
|
|
613
|
+
const model = await resolveAIProfile("balanced/default", {
|
|
614
|
+
catalogLane: "text",
|
|
573
615
|
source: "bundled",
|
|
574
616
|
});
|
|
575
617
|
```
|
|
@@ -577,7 +619,8 @@ const model = await resolveAIProfile("balanced", {
|
|
|
577
619
|
## Force refresh
|
|
578
620
|
|
|
579
621
|
```ts
|
|
580
|
-
const model = await resolveAIProfile("balanced", {
|
|
622
|
+
const model = await resolveAIProfile("balanced/default", {
|
|
623
|
+
catalogLane: "text",
|
|
581
624
|
refresh: true,
|
|
582
625
|
});
|
|
583
626
|
```
|
|
@@ -586,7 +629,7 @@ const model = await resolveAIProfile("balanced", {
|
|
|
586
629
|
|
|
587
630
|
**Default (`source: "auto"`):**
|
|
588
631
|
|
|
589
|
-
1. Fetch `models-profiles.json`
|
|
632
|
+
1. Fetch `models-profiles.json` from the assets URL (see below).
|
|
590
633
|
2. Validate the response; if valid, use it and cache it in process memory for 24 hours.
|
|
591
634
|
3. If fetch or validation fails, use the JSON shipped inside this npm package (bundled fallback).
|
|
592
635
|
4. After TTL, the next call tries fetch again; if that fails but an earlier fetch was cached, reuse the stale cache with a warning.
|
|
@@ -602,13 +645,13 @@ The `version` field in the JSON files (and `registryVersion` on resolved output)
|
|
|
602
645
|
## Remote assets
|
|
603
646
|
|
|
604
647
|
- `https://open-assets.x12i.com/models-profiles.json`
|
|
605
|
-
- `https://open-assets.x12i.com/profiles-shortcuts.json`
|
|
606
648
|
|
|
607
649
|
## Integration example
|
|
608
650
|
|
|
609
651
|
```ts
|
|
610
652
|
const resolved = await resolveAIProfile(
|
|
611
|
-
node.taskConfiguration.aiProfile ?? "balanced"
|
|
653
|
+
node.taskConfiguration.aiProfile ?? "balanced/default",
|
|
654
|
+
{ catalogLane: "text" },
|
|
612
655
|
);
|
|
613
656
|
|
|
614
657
|
const modelConfig = {
|
|
@@ -652,8 +695,6 @@ Default choice per profile (vendor-native ids in registry; OpenRouter slugs when
|
|
|
652
695
|
| `local` | CPU (no OpenRouter) | **`cpu`** | `llama_cpp_gguf` | `funcx:llama-cpp:gguf` |
|
|
653
696
|
| `local` | CPU | **`cpu`** | `transformersjs_default` | `Xenova/distilbart-cnn-6-6` |
|
|
654
697
|
|
|
655
|
-
FuncX mode shortcuts (bundled): `weak` → local, `normal` → balanced, `strong` → pro, `ultra` → deep, `default` → balanced.
|
|
656
|
-
|
|
657
698
|
Local CPU choices expose FuncX env keys in `resolved.metadata` (e.g. `LLAMA_CPP_MODEL_PATH`, `TRANSFORMERS_JS_MODEL_ID`).
|
|
658
699
|
|
|
659
700
|
### OpenRouter model ids
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import type { AIProfileChoice, AIProfileDefinition,
|
|
1
|
+
import type { AIProfileChoice, AIProfileDefinition, AIProfileWarning, AIProfilesRegistry, CostCapPer1M, ModelsCatalogJson, ResolvedAIProfile } from "./types.js";
|
|
2
2
|
interface BuildResolvedProfileInput {
|
|
3
3
|
input: string;
|
|
4
|
-
shortcutKey?: string;
|
|
5
4
|
profile: AIProfileDefinition;
|
|
6
5
|
choice: AIProfileChoice;
|
|
7
6
|
choiceKey: string;
|
|
8
|
-
shortcut?: AIProfileShortcut;
|
|
9
7
|
registry: AIProfilesRegistry;
|
|
10
8
|
loaderWarnings?: AIProfileWarning[];
|
|
11
9
|
useOpenRouter?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildResolvedProfile.d.ts","sourceRoot":"","sources":["../src/buildResolvedProfile.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EACV,eAAe,EACf,mBAAmB,EACnB,
|
|
1
|
+
{"version":3,"file":"buildResolvedProfile.d.ts","sourceRoot":"","sources":["../src/buildResolvedProfile.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EACV,eAAe,EACf,mBAAmB,EACnB,gBAAgB,EAChB,kBAAkB,EAClB,YAAY,EAEZ,iBAAiB,EACjB,iBAAiB,EAClB,MAAM,YAAY,CAAC;AAEpB,UAAU,yBAAyB;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,mBAAmB,CAAC;IAC7B,MAAM,EAAE,eAAe,CAAC;IACxB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,kBAAkB,CAAC;IAC7B,cAAc,CAAC,EAAE,gBAAgB,EAAE,CAAC;IACpC,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,OAAO,CAAC,EAAE,iBAAiB,CAAC;IAC5B,cAAc,CAAC,EAAE,YAAY,CAAC;CAC/B;AA8CD,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,yBAAyB,GAChC,iBAAiB,CAyLnB"}
|
|
@@ -38,7 +38,7 @@ function loadCatalogForEnrichment(catalog) {
|
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
40
|
export function buildResolvedProfile(params) {
|
|
41
|
-
const { input,
|
|
41
|
+
const { input, profile, choice, registry, loaderWarnings = [], useOpenRouter: explicitUseOpenRouter, catalog: catalogInput, } = params;
|
|
42
42
|
const costCapApplied = params.costCapApplied;
|
|
43
43
|
const warnings = [...loaderWarnings];
|
|
44
44
|
const cache = getMemoryCache();
|
|
@@ -180,13 +180,6 @@ export function buildResolvedProfile(params) {
|
|
|
180
180
|
loadedAt: registry.loadedAt,
|
|
181
181
|
expiresAt,
|
|
182
182
|
};
|
|
183
|
-
if (shortcut && shortcutKey) {
|
|
184
|
-
resolved.shortcut = {
|
|
185
|
-
key: shortcutKey,
|
|
186
|
-
profile: shortcut.profile,
|
|
187
|
-
choice: shortcut.choice,
|
|
188
|
-
};
|
|
189
|
-
}
|
|
190
183
|
if (warnings.length > 0) {
|
|
191
184
|
resolved.warnings = warnings;
|
|
192
185
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildResolvedProfile.js","sourceRoot":"","sources":["../src/buildResolvedProfile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAChF,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,EACL,mBAAmB,EACnB,yBAAyB,GAC1B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,wBAAwB,EAAE,MAAM,sCAAsC,CAAC;AAChF,OAAO,EAAE,yBAAyB,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AAC/F,OAAO,EAAE,8BAA8B,EAAE,MAAM,wBAAwB,CAAC;AACxE,OAAO,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AACrE,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EACL,cAAc,EACd,sBAAsB,GACvB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EACL,iBAAiB,EACjB,oBAAoB,GACrB,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"buildResolvedProfile.js","sourceRoot":"","sources":["../src/buildResolvedProfile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAChF,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,EACL,mBAAmB,EACnB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,CAAC;QACvE,MAAM,EAAE,MAAM,CAAC,MAAM;QACrB,MAAM,EAAE,QAAQ,CAAC,MAAM;QACvB,GAAG,CAAC,QAAQ,CAAC,OAAO,KAAK,SAAS;YAChC,CAAC,CAAC,EAAE,eAAe,EAAE,QAAQ,CAAC,OAAO,EAAE;YACvC,CAAC,CAAC,EAAE,CAAC;QACP,QAAQ,EAAE,QAAQ,CAAC,QAAQ;QAC3B,SAAS;KACV,CAAC;IAEF,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACxB,QAAQ,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC/B,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { AIProfilesRegistry, AIRegistryStatistics, ModelsCatalogJson, ModelsProfilesJson, ModelsRegistryJson, ProfileStatisticsFilter } from "./types.js";
|
|
2
2
|
export declare function computeProfilesStatistics(registry: AIProfilesRegistry, filter?: ProfileStatisticsFilter): AIRegistryStatistics["profiles"];
|
|
3
|
-
export declare function computeShortcutsStatistics(registry: AIProfilesRegistry): AIRegistryStatistics["shortcuts"];
|
|
4
3
|
export declare function computeCatalogStatistics(catalog: ModelsCatalogJson): AIRegistryStatistics["catalog"];
|
|
5
4
|
export declare function computeLinkageStatistics(linkageRegistry: ModelsRegistryJson): AIRegistryStatistics["linkage"];
|
|
6
5
|
export declare function buildRegistryStatistics(input: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"computeRegistryStatistics.d.ts","sourceRoot":"","sources":["../src/computeRegistryStatistics.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,kBAAkB,EAElB,oBAAoB,EACpB,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,EAClB,uBAAuB,EACxB,MAAM,YAAY,CAAC;AAmCpB,wBAAgB,yBAAyB,CACvC,QAAQ,EAAE,kBAAkB,EAC5B,MAAM,GAAE,uBAA4B,GACnC,oBAAoB,CAAC,UAAU,CAAC,
|
|
1
|
+
{"version":3,"file":"computeRegistryStatistics.d.ts","sourceRoot":"","sources":["../src/computeRegistryStatistics.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,kBAAkB,EAElB,oBAAoB,EACpB,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,EAClB,uBAAuB,EACxB,MAAM,YAAY,CAAC;AAmCpB,wBAAgB,yBAAyB,CACvC,QAAQ,EAAE,kBAAkB,EAC5B,MAAM,GAAE,uBAA4B,GACnC,oBAAoB,CAAC,UAAU,CAAC,CA2DlC;AAED,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,iBAAiB,GACzB,oBAAoB,CAAC,SAAS,CAAC,CA2CjC;AAED,wBAAgB,wBAAwB,CACtC,eAAe,EAAE,kBAAkB,GAClC,oBAAoB,CAAC,SAAS,CAAC,CAsBjC;AAED,wBAAgB,uBAAuB,CAAC,KAAK,EAAE;IAC7C,QAAQ,EAAE,kBAAkB,CAAC;IAC7B,cAAc,EAAE,QAAQ,GAAG,SAAS,CAAC;IACrC,OAAO,CAAC,EAAE,iBAAiB,CAAC;IAC5B,aAAa,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAC;IACrC,eAAe,CAAC,EAAE,kBAAkB,CAAC;IACrC,MAAM,CAAC,EAAE,uBAAuB,CAAC;CAClC,GAAG,oBAAoB,CA6BvB;AAED,wBAAgB,8BAA8B,CAC5C,QAAQ,EAAE,kBAAkB,EAC5B,OAAO,EAAE,iBAAiB,GACzB,kBAAkB,CAEpB"}
|
|
@@ -27,7 +27,6 @@ export function computeProfilesStatistics(registry, filter = {}) {
|
|
|
27
27
|
const categories = [];
|
|
28
28
|
let profileCount = 0;
|
|
29
29
|
let choiceCount = 0;
|
|
30
|
-
let aliasCount = 0;
|
|
31
30
|
for (const profile of Object.values(registry.profiles)) {
|
|
32
31
|
if (!profilePassesFilter(profile.status, filter)) {
|
|
33
32
|
continue;
|
|
@@ -36,7 +35,6 @@ export function computeProfilesStatistics(registry, filter = {}) {
|
|
|
36
35
|
continue;
|
|
37
36
|
}
|
|
38
37
|
profileCount += 1;
|
|
39
|
-
aliasCount += profile.aliases?.length ?? 0;
|
|
40
38
|
statuses.push(profile.status ?? "active");
|
|
41
39
|
categories.push(profile.category);
|
|
42
40
|
for (const choice of Object.values(profile.choices)) {
|
|
@@ -59,7 +57,6 @@ export function computeProfilesStatistics(registry, filter = {}) {
|
|
|
59
57
|
return {
|
|
60
58
|
total: profileCount,
|
|
61
59
|
choices: choiceCount,
|
|
62
|
-
aliases: aliasCount,
|
|
63
60
|
uniqueProviders: providers.size,
|
|
64
61
|
providers: [...providers].sort((a, b) => a.localeCompare(b)),
|
|
65
62
|
uniqueModelKeys: modelKeys.size,
|
|
@@ -70,11 +67,6 @@ export function computeProfilesStatistics(registry, filter = {}) {
|
|
|
70
67
|
averageChoicesPerProfile: profileCount > 0 ? Math.round((choiceCount / profileCount) * 100) / 100 : 0,
|
|
71
68
|
};
|
|
72
69
|
}
|
|
73
|
-
export function computeShortcutsStatistics(registry) {
|
|
74
|
-
return {
|
|
75
|
-
total: Object.keys(registry.shortcuts).length,
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
70
|
export function computeCatalogStatistics(catalog) {
|
|
79
71
|
const directProviders = new Set();
|
|
80
72
|
let withPricing = 0;
|
|
@@ -146,7 +138,6 @@ export function buildRegistryStatistics(input) {
|
|
|
146
138
|
: {}),
|
|
147
139
|
},
|
|
148
140
|
profiles: computeProfilesStatistics(input.registry, input.filter),
|
|
149
|
-
shortcuts: computeShortcutsStatistics(input.registry),
|
|
150
141
|
registry: {
|
|
151
142
|
version: input.registry.version,
|
|
152
143
|
loadedAt: input.registry.loadedAt,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"computeRegistryStatistics.js","sourceRoot":"","sources":["../src/computeRegistryStatistics.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC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B,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAC1D,CAAC;IAED,IAAI,KAAK,CAAC,eAAe,EAAE,CAAC;QAC1B,KAAK,CAAC,OAAO,GAAG,wBAAwB,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC;IAClE,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAED,MAAM,UAAU,8BAA8B,CAC5C,QAA4B,EAC5B,OAA0B;IAE1B,OAAO,mBAAmB,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,QAAQ,CAAC;AACzD,CAAC"}
|
package/dist/constants.d.ts
CHANGED
|
@@ -2,14 +2,12 @@ import type { AIRuntimeDefaults } from "./types.js";
|
|
|
2
2
|
export declare const DEFAULT_CACHE_TTL_MS: number;
|
|
3
3
|
export declare const DEFAULT_FETCH_TIMEOUT_MS = 5000;
|
|
4
4
|
export declare const REMOTE_MODELS_PROFILES_URL = "https://open-assets.x12i.com/models-profiles.json";
|
|
5
|
-
export declare const REMOTE_PROFILES_SHORTCUTS_URL = "https://open-assets.x12i.com/profiles-shortcuts.json";
|
|
6
5
|
export declare const REMOTE_MODELS_CATALOG_URL = "https://open-assets.x12i.com/models-catalog.json";
|
|
7
6
|
/** Public OpenRouter model list (used by maintainers to regenerate the catalog). */
|
|
8
7
|
export declare const OPENROUTER_MODELS_API_URL = "https://openrouter.ai/api/v1/models";
|
|
9
8
|
export declare const MODELS_PROFILES_SCHEMA_V3: "x12i.ai-profiles.model-registry.v3";
|
|
10
9
|
/** Only v3 registry JSON is accepted (no v1/v2). */
|
|
11
10
|
export declare const MODELS_PROFILES_SCHEMAS: readonly ["x12i.ai-profiles.model-registry.v3"];
|
|
12
|
-
export declare const PROFILES_SHORTCUTS_SCHEMA: "x12i.ai-profiles.shortcuts";
|
|
13
11
|
export declare const INSTRUCTION_TIERS: readonly ["default", "cpu", "reasoning"];
|
|
14
12
|
export declare const AI_PROFILE_BACKENDS: readonly ["openrouter", "llama-cpp", "transformersjs", "custom"];
|
|
15
13
|
/** Canonical media types for model input/output (aligned with OpenRouter catalog). */
|
package/dist/constants.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAEpD,eAAO,MAAM,oBAAoB,QAAsB,CAAC;AACxD,eAAO,MAAM,wBAAwB,OAAO,CAAC;AAE7C,eAAO,MAAM,0BAA0B,sDACc,CAAC;AAEtD,eAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAEpD,eAAO,MAAM,oBAAoB,QAAsB,CAAC;AACxD,eAAO,MAAM,wBAAwB,OAAO,CAAC;AAE7C,eAAO,MAAM,0BAA0B,sDACc,CAAC;AAEtD,eAAO,MAAM,yBAAyB,qDACc,CAAC;AAErD,oFAAoF;AACpF,eAAO,MAAM,yBAAyB,wCACC,CAAC;AAExC,eAAO,MAAM,yBAAyB,EACpC,oCAA6C,CAAC;AAEhD,oDAAoD;AACpD,eAAO,MAAM,uBAAuB,iDAAuC,CAAC;AAC5E,eAAO,MAAM,iBAAiB,0CAA2C,CAAC;AAE1E,eAAO,MAAM,mBAAmB,kEAKtB,CAAC;AAEX,sFAAsF;AACtF,eAAO,MAAM,gBAAgB,sDAMnB,CAAC;AAEX,eAAO,MAAM,wBAAwB,EAAE,QAAQ,CAAC,iBAAiB,CAahE,CAAC"}
|
package/dist/constants.js
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
export const DEFAULT_CACHE_TTL_MS = 24 * 60 * 60 * 1000;
|
|
2
2
|
export const DEFAULT_FETCH_TIMEOUT_MS = 5000;
|
|
3
3
|
export const REMOTE_MODELS_PROFILES_URL = "https://open-assets.x12i.com/models-profiles.json";
|
|
4
|
-
export const REMOTE_PROFILES_SHORTCUTS_URL = "https://open-assets.x12i.com/profiles-shortcuts.json";
|
|
5
4
|
export const REMOTE_MODELS_CATALOG_URL = "https://open-assets.x12i.com/models-catalog.json";
|
|
6
5
|
/** Public OpenRouter model list (used by maintainers to regenerate the catalog). */
|
|
7
6
|
export const OPENROUTER_MODELS_API_URL = "https://openrouter.ai/api/v1/models";
|
|
8
7
|
export const MODELS_PROFILES_SCHEMA_V3 = "x12i.ai-profiles.model-registry.v3";
|
|
9
8
|
/** Only v3 registry JSON is accepted (no v1/v2). */
|
|
10
9
|
export const MODELS_PROFILES_SCHEMAS = [MODELS_PROFILES_SCHEMA_V3];
|
|
11
|
-
export const PROFILES_SHORTCUTS_SCHEMA = "x12i.ai-profiles.shortcuts";
|
|
12
10
|
export const INSTRUCTION_TIERS = ["default", "cpu", "reasoning"];
|
|
13
11
|
export const AI_PROFILE_BACKENDS = [
|
|
14
12
|
"openrouter",
|
package/dist/constants.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,oBAAoB,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AACxD,MAAM,CAAC,MAAM,wBAAwB,GAAG,IAAI,CAAC;AAE7C,MAAM,CAAC,MAAM,0BAA0B,GACrC,mDAAmD,CAAC;AAEtD,MAAM,CAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,oBAAoB,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AACxD,MAAM,CAAC,MAAM,wBAAwB,GAAG,IAAI,CAAC;AAE7C,MAAM,CAAC,MAAM,0BAA0B,GACrC,mDAAmD,CAAC;AAEtD,MAAM,CAAC,MAAM,yBAAyB,GAC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