@koda-sl/baker-cli 0.345.0 → 0.346.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/README.md +2 -0
- package/dist/{chunk-KGDL7F7M.js → chunk-2IC3CGQO.js} +3 -3
- package/dist/chunk-2OKSJNLA.js +855 -0
- package/dist/chunk-2OKSJNLA.js.map +1 -0
- package/dist/{chunk-XPUSSDLR.js → chunk-4QXKWIFC.js} +3 -3
- package/dist/{chunk-JWMLQSGK.js → chunk-NA5CPMUA.js} +4 -4
- package/dist/{chunk-PWGY347J.js → chunk-XWHHYHKQ.js} +2 -2
- package/dist/{chunk-FFOURYP5.js → chunk-YBD3W4M7.js} +6 -5
- package/dist/chunk-YBD3W4M7.js.map +1 -0
- package/dist/cli.js +50 -463
- package/dist/cli.js.map +1 -1
- package/dist/{client-PWRZOA3Q.js → client-ODCNYCP4.js} +4 -4
- package/dist/engine/index.js +3 -3
- package/dist/{env-TQTHWLBN.js → env-BSG7TY5Y.js} +6 -2
- package/dist/{output-HD63GTWI.js → output-2XBCYF7L.js} +5 -5
- package/dist/{shared-5662SBDW.js → shared-RYAF7Y7H.js} +6 -6
- package/package.json +1 -1
- package/dist/chunk-4VP5WWPR.js +0 -376
- package/dist/chunk-4VP5WWPR.js.map +0 -1
- package/dist/chunk-FFOURYP5.js.map +0 -1
- /package/dist/{chunk-KGDL7F7M.js.map → chunk-2IC3CGQO.js.map} +0 -0
- /package/dist/{chunk-XPUSSDLR.js.map → chunk-4QXKWIFC.js.map} +0 -0
- /package/dist/{chunk-JWMLQSGK.js.map → chunk-NA5CPMUA.js.map} +0 -0
- /package/dist/{chunk-PWGY347J.js.map → chunk-XWHHYHKQ.js.map} +0 -0
- /package/dist/{client-PWRZOA3Q.js.map → client-ODCNYCP4.js.map} +0 -0
- /package/dist/{env-TQTHWLBN.js.map → env-BSG7TY5Y.js.map} +0 -0
- /package/dist/{output-HD63GTWI.js.map → output-2XBCYF7L.js.map} +0 -0
- /package/dist/{shared-5662SBDW.js.map → shared-RYAF7Y7H.js.map} +0 -0
package/dist/cli.js
CHANGED
|
@@ -67,7 +67,7 @@ import {
|
|
|
67
67
|
validateCanvasDeep,
|
|
68
68
|
withoutCastName,
|
|
69
69
|
ytDlpBlockSignal
|
|
70
|
-
} from "./chunk-
|
|
70
|
+
} from "./chunk-YBD3W4M7.js";
|
|
71
71
|
import {
|
|
72
72
|
csvOrJson,
|
|
73
73
|
daysAgoIso,
|
|
@@ -76,7 +76,7 @@ import {
|
|
|
76
76
|
resolveAccountIdArg,
|
|
77
77
|
resolveEffectiveStatus,
|
|
78
78
|
todayIso
|
|
79
|
-
} from "./chunk-
|
|
79
|
+
} from "./chunk-NA5CPMUA.js";
|
|
80
80
|
import {
|
|
81
81
|
buildQueryCacheKey,
|
|
82
82
|
cacheGet,
|
|
@@ -92,33 +92,42 @@ import {
|
|
|
92
92
|
writeAdsJson,
|
|
93
93
|
writeAdsOutput,
|
|
94
94
|
writeJsonEnvelope
|
|
95
|
-
} from "./chunk-
|
|
95
|
+
} from "./chunk-2IC3CGQO.js";
|
|
96
96
|
import {
|
|
97
97
|
ApiError,
|
|
98
98
|
apiGet,
|
|
99
99
|
apiGetWithHeaders,
|
|
100
100
|
apiPost,
|
|
101
101
|
validateConvexId
|
|
102
|
-
} from "./chunk-
|
|
102
|
+
} from "./chunk-4QXKWIFC.js";
|
|
103
103
|
import {
|
|
104
104
|
installExitRecord,
|
|
105
105
|
installStreamTaps,
|
|
106
106
|
logInvocation
|
|
107
|
-
} from "./chunk-
|
|
107
|
+
} from "./chunk-XWHHYHKQ.js";
|
|
108
108
|
import {
|
|
109
|
+
adContentNormalizer,
|
|
109
110
|
captureBudgetMs,
|
|
110
111
|
captureProxyCredentials,
|
|
111
112
|
captureVimeoCookie,
|
|
113
|
+
compactImage,
|
|
114
|
+
compactVideo,
|
|
112
115
|
getEnv,
|
|
113
116
|
hasOpenRouterKey,
|
|
114
117
|
isProxyFailure,
|
|
115
118
|
openRouterKey,
|
|
119
|
+
optionalChatId,
|
|
116
120
|
plannedRoutes,
|
|
117
121
|
refuseNonPublicUrl,
|
|
118
122
|
requireChatId,
|
|
119
123
|
resolveChatId,
|
|
120
|
-
shouldEscalate
|
|
121
|
-
|
|
124
|
+
shouldEscalate,
|
|
125
|
+
testimonialNormalizer,
|
|
126
|
+
videoNormalizer,
|
|
127
|
+
winningAdNormalizer,
|
|
128
|
+
writeJson,
|
|
129
|
+
writeOutput
|
|
130
|
+
} from "./chunk-2OKSJNLA.js";
|
|
122
131
|
|
|
123
132
|
// src/cli.ts
|
|
124
133
|
import { defineCommand as defineCommand245, runMain } from "citty";
|
|
@@ -159,420 +168,6 @@ import { defineCommand as defineCommand18 } from "citty";
|
|
|
159
168
|
// src/commands/actions/claim.ts
|
|
160
169
|
import { defineCommand } from "citty";
|
|
161
170
|
|
|
162
|
-
// src/output.ts
|
|
163
|
-
var ASPECT_RATIO_MAP = {
|
|
164
|
-
"1:1": 1,
|
|
165
|
-
"16:9": 16 / 9,
|
|
166
|
-
"9:16": 9 / 16,
|
|
167
|
-
"2:3": 2 / 3,
|
|
168
|
-
"3:4": 3 / 4,
|
|
169
|
-
"1:2": 1 / 2,
|
|
170
|
-
"2:1": 2,
|
|
171
|
-
"4:5": 4 / 5,
|
|
172
|
-
"3:2": 3 / 2,
|
|
173
|
-
"4:3": 4 / 3
|
|
174
|
-
};
|
|
175
|
-
var ASPECT_RATIO_TOLERANCE = 0.08;
|
|
176
|
-
function formatAspectRatio(ratio) {
|
|
177
|
-
if (ratio === void 0 || ratio === null) {
|
|
178
|
-
return null;
|
|
179
|
-
}
|
|
180
|
-
for (const [label, value] of Object.entries(ASPECT_RATIO_MAP)) {
|
|
181
|
-
if (Math.abs(ratio - value) / value < ASPECT_RATIO_TOLERANCE) {
|
|
182
|
-
return label;
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
return null;
|
|
186
|
-
}
|
|
187
|
-
function groupSummary(record) {
|
|
188
|
-
const key = record.groupKey;
|
|
189
|
-
if (typeof key !== "string" || !key) {
|
|
190
|
-
return null;
|
|
191
|
-
}
|
|
192
|
-
const index = typeof record.groupIndex === "number" ? record.groupIndex : null;
|
|
193
|
-
const size = typeof record.groupSize === "number" ? record.groupSize : null;
|
|
194
|
-
return {
|
|
195
|
-
key,
|
|
196
|
-
kind: typeof record.groupKind === "string" ? record.groupKind : null,
|
|
197
|
-
position: index === null ? null : size === null ? `${index + 1}` : `${index + 1} of ${size}`,
|
|
198
|
-
title: typeof record.groupTitle === "string" ? record.groupTitle : null,
|
|
199
|
-
url: typeof record.groupUrl === "string" ? record.groupUrl : null
|
|
200
|
-
};
|
|
201
|
-
}
|
|
202
|
-
function peopleLines(value) {
|
|
203
|
-
if (!Array.isArray(value)) {
|
|
204
|
-
return [];
|
|
205
|
-
}
|
|
206
|
-
return value.flatMap((entry) => {
|
|
207
|
-
const person = asRecord(entry);
|
|
208
|
-
const role = typeof person.role === "string" ? person.role : "";
|
|
209
|
-
if (!role) {
|
|
210
|
-
return [];
|
|
211
|
-
}
|
|
212
|
-
const identity = typeof person.identity === "string" && person.identity ? ` \u2014 ${person.identity}` : "";
|
|
213
|
-
const appearance = typeof person.appearance === "string" && person.appearance ? ` (${person.appearance})` : "";
|
|
214
|
-
const speaking = person.speaking === true ? " [speaking]" : "";
|
|
215
|
-
return [`${role}${identity}${appearance}${speaking}`];
|
|
216
|
-
});
|
|
217
|
-
}
|
|
218
|
-
function compactImage(image) {
|
|
219
|
-
const analysis = asRecord(image.analysis);
|
|
220
|
-
return {
|
|
221
|
-
_id: String(image._id ?? ""),
|
|
222
|
-
name: String(image.name ?? ""),
|
|
223
|
-
imageUrl: String(image.imageUrl ?? ""),
|
|
224
|
-
description: String(image.description ?? ""),
|
|
225
|
-
tags: Array.isArray(image.tags) ? image.tags : [],
|
|
226
|
-
// Two numbers that are not about choosing the image but about placing it.
|
|
227
|
-
// A remote <BakerImage> with no width/height makes Astro DOWNLOAD the file
|
|
228
|
-
// at build time just to measure it — one request per image per build, on a
|
|
229
|
-
// build that is otherwise offline, and a single dropped connection there
|
|
230
|
-
// fails a client's whole verify. They are cheap enough to always carry, and
|
|
231
|
-
// burying them behind --full meant the agent placing the image never had
|
|
232
|
-
// them.
|
|
233
|
-
width: typeof image.width === "number" ? image.width : null,
|
|
234
|
-
height: typeof image.height === "number" ? image.height : null,
|
|
235
|
-
// The facts that decide a pick, so choosing does not need a second call:
|
|
236
|
-
// whose brand it is, who is in it, and what text is burned in.
|
|
237
|
-
subject: typeof analysis.subject === "string" ? analysis.subject : null,
|
|
238
|
-
brandOwnership: typeof analysis.brandOwnership === "string" ? analysis.brandOwnership : null,
|
|
239
|
-
people: peopleLines(analysis.people),
|
|
240
|
-
textInImage: Array.isArray(analysis.textInImage) ? analysis.textInImage : [],
|
|
241
|
-
group: groupSummary(image)
|
|
242
|
-
};
|
|
243
|
-
}
|
|
244
|
-
function fullImage(image) {
|
|
245
|
-
const compact3 = compactImage(image);
|
|
246
|
-
return {
|
|
247
|
-
...compact3,
|
|
248
|
-
aspectRatio: formatAspectRatio(image.aspectRatio),
|
|
249
|
-
dominantColor: image.dominantColor ?? null,
|
|
250
|
-
imagePalette: Array.isArray(image.imagePalette) ? image.imagePalette : [],
|
|
251
|
-
source: String(image.source ?? ""),
|
|
252
|
-
externalUrl: image.externalUrl ?? null,
|
|
253
|
-
originalFilename: image.originalFilename ?? null,
|
|
254
|
-
descriptionContext: image.descriptionContext ?? null,
|
|
255
|
-
style: typeof asRecord(image.analysis).style === "string" ? asRecord(image.analysis).style : null,
|
|
256
|
-
composition: typeof asRecord(image.analysis).composition === "string" ? asRecord(image.analysis).composition : null,
|
|
257
|
-
usageNotes: typeof asRecord(image.analysis).usageNotes === "string" ? asRecord(image.analysis).usageNotes : null,
|
|
258
|
-
createdAt: image.createdAt ?? null
|
|
259
|
-
};
|
|
260
|
-
}
|
|
261
|
-
function imageNormalizer(record, full) {
|
|
262
|
-
if (full) {
|
|
263
|
-
return fullImage(record);
|
|
264
|
-
}
|
|
265
|
-
return compactImage(record);
|
|
266
|
-
}
|
|
267
|
-
function compactVideo(video) {
|
|
268
|
-
const analysis = asRecord(video.analysis);
|
|
269
|
-
const sceneCount = typeof video.sceneCount === "number" ? video.sceneCount : Array.isArray(video.scenes) ? video.scenes.length : 0;
|
|
270
|
-
return {
|
|
271
|
-
_id: String(video._id ?? ""),
|
|
272
|
-
name: String(video.name ?? ""),
|
|
273
|
-
thumbnailUrl: String(video.thumbnailUrl ?? ""),
|
|
274
|
-
description: String(video.description ?? ""),
|
|
275
|
-
tags: Array.isArray(video.tags) ? video.tags : [],
|
|
276
|
-
status: String(video.status ?? ""),
|
|
277
|
-
// What decides whether this clip is usable, without a second call: who is
|
|
278
|
-
// on camera and in what role, what language they speak, how it opens, and
|
|
279
|
-
// how many beats there are to cut from.
|
|
280
|
-
subject: typeof analysis.subject === "string" ? analysis.subject : null,
|
|
281
|
-
brandOwnership: typeof analysis.brandOwnership === "string" ? analysis.brandOwnership : null,
|
|
282
|
-
people: peopleLines(analysis.people),
|
|
283
|
-
spokenLanguages: Array.isArray(analysis.spokenLanguages) ? analysis.spokenLanguages : [],
|
|
284
|
-
hook: typeof analysis.hook === "string" ? analysis.hook : null,
|
|
285
|
-
sceneCount,
|
|
286
|
-
group: groupSummary(video)
|
|
287
|
-
};
|
|
288
|
-
}
|
|
289
|
-
function sceneDecoration(scene) {
|
|
290
|
-
const shot = typeof scene.shot === "string" && scene.shot ? ` [${scene.shot}]` : "";
|
|
291
|
-
const change = typeof scene.visualChange === "string" && scene.visualChange ? ` <${scene.visualChange}>` : "";
|
|
292
|
-
const overlayText = Array.isArray(scene.onScreenText) ? scene.onScreenText.filter(Boolean) : [];
|
|
293
|
-
let overlay = "";
|
|
294
|
-
if (scene.hasOverlay === true) {
|
|
295
|
-
overlay = overlayText.length > 0 ? ` \u2014 banner: "${overlayText.join('" / "')}"` : " \u2014 banner";
|
|
296
|
-
} else if (scene.hasOverlay === false) {
|
|
297
|
-
overlay = " \u2014 clean frame";
|
|
298
|
-
}
|
|
299
|
-
const spoken = typeof scene.spoken === "string" && scene.spoken ? ` \u2014 says: "${scene.spoken}"` : "";
|
|
300
|
-
return `${shot}${change}${overlay}${spoken}`;
|
|
301
|
-
}
|
|
302
|
-
function sceneLines(value) {
|
|
303
|
-
if (!Array.isArray(value)) {
|
|
304
|
-
return [];
|
|
305
|
-
}
|
|
306
|
-
return value.flatMap((s) => {
|
|
307
|
-
const scene = asRecord(s);
|
|
308
|
-
const title = typeof scene.title === "string" ? scene.title : "";
|
|
309
|
-
if (!title) {
|
|
310
|
-
return [];
|
|
311
|
-
}
|
|
312
|
-
const start = round2(scene.startSecond);
|
|
313
|
-
const end = round2(scene.endSecond);
|
|
314
|
-
const range = start !== null && end !== null ? ` (${start}-${end}s)` : "";
|
|
315
|
-
return [`${title}${range}${sceneDecoration(scene)}`];
|
|
316
|
-
});
|
|
317
|
-
}
|
|
318
|
-
function fullVideo(video) {
|
|
319
|
-
const compact3 = compactVideo(video);
|
|
320
|
-
return {
|
|
321
|
-
...compact3,
|
|
322
|
-
duration: video.duration ?? null,
|
|
323
|
-
muxPlaybackId: String(video.muxPlaybackId ?? ""),
|
|
324
|
-
source: String(video.source ?? ""),
|
|
325
|
-
// The spoken transcript + AI scene breakdown of the client's own clip — the
|
|
326
|
-
// "understand what's in this video" payload. Kept out of the compact/search
|
|
327
|
-
// projection (too large for a list) and surfaced here on --full.
|
|
328
|
-
transcript: video.transcript ?? null,
|
|
329
|
-
transcript_segment_count: Array.isArray(video.transcriptSegments) ? video.transcriptSegments.length : 0,
|
|
330
|
-
scenes: sceneLines(video.scenes),
|
|
331
|
-
originalFilename: video.originalFilename ?? null,
|
|
332
|
-
descriptionContext: video.descriptionContext ?? null,
|
|
333
|
-
shotStyle: typeof asRecord(video.analysis).shotStyle === "string" ? asRecord(video.analysis).shotStyle : null,
|
|
334
|
-
audioStyle: typeof asRecord(video.analysis).audioStyle === "string" ? asRecord(video.analysis).audioStyle : null,
|
|
335
|
-
onScreenText: Array.isArray(asRecord(video.analysis).onScreenText) ? asRecord(video.analysis).onScreenText : [],
|
|
336
|
-
usageNotes: typeof asRecord(video.analysis).usageNotes === "string" ? asRecord(video.analysis).usageNotes : null,
|
|
337
|
-
createdAt: video.createdAt ?? null
|
|
338
|
-
};
|
|
339
|
-
}
|
|
340
|
-
function videoNormalizer(record, full) {
|
|
341
|
-
if (full) {
|
|
342
|
-
return fullVideo(record);
|
|
343
|
-
}
|
|
344
|
-
return compactVideo(record);
|
|
345
|
-
}
|
|
346
|
-
function truncate(text2, maxLength) {
|
|
347
|
-
if (text2.length <= maxLength) return text2;
|
|
348
|
-
return `${text2.slice(0, maxLength)}...`;
|
|
349
|
-
}
|
|
350
|
-
function compactTestimonial(record) {
|
|
351
|
-
return {
|
|
352
|
-
_id: String(record._id ?? ""),
|
|
353
|
-
reviewerName: String(record.reviewerName ?? ""),
|
|
354
|
-
reviewText: truncate(String(record.reviewText ?? ""), 200),
|
|
355
|
-
rating: record.rating ?? null,
|
|
356
|
-
sentiment: record.sentiment ?? null,
|
|
357
|
-
tags: Array.isArray(record.tags) ? record.tags : [],
|
|
358
|
-
sourceType: String(record.sourceType ?? "")
|
|
359
|
-
};
|
|
360
|
-
}
|
|
361
|
-
function fullTestimonial(record) {
|
|
362
|
-
const compact3 = compactTestimonial(record);
|
|
363
|
-
return {
|
|
364
|
-
...compact3,
|
|
365
|
-
reviewText: String(record.reviewText ?? ""),
|
|
366
|
-
highlight: record.highlight ?? null,
|
|
367
|
-
summary: record.summary ?? null,
|
|
368
|
-
language: record.language ?? null,
|
|
369
|
-
reviewerImageUrl: record.reviewerImageUrl ?? null,
|
|
370
|
-
sourceUrl: record.sourceUrl ?? null,
|
|
371
|
-
reviewDate: record.reviewDate ?? null,
|
|
372
|
-
createdAt: record.createdAt ?? null,
|
|
373
|
-
status: String(record.status ?? "")
|
|
374
|
-
};
|
|
375
|
-
}
|
|
376
|
-
function testimonialNormalizer(record, full) {
|
|
377
|
-
if (full) {
|
|
378
|
-
return fullTestimonial(record);
|
|
379
|
-
}
|
|
380
|
-
return compactTestimonial(record);
|
|
381
|
-
}
|
|
382
|
-
function round2(value) {
|
|
383
|
-
if (typeof value !== "number" || Number.isNaN(value)) {
|
|
384
|
-
return null;
|
|
385
|
-
}
|
|
386
|
-
return Math.round(value * 100) / 100;
|
|
387
|
-
}
|
|
388
|
-
function asRecord(value) {
|
|
389
|
-
return value && typeof value === "object" ? value : {};
|
|
390
|
-
}
|
|
391
|
-
function compactWinningAd(record) {
|
|
392
|
-
const dna = asRecord(record.dna);
|
|
393
|
-
return {
|
|
394
|
-
advertiser: String(record.advertiser ?? ""),
|
|
395
|
-
platform: String(record.platform ?? ""),
|
|
396
|
-
format: String(record.format ?? ""),
|
|
397
|
-
relevance: round2(record.relevance),
|
|
398
|
-
winner_score: round2(record.winner_score),
|
|
399
|
-
summary: String(dna.creative_concept ?? ""),
|
|
400
|
-
advertiser_id: String(record.advertiser_id ?? ""),
|
|
401
|
-
ad_id: String(record.ad_id ?? ""),
|
|
402
|
-
media_url: String(record.media_url ?? "")
|
|
403
|
-
};
|
|
404
|
-
}
|
|
405
|
-
function fullWinningAd(record) {
|
|
406
|
-
const compact3 = compactWinningAd(record);
|
|
407
|
-
const dna = asRecord(record.dna);
|
|
408
|
-
return {
|
|
409
|
-
...compact3,
|
|
410
|
-
winner_category: String(record.winner_category ?? ""),
|
|
411
|
-
media_kind: record.media_kind ?? null,
|
|
412
|
-
days_active: record.days_active ?? null,
|
|
413
|
-
reach: record.reach ?? null,
|
|
414
|
-
active: typeof record.active === "boolean" ? record.active : null,
|
|
415
|
-
angle: dna.angle ?? null,
|
|
416
|
-
awareness_stage: dna.awareness_stage ?? null,
|
|
417
|
-
target_persona: dna.target_persona ?? null,
|
|
418
|
-
hook_archetype: dna.hook_archetype ?? null,
|
|
419
|
-
industry: dna.industry ?? null
|
|
420
|
-
};
|
|
421
|
-
}
|
|
422
|
-
function winningAdNormalizer(record, full) {
|
|
423
|
-
if (full) {
|
|
424
|
-
return fullWinningAd(record);
|
|
425
|
-
}
|
|
426
|
-
return compactWinningAd(record);
|
|
427
|
-
}
|
|
428
|
-
function overlayLines(value, detailed = false) {
|
|
429
|
-
if (!Array.isArray(value)) {
|
|
430
|
-
return [];
|
|
431
|
-
}
|
|
432
|
-
return value.flatMap((o) => {
|
|
433
|
-
const item = asRecord(o);
|
|
434
|
-
const text2 = typeof item.text === "string" ? item.text : "";
|
|
435
|
-
if (!text2) {
|
|
436
|
-
return [];
|
|
437
|
-
}
|
|
438
|
-
const at = round2(item.appears_at_s);
|
|
439
|
-
let line = at !== null ? `${text2} @${at}s` : text2;
|
|
440
|
-
if (detailed) {
|
|
441
|
-
const tags = [item.role, item.position].filter((t) => typeof t === "string" && t.length > 0);
|
|
442
|
-
if (tags.length) {
|
|
443
|
-
line += ` [${tags.join(", ")}]`;
|
|
444
|
-
}
|
|
445
|
-
}
|
|
446
|
-
return [line];
|
|
447
|
-
});
|
|
448
|
-
}
|
|
449
|
-
function compactAdContent(record) {
|
|
450
|
-
return {
|
|
451
|
-
ad_id: record.ad_id ?? null,
|
|
452
|
-
advertiser: record.advertiser ?? null,
|
|
453
|
-
format: record.format ?? null,
|
|
454
|
-
media_kind: record.media_kind ?? null,
|
|
455
|
-
media_url: record.media_url ?? null,
|
|
456
|
-
summary: record.summary ?? null,
|
|
457
|
-
transcript: record.transcript ?? null,
|
|
458
|
-
on_screen_text: overlayLines(record.on_screen_text),
|
|
459
|
-
has_captions: typeof record.has_captions === "boolean" ? record.has_captions : null,
|
|
460
|
-
primary_text: record.primary_text ?? null,
|
|
461
|
-
headline: record.headline ?? null,
|
|
462
|
-
cta: record.cta ?? null
|
|
463
|
-
};
|
|
464
|
-
}
|
|
465
|
-
function fullAdContent(record) {
|
|
466
|
-
const speech = asRecord(record.speech);
|
|
467
|
-
const pacing = asRecord(record.pacing);
|
|
468
|
-
const music = asRecord(record.music);
|
|
469
|
-
return {
|
|
470
|
-
...compactAdContent(record),
|
|
471
|
-
platform: record.platform ?? null,
|
|
472
|
-
// Re-derive with role/position tags — the lean compact version dropped them.
|
|
473
|
-
on_screen_text: overlayLines(record.on_screen_text, true),
|
|
474
|
-
winner_score: round2(record.winner_score),
|
|
475
|
-
winner_category: record.winner_category ?? null,
|
|
476
|
-
angle: record.angle ?? null,
|
|
477
|
-
hook_archetype: record.hook_archetype ?? null,
|
|
478
|
-
caption_style: record.caption_style ?? null,
|
|
479
|
-
has_speech: typeof record.has_speech === "boolean" ? record.has_speech : null,
|
|
480
|
-
speech_pct_of_runtime: round2(speech.speech_pct_of_runtime),
|
|
481
|
-
speaker_count: speech.speaker_count ?? null,
|
|
482
|
-
voiceover_vs_sync: speech.voiceover_vs_sync ?? null,
|
|
483
|
-
is_direct_address: typeof speech.is_direct_address === "boolean" ? speech.is_direct_address : null,
|
|
484
|
-
speech_emotion_dominant: speech.speech_emotion_dominant ?? null,
|
|
485
|
-
scene_count: pacing.scene_count ?? null,
|
|
486
|
-
avg_shot_length_s: round2(pacing.avg_shot_length_s),
|
|
487
|
-
pacing_shape: pacing.pacing_shape ?? null,
|
|
488
|
-
hook_ends_at_s: round2(pacing.hook_ends_at_s),
|
|
489
|
-
cta_first_shown_at_s: round2(pacing.cta_first_shown_at_s),
|
|
490
|
-
product_first_appears_at_s: round2(pacing.product_first_appears_at_s),
|
|
491
|
-
music_track_title: music.track_title ?? null,
|
|
492
|
-
music_track_artist: music.track_artist ?? null
|
|
493
|
-
};
|
|
494
|
-
}
|
|
495
|
-
function adContentNormalizer(record, full) {
|
|
496
|
-
return full ? fullAdContent(record) : compactAdContent(record);
|
|
497
|
-
}
|
|
498
|
-
function applyFieldMask(data, fields) {
|
|
499
|
-
const result = {};
|
|
500
|
-
for (const field of fields) {
|
|
501
|
-
if (field in data) {
|
|
502
|
-
result[field] = data[field];
|
|
503
|
-
}
|
|
504
|
-
}
|
|
505
|
-
return result;
|
|
506
|
-
}
|
|
507
|
-
function write(text2) {
|
|
508
|
-
process.stdout.write(text2);
|
|
509
|
-
}
|
|
510
|
-
function writeJson(envelope) {
|
|
511
|
-
write(`${JSON.stringify(envelope, null, 2)}
|
|
512
|
-
`);
|
|
513
|
-
}
|
|
514
|
-
function writeFiles(data, fields) {
|
|
515
|
-
write(`${fields.join(" ")}
|
|
516
|
-
`);
|
|
517
|
-
for (const item of data) {
|
|
518
|
-
const values = fields.map((f) => String(item[f] ?? ""));
|
|
519
|
-
write(`${values.join(" ")}
|
|
520
|
-
`);
|
|
521
|
-
}
|
|
522
|
-
}
|
|
523
|
-
function writeMd(data, fields) {
|
|
524
|
-
write(`| ${fields.join(" | ")} |
|
|
525
|
-
`);
|
|
526
|
-
write(`| ${fields.map(() => "---").join(" | ")} |
|
|
527
|
-
`);
|
|
528
|
-
for (const item of data) {
|
|
529
|
-
const values = fields.map((f) => String(item[f] ?? ""));
|
|
530
|
-
write(`| ${values.join(" | ")} |
|
|
531
|
-
`);
|
|
532
|
-
}
|
|
533
|
-
}
|
|
534
|
-
function normalizeData(envelope, fields, full, normalizer) {
|
|
535
|
-
const raw = Array.isArray(envelope.data) ? envelope.data : [envelope.data];
|
|
536
|
-
const items = raw.map((item) => {
|
|
537
|
-
const record = item;
|
|
538
|
-
return normalizer(record, full);
|
|
539
|
-
});
|
|
540
|
-
if (fields) {
|
|
541
|
-
return items.map((item) => applyFieldMask(item, fields));
|
|
542
|
-
}
|
|
543
|
-
return items;
|
|
544
|
-
}
|
|
545
|
-
function writeOutput(envelope, format, fields, full, normalizer) {
|
|
546
|
-
if (!envelope.ok || "dryRun" in envelope) {
|
|
547
|
-
writeJson(envelope);
|
|
548
|
-
return;
|
|
549
|
-
}
|
|
550
|
-
if (format === "json") {
|
|
551
|
-
writeJson(envelope);
|
|
552
|
-
return;
|
|
553
|
-
}
|
|
554
|
-
if (format !== "files" && format !== "md") {
|
|
555
|
-
process.stderr.write(`Unknown --output "${String(format)}". Valid formats: json, files, md. Using json.
|
|
556
|
-
`);
|
|
557
|
-
writeJson(envelope);
|
|
558
|
-
return;
|
|
559
|
-
}
|
|
560
|
-
const items = normalizeData(envelope, fields, full ?? false, normalizer ?? imageNormalizer);
|
|
561
|
-
const displayFields = fields ?? Object.keys(items[0] ?? {});
|
|
562
|
-
if (format === "files") {
|
|
563
|
-
writeFiles(items, displayFields);
|
|
564
|
-
} else {
|
|
565
|
-
writeMd(items, displayFields);
|
|
566
|
-
}
|
|
567
|
-
writeHints(envelope.hints);
|
|
568
|
-
}
|
|
569
|
-
function writeHints(hints2) {
|
|
570
|
-
for (const hint of hints2 ?? []) {
|
|
571
|
-
process.stderr.write(`${hint}
|
|
572
|
-
`);
|
|
573
|
-
}
|
|
574
|
-
}
|
|
575
|
-
|
|
576
171
|
// src/schemas.ts
|
|
577
172
|
var registry = /* @__PURE__ */ new Map();
|
|
578
173
|
function registerSchema(schema) {
|
|
@@ -13082,8 +12677,8 @@ var writeMdRows = (rows, fields, notices) => {
|
|
|
13082
12677
|
};
|
|
13083
12678
|
var ROW_WRITERS = { csv: writeCsvRows, jsonl: writeJsonlRows, md: writeMdRows };
|
|
13084
12679
|
function writeRows(format, rows, columns, notices) {
|
|
13085
|
-
const
|
|
13086
|
-
|
|
12680
|
+
const write = ROW_WRITERS[format] ?? writeMdRows;
|
|
12681
|
+
write(rows, columns, notices);
|
|
13087
12682
|
if (rows.length > REPEAT_NOTICE_ABOVE_ROWS) {
|
|
13088
12683
|
for (const line of notices) writeLine(line);
|
|
13089
12684
|
}
|
|
@@ -22286,7 +21881,7 @@ Subcommands:
|
|
|
22286
21881
|
|
|
22287
21882
|
// src/commands/ads/linkedin/creatives.ts
|
|
22288
21883
|
import { defineCommand as defineCommand44 } from "citty";
|
|
22289
|
-
function
|
|
21884
|
+
function asRecord(value) {
|
|
22290
21885
|
return typeof value === "object" && value !== null && !Array.isArray(value) ? value : void 0;
|
|
22291
21886
|
}
|
|
22292
21887
|
function asString(value) {
|
|
@@ -22296,12 +21891,12 @@ function creativeDestination(content) {
|
|
|
22296
21891
|
if (!content) return { format: "unknown" };
|
|
22297
21892
|
const reference = asString(content.reference);
|
|
22298
21893
|
if (reference) return { format: "post", postUrn: reference };
|
|
22299
|
-
const textAd =
|
|
21894
|
+
const textAd = asRecord(content.textAd);
|
|
22300
21895
|
if (textAd) return { format: "text", landingUrl: asString(textAd.landingPage) };
|
|
22301
|
-
const spotlight =
|
|
21896
|
+
const spotlight = asRecord(content.spotlight);
|
|
22302
21897
|
if (spotlight) return { format: "spotlight", landingUrl: asString(spotlight.landingPage) };
|
|
22303
|
-
if (
|
|
22304
|
-
if (
|
|
21898
|
+
if (asRecord(content.follower)) return { format: "follower" };
|
|
21899
|
+
if (asRecord(content.jobs)) return { format: "jobs" };
|
|
22305
21900
|
return { format: "unknown" };
|
|
22306
21901
|
}
|
|
22307
21902
|
var COMPACT_COLUMNS = [
|
|
@@ -22332,7 +21927,7 @@ function compactRow(row) {
|
|
|
22332
21927
|
function readPath(row, path48) {
|
|
22333
21928
|
let current = row;
|
|
22334
21929
|
for (const segment of path48.split(".")) {
|
|
22335
|
-
const record =
|
|
21930
|
+
const record = asRecord(current);
|
|
22336
21931
|
if (!record) return void 0;
|
|
22337
21932
|
current = record[segment];
|
|
22338
21933
|
}
|
|
@@ -25705,10 +25300,10 @@ Example: baker ads meta ads retag 120252158038400247 --url-tags "utm_source={{si
|
|
|
25705
25300
|
}
|
|
25706
25301
|
},
|
|
25707
25302
|
run: async ({ args: args5 }) => {
|
|
25708
|
-
const { apiPost: apiPost2 } = await import("./client-
|
|
25709
|
-
const { requireChatId: requireChatId2 } = await import("./env-
|
|
25710
|
-
const { writeJsonEnvelope: writeJsonEnvelope2 } = await import("./output-
|
|
25711
|
-
const { handleMetaError: handleMetaError2 } = await import("./shared-
|
|
25303
|
+
const { apiPost: apiPost2 } = await import("./client-ODCNYCP4.js");
|
|
25304
|
+
const { requireChatId: requireChatId2 } = await import("./env-BSG7TY5Y.js");
|
|
25305
|
+
const { writeJsonEnvelope: writeJsonEnvelope2 } = await import("./output-2XBCYF7L.js");
|
|
25306
|
+
const { handleMetaError: handleMetaError2 } = await import("./shared-RYAF7Y7H.js");
|
|
25712
25307
|
try {
|
|
25713
25308
|
const accountId = bareAccountId2(args5);
|
|
25714
25309
|
const urlTags = typeof args5["url-tags"] === "string" ? args5["url-tags"] : void 0;
|
|
@@ -25853,10 +25448,10 @@ function duplicateCommand2(entity, label) {
|
|
|
25853
25448
|
replace: { type: "boolean", description: "Pause the original once the copy publishes" }
|
|
25854
25449
|
},
|
|
25855
25450
|
run: async ({ args: args5 }) => {
|
|
25856
|
-
const { apiPost: apiPost2 } = await import("./client-
|
|
25857
|
-
const { requireChatId: requireChatId2 } = await import("./env-
|
|
25858
|
-
const { writeJsonEnvelope: writeJsonEnvelope2 } = await import("./output-
|
|
25859
|
-
const { handleMetaError: handleMetaError2 } = await import("./shared-
|
|
25451
|
+
const { apiPost: apiPost2 } = await import("./client-ODCNYCP4.js");
|
|
25452
|
+
const { requireChatId: requireChatId2 } = await import("./env-BSG7TY5Y.js");
|
|
25453
|
+
const { writeJsonEnvelope: writeJsonEnvelope2 } = await import("./output-2XBCYF7L.js");
|
|
25454
|
+
const { handleMetaError: handleMetaError2 } = await import("./shared-RYAF7Y7H.js");
|
|
25860
25455
|
try {
|
|
25861
25456
|
const accountId = bareAccountId2(args5);
|
|
25862
25457
|
const chatId = requireChatId2();
|
|
@@ -33473,8 +33068,8 @@ var conversionsCommand3 = (() => {
|
|
|
33473
33068
|
const args6 = parseConversionsArgs(raw, process.argv);
|
|
33474
33069
|
for (const eventKey of args6.eventKeys) refuseUnmatchableKey(eventKey);
|
|
33475
33070
|
const before = await apiPost("/api/analytics/conversions", {});
|
|
33476
|
-
const
|
|
33477
|
-
const stored =
|
|
33071
|
+
const write = conversionsWrite(args6, before.data.definitions);
|
|
33072
|
+
const stored = write ? (await apiPost("/api/analytics/conversions", write)).data.definitions : before.data.definitions;
|
|
33478
33073
|
const report = await apiPost("/api/analytics/query", {
|
|
33479
33074
|
preset: "conversions",
|
|
33480
33075
|
days: args6.days
|
|
@@ -33850,11 +33445,7 @@ function rosterRow(avatar) {
|
|
|
33850
33445
|
};
|
|
33851
33446
|
}
|
|
33852
33447
|
function chatIdFromEnv() {
|
|
33853
|
-
|
|
33854
|
-
return getEnv().BAKER_CHAT_ID || void 0;
|
|
33855
|
-
} catch {
|
|
33856
|
-
return void 0;
|
|
33857
|
-
}
|
|
33448
|
+
return optionalChatId();
|
|
33858
33449
|
}
|
|
33859
33450
|
function rosterHints(roster, statusFilter) {
|
|
33860
33451
|
if (roster.length === 0) {
|
|
@@ -39383,7 +38974,7 @@ function sceneSpokenText(scene) {
|
|
|
39383
38974
|
return (scene.dialogue ?? []).map((d) => d.line?.trim()).filter((l) => Boolean(l)).join(" ") || null;
|
|
39384
38975
|
}
|
|
39385
38976
|
function buildMotionBoard(blueprint) {
|
|
39386
|
-
const
|
|
38977
|
+
const round4 = (n) => Math.round(n * 100) / 100;
|
|
39387
38978
|
let cursor = 0;
|
|
39388
38979
|
return blueprint.scenes.map((scene, i) => {
|
|
39389
38980
|
const start_s = scene.start_s ?? cursor;
|
|
@@ -39395,15 +38986,15 @@ function buildMotionBoard(blueprint) {
|
|
|
39395
38986
|
const graphics = [
|
|
39396
38987
|
...(overlays.success ? overlays.data : []).filter((ov) => ov.text?.trim()).map((ov) => ({
|
|
39397
38988
|
kind: "text",
|
|
39398
|
-
at_s:
|
|
39399
|
-
dur_s:
|
|
38989
|
+
at_s: round4(ov.appears_at_s ?? start_s),
|
|
38990
|
+
dur_s: round4(ov.duration_s ?? 2.5),
|
|
39400
38991
|
position: ov.position ?? "bottom_center",
|
|
39401
38992
|
text: ov.text?.trim()
|
|
39402
38993
|
})),
|
|
39403
38994
|
...(floats.success ? floats.data : []).map((fe) => ({
|
|
39404
38995
|
kind: "graphic",
|
|
39405
|
-
at_s:
|
|
39406
|
-
dur_s:
|
|
38996
|
+
at_s: round4(fe.appears_at_s ?? start_s),
|
|
38997
|
+
dur_s: round4(fe.duration_s ?? 2.5),
|
|
39407
38998
|
position: fe.position ?? "bottom_center",
|
|
39408
38999
|
label: fe.brand_name || fe.what_it_represents || fe.description || fe.kind || "element"
|
|
39409
39000
|
}))
|
|
@@ -39411,7 +39002,7 @@ function buildMotionBoard(blueprint) {
|
|
|
39411
39002
|
return {
|
|
39412
39003
|
scene: i,
|
|
39413
39004
|
role: resolveSceneRole(scene, i, blueprint.scenes.length),
|
|
39414
|
-
window_s: [
|
|
39005
|
+
window_s: [round4(start_s), round4(end_s)],
|
|
39415
39006
|
// A continuation b-roll scene shares the previous scene's end frame as its start
|
|
39416
39007
|
// (no own `s<i>_start` node), so point the storyboard at that shared keyframe.
|
|
39417
39008
|
storyboard_frames: [scene.continues_previous && i > 0 ? `s${i - 1}_end` : `s${i}_start`],
|
|
@@ -41174,7 +40765,7 @@ ${describeRewrites(healed.rewrites)}
|
|
|
41174
40765
|
// "edited since last render". Computed from the on-disk canvas.json +
|
|
41175
40766
|
// prompt.json — the same helper the edit-sync uses, so the two are comparable.
|
|
41176
40767
|
sourceSha: await computeSourceSha(filePath),
|
|
41177
|
-
chatId:
|
|
40768
|
+
chatId: optionalChatId(),
|
|
41178
40769
|
canvasSnapshotUrl
|
|
41179
40770
|
};
|
|
41180
40771
|
if (client) {
|
|
@@ -45165,11 +44756,7 @@ function detectCreativeContentType(filePath) {
|
|
|
45165
44756
|
});
|
|
45166
44757
|
}
|
|
45167
44758
|
function chatIdFromEnv2() {
|
|
45168
|
-
|
|
45169
|
-
return getEnv().BAKER_CHAT_ID || void 0;
|
|
45170
|
-
} catch {
|
|
45171
|
-
return void 0;
|
|
45172
|
-
}
|
|
44759
|
+
return optionalChatId();
|
|
45173
44760
|
}
|
|
45174
44761
|
function parseOptionalUrl(value) {
|
|
45175
44762
|
if (value === void 0 || value.trim() === "") {
|
|
@@ -53086,7 +52673,7 @@ var extractCommand = defineCommand149({
|
|
|
53086
52673
|
import { defineCommand as defineCommand150 } from "citty";
|
|
53087
52674
|
|
|
53088
52675
|
// src/commands/images/providerHits.ts
|
|
53089
|
-
function
|
|
52676
|
+
function asRecord2(value) {
|
|
53090
52677
|
return value && typeof value === "object" ? value : {};
|
|
53091
52678
|
}
|
|
53092
52679
|
function str(value) {
|
|
@@ -53111,7 +52698,7 @@ function providerHitNormalizer(record, full) {
|
|
|
53111
52698
|
if (!full) {
|
|
53112
52699
|
return compact3;
|
|
53113
52700
|
}
|
|
53114
|
-
const group =
|
|
52701
|
+
const group = asRecord2(record.group);
|
|
53115
52702
|
return {
|
|
53116
52703
|
...compact3,
|
|
53117
52704
|
externalUrl: str(record.externalUrl),
|
|
@@ -57016,7 +56603,7 @@ function dedupe(findings) {
|
|
|
57016
56603
|
|
|
57017
56604
|
// src/engine/landing/lib/critique.ts
|
|
57018
56605
|
var FAMILIES = ["typography", "color", "borders_depth", "motion", "spacing", "copy", "integrity"];
|
|
57019
|
-
function
|
|
56606
|
+
function round2(n) {
|
|
57020
56607
|
return Math.round(n * 100) / 100;
|
|
57021
56608
|
}
|
|
57022
56609
|
function clamp012(n) {
|
|
@@ -57053,11 +56640,11 @@ function critiqueLanding(input) {
|
|
|
57053
56640
|
const dimensions = FAMILIES.map((family) => {
|
|
57054
56641
|
const fam = findings.filter((f) => f.family === family);
|
|
57055
56642
|
const penalty = fam.reduce((s, f) => s + SEVERITY_WEIGHT[f.severity], 0);
|
|
57056
|
-
const score =
|
|
56643
|
+
const score = round2(clamp012(1 - penalty));
|
|
57057
56644
|
const note = fam.length === 0 ? "clean" : `${fam.length} finding(s): ${describeCounts(fam)}`;
|
|
57058
56645
|
return { dimension: family, score, note };
|
|
57059
56646
|
});
|
|
57060
|
-
const overall =
|
|
56647
|
+
const overall = round2(dimensions.reduce((s, d) => s + d.score, 0) / dimensions.length);
|
|
57061
56648
|
const counts = {
|
|
57062
56649
|
block: findings.filter((f) => f.severity === "block").length,
|
|
57063
56650
|
warn: findings.filter((f) => f.severity === "warn").length,
|
|
@@ -61216,7 +60803,7 @@ function writeJsonl(data) {
|
|
|
61216
60803
|
`);
|
|
61217
60804
|
}
|
|
61218
60805
|
}
|
|
61219
|
-
function
|
|
60806
|
+
function writeMd(data, fields) {
|
|
61220
60807
|
if (data.length === 0) return;
|
|
61221
60808
|
const cols = fields ?? Object.keys(data[0] ?? {});
|
|
61222
60809
|
process.stdout.write(`| ${cols.join(" | ")} |
|
|
@@ -61238,7 +60825,7 @@ function writeResearchOutput(data, format, fields) {
|
|
|
61238
60825
|
writeJsonl(data);
|
|
61239
60826
|
break;
|
|
61240
60827
|
case "md":
|
|
61241
|
-
|
|
60828
|
+
writeMd(data, fields);
|
|
61242
60829
|
break;
|
|
61243
60830
|
default:
|
|
61244
60831
|
writeResearchJson({ ok: true, data });
|