@x12i/ai-profiles 1.4.0 → 1.6.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 (148) hide show
  1. package/README.md +237 -21
  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 +3 -1
  11. package/dist/buildResolvedProfile.d.ts.map +1 -1
  12. package/dist/buildResolvedProfile.js +94 -11
  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 +26 -1
  44. package/dist/index.d.ts.map +1 -1
  45. package/dist/index.js +21 -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 +161 -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 +62 -18
  116. package/dist/resolveAIProfile.js.map +1 -1
  117. package/dist/resolveModelIdentity.d.ts +17 -0
  118. package/dist/resolveModelIdentity.d.ts.map +1 -0
  119. package/dist/resolveModelIdentity.js +107 -0
  120. package/dist/resolveModelIdentity.js.map +1 -0
  121. package/dist/resolveModelRouting.d.ts +2 -1
  122. package/dist/resolveModelRouting.d.ts.map +1 -1
  123. package/dist/resolveModelRouting.js +9 -10
  124. package/dist/resolveModelRouting.js.map +1 -1
  125. package/dist/types.d.ts +339 -4
  126. package/dist/types.d.ts.map +1 -1
  127. package/dist/types.js +10 -0
  128. package/dist/types.js.map +1 -1
  129. package/dist/validateProfileVendorCoverage.d.ts +12 -0
  130. package/dist/validateProfileVendorCoverage.d.ts.map +1 -0
  131. package/dist/validateProfileVendorCoverage.js +58 -0
  132. package/dist/validateProfileVendorCoverage.js.map +1 -0
  133. package/dist/validation/openRouterAlignment.d.ts +6 -15
  134. package/dist/validation/openRouterAlignment.d.ts.map +1 -1
  135. package/dist/validation/openRouterAlignment.js +9 -57
  136. package/dist/validation/openRouterAlignment.js.map +1 -1
  137. package/dist/validation/validateModelsCatalog.d.ts +3 -0
  138. package/dist/validation/validateModelsCatalog.d.ts.map +1 -0
  139. package/dist/validation/validateModelsCatalog.js +42 -0
  140. package/dist/validation/validateModelsCatalog.js.map +1 -0
  141. package/dist/validation/validateModelsProfilesJson.d.ts.map +1 -1
  142. package/dist/validation/validateModelsProfilesJson.js +38 -2
  143. package/dist/validation/validateModelsProfilesJson.js.map +1 -1
  144. package/dist/vendorPolicy.d.ts +20 -0
  145. package/dist/vendorPolicy.d.ts.map +1 -0
  146. package/dist/vendorPolicy.js +71 -0
  147. package/dist/vendorPolicy.js.map +1 -0
  148. package/package.json +12 -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
@@ -10,17 +90,63 @@ npm install @x12i/ai-profiles
10
90
 
11
91
  ## Public API
12
92
 
93
+ ### Profiles and registry loading
94
+
13
95
  | Export | Sync? | Purpose |
14
96
  |--------|-------|---------|
15
97
  | `listAIProfiles(options?)` | No (async) | Profile summaries: primary `profile` key, `aliases[]`, choices, defaults |
98
+ | `getAIRegistryStatistics(options?)` | No (async) | Counts: profiles, choices, providers, shortcuts, catalog models, linkage health |
99
+ | `formatRegistryStatistics(stats)` | Yes | Human-readable summary for logs / CLI |
100
+ | `loadAIProfilesRegistry(options?)` | No (async) | Raw profiles + shortcuts registry (`auto` / `remote` / `bundled`, 24h memory cache) |
101
+ | `loadAIProfilesRegistryWithWarnings(options?)` | No (async) | Same as above, plus `warnings[]` (stale cache, bundled fallback, etc.) |
102
+ | `loadModelsCatalog(options?)` | No (async) | Unified models catalog (`auto` / `remote` / `bundled`, same cache pattern as profiles) |
103
+ | `loadBundledModelsCatalog()` | Yes | Package-shipped `models-catalog.json` only |
104
+ | `loadBundledModelsRegistry()` | Yes | Package-shipped `models-registry.json` (linkage index) |
16
105
  | `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 |
106
+ | `resolveAIProfile(input, options?)` | No (async) | Resolve profile/shortcut/alias → model, pricing, runtime, canonical `profile` key |
20
107
  | `isKnownProfileOrShortcut(input)` | Yes (bundled only) | Whether input is a known primary key, shortcut, or alias |
21
108
  | `AIProfilesError` | — | Typed errors (`UNKNOWN_PROFILE`, …) |
22
109
 
23
- Registry JSON lives in `models-profiles.json` (profiles + aliases) and `profiles-shortcuts.json` (shortcuts).
110
+ ### Model identity (vendor + model strings)
111
+
112
+ Use these when callers pass **raw model ids or OpenRouter slugs**, not profile names.
113
+
114
+ | Export | Sync? | Purpose |
115
+ |--------|-------|---------|
116
+ | `resolveModelIdentity(input, options?)` | Yes | Given a bare id or `vendor/slug`, return `{ provider, modelId, invocation? }` via bundled registry + catalog fallback |
117
+ | `buildModelInvocation(provider, modelId)` | Yes | `{ direct, openrouter }` endpoints for a provider hint + model string |
118
+ | `buildDirectInvocation(provider, modelId)` | Yes | Vendor-direct `{ provider, modelId }`; splits prefixed slugs for all vendors |
119
+ | `buildOpenRouterModelId(provider, modelId)` | Yes | Build an OpenRouter slug (`openai/gpt-5.4`) from registry fields |
120
+ | `parseDirectFromOpenRouterSlug(slug, family?)` | Yes | Split `vendor/model` → direct slice (`custom` + bare id when vendor is not a first-class provider) |
121
+ | `normalizeAnthropicVersionSlug(slug)` | Yes | Dotted minor versions for Anthropic (`4-6` → `4.6`) |
122
+ | `buildRegistryKey(provider, modelId)` | Yes | Stable registry key (`vendor:…`) used in `models-registry.json` |
123
+ | `matchOpenRouterCatalog(provider, modelId, index)` | Yes | Match a choice against a catalog index |
124
+ | `lookupInvocationForChoice(registry, provider, modelId)` | Yes | Lookup prebuilt invocation from `models-registry.json` |
125
+
126
+ **Prefixed slugs:** `buildDirectInvocation("meta-llama", "meta-llama/llama-3.1-8b-instruct")` yields `{ provider: "meta-llama", modelId: "llama-3.1-8b-instruct" }`. Host paths keep the nested id when the provider hint differs (e.g. Together: `together` + `meta-llama/Llama-3.3-70b-instruct`). Bare and prefixed Anthropic inputs normalize to the same direct and OpenRouter ids.
127
+
128
+ ### Routing, validation, and maintainer tooling
129
+
130
+ | Export | Sync? | Purpose |
131
+ |--------|-------|---------|
132
+ | `resolveUseOpenRouter(explicit?)` | Yes | Resolve OpenRouter vs vendor-direct routing (option → env → default) |
133
+ | `validateBundledProfileVendorCoverage(options?)` | Yes | Advisory report of leading-vendor coverage per profile |
134
+ | `isProfileVendorTrimReady(profile, allowedProviders)` | Yes | Whether auto-pick can satisfy a vendor filter |
135
+ | `listFaultyProfileChoices()` | Yes | Profile choices with faulty OpenRouter catalog linkage |
136
+ | `buildModelsRegistry`, `verifyOpenRouterAlignment`, … | Yes | Catalog/registry build and alignment (see scripts below) |
137
+
138
+ Registry JSON lives in four bundled assets:
139
+
140
+ | File | Schema | Role |
141
+ |------|--------|------|
142
+ | `models-profiles.json` | `x12i.ai-profiles.model-registry.v3` | Profile intent, choices, `requiredCapabilities`, `modelStatus` — **no embedded pricing** |
143
+ | `models-catalog.json` | `x12i.ai-profiles.models-catalog` | Per-model pricing, context window, capabilities (OpenRouter-normalized) |
144
+ | `models-registry.json` | `x12i.ai-profiles.models-registry` | Built linkage index: vendor keys, OpenRouter slugs, `invocation` pairs |
145
+ | `profiles-shortcuts.json` | `x12i.ai-profiles.shortcuts` | Named entry points |
146
+
147
+ **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`.
148
+
149
+ 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).
24
150
 
25
151
  ## Basic usage
26
152
 
@@ -39,11 +165,40 @@ console.log(model.profile); // canonical primary key: cheap
39
165
  console.log(model.provider); // "openrouter" by default for remote profiles
40
166
  console.log(model.modelId); // "google/gemini-2.5-flash-lite"
41
167
  console.log(model.routing); // "openrouter" | "direct"
42
- console.log(model.pricing);
168
+ console.log(model.pricing); // from models-catalog.json
169
+ console.log(model.modelStatus); // verified | predicted
170
+ console.log(model.requiredCapabilities); // profile intent
171
+ console.log(model.capabilities); // contextWindow, supportsTools, …
43
172
  console.log(model.instructionTier);
44
173
  console.log(model.backend);
45
174
  ```
46
175
 
176
+ ## Registry statistics
177
+
178
+ 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.
179
+
180
+ ```ts
181
+ import {
182
+ formatRegistryStatistics,
183
+ getAIRegistryStatistics,
184
+ } from "@x12i/ai-profiles";
185
+
186
+ const { statistics, warnings } = await getAIRegistryStatistics({
187
+ source: "bundled", // or "auto" | "remote"
188
+ includeCatalog: true,
189
+ includeLinkage: true,
190
+ });
191
+
192
+ console.log(statistics.profiles.total);
193
+ console.log(statistics.profiles.providers);
194
+ console.log(statistics.catalog?.totalModels);
195
+ console.log(statistics.linkage?.faulty);
196
+
197
+ console.log(formatRegistryStatistics(statistics));
198
+ ```
199
+
200
+ CLI (after build): `npm run stats` (text) or `npm run stats:json`.
201
+
47
202
  ## Naming: many names, one profile
48
203
 
49
204
  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.
@@ -172,15 +327,31 @@ await resolveAIProfile("cheap", { useOpenRouter: true }); // still OpenRouter
172
327
  Helper exports:
173
328
 
174
329
  ```ts
175
- import { resolveUseOpenRouter, buildOpenRouterModelId } from "@x12i/ai-profiles";
330
+ import {
331
+ resolveUseOpenRouter,
332
+ buildOpenRouterModelId,
333
+ buildModelInvocation,
334
+ resolveModelIdentity,
335
+ } from "@x12i/ai-profiles";
176
336
 
177
337
  resolveUseOpenRouter(); // true by default
178
338
  resolveUseOpenRouter(false); // explicit override
179
339
 
180
340
  buildOpenRouterModelId("openai", "gpt-5.4"); // "openai/gpt-5.4"
341
+
342
+ // Same direct + OpenRouter shape whether input is bare or prefixed:
343
+ buildModelInvocation("anthropic", "claude-3-5-sonnet-20241022");
344
+ buildModelInvocation("anthropic", "anthropic/claude-3-5-sonnet-20241022");
345
+
346
+ // Bare model string → vendor + model (no profile name required):
347
+ resolveModelIdentity("google/gemini-2.5-flash-lite");
348
+ // { provider: "google", modelId: "gemini-2.5-flash-lite", invocation: { … } }
349
+
350
+ resolveModelIdentity("google/gemini-2.5-flash-lite", { asOpenRouter: true });
351
+ // { provider: "openrouter", modelId: "google/gemini-2.5-flash-lite", … }
181
352
  ```
182
353
 
183
- Tests: `test/resolveModelRouting.test.ts`.
354
+ Tests: `test/resolveModelRouting.test.ts`, `test/modelIdentity.test.ts`, `test/resolveModelIdentity.test.ts`.
184
355
 
185
356
  ## Use bundled only
186
357
 
@@ -249,15 +420,25 @@ const modelConfig = {
249
420
 
250
421
  ## Profile matrix (FuncX contract)
251
422
 
252
- | Profile | Inference | Instruction tier | Example model |
253
- |---------|-----------|------------------|---------------|
254
- | `cheap` | Remote | **`default`** | `gemini-2.5-flash-lite` |
255
- | `fast` | Remote | **`default`** | `gpt-5.4-mini` |
256
- | `balanced` | Remote | **`default`** | `gpt-5.4` |
257
- | `deep` | Remote | **`reasoning`** | `claude-sonnet-4.6` |
258
- | `pro` | Remote | **`default`** | `gpt-5.5` |
259
- | `local` / `llama_cpp_gguf` | CPU | **`cpu`** | `funcx:llama-cpp:gguf` |
260
- | `local` / `transformersjs_default` | CPU | **`cpu`** | `Xenova/distilbart-cnn-6-6` |
423
+ Default choice per profile (vendor-native ids in registry; OpenRouter slugs when `useOpenRouter` is true):
424
+
425
+ | Profile | Inference | Instruction tier | Default choice | Example model |
426
+ |---------|-----------|------------------|----------------|---------------|
427
+ | `cheap` | Remote | **`default`** | `default` | `gemini-2.5-flash-lite` |
428
+ | `fast` | Remote | **`default`** | `default` | `gpt-5.4-mini` |
429
+ | `balanced` | Remote | **`default`** | `default` | `gpt-5.4` |
430
+ | `deep` | Remote | **`reasoning`** | `default` | `claude-sonnet-4.6` |
431
+ | `pro` | Remote | **`default`** | `default` | `gpt-5.5` |
432
+ | `json` | Remote | **`default`** | `default` | `gpt-5.4-mini` (schema output) |
433
+ | `agentic` | Remote | **`default`** | `default` | `claude-sonnet-4.6` |
434
+ | `research` | Remote | **`reasoning`** | `default` | `claude-sonnet-4.6` |
435
+ | `cyber` | Remote | **`reasoning`** | `default` | `claude-sonnet-4.6` |
436
+ | `content` | Remote | **`default`** | `default` | `claude-sonnet-4.6` |
437
+ | `summarization` | Remote | **`default`** | `default` | `claude-haiku-4.5` |
438
+ | `vision` | Remote | **`default`** | `default` | `gpt-5.4` |
439
+ | `open_weights` | Remote | **`default`** | `default` | `meta-llama/Llama-3.3-70b-instruct` |
440
+ | `local` | CPU | **`cpu`** | `llama_cpp_gguf` | `funcx:llama-cpp:gguf` |
441
+ | `local` | CPU | **`cpu`** | `transformersjs_default` | `Xenova/distilbart-cnn-6-6` |
261
442
 
262
443
  FuncX mode shortcuts (bundled): `weak` → local, `normal` → balanced, `strong` → pro, `ultra` → deep, `default` → balanced.
263
444
 
@@ -271,22 +452,57 @@ Remote profile choices in `models-profiles.json` use vendor-native `modelId` val
271
452
  - `modelId`: full slug such as `openai/gpt-5.4`
272
453
  - `routing`: `"openrouter"`
273
454
 
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.
455
+ Pass `useOpenRouter: false` (or `USE_OPENROUTER=0`) to get vendor-native `provider` + `modelId` for direct API calls.
456
+
457
+ Every resolved profile includes **`invocation`** with both call shapes:
458
+
459
+ ```ts
460
+ resolved.invocation.direct // { provider: "openai", modelId: "gpt-5.4" }
461
+ resolved.invocation.openrouter // { provider: "openrouter", modelId: "openai/gpt-5.4" } | null
462
+ ```
463
+
464
+ Top-level `provider` / `modelId` / `routing` remain the **active** path selected by `useOpenRouter`.
465
+
466
+ ### Vendor trimming
467
+
468
+ 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.
469
+
470
+ ```ts
471
+ await resolveAIProfile("balanced", {
472
+ allowedProviders: ["google", "openai"],
473
+ preferLeadingVendors: true, // default
474
+ });
475
+ ```
275
476
 
276
477
  ### Keeping models aligned over time
277
478
 
479
+ Bundled linkage lives in `src/data/models-registry.json`, built from `models-profiles.json` and `src/data/models-catalog.json`.
480
+
481
+ Each catalog model has **two explicit call shapes** (never `provider: "openrouter"` with `modelId: "qwen/..."` as the only view):
482
+
483
+ - `direct` — vendor-native (`{ provider: "google", modelId: "gemini-3.5-flash" }`)
484
+ - `openrouter` — transport (`{ provider: "openrouter", modelId: "google/gemini-3.5-flash" }`)
485
+
486
+ Legacy open-assets files named `openrouter-models-catalog.json` are normalized into this shape on `catalog:pull`.
487
+
278
488
  When OpenRouter deprecates or renames a model slug:
279
489
 
280
490
  1. Update `src/data/models-profiles.json` to a current vendor-native id (preferred).
281
- 2. Refresh the OpenRouter catalog in `@x12i/ai-tools` (`openrouter-models-catalog.json`).
491
+ 2. Refresh `src/data/models-catalog.json` via `npm run catalog:pull` (fetched from open-assets, normalized locally).
282
492
  3. Run alignment checks before publishing:
283
493
 
284
494
  ```bash
285
- npm run verify:openrouter # bundled profiles vs ai-tools catalog (sibling or dev install)
286
- npm run verify:openrouter:live # same vs live open-assets catalog (pre-release)
495
+ npm run registry:finish # merge profile catalog supplement, verified defaults, rebuild linkage
496
+ npm run catalog:sync # pull catalog, rebuild models-registry.json, verify
497
+ npm run catalog:pull # fetch open-assets catalog into src/data/
498
+ npm run catalog:build # rebuild models-registry.json + reports/fault-report.json
499
+ npm run verify:openrouter # alias for catalog:verify (fails on faulty OR linkage only)
500
+ npm run verify:openrouter:live # legacy script vs live catalog
287
501
  ```
288
502
 
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).
503
+ 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.
504
+
505
+ Unit tests in `test/openrouterAlignment.test.ts`, `test/modelIdentity.test.ts`, `test/resolveModelIdentity.test.ts`, and `test/resolveModelRouting.test.ts` guard resolution rules offline.
290
506
 
291
507
  Vendor-direct-only choices (not routed via OpenRouter) can opt out:
292
508
 
@@ -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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aAAa,EACX,0GAA0G;aAC7G;SACF;QACD,KAAK,EAAE;YACL,GAAG,CAAC,OAAO,CAAC,KAAK,IAAI,EAAE,CAAC;YACxB,qBAAqB,yBAAyB,EAAE;SACjD;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,25 @@
1
+ import type { ModelRegistryEntry, ModelsProfilesJson, ModelsRegistryJson, ModelsCatalogJson } from "./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"}