@agentproto/model-catalog 0.13.2 → 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/access/index.d.ts +4 -3
- package/dist/access/index.mjs +5 -4
- package/dist/{catalog-DLa4soLN.d.ts → catalog-BB0uDJh-.d.ts} +18 -38
- package/dist/{chunk-P5PQS3SJ.mjs → chunk-BXTZ2EDE.mjs} +114 -460
- package/dist/chunk-BXTZ2EDE.mjs.map +1 -0
- package/dist/{chunk-ORWNAAFP.mjs → chunk-DTE62ERL.mjs} +4 -4
- package/dist/{chunk-ORWNAAFP.mjs.map → chunk-DTE62ERL.mjs.map} +1 -1
- package/dist/{chunk-2P2R2XLK.mjs → chunk-ETI76MOK.mjs} +5 -5
- package/dist/{chunk-2P2R2XLK.mjs.map → chunk-ETI76MOK.mjs.map} +1 -1
- package/dist/chunk-HFPX2DNR.mjs +3 -0
- package/dist/chunk-HFPX2DNR.mjs.map +1 -0
- package/dist/{chunk-FPTLINCV.mjs → chunk-IHU6XTXS.mjs} +3 -3
- package/dist/{chunk-FPTLINCV.mjs.map → chunk-IHU6XTXS.mjs.map} +1 -1
- package/dist/{chunk-5E34CLTH.mjs → chunk-MZ23K5W6.mjs} +161 -169
- package/dist/chunk-MZ23K5W6.mjs.map +1 -0
- package/dist/{chunk-POKSD3S3.mjs → chunk-PVE3WQRH.mjs} +8 -6
- package/dist/chunk-PVE3WQRH.mjs.map +1 -0
- package/dist/{chunk-5GIH3O6I.mjs → chunk-W7K6DGOK.mjs} +4 -4
- package/dist/{chunk-5GIH3O6I.mjs.map → chunk-W7K6DGOK.mjs.map} +1 -1
- package/dist/{chunk-PKFRG2DA.mjs → chunk-YSEQMLV2.mjs} +14 -5
- package/dist/chunk-YSEQMLV2.mjs.map +1 -0
- package/dist/cost/index.mjs +6 -6
- package/dist/curation/index.d.ts +2 -2
- package/dist/curation/index.mjs +6 -6
- package/dist/evaluate-BjSlZsJf.d.ts +49 -0
- package/dist/{index-BZlWH9br.d.ts → index-D8FWHlom.d.ts} +1 -1
- package/dist/index-DetGJJ-F.d.ts +78 -0
- package/dist/index.d.ts +7 -5
- package/dist/index.mjs +11 -10
- package/dist/index.mjs.map +1 -1
- package/dist/lists/index.d.ts +70 -0
- package/dist/lists/index.mjs +290 -0
- package/dist/lists/index.mjs.map +1 -0
- package/dist/llm/index.d.ts +1 -1
- package/dist/llm/index.mjs +2 -2
- package/dist/overlay/index.d.ts +1 -1
- package/dist/picker/index.d.ts +112 -5
- package/dist/route-identity/index.d.ts +1 -1
- package/dist/route-identity/index.mjs +2 -2
- package/dist/types-DMzMWJeJ.d.ts +50 -0
- package/package.json +8 -3
- package/dist/chunk-5E34CLTH.mjs.map +0 -1
- package/dist/chunk-P5PQS3SJ.mjs.map +0 -1
- package/dist/chunk-PKFRG2DA.mjs.map +0 -1
- package/dist/chunk-POKSD3S3.mjs.map +0 -1
- package/dist/evaluate-DYz38I9t.d.ts +0 -84
- package/dist/index-CwIGbZai.d.ts +0 -171
|
@@ -1 +0,0 @@
|
|
|
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,CA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AqB,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-PKFRG2DA.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 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/access/catalog-defaults.ts","../src/access/evaluate.ts"],"names":[],"mappings":";;;;;;;;;AAmBO,SAAS,wBACd,KAAA,EACwB;AACxB,EAAA,QAAQ,MAAM,IAAA;AAAM,IAClB,KAAK,OAAA;AACH,MAAA,OAAO,KAAA,CAAM,GAAA,CAAI,YAAA,GACb,EAAE,OAAA,EAAS,IAAA,EAAM,MAAA,EAAQ,+BAAA,EAAgC,GACzD,EAAE,OAAA,EAAS,KAAA,EAAO,QAAQ,8BAAA,EAA+B;AAAA,IAC/D,KAAK,OAAA;AACH,MAAA,OAAO,KAAA,CAAM,GAAA,CAAI,YAAA,GACb,EAAE,OAAA,EAAS,IAAA,EAAM,MAAA,EAAQ,+BAAA,EAAgC,GACzD,EAAE,OAAA,EAAS,KAAA,EAAO,QAAQ,8BAAA,EAA+B;AAAA,IAC/D,KAAK,KAAA;AAEH,MAAA,OAAO,EAAE,OAAA,EAAS,IAAA,EAAM,MAAA,EAAQ,6BAAA,EAA8B;AAAA,IAChE,KAAK,OAAA;AACH,MAAA,OAAO,KAAA,CAAM,GAAA,CAAI,YAAA,GACb,EAAE,OAAA,EAAS,IAAA,EAAM,MAAA,EAAQ,+BAAA,EAAgC,GACzD,EAAE,OAAA,EAAS,KAAA,EAAO,QAAQ,8BAAA,EAA+B;AAAA,IAC/D,KAAK,OAAA;AAEH,MAAA,OAAO,EAAE,OAAA,EAAS,IAAA,EAAM,MAAA,EAAQ,+BAAA,EAAgC;AAAA;AAEtE;;;ACXA,IAAM,qBAAA,GAGF;AAAA,EACF,GAAA,EAAK,CAAA;AAAA,EACL,QAAA,EAAU,CAAA;AAAA,EACV,SAAA,EAAW,CAAA;AAAA,EACX,IAAA,EAAM;AACR,CAAA;AAgBA,IAAM,yCAAyB,IAAI,GAAA,CAAI,CAAC,MAA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AAE,CAAA,CAAA,GACjC,CAAA,EAAG,CAAA,CAAE,IAAI,CAAA,CAAA,EAAK,EAAwB,KAAK,CAAA,CAAA;AACjD,MAAA,MAAM,OAAO,MAAA,CAAO,MAAA,GAAS,CAAA,CAAA,EAAI,MAAA,CAAO,MAAM,CAAA,CAAA,GAAK,EAAA;AACnD,MAAA,OAAO;AAAA,QACL,OAAA,EAAS,OAAO,MAAA,KAAW,OAAA;AAAA,QAC3B,QAAQ,CAAA,KAAA,EAAQ,SAAS,IAAI,MAAA,CAAO,MAAM,GAAG,IAAI,CAAA;AAAA,OACnD;AAAA,IACF;AAAA,EACF;AAGA,EAAA,MAAM,QAAA,GAAW,wBAAwB,KAAK,CAAA;AAC9C,EAAA,OAAO,EAAE,OAAA,EAAS,QAAA,CAAS,OAAA,EAAS,MAAA,EAAQ,SAAS,MAAA,EAAO;AAC9D","file":"chunk-POKSD3S3.mjs","sourcesContent":["/**\n * Catalog-flag defaults — the layer that runs before any workspace\n * override. Mirrors the access-control plan:\n * - Default-allow: `lifecycle = stable && agentVisible = true`\n * - Default-block: `lifecycle = preview` or `lifecycle = deprecated`\n * - Default-block: any model with `agentVisible = false`\n *\n * Legacy catalog data (image/video) carries `agentVisible` but not\n * `lifecycle` — until v2 normalization, lifecycle defaults to \"stable\"\n * for every entry. LLM and audio entries default to allow (curated).\n */\n\nimport type { ResolvedModel } from \"../registry/index.js\"\n\nexport interface CatalogDefaultDecision {\n allowed: boolean\n reason: string\n}\n\nexport function evaluateCatalogDefaults(\n model: ResolvedModel\n): CatalogDefaultDecision {\n switch (model.kind) {\n case \"image\":\n return model.def.agentVisible\n ? { allowed: true, reason: \"catalog-default:agent-visible\" }\n : { allowed: false, reason: \"catalog-default:agent-hidden\" }\n case \"video\":\n return model.def.agentVisible\n ? { allowed: true, reason: \"catalog-default:agent-visible\" }\n : { allowed: false, reason: \"catalog-default:agent-hidden\" }\n case \"llm\":\n // LLM entries are curated — every catalog entry is visible.\n return { allowed: true, reason: \"catalog-default:llm-curated\" }\n case \"audio\":\n return model.def.agentVisible\n ? { allowed: true, reason: \"catalog-default:agent-visible\" }\n : { allowed: false, reason: \"catalog-default:agent-hidden\" }\n case \"voice\":\n // Voice metadata catalog is curated.\n return { allowed: true, reason: \"catalog-default:voice-curated\" }\n }\n}\n","/**\n * Access evaluator — resolves whether a workspace can use a given model.\n *\n * Resolution order:\n * 1. App scope — if the app opts out of the model's kind, deny.\n * 2. Workspace explicit `model:<id>` rule — terminal allow or block.\n * 3. Workspace tag / provider / priceTier / kind rules — most-specific\n * band wins. Within a band, block wins. Specificity ladder:\n * tag (4) > provider (3) > priceTier (2) > kind (1).\n * Rationale: an explicit `allow tag:image:generate` should beat a\n * blanket `block kind:llm`. The tag rule is the more specific\n * intent and reflects the operator's allowlist.\n * 4. Catalog defaults — `lifecycle=stable && agentVisible=true` → allow.\n *\n * BYOK relaxation: when `byokActive`, `priceTier=premium` blocks are\n * bypassed (BYOK users pay providers directly). NSFW / compliance\n * blocks NEVER bypass.\n */\n\nimport type { ResolvedModel } from \"../registry/index.js\"\nimport { modelHasTag, modelMatchesPriceTier } from \"../enrichment/index.js\"\nimport { evaluateCatalogDefaults } from \"./catalog-defaults.js\"\nimport type { AccessRule, AppScope } from \"./types.js\"\n\n/**\n * Specificity of non-model rule targets. Higher = more specific.\n * Most-specific band wins; within a band, block wins.\n *\n * Mirrors the scope specificity logic in\n * `packages/core/src/domain/model-access/types.ts:79`.\n */\nconst NON_MODEL_SPECIFICITY: Record<\n \"tag\" | \"provider\" | \"priceTier\" | \"kind\",\n number\n> = {\n tag: 4,\n provider: 3,\n priceTier: 2,\n kind: 1,\n}\n\nexport interface AccessEvalInput {\n model: ResolvedModel\n appScope?: AppScope\n /** Workspace overrides; v1 callers pass `[]`. */\n rules?: AccessRule[]\n byokActive?: boolean\n}\n\nexport interface AccessDecision {\n allowed: boolean\n /** Stable token for logs/metrics. */\n reason: string\n}\n\nconst NSFW_TAG_BLOCK_REASONS = new Set([\"nsfw\", \"compliance\"])\n\n/**\n * Returns true iff the rule matches the resolved model.\n *\n * Tag and priceTier matching go through the enrichment layer\n * (`@agentproto/model-catalog/enrichment`) — explicit per-model\n * enrichment wins, heuristic fallback fills the rest.\n */\nfunction ruleMatches(rule: AccessRule, model: ResolvedModel): boolean {\n const target = rule.target\n switch (target.kind) {\n case \"model\":\n return target.id === model.id\n case \"kind\":\n return target.value === model.kind\n case \"provider\": {\n switch (model.kind) {\n case \"image\":\n return model.def.provider === target.value\n case \"video\":\n return model.def.provider === target.value\n case \"audio\":\n return model.def.provider === target.value\n case \"voice\":\n return model.voice.provider === target.value\n case \"llm\":\n // No provider field on LLM entries — best-effort by canonical id\n // structure. All LLM ids follow `<vendor>/…` or\n // `<router>/<vendor>/…` conventions, so check for an exact\n // prefix segment or an interior `/<vendor>/` segment.\n // NOTE: avoid plain `.includes(target.value)` — it would\n // false-positive on any id that merely *contains* the substring\n // (e.g. \"not-google/…\" matching provider \"google\").\n // A `<router>/<vendor>/…` id (e.g. `openrouter/anthropic/…`) can\n // match BOTH a `router` and a `vendor` provider rule — that is\n // intentional; band resolution (most-specific wins) reconciles it.\n return (\n model.canonicalId.startsWith(`${target.value}/`) ||\n model.canonicalId.includes(`/${target.value}/`)\n )\n }\n }\n case \"tag\":\n return modelHasTag(model, target.value)\n case \"priceTier\":\n return modelMatchesPriceTier(model, target.value)\n }\n}\n\nexport function evaluateAccess(input: AccessEvalInput): AccessDecision {\n const { model, appScope, rules = [], byokActive = false } = input\n\n // 1. App scope. `voice` rows are metadata, not callable models — they\n // bypass kind-scope checks (gating happens on the audio MODEL the\n // voice plays through).\n if (\n appScope &&\n appScope.kinds.length > 0 &&\n model.kind !== \"voice\" &&\n !appScope.kinds.includes(model.kind)\n ) {\n return {\n allowed: false,\n reason: `app-scope:kind-not-allowed:${model.kind}`,\n }\n }\n\n // 2. Explicit per-model rules. Most specific band — terminal if any\n // matches. Within the band, block wins over allow (so a workspace\n // `block model:X` beats a tier-policy `allow model:X` regardless of\n // the order they appear in the merged rule list).\n const modelMatches = rules.filter(\n r =>\n r.target.kind === \"model\" && (r.target as { id: string }).id === model.id\n )\n if (modelMatches.length > 0) {\n const winner =\n modelMatches.find(r => r.effect === \"block\") ?? modelMatches[0]!\n return {\n allowed: winner.effect === \"allow\",\n reason: `rule:model:${winner.effect}${winner.reason ? `:${winner.reason}` : \"\"}`,\n }\n }\n\n // 3. Tag / provider / priceTier / kind rules. Most-specific band wins;\n // within a band, block wins. BYOK relaxation drops priceTier=premium\n // blocks before specificity grouping.\n const matchedByBand = new Map<number, AccessRule[]>()\n for (const rule of rules) {\n const k = rule.target.kind\n if (k === \"model\") continue\n if (!ruleMatches(rule, model)) continue\n if (rule.effect === \"block\") {\n // BYOK relaxation — same condition as before the refactor.\n if (\n byokActive &&\n rule.target.kind === \"priceTier\" &&\n rule.target.value === \"premium\" &&\n !NSFW_TAG_BLOCK_REASONS.has(rule.reason ?? \"\")\n ) {\n continue\n }\n }\n const band = NON_MODEL_SPECIFICITY[k]\n const list = matchedByBand.get(band) ?? []\n list.push(rule)\n matchedByBand.set(band, list)\n }\n\n if (matchedByBand.size > 0) {\n // Walk bands from most-specific to least-specific. The first band\n // with any matching rule decides — block wins within the band.\n const bands = Array.from(matchedByBand.keys()).sort((a, b) => b - a)\n for (const band of bands) {\n const bandRules = matchedByBand.get(band)!\n const blocked = bandRules.find(r => r.effect === \"block\")\n const allowed = bandRules.find(r => r.effect === \"allow\")\n const winner = blocked ?? allowed\n if (!winner) continue\n const t = winner.target\n const targetStr =\n t.kind === \"model\"\n ? `model:${(t as { id: string }).id}`\n : `${t.kind}:${(t as { value: string }).value}`\n const tail = winner.reason ? `:${winner.reason}` : \"\"\n return {\n allowed: winner.effect === \"allow\",\n reason: `rule:${targetStr}:${winner.effect}${tail}`,\n }\n }\n }\n\n // 4. Catalog defaults.\n const fallback = evaluateCatalogDefaults(model)\n return { allowed: fallback.allowed, reason: fallback.reason }\n}\n"]}
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import { R as ResolvedModel } from './index-BZlWH9br.js';
|
|
2
|
-
import { M as ModelKind } from './base-BaiI72Da.js';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Access control types — workspace-override rules + app scope.
|
|
6
|
-
*
|
|
7
|
-
* v1 ships the evaluator + types; the DB-backed `model_access_rules`
|
|
8
|
-
* table follows in v2 (the MCP gen layer reads rows and threads them
|
|
9
|
-
* through `evaluateAccess` per workspace).
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
type AccessEffect = "allow" | "block";
|
|
13
|
-
type AccessTarget = {
|
|
14
|
-
kind: "model";
|
|
15
|
-
id: string;
|
|
16
|
-
} | {
|
|
17
|
-
kind: "tag";
|
|
18
|
-
value: string;
|
|
19
|
-
} | {
|
|
20
|
-
kind: "provider";
|
|
21
|
-
value: string;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* `kind: "priceTier"` is the persisted DB discriminator string for
|
|
25
|
-
* catalog-price-tier targets (`low | mid | high | premium`). The
|
|
26
|
-
* conceptual name is `catalogPriceTier`; the literal stays `priceTier`
|
|
27
|
-
* to avoid breaking existing rows in `*_model_access_rules` tables.
|
|
28
|
-
*/
|
|
29
|
-
| {
|
|
30
|
-
kind: "priceTier";
|
|
31
|
-
value: "low" | "mid" | "high" | "premium";
|
|
32
|
-
} | {
|
|
33
|
-
kind: "kind";
|
|
34
|
-
value: ModelKind;
|
|
35
|
-
};
|
|
36
|
-
interface AccessRule {
|
|
37
|
-
effect: AccessEffect;
|
|
38
|
-
target: AccessTarget;
|
|
39
|
-
/** Audit reason; surfaced in decision.reason. */
|
|
40
|
-
reason?: string;
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Per-product opt-in: the app declares which kinds it surfaces. Lets
|
|
44
|
-
* one app hide LLMs, another hide video, etc. Empty `kinds` means the app
|
|
45
|
-
* does not constrain by kind (admin / catalog-browser scope).
|
|
46
|
-
*/
|
|
47
|
-
interface AppScope {
|
|
48
|
-
kinds: ModelKind[];
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* Access evaluator — resolves whether a workspace can use a given model.
|
|
53
|
-
*
|
|
54
|
-
* Resolution order:
|
|
55
|
-
* 1. App scope — if the app opts out of the model's kind, deny.
|
|
56
|
-
* 2. Workspace explicit `model:<id>` rule — terminal allow or block.
|
|
57
|
-
* 3. Workspace tag / provider / priceTier / kind rules — most-specific
|
|
58
|
-
* band wins. Within a band, block wins. Specificity ladder:
|
|
59
|
-
* tag (4) > provider (3) > priceTier (2) > kind (1).
|
|
60
|
-
* Rationale: an explicit `allow tag:image:generate` should beat a
|
|
61
|
-
* blanket `block kind:llm`. The tag rule is the more specific
|
|
62
|
-
* intent and reflects the operator's allowlist.
|
|
63
|
-
* 4. Catalog defaults — `lifecycle=stable && agentVisible=true` → allow.
|
|
64
|
-
*
|
|
65
|
-
* BYOK relaxation: when `byokActive`, `priceTier=premium` blocks are
|
|
66
|
-
* bypassed (BYOK users pay providers directly). NSFW / compliance
|
|
67
|
-
* blocks NEVER bypass.
|
|
68
|
-
*/
|
|
69
|
-
|
|
70
|
-
interface AccessEvalInput {
|
|
71
|
-
model: ResolvedModel;
|
|
72
|
-
appScope?: AppScope;
|
|
73
|
-
/** Workspace overrides; v1 callers pass `[]`. */
|
|
74
|
-
rules?: AccessRule[];
|
|
75
|
-
byokActive?: boolean;
|
|
76
|
-
}
|
|
77
|
-
interface AccessDecision {
|
|
78
|
-
allowed: boolean;
|
|
79
|
-
/** Stable token for logs/metrics. */
|
|
80
|
-
reason: string;
|
|
81
|
-
}
|
|
82
|
-
declare function evaluateAccess(input: AccessEvalInput): AccessDecision;
|
|
83
|
-
|
|
84
|
-
export { type AccessDecision as A, type AccessEffect as a, type AccessEvalInput as b, type AccessRule as c, type AccessTarget as d, type AppScope as e, evaluateAccess as f };
|
package/dist/index-CwIGbZai.d.ts
DELETED
|
@@ -1,171 +0,0 @@
|
|
|
1
|
-
import { A as AccessDecision } from './evaluate-DYz38I9t.js';
|
|
2
|
-
import { C as CatalogPriceTier, L as Lifecycle, M as ModelKind } from './base-BaiI72Da.js';
|
|
3
|
-
import { R as ResolvedModel } from './index-BZlWH9br.js';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Model enrichment — `catalogPriceTier` / `tags` / `lifecycle` / `actions`
|
|
7
|
-
* per model id.
|
|
8
|
-
*
|
|
9
|
-
* Bridge between the legacy data shape (`ImageModelDefinition`,
|
|
10
|
-
* `VideoModelDefinition`, `LLMPricing`) and the v2 access-rule
|
|
11
|
-
* primitives that target by tier, tag, and action. Without this, rules
|
|
12
|
-
* like `priceTier:premium` and `tag:nsfw` would never match anything.
|
|
13
|
-
*
|
|
14
|
-
* Two layers:
|
|
15
|
-
* 1. Explicit map for the curated set we know about (overrides win).
|
|
16
|
-
* 2. Heuristic inference for any model not in the explicit map
|
|
17
|
-
* (catalogPriceTier from creditCost / token rates; tags from kind +
|
|
18
|
-
* provider).
|
|
19
|
-
*
|
|
20
|
-
* Actions (`<kind>:<verb>` — e.g. `image:generate`, `llm:tool_use`) are
|
|
21
|
-
* computed from per-kind capability objects via `getActions` and merged
|
|
22
|
-
* into `tags` so existing tag-based access rules match action targets
|
|
23
|
-
* without any evaluator change. The reserved `<kind>:` prefix is enforced
|
|
24
|
-
* by `assertReservedPrefixDiscipline` at module load — free-form curation
|
|
25
|
-
* tags must NOT use it.
|
|
26
|
-
*
|
|
27
|
-
* Add an entry to `EXPLICIT_ENRICHMENT` when you want exact control;
|
|
28
|
-
* skip it when defaults are good enough.
|
|
29
|
-
*/
|
|
30
|
-
|
|
31
|
-
interface ModelEnrichment {
|
|
32
|
-
catalogPriceTier: CatalogPriceTier;
|
|
33
|
-
/** Curation tags + action tags (`<kind>:<verb>`) merged. */
|
|
34
|
-
tags: readonly string[];
|
|
35
|
-
lifecycle: Lifecycle;
|
|
36
|
-
/** Action tags only — convenience subset of `tags`. */
|
|
37
|
-
actions: readonly string[];
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Display price gauge level (1..5) for a model — the **visual** "price
|
|
41
|
-
* mostly" indicator (Low / Medium / High / Max / Ultra) the pickers and the
|
|
42
|
-
* estimator render as a bar. Distinct from {@link inferCatalogPriceTier}:
|
|
43
|
-
* that one drives 4-value *access* rules (`priceTier:premium`) and must stay a
|
|
44
|
-
* `CatalogPriceTier`; this is cosmetic and free to span 5 bands. Both bucket
|
|
45
|
-
* the same provider USD cost, so they move together by construction.
|
|
46
|
-
*/
|
|
47
|
-
declare function priceTierForModel(model: ResolvedModel): number;
|
|
48
|
-
/**
|
|
49
|
-
* Resolve enrichment for any model. Explicit map wins; heuristic fallback
|
|
50
|
-
* fills the rest. Action tags (`<kind>:<verb>`) are derived from the
|
|
51
|
-
* model's capability fields and merged into `tags`. Always returns a
|
|
52
|
-
* value (never undefined).
|
|
53
|
-
*/
|
|
54
|
-
declare function getEnrichment(model: ResolvedModel): ModelEnrichment;
|
|
55
|
-
declare function modelHasTag(model: ResolvedModel, tag: string): boolean;
|
|
56
|
-
declare function modelHasAction(model: ResolvedModel, action: string): boolean;
|
|
57
|
-
declare function modelMatchesCatalogPriceTier(model: ResolvedModel, tier: CatalogPriceTier): boolean;
|
|
58
|
-
/**
|
|
59
|
-
* @deprecated Use `modelMatchesCatalogPriceTier`. Kept for back-compat
|
|
60
|
-
* with the v1 evaluator's switch case which still uses the
|
|
61
|
-
* `priceTier` discriminator string. The function itself routes to the
|
|
62
|
-
* canonical name.
|
|
63
|
-
*/
|
|
64
|
-
declare function modelMatchesPriceTier(model: ResolvedModel, tier: CatalogPriceTier): boolean;
|
|
65
|
-
declare function modelMatchesKind(model: ResolvedModel, kind: ModelKind): boolean;
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* Picker subpath — wire shapes returned by the per-app
|
|
69
|
-
* `GET /models/available` route. Single source of truth shared by:
|
|
70
|
-
* - the server-side helper (an app-side model-access helper)
|
|
71
|
-
* - the per-app SDK clients (e.g. an app SDK client)
|
|
72
|
-
* - the cross-app picker hook (an app picker hook)
|
|
73
|
-
*
|
|
74
|
-
* Without this single source the hook + SDK previously drifted from
|
|
75
|
-
* the API contract and a fetcher in the app silently kept calling
|
|
76
|
-
* with a stale auth pattern after the cookie-auth migration.
|
|
77
|
-
*/
|
|
78
|
-
|
|
79
|
-
interface AvailableModelCapabilities {
|
|
80
|
-
generate?: boolean;
|
|
81
|
-
edit?: boolean;
|
|
82
|
-
upscale?: boolean;
|
|
83
|
-
textToVideo?: boolean;
|
|
84
|
-
imageToVideo?: boolean;
|
|
85
|
-
audio?: boolean;
|
|
86
|
-
subjectReference?: boolean;
|
|
87
|
-
tts?: boolean;
|
|
88
|
-
stt?: boolean;
|
|
89
|
-
s2s?: boolean;
|
|
90
|
-
}
|
|
91
|
-
interface AvailableModel {
|
|
92
|
-
id: string;
|
|
93
|
-
/** Canonical model id (LLM aliases collapse here). */
|
|
94
|
-
canonicalId: string;
|
|
95
|
-
/**
|
|
96
|
-
* Priced model kind. Typed `ModelKind` (not `CatalogKind`) on purpose: the
|
|
97
|
-
* picker never surfaces `voice` rows as `AvailableModel` — voices reach the
|
|
98
|
-
* UI through a separate path — so `voice` is intentionally out of range here.
|
|
99
|
-
*/
|
|
100
|
-
kind: ModelKind;
|
|
101
|
-
displayName: string;
|
|
102
|
-
description: string;
|
|
103
|
-
enrichment: ModelEnrichment;
|
|
104
|
-
decision: AccessDecision;
|
|
105
|
-
capabilities: AvailableModelCapabilities;
|
|
106
|
-
/** Recommended pricing display (per provider unit). */
|
|
107
|
-
pricingHint?: string;
|
|
108
|
-
/**
|
|
109
|
-
* Audio models only: cost normalized to **per minute of speech**, the
|
|
110
|
-
* intuitive unit for the voice picker. TTS (billed per 1k chars) is
|
|
111
|
-
* converted via an assumed speaking rate; per-minute models pass through.
|
|
112
|
-
*/
|
|
113
|
-
voiceHint?: string;
|
|
114
|
-
/**
|
|
115
|
-
* Relative price gauge level (1..{@link PRICE_TIER_SLOTS}) from
|
|
116
|
-
* `priceTierForModel` — the visual "price mostly" indicator the picker
|
|
117
|
-
* renders as a segmented bar instead of a raw number. 0 when unknown.
|
|
118
|
-
*/
|
|
119
|
-
priceTier?: number;
|
|
120
|
-
/** Localized-agnostic tier name for `priceTier` (e.g. `"High"`). */
|
|
121
|
-
priceTierName?: string;
|
|
122
|
-
}
|
|
123
|
-
interface AvailableConnector {
|
|
124
|
-
id: string;
|
|
125
|
-
name: string;
|
|
126
|
-
/** Whether the actor's guild/workspace has a connected credential for this provider. */
|
|
127
|
-
byokAvailable: boolean;
|
|
128
|
-
models: AvailableModel[];
|
|
129
|
-
}
|
|
130
|
-
/** Number of segments in the price gauge. */
|
|
131
|
-
declare const PRICE_TIER_SLOTS = 5;
|
|
132
|
-
/**
|
|
133
|
-
* Display names for levels 1..{@link PRICE_TIER_SLOTS}, ascending price. Kept
|
|
134
|
-
* as brand tokens (not localized) so the gauge reads the same everywhere.
|
|
135
|
-
*/
|
|
136
|
-
declare const PRICE_TIER_NAMES: readonly ["Low", "Medium", "High", "Max", "Ultra"];
|
|
137
|
-
/** Name for a gauge level (1-based); empty string when out of range. */
|
|
138
|
-
declare function priceTierName(level: number): string;
|
|
139
|
-
/**
|
|
140
|
-
* Unicode price gauge (e.g. `▰▰▱▱▱`) for text-only surfaces (WhatsApp, logs).
|
|
141
|
-
* Rich UIs read {@link AvailableModel.priceTier} and render styled segments.
|
|
142
|
-
*/
|
|
143
|
-
declare function priceTierBar(level: number, slots?: number): string;
|
|
144
|
-
interface AvailableModelsActor {
|
|
145
|
-
appId: string;
|
|
146
|
-
userId: string;
|
|
147
|
-
tier?: string;
|
|
148
|
-
guildId?: string;
|
|
149
|
-
}
|
|
150
|
-
interface AvailableModelsResponse {
|
|
151
|
-
success: true;
|
|
152
|
-
actor: AvailableModelsActor;
|
|
153
|
-
connectors: AvailableConnector[];
|
|
154
|
-
}
|
|
155
|
-
interface ListAvailableModelsParams {
|
|
156
|
-
/** Restrict to one or more kinds. Empty = all kinds. */
|
|
157
|
-
kind?: ModelKind | ModelKind[];
|
|
158
|
-
/** Guild scope — joins guild-level connectors for BYOK badges. */
|
|
159
|
-
guildId?: string;
|
|
160
|
-
/** Include rules-blocked models (decision.allowed=false). Default true. */
|
|
161
|
-
includeBlocked?: boolean;
|
|
162
|
-
/** Include catalog entries with agentVisible=false. Default false. */
|
|
163
|
-
includeHidden?: boolean;
|
|
164
|
-
/**
|
|
165
|
-
* Curation surface-profile id (`voice-s2s`, `images`, …) the app exposes.
|
|
166
|
-
* Resolved server-side via `getSurfaceProfile`. Omitted = full catalog.
|
|
167
|
-
*/
|
|
168
|
-
surface?: string;
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
export { type AvailableConnector as A, type ListAvailableModelsParams as L, type ModelEnrichment as M, PRICE_TIER_NAMES as P, type AvailableModel as a, type AvailableModelCapabilities as b, type AvailableModelsActor as c, type AvailableModelsResponse as d, modelHasTag as e, modelMatchesCatalogPriceTier as f, getEnrichment as g, modelMatchesKind as h, modelMatchesPriceTier as i, PRICE_TIER_SLOTS as j, priceTierBar as k, priceTierName as l, modelHasAction as m, priceTierForModel as p };
|