@x12i/ai-profiles 1.2.7 → 1.5.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.
Files changed (144) hide show
  1. package/README.md +278 -18
  2. package/dist/buildCatalogFromOpenRouterApi.d.ts +29 -0
  3. package/dist/buildCatalogFromOpenRouterApi.d.ts.map +1 -0
  4. package/dist/buildCatalogFromOpenRouterApi.js +113 -0
  5. package/dist/buildCatalogFromOpenRouterApi.js.map +1 -0
  6. package/dist/buildModelsRegistry.d.ts +25 -0
  7. package/dist/buildModelsRegistry.d.ts.map +1 -0
  8. package/dist/buildModelsRegistry.js +190 -0
  9. package/dist/buildModelsRegistry.js.map +1 -0
  10. package/dist/buildResolvedProfile.d.ts +4 -1
  11. package/dist/buildResolvedProfile.d.ts.map +1 -1
  12. package/dist/buildResolvedProfile.js +102 -15
  13. package/dist/buildResolvedProfile.js.map +1 -1
  14. package/dist/catalogEnrichment.d.ts +19 -0
  15. package/dist/catalogEnrichment.d.ts.map +1 -0
  16. package/dist/catalogEnrichment.js +87 -0
  17. package/dist/catalogEnrichment.js.map +1 -0
  18. package/dist/computeRegistryStatistics.d.ts +15 -0
  19. package/dist/computeRegistryStatistics.d.ts.map +1 -0
  20. package/dist/computeRegistryStatistics.js +168 -0
  21. package/dist/computeRegistryStatistics.js.map +1 -0
  22. package/dist/constants.d.ts +6 -0
  23. package/dist/constants.d.ts.map +1 -1
  24. package/dist/constants.js +10 -0
  25. package/dist/constants.js.map +1 -1
  26. package/dist/data/models-catalog.json +2219 -0
  27. package/dist/data/models-profiles.json +1361 -193
  28. package/dist/data/models-profiles.schema.json +130 -0
  29. package/dist/data/models-registry.json +1606 -0
  30. package/dist/data/openrouter-models-catalog.json +857 -0
  31. package/dist/data/profiles-shortcuts.json +101 -2
  32. package/dist/errors.d.ts +1 -1
  33. package/dist/errors.d.ts.map +1 -1
  34. package/dist/errors.js.map +1 -1
  35. package/dist/formatRegistryStatistics.d.ts +4 -0
  36. package/dist/formatRegistryStatistics.d.ts.map +1 -0
  37. package/dist/formatRegistryStatistics.js +34 -0
  38. package/dist/formatRegistryStatistics.js.map +1 -0
  39. package/dist/getAIRegistryStatistics.d.ts +11 -0
  40. package/dist/getAIRegistryStatistics.d.ts.map +1 -0
  41. package/dist/getAIRegistryStatistics.js +52 -0
  42. package/dist/getAIRegistryStatistics.js.map +1 -0
  43. package/dist/index.d.ts +24 -1
  44. package/dist/index.d.ts.map +1 -1
  45. package/dist/index.js +20 -0
  46. package/dist/index.js.map +1 -1
  47. package/dist/listAIProfiles.d.ts +6 -0
  48. package/dist/listAIProfiles.d.ts.map +1 -1
  49. package/dist/listAIProfiles.js +6 -0
  50. package/dist/listAIProfiles.js.map +1 -1
  51. package/dist/loadModelsRegistry.d.ts +6 -0
  52. package/dist/loadModelsRegistry.d.ts.map +1 -0
  53. package/dist/loadModelsRegistry.js +43 -0
  54. package/dist/loadModelsRegistry.js.map +1 -0
  55. package/dist/loader/catalogMemoryCache.d.ts +12 -0
  56. package/dist/loader/catalogMemoryCache.d.ts.map +1 -0
  57. package/dist/loader/catalogMemoryCache.js +14 -0
  58. package/dist/loader/catalogMemoryCache.js.map +1 -0
  59. package/dist/loader/loadBundledModelsCatalog.d.ts +3 -0
  60. package/dist/loader/loadBundledModelsCatalog.d.ts.map +1 -0
  61. package/dist/loader/loadBundledModelsCatalog.js +20 -0
  62. package/dist/loader/loadBundledModelsCatalog.js.map +1 -0
  63. package/dist/loader/loadBundledModelsProfiles.d.ts +4 -0
  64. package/dist/loader/loadBundledModelsProfiles.d.ts.map +1 -0
  65. package/dist/loader/loadBundledModelsProfiles.js +14 -0
  66. package/dist/loader/loadBundledModelsProfiles.js.map +1 -0
  67. package/dist/loader/loadBundledRegistry.d.ts.map +1 -1
  68. package/dist/loader/loadBundledRegistry.js +2 -1
  69. package/dist/loader/loadBundledRegistry.js.map +1 -1
  70. package/dist/loader/loadModelsCatalog.d.ts +9 -0
  71. package/dist/loader/loadModelsCatalog.d.ts.map +1 -0
  72. package/dist/loader/loadModelsCatalog.js +72 -0
  73. package/dist/loader/loadModelsCatalog.js.map +1 -0
  74. package/dist/loader/loadModelsProfilesJson.d.ts +3 -0
  75. package/dist/loader/loadModelsProfilesJson.d.ts.map +1 -0
  76. package/dist/loader/loadModelsProfilesJson.js +18 -0
  77. package/dist/loader/loadModelsProfilesJson.js.map +1 -0
  78. package/dist/loader/loadRemoteModelsCatalog.d.ts +3 -0
  79. package/dist/loader/loadRemoteModelsCatalog.d.ts.map +1 -0
  80. package/dist/loader/loadRemoteModelsCatalog.js +23 -0
  81. package/dist/loader/loadRemoteModelsCatalog.js.map +1 -0
  82. package/dist/loader/loadRemoteModelsProfiles.d.ts +3 -0
  83. package/dist/loader/loadRemoteModelsProfiles.d.ts.map +1 -0
  84. package/dist/loader/loadRemoteModelsProfiles.js +21 -0
  85. package/dist/loader/loadRemoteModelsProfiles.js.map +1 -0
  86. package/dist/loader/loadRemoteRegistry.d.ts.map +1 -1
  87. package/dist/loader/loadRemoteRegistry.js +2 -1
  88. package/dist/loader/loadRemoteRegistry.js.map +1 -1
  89. package/dist/mergeCatalogSupplement.d.ts +4 -0
  90. package/dist/mergeCatalogSupplement.d.ts.map +1 -0
  91. package/dist/mergeCatalogSupplement.js +26 -0
  92. package/dist/mergeCatalogSupplement.js.map +1 -0
  93. package/dist/modelIdentity.d.ts +33 -0
  94. package/dist/modelIdentity.d.ts.map +1 -0
  95. package/dist/modelIdentity.js +150 -0
  96. package/dist/modelIdentity.js.map +1 -0
  97. package/dist/modelsCatalog.d.ts +21 -0
  98. package/dist/modelsCatalog.d.ts.map +1 -0
  99. package/dist/modelsCatalog.js +187 -0
  100. package/dist/modelsCatalog.js.map +1 -0
  101. package/dist/profileCatalogSupplement.d.ts +7 -0
  102. package/dist/profileCatalogSupplement.d.ts.map +1 -0
  103. package/dist/profileCatalogSupplement.js +292 -0
  104. package/dist/profileCatalogSupplement.js.map +1 -0
  105. package/dist/profileRegistryV2.d.ts +19 -0
  106. package/dist/profileRegistryV2.d.ts.map +1 -0
  107. package/dist/profileRegistryV2.js +257 -0
  108. package/dist/profileRegistryV2.js.map +1 -0
  109. package/dist/profileRegistryV3.d.ts +11 -0
  110. package/dist/profileRegistryV3.d.ts.map +1 -0
  111. package/dist/profileRegistryV3.js +526 -0
  112. package/dist/profileRegistryV3.js.map +1 -0
  113. package/dist/resolveAIProfile.d.ts +8 -0
  114. package/dist/resolveAIProfile.d.ts.map +1 -1
  115. package/dist/resolveAIProfile.js +63 -18
  116. package/dist/resolveAIProfile.js.map +1 -1
  117. package/dist/resolveModelRouting.d.ts +20 -0
  118. package/dist/resolveModelRouting.d.ts.map +1 -0
  119. package/dist/resolveModelRouting.js +70 -0
  120. package/dist/resolveModelRouting.js.map +1 -0
  121. package/dist/types.d.ts +348 -4
  122. package/dist/types.d.ts.map +1 -1
  123. package/dist/types.js +10 -0
  124. package/dist/types.js.map +1 -1
  125. package/dist/validateProfileVendorCoverage.d.ts +12 -0
  126. package/dist/validateProfileVendorCoverage.d.ts.map +1 -0
  127. package/dist/validateProfileVendorCoverage.js +58 -0
  128. package/dist/validateProfileVendorCoverage.js.map +1 -0
  129. package/dist/validation/openRouterAlignment.d.ts +6 -15
  130. package/dist/validation/openRouterAlignment.d.ts.map +1 -1
  131. package/dist/validation/openRouterAlignment.js +9 -57
  132. package/dist/validation/openRouterAlignment.js.map +1 -1
  133. package/dist/validation/validateModelsCatalog.d.ts +3 -0
  134. package/dist/validation/validateModelsCatalog.d.ts.map +1 -0
  135. package/dist/validation/validateModelsCatalog.js +42 -0
  136. package/dist/validation/validateModelsCatalog.js.map +1 -0
  137. package/dist/validation/validateModelsProfilesJson.d.ts.map +1 -1
  138. package/dist/validation/validateModelsProfilesJson.js +38 -2
  139. package/dist/validation/validateModelsProfilesJson.js.map +1 -1
  140. package/dist/vendorPolicy.d.ts +20 -0
  141. package/dist/vendorPolicy.d.ts.map +1 -0
  142. package/dist/vendorPolicy.js +71 -0
  143. package/dist/vendorPolicy.js.map +1 -0
  144. package/package.json +15 -2
package/README.md CHANGED
@@ -2,6 +2,86 @@
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
+ ## Why AI profiles
6
+
7
+ Any system that runs many different AI tasks—classification, architecture review, JSON extraction, tool-using agents—faces the same problem: **tasks are not interchangeable**. They differ in reasoning quality, cost sensitivity, latency, output shape (prose vs schema vs citations), and which provider traits matter (instruction following, long context, tool use).
8
+
9
+ Hardcoding one model everywhere leads to one of three failures: overpaying for simple high-volume work, under-serving hard problems with a weak model, or locking the product to a single vendor with no fallback when prices or availability change.
10
+
11
+ ### What a profile is
12
+
13
+ An **AI profile** is **not** a model. It is a **capability contract**: a stable name for *what kind of work* you need, not *which SKU* fulfills it.
14
+
15
+ When a graph node or function asks for `deep`, it means: high reasoning effort, complex work—resolve that intent to a concrete `provider` + `modelId` + runtime defaults **today**, without the caller caring whether that is Claude, GPT, or Gemini. The registry (`models-profiles.json`) is the mapping layer; profiles are the interface tasks depend on.
16
+
17
+ ### Profiles vs choices
18
+
19
+ | Layer | Role | Example |
20
+ |-------|------|---------|
21
+ | **Profile** | Semantic intent (cost, speed, reasoning tier, output mode, agentic behavior) | `cheap`, `balanced`, `json`, `agentic` |
22
+ | **Choice** | Implementation option within that profile (provider, model, batch vs sync, cost/quality trade-off) | `default`, `cost_floor`, `safer_provider` |
23
+
24
+ Every profile has a **`defaultChoice`** (recommended) and typically **two alternatives** so operators can tune without changing task code:
25
+
26
+ - **Provider diversity** — Anthropic (writing/reasoning), OpenAI (code/instruction following), Google (cost, long context) within the same profile.
27
+ - **Cost flexibility** — e.g. `balanced` + `cost_balanced` vs `reasoning_balanced` for the same “normal work” intent.
28
+ - **Capability variants** — e.g. `long_context_deep` when the constraint is window size, not reasoning tier alone.
29
+ - **Execution mode** — e.g. `cheap` + `cost_floor` with `executionMode: batch` for background bulk work.
30
+ - **Resilience** — swap choice or fall back within the same profile when a provider is down or rate-limited.
31
+
32
+ **Shortcuts** (`profiles-shortcuts.json`) are named entry points that may pin a profile and optionally a choice (e.g. `cheapest` → `cheap` + `cost_floor`). **Aliases** on each profile are alternate names for the same profile (e.g. `economy` → `cheap`).
33
+
34
+ Tasks should declare **requirements** (`profile` + optional `choice`), not model names. Profiles are the vocabulary; choices are how that vocabulary is implemented under different constraints.
35
+
36
+ ### Profile catalog (bundled)
37
+
38
+ Profiles are grouped by **what kind of work** they represent—not only by price/quality tier. Several axes are orthogonal (structured output, agents, research, local inference).
39
+
40
+ | Profile | Category | When to use it |
41
+ |---------|----------|----------------|
42
+ | `cheap` | cost | High-volume, non-critical work: routing, classification, simple transforms. “Cheap” means low-cost selection, not always the absolute cheapest SKU. |
43
+ | `fast` | speed | Interactive UX where latency matters more than maximum reasoning depth. |
44
+ | `balanced` | standard | Default workhorse: general graph execution, coding, product logic (~80% of tasks). |
45
+ | `deep` | reasoning | Hard problems: architecture, planning, analysis, code review—work that needs real reasoning, not pattern matching. |
46
+ | `pro` | premium | Critical outputs where quality or a wrong answer has high downstream cost; use sparingly. |
47
+ | `json` | output | Strict JSON/schema, extraction, classification—machine-readable pipelines (`outputMode: schema`, low temperature). |
48
+ | `agentic` | agentic | Tool use, planning, multi-step execution (`toolPolicy` allows writes with approval). |
49
+ | `research` | research | Source-heavy reading, synthesis, citations (read-only tools, web/file search). |
50
+ | `cyber` | security | Threat analysis, TPRM, contract verification, security log parsing. |
51
+ | `content` | creative | Prose, marketing copy, programmatic SEO, brand voice. |
52
+ | `summarization` | analysis | Document triage, digests, compressing very large corpora. |
53
+ | `vision` | multimodal | Image understanding, OCR, charts, scanned PDF structure extraction. |
54
+ | `coding` | engineering | Software engineering: implementation, refactors, reviews, debugging. |
55
+ | `extraction` | extraction | NER, classification, taxonomy mapping, entity extraction, document labeling. |
56
+ | `routing` | routing | Intent classification, record routing, workflow branching (cheapest viable). |
57
+ | `open_weights` | resilience | Hosted open-source models (Llama, Qwen) as vendor hedge and self-host path (`deploymentType: openWeightsHosted`). |
58
+ | `local` | local | On-device / offline CPU inference (privacy, edge, dev without API keys). |
59
+
60
+ ### Typical choices per profile
61
+
62
+ Each profile’s `choices` in `models-profiles.json` follow a consistent pattern: **`default`** (recommended), plus variants along cost, provider family, or a specific capability.
63
+
64
+ | Profile | Choices (bundled) | What the variants optimize |
65
+ |---------|-------------------|------------------------------|
66
+ | `cheap` | `default`, `cost_floor`, `safer_provider`, `absolute_floor` | Normal cheap vs batch floor vs safer Haiku vs DeepSeek V4 Flash volume floor |
67
+ | `fast` | `default`, `cheaper_fast`, `quality_fast`, `grok_fast` | Interactive default vs lower cost vs stronger quality vs Grok 4.1 Fast (2M context) |
68
+ | `balanced` | `default`, `reasoning_balanced`, `cost_balanced` | General default vs stronger reasoning vs lower cost |
69
+ | `deep` | `default`, `openai_deep`, `long_context_deep`, `deepseek_pro`, `grok_flagship` | High reasoning default vs OpenAI vs long context vs cost-efficient DeepSeek vs Grok 4.3 |
70
+ | `pro` | `default`, `claude_pro`, `cost_pro` | Premium default vs Claude premium vs Sonnet-level “pro-like” at lower cost |
71
+ | `json` | `default`, `cheap_json`, `quality_json` | Reliable schema output vs volume/cost vs complex extraction needing reasoning |
72
+ | `agentic` | `default`, `openai_agentic`, `cheap_agentic` | Agent default vs OpenAI orchestration vs lower-cost moderate agents |
73
+ | `research` | `default`, `premium_research`, `long_context_research` | Synthesis default vs highest quality vs very large context |
74
+ | `cyber` | `default`, `log_analysis`, `deep_forensics` | Policy/contract review vs bulk log JSON vs max forensics |
75
+ | `content` | `default`, `pseo_bulk`, `brand_voice` | Natural prose vs batch pSEO schema vs premium copy |
76
+ | `summarization` | `default`, `mega_context` | Fast digest (Haiku) vs multi-hundred-k token compression |
77
+ | `vision` | `default`, `document_ocr` | General multimodal vs schema OCR from scans/PDFs |
78
+ | `open_weights` | `default`, `multilingual_code` | Llama 3.3 70B vs Qwen 2.5 72B (coding / multilingual) |
79
+ | `local` | `llama_cpp_gguf`, `transformersjs_default` | GGUF via llama.cpp vs Hugging Face Transformers.js on CPU |
80
+
81
+ Bundled **shortcuts** that pin a choice include `cheapest`, `absolute-floor`, `grok-fast`, `deepseek-pro`, `qwen`, `cheap-json`, `audit`, `pseo`, `ocr`, and FuncX-style `weak` / `normal` / `strong` / `ultra` (see [Profile matrix](#profile-matrix-funcx-contract)).
82
+
83
+ Registry fields on each choice—`runtime` (`reasoningEffort`, `toolPolicy`, `outputMode`, `instructionTier`, `backend`), `modelStatus` (`verified` | `predicted`), `api` (vendor + OpenRouter slugs), and `reason`—document *why* that model backs the choice. **Pricing and capabilities** come from `models-catalog.json` at resolve time. Profile-level `requiredCapabilities` describes intent for future dynamic selection (Optimixer). Consumers use `resolveAIProfile` to materialize the merged result.
84
+
5
85
  ## Install
6
86
 
7
87
  ```bash
@@ -13,12 +93,30 @@ npm install @x12i/ai-profiles
13
93
  | Export | Sync? | Purpose |
14
94
  |--------|-------|---------|
15
95
  | `listAIProfiles(options?)` | No (async) | Profile summaries: primary `profile` key, `aliases[]`, choices, defaults |
96
+ | `getAIRegistryStatistics(options?)` | No (async) | Counts: profiles, choices, providers, shortcuts, catalog models, linkage health |
97
+ | `formatRegistryStatistics(stats)` | Yes | Human-readable summary for logs / CLI |
98
+ | `loadModelsCatalog(options?)` | No (async) | Unified models catalog (`auto` / `remote` / `bundled`, same cache pattern as profiles) |
16
99
  | `listAIShortcuts()` | Yes | Shortcut table: `{ key, profile, choice?, description? }[]` |
17
100
  | `resolveAIProfile(input, options?)` | No (async) | Resolve input → model, pricing, runtime, canonical `profile` key |
101
+ | `resolveUseOpenRouter(explicit?)` | Yes | Resolve OpenRouter vs vendor-direct routing (option → env → default) |
102
+ | `buildOpenRouterModelId(provider, modelId)` | Yes | Build an OpenRouter slug (`openai/gpt-5.4`) from registry fields |
103
+ | `validateBundledProfileVendorCoverage(options?)` | Yes | Advisory report of leading-vendor coverage per profile |
104
+ | `isProfileVendorTrimReady(profile, allowedProviders)` | Yes | Whether auto-pick can satisfy a vendor filter |
105
+ | `listFaultyProfileChoices()` | Yes | Profile choices with faulty OpenRouter catalog linkage |
18
106
  | `isKnownProfileOrShortcut(input)` | Yes (bundled only) | Whether input is a known primary key, shortcut, or alias |
19
107
  | `AIProfilesError` | — | Typed errors (`UNKNOWN_PROFILE`, …) |
20
108
 
21
- Registry JSON lives in `models-profiles.json` (profiles + aliases) and `profiles-shortcuts.json` (shortcuts).
109
+ Registry JSON lives in three assets:
110
+
111
+ | File | Schema | Role |
112
+ |------|--------|------|
113
+ | `models-profiles.json` | `x12i.ai-profiles.model-registry.v3` | Profile intent, choices, `requiredCapabilities`, `modelStatus` — **no embedded pricing** |
114
+ | `models-catalog.json` | `x12i.ai-profiles.models-catalog` | Per-model pricing, context window, capabilities (OpenRouter-normalized) |
115
+ | `profiles-shortcuts.json` | `x12i.ai-profiles.shortcuts` | Named entry points |
116
+
117
+ **v3 contract:** `modelId` is **vendor-native** (e.g. `claude-sonnet-4-5`). OpenRouter slugs live under `choice.api.openRouterModelId`. `resolveAIProfile` merges catalog data into `resolved.pricing`, `resolved.limits`, and `resolved.capabilities`. Default choices use **verified** SKUs; forward-looking models remain as alternates with `modelStatus: predicted`.
118
+
119
+ Validate with `src/data/models-profiles.schema.json`. Maintainer scripts: `npm run migrate:profiles-v3`, `npm run registry:finish` (catalog supplement + verified defaults + linkage rebuild).
22
120
 
23
121
  ## Basic usage
24
122
 
@@ -34,13 +132,43 @@ const profiles = await listAIProfiles();
34
132
  const model = await resolveAIProfile("cheap");
35
133
 
36
134
  console.log(model.profile); // canonical primary key: cheap
37
- console.log(model.provider);
38
- console.log(model.modelId);
39
- console.log(model.pricing);
135
+ console.log(model.provider); // "openrouter" by default for remote profiles
136
+ console.log(model.modelId); // "google/gemini-2.5-flash-lite"
137
+ console.log(model.routing); // "openrouter" | "direct"
138
+ console.log(model.pricing); // from models-catalog.json
139
+ console.log(model.modelStatus); // verified | predicted
140
+ console.log(model.requiredCapabilities); // profile intent
141
+ console.log(model.capabilities); // contextWindow, supportsTools, …
40
142
  console.log(model.instructionTier);
41
143
  console.log(model.backend);
42
144
  ```
43
145
 
146
+ ## Registry statistics
147
+
148
+ Use **`getAIRegistryStatistics()`** for discovery dashboards, CI summaries, and operator tooling. It loads profiles and the models catalog with the same `source` / `refresh` options as `resolveAIProfile`, then returns structured counts.
149
+
150
+ ```ts
151
+ import {
152
+ formatRegistryStatistics,
153
+ getAIRegistryStatistics,
154
+ } from "@x12i/ai-profiles";
155
+
156
+ const { statistics, warnings } = await getAIRegistryStatistics({
157
+ source: "bundled", // or "auto" | "remote"
158
+ includeCatalog: true,
159
+ includeLinkage: true,
160
+ });
161
+
162
+ console.log(statistics.profiles.total);
163
+ console.log(statistics.profiles.providers);
164
+ console.log(statistics.catalog?.totalModels);
165
+ console.log(statistics.linkage?.faulty);
166
+
167
+ console.log(formatRegistryStatistics(statistics));
168
+ ```
169
+
170
+ CLI (after build): `npm run stats` (text) or `npm run stats:json`.
171
+
44
172
  ## Naming: many names, one profile
45
173
 
46
174
  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.
@@ -106,6 +234,79 @@ const model = await resolveAIProfile("cheap", {
106
234
  });
107
235
  ```
108
236
 
237
+ ## OpenRouter vs vendor-direct routing
238
+
239
+ 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.
240
+
241
+ ### Resolution priority
242
+
243
+ 1. **`options.useOpenRouter`** when passed to `resolveAIProfile`
244
+ 2. **`USE_OPENROUTER`** in `.env` / process env
245
+ 3. **Default: `true`** (OpenRouter)
246
+
247
+ Supported today: **OpenRouter** and **vendor-direct**. Azure and AWS routing are not supported yet.
248
+
249
+ ### OpenRouter (default)
250
+
251
+ ```ts
252
+ const resolved = await resolveAIProfile("cheap");
253
+ // or explicitly:
254
+ await resolveAIProfile("cheap", { useOpenRouter: true });
255
+
256
+ // resolved.provider === "openrouter"
257
+ // resolved.modelId === "google/gemini-2.5-flash-lite"
258
+ // resolved.routing === "openrouter"
259
+ // resolved.backend === "openrouter"
260
+ ```
261
+
262
+ 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`).
263
+
264
+ This applies to **primary keys, aliases, and shortcuts** — any input that resolves to a remote profile choice.
265
+
266
+ ### Vendor-direct
267
+
268
+ ```ts
269
+ const resolved = await resolveAIProfile("cheap", { useOpenRouter: false });
270
+
271
+ // resolved.provider === "google"
272
+ // resolved.modelId === "gemini-2.5-flash-lite"
273
+ // resolved.routing === "direct"
274
+ // resolved.backend === "custom"
275
+ ```
276
+
277
+ Use this when calling OpenAI, Anthropic, Google, etc. APIs directly instead of through OpenRouter.
278
+
279
+ ### Env fallback
280
+
281
+ Set in `.env` or the process environment:
282
+
283
+ ```env
284
+ USE_OPENROUTER=1 # or true, yes, on → OpenRouter
285
+ USE_OPENROUTER=0 # or false, no, off → vendor-direct
286
+ ```
287
+
288
+ When `useOpenRouter` is omitted from `resolveAIProfile`, the env value is used. An explicit option always wins over env.
289
+
290
+ ```ts
291
+ process.env.USE_OPENROUTER = "0";
292
+ await resolveAIProfile("cheap"); // vendor-direct
293
+
294
+ await resolveAIProfile("cheap", { useOpenRouter: true }); // still OpenRouter
295
+ ```
296
+
297
+ Helper exports:
298
+
299
+ ```ts
300
+ import { resolveUseOpenRouter, buildOpenRouterModelId } from "@x12i/ai-profiles";
301
+
302
+ resolveUseOpenRouter(); // true by default
303
+ resolveUseOpenRouter(false); // explicit override
304
+
305
+ buildOpenRouterModelId("openai", "gpt-5.4"); // "openai/gpt-5.4"
306
+ ```
307
+
308
+ Tests: `test/resolveModelRouting.test.ts`.
309
+
109
310
  ## Use bundled only
110
311
 
111
312
  ```ts
@@ -154,6 +355,7 @@ const resolved = await resolveAIProfile(
154
355
  const modelConfig = {
155
356
  provider: resolved.provider,
156
357
  model: resolved.modelId,
358
+ routing: resolved.routing,
157
359
  instructionTier: resolved.instructionTier,
158
360
  backend: resolved.backend,
159
361
  temperature: resolved.runtime.temperature,
@@ -161,19 +363,36 @@ const modelConfig = {
161
363
  toolPolicy: resolved.runtime.toolPolicy,
162
364
  reasoningEffort: resolved.runtime.reasoningEffort,
163
365
  };
366
+
367
+ // Default OpenRouter routing:
368
+ // provider: "openrouter", model: "openai/gpt-5.4", routing: "openrouter"
369
+
370
+ // Vendor-direct:
371
+ // await resolveAIProfile(..., { useOpenRouter: false })
372
+ // provider: "openai", model: "gpt-5.4", routing: "direct"
164
373
  ```
165
374
 
166
375
  ## Profile matrix (FuncX contract)
167
376
 
168
- | Profile | Inference | Instruction tier | Example model |
169
- |---------|-----------|------------------|---------------|
170
- | `cheap` | Remote | **`default`** | `gemini-2.5-flash-lite` |
171
- | `fast` | Remote | **`default`** | `gpt-5.4-mini` |
172
- | `balanced` | Remote | **`default`** | `gpt-5.4` |
173
- | `deep` | Remote | **`reasoning`** | `claude-sonnet-4.6` |
174
- | `pro` | Remote | **`default`** | `gpt-5.5` |
175
- | `local` / `llama_cpp_gguf` | CPU | **`cpu`** | `funcx:llama-cpp:gguf` |
176
- | `local` / `transformersjs_default` | CPU | **`cpu`** | `Xenova/distilbart-cnn-6-6` |
377
+ Default choice per profile (vendor-native ids in registry; OpenRouter slugs when `useOpenRouter` is true):
378
+
379
+ | Profile | Inference | Instruction tier | Default choice | Example model |
380
+ |---------|-----------|------------------|----------------|---------------|
381
+ | `cheap` | Remote | **`default`** | `default` | `gemini-2.5-flash-lite` |
382
+ | `fast` | Remote | **`default`** | `default` | `gpt-5.4-mini` |
383
+ | `balanced` | Remote | **`default`** | `default` | `gpt-5.4` |
384
+ | `deep` | Remote | **`reasoning`** | `default` | `claude-sonnet-4.6` |
385
+ | `pro` | Remote | **`default`** | `default` | `gpt-5.5` |
386
+ | `json` | Remote | **`default`** | `default` | `gpt-5.4-mini` (schema output) |
387
+ | `agentic` | Remote | **`default`** | `default` | `claude-sonnet-4.6` |
388
+ | `research` | Remote | **`reasoning`** | `default` | `claude-sonnet-4.6` |
389
+ | `cyber` | Remote | **`reasoning`** | `default` | `claude-sonnet-4.6` |
390
+ | `content` | Remote | **`default`** | `default` | `claude-sonnet-4.6` |
391
+ | `summarization` | Remote | **`default`** | `default` | `claude-haiku-4.5` |
392
+ | `vision` | Remote | **`default`** | `default` | `gpt-5.4` |
393
+ | `open_weights` | Remote | **`default`** | `default` | `meta-llama/Llama-3.3-70b-instruct` |
394
+ | `local` | CPU | **`cpu`** | `llama_cpp_gguf` | `funcx:llama-cpp:gguf` |
395
+ | `local` | CPU | **`cpu`** | `transformersjs_default` | `Xenova/distilbart-cnn-6-6` |
177
396
 
178
397
  FuncX mode shortcuts (bundled): `weak` → local, `normal` → balanced, `strong` → pro, `ultra` → deep, `default` → balanced.
179
398
 
@@ -181,22 +400,63 @@ Local CPU choices expose FuncX env keys in `resolved.metadata` (e.g. `LLAMA_CPP_
181
400
 
182
401
  ### OpenRouter model ids
183
402
 
184
- Remote profile choices use vendor-native `modelId` values (e.g. `gpt-5.4`, `gemini-2.5-flash-lite`). Anthropic version segments follow OpenRouter slugs (`claude-sonnet-4.6`, not `claude-sonnet-4-6`). `@x12i/ai-tools` resolves these to full OpenRouter slugs (`openai/gpt-5.4`) and remaps deprecated ids when the bundled catalog is stale.
403
+ 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:
404
+
405
+ - `provider`: `"openrouter"`
406
+ - `modelId`: full slug such as `openai/gpt-5.4`
407
+ - `routing`: `"openrouter"`
408
+
409
+ Pass `useOpenRouter: false` (or `USE_OPENROUTER=0`) to get vendor-native `provider` + `modelId` for direct API calls.
410
+
411
+ Every resolved profile includes **`invocation`** with both call shapes:
412
+
413
+ ```ts
414
+ resolved.invocation.direct // { provider: "openai", modelId: "gpt-5.4" }
415
+ resolved.invocation.openrouter // { provider: "openrouter", modelId: "openai/gpt-5.4" } | null
416
+ ```
417
+
418
+ Top-level `provider` / `modelId` / `routing` remain the **active** path selected by `useOpenRouter`.
419
+
420
+ ### Vendor trimming
421
+
422
+ Restrict resolution to specific vendors (auto-picks within the profile when the default is outside the set). **Leading vendors** (`openai`, `anthropic`, `google`, `deepseek`, `xai`) are **preferred** during auto-pick, not forced — explicit `choice` still honors `together` and other providers.
423
+
424
+ ```ts
425
+ await resolveAIProfile("balanced", {
426
+ allowedProviders: ["google", "openai"],
427
+ preferLeadingVendors: true, // default
428
+ });
429
+ ```
185
430
 
186
431
  ### Keeping models aligned over time
187
432
 
433
+ Bundled linkage lives in `src/data/models-registry.json`, built from `models-profiles.json` and `src/data/models-catalog.json`.
434
+
435
+ Each catalog model has **two explicit call shapes** (never `provider: "openrouter"` with `modelId: "qwen/..."` as the only view):
436
+
437
+ - `direct` — vendor-native (`{ provider: "google", modelId: "gemini-3.5-flash" }`)
438
+ - `openrouter` — transport (`{ provider: "openrouter", modelId: "google/gemini-3.5-flash" }`)
439
+
440
+ Legacy open-assets files named `openrouter-models-catalog.json` are normalized into this shape on `catalog:pull`.
441
+
188
442
  When OpenRouter deprecates or renames a model slug:
189
443
 
190
444
  1. Update `src/data/models-profiles.json` to a current vendor-native id (preferred).
191
- 2. Refresh the OpenRouter catalog in `@x12i/ai-tools` (`openrouter-models-catalog.json`).
445
+ 2. Refresh `src/data/models-catalog.json` via `npm run catalog:pull` (fetched from open-assets, normalized locally).
192
446
  3. Run alignment checks before publishing:
193
447
 
194
448
  ```bash
195
- npm run verify:openrouter # bundled profiles vs ai-tools catalog (sibling or dev install)
196
- npm run verify:openrouter:live # same vs live open-assets catalog (pre-release)
449
+ npm run registry:finish # merge profile catalog supplement, verified defaults, rebuild linkage
450
+ npm run catalog:sync # pull catalog, rebuild models-registry.json, verify
451
+ npm run catalog:pull # fetch open-assets catalog into src/data/
452
+ npm run catalog:build # rebuild models-registry.json + reports/fault-report.json
453
+ npm run verify:openrouter # alias for catalog:verify (fails on faulty OR linkage only)
454
+ npm run verify:openrouter:live # legacy script vs live catalog
197
455
  ```
198
456
 
199
- 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).
457
+ With the seed catalog (<50 models), choices not yet listed are marked `catalog-miss` in the registry (warnings in `reports/fault-report.json`, not CI failures). A full catalog promotes true `faulty` rows for slug mismatches.
458
+
459
+ Unit tests in `test/openrouterAlignment.test.ts`, `test/modelIdentity.test.ts`, and `test/resolveModelRouting.test.ts` guard resolution rules offline.
200
460
 
201
461
  Vendor-direct-only choices (not routed via OpenRouter) can opt out:
202
462
 
@@ -0,0 +1,29 @@
1
+ import type { ModelsCatalogJson } from "./types.js";
2
+ export type OpenRouterApiModel = {
3
+ id: string;
4
+ canonical_slug?: string;
5
+ name?: string;
6
+ created?: number;
7
+ description?: string;
8
+ context_length?: number;
9
+ architecture?: {
10
+ modality?: string;
11
+ input_modalities?: string[];
12
+ output_modalities?: string[];
13
+ };
14
+ pricing?: Record<string, string | null | undefined>;
15
+ top_provider?: {
16
+ max_completion_tokens?: number;
17
+ };
18
+ supported_parameters?: string[];
19
+ knowledge_cutoff?: string | null;
20
+ expiration_date?: string | null;
21
+ };
22
+ export type OpenRouterApiModelsResponse = {
23
+ data: OpenRouterApiModel[];
24
+ };
25
+ /** Build the legacy OpenRouter-only catalog document (fed into {@link normalizeModelsCatalog}). */
26
+ export declare function buildLegacyCatalogFromOpenRouterApi(response: OpenRouterApiModelsResponse): Record<string, unknown>;
27
+ /** Fetch response → unified {@link ModelsCatalogJson}. */
28
+ export declare function buildModelsCatalogFromOpenRouterApi(response: OpenRouterApiModelsResponse): ModelsCatalogJson;
29
+ //# sourceMappingURL=buildCatalogFromOpenRouterApi.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"buildCatalogFromOpenRouterApi.d.ts","sourceRoot":"","sources":["../src/buildCatalogFromOpenRouterApi.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAiC,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAEnF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,YAAY,CAAC,EAAE;QACb,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;QAC5B,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;KAC9B,CAAC;IACF,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC,CAAC;IACpD,YAAY,CAAC,EAAE;QACb,qBAAqB,CAAC,EAAE,MAAM,CAAC;KAChC,CAAC;IACF,oBAAoB,CAAC,EAAE,MAAM,EAAE,CAAC;IAChC,gBAAgB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACjC,CAAC;AAEF,MAAM,MAAM,2BAA2B,GAAG;IACxC,IAAI,EAAE,kBAAkB,EAAE,CAAC;CAC5B,CAAC;AA8FF,mGAAmG;AACnG,wBAAgB,mCAAmC,CACjD,QAAQ,EAAE,2BAA2B,GACpC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAoBzB;AAED,0DAA0D;AAC1D,wBAAgB,mCAAmC,CACjD,QAAQ,EAAE,2BAA2B,GACpC,iBAAiB,CAoBnB"}
@@ -0,0 +1,113 @@
1
+ import { OPENROUTER_MODELS_API_URL } from "./constants.js";
2
+ import { MODELS_CATALOG_REMOTE_URL, normalizeModelsCatalog, } from "./modelsCatalog.js";
3
+ function perTokenToPerMillion(tokenPrice) {
4
+ if (tokenPrice === null || tokenPrice === undefined || tokenPrice === "") {
5
+ return undefined;
6
+ }
7
+ const perToken = Number(tokenPrice);
8
+ if (!Number.isFinite(perToken)) {
9
+ return undefined;
10
+ }
11
+ return perToken * 1_000_000;
12
+ }
13
+ function inferFamily(modelId) {
14
+ const slash = modelId.indexOf("/");
15
+ if (slash <= 0) {
16
+ return undefined;
17
+ }
18
+ let prefix = modelId.slice(0, slash).toLowerCase();
19
+ if (prefix.startsWith("~")) {
20
+ prefix = prefix.slice(1);
21
+ }
22
+ return prefix || undefined;
23
+ }
24
+ function mapModalities(model) {
25
+ const input = model.architecture?.input_modalities ?? ["text"];
26
+ const output = model.architecture?.output_modalities ?? ["text"];
27
+ return {
28
+ input: input.map((m) => m.toLowerCase()),
29
+ output: output.map((m) => m.toLowerCase()),
30
+ };
31
+ }
32
+ function inferCapabilities(supported) {
33
+ if (!supported?.length) {
34
+ return undefined;
35
+ }
36
+ const caps = {};
37
+ if (supported.some((p) => p === "reasoning" || p === "include_reasoning")) {
38
+ caps.reasoning = true;
39
+ }
40
+ if (supported.some((p) => p === "tools" || p === "tool_choice")) {
41
+ caps.toolCalling = true;
42
+ }
43
+ if (supported.some((p) => p === "structured_outputs")) {
44
+ caps.structuredOutputs = true;
45
+ }
46
+ return Object.keys(caps).length > 0 ? caps : undefined;
47
+ }
48
+ function mapLegacyEntry(model) {
49
+ const pricing = model.pricing ?? {};
50
+ return {
51
+ modelId: model.id,
52
+ canonicalSlug: model.canonical_slug,
53
+ displayName: model.name,
54
+ family: inferFamily(model.id),
55
+ status: model.expiration_date ? "deprecated" : "active",
56
+ modalities: mapModalities(model),
57
+ contextWindow: model.context_length,
58
+ maxCompletionTokens: model.top_provider?.max_completion_tokens,
59
+ knowledgeCutoff: model.knowledge_cutoff ?? undefined,
60
+ pricing: {
61
+ input: perTokenToPerMillion(pricing.prompt),
62
+ output: perTokenToPerMillion(pricing.completion),
63
+ cachedInput: perTokenToPerMillion(pricing.input_cache_read),
64
+ cacheWrite: perTokenToPerMillion(pricing.input_cache_write),
65
+ imageInput: perTokenToPerMillion(pricing.image),
66
+ audioInput: perTokenToPerMillion(pricing.audio),
67
+ internalReasoning: perTokenToPerMillion(pricing.internal_reasoning),
68
+ webSearchPerRequest: perTokenToPerMillion(pricing.web_search),
69
+ },
70
+ capabilities: inferCapabilities(model.supported_parameters),
71
+ };
72
+ }
73
+ /** Build the legacy OpenRouter-only catalog document (fed into {@link normalizeModelsCatalog}). */
74
+ export function buildLegacyCatalogFromOpenRouterApi(response) {
75
+ const models = (response.data ?? []).filter((m) => m?.id?.trim());
76
+ return {
77
+ schema: "x12i.openrouter-models.catalog",
78
+ version: "1.0.0",
79
+ generatedAt: new Date().toISOString(),
80
+ source: {
81
+ catalogUrl: OPENROUTER_MODELS_API_URL,
82
+ pricingUrl: "https://openrouter.ai/pricing",
83
+ verifiedAt: new Date().toISOString().slice(0, 10),
84
+ normalization: "OpenRouter API pricing fields are per-token decimal strings. Values are normalized to USD per 1M tokens.",
85
+ },
86
+ notes: [
87
+ "Generated from https://openrouter.ai/api/v1/models.",
88
+ "Upload the normalized models-catalog.json to open-assets for remote refresh.",
89
+ ],
90
+ models: models.map(mapLegacyEntry),
91
+ };
92
+ }
93
+ /** Fetch response → unified {@link ModelsCatalogJson}. */
94
+ export function buildModelsCatalogFromOpenRouterApi(response) {
95
+ const legacy = buildLegacyCatalogFromOpenRouterApi(response);
96
+ const catalog = normalizeModelsCatalog(legacy);
97
+ return {
98
+ ...catalog,
99
+ sources: {
100
+ openrouter: {
101
+ catalogUrl: OPENROUTER_MODELS_API_URL,
102
+ pricingUrl: "https://openrouter.ai/pricing",
103
+ verifiedAt: new Date().toISOString().slice(0, 10),
104
+ normalization: "OpenRouter API pricing fields are per-token decimal strings. Values are normalized to USD per 1M tokens.",
105
+ },
106
+ },
107
+ notes: [
108
+ ...(catalog.notes ?? []),
109
+ `Remote asset URL: ${MODELS_CATALOG_REMOTE_URL}`,
110
+ ],
111
+ };
112
+ }
113
+ //# sourceMappingURL=buildCatalogFromOpenRouterApi.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"buildCatalogFromOpenRouterApi.js","sourceRoot":"","sources":["../src/buildCatalogFromOpenRouterApi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,EACL,yBAAyB,EACzB,sBAAsB,GACvB,MAAM,oBAAoB,CAAC;AA4B5B,SAAS,oBAAoB,CAC3B,UAAqC;IAErC,IAAI,UAAU,KAAK,IAAI,IAAI,UAAU,KAAK,SAAS,IAAI,UAAU,KAAK,EAAE,EAAE,CAAC;QACzE,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,QAAQ,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC;IACpC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC/B,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,OAAO,QAAQ,GAAG,SAAS,CAAC;AAC9B,CAAC;AAED,SAAS,WAAW,CAAC,OAAe;IAClC,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACnC,IAAI,KAAK,IAAI,CAAC,EAAE,CAAC;QACf,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,IAAI,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,WAAW,EAAE,CAAC;IACnD,IAAI,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;QAC3B,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAC3B,CAAC;IAED,OAAO,MAAM,IAAI,SA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types.js";
2
+ import { validateProfileVendorCoverage } from "./validateProfileVendorCoverage.js";
3
+ export interface FaultyProfileChoice {
4
+ profile: string;
5
+ choice: string;
6
+ registryKey: string;
7
+ invocation: ModelRegistryEntry["invocation"];
8
+ candidates: string[];
9
+ }
10
+ export interface CatalogMissChoice {
11
+ profile: string;
12
+ choice: string;
13
+ registryKey: string;
14
+ invocation: ModelRegistryEntry["invocation"];
15
+ candidates: string[];
16
+ }
17
+ export interface ModelsRegistryBuildResult {
18
+ registry: ModelsRegistryJson;
19
+ faulty: FaultyProfileChoice[];
20
+ catalogMiss: CatalogMissChoice[];
21
+ vendorWarnings: ReturnType<typeof validateProfileVendorCoverage>;
22
+ }
23
+ export declare function buildModelsRegistry(profiles: ModelsProfilesJson, catalog: ModelsCatalogJson | unknown): ModelsRegistryBuildResult;
24
+ export declare function listFaultyFromRegistry(registry: ModelsRegistryJson): FaultyProfileChoice[];
25
+ //# sourceMappingURL=buildModelsRegistry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"buildModelsRegistry.d.ts","sourceRoot":"","sources":["../src/buildModelsRegistry.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EACV,kBAAkB,EAClB,kBAAkB,EAClB,kBAAkB,EAClB,iBAAiB,EAClB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,6BAA6B,EAAE,MAAM,oCAAoC,CAAC;AAEnF,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,kBAAkB,CAAC,YAAY,CAAC,CAAC;IAC7C,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB;AAED,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,kBAAkB,CAAC,YAAY,CAAC,CAAC;IAC7C,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB;AAED,MAAM,WAAW,yBAAyB;IACxC,QAAQ,EAAE,kBAAkB,CAAC;IAC7B,MAAM,EAAE,mBAAmB,EAAE,CAAC;IAC9B,WAAW,EAAE,iBAAiB,EAAE,CAAC;IACjC,cAAc,EAAE,UAAU,CAAC,OAAO,6BAA6B,CAAC,CAAC;CAClE;AAgBD,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,kBAAkB,EAC5B,OAAO,EAAE,iBAAiB,GAAG,OAAO,GACnC,yBAAyB,CA6J3B;AAmBD,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,kBAAkB,GAC3B,mBAAmB,EAAE,CAoBvB"}