@koda-sl/baker-cli 0.104.0 → 0.105.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -935,6 +935,446 @@ var actionsTagsCreateResponseSchema = okResponse(z2.object({ tagId: z2.string()
935
935
  var actionsTagsDeleteRequestSchema = z2.object({ name: z2.string() });
936
936
  var actionsTagsDeleteResponseSchema = okOnlySchema();
937
937
 
938
+ // ../api/src/images.ts
939
+ import { z as z3 } from "zod";
940
+ var imageSourceSchema = z3.enum([
941
+ "uploaded",
942
+ "website",
943
+ "google_testimonial",
944
+ "trustpilot_testimonial",
945
+ "instagram",
946
+ "magnific",
947
+ "brandfetch",
948
+ "google_images",
949
+ "firecrawl",
950
+ "screenshotone",
951
+ "iconify",
952
+ "giphy",
953
+ "pinterest",
954
+ "ai_generated"
955
+ ]);
956
+ var imageStatusSchema = z3.enum(["uploading", "processing", "ready", "error"]);
957
+ var upscaleConfigSchema = z3.object({
958
+ model: z3.literal("philz1337x/crystal-upscaler"),
959
+ input: z3.object({
960
+ scale_factor: z3.number(),
961
+ creativity: z3.number(),
962
+ output_format: z3.string()
963
+ }),
964
+ status: z3.enum(["pending", "completed"])
965
+ });
966
+ var imageDocSchema = z3.object({
967
+ _id: z3.string(),
968
+ _creationTime: z3.number(),
969
+ companyId: z3.string(),
970
+ storageKey: z3.string(),
971
+ upscaleConfig: upscaleConfigSchema.optional(),
972
+ upscaledStorageKey: z3.string().optional(),
973
+ name: z3.string(),
974
+ description: z3.string(),
975
+ tags: z3.array(z3.string()),
976
+ source: z3.string(),
977
+ externalId: z3.string().optional(),
978
+ externalUrl: z3.string().optional(),
979
+ contentHash: z3.string().optional(),
980
+ sourceId: z3.string().optional(),
981
+ descriptionContext: z3.string().optional(),
982
+ width: z3.number().optional(),
983
+ height: z3.number().optional(),
984
+ aspectRatio: z3.number().optional(),
985
+ dominantColor: z3.string().optional(),
986
+ imagePalette: z3.array(z3.string()).optional(),
987
+ thumbhashDataUri: z3.string().optional(),
988
+ isLightImage: z3.boolean().optional(),
989
+ descriptionEmbedding: z3.array(z3.number()).optional(),
990
+ imageEmbedding: z3.array(z3.number()).optional(),
991
+ searchText: z3.string().optional(),
992
+ status: imageStatusSchema,
993
+ errorMessage: z3.string().optional(),
994
+ createdAt: z3.number(),
995
+ updatedAt: z3.number(),
996
+ imageUrl: z3.string()
997
+ });
998
+ var imageHitSourceSchema = z3.enum([
999
+ "library",
1000
+ "magnific",
1001
+ "google_images",
1002
+ "brandfetch",
1003
+ "firecrawl",
1004
+ "screenshotone",
1005
+ "iconify",
1006
+ "giphy",
1007
+ "pinterest"
1008
+ ]);
1009
+ var imageHitSchema = z3.object({
1010
+ source: imageHitSourceSchema,
1011
+ url: z3.string(),
1012
+ thumbnailUrl: z3.string().optional(),
1013
+ width: z3.number().optional(),
1014
+ height: z3.number().optional(),
1015
+ aspectRatio: z3.number().optional(),
1016
+ dominantColor: z3.string().optional(),
1017
+ externalId: z3.string().optional(),
1018
+ externalUrl: z3.string().optional(),
1019
+ providerMeta: z3.record(z3.string(), z3.unknown()).optional(),
1020
+ descriptionContext: z3.string().optional(),
1021
+ _id: z3.string().optional(),
1022
+ name: z3.string().optional(),
1023
+ description: z3.string().optional(),
1024
+ tags: z3.array(z3.string()).optional(),
1025
+ score: z3.number().optional(),
1026
+ alsoInLibrary: z3.string().optional(),
1027
+ prefetchedBytes: z3.string().optional(),
1028
+ prefetchedContentType: z3.string().optional()
1029
+ });
1030
+ var ingestedImageHitSchema = imageHitSchema.extend({
1031
+ imageId: z3.string().optional(),
1032
+ imageUrl: z3.string().optional(),
1033
+ deduped: z3.boolean().optional(),
1034
+ sourceUrl: z3.string().optional()
1035
+ });
1036
+ var autoIngestItemSchema = z3.object({
1037
+ imageId: z3.string(),
1038
+ deduped: z3.boolean(),
1039
+ imageUrl: z3.string(),
1040
+ sourceUrl: z3.string(),
1041
+ externalUrl: z3.string().optional()
1042
+ });
1043
+ function providerHitsResponseSchema() {
1044
+ return z3.object({
1045
+ hits: z3.array(ingestedImageHitSchema),
1046
+ ingested: z3.array(autoIngestItemSchema)
1047
+ });
1048
+ }
1049
+ var imagesGetRequestSchema = z3.object({ id: z3.string().min(1, "Missing id parameter") });
1050
+ var imagesSearchRequestSchema = z3.object({
1051
+ query: z3.string().min(1),
1052
+ limit: z3.coerce.number().int().positive().max(100).optional(),
1053
+ aspectRatio: z3.string().optional(),
1054
+ tags: z3.array(z3.string()).optional(),
1055
+ source: z3.string().optional(),
1056
+ externalUrlHost: z3.string().optional()
1057
+ });
1058
+ var imageSearchResultSchema = z3.object({
1059
+ _id: z3.string(),
1060
+ imageUrl: z3.string(),
1061
+ name: z3.string(),
1062
+ description: z3.string(),
1063
+ tags: z3.array(z3.string()),
1064
+ width: z3.number().optional(),
1065
+ height: z3.number().optional(),
1066
+ aspectRatio: z3.number().optional(),
1067
+ dominantColor: z3.string().optional(),
1068
+ imagePalette: z3.array(z3.string()).optional(),
1069
+ source: z3.string(),
1070
+ externalUrl: z3.string().optional(),
1071
+ score: z3.number()
1072
+ });
1073
+ var imagesSearchResponseSchema = z3.array(imageSearchResultSchema);
1074
+ var imagesUploadRequestSchema = z3.object({
1075
+ base64: z3.string().min(1),
1076
+ contentType: z3.string().min(1),
1077
+ source: z3.string().optional(),
1078
+ descriptionContext: z3.string().optional()
1079
+ });
1080
+ var imagesUploadResponseSchema = z3.object({ imageId: z3.string() });
1081
+ var imagesDeleteRequestSchema = z3.object({ id: z3.string().min(1, "Missing image ID") });
1082
+ var imagesDeleteResponseSchema = z3.object({ ok: z3.literal(true) });
1083
+ var imagesUpscaleRequestSchema = z3.object({ imageId: z3.string().min(1, "Missing image ID") });
1084
+ var imagesUpscaleResponseSchema = z3.object({
1085
+ imageId: z3.string(),
1086
+ status: z3.literal("processing")
1087
+ });
1088
+ var IMAGES_FIND_SOURCES = ["library", "magnific", "google", "iconify", "giphy", "pinterest"];
1089
+ var imagesFindRequestSchema = z3.object({
1090
+ query: z3.string().min(1),
1091
+ sources: z3.array(z3.enum(IMAGES_FIND_SOURCES)).optional(),
1092
+ limit: z3.coerce.number().int().positive().max(50).optional(),
1093
+ fallback: z3.boolean().optional(),
1094
+ threshold: z3.number().min(0).max(1).optional(),
1095
+ autoIngest: z3.coerce.number().int().min(0).max(20).optional(),
1096
+ descriptionContext: z3.string().optional()
1097
+ });
1098
+ var imagesFindResponseSchema = z3.object({
1099
+ groups: z3.object({
1100
+ library: z3.array(imageHitSchema),
1101
+ external: z3.array(ingestedImageHitSchema)
1102
+ }),
1103
+ meta: z3.object({
1104
+ counts: z3.record(z3.string(), z3.number()),
1105
+ errors: z3.array(z3.object({ source: imageHitSourceSchema, message: z3.string() }))
1106
+ }),
1107
+ ingested: z3.array(autoIngestItemSchema)
1108
+ });
1109
+ var imagesStockRequestSchema = z3.object({
1110
+ query: z3.string().min(1),
1111
+ orientation: z3.enum(["landscape", "portrait", "square", "panoramic"]).optional(),
1112
+ contentType: z3.enum(["photo", "vector", "psd"]).optional(),
1113
+ license: z3.enum(["freemium", "premium"]).optional(),
1114
+ color: z3.string().optional(),
1115
+ aiGenerated: z3.enum(["exclude", "only"]).optional(),
1116
+ people: z3.enum(["include", "exclude", "only"]).optional(),
1117
+ order: z3.enum(["relevance", "recent"]).optional(),
1118
+ limit: z3.coerce.number().int().positive().max(50).optional(),
1119
+ page: z3.coerce.number().int().positive().optional(),
1120
+ autoIngest: z3.coerce.number().int().min(0).max(20).optional(),
1121
+ descriptionContext: z3.string().optional()
1122
+ });
1123
+ var imagesStockResponseSchema = providerHitsResponseSchema();
1124
+ var imagesGoogleRequestSchema = z3.object({
1125
+ query: z3.string().min(1),
1126
+ type: z3.string().optional(),
1127
+ size: z3.string().optional(),
1128
+ color: z3.string().optional(),
1129
+ safe: z3.enum(["off", "active"]).optional(),
1130
+ limit: z3.coerce.number().int().positive().max(50).optional(),
1131
+ autoIngest: z3.coerce.number().int().min(0).max(20).optional(),
1132
+ descriptionContext: z3.string().optional()
1133
+ });
1134
+ var imagesGoogleResponseSchema = providerHitsResponseSchema();
1135
+ var imagesPinterestRequestSchema = z3.object({
1136
+ query: z3.string().min(1),
1137
+ limit: z3.coerce.number().int().positive().max(20).optional(),
1138
+ autoIngest: z3.coerce.number().int().min(0).max(20).optional(),
1139
+ descriptionContext: z3.string().optional()
1140
+ });
1141
+ var imagesPinterestResponseSchema = providerHitsResponseSchema();
1142
+ var rgbTriple = z3.tuple([
1143
+ z3.number().int().min(0).max(255),
1144
+ z3.number().int().min(0).max(255),
1145
+ z3.number().int().min(0).max(255)
1146
+ ]);
1147
+ var imageGenerateModelSchema = z3.enum([
1148
+ "openai/gpt-5.4-image-2",
1149
+ "google/gemini-3.5-flash",
1150
+ "google/gemini-3.1-flash-image-preview",
1151
+ "google/gemini-3-pro-image-preview",
1152
+ "recraft/recraft-v4.1-pro-vector"
1153
+ ]);
1154
+ var imagesGenerateRequestSchema = z3.object({
1155
+ prompt: z3.string().min(1),
1156
+ model: imageGenerateModelSchema.optional(),
1157
+ // Aspect ratio + size are validated loosely as strings; the per-model enum
1158
+ // lives in canvas-contract and OpenRouter rejects unsupported combinations.
1159
+ aspectRatio: z3.string().optional(),
1160
+ imageSize: z3.string().optional(),
1161
+ // Recraft v4.1 Pro Vector levers (ignored by other models).
1162
+ strength: z3.coerce.number().min(0).max(1).optional(),
1163
+ rgbColors: z3.array(rgbTriple).optional(),
1164
+ backgroundRgbColor: rgbTriple.optional(),
1165
+ // Public image URLs used as visual references (multi-reference, in order).
1166
+ referenceUrls: z3.array(z3.string().url()).optional(),
1167
+ descriptionContext: z3.string().optional()
1168
+ });
1169
+ var generatedImageSchema = z3.object({
1170
+ imageId: z3.string(),
1171
+ deduped: z3.boolean(),
1172
+ imageUrl: z3.string(),
1173
+ width: z3.number().optional(),
1174
+ height: z3.number().optional()
1175
+ });
1176
+ var imagesGenerateResponseSchema = z3.object({
1177
+ model: z3.string(),
1178
+ costUsd: z3.number(),
1179
+ images: z3.array(generatedImageSchema)
1180
+ });
1181
+ var imagesLogoRequestSchema = z3.object({
1182
+ domain: z3.string().min(1),
1183
+ variant: z3.enum(["icon", "logo", "symbol"]).optional(),
1184
+ autoIngest: z3.coerce.number().int().min(0).max(5).optional(),
1185
+ descriptionContext: z3.string().optional()
1186
+ });
1187
+ var imagesLogoResponseSchema = providerHitsResponseSchema();
1188
+ var imagesIconRequestSchema = z3.object({
1189
+ name: z3.string().min(1),
1190
+ set: z3.string().optional(),
1191
+ color: z3.string().optional(),
1192
+ width: z3.coerce.number().int().positive().optional(),
1193
+ autoIngest: z3.coerce.number().int().min(0).max(20).optional(),
1194
+ descriptionContext: z3.string().optional()
1195
+ });
1196
+ var imagesIconResponseSchema = providerHitsResponseSchema();
1197
+ var imagesExtractRequestSchema = z3.object({
1198
+ url: z3.string().url(),
1199
+ waitFor: z3.coerce.number().int().min(0).max(3e4).optional(),
1200
+ limit: z3.coerce.number().int().positive().max(50).optional(),
1201
+ autoIngest: z3.coerce.number().int().min(0).max(20).optional(),
1202
+ descriptionContext: z3.string().optional()
1203
+ });
1204
+ var imagesExtractResponseSchema = providerHitsResponseSchema();
1205
+ var imagesScreenshotRequestSchema = z3.object({
1206
+ url: z3.string().url(),
1207
+ fullPage: z3.boolean().optional(),
1208
+ viewportWidth: z3.coerce.number().int().positive().max(3840).optional(),
1209
+ viewportHeight: z3.coerce.number().int().positive().max(2160).optional(),
1210
+ format: z3.enum(["webp", "png", "jpg"]).optional(),
1211
+ descriptionContext: z3.string().optional()
1212
+ });
1213
+ var imagesScreenshotResponseSchema = providerHitsResponseSchema();
1214
+ var imagesGiphyRequestSchema = z3.object({
1215
+ query: z3.string().min(1).optional(),
1216
+ trending: z3.coerce.boolean().optional(),
1217
+ limit: z3.coerce.number().int().positive().max(50).optional(),
1218
+ rating: z3.enum(["g", "pg", "pg-13", "r"]).optional(),
1219
+ lang: z3.string().optional(),
1220
+ autoIngest: z3.coerce.number().int().min(0).max(20).optional(),
1221
+ descriptionContext: z3.string().optional()
1222
+ });
1223
+ var imagesGifResponseSchema = providerHitsResponseSchema();
1224
+ var imagesStickerResponseSchema = providerHitsResponseSchema();
1225
+ var imagesIngestRequestSchema = z3.object({
1226
+ url: z3.string().url(),
1227
+ // Validate source at the HTTP boundary so unknown values produce the standard
1228
+ // `{ code: "BAD_REQUEST", message }` shape instead of a plain Error from
1229
+ // `assertImageSource` inside the action.
1230
+ source: imageSourceSchema,
1231
+ externalId: z3.string().optional(),
1232
+ externalUrl: z3.string().optional(),
1233
+ descriptionContext: z3.string().optional()
1234
+ });
1235
+ var imagesIngestResponseSchema = z3.object({
1236
+ imageId: z3.string(),
1237
+ deduped: z3.boolean(),
1238
+ contentHash: z3.string()
1239
+ });
1240
+
1241
+ // ../api/src/testimonials.ts
1242
+ import { z as z4 } from "zod";
1243
+ var testimonialSourceTypeSchema = z4.enum(["google", "trustpilot"]);
1244
+ var testimonialStatusSchema = z4.enum(["pending", "processing", "ready", "error"]);
1245
+ var testimonialSentimentSchema = z4.enum(["positive", "neutral", "negative"]);
1246
+ var testimonialDocSchema = z4.object({
1247
+ _id: z4.string(),
1248
+ _creationTime: z4.number(),
1249
+ companyId: z4.string(),
1250
+ sourceId: z4.string(),
1251
+ sourceType: testimonialSourceTypeSchema,
1252
+ reviewText: z4.string(),
1253
+ reviewTitle: z4.string().optional(),
1254
+ searchText: z4.string().optional(),
1255
+ reviewerName: z4.string().optional(),
1256
+ reviewerImageUrl: z4.string().optional(),
1257
+ reviewerImageId: z4.string().optional(),
1258
+ reviewerLocation: z4.string().optional(),
1259
+ rating: z4.number().optional(),
1260
+ reviewDate: z4.number().optional(),
1261
+ ownerAnswer: z4.string().optional(),
1262
+ mediaUrls: z4.array(z4.string()).optional(),
1263
+ imageIds: z4.array(z4.string()).optional(),
1264
+ videoIds: z4.array(z4.string()).optional(),
1265
+ sourceUrl: z4.string().optional(),
1266
+ rawData: z4.unknown().optional(),
1267
+ tags: z4.array(z4.string()),
1268
+ highlight: z4.string().optional(),
1269
+ language: z4.string().optional(),
1270
+ summary: z4.string().optional(),
1271
+ sentiment: testimonialSentimentSchema.optional(),
1272
+ textEmbedding: z4.array(z4.number()).optional(),
1273
+ externalId: z4.string().optional(),
1274
+ contentHash: z4.string().optional(),
1275
+ status: testimonialStatusSchema,
1276
+ errorMessage: z4.string().optional(),
1277
+ createdAt: z4.number(),
1278
+ updatedAt: z4.number()
1279
+ });
1280
+ var testimonialsListRequestSchema = z4.object({
1281
+ source: testimonialSourceTypeSchema.optional(),
1282
+ rating_min: z4.coerce.number().int().min(1).max(5).optional(),
1283
+ rating_max: z4.coerce.number().int().min(1).max(5).optional(),
1284
+ tags: z4.string().transform((s) => s.split(",").filter(Boolean)).optional(),
1285
+ status: testimonialStatusSchema.optional(),
1286
+ sentiment: testimonialSentimentSchema.optional(),
1287
+ language: z4.string().min(2).max(5).optional(),
1288
+ limit: z4.coerce.number().int().positive().max(200).optional()
1289
+ });
1290
+ var testimonialsListResponseSchema = z4.array(testimonialDocSchema);
1291
+ var testimonialsGetRequestSchema = z4.object({ id: z4.string().min(1, "Missing id parameter") });
1292
+ var testimonialsSearchRequestSchema = z4.object({
1293
+ query: z4.string().min(1),
1294
+ limit: z4.coerce.number().int().positive().max(100).optional(),
1295
+ source: testimonialSourceTypeSchema.optional(),
1296
+ rating_min: z4.coerce.number().int().min(1).max(5).optional(),
1297
+ rating_max: z4.coerce.number().int().min(1).max(5).optional(),
1298
+ tags: z4.array(z4.string()).optional(),
1299
+ status: testimonialStatusSchema.optional(),
1300
+ sentiment: testimonialSentimentSchema.optional(),
1301
+ language: z4.string().min(2).max(5).optional()
1302
+ }).refine(
1303
+ (data) => data.rating_min === void 0 || data.rating_max === void 0 || data.rating_min <= data.rating_max,
1304
+ { message: "rating_min must be less than or equal to rating_max" }
1305
+ );
1306
+ var testimonialsSearchResponseSchema = z4.array(testimonialDocSchema);
1307
+ var testimonialsOutscraperWebhookResponseSchema = z4.object({
1308
+ ok: z4.literal(true),
1309
+ note: z4.string().optional()
1310
+ });
1311
+
1312
+ // ../api/src/videos.ts
1313
+ import { z as z5 } from "zod";
1314
+ var videoStatusSchema = z5.enum(["uploading", "uploaded", "processing", "ready", "error"]);
1315
+ var videoTranscriptSegmentSchema = z5.object({
1316
+ text: z5.string(),
1317
+ startSecond: z5.number(),
1318
+ endSecond: z5.number()
1319
+ });
1320
+ var videoSceneSchema = z5.object({
1321
+ title: z5.string(),
1322
+ description: z5.string(),
1323
+ startSecond: z5.number(),
1324
+ endSecond: z5.number(),
1325
+ thumbnailTime: z5.number()
1326
+ });
1327
+ var videoDocSchema = z5.object({
1328
+ _id: z5.string(),
1329
+ _creationTime: z5.number(),
1330
+ companyId: z5.string(),
1331
+ muxAssetId: z5.string(),
1332
+ muxPlaybackId: z5.string(),
1333
+ muxUploadId: z5.string(),
1334
+ name: z5.string(),
1335
+ description: z5.string(),
1336
+ tags: z5.array(z5.string()),
1337
+ source: z5.string(),
1338
+ externalId: z5.string().optional(),
1339
+ sourceId: z5.string().optional(),
1340
+ width: z5.number().optional(),
1341
+ height: z5.number().optional(),
1342
+ aspectRatio: z5.number().optional(),
1343
+ duration: z5.number().optional(),
1344
+ transcript: z5.string().optional(),
1345
+ transcriptSegments: z5.array(videoTranscriptSegmentSchema).optional(),
1346
+ scenes: z5.array(videoSceneSchema).optional(),
1347
+ descriptionEmbedding: z5.array(z5.number()).optional(),
1348
+ searchText: z5.string().optional(),
1349
+ status: videoStatusSchema,
1350
+ errorMessage: z5.string().optional(),
1351
+ createdAt: z5.number(),
1352
+ updatedAt: z5.number(),
1353
+ thumbnailUrl: z5.string()
1354
+ });
1355
+ var videosWebhookResponseSchema = z5.object({ ok: z5.literal(true) });
1356
+ var videosGetRequestSchema = z5.object({ id: z5.string().min(1, "Missing id parameter") });
1357
+ var videosSearchRequestSchema = z5.object({
1358
+ query: z5.string().min(1),
1359
+ limit: z5.coerce.number().int().positive().max(100).optional(),
1360
+ tags: z5.array(z5.string()).optional()
1361
+ });
1362
+ var videoSearchResultSchema = z5.object({
1363
+ _id: z5.string(),
1364
+ thumbnailUrl: z5.string(),
1365
+ name: z5.string(),
1366
+ description: z5.string(),
1367
+ tags: z5.array(z5.string()),
1368
+ status: z5.string(),
1369
+ duration: z5.number().optional(),
1370
+ muxPlaybackId: z5.string(),
1371
+ createdAt: z5.number()
1372
+ });
1373
+ var videosSearchResponseSchema = z5.array(videoSearchResultSchema);
1374
+ var videosUploadResponseSchema = z5.object({ uploadUrl: z5.string(), videoId: z5.string() });
1375
+ var videosDeleteRequestSchema = z5.object({ id: z5.string().min(1, "Missing video ID") });
1376
+ var videosDeleteResponseSchema = z5.object({ ok: z5.literal(true) });
1377
+
938
1378
  // src/commands/actions/complete.ts
939
1379
  import { defineCommand as defineCommand2 } from "citty";
940
1380
  registerSchema({
@@ -8809,27 +9249,27 @@ import path5 from "path";
8809
9249
  import { defineCommand as defineCommand82 } from "citty";
8810
9250
 
8811
9251
  // src/engine/scaffold/staticAd.ts
8812
- import { z as z3 } from "zod";
9252
+ import { z as z6 } from "zod";
8813
9253
  var GEN_ASPECT_RATIOS = /* @__PURE__ */ new Set(["1:1", "4:5", "9:16", "16:9", "4:3", "3:4", "2:3", "3:2", "21:9"]);
8814
9254
  var DEFAULT_ASPECT_RATIO = "9:16";
8815
- var Blueprint = z3.object({
8816
- meta: z3.object({ estimated_aspect_ratio: z3.string().optional() }).loose().optional(),
8817
- text_content: z3.array(z3.object({ text: z3.string().optional() }).loose()).optional()
9255
+ var Blueprint = z6.object({
9256
+ meta: z6.object({ estimated_aspect_ratio: z6.string().optional() }).loose().optional(),
9257
+ text_content: z6.array(z6.object({ text: z6.string().optional() }).loose()).optional()
8818
9258
  }).loose();
8819
- var ElementLocator = z3.object({
8820
- collection: z3.enum(["subjects", "people", "brands_logos"]),
8821
- index: z3.number().int().nonnegative()
9259
+ var ElementLocator = z6.object({
9260
+ collection: z6.enum(["subjects", "people", "brands_logos"]),
9261
+ index: z6.number().int().nonnegative()
8822
9262
  }).loose();
8823
- var MainElement = z3.object({
9263
+ var MainElement = z6.object({
8824
9264
  // logo | product | person | animal | badge | other
8825
- type: z3.string(),
8826
- label: z3.string().optional(),
8827
- description: z3.string().optional(),
8828
- expression: z3.string().nullable().optional(),
8829
- reason: z3.string().optional(),
9265
+ type: z6.string(),
9266
+ label: z6.string().optional(),
9267
+ description: z6.string().optional(),
9268
+ expression: z6.string().nullable().optional(),
9269
+ reason: z6.string().optional(),
8830
9270
  locator: ElementLocator.optional()
8831
9271
  }).loose();
8832
- var MainElements = z3.array(MainElement);
9272
+ var MainElements = z6.array(MainElement);
8833
9273
  function sanitizeId(raw, fallback) {
8834
9274
  const id = raw.toLowerCase().replace(/[^a-z0-9]+/g, "_").replace(/^_+|_+$/g, "");
8835
9275
  return /^[a-z]/.test(id) ? id : `${fallback}_${id}`.replace(/_+$/g, "") || fallback;
@@ -9324,7 +9764,7 @@ import { toCardinal as nwKo } from "n2words/ko-KR";
9324
9764
  import { toCardinal as nwNl } from "n2words/nl-NL";
9325
9765
  import { toCardinal as nwPl } from "n2words/pl-PL";
9326
9766
  import { toCardinal as nwPt } from "n2words/pt-PT";
9327
- import { z as z4 } from "zod";
9767
+ import { z as z7 } from "zod";
9328
9768
 
9329
9769
  // src/engine/scaffold/lib/shoot-modes.ts
9330
9770
  var SHOOT_MODES = [
@@ -9581,49 +10021,49 @@ function trimArgs(durationS, offsetS = 0) {
9581
10021
  "{{out.video}}"
9582
10022
  ];
9583
10023
  }
9584
- var FrameAsset = z4.object({ url: z4.string().optional() }).loose().optional();
9585
- var DialogueLine = z4.object({
9586
- speaker: z4.string().optional(),
9587
- line: z4.string().optional(),
10024
+ var FrameAsset = z7.object({ url: z7.string().optional() }).loose().optional();
10025
+ var DialogueLine = z7.object({
10026
+ speaker: z7.string().optional(),
10027
+ line: z7.string().optional(),
9588
10028
  // Absolute seconds on the source timeline (the deconstruct emits both).
9589
- start_s: z4.number().optional(),
9590
- end_s: z4.number().optional(),
9591
- delivery: z4.string().optional(),
9592
- voice_description: z4.string().optional()
10029
+ start_s: z7.number().optional(),
10030
+ end_s: z7.number().optional(),
10031
+ delivery: z7.string().optional(),
10032
+ voice_description: z7.string().optional()
9593
10033
  }).loose();
9594
- var Sfx = z4.object({
9595
- at_s: z4.number().optional(),
9596
- duration_s: z4.number().optional(),
9597
- sound_effect_prompt: z4.string().optional(),
9598
- description: z4.string().optional()
10034
+ var Sfx = z7.object({
10035
+ at_s: z7.number().optional(),
10036
+ duration_s: z7.number().optional(),
10037
+ sound_effect_prompt: z7.string().optional(),
10038
+ description: z7.string().optional()
9599
10039
  }).loose();
9600
- var CompositionRegion = z4.object({
10040
+ var CompositionRegion = z7.object({
9601
10041
  // full | top | bottom | left | right | inset
9602
- panel: z4.string().optional(),
10042
+ panel: z7.string().optional(),
9603
10043
  // 9-grid anchor for an `inset` presenter box.
9604
- position: z4.string().optional(),
9605
- is_presenter: z4.boolean().optional(),
10044
+ position: z7.string().optional(),
10045
+ is_presenter: z7.boolean().optional(),
9606
10046
  // The cast id shown/speaking in this region (routes lip-sync + element refs).
9607
- cast_ref: z4.string().optional(),
9608
- summary: z4.string().optional(),
9609
- frame_prompt: z4.string().optional(),
9610
- motion_prompt: z4.string().optional()
10047
+ cast_ref: z7.string().optional(),
10048
+ summary: z7.string().optional(),
10049
+ frame_prompt: z7.string().optional(),
10050
+ motion_prompt: z7.string().optional()
9611
10051
  }).loose();
9612
- var SceneComposition = z4.object({
10052
+ var SceneComposition = z7.object({
9613
10053
  // full_frame (default) | split_screen | pip | keyed_overlay
9614
- layout: z4.string().optional(),
10054
+ layout: z7.string().optional(),
9615
10055
  // split_screen only: vertical (top/bottom) | horizontal (left/right).
9616
- split_axis: z4.string().optional(),
9617
- regions: z4.array(CompositionRegion).optional()
10056
+ split_axis: z7.string().optional(),
10057
+ regions: z7.array(CompositionRegion).optional()
9618
10058
  }).loose();
9619
- var CameraMotion = z4.object({ movement: z4.string().optional(), detail: z4.string().optional() }).loose();
9620
- var TranscriptWord = z4.object({ text: z4.string().optional() }).loose();
9621
- var Scene = z4.object({
9622
- start_s: z4.number().optional(),
9623
- end_s: z4.number().optional(),
9624
- duration_s: z4.number().optional(),
9625
- summary: z4.string().optional(),
9626
- action_detail: z4.string().optional(),
10059
+ var CameraMotion = z7.object({ movement: z7.string().optional(), detail: z7.string().optional() }).loose();
10060
+ var TranscriptWord = z7.object({ text: z7.string().optional() }).loose();
10061
+ var Scene = z7.object({
10062
+ start_s: z7.number().optional(),
10063
+ end_s: z7.number().optional(),
10064
+ duration_s: z7.number().optional(),
10065
+ summary: z7.string().optional(),
10066
+ action_detail: z7.string().optional(),
9627
10067
  // The scene's spatial layout. Absent/full_frame ⇒ one uncut shot (default path).
9628
10068
  // A layered layout (split_screen/pip/keyed_overlay) with regions ⇒ the scaffold
9629
10069
  // builds one clip per region and stacks/overlays them into the scene picture.
@@ -9631,77 +10071,77 @@ var Scene = z4.object({
9631
10071
  // The capture "look" for this scene — selected from the ad-native shoot-mode
9632
10072
  // grammar (see lib/shoot-modes.ts). When absent the scaffold auto-derives a
9633
10073
  // UGC/product mode; a human can override per scene by setting this.
9634
- shoot_mode: z4.string().optional(),
10074
+ shoot_mode: z7.string().optional(),
9635
10075
  // Diegetic ambient the clip's native audio should carry (no music). When
9636
10076
  // absent the scene falls back to its shoot mode's default ambience.
9637
- ambient: z4.string().optional(),
10077
+ ambient: z7.string().optional(),
9638
10078
  camera_motion: CameraMotion.optional(),
9639
- start_frame_prompt: z4.string().optional(),
9640
- end_frame_prompt: z4.string().optional(),
9641
- motion_prompt: z4.string().optional(),
10079
+ start_frame_prompt: z7.string().optional(),
10080
+ end_frame_prompt: z7.string().optional(),
10081
+ motion_prompt: z7.string().optional(),
9642
10082
  // The scene's role in the ad's persuasion arc (DECON-supplied); drives the
9643
10083
  // script re-craft checklist. Inferred from position when absent.
9644
- narrative_role: z4.string().optional(),
10084
+ narrative_role: z7.string().optional(),
9645
10085
  // DECON-supplied on the HOOK scene: the engineered physical/emotional state that
9646
10086
  // makes the first frame stop the scroll (sweaty/breathless/urgent …). Injected
9647
10087
  // into the hook's start-frame description so the generator renders that state,
9648
10088
  // not a calm influencer (CCA-11).
9649
- hook_mechanic: z4.object({ mechanic: z4.string().optional(), why_it_stops_scroll: z4.string().optional() }).loose().optional(),
10089
+ hook_mechanic: z7.object({ mechanic: z7.string().optional(), why_it_stops_scroll: z7.string().optional() }).loose().optional(),
9650
10090
  // DECON-supplied per-scene location (so a gym hook isn't flattened to "home").
9651
- scene_setting: z4.string().optional(),
10091
+ scene_setting: z7.string().optional(),
9652
10092
  // How this scene cuts to the next (DECON-supplied). A recognized non-cut type
9653
10093
  // (fade/whip/zoom/dissolve/swipe) is reproduced as an ffmpeg xfade at the
9654
10094
  // boundary; cut/match_cut/none/other stay hard cuts. The last scene's value is
9655
10095
  // ignored (nothing follows it).
9656
- transition_out: z4.object({ type: z4.string().optional(), description: z4.string().optional() }).loose().optional(),
9657
- dialogue: z4.array(DialogueLine).optional(),
9658
- sfx: z4.array(Sfx).optional(),
9659
- overlays: z4.array(z4.unknown()).optional(),
9660
- floating_elements: z4.array(z4.unknown()).optional(),
9661
- transcript_slice: z4.array(TranscriptWord).optional(),
10096
+ transition_out: z7.object({ type: z7.string().optional(), description: z7.string().optional() }).loose().optional(),
10097
+ dialogue: z7.array(DialogueLine).optional(),
10098
+ sfx: z7.array(Sfx).optional(),
10099
+ overlays: z7.array(z7.unknown()).optional(),
10100
+ floating_elements: z7.array(z7.unknown()).optional(),
10101
+ transcript_slice: z7.array(TranscriptWord).optional(),
9662
10102
  start_frame_asset: FrameAsset,
9663
10103
  end_frame_asset: FrameAsset,
9664
10104
  // DECON-supplied: true when this scene is a length-split CONTINUATION of the
9665
10105
  // previous one (the SAME physical shot, broken up only because it exceeded the
9666
10106
  // clip ceiling). The scaffold then shares the splice keyframe — this scene's
9667
10107
  // start frame IS the previous scene's end frame — so the join is seamless.
9668
- continues_previous: z4.boolean().optional()
10108
+ continues_previous: z7.boolean().optional()
9669
10109
  }).loose();
9670
- var VideoBlueprint = z4.object({
9671
- source: z4.object({ aspect_ratio: z4.string().optional(), duration_s: z4.number().optional() }).loose().optional(),
9672
- global: z4.object({
9673
- music: z4.object({
9674
- present: z4.boolean().optional(),
9675
- music_prompt: z4.string().optional(),
10110
+ var VideoBlueprint = z7.object({
10111
+ source: z7.object({ aspect_ratio: z7.string().optional(), duration_s: z7.number().optional() }).loose().optional(),
10112
+ global: z7.object({
10113
+ music: z7.object({
10114
+ present: z7.boolean().optional(),
10115
+ music_prompt: z7.string().optional(),
9676
10116
  // Absolute second the music enters in the reference (the bed often
9677
10117
  // kicks in mid-ad, after the hook). We start the regenerated track here
9678
10118
  // instead of at 0 so the timing matches.
9679
- starts_at_s: z4.number().optional(),
10119
+ starts_at_s: z7.number().optional(),
9680
10120
  // Populated by the deconstruct when AudD (Shazam-style) recognizes the
9681
10121
  // reference track. We never reuse it — only style the regenerated bed.
9682
- identified_track: z4.object({ title: z4.string().optional(), artist: z4.string().optional() }).loose().nullish()
10122
+ identified_track: z7.object({ title: z7.string().optional(), artist: z7.string().optional() }).loose().nullish()
9683
10123
  }).loose().optional(),
9684
- cast: z4.array(
9685
- z4.object({
9686
- id: z4.string().optional(),
9687
- description: z4.string().optional(),
10124
+ cast: z7.array(
10125
+ z7.object({
10126
+ id: z7.string().optional(),
10127
+ description: z7.string().optional(),
9688
10128
  // The deconstruct's note on the target-market localization (e.g. "native
9689
10129
  // French speaker") — read to derive the spoken-track language code.
9690
- market_localization_note: z4.string().optional()
10130
+ market_localization_note: z7.string().optional()
9691
10131
  }).loose()
9692
10132
  ).optional(),
9693
- voiceover: z4.object({
10133
+ voiceover: z7.object({
9694
10134
  // on_camera | mixed → mouths are on screen (lip-sync candidates);
9695
10135
  // voiceover | none → narration over the picture (no lip-sync).
9696
- mode: z4.string().optional(),
9697
- voice_description: z4.string().optional(),
9698
- persona: z4.string().optional()
10136
+ mode: z7.string().optional(),
10137
+ voice_description: z7.string().optional(),
10138
+ persona: z7.string().optional()
9699
10139
  }).loose().optional(),
9700
10140
  // Visual palette — read only to colour a clean brand-card/CTA plate (the
9701
10141
  // first hex is the dominant brand colour); never to drive frame generation.
9702
- style: z4.object({ palette: z4.array(z4.object({ hex: z4.string().optional() }).loose()).optional() }).loose().optional()
10142
+ style: z7.object({ palette: z7.array(z7.object({ hex: z7.string().optional() }).loose()).optional() }).loose().optional()
9703
10143
  }).loose().optional(),
9704
- scenes: z4.array(Scene).min(1)
10144
+ scenes: z7.array(Scene).min(1)
9705
10145
  }).loose();
9706
10146
  function injectHookPhysicality(blueprint) {
9707
10147
  for (const scene of blueprint.scenes) {
@@ -9711,26 +10151,26 @@ function injectHookPhysicality(blueprint) {
9711
10151
  scene.start_frame_prompt = `${prompt} The subject's physical state IS the scroll-stopper \u2014 render it explicitly, not a calm pose: ${why}.`;
9712
10152
  }
9713
10153
  }
9714
- var AppearsItem = z4.union([z4.number(), z4.object({ scene: z4.number(), edge: z4.string().optional() }).loose()]);
9715
- var RecurringElement = z4.object({
10154
+ var AppearsItem = z7.union([z7.number(), z7.object({ scene: z7.number(), edge: z7.string().optional() }).loose()]);
10155
+ var RecurringElement = z7.object({
9716
10156
  // person | animal | product | logo | badge | other
9717
- type: z4.string(),
9718
- label: z4.string().optional(),
9719
- description: z4.string().optional(),
9720
- expression: z4.string().nullable().optional(),
10157
+ type: z7.string(),
10158
+ label: z7.string().optional(),
10159
+ description: z7.string().optional(),
10160
+ expression: z7.string().nullable().optional(),
9721
10161
  // When the element maps to a global cast entry, its stable id (for annotation).
9722
- cast_id: z4.string().nullable().optional(),
10162
+ cast_id: z7.string().nullable().optional(),
9723
10163
  // The label of another element that is the SAME individual as this one, shown
9724
10164
  // in a DIFFERENT wardrobe/persona/state (e.g. one creator playing skeptic in a
9725
10165
  // pink shirt and believer in a white shirt). Each look gets its own reference
9726
10166
  // slot, but the face/identity must stay identical across them.
9727
- same_as: z4.string().nullable().optional(),
10167
+ same_as: z7.string().nullable().optional(),
9728
10168
  // Scenes the element appears in. Either a bare list of scene indices (both
9729
10169
  // edges) or per-{scene,edge} entries. Both forms are accepted and merged.
9730
- scenes: z4.array(z4.number()).optional(),
9731
- appears_in: z4.array(AppearsItem).optional()
10170
+ scenes: z7.array(z7.number()).optional(),
10171
+ appears_in: z7.array(AppearsItem).optional()
9732
10172
  }).loose();
9733
- var RecurringElements = z4.array(RecurringElement);
10173
+ var RecurringElements = z7.array(RecurringElement);
9734
10174
  function sanitizeId2(raw, fallback) {
9735
10175
  const id = raw.toLowerCase().replace(/[^a-z0-9]+/g, "_").replace(/^_+|_+$/g, "");
9736
10176
  return /^[a-z]/.test(id) ? id : `${fallback}_${id}`.replace(/_+$/g, "") || fallback;
@@ -11193,25 +11633,25 @@ function buildSfxMusic(blueprint, nodes) {
11193
11633
  }
11194
11634
  return tracks;
11195
11635
  }
11196
- var OverlayStyle = z4.object({ color_hex: z4.string().optional(), background: z4.string().optional(), size: z4.string().optional() }).loose();
11197
- var Overlay = z4.object({
11198
- text: z4.string().optional(),
11199
- appears_at_s: z4.number().optional(),
11200
- duration_s: z4.number().optional(),
11201
- position: z4.string().optional(),
11202
- role: z4.string().optional(),
11203
- animation: z4.string().optional(),
11204
- animation_detail: z4.string().optional(),
11636
+ var OverlayStyle = z7.object({ color_hex: z7.string().optional(), background: z7.string().optional(), size: z7.string().optional() }).loose();
11637
+ var Overlay = z7.object({
11638
+ text: z7.string().optional(),
11639
+ appears_at_s: z7.number().optional(),
11640
+ duration_s: z7.number().optional(),
11641
+ position: z7.string().optional(),
11642
+ role: z7.string().optional(),
11643
+ animation: z7.string().optional(),
11644
+ animation_detail: z7.string().optional(),
11205
11645
  style: OverlayStyle.optional()
11206
11646
  }).loose();
11207
- var FloatingElement = z4.object({
11208
- kind: z4.string().optional(),
11209
- description: z4.string().optional(),
11210
- brand_name: z4.string().nullish(),
11211
- what_it_represents: z4.string().optional(),
11212
- appears_at_s: z4.number().optional(),
11213
- duration_s: z4.number().optional(),
11214
- position: z4.string().optional()
11647
+ var FloatingElement = z7.object({
11648
+ kind: z7.string().optional(),
11649
+ description: z7.string().optional(),
11650
+ brand_name: z7.string().nullish(),
11651
+ what_it_represents: z7.string().optional(),
11652
+ appears_at_s: z7.number().optional(),
11653
+ duration_s: z7.number().optional(),
11654
+ position: z7.string().optional()
11215
11655
  }).loose();
11216
11656
  function escapeHtml(s) {
11217
11657
  return s.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
@@ -11243,7 +11683,7 @@ function positionClass(position) {
11243
11683
  function collectCaptions(blueprint) {
11244
11684
  return blueprint.scenes.flatMap((scene) => {
11245
11685
  const sceneStart = scene.start_s ?? 0;
11246
- const overlays = z4.array(Overlay).safeParse(scene.overlays ?? []);
11686
+ const overlays = z7.array(Overlay).safeParse(scene.overlays ?? []);
11247
11687
  return overlays.success ? overlays.data.filter((ov) => Boolean(ov.text?.trim())).map((ov) => {
11248
11688
  const at = ov.appears_at_s ?? sceneStart;
11249
11689
  return { text: ov.text.trim(), at, end: at + (ov.duration_s ?? 2.5), ov };
@@ -11352,7 +11792,7 @@ function buildOverlayHtml(input) {
11352
11792
  if (ovParts.length > 0) blocks.push(ovParts.join("\n"));
11353
11793
  for (const scene of blueprint.scenes) {
11354
11794
  const sceneStart = scene.start_s ?? 0;
11355
- const floats = z4.array(FloatingElement).safeParse(scene.floating_elements ?? []);
11795
+ const floats = z7.array(FloatingElement).safeParse(scene.floating_elements ?? []);
11356
11796
  const parts = (floats.success ? floats.data.map((fe) => floatingStub(fe, sceneStart)) : []).filter(Boolean);
11357
11797
  const pip = uiPipStub(scene);
11358
11798
  if (pip) parts.push(pip);
@@ -11609,8 +12049,8 @@ function buildMotionBoard(blueprint) {
11609
12049
  const end_s = scene.end_s ?? start_s + sceneDurationS(scene);
11610
12050
  cursor = end_s;
11611
12051
  const spoken = sceneSpokenText(scene);
11612
- const overlays = z4.array(Overlay).safeParse(scene.overlays ?? []);
11613
- const floats = z4.array(FloatingElement).safeParse(scene.floating_elements ?? []);
12052
+ const overlays = z7.array(Overlay).safeParse(scene.overlays ?? []);
12053
+ const floats = z7.array(FloatingElement).safeParse(scene.floating_elements ?? []);
11614
12054
  const graphics = [
11615
12055
  ...(overlays.success ? overlays.data : []).filter((ov) => ov.text?.trim()).map((ov) => ({
11616
12056
  kind: "text",
@@ -12401,7 +12841,7 @@ async function waitForReadyImage(deps, imageId, opts = {}) {
12401
12841
  let lastStatus = "unknown";
12402
12842
  while (Date.now() <= deadline) {
12403
12843
  const image = await getImage(deps, imageId);
12404
- lastStatus = image.status ?? "unknown";
12844
+ lastStatus = image.status;
12405
12845
  if (image.status === "ready") {
12406
12846
  return image;
12407
12847
  }
@@ -13739,7 +14179,9 @@ var findCommand = defineCommand101({
13739
14179
  process.exit(1);
13740
14180
  }
13741
14181
  const body = { query };
13742
- if (args.sources) body.sources = args.sources.split(",").filter(Boolean);
14182
+ if (args.sources) {
14183
+ body.sources = args.sources.split(",").filter(Boolean);
14184
+ }
13743
14185
  if (args.limit) body.limit = Number(args.limit);
13744
14186
  if (args.fallback) body.fallback = true;
13745
14187
  if (args.threshold) body.threshold = Number(args.threshold);
@@ -13826,8 +14268,15 @@ function buildGenerateBody(args, prompt) {
13826
14268
  if (args["aspect-ratio"]) body.aspectRatio = args["aspect-ratio"];
13827
14269
  if (args["image-size"]) body.imageSize = args["image-size"];
13828
14270
  if (args.strength !== void 0) body.strength = Number(args.strength);
13829
- if (args["rgb-colors"]) body.rgbColors = parseJsonArg(args["rgb-colors"], "rgb-colors");
13830
- if (args["bg-rgb"]) body.backgroundRgbColor = parseJsonArg(args["bg-rgb"], "bg-rgb");
14271
+ if (args["rgb-colors"]) {
14272
+ body.rgbColors = parseJsonArg(args["rgb-colors"], "rgb-colors");
14273
+ }
14274
+ if (args["bg-rgb"]) {
14275
+ body.backgroundRgbColor = parseJsonArg(
14276
+ args["bg-rgb"],
14277
+ "bg-rgb"
14278
+ );
14279
+ }
13831
14280
  if (args.context) body.descriptionContext = args.context;
13832
14281
  return body;
13833
14282
  }
@@ -15783,10 +16232,10 @@ var upscaleCommand = defineCommand118({
15783
16232
  writeJson({ ok: true, data: { imageId, status: "completed", image: doc } });
15784
16233
  return;
15785
16234
  }
15786
- if (doc.upscaleConfig?.status === "error") {
16235
+ if (!doc.upscaleConfig) {
15787
16236
  writeJson({
15788
16237
  ok: false,
15789
- error: { code: "IMAGE_PROCESSING_ERROR", message: doc.upscaleConfig.error ?? "Upscale failed" }
16238
+ error: { code: "IMAGE_PROCESSING_ERROR", message: "Upscale failed" }
15790
16239
  });
15791
16240
  process.exit(1);
15792
16241
  }