@koda-sl/baker-cli 0.403.0 → 0.405.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 +16 -1
- package/canvas/static-ad-composition/index.html +573 -10
- package/canvas/static-ad-composition/meta.json +1 -0
- package/dist/{chunk-X7PLV5QH.js → chunk-DGZ5DLXK.js} +65 -17
- package/dist/chunk-DGZ5DLXK.js.map +1 -0
- package/dist/cli.js +2291 -1827
- package/dist/cli.js.map +1 -1
- package/dist/engine/index.d.ts +23 -0
- package/dist/engine/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-X7PLV5QH.js.map +0 -1
|
@@ -6223,20 +6223,7 @@ var Engine = class {
|
|
|
6223
6223
|
const layers = topologicalLayers(graph);
|
|
6224
6224
|
const limit = resolveConcurrency(opts.concurrency);
|
|
6225
6225
|
for (const layer of layers) {
|
|
6226
|
-
|
|
6227
|
-
if (opts.max_credits !== void 0 && counters.totalCredits > opts.max_credits) {
|
|
6228
|
-
throw new RunAbortedError(
|
|
6229
|
-
"cost_cap",
|
|
6230
|
-
`spent ${counters.totalCredits} credits, over the ${opts.max_credits}-credit cap \u2014 completed nodes are cached; raise --max-credits to continue where this stopped`
|
|
6231
|
-
);
|
|
6232
|
-
}
|
|
6233
|
-
const held = heldByCheckpoint(canvas, layer, opts.stop_before_kinds);
|
|
6234
|
-
if (held.length > 0) {
|
|
6235
|
-
throw new RunAbortedError(
|
|
6236
|
-
"checkpoint",
|
|
6237
|
-
`stopped before ${held.join(", ")} \u2014 everything up to here is done and cached, so continuing this run id pays for none of it again`
|
|
6238
|
-
);
|
|
6239
|
-
}
|
|
6226
|
+
await this.assertLayerMayRun(canvas, layer, outputs, runId, opts, counters);
|
|
6240
6227
|
const settled = await mapWithConcurrency(layer, limit, (nodeId) => {
|
|
6241
6228
|
if (opts.signal?.aborted) {
|
|
6242
6229
|
return Promise.reject(new RunAbortedError("signal", "run aborted before node dispatch"));
|
|
@@ -6363,6 +6350,59 @@ var Engine = class {
|
|
|
6363
6350
|
this.logOutputWarnings(node.id, outputsObj);
|
|
6364
6351
|
return { cached: false, credits, durationMs: elapsed };
|
|
6365
6352
|
}
|
|
6353
|
+
/**
|
|
6354
|
+
* Every reason a layer must not dispatch, checked before any of its nodes starts, so a stop
|
|
6355
|
+
* never leaves a layer half billed: a signal, the cost cap, a checkpoint, and a billed node
|
|
6356
|
+
* the cache cannot serve when the run is cache-only.
|
|
6357
|
+
*/
|
|
6358
|
+
async assertLayerMayRun(canvas, layer, outputs, runId, opts, counters) {
|
|
6359
|
+
if (opts.signal?.aborted) throw new RunAbortedError("signal", "run aborted before layer dispatch");
|
|
6360
|
+
if (opts.max_credits !== void 0 && counters.totalCredits > opts.max_credits) {
|
|
6361
|
+
throw new RunAbortedError(
|
|
6362
|
+
"cost_cap",
|
|
6363
|
+
`spent ${counters.totalCredits} credits, over the ${opts.max_credits}-credit cap \u2014 completed nodes are cached; raise --max-credits to continue where this stopped`
|
|
6364
|
+
);
|
|
6365
|
+
}
|
|
6366
|
+
const held = heldByCheckpoint(canvas, layer, opts.stop_before_kinds);
|
|
6367
|
+
if (held.length > 0) {
|
|
6368
|
+
throw new RunAbortedError(
|
|
6369
|
+
"checkpoint",
|
|
6370
|
+
`stopped before ${held.join(", ")} \u2014 everything up to here is done and cached, so continuing this run id pays for none of it again`
|
|
6371
|
+
);
|
|
6372
|
+
}
|
|
6373
|
+
if (opts.billed_from_cache_only) {
|
|
6374
|
+
const fresh = await this.billedMisses(canvas, layer, outputs, runId, opts);
|
|
6375
|
+
if (fresh.length > 0) {
|
|
6376
|
+
throw new RunAbortedError(
|
|
6377
|
+
"cache_only",
|
|
6378
|
+
`${fresh.join(", ")} would be rendered fresh and billed \u2014 nothing in this layer ran`
|
|
6379
|
+
);
|
|
6380
|
+
}
|
|
6381
|
+
}
|
|
6382
|
+
}
|
|
6383
|
+
/**
|
|
6384
|
+
* The billed nodes of a layer that would miss the cache, found before any of them runs:
|
|
6385
|
+
* each is prepared exactly as `executeOne` would (same inputs, params and cache key).
|
|
6386
|
+
*
|
|
6387
|
+
* `executeOne` prepares each node again when it runs, so a cache-only layer hydrates its
|
|
6388
|
+
* text slots and hashes its `cacheKeyExtras` twice. Deliberate: a re-draw's layers are
|
|
6389
|
+
* small, and threading this preparation into `executeOne` would couple the check to the
|
|
6390
|
+
* run path, where a stale preparation would bill the wrong key.
|
|
6391
|
+
*/
|
|
6392
|
+
async billedMisses(canvas, layer, outputs, runId, opts) {
|
|
6393
|
+
const misses = [];
|
|
6394
|
+
for (const nodeId of layer) {
|
|
6395
|
+
const node = canvas.nodes.find((n) => n.id === nodeId);
|
|
6396
|
+
const def = node ? this.registry.get(node.type) : void 0;
|
|
6397
|
+
if (!node || !def) continue;
|
|
6398
|
+
const token = resolveRegenerateToken(node, opts.regenerate, runId);
|
|
6399
|
+
const prepared = await prepareForExecution(node, outputs, def, canvas.cache_salt, token, this.assets);
|
|
6400
|
+
if (estimateNodeCredits2(def, prepared.renderedParams) <= 0) continue;
|
|
6401
|
+
const hit = opts.cache_policy === "bypass" ? null : await this.cache.get(prepared.cacheKey);
|
|
6402
|
+
if (!hit) misses.push(nodeId);
|
|
6403
|
+
}
|
|
6404
|
+
return misses;
|
|
6405
|
+
}
|
|
6366
6406
|
/** A cache hit replayed as this node's result: its outputs written, and free. */
|
|
6367
6407
|
async replayCached(node, cacheKey, outputs, writer) {
|
|
6368
6408
|
const cacheT0 = Date.now();
|
|
@@ -8804,7 +8844,12 @@ var CompositionMetaSchema = z12.object({
|
|
|
8804
8844
|
fps: z12.number().int().positive().default(30),
|
|
8805
8845
|
default_duration: z12.number().positive().default(10),
|
|
8806
8846
|
inputs: z12.record(z12.string(), InputSpec).default({}),
|
|
8807
|
-
params: z12.record(z12.string(), ParamSpec).default({})
|
|
8847
|
+
params: z12.record(z12.string(), ParamSpec).default({}),
|
|
8848
|
+
/**
|
|
8849
|
+
* The page reads its own staged files (a picture's pixels), so a snapshot opens it with
|
|
8850
|
+
* file access. Off by default: Chromium grants it for every file:// path, not just these.
|
|
8851
|
+
*/
|
|
8852
|
+
reads_staged_files: z12.boolean().optional()
|
|
8808
8853
|
}).strict();
|
|
8809
8854
|
async function loadCompositionMeta(compositionDir) {
|
|
8810
8855
|
const metaPath = path13.join(compositionDir, "meta.json");
|
|
@@ -9835,7 +9880,7 @@ var hyperframeSnapshotNode = defineNode({
|
|
|
9835
9880
|
const pwSpecifier = ["play", "wright"].join("");
|
|
9836
9881
|
const playwright = require_3(pwSpecifier);
|
|
9837
9882
|
const { chromium } = playwright;
|
|
9838
|
-
const browser = await chromium.launch({ headless: true });
|
|
9883
|
+
const browser = await chromium.launch({ headless: true, args: chromiumArgsFor(meta) });
|
|
9839
9884
|
try {
|
|
9840
9885
|
const context = await browser.newContext({
|
|
9841
9886
|
viewport: { width: meta.width, height: meta.height },
|
|
@@ -9871,6 +9916,9 @@ var hyperframeSnapshotNode = defineNode({
|
|
|
9871
9916
|
}
|
|
9872
9917
|
}
|
|
9873
9918
|
});
|
|
9919
|
+
function chromiumArgsFor(meta) {
|
|
9920
|
+
return meta.reads_staged_files ? ["--allow-file-access-from-files"] : [];
|
|
9921
|
+
}
|
|
9874
9922
|
function validateAndParseDynamicParams2(meta, params) {
|
|
9875
9923
|
const dynamic = {};
|
|
9876
9924
|
for (const [k, v] of Object.entries(params)) {
|
|
@@ -11660,4 +11708,4 @@ export {
|
|
|
11660
11708
|
defaultRegistry,
|
|
11661
11709
|
createEngineFromEnv
|
|
11662
11710
|
};
|
|
11663
|
-
//# sourceMappingURL=chunk-
|
|
11711
|
+
//# sourceMappingURL=chunk-DGZ5DLXK.js.map
|