@agentproto/model-catalog 0.9.1 → 0.9.4
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/dist/access/index.mjs +3 -3
- package/dist/{chunk-HL2G36MT.mjs → chunk-3Y5TQDGE.mjs} +3 -3
- package/dist/{chunk-HL2G36MT.mjs.map → chunk-3Y5TQDGE.mjs.map} +1 -1
- package/dist/{chunk-PUIEZ3G4.mjs → chunk-5XUA72EH.mjs} +3 -3
- package/dist/{chunk-PUIEZ3G4.mjs.map → chunk-5XUA72EH.mjs.map} +1 -1
- package/dist/{chunk-MR5ZPIUN.mjs → chunk-6VUL4I7V.mjs} +213 -112
- package/dist/chunk-6VUL4I7V.mjs.map +1 -0
- package/dist/{chunk-RK6MHEIS.mjs → chunk-GW52XH4V.mjs} +154 -37
- package/dist/chunk-GW52XH4V.mjs.map +1 -0
- package/dist/{chunk-BZ7O32GA.mjs → chunk-H467PHUU.mjs} +3 -3
- package/dist/{chunk-BZ7O32GA.mjs.map → chunk-H467PHUU.mjs.map} +1 -1
- package/dist/{chunk-RKG52ASE.mjs → chunk-JHBSGPWH.mjs} +5 -5
- package/dist/{chunk-RKG52ASE.mjs.map → chunk-JHBSGPWH.mjs.map} +1 -1
- package/dist/{chunk-DW45X6XT.mjs → chunk-QNJRWRWC.mjs} +18 -3
- package/dist/chunk-QNJRWRWC.mjs.map +1 -0
- package/dist/{chunk-O7ZJEMH6.mjs → chunk-UREM2UZK.mjs} +4 -4
- package/dist/{chunk-O7ZJEMH6.mjs.map → chunk-UREM2UZK.mjs.map} +1 -1
- package/dist/{chunk-LE7NKYLT.mjs → chunk-V2BMFFUF.mjs} +4 -4
- package/dist/{chunk-LE7NKYLT.mjs.map → chunk-V2BMFFUF.mjs.map} +1 -1
- package/dist/cost/index.mjs +6 -6
- package/dist/curation/index.mjs +6 -6
- package/dist/index.mjs +11 -11
- package/dist/llm/index.mjs +1 -1
- package/dist/route-identity/index.mjs +3 -3
- package/dist/schema/index.mjs +2 -2
- package/package.json +5 -4
- package/dist/chunk-DW45X6XT.mjs.map +0 -1
- package/dist/chunk-MR5ZPIUN.mjs.map +0 -1
- package/dist/chunk-RK6MHEIS.mjs.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DEFAULT_PRICING } from './chunk-
|
|
1
|
+
import { DEFAULT_PRICING } from './chunk-6VUL4I7V.mjs';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* @agentproto/model-catalog v0.1.0
|
|
@@ -364,5 +364,5 @@ function modelMatchesKind(model, kind) {
|
|
|
364
364
|
}
|
|
365
365
|
|
|
366
366
|
export { assertReservedPrefixDiscipline, getActions, getEnrichment, isActionTag, modelHasAction, modelHasTag, modelMatchesCatalogPriceTier, modelMatchesKind, modelMatchesPriceTier, priceTierForModel };
|
|
367
|
-
//# sourceMappingURL=chunk-
|
|
368
|
-
//# sourceMappingURL=chunk-
|
|
367
|
+
//# sourceMappingURL=chunk-H467PHUU.mjs.map
|
|
368
|
+
//# sourceMappingURL=chunk-H467PHUU.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/registry/actions.ts","../src/enrichment/index.ts"],"names":[],"mappings":";;;;;;;;;AA0BA,IAAM,sBAAA,GAAyB,CAAC,MAAA,EAAQ,QAAA,EAAU,UAAU,QAAQ,CAAA;AAM7D,SAAS,WAAW,KAAA,EAAgC;AACzD,EAAA,QAAQ,MAAM,IAAA;AAAM,IAClB,KAAK,OAAA,EAAS;AACZ,MAAA,MAAM,MAAgB,EAAC;AACvB,MAAA,MAAM,CAAA,GAAI,MAAM,GAAA,CAAI,YAAA;AACpB,MAAA,IAAI,CAAA,CAAE,QAAA,EAAU,GAAA,CAAI,IAAA,CAAK,gBAAgB,CAAA;AACzC,MAAA,IAAI,CAAA,CAAE,IAAA,EAAM,GAAA,CAAI,IAAA,CAAK,YAAY,CAAA;AACjC,MAAA,IAAI,CAAA,CAAE,OAAA,EA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A,CAAc,KAAK,CAAA,CAAE,gBAAA,KAAqB,IAAA;AACnD;AAQO,SAAS,qBAAA,CACd,OACA,IAAA,EACS;AACT,EAAA,OAAO,4BAAA,CAA6B,OAAO,IAAI,CAAA;AACjD;AAEO,SAAS,gBAAA,CACd,OACA,IAAA,EACS;AACT,EAAA,OAAO,MAAM,IAAA,KAAS,IAAA;AACxB","file":"chunk-BZ7O32GA.mjs","sourcesContent":["/**\n * Action projection — `<kind>:<verb>` namespaced strings derived from\n * each model's per-kind capability object.\n *\n * Convention:\n * - `image:generate`, `image:edit`, `image:upscale`, `image:reference`\n * - `video:text_to`, `video:image_to`, `video:subject_reference`,\n * `video:audio`\n * - `audio:tts`, `audio:stt`, `audio:realtime`\n * - `llm:vision`, `llm:tool_use`, `llm:reasoning`, `llm:long_context`\n *\n * Always `<kind>:<verb_or_modifier>`, snake_case.\n *\n * Action tags share a string array with curation tags but live behind the\n * reserved `<kind>:` prefix. Curation tags MUST NOT use the prefix —\n * `assertReservedPrefixDiscipline` enforces this at module load.\n *\n * The reason this lives in the catalog package (not enrichment) is that\n * actions are intrinsic to a model — derived from its capability fields,\n * not subjectively curated. Keeping the projection separate makes it\n * trivially callable from anywhere (e.g. a UI badge component) without\n * pulling the heuristic enrichment table.\n */\n\nimport type { ResolvedModel } from \"./index.js\"\n\nconst RESERVED_KIND_PREFIXES = [\"llm:\", \"image:\", \"video:\", \"audio:\"] as const\n\n/**\n * Compute the action tags a model supports. Returns an empty array for\n * models with no recognized capability bits (defensive — never throws).\n */\nexport function getActions(model: ResolvedModel): string[] {\n switch (model.kind) {\n case \"image\": {\n const out: string[] = []\n const c = model.def.capabilities\n if (c.generate) out.push(\"image:generate\")\n if (c.edit) out.push(\"image:edit\")\n if (c.upscale) out.push(\"image:upscale\")\n if (model.def.referenceImages.supported) out.push(\"image:reference\")\n return out\n }\n case \"video\": {\n const out: string[] = []\n const c = model.def.capabilities\n if (c.textToVideo) out.push(\"video:text_to\")\n if (c.imageToVideo) out.push(\"video:image_to\")\n if (c.subjectReference) out.push(\"video:subject_reference\")\n if (c.audio) out.push(\"video:audio\")\n return out\n }\n case \"audio\": {\n const out: string[] = []\n const c = model.def.capabilities\n // One action per enabled modality (a model may do more than one).\n if (c.tts) out.push(\"audio:tts\")\n if (c.stt) out.push(\"audio:stt\")\n if (c.s2s) out.push(\"audio:s2s\")\n if (c.voiceCloning) out.push(\"audio:voice_cloning\")\n if (c.streaming) out.push(\"audio:streaming\")\n if (c.diarization) out.push(\"audio:diarization\")\n if (c.timestamps) out.push(\"audio:timestamps\")\n return out\n }\n case \"voice\":\n // Voice metadata represents a render-target, not an action — tag it\n // with the engine modality so it matches the same action vocabulary\n // as audio models (s2s engines vs sequential tts).\n return model.voice.provider === \"openai-realtime\" ||\n model.voice.provider === \"gemini-live\"\n ? [\"audio:s2s\"]\n : [\"audio:tts\"]\n case \"llm\": {\n // LLM actions piggyback on the catalog-attached capability metadata\n // when present. The legacy `LLMPricing` shape doesn't carry\n // capabilities directly — those live in the agent-framework\n // catalog (to be folded into model-catalog/llm in a future phase).\n // For v1, infer from canonical id heuristics. Keep conservative:\n // only emit actions we can prove from the id.\n const out: string[] = []\n const id = model.canonicalId.toLowerCase()\n // Tool use: every modern frontier LLM supports it. Bare `gpt`,\n // `claude`, `gemini` are tool-capable; small fast variants\n // (haiku, mini, flash, lite) are too. We assume yes unless the\n // id obviously rules it out.\n out.push(\"llm:tool_use\")\n // Reasoning: opus / sonnet / pro / r1 / o1 / o3 / thinking models.\n if (\n /opus|sonnet|claude-3.7|gpt-4\\.5|gpt-5|gemini-.*-pro|deepseek-r1|o1|o3|thinking|reasoning/.test(\n id\n )\n ) {\n out.push(\"llm:reasoning\")\n }\n // Vision: Sonnet, Opus, GPT-4o, Gemini, multimodal-marked ids.\n if (\n /sonnet|opus|gpt-4o|gpt-5|gemini|claude-3|claude-haiku-4|vision|vl/.test(\n id\n )\n ) {\n out.push(\"llm:vision\")\n }\n // Long context: Gemini, GPT-4.1, Sonnet 4 (1M), Kimi, Grok 4 fast.\n if (\n /gemini|gpt-4\\.1|claude-sonnet-4|kimi|grok-4|qwen3-next|long.context/.test(\n id\n )\n ) {\n out.push(\"llm:long_context\")\n }\n return out\n }\n }\n}\n\n/**\n * Validate that a string array intended as curation tags does not use a\n * reserved `<kind>:` prefix. Run at module load on the explicit\n * enrichment map; throws on violation so the offending entry is caught\n * before any access decision is made.\n *\n * Caller pattern (in tests / module-load init):\n * for (const e of Object.values(EXPLICIT_ENRICHMENT))\n * assertReservedPrefixDiscipline(e.tags)\n */\nexport function assertReservedPrefixDiscipline(\n curationTags: readonly string[]\n): void {\n for (const tag of curationTags) {\n for (const prefix of RESERVED_KIND_PREFIXES) {\n if (tag.startsWith(prefix)) {\n throw new Error(\n `Reserved tag prefix \"${prefix}\" used in curation tag \"${tag}\". ` +\n `Action tags (\\`<kind>:<verb>\\`) are derived automatically by ` +\n `getActions() — do not put them in curation arrays.`\n )\n }\n }\n }\n}\n\n/**\n * Returns true iff the given tag is in the reserved action-tag namespace.\n * Useful for callers that need to display curation tags only (e.g.\n * an admin UI) without hardcoding the prefix list.\n */\nexport function isActionTag(tag: string): boolean {\n return RESERVED_KIND_PREFIXES.some(p => tag.startsWith(p))\n}\n","/**\n * Model enrichment — `catalogPriceTier` / `tags` / `lifecycle` / `actions`\n * per model id.\n *\n * Bridge between the legacy data shape (`ImageModelDefinition`,\n * `VideoModelDefinition`, `LLMPricing`) and the v2 access-rule\n * primitives that target by tier, tag, and action. Without this, rules\n * like `priceTier:premium` and `tag:nsfw` would never match anything.\n *\n * Two layers:\n * 1. Explicit map for the curated set we know about (overrides win).\n * 2. Heuristic inference for any model not in the explicit map\n * (catalogPriceTier from creditCost / token rates; tags from kind +\n * provider).\n *\n * Actions (`<kind>:<verb>` — e.g. `image:generate`, `llm:tool_use`) are\n * computed from per-kind capability objects via `getActions` and merged\n * into `tags` so existing tag-based access rules match action targets\n * without any evaluator change. The reserved `<kind>:` prefix is enforced\n * by `assertReservedPrefixDiscipline` at module load — free-form curation\n * tags must NOT use it.\n *\n * Add an entry to `EXPLICIT_ENRICHMENT` when you want exact control;\n * skip it when defaults are good enough.\n */\n\nimport type { CatalogPriceTier, Lifecycle, ModelKind } from \"../schema/index.js\"\nimport type { ResolvedModel } from \"../registry/index.js\"\nimport { DEFAULT_PRICING } from \"../llm/index.js\"\nimport {\n getActions,\n assertReservedPrefixDiscipline,\n} from \"../registry/actions.js\"\n\nexport interface ModelEnrichment {\n catalogPriceTier: CatalogPriceTier\n /** Curation tags + action tags (`<kind>:<verb>`) merged. */\n tags: readonly string[]\n lifecycle: Lifecycle\n /** Action tags only — convenience subset of `tags`. */\n actions: readonly string[]\n}\n\n/**\n * Internal shape for the curated explicit-enrichment map. The map carries\n * only the *curation* fields — `tags` here is curation-only (no action\n * tags). `getEnrichment` adds derived `actions` and merges them into\n * `tags` at read time.\n */\ninterface ExplicitEnrichment {\n catalogPriceTier: CatalogPriceTier\n tags: readonly string[]\n lifecycle: Lifecycle\n}\n\nconst EXPLICIT_ENRICHMENT: Record<string, ExplicitEnrichment> = {\n // ── LLM ──────────────────────────────────────────────────────────────\n \"claude-opus-4-5\": {\n catalogPriceTier: \"premium\",\n tags: [\"llm\", \"anthropic\", \"premium\", \"reasoning\"],\n lifecycle: \"stable\",\n },\n \"claude-sonnet-4-5\": {\n catalogPriceTier: \"high\",\n tags: [\"llm\", \"anthropic\"],\n lifecycle: \"stable\",\n },\n \"claude-haiku-4-5\": {\n catalogPriceTier: \"low\",\n tags: [\"llm\", \"anthropic\", \"fast\"],\n lifecycle: \"stable\",\n },\n \"gemini-2.5-flash\": {\n catalogPriceTier: \"low\",\n tags: [\"llm\", \"google\", \"fast\"],\n lifecycle: \"stable\",\n },\n \"gemini-2.5-pro\": {\n catalogPriceTier: \"mid\",\n tags: [\"llm\", \"google\", \"reasoning\"],\n lifecycle: \"stable\",\n },\n \"gpt-4.1\": {\n catalogPriceTier: \"mid\",\n tags: [\"llm\", \"openai\"],\n lifecycle: \"stable\",\n },\n \"gpt-4.1-mini\": {\n catalogPriceTier: \"low\",\n tags: [\"llm\", \"openai\", \"fast\"],\n lifecycle: \"stable\",\n },\n \"gpt-4o\": {\n catalogPriceTier: \"mid\",\n tags: [\"llm\", \"openai\"],\n lifecycle: \"stable\",\n },\n \"gpt-4o-mini\": {\n catalogPriceTier: \"low\",\n tags: [\"llm\", \"openai\", \"fast\"],\n lifecycle: \"stable\",\n },\n\n // ── Image (highlights — others fall through to heuristic) ────────────\n \"nano-banana-pro\": {\n catalogPriceTier: \"high\",\n tags: [\"image\", \"google\", \"high-quality\", \"text-rendering\"],\n lifecycle: \"stable\",\n },\n \"nano-banana-2\": {\n catalogPriceTier: \"mid\",\n tags: [\"image\", \"google\"],\n lifecycle: \"stable\",\n },\n \"nano-banana\": {\n catalogPriceTier: \"low\",\n tags: [\"image\", \"google\", \"fast\"],\n lifecycle: \"stable\",\n },\n \"flux-2-dev\": {\n catalogPriceTier: \"low\",\n tags: [\"image\", \"bfl\", \"flux\"],\n lifecycle: \"stable\",\n },\n \"flux-kontext-pro\": {\n catalogPriceTier: \"low\",\n tags: [\"image\", \"bfl\", \"flux\", \"edit\"],\n lifecycle: \"stable\",\n },\n \"flux-kontext-max\": {\n catalogPriceTier: \"mid\",\n tags: [\"image\", \"bfl\", \"flux\", \"edit\", \"high-quality\"],\n lifecycle: \"stable\",\n },\n \"seedream-4\": {\n catalogPriceTier: \"low\",\n tags: [\"image\", \"bytedance\", \"photorealistic\"],\n lifecycle: \"stable\",\n },\n\n // ── Video (highlights) ──────────────────────────────────────────────\n \"google/veo-3.1\": {\n catalogPriceTier: \"high\",\n tags: [\"video\", \"google\", \"veo\", \"high-quality\", \"audio\"],\n lifecycle: \"stable\",\n },\n \"google/veo-3.1-fast\": {\n catalogPriceTier: \"mid\",\n tags: [\"video\", \"google\", \"veo\", \"fast\", \"audio\"],\n lifecycle: \"stable\",\n },\n \"kwaivgi/kling-v2.5-turbo-pro\": {\n catalogPriceTier: \"low\",\n tags: [\"video\", \"kling\", \"fast\"],\n lifecycle: \"deprecated\",\n },\n}\n\n// Module-load lint: every curation tag in the explicit map must avoid the\n// reserved `<kind>:` prefix. Action tags are derived by `getActions`,\n// never written by hand.\nfor (const entry of Object.values(EXPLICIT_ENRICHMENT)) {\n assertReservedPrefixDiscipline(entry.tags)\n}\n\n/**\n * Heuristic catalogPriceTier — used when an entry has no explicit\n * enrichment. Buckets are intentionally generous so rules don't need\n * every model priced exactly.\n */\nfunction inferCatalogPriceTier(model: ResolvedModel): CatalogPriceTier {\n switch (model.kind) {\n case \"image\": {\n // Derive from baseCost (USD) — formula bucketing keeps tiers\n // stable when category markup changes.\n const usd = model.def.pricing.baseCost\n if (usd <= 0.02) return \"low\"\n if (usd <= 0.05) return \"mid\"\n if (usd <= 0.1) return \"high\"\n return \"premium\"\n }\n case \"video\": {\n const usd = model.def.pricing.baseCost\n if (usd <= 0.3) return \"low\"\n if (usd <= 0.7) return \"mid\"\n if (usd <= 1.2) return \"high\"\n return \"premium\"\n }\n case \"llm\": {\n // Bucket on provider USD/1M output tokens (output dominates spend).\n // Stable across markup changes — was previously keyed on the\n // credit-side rate, which moved with formula tweaks. A known-but-\n // unpriced id (pricing undefined — see ResolvedModel's doc comment)\n // buckets on DEFAULT_PRICING, same fallback convention as\n // `calculateLLMCreditCost` and the HuggingFace route in\n // `route-identity/index.ts`.\n const out = model.pricing?.outputPer1M ?? DEFAULT_PRICING.outputPer1M\n if (out <= 1) return \"low\"\n if (out <= 10) return \"mid\"\n if (out <= 30) return \"high\"\n return \"premium\"\n }\n case \"audio\": {\n // Bucket on production USD per billing unit (1k chars or 1 min).\n const usd = model.def.pricing.baseCost\n if (usd <= 0.01) return \"low\"\n if (usd <= 0.05) return \"mid\"\n if (usd <= 0.2) return \"high\"\n return \"premium\"\n }\n case \"voice\":\n // Voice metadata isn't priced on its own.\n return \"low\"\n }\n}\n\n/**\n * Display price gauge level (1..5) for a model — the **visual** \"price\n * mostly\" indicator (Low / Medium / High / Max / Ultra) the pickers and the\n * estimator render as a bar. Distinct from {@link inferCatalogPriceTier}:\n * that one drives 4-value *access* rules (`priceTier:premium`) and must stay a\n * `CatalogPriceTier`; this is cosmetic and free to span 5 bands. Both bucket\n * the same provider USD cost, so they move together by construction.\n */\nexport function priceTierForModel(model: ResolvedModel): number {\n switch (model.kind) {\n case \"image\": {\n const usd = model.def.pricing.baseCost\n if (usd <= 0.02) return 1\n if (usd <= 0.05) return 2\n if (usd <= 0.1) return 3\n if (usd <= 0.2) return 4\n return 5\n }\n case \"video\": {\n const usd = model.def.pricing.baseCost\n if (usd <= 0.3) return 1\n if (usd <= 0.7) return 2\n if (usd <= 1.2) return 3\n if (usd <= 2.5) return 4\n return 5\n }\n case \"llm\": {\n // Same DEFAULT_PRICING fallback as inferCatalogPriceTier above.\n const out = model.pricing?.outputPer1M ?? DEFAULT_PRICING.outputPer1M\n if (out <= 1) return 1\n if (out <= 10) return 2\n if (out <= 30) return 3\n if (out <= 75) return 4\n return 5\n }\n case \"audio\": {\n const usd = model.def.pricing.baseCost\n if (usd <= 0.01) return 1\n if (usd <= 0.05) return 2\n if (usd <= 0.2) return 3\n if (usd <= 0.5) return 4\n return 5\n }\n case \"voice\":\n return 1\n }\n}\n\nfunction inferTags(model: ResolvedModel): string[] {\n const tags: string[] = [model.kind]\n switch (model.kind) {\n case \"image\":\n if (model.def.provider) tags.push(model.def.provider)\n if (model.def.capabilities.edit) tags.push(\"edit\")\n if (model.def.capabilities.upscale) tags.push(\"upscale\")\n if (model.def.referenceImages.supported) tags.push(\"ref-images\")\n if (!model.def.agentVisible) tags.push(\"hidden\")\n break\n case \"video\":\n tags.push(model.def.provider)\n if (model.def.capabilities.audio) tags.push(\"audio\")\n if (model.def.capabilities.subjectReference) tags.push(\"subject-ref\")\n if (model.def.capabilities.imageToVideo) tags.push(\"i2v\")\n if (model.def.capabilities.textToVideo) tags.push(\"t2v\")\n if (!model.def.agentVisible) tags.push(\"hidden\")\n break\n case \"llm\":\n // Provider inferred from canonical id prefix (anthropic / openai / google).\n if (model.canonicalId.includes(\"claude\")) tags.push(\"anthropic\")\n else if (model.canonicalId.includes(\"gpt\")) tags.push(\"openai\")\n else if (model.canonicalId.includes(\"gemini\")) tags.push(\"google\")\n break\n case \"audio\":\n tags.push(model.def.provider)\n // Modality is multi-valued — emit a tag per enabled capability so\n // access rules can target `s2s` / `tts` / `stt` independently.\n if (model.def.capabilities.tts) tags.push(\"tts\")\n if (model.def.capabilities.stt) tags.push(\"stt\")\n if (model.def.capabilities.s2s) tags.push(\"s2s\")\n for (const lang of model.def.capabilities.languages) {\n tags.push(`lang:${lang}`)\n }\n if (model.def.capabilities.voiceCloning) tags.push(\"voice-cloning\")\n if (model.def.capabilities.streaming) tags.push(\"streaming\")\n if (model.def.capabilities.diarization) tags.push(\"diarization\")\n if (model.def.capabilities.timestamps) tags.push(\"timestamps\")\n if (!model.def.agentVisible) tags.push(\"hidden\")\n break\n case \"voice\": {\n // \"voice\" is already pushed via `model.kind`. Tag the engine provider\n // and its modality (s2s engines vs sequential tts) so voice access\n // rules can target the same `s2s`/`tts` vocabulary as audio models.\n tags.push(model.voice.provider)\n const s2sVoice =\n model.voice.provider === \"openai-realtime\" ||\n model.voice.provider === \"gemini-live\"\n tags.push(s2sVoice ? \"s2s\" : \"tts\")\n tags.push(`gender:${model.voice.gender}`)\n tags.push(`lang:${model.voice.primaryLanguage}`)\n break\n }\n }\n return tags\n}\n\nfunction inferLifecycle(model: ResolvedModel): Lifecycle {\n // Image / video catalogs use `agentVisible: false` to mark legacy /\n // less-used entries — treat those as \"deprecated\" for rule purposes.\n if (model.kind === \"image\" && !model.def.agentVisible) return \"deprecated\"\n if (model.kind === \"video\" && !model.def.agentVisible) return \"deprecated\"\n return \"stable\"\n}\n\n/**\n * Compose the curation portion of enrichment (everything except actions).\n * Internal — `getEnrichment` is the public entry that adds actions.\n */\nfunction getCurationEnrichment(model: ResolvedModel): ExplicitEnrichment {\n const explicit = EXPLICIT_ENRICHMENT[model.id]\n if (explicit) return explicit\n // For LLM, also try the canonical id (e.g., \"claude-sonnet-4-5\" →\n // \"claude-sonnet-4\" maps via aliases).\n if (model.kind === \"llm\" && model.canonicalId !== model.id) {\n const byCanonical = EXPLICIT_ENRICHMENT[model.canonicalId]\n if (byCanonical) return byCanonical\n }\n return {\n catalogPriceTier: inferCatalogPriceTier(model),\n tags: inferTags(model),\n lifecycle: inferLifecycle(model),\n }\n}\n\n/**\n * Merge two tag arrays preserving first-occurrence order, deduped.\n * Used to fold action tags into curation tags without duplicating.\n */\nfunction mergeTags(\n curation: readonly string[],\n actions: readonly string[]\n): string[] {\n const out: string[] = []\n const seen = new Set<string>()\n for (const t of curation) {\n if (seen.has(t)) continue\n seen.add(t)\n out.push(t)\n }\n for (const t of actions) {\n if (seen.has(t)) continue\n seen.add(t)\n out.push(t)\n }\n return out\n}\n\n/**\n * Resolve enrichment for any model. Explicit map wins; heuristic fallback\n * fills the rest. Action tags (`<kind>:<verb>`) are derived from the\n * model's capability fields and merged into `tags`. Always returns a\n * value (never undefined).\n */\nexport function getEnrichment(model: ResolvedModel): ModelEnrichment {\n const curation = getCurationEnrichment(model)\n const actions = getActions(model)\n return {\n catalogPriceTier: curation.catalogPriceTier,\n tags: mergeTags(curation.tags, actions),\n lifecycle: curation.lifecycle,\n actions,\n }\n}\n\nexport function modelHasTag(model: ResolvedModel, tag: string): boolean {\n return getEnrichment(model).tags.includes(tag)\n}\n\nexport function modelHasAction(model: ResolvedModel, action: string): boolean {\n return getEnrichment(model).actions.includes(action)\n}\n\nexport function modelMatchesCatalogPriceTier(\n model: ResolvedModel,\n tier: CatalogPriceTier\n): boolean {\n return getEnrichment(model).catalogPriceTier === tier\n}\n\n/**\n * @deprecated Use `modelMatchesCatalogPriceTier`. Kept for back-compat\n * with the v1 evaluator's switch case which still uses the\n * `priceTier` discriminator string. The function itself routes to the\n * canonical name.\n */\nexport function modelMatchesPriceTier(\n model: ResolvedModel,\n tier: CatalogPriceTier\n): boolean {\n return modelMatchesCatalogPriceTier(model, tier)\n}\n\nexport function modelMatchesKind(\n model: ResolvedModel,\n kind: ModelKind\n): boolean {\n return model.kind === kind\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/registry/actions.ts","../src/enrichment/index.ts"],"names":[],"mappings":";;;;;;;;;AA0BA,IAAM,sBAAA,GAAyB,CAAC,MAAA,EAAQ,QAAA,EAAU,UAAU,QAAQ,CAAA;AAM7D,SAAS,WAAW,KAAA,EAAgC;AACzD,EAAA,QAAQ,MAAM,IAAA;AAAM,IAClB,KAAK,OAAA,EAAS;AACZ,MAAA,MAAM,MAAgB,EAAC;AACvB,MAAA,MAAM,CAAA,GAAI,MAAM,GAAA,CAAI,YAAA;AACpB,MAAA,IAAI,CAAA,CAAE,QAAA,EAAU,GAAA,CAAI,IAAA,CAAK,gBAAgB,CAAA;AACzC,MAAA,IAAI,CAAA,CAAE,IAAA,EAAM,GAAA,CAAI,IAAA,CAAK,YAAY,CAAA;AACjC,MAAA,IAAI,CAAA,CAAE,OAAA,EAAS,GAAA,CAAI,IAAA,CAAK,eAAe,CAAA;AACvC,MAAA,IAAI,MAAM,GAAA,CAAI,eAAA,CAAgB,SAAA,EAAW,GAAA,CAAI,KAAK,iBAAiB,CAAA;AACnE,MAAA,OAAO,GAAA;AAAA,IACT;AAAA,IACA,KAAK,OAAA,EAAS;AACZ,MAAA,MAAM,MAAgB,EAAC;AACvB,MAAA,MAAM,CAAA,GAAI,MAAM,GAAA,CAAI,YAAA;AACpB,MAAA,IAAI,CAAA,CAAE,WAAA,EAAa,GAAA,CAAI,IAAA,CAAK,eAAe,CAAA;AAC3C,MAAA,IAAI,CAAA,CAAE,YAAA,EAAc,GAAA,CAAI,IAAA,CAAK,gBAAgB,CAAA;AAC7C,MAAA,IAAI,CAAA,CAAE,gBAAA,EAAkB,GAAA,CAAI,IAAA,CAAK,yBAAyB,CAAA;AAC1D,MAAA,IAAI,CAAA,CAAE,KAAA,EAAO,GAAA,CAAI,IAAA,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QO,SAAS,cAAc,KAAA,EAAuC;AACnE,EAAA,MAAM,QAAA,GAAW,sBAAsB,KAAK,CAAA;AAC5C,EAAA,MAAM,OAAA,GAAU,WAAW,KAAK,CAAA;AAChC,EAAA,OAAO;AAAA,IACL,kBAAkB,QAAA,CAAS,gBAAA;AAAA,IAC3B,IAAA,EAAM,SAAA,CAAU,QAAA,CAAS,IAAA,EAAM,OAAO,CAAA;AAAA,IACtC,WAAW,QAAA,CAAS,SAAA;AAAA,IACpB;AAAA,GACF;AACF;AAEO,SAAS,WAAA,CAAY,OAAsB,GAAA,EAAsB;AACtE,EAAA,OAAO,aAAA,CAAc,KAAK,CAAA,CAAE,IAAA,CAAK,SAAS,GAAG,CAAA;AAC/C;AAEO,SAAS,cAAA,CAAe,OAAsB,MAAA,EAAyB;AAC5E,EAAA,OAAO,aAAA,CAAc,KAAK,CAAA,CAAE,OAAA,CAAQ,SAAS,MAAM,CAAA;AACrD;AAEO,SAAS,4BAAA,CACd,OACA,IAAA,EACS;AACT,EAAA,OAAO,aAAA,CAAc,KAAK,CAAA,CAAE,gBAAA,KAAqB,IAAA;AACnD;AAQO,SAAS,qBAAA,CACd,OACA,IAAA,EACS;AACT,EAAA,OAAO,4BAAA,CAA6B,OAAO,IAAI,CAAA;AACjD;AAEO,SAAS,gBAAA,CACd,OACA,IAAA,EACS;AACT,EAAA,OAAO,MAAM,IAAA,KAAS,IAAA;AACxB","file":"chunk-H467PHUU.mjs","sourcesContent":["/**\n * Action projection — `<kind>:<verb>` namespaced strings derived from\n * each model's per-kind capability object.\n *\n * Convention:\n * - `image:generate`, `image:edit`, `image:upscale`, `image:reference`\n * - `video:text_to`, `video:image_to`, `video:subject_reference`,\n * `video:audio`\n * - `audio:tts`, `audio:stt`, `audio:realtime`\n * - `llm:vision`, `llm:tool_use`, `llm:reasoning`, `llm:long_context`\n *\n * Always `<kind>:<verb_or_modifier>`, snake_case.\n *\n * Action tags share a string array with curation tags but live behind the\n * reserved `<kind>:` prefix. Curation tags MUST NOT use the prefix —\n * `assertReservedPrefixDiscipline` enforces this at module load.\n *\n * The reason this lives in the catalog package (not enrichment) is that\n * actions are intrinsic to a model — derived from its capability fields,\n * not subjectively curated. Keeping the projection separate makes it\n * trivially callable from anywhere (e.g. a UI badge component) without\n * pulling the heuristic enrichment table.\n */\n\nimport type { ResolvedModel } from \"./index.js\"\n\nconst RESERVED_KIND_PREFIXES = [\"llm:\", \"image:\", \"video:\", \"audio:\"] as const\n\n/**\n * Compute the action tags a model supports. Returns an empty array for\n * models with no recognized capability bits (defensive — never throws).\n */\nexport function getActions(model: ResolvedModel): string[] {\n switch (model.kind) {\n case \"image\": {\n const out: string[] = []\n const c = model.def.capabilities\n if (c.generate) out.push(\"image:generate\")\n if (c.edit) out.push(\"image:edit\")\n if (c.upscale) out.push(\"image:upscale\")\n if (model.def.referenceImages.supported) out.push(\"image:reference\")\n return out\n }\n case \"video\": {\n const out: string[] = []\n const c = model.def.capabilities\n if (c.textToVideo) out.push(\"video:text_to\")\n if (c.imageToVideo) out.push(\"video:image_to\")\n if (c.subjectReference) out.push(\"video:subject_reference\")\n if (c.audio) out.push(\"video:audio\")\n return out\n }\n case \"audio\": {\n const out: string[] = []\n const c = model.def.capabilities\n // One action per enabled modality (a model may do more than one).\n if (c.tts) out.push(\"audio:tts\")\n if (c.stt) out.push(\"audio:stt\")\n if (c.s2s) out.push(\"audio:s2s\")\n if (c.voiceCloning) out.push(\"audio:voice_cloning\")\n if (c.streaming) out.push(\"audio:streaming\")\n if (c.diarization) out.push(\"audio:diarization\")\n if (c.timestamps) out.push(\"audio:timestamps\")\n return out\n }\n case \"voice\":\n // Voice metadata represents a render-target, not an action — tag it\n // with the engine modality so it matches the same action vocabulary\n // as audio models (s2s engines vs sequential tts).\n return model.voice.provider === \"openai-realtime\" ||\n model.voice.provider === \"gemini-live\"\n ? [\"audio:s2s\"]\n : [\"audio:tts\"]\n case \"llm\": {\n // LLM actions piggyback on the catalog-attached capability metadata\n // when present. The legacy `LLMPricing` shape doesn't carry\n // capabilities directly — those live in the agent-framework\n // catalog (to be folded into model-catalog/llm in a future phase).\n // For v1, infer from canonical id heuristics. Keep conservative:\n // only emit actions we can prove from the id.\n const out: string[] = []\n const id = model.canonicalId.toLowerCase()\n // Tool use: every modern frontier LLM supports it. Bare `gpt`,\n // `claude`, `gemini` are tool-capable; small fast variants\n // (haiku, mini, flash, lite) are too. We assume yes unless the\n // id obviously rules it out.\n out.push(\"llm:tool_use\")\n // Reasoning: opus / sonnet / pro / r1 / o1 / o3 / thinking models.\n if (\n /opus|sonnet|claude-3.7|gpt-4\\.5|gpt-5|gemini-.*-pro|deepseek-r1|o1|o3|thinking|reasoning/.test(\n id\n )\n ) {\n out.push(\"llm:reasoning\")\n }\n // Vision: Sonnet, Opus, GPT-4o, Gemini, multimodal-marked ids.\n if (\n /sonnet|opus|gpt-4o|gpt-5|gemini|claude-3|claude-haiku-4|vision|vl/.test(\n id\n )\n ) {\n out.push(\"llm:vision\")\n }\n // Long context: Gemini, GPT-4.1, Sonnet 4 (1M), Kimi, Grok 4 fast.\n if (\n /gemini|gpt-4\\.1|claude-sonnet-4|kimi|grok-4|qwen3-next|long.context/.test(\n id\n )\n ) {\n out.push(\"llm:long_context\")\n }\n return out\n }\n }\n}\n\n/**\n * Validate that a string array intended as curation tags does not use a\n * reserved `<kind>:` prefix. Run at module load on the explicit\n * enrichment map; throws on violation so the offending entry is caught\n * before any access decision is made.\n *\n * Caller pattern (in tests / module-load init):\n * for (const e of Object.values(EXPLICIT_ENRICHMENT))\n * assertReservedPrefixDiscipline(e.tags)\n */\nexport function assertReservedPrefixDiscipline(\n curationTags: readonly string[]\n): void {\n for (const tag of curationTags) {\n for (const prefix of RESERVED_KIND_PREFIXES) {\n if (tag.startsWith(prefix)) {\n throw new Error(\n `Reserved tag prefix \"${prefix}\" used in curation tag \"${tag}\". ` +\n `Action tags (\\`<kind>:<verb>\\`) are derived automatically by ` +\n `getActions() — do not put them in curation arrays.`\n )\n }\n }\n }\n}\n\n/**\n * Returns true iff the given tag is in the reserved action-tag namespace.\n * Useful for callers that need to display curation tags only (e.g.\n * an admin UI) without hardcoding the prefix list.\n */\nexport function isActionTag(tag: string): boolean {\n return RESERVED_KIND_PREFIXES.some(p => tag.startsWith(p))\n}\n","/**\n * Model enrichment — `catalogPriceTier` / `tags` / `lifecycle` / `actions`\n * per model id.\n *\n * Bridge between the legacy data shape (`ImageModelDefinition`,\n * `VideoModelDefinition`, `LLMPricing`) and the v2 access-rule\n * primitives that target by tier, tag, and action. Without this, rules\n * like `priceTier:premium` and `tag:nsfw` would never match anything.\n *\n * Two layers:\n * 1. Explicit map for the curated set we know about (overrides win).\n * 2. Heuristic inference for any model not in the explicit map\n * (catalogPriceTier from creditCost / token rates; tags from kind +\n * provider).\n *\n * Actions (`<kind>:<verb>` — e.g. `image:generate`, `llm:tool_use`) are\n * computed from per-kind capability objects via `getActions` and merged\n * into `tags` so existing tag-based access rules match action targets\n * without any evaluator change. The reserved `<kind>:` prefix is enforced\n * by `assertReservedPrefixDiscipline` at module load — free-form curation\n * tags must NOT use it.\n *\n * Add an entry to `EXPLICIT_ENRICHMENT` when you want exact control;\n * skip it when defaults are good enough.\n */\n\nimport type { CatalogPriceTier, Lifecycle, ModelKind } from \"../schema/index.js\"\nimport type { ResolvedModel } from \"../registry/index.js\"\nimport { DEFAULT_PRICING } from \"../llm/index.js\"\nimport {\n getActions,\n assertReservedPrefixDiscipline,\n} from \"../registry/actions.js\"\n\nexport interface ModelEnrichment {\n catalogPriceTier: CatalogPriceTier\n /** Curation tags + action tags (`<kind>:<verb>`) merged. */\n tags: readonly string[]\n lifecycle: Lifecycle\n /** Action tags only — convenience subset of `tags`. */\n actions: readonly string[]\n}\n\n/**\n * Internal shape for the curated explicit-enrichment map. The map carries\n * only the *curation* fields — `tags` here is curation-only (no action\n * tags). `getEnrichment` adds derived `actions` and merges them into\n * `tags` at read time.\n */\ninterface ExplicitEnrichment {\n catalogPriceTier: CatalogPriceTier\n tags: readonly string[]\n lifecycle: Lifecycle\n}\n\nconst EXPLICIT_ENRICHMENT: Record<string, ExplicitEnrichment> = {\n // ── LLM ──────────────────────────────────────────────────────────────\n \"claude-opus-4-5\": {\n catalogPriceTier: \"premium\",\n tags: [\"llm\", \"anthropic\", \"premium\", \"reasoning\"],\n lifecycle: \"stable\",\n },\n \"claude-sonnet-4-5\": {\n catalogPriceTier: \"high\",\n tags: [\"llm\", \"anthropic\"],\n lifecycle: \"stable\",\n },\n \"claude-haiku-4-5\": {\n catalogPriceTier: \"low\",\n tags: [\"llm\", \"anthropic\", \"fast\"],\n lifecycle: \"stable\",\n },\n \"gemini-2.5-flash\": {\n catalogPriceTier: \"low\",\n tags: [\"llm\", \"google\", \"fast\"],\n lifecycle: \"stable\",\n },\n \"gemini-2.5-pro\": {\n catalogPriceTier: \"mid\",\n tags: [\"llm\", \"google\", \"reasoning\"],\n lifecycle: \"stable\",\n },\n \"gpt-4.1\": {\n catalogPriceTier: \"mid\",\n tags: [\"llm\", \"openai\"],\n lifecycle: \"stable\",\n },\n \"gpt-4.1-mini\": {\n catalogPriceTier: \"low\",\n tags: [\"llm\", \"openai\", \"fast\"],\n lifecycle: \"stable\",\n },\n \"gpt-4o\": {\n catalogPriceTier: \"mid\",\n tags: [\"llm\", \"openai\"],\n lifecycle: \"stable\",\n },\n \"gpt-4o-mini\": {\n catalogPriceTier: \"low\",\n tags: [\"llm\", \"openai\", \"fast\"],\n lifecycle: \"stable\",\n },\n\n // ── Image (highlights — others fall through to heuristic) ────────────\n \"nano-banana-pro\": {\n catalogPriceTier: \"high\",\n tags: [\"image\", \"google\", \"high-quality\", \"text-rendering\"],\n lifecycle: \"stable\",\n },\n \"nano-banana-2\": {\n catalogPriceTier: \"mid\",\n tags: [\"image\", \"google\"],\n lifecycle: \"stable\",\n },\n \"nano-banana\": {\n catalogPriceTier: \"low\",\n tags: [\"image\", \"google\", \"fast\"],\n lifecycle: \"stable\",\n },\n \"flux-2-dev\": {\n catalogPriceTier: \"low\",\n tags: [\"image\", \"bfl\", \"flux\"],\n lifecycle: \"stable\",\n },\n \"flux-kontext-pro\": {\n catalogPriceTier: \"low\",\n tags: [\"image\", \"bfl\", \"flux\", \"edit\"],\n lifecycle: \"stable\",\n },\n \"flux-kontext-max\": {\n catalogPriceTier: \"mid\",\n tags: [\"image\", \"bfl\", \"flux\", \"edit\", \"high-quality\"],\n lifecycle: \"stable\",\n },\n \"seedream-4\": {\n catalogPriceTier: \"low\",\n tags: [\"image\", \"bytedance\", \"photorealistic\"],\n lifecycle: \"stable\",\n },\n\n // ── Video (highlights) ──────────────────────────────────────────────\n \"google/veo-3.1\": {\n catalogPriceTier: \"high\",\n tags: [\"video\", \"google\", \"veo\", \"high-quality\", \"audio\"],\n lifecycle: \"stable\",\n },\n \"google/veo-3.1-fast\": {\n catalogPriceTier: \"mid\",\n tags: [\"video\", \"google\", \"veo\", \"fast\", \"audio\"],\n lifecycle: \"stable\",\n },\n \"kwaivgi/kling-v2.5-turbo-pro\": {\n catalogPriceTier: \"low\",\n tags: [\"video\", \"kling\", \"fast\"],\n lifecycle: \"deprecated\",\n },\n}\n\n// Module-load lint: every curation tag in the explicit map must avoid the\n// reserved `<kind>:` prefix. Action tags are derived by `getActions`,\n// never written by hand.\nfor (const entry of Object.values(EXPLICIT_ENRICHMENT)) {\n assertReservedPrefixDiscipline(entry.tags)\n}\n\n/**\n * Heuristic catalogPriceTier — used when an entry has no explicit\n * enrichment. Buckets are intentionally generous so rules don't need\n * every model priced exactly.\n */\nfunction inferCatalogPriceTier(model: ResolvedModel): CatalogPriceTier {\n switch (model.kind) {\n case \"image\": {\n // Derive from baseCost (USD) — formula bucketing keeps tiers\n // stable when category markup changes.\n const usd = model.def.pricing.baseCost\n if (usd <= 0.02) return \"low\"\n if (usd <= 0.05) return \"mid\"\n if (usd <= 0.1) return \"high\"\n return \"premium\"\n }\n case \"video\": {\n const usd = model.def.pricing.baseCost\n if (usd <= 0.3) return \"low\"\n if (usd <= 0.7) return \"mid\"\n if (usd <= 1.2) return \"high\"\n return \"premium\"\n }\n case \"llm\": {\n // Bucket on provider USD/1M output tokens (output dominates spend).\n // Stable across markup changes — was previously keyed on the\n // credit-side rate, which moved with formula tweaks. A known-but-\n // unpriced id (pricing undefined — see ResolvedModel's doc comment)\n // buckets on DEFAULT_PRICING, same fallback convention as\n // `calculateLLMCreditCost` and the HuggingFace route in\n // `route-identity/index.ts`.\n const out = model.pricing?.outputPer1M ?? DEFAULT_PRICING.outputPer1M\n if (out <= 1) return \"low\"\n if (out <= 10) return \"mid\"\n if (out <= 30) return \"high\"\n return \"premium\"\n }\n case \"audio\": {\n // Bucket on production USD per billing unit (1k chars or 1 min).\n const usd = model.def.pricing.baseCost\n if (usd <= 0.01) return \"low\"\n if (usd <= 0.05) return \"mid\"\n if (usd <= 0.2) return \"high\"\n return \"premium\"\n }\n case \"voice\":\n // Voice metadata isn't priced on its own.\n return \"low\"\n }\n}\n\n/**\n * Display price gauge level (1..5) for a model — the **visual** \"price\n * mostly\" indicator (Low / Medium / High / Max / Ultra) the pickers and the\n * estimator render as a bar. Distinct from {@link inferCatalogPriceTier}:\n * that one drives 4-value *access* rules (`priceTier:premium`) and must stay a\n * `CatalogPriceTier`; this is cosmetic and free to span 5 bands. Both bucket\n * the same provider USD cost, so they move together by construction.\n */\nexport function priceTierForModel(model: ResolvedModel): number {\n switch (model.kind) {\n case \"image\": {\n const usd = model.def.pricing.baseCost\n if (usd <= 0.02) return 1\n if (usd <= 0.05) return 2\n if (usd <= 0.1) return 3\n if (usd <= 0.2) return 4\n return 5\n }\n case \"video\": {\n const usd = model.def.pricing.baseCost\n if (usd <= 0.3) return 1\n if (usd <= 0.7) return 2\n if (usd <= 1.2) return 3\n if (usd <= 2.5) return 4\n return 5\n }\n case \"llm\": {\n // Same DEFAULT_PRICING fallback as inferCatalogPriceTier above.\n const out = model.pricing?.outputPer1M ?? DEFAULT_PRICING.outputPer1M\n if (out <= 1) return 1\n if (out <= 10) return 2\n if (out <= 30) return 3\n if (out <= 75) return 4\n return 5\n }\n case \"audio\": {\n const usd = model.def.pricing.baseCost\n if (usd <= 0.01) return 1\n if (usd <= 0.05) return 2\n if (usd <= 0.2) return 3\n if (usd <= 0.5) return 4\n return 5\n }\n case \"voice\":\n return 1\n }\n}\n\nfunction inferTags(model: ResolvedModel): string[] {\n const tags: string[] = [model.kind]\n switch (model.kind) {\n case \"image\":\n if (model.def.provider) tags.push(model.def.provider)\n if (model.def.capabilities.edit) tags.push(\"edit\")\n if (model.def.capabilities.upscale) tags.push(\"upscale\")\n if (model.def.referenceImages.supported) tags.push(\"ref-images\")\n if (!model.def.agentVisible) tags.push(\"hidden\")\n break\n case \"video\":\n tags.push(model.def.provider)\n if (model.def.capabilities.audio) tags.push(\"audio\")\n if (model.def.capabilities.subjectReference) tags.push(\"subject-ref\")\n if (model.def.capabilities.imageToVideo) tags.push(\"i2v\")\n if (model.def.capabilities.textToVideo) tags.push(\"t2v\")\n if (!model.def.agentVisible) tags.push(\"hidden\")\n break\n case \"llm\":\n // Provider inferred from canonical id prefix (anthropic / openai / google).\n if (model.canonicalId.includes(\"claude\")) tags.push(\"anthropic\")\n else if (model.canonicalId.includes(\"gpt\")) tags.push(\"openai\")\n else if (model.canonicalId.includes(\"gemini\")) tags.push(\"google\")\n break\n case \"audio\":\n tags.push(model.def.provider)\n // Modality is multi-valued — emit a tag per enabled capability so\n // access rules can target `s2s` / `tts` / `stt` independently.\n if (model.def.capabilities.tts) tags.push(\"tts\")\n if (model.def.capabilities.stt) tags.push(\"stt\")\n if (model.def.capabilities.s2s) tags.push(\"s2s\")\n for (const lang of model.def.capabilities.languages) {\n tags.push(`lang:${lang}`)\n }\n if (model.def.capabilities.voiceCloning) tags.push(\"voice-cloning\")\n if (model.def.capabilities.streaming) tags.push(\"streaming\")\n if (model.def.capabilities.diarization) tags.push(\"diarization\")\n if (model.def.capabilities.timestamps) tags.push(\"timestamps\")\n if (!model.def.agentVisible) tags.push(\"hidden\")\n break\n case \"voice\": {\n // \"voice\" is already pushed via `model.kind`. Tag the engine provider\n // and its modality (s2s engines vs sequential tts) so voice access\n // rules can target the same `s2s`/`tts` vocabulary as audio models.\n tags.push(model.voice.provider)\n const s2sVoice =\n model.voice.provider === \"openai-realtime\" ||\n model.voice.provider === \"gemini-live\"\n tags.push(s2sVoice ? \"s2s\" : \"tts\")\n tags.push(`gender:${model.voice.gender}`)\n tags.push(`lang:${model.voice.primaryLanguage}`)\n break\n }\n }\n return tags\n}\n\nfunction inferLifecycle(model: ResolvedModel): Lifecycle {\n // Image / video catalogs use `agentVisible: false` to mark legacy /\n // less-used entries — treat those as \"deprecated\" for rule purposes.\n if (model.kind === \"image\" && !model.def.agentVisible) return \"deprecated\"\n if (model.kind === \"video\" && !model.def.agentVisible) return \"deprecated\"\n return \"stable\"\n}\n\n/**\n * Compose the curation portion of enrichment (everything except actions).\n * Internal — `getEnrichment` is the public entry that adds actions.\n */\nfunction getCurationEnrichment(model: ResolvedModel): ExplicitEnrichment {\n const explicit = EXPLICIT_ENRICHMENT[model.id]\n if (explicit) return explicit\n // For LLM, also try the canonical id (e.g., \"claude-sonnet-4-5\" →\n // \"claude-sonnet-4\" maps via aliases).\n if (model.kind === \"llm\" && model.canonicalId !== model.id) {\n const byCanonical = EXPLICIT_ENRICHMENT[model.canonicalId]\n if (byCanonical) return byCanonical\n }\n return {\n catalogPriceTier: inferCatalogPriceTier(model),\n tags: inferTags(model),\n lifecycle: inferLifecycle(model),\n }\n}\n\n/**\n * Merge two tag arrays preserving first-occurrence order, deduped.\n * Used to fold action tags into curation tags without duplicating.\n */\nfunction mergeTags(\n curation: readonly string[],\n actions: readonly string[]\n): string[] {\n const out: string[] = []\n const seen = new Set<string>()\n for (const t of curation) {\n if (seen.has(t)) continue\n seen.add(t)\n out.push(t)\n }\n for (const t of actions) {\n if (seen.has(t)) continue\n seen.add(t)\n out.push(t)\n }\n return out\n}\n\n/**\n * Resolve enrichment for any model. Explicit map wins; heuristic fallback\n * fills the rest. Action tags (`<kind>:<verb>`) are derived from the\n * model's capability fields and merged into `tags`. Always returns a\n * value (never undefined).\n */\nexport function getEnrichment(model: ResolvedModel): ModelEnrichment {\n const curation = getCurationEnrichment(model)\n const actions = getActions(model)\n return {\n catalogPriceTier: curation.catalogPriceTier,\n tags: mergeTags(curation.tags, actions),\n lifecycle: curation.lifecycle,\n actions,\n }\n}\n\nexport function modelHasTag(model: ResolvedModel, tag: string): boolean {\n return getEnrichment(model).tags.includes(tag)\n}\n\nexport function modelHasAction(model: ResolvedModel, action: string): boolean {\n return getEnrichment(model).actions.includes(action)\n}\n\nexport function modelMatchesCatalogPriceTier(\n model: ResolvedModel,\n tier: CatalogPriceTier\n): boolean {\n return getEnrichment(model).catalogPriceTier === tier\n}\n\n/**\n * @deprecated Use `modelMatchesCatalogPriceTier`. Kept for back-compat\n * with the v1 evaluator's switch case which still uses the\n * `priceTier` discriminator string. The function itself routes to the\n * canonical name.\n */\nexport function modelMatchesPriceTier(\n model: ResolvedModel,\n tier: CatalogPriceTier\n): boolean {\n return modelMatchesCatalogPriceTier(model, tier)\n}\n\nexport function modelMatchesKind(\n model: ResolvedModel,\n kind: ModelKind\n): boolean {\n return model.kind === kind\n}\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { listRouterLlmRoutes, formatModelRef } from './chunk-
|
|
2
|
-
import { modelHasTag } from './chunk-
|
|
1
|
+
import { listRouterLlmRoutes, formatModelRef } from './chunk-GW52XH4V.mjs';
|
|
2
|
+
import { modelHasTag } from './chunk-H467PHUU.mjs';
|
|
3
3
|
import { getMergedOverlay } from './chunk-H6JUTF3U.mjs';
|
|
4
|
-
import { resolvePricing, resolveAlias, isKnownLlmId, getModelProvider, LLM_PRICING_CATALOG, listUnpricedKnownLlmIds } from './chunk-
|
|
4
|
+
import { resolvePricing, resolveAlias, isKnownLlmId, getModelProvider, LLM_PRICING_CATALOG, listUnpricedKnownLlmIds } from './chunk-6VUL4I7V.mjs';
|
|
5
5
|
import { IMAGE_MODEL_CATALOG } from './chunk-2LWYZOWB.mjs';
|
|
6
6
|
import { VIDEO_MODEL_CATALOG } from './chunk-IJZ4XPO2.mjs';
|
|
7
7
|
import { AUDIO_MODEL_CATALOG } from './chunk-WRUWNKDB.mjs';
|
|
@@ -202,5 +202,5 @@ function resolveAlias2(id) {
|
|
|
202
202
|
}
|
|
203
203
|
|
|
204
204
|
export { getModel, getModelsByProvider, getStaticModelProvider, isAgentVisible, listModels, resolveAlias2 as resolveAlias };
|
|
205
|
-
//# sourceMappingURL=chunk-
|
|
206
|
-
//# sourceMappingURL=chunk-
|
|
205
|
+
//# sourceMappingURL=chunk-JHBSGPWH.mjs.map
|
|
206
|
+
//# sourceMappingURL=chunk-JHBSGPWH.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/registry/index.ts"],"names":["resolveAlias"],"mappings":";;;;;;;;;;;;;;;;AAsCA,SAAS,WAAA,CAAY,IAAY,EAAA,EAA2B;AAC1D,EAAA,IAAI,GAAA,GAAM,EAAA;AACV,EAAA,MAAM,IAAA,uBAAW,GAAA,EAAY;AAC7B,EAAA,WAAS;AACP,IAAA,MAAM,IAAA,GAAO,EAAA,CAAG,OAAA,CAAQ,GAAG,CAAA;AAC3B,IAAA,IAAI,IAAA,KAAS,MAAA,IAAa,IAAA,CAAK,GAAA,CAAI,GAAG,CAAA,EAAG;AACzC,IAAA,IAAA,CAAK,IAAI,GAAG,CAAA;AACZ,IAAA,GAAA,GAAM,IAAA;AAAA,EACR;AACA,EAAA,OAAO,GAAA;AACT;AAGA,SAAS,YAAA,CAAa,IAAmB,GAAA,EAAuC;AAC9E,EAAA,OAAO,GAAG,KAAA,CAAM,IAAA;AAAA,IACd,CAAA,CAAA,KACE,CAAA,CAAE,SAAA,KAAc,GAAA,IAChB,CAAA,CAAE,eAAA,KAAoB,GAAA,IAAA,CACrB,CAAA,CAAE,OAAA,IAAW,EAAC,EAAG,QAAA,CAAS,GAAG;AAAA,GAClC;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AAa,EAAA,EAAoB;AAC/C,EAAA,MAAM,KAAK,gBAAA,EAAiB;AAC5B,EAAA,MAAM,GAAA,GAAM,WAAA,CAAY,EAAA,EAAI,EAAE,CAAA;AAC9B,EAAA,IAAI,EAAA,CAAG,KAAA,CAAM,GAAG,CAAA,IAAK,EAAA,CAAG,KAAA,CAAM,GAAG,CAAA,IAAK,EAAA,CAAG,KAAA,CAAM,GAAG,CAAA,EAAG,OAAO,GAAA;AAC5D,EAAA,IAAI,YAAA,CAAa,EAAA,EAAI,GAAG,CAAA,EAAG,OAAO,GAAA;AAClC,EAAA,IAAI,EAAA,CAAG,GAAA,CAAI,GAAG,CAAA,EAAG,OAAO,GAAA;AACxB,EAAA,IAAI,mBAAA,CAAoB,GAAG,CAAA,EAAG,OAAO,GAAA;AACrC,EAAA,IAAI,mBAAA,CAAoB,GAAG,CAAA,EAAG,OAAO,GAAA;AACrC,EAAA,IAAI,mBAAA,CAAoB,GAAG,CAAA,EAAG,OAAO,GAAA;AACrC,EAAA,IAAI,WAAA,CAAY,GAAA,CAAI,GAAG,CAAA,EAAG,OAAO,GAAA;AACjC,EAAA,OAAO,aAAgB,GAAG,CAAA;AAC5B","file":"chunk-RKG52ASE.mjs","sourcesContent":["/**\n * Cross-kind registry. Resolves a model id against every catalog (LLM,\n * image, video, audio) and returns a discriminated `ResolvedModel`.\n *\n * v1 returns the legacy per-kind data shapes verbatim — image/video keep\n * `*ModelDefinition`, LLM keeps `LLMPricing`, audio surfaces voices.\n * Callers (cost dispatcher, access evaluator) match on `.kind` and dig\n * into the per-kind payload as needed.\n */\n\nimport {\n LLM_PRICING_CATALOG,\n resolveAlias as resolveLlmAlias,\n resolvePricing,\n isKnownLlmId,\n listUnpricedKnownLlmIds,\n getModelProvider,\n type LLMPricing,\n} from \"../llm/index.js\"\nimport {\n IMAGE_MODEL_CATALOG,\n type ImageModelDefinition,\n} from \"../image/index.js\"\nimport {\n VIDEO_MODEL_CATALOG,\n type VideoModelDefinition,\n} from \"../video/index.js\"\nimport {\n AUDIO_MODEL_CATALOG,\n type AudioModelDefinition,\n} from \"../audio/index.js\"\nimport { VOICE_CATALOG, type CatalogVoice } from \"../voice/index.js\"\nimport { modelHasTag } from \"../enrichment/index.js\"\nimport { getMergedOverlay, type MergedOverlay } from \"../overlay/index.js\"\nimport { listRouterLlmRoutes, formatModelRef } from \"../route-identity/index.js\"\n\n/** Follow consumer-overlay alias hops to a concrete id (cycle-guarded).\n * Ids with no overlay alias pass through unchanged. */\nfunction followAlias(id: string, ov: MergedOverlay): string {\n let cur = id\n const seen = new Set<string>()\n for (;;) {\n const next = ov.aliases[cur]\n if (next === undefined || seen.has(cur)) break\n seen.add(cur)\n cur = next\n }\n return cur\n}\n\n/** Find an overlay voice by catalogId / providerVoiceId / alias. */\nfunction overlayVoice(ov: MergedOverlay, key: string): CatalogVoice | undefined {\n return ov.voice.find(\n v =>\n v.catalogId === key ||\n v.providerVoiceId === key ||\n (v.aliases ?? []).includes(key),\n )\n}\n\n/**\n * `audio` resolves to either an audio MODEL (priced TTS/STT) or a\n * voice (downstream metadata). Most call sites care about the model\n * (pricing, capabilities); a few (voice pickers) want the voice. They\n * share the resolver but discriminate on the inner payload.\n */\nexport type ResolvedModel =\n | {\n kind: \"llm\"\n id: string\n canonicalId: string\n /** Undefined for a real, known id with no pricing row yet — existence\n * and pricing are independent, see `LlmModelId`'s doc comment in\n * `llm/catalog.ts`. Every reader MUST handle the absent case; never\n * assume a `kind: \"llm\"` result is priced. */\n pricing: LLMPricing | undefined\n /** Best-effort provider even when `pricing` is absent (falls back to\n * `CONTEXT_WINDOWS`'s own provider field — see `getModelProvider`).\n * Prefer this over `pricing?.provider` when you only need routing. */\n provider: string | undefined\n }\n | { kind: \"image\"; id: string; def: ImageModelDefinition }\n | { kind: \"video\"; id: string; def: VideoModelDefinition }\n | { kind: \"audio\"; id: string; def: AudioModelDefinition }\n | { kind: \"voice\"; id: string; voice: CatalogVoice }\n\n/**\n * Every kind the registry can resolve. Broader than the catalog\n * `ModelKind` (llm/image/video/audio) because voices are a first-class\n * registry kind but not a priced model family. Derived from\n * `ResolvedModel` so it can never drift.\n */\nexport type CatalogKind = ResolvedModel[\"kind\"]\n\n// Voices resolve by canonical id (\"minimax-french-female-anchor\"), native\n// provider id (\"French_FemaleAnchor\"), or a consumer-overlay alias — index\n// all three so new slugs, native ids, and persisted operator rows all hit.\nconst VOICE_INDEX: Map<string, CatalogVoice> = new Map([\n ...VOICE_CATALOG.map(v => [v.providerVoiceId, v] as const),\n ...VOICE_CATALOG.map(v => [v.catalogId, v] as const),\n ...VOICE_CATALOG.flatMap((v: CatalogVoice) =>\n (v.aliases ?? []).map(a => [a, v] as const)\n ),\n])\n\n/**\n * Resolves a model id across every catalog.\n *\n * Lookup order: image → video → audio → LLM (last because LLM has the\n * partial-prefix fallback that can match other strings if probed first).\n *\n * Returns `undefined` for unknown ids — callers decide whether to throw\n * or fall back. LLM uses fallback pricing inside its own dispatcher\n * (preserves existing behavior at the orchestrator).\n */\nexport function getModel(id: string): ResolvedModel | undefined {\n // Consumer overlays first: resolve any overlay alias to a concrete id,\n // then let overlay entries override/extend the generated catalogs. The\n // returned `id` echoes what the caller asked for (alias-preserving), as\n // the legacy voice-alias path already did.\n const ov = getMergedOverlay()\n const key = followAlias(id, ov)\n\n if (ov.image[key]) return { kind: \"image\", id, def: ov.image[key]! }\n if (ov.video[key]) return { kind: \"video\", id, def: ov.video[key]! }\n if (ov.audio[key]) return { kind: \"audio\", id, def: ov.audio[key]! }\n const ovVoice = overlayVoice(ov, key)\n if (ovVoice) return { kind: \"voice\", id, voice: ovVoice }\n if (ov.llm[key]) {\n const pricing = ov.llm[key]!\n return { kind: \"llm\", id, canonicalId: key, pricing, provider: pricing.provider }\n }\n\n const imageDef = IMAGE_MODEL_CATALOG[key]\n if (imageDef) return { kind: \"image\", id, def: imageDef }\n\n const videoDef = VIDEO_MODEL_CATALOG[key]\n if (videoDef) return { kind: \"video\", id, def: videoDef }\n\n // Audio MODEL (priced TTS/STT) — checked before voice lookup so an\n // id that exists in both maps lands on the priced entry.\n const audioDef = AUDIO_MODEL_CATALOG[key]\n if (audioDef) return { kind: \"audio\", id, def: audioDef }\n\n const voice = VOICE_INDEX.get(key)\n if (voice) return { kind: \"voice\", id, voice }\n\n const llmPricing = resolvePricing(key)\n if (llmPricing) {\n const canonicalId = resolveLlmAlias(key)\n return { kind: \"llm\", id, canonicalId, pricing: llmPricing, provider: llmPricing.provider }\n }\n // Known id, no pricing row yet (see `LlmModelId`'s doc comment in\n // llm/catalog.ts) — still resolves, just unpriced. This is the case that\n // used to make a real, live, provider-published model (e.g. a brand-new\n // Anthropic release the day it ships, before the next pricing sync)\n // disappear from every downstream surface instead of showing up unpriced.\n if (isKnownLlmId(key)) {\n return { kind: \"llm\", id, canonicalId: key, pricing: undefined, provider: getModelProvider(key) }\n }\n\n return undefined\n}\n\n/**\n * Returns true iff the id is exposed to agents.\n *\n * - LLM: every entry in `LLM_PRICING_CATALOG` is considered visible\n * (legacy convention; refine in v2 with per-entry `agentVisible`).\n * - Image / Video: respects the `agentVisible` flag.\n * - Audio voices: all voices are visible (catalog itself is curated).\n */\nexport function isAgentVisible(id: string): boolean {\n const m = getModel(id)\n if (!m) return false\n switch (m.kind) {\n case \"image\":\n return m.def.agentVisible\n case \"video\":\n return m.def.agentVisible\n case \"audio\":\n return m.def.agentVisible\n case \"llm\":\n return (\n id in LLM_PRICING_CATALOG || resolveLlmAlias(id) in LLM_PRICING_CATALOG\n )\n case \"voice\":\n return true\n }\n}\n\nexport interface ListModelsFilter {\n kind?: CatalogKind\n /** Single provider (back-compat). Folded into `providers` internally. */\n provider?: string\n /** Provider OR-set — a model matches if its provider is any of these. */\n providers?: string[]\n /**\n * Capability tags a model must carry (ALL of them). Capabilities are\n * emitted as tags by enrichment — audio `tts`/`stt`/`s2s`, image\n * `edit`/`upscale`, video `i2v`/`t2v` — so this filters on the same\n * vocabulary `listModels({capabilities:[\"s2s\"]})` would expect.\n */\n capabilities?: string[]\n /** Arbitrary tags a model must carry (ALL of them). */\n tags?: string[]\n agentVisibleOnly?: boolean\n}\n\n/**\n * Cross-kind listing. Useful for catalog browsers and capability search.\n * Returns `ResolvedModel[]` (discriminated by kind).\n *\n * Provider is an OR-set (`providers` ∪ the singular `provider`); capability\n * and tag filters are AND-sets (a model must carry every listed value).\n * Composed: `listModels({ kind:\"audio\", capabilities:[\"s2s\"],\n * providers:[\"gemini-live\",\"openai-realtime\"] })` → all s2s models from\n * Gemini OR OpenAI.\n */\nexport function listModels(filter: ListModelsFilter = {}): ResolvedModel[] {\n const providerSet =\n filter.provider || filter.providers\n ? new Set([\n ...(filter.provider ? [filter.provider] : []),\n ...(filter.providers ?? []),\n ])\n : undefined\n const providerMatches = (provider: string | undefined): boolean =>\n !providerSet || (provider !== undefined && providerSet.has(provider))\n\n const ov = getMergedOverlay()\n const out: ResolvedModel[] = []\n // Overlay entries override core ones with the same id, so collect ids the\n // overlay has already supplied per kind and skip the core duplicate.\n const seen = { image: new Set<string>(), video: new Set<string>(), audio: new Set<string>(), voice: new Set<string>(), llm: new Set<string>() }\n\n if (!filter.kind || filter.kind === \"image\") {\n for (const [id, def] of Object.entries(ov.image)) {\n if (!providerMatches(def.provider)) continue\n if (filter.agentVisibleOnly && !def.agentVisible) continue\n seen.image.add(id)\n out.push({ kind: \"image\", id, def })\n }\n for (const [id, def] of Object.entries(IMAGE_MODEL_CATALOG)) {\n if (seen.image.has(id) || !providerMatches(def.provider)) continue\n if (filter.agentVisibleOnly && !def.agentVisible) continue\n out.push({ kind: \"image\", id, def })\n }\n }\n if (!filter.kind || filter.kind === \"video\") {\n for (const [id, def] of Object.entries(ov.video)) {\n if (!providerMatches(def.provider)) continue\n if (filter.agentVisibleOnly && !def.agentVisible) continue\n seen.video.add(id)\n out.push({ kind: \"video\", id, def })\n }\n for (const [id, def] of Object.entries(VIDEO_MODEL_CATALOG)) {\n if (seen.video.has(id) || !providerMatches(def.provider)) continue\n if (filter.agentVisibleOnly && !def.agentVisible) continue\n out.push({ kind: \"video\", id, def })\n }\n }\n if (!filter.kind || filter.kind === \"audio\") {\n for (const [id, def] of Object.entries(ov.audio)) {\n if (!providerMatches(def.provider)) continue\n if (filter.agentVisibleOnly && !def.agentVisible) continue\n seen.audio.add(id)\n out.push({ kind: \"audio\", id, def })\n }\n for (const [id, def] of Object.entries(AUDIO_MODEL_CATALOG)) {\n if (seen.audio.has(id) || !providerMatches(def.provider)) continue\n if (filter.agentVisibleOnly && !def.agentVisible) continue\n out.push({ kind: \"audio\", id, def })\n }\n }\n if (!filter.kind || filter.kind === \"voice\") {\n for (const v of ov.voice) {\n if (!providerMatches(v.provider)) continue\n seen.voice.add(v.catalogId)\n out.push({ kind: \"voice\", id: v.catalogId, voice: v })\n }\n for (const v of VOICE_CATALOG) {\n if (seen.voice.has(v.catalogId) || !providerMatches(v.provider)) continue\n out.push({ kind: \"voice\", id: v.catalogId, voice: v })\n }\n }\n if (!filter.kind || filter.kind === \"llm\") {\n for (const [id, pricing] of Object.entries(ov.llm)) {\n if (!providerMatches(pricing.provider)) continue\n seen.llm.add(id)\n out.push({ kind: \"llm\", id, canonicalId: id, pricing, provider: pricing.provider })\n }\n for (const [id, pricing] of Object.entries(LLM_PRICING_CATALOG)) {\n if (seen.llm.has(id) || !providerMatches(pricing.provider)) continue\n seen.llm.add(id)\n out.push({ kind: \"llm\", id, canonicalId: id, pricing, provider: pricing.provider })\n }\n // Known ids with no pricing row yet (see `LlmModelId`'s doc comment in\n // llm/catalog.ts) — surfaced unpriced rather than silently dropped.\n for (const { id, provider } of listUnpricedKnownLlmIds()) {\n if (seen.llm.has(id) || !providerMatches(provider)) continue\n out.push({ kind: \"llm\", id, canonicalId: id, pricing: undefined, provider })\n }\n }\n\n // Capability + tag filters are AND-sets, applied over the enrichment tag\n // vocabulary (capabilities are emitted as tags). Skipped entirely when\n // unset so the common path stays allocation-free.\n const required = [...(filter.capabilities ?? []), ...(filter.tags ?? [])]\n if (required.length === 0) return out\n return out.filter(model => required.every(tag => modelHasTag(model, tag)))\n}\n\n/**\n * Provider-centric view — every model a provider offers across all kinds\n * (llm / image / video / audio incl. tts/stt/s2s). This is the \"provider\n * catalog\" (openai, google, anthropic, replicate, openrouter, …): a\n * derived query over the kind-organized catalogs, NOT a parallel store.\n *\n * When `provider` names a router (openrouter, requesty, huggingface),\n * this also folds in that router's generated route table\n * (`listRouterLlmRoutes`), emitting `vendor/product@router` ids — the\n * router's full surface, not just what happens to be curated into\n * `LLM_PRICING_CATALOG`. OpenRouter's routes are already spread into that\n * catalog (bare `vendor/product` ids, `llm/catalog.ts`), so its router-table\n * entries are deduped against the bare ids `listModels` already returned;\n * Requesty and HuggingFace have no such overlap today, so their route table\n * entries are added in full. Deliberately NOT achieved by spreading\n * `REQUESTY_ROUTES`/`HUGGINGFACE_ROUTES` into `LLM_PRICING_CATALOG` itself —\n * that catalog is the legacy bare-id path, and a bare id must keep meaning\n * direct-vendor pricing (`route-identity/index.ts`).\n */\nexport function getModelsByProvider(provider: string): ResolvedModel[] {\n const models = listModels({ provider })\n const routerRoutes = listRouterLlmRoutes(provider)\n if (routerRoutes.length === 0) return models\n\n const existingIds = new Set(models.map(m => m.id))\n const routed: ResolvedModel[] = []\n for (const route of routerRoutes) {\n const bareId = `${route.vendor}/${route.product}`\n if (existingIds.has(bareId)) continue\n const id = formatModelRef(route.ref)\n routed.push({ kind: \"llm\", id, canonicalId: id, pricing: route.pricing, provider: route.pricing.provider })\n }\n return [...models, ...routed]\n}\n\n/**\n * Returns the platform a model's adapter is **statically pinned** to,\n * if known. ONLY meaningful for image / video / audio — those adapters\n * are constructed per-platform (Replicate adapter, MiniMax adapter…),\n * so the model's `def.provider` IS the runtime connector.\n *\n * For LLM, returns `undefined` — the runtime connector is determined\n * at call time by `pickLlmConnector(connectors, parseModelId(id).provider)`\n * against the guild's installed connectors, NOT by the model id alone.\n * The same `anthropic/claude-sonnet-4-5` can route through OpenRouter\n * OR direct Anthropic depending on which connectors the guild has\n * installed. Recording call sites MUST pass the actual `connectorUsed`\n * they invoked; do not infer from id.\n *\n * Use case: image/video workflow steps fetch `model.def.provider`\n * directly (no ambiguity). LLM call sites use the runtime resolver.\n */\nexport function getStaticModelProvider(\n model: ResolvedModel\n): string | undefined {\n switch (model.kind) {\n case \"image\":\n case \"video\":\n case \"audio\":\n return model.def.provider\n case \"voice\":\n return model.voice.provider\n case \"llm\":\n // Runtime routing — caller knows, we don't.\n return undefined\n }\n}\n\n/**\n * Resolves an id to its canonical catalog key across kinds. For ids that\n * have no alias, returns the id unchanged. Used by callers that want to\n * normalize before persisting (e.g., `byok_usage` rows).\n */\nexport function resolveAlias(id: string): string {\n const ov = getMergedOverlay()\n const key = followAlias(id, ov)\n if (ov.image[key] || ov.video[key] || ov.audio[key]) return key\n if (overlayVoice(ov, key)) return key\n if (ov.llm[key]) return key\n if (IMAGE_MODEL_CATALOG[key]) return key\n if (VIDEO_MODEL_CATALOG[key]) return key\n if (AUDIO_MODEL_CATALOG[key]) return key\n if (VOICE_INDEX.has(key)) return key\n return resolveLlmAlias(key)\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/registry/index.ts"],"names":["resolveAlias"],"mappings":";;;;;;;;;;;;;;;;AAsCA,SAAS,WAAA,CAAY,IAAY,EAAA,EAA2B;AAC1D,EAAA,IAAI,GAAA,GAAM,EAAA;AACV,EAAA,MAAM,IAAA,uBAAW,GAAA,EAAY;AAC7B,EAAA,WAAS;AACP,IAAA,MAAM,IAAA,GAAO,EAAA,CAAG,OAAA,CAAQ,GAAG,CAAA;AAC3B,IAAA,IAAI,IAAA,KAAS,MAAA,IAAa,IAAA,CAAK,GAAA,CAAI,GAAG,CAAA,EAAG;AACzC,IAAA,IAAA,CAAK,IAAI,GAAG,CAAA;AACZ,IAAA,GAAA,GAAM,IAAA;AAAA,EACR;AACA,EAAA,OAAO,GAAA;AACT;AAGA,SAAS,YAAA,CAAa,IAAmB,GAAA,EAAuC;AAC9E,EAAA,OAAO,GAAG,KAAA,CA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AA;AACH,MAAA,OAAO,MAAM,GAAA,CAAI,QAAA;AAAA,IACnB,KAAK,OAAA;AACH,MAAA,OAAO,MAAM,KAAA,CAAM,QAAA;AAAA,IACrB,KAAK,KAAA;AAEH,MAAA,OAAO,MAAA;AAAA;AAEb;AAOO,SAASA,cAAa,EAAA,EAAoB;AAC/C,EAAA,MAAM,KAAK,gBAAA,EAAiB;AAC5B,EAAA,MAAM,GAAA,GAAM,WAAA,CAAY,EAAA,EAAI,EAAE,CAAA;AAC9B,EAAA,IAAI,EAAA,CAAG,KAAA,CAAM,GAAG,CAAA,IAAK,EAAA,CAAG,KAAA,CAAM,GAAG,CAAA,IAAK,EAAA,CAAG,KAAA,CAAM,GAAG,CAAA,EAAG,OAAO,GAAA;AAC5D,EAAA,IAAI,YAAA,CAAa,EAAA,EAAI,GAAG,CAAA,EAAG,OAAO,GAAA;AAClC,EAAA,IAAI,EAAA,CAAG,GAAA,CAAI,GAAG,CAAA,EAAG,OAAO,GAAA;AACxB,EAAA,IAAI,mBAAA,CAAoB,GAAG,CAAA,EAAG,OAAO,GAAA;AACrC,EAAA,IAAI,mBAAA,CAAoB,GAAG,CAAA,EAAG,OAAO,GAAA;AACrC,EAAA,IAAI,mBAAA,CAAoB,GAAG,CAAA,EAAG,OAAO,GAAA;AACrC,EAAA,IAAI,WAAA,CAAY,GAAA,CAAI,GAAG,CAAA,EAAG,OAAO,GAAA;AACjC,EAAA,OAAO,aAAgB,GAAG,CAAA;AAC5B","file":"chunk-JHBSGPWH.mjs","sourcesContent":["/**\n * Cross-kind registry. Resolves a model id against every catalog (LLM,\n * image, video, audio) and returns a discriminated `ResolvedModel`.\n *\n * v1 returns the legacy per-kind data shapes verbatim — image/video keep\n * `*ModelDefinition`, LLM keeps `LLMPricing`, audio surfaces voices.\n * Callers (cost dispatcher, access evaluator) match on `.kind` and dig\n * into the per-kind payload as needed.\n */\n\nimport {\n LLM_PRICING_CATALOG,\n resolveAlias as resolveLlmAlias,\n resolvePricing,\n isKnownLlmId,\n listUnpricedKnownLlmIds,\n getModelProvider,\n type LLMPricing,\n} from \"../llm/index.js\"\nimport {\n IMAGE_MODEL_CATALOG,\n type ImageModelDefinition,\n} from \"../image/index.js\"\nimport {\n VIDEO_MODEL_CATALOG,\n type VideoModelDefinition,\n} from \"../video/index.js\"\nimport {\n AUDIO_MODEL_CATALOG,\n type AudioModelDefinition,\n} from \"../audio/index.js\"\nimport { VOICE_CATALOG, type CatalogVoice } from \"../voice/index.js\"\nimport { modelHasTag } from \"../enrichment/index.js\"\nimport { getMergedOverlay, type MergedOverlay } from \"../overlay/index.js\"\nimport { listRouterLlmRoutes, formatModelRef } from \"../route-identity/index.js\"\n\n/** Follow consumer-overlay alias hops to a concrete id (cycle-guarded).\n * Ids with no overlay alias pass through unchanged. */\nfunction followAlias(id: string, ov: MergedOverlay): string {\n let cur = id\n const seen = new Set<string>()\n for (;;) {\n const next = ov.aliases[cur]\n if (next === undefined || seen.has(cur)) break\n seen.add(cur)\n cur = next\n }\n return cur\n}\n\n/** Find an overlay voice by catalogId / providerVoiceId / alias. */\nfunction overlayVoice(ov: MergedOverlay, key: string): CatalogVoice | undefined {\n return ov.voice.find(\n v =>\n v.catalogId === key ||\n v.providerVoiceId === key ||\n (v.aliases ?? []).includes(key),\n )\n}\n\n/**\n * `audio` resolves to either an audio MODEL (priced TTS/STT) or a\n * voice (downstream metadata). Most call sites care about the model\n * (pricing, capabilities); a few (voice pickers) want the voice. They\n * share the resolver but discriminate on the inner payload.\n */\nexport type ResolvedModel =\n | {\n kind: \"llm\"\n id: string\n canonicalId: string\n /** Undefined for a real, known id with no pricing row yet — existence\n * and pricing are independent, see `LlmModelId`'s doc comment in\n * `llm/catalog.ts`. Every reader MUST handle the absent case; never\n * assume a `kind: \"llm\"` result is priced. */\n pricing: LLMPricing | undefined\n /** Best-effort provider even when `pricing` is absent (falls back to\n * `CONTEXT_WINDOWS`'s own provider field — see `getModelProvider`).\n * Prefer this over `pricing?.provider` when you only need routing. */\n provider: string | undefined\n }\n | { kind: \"image\"; id: string; def: ImageModelDefinition }\n | { kind: \"video\"; id: string; def: VideoModelDefinition }\n | { kind: \"audio\"; id: string; def: AudioModelDefinition }\n | { kind: \"voice\"; id: string; voice: CatalogVoice }\n\n/**\n * Every kind the registry can resolve. Broader than the catalog\n * `ModelKind` (llm/image/video/audio) because voices are a first-class\n * registry kind but not a priced model family. Derived from\n * `ResolvedModel` so it can never drift.\n */\nexport type CatalogKind = ResolvedModel[\"kind\"]\n\n// Voices resolve by canonical id (\"minimax-french-female-anchor\"), native\n// provider id (\"French_FemaleAnchor\"), or a consumer-overlay alias — index\n// all three so new slugs, native ids, and persisted operator rows all hit.\nconst VOICE_INDEX: Map<string, CatalogVoice> = new Map([\n ...VOICE_CATALOG.map(v => [v.providerVoiceId, v] as const),\n ...VOICE_CATALOG.map(v => [v.catalogId, v] as const),\n ...VOICE_CATALOG.flatMap((v: CatalogVoice) =>\n (v.aliases ?? []).map(a => [a, v] as const)\n ),\n])\n\n/**\n * Resolves a model id across every catalog.\n *\n * Lookup order: image → video → audio → LLM (last because LLM has the\n * partial-prefix fallback that can match other strings if probed first).\n *\n * Returns `undefined` for unknown ids — callers decide whether to throw\n * or fall back. LLM uses fallback pricing inside its own dispatcher\n * (preserves existing behavior at the orchestrator).\n */\nexport function getModel(id: string): ResolvedModel | undefined {\n // Consumer overlays first: resolve any overlay alias to a concrete id,\n // then let overlay entries override/extend the generated catalogs. The\n // returned `id` echoes what the caller asked for (alias-preserving), as\n // the legacy voice-alias path already did.\n const ov = getMergedOverlay()\n const key = followAlias(id, ov)\n\n if (ov.image[key]) return { kind: \"image\", id, def: ov.image[key]! }\n if (ov.video[key]) return { kind: \"video\", id, def: ov.video[key]! }\n if (ov.audio[key]) return { kind: \"audio\", id, def: ov.audio[key]! }\n const ovVoice = overlayVoice(ov, key)\n if (ovVoice) return { kind: \"voice\", id, voice: ovVoice }\n if (ov.llm[key]) {\n const pricing = ov.llm[key]!\n return { kind: \"llm\", id, canonicalId: key, pricing, provider: pricing.provider }\n }\n\n const imageDef = IMAGE_MODEL_CATALOG[key]\n if (imageDef) return { kind: \"image\", id, def: imageDef }\n\n const videoDef = VIDEO_MODEL_CATALOG[key]\n if (videoDef) return { kind: \"video\", id, def: videoDef }\n\n // Audio MODEL (priced TTS/STT) — checked before voice lookup so an\n // id that exists in both maps lands on the priced entry.\n const audioDef = AUDIO_MODEL_CATALOG[key]\n if (audioDef) return { kind: \"audio\", id, def: audioDef }\n\n const voice = VOICE_INDEX.get(key)\n if (voice) return { kind: \"voice\", id, voice }\n\n const llmPricing = resolvePricing(key)\n if (llmPricing) {\n const canonicalId = resolveLlmAlias(key)\n return { kind: \"llm\", id, canonicalId, pricing: llmPricing, provider: llmPricing.provider }\n }\n // Known id, no pricing row yet (see `LlmModelId`'s doc comment in\n // llm/catalog.ts) — still resolves, just unpriced. This is the case that\n // used to make a real, live, provider-published model (e.g. a brand-new\n // Anthropic release the day it ships, before the next pricing sync)\n // disappear from every downstream surface instead of showing up unpriced.\n if (isKnownLlmId(key)) {\n return { kind: \"llm\", id, canonicalId: key, pricing: undefined, provider: getModelProvider(key) }\n }\n\n return undefined\n}\n\n/**\n * Returns true iff the id is exposed to agents.\n *\n * - LLM: every entry in `LLM_PRICING_CATALOG` is considered visible\n * (legacy convention; refine in v2 with per-entry `agentVisible`).\n * - Image / Video: respects the `agentVisible` flag.\n * - Audio voices: all voices are visible (catalog itself is curated).\n */\nexport function isAgentVisible(id: string): boolean {\n const m = getModel(id)\n if (!m) return false\n switch (m.kind) {\n case \"image\":\n return m.def.agentVisible\n case \"video\":\n return m.def.agentVisible\n case \"audio\":\n return m.def.agentVisible\n case \"llm\":\n return (\n id in LLM_PRICING_CATALOG || resolveLlmAlias(id) in LLM_PRICING_CATALOG\n )\n case \"voice\":\n return true\n }\n}\n\nexport interface ListModelsFilter {\n kind?: CatalogKind\n /** Single provider (back-compat). Folded into `providers` internally. */\n provider?: string\n /** Provider OR-set — a model matches if its provider is any of these. */\n providers?: string[]\n /**\n * Capability tags a model must carry (ALL of them). Capabilities are\n * emitted as tags by enrichment — audio `tts`/`stt`/`s2s`, image\n * `edit`/`upscale`, video `i2v`/`t2v` — so this filters on the same\n * vocabulary `listModels({capabilities:[\"s2s\"]})` would expect.\n */\n capabilities?: string[]\n /** Arbitrary tags a model must carry (ALL of them). */\n tags?: string[]\n agentVisibleOnly?: boolean\n}\n\n/**\n * Cross-kind listing. Useful for catalog browsers and capability search.\n * Returns `ResolvedModel[]` (discriminated by kind).\n *\n * Provider is an OR-set (`providers` ∪ the singular `provider`); capability\n * and tag filters are AND-sets (a model must carry every listed value).\n * Composed: `listModels({ kind:\"audio\", capabilities:[\"s2s\"],\n * providers:[\"gemini-live\",\"openai-realtime\"] })` → all s2s models from\n * Gemini OR OpenAI.\n */\nexport function listModels(filter: ListModelsFilter = {}): ResolvedModel[] {\n const providerSet =\n filter.provider || filter.providers\n ? new Set([\n ...(filter.provider ? [filter.provider] : []),\n ...(filter.providers ?? []),\n ])\n : undefined\n const providerMatches = (provider: string | undefined): boolean =>\n !providerSet || (provider !== undefined && providerSet.has(provider))\n\n const ov = getMergedOverlay()\n const out: ResolvedModel[] = []\n // Overlay entries override core ones with the same id, so collect ids the\n // overlay has already supplied per kind and skip the core duplicate.\n const seen = { image: new Set<string>(), video: new Set<string>(), audio: new Set<string>(), voice: new Set<string>(), llm: new Set<string>() }\n\n if (!filter.kind || filter.kind === \"image\") {\n for (const [id, def] of Object.entries(ov.image)) {\n if (!providerMatches(def.provider)) continue\n if (filter.agentVisibleOnly && !def.agentVisible) continue\n seen.image.add(id)\n out.push({ kind: \"image\", id, def })\n }\n for (const [id, def] of Object.entries(IMAGE_MODEL_CATALOG)) {\n if (seen.image.has(id) || !providerMatches(def.provider)) continue\n if (filter.agentVisibleOnly && !def.agentVisible) continue\n out.push({ kind: \"image\", id, def })\n }\n }\n if (!filter.kind || filter.kind === \"video\") {\n for (const [id, def] of Object.entries(ov.video)) {\n if (!providerMatches(def.provider)) continue\n if (filter.agentVisibleOnly && !def.agentVisible) continue\n seen.video.add(id)\n out.push({ kind: \"video\", id, def })\n }\n for (const [id, def] of Object.entries(VIDEO_MODEL_CATALOG)) {\n if (seen.video.has(id) || !providerMatches(def.provider)) continue\n if (filter.agentVisibleOnly && !def.agentVisible) continue\n out.push({ kind: \"video\", id, def })\n }\n }\n if (!filter.kind || filter.kind === \"audio\") {\n for (const [id, def] of Object.entries(ov.audio)) {\n if (!providerMatches(def.provider)) continue\n if (filter.agentVisibleOnly && !def.agentVisible) continue\n seen.audio.add(id)\n out.push({ kind: \"audio\", id, def })\n }\n for (const [id, def] of Object.entries(AUDIO_MODEL_CATALOG)) {\n if (seen.audio.has(id) || !providerMatches(def.provider)) continue\n if (filter.agentVisibleOnly && !def.agentVisible) continue\n out.push({ kind: \"audio\", id, def })\n }\n }\n if (!filter.kind || filter.kind === \"voice\") {\n for (const v of ov.voice) {\n if (!providerMatches(v.provider)) continue\n seen.voice.add(v.catalogId)\n out.push({ kind: \"voice\", id: v.catalogId, voice: v })\n }\n for (const v of VOICE_CATALOG) {\n if (seen.voice.has(v.catalogId) || !providerMatches(v.provider)) continue\n out.push({ kind: \"voice\", id: v.catalogId, voice: v })\n }\n }\n if (!filter.kind || filter.kind === \"llm\") {\n for (const [id, pricing] of Object.entries(ov.llm)) {\n if (!providerMatches(pricing.provider)) continue\n seen.llm.add(id)\n out.push({ kind: \"llm\", id, canonicalId: id, pricing, provider: pricing.provider })\n }\n for (const [id, pricing] of Object.entries(LLM_PRICING_CATALOG)) {\n if (seen.llm.has(id) || !providerMatches(pricing.provider)) continue\n seen.llm.add(id)\n out.push({ kind: \"llm\", id, canonicalId: id, pricing, provider: pricing.provider })\n }\n // Known ids with no pricing row yet (see `LlmModelId`'s doc comment in\n // llm/catalog.ts) — surfaced unpriced rather than silently dropped.\n for (const { id, provider } of listUnpricedKnownLlmIds()) {\n if (seen.llm.has(id) || !providerMatches(provider)) continue\n out.push({ kind: \"llm\", id, canonicalId: id, pricing: undefined, provider })\n }\n }\n\n // Capability + tag filters are AND-sets, applied over the enrichment tag\n // vocabulary (capabilities are emitted as tags). Skipped entirely when\n // unset so the common path stays allocation-free.\n const required = [...(filter.capabilities ?? []), ...(filter.tags ?? [])]\n if (required.length === 0) return out\n return out.filter(model => required.every(tag => modelHasTag(model, tag)))\n}\n\n/**\n * Provider-centric view — every model a provider offers across all kinds\n * (llm / image / video / audio incl. tts/stt/s2s). This is the \"provider\n * catalog\" (openai, google, anthropic, replicate, openrouter, …): a\n * derived query over the kind-organized catalogs, NOT a parallel store.\n *\n * When `provider` names a router (openrouter, requesty, huggingface),\n * this also folds in that router's generated route table\n * (`listRouterLlmRoutes`), emitting `vendor/product@router` ids — the\n * router's full surface, not just what happens to be curated into\n * `LLM_PRICING_CATALOG`. OpenRouter's routes are already spread into that\n * catalog (bare `vendor/product` ids, `llm/catalog.ts`), so its router-table\n * entries are deduped against the bare ids `listModels` already returned;\n * Requesty and HuggingFace have no such overlap today, so their route table\n * entries are added in full. Deliberately NOT achieved by spreading\n * `REQUESTY_ROUTES`/`HUGGINGFACE_ROUTES` into `LLM_PRICING_CATALOG` itself —\n * that catalog is the legacy bare-id path, and a bare id must keep meaning\n * direct-vendor pricing (`route-identity/index.ts`).\n */\nexport function getModelsByProvider(provider: string): ResolvedModel[] {\n const models = listModels({ provider })\n const routerRoutes = listRouterLlmRoutes(provider)\n if (routerRoutes.length === 0) return models\n\n const existingIds = new Set(models.map(m => m.id))\n const routed: ResolvedModel[] = []\n for (const route of routerRoutes) {\n const bareId = `${route.vendor}/${route.product}`\n if (existingIds.has(bareId)) continue\n const id = formatModelRef(route.ref)\n routed.push({ kind: \"llm\", id, canonicalId: id, pricing: route.pricing, provider: route.pricing.provider })\n }\n return [...models, ...routed]\n}\n\n/**\n * Returns the platform a model's adapter is **statically pinned** to,\n * if known. ONLY meaningful for image / video / audio — those adapters\n * are constructed per-platform (Replicate adapter, MiniMax adapter…),\n * so the model's `def.provider` IS the runtime connector.\n *\n * For LLM, returns `undefined` — the runtime connector is determined\n * at call time by `pickLlmConnector(connectors, parseModelId(id).provider)`\n * against the guild's installed connectors, NOT by the model id alone.\n * The same `anthropic/claude-sonnet-4-5` can route through OpenRouter\n * OR direct Anthropic depending on which connectors the guild has\n * installed. Recording call sites MUST pass the actual `connectorUsed`\n * they invoked; do not infer from id.\n *\n * Use case: image/video workflow steps fetch `model.def.provider`\n * directly (no ambiguity). LLM call sites use the runtime resolver.\n */\nexport function getStaticModelProvider(\n model: ResolvedModel\n): string | undefined {\n switch (model.kind) {\n case \"image\":\n case \"video\":\n case \"audio\":\n return model.def.provider\n case \"voice\":\n return model.voice.provider\n case \"llm\":\n // Runtime routing — caller knows, we don't.\n return undefined\n }\n}\n\n/**\n * Resolves an id to its canonical catalog key across kinds. For ids that\n * have no alias, returns the id unchanged. Used by callers that want to\n * normalize before persisting (e.g., `byok_usage` rows).\n */\nexport function resolveAlias(id: string): string {\n const ov = getMergedOverlay()\n const key = followAlias(id, ov)\n if (ov.image[key] || ov.video[key] || ov.audio[key]) return key\n if (overlayVoice(ov, key)) return key\n if (ov.llm[key]) return key\n if (IMAGE_MODEL_CATALOG[key]) return key\n if (VIDEO_MODEL_CATALOG[key]) return key\n if (AUDIO_MODEL_CATALOG[key]) return key\n if (VOICE_INDEX.has(key)) return key\n return resolveLlmAlias(key)\n}\n"]}
|
|
@@ -35,7 +35,22 @@ var PROVIDER_KEY_ENV = {
|
|
|
35
35
|
elevenlabs: "ELEVENLABS_API_KEY",
|
|
36
36
|
"gemini-live": "GOOGLE_GENERATIVE_AI_API_KEY",
|
|
37
37
|
google: "GOOGLE_GENERATIVE_AI_API_KEY",
|
|
38
|
-
|
|
38
|
+
// Ecosystem convention, not our own invention: every HF tool (transformers,
|
|
39
|
+
// huggingface_hub, the `hf` CLI) and — load-bearing here — opencode's own
|
|
40
|
+
// bundled huggingface provider (`@ai-sdk/openai-compatible`, reads
|
|
41
|
+
// `env:["HF_TOKEN"]` off its models.dev-style catalog entry, confirmed by
|
|
42
|
+
// inspecting the shipped `opencode acp` binary) read `HF_TOKEN`, never
|
|
43
|
+
// `HUGGINGFACE_API_KEY`. `ANTHROPIC_GATEWAY_PRESETS.huggingface.keyEnv`
|
|
44
|
+
// (`provider-presets/src/anthropic-gateways.ts`) already got this right for
|
|
45
|
+
// the explicit `route.gateway` path; this was the other half — the
|
|
46
|
+
// model-derived-api-key path (`resolveAuthSpec`'s non-gateway branch calls
|
|
47
|
+
// `providerEnvVar(provider)`, i.e. THIS map, directly) still injected the
|
|
48
|
+
// wrong var, so any `<model>@huggingface` spawn through a model-derived
|
|
49
|
+
// router (opencode) got a credential opencode's huggingface provider never
|
|
50
|
+
// reads — it sees no HF_TOKEN, treats the provider as unconfigured, and
|
|
51
|
+
// 404s with "model not found: huggingface/<model>" even though the model
|
|
52
|
+
// itself is present in opencode's own catalog.
|
|
53
|
+
huggingface: "HF_TOKEN",
|
|
39
54
|
minimax: "MINIMAX_API_KEY",
|
|
40
55
|
mistral: "MISTRAL_API_KEY",
|
|
41
56
|
moonshot: "MOONSHOT_API_KEY",
|
|
@@ -66,5 +81,5 @@ var baseEntryShape = {
|
|
|
66
81
|
};
|
|
67
82
|
|
|
68
83
|
export { CatalogPriceTierSchema, CatalogProviderSchema, LifecycleSchema, ModelKindSchema, NsfwPolicySchema, PROVIDER_KEY_ENV, PROVIDER_KEY_ENV_ALIASES, baseEntryShape };
|
|
69
|
-
//# sourceMappingURL=chunk-
|
|
70
|
-
//# sourceMappingURL=chunk-
|
|
84
|
+
//# sourceMappingURL=chunk-QNJRWRWC.mjs.map
|
|
85
|
+
//# sourceMappingURL=chunk-QNJRWRWC.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/schema/base.ts"],"names":[],"mappings":";;;;;;;;AAYO,IAAM,eAAA,GAAkB,EAAE,IAAA,CAAK,CAAC,OAAO,OAAA,EAAS,OAAA,EAAS,OAAO,CAAC;AAGjE,IAAM,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AAA,EAAQ,CAAC,gBAAgB,CAAA;AAAA,EACzB,QAAA,EAAU,CAAC,qBAAqB;AAClC;AAEO,IAAM,cAAA,GAAiB;AAAA,EAC5B,EAAA,EAAI,CAAA,CAAE,MAAA,EAAO,CAAE,IAAI,CAAC,CAAA;AAAA,EACpB,IAAA,EAAM,CAAA,CAAE,MAAA,EAAO,CAAE,IAAI,CAAC,CAAA;AAAA,EACtB,WAAA,EAAa,CAAA,CAAE,MAAA,EAAO,CAAE,QAAQ,EAAE,CAAA;AAAA,EAClC,QAAA,EAAU,qBAAA;AAAA,EACV,UAAA,EAAY,CAAA,CAAE,MAAA,EAAO,CAAE,IAAI,CAAC,CAAA;AAAA,EAC5B,YAAA,EAAc,CAAA,CAAE,OAAA,EAAQ,CAAE,QAAQ,KAAK,CAAA;AAAA,EACvC,SAAA,EAAW,eAAA,CAAgB,OAAA,CAAQ,QAAQ,CAAA;AAAA,EAC3C,IAAA,EAAM,EAAE,KAAA,CAAM,CAAA,CAAE,QAAQ,CAAA,CAAE,OAAA,CAAQ,EAAE,CAAA;AAAA,EACpC,gBAAA,EAAkB,sBAAA,CAAuB,OAAA,CAAQ,KAAK,CAAA;AAAA,EACtD,UAAA,EAAY,gBAAA,CAAiB,OAAA,CAAQ,UAAU,CAAA;AAAA,EAC/C,SAAS,CAAA,CAAE,KAAA,CAAM,EAAE,MAAA,EAAQ,EAAE,QAAA,EAAS;AAAA,EACtC,SAAS,CAAA,CAAE,KAAA,CAAM,EAAE,MAAA,EAAQ,EAAE,QAAA;AAC/B","file":"chunk-QNJRWRWC.mjs","sourcesContent":["import { z } from \"zod\"\n\n/**\n * Shared schema fragments for every model catalog entry.\n *\n * `baseEntryShape` is spread into per-kind schemas so each kind stays a\n * plain `z.object` — required by `z.discriminatedUnion`.\n *\n * Mirrors the pattern in\n * `packages/agencies/registry-client/src/types.ts` (`basePayloadShape`).\n */\n\nexport const ModelKindSchema = z.enum([\"llm\", \"image\", \"video\", \"audio\"])\nexport type ModelKind = z.infer<typeof ModelKindSchema>\n\nexport const LifecycleSchema = z.enum([\"stable\", \"preview\", \"deprecated\"])\nexport type Lifecycle = z.infer<typeof LifecycleSchema>\n\n/**\n * `catalogPriceTier` — the model's intrinsic cost bucket. Distinct from\n * `subscriptionPlanTier` (the user's billing level) and `modelPreset`\n * (an app's per-conversation UX picker). Always qualify when discussing\n * tiers — bare `priceTier` / `tier` is ambiguous in this codebase.\n */\nexport const CatalogPriceTierSchema = z.enum([\"low\", \"mid\", \"high\", \"premium\"])\nexport type CatalogPriceTier = z.infer<typeof CatalogPriceTierSchema>\n\nexport const NsfwPolicySchema = z.enum([\"filtered\", \"permissive\", \"strict\"])\nexport type NsfwPolicy = z.infer<typeof NsfwPolicySchema>\n\n/**\n * Canonical model-provider registry — the single source of truth for the\n * `provider` field on every catalog entry. Adding a model on a new\n * provider means adding it here first, so a typo or an un-onboarded\n * provider is a validation/build error rather than a silently-broken\n * entry. `CatalogVoiceProviderSchema` is the voice-callable subset.\n */\nexport const CatalogProviderSchema = z.enum([\n \"anthropic\",\n \"assemblyai\",\n \"deepgram\",\n \"elevenlabs\",\n \"gemini-live\",\n \"google\",\n \"huggingface\",\n \"minimax\",\n \"mistral\",\n \"moonshot\",\n \"openai\",\n \"openai-realtime\",\n \"openrouter\",\n \"replicate\",\n \"requesty\",\n \"xai\",\n])\nexport type CatalogProvider = z.infer<typeof CatalogProviderSchema>\n\n/**\n * Canonical provider → api-key ENVIRONMENT VARIABLE name — the single source\n * of truth for \"which env var carries this provider's LLM billing key\". Lives\n * here, next to {@link CatalogProviderSchema}, because provider identity and\n * its key env are the same fact (adding a provider to the enum forces adding\n * its key env, or this `Record<CatalogProvider, string>` fails to type-check —\n * the compile-time equivalent of catalog-sync keeping it current).\n *\n * `@agentproto/runtime`'s `providers-store` DERIVES `PROVIDER_ENV_VARS` from\n * this map (re-exporting it plus a few non-catalog gateway keys like `groq` /\n * `vercel-ai-gateway`), and the billing-auth resolver calls\n * `providerEnvVar(provider)` rather than ever re-listing these names per\n * adapter manifest. Names follow each SDK's own convention (matching the\n * adapter manifests' `models.env` maps). This is the api-key axis ONLY — the\n * `subscription` (Anthropic OAuth) env var is consumer-specific and declared\n * per Claude adapter, not here.\n */\nexport const PROVIDER_KEY_ENV: Record<CatalogProvider, string> = {\n anthropic: \"ANTHROPIC_API_KEY\",\n assemblyai: \"ASSEMBLYAI_API_KEY\",\n deepgram: \"DEEPGRAM_API_KEY\",\n elevenlabs: \"ELEVENLABS_API_KEY\",\n \"gemini-live\": \"GOOGLE_GENERATIVE_AI_API_KEY\",\n google: \"GOOGLE_GENERATIVE_AI_API_KEY\",\n // Ecosystem convention, not our own invention: every HF tool (transformers,\n // huggingface_hub, the `hf` CLI) and — load-bearing here — opencode's own\n // bundled huggingface provider (`@ai-sdk/openai-compatible`, reads\n // `env:[\"HF_TOKEN\"]` off its models.dev-style catalog entry, confirmed by\n // inspecting the shipped `opencode acp` binary) read `HF_TOKEN`, never\n // `HUGGINGFACE_API_KEY`. `ANTHROPIC_GATEWAY_PRESETS.huggingface.keyEnv`\n // (`provider-presets/src/anthropic-gateways.ts`) already got this right for\n // the explicit `route.gateway` path; this was the other half — the\n // model-derived-api-key path (`resolveAuthSpec`'s non-gateway branch calls\n // `providerEnvVar(provider)`, i.e. THIS map, directly) still injected the\n // wrong var, so any `<model>@huggingface` spawn through a model-derived\n // router (opencode) got a credential opencode's huggingface provider never\n // reads — it sees no HF_TOKEN, treats the provider as unconfigured, and\n // 404s with \"model not found: huggingface/<model>\" even though the model\n // itself is present in opencode's own catalog.\n huggingface: \"HF_TOKEN\",\n minimax: \"MINIMAX_API_KEY\",\n mistral: \"MISTRAL_API_KEY\",\n moonshot: \"MOONSHOT_API_KEY\",\n openai: \"OPENAI_API_KEY\",\n \"openai-realtime\": \"OPENAI_API_KEY\",\n openrouter: \"OPENROUTER_API_KEY\",\n replicate: \"REPLICATE_API_TOKEN\",\n requesty: \"REQUESTY_API_KEY\",\n xai: \"XAI_API_KEY\",\n}\n\n/**\n * ADDITIONAL env-var names that carry the *same* provider key, beyond the one\n * canonical name in {@link PROVIDER_KEY_ENV}. Some consumers read a different\n * alias for a provider than the name we canonically inject, so a key set once\n * (`agentproto auth provider set <provider> <key>`) must be able to satisfy\n * every alias, not just the canonical name. `providers-store` derives its\n * `PROVIDER_ENV_ALIASES` from this and injects the canonical name PLUS every\n * alias at `serve` boot (explicit env still wins, per env name).\n *\n * Aliases are VERIFIED against a real consumer, never guessed — an alias we\n * cannot prove a consumer reads does not belong here:\n *\n * - `google: [\"GOOGLE_API_KEY\"]` — mastracode / `@mastra/core`. Its\n * `PROVIDER_REGISTRY.google.apiKeyEnvVar` is the alias array\n * `[\"GOOGLE_API_KEY\", \"GOOGLE_GENERATIVE_AI_API_KEY\"]`, but\n * `@mastra/code-sdk`'s `getApiKeyEnvVar()` collapses it to `envVars[0]`\n * (`GOOGLE_API_KEY`) before testing `Boolean(process.env[…])`. So mastracode\n * consults ONLY `GOOGLE_API_KEY`; our canonical `GOOGLE_GENERATIVE_AI_API_KEY`\n * is invisible to it. (Confirmed in the installed mastracode 0.26.x tree.)\n * - `moonshot: [\"MOONSHOT_AI_API_KEY\"]` — mastracode again, but via a HARDCODED\n * branch that bypasses the registry entirely:\n * `@mastra/code-sdk/dist/agents/mastracode-gateway.js:331-333` does\n * `if (args.providerId === \"moonshotai\") { if (!process.env.MOONSHOT_AI_API_KEY) throw … }`.\n * It reads `MOONSHOT_AI_API_KEY` (note the `_AI_`); we inject `MOONSHOT_API_KEY`\n * via {@link PROVIDER_KEY_ENV}. Because the name is hardcoded, not\n * registry-declared, the next reader cannot discover it from the registry —\n * hence this comment. (The provider slug drifts too: `moonshotai` upstream vs\n * our `moonshot`; the alias handles the env NAME, which is what matters here.)\n *\n * `gemini-live` is deliberately absent: no consumer of that provider is known\n * to read `GOOGLE_API_KEY`, so per the verify-not-guess rule it stays out. The\n * drift set is capped: across the providers we share with mastracode, only\n * `google` and `moonshot` diverge — anthropic / openai / openrouter / xai /\n * mistral / minimax (and the non-catalog groq) all match, so none are added.\n *\n * `Partial` because most providers have no known alias — a provider absent\n * here just gets its single canonical name injected.\n */\nexport const PROVIDER_KEY_ENV_ALIASES = {\n google: [\"GOOGLE_API_KEY\"],\n moonshot: [\"MOONSHOT_AI_API_KEY\"],\n} satisfies Partial<Record<CatalogProvider, readonly string[]>>\n\nexport const baseEntryShape = {\n id: z.string().min(1),\n name: z.string().min(1),\n description: z.string().default(\"\"),\n provider: CatalogProviderSchema,\n providerId: z.string().min(1),\n agentVisible: z.boolean().default(false),\n lifecycle: LifecycleSchema.default(\"stable\"),\n tags: z.array(z.string()).default([]),\n catalogPriceTier: CatalogPriceTierSchema.default(\"mid\"),\n nsfwPolicy: NsfwPolicySchema.default(\"filtered\"),\n regions: z.array(z.string()).optional(),\n aliases: z.array(z.string()).optional(),\n} as const\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { listModels } from './chunk-
|
|
2
|
-
import { modelHasTag } from './chunk-
|
|
1
|
+
import { listModels } from './chunk-JHBSGPWH.mjs';
|
|
2
|
+
import { modelHasTag } from './chunk-H467PHUU.mjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* @agentproto/model-catalog v0.1.0
|
|
@@ -130,5 +130,5 @@ function filterVoicesByProviders(voices, providerTokens) {
|
|
|
130
130
|
}
|
|
131
131
|
|
|
132
132
|
export { applyProfile, expandProviders, filterVoicesByProviders, getProviderGroup, getSurfaceProfile, groupForProvider, listProviderGroups, listSurfaceProfiles, listSurfaced, modelMatchesProfile };
|
|
133
|
-
//# sourceMappingURL=chunk-
|
|
134
|
-
//# sourceMappingURL=chunk-
|
|
133
|
+
//# sourceMappingURL=chunk-UREM2UZK.mjs.map
|
|
134
|
+
//# sourceMappingURL=chunk-UREM2UZK.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/curation/index.ts"],"names":[],"mappings":";;;;;;;;;;AAgDA,IAAM,eAAA,GAA4C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IAAA,GAAO,eAAA,CAAgB,OAAA,CAAQ,SAAS,CAAA;AAC9C,IAAA,IAAI,CAAC,KAAK,IAAA,CAAK,CAAA,GAAA,KAAO,YAAY,KAAA,EAAO,GAAG,CAAC,CAAA,EAAG,OAAO,KAAA;AAAA,EACzD;AACA,EAAA,IAAI,QAAQ,YAAA,EAAc;AACxB,IAAA,IAAI,CAAC,QAAQ,YAAA,CAAa,KAAA,CAAM,SAAO,WAAA,CAAY,KAAA,EAAO,GAAG,CAAC,CAAA;AAC5D,MAAA,OAAO,KAAA;AAAA,EACX;AACA,EAAA,IAAI,QAAQ,IAAA,EAAM;AAChB,IAAA,IAAI,CAAC,OAAA,CAAQ,IAAA,CAAK,KAAA,CAAM,CAAA,GAAA,KAAO,YAAY,KAAA,EAAO,GAAG,CAAC,CAAA,EAAG,OAAO,KAAA;AAAA,EAClE;AACA,EAAA,OAAO,IAAA;AACT;AAGO,SAAS,YAAA,CACd,QACA,OAAA,EACiB;AACjB,EAAA,OAAO,OAAO,MAAA,CAAO,CAAA,KAAA,KAAS,mBAAA,CAAoB,KAAA,EAAO,OAAO,CAAC,CAAA;AACnE;AAMO,SAAS,aAAa,OAAA,EAA0C;AACrE,EAAA,OAAO,YAAA,CAAa,UAAA,EAAW,EAAG,OAAO,CAAA;AAC3C;AASO,SAAS,uBAAA,CACd,QACA,cAAA,EACgB;AAChB,EAAA,IAAI,cAAA,CAAe,MAAA,KAAW,CAAA,EAAG,OAAO,MAAA;AACxC,EAAA,MAAM,IAAA,GAAO,IAAI,GAAA,CAAI,eAAA,CAAgB,cAAc,CAAC,CAAA;AACpD,EAAA,OAAO,OAAO,MAAA,CAAO,CAAA,CAAA,KAAK,KAAK,GAAA,CAAI,CAAA,CAAE,QAAQ,CAAC,CAAA;AAChD","file":"chunk-O7ZJEMH6.mjs","sourcesContent":["/**\n * Curation — what an app SURFACES from the catalog, distinct from\n * model-access (who MAY use a model: tier/scope policy). Curation is the\n * \"feature/provider catalog\" layer: an app composes views over the one\n * registry (\"all s2s voices from OpenAI OR Google\", \"images only\", …)\n * without touching the underlying data.\n *\n * Two registries, both following the canonical profile-registry shape\n * (`listX()` / `getX(id)` throwing with the known-id list):\n *\n * 1. PROVIDER GROUPS — a company (`openai`) maps to every provider tag\n * it owns across kinds (`openai` for the LLM/audio company tag,\n * `openai-realtime` for its voice engine). This is what reconciles\n * the two provider vocabularies in the registry: audio MODELS are\n * tagged by company, voices by engine. Curating by group spans both.\n *\n * 2. SURFACE PROFILES — named presets (`voice-s2s`, `images`, …) an app\n * selects from. Permissive by default (`all`); apps narrow only when\n * a picker should diverge.\n *\n * Selection precedence (caller's job): per-call arg → per-app/guild\n * config → env → `all` fallback.\n */\n\nimport {\n listModels,\n type CatalogKind,\n type ResolvedModel,\n} from \"../registry/index.js\"\nimport { modelHasTag } from \"../enrichment/index.js\"\nimport type { CatalogVoice } from \"../schema/voice.js\"\n\n// ───────────────────────────────────────────────────────────────────────\n// Provider groups — company → provider tags across kinds\n// ───────────────────────────────────────────────────────────────────────\n\nexport interface ProviderGroup {\n /** Canonical company id, e.g. \"openai\", \"google\". */\n id: string\n /** Display label. */\n label: string\n /**\n * Every provider tag this company owns across kinds. Audio/image/LLM use\n * the company tag (`openai`); the voice engine uses its own (`openai-realtime`).\n */\n providers: readonly string[]\n}\n\nconst PROVIDER_GROUPS: readonly ProviderGroup[] = [\n { id: \"openai\", label: \"OpenAI\", providers: [\"openai\", \"openai-realtime\"] },\n { id: \"google\", label: \"Google\", providers: [\"google\", \"gemini-live\"] },\n { id: \"anthropic\", label: \"Anthropic\", providers: [\"anthropic\"] },\n { id: \"minimax\", label: \"MiniMax\", providers: [\"minimax\"] },\n { id: \"elevenlabs\", label: \"ElevenLabs\", providers: [\"elevenlabs\"] },\n { id: \"replicate\", label: \"Replicate\", providers: [\"replicate\"] },\n { id: \"deepgram\", label: \"Deepgram\", providers: [\"deepgram\"] },\n { id: \"assemblyai\", label: \"AssemblyAI\", providers: [\"assemblyai\"] },\n]\n\nexport function listProviderGroups(): readonly ProviderGroup[] {\n return PROVIDER_GROUPS\n}\n\nexport function getProviderGroup(id: string): ProviderGroup {\n const group = PROVIDER_GROUPS.find(g => g.id === id)\n if (!group) {\n const known = PROVIDER_GROUPS.map(g => g.id).join(\", \")\n throw new Error(`curation: unknown provider group \"${id}\". Known: ${known}`)\n }\n return group\n}\n\n/** The group that owns a raw provider tag, if any. */\nexport function groupForProvider(\n providerTag: string\n): ProviderGroup | undefined {\n return PROVIDER_GROUPS.find(g => g.providers.includes(providerTag))\n}\n\n/**\n * Expand a mixed list of provider-group ids and raw provider tags into the\n * flat set of provider tags to match against. A token that is a known\n * group id expands to its members; anything else passes through as a raw\n * tag (so callers can target an engine directly, e.g. `gemini-live`).\n */\nexport function expandProviders(tokens: readonly string[]): string[] {\n const out = new Set<string>()\n for (const token of tokens) {\n const group = PROVIDER_GROUPS.find(g => g.id === token)\n if (group) {\n for (const p of group.providers) out.add(p)\n } else {\n out.add(token)\n }\n }\n return [...out]\n}\n\n// ───────────────────────────────────────────────────────────────────────\n// Surface profiles — named views an app surfaces\n// ───────────────────────────────────────────────────────────────────────\n\nexport interface SurfaceProfile {\n id: string\n description: string\n /** Restrict to these kinds. Undefined/empty = every kind. */\n kinds?: readonly CatalogKind[]\n /**\n * Restrict to these provider GROUP ids or raw provider tags (OR-set).\n * Expanded via `expandProviders`, so `[\"openai\"]` covers both the\n * `openai` company tag and the `openai-realtime` voice engine.\n */\n providers?: readonly string[]\n /** Require all of these capability tags (AND-set): `s2s`, `tts`, `edit`, … */\n capabilities?: readonly string[]\n /** Require all of these arbitrary tags (AND-set). */\n tags?: readonly string[]\n}\n\nconst SURFACE_PROFILES: readonly SurfaceProfile[] = [\n {\n id: \"all\",\n description: \"Everything the catalog offers — the permissive default\",\n },\n {\n id: \"text\",\n description: \"Text models (LLMs) only\",\n kinds: [\"llm\"],\n },\n {\n id: \"images\",\n description: \"Image models only\",\n kinds: [\"image\"],\n },\n {\n id: \"video\",\n description: \"Video models only\",\n kinds: [\"video\"],\n },\n {\n id: \"audio\",\n description: \"Audio models (TTS / STT / s2s) only\",\n kinds: [\"audio\"],\n },\n {\n id: \"voice\",\n description: \"Every curated voice, any provider\",\n kinds: [\"voice\"],\n },\n {\n id: \"voice-s2s\",\n description:\n \"Speech-to-speech voice engines (OpenAI Realtime, Gemini Live)\",\n kinds: [\"voice\"],\n capabilities: [\"s2s\"],\n },\n {\n id: \"voice-tts\",\n description: \"Sequential TTS voices (MiniMax, ElevenLabs)\",\n kinds: [\"voice\"],\n capabilities: [\"tts\"],\n },\n]\n\nexport function listSurfaceProfiles(): readonly SurfaceProfile[] {\n return SURFACE_PROFILES\n}\n\nexport function getSurfaceProfile(id: string): SurfaceProfile {\n const profile = SURFACE_PROFILES.find(p => p.id === id)\n if (!profile) {\n const known = SURFACE_PROFILES.map(p => p.id).join(\", \")\n throw new Error(\n `curation: unknown surface profile \"${id}\". Known: ${known}`\n )\n }\n return profile\n}\n\n// ───────────────────────────────────────────────────────────────────────\n// Filters\n// ───────────────────────────────────────────────────────────────────────\n\n/**\n * True iff a model passes a surface profile. Provider membership, like\n * capability/tag membership, is checked against the enrichment tag\n * vocabulary (every kind emits its provider as a tag), so this is uniform\n * across kinds and naturally spans the company/engine provider split.\n */\nexport function modelMatchesProfile(\n model: ResolvedModel,\n profile: SurfaceProfile\n): boolean {\n if (profile.kinds && profile.kinds.length > 0) {\n if (!profile.kinds.includes(model.kind)) return false\n }\n if (profile.providers && profile.providers.length > 0) {\n const tags = expandProviders(profile.providers)\n if (!tags.some(tag => modelHasTag(model, tag))) return false\n }\n if (profile.capabilities) {\n if (!profile.capabilities.every(cap => modelHasTag(model, cap)))\n return false\n }\n if (profile.tags) {\n if (!profile.tags.every(tag => modelHasTag(model, tag))) return false\n }\n return true\n}\n\n/** Filter a model list down to what a surface profile exposes. */\nexport function applyProfile(\n models: ResolvedModel[],\n profile: SurfaceProfile\n): ResolvedModel[] {\n return models.filter(model => modelMatchesProfile(model, profile))\n}\n\n/**\n * The catalog as a surface profile exposes it — `applyProfile` over the\n * full registry. The composable entry point for \"show me this view\".\n */\nexport function listSurfaced(profile: SurfaceProfile): ResolvedModel[] {\n return applyProfile(listModels(), profile)\n}\n\n/**\n * Voice-list curation. The merged voice catalog (curated + live\n * ElevenLabs) is `CatalogVoice[]`, not `ResolvedModel[]`, so it gets its\n * own provider filter — same group-expansion semantics. Only the provider\n * facet of a profile applies to a raw voice list (kind is implicitly\n * voice; capability/tag live on the registry projection).\n */\nexport function filterVoicesByProviders(\n voices: CatalogVoice[],\n providerTokens: readonly string[]\n): CatalogVoice[] {\n if (providerTokens.length === 0) return voices\n const tags = new Set(expandProviders(providerTokens))\n return voices.filter(v => tags.has(v.provider))\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/curation/index.ts"],"names":[],"mappings":";;;;;;;;;;AAgDA,IAAM,eAAA,GAA4C;AAAA,EAChD,EAAE,IAAI,QAAA,EAAU,KAAA,EAAO,UAAU,SAAA,EAAW,CAAC,QAAA,EAAU,iBAAiB,CAAA,EAAE;AAAA,EAC1E,EAAE,IAAI,QAAA,EAAU,KAAA,EAAO,UAAU,SAAA,EAAW,CAAC,QAAA,EAAU,aAAa,CAAA,EAAE;AAAA,EACtE,EAAE,IAAI,WAAA,EAAa,KAAA,EAAO,aAAa,SAAA,EAAW,CAAC,WAAW,CAAA,EAAE;AAAA,EAChE,EAAE,IAAI,SAAA,EAAW,KAAA,EAAO,WAAW,SAAA,EAAW,CAAC,SAAS,CAAA,EAAE;AAAA,EAC1D,EAAE,IAAI,YAAA,EAAc,KAAA,EAAO,cAAc,SAAA,EAAW,CAAC,YAAY,CAAA,EAAE;AAAA,EACnE,EAAE,IAAI,WAAA,EAAa,KAAA,EAAO,aAAa,SAAA,EAAW,CAAC,WAAW,CAAA,EAAE;AAAA,EAChE,EAAE,IAAI,UAAA,EAAY,KAAA,EAAO,YAAY,SAAA,EAAW,CAAC,UAAU,CAAA,EAAE;AAAA,EAC7D,EAAE,IA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OAAO,CAAC,CAAA;AACnE;AAMO,SAAS,aAAa,OAAA,EAA0C;AACrE,EAAA,OAAO,YAAA,CAAa,UAAA,EAAW,EAAG,OAAO,CAAA;AAC3C;AASO,SAAS,uBAAA,CACd,QACA,cAAA,EACgB;AAChB,EAAA,IAAI,cAAA,CAAe,MAAA,KAAW,CAAA,EAAG,OAAO,MAAA;AACxC,EAAA,MAAM,IAAA,GAAO,IAAI,GAAA,CAAI,eAAA,CAAgB,cAAc,CAAC,CAAA;AACpD,EAAA,OAAO,OAAO,MAAA,CAAO,CAAA,CAAA,KAAK,KAAK,GAAA,CAAI,CAAA,CAAE,QAAQ,CAAC,CAAA;AAChD","file":"chunk-UREM2UZK.mjs","sourcesContent":["/**\n * Curation — what an app SURFACES from the catalog, distinct from\n * model-access (who MAY use a model: tier/scope policy). Curation is the\n * \"feature/provider catalog\" layer: an app composes views over the one\n * registry (\"all s2s voices from OpenAI OR Google\", \"images only\", …)\n * without touching the underlying data.\n *\n * Two registries, both following the canonical profile-registry shape\n * (`listX()` / `getX(id)` throwing with the known-id list):\n *\n * 1. PROVIDER GROUPS — a company (`openai`) maps to every provider tag\n * it owns across kinds (`openai` for the LLM/audio company tag,\n * `openai-realtime` for its voice engine). This is what reconciles\n * the two provider vocabularies in the registry: audio MODELS are\n * tagged by company, voices by engine. Curating by group spans both.\n *\n * 2. SURFACE PROFILES — named presets (`voice-s2s`, `images`, …) an app\n * selects from. Permissive by default (`all`); apps narrow only when\n * a picker should diverge.\n *\n * Selection precedence (caller's job): per-call arg → per-app/guild\n * config → env → `all` fallback.\n */\n\nimport {\n listModels,\n type CatalogKind,\n type ResolvedModel,\n} from \"../registry/index.js\"\nimport { modelHasTag } from \"../enrichment/index.js\"\nimport type { CatalogVoice } from \"../schema/voice.js\"\n\n// ───────────────────────────────────────────────────────────────────────\n// Provider groups — company → provider tags across kinds\n// ───────────────────────────────────────────────────────────────────────\n\nexport interface ProviderGroup {\n /** Canonical company id, e.g. \"openai\", \"google\". */\n id: string\n /** Display label. */\n label: string\n /**\n * Every provider tag this company owns across kinds. Audio/image/LLM use\n * the company tag (`openai`); the voice engine uses its own (`openai-realtime`).\n */\n providers: readonly string[]\n}\n\nconst PROVIDER_GROUPS: readonly ProviderGroup[] = [\n { id: \"openai\", label: \"OpenAI\", providers: [\"openai\", \"openai-realtime\"] },\n { id: \"google\", label: \"Google\", providers: [\"google\", \"gemini-live\"] },\n { id: \"anthropic\", label: \"Anthropic\", providers: [\"anthropic\"] },\n { id: \"minimax\", label: \"MiniMax\", providers: [\"minimax\"] },\n { id: \"elevenlabs\", label: \"ElevenLabs\", providers: [\"elevenlabs\"] },\n { id: \"replicate\", label: \"Replicate\", providers: [\"replicate\"] },\n { id: \"deepgram\", label: \"Deepgram\", providers: [\"deepgram\"] },\n { id: \"assemblyai\", label: \"AssemblyAI\", providers: [\"assemblyai\"] },\n]\n\nexport function listProviderGroups(): readonly ProviderGroup[] {\n return PROVIDER_GROUPS\n}\n\nexport function getProviderGroup(id: string): ProviderGroup {\n const group = PROVIDER_GROUPS.find(g => g.id === id)\n if (!group) {\n const known = PROVIDER_GROUPS.map(g => g.id).join(\", \")\n throw new Error(`curation: unknown provider group \"${id}\". Known: ${known}`)\n }\n return group\n}\n\n/** The group that owns a raw provider tag, if any. */\nexport function groupForProvider(\n providerTag: string\n): ProviderGroup | undefined {\n return PROVIDER_GROUPS.find(g => g.providers.includes(providerTag))\n}\n\n/**\n * Expand a mixed list of provider-group ids and raw provider tags into the\n * flat set of provider tags to match against. A token that is a known\n * group id expands to its members; anything else passes through as a raw\n * tag (so callers can target an engine directly, e.g. `gemini-live`).\n */\nexport function expandProviders(tokens: readonly string[]): string[] {\n const out = new Set<string>()\n for (const token of tokens) {\n const group = PROVIDER_GROUPS.find(g => g.id === token)\n if (group) {\n for (const p of group.providers) out.add(p)\n } else {\n out.add(token)\n }\n }\n return [...out]\n}\n\n// ───────────────────────────────────────────────────────────────────────\n// Surface profiles — named views an app surfaces\n// ───────────────────────────────────────────────────────────────────────\n\nexport interface SurfaceProfile {\n id: string\n description: string\n /** Restrict to these kinds. Undefined/empty = every kind. */\n kinds?: readonly CatalogKind[]\n /**\n * Restrict to these provider GROUP ids or raw provider tags (OR-set).\n * Expanded via `expandProviders`, so `[\"openai\"]` covers both the\n * `openai` company tag and the `openai-realtime` voice engine.\n */\n providers?: readonly string[]\n /** Require all of these capability tags (AND-set): `s2s`, `tts`, `edit`, … */\n capabilities?: readonly string[]\n /** Require all of these arbitrary tags (AND-set). */\n tags?: readonly string[]\n}\n\nconst SURFACE_PROFILES: readonly SurfaceProfile[] = [\n {\n id: \"all\",\n description: \"Everything the catalog offers — the permissive default\",\n },\n {\n id: \"text\",\n description: \"Text models (LLMs) only\",\n kinds: [\"llm\"],\n },\n {\n id: \"images\",\n description: \"Image models only\",\n kinds: [\"image\"],\n },\n {\n id: \"video\",\n description: \"Video models only\",\n kinds: [\"video\"],\n },\n {\n id: \"audio\",\n description: \"Audio models (TTS / STT / s2s) only\",\n kinds: [\"audio\"],\n },\n {\n id: \"voice\",\n description: \"Every curated voice, any provider\",\n kinds: [\"voice\"],\n },\n {\n id: \"voice-s2s\",\n description:\n \"Speech-to-speech voice engines (OpenAI Realtime, Gemini Live)\",\n kinds: [\"voice\"],\n capabilities: [\"s2s\"],\n },\n {\n id: \"voice-tts\",\n description: \"Sequential TTS voices (MiniMax, ElevenLabs)\",\n kinds: [\"voice\"],\n capabilities: [\"tts\"],\n },\n]\n\nexport function listSurfaceProfiles(): readonly SurfaceProfile[] {\n return SURFACE_PROFILES\n}\n\nexport function getSurfaceProfile(id: string): SurfaceProfile {\n const profile = SURFACE_PROFILES.find(p => p.id === id)\n if (!profile) {\n const known = SURFACE_PROFILES.map(p => p.id).join(\", \")\n throw new Error(\n `curation: unknown surface profile \"${id}\". Known: ${known}`\n )\n }\n return profile\n}\n\n// ───────────────────────────────────────────────────────────────────────\n// Filters\n// ───────────────────────────────────────────────────────────────────────\n\n/**\n * True iff a model passes a surface profile. Provider membership, like\n * capability/tag membership, is checked against the enrichment tag\n * vocabulary (every kind emits its provider as a tag), so this is uniform\n * across kinds and naturally spans the company/engine provider split.\n */\nexport function modelMatchesProfile(\n model: ResolvedModel,\n profile: SurfaceProfile\n): boolean {\n if (profile.kinds && profile.kinds.length > 0) {\n if (!profile.kinds.includes(model.kind)) return false\n }\n if (profile.providers && profile.providers.length > 0) {\n const tags = expandProviders(profile.providers)\n if (!tags.some(tag => modelHasTag(model, tag))) return false\n }\n if (profile.capabilities) {\n if (!profile.capabilities.every(cap => modelHasTag(model, cap)))\n return false\n }\n if (profile.tags) {\n if (!profile.tags.every(tag => modelHasTag(model, tag))) return false\n }\n return true\n}\n\n/** Filter a model list down to what a surface profile exposes. */\nexport function applyProfile(\n models: ResolvedModel[],\n profile: SurfaceProfile\n): ResolvedModel[] {\n return models.filter(model => modelMatchesProfile(model, profile))\n}\n\n/**\n * The catalog as a surface profile exposes it — `applyProfile` over the\n * full registry. The composable entry point for \"show me this view\".\n */\nexport function listSurfaced(profile: SurfaceProfile): ResolvedModel[] {\n return applyProfile(listModels(), profile)\n}\n\n/**\n * Voice-list curation. The merged voice catalog (curated + live\n * ElevenLabs) is `CatalogVoice[]`, not `ResolvedModel[]`, so it gets its\n * own provider filter — same group-expansion semantics. Only the provider\n * facet of a profile applies to a raw voice list (kind is implicitly\n * voice; capability/tag live on the registry projection).\n */\nexport function filterVoicesByProviders(\n voices: CatalogVoice[],\n providerTokens: readonly string[]\n): CatalogVoice[] {\n if (providerTokens.length === 0) return voices\n const tags = new Set(expandProviders(providerTokens))\n return voices.filter(v => tags.has(v.provider))\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { getModel } from './chunk-
|
|
2
|
-
import { calculateLLMCreditCost } from './chunk-
|
|
1
|
+
import { getModel } from './chunk-JHBSGPWH.mjs';
|
|
2
|
+
import { calculateLLMCreditCost } from './chunk-6VUL4I7V.mjs';
|
|
3
3
|
import { computeCenticredits, pricingRegistry } from './chunk-QHELXPSL.mjs';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -223,5 +223,5 @@ function calculateAudioCost(modelId, usage, opts) {
|
|
|
223
223
|
}
|
|
224
224
|
|
|
225
225
|
export { CostUsageKindMismatchError, UnknownModelError, calculateAudioCost, calculateCost, calculateImageCost, calculateLLMCost, calculateVideoCost };
|
|
226
|
-
//# sourceMappingURL=chunk-
|
|
227
|
-
//# sourceMappingURL=chunk-
|
|
226
|
+
//# sourceMappingURL=chunk-V2BMFFUF.mjs.map
|
|
227
|
+
//# sourceMappingURL=chunk-V2BMFFUF.mjs.map
|