@agentproto/catalog-sync 0.5.7 → 0.5.10

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/bin.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/types.ts","../src/generators/llm-openrouter.ts","../src/generators/llm-requesty.ts","../src/generators/llm-huggingface.ts","../src/generators/llm-context-windows.ts","../src/generators/serialize-voices.ts","../src/generators/voice-elevenlabs.ts","../src/generators/voice-minimax.ts","../src/generators/image-replicate.ts","../src/runner.ts","../src/bin.ts"],"names":["OUTPUT_PATH","ModelSchema","z","SnapshotSchema","round6","per1m","fmt","vendorOf","serializeEntry","serializeFile","generate","sources","__dirname","files","changed"],"mappings":";;;;;;;;;;;;;;;AAsDO,SAAS,gBAAgB,CAAA,EAAuC;AACrE,EAAA,OAAO,CAAA;AACT;;;AC9CA,IAAM,qBAAA,GAAwB,qCAAA;AAG9B,IAAM,WAAA,GAAc,+DAAA;AAYpB,IAAM,aAAA,GAAgB,EACnB,MAAA,CAAO;AAAA,EACN,MAAA,EAAQ,CAAA,CAAE,MAAA,EAAO,CAAE,QAAA,EAAS;AAAA,EAC5B,UAAA,EAAY,CAAA,CAAE,MAAA,EAAO,CAAE,QAAA,EAAS;AAAA,EAChC,gBAAA,EAAkB,CAAA,CAAE,MAAA,EAAO,CAAE,QAAA,EAAS;AAAA,EACtC,iBAAA,EAAmB,CAAA,CAAE,MAAA,EAAO,CAAE,QAAA;AAChC,CAAC,EACA,WAAA,EAAY;AAEf,IAAM,WAAA,GAAc,EACjB,MAAA,CAAO;AAAA,EACN,EAAA,EAAI,EAAE,MAAA,EAAO;AAAA,EACb,OAAA,EAAS,cAAc,QAAA;AACzB,CAAC,EACA,WAAA,EAAY;AAEf,IAAM,cAAA,GAAiB,EAAE,MAAA,CAAO;AAAA,EAC9B,IAAA,EAAM,CAAA,CAAE,KAAA,CAAM,WAAW;AAC3B,CAAC,CAAA;AAuBD,SAAS,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AK,CAAC,CAAA;AAAA,EAChB;AACA,EAAA,OAAA,CAAQ,MAAA,CAAO,KAAA;AAAA,IACb,CAAA,wBAAA,EAA2B,WAAW,MAAM,CAAA,eAAA,EAAkB,OAAO,IAAA,CAAK,KAAK,EAAE,MAAM,CAAA;AAAA;AAAA,GACzF;AACA,EAAA,OAAA,CAAQ,KAAK,CAAC,CAAA;AAChB;AAEA,IAAI,OAAA,CAAQ,SAAS,CAAA,EAAG;AACtB,EAAA,OAAA,CAAQ,MAAA,CAAO,KAAA,CAAM,CAAA,oBAAA,EAAuB,OAAA,CAAQ,MAAM,CAAA;AAAA,CAAa,CAAA;AACvE,EAAA,KAAA,MAAW,KAAK,OAAA,EAAS,OAAA,CAAQ,MAAA,CAAO,KAAA,CAAM,KAAK,CAAC;AAAA,CAAI,CAAA;AAC1D,CAAA,MAAO;AACL,EAAA,OAAA,CAAQ,OAAO,KAAA,CAAM,CAAA;AAAA,CAA6B,CAAA;AACpD;AACA,OAAA,CAAQ,KAAK,CAAC,CAAA","file":"bin.mjs","sourcesContent":["/**\n * catalog-sync generator contract.\n *\n * FROZEN — a sibling agent builds provider generators against this surface.\n * Do not change field names, shapes, or the `defineGenerator` signature\n * without coordinating. Adding new generators is the expected extension\n * path; editing this file is not.\n */\n\nexport interface CatalogSource {\n id: string\n url: string\n /** HTTP method for the live (`--refresh`) fetch. Default `\"GET\"`. */\n method?: \"GET\" | \"POST\"\n /**\n * Request headers for the live fetch. A value may embed `env:VAR_NAME`\n * tokens, resolved from `process.env` at fetch time (e.g.\n * `{ \"xi-api-key\": \"env:ELEVENLABS_API_KEY\" }` or\n * `{ Authorization: \"Bearer env:MINIMAX_API_KEY\" }`). If any referenced env\n * var is unset, the source is treated as un-refreshable — the committed\n * snapshot is reused rather than fetched without auth. Offline reads\n * (default, no `--refresh`) ignore headers entirely.\n */\n headers?: Record<string, string>\n /** JSON request body for POST sources (e.g. MiniMax `get_voice`). */\n body?: unknown\n}\n\nexport interface GeneratorContext {\n /**\n * Reads the pinned snapshot at `snapshots/<src.id>.json`; if missing and\n * `refresh=true`, fetches `src.url` and writes the snapshot. Returns\n * parsed JSON.\n *\n * Offline by default: when no snapshot exists and `refresh` is false this\n * throws — generators MUST be runnable without network access so CI and\n * tests are deterministic. The only network path is behind `--refresh`.\n */\n fetchSource(src: CatalogSource): Promise<unknown>\n refresh: boolean\n}\n\n/** Repo-relative path → TS source text. */\nexport type GeneratedFiles = Record<string, string>\n\nexport interface CatalogGenerator {\n /** e.g. \"llm:openrouter\" */\n name: string\n modality: \"llm\" | \"image\" | \"video\" | \"audio\" | \"voice\"\n sources: CatalogSource[]\n generate(ctx: GeneratorContext): Promise<GeneratedFiles>\n}\n\n/** Identity helper — lets a generator module declare itself with type inference. */\nexport function defineGenerator(g: CatalogGenerator): CatalogGenerator {\n return g\n}\n","import { z } from \"zod\"\n\nimport { defineGenerator, type GeneratedFiles, type GeneratorContext } from \"../types.js\"\n\n/**\n * PINNED source. The OpenRouter `/api/v1/models` payload lists every route\n * the router exposes with per-token USD pricing. We never fetch it at build\n * or test time — only behind `--refresh`, which writes\n * `snapshots/llm-openrouter.json` so the next offline run is deterministic.\n */\nconst OPENROUTER_MODELS_URL = \"https://openrouter.ai/api/v1/models\"\n\n/** Repo-relative drop-in target for {@link @agentproto/model-catalog}. */\nconst OUTPUT_PATH = \"packages/model-catalog/src/llm/openrouter-routes.generated.ts\"\n\n// ── Source schema ────────────────────────────────────────────────────────\n// OpenRouter prices are STRINGS of USD-per-token (e.g. \"0.000003\" = $3/1M).\n// `input_cache_read` / `input_cache_write` are optional and only present for\n// models that support prompt caching (Anthropic, etc.). These are the REAL\n// OpenRouter field names (verified against the live /v1/models payload) — an\n// earlier draft used `cache_read`/`cache_write`, which never matched, so cache\n// multipliers were silently always absent. passthrough() keeps the other live\n// keys (web_search, image, audio, internal_reasoning, input_cache_write_1h)\n// forward-compatible without a regenerate — we only read what we model.\n\nconst PricingSchema = z\n .object({\n prompt: z.string().optional(),\n completion: z.string().optional(),\n input_cache_read: z.string().optional(),\n input_cache_write: z.string().optional(),\n })\n .passthrough()\n\nconst ModelSchema = z\n .object({\n id: z.string(),\n pricing: PricingSchema.optional(),\n })\n .passthrough()\n\nconst SnapshotSchema = z.object({\n data: z.array(ModelSchema),\n})\n\n// ── Output shape (mirrors model-catalog's LLMPricing) ────────────────────\n// Drop-in for `packages/model-catalog/src/llm/openrouter-routes.generated.ts`.\n// Structurally identical to LLMPricing — inputPer1M / outputPer1M in USD per\n// 1M tokens, plus cacheReadMultiplier / cacheWriteMultiplier WHEN the source\n// carries cache_read / cache_write. The existing committed file omits cache\n// fields; this generator emits them when present (per the P3 spec: \"plus\n// cache fields if the source has them\"). Fields are optional on LLMPricing,\n// so the output remains drop-in compatible.\n\ninterface LLMPricingEntry {\n inputPer1M: number\n outputPer1M: number\n cacheReadMultiplier?: number\n cacheWriteMultiplier?: number\n vendor: string\n provider: \"openrouter\"\n}\n\n// ── Number helpers ──────────────────────────────────────────────────────\n\n/** Round to 6 decimal places, killing binary-float noise from the per-token × 1e6 product. */\nfunction round6(n: number): number {\n return Math.round(n * 1_000_000) / 1_000_000\n}\n\n/** Convert a per-token USD string to USD-per-1M-tokens, or undefined if unpriced. */\nfunction per1m(tokenPrice: string | undefined): number | undefined {\n if (tokenPrice === undefined) return undefined\n const n = Number(tokenPrice)\n if (!Number.isFinite(n)) return undefined\n return round6(n * 1_000_000)\n}\n\n/** Shortest faithful decimal string (matches existing file: 1, 0.5, 0.7448, 1.25). */\nfunction fmt(n: number): string {\n if (!Number.isFinite(n)) return \"0\"\n return `${round6(n)}`\n}\n\n/** Vendor slug = first segment of the OpenRouter route id (`vendor/model`). */\nfunction vendorOf(id: string): string {\n if (!id.includes(\"/\")) return id\n return id.split(\"/\")[0] ?? id\n}\n\n// ── Serialization ────────────────────────────────────────────────────────\n\nfunction serializeEntry(e: LLMPricingEntry): string {\n const fields: string[] = [\n `inputPer1M: ${fmt(e.inputPer1M)}`,\n `outputPer1M: ${fmt(e.outputPer1M)}`,\n ]\n if (e.cacheReadMultiplier !== undefined) {\n fields.push(`cacheReadMultiplier: ${fmt(e.cacheReadMultiplier)}`)\n }\n if (e.cacheWriteMultiplier !== undefined) {\n fields.push(`cacheWriteMultiplier: ${fmt(e.cacheWriteMultiplier)}`)\n }\n fields.push(`vendor: ${JSON.stringify(e.vendor)}`)\n fields.push(`provider: ${JSON.stringify(e.provider)}`)\n return `{\\n ${fields.join(\",\\n \")},\\n }`\n}\n\nfunction serializeFile(entries: Record<string, LLMPricingEntry>): string {\n const ids = Object.keys(entries).sort()\n const providers = Array.from(new Set(ids.map(vendorOf))).sort()\n\n const lines: string[] = [\n \"// AUTO-GENERATED by @agentproto/catalog-sync (llm:openrouter).\",\n \"// Do not edit by hand — re-run `pnpm --filter @agentproto/catalog-sync generate`.\",\n `// Source: ${OPENROUTER_MODELS_URL}`,\n \"// Pricing carries provider USD (inputPer1M / outputPer1M) plus cache\",\n \"// multipliers (cacheReadMultiplier / cacheWriteMultiplier) derived from the\",\n \"// source's input_cache_read / input_cache_write per-token fields when present.\",\n \"\",\n 'import type { LLMPricing } from \"./catalog.js\"',\n \"\",\n \"export const OPENROUTER_ROUTES: Record<string, LLMPricing> = {\",\n ]\n for (const id of ids) {\n lines.push(` ${JSON.stringify(id)}: ${serializeEntry(entries[id]!)},`)\n }\n lines.push(\"}\")\n lines.push(\"\")\n lines.push(\"/** Provider slugs treated as OpenRouter routes by the picker. */\")\n lines.push(\"export const OPENROUTER_PROVIDERS: readonly string[] = [\")\n for (const p of providers) {\n lines.push(` ${JSON.stringify(p)},`)\n }\n lines.push(\"]\")\n lines.push(\"\")\n return lines.join(\"\\n\")\n}\n\n// ── Generator ───────────────────────────────────────────────────────────\n\nasync function generate(ctx: GeneratorContext): Promise<GeneratedFiles> {\n const src = sources[0]\n if (!src) throw new Error(\"llm:openrouter: no source configured\")\n const parsed = SnapshotSchema.parse(await ctx.fetchSource(src))\n\n const entries: Record<string, LLMPricingEntry> = {}\n for (const model of parsed.data) {\n const pricing = model.pricing\n if (!pricing) continue\n const inputPer1M = per1m(pricing.prompt)\n const outputPer1M = per1m(pricing.completion)\n if (inputPer1M === undefined || outputPer1M === undefined) continue\n // Skip unpriced routes (e.g. openrouter/auto, which carries \"0\" pricing).\n if (inputPer1M === 0 && outputPer1M === 0) continue\n\n const entry: LLMPricingEntry = {\n inputPer1M,\n outputPer1M,\n vendor: vendorOf(model.id),\n provider: \"openrouter\",\n }\n\n const cacheReadPer1M = per1m(pricing.input_cache_read)\n const cacheWritePer1M = per1m(pricing.input_cache_write)\n if (cacheReadPer1M !== undefined && cacheReadPer1M > 0 && inputPer1M > 0) {\n entry.cacheReadMultiplier = round6(cacheReadPer1M / inputPer1M)\n }\n if (cacheWritePer1M !== undefined && cacheWritePer1M > 0 && inputPer1M > 0) {\n entry.cacheWriteMultiplier = round6(cacheWritePer1M / inputPer1M)\n }\n\n entries[model.id] = entry\n }\n\n return { [OUTPUT_PATH]: serializeFile(entries) }\n}\n\nconst sources = [{ id: \"llm-openrouter\", url: OPENROUTER_MODELS_URL }]\n\nexport const llmOpenRouterGenerator = defineGenerator({\n name: \"llm:openrouter\",\n modality: \"llm\",\n sources,\n generate,\n})\n","import { z } from \"zod\"\n\nimport { defineGenerator, type GeneratedFiles, type GeneratorContext } from \"../types.js\"\n\n/**\n * PINNED source. The Requesty `/v1/models` payload lists every route the\n * router exposes with per-token USD pricing. We never fetch it at build or\n * test time — only behind `--refresh`, which writes\n * `snapshots/llm-requesty.json` so the next offline run is deterministic.\n * Live fetch requires `Authorization: Bearer $REQUESTY_API_KEY` (see\n * `sources` below) — without the key set, the framework reuses the\n * committed snapshot rather than fetching unauthenticated.\n */\nconst REQUESTY_MODELS_URL = \"https://router.requesty.ai/v1/models\"\n\n/** Repo-relative drop-in target for {@link @agentproto/model-catalog}. */\nconst OUTPUT_PATH = \"packages/model-catalog/src/llm/requesty-routes.generated.ts\"\n\n// ── Source schema ────────────────────────────────────────────────────────\n// UNLIKE OpenRouter, Requesty prices are JSON **numbers** in USD-PER-TOKEN\n// (e.g. `4e-7` = $0.40/1M), not strings, and live flat on the model entry\n// rather than nested under a `pricing` object. `cached_price` is a cache\n// READ price (no cache-write price exists in this source — we never emit\n// `cacheWriteMultiplier`). `supports_caching` gates whether `cached_price`\n// is actually meaningful: some entries carry a non-zero `cached_price` with\n// `supports_caching: false` (cache pricing published but not offered), so\n// the multiplier must only be derived when the flag is true. passthrough()\n// keeps the other live keys (context_window, supports_vision, description,\n// …) forward-compatible without a regenerate — we only read what we model.\n\nconst ModelSchema = z\n .object({\n id: z.string(),\n input_price: z.number().optional(),\n output_price: z.number().optional(),\n cached_price: z.number().optional(),\n supports_caching: z.boolean().optional(),\n })\n .passthrough()\n\nconst SnapshotSchema = z.object({\n data: z.array(ModelSchema),\n})\n\n// ── Output shape (mirrors model-catalog's LLMPricing) ────────────────────\n// Drop-in for `packages/model-catalog/src/llm/requesty-routes.generated.ts`.\n// Structurally identical to LLMPricing — inputPer1M / outputPer1M in USD per\n// 1M tokens, plus cacheReadMultiplier when the source carries a meaningful\n// `cached_price`. No `cacheWriteMultiplier` — Requesty has no cache-write\n// price to derive one from.\n\ninterface LLMPricingEntry {\n inputPer1M: number\n outputPer1M: number\n cacheReadMultiplier?: number\n vendor: string\n provider: \"requesty\"\n}\n\n// ── Number helpers ──────────────────────────────────────────────────────\n\n/** Round to 6 decimal places, killing binary-float noise from the per-token × 1e6 product. */\nfunction round6(n: number): number {\n return Math.round(n * 1_000_000) / 1_000_000\n}\n\n/**\n * Convert a per-token USD number to USD-per-1M-tokens, or undefined if\n * unpriced. UNLIKE OpenRouter (per-token USD strings), Requesty already\n * gives per-token USD as a JSON number, so there's no `Number(...)` parse\n * step — just the same ×1e6 + round6 normalization.\n */\nfunction per1m(tokenPrice: number | undefined): number | undefined {\n if (tokenPrice === undefined) return undefined\n if (!Number.isFinite(tokenPrice)) return undefined\n return round6(tokenPrice * 1_000_000)\n}\n\n/** Shortest faithful decimal string (matches existing file: 1, 0.5, 0.7448, 1.25). */\nfunction fmt(n: number): string {\n if (!Number.isFinite(n)) return \"0\"\n return `${round6(n)}`\n}\n\n/** Vendor slug = first segment of the Requesty route id (`vendor/model`). */\nfunction vendorOf(id: string): string {\n if (!id.includes(\"/\")) return id\n return id.split(\"/\")[0] ?? id\n}\n\n// ── Serialization ────────────────────────────────────────────────────────\n\nfunction serializeEntry(e: LLMPricingEntry): string {\n const fields: string[] = [\n `inputPer1M: ${fmt(e.inputPer1M)}`,\n `outputPer1M: ${fmt(e.outputPer1M)}`,\n ]\n if (e.cacheReadMultiplier !== undefined) {\n fields.push(`cacheReadMultiplier: ${fmt(e.cacheReadMultiplier)}`)\n }\n fields.push(`vendor: ${JSON.stringify(e.vendor)}`)\n fields.push(`provider: ${JSON.stringify(e.provider)}`)\n return `{\\n ${fields.join(\",\\n \")},\\n }`\n}\n\nfunction serializeFile(entries: Record<string, LLMPricingEntry>): string {\n const ids = Object.keys(entries).sort()\n const providers = Array.from(new Set(ids.map(vendorOf))).sort()\n\n const lines: string[] = [\n \"// AUTO-GENERATED by @agentproto/catalog-sync (llm:requesty).\",\n \"// Do not edit by hand — re-run `pnpm --filter @agentproto/catalog-sync generate`.\",\n `// Source: ${REQUESTY_MODELS_URL}`,\n \"// Pricing carries provider USD (inputPer1M / outputPer1M) plus a cache\",\n \"// multiplier (cacheReadMultiplier) derived from the source's cached_price\",\n \"// per-token field when `supports_caching` is true. Requesty has no\",\n \"// cache-write price, so cacheWriteMultiplier is never emitted.\",\n \"\",\n 'import type { LLMPricing } from \"./catalog.js\"',\n \"\",\n \"export const REQUESTY_ROUTES: Record<string, LLMPricing> = {\",\n ]\n for (const id of ids) {\n lines.push(` ${JSON.stringify(id)}: ${serializeEntry(entries[id]!)},`)\n }\n lines.push(\"}\")\n lines.push(\"\")\n lines.push(\"/** Provider slugs treated as Requesty routes by the picker. */\")\n lines.push(\"export const REQUESTY_PROVIDERS: readonly string[] = [\")\n for (const p of providers) {\n lines.push(` ${JSON.stringify(p)},`)\n }\n lines.push(\"]\")\n lines.push(\"\")\n return lines.join(\"\\n\")\n}\n\n// ── Generator ───────────────────────────────────────────────────────────\n\nasync function generate(ctx: GeneratorContext): Promise<GeneratedFiles> {\n const src = sources[0]\n if (!src) throw new Error(\"llm:requesty: no source configured\")\n const parsed = SnapshotSchema.parse(await ctx.fetchSource(src))\n\n const entries: Record<string, LLMPricingEntry> = {}\n for (const model of parsed.data) {\n const inputPer1M = per1m(model.input_price)\n const outputPer1M = per1m(model.output_price)\n if (inputPer1M === undefined || outputPer1M === undefined) continue\n // Skip unpriced routes.\n if (inputPer1M === 0 && outputPer1M === 0) continue\n\n const entry: LLMPricingEntry = {\n inputPer1M,\n outputPer1M,\n vendor: vendorOf(model.id),\n provider: \"requesty\",\n }\n\n if (model.supports_caching === true && inputPer1M > 0) {\n const cachePer1M = per1m(model.cached_price)\n if (cachePer1M !== undefined) {\n entry.cacheReadMultiplier = round6(cachePer1M / inputPer1M)\n }\n }\n\n entries[model.id] = entry\n }\n\n return { [OUTPUT_PATH]: serializeFile(entries) }\n}\n\nconst sources = [\n {\n id: \"llm-requesty\",\n url: REQUESTY_MODELS_URL,\n // Live refresh needs the account key (Bearer). Without REQUESTY_API_KEY\n // set, the framework reuses the committed snapshot.\n headers: { Authorization: \"Bearer env:REQUESTY_API_KEY\" },\n },\n]\n\nexport const llmRequestyGenerator = defineGenerator({\n name: \"llm:requesty\",\n modality: \"llm\",\n sources,\n generate,\n})\n","import { z } from \"zod\"\n\nimport { defineGenerator, type GeneratedFiles, type GeneratorContext } from \"../types.js\"\n\n/**\n * PINNED source. The HuggingFace router `/v1/models` payload lists every\n * model the router knows about, each carrying a per-model `providers[]`\n * array — one entry per inference provider currently serving it. We never\n * fetch it at build or test time — only behind `--refresh`, which writes\n * `snapshots/llm-huggingface.json` so the next offline run is deterministic.\n * No auth required — the listing endpoint returns HTTP 200 unauthenticated\n * (verified 2026-07-18).\n */\nconst HUGGINGFACE_MODELS_URL = \"https://router.huggingface.co/v1/models\"\n\n/** Repo-relative drop-in target for {@link @agentproto/model-catalog}. */\nconst OUTPUT_PATH = \"packages/model-catalog/src/llm/huggingface-routes.generated.ts\"\n\n// ── Source schema ────────────────────────────────────────────────────────\n// Every per-provider field except `provider`/`status` is optional — some\n// entries are sparse (provider+status only). `pricing.input`/`pricing.output`\n// are USD-PER-1M-TOKENS NUMBERS (unlike OpenRouter's per-token strings),\n// already at the scale LLMPricing expects — no ×1e6 conversion needed.\n// passthrough() keeps unread live fields (owned_by, architecture, is_free,\n// throughput, …) forward-compatible without a regenerate — we only read\n// what we model.\n\nconst HFProviderSchema = z\n .object({\n provider: z.string(),\n status: z.string(),\n context_length: z.number().optional(),\n pricing: z\n .object({\n input: z.number().optional(),\n output: z.number().optional(),\n })\n .optional(),\n supports_tools: z.boolean().optional(),\n supports_structured_output: z.boolean().optional(),\n })\n .passthrough()\n\nconst HFModelSchema = z\n .object({\n id: z.string(),\n providers: z.array(HFProviderSchema).optional(),\n })\n .passthrough()\n\nconst SnapshotSchema = z.object({\n data: z.array(HFModelSchema),\n})\n\n// ── Output shape (drop-in for model-catalog's route-identity resolver) ────\n\ninterface HuggingFaceRouteProviderEntry {\n provider: string\n status: string\n contextLength?: number\n inputPer1M?: number\n outputPer1M?: number\n supportsTools?: boolean\n supportsStructuredOutput?: boolean\n}\n\ninterface HuggingFaceRouteEntry {\n wireId: string\n providers: HuggingFaceRouteProviderEntry[]\n}\n\n// ── Number helpers ──────────────────────────────────────────────────────\n\n/** Round to 4 decimal places, killing binary-float noise from the source payload. */\nfunction round4(n: number): number {\n return Math.round(n * 10_000) / 10_000\n}\n\n// ── Serialization ────────────────────────────────────────────────────────\n\nfunction serializeProvider(p: HuggingFaceRouteProviderEntry): string {\n const fields: string[] = [\n `provider: ${JSON.stringify(p.provider)}`,\n `status: ${JSON.stringify(p.status)}`,\n ]\n if (p.contextLength !== undefined) fields.push(`contextLength: ${p.contextLength}`)\n if (p.inputPer1M !== undefined) fields.push(`inputPer1M: ${p.inputPer1M}`)\n if (p.outputPer1M !== undefined) fields.push(`outputPer1M: ${p.outputPer1M}`)\n if (p.supportsTools !== undefined) fields.push(`supportsTools: ${p.supportsTools}`)\n if (p.supportsStructuredOutput !== undefined) {\n fields.push(`supportsStructuredOutput: ${p.supportsStructuredOutput}`)\n }\n return ` {\\n ${fields.join(\",\\n \")},\\n }`\n}\n\nfunction serializeEntry(id: string, e: HuggingFaceRouteEntry): string {\n const providerLines = e.providers.map(serializeProvider).join(\",\\n\")\n return [\n ` ${JSON.stringify(id)}: {`,\n ` wireId: ${JSON.stringify(e.wireId)},`,\n ` providers: [`,\n providerLines,\n ` ],`,\n ` },`,\n ].join(\"\\n\")\n}\n\nfunction serializeFile(entries: Record<string, HuggingFaceRouteEntry>): string {\n const ids = Object.keys(entries).sort()\n\n const lines: string[] = [\n \"// AUTO-GENERATED by @agentproto/catalog-sync (llm:huggingface).\",\n \"// Do not edit by hand — re-run `pnpm --filter @agentproto/catalog-sync generate`.\",\n `// Source: ${HUGGINGFACE_MODELS_URL}`,\n \"// Per-model LIVE inference providers from the HuggingFace router. HF wire\",\n \"// ids are case-sensitive and preserved verbatim. Provider entries are\",\n \"// SPARSE on some models — every field below except provider/status is\",\n \"// optional and emitted only when the upstream response carries it. Only\",\n '// providers with status === \"live\" are kept; models with zero live',\n \"// providers are skipped. inputPer1M/outputPer1M are USD per 1M tokens\",\n \"// (HuggingFace router convention — already at that scale, unlike\",\n \"// OpenRouter's per-token strings).\",\n \"\",\n \"export interface HuggingFaceRouteProvider {\",\n \" provider: string\",\n \" status: string\",\n \" contextLength?: number\",\n \" inputPer1M?: number\",\n \" outputPer1M?: number\",\n \" supportsTools?: boolean\",\n \" supportsStructuredOutput?: boolean\",\n \"}\",\n \"\",\n \"export interface HuggingFaceRoute {\",\n \" wireId: string\",\n \" providers: HuggingFaceRouteProvider[]\",\n \"}\",\n \"\",\n \"export const HUGGINGFACE_ROUTES: Record<string, HuggingFaceRoute> = {\",\n ]\n for (const id of ids) {\n lines.push(serializeEntry(id, entries[id]!))\n }\n lines.push(\"}\")\n lines.push(\"\")\n return lines.join(\"\\n\")\n}\n\n// ── Generator ───────────────────────────────────────────────────────────\n\nasync function generate(ctx: GeneratorContext): Promise<GeneratedFiles> {\n const src = sources[0]\n if (!src) throw new Error(\"llm:huggingface: no source configured\")\n const parsed = SnapshotSchema.parse(await ctx.fetchSource(src))\n\n const entries: Record<string, HuggingFaceRouteEntry> = {}\n for (const model of parsed.data) {\n const liveProviders = (model.providers ?? []).filter((p) => p.status === \"live\")\n if (liveProviders.length === 0) continue\n\n const providers: HuggingFaceRouteProviderEntry[] = liveProviders\n .map((p) => {\n const entry: HuggingFaceRouteProviderEntry = {\n provider: p.provider,\n status: p.status,\n }\n if (p.context_length !== undefined) entry.contextLength = p.context_length\n if (p.pricing?.input !== undefined) entry.inputPer1M = round4(p.pricing.input)\n if (p.pricing?.output !== undefined) entry.outputPer1M = round4(p.pricing.output)\n if (p.supports_tools !== undefined) entry.supportsTools = p.supports_tools\n if (p.supports_structured_output !== undefined) {\n entry.supportsStructuredOutput = p.supports_structured_output\n }\n return entry\n })\n .sort((a, b) => a.provider.localeCompare(b.provider))\n\n entries[model.id] = { wireId: model.id, providers }\n }\n\n return { [OUTPUT_PATH]: serializeFile(entries) }\n}\n\nconst sources = [\n {\n id: \"llm-huggingface\",\n url: HUGGINGFACE_MODELS_URL,\n },\n]\n\nexport const llmHuggingfaceGenerator = defineGenerator({\n name: \"llm:huggingface\",\n modality: \"llm\",\n sources,\n generate,\n})\n","import { z } from \"zod\"\n\nimport { defineGenerator, type CatalogSource, type GeneratedFiles, type GeneratorContext } from \"../types.js\"\n\n/**\n * Context window (max input tokens) + max output tokens, live per model id,\n * for the four providers that publish a machine-readable models-list with\n * this data: Anthropic, Groq, xAI, Moonshot. This is NOT pricing — Anthropic's\n * `/v1/models` carries no price at all, and Groq/xAI pricing units need\n * separate verification before they're trusted for billing; see\n * `LLM_PRICING_CATALOG` / `OPENROUTER_ROUTES` in `catalog.ts` for that.\n *\n * ZAI/Zhipu and OpenAI are deliberately excluded: ZAI's `/v4/models` list\n * returns bare `{id, owned_by, created}` with no context field, and OpenAI\n * has no stable models-list endpoint at all (see `sources/openai.ts`) — both\n * stay hand-maintained until (if ever) they publish one.\n */\n\n/** Repo-relative drop-in target for {@link @agentproto/model-catalog}. */\nconst OUTPUT_PATH = \"packages/model-catalog/src/llm/context-windows.generated.ts\"\n\n// ── Output shape (mirrors ContextWindowEntry in model-catalog's catalog.ts) ──\n\ninterface ContextWindowEntry {\n contextWindow: number\n maxOutput?: number\n displayName?: string\n provider: \"anthropic\" | \"groq\" | \"xai\" | \"moonshot\"\n}\n\n// ── Source schemas ───────────────────────────────────────────────────────\n// Each provider's models-list shape, verified against the live payload\n// (2026-07-16). `passthrough()` keeps unrelated fields forward-compatible.\n\nconst AnthropicModelSchema = z\n .object({\n id: z.string(),\n display_name: z.string().optional(),\n max_input_tokens: z.number().optional(),\n max_tokens: z.number().optional(),\n })\n .passthrough()\nconst AnthropicSnapshotSchema = z.object({ data: z.array(AnthropicModelSchema) })\n\nconst GroqModelSchema = z\n .object({\n id: z.string(),\n context_window: z.number().optional(),\n max_completion_tokens: z.number().optional(),\n })\n .passthrough()\nconst GroqSnapshotSchema = z.object({ data: z.array(GroqModelSchema) })\n\n// xAI's `context_length` is `null` for non-text models (e.g. grok-imagine-video).\nconst XaiModelSchema = z\n .object({\n id: z.string(),\n context_length: z.number().nullable().optional(),\n })\n .passthrough()\nconst XaiSnapshotSchema = z.object({ data: z.array(XaiModelSchema) })\n\nconst MoonshotModelSchema = z\n .object({\n id: z.string(),\n context_length: z.number().optional(),\n })\n .passthrough()\nconst MoonshotSnapshotSchema = z.object({ data: z.array(MoonshotModelSchema) })\n\n// ── Serialization ────────────────────────────────────────────────────────\n\nfunction serializeEntry(e: ContextWindowEntry): string {\n const fields: string[] = [`contextWindow: ${e.contextWindow}`]\n if (e.maxOutput !== undefined) fields.push(`maxOutput: ${e.maxOutput}`)\n if (e.displayName !== undefined) fields.push(`displayName: ${JSON.stringify(e.displayName)}`)\n fields.push(`provider: ${JSON.stringify(e.provider)}`)\n return `{ ${fields.join(\", \")} }`\n}\n\nfunction serializeFile(entries: Record<string, ContextWindowEntry>): string {\n const ids = Object.keys(entries).sort()\n const lines: string[] = [\n \"// AUTO-GENERATED by @agentproto/catalog-sync (llm:context-windows).\",\n \"// Do not edit by hand — re-run `pnpm --filter @agentproto/catalog-sync generate --refresh`.\",\n \"// Sources: api.anthropic.com/v1/models, api.groq.com/openai/v1/models,\",\n \"// api.x.ai/v1/models, api.moonshot.ai/v1/models\",\n \"// Context window (max input tokens) + max output tokens per live model id.\",\n \"// NOT pricing — see LLM_PRICING_CATALOG / OPENROUTER_ROUTES in catalog.ts.\",\n \"\",\n \"export interface ContextWindowEntry {\",\n \" contextWindow: number\",\n \" maxOutput?: number\",\n \" displayName?: string\",\n ' provider: \"anthropic\" | \"groq\" | \"xai\" | \"moonshot\"',\n \"}\",\n \"\",\n \"export const CONTEXT_WINDOWS: Record<string, ContextWindowEntry> = {\",\n ]\n for (const id of ids) {\n lines.push(` ${JSON.stringify(id)}: ${serializeEntry(entries[id]!)},`)\n }\n lines.push(\"}\")\n lines.push(\"\")\n return lines.join(\"\\n\")\n}\n\n// ── Generator ───────────────────────────────────────────────────────────\n\nasync function generate(ctx: GeneratorContext): Promise<GeneratedFiles> {\n const entries: Record<string, ContextWindowEntry> = {}\n\n const anthropicSrc = sources.find(s => s.id === \"llm-anthropic\")\n if (anthropicSrc) {\n const parsed = AnthropicSnapshotSchema.parse(await ctx.fetchSource(anthropicSrc))\n for (const m of parsed.data) {\n if (!m.max_input_tokens || !m.max_tokens) continue\n entries[m.id] = {\n contextWindow: m.max_input_tokens,\n maxOutput: m.max_tokens,\n ...(m.display_name ? { displayName: m.display_name } : {}),\n provider: \"anthropic\",\n }\n }\n }\n\n const groqSrc = sources.find(s => s.id === \"llm-groq\")\n if (groqSrc) {\n const parsed = GroqSnapshotSchema.parse(await ctx.fetchSource(groqSrc))\n for (const m of parsed.data) {\n if (!m.context_window) continue\n entries[m.id] = {\n contextWindow: m.context_window,\n ...(m.max_completion_tokens ? { maxOutput: m.max_completion_tokens } : {}),\n provider: \"groq\",\n }\n }\n }\n\n const xaiSrc = sources.find(s => s.id === \"llm-xai\")\n if (xaiSrc) {\n const parsed = XaiSnapshotSchema.parse(await ctx.fetchSource(xaiSrc))\n for (const m of parsed.data) {\n if (!m.context_length) continue\n entries[m.id] = { contextWindow: m.context_length, provider: \"xai\" }\n }\n }\n\n const moonshotSrc = sources.find(s => s.id === \"llm-moonshot\")\n if (moonshotSrc) {\n const parsed = MoonshotSnapshotSchema.parse(await ctx.fetchSource(moonshotSrc))\n for (const m of parsed.data) {\n if (!m.context_length) continue\n entries[m.id] = { contextWindow: m.context_length, provider: \"moonshot\" }\n }\n }\n\n return { [OUTPUT_PATH]: serializeFile(entries) }\n}\n\nconst sources: CatalogSource[] = [\n {\n id: \"llm-anthropic\",\n url: \"https://api.anthropic.com/v1/models?limit=1000\",\n headers: {\n \"x-api-key\": \"env:ANTHROPIC_API_KEY\",\n \"anthropic-version\": \"2023-06-01\",\n },\n },\n {\n id: \"llm-groq\",\n url: \"https://api.groq.com/openai/v1/models\",\n headers: { Authorization: \"Bearer env:GROQ_API_KEY\" },\n },\n {\n id: \"llm-xai\",\n url: \"https://api.x.ai/v1/models\",\n headers: { Authorization: \"Bearer env:XAI_API_KEY\" },\n },\n {\n id: \"llm-moonshot\",\n url: \"https://api.moonshot.ai/v1/models\",\n headers: { Authorization: \"Bearer env:MOONSHOT_API_KEY\" },\n },\n]\n\nexport const llmContextWindowsGenerator = defineGenerator({\n name: \"llm:context-windows\",\n modality: \"llm\",\n sources,\n generate,\n})\n","/**\n * Shared CatalogVoice[] → TS-source serializer for the voice generators.\n *\n * The mapping (raw provider JSON → CatalogVoice) lives in\n * `@agentproto/model-catalog/providers` so build time and runtime share it;\n * this module only turns the mapped voices into a committed `*.generated.ts`.\n * Field emit order is fixed (matches the historical generator output) so the\n * generated file stays diff-stable across runs.\n */\n\nimport type { CatalogVoice } from \"@agentproto/model-catalog/schema/voice\"\n\nfunction serializeVoice(v: CatalogVoice): string {\n const lines: string[] = [\" {\"]\n lines.push(` catalogId: ${JSON.stringify(v.catalogId)},`)\n lines.push(` providerVoiceId: ${JSON.stringify(v.providerVoiceId)},`)\n lines.push(` provider: ${JSON.stringify(v.provider)},`)\n lines.push(` label: ${JSON.stringify(v.label)},`)\n lines.push(` description: ${JSON.stringify(v.description)},`)\n lines.push(` gender: ${JSON.stringify(v.gender)},`)\n lines.push(` primaryLanguage: ${JSON.stringify(v.primaryLanguage)},`)\n lines.push(\n ` supportedLanguages: [${v.supportedLanguages.map(l => JSON.stringify(l)).join(\", \")}],`,\n )\n if (v.quality !== undefined) lines.push(` quality: ${JSON.stringify(v.quality)},`)\n if (v.featured !== undefined) lines.push(` featured: ${v.featured},`)\n if (v.samplePath !== undefined) lines.push(` samplePath: ${JSON.stringify(v.samplePath)},`)\n if (v.age !== undefined) lines.push(` age: ${JSON.stringify(v.age)},`)\n lines.push(\" },\")\n return lines.join(\"\\n\")\n}\n\n/**\n * Render a full generated voice module.\n *\n * @param generatorName e.g. `voice:elevenlabs` (goes in the header comment)\n * @param exportName e.g. `ELEVENLABS_VOICES`\n * @param voices mapped voices, in emit order\n */\nexport function serializeVoiceModule(\n generatorName: string,\n exportName: string,\n voices: readonly CatalogVoice[],\n): string {\n const lines: string[] = [\n `// Generated by @agentproto/catalog-sync generator ${generatorName}`,\n \"// DO NOT EDIT MANUALLY — regenerate with catalog-sync\",\n \"\",\n 'import type { CatalogVoice } from \"@agentproto/model-catalog/schema/voice\"',\n \"\",\n `export const ${exportName}: readonly CatalogVoice[] = [`,\n ]\n for (const v of voices) lines.push(serializeVoice(v))\n lines.push(\"] as const\")\n lines.push(\"\")\n return lines.join(\"\\n\")\n}\n","/**\n * voice-elevenlabs generator — reads the ElevenLabs /v1/voices snapshot and\n * emits a CatalogVoice[]-shaped generated TS file.\n *\n * The raw → CatalogVoice mapping lives in\n * `@agentproto/model-catalog/providers` (shared with the runtime\n * live-on-setup path); this generator only fetches, validates, and\n * serializes. Provider-native ids only; no product-specific aliases.\n */\n\nimport {\n ElevenLabsVoicesSnapshotSchema,\n mapElevenLabsVoices,\n} from \"@agentproto/model-catalog/providers\"\n\nimport type {\n CatalogGenerator,\n CatalogSource,\n GeneratedFiles,\n GeneratorContext,\n} from \"../types.js\"\nimport { defineGenerator } from \"../types.js\"\nimport { serializeVoiceModule } from \"./serialize-voices.js\"\n\n// `id` MUST match the snapshot filename stem — the framework's\n// `ctx.fetchSource` resolves `snapshots/<id>.json` (and is the single,\n// dist-safe reader; generators never touch the filesystem themselves).\nexport const ELEVENLABS_SOURCE: CatalogSource = {\n id: \"voice-elevenlabs\",\n url: \"https://api.elevenlabs.io/v1/voices\",\n // Live refresh needs the account key; offline reads ignore this.\n headers: { \"xi-api-key\": \"env:ELEVENLABS_API_KEY\" },\n}\n\nconst OUTPUT_PATH = \"packages/catalog-sync/generated/voice-elevenlabs.generated.ts\"\n\nexport const voiceElevenlabs: CatalogGenerator = defineGenerator({\n name: \"voice:elevenlabs\",\n modality: \"voice\",\n sources: [ELEVENLABS_SOURCE],\n\n async generate(ctx: GeneratorContext): Promise<GeneratedFiles> {\n // Snapshot-first (refresh re-fetches) — both handled by the framework.\n const snapshot = ElevenLabsVoicesSnapshotSchema.parse(\n await ctx.fetchSource(ELEVENLABS_SOURCE),\n )\n const voices = mapElevenLabsVoices(snapshot)\n return {\n [OUTPUT_PATH]: serializeVoiceModule(\n \"voice:elevenlabs\",\n \"ELEVENLABS_VOICES\",\n voices,\n ),\n }\n },\n})\n","/**\n * voice-minimax generator — reads the MiniMax /v1/get_voice snapshot and\n * emits a CatalogVoice[]-shaped generated TS file.\n *\n * The raw → CatalogVoice mapping lives in\n * `@agentproto/model-catalog/providers` (shared with the runtime\n * live-on-setup path); this generator only fetches, validates, and\n * serializes. Provider-native ids only; no product-specific aliases.\n */\n\nimport {\n mapMinimaxVoices,\n MinimaxVoicesSnapshotSchema,\n} from \"@agentproto/model-catalog/providers\"\n\nimport type {\n CatalogGenerator,\n CatalogSource,\n GeneratedFiles,\n GeneratorContext,\n} from \"../types.js\"\nimport { defineGenerator } from \"../types.js\"\nimport { serializeVoiceModule } from \"./serialize-voices.js\"\n\n// `id` MUST match the snapshot filename stem — the framework's\n// `ctx.fetchSource` resolves `snapshots/<id>.json` (single dist-safe reader;\n// generators never touch the filesystem themselves).\nexport const MINIMAX_SOURCE: CatalogSource = {\n id: \"voice-minimax\",\n url: \"https://api.minimax.io/v1/get_voice\",\n // get_voice is a POST; live refresh needs the account key (Bearer). Without\n // MINIMAX_API_KEY set, the framework reuses the committed snapshot.\n method: \"POST\",\n headers: {\n Authorization: \"Bearer env:MINIMAX_API_KEY\",\n \"Content-Type\": \"application/json\",\n },\n body: { voice_type: \"system\" },\n}\n\nconst OUTPUT_PATH = \"packages/catalog-sync/generated/voice-minimax.generated.ts\"\n\nexport const voiceMinimax: CatalogGenerator = defineGenerator({\n name: \"voice:minimax\",\n modality: \"voice\",\n sources: [MINIMAX_SOURCE],\n\n async generate(ctx: GeneratorContext): Promise<GeneratedFiles> {\n // Snapshot-first (refresh re-fetches) — both handled by the framework.\n const snapshot = MinimaxVoicesSnapshotSchema.parse(\n await ctx.fetchSource(MINIMAX_SOURCE),\n )\n const voices = mapMinimaxVoices(snapshot)\n return {\n [OUTPUT_PATH]: serializeVoiceModule(\n \"voice:minimax\",\n \"MINIMAX_VOICES\",\n voices,\n ),\n }\n },\n})\n","/**\n * image-replicate generator — reads a curated Replicate image-models\n * snapshot and emits ImageModelDefinition[]-shaped generated TS entries.\n *\n * Mirrors the shape from packages/model-catalog/src/image/catalog.ts exactly.\n * Provider-native ids only; no product-specific aliases.\n */\n\nimport type {\n CatalogGenerator,\n CatalogSource,\n GeneratedFiles,\n GeneratorContext,\n} from \"../types.js\"\nimport { defineGenerator } from \"../types.js\"\n\n// ── Replicate snapshot shapes ───────────────────────────────────────────\n\ninterface ReplicateOpenApiSchema {\n input: { type: string; properties: Record<string, { type: string; items?: { type: string }; format?: string }> }\n output: { type: string; items?: { type: string; format?: string }; format?: string }\n}\n\ninterface ReplicateLatestVersion {\n id: string\n created_at: string\n openapi_schema: ReplicateOpenApiSchema\n}\n\ninterface ReplicateModel {\n owner: string\n name: string\n description: string\n visibility: string\n run_count: number\n cover_image_url: string | null\n latest_version: ReplicateLatestVersion\n}\n\ninterface ReplicateSnapshot {\n _meta: Record<string, unknown>\n models: ReplicateModel[]\n}\n\n// ── ImageModelDefinition mirror (from packages/model-catalog/src/image/catalog.ts) ──\n\ninterface ImageModelPricing {\n costPerImage: number\n costTier: \"low\" | \"medium\" | \"high\"\n billingUnit: \"per_image\"\n baseCost: number\n creditCost?: number\n overrideCreditCost?: number\n}\n\ninterface ImageModelCapabilities {\n generate: boolean\n edit: boolean\n upscale?: boolean\n}\n\ninterface ImageModelReferenceImages {\n supported: boolean\n fieldName: \"image_input\" | \"input_images\" | \"input_image\" | \"none\"\n maxCount: number\n singular: boolean\n}\n\ninterface ImageModelAspectRatio {\n supported: string[]\n default: string\n}\n\ninterface ImageModelEntry {\n id: string\n name: string\n providerId: string\n provider: string\n capabilities: ImageModelCapabilities\n referenceImages: ImageModelReferenceImages\n aspectRatio: ImageModelAspectRatio\n output: \"string\" | \"array\"\n pricing: ImageModelPricing\n description: string\n agentVisible: boolean\n triggerWord?: string\n}\n\n// ── Pricing (hand-authored, mirrors model-catalog) ──────────────────────\n\ninterface PricingRecord {\n costPerImage: number\n costTier: \"low\" | \"medium\" | \"high\"\n baseCost: number\n creditCost?: number\n overrideCreditCost?: number\n}\n\nconst PRICING: Record<string, PricingRecord> = {\n \"nano-banana-pro\": { costPerImage: 0.15, costTier: \"high\", baseCost: 0.15, creditCost: 10 },\n \"nano-banana-2\": { costPerImage: 0.06, costTier: \"medium\", baseCost: 0.06, creditCost: 5 },\n \"nano-banana\": { costPerImage: 0.04, costTier: \"low\", baseCost: 0.04, creditCost: 5 },\n \"flux-2-dev\": { costPerImage: 0.03, costTier: \"low\", baseCost: 0.03, creditCost: 3 },\n \"flux-kontext-pro\": { costPerImage: 0.04, costTier: \"low\", baseCost: 0.04, creditCost: 5 },\n \"flux-kontext-max\": { costPerImage: 0.08, costTier: \"medium\", baseCost: 0.08, creditCost: 8 },\n \"flux-1.1-pro-ultra\": { costPerImage: 0.06, costTier: \"medium\", baseCost: 0.06, creditCost: 8 },\n \"seedream-4\": { costPerImage: 0.03, costTier: \"low\", baseCost: 0.03, creditCost: 3 },\n \"recraft-v3\": { costPerImage: 0.04, costTier: \"low\", baseCost: 0.04, creditCost: 5 },\n \"image-01\": { costPerImage: 0.02, costTier: \"low\", baseCost: 0.02, creditCost: 2 },\n \"gpt-image-1\": { costPerImage: 0.04, costTier: \"low\", baseCost: 0.04, creditCost: 5 },\n \"ideogram-v3-turbo\": { costPerImage: 0.03, costTier: \"low\", baseCost: 0.03, creditCost: 4 },\n \"flux-1.1-pro\": { costPerImage: 0.04, costTier: \"low\", baseCost: 0.04, creditCost: 5 },\n}\n\n// Models visible to agents (the active generation ones)\nconst AGENT_VISIBLE = new Set([\n \"nano-banana-pro\",\n \"nano-banana-2\",\n \"nano-banana\",\n \"flux-2-dev\",\n \"flux-kontext-pro\",\n \"flux-kontext-max\",\n \"flux-1.1-pro-ultra\",\n \"seedream-4\",\n \"recraft-v3\",\n \"image-01\",\n \"gpt-image-1\",\n \"ideogram-v3-turbo\",\n])\n\nconst ASPECT_RATIOS_DEFAULT: ImageModelAspectRatio = {\n supported: [\"1:1\", \"9:16\", \"16:9\", \"2:3\", \"3:2\", \"3:4\", \"4:3\"],\n default: \"1:1\",\n}\n\nconst ASPECT_RATIOS_WIDE: ImageModelAspectRatio = {\n supported: [\"1:1\", \"9:16\", \"16:9\", \"2:3\", \"3:2\", \"3:4\", \"4:3\", \"4:5\", \"5:4\"],\n default: \"1:1\",\n}\n\nconst ASPECT_RATIOS_ULTRA: ImageModelAspectRatio = {\n supported: [\"1:1\", \"9:16\", \"16:9\", \"21:9\", \"9:21\", \"3:4\", \"4:3\"],\n default: \"1:1\",\n}\n\nconst ASPECT_RATIOS_NBPRO: ImageModelAspectRatio = {\n supported: [\n \"1:1\", \"9:16\", \"16:9\", \"2:3\", \"3:2\", \"3:4\", \"4:3\",\n \"4:5\", \"5:4\", \"21:9\",\n ],\n default: \"match_input_image\",\n}\n\nconst ASPECT_RATIOS_NB2: ImageModelAspectRatio = {\n supported: [\n \"1:1\", \"9:16\", \"16:9\", \"2:3\", \"3:2\", \"3:4\", \"4:3\",\n \"4:5\", \"5:4\",\n ],\n default: \"match_input_image\",\n}\n\nconst ASPECT_RATIOS_SQUARE: ImageModelAspectRatio = {\n supported: [\"1:1\"],\n default: \"1:1\",\n}\n\ninterface ModelSpec {\n id: string\n name: string\n capabilities: ImageModelCapabilities\n referenceImages: ImageModelReferenceImages\n aspectRatio: ImageModelAspectRatio\n output: \"string\" | \"array\"\n triggerWord?: string\n}\n\nconst MODEL_SPECS: Record<string, ModelSpec> = {\n \"nano-banana-pro\": {\n id: \"nano-banana-pro\",\n name: \"Nano Banana Pro\",\n capabilities: { generate: true, edit: true },\n referenceImages: { supported: true, fieldName: \"image_input\", maxCount: 14, singular: false },\n aspectRatio: ASPECT_RATIOS_NBPRO,\n output: \"string\",\n },\n \"nano-banana-2\": {\n id: \"nano-banana-2\",\n name: \"Nano Banana 2\",\n capabilities: { generate: true, edit: true },\n referenceImages: { supported: true, fieldName: \"image_input\", maxCount: 4, singular: false },\n aspectRatio: ASPECT_RATIOS_NB2,\n output: \"string\",\n },\n \"nano-banana\": {\n id: \"nano-banana\",\n name: \"Nano Banana\",\n capabilities: { generate: true, edit: true },\n referenceImages: { supported: true, fieldName: \"image_input\", maxCount: 4, singular: false },\n aspectRatio: ASPECT_RATIOS_DEFAULT,\n output: \"string\",\n },\n \"flux-2-dev\": {\n id: \"flux-2-dev\",\n name: \"Flux 2 Dev\",\n capabilities: { generate: true, edit: true },\n referenceImages: { supported: true, fieldName: \"input_images\", maxCount: 5, singular: false },\n aspectRatio: ASPECT_RATIOS_WIDE,\n output: \"string\",\n },\n \"flux-kontext-pro\": {\n id: \"flux-kontext-pro\",\n name: \"Flux Kontext Pro\",\n capabilities: { generate: true, edit: true },\n referenceImages: { supported: true, fieldName: \"input_image\", maxCount: 1, singular: true },\n aspectRatio: ASPECT_RATIOS_DEFAULT,\n output: \"string\",\n },\n \"flux-kontext-max\": {\n id: \"flux-kontext-max\",\n name: \"Flux Kontext Max\",\n capabilities: { generate: true, edit: true },\n referenceImages: { supported: true, fieldName: \"input_image\", maxCount: 1, singular: true },\n aspectRatio: ASPECT_RATIOS_DEFAULT,\n output: \"string\",\n },\n \"flux-1.1-pro-ultra\": {\n id: \"flux-1.1-pro-ultra\",\n name: \"Flux 1.1 Pro Ultra\",\n capabilities: { generate: true, edit: false },\n referenceImages: { supported: false, fieldName: \"none\", maxCount: 0, singular: false },\n aspectRatio: ASPECT_RATIOS_ULTRA,\n output: \"string\",\n },\n \"seedream-4\": {\n id: \"seedream-4\",\n name: \"SeedReam 4\",\n capabilities: { generate: true, edit: true },\n referenceImages: { supported: true, fieldName: \"image_input\", maxCount: 10, singular: false },\n aspectRatio: ASPECT_RATIOS_DEFAULT,\n output: \"string\",\n },\n \"recraft-v3\": {\n id: \"recraft\",\n name: \"Recraft V3\",\n capabilities: { generate: true, edit: false },\n referenceImages: { supported: false, fieldName: \"none\", maxCount: 0, singular: false },\n aspectRatio: ASPECT_RATIOS_SQUARE,\n output: \"string\",\n },\n \"image-01\": {\n id: \"minimax\",\n name: \"MiniMax Image\",\n capabilities: { generate: true, edit: false },\n referenceImages: { supported: false, fieldName: \"none\", maxCount: 0, singular: false },\n aspectRatio: { supported: [\"1:1\", \"9:16\", \"16:9\", \"3:4\", \"4:3\"], default: \"1:1\" },\n output: \"array\",\n },\n \"gpt-image-1\": {\n id: \"gpt-image-1\",\n name: \"OpenAI GPT Image 1\",\n capabilities: { generate: true, edit: true },\n referenceImages: { supported: true, fieldName: \"input_image\", maxCount: 1, singular: true },\n aspectRatio: { supported: [\"1:1\", \"2:3\", \"3:2\"], default: \"1:1\" },\n output: \"string\",\n },\n \"ideogram-v3-turbo\": {\n id: \"ideogram-v3\",\n name: \"Ideogram v3\",\n capabilities: { generate: true, edit: false },\n referenceImages: { supported: false, fieldName: \"none\", maxCount: 0, singular: false },\n aspectRatio: { supported: [\"1:1\", \"9:16\", \"16:9\", \"2:3\", \"3:2\"], default: \"1:1\" },\n output: \"string\",\n },\n \"flux-1.1-pro\": {\n id: \"flux\",\n name: \"Flux 1.1 Pro\",\n capabilities: { generate: true, edit: false },\n referenceImages: { supported: false, fieldName: \"none\", maxCount: 0, singular: false },\n aspectRatio: { supported: [\"1:1\", \"9:16\", \"16:9\"], default: \"1:1\" },\n output: \"string\",\n },\n}\n\nfunction mapModel(raw: ReplicateModel): ImageModelEntry {\n const providerId = `${raw.owner}/${raw.name}`\n const spec = MODEL_SPECS[raw.name] ?? {\n id: raw.name,\n name: raw.name,\n capabilities: { generate: true, edit: false },\n referenceImages: { supported: false, fieldName: \"none\" as const, maxCount: 0, singular: false },\n aspectRatio: ASPECT_RATIOS_DEFAULT,\n output: \"string\" as const,\n }\n\n const pricing = PRICING[raw.name] ?? {\n costPerImage: 0.03,\n costTier: \"low\" as const,\n baseCost: 0.03,\n creditCost: 3,\n }\n\n return {\n id: spec.id,\n name: spec.name,\n providerId,\n provider: raw.owner === \"openai\" ? \"openai\" : raw.owner === \"minimax\" ? \"minimax\" : \"replicate\",\n capabilities: spec.capabilities,\n referenceImages: spec.referenceImages,\n aspectRatio: spec.aspectRatio,\n output: spec.output,\n pricing: {\n costPerImage: pricing.costPerImage,\n costTier: pricing.costTier,\n billingUnit: \"per_image\" as const,\n baseCost: pricing.baseCost,\n ...(pricing.creditCost !== undefined ? { creditCost: pricing.creditCost } : {}),\n ...(pricing.overrideCreditCost !== undefined ? { overrideCreditCost: pricing.overrideCreditCost } : {}),\n },\n description: raw.description,\n agentVisible: AGENT_VISIBLE.has(raw.name),\n ...(spec.triggerWord ? { triggerWord: spec.triggerWord } : {}),\n }\n}\n\n// ── Generator ────────────────────────────────────────────────────────────\n\n// `id` MUST match the snapshot filename stem — the framework's\n// `ctx.fetchSource` resolves `snapshots/<id>.json` (single dist-safe reader;\n// generators never touch the filesystem themselves).\n// The Replicate models endpoint is authed. Declare the token as an `env:` header\n// token so the runner's missing-env gate (runner.ts `resolveHeaders`) SKIPS the\n// refresh and reuses the committed snapshot when `REPLICATE_API_TOKEN` is absent\n// — exactly like the authed LLM sources (Anthropic/Groq/xAI/Moonshot). Without\n// this a token-less `catalog-sync generate --refresh` fetched unauthenticated,\n// 401'd, and threw — crashing the whole run for anyone (or the weekly Action)\n// without the secret. `--check` never fetches, so it is unaffected.\nexport const REPLICATE_SOURCE: CatalogSource = {\n id: \"image-replicate\",\n url: \"https://api.replicate.com/v1/models?query=image+generation\",\n headers: { Authorization: \"Bearer env:REPLICATE_API_TOKEN\" },\n}\n\nexport const imageReplicate: CatalogGenerator = defineGenerator({\n name: \"image:replicate\",\n modality: \"image\",\n sources: [REPLICATE_SOURCE],\n\n async generate(ctx: GeneratorContext): Promise<GeneratedFiles> {\n // Snapshot-first (refresh re-fetches) — both handled by the framework.\n const data = (await ctx.fetchSource(REPLICATE_SOURCE)) as ReplicateSnapshot\n\n const entries = data.models.map(mapModel)\n\n const lines: string[] = [\n \"// Generated by @agentproto/catalog-sync generator image:replicate\",\n \"// DO NOT EDIT MANUALLY — regenerate with catalog-sync\",\n \"\",\n \"import type { ImageModelDefinition } from \\\"@agentproto/model-catalog/image\\\"\",\n \"\",\n \"export const REPLICATE_IMAGE_MODELS: Record<string, ImageModelDefinition> = {\",\n ]\n\n for (const e of entries) {\n const trigger = e.triggerWord ? `,\\n triggerWord: ${JSON.stringify(e.triggerWord)}` : \"\"\n const creditCost = e.pricing.creditCost !== undefined\n ? `,\\n creditCost: ${e.pricing.creditCost}`\n : \"\"\n const override = e.pricing.overrideCreditCost !== undefined\n ? `,\\n overrideCreditCost: ${e.pricing.overrideCreditCost}`\n : \"\"\n\n lines.push(` ${JSON.stringify(e.id)}: {`)\n lines.push(` id: ${JSON.stringify(e.id)},`)\n lines.push(` name: ${JSON.stringify(e.name)},`)\n lines.push(` providerId: ${JSON.stringify(e.providerId)},`)\n lines.push(` provider: ${JSON.stringify(e.provider)},`)\n lines.push(` capabilities: { generate: ${e.capabilities.generate}, edit: ${e.capabilities.edit}${e.capabilities.upscale ? `, upscale: ${e.capabilities.upscale}` : \"\"} },`)\n lines.push(` referenceImages: {`)\n lines.push(` supported: ${e.referenceImages.supported},`)\n lines.push(` fieldName: ${JSON.stringify(e.referenceImages.fieldName)},`)\n lines.push(` maxCount: ${e.referenceImages.maxCount},`)\n lines.push(` singular: ${e.referenceImages.singular},`)\n lines.push(` },`)\n lines.push(` aspectRatio: {`)\n lines.push(` supported: [${e.aspectRatio.supported.map(a => JSON.stringify(a)).join(\", \")}],`)\n lines.push(` default: ${JSON.stringify(e.aspectRatio.default)},`)\n lines.push(` },`)\n lines.push(` output: ${JSON.stringify(e.output)},`)\n lines.push(` pricing: {`)\n lines.push(` costPerImage: ${e.pricing.costPerImage},`)\n lines.push(` costTier: ${JSON.stringify(e.pricing.costTier)},`)\n lines.push(` billingUnit: ${JSON.stringify(e.pricing.billingUnit)},`)\n lines.push(` baseCost: ${e.pricing.baseCost},${creditCost}${override}`)\n lines.push(` },`)\n lines.push(` description: ${JSON.stringify(e.description)},`)\n lines.push(` agentVisible: ${e.agentVisible},${trigger}`)\n lines.push(` },`)\n }\n\n lines.push(\"}\")\n lines.push(\"\")\n\n const outputPath = \"packages/catalog-sync/generated/image-replicate.generated.ts\"\n return { [outputPath]: lines.join(\"\\n\") }\n },\n})\n","import { existsSync, mkdirSync, readFileSync, writeFileSync } from \"node:fs\"\nimport { dirname, join, resolve } from \"node:path\"\nimport { fileURLToPath } from \"node:url\"\n\nimport type {\n CatalogGenerator,\n CatalogSource,\n GeneratedFiles,\n GeneratorContext,\n} from \"./types.js\"\n\nconst __dirname = dirname(fileURLToPath(import.meta.url))\n\n/**\n * The catalog-sync package directory. Resolves the same way whether the\n * module is loaded from `src/` (vitest, type-checking) or `dist/` (built) —\n * both sit one level below the package root, so walking up one directory\n * from this file lands on `packages/catalog-sync/`.\n */\nfunction catalogSyncDir(): string {\n return resolve(__dirname, \"..\")\n}\n\n/** Absolute path to a committed/pinned source snapshot. */\nfunction snapshotPath(id: string): string {\n return join(catalogSyncDir(), \"snapshots\", `${id}.json`)\n}\n\n/**\n * The monorepo root. Resolved by walking up from the catalog-sync package\n * until `pnpm-workspace.yaml` is found. Generated-file paths in\n * {@link GeneratedFiles} are repo-relative and are resolved against this.\n */\nfunction repoRoot(): string {\n let dir = catalogSyncDir()\n for (let i = 0; i < 12; i++) {\n if (existsSync(join(dir, \"pnpm-workspace.yaml\"))) return dir\n const parent = dirname(dir)\n if (parent === dir) break\n dir = parent\n }\n // Fallback: catalog-sync lives at <root>/packages/catalog-sync.\n return dirname(dirname(catalogSyncDir()))\n}\n\n/** Reads an existing file as UTF-8, or returns undefined when absent. */\nfunction readIfExists(absPath: string): string | undefined {\n if (!existsSync(absPath)) return undefined\n return readFileSync(absPath, \"utf8\")\n}\n\n/**\n * Resolve `env:VAR_NAME` tokens inside header values from `process.env`.\n * Returns the materialized headers plus the names of any referenced env vars\n * that are unset — the caller uses `missing` to decide whether the source can\n * be refreshed (we never fetch an authed endpoint without its key).\n */\nfunction resolveHeaders(headers?: Record<string, string>): {\n headers: Record<string, string>\n missing: string[]\n} {\n const out: Record<string, string> = {}\n const missing: string[] = []\n if (!headers) return { headers: out, missing }\n for (const [key, value] of Object.entries(headers)) {\n out[key] = value.replace(/env:([A-Z0-9_]+)/g, (_match, name: string) => {\n const v = process.env[name]\n if (v === undefined || v === \"\") {\n missing.push(name)\n return \"\"\n }\n return v\n })\n }\n return { headers: out, missing }\n}\n\nexport interface RunGeneratorsOptions {\n /** When true, missing snapshots are fetched from their pinned `url`. */\n refresh: boolean\n /** When true, generated files are written to disk at their repo-relative path. */\n write: boolean\n}\n\nexport interface RunGeneratorsResult {\n files: GeneratedFiles\n /** Repo-relative paths whose generated content differs from what is on disk. */\n changed: string[]\n}\n\n/**\n * Runs each generator, gathering its emitted files, then (optionally) writes\n * them. `changed` is ALWAYS computed — it is the diff of generated content\n * vs disk — so `--check` (write=false) can surface drift without mutating\n * anything. Writes only happen when `write=true` AND a path differs.\n */\nexport async function runGenerators(\n gens: CatalogGenerator[],\n opts: RunGeneratorsOptions\n): Promise<RunGeneratorsResult> {\n const files: GeneratedFiles = {}\n\n for (const gen of gens) {\n const ctx: GeneratorContext = {\n refresh: opts.refresh,\n async fetchSource(src: CatalogSource): Promise<unknown> {\n const path = snapshotPath(src.id)\n const existing = readIfExists(path)\n\n // Offline path (default): reuse the committed snapshot; error if none.\n if (!opts.refresh) {\n if (existing !== undefined) return JSON.parse(existing)\n throw new Error(\n `catalog-sync: no committed snapshot for source \"${src.id}\" ` +\n `(${path}), and --refresh is not set. Run ` +\n `\\`catalog-sync generate --refresh\\` to fetch ${src.url}.`\n )\n }\n\n // --refresh: force a live re-fetch (do NOT short-circuit on an existing\n // snapshot — refreshing is the whole point). Auth headers may embed\n // `env:VAR` tokens; if a referenced var is unset we can't authenticate,\n // so reuse the committed snapshot rather than fetch unauthenticated.\n const { headers, missing } = resolveHeaders(src.headers)\n if (missing.length > 0) {\n if (existing !== undefined) {\n process.stderr.write(\n `catalog-sync: skipping refresh of \"${src.id}\" — missing env ` +\n `${missing.join(\", \")}; reusing committed snapshot.\\n`\n )\n return JSON.parse(existing)\n }\n throw new Error(\n `catalog-sync: cannot refresh \"${src.id}\" — missing env ` +\n `${missing.join(\", \")} and no committed snapshot.`\n )\n }\n const res = await fetch(src.url, {\n method: src.method ?? \"GET\",\n headers,\n ...(src.body !== undefined\n ? { body: JSON.stringify(src.body) }\n : {}),\n })\n if (!res.ok) {\n throw new Error(\n `catalog-sync: fetch ${src.url} failed: ${res.status} ${res.statusText}`\n )\n }\n const text = await res.text()\n const parsed: unknown = JSON.parse(text)\n mkdirSync(dirname(path), { recursive: true })\n writeFileSync(path, `${JSON.stringify(parsed, null, 2)}\\n`, \"utf8\")\n return parsed\n },\n }\n\n const out = await gen.generate(ctx)\n for (const [path, content] of Object.entries(out)) {\n files[path] = content\n }\n }\n\n const root = repoRoot()\n const changed: string[] = []\n for (const [relPath, content] of Object.entries(files)) {\n const abs = join(root, relPath)\n const existing = readIfExists(abs)\n if (existing !== content) {\n changed.push(relPath)\n if (opts.write) {\n mkdirSync(dirname(abs), { recursive: true })\n writeFileSync(abs, content, \"utf8\")\n }\n }\n }\n\n return { files, changed }\n}\n","#!/usr/bin/env node\n\n/**\n * catalog-sync CLI.\n *\n * catalog-sync generate [--refresh] [--check]\n *\n * - `generate` (default) — generate from pinned snapshots, write changed files.\n * - `--refresh` — re-fetch each source's pinned URL into snapshots/.\n * - `--check` — generate in memory, diff vs committed files; exit 1\n * on drift. This is what CI runs. Never writes.\n */\n\nimport { llmOpenRouterGenerator } from \"./generators/llm-openrouter.js\"\nimport { llmRequestyGenerator } from \"./generators/llm-requesty.js\"\nimport { llmHuggingfaceGenerator } from \"./generators/llm-huggingface.js\"\nimport { llmContextWindowsGenerator } from \"./generators/llm-context-windows.js\"\nimport { voiceElevenlabs } from \"./generators/voice-elevenlabs.js\"\nimport { voiceMinimax } from \"./generators/voice-minimax.js\"\nimport { imageReplicate } from \"./generators/image-replicate.js\"\nimport { runGenerators } from \"./runner.js\"\n\nconst args = process.argv.slice(2)\nconst command = args[0] ?? \"\"\nconst flags = new Set(args.slice(1))\n\nconst KNOWN_FLAGS = new Set([\"--refresh\", \"--check\"])\nconst unknownFlags = [...flags].filter((f) => !KNOWN_FLAGS.has(f))\n\nif (command !== \"generate\" || unknownFlags.length > 0) {\n if (command !== \"generate\") {\n process.stderr.write(\n `catalog-sync: unknown command \"${command}\". Usage: catalog-sync generate [--refresh] [--check]\\n`\n )\n }\n if (unknownFlags.length > 0) {\n process.stderr.write(`catalog-sync: unknown flag(s) ${unknownFlags.join(\", \")}\\n`)\n }\n process.exit(2)\n}\n\nconst refresh = flags.has(\"--refresh\")\nconst check = flags.has(\"--check\")\nconst generators = [\n llmOpenRouterGenerator,\n llmRequestyGenerator,\n llmHuggingfaceGenerator,\n llmContextWindowsGenerator,\n voiceElevenlabs,\n voiceMinimax,\n imageReplicate,\n]\n\nconst { changed, files } = await runGenerators(generators, {\n refresh,\n write: !check,\n})\n\nif (check) {\n if (changed.length > 0) {\n process.stderr.write(\n `catalog-sync: drift detected — ${changed.length} file(s) differ from committed:\\n`\n )\n for (const p of changed) process.stderr.write(` ${p}\\n`)\n process.stderr.write(`Re-run \\`catalog-sync generate\\` to update.\\n`)\n process.exit(1)\n }\n process.stdout.write(\n `catalog-sync: no drift (${generators.length} generator(s), ${Object.keys(files).length} file(s) up to date).\\n`\n )\n process.exit(0)\n}\n\nif (changed.length > 0) {\n process.stdout.write(`catalog-sync: wrote ${changed.length} file(s):\\n`)\n for (const p of changed) process.stdout.write(` ${p}\\n`)\n} else {\n process.stdout.write(`catalog-sync: no changes.\\n`)\n}\nprocess.exit(0)\n"]}
1
+ {"version":3,"sources":["../src/types.ts","../src/added-at.ts","../src/generators/llm-openrouter.ts","../src/generators/llm-requesty.ts","../src/generators/llm-huggingface.ts","../src/generators/google-native-model-ids.mjs","../src/generators/llm-context-windows.ts","../src/generators/serialize-voices.ts","../src/generators/voice-elevenlabs.ts","../src/generators/voice-minimax.ts","../src/generators/image-replicate.ts","../src/changelog.ts","../src/runner.ts","../src/bin.ts"],"names":["__dirname","OUTPUT_PATH","ModelSchema","z","SnapshotSchema","round6","per1m","fmt","vendorOf","serializeEntry","serializeFile","LEDGER_ID","generate","sources","dirname","fileURLToPath","catalogSyncDir","resolve","join","existsSync","readFileSync","files","changed"],"mappings":";;;;;;;;;;;;;;;AAsDO,SAAS,gBAAgB,CAAA,E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AO,KAAA;AAAA,IACb,CAAA,wBAAA,EAA2B,WAAW,MAAM,CAAA,eAAA,EAAkB,OAAO,IAAA,CAAK,KAAK,EAAE,MAAM,CAAA;AAAA;AAAA,GACzF;AACA,EAAA,OAAA,CAAQ,KAAK,CAAC,CAAA;AAChB;AAEA,IAAI,OAAA,CAAQ,SAAS,CAAA,EAAG;AACtB,EAAA,OAAA,CAAQ,MAAA,CAAO,KAAA,CAAM,CAAA,oBAAA,EAAuB,OAAA,CAAQ,MAAM,CAAA;AAAA,CAAa,CAAA;AACvE,EAAA,KAAA,MAAW,KAAK,OAAA,EAAS,OAAA,CAAQ,MAAA,CAAO,KAAA,CAAM,KAAK,CAAC;AAAA,CAAI,CAAA;AAC1D,CAAA,MAAO;AACL,EAAA,OAAA,CAAQ,OAAO,KAAA,CAAM,CAAA;AAAA,CAA6B,CAAA;AACpD;AACA,OAAA,CAAQ,KAAK,CAAC,CAAA","file":"bin.mjs","sourcesContent":["/**\n * catalog-sync generator contract.\n *\n * FROZEN — a sibling agent builds provider generators against this surface.\n * Do not change field names, shapes, or the `defineGenerator` signature\n * without coordinating. Adding new generators is the expected extension\n * path; editing this file is not.\n */\n\nexport interface CatalogSource {\n id: string\n url: string\n /** HTTP method for the live (`--refresh`) fetch. Default `\"GET\"`. */\n method?: \"GET\" | \"POST\"\n /**\n * Request headers for the live fetch. A value may embed `env:VAR_NAME`\n * tokens, resolved from `process.env` at fetch time (e.g.\n * `{ \"xi-api-key\": \"env:ELEVENLABS_API_KEY\" }` or\n * `{ Authorization: \"Bearer env:MINIMAX_API_KEY\" }`). If any referenced env\n * var is unset, the source is treated as un-refreshable — the committed\n * snapshot is reused rather than fetched without auth. Offline reads\n * (default, no `--refresh`) ignore headers entirely.\n */\n headers?: Record<string, string>\n /** JSON request body for POST sources (e.g. MiniMax `get_voice`). */\n body?: unknown\n}\n\nexport interface GeneratorContext {\n /**\n * Reads the pinned snapshot at `snapshots/<src.id>.json`; if missing and\n * `refresh=true`, fetches `src.url` and writes the snapshot. Returns\n * parsed JSON.\n *\n * Offline by default: when no snapshot exists and `refresh` is false this\n * throws — generators MUST be runnable without network access so CI and\n * tests are deterministic. The only network path is behind `--refresh`.\n */\n fetchSource(src: CatalogSource): Promise<unknown>\n refresh: boolean\n}\n\n/** Repo-relative path → TS source text. */\nexport type GeneratedFiles = Record<string, string>\n\nexport interface CatalogGenerator {\n /** e.g. \"llm:openrouter\" */\n name: string\n modality: \"llm\" | \"image\" | \"video\" | \"audio\" | \"voice\"\n sources: CatalogSource[]\n generate(ctx: GeneratorContext): Promise<GeneratedFiles>\n}\n\n/** Identity helper — lets a generator module declare itself with type inference. */\nexport function defineGenerator(g: CatalogGenerator): CatalogGenerator {\n return g\n}\n","/**\n * `addedAt` ledger — tracks, per generator, the ISO date each model id was\n * FIRST seen by a sync run. See `README.md` (\"addedAt convention\") for the\n * full contract; this module is the mechanism.\n *\n * Invariant: once an id has a ledger entry, that date is NEVER overwritten —\n * not even if the source's own `created` timestamp for that id later\n * resolves to something different (a provider backdating/correcting its own\n * metadata must not rewrite catalog history). New ids are backfilled from\n * the source's own creation timestamp when it has one, else stamped with\n * the current run's date.\n *\n * Ledger entries are never dropped when an id disappears from a run — the\n * ledger records \"first ever seen\", not \"currently present\". A model that\n * vanishes from a provider's list and later reappears keeps its original\n * `addedAt` rather than looking newly added.\n *\n * Each generator owns one ledger file, committed at\n * `packages/catalog-sync/ledger/<generator-id>.json` (id → ISO date, sorted\n * keys, deterministic serialization) — included as a normal entry in the\n * generator's `GeneratedFiles` return value, so `runner.ts`'s existing\n * diff/write logic covers it for free (including `--check` drift detection).\n */\n\nimport { existsSync, readFileSync } from \"node:fs\"\nimport { dirname, join, resolve } from \"node:path\"\nimport { fileURLToPath } from \"node:url\"\n\nconst __dirname = dirname(fileURLToPath(import.meta.url))\n\n/** The catalog-sync package directory — see `runner.ts`'s `catalogSyncDir`. */\nfunction catalogSyncDir(): string {\n return resolve(__dirname, \"..\")\n}\n\n/** Absolute path to a generator's committed addedAt ledger. */\nexport function ledgerAbsPath(ledgerId: string): string {\n return join(catalogSyncDir(), \"ledger\", `${ledgerId}.json`)\n}\n\n/** Repo-relative path for a ledger — for inclusion in a generator's `GeneratedFiles`. */\nexport function ledgerRelPath(ledgerId: string): string {\n return `packages/catalog-sync/ledger/${ledgerId}.json`\n}\n\nexport type AddedAtLedger = Record<string, string>\n\n/** Reads a committed ledger from disk. Missing/unparseable → empty ledger. */\nexport function readLedger(ledgerId: string): AddedAtLedger {\n const path = ledgerAbsPath(ledgerId)\n if (!existsSync(path)) return {}\n try {\n const parsed: unknown = JSON.parse(readFileSync(path, \"utf8\"))\n if (!parsed || typeof parsed !== \"object\" || Array.isArray(parsed)) return {}\n return parsed as AddedAtLedger\n } catch {\n return {}\n }\n}\n\n/** Deterministic (sorted-key) JSON serialization, matching the `*.generated.ts` style of a trailing newline. */\nexport function serializeLedger(ledger: AddedAtLedger): string {\n const sorted: AddedAtLedger = {}\n for (const id of Object.keys(ledger).sort()) sorted[id] = ledger[id]!\n return `${JSON.stringify(sorted, null, 2)}\\n`\n}\n\n/**\n * Merge the current run's ids into a ledger.\n *\n * - id already in `previous` → keep the existing stamp verbatim (never\n * mutated), regardless of what `createdAt` says this run.\n * - id new to the ledger, source has a native creation timestamp for it →\n * backfill with `createdAt[id]`.\n * - id new to the ledger, no native timestamp → stamp with `today`.\n * - ids in `previous` but absent from `currentIds` this run are kept as-is\n * (see module doc comment — the ledger is \"first ever seen\").\n */\nexport function computeAddedAtLedger(\n currentIds: readonly string[],\n previous: AddedAtLedger,\n createdAt: Readonly<Record<string, string>>,\n today: string\n): AddedAtLedger {\n const next: AddedAtLedger = { ...previous }\n for (const id of currentIds) {\n if (next[id] !== undefined) continue\n next[id] = createdAt[id] ?? today\n }\n return next\n}\n\n/** Today's date as `YYYY-MM-DD`, in UTC. */\nexport function todayIso(): string {\n return new Date().toISOString().slice(0, 10)\n}\n\n/** Converts a provider's Unix-seconds creation timestamp to `YYYY-MM-DD`. */\nexport function isoDateFromUnixSeconds(seconds: number): string {\n return new Date(seconds * 1000).toISOString().slice(0, 10)\n}\n","import { z } from \"zod\"\n\nimport { defineGenerator, type GeneratedFiles, type GeneratorContext } from \"../types.js\"\nimport {\n computeAddedAtLedger,\n isoDateFromUnixSeconds,\n ledgerRelPath,\n readLedger,\n serializeLedger,\n todayIso,\n} from \"../added-at.js\"\n\n/**\n * PINNED source. The OpenRouter `/api/v1/models` payload lists every route\n * the router exposes with per-token USD pricing. We never fetch it at build\n * or test time — only behind `--refresh`, which writes\n * `snapshots/llm-openrouter.json` so the next offline run is deterministic.\n */\nconst OPENROUTER_MODELS_URL = \"https://openrouter.ai/api/v1/models\"\n\n/** Repo-relative drop-in target for {@link @agentproto/model-catalog}. */\nconst OUTPUT_PATH = \"packages/model-catalog/src/llm/openrouter-routes.generated.ts\"\n\n// ── Source schema ────────────────────────────────────────────────────────\n// OpenRouter prices are STRINGS of USD-per-token (e.g. \"0.000003\" = $3/1M).\n// `input_cache_read` / `input_cache_write` are optional and only present for\n// models that support prompt caching (Anthropic, etc.). These are the REAL\n// OpenRouter field names (verified against the live /v1/models payload) — an\n// earlier draft used `cache_read`/`cache_write`, which never matched, so cache\n// multipliers were silently always absent. passthrough() keeps the other live\n// keys (web_search, image, audio, internal_reasoning, input_cache_write_1h)\n// forward-compatible without a regenerate — we only read what we model.\n\nconst PricingSchema = z\n .object({\n prompt: z.string().optional(),\n completion: z.string().optional(),\n input_cache_read: z.string().optional(),\n input_cache_write: z.string().optional(),\n })\n .passthrough()\n\n// `created` is Unix seconds — OpenRouter's own route-creation timestamp,\n// used to backfill `addedAt` for ids not already in the ledger (see\n// `../added-at.ts`). Verified present on the live payload (2026-08-31).\nconst ModelSchema = z\n .object({\n id: z.string(),\n pricing: PricingSchema.optional(),\n created: z.number().optional(),\n })\n .passthrough()\n\nconst SnapshotSchema = z.object({\n data: z.array(ModelSchema),\n})\n\n// ── Output shape (mirrors model-catalog's LLMPricing) ────────────────────\n// Drop-in for `packages/model-catalog/src/llm/openrouter-routes.generated.ts`.\n// Structurally identical to LLMPricing — inputPer1M / outputPer1M in USD per\n// 1M tokens, plus cacheReadMultiplier / cacheWriteMultiplier WHEN the source\n// carries cache_read / cache_write. The existing committed file omits cache\n// fields; this generator emits them when present (per the P3 spec: \"plus\n// cache fields if the source has them\"). Fields are optional on LLMPricing,\n// so the output remains drop-in compatible.\n\ninterface LLMPricingEntry {\n inputPer1M: number\n outputPer1M: number\n cacheReadMultiplier?: number\n cacheWriteMultiplier?: number\n /** ISO date this id was first seen by a sync run. See `../added-at.ts`. */\n addedAt?: string\n vendor: string\n provider: \"openrouter\"\n}\n\n// ── Number helpers ──────────────────────────────────────────────────────\n\n/** Round to 6 decimal places, killing binary-float noise from the per-token × 1e6 product. */\nfunction round6(n: number): number {\n return Math.round(n * 1_000_000) / 1_000_000\n}\n\n/** Convert a per-token USD string to USD-per-1M-tokens, or undefined if unpriced. */\nfunction per1m(tokenPrice: string | undefined): number | undefined {\n if (tokenPrice === undefined) return undefined\n const n = Number(tokenPrice)\n if (!Number.isFinite(n)) return undefined\n return round6(n * 1_000_000)\n}\n\n/** Shortest faithful decimal string (matches existing file: 1, 0.5, 0.7448, 1.25). */\nfunction fmt(n: number): string {\n if (!Number.isFinite(n)) return \"0\"\n return `${round6(n)}`\n}\n\n/** Vendor slug = first segment of the OpenRouter route id (`vendor/model`). */\nfunction vendorOf(id: string): string {\n if (!id.includes(\"/\")) return id\n return id.split(\"/\")[0] ?? id\n}\n\n// ── Serialization ────────────────────────────────────────────────────────\n\nfunction serializeEntry(e: LLMPricingEntry): string {\n const fields: string[] = [\n `inputPer1M: ${fmt(e.inputPer1M)}`,\n `outputPer1M: ${fmt(e.outputPer1M)}`,\n ]\n if (e.cacheReadMultiplier !== undefined) {\n fields.push(`cacheReadMultiplier: ${fmt(e.cacheReadMultiplier)}`)\n }\n if (e.cacheWriteMultiplier !== undefined) {\n fields.push(`cacheWriteMultiplier: ${fmt(e.cacheWriteMultiplier)}`)\n }\n if (e.addedAt !== undefined) {\n fields.push(`addedAt: ${JSON.stringify(e.addedAt)}`)\n }\n fields.push(`vendor: ${JSON.stringify(e.vendor)}`)\n fields.push(`provider: ${JSON.stringify(e.provider)}`)\n return `{\\n ${fields.join(\",\\n \")},\\n }`\n}\n\nfunction serializeFile(entries: Record<string, LLMPricingEntry>): string {\n const ids = Object.keys(entries).sort()\n const providers = Array.from(new Set(ids.map(vendorOf))).sort()\n\n const lines: string[] = [\n \"// AUTO-GENERATED by @agentproto/catalog-sync (llm:openrouter).\",\n \"// Do not edit by hand — re-run `pnpm --filter @agentproto/catalog-sync generate`.\",\n `// Source: ${OPENROUTER_MODELS_URL}`,\n \"// Pricing carries provider USD (inputPer1M / outputPer1M) plus cache\",\n \"// multipliers (cacheReadMultiplier / cacheWriteMultiplier) derived from the\",\n \"// source's input_cache_read / input_cache_write per-token fields when present.\",\n \"// addedAt is the ISO date this id was first seen by a sync run — backfilled\",\n \"// from the source's own `created` timestamp, then NEVER mutated; see\",\n \"// packages/catalog-sync/src/added-at.ts and the package README.\",\n \"\",\n 'import type { LLMPricing } from \"./catalog.js\"',\n \"\",\n \"export const OPENROUTER_ROUTES: Record<string, LLMPricing> = {\",\n ]\n for (const id of ids) {\n lines.push(` ${JSON.stringify(id)}: ${serializeEntry(entries[id]!)},`)\n }\n lines.push(\"}\")\n lines.push(\"\")\n lines.push(\"/** Provider slugs treated as OpenRouter routes by the picker. */\")\n lines.push(\"export const OPENROUTER_PROVIDERS: readonly string[] = [\")\n for (const p of providers) {\n lines.push(` ${JSON.stringify(p)},`)\n }\n lines.push(\"]\")\n lines.push(\"\")\n return lines.join(\"\\n\")\n}\n\n// ── Generator ───────────────────────────────────────────────────────────\n\nconst LEDGER_ID = \"llm-openrouter\"\n\nasync function generate(ctx: GeneratorContext): Promise<GeneratedFiles> {\n const src = sources[0]\n if (!src) throw new Error(\"llm:openrouter: no source configured\")\n const parsed = SnapshotSchema.parse(await ctx.fetchSource(src))\n\n const entries: Record<string, LLMPricingEntry> = {}\n const createdAt: Record<string, string> = {}\n for (const model of parsed.data) {\n const pricing = model.pricing\n if (!pricing) continue\n const inputPer1M = per1m(pricing.prompt)\n const outputPer1M = per1m(pricing.completion)\n if (inputPer1M === undefined || outputPer1M === undefined) continue\n // Skip unpriced routes (e.g. openrouter/auto, which carries \"0\" pricing).\n if (inputPer1M === 0 && outputPer1M === 0) continue\n\n const entry: LLMPricingEntry = {\n inputPer1M,\n outputPer1M,\n vendor: vendorOf(model.id),\n provider: \"openrouter\",\n }\n\n const cacheReadPer1M = per1m(pricing.input_cache_read)\n const cacheWritePer1M = per1m(pricing.input_cache_write)\n if (cacheReadPer1M !== undefined && cacheReadPer1M > 0 && inputPer1M > 0) {\n entry.cacheReadMultiplier = round6(cacheReadPer1M / inputPer1M)\n }\n if (cacheWritePer1M !== undefined && cacheWritePer1M > 0 && inputPer1M > 0) {\n entry.cacheWriteMultiplier = round6(cacheWritePer1M / inputPer1M)\n }\n\n entries[model.id] = entry\n if (model.created !== undefined) createdAt[model.id] = isoDateFromUnixSeconds(model.created)\n }\n\n const ledger = computeAddedAtLedger(\n Object.keys(entries),\n readLedger(LEDGER_ID),\n createdAt,\n todayIso()\n )\n for (const [id, entry] of Object.entries(entries)) entry.addedAt = ledger[id]\n\n return {\n [OUTPUT_PATH]: serializeFile(entries),\n [ledgerRelPath(LEDGER_ID)]: serializeLedger(ledger),\n }\n}\n\nconst sources = [{ id: \"llm-openrouter\", url: OPENROUTER_MODELS_URL }]\n\nexport const llmOpenRouterGenerator = defineGenerator({\n name: \"llm:openrouter\",\n modality: \"llm\",\n sources,\n generate,\n})\n","import { z } from \"zod\"\n\nimport { defineGenerator, type GeneratedFiles, type GeneratorContext } from \"../types.js\"\nimport {\n computeAddedAtLedger,\n isoDateFromUnixSeconds,\n ledgerRelPath,\n readLedger,\n serializeLedger,\n todayIso,\n} from \"../added-at.js\"\n\n/**\n * PINNED source. The Requesty `/v1/models` payload lists every route the\n * router exposes with per-token USD pricing. We never fetch it at build or\n * test time — only behind `--refresh`, which writes\n * `snapshots/llm-requesty.json` so the next offline run is deterministic.\n * Live fetch requires `Authorization: Bearer $REQUESTY_API_KEY` (see\n * `sources` below) — without the key set, the framework reuses the\n * committed snapshot rather than fetching unauthenticated.\n */\nconst REQUESTY_MODELS_URL = \"https://router.requesty.ai/v1/models\"\n\n/** Repo-relative drop-in target for {@link @agentproto/model-catalog}. */\nconst OUTPUT_PATH = \"packages/model-catalog/src/llm/requesty-routes.generated.ts\"\n\n// ── Source schema ────────────────────────────────────────────────────────\n// UNLIKE OpenRouter, Requesty prices are JSON **numbers** in USD-PER-TOKEN\n// (e.g. `4e-7` = $0.40/1M), not strings, and live flat on the model entry\n// rather than nested under a `pricing` object. `cached_price` is a cache\n// READ price (no cache-write price exists in this source — we never emit\n// `cacheWriteMultiplier`). `supports_caching` gates whether `cached_price`\n// is actually meaningful: some entries carry a non-zero `cached_price` with\n// `supports_caching: false` (cache pricing published but not offered), so\n// the multiplier must only be derived when the flag is true. passthrough()\n// keeps the other live keys (context_window, supports_vision, description,\n// …) forward-compatible without a regenerate — we only read what we model.\n\n// `created` is Unix seconds — Requesty's own route-creation timestamp, used\n// to backfill `addedAt` for ids not already in the ledger (see\n// `../added-at.ts`). Verified present on the live payload (2026-08-31).\nconst ModelSchema = z\n .object({\n id: z.string(),\n input_price: z.number().optional(),\n output_price: z.number().optional(),\n cached_price: z.number().optional(),\n supports_caching: z.boolean().optional(),\n created: z.number().optional(),\n })\n .passthrough()\n\nconst SnapshotSchema = z.object({\n data: z.array(ModelSchema),\n})\n\n// ── Output shape (mirrors model-catalog's LLMPricing) ────────────────────\n// Drop-in for `packages/model-catalog/src/llm/requesty-routes.generated.ts`.\n// Structurally identical to LLMPricing — inputPer1M / outputPer1M in USD per\n// 1M tokens, plus cacheReadMultiplier when the source carries a meaningful\n// `cached_price`. No `cacheWriteMultiplier` — Requesty has no cache-write\n// price to derive one from.\n\ninterface LLMPricingEntry {\n inputPer1M: number\n outputPer1M: number\n cacheReadMultiplier?: number\n /** ISO date this id was first seen by a sync run. See `../added-at.ts`. */\n addedAt?: string\n vendor: string\n provider: \"requesty\"\n}\n\n// ── Number helpers ──────────────────────────────────────────────────────\n\n/** Round to 6 decimal places, killing binary-float noise from the per-token × 1e6 product. */\nfunction round6(n: number): number {\n return Math.round(n * 1_000_000) / 1_000_000\n}\n\n/**\n * Convert a per-token USD number to USD-per-1M-tokens, or undefined if\n * unpriced. UNLIKE OpenRouter (per-token USD strings), Requesty already\n * gives per-token USD as a JSON number, so there's no `Number(...)` parse\n * step — just the same ×1e6 + round6 normalization.\n */\nfunction per1m(tokenPrice: number | undefined): number | undefined {\n if (tokenPrice === undefined) return undefined\n if (!Number.isFinite(tokenPrice)) return undefined\n return round6(tokenPrice * 1_000_000)\n}\n\n/** Shortest faithful decimal string (matches existing file: 1, 0.5, 0.7448, 1.25). */\nfunction fmt(n: number): string {\n if (!Number.isFinite(n)) return \"0\"\n return `${round6(n)}`\n}\n\n/** Vendor slug = first segment of the Requesty route id (`vendor/model`). */\nfunction vendorOf(id: string): string {\n if (!id.includes(\"/\")) return id\n return id.split(\"/\")[0] ?? id\n}\n\n// ── Serialization ────────────────────────────────────────────────────────\n\nfunction serializeEntry(e: LLMPricingEntry): string {\n const fields: string[] = [\n `inputPer1M: ${fmt(e.inputPer1M)}`,\n `outputPer1M: ${fmt(e.outputPer1M)}`,\n ]\n if (e.cacheReadMultiplier !== undefined) {\n fields.push(`cacheReadMultiplier: ${fmt(e.cacheReadMultiplier)}`)\n }\n if (e.addedAt !== undefined) {\n fields.push(`addedAt: ${JSON.stringify(e.addedAt)}`)\n }\n fields.push(`vendor: ${JSON.stringify(e.vendor)}`)\n fields.push(`provider: ${JSON.stringify(e.provider)}`)\n return `{\\n ${fields.join(\",\\n \")},\\n }`\n}\n\nfunction serializeFile(entries: Record<string, LLMPricingEntry>): string {\n const ids = Object.keys(entries).sort()\n const providers = Array.from(new Set(ids.map(vendorOf))).sort()\n\n const lines: string[] = [\n \"// AUTO-GENERATED by @agentproto/catalog-sync (llm:requesty).\",\n \"// Do not edit by hand — re-run `pnpm --filter @agentproto/catalog-sync generate`.\",\n `// Source: ${REQUESTY_MODELS_URL}`,\n \"// Pricing carries provider USD (inputPer1M / outputPer1M) plus a cache\",\n \"// multiplier (cacheReadMultiplier) derived from the source's cached_price\",\n \"// per-token field when `supports_caching` is true. Requesty has no\",\n \"// cache-write price, so cacheWriteMultiplier is never emitted.\",\n \"// addedAt is the ISO date this id was first seen by a sync run — backfilled\",\n \"// from the source's own `created` timestamp, then NEVER mutated; see\",\n \"// packages/catalog-sync/src/added-at.ts and the package README.\",\n \"\",\n 'import type { LLMPricing } from \"./catalog.js\"',\n \"\",\n \"export const REQUESTY_ROUTES: Record<string, LLMPricing> = {\",\n ]\n for (const id of ids) {\n lines.push(` ${JSON.stringify(id)}: ${serializeEntry(entries[id]!)},`)\n }\n lines.push(\"}\")\n lines.push(\"\")\n lines.push(\"/** Provider slugs treated as Requesty routes by the picker. */\")\n lines.push(\"export const REQUESTY_PROVIDERS: readonly string[] = [\")\n for (const p of providers) {\n lines.push(` ${JSON.stringify(p)},`)\n }\n lines.push(\"]\")\n lines.push(\"\")\n return lines.join(\"\\n\")\n}\n\n// ── Generator ───────────────────────────────────────────────────────────\n\nconst LEDGER_ID = \"llm-requesty\"\n\nasync function generate(ctx: GeneratorContext): Promise<GeneratedFiles> {\n const src = sources[0]\n if (!src) throw new Error(\"llm:requesty: no source configured\")\n const parsed = SnapshotSchema.parse(await ctx.fetchSource(src))\n\n const entries: Record<string, LLMPricingEntry> = {}\n const createdAt: Record<string, string> = {}\n for (const model of parsed.data) {\n const inputPer1M = per1m(model.input_price)\n const outputPer1M = per1m(model.output_price)\n if (inputPer1M === undefined || outputPer1M === undefined) continue\n // Skip unpriced routes.\n if (inputPer1M === 0 && outputPer1M === 0) continue\n\n const entry: LLMPricingEntry = {\n inputPer1M,\n outputPer1M,\n vendor: vendorOf(model.id),\n provider: \"requesty\",\n }\n\n if (model.supports_caching === true && inputPer1M > 0) {\n const cachePer1M = per1m(model.cached_price)\n if (cachePer1M !== undefined) {\n entry.cacheReadMultiplier = round6(cachePer1M / inputPer1M)\n }\n }\n\n entries[model.id] = entry\n if (model.created !== undefined) createdAt[model.id] = isoDateFromUnixSeconds(model.created)\n }\n\n const ledger = computeAddedAtLedger(\n Object.keys(entries),\n readLedger(LEDGER_ID),\n createdAt,\n todayIso()\n )\n for (const [id, entry] of Object.entries(entries)) entry.addedAt = ledger[id]\n\n return {\n [OUTPUT_PATH]: serializeFile(entries),\n [ledgerRelPath(LEDGER_ID)]: serializeLedger(ledger),\n }\n}\n\nconst sources = [\n {\n id: \"llm-requesty\",\n url: REQUESTY_MODELS_URL,\n // Live refresh needs the account key (Bearer). Without REQUESTY_API_KEY\n // set, the framework reuses the committed snapshot.\n headers: { Authorization: \"Bearer env:REQUESTY_API_KEY\" },\n },\n]\n\nexport const llmRequestyGenerator = defineGenerator({\n name: \"llm:requesty\",\n modality: \"llm\",\n sources,\n generate,\n})\n","import { z } from \"zod\"\n\nimport { defineGenerator, type GeneratedFiles, type GeneratorContext } from \"../types.js\"\n\n/**\n * PINNED source. The HuggingFace router `/v1/models` payload lists every\n * model the router knows about, each carrying a per-model `providers[]`\n * array — one entry per inference provider currently serving it. We never\n * fetch it at build or test time — only behind `--refresh`, which writes\n * `snapshots/llm-huggingface.json` so the next offline run is deterministic.\n * No auth required — the listing endpoint returns HTTP 200 unauthenticated\n * (verified 2026-07-18).\n */\nconst HUGGINGFACE_MODELS_URL = \"https://router.huggingface.co/v1/models\"\n\n/** Repo-relative drop-in target for {@link @agentproto/model-catalog}. */\nconst OUTPUT_PATH = \"packages/model-catalog/src/llm/huggingface-routes.generated.ts\"\n\n// ── Source schema ────────────────────────────────────────────────────────\n// Every per-provider field except `provider`/`status` is optional — some\n// entries are sparse (provider+status only). `pricing.input`/`pricing.output`\n// are USD-PER-1M-TOKENS NUMBERS (unlike OpenRouter's per-token strings),\n// already at the scale LLMPricing expects — no ×1e6 conversion needed.\n// passthrough() keeps unread live fields (owned_by, architecture, is_free,\n// throughput, …) forward-compatible without a regenerate — we only read\n// what we model.\n\nconst HFProviderSchema = z\n .object({\n provider: z.string(),\n status: z.string(),\n context_length: z.number().optional(),\n pricing: z\n .object({\n input: z.number().optional(),\n output: z.number().optional(),\n })\n .optional(),\n supports_tools: z.boolean().optional(),\n supports_structured_output: z.boolean().optional(),\n })\n .passthrough()\n\nconst HFModelSchema = z\n .object({\n id: z.string(),\n providers: z.array(HFProviderSchema).optional(),\n })\n .passthrough()\n\nconst SnapshotSchema = z.object({\n data: z.array(HFModelSchema),\n})\n\n// ── Output shape (drop-in for model-catalog's route-identity resolver) ────\n\ninterface HuggingFaceRouteProviderEntry {\n provider: string\n status: string\n contextLength?: number\n inputPer1M?: number\n outputPer1M?: number\n supportsTools?: boolean\n supportsStructuredOutput?: boolean\n}\n\ninterface HuggingFaceRouteEntry {\n wireId: string\n providers: HuggingFaceRouteProviderEntry[]\n}\n\n// ── Number helpers ──────────────────────────────────────────────────────\n\n/** Round to 4 decimal places, killing binary-float noise from the source payload. */\nfunction round4(n: number): number {\n return Math.round(n * 10_000) / 10_000\n}\n\n// ── Serialization ────────────────────────────────────────────────────────\n\nfunction serializeProvider(p: HuggingFaceRouteProviderEntry): string {\n const fields: string[] = [\n `provider: ${JSON.stringify(p.provider)}`,\n `status: ${JSON.stringify(p.status)}`,\n ]\n if (p.contextLength !== undefined) fields.push(`contextLength: ${p.contextLength}`)\n if (p.inputPer1M !== undefined) fields.push(`inputPer1M: ${p.inputPer1M}`)\n if (p.outputPer1M !== undefined) fields.push(`outputPer1M: ${p.outputPer1M}`)\n if (p.supportsTools !== undefined) fields.push(`supportsTools: ${p.supportsTools}`)\n if (p.supportsStructuredOutput !== undefined) {\n fields.push(`supportsStructuredOutput: ${p.supportsStructuredOutput}`)\n }\n return ` {\\n ${fields.join(\",\\n \")},\\n }`\n}\n\nfunction serializeEntry(id: string, e: HuggingFaceRouteEntry): string {\n const providerLines = e.providers.map(serializeProvider).join(\",\\n\")\n return [\n ` ${JSON.stringify(id)}: {`,\n ` wireId: ${JSON.stringify(e.wireId)},`,\n ` providers: [`,\n providerLines,\n ` ],`,\n ` },`,\n ].join(\"\\n\")\n}\n\nfunction serializeFile(entries: Record<string, HuggingFaceRouteEntry>): string {\n const ids = Object.keys(entries).sort()\n\n const lines: string[] = [\n \"// AUTO-GENERATED by @agentproto/catalog-sync (llm:huggingface).\",\n \"// Do not edit by hand — re-run `pnpm --filter @agentproto/catalog-sync generate`.\",\n `// Source: ${HUGGINGFACE_MODELS_URL}`,\n \"// Per-model LIVE inference providers from the HuggingFace router. HF wire\",\n \"// ids are case-sensitive and preserved verbatim. Provider entries are\",\n \"// SPARSE on some models — every field below except provider/status is\",\n \"// optional and emitted only when the upstream response carries it. Only\",\n '// providers with status === \"live\" are kept; models with zero live',\n \"// providers are skipped. inputPer1M/outputPer1M are USD per 1M tokens\",\n \"// (HuggingFace router convention — already at that scale, unlike\",\n \"// OpenRouter's per-token strings).\",\n \"\",\n \"export interface HuggingFaceRouteProvider {\",\n \" provider: string\",\n \" status: string\",\n \" contextLength?: number\",\n \" inputPer1M?: number\",\n \" outputPer1M?: number\",\n \" supportsTools?: boolean\",\n \" supportsStructuredOutput?: boolean\",\n \"}\",\n \"\",\n \"export interface HuggingFaceRoute {\",\n \" wireId: string\",\n \" providers: HuggingFaceRouteProvider[]\",\n \"}\",\n \"\",\n \"export const HUGGINGFACE_ROUTES: Record<string, HuggingFaceRoute> = {\",\n ]\n for (const id of ids) {\n lines.push(serializeEntry(id, entries[id]!))\n }\n lines.push(\"}\")\n lines.push(\"\")\n return lines.join(\"\\n\")\n}\n\n// ── Generator ───────────────────────────────────────────────────────────\n\nasync function generate(ctx: GeneratorContext): Promise<GeneratedFiles> {\n const src = sources[0]\n if (!src) throw new Error(\"llm:huggingface: no source configured\")\n const parsed = SnapshotSchema.parse(await ctx.fetchSource(src))\n\n const entries: Record<string, HuggingFaceRouteEntry> = {}\n for (const model of parsed.data) {\n const liveProviders = (model.providers ?? []).filter((p) => p.status === \"live\")\n if (liveProviders.length === 0) continue\n\n const providers: HuggingFaceRouteProviderEntry[] = liveProviders\n .map((p) => {\n const entry: HuggingFaceRouteProviderEntry = {\n provider: p.provider,\n status: p.status,\n }\n if (p.context_length !== undefined) entry.contextLength = p.context_length\n if (p.pricing?.input !== undefined) entry.inputPer1M = round4(p.pricing.input)\n if (p.pricing?.output !== undefined) entry.outputPer1M = round4(p.pricing.output)\n if (p.supports_tools !== undefined) entry.supportsTools = p.supports_tools\n if (p.supports_structured_output !== undefined) {\n entry.supportsStructuredOutput = p.supports_structured_output\n }\n return entry\n })\n .sort((a, b) => a.provider.localeCompare(b.provider))\n\n entries[model.id] = { wireId: model.id, providers }\n }\n\n return { [OUTPUT_PATH]: serializeFile(entries) }\n}\n\nconst sources = [\n {\n id: \"llm-huggingface\",\n url: HUGGINGFACE_MODELS_URL,\n },\n]\n\nexport const llmHuggingfaceGenerator = defineGenerator({\n name: \"llm:huggingface\",\n modality: \"llm\",\n sources,\n generate,\n})\n","/**\n * Native Google/Gemini model ids the catalog-sync pipeline is allowed to\n * emit via the OpenRouter remap (Google's native API is billing-blocked —\n * see `llm-context-windows.ts`), verified against `adapters/gemini/src/index.ts`\n * (`models.allowed`) and the hand-maintained Google rows in\n * `model-catalog/src/llm/catalog.ts` — the two places that would break if a\n * wrong id slipped in. Do not add to this list from OpenRouter data alone;\n * a new entry needs the same cross-check.\n *\n * Plain `.mjs` (no TypeScript syntax) so both `llm-context-windows.ts` (the\n * context-window generator, imported as compiled JS via the `.js` extension\n * per NodeNext resolution) and `scripts/catalog-sync/sync-google.mjs` (a\n * bare `node` script, no TS toolchain) can import the SAME list — a\n * duplicated copy in the `.mjs` script would silently drift from this one.\n */\nexport const GOOGLE_NATIVE_MODEL_IDS = new Set([\n \"gemini-2.5-pro\",\n \"gemini-2.5-flash\",\n \"gemini-2.5-flash-lite\",\n \"gemini-3.5-flash\",\n \"gemini-3.1-pro-preview\",\n \"gemini-3-flash-preview\",\n \"gemini-3.1-flash-lite\",\n])\n","import { z } from \"zod\"\n\nimport { defineGenerator, type CatalogSource, type GeneratedFiles, type GeneratorContext } from \"../types.js\"\nimport { GOOGLE_NATIVE_MODEL_IDS } from \"./google-native-model-ids.mjs\"\n\n/**\n * Context window (max input tokens) + max output tokens, live per model id,\n * for the providers that publish a machine-readable models-list with this\n * data: Anthropic, Groq, xAI, Moonshot, Mistral. This is NOT pricing —\n * Anthropic's `/v1/models` carries no price at all, and Groq/xAI/Mistral\n * pricing units need separate verification before they're trusted for\n * billing; see `LLM_PRICING_CATALOG` / `OPENROUTER_ROUTES` in `catalog.ts`\n * for that.\n *\n * ZAI/Zhipu and OpenAI are deliberately excluded: ZAI's `/v4/models` list\n * returns bare `{id, owned_by, created}` with no context field, and OpenAI\n * has no stable models-list endpoint at all (see `sources/openai.ts`) — both\n * stay hand-maintained until (if ever) they publish one.\n *\n * Google/Gemini — SOURCED FROM OPENROUTER (Google API blocked), ids\n * remapped. The native source, `GET generativelanguage.googleapis.com/\n * v1beta/models` (auth via `x-goog-api-key`), would fit this generator's\n * shape directly, but every Google key available to this sync run 403s with\n * `PERMISSION_DENIED — Lightning dunning decision is deny` (a billing hold\n * on the project, not a missing/invalid key; verified 2026-08-30). Rather\n * than leave Google unsynced, we read `GET openrouter.ai/api/v1/models`\n * (already pinned as the `llm-openrouter` source for the `llm:openrouter`\n * generator — reused here, not re-fetched) and remap its `google/<id>`\n * routes to bare native ids by stripping the `google/` prefix. ONLY ids\n * that exactly match a real native Gemini id already in use elsewhere in\n * this codebase (the `gemini` adapter's `models.allowed` list,\n * `adapters/gemini/src/index.ts`, and the hand-maintained pricing rows in\n * `model-catalog/src/llm/catalog.ts`) are kept — everything else under\n * `google/` on OpenRouter is logged and skipped rather than guessed:\n * `:batch` suffixed routes (a distinct billing surface, not the same model),\n * dated/preview/image/customtools variants with no confirmed native\n * counterpart (e.g. `gemini-3-pro-image`, `gemini-2.5-pro-preview-05-06`,\n * `gemini-3.1-pro-preview-customtools`), non-Gemini families (`gemma-*`,\n * `lyria-*`), and newer Gemini lines OpenRouter carries that aren't yet a\n * confirmed native id here (`gemini-3.6-flash`, `gemini-3.7-flash`).\n * Native-only surfaces (imagen-*, gemini-live*, embedding models) never\n * appear under OpenRouter's `google/` prefix at all, so there is nothing to\n * filter for those — they simply aren't representable via this source.\n * When a working Google key exists, swap this block for a direct\n * `generativelanguage.googleapis.com/v1beta/models` source instead.\n */\n\n/** Repo-relative drop-in target for {@link @agentproto/model-catalog}. */\nconst OUTPUT_PATH = \"packages/model-catalog/src/llm/context-windows.generated.ts\"\n\n// ── Output shape (mirrors ContextWindowEntry in model-catalog's catalog.ts) ──\n\ninterface ContextWindowEntry {\n contextWindow: number\n maxOutput?: number\n displayName?: string\n provider: \"anthropic\" | \"groq\" | \"xai\" | \"moonshot\" | \"mistral\" | \"google\"\n}\n\n// ── Source schemas ───────────────────────────────────────────────────────\n// Each provider's models-list shape, verified against the live payload\n// (2026-07-16). `passthrough()` keeps unrelated fields forward-compatible.\n\nconst AnthropicModelSchema = z\n .object({\n id: z.string(),\n display_name: z.string().optional(),\n max_input_tokens: z.number().optional(),\n max_tokens: z.number().optional(),\n })\n .passthrough()\nconst AnthropicSnapshotSchema = z.object({ data: z.array(AnthropicModelSchema) })\n\nconst GroqModelSchema = z\n .object({\n id: z.string(),\n context_window: z.number().optional(),\n max_completion_tokens: z.number().optional(),\n })\n .passthrough()\nconst GroqSnapshotSchema = z.object({ data: z.array(GroqModelSchema) })\n\n// xAI's `context_length` is `null` for non-text models (e.g. grok-imagine-video).\nconst XaiModelSchema = z\n .object({\n id: z.string(),\n context_length: z.number().nullable().optional(),\n })\n .passthrough()\nconst XaiSnapshotSchema = z.object({ data: z.array(XaiModelSchema) })\n\nconst MoonshotModelSchema = z\n .object({\n id: z.string(),\n context_length: z.number().optional(),\n })\n .passthrough()\nconst MoonshotSnapshotSchema = z.object({ data: z.array(MoonshotModelSchema) })\n\n// Mistral's `name` is NOT a human display name — it's an alias pointing at\n// the canonical dated id (e.g. id `mistral-small-latest`, name\n// `mistral-small-2603`), so it's read only as passthrough, never surfaced as\n// `displayName` (verified against the live payload, 2026-08-30).\nconst MistralModelSchema = z\n .object({\n id: z.string(),\n max_context_length: z.number().optional(),\n })\n .passthrough()\nconst MistralSnapshotSchema = z.object({ data: z.array(MistralModelSchema) })\n\n// OpenRouter's `/api/v1/models` — reused (same source id, same pinned\n// snapshot) from `llm-openrouter.ts`'s own generator. We only read\n// `context_length` and `top_provider.max_completion_tokens`; pricing is\n// deliberately NOT read here (see the module doc comment / generator below).\nconst OpenRouterModelSchema = z\n .object({\n id: z.string(),\n context_length: z.number().nullable().optional(),\n top_provider: z\n .object({ max_completion_tokens: z.number().nullable().optional() })\n .passthrough()\n .optional(),\n })\n .passthrough()\nconst OpenRouterSnapshotSchema = z.object({ data: z.array(OpenRouterModelSchema) })\n\n// ── Serialization ────────────────────────────────────────────────────────\n\nfunction serializeEntry(e: ContextWindowEntry): string {\n const fields: string[] = [`contextWindow: ${e.contextWindow}`]\n if (e.maxOutput !== undefined) fields.push(`maxOutput: ${e.maxOutput}`)\n if (e.displayName !== undefined) fields.push(`displayName: ${JSON.stringify(e.displayName)}`)\n fields.push(`provider: ${JSON.stringify(e.provider)}`)\n return `{ ${fields.join(\", \")} }`\n}\n\nfunction serializeFile(entries: Record<string, ContextWindowEntry>): string {\n const ids = Object.keys(entries).sort()\n const lines: string[] = [\n \"// AUTO-GENERATED by @agentproto/catalog-sync (llm:context-windows).\",\n \"// Do not edit by hand — re-run `pnpm --filter @agentproto/catalog-sync generate --refresh`.\",\n \"// Sources: api.anthropic.com/v1/models, api.groq.com/openai/v1/models,\",\n \"// api.x.ai/v1/models, api.moonshot.ai/v1/models,\",\n \"// api.mistral.ai/v1/models\",\n \"// google entries: SOURCED FROM OPENROUTER (openrouter.ai/api/v1/models),\",\n \"// Google's native API is billing-blocked — ids remapped from\",\n \"// google/<id> to the bare native id; see the generator's module\",\n \"// doc comment for the exact remap + skip rules.\",\n \"// Context window (max input tokens) + max output tokens per live model id.\",\n \"// NOT pricing — see LLM_PRICING_CATALOG / OPENROUTER_ROUTES in catalog.ts.\",\n \"\",\n \"export interface ContextWindowEntry {\",\n \" contextWindow: number\",\n \" maxOutput?: number\",\n \" displayName?: string\",\n ' provider: \"anthropic\" | \"groq\" | \"xai\" | \"moonshot\" | \"mistral\" | \"google\"',\n \"}\",\n \"\",\n \"export const CONTEXT_WINDOWS: Record<string, ContextWindowEntry> = {\",\n ]\n for (const id of ids) {\n lines.push(` ${JSON.stringify(id)}: ${serializeEntry(entries[id]!)},`)\n }\n lines.push(\"}\")\n lines.push(\"\")\n return lines.join(\"\\n\")\n}\n\n// ── Generator ───────────────────────────────────────────────────────────\n\nasync function generate(ctx: GeneratorContext): Promise<GeneratedFiles> {\n const entries: Record<string, ContextWindowEntry> = {}\n\n const anthropicSrc = sources.find(s => s.id === \"llm-anthropic\")\n if (anthropicSrc) {\n const parsed = AnthropicSnapshotSchema.parse(await ctx.fetchSource(anthropicSrc))\n for (const m of parsed.data) {\n if (!m.max_input_tokens || !m.max_tokens) continue\n entries[m.id] = {\n contextWindow: m.max_input_tokens,\n maxOutput: m.max_tokens,\n ...(m.display_name ? { displayName: m.display_name } : {}),\n provider: \"anthropic\",\n }\n }\n\n // Some Anthropic model generations \"age out\" of the live /v1/models\n // listing into a dated-only id (e.g. claude-opus-4-5-20251101) while\n // the bare \"latest\" spelling (claude-opus-4-5) stays a valid, callable\n // back-compat id — just no longer separately listed. Mechanically\n // derive the bare form from every dated entry (strip the trailing\n // -YYYYMMDD), identical to its dated sibling, the same way\n // `scripts/catalog-sync/sync-anthropic.mjs` already does for pricing —\n // this generator has its own independent entries map (context window,\n // not price) and was missing the same derivation, which dropped the\n // bare id from `listNativeModelIds(\"anthropic\")` (and so from every\n // adapter's native model menu) even though it still priced and\n // resolved fine. Skips a bare id that's already a distinct,\n // separately-listed entry (a live, non-aged model should never be\n // silently overwritten).\n for (const [id, entry] of Object.entries(entries)) {\n if (entry.provider !== \"anthropic\") continue\n const bare = id.replace(/-\\d{8}$/, \"\")\n if (bare === id) continue\n if (bare in entries) continue\n entries[bare] = { ...entry }\n }\n }\n\n const groqSrc = sources.find(s => s.id === \"llm-groq\")\n if (groqSrc) {\n const parsed = GroqSnapshotSchema.parse(await ctx.fetchSource(groqSrc))\n for (const m of parsed.data) {\n if (!m.context_window) continue\n entries[m.id] = {\n contextWindow: m.context_window,\n ...(m.max_completion_tokens ? { maxOutput: m.max_completion_tokens } : {}),\n provider: \"groq\",\n }\n }\n }\n\n const xaiSrc = sources.find(s => s.id === \"llm-xai\")\n if (xaiSrc) {\n const parsed = XaiSnapshotSchema.parse(await ctx.fetchSource(xaiSrc))\n for (const m of parsed.data) {\n if (!m.context_length) continue\n entries[m.id] = { contextWindow: m.context_length, provider: \"xai\" }\n }\n }\n\n const moonshotSrc = sources.find(s => s.id === \"llm-moonshot\")\n if (moonshotSrc) {\n const parsed = MoonshotSnapshotSchema.parse(await ctx.fetchSource(moonshotSrc))\n for (const m of parsed.data) {\n if (!m.context_length) continue\n entries[m.id] = { contextWindow: m.context_length, provider: \"moonshot\" }\n }\n }\n\n const mistralSrc = sources.find(s => s.id === \"llm-mistral\")\n if (mistralSrc) {\n const parsed = MistralSnapshotSchema.parse(await ctx.fetchSource(mistralSrc))\n for (const m of parsed.data) {\n if (!m.max_context_length) continue\n entries[m.id] = { contextWindow: m.max_context_length, provider: \"mistral\" }\n }\n }\n\n // Google/Gemini via OpenRouter (see module doc comment for the \"why\").\n const googleSrc = sources.find(s => s.id === \"llm-openrouter\")\n if (googleSrc) {\n const parsed = OpenRouterSnapshotSchema.parse(await ctx.fetchSource(googleSrc))\n for (const m of parsed.data) {\n if (!m.id.startsWith(\"google/\")) continue\n const nativeId = m.id.slice(\"google/\".length)\n if (m.id.includes(\":\")) {\n console.error(\n `llm:context-windows: skipping \"${m.id}\" — \":\"-suffixed batch route, ` +\n `not the same billing surface as the base model.`\n )\n continue\n }\n if (!GOOGLE_NATIVE_MODEL_IDS.has(nativeId)) {\n console.error(\n `llm:context-windows: skipping \"${m.id}\" — no confirmed native Gemini ` +\n `id \"${nativeId}\" (see GOOGLE_NATIVE_MODEL_IDS); not guessing the remap.`\n )\n continue\n }\n if (!m.context_length) continue\n entries[nativeId] = {\n contextWindow: m.context_length,\n ...(m.top_provider?.max_completion_tokens\n ? { maxOutput: m.top_provider.max_completion_tokens }\n : {}),\n provider: \"google\",\n }\n }\n }\n\n return { [OUTPUT_PATH]: serializeFile(entries) }\n}\n\nconst sources: CatalogSource[] = [\n {\n id: \"llm-anthropic\",\n url: \"https://api.anthropic.com/v1/models?limit=1000\",\n headers: {\n \"x-api-key\": \"env:ANTHROPIC_API_KEY\",\n \"anthropic-version\": \"2023-06-01\",\n },\n },\n {\n id: \"llm-groq\",\n url: \"https://api.groq.com/openai/v1/models\",\n headers: { Authorization: \"Bearer env:GROQ_API_KEY\" },\n },\n {\n id: \"llm-xai\",\n url: \"https://api.x.ai/v1/models\",\n headers: { Authorization: \"Bearer env:XAI_API_KEY\" },\n },\n {\n id: \"llm-moonshot\",\n url: \"https://api.moonshot.ai/v1/models\",\n headers: { Authorization: \"Bearer env:MOONSHOT_API_KEY\" },\n },\n {\n id: \"llm-mistral\",\n url: \"https://api.mistral.ai/v1/models\",\n headers: { Authorization: \"Bearer env:MISTRAL_API_KEY\" },\n },\n // Google via OpenRouter (no Google key needed — see module doc comment).\n // Same source id/url as `llm-openrouter.ts`'s own generator, so both share\n // the one pinned `snapshots/llm-openrouter.json` instead of fetching twice.\n {\n id: \"llm-openrouter\",\n url: \"https://openrouter.ai/api/v1/models\",\n },\n]\n\nexport const llmContextWindowsGenerator = defineGenerator({\n name: \"llm:context-windows\",\n modality: \"llm\",\n sources,\n generate,\n})\n","/**\n * Shared CatalogVoice[] → TS-source serializer for the voice generators.\n *\n * The mapping (raw provider JSON → CatalogVoice) lives in\n * `@agentproto/model-catalog/providers` so build time and runtime share it;\n * this module only turns the mapped voices into a committed `*.generated.ts`.\n * Field emit order is fixed (matches the historical generator output) so the\n * generated file stays diff-stable across runs.\n */\n\nimport type { CatalogVoice } from \"@agentproto/model-catalog/schema/voice\"\n\nfunction serializeVoice(v: CatalogVoice): string {\n const lines: string[] = [\" {\"]\n lines.push(` catalogId: ${JSON.stringify(v.catalogId)},`)\n lines.push(` providerVoiceId: ${JSON.stringify(v.providerVoiceId)},`)\n lines.push(` provider: ${JSON.stringify(v.provider)},`)\n lines.push(` label: ${JSON.stringify(v.label)},`)\n lines.push(` description: ${JSON.stringify(v.description)},`)\n lines.push(` gender: ${JSON.stringify(v.gender)},`)\n lines.push(` primaryLanguage: ${JSON.stringify(v.primaryLanguage)},`)\n lines.push(\n ` supportedLanguages: [${v.supportedLanguages.map(l => JSON.stringify(l)).join(\", \")}],`,\n )\n if (v.quality !== undefined) lines.push(` quality: ${JSON.stringify(v.quality)},`)\n if (v.featured !== undefined) lines.push(` featured: ${v.featured},`)\n if (v.samplePath !== undefined) lines.push(` samplePath: ${JSON.stringify(v.samplePath)},`)\n if (v.age !== undefined) lines.push(` age: ${JSON.stringify(v.age)},`)\n lines.push(\" },\")\n return lines.join(\"\\n\")\n}\n\n/**\n * Render a full generated voice module.\n *\n * @param generatorName e.g. `voice:elevenlabs` (goes in the header comment)\n * @param exportName e.g. `ELEVENLABS_VOICES`\n * @param voices mapped voices, in emit order\n */\nexport function serializeVoiceModule(\n generatorName: string,\n exportName: string,\n voices: readonly CatalogVoice[],\n): string {\n const lines: string[] = [\n `// Generated by @agentproto/catalog-sync generator ${generatorName}`,\n \"// DO NOT EDIT MANUALLY — regenerate with catalog-sync\",\n \"\",\n 'import type { CatalogVoice } from \"@agentproto/model-catalog/schema/voice\"',\n \"\",\n `export const ${exportName}: readonly CatalogVoice[] = [`,\n ]\n for (const v of voices) lines.push(serializeVoice(v))\n lines.push(\"] as const\")\n lines.push(\"\")\n return lines.join(\"\\n\")\n}\n","/**\n * voice-elevenlabs generator — reads the ElevenLabs /v1/voices snapshot and\n * emits a CatalogVoice[]-shaped generated TS file.\n *\n * The raw → CatalogVoice mapping lives in\n * `@agentproto/model-catalog/providers` (shared with the runtime\n * live-on-setup path); this generator only fetches, validates, and\n * serializes. Provider-native ids only; no product-specific aliases.\n */\n\nimport {\n ElevenLabsVoicesSnapshotSchema,\n mapElevenLabsVoices,\n} from \"@agentproto/model-catalog/providers\"\n\nimport type {\n CatalogGenerator,\n CatalogSource,\n GeneratedFiles,\n GeneratorContext,\n} from \"../types.js\"\nimport { defineGenerator } from \"../types.js\"\nimport { serializeVoiceModule } from \"./serialize-voices.js\"\n\n// `id` MUST match the snapshot filename stem — the framework's\n// `ctx.fetchSource` resolves `snapshots/<id>.json` (and is the single,\n// dist-safe reader; generators never touch the filesystem themselves).\nexport const ELEVENLABS_SOURCE: CatalogSource = {\n id: \"voice-elevenlabs\",\n url: \"https://api.elevenlabs.io/v1/voices\",\n // Live refresh needs the account key; offline reads ignore this.\n headers: { \"xi-api-key\": \"env:ELEVENLABS_API_KEY\" },\n}\n\nconst OUTPUT_PATH = \"packages/catalog-sync/generated/voice-elevenlabs.generated.ts\"\n\nexport const voiceElevenlabs: CatalogGenerator = defineGenerator({\n name: \"voice:elevenlabs\",\n modality: \"voice\",\n sources: [ELEVENLABS_SOURCE],\n\n async generate(ctx: GeneratorContext): Promise<GeneratedFiles> {\n // Snapshot-first (refresh re-fetches) — both handled by the framework.\n const snapshot = ElevenLabsVoicesSnapshotSchema.parse(\n await ctx.fetchSource(ELEVENLABS_SOURCE),\n )\n const voices = mapElevenLabsVoices(snapshot)\n return {\n [OUTPUT_PATH]: serializeVoiceModule(\n \"voice:elevenlabs\",\n \"ELEVENLABS_VOICES\",\n voices,\n ),\n }\n },\n})\n","/**\n * voice-minimax generator — reads the MiniMax /v1/get_voice snapshot and\n * emits a CatalogVoice[]-shaped generated TS file.\n *\n * The raw → CatalogVoice mapping lives in\n * `@agentproto/model-catalog/providers` (shared with the runtime\n * live-on-setup path); this generator only fetches, validates, and\n * serializes. Provider-native ids only; no product-specific aliases.\n */\n\nimport {\n mapMinimaxVoices,\n MinimaxVoicesSnapshotSchema,\n} from \"@agentproto/model-catalog/providers\"\n\nimport type {\n CatalogGenerator,\n CatalogSource,\n GeneratedFiles,\n GeneratorContext,\n} from \"../types.js\"\nimport { defineGenerator } from \"../types.js\"\nimport { serializeVoiceModule } from \"./serialize-voices.js\"\n\n// `id` MUST match the snapshot filename stem — the framework's\n// `ctx.fetchSource` resolves `snapshots/<id>.json` (single dist-safe reader;\n// generators never touch the filesystem themselves).\nexport const MINIMAX_SOURCE: CatalogSource = {\n id: \"voice-minimax\",\n url: \"https://api.minimax.io/v1/get_voice\",\n // get_voice is a POST; live refresh needs the account key (Bearer). Without\n // MINIMAX_API_KEY set, the framework reuses the committed snapshot.\n method: \"POST\",\n headers: {\n Authorization: \"Bearer env:MINIMAX_API_KEY\",\n \"Content-Type\": \"application/json\",\n },\n body: { voice_type: \"system\" },\n}\n\nconst OUTPUT_PATH = \"packages/catalog-sync/generated/voice-minimax.generated.ts\"\n\nexport const voiceMinimax: CatalogGenerator = defineGenerator({\n name: \"voice:minimax\",\n modality: \"voice\",\n sources: [MINIMAX_SOURCE],\n\n async generate(ctx: GeneratorContext): Promise<GeneratedFiles> {\n // Snapshot-first (refresh re-fetches) — both handled by the framework.\n const snapshot = MinimaxVoicesSnapshotSchema.parse(\n await ctx.fetchSource(MINIMAX_SOURCE),\n )\n const voices = mapMinimaxVoices(snapshot)\n return {\n [OUTPUT_PATH]: serializeVoiceModule(\n \"voice:minimax\",\n \"MINIMAX_VOICES\",\n voices,\n ),\n }\n },\n})\n","/**\n * image-replicate generator — reads a curated Replicate image-models\n * snapshot and emits ImageModelDefinition[]-shaped generated TS entries.\n *\n * Mirrors the shape from packages/model-catalog/src/image/catalog.ts exactly.\n * Provider-native ids only; no product-specific aliases.\n */\n\nimport type {\n CatalogGenerator,\n CatalogSource,\n GeneratedFiles,\n GeneratorContext,\n} from \"../types.js\"\nimport { defineGenerator } from \"../types.js\"\n\n// ── Replicate snapshot shapes ───────────────────────────────────────────\n\ninterface ReplicateOpenApiSchema {\n input: { type: string; properties: Record<string, { type: string; items?: { type: string }; format?: string }> }\n output: { type: string; items?: { type: string; format?: string }; format?: string }\n}\n\ninterface ReplicateLatestVersion {\n id: string\n created_at: string\n openapi_schema: ReplicateOpenApiSchema\n}\n\ninterface ReplicateModel {\n owner: string\n name: string\n description: string\n visibility: string\n run_count: number\n cover_image_url: string | null\n latest_version: ReplicateLatestVersion\n}\n\ninterface ReplicateSnapshot {\n _meta: Record<string, unknown>\n models: ReplicateModel[]\n}\n\n// ── ImageModelDefinition mirror (from packages/model-catalog/src/image/catalog.ts) ──\n\ninterface ImageModelPricing {\n costPerImage: number\n costTier: \"low\" | \"medium\" | \"high\"\n billingUnit: \"per_image\"\n baseCost: number\n creditCost?: number\n overrideCreditCost?: number\n}\n\ninterface ImageModelCapabilities {\n generate: boolean\n edit: boolean\n upscale?: boolean\n}\n\ninterface ImageModelReferenceImages {\n supported: boolean\n fieldName: \"image_input\" | \"input_images\" | \"input_image\" | \"none\"\n maxCount: number\n singular: boolean\n}\n\ninterface ImageModelAspectRatio {\n supported: string[]\n default: string\n}\n\ninterface ImageModelEntry {\n id: string\n name: string\n providerId: string\n provider: string\n capabilities: ImageModelCapabilities\n referenceImages: ImageModelReferenceImages\n aspectRatio: ImageModelAspectRatio\n output: \"string\" | \"array\"\n pricing: ImageModelPricing\n description: string\n agentVisible: boolean\n triggerWord?: string\n}\n\n// ── Pricing (hand-authored, mirrors model-catalog) ──────────────────────\n\ninterface PricingRecord {\n costPerImage: number\n costTier: \"low\" | \"medium\" | \"high\"\n baseCost: number\n creditCost?: number\n overrideCreditCost?: number\n}\n\nconst PRICING: Record<string, PricingRecord> = {\n \"nano-banana-pro\": { costPerImage: 0.15, costTier: \"high\", baseCost: 0.15, creditCost: 10 },\n \"nano-banana-2\": { costPerImage: 0.06, costTier: \"medium\", baseCost: 0.06, creditCost: 5 },\n \"nano-banana\": { costPerImage: 0.04, costTier: \"low\", baseCost: 0.04, creditCost: 5 },\n \"flux-2-dev\": { costPerImage: 0.03, costTier: \"low\", baseCost: 0.03, creditCost: 3 },\n \"flux-kontext-pro\": { costPerImage: 0.04, costTier: \"low\", baseCost: 0.04, creditCost: 5 },\n \"flux-kontext-max\": { costPerImage: 0.08, costTier: \"medium\", baseCost: 0.08, creditCost: 8 },\n \"flux-1.1-pro-ultra\": { costPerImage: 0.06, costTier: \"medium\", baseCost: 0.06, creditCost: 8 },\n \"seedream-4\": { costPerImage: 0.03, costTier: \"low\", baseCost: 0.03, creditCost: 3 },\n \"recraft-v3\": { costPerImage: 0.04, costTier: \"low\", baseCost: 0.04, creditCost: 5 },\n \"image-01\": { costPerImage: 0.02, costTier: \"low\", baseCost: 0.02, creditCost: 2 },\n \"gpt-image-1\": { costPerImage: 0.04, costTier: \"low\", baseCost: 0.04, creditCost: 5 },\n \"ideogram-v3-turbo\": { costPerImage: 0.03, costTier: \"low\", baseCost: 0.03, creditCost: 4 },\n \"flux-1.1-pro\": { costPerImage: 0.04, costTier: \"low\", baseCost: 0.04, creditCost: 5 },\n}\n\n// Models visible to agents (the active generation ones)\nconst AGENT_VISIBLE = new Set([\n \"nano-banana-pro\",\n \"nano-banana-2\",\n \"nano-banana\",\n \"flux-2-dev\",\n \"flux-kontext-pro\",\n \"flux-kontext-max\",\n \"flux-1.1-pro-ultra\",\n \"seedream-4\",\n \"recraft-v3\",\n \"image-01\",\n \"gpt-image-1\",\n \"ideogram-v3-turbo\",\n])\n\nconst ASPECT_RATIOS_DEFAULT: ImageModelAspectRatio = {\n supported: [\"1:1\", \"9:16\", \"16:9\", \"2:3\", \"3:2\", \"3:4\", \"4:3\"],\n default: \"1:1\",\n}\n\nconst ASPECT_RATIOS_WIDE: ImageModelAspectRatio = {\n supported: [\"1:1\", \"9:16\", \"16:9\", \"2:3\", \"3:2\", \"3:4\", \"4:3\", \"4:5\", \"5:4\"],\n default: \"1:1\",\n}\n\nconst ASPECT_RATIOS_ULTRA: ImageModelAspectRatio = {\n supported: [\"1:1\", \"9:16\", \"16:9\", \"21:9\", \"9:21\", \"3:4\", \"4:3\"],\n default: \"1:1\",\n}\n\nconst ASPECT_RATIOS_NBPRO: ImageModelAspectRatio = {\n supported: [\n \"1:1\", \"9:16\", \"16:9\", \"2:3\", \"3:2\", \"3:4\", \"4:3\",\n \"4:5\", \"5:4\", \"21:9\",\n ],\n default: \"match_input_image\",\n}\n\nconst ASPECT_RATIOS_NB2: ImageModelAspectRatio = {\n supported: [\n \"1:1\", \"9:16\", \"16:9\", \"2:3\", \"3:2\", \"3:4\", \"4:3\",\n \"4:5\", \"5:4\",\n ],\n default: \"match_input_image\",\n}\n\nconst ASPECT_RATIOS_SQUARE: ImageModelAspectRatio = {\n supported: [\"1:1\"],\n default: \"1:1\",\n}\n\ninterface ModelSpec {\n id: string\n name: string\n capabilities: ImageModelCapabilities\n referenceImages: ImageModelReferenceImages\n aspectRatio: ImageModelAspectRatio\n output: \"string\" | \"array\"\n triggerWord?: string\n}\n\nconst MODEL_SPECS: Record<string, ModelSpec> = {\n \"nano-banana-pro\": {\n id: \"nano-banana-pro\",\n name: \"Nano Banana Pro\",\n capabilities: { generate: true, edit: true },\n referenceImages: { supported: true, fieldName: \"image_input\", maxCount: 14, singular: false },\n aspectRatio: ASPECT_RATIOS_NBPRO,\n output: \"string\",\n },\n \"nano-banana-2\": {\n id: \"nano-banana-2\",\n name: \"Nano Banana 2\",\n capabilities: { generate: true, edit: true },\n referenceImages: { supported: true, fieldName: \"image_input\", maxCount: 4, singular: false },\n aspectRatio: ASPECT_RATIOS_NB2,\n output: \"string\",\n },\n \"nano-banana\": {\n id: \"nano-banana\",\n name: \"Nano Banana\",\n capabilities: { generate: true, edit: true },\n referenceImages: { supported: true, fieldName: \"image_input\", maxCount: 4, singular: false },\n aspectRatio: ASPECT_RATIOS_DEFAULT,\n output: \"string\",\n },\n \"flux-2-dev\": {\n id: \"flux-2-dev\",\n name: \"Flux 2 Dev\",\n capabilities: { generate: true, edit: true },\n referenceImages: { supported: true, fieldName: \"input_images\", maxCount: 5, singular: false },\n aspectRatio: ASPECT_RATIOS_WIDE,\n output: \"string\",\n },\n \"flux-kontext-pro\": {\n id: \"flux-kontext-pro\",\n name: \"Flux Kontext Pro\",\n capabilities: { generate: true, edit: true },\n referenceImages: { supported: true, fieldName: \"input_image\", maxCount: 1, singular: true },\n aspectRatio: ASPECT_RATIOS_DEFAULT,\n output: \"string\",\n },\n \"flux-kontext-max\": {\n id: \"flux-kontext-max\",\n name: \"Flux Kontext Max\",\n capabilities: { generate: true, edit: true },\n referenceImages: { supported: true, fieldName: \"input_image\", maxCount: 1, singular: true },\n aspectRatio: ASPECT_RATIOS_DEFAULT,\n output: \"string\",\n },\n \"flux-1.1-pro-ultra\": {\n id: \"flux-1.1-pro-ultra\",\n name: \"Flux 1.1 Pro Ultra\",\n capabilities: { generate: true, edit: false },\n referenceImages: { supported: false, fieldName: \"none\", maxCount: 0, singular: false },\n aspectRatio: ASPECT_RATIOS_ULTRA,\n output: \"string\",\n },\n \"seedream-4\": {\n id: \"seedream-4\",\n name: \"SeedReam 4\",\n capabilities: { generate: true, edit: true },\n referenceImages: { supported: true, fieldName: \"image_input\", maxCount: 10, singular: false },\n aspectRatio: ASPECT_RATIOS_DEFAULT,\n output: \"string\",\n },\n \"recraft-v3\": {\n id: \"recraft\",\n name: \"Recraft V3\",\n capabilities: { generate: true, edit: false },\n referenceImages: { supported: false, fieldName: \"none\", maxCount: 0, singular: false },\n aspectRatio: ASPECT_RATIOS_SQUARE,\n output: \"string\",\n },\n \"image-01\": {\n id: \"minimax\",\n name: \"MiniMax Image\",\n capabilities: { generate: true, edit: false },\n referenceImages: { supported: false, fieldName: \"none\", maxCount: 0, singular: false },\n aspectRatio: { supported: [\"1:1\", \"9:16\", \"16:9\", \"3:4\", \"4:3\"], default: \"1:1\" },\n output: \"array\",\n },\n \"gpt-image-1\": {\n id: \"gpt-image-1\",\n name: \"OpenAI GPT Image 1\",\n capabilities: { generate: true, edit: true },\n referenceImages: { supported: true, fieldName: \"input_image\", maxCount: 1, singular: true },\n aspectRatio: { supported: [\"1:1\", \"2:3\", \"3:2\"], default: \"1:1\" },\n output: \"string\",\n },\n \"ideogram-v3-turbo\": {\n id: \"ideogram-v3\",\n name: \"Ideogram v3\",\n capabilities: { generate: true, edit: false },\n referenceImages: { supported: false, fieldName: \"none\", maxCount: 0, singular: false },\n aspectRatio: { supported: [\"1:1\", \"9:16\", \"16:9\", \"2:3\", \"3:2\"], default: \"1:1\" },\n output: \"string\",\n },\n \"flux-1.1-pro\": {\n id: \"flux\",\n name: \"Flux 1.1 Pro\",\n capabilities: { generate: true, edit: false },\n referenceImages: { supported: false, fieldName: \"none\", maxCount: 0, singular: false },\n aspectRatio: { supported: [\"1:1\", \"9:16\", \"16:9\"], default: \"1:1\" },\n output: \"string\",\n },\n}\n\nfunction mapModel(raw: ReplicateModel): ImageModelEntry {\n const providerId = `${raw.owner}/${raw.name}`\n const spec = MODEL_SPECS[raw.name] ?? {\n id: raw.name,\n name: raw.name,\n capabilities: { generate: true, edit: false },\n referenceImages: { supported: false, fieldName: \"none\" as const, maxCount: 0, singular: false },\n aspectRatio: ASPECT_RATIOS_DEFAULT,\n output: \"string\" as const,\n }\n\n const pricing = PRICING[raw.name] ?? {\n costPerImage: 0.03,\n costTier: \"low\" as const,\n baseCost: 0.03,\n creditCost: 3,\n }\n\n return {\n id: spec.id,\n name: spec.name,\n providerId,\n provider: raw.owner === \"openai\" ? \"openai\" : raw.owner === \"minimax\" ? \"minimax\" : \"replicate\",\n capabilities: spec.capabilities,\n referenceImages: spec.referenceImages,\n aspectRatio: spec.aspectRatio,\n output: spec.output,\n pricing: {\n costPerImage: pricing.costPerImage,\n costTier: pricing.costTier,\n billingUnit: \"per_image\" as const,\n baseCost: pricing.baseCost,\n ...(pricing.creditCost !== undefined ? { creditCost: pricing.creditCost } : {}),\n ...(pricing.overrideCreditCost !== undefined ? { overrideCreditCost: pricing.overrideCreditCost } : {}),\n },\n description: raw.description,\n agentVisible: AGENT_VISIBLE.has(raw.name),\n ...(spec.triggerWord ? { triggerWord: spec.triggerWord } : {}),\n }\n}\n\n// ── Generator ────────────────────────────────────────────────────────────\n\n// `id` MUST match the snapshot filename stem — the framework's\n// `ctx.fetchSource` resolves `snapshots/<id>.json` (single dist-safe reader;\n// generators never touch the filesystem themselves).\n// The Replicate models endpoint is authed. Declare the token as an `env:` header\n// token so the runner's missing-env gate (runner.ts `resolveHeaders`) SKIPS the\n// refresh and reuses the committed snapshot when `REPLICATE_API_TOKEN` is absent\n// — exactly like the authed LLM sources (Anthropic/Groq/xAI/Moonshot). Without\n// this a token-less `catalog-sync generate --refresh` fetched unauthenticated,\n// 401'd, and threw — crashing the whole run for anyone (or the weekly Action)\n// without the secret. `--check` never fetches, so it is unaffected.\nexport const REPLICATE_SOURCE: CatalogSource = {\n id: \"image-replicate\",\n url: \"https://api.replicate.com/v1/models?query=image+generation\",\n headers: { Authorization: \"Bearer env:REPLICATE_API_TOKEN\" },\n}\n\nexport const imageReplicate: CatalogGenerator = defineGenerator({\n name: \"image:replicate\",\n modality: \"image\",\n sources: [REPLICATE_SOURCE],\n\n async generate(ctx: GeneratorContext): Promise<GeneratedFiles> {\n // Snapshot-first (refresh re-fetches) — both handled by the framework.\n const data = (await ctx.fetchSource(REPLICATE_SOURCE)) as ReplicateSnapshot\n\n const entries = data.models.map(mapModel)\n\n const lines: string[] = [\n \"// Generated by @agentproto/catalog-sync generator image:replicate\",\n \"// DO NOT EDIT MANUALLY — regenerate with catalog-sync\",\n \"\",\n \"import type { ImageModelDefinition } from \\\"@agentproto/model-catalog/image\\\"\",\n \"\",\n \"export const REPLICATE_IMAGE_MODELS: Record<string, ImageModelDefinition> = {\",\n ]\n\n for (const e of entries) {\n const trigger = e.triggerWord ? `,\\n triggerWord: ${JSON.stringify(e.triggerWord)}` : \"\"\n const creditCost = e.pricing.creditCost !== undefined\n ? `,\\n creditCost: ${e.pricing.creditCost}`\n : \"\"\n const override = e.pricing.overrideCreditCost !== undefined\n ? `,\\n overrideCreditCost: ${e.pricing.overrideCreditCost}`\n : \"\"\n\n lines.push(` ${JSON.stringify(e.id)}: {`)\n lines.push(` id: ${JSON.stringify(e.id)},`)\n lines.push(` name: ${JSON.stringify(e.name)},`)\n lines.push(` providerId: ${JSON.stringify(e.providerId)},`)\n lines.push(` provider: ${JSON.stringify(e.provider)},`)\n lines.push(` capabilities: { generate: ${e.capabilities.generate}, edit: ${e.capabilities.edit}${e.capabilities.upscale ? `, upscale: ${e.capabilities.upscale}` : \"\"} },`)\n lines.push(` referenceImages: {`)\n lines.push(` supported: ${e.referenceImages.supported},`)\n lines.push(` fieldName: ${JSON.stringify(e.referenceImages.fieldName)},`)\n lines.push(` maxCount: ${e.referenceImages.maxCount},`)\n lines.push(` singular: ${e.referenceImages.singular},`)\n lines.push(` },`)\n lines.push(` aspectRatio: {`)\n lines.push(` supported: [${e.aspectRatio.supported.map(a => JSON.stringify(a)).join(\", \")}],`)\n lines.push(` default: ${JSON.stringify(e.aspectRatio.default)},`)\n lines.push(` },`)\n lines.push(` output: ${JSON.stringify(e.output)},`)\n lines.push(` pricing: {`)\n lines.push(` costPerImage: ${e.pricing.costPerImage},`)\n lines.push(` costTier: ${JSON.stringify(e.pricing.costTier)},`)\n lines.push(` billingUnit: ${JSON.stringify(e.pricing.billingUnit)},`)\n lines.push(` baseCost: ${e.pricing.baseCost},${creditCost}${override}`)\n lines.push(` },`)\n lines.push(` description: ${JSON.stringify(e.description)},`)\n lines.push(` agentVisible: ${e.agentVisible},${trigger}`)\n lines.push(` },`)\n }\n\n lines.push(\"}\")\n lines.push(\"\")\n\n const outputPath = \"packages/catalog-sync/generated/image-replicate.generated.ts\"\n return { [outputPath]: lines.join(\"\\n\") }\n },\n})\n","/**\n * `CATALOG-CHANGELOG.md` — a human-readable \"what models changed\" log,\n * distinct from the changesets-driven `CHANGELOG.md` next to it (that's\n * package-version history, one entry per publish). This file answers \"what\n * models did catalog-sync add or remove, and when\" by reading top-to-bottom.\n *\n * Wired into `runner.ts`: every `runGenerators` call diffs each changed\n * `*.generated.ts` file's top-level id keys (before vs after) and, when a\n * run actually adds or removes model ids for at least one generator,\n * APPENDS one dated section (`## YYYY-MM-DD`) with a `### <generator name>`\n * subsection per affected generator. Sections are appended at the END of\n * the file (newest last) — a plain, non-destructive `+=`, so the writer\n * never has to parse and re-emit prior history.\n *\n * A run with no id-level drift (pricing-only changes, or a `--check` with\n * nothing to report) appends NOTHING — no empty section, no touched file,\n * no diff. addedAt ledger files (`ledger/*.json`) are intentionally NOT\n * diffed here — they never lose an id (see `added-at.ts`), so they carry no\n * \"removed\" signal, and every id they'd report as \"added\" is already\n * covered by the generator's own `*.generated.ts` diff.\n */\n\n/** Matches a top-level (2-space-indented) quoted key of a `Record<string, X>` literal. */\nconst RECORD_KEY_RE = /^ {2}\"([^\"]+)\":\\s*\\{/gm\n\n/** Extracts the top-level quoted ids of a generated `Record<string, X>` map. */\nexport function extractRecordIds(source: string): Set<string> {\n const ids = new Set<string>()\n for (const m of source.matchAll(RECORD_KEY_RE)) {\n if (m[1] !== undefined) ids.add(m[1])\n }\n return ids\n}\n\nexport interface ModelIdDiff {\n added: string[]\n removed: string[]\n}\n\n/** Diffs the id sets of a generated file's before/after content. `before` undefined = new file (no removals possible). */\nexport function diffModelIds(before: string | undefined, after: string): ModelIdDiff {\n const beforeIds = before !== undefined ? extractRecordIds(before) : new Set<string>()\n const afterIds = extractRecordIds(after)\n const added = [...afterIds].filter((id) => !beforeIds.has(id)).sort()\n const removed = [...beforeIds].filter((id) => !afterIds.has(id)).sort()\n return { added, removed }\n}\n\nexport interface GeneratorChangelogEntry {\n /** The owning generator's `name` (e.g. `\"llm:openrouter\"`). */\n generator: string\n added: string[]\n removed: string[]\n}\n\n/** Renders a dated section, or `\"\"` when every entry is empty (nothing to report). */\nexport function renderChangelogSection(date: string, entries: readonly GeneratorChangelogEntry[]): string {\n const nonEmpty = entries.filter((e) => e.added.length > 0 || e.removed.length > 0)\n if (nonEmpty.length === 0) return \"\"\n const lines: string[] = [`## ${date}`, \"\"]\n for (const e of nonEmpty) {\n lines.push(`### ${e.generator}`)\n if (e.added.length > 0) lines.push(`- Added: ${e.added.join(\", \")}`)\n if (e.removed.length > 0) lines.push(`- Removed: ${e.removed.join(\", \")}`)\n lines.push(\"\")\n }\n return lines.join(\"\\n\").replace(/\\n+$/, \"\\n\")\n}\n\nexport const CATALOG_CHANGELOG_HEADER = `# Catalog Changelog\n\nHuman-readable log of model additions/removals detected by\n\\`@agentproto/catalog-sync\\` runs — NOT \\`CHANGELOG.md\\` next to it (that one is\nchangesets-driven package-version history). A dated section is appended\nautomatically here whenever a sync run adds or removes model ids; sections\nare appended at the END of the file (newest last). Pricing-only drift (no id\nadded/removed) is not logged here — see the generated files' own git history\nfor that.\n`\n\n/**\n * Appends a new dated section to `existing` changelog content.\n *\n * Returns `undefined` when there is nothing to report (no generator has an\n * added/removed id this run) — the caller should leave the file untouched\n * in that case, not write an unchanged copy.\n */\nexport function appendChangelog(\n existing: string | undefined,\n date: string,\n entries: readonly GeneratorChangelogEntry[]\n): string | undefined {\n const section = renderChangelogSection(date, entries)\n if (section === \"\") return undefined\n const base = existing !== undefined && existing.length > 0 ? existing.replace(/\\n+$/, \"\\n\") : CATALOG_CHANGELOG_HEADER\n return `${base}\\n${section}`\n}\n","import { existsSync, mkdirSync, readFileSync, writeFileSync } from \"node:fs\"\nimport { dirname, join, resolve } from \"node:path\"\nimport { fileURLToPath } from \"node:url\"\n\nimport type {\n CatalogGenerator,\n CatalogSource,\n GeneratedFiles,\n GeneratorContext,\n} from \"./types.js\"\nimport { appendChangelog, diffModelIds, type GeneratorChangelogEntry } from \"./changelog.js\"\nimport { todayIso } from \"./added-at.js\"\n\nconst __dirname = dirname(fileURLToPath(import.meta.url))\n\n/**\n * The catalog-sync package directory. Resolves the same way whether the\n * module is loaded from `src/` (vitest, type-checking) or `dist/` (built) —\n * both sit one level below the package root, so walking up one directory\n * from this file lands on `packages/catalog-sync/`.\n */\nfunction catalogSyncDir(): string {\n return resolve(__dirname, \"..\")\n}\n\n/** Absolute path to a committed/pinned source snapshot. */\nfunction snapshotPath(id: string): string {\n return join(catalogSyncDir(), \"snapshots\", `${id}.json`)\n}\n\n/**\n * The monorepo root. Resolved by walking up from the catalog-sync package\n * until `pnpm-workspace.yaml` is found. Generated-file paths in\n * {@link GeneratedFiles} are repo-relative and are resolved against this.\n */\nfunction repoRoot(): string {\n let dir = catalogSyncDir()\n for (let i = 0; i < 12; i++) {\n if (existsSync(join(dir, \"pnpm-workspace.yaml\"))) return dir\n const parent = dirname(dir)\n if (parent === dir) break\n dir = parent\n }\n // Fallback: catalog-sync lives at <root>/packages/catalog-sync.\n return dirname(dirname(catalogSyncDir()))\n}\n\n/** Reads an existing file as UTF-8, or returns undefined when absent. */\nfunction readIfExists(absPath: string): string | undefined {\n if (!existsSync(absPath)) return undefined\n return readFileSync(absPath, \"utf8\")\n}\n\n/**\n * Resolve `env:VAR_NAME` tokens inside header values from `process.env`.\n * Returns the materialized headers plus the names of any referenced env vars\n * that are unset — the caller uses `missing` to decide whether the source can\n * be refreshed (we never fetch an authed endpoint without its key).\n */\nfunction resolveHeaders(headers?: Record<string, string>): {\n headers: Record<string, string>\n missing: string[]\n} {\n const out: Record<string, string> = {}\n const missing: string[] = []\n if (!headers) return { headers: out, missing }\n for (const [key, value] of Object.entries(headers)) {\n out[key] = value.replace(/env:([A-Z0-9_]+)/g, (_match, name: string) => {\n const v = process.env[name]\n if (v === undefined || v === \"\") {\n missing.push(name)\n return \"\"\n }\n return v\n })\n }\n return { headers: out, missing }\n}\n\n/** Repo-relative path of the human-readable model-add/remove log (see `changelog.ts`). */\nexport const CATALOG_CHANGELOG_PATH = \"packages/model-catalog/CATALOG-CHANGELOG.md\"\n\n/** Generated files whose top-level id keys are worth diffing for the changelog. */\nfunction isChangelogEligible(relPath: string): boolean {\n return relPath.endsWith(\".generated.ts\")\n}\n\nexport interface RunGeneratorsOptions {\n /** When true, missing snapshots are fetched from their pinned `url`. */\n refresh: boolean\n /** When true, generated files are written to disk at their repo-relative path. */\n write: boolean\n}\n\nexport interface RunGeneratorsResult {\n files: GeneratedFiles\n /** Repo-relative paths whose generated content differs from what is on disk. */\n changed: string[]\n}\n\n/**\n * Runs each generator, gathering its emitted files, then (optionally) writes\n * them. `changed` is ALWAYS computed — it is the diff of generated content\n * vs disk — so `--check` (write=false) can surface drift without mutating\n * anything. Writes only happen when `write=true` AND a path differs.\n *\n * Also appends `CATALOG_CHANGELOG_PATH` (see `changelog.ts`) when this run's\n * per-generator diffs add or remove any model id — folded into the same\n * `files`/`changed` bookkeeping as every other generated file, so `--check`\n * catches an un-committed changelog entry too.\n */\nexport async function runGenerators(\n gens: CatalogGenerator[],\n opts: RunGeneratorsOptions\n): Promise<RunGeneratorsResult> {\n const files: GeneratedFiles = {}\n const pathToGenerator: Record<string, string> = {}\n\n for (const gen of gens) {\n const ctx: GeneratorContext = {\n refresh: opts.refresh,\n async fetchSource(src: CatalogSource): Promise<unknown> {\n const path = snapshotPath(src.id)\n const existing = readIfExists(path)\n\n // Offline path (default): reuse the committed snapshot; error if none.\n if (!opts.refresh) {\n if (existing !== undefined) return JSON.parse(existing)\n throw new Error(\n `catalog-sync: no committed snapshot for source \"${src.id}\" ` +\n `(${path}), and --refresh is not set. Run ` +\n `\\`catalog-sync generate --refresh\\` to fetch ${src.url}.`\n )\n }\n\n // --refresh: force a live re-fetch (do NOT short-circuit on an existing\n // snapshot — refreshing is the whole point). Auth headers may embed\n // `env:VAR` tokens; if a referenced var is unset we can't authenticate,\n // so reuse the committed snapshot rather than fetch unauthenticated.\n const { headers, missing } = resolveHeaders(src.headers)\n if (missing.length > 0) {\n if (existing !== undefined) {\n process.stderr.write(\n `catalog-sync: skipping refresh of \"${src.id}\" — missing env ` +\n `${missing.join(\", \")}; reusing committed snapshot.\\n`\n )\n return JSON.parse(existing)\n }\n throw new Error(\n `catalog-sync: cannot refresh \"${src.id}\" — missing env ` +\n `${missing.join(\", \")} and no committed snapshot.`\n )\n }\n const res = await fetch(src.url, {\n method: src.method ?? \"GET\",\n headers,\n ...(src.body !== undefined\n ? { body: JSON.stringify(src.body) }\n : {}),\n })\n if (!res.ok) {\n throw new Error(\n `catalog-sync: fetch ${src.url} failed: ${res.status} ${res.statusText}`\n )\n }\n const text = await res.text()\n const parsed: unknown = JSON.parse(text)\n mkdirSync(dirname(path), { recursive: true })\n writeFileSync(path, `${JSON.stringify(parsed, null, 2)}\\n`, \"utf8\")\n return parsed\n },\n }\n\n const out = await gen.generate(ctx)\n for (const [path, content] of Object.entries(out)) {\n files[path] = content\n pathToGenerator[path] = gen.name\n }\n }\n\n const root = repoRoot()\n const changed: string[] = []\n const changelogEntries: GeneratorChangelogEntry[] = []\n for (const [relPath, content] of Object.entries(files)) {\n const abs = join(root, relPath)\n const existing = readIfExists(abs)\n if (existing !== content) {\n changed.push(relPath)\n if (opts.write) {\n mkdirSync(dirname(abs), { recursive: true })\n writeFileSync(abs, content, \"utf8\")\n }\n }\n if (isChangelogEligible(relPath)) {\n const { added, removed } = diffModelIds(existing, content)\n if (added.length > 0 || removed.length > 0) {\n changelogEntries.push({ generator: pathToGenerator[relPath] ?? relPath, added, removed })\n }\n }\n }\n\n // CATALOG-CHANGELOG.md: appended (never touched when there's nothing to\n // report) from the per-generator id diffs gathered above. Goes through the\n // same changed/write bookkeeping as any other generated file.\n const changelogAbs = join(root, CATALOG_CHANGELOG_PATH)\n const changelogExisting = readIfExists(changelogAbs)\n const newChangelog = appendChangelog(changelogExisting, todayIso(), changelogEntries)\n if (newChangelog !== undefined) {\n files[CATALOG_CHANGELOG_PATH] = newChangelog\n changed.push(CATALOG_CHANGELOG_PATH)\n if (opts.write) {\n mkdirSync(dirname(changelogAbs), { recursive: true })\n writeFileSync(changelogAbs, newChangelog, \"utf8\")\n }\n }\n\n return { files, changed }\n}\n","#!/usr/bin/env node\n\n/**\n * catalog-sync CLI.\n *\n * catalog-sync generate [--refresh] [--check]\n *\n * - `generate` (default) — generate from pinned snapshots, write changed files.\n * - `--refresh` — re-fetch each source's pinned URL into snapshots/.\n * - `--check` — generate in memory, diff vs committed files; exit 1\n * on drift. This is what CI runs. Never writes.\n */\n\nimport { llmOpenRouterGenerator } from \"./generators/llm-openrouter.js\"\nimport { llmRequestyGenerator } from \"./generators/llm-requesty.js\"\nimport { llmHuggingfaceGenerator } from \"./generators/llm-huggingface.js\"\nimport { llmContextWindowsGenerator } from \"./generators/llm-context-windows.js\"\nimport { voiceElevenlabs } from \"./generators/voice-elevenlabs.js\"\nimport { voiceMinimax } from \"./generators/voice-minimax.js\"\nimport { imageReplicate } from \"./generators/image-replicate.js\"\nimport { runGenerators } from \"./runner.js\"\n\nconst args = process.argv.slice(2)\nconst command = args[0] ?? \"\"\nconst flags = new Set(args.slice(1))\n\nconst KNOWN_FLAGS = new Set([\"--refresh\", \"--check\"])\nconst unknownFlags = [...flags].filter((f) => !KNOWN_FLAGS.has(f))\n\nif (command !== \"generate\" || unknownFlags.length > 0) {\n if (command !== \"generate\") {\n process.stderr.write(\n `catalog-sync: unknown command \"${command}\". Usage: catalog-sync generate [--refresh] [--check]\\n`\n )\n }\n if (unknownFlags.length > 0) {\n process.stderr.write(`catalog-sync: unknown flag(s) ${unknownFlags.join(\", \")}\\n`)\n }\n process.exit(2)\n}\n\nconst refresh = flags.has(\"--refresh\")\nconst check = flags.has(\"--check\")\nconst generators = [\n llmOpenRouterGenerator,\n llmRequestyGenerator,\n llmHuggingfaceGenerator,\n llmContextWindowsGenerator,\n voiceElevenlabs,\n voiceMinimax,\n imageReplicate,\n]\n\nconst { changed, files } = await runGenerators(generators, {\n refresh,\n write: !check,\n})\n\nif (check) {\n if (changed.length > 0) {\n process.stderr.write(\n `catalog-sync: drift detected — ${changed.length} file(s) differ from committed:\\n`\n )\n for (const p of changed) process.stderr.write(` ${p}\\n`)\n process.stderr.write(`Re-run \\`catalog-sync generate\\` to update.\\n`)\n process.exit(1)\n }\n process.stdout.write(\n `catalog-sync: no drift (${generators.length} generator(s), ${Object.keys(files).length} file(s) up to date).\\n`\n )\n process.exit(0)\n}\n\nif (changed.length > 0) {\n process.stdout.write(`catalog-sync: wrote ${changed.length} file(s):\\n`)\n for (const p of changed) process.stdout.write(` ${p}\\n`)\n} else {\n process.stdout.write(`catalog-sync: no changes.\\n`)\n}\nprocess.exit(0)\n"]}