@agentproto/catalog-sync 0.6.0 → 0.6.1

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/index.mjs CHANGED
@@ -972,8 +972,28 @@ var voiceMinimax = defineGenerator({
972
972
  };
973
973
  }
974
974
  });
975
-
976
- // src/generators/image-replicate.ts
975
+ var ReplicateModelSchema = z.object({
976
+ owner: z.string(),
977
+ name: z.string(),
978
+ description: z.string().nullable(),
979
+ visibility: z.string(),
980
+ run_count: z.number(),
981
+ cover_image_url: z.string().nullable(),
982
+ latest_version: z.object({
983
+ id: z.string(),
984
+ created_at: z.string(),
985
+ openapi_schema: z.any()
986
+ })
987
+ }).passthrough();
988
+ var ReplicateSnapshotSchema = z.object({
989
+ // DRF-paginated shape (live API)
990
+ results: z.array(ReplicateModelSchema).optional(),
991
+ next: z.string().nullable().optional(),
992
+ previous: z.string().nullable().optional(),
993
+ // Hand-authored fixture shape (committed snapshot)
994
+ _meta: z.record(z.string(), z.unknown()).optional(),
995
+ models: z.array(ReplicateModelSchema).optional()
996
+ }).passthrough();
977
997
  var PRICING = {
978
998
  "nano-banana-pro": { costPerImage: 0.15, costTier: "high", baseCost: 0.15, creditCost: 10 },
979
999
  "nano-banana-2": { costPerImage: 0.06, costTier: "medium", baseCost: 0.06, creditCost: 5 },
@@ -1187,14 +1207,14 @@ function mapModel(raw) {
1187
1207
  ...pricing.creditCost !== void 0 ? { creditCost: pricing.creditCost } : {},
1188
1208
  ...pricing.overrideCreditCost !== void 0 ? { overrideCreditCost: pricing.overrideCreditCost } : {}
1189
1209
  },
1190
- description: raw.description,
1210
+ description: raw.description ?? "",
1191
1211
  agentVisible: AGENT_VISIBLE.has(raw.name),
1192
1212
  ...spec.triggerWord ? { triggerWord: spec.triggerWord } : {}
1193
1213
  };
1194
1214
  }
1195
1215
  var REPLICATE_SOURCE = {
1196
1216
  id: "image-replicate",
1197
- url: "https://api.replicate.com/v1/models?query=image+generation",
1217
+ url: "https://api.replicate.com/v1/collections/text-to-image",
1198
1218
  headers: { Authorization: "Bearer env:REPLICATE_API_TOKEN" }
1199
1219
  };
1200
1220
  var imageReplicate = defineGenerator({
@@ -1202,8 +1222,22 @@ var imageReplicate = defineGenerator({
1202
1222
  modality: "image",
1203
1223
  sources: [REPLICATE_SOURCE],
1204
1224
  async generate(ctx) {
1205
- const data = await ctx.fetchSource(REPLICATE_SOURCE);
1206
- const entries = data.models.map(mapModel);
1225
+ const raw = await ctx.fetchSource(REPLICATE_SOURCE);
1226
+ const data = ReplicateSnapshotSchema.parse(raw);
1227
+ const models = data.results ?? data.models;
1228
+ if (!models) {
1229
+ throw new Error(
1230
+ "Replicate snapshot has neither `results` nor `models` array \u2014 invalid shape"
1231
+ );
1232
+ }
1233
+ const curatedModels = models.filter((m) => MODEL_SPECS[m.name]);
1234
+ if (curatedModels.length === 0) {
1235
+ const sampleNames = [...AGENT_VISIBLE].slice(0, 3).join(", ");
1236
+ throw new Error(
1237
+ `image:replicate: none of the curated models (${sampleNames}\u2026) present in source payload (${models.length} entries) \u2014 API shape or roster drift`
1238
+ );
1239
+ }
1240
+ const entries = curatedModels.map(mapModel);
1207
1241
  const lines = [
1208
1242
  "// Generated by @agentproto/catalog-sync generator image:replicate",
1209
1243
  "// DO NOT EDIT MANUALLY \u2014 regenerate with catalog-sync",