@koda-sl/baker-cli 0.370.0 → 0.371.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 +7 -0
- package/dist/{chunk-AI4HWQVN.js → chunk-3NIBJ3GL.js} +191 -109
- package/dist/chunk-3NIBJ3GL.js.map +1 -0
- package/dist/cli.js +24 -12
- package/dist/cli.js.map +1 -1
- package/dist/engine/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-AI4HWQVN.js.map +0 -1
package/dist/cli.js
CHANGED
|
@@ -55,6 +55,7 @@ import {
|
|
|
55
55
|
promptMaxLength,
|
|
56
56
|
requireCredentialsFromEnv,
|
|
57
57
|
resolveConcurrency,
|
|
58
|
+
runFailureCode,
|
|
58
59
|
runYtDlp,
|
|
59
60
|
sha256Hex,
|
|
60
61
|
spineInputFlags,
|
|
@@ -69,7 +70,7 @@ import {
|
|
|
69
70
|
validateCanvasDeep,
|
|
70
71
|
withoutCastName,
|
|
71
72
|
ytDlpBlockSignal
|
|
72
|
-
} from "./chunk-
|
|
73
|
+
} from "./chunk-3NIBJ3GL.js";
|
|
73
74
|
import {
|
|
74
75
|
csvOrJson,
|
|
75
76
|
daysAgoIso,
|
|
@@ -42468,14 +42469,14 @@ ${describeRewrites(healed.rewrites)}
|
|
|
42468
42469
|
const failures = e.failures.map((f) => ({ node_id: f.nodeId, message: describeFailureReason(f.reason) }));
|
|
42469
42470
|
if (poster) await poster.flush(failedPayload(e.message));
|
|
42470
42471
|
process.stderr.write(
|
|
42471
|
-
`${JSON.stringify({ ok: false, error: { code:
|
|
42472
|
+
`${JSON.stringify({ ok: false, error: { code: runFailureCode(e), message: e.message, failures } }, null, 2)}
|
|
42472
42473
|
`
|
|
42473
42474
|
);
|
|
42474
42475
|
process.exit(1);
|
|
42475
42476
|
}
|
|
42476
42477
|
const msg = e instanceof Error ? e.message : String(e);
|
|
42477
42478
|
if (poster) await poster.flush(failedPayload(msg));
|
|
42478
|
-
process.stderr.write(`${JSON.stringify({ ok: false, error: { code:
|
|
42479
|
+
process.stderr.write(`${JSON.stringify({ ok: false, error: { code: runFailureCode(e), message: msg } }, null, 2)}
|
|
42479
42480
|
`);
|
|
42480
42481
|
process.exit(1);
|
|
42481
42482
|
}
|
|
@@ -43312,6 +43313,15 @@ function resolvePlacements(placementsFlag, definitionPlatform) {
|
|
|
43312
43313
|
message: `--placements "${flag}" is not a valid placement set. Use one of: ${AD_FORMAT_PLATFORMS.join(", ")}, or "none" for a single base ad.`
|
|
43313
43314
|
};
|
|
43314
43315
|
}
|
|
43316
|
+
async function validateScaffoldedStaticAd(canvas, canvasDir) {
|
|
43317
|
+
const validation = await validateCanvasDeep(resolveRelativeCanvasPaths(canvas, canvasDir), defaultRegistry());
|
|
43318
|
+
if (validation.ok) return { blocking: [], hints: [], estimatedCredits: validation.estimatedCredits };
|
|
43319
|
+
const overCap = validation.issues.filter((i) => i.code === "PROMPT_OVER_MODEL_LIMIT");
|
|
43320
|
+
return {
|
|
43321
|
+
blocking: validation.issues.filter((i) => i.code !== "PROMPT_OVER_MODEL_LIMIT"),
|
|
43322
|
+
hints: overCap.map((i) => `${i.code}: ${i.message} Trim prompt.json, then \`baker canvas validate\`.`)
|
|
43323
|
+
};
|
|
43324
|
+
}
|
|
43315
43325
|
function regionCount(layout) {
|
|
43316
43326
|
const regions = layout?.regions;
|
|
43317
43327
|
return Array.isArray(regions) ? regions.length : 0;
|
|
@@ -43503,10 +43513,10 @@ var scaffoldStaticAdCommand = defineCommand114({
|
|
|
43503
43513
|
} catch (e) {
|
|
43504
43514
|
return fail3("scaffold", e instanceof Error ? e.message : String(e));
|
|
43505
43515
|
}
|
|
43506
|
-
const validation = await
|
|
43507
|
-
if (
|
|
43516
|
+
const validation = await validateScaffoldedStaticAd(canvas, path21.dirname(outPath));
|
|
43517
|
+
if (validation.blocking.length > 0) {
|
|
43508
43518
|
process.stderr.write(
|
|
43509
|
-
`${JSON.stringify({ ok: false, error: { code: "validation", issues: validation.
|
|
43519
|
+
`${JSON.stringify({ ok: false, error: { code: "validation", issues: validation.blocking } }, null, 2)}
|
|
43510
43520
|
`
|
|
43511
43521
|
);
|
|
43512
43522
|
process.exit(2);
|
|
@@ -43540,6 +43550,12 @@ var scaffoldStaticAdCommand = defineCommand114({
|
|
|
43540
43550
|
sourceSha: await computeSourceSha(outPath)
|
|
43541
43551
|
});
|
|
43542
43552
|
}
|
|
43553
|
+
const hints2 = [
|
|
43554
|
+
...uncast.length ? [
|
|
43555
|
+
`NOT CAST: ${uncast.map((h) => `\`${h}\``).join(", ")} \u2014 the element selection found fewer people than avatars passed, so ${uncast.length === 1 ? "this avatar plays" : "these avatars play"} nobody in this ad. Tell the user who is cast and who is not.`
|
|
43556
|
+
] : [],
|
|
43557
|
+
...validation.hints
|
|
43558
|
+
];
|
|
43543
43559
|
process.stdout.write(
|
|
43544
43560
|
`${JSON.stringify(
|
|
43545
43561
|
{
|
|
@@ -43549,11 +43565,7 @@ var scaffoldStaticAdCommand = defineCommand114({
|
|
|
43549
43565
|
definition_path: definitionPath ?? void 0,
|
|
43550
43566
|
source_reference: durableSourceUrl ?? void 0,
|
|
43551
43567
|
output: canvas.output,
|
|
43552
|
-
...
|
|
43553
|
-
hints: [
|
|
43554
|
-
`NOT CAST: ${uncast.map((h) => `\`${h}\``).join(", ")} \u2014 the element selection found fewer people than avatars passed, so ${uncast.length === 1 ? "this avatar plays" : "these avatars play"} nobody in this ad. Tell the user who is cast and who is not.`
|
|
43555
|
-
]
|
|
43556
|
-
} : {},
|
|
43568
|
+
...hints2.length ? { hints: hints2 } : {},
|
|
43557
43569
|
models: { describe: describeModel, select: selectModel, layout: layoutModel, gen: opts.genModel },
|
|
43558
43570
|
aspect_ratio: report.aspect_ratio,
|
|
43559
43571
|
placements: report.placements,
|
|
@@ -45838,7 +45850,7 @@ import { defineCommand as defineCommand118 } from "citty";
|
|
|
45838
45850
|
var validateCommand = defineCommand118({
|
|
45839
45851
|
meta: {
|
|
45840
45852
|
name: "validate",
|
|
45841
|
-
description: "Validate a canvas JSON file (no execution). Includes a per-node cost preview and runs each node's deep validators (composition meta checks for hyperframe_render/_snapshot)."
|
|
45853
|
+
description: "Validate a canvas JSON file (no execution). Includes a per-node cost preview and runs each node's deep validators (composition meta checks for hyperframe_render/_snapshot), and measures each generator prompt with its {{slots}} filled against the model's character cap (PROMPT_OVER_MODEL_LIMIT)."
|
|
45842
45854
|
},
|
|
45843
45855
|
args: { file: { type: "positional", required: true, description: "Path to canvas JSON" } },
|
|
45844
45856
|
async run({ args: args5 }) {
|