@agentproto/model-catalog 0.10.3 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/dist/access/index.d.ts +3 -3
  2. package/dist/access/index.mjs +4 -4
  3. package/dist/{catalog-BAb74hY-.d.ts → catalog-BMcj8odg.d.ts} +612 -22
  4. package/dist/{chunk-ZQ6VOPGQ.mjs → chunk-3CU3W43Q.mjs} +3 -3
  5. package/dist/{chunk-ZQ6VOPGQ.mjs.map → chunk-3CU3W43Q.mjs.map} +1 -1
  6. package/dist/{chunk-S2EJIT6D.mjs → chunk-3RHYOFVS.mjs} +177 -73
  7. package/dist/chunk-3RHYOFVS.mjs.map +1 -0
  8. package/dist/{chunk-Z6DB2FB7.mjs → chunk-ARK2DCFR.mjs} +3 -3
  9. package/dist/{chunk-Z6DB2FB7.mjs.map → chunk-ARK2DCFR.mjs.map} +1 -1
  10. package/dist/{chunk-7DKQFHCJ.mjs → chunk-GE56A2NL.mjs} +4 -4
  11. package/dist/{chunk-7DKQFHCJ.mjs.map → chunk-GE56A2NL.mjs.map} +1 -1
  12. package/dist/{chunk-DHMYBXQB.mjs → chunk-S26LSXTN.mjs} +3 -3
  13. package/dist/{chunk-DHMYBXQB.mjs.map → chunk-S26LSXTN.mjs.map} +1 -1
  14. package/dist/{chunk-PL4ALP73.mjs → chunk-U5O444SC.mjs} +5 -4
  15. package/dist/chunk-U5O444SC.mjs.map +1 -0
  16. package/dist/{chunk-KJYNTETN.mjs → chunk-UI3BUHUO.mjs} +4 -4
  17. package/dist/{chunk-KJYNTETN.mjs.map → chunk-UI3BUHUO.mjs.map} +1 -1
  18. package/dist/{chunk-5VXG5VZA.mjs → chunk-YBEL3JLY.mjs} +5 -5
  19. package/dist/{chunk-5VXG5VZA.mjs.map → chunk-YBEL3JLY.mjs.map} +1 -1
  20. package/dist/cost/index.mjs +6 -6
  21. package/dist/curation/index.d.ts +2 -2
  22. package/dist/curation/index.mjs +6 -6
  23. package/dist/{evaluate-B83jX17h.d.ts → evaluate-C77bYu0f.d.ts} +1 -1
  24. package/dist/{index-vC37SFpk.d.ts → index-CJ7uYbnm.d.ts} +1 -1
  25. package/dist/{index-BWvtVzEG.d.ts → index-VyKByfsk.d.ts} +2 -2
  26. package/dist/index.d.ts +5 -5
  27. package/dist/index.mjs +10 -10
  28. package/dist/llm/index.d.ts +1 -1
  29. package/dist/llm/index.mjs +2 -2
  30. package/dist/overlay/index.d.ts +1 -1
  31. package/dist/picker/index.d.ts +4 -4
  32. package/dist/route-identity/index.d.ts +1 -1
  33. package/dist/route-identity/index.mjs +2 -2
  34. package/package.json +1 -1
  35. package/dist/chunk-PL4ALP73.mjs.map +0 -1
  36. package/dist/chunk-S2EJIT6D.mjs.map +0 -1
@@ -1,4 +1,4 @@
1
- import { OPENCODE_GO_ROUTES, OPENCODE_ZEN_ROUTES, OPENCODE_GO_ANTHROPIC_MODELS, OPENCODE_ZEN_ANTHROPIC_MODELS } from './chunk-S2EJIT6D.mjs';
1
+ import { OPENCODE_GO_ROUTES, OPENCODE_ZEN_ROUTES, OPENCODE_GO_ANTHROPIC_MODELS, OPENCODE_ZEN_ANTHROPIC_MODELS } from './chunk-3RHYOFVS.mjs';
2
2
 
3
3
  /**
4
4
  * @agentproto/model-catalog v0.1.0
@@ -76,5 +76,5 @@ var LLM_TIERS = {
76
76
  };
77
77
 
78
78
  export { LLM_TIERS, OPERATOR_AGENT_MODELS, OPERATOR_DEFAULT_GEMINI, OPERATOR_DEFAULT_PREMIUM, OPERATOR_DEFAULT_STANDARD, WORKFLOW_FAST_MODEL, WORKFLOW_PREMIUM_MODEL, WORKFLOW_TINY_MODEL, formatTokens, listOpencodeAnthropicModelRefs, listOpencodeModelRefs };
79
- //# sourceMappingURL=chunk-Z6DB2FB7.mjs.map
80
- //# sourceMappingURL=chunk-Z6DB2FB7.mjs.map
79
+ //# sourceMappingURL=chunk-ARK2DCFR.mjs.map
80
+ //# sourceM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AACA,EAAA,OAAO,OAAO,CAAC,CAAA;AACjB;;;ACRO,IAAM,mBAAA,GAAsB;AAG5B,IAAM,sBAAA,GAAyB;AAG/B,IAAM,mBAAA,GAAsB;AAO5B,IAAM,qBAAA,GAAwB;AAAA,EACnC,iBAAA;AAAA,EACA,mBAAA;AAAA,EACA;AACF;AAKO,IAAM,wBAAA,GAA+C;AACrD,IAAM,yBAAA,GAAgD;AACtD,IAAM,uBAAA,GACX;AAcK,IAAM,SAAA,GAAY;AAAA;AAAA,EAEvB,IAAA,EAAM,CAAC,+BAA+B,CAAA;AAAA;AAAA,EAEtC,IAAA,EAAM;AAAA,IACJ,cAAA;AAAA,IACA,cAAA;AAAA,IACA,YAAA;AAAA,IACA;AAAA,GACF;AAAA;AAAA,EAEA,IAAA,EAAM;AAAA,IACJ,kBAAA;AAAA,IACA,sBAAA;AAAA,IACA;AAAA,GACF;AAAA;AAAA,EAEA,IAAA,EAAM;AAAA,IACJ,mBAAA;AAAA,IACA,QAAA;AAAA,IACA,WAAA;AAAA,IACA;AAAA,GACF;AAAA;AAAA,EAEA,GAAA,EAAK;AAAA,IACH,iBAAA;AAAA,IACA,+BAAA;AAAA,IACA;AAAA;AAEJ","file":"chunk-Z6DB2FB7.mjs","sourcesContent":["/**\n * OpenCode's two hosted endpoints — the small hand-written surface over their\n * generated route tables.\n *\n * Deliberately its OWN module rather than an addition to `catalog.ts`: that\n * file owns `LLM_PRICING_CATALOG`, and the one invariant these tables have is\n * that they are NEVER spread into it (a bare `claude-sonnet-5` must keep\n * meaning direct Anthropic, not a Zen-priced route — see the OpenCode branch\n * in `route-identity/index.ts`). Keeping the import out of `catalog.ts`\n * keeps that temptation out of reach.\n */\n\nimport {\n OPENCODE_GO_ANTHROPIC_MODELS,\n OPENCODE_GO_ROUTES,\n} from \"./opencode-go-routes.generated.js\"\nimport {\n OPENCODE_ZEN_ANTHROPIC_MODELS,\n OPENCODE_ZEN_ROUTES,\n} from \"./opencode-zen-routes.generated.js\"\n\n/**\n * The two OpenCode hosted endpoints, by catalog provider id.\n * - `\"opencode\"` — OpenCode Zen, pay-as-you-go (`.../zen/v1`).\n * - `\"opencode-go\"` — OpenCode Go, the flat subscription (`.../zen/go/v1`).\n */\nexport type OpencodeEndpoint = \"opencode\" | \"opencode-go\"\n\n/**\n * Every model ref an OpenCode endpoint serves, in the `<provider>/<bare-id>`\n * form the route tables are keyed by — which is also opencode's own config\n * spelling and what a caller passes to `agent_start`.\n */\nexport function listOpencodeModelRefs(endpoint: OpencodeEndpoint): string[] {\n const routes = endpoint === \"opencode-go\" ? OPENCODE_GO_ROUTES : OPENCODE_ZEN_ROUTES\n return Object.keys(routes).sort()\n}\n\n/**\n * The subset of {@link listOpencodeModelRefs} whose wire surface is the\n * Anthropic Messages API — exactly what the matching `opencode` /\n * `opencode-go` gateway preset can serve, and therefore exactly what an\n * Anthropic-native adapter (claude-code / claude-sdk) may offer on that\n * route. Both endpoints also serve OpenAI chat/completions, OpenAI Responses\n * and (Zen only) Gemini models behind the same base URL; those are\n * unreachable from an Anthropic client and are excluded here.\n *\n * Derived from the generated `*_ANTHROPIC_MODELS` lists, which come from the\n * source's own per-model `provider.npm` discriminator — so an adapter menu\n * built on this can never drift into offering an id the endpoint won't answer\n * on `/v1/messages`, and a newly-added Anthropic-surface model becomes\n * offerable on the next catalog-sync run with no code change (the same\n * rationale as `listNativeModelIds`).\n */\nexport function listOpencodeAnthropicModelRefs(endpoint: OpencodeEndpoint): string[] {\n const bareIds =\n endpoint === \"opencode-go\" ? OPENCODE_GO_ANTHROPIC_MODELS : OPENCODE_ZEN_ANTHROPIC_MODELS\n return bareIds.map(id => `${endpoint}/${id}`).sort()\n}\n","/**\n * Shared human-readable token formatting, so the `agentproto models` CLI and\n * the `catalog_models` MCP tool render the same `1M`/`200k` shapes instead of\n * raw integers. Lives next to `resolveContextWindow` (its data source) — one\n * formatter per concept, both output surfaces consume it.\n */\n\n/** Format a token count compactly — `1M`, `500k`, `2k`, `448`. Undefined ⇒\n * null so JSON output omits rather than fabricates a value. */\nexport function formatTokens(n: number | undefined): string | null {\n if (typeof n !== \"number\" || n <= 0) return null\n if (n >= 1_000_000) {\n const m = n / 1_000_000\n const text = Number.isInteger(m) ? String(m) : m.toFixed(1)\n return `${text}M`\n }\n if (n >= 1_000) {\n const k = n / 1_000\n const text = Number.isInteger(k) ? String(k) : k.toFixed(1)\n return `${text}k`\n }\n return String(n)\n}\n","/**\n * Curated, SDK-ready LLM model ids.\n *\n * Centralizes the version-specific provider ids used at runtime so call\n * sites stop carrying string literals. Pricing for each is resolved\n * automatically through `MODEL_ALIASES` in `catalog.ts` (e.g.\n * `claude-sonnet-4-6` → `claude-sonnet-4-5`).\n *\n * Update one constant here when bumping the platform-wide default —\n * every workflow step and operator config picks up the new id with a\n * single rebuild.\n */\n\n/** Fast workhorse for content workflows (outline, post, sections). */\nexport const WORKFLOW_FAST_MODEL = \"claude-sonnet-4-6\" as const\n\n/** Premium tier for high-stakes generation (rarely used in workflows). */\nexport const WORKFLOW_PREMIUM_MODEL = \"claude-opus-4-6\" as const\n\n/** Cheap-and-quick for short outputs like titles. */\nexport const WORKFLOW_TINY_MODEL = \"claude-haiku-4-5-20251001\" as const\n\n/**\n * Models eligible for operator agents (an app). Keep in sync with the\n * agent-framework's model-provider config. The literal tuple drives the\n * `OperatorAgentModel` union type below.\n */\nexport const OPERATOR_AGENT_MODELS = [\n \"claude-opus-4-5\",\n \"claude-sonnet-4-5\",\n \"gemini-3.1-pro-preview\",\n] as const\n\nexport type OperatorAgentModel = (typeof OPERATOR_AGENT_MODELS)[number]\n\n/** Default operator model when no explicit choice is made. */\nexport const OPERATOR_DEFAULT_PREMIUM: OperatorAgentModel = \"claude-opus-4-5\"\nexport const OPERATOR_DEFAULT_STANDARD: OperatorAgentModel = \"claude-sonnet-4-5\"\nexport const OPERATOR_DEFAULT_GEMINI: OperatorAgentModel =\n \"gemini-3.1-pro-preview\"\n\n// ── Plan-tier → model lists ─────────────────────────────────────────────\n//\n// Catalog-canonical equivalent of agent-framework's `MODEL_TIERS`. Used\n// by per-app `AppPlanRegistry` files as the source list when a plan\n// surfaces \"all of the X tier\". Keeping this in the catalog keeps the\n// app registries declarative — they pick from `LLM_TIERS.plus` rather\n// than re-specifying ids.\n//\n// All ids resolve through `resolvePricing` (direct match → alias →\n// partial-prefix). Names are app-vocabulary-neutral; per-app registries\n// re-key as needed (`PaygoTier.nano` → `LLM_TIERS.nano`, etc.).\n\nexport const LLM_TIERS = {\n /** Cheap-and-quick. Single-model fallback. */\n nano: [\"mistral-small-creative-latest\"] as const,\n /** Low-cost, agentic-capable. Direct alt-providers. */\n mini: [\n \"MiniMax-M2.5\",\n \"MiniMax-M2.1\",\n \"MiniMax-M2\",\n \"mistral-large-latest\",\n ] as const,\n /** Medium cost, fast inference + good general perf. OpenRouter-routed. */\n lite: [\n \"x-ai/grok-4-fast\",\n \"xiaomi/mimo-v2-flash\",\n \"google/gemini-3-flash-preview\",\n ] as const,\n /** High quality, premium features. Mix of direct + OpenRouter. */\n plus: [\n \"claude-sonnet-4-5\",\n \"gpt-4o\",\n \"kimi-k2.5\",\n \"deepseek/deepseek-v3.2\",\n ] as const,\n /** Top-tier, best performance. */\n pro: [\n \"claude-opus-4-5\",\n \"google/gemini-3.1-pro-preview\",\n \"kimi-k2-thinking\",\n ] as const,\n} as const\n\nexport type LlmTierName = keyof typeof LLM_TIERS\n"]}
1
+ {"version":3,"sources":["../src/llm/opencode.ts","../src/llm/tokens.ts","../src/llm/defaults.ts"],"names":[],"mappings":";;;;;;;;;AAiCO,SAAS,sBAAsB,QAAA,EAAsC;AAC1E,EAAA,MAAM,MAAA,GAAS,QAAA,KAAa,aAAA,GAAgB,kBAAA,GAAqB,mBAAA;AACjE,EAAA,OAAO,MAAA,CAAO,IAAA,CAAK,MAAM,CAAA,CAAE,IAAA,EAAK;AAClC;AAkBO,SAAS,+BAA+B,QAAA,EAAsC;AACnF,EAAA,MAAM,OAAA,GACJ,QAAA,KAAa,aAAA,GAA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AAA,IACA,cAAA;AAAA,IACA,YAAA;AAAA,IACA;AAAA,GACF;AAAA;AAAA,EAEA,IAAA,EAAM;AAAA,IACJ,kBAAA;AAAA,IACA,sBAAA;AAAA,IACA;AAAA,GACF;AAAA;AAAA,EAEA,IAAA,EAAM;AAAA,IACJ,mBAAA;AAAA,IACA,QAAA;AAAA,IACA,WAAA;AAAA,IACA;AAAA,GACF;AAAA;AAAA,EAEA,GAAA,EAAK;AAAA,IACH,iBAAA;AAAA,IACA,+BAAA;AAAA,IACA;AAAA;AAEJ","file":"chunk-ARK2DCFR.mjs","sourcesContent":["/**\n * OpenCode's two hosted endpoints — the small hand-written surface over their\n * generated route tables.\n *\n * Deliberately its OWN module rather than an addition to `catalog.ts`: that\n * file owns `LLM_PRICING_CATALOG`, and the one invariant these tables have is\n * that they are NEVER spread into it (a bare `claude-sonnet-5` must keep\n * meaning direct Anthropic, not a Zen-priced route — see the OpenCode branch\n * in `route-identity/index.ts`). Keeping the import out of `catalog.ts`\n * keeps that temptation out of reach.\n */\n\nimport {\n OPENCODE_GO_ANTHROPIC_MODELS,\n OPENCODE_GO_ROUTES,\n} from \"./opencode-go-routes.generated.js\"\nimport {\n OPENCODE_ZEN_ANTHROPIC_MODELS,\n OPENCODE_ZEN_ROUTES,\n} from \"./opencode-zen-routes.generated.js\"\n\n/**\n * The two OpenCode hosted endpoints, by catalog provider id.\n * - `\"opencode\"` — OpenCode Zen, pay-as-you-go (`.../zen/v1`).\n * - `\"opencode-go\"` — OpenCode Go, the flat subscription (`.../zen/go/v1`).\n */\nexport type OpencodeEndpoint = \"opencode\" | \"opencode-go\"\n\n/**\n * Every model ref an OpenCode endpoint serves, in the `<provider>/<bare-id>`\n * form the route tables are keyed by — which is also opencode's own config\n * spelling and what a caller passes to `agent_start`.\n */\nexport function listOpencodeModelRefs(endpoint: OpencodeEndpoint): string[] {\n const routes = endpoint === \"opencode-go\" ? OPENCODE_GO_ROUTES : OPENCODE_ZEN_ROUTES\n return Object.keys(routes).sort()\n}\n\n/**\n * The subset of {@link listOpencodeModelRefs} whose wire surface is the\n * Anthropic Messages API — exactly what the matching `opencode` /\n * `opencode-go` gateway preset can serve, and therefore exactly what an\n * Anthropic-native adapter (claude-code / claude-sdk) may offer on that\n * route. Both endpoints also serve OpenAI chat/completions, OpenAI Responses\n * and (Zen only) Gemini models behind the same base URL; those are\n * unreachable from an Anthropic client and are excluded here.\n *\n * Derived from the generated `*_ANTHROPIC_MODELS` lists, which come from the\n * source's own per-model `provider.npm` discriminator — so an adapter menu\n * built on this can never drift into offering an id the endpoint won't answer\n * on `/v1/messages`, and a newly-added Anthropic-surface model becomes\n * offerable on the next catalog-sync run with no code change (the same\n * rationale as `listNativeModelIds`).\n */\nexport function listOpencodeAnthropicModelRefs(endpoint: OpencodeEndpoint): string[] {\n const bareIds =\n endpoint === \"opencode-go\" ? OPENCODE_GO_ANTHROPIC_MODELS : OPENCODE_ZEN_ANTHROPIC_MODELS\n return bareIds.map(id => `${endpoint}/${id}`).sort()\n}\n","/**\n * Shared human-readable token formatting, so the `agentproto models` CLI and\n * the `catalog_models` MCP tool render the same `1M`/`200k` shapes instead of\n * raw integers. Lives next to `resolveContextWindow` (its data source) — one\n * formatter per concept, both output surfaces consume it.\n */\n\n/** Format a token count compactly — `1M`, `500k`, `2k`, `448`. Undefined ⇒\n * null so JSON output omits rather than fabricates a value. */\nexport function formatTokens(n: number | undefined): string | null {\n if (typeof n !== \"number\" || n <= 0) return null\n if (n >= 1_000_000) {\n const m = n / 1_000_000\n const text = Number.isInteger(m) ? String(m) : m.toFixed(1)\n return `${text}M`\n }\n if (n >= 1_000) {\n const k = n / 1_000\n const text = Number.isInteger(k) ? String(k) : k.toFixed(1)\n return `${text}k`\n }\n return String(n)\n}\n","/**\n * Curated, SDK-ready LLM model ids.\n *\n * Centralizes the version-specific provider ids used at runtime so call\n * sites stop carrying string literals. Pricing for each is resolved\n * automatically through `MODEL_ALIASES` in `catalog.ts` (e.g.\n * `claude-sonnet-4-6` → `claude-sonnet-4-5`).\n *\n * Update one constant here when bumping the platform-wide default —\n * every workflow step and operator config picks up the new id with a\n * single rebuild.\n */\n\n/** Fast workhorse for content workflows (outline, post, sections). */\nexport const WORKFLOW_FAST_MODEL = \"claude-sonnet-4-6\" as const\n\n/** Premium tier for high-stakes generation (rarely used in workflows). */\nexport const WORKFLOW_PREMIUM_MODEL = \"claude-opus-4-6\" as const\n\n/** Cheap-and-quick for short outputs like titles. */\nexport const WORKFLOW_TINY_MODEL = \"claude-haiku-4-5-20251001\" as const\n\n/**\n * Models eligible for operator agents (an app). Keep in sync with the\n * agent-framework's model-provider config. The literal tuple drives the\n * `OperatorAgentModel` union type below.\n */\nexport const OPERATOR_AGENT_MODELS = [\n \"claude-opus-4-5\",\n \"claude-sonnet-4-5\",\n \"gemini-3.1-pro-preview\",\n] as const\n\nexport type OperatorAgentModel = (typeof OPERATOR_AGENT_MODELS)[number]\n\n/** Default operator model when no explicit choice is made. */\nexport const OPERATOR_DEFAULT_PREMIUM: OperatorAgentModel = \"claude-opus-4-5\"\nexport const OPERATOR_DEFAULT_STANDARD: OperatorAgentModel = \"claude-sonnet-4-5\"\nexport const OPERATOR_DEFAULT_GEMINI: OperatorAgentModel =\n \"gemini-3.1-pro-preview\"\n\n// ── Plan-tier → model lists ─────────────────────────────────────────────\n//\n// Catalog-canonical equivalent of agent-framework's `MODEL_TIERS`. Used\n// by per-app `AppPlanRegistry` files as the source list when a plan\n// surfaces \"all of the X tier\". Keeping this in the catalog keeps the\n// app registries declarative — they pick from `LLM_TIERS.plus` rather\n// than re-specifying ids.\n//\n// All ids resolve through `resolvePricing` (direct match → alias →\n// partial-prefix). Names are app-vocabulary-neutral; per-app registries\n// re-key as needed (`PaygoTier.nano` → `LLM_TIERS.nano`, etc.).\n\nexport const LLM_TIERS = {\n /** Cheap-and-quick. Single-model fallback. */\n nano: [\"mistral-small-creative-latest\"] as const,\n /** Low-cost, agentic-capable. Direct alt-providers. */\n mini: [\n \"MiniMax-M2.5\",\n \"MiniMax-M2.1\",\n \"MiniMax-M2\",\n \"mistral-large-latest\",\n ] as const,\n /** Medium cost, fast inference + good general perf. OpenRouter-routed. */\n lite: [\n \"x-ai/grok-4-fast\",\n \"xiaomi/mimo-v2-flash\",\n \"google/gemini-3-flash-preview\",\n ] as const,\n /** High quality, premium features. Mix of direct + OpenRouter. */\n plus: [\n \"claude-sonnet-4-5\",\n \"gpt-4o\",\n \"kimi-k2.5\",\n \"deepseek/deepseek-v3.2\",\n ] as const,\n /** Top-tier, best performance. */\n pro: [\n \"claude-opus-4-5\",\n \"google/gemini-3.1-pro-preview\",\n \"kimi-k2-thinking\",\n ] as const,\n} as const\n\nexport type LlmTierName = keyof typeof LLM_TIERS\n"]}
@@ -1,5 +1,5 @@
1
- import { listModels } from './chunk-5VXG5VZA.mjs';
2
- import { modelHasTag } from './chunk-ZQ6VOPGQ.mjs';
1
+ import { listModels } from './chunk-YBEL3JLY.mjs';
2
+ import { modelHasTag } from './chunk-3CU3W43Q.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-7DKQFHCJ.mjs.map
134
- //# sourceMappingURL=chunk-7DKQFHCJ.mjs.map
133
+ //# sourceMappingURL=chunk-GE56A2NL.mjs.map
134
+ //# sourceMappingURL=chunk-GE56A2NL.mjs.map
@@ -1 +1 @@
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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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-7DKQFHCJ.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,IAAI,YAAA,EAAc,KAAA,EAAO,cAAc,SAAA,EAAW,CAAC,YAAY,CAAA;AACnE,CAAA;AAEO,SAAS,kBAAA,GAA+C;AAC7D,EAAA,OAAO,eAAA;AACT;AAEO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AA,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-GE56A2NL.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,4 +1,4 @@
1
- import { modelMatchesPriceTier, modelHasTag } from './chunk-ZQ6VOPGQ.mjs';
1
+ import { modelMatchesPriceTier, modelHasTag } from './chunk-3CU3W43Q.mjs';
2
2
 
3
3
  /**
4
4
  * @agentproto/model-catalog v0.1.0
@@ -112,5 +112,5 @@ function evaluateAccess(input) {
112
112
  }
113
113
 
114
114
  export { evaluateAccess, evaluateCatalogDefaults };
115
- //# sourceMappingURL=chunk-DHMYBXQB.mjs.map
116
- //# sourceMappingURL=chunk-DHMYBXQB.mjs.map
115
+ //# sourceMappingURL=chunk-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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-DHMYBXQB.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
+ {"version":3,"sources":["../src/access/catalog-defaults.ts","../src/access/evaluate.ts"],"names":[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AAA,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-S26LSXTN.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,5 +1,5 @@
1
1
  import { CatalogProviderSchema } from './chunk-WG4F6IRS.mjs';
2
- import { resolvePricing, resolveAlias, OPENCODE_GO_ROUTES, OPENCODE_ZEN_ROUTES, OPENROUTER_ROUTES, DEFAULT_PRICING } from './chunk-S2EJIT6D.mjs';
2
+ import { resolvePricing, resolveAlias, OPENCODE_GO_ROUTES, OPENCODE_ZEN_ROUTES, OPENROUTER_ROUTES, DEFAULT_PRICING } from './chunk-3RHYOFVS.mjs';
3
3
 
4
4
  /**
5
5
  * @agentproto/model-catalog v0.1.0
@@ -8518,6 +8518,7 @@ var HUGGINGFACE_ROUTES = {
8518
8518
 
8519
8519
  // src/route-identity/index.ts
8520
8520
  var SEGMENT_RE = /^[a-zA-Z0-9_.-]+$/;
8521
+ var PRODUCT_RE = /^[a-zA-Z0-9_.-]+(?:\[\d+(?:\.\d+)?[kKmM]\])?$/;
8521
8522
  var OPENROUTER_VARIANTS = [
8522
8523
  "free",
8523
8524
  "nitro",
@@ -8602,7 +8603,7 @@ function parseModelRef(raw) {
8602
8603
  if (value.length === 0) {
8603
8604
  throw new InvalidModelRefError(raw, `${label} segment is empty`);
8604
8605
  }
8605
- if (!SEGMENT_RE.test(value)) {
8606
+ if (!(label === "product" ? PRODUCT_RE : SEGMENT_RE).test(value)) {
8606
8607
  throw new InvalidModelRefError(
8607
8608
  raw,
8608
8609
  `${label} "${value}" contains invalid characters (no '/' or '@')`
@@ -8855,5 +8856,5 @@ function diagnoseModelRef(input) {
8855
8856
  }
8856
8857
 
8857
8858
  export { InvalidModelRefError, OPENROUTER_VARIANTS, clearCustomRoutes, diagnoseModelRef, formatModelRef, isModelRefString, listRouterLlmRoutes, parseModelRef, registerCustomRoute, resolveCustomRoute, resolveLlmModelRoute, stripAnthropicNativeVendor, stripFixedNativeVendor, stripRouteSuffix, tryParseModelRef };
8858
- //# sourceMappingURL=chunk-PL4ALP73.mjs.map
8859
- //# sourceMappingURL=chunk-PL4ALP73.mjs.map
8859
+ //# sourceMappingURL=chunk-U5O444SC.mjs.map
8860
+ //# sourceMappingURL=chunk-U5O444SC.mjs.map