@x12i/ai-profiles 1.2.5 → 1.4.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 +146 -30
- package/dist/buildResolvedProfile.d.ts +1 -0
- package/dist/buildResolvedProfile.d.ts.map +1 -1
- package/dist/buildResolvedProfile.js +10 -6
- package/dist/buildResolvedProfile.js.map +1 -1
- package/dist/constants.d.ts +0 -9
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +0 -13
- package/dist/constants.js.map +1 -1
- package/dist/data/models-profiles.json +8 -1
- package/dist/data/profiles-shortcuts.json +3 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/isKnownProfileOrShortcut.d.ts +2 -5
- package/dist/isKnownProfileOrShortcut.d.ts.map +1 -1
- package/dist/isKnownProfileOrShortcut.js +4 -15
- package/dist/isKnownProfileOrShortcut.js.map +1 -1
- package/dist/profileInputMatch.d.ts +20 -0
- package/dist/profileInputMatch.d.ts.map +1 -0
- package/dist/profileInputMatch.js +30 -0
- package/dist/profileInputMatch.js.map +1 -0
- package/dist/resolveAIProfile.d.ts.map +1 -1
- package/dist/resolveAIProfile.js +26 -17
- package/dist/resolveAIProfile.js.map +1 -1
- package/dist/resolveModelRouting.d.ts +19 -0
- package/dist/resolveModelRouting.d.ts.map +1 -0
- package/dist/resolveModelRouting.js +71 -0
- package/dist/resolveModelRouting.js.map +1 -0
- package/dist/types.d.ts +12 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/validation/validateModelsProfilesJson.d.ts.map +1 -1
- package/dist/validation/validateModelsProfilesJson.js +1 -7
- package/dist/validation/validateModelsProfilesJson.js.map +1 -1
- package/package.json +4 -1
package/README.md
CHANGED
|
@@ -8,6 +8,20 @@ Resolve AI profile names into concrete model choices. The package ships JSON in
|
|
|
8
8
|
npm install @x12i/ai-profiles
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
+
## Public API
|
|
12
|
+
|
|
13
|
+
| Export | Sync? | Purpose |
|
|
14
|
+
|--------|-------|---------|
|
|
15
|
+
| `listAIProfiles(options?)` | No (async) | Profile summaries: primary `profile` key, `aliases[]`, choices, defaults |
|
|
16
|
+
| `listAIShortcuts()` | Yes | Shortcut table: `{ key, profile, choice?, description? }[]` |
|
|
17
|
+
| `resolveAIProfile(input, options?)` | No (async) | Resolve input → model, pricing, runtime, canonical `profile` key |
|
|
18
|
+
| `resolveUseOpenRouter(explicit?)` | Yes | Resolve OpenRouter vs vendor-direct routing (option → env → default) |
|
|
19
|
+
| `buildOpenRouterModelId(provider, modelId)` | Yes | Build an OpenRouter slug (`openai/gpt-5.4`) from registry fields |
|
|
20
|
+
| `isKnownProfileOrShortcut(input)` | Yes (bundled only) | Whether input is a known primary key, shortcut, or alias |
|
|
21
|
+
| `AIProfilesError` | — | Typed errors (`UNKNOWN_PROFILE`, …) |
|
|
22
|
+
|
|
23
|
+
Registry JSON lives in `models-profiles.json` (profiles + aliases) and `profiles-shortcuts.json` (shortcuts).
|
|
24
|
+
|
|
11
25
|
## Basic usage
|
|
12
26
|
|
|
13
27
|
```ts
|
|
@@ -21,18 +35,54 @@ import {
|
|
|
21
35
|
const profiles = await listAIProfiles();
|
|
22
36
|
const model = await resolveAIProfile("cheap");
|
|
23
37
|
|
|
24
|
-
console.log(model.
|
|
25
|
-
console.log(model.
|
|
38
|
+
console.log(model.profile); // canonical primary key: cheap
|
|
39
|
+
console.log(model.provider); // "openrouter" by default for remote profiles
|
|
40
|
+
console.log(model.modelId); // "google/gemini-2.5-flash-lite"
|
|
41
|
+
console.log(model.routing); // "openrouter" | "direct"
|
|
26
42
|
console.log(model.pricing);
|
|
27
43
|
console.log(model.instructionTier);
|
|
28
44
|
console.log(model.backend);
|
|
29
45
|
```
|
|
30
46
|
|
|
31
|
-
##
|
|
47
|
+
## Naming: many names, one profile
|
|
48
|
+
|
|
49
|
+
Each **profile** has exactly one **primary key** (e.g. `balanced`, `cheap`) and **many aliases** — alternate strings that mean the same profile. Data is in `models-profiles.json` under each profile’s `aliases` array.
|
|
50
|
+
|
|
51
|
+
**Shortcuts** (`profiles-shortcuts.json`) are a second registry of names. A shortcut points at a profile and may pin a specific **choice** (e.g. `cheapest` → `cheap` + `cost_floor`).
|
|
52
|
+
|
|
53
|
+
The same string can appear as both an alias and a shortcut. That is intentional.
|
|
54
|
+
|
|
55
|
+
### Resolution order
|
|
56
|
+
|
|
57
|
+
For `resolveAIProfile(input)` and `isKnownProfileOrShortcut(input)` (bundled path uses the same rules):
|
|
58
|
+
|
|
59
|
+
1. **Primary key** — input matches a profile id → that profile, default choice (unless `options.choice` is set).
|
|
60
|
+
2. **Shortcut** — input matches a shortcut key → shortcut’s profile and choice (shortcut overrides alias when both exist).
|
|
61
|
+
3. **Alias** — input matches an entry in some profile’s `aliases` → that profile, default choice.
|
|
62
|
+
|
|
63
|
+
Input is normalized (trimmed, lowercased) before matching.
|
|
64
|
+
|
|
65
|
+
### Examples
|
|
66
|
+
|
|
67
|
+
```ts
|
|
68
|
+
// Primary key
|
|
69
|
+
await resolveAIProfile("balanced"); // profile: balanced
|
|
32
70
|
|
|
33
|
-
|
|
71
|
+
// Alias only (on cheap in bundled data)
|
|
72
|
+
await resolveAIProfile("cost-sensitive"); // profile: cheap, choice: default
|
|
34
73
|
|
|
35
|
-
|
|
74
|
+
// Alias shared with shortcut — shortcut wins if it pins a choice
|
|
75
|
+
await resolveAIProfile("default"); // profile: balanced (via default shortcut)
|
|
76
|
+
|
|
77
|
+
// Shortcut with explicit choice
|
|
78
|
+
await resolveAIProfile("cheapest"); // profile: cheap, choice: cost_floor
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
`listAIProfiles()` returns each profile’s `aliases` so UIs can show friendly labels. `listAIShortcuts()` lists shortcut keys separately (not duplicated inside `listAIProfiles()`).
|
|
82
|
+
|
|
83
|
+
## Sync validation (bundled registry)
|
|
84
|
+
|
|
85
|
+
Use **`isKnownProfileOrShortcut(input)`** before run/execute or on first paint when the remote registry may not be loaded yet. It reads the **bundled** JSON only (no network, no in-memory cache race).
|
|
36
86
|
|
|
37
87
|
```ts
|
|
38
88
|
const canRun =
|
|
@@ -41,45 +91,97 @@ const canRun =
|
|
|
41
91
|
isKnownProfileOrShortcut(fallbackProfile);
|
|
42
92
|
```
|
|
43
93
|
|
|
44
|
-
|
|
94
|
+
Accepts **primary keys**, **shortcuts**, and **profile aliases**. Unknown strings return `false`.
|
|
95
|
+
|
|
96
|
+
After validation, call `resolveAIProfile` (usually `source: "auto"` or `"bundled"`) to get the canonical `resolved.profile` primary key and model details.
|
|
45
97
|
|
|
46
|
-
###
|
|
98
|
+
### UI guidance
|
|
47
99
|
|
|
48
|
-
- **
|
|
49
|
-
- **Shortcut
|
|
50
|
-
- **
|
|
51
|
-
|
|
52
|
-
|
|
100
|
+
- **Profile picker**: `await listAIProfiles()` → use each row’s `profile` as the value; show `displayName` / `aliases` as labels if helpful.
|
|
101
|
+
- **Shortcut picker** (optional): `listAIShortcuts()` → use `key` as the value.
|
|
102
|
+
- **Stored config**: any accepted name (primary, alias, or shortcut) is valid; prefer primary keys for new data if you want one canonical form in your own schema.
|
|
103
|
+
|
|
104
|
+
## Force a choice
|
|
53
105
|
|
|
54
106
|
```ts
|
|
55
|
-
|
|
107
|
+
const model = await resolveAIProfile("cheap", {
|
|
108
|
+
choice: "safer_provider",
|
|
109
|
+
});
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
## OpenRouter vs vendor-direct routing
|
|
56
113
|
|
|
57
|
-
|
|
58
|
-
|
|
114
|
+
Remote profiles (anything that is not `local` / on-device) can be resolved for **OpenRouter** or for a **vendor API directly**. Local CPU profiles are always returned as-is.
|
|
115
|
+
|
|
116
|
+
### Resolution priority
|
|
117
|
+
|
|
118
|
+
1. **`options.useOpenRouter`** when passed to `resolveAIProfile`
|
|
119
|
+
2. **`USE_OPENROUTER`** in `.env` / process env
|
|
120
|
+
3. **Default: `true`** (OpenRouter)
|
|
121
|
+
|
|
122
|
+
Supported today: **OpenRouter** and **vendor-direct**. Azure and AWS routing are not supported yet.
|
|
123
|
+
|
|
124
|
+
### OpenRouter (default)
|
|
125
|
+
|
|
126
|
+
```ts
|
|
127
|
+
const resolved = await resolveAIProfile("cheap");
|
|
128
|
+
// or explicitly:
|
|
129
|
+
await resolveAIProfile("cheap", { useOpenRouter: true });
|
|
130
|
+
|
|
131
|
+
// resolved.provider === "openrouter"
|
|
132
|
+
// resolved.modelId === "google/gemini-2.5-flash-lite"
|
|
133
|
+
// resolved.routing === "openrouter"
|
|
134
|
+
// resolved.backend === "openrouter"
|
|
59
135
|
```
|
|
60
136
|
|
|
61
|
-
|
|
137
|
+
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`).
|
|
62
138
|
|
|
63
|
-
|
|
139
|
+
This applies to **primary keys, aliases, and shortcuts** — any input that resolves to a remote profile choice.
|
|
64
140
|
|
|
65
|
-
|
|
141
|
+
### Vendor-direct
|
|
66
142
|
|
|
67
143
|
```ts
|
|
68
|
-
const
|
|
144
|
+
const resolved = await resolveAIProfile("cheap", { useOpenRouter: false });
|
|
69
145
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
146
|
+
// resolved.provider === "google"
|
|
147
|
+
// resolved.modelId === "gemini-2.5-flash-lite"
|
|
148
|
+
// resolved.routing === "direct"
|
|
149
|
+
// resolved.backend === "custom"
|
|
73
150
|
```
|
|
74
151
|
|
|
75
|
-
|
|
152
|
+
Use this when calling OpenAI, Anthropic, Google, etc. APIs directly instead of through OpenRouter.
|
|
153
|
+
|
|
154
|
+
### Env fallback
|
|
155
|
+
|
|
156
|
+
Set in `.env` or the process environment:
|
|
157
|
+
|
|
158
|
+
```env
|
|
159
|
+
USE_OPENROUTER=1 # or true, yes, on → OpenRouter
|
|
160
|
+
USE_OPENROUTER=0 # or false, no, off → vendor-direct
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
When `useOpenRouter` is omitted from `resolveAIProfile`, the env value is used. An explicit option always wins over env.
|
|
76
164
|
|
|
77
165
|
```ts
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
166
|
+
process.env.USE_OPENROUTER = "0";
|
|
167
|
+
await resolveAIProfile("cheap"); // vendor-direct
|
|
168
|
+
|
|
169
|
+
await resolveAIProfile("cheap", { useOpenRouter: true }); // still OpenRouter
|
|
81
170
|
```
|
|
82
171
|
|
|
172
|
+
Helper exports:
|
|
173
|
+
|
|
174
|
+
```ts
|
|
175
|
+
import { resolveUseOpenRouter, buildOpenRouterModelId } from "@x12i/ai-profiles";
|
|
176
|
+
|
|
177
|
+
resolveUseOpenRouter(); // true by default
|
|
178
|
+
resolveUseOpenRouter(false); // explicit override
|
|
179
|
+
|
|
180
|
+
buildOpenRouterModelId("openai", "gpt-5.4"); // "openai/gpt-5.4"
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
Tests: `test/resolveModelRouting.test.ts`.
|
|
184
|
+
|
|
83
185
|
## Use bundled only
|
|
84
186
|
|
|
85
187
|
```ts
|
|
@@ -128,6 +230,7 @@ const resolved = await resolveAIProfile(
|
|
|
128
230
|
const modelConfig = {
|
|
129
231
|
provider: resolved.provider,
|
|
130
232
|
model: resolved.modelId,
|
|
233
|
+
routing: resolved.routing,
|
|
131
234
|
instructionTier: resolved.instructionTier,
|
|
132
235
|
backend: resolved.backend,
|
|
133
236
|
temperature: resolved.runtime.temperature,
|
|
@@ -135,6 +238,13 @@ const modelConfig = {
|
|
|
135
238
|
toolPolicy: resolved.runtime.toolPolicy,
|
|
136
239
|
reasoningEffort: resolved.runtime.reasoningEffort,
|
|
137
240
|
};
|
|
241
|
+
|
|
242
|
+
// Default OpenRouter routing:
|
|
243
|
+
// provider: "openrouter", model: "openai/gpt-5.4", routing: "openrouter"
|
|
244
|
+
|
|
245
|
+
// Vendor-direct:
|
|
246
|
+
// await resolveAIProfile(..., { useOpenRouter: false })
|
|
247
|
+
// provider: "openai", model: "gpt-5.4", routing: "direct"
|
|
138
248
|
```
|
|
139
249
|
|
|
140
250
|
## Profile matrix (FuncX contract)
|
|
@@ -149,13 +259,19 @@ const modelConfig = {
|
|
|
149
259
|
| `local` / `llama_cpp_gguf` | CPU | **`cpu`** | `funcx:llama-cpp:gguf` |
|
|
150
260
|
| `local` / `transformersjs_default` | CPU | **`cpu`** | `Xenova/distilbart-cnn-6-6` |
|
|
151
261
|
|
|
152
|
-
|
|
262
|
+
FuncX mode shortcuts (bundled): `weak` → local, `normal` → balanced, `strong` → pro, `ultra` → deep, `default` → balanced.
|
|
153
263
|
|
|
154
264
|
Local CPU choices expose FuncX env keys in `resolved.metadata` (e.g. `LLAMA_CPP_MODEL_PATH`, `TRANSFORMERS_JS_MODEL_ID`).
|
|
155
265
|
|
|
156
266
|
### OpenRouter model ids
|
|
157
267
|
|
|
158
|
-
Remote profile choices use vendor-native `modelId` values (e.g. `gpt-5.4`, `gemini-2.5-flash-lite`).
|
|
268
|
+
Remote profile choices in `models-profiles.json` use vendor-native `modelId` values (e.g. `gpt-5.4`, `gemini-2.5-flash-lite`). By default, `resolveAIProfile` returns OpenRouter-ready output:
|
|
269
|
+
|
|
270
|
+
- `provider`: `"openrouter"`
|
|
271
|
+
- `modelId`: full slug such as `openai/gpt-5.4`
|
|
272
|
+
- `routing`: `"openrouter"`
|
|
273
|
+
|
|
274
|
+
Pass `useOpenRouter: false` (or `USE_OPENROUTER=0`) to get vendor-native `provider` + `modelId` for direct API calls. `@x12i/ai-tools` can still remap deprecated OpenRouter ids when the bundled catalog is stale.
|
|
159
275
|
|
|
160
276
|
### Keeping models aligned over time
|
|
161
277
|
|
|
@@ -170,7 +286,7 @@ npm run verify:openrouter # bundled profiles vs ai-tools catalog (sibling
|
|
|
170
286
|
npm run verify:openrouter:live # same vs live open-assets catalog (pre-release)
|
|
171
287
|
```
|
|
172
288
|
|
|
173
|
-
Unit tests in `test/openrouterAlignment.test.ts` guard resolution rules offline. Use `verify:openrouter` when updating profile model ids; use `verify:openrouter:live` after refreshing [open-assets](https://open-assets.x12i.com/openrouter-models-catalog.json).
|
|
289
|
+
Unit tests in `test/openrouterAlignment.test.ts` and `test/resolveModelRouting.test.ts` guard resolution rules offline. Use `verify:openrouter` when updating profile model ids; use `verify:openrouter:live` after refreshing [open-assets](https://open-assets.x12i.com/openrouter-models-catalog.json).
|
|
174
290
|
|
|
175
291
|
Vendor-direct-only choices (not routed via OpenRouter) can opt out:
|
|
176
292
|
|
|
@@ -181,7 +297,7 @@ Vendor-direct-only choices (not routed via OpenRouter) can opt out:
|
|
|
181
297
|
## Tests
|
|
182
298
|
|
|
183
299
|
```bash
|
|
184
|
-
npm test # build + full suite
|
|
300
|
+
npm test # build + full suite
|
|
185
301
|
npm run test:unit # source tests only (skip integration/exports)
|
|
186
302
|
npm run test:integration # integration + dist export smoke tests
|
|
187
303
|
npm run pack:check # dry-run npm tarball contents
|
|
@@ -7,6 +7,7 @@ interface BuildResolvedProfileInput {
|
|
|
7
7
|
shortcut?: AIProfileShortcut;
|
|
8
8
|
registry: AIProfilesRegistry;
|
|
9
9
|
loaderWarnings?: AIProfileWarning[];
|
|
10
|
+
useOpenRouter?: boolean;
|
|
10
11
|
}
|
|
11
12
|
export declare function buildResolvedProfile(params: BuildResolvedProfileInput): ResolvedAIProfile;
|
|
12
13
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildResolvedProfile.d.ts","sourceRoot":"","sources":["../src/buildResolvedProfile.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"buildResolvedProfile.d.ts","sourceRoot":"","sources":["../src/buildResolvedProfile.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EACV,eAAe,EACf,mBAAmB,EACnB,iBAAiB,EACjB,gBAAgB,EAChB,kBAAkB,EAClB,iBAAiB,EAClB,MAAM,YAAY,CAAC;AAEpB,UAAU,yBAAyB;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,mBAAmB,CAAC;IAC7B,MAAM,EAAE,eAAe,CAAC;IACxB,QAAQ,CAAC,EAAE,iBAAiB,CAAC;IAC7B,QAAQ,EAAE,kBAAkB,CAAC;IAC7B,cAAc,CAAC,EAAE,gBAAgB,EAAE,CAAC;IACpC,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,yBAAyB,GAChC,iBAAiB,CA2GnB"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { DEFAULT_CACHE_TTL_MS, DEFAULT_RUNTIME_DEFAULTS } from "./constants.js";
|
|
2
2
|
import { getMemoryCache } from "./loader/memoryCache.js";
|
|
3
3
|
import { resolveBackend, resolveInstructionTier, } from "./resolveInstructionTierAndBackend.js";
|
|
4
|
+
import { applyModelRouting, resolveUseOpenRouter, } from "./resolveModelRouting.js";
|
|
4
5
|
export function buildResolvedProfile(params) {
|
|
5
|
-
const { input, shortcutKey, profile, choice, shortcut, registry, loaderWarnings = [], } = params;
|
|
6
|
+
const { input, shortcutKey, profile, choice, shortcut, registry, loaderWarnings = [], useOpenRouter: explicitUseOpenRouter, } = params;
|
|
6
7
|
const warnings = [...loaderWarnings];
|
|
7
8
|
const cache = getMemoryCache();
|
|
8
9
|
const cacheLoadedAt = cache?.loadedAt ?? Date.parse(registry.loadedAt);
|
|
@@ -38,11 +39,13 @@ export function buildResolvedProfile(params) {
|
|
|
38
39
|
...(choice.runtime ?? {}),
|
|
39
40
|
};
|
|
40
41
|
const instructionTier = resolveInstructionTier(profile, mergedRuntime.instructionTier);
|
|
41
|
-
const
|
|
42
|
+
const resolvedBackend = resolveBackend(profile, choice, mergedRuntime.backend);
|
|
43
|
+
const useOpenRouter = resolveUseOpenRouter(explicitUseOpenRouter);
|
|
44
|
+
const routed = applyModelRouting(choice, resolvedBackend, useOpenRouter);
|
|
42
45
|
const runtime = {
|
|
43
46
|
...mergedRuntime,
|
|
44
47
|
instructionTier,
|
|
45
|
-
backend,
|
|
48
|
+
backend: routed.backend,
|
|
46
49
|
};
|
|
47
50
|
const resolved = {
|
|
48
51
|
input,
|
|
@@ -53,10 +56,11 @@ export function buildResolvedProfile(params) {
|
|
|
53
56
|
choice: choice.choice,
|
|
54
57
|
choiceDisplayName: choice.displayName,
|
|
55
58
|
choiceDescription: choice.description,
|
|
56
|
-
provider:
|
|
57
|
-
modelId:
|
|
59
|
+
provider: routed.provider,
|
|
60
|
+
modelId: routed.modelId,
|
|
61
|
+
routing: routed.routing,
|
|
58
62
|
instructionTier,
|
|
59
|
-
backend,
|
|
63
|
+
backend: routed.backend,
|
|
60
64
|
pricing,
|
|
61
65
|
runtime,
|
|
62
66
|
...(choice.metadata !== undefined ? { metadata: choice.metadata } : {}),
|
|
@@ -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,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EACL,cAAc,EACd,sBAAsB,GACvB,MAAM,uCAAuC,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,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EACL,cAAc,EACd,sBAAsB,GACvB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EACL,iBAAiB,EACjB,oBAAoB,G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AAC,MAAM,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,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,IAAI,WAAW,EAAE,CAAC;QAC5B,QAAQ,CAAC,QAAQ,GAAG;YAClB,GAAG,EAAE,WAAW;YAChB,OAAO,EAAE,QAAQ,CAAC,OAAO;YACzB,MAAM,EAAE,QAAQ,CAAC,MAAM;SACxB,CAAC;IACJ,CAAC;IAED,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACxB,QAAQ,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC/B,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
package/dist/constants.d.ts
CHANGED
|
@@ -5,15 +5,6 @@ export declare const REMOTE_MODELS_PROFILES_URL = "https://open-assets.x12i.com/
|
|
|
5
5
|
export declare const REMOTE_PROFILES_SHORTCUTS_URL = "https://open-assets.x12i.com/profiles-shortcuts.json";
|
|
6
6
|
export declare const MODELS_PROFILES_SCHEMA: "x12i.ai-profiles.models-profiles";
|
|
7
7
|
export declare const PROFILES_SHORTCUTS_SCHEMA: "x12i.ai-profiles.shortcuts";
|
|
8
|
-
/** Reserved keys — not valid profile or shortcut identifiers. */
|
|
9
|
-
export declare const RESERVED_PROFILE_KEYS: readonly ["default"];
|
|
10
|
-
/**
|
|
11
|
-
* Legacy graph-engine profile tokens. Forbidden on `profile.aliases` and as
|
|
12
|
-
* primary keys; use `legacyGraphEngineAliasMap` for one-time graph JSON migration.
|
|
13
|
-
*/
|
|
14
|
-
export declare const LEGACY_GRAPH_ENGINE_ALIAS_KEYS: readonly ["default", "strong", "weak"];
|
|
15
|
-
/** Must not appear on any profile `aliases` array. */
|
|
16
|
-
export declare const FORBIDDEN_PROFILE_ALIASES: readonly ["default", "strong", "weak"];
|
|
17
8
|
export declare const INSTRUCTION_TIERS: readonly ["default", "cpu", "reasoning"];
|
|
18
9
|
export declare const AI_PROFILE_BACKENDS: readonly ["openrouter", "llama-cpp", "transformersjs", "custom"];
|
|
19
10
|
export declare const DEFAULT_RUNTIME_DEFAULTS: Required<AIRuntimeDefaults>;
|
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,6BAA6B,yDACc,CAAC;AAEzD,eAAO,MAAM,sBAAsB,EAAG,kCAA2C,CAAC;AAClF,eAAO,MAAM,yBAAyB,EAAG,4BAAqC,CAAC;AAE/E,
|
|
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,6BAA6B,yDACc,CAAC;AAEzD,eAAO,MAAM,sBAAsB,EAAG,kCAA2C,CAAC;AAClF,eAAO,MAAM,yBAAyB,EAAG,4BAAqC,CAAC;AAE/E,eAAO,MAAM,iBAAiB,0CAA2C,CAAC;AAE1E,eAAO,MAAM,mBAAmB,kEAKtB,CAAC;AAEX,eAAO,MAAM,wBAAwB,EAAE,QAAQ,CAAC,iBAAiB,CAahE,CAAC"}
|
package/dist/constants.js
CHANGED
|
@@ -4,19 +4,6 @@ export const REMOTE_MODELS_PROFILES_URL = "https://open-assets.x12i.com/models-p
|
|
|
4
4
|
export const REMOTE_PROFILES_SHORTCUTS_URL = "https://open-assets.x12i.com/profiles-shortcuts.json";
|
|
5
5
|
export const MODELS_PROFILES_SCHEMA = "x12i.ai-profiles.models-profiles";
|
|
6
6
|
export const PROFILES_SHORTCUTS_SCHEMA = "x12i.ai-profiles.shortcuts";
|
|
7
|
-
/** Reserved keys — not valid profile or shortcut identifiers. */
|
|
8
|
-
export const RESERVED_PROFILE_KEYS = ["default"];
|
|
9
|
-
/**
|
|
10
|
-
* Legacy graph-engine profile tokens. Forbidden on `profile.aliases` and as
|
|
11
|
-
* primary keys; use `legacyGraphEngineAliasMap` for one-time graph JSON migration.
|
|
12
|
-
*/
|
|
13
|
-
export const LEGACY_GRAPH_ENGINE_ALIAS_KEYS = [
|
|
14
|
-
"default",
|
|
15
|
-
"strong",
|
|
16
|
-
"weak",
|
|
17
|
-
];
|
|
18
|
-
/** Must not appear on any profile `aliases` array. */
|
|
19
|
-
export const FORBIDDEN_PROFILE_ALIASES = LEGACY_GRAPH_ENGINE_ALIAS_KEYS;
|
|
20
7
|
export const INSTRUCTION_TIERS = ["default", "cpu", "reasoning"];
|
|
21
8
|
export const AI_PROFILE_BACKENDS = [
|
|
22
9
|
"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,M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|
@@ -160,6 +160,7 @@
|
|
|
160
160
|
"description": "Default model selection for normal graph execution.",
|
|
161
161
|
"category": "standard",
|
|
162
162
|
"aliases": [
|
|
163
|
+
"default",
|
|
163
164
|
"standard",
|
|
164
165
|
"normal"
|
|
165
166
|
],
|
|
@@ -310,7 +311,8 @@
|
|
|
310
311
|
"aliases": [
|
|
311
312
|
"premium",
|
|
312
313
|
"best",
|
|
313
|
-
"highest-quality"
|
|
314
|
+
"highest-quality",
|
|
315
|
+
"strong"
|
|
314
316
|
],
|
|
315
317
|
"defaultChoice": "default",
|
|
316
318
|
"choices": {
|
|
@@ -629,6 +631,11 @@
|
|
|
629
631
|
"displayName": "Local / CPU",
|
|
630
632
|
"description": "On-device inference via FuncX CPU backends. No OpenRouter. Uses cpu instruction tier.",
|
|
631
633
|
"category": "local",
|
|
634
|
+
"aliases": [
|
|
635
|
+
"weak",
|
|
636
|
+
"offline",
|
|
637
|
+
"on-device"
|
|
638
|
+
],
|
|
632
639
|
"defaultChoice": "llama_cpp_gguf",
|
|
633
640
|
"choices": {
|
|
634
641
|
"llama_cpp_gguf": {
|
package/dist/index.d.ts
CHANGED
|
@@ -2,9 +2,9 @@ export { listAIProfiles } from "./listAIProfiles.js";
|
|
|
2
2
|
export { listAIShortcuts } from "./listAIShortcuts.js";
|
|
3
3
|
export { resolveAIProfile } from "./resolveAIProfile.js";
|
|
4
4
|
export { isKnownProfileOrShortcut } from "./isKnownProfileOrShortcut.js";
|
|
5
|
-
export {
|
|
6
|
-
export type { LegacyGraphEngineAliasKey } from "./legacyGraphEngineAliasMap.js";
|
|
5
|
+
export { resolveUseOpenRouter, readUseOpenRouterFromEnv, buildOpenRouterModelId, } from "./resolveModelRouting.js";
|
|
7
6
|
export type { AIProfilesRegistry, AIProfileDefinition, AIProfileChoice, AIProfileShortcut, AIProfileSummary, AIShortcutSummary, ResolvedAIProfile, ListAIProfilesOptions, ResolveAIProfileOptions, AIProvider, AIModelPricing, AIRuntimeDefaults, AIProfileBackend, AIProfileWarning, InstructionTier, RegistrySourceMode, } from "./types.js";
|
|
7
|
+
export type { AIModelRoutingMode } from "./resolveModelRouting.js";
|
|
8
8
|
export { AIProfilesError } from "./errors.js";
|
|
9
9
|
export type { AIProfilesErrorCode } from "./errors.js";
|
|
10
10
|
//# 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,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,EACL,
|
|
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,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,EACL,oBAAoB,EACpB,wBAAwB,EACxB,sBAAsB,GACvB,MAAM,0BAA0B,CAAC;AAElC,YAAY,EACV,kBAAkB,EAClB,mBAAmB,EACnB,eAAe,EACf,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,EACjB,iBAAiB,EACjB,qBAAqB,EACrB,uBAAuB,EACvB,UAAU,EACV,cAAc,EACd,iBAAiB,EACjB,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,EACf,kBAAkB,GACnB,MAAM,YAAY,CAAC;AAEpB,YAAY,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAEnE,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,YAAY,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -2,6 +2,6 @@ export { listAIProfiles } from "./listAIProfiles.js";
|
|
|
2
2
|
export { listAIShortcuts } from "./listAIShortcuts.js";
|
|
3
3
|
export { resolveAIProfile } from "./resolveAIProfile.js";
|
|
4
4
|
export { isKnownProfileOrShortcut } from "./isKnownProfileOrShortcut.js";
|
|
5
|
-
export {
|
|
5
|
+
export { resolveUseOpenRouter, readUseOpenRouterFromEnv, buildOpenRouterModelId, } from "./resolveModelRouting.js";
|
|
6
6
|
export { AIProfilesError } from "./errors.js";
|
|
7
7
|
//# 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;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,EACL,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,EACL,oBAAoB,EACpB,wBAAwB,EACxB,sBAAsB,GACvB,MAAM,0BAA0B,CAAC;AAuBlC,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Returns true when `input` matches a profile primary key or
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* Profile aliases (see `listAIProfiles`) are not primary keys and are not
|
|
6
|
-
* accepted here unless the same string is also a shortcut key.
|
|
2
|
+
* Returns true when `input` matches a profile primary key, shortcut, or alias.
|
|
3
|
+
* Sync — bundled registry only, safe on first paint.
|
|
7
4
|
*/
|
|
8
5
|
export declare function isKnownProfileOrShortcut(input: string): boolean;
|
|
9
6
|
//# sourceMappingURL=isKnownProfileOrShortcut.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isKnownProfileOrShortcut.d.ts","sourceRoot":"","sources":["../src/isKnownProfileOrShortcut.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"isKnownProfileOrShortcut.d.ts","sourceRoot":"","sources":["../src/isKnownProfileOrShortcut.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAG/D"}
|
|
@@ -1,22 +1,11 @@
|
|
|
1
1
|
import { getBundledRegistry } from "./bundledRegistry.js";
|
|
2
|
-
import {
|
|
3
|
-
import { normalizeKey } from "./normalizeKey.js";
|
|
2
|
+
import { matchProfileInput } from "./profileInputMatch.js";
|
|
4
3
|
/**
|
|
5
|
-
* Returns true when `input` matches a profile primary key or
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* Profile aliases (see `listAIProfiles`) are not primary keys and are not
|
|
9
|
-
* accepted here unless the same string is also a shortcut key.
|
|
4
|
+
* Returns true when `input` matches a profile primary key, shortcut, or alias.
|
|
5
|
+
* Sync — bundled registry only, safe on first paint.
|
|
10
6
|
*/
|
|
11
7
|
export function isKnownProfileOrShortcut(input) {
|
|
12
|
-
const key = normalizeKey(input);
|
|
13
|
-
if (!key) {
|
|
14
|
-
return false;
|
|
15
|
-
}
|
|
16
|
-
if (RESERVED_PROFILE_KEYS.includes(key)) {
|
|
17
|
-
return false;
|
|
18
|
-
}
|
|
19
8
|
const registry = getBundledRegistry();
|
|
20
|
-
return
|
|
9
|
+
return matchProfileInput(registry, input) !== undefined;
|
|
21
10
|
}
|
|
22
11
|
//# sourceMappingURL=isKnownProfileOrShortcut.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isKnownProfileOrShortcut.js","sourceRoot":"","sources":["../src/isKnownProfileOrShortcut.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"isKnownProfileOrShortcut.js","sourceRoot":"","sources":["../src/isKnownProfileOrShortcut.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAE3D;;;GAGG;AACH,MAAM,UAAU,wBAAwB,CAAC,KAAa;IACpD,MAAM,QAAQ,GAAG,kBAAkB,EAAE,CAAC;IACtC,OAAO,iBAAiB,CAAC,QAAQ,EAAE,KAAK,CAAC,KAAK,SAAS,CAAC;AAC1D,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { AIProfileShortcut, AIProfilesRegistry } from "./types.js";
|
|
2
|
+
export type ProfileInputMatch = {
|
|
3
|
+
kind: "profile";
|
|
4
|
+
profileKey: string;
|
|
5
|
+
} | {
|
|
6
|
+
kind: "shortcut";
|
|
7
|
+
profileKey: string;
|
|
8
|
+
shortcutKey: string;
|
|
9
|
+
shortcut: AIProfileShortcut;
|
|
10
|
+
} | {
|
|
11
|
+
kind: "alias";
|
|
12
|
+
profileKey: string;
|
|
13
|
+
alias: string;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Resolves user input to a profile: primary key, shortcut (optional choice), or alias.
|
|
17
|
+
* Shortcuts take precedence over aliases when the same string appears in both.
|
|
18
|
+
*/
|
|
19
|
+
export declare function matchProfileInput(registry: Pick<AIProfilesRegistry, "profiles" | "shortcuts">, input: string): ProfileInputMatch | undefined;
|
|
20
|
+
//# sourceMappingURL=profileInputMatch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profileInputMatch.d.ts","sourceRoot":"","sources":["../src/profileInputMatch.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAExE,MAAM,MAAM,iBAAiB,GACzB;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,GACvC;IACE,IAAI,EAAE,UAAU,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,iBAAiB,CAAC;CAC7B,GACD;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAEzD;;;GAGG;AACH,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,IAAI,CAAC,kBAAkB,EAAE,UAAU,GAAG,WAAW,CAAC,EAC5D,KAAK,EAAE,MAAM,GACZ,iBAAiB,GAAG,SAAS,CA6B/B"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { normalizeKey } from "./normalizeKey.js";
|
|
2
|
+
/**
|
|
3
|
+
* Resolves user input to a profile: primary key, shortcut (optional choice), or alias.
|
|
4
|
+
* Shortcuts take precedence over aliases when the same string appears in both.
|
|
5
|
+
*/
|
|
6
|
+
export function matchProfileInput(registry, input) {
|
|
7
|
+
const key = normalizeKey(input);
|
|
8
|
+
if (!key) {
|
|
9
|
+
return undefined;
|
|
10
|
+
}
|
|
11
|
+
if (registry.profiles[key]) {
|
|
12
|
+
return { kind: "profile", profileKey: key };
|
|
13
|
+
}
|
|
14
|
+
const shortcut = registry.shortcuts[key];
|
|
15
|
+
if (shortcut) {
|
|
16
|
+
return {
|
|
17
|
+
kind: "shortcut",
|
|
18
|
+
profileKey: shortcut.profile,
|
|
19
|
+
shortcutKey: key,
|
|
20
|
+
shortcut,
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
for (const [profileKey, profile] of Object.entries(registry.profiles)) {
|
|
24
|
+
if (profile.aliases?.some((alias) => normalizeKey(alias) === key)) {
|
|
25
|
+
return { kind: "alias", profileKey, alias: key };
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return undefined;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=profileInputMatch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profileInputMatch.js","sourceRoot":"","sources":["../src/profileInputMatch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAajD;;;GAGG;AACH,MAAM,UAAU,iBAAiB,CAC/B,QAA4D,EAC5D,KAAa;IAEb,MAAM,GAAG,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC;IAEhC,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,IAAI,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QAC3B,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,UAAU,EAAE,GAAG,EAAE,CAAC;IAC9C,CAAC;IAED,MAAM,QAAQ,GAAG,QAAQ,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;IAEzC,IAAI,QAAQ,EAAE,CAAC;QACb,OAAO;YACL,IAAI,EAAE,UAAU;YAChB,UAAU,EAAE,QAAQ,CAAC,OAAO;YAC5B,WAAW,EAAE,GAAG;YAChB,QAAQ;SACT,CAAC;IACJ,CAAC;IAED,KAAK,MAAM,CAAC,UAAU,EAAE,OAAO,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;QACtE,IAAI,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,YAAY,CAAC,KAAK,CAAC,KAAK,GAAG,CAAC,EAAE,CAAC;YAClE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC;QACnD,CAAC;IACH,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolveAIProfile.d.ts","sourceRoot":"","sources":["../src/resolveAIProfile.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,uBAAuB,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAE7E,wBAAsB,gBAAgB,CACpC,KAAK,EAAE,MAAM,EACb,OAAO,GAAE,uBAA4B,GACpC,OAAO,CAAC,iBAAiB,CAAC,
|
|
1
|
+
{"version":3,"file":"resolveAIProfile.d.ts","sourceRoot":"","sources":["../src/resolveAIProfile.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,uBAAuB,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAE7E,wBAAsB,gBAAgB,CACpC,KAAK,EAAE,MAAM,EACb,OAAO,GAAE,uBAA4B,GACpC,OAAO,CAAC,iBAAiB,CAAC,CA8E5B"}
|
package/dist/resolveAIProfile.js
CHANGED
|
@@ -1,29 +1,37 @@
|
|
|
1
1
|
import { buildResolvedProfile } from "./buildResolvedProfile.js";
|
|
2
2
|
import { AIProfilesError } from "./errors.js";
|
|
3
3
|
import { loadAIProfilesRegistryWithWarnings } from "./loader/loadAIProfilesRegistry.js";
|
|
4
|
-
import {
|
|
4
|
+
import { matchProfileInput } from "./profileInputMatch.js";
|
|
5
5
|
export async function resolveAIProfile(input, options = {}) {
|
|
6
6
|
const { registry, warnings } = await loadAIProfilesRegistryWithWarnings({
|
|
7
7
|
source: options.source,
|
|
8
8
|
refresh: options.refresh,
|
|
9
9
|
});
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
const match = matchProfileInput(registry, input);
|
|
11
|
+
if (!match) {
|
|
12
|
+
throw new AIProfilesError("UNKNOWN_PROFILE", `Unknown AI profile, shortcut, or alias: ${input}`, { input });
|
|
13
|
+
}
|
|
13
14
|
let profileKey;
|
|
14
15
|
let choiceKey;
|
|
15
|
-
let matchedShortcut
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
16
|
+
let matchedShortcut;
|
|
17
|
+
switch (match.kind) {
|
|
18
|
+
case "profile":
|
|
19
|
+
profileKey = match.profileKey;
|
|
20
|
+
choiceKey =
|
|
21
|
+
options.choice ?? registry.profiles[profileKey].defaultChoice;
|
|
22
|
+
matchedShortcut = undefined;
|
|
23
|
+
break;
|
|
24
|
+
case "shortcut":
|
|
25
|
+
profileKey = match.profileKey;
|
|
26
|
+
choiceKey = options.choice ?? match.shortcut.choice;
|
|
27
|
+
matchedShortcut = match.shortcut;
|
|
28
|
+
break;
|
|
29
|
+
case "alias":
|
|
30
|
+
profileKey = match.profileKey;
|
|
31
|
+
choiceKey =
|
|
32
|
+
options.choice ?? registry.profiles[profileKey].defaultChoice;
|
|
33
|
+
matchedShortcut = undefined;
|
|
34
|
+
break;
|
|
27
35
|
}
|
|
28
36
|
const profile = registry.profiles[profileKey];
|
|
29
37
|
if (!profile) {
|
|
@@ -42,12 +50,13 @@ export async function resolveAIProfile(input, options = {}) {
|
|
|
42
50
|
}
|
|
43
51
|
return buildResolvedProfile({
|
|
44
52
|
input,
|
|
45
|
-
shortcutKey:
|
|
53
|
+
shortcutKey: match.kind === "shortcut" ? match.shortcutKey : undefined,
|
|
46
54
|
profile,
|
|
47
55
|
choice,
|
|
48
56
|
shortcut: matchedShortcut,
|
|
49
57
|
registry,
|
|
50
58
|
loaderWarnings: warnings,
|
|
59
|
+
useOpenRouter: options.useOpenRouter,
|
|
51
60
|
});
|
|
52
61
|
}
|
|
53
62
|
//# sourceMappingURL=resolveAIProfile.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolveAIProfile.js","sourceRoot":"","sources":["../src/resolveAIProfile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,kCAAkC,EAAE,MAAM,oCAAoC,CAAC;AACxF,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"resolveAIProfile.js","sourceRoot":"","sources":["../src/resolveAIProfile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,kCAAkC,EAAE,MAAM,oCAAoC,CAAC;AACxF,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAG3D,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,KAAa,EACb,UAAmC,EAAE;IAErC,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,MAAM,kCAAkC,CAAC;QACtE,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,OAAO,EAAE,OAAO,CAAC,OAAO;KACzB,CAAC,CAAC;IAEH,MAAM,KAAK,GAAG,iBAAiB,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;IAEjD,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,MAAM,IAAI,eAAe,CACvB,iBAAiB,EACjB,2CAA2C,KAAK,EAAE,EAClD,EAAE,KAAK,EAAE,CACV,CAAC;IACJ,CAAC;IAED,IAAI,UAAkB,CAAC;IACvB,IAAI,SAA6B,CAAC;IACl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AAC;QACL,CAAC;QAED,MAAM,IAAI,eAAe,CACvB,gBAAgB,EAChB,mBAAmB,cAAc,qBAAqB,UAAU,GAAG,EACnE,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,cAAc,EAAE,CACvD,CAAC;IACJ,CAAC;IAED,OAAO,oBAAoB,CAAC;QAC1B,KAAK;QACL,WAAW,EAAE,KAAK,CAAC,IAAI,KAAK,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS;QACtE,OAAO;QACP,MAAM;QACN,QAAQ,EAAE,eAAe;QACzB,QAAQ;QACR,cAAc,EAAE,QAAQ;QACxB,aAAa,EAAE,OAAO,CAAC,aAAa;KACrC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { AIProfileBackend, AIProfileChoice, AIProvider } from "./types.js";
|
|
2
|
+
export type AIModelRoutingMode = "openrouter" | "direct";
|
|
3
|
+
/** Reads `USE_OPENROUTER` from process env (loading `.env` once when unset). */
|
|
4
|
+
export declare function readUseOpenRouterFromEnv(): boolean | undefined;
|
|
5
|
+
/**
|
|
6
|
+
* Resolves whether to route via OpenRouter.
|
|
7
|
+
* Explicit option wins, then `USE_OPENROUTER` env, then default `true`.
|
|
8
|
+
*/
|
|
9
|
+
export declare function resolveUseOpenRouter(explicit?: boolean): boolean;
|
|
10
|
+
export declare function isRemoteProfileChoice(choice: AIProfileChoice): boolean;
|
|
11
|
+
export declare function buildOpenRouterModelId(provider: string, modelId: string): string;
|
|
12
|
+
export interface AppliedModelRouting {
|
|
13
|
+
provider: AIProvider;
|
|
14
|
+
modelId: string;
|
|
15
|
+
backend: AIProfileBackend;
|
|
16
|
+
routing: AIModelRoutingMode;
|
|
17
|
+
}
|
|
18
|
+
export declare function applyModelRouting(choice: AIProfileChoice, backend: AIProfileBackend, useOpenRouter: boolean): AppliedModelRouting;
|
|
19
|
+
//# sourceMappingURL=resolveModelRouting.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveModelRouting.d.ts","sourceRoot":"","sources":["../src/resolveModelRouting.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAGhF,MAAM,MAAM,kBAAkB,GAAG,YAAY,GAAG,QAAQ,CAAC;AAyBzD,gFAAgF;AAChF,wBAAgB,wBAAwB,IAAI,OAAO,GAAG,SAAS,CAU9D;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,CAAC,EAAE,OAAO,GAAG,OAAO,CAMhE;AAED,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAUtE;AAED,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAOhF;AAED,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,UAAU,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,gBAAgB,CAAC;IAC1B,OAAO,EAAE,kBAAkB,CAAC;CAC7B;AAED,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,eAAe,EACvB,OAAO,EAAE,gBAAgB,EACzB,aAAa,EAAE,OAAO,GACrB,mBAAmB,CAgBrB"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { loadDotenv } from "@x12i/env";
|
|
2
|
+
import { normalizeAnthropicVersionSlug } from "./validation/openRouterAlignment.js";
|
|
3
|
+
let dotenvLoaded = false;
|
|
4
|
+
function ensureDotenvLoaded() {
|
|
5
|
+
if (!dotenvLoaded) {
|
|
6
|
+
loadDotenv();
|
|
7
|
+
dotenvLoaded = true;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
function parseBooleanEnv(value) {
|
|
11
|
+
const normalized = value.trim().toLowerCase();
|
|
12
|
+
if (["1", "true", "yes", "on"].includes(normalized)) {
|
|
13
|
+
return true;
|
|
14
|
+
}
|
|
15
|
+
if (["0", "false", "no", "off"].includes(normalized)) {
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
return undefined;
|
|
19
|
+
}
|
|
20
|
+
/** Reads `USE_OPENROUTER` from process env (loading `.env` once when unset). */
|
|
21
|
+
export function readUseOpenRouterFromEnv() {
|
|
22
|
+
ensureDotenvLoaded();
|
|
23
|
+
const raw = process.env.USE_OPENROUTER;
|
|
24
|
+
if (raw === undefined || raw.trim() === "") {
|
|
25
|
+
return undefined;
|
|
26
|
+
}
|
|
27
|
+
return parseBooleanEnv(raw);
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Resolves whether to route via OpenRouter.
|
|
31
|
+
* Explicit option wins, then `USE_OPENROUTER` env, then default `true`.
|
|
32
|
+
*/
|
|
33
|
+
export function resolveUseOpenRouter(explicit) {
|
|
34
|
+
if (explicit !== undefined) {
|
|
35
|
+
return explicit;
|
|
36
|
+
}
|
|
37
|
+
return readUseOpenRouterFromEnv() ?? true;
|
|
38
|
+
}
|
|
39
|
+
export function isRemoteProfileChoice(choice) {
|
|
40
|
+
if (choice.provider === "local") {
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
if (choice.modelId.startsWith("funcx:") || choice.modelId.startsWith("Xenova/")) {
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
return true;
|
|
47
|
+
}
|
|
48
|
+
export function buildOpenRouterModelId(provider, modelId) {
|
|
49
|
+
if (modelId.includes("/")) {
|
|
50
|
+
return modelId;
|
|
51
|
+
}
|
|
52
|
+
const normalizedModel = normalizeAnthropicVersionSlug(modelId);
|
|
53
|
+
return `${provider}/${normalizedModel}`;
|
|
54
|
+
}
|
|
55
|
+
export function applyModelRouting(choice, backend, useOpenRouter) {
|
|
56
|
+
if (!isRemoteProfileChoice(choice) || !useOpenRouter) {
|
|
57
|
+
return {
|
|
58
|
+
provider: choice.provider,
|
|
59
|
+
modelId: choice.modelId,
|
|
60
|
+
backend: useOpenRouter ? backend : backend === "openrouter" ? "custom" : backend,
|
|
61
|
+
routing: "direct",
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
return {
|
|
65
|
+
provider: "openrouter",
|
|
66
|
+
modelId: buildOpenRouterModelId(choice.provider, choice.modelId),
|
|
67
|
+
backend: "openrouter",
|
|
68
|
+
routing: "openrouter",
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=resolveModelRouting.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveModelRouting.js","sourceRoot":"","sources":["../src/resolveModelRouting.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAEvC,OAAO,EAAE,6BAA6B,EAAE,MAAM,qCAAqC,CAAC;AAIpF,IAAI,YAAY,GAAG,KAAK,CAAC;AAEzB,SAAS,kBAAkB;IACzB,IAAI,CAAC,YAAY,EAAE,CAAC;QAClB,UAAU,EAAE,CAAC;QACb,YAAY,GAAG,IAAI,CAAC;IACtB,CAAC;AACH,CAAC;AAED,SAAS,eAAe,CAAC,KAAa;IACpC,MAAM,UAAU,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IAE9C,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC;QACpD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC;QACrD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,gFAAgF;AAChF,MAAM,UAAU,wBAAwB;IACtC,kBAAkB,EAAE,CAAC;IAErB,MAAM,GAAG,GAAG,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AO,EAAE,aAAa,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,KAAK,YAAY,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO;YAChF,OAAO,EAAE,QAAQ;SAClB,CAAC;IACJ,CAAC;IAED,OAAO;QACL,QAAQ,EAAE,YAAY;QACtB,OAAO,EAAE,sBAAsB,CAAC,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,OAAO,CAAC;QAChE,OAAO,EAAE,YAAY;QACrB,OAAO,EAAE,YAAY;KACtB,CAAC;AACJ,CAAC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type AIProvider = "openai" | "anthropic" | "google" | "deepseek" | "mistral" | "groq" | "xai" | "local" | "custom";
|
|
1
|
+
export type AIProvider = "openai" | "anthropic" | "google" | "deepseek" | "mistral" | "groq" | "xai" | "local" | "custom" | "openrouter";
|
|
2
2
|
export type InstructionTier = "default" | "cpu" | "reasoning";
|
|
3
3
|
export type AIProfileBackend = "openrouter" | "llama-cpp" | "transformersjs" | "custom";
|
|
4
4
|
export interface AIModelPricing {
|
|
@@ -48,6 +48,7 @@ export interface AIProfileDefinition {
|
|
|
48
48
|
displayName: string;
|
|
49
49
|
description: string;
|
|
50
50
|
category: string;
|
|
51
|
+
/** Many alternate names for this profile (see `matchProfileInput`). */
|
|
51
52
|
aliases?: string[];
|
|
52
53
|
defaultChoice: string;
|
|
53
54
|
choices: Record<string, AIProfileChoice>;
|
|
@@ -95,7 +96,7 @@ export interface AIProfileSummary {
|
|
|
95
96
|
category: string;
|
|
96
97
|
defaultChoice: string;
|
|
97
98
|
choices: string[];
|
|
98
|
-
/**
|
|
99
|
+
/** Additional names for the same profile (also valid for resolve / sync validation). */
|
|
99
100
|
aliases: string[];
|
|
100
101
|
defaultProvider: AIProvider;
|
|
101
102
|
defaultModelId: string;
|
|
@@ -124,6 +125,8 @@ export interface ResolvedAIProfile {
|
|
|
124
125
|
choiceDescription: string;
|
|
125
126
|
provider: AIProvider;
|
|
126
127
|
modelId: string;
|
|
128
|
+
/** How the resolved provider/model were routed (`openrouter` vs vendor-direct). */
|
|
129
|
+
routing: "openrouter" | "direct";
|
|
127
130
|
instructionTier: InstructionTier;
|
|
128
131
|
backend: AIProfileBackend;
|
|
129
132
|
pricing?: AIModelPricing & {
|
|
@@ -158,6 +161,13 @@ export interface ResolveAIProfileOptions {
|
|
|
158
161
|
refresh?: boolean;
|
|
159
162
|
allowFallbackToDefaultChoice?: boolean;
|
|
160
163
|
strict?: boolean;
|
|
164
|
+
/**
|
|
165
|
+
* When true (default), remote models resolve via OpenRouter (`provider: "openrouter"`,
|
|
166
|
+
* `modelId: "{vendor}/{model}"`). When false, use the choice's vendor provider and model id.
|
|
167
|
+
* Falls back to `USE_OPENROUTER` in `.env` when omitted (`1`/`true` → OpenRouter,
|
|
168
|
+
* `0`/`false` → direct). Azure and AWS routing are not supported yet.
|
|
169
|
+
*/
|
|
170
|
+
useOpenRouter?: boolean;
|
|
161
171
|
}
|
|
162
172
|
export interface LoadRegistryOptions {
|
|
163
173
|
source?: RegistrySourceMode;
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,GAClB,QAAQ,GACR,WAAW,GACX,QAAQ,GACR,UAAU,GACV,SAAS,GACT,MAAM,GACN,KAAK,GACL,OAAO,GACP,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,GAClB,QAAQ,GACR,WAAW,GACX,QAAQ,GACR,UAAU,GACV,SAAS,GACT,MAAM,GACN,KAAK,GACL,OAAO,GACP,QAAQ,GACR,YAAY,CAAC;AAEjB,MAAM,MAAM,eAAe,GAAG,SAAS,GAAG,KAAK,GAAG,W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G,EAAE,MAAM,CAAC;QACZ,OAAO,EAAE,MAAM,CAAC;QAChB,MAAM,CAAC,EAAE,MAAM,CAAC;KACjB,CAAC;IAEF,QAAQ,CAAC,EAAE,gBAAgB,EAAE,CAAC;CAC/B;AAED,MAAM,WAAW,qBAAqB;IACpC,MAAM,CAAC,EAAE,kBAAkB,CAAC;IAC5B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,uBAAuB;IACtC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,kBAAkB,CAAC;IAC5B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,4BAA4B,CAAC,EAAE,OAAO,CAAC;IACvC,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;;;;OAKG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED,MAAM,WAAW,mBAAmB;IAClC,MAAM,CAAC,EAAE,kBAAkB,CAAC;IAC5B,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,kBAAkB,CAAC;IAC7B,QAAQ,EAAE,gBAAgB,EAAE,CAAC;CAC9B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validateModelsProfilesJson.d.ts","sourceRoot":"","sources":["../../src/validation/validateModelsProfilesJson.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"validateModelsProfilesJson.d.ts","sourceRoot":"","sources":["../../src/validation/validateModelsProfilesJson.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EACV,mBAAmB,EACnB,kBAAkB,EAClB,qBAAqB,EACtB,MAAM,aAAa,CAAC;AAgOrB,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,OAAO,GAAG,kBAAkB,CAgD7E;AAED,wBAAgB,6BAA6B,CAC3C,KAAK,EAAE,OAAO,EACd,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,GAC5C,qBAAqB,CAqEvB"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AIProfilesError } from "../errors.js";
|
|
2
|
-
import { AI_PROFILE_BACKENDS,
|
|
2
|
+
import { AI_PROFILE_BACKENDS, INSTRUCTION_TIERS, MODELS_PROFILES_SCHEMA, PROFILES_SHORTCUTS_SCHEMA, } from "../constants.js";
|
|
3
3
|
function isRecord(value) {
|
|
4
4
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
5
5
|
}
|
|
@@ -84,9 +84,6 @@ function validateProfile(profileKey, profile) {
|
|
|
84
84
|
if (typeof alias !== "string" || alias.trim() === "") {
|
|
85
85
|
throw new AIProfilesError("REGISTRY_VALIDATION_FAILED", `Invalid alias on profile '${profileKey}'`, { profile: profileKey, alias });
|
|
86
86
|
}
|
|
87
|
-
if (FORBIDDEN_PROFILE_ALIASES.includes(alias)) {
|
|
88
|
-
throw new AIProfilesError("REGISTRY_VALIDATION_FAILED", `Profile '${profileKey}' alias '${alias}' is reserved (legacy graph-engine token)`, { profile: profileKey, alias });
|
|
89
|
-
}
|
|
90
87
|
}
|
|
91
88
|
}
|
|
92
89
|
}
|
|
@@ -128,9 +125,6 @@ export function validateProfilesShortcutsJson(value, profiles) {
|
|
|
128
125
|
throw new AIProfilesError("REGISTRY_VALIDATION_FAILED", "profiles-shortcuts.json shortcuts must be an object");
|
|
129
126
|
}
|
|
130
127
|
for (const [shortcutKey, shortcut] of Object.entries(value.shortcuts)) {
|
|
131
|
-
if (RESERVED_PROFILE_KEYS.includes(shortcutKey)) {
|
|
132
|
-
throw new AIProfilesError("REGISTRY_VALIDATION_FAILED", `Shortcut key '${shortcutKey}' is reserved`, { shortcut: shortcutKey });
|
|
133
|
-
}
|
|
134
128
|
if (!isRecord(shortcut)) {
|
|
135
129
|
throw new AIProfilesError("REGISTRY_VALIDATION_FAILED", `Invalid shortcut '${shortcutKey}'`, { shortcut: shortcutKey });
|
|
136
130
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validateModelsProfilesJson.js","sourceRoot":"","sources":["../../src/validation/validateModelsProfilesJson.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EACL,mBAAmB,EACnB,
|
|
1
|
+
{"version":3,"file":"validateModelsProfilesJson.js","sourceRoot":"","sources":["../../src/validation/validateModelsProfilesJson.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EACjB,sBAAsB,EACtB,yBAAyB,GAC1B,MAAM,iBAAiB,CAAC;AAOzB,SAAS,QAAQ,CAAC,KAAc;IAC9B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9E,CAAC;AAED,SAAS,aAAa,CACpB,KAAc,EACd,KAAa,EACb,OAAe;IAEf,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC;QACrD,MAAM,IAAI,eAAe,CACvB,4BAA4B,EAC5B,sBAAsB,KAAK,OAAO,OAAO,EAAE,EAC3C,EAAE,KAAK,EAAE,OAAO,EAAE,CACnB,CAAC;IACJ,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAS,oBAAoB,CAC3B,OAAgC,EAChC,UAAkB,EAClB,SAAiB;IAEjB,IAAI,OAAO,CAAC,eAAe,KAAK,SAAS,EAAE,CAAC;QAC1C,IACE,CAAC,iBAAiB,CAAC,QAAQ,CACzB,OAAO,CAAC,eAAqD,CAC9D,EACD,CAAC;YACD,MAAM,IAAI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CAAC;QACrC,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,MAAM,IAAI,eAAe,CACvB,4BAA4B,EAC5B,aAAa,WAAW,iCAAiC,UAAU,GAAG,EACtE,EAAE,QAAQ,EAAE,WAAW,EAAE,OAAO,EAAE,UAAU,EAAE,CAC/C,CAAC;QACJ,CAAC;QAED,IAAI,QAAQ,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;YAClC,MAAM,SAAS,GAAG,aAAa,CAC7B,QAAQ,CAAC,MAAM,EACf,QAAQ,EACR,aAAa,WAAW,GAAG,CAC5B,CAAC;YAEF,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC;gBAChC,MAAM,IAAI,eAAe,CACvB,4BAA4B,EAC5B,aAAa,WAAW,gCAAgC,SAAS,kBAAkB,UAAU,GAAG,EAChG,EAAE,QAAQ,EAAE,WAAW,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,CAClE,CAAC;YACJ,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,KAAyC,CAAC;AACnD,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@x12i/ai-profiles",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"description": "Resolve AI profile names into concrete model choices with bundled defaults and remote JSON refresh",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -63,5 +63,8 @@
|
|
|
63
63
|
"@types/node": "^22.15.21",
|
|
64
64
|
"typescript": "^5.8.3",
|
|
65
65
|
"vitest": "^3.1.4"
|
|
66
|
+
},
|
|
67
|
+
"dependencies": {
|
|
68
|
+
"@x12i/env": "^4.0.1"
|
|
66
69
|
}
|
|
67
70
|
}
|