@koda-sl/baker-cli 0.103.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
@@ -926,6 +926,454 @@ var actionsRemoveDraftOpRequestSchema = z2.object({
926
926
  target: removeDraftOpTargetSchema
927
927
  });
928
928
  var actionsRemoveDraftOpResponseSchema = okOnlySchema();
929
+ var actionsTagsListResponseSchema = z2.object({ markdown: z2.string() });
930
+ var actionsTagsCreateRequestSchema = z2.object({
931
+ name: z2.string(),
932
+ description: z2.string().optional()
933
+ });
934
+ var actionsTagsCreateResponseSchema = okResponse(z2.object({ tagId: z2.string() }));
935
+ var actionsTagsDeleteRequestSchema = z2.object({ name: z2.string() });
936
+ var actionsTagsDeleteResponseSchema = okOnlySchema();
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) });
929
1377
 
930
1378
  // src/commands/actions/complete.ts
931
1379
  import { defineCommand as defineCommand2 } from "citty";
@@ -8801,27 +9249,27 @@ import path5 from "path";
8801
9249
  import { defineCommand as defineCommand82 } from "citty";
8802
9250
 
8803
9251
  // src/engine/scaffold/staticAd.ts
8804
- import { z as z3 } from "zod";
9252
+ import { z as z6 } from "zod";
8805
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"]);
8806
9254
  var DEFAULT_ASPECT_RATIO = "9:16";
8807
- var Blueprint = z3.object({
8808
- meta: z3.object({ estimated_aspect_ratio: z3.string().optional() }).loose().optional(),
8809
- 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()
8810
9258
  }).loose();
8811
- var ElementLocator = z3.object({
8812
- collection: z3.enum(["subjects", "people", "brands_logos"]),
8813
- index: z3.number().int().nonnegative()
9259
+ var ElementLocator = z6.object({
9260
+ collection: z6.enum(["subjects", "people", "brands_logos"]),
9261
+ index: z6.number().int().nonnegative()
8814
9262
  }).loose();
8815
- var MainElement = z3.object({
9263
+ var MainElement = z6.object({
8816
9264
  // logo | product | person | animal | badge | other
8817
- type: z3.string(),
8818
- label: z3.string().optional(),
8819
- description: z3.string().optional(),
8820
- expression: z3.string().nullable().optional(),
8821
- 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(),
8822
9270
  locator: ElementLocator.optional()
8823
9271
  }).loose();
8824
- var MainElements = z3.array(MainElement);
9272
+ var MainElements = z6.array(MainElement);
8825
9273
  function sanitizeId(raw, fallback) {
8826
9274
  const id = raw.toLowerCase().replace(/[^a-z0-9]+/g, "_").replace(/^_+|_+$/g, "");
8827
9275
  return /^[a-z]/.test(id) ? id : `${fallback}_${id}`.replace(/_+$/g, "") || fallback;
@@ -9316,7 +9764,7 @@ import { toCardinal as nwKo } from "n2words/ko-KR";
9316
9764
  import { toCardinal as nwNl } from "n2words/nl-NL";
9317
9765
  import { toCardinal as nwPl } from "n2words/pl-PL";
9318
9766
  import { toCardinal as nwPt } from "n2words/pt-PT";
9319
- import { z as z4 } from "zod";
9767
+ import { z as z7 } from "zod";
9320
9768
 
9321
9769
  // src/engine/scaffold/lib/shoot-modes.ts
9322
9770
  var SHOOT_MODES = [
@@ -9573,49 +10021,49 @@ function trimArgs(durationS, offsetS = 0) {
9573
10021
  "{{out.video}}"
9574
10022
  ];
9575
10023
  }
9576
- var FrameAsset = z4.object({ url: z4.string().optional() }).loose().optional();
9577
- var DialogueLine = z4.object({
9578
- speaker: z4.string().optional(),
9579
- 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(),
9580
10028
  // Absolute seconds on the source timeline (the deconstruct emits both).
9581
- start_s: z4.number().optional(),
9582
- end_s: z4.number().optional(),
9583
- delivery: z4.string().optional(),
9584
- 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()
9585
10033
  }).loose();
9586
- var Sfx = z4.object({
9587
- at_s: z4.number().optional(),
9588
- duration_s: z4.number().optional(),
9589
- sound_effect_prompt: z4.string().optional(),
9590
- 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()
9591
10039
  }).loose();
9592
- var CompositionRegion = z4.object({
10040
+ var CompositionRegion = z7.object({
9593
10041
  // full | top | bottom | left | right | inset
9594
- panel: z4.string().optional(),
10042
+ panel: z7.string().optional(),
9595
10043
  // 9-grid anchor for an `inset` presenter box.
9596
- position: z4.string().optional(),
9597
- is_presenter: z4.boolean().optional(),
10044
+ position: z7.string().optional(),
10045
+ is_presenter: z7.boolean().optional(),
9598
10046
  // The cast id shown/speaking in this region (routes lip-sync + element refs).
9599
- cast_ref: z4.string().optional(),
9600
- summary: z4.string().optional(),
9601
- frame_prompt: z4.string().optional(),
9602
- 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()
9603
10051
  }).loose();
9604
- var SceneComposition = z4.object({
10052
+ var SceneComposition = z7.object({
9605
10053
  // full_frame (default) | split_screen | pip | keyed_overlay
9606
- layout: z4.string().optional(),
10054
+ layout: z7.string().optional(),
9607
10055
  // split_screen only: vertical (top/bottom) | horizontal (left/right).
9608
- split_axis: z4.string().optional(),
9609
- regions: z4.array(CompositionRegion).optional()
10056
+ split_axis: z7.string().optional(),
10057
+ regions: z7.array(CompositionRegion).optional()
9610
10058
  }).loose();
9611
- var CameraMotion = z4.object({ movement: z4.string().optional(), detail: z4.string().optional() }).loose();
9612
- var TranscriptWord = z4.object({ text: z4.string().optional() }).loose();
9613
- var Scene = z4.object({
9614
- start_s: z4.number().optional(),
9615
- end_s: z4.number().optional(),
9616
- duration_s: z4.number().optional(),
9617
- summary: z4.string().optional(),
9618
- 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(),
9619
10067
  // The scene's spatial layout. Absent/full_frame ⇒ one uncut shot (default path).
9620
10068
  // A layered layout (split_screen/pip/keyed_overlay) with regions ⇒ the scaffold
9621
10069
  // builds one clip per region and stacks/overlays them into the scene picture.
@@ -9623,77 +10071,77 @@ var Scene = z4.object({
9623
10071
  // The capture "look" for this scene — selected from the ad-native shoot-mode
9624
10072
  // grammar (see lib/shoot-modes.ts). When absent the scaffold auto-derives a
9625
10073
  // UGC/product mode; a human can override per scene by setting this.
9626
- shoot_mode: z4.string().optional(),
10074
+ shoot_mode: z7.string().optional(),
9627
10075
  // Diegetic ambient the clip's native audio should carry (no music). When
9628
10076
  // absent the scene falls back to its shoot mode's default ambience.
9629
- ambient: z4.string().optional(),
10077
+ ambient: z7.string().optional(),
9630
10078
  camera_motion: CameraMotion.optional(),
9631
- start_frame_prompt: z4.string().optional(),
9632
- end_frame_prompt: z4.string().optional(),
9633
- 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(),
9634
10082
  // The scene's role in the ad's persuasion arc (DECON-supplied); drives the
9635
10083
  // script re-craft checklist. Inferred from position when absent.
9636
- narrative_role: z4.string().optional(),
10084
+ narrative_role: z7.string().optional(),
9637
10085
  // DECON-supplied on the HOOK scene: the engineered physical/emotional state that
9638
10086
  // makes the first frame stop the scroll (sweaty/breathless/urgent …). Injected
9639
10087
  // into the hook's start-frame description so the generator renders that state,
9640
10088
  // not a calm influencer (CCA-11).
9641
- 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(),
9642
10090
  // DECON-supplied per-scene location (so a gym hook isn't flattened to "home").
9643
- scene_setting: z4.string().optional(),
10091
+ scene_setting: z7.string().optional(),
9644
10092
  // How this scene cuts to the next (DECON-supplied). A recognized non-cut type
9645
10093
  // (fade/whip/zoom/dissolve/swipe) is reproduced as an ffmpeg xfade at the
9646
10094
  // boundary; cut/match_cut/none/other stay hard cuts. The last scene's value is
9647
10095
  // ignored (nothing follows it).
9648
- transition_out: z4.object({ type: z4.string().optional(), description: z4.string().optional() }).loose().optional(),
9649
- dialogue: z4.array(DialogueLine).optional(),
9650
- sfx: z4.array(Sfx).optional(),
9651
- overlays: z4.array(z4.unknown()).optional(),
9652
- floating_elements: z4.array(z4.unknown()).optional(),
9653
- 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(),
9654
10102
  start_frame_asset: FrameAsset,
9655
10103
  end_frame_asset: FrameAsset,
9656
10104
  // DECON-supplied: true when this scene is a length-split CONTINUATION of the
9657
10105
  // previous one (the SAME physical shot, broken up only because it exceeded the
9658
10106
  // clip ceiling). The scaffold then shares the splice keyframe — this scene's
9659
10107
  // start frame IS the previous scene's end frame — so the join is seamless.
9660
- continues_previous: z4.boolean().optional()
10108
+ continues_previous: z7.boolean().optional()
9661
10109
  }).loose();
9662
- var VideoBlueprint = z4.object({
9663
- source: z4.object({ aspect_ratio: z4.string().optional(), duration_s: z4.number().optional() }).loose().optional(),
9664
- global: z4.object({
9665
- music: z4.object({
9666
- present: z4.boolean().optional(),
9667
- 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(),
9668
10116
  // Absolute second the music enters in the reference (the bed often
9669
10117
  // kicks in mid-ad, after the hook). We start the regenerated track here
9670
10118
  // instead of at 0 so the timing matches.
9671
- starts_at_s: z4.number().optional(),
10119
+ starts_at_s: z7.number().optional(),
9672
10120
  // Populated by the deconstruct when AudD (Shazam-style) recognizes the
9673
10121
  // reference track. We never reuse it — only style the regenerated bed.
9674
- 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()
9675
10123
  }).loose().optional(),
9676
- cast: z4.array(
9677
- z4.object({
9678
- id: z4.string().optional(),
9679
- description: z4.string().optional(),
10124
+ cast: z7.array(
10125
+ z7.object({
10126
+ id: z7.string().optional(),
10127
+ description: z7.string().optional(),
9680
10128
  // The deconstruct's note on the target-market localization (e.g. "native
9681
10129
  // French speaker") — read to derive the spoken-track language code.
9682
- market_localization_note: z4.string().optional()
10130
+ market_localization_note: z7.string().optional()
9683
10131
  }).loose()
9684
10132
  ).optional(),
9685
- voiceover: z4.object({
10133
+ voiceover: z7.object({
9686
10134
  // on_camera | mixed → mouths are on screen (lip-sync candidates);
9687
10135
  // voiceover | none → narration over the picture (no lip-sync).
9688
- mode: z4.string().optional(),
9689
- voice_description: z4.string().optional(),
9690
- persona: z4.string().optional()
10136
+ mode: z7.string().optional(),
10137
+ voice_description: z7.string().optional(),
10138
+ persona: z7.string().optional()
9691
10139
  }).loose().optional(),
9692
10140
  // Visual palette — read only to colour a clean brand-card/CTA plate (the
9693
10141
  // first hex is the dominant brand colour); never to drive frame generation.
9694
- 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()
9695
10143
  }).loose().optional(),
9696
- scenes: z4.array(Scene).min(1)
10144
+ scenes: z7.array(Scene).min(1)
9697
10145
  }).loose();
9698
10146
  function injectHookPhysicality(blueprint) {
9699
10147
  for (const scene of blueprint.scenes) {
@@ -9703,26 +10151,26 @@ function injectHookPhysicality(blueprint) {
9703
10151
  scene.start_frame_prompt = `${prompt} The subject's physical state IS the scroll-stopper \u2014 render it explicitly, not a calm pose: ${why}.`;
9704
10152
  }
9705
10153
  }
9706
- var AppearsItem = z4.union([z4.number(), z4.object({ scene: z4.number(), edge: z4.string().optional() }).loose()]);
9707
- 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({
9708
10156
  // person | animal | product | logo | badge | other
9709
- type: z4.string(),
9710
- label: z4.string().optional(),
9711
- description: z4.string().optional(),
9712
- 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(),
9713
10161
  // When the element maps to a global cast entry, its stable id (for annotation).
9714
- cast_id: z4.string().nullable().optional(),
10162
+ cast_id: z7.string().nullable().optional(),
9715
10163
  // The label of another element that is the SAME individual as this one, shown
9716
10164
  // in a DIFFERENT wardrobe/persona/state (e.g. one creator playing skeptic in a
9717
10165
  // pink shirt and believer in a white shirt). Each look gets its own reference
9718
10166
  // slot, but the face/identity must stay identical across them.
9719
- same_as: z4.string().nullable().optional(),
10167
+ same_as: z7.string().nullable().optional(),
9720
10168
  // Scenes the element appears in. Either a bare list of scene indices (both
9721
10169
  // edges) or per-{scene,edge} entries. Both forms are accepted and merged.
9722
- scenes: z4.array(z4.number()).optional(),
9723
- appears_in: z4.array(AppearsItem).optional()
10170
+ scenes: z7.array(z7.number()).optional(),
10171
+ appears_in: z7.array(AppearsItem).optional()
9724
10172
  }).loose();
9725
- var RecurringElements = z4.array(RecurringElement);
10173
+ var RecurringElements = z7.array(RecurringElement);
9726
10174
  function sanitizeId2(raw, fallback) {
9727
10175
  const id = raw.toLowerCase().replace(/[^a-z0-9]+/g, "_").replace(/^_+|_+$/g, "");
9728
10176
  return /^[a-z]/.test(id) ? id : `${fallback}_${id}`.replace(/_+$/g, "") || fallback;
@@ -11185,25 +11633,25 @@ function buildSfxMusic(blueprint, nodes) {
11185
11633
  }
11186
11634
  return tracks;
11187
11635
  }
11188
- var OverlayStyle = z4.object({ color_hex: z4.string().optional(), background: z4.string().optional(), size: z4.string().optional() }).loose();
11189
- var Overlay = z4.object({
11190
- text: z4.string().optional(),
11191
- appears_at_s: z4.number().optional(),
11192
- duration_s: z4.number().optional(),
11193
- position: z4.string().optional(),
11194
- role: z4.string().optional(),
11195
- animation: z4.string().optional(),
11196
- 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(),
11197
11645
  style: OverlayStyle.optional()
11198
11646
  }).loose();
11199
- var FloatingElement = z4.object({
11200
- kind: z4.string().optional(),
11201
- description: z4.string().optional(),
11202
- brand_name: z4.string().nullish(),
11203
- what_it_represents: z4.string().optional(),
11204
- appears_at_s: z4.number().optional(),
11205
- duration_s: z4.number().optional(),
11206
- 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()
11207
11655
  }).loose();
11208
11656
  function escapeHtml(s) {
11209
11657
  return s.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
@@ -11235,7 +11683,7 @@ function positionClass(position) {
11235
11683
  function collectCaptions(blueprint) {
11236
11684
  return blueprint.scenes.flatMap((scene) => {
11237
11685
  const sceneStart = scene.start_s ?? 0;
11238
- const overlays = z4.array(Overlay).safeParse(scene.overlays ?? []);
11686
+ const overlays = z7.array(Overlay).safeParse(scene.overlays ?? []);
11239
11687
  return overlays.success ? overlays.data.filter((ov) => Boolean(ov.text?.trim())).map((ov) => {
11240
11688
  const at = ov.appears_at_s ?? sceneStart;
11241
11689
  return { text: ov.text.trim(), at, end: at + (ov.duration_s ?? 2.5), ov };
@@ -11344,7 +11792,7 @@ function buildOverlayHtml(input) {
11344
11792
  if (ovParts.length > 0) blocks.push(ovParts.join("\n"));
11345
11793
  for (const scene of blueprint.scenes) {
11346
11794
  const sceneStart = scene.start_s ?? 0;
11347
- const floats = z4.array(FloatingElement).safeParse(scene.floating_elements ?? []);
11795
+ const floats = z7.array(FloatingElement).safeParse(scene.floating_elements ?? []);
11348
11796
  const parts = (floats.success ? floats.data.map((fe) => floatingStub(fe, sceneStart)) : []).filter(Boolean);
11349
11797
  const pip = uiPipStub(scene);
11350
11798
  if (pip) parts.push(pip);
@@ -11601,8 +12049,8 @@ function buildMotionBoard(blueprint) {
11601
12049
  const end_s = scene.end_s ?? start_s + sceneDurationS(scene);
11602
12050
  cursor = end_s;
11603
12051
  const spoken = sceneSpokenText(scene);
11604
- const overlays = z4.array(Overlay).safeParse(scene.overlays ?? []);
11605
- 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 ?? []);
11606
12054
  const graphics = [
11607
12055
  ...(overlays.success ? overlays.data : []).filter((ov) => ov.text?.trim()).map((ov) => ({
11608
12056
  kind: "text",
@@ -12393,7 +12841,7 @@ async function waitForReadyImage(deps, imageId, opts = {}) {
12393
12841
  let lastStatus = "unknown";
12394
12842
  while (Date.now() <= deadline) {
12395
12843
  const image = await getImage(deps, imageId);
12396
- lastStatus = image.status ?? "unknown";
12844
+ lastStatus = image.status;
12397
12845
  if (image.status === "ready") {
12398
12846
  return image;
12399
12847
  }
@@ -13731,7 +14179,9 @@ var findCommand = defineCommand101({
13731
14179
  process.exit(1);
13732
14180
  }
13733
14181
  const body = { query };
13734
- if (args.sources) body.sources = args.sources.split(",").filter(Boolean);
14182
+ if (args.sources) {
14183
+ body.sources = args.sources.split(",").filter(Boolean);
14184
+ }
13735
14185
  if (args.limit) body.limit = Number(args.limit);
13736
14186
  if (args.fallback) body.fallback = true;
13737
14187
  if (args.threshold) body.threshold = Number(args.threshold);
@@ -13818,8 +14268,15 @@ function buildGenerateBody(args, prompt) {
13818
14268
  if (args["aspect-ratio"]) body.aspectRatio = args["aspect-ratio"];
13819
14269
  if (args["image-size"]) body.imageSize = args["image-size"];
13820
14270
  if (args.strength !== void 0) body.strength = Number(args.strength);
13821
- if (args["rgb-colors"]) body.rgbColors = parseJsonArg(args["rgb-colors"], "rgb-colors");
13822
- 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
+ }
13823
14280
  if (args.context) body.descriptionContext = args.context;
13824
14281
  return body;
13825
14282
  }
@@ -15775,10 +16232,10 @@ var upscaleCommand = defineCommand118({
15775
16232
  writeJson({ ok: true, data: { imageId, status: "completed", image: doc } });
15776
16233
  return;
15777
16234
  }
15778
- if (doc.upscaleConfig?.status === "error") {
16235
+ if (!doc.upscaleConfig) {
15779
16236
  writeJson({
15780
16237
  ok: false,
15781
- error: { code: "IMAGE_PROCESSING_ERROR", message: doc.upscaleConfig.error ?? "Upscale failed" }
16238
+ error: { code: "IMAGE_PROCESSING_ERROR", message: "Upscale failed" }
15782
16239
  });
15783
16240
  process.exit(1);
15784
16241
  }