@koda-sl/baker-cli 0.270.2-dev.f69bf4bac → 0.270.4-dev.12dd573e5
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.
|
@@ -1139,6 +1139,14 @@ function normalizeForCanonical(value) {
|
|
|
1139
1139
|
return void 0;
|
|
1140
1140
|
}
|
|
1141
1141
|
|
|
1142
|
+
// ../canvas-contract/src/frameRealism.ts
|
|
1143
|
+
function frameRealismDirection(opts = {}) {
|
|
1144
|
+
return " Everything obeys real-world physics: paper, card and screens are OPAQUE with nothing showing through from behind, every object is at believable real-world scale next to the people handling it, and every object has its real-world form and construction \u2014 a phone has ONE screen and it is on the front. NO readable text or numbers anywhere in frame \u2014 phone screens, documents and signage stay illegible or out of focus, because any figure the model invents will contradict the script. Hands are kept simple: no close-up of fingers manipulating small parts, no hand gripping the edge of an object, and each person has exactly TWO arms and TWO legs, all attached and all visible or all out of frame. Anyone working does so the way the trade actually does it: nobody stands or kneels on the equipment being installed, nothing is fitted overhanging an edge or floating unsupported, and every part rests on the structure that would really carry it." + // The newest clause, and the one no route had. A testimonial came back with the customer
|
|
1145
|
+
// repairing the panel herself: nothing said she was not the installer, so the model cast
|
|
1146
|
+
// her as one. Who someone IS in the picture has to be stated, or it is guessed.
|
|
1147
|
+
(opts.role ? ` The person on camera is ${opts.role} \u2014 they are shown as that and never doing somebody else's job.` : "") + (opts.currency ? ` If a currency is unavoidably visible it is ${opts.currency}.` : "");
|
|
1148
|
+
}
|
|
1149
|
+
|
|
1142
1150
|
// ../canvas-contract/src/registry.ts
|
|
1143
1151
|
var OPENROUTER_IMAGE_AR = ["1:1", "2:3", "3:2", "3:4", "4:3", "4:5", "5:4", "9:16", "16:9", "21:9"];
|
|
1144
1152
|
var OPENROUTER_IMAGE_AR_EXTREME = [...OPENROUTER_IMAGE_AR, "1:4", "4:1", "1:8", "8:1"];
|
|
@@ -3123,6 +3131,16 @@ function dfsCycle(u, color, stack, reverseAdj) {
|
|
|
3123
3131
|
stack.pop();
|
|
3124
3132
|
return null;
|
|
3125
3133
|
}
|
|
3134
|
+
function nodesBeforeCheckpoint(graph, types, stopKinds) {
|
|
3135
|
+
const all = new Set(graph.keys());
|
|
3136
|
+
if (!stopKinds?.size) return all;
|
|
3137
|
+
const running = /* @__PURE__ */ new Set();
|
|
3138
|
+
for (const layer of topologicalLayers(graph)) {
|
|
3139
|
+
if (layer.some((id) => stopKinds.has(types.get(id) ?? ""))) return running;
|
|
3140
|
+
for (const id of layer) running.add(id);
|
|
3141
|
+
}
|
|
3142
|
+
return running;
|
|
3143
|
+
}
|
|
3126
3144
|
|
|
3127
3145
|
// src/engine/engine/validator.ts
|
|
3128
3146
|
import { readFile as readFile2 } from "fs/promises";
|
|
@@ -3755,6 +3773,19 @@ function checkSlotsForNode(ctx, n, _i) {
|
|
|
3755
3773
|
});
|
|
3756
3774
|
}
|
|
3757
3775
|
}
|
|
3776
|
+
function estimateCreditsFor(canvas, registry, ids) {
|
|
3777
|
+
let total = 0;
|
|
3778
|
+
for (const n of canvas.nodes) {
|
|
3779
|
+
if (!ids.has(n.id)) continue;
|
|
3780
|
+
const def = registry.get(n.type);
|
|
3781
|
+
if (!def?.cost) continue;
|
|
3782
|
+
try {
|
|
3783
|
+
total += def.cost({ params: def.params.parse(n.params ?? {}) }).credits;
|
|
3784
|
+
} catch {
|
|
3785
|
+
}
|
|
3786
|
+
}
|
|
3787
|
+
return total;
|
|
3788
|
+
}
|
|
3758
3789
|
function estimateCredits(ctx) {
|
|
3759
3790
|
let total = 0;
|
|
3760
3791
|
for (const n of ctx.canvas.nodes) {
|
|
@@ -4579,6 +4610,13 @@ function unwrap(schema) {
|
|
|
4579
4610
|
}
|
|
4580
4611
|
|
|
4581
4612
|
// src/engine/engine/executor.ts
|
|
4613
|
+
function heldByCheckpoint(canvas, layer, kinds) {
|
|
4614
|
+
if (!kinds?.size) return [];
|
|
4615
|
+
return layer.filter((id) => {
|
|
4616
|
+
const type = canvas.nodes.find((n) => n.id === id)?.type;
|
|
4617
|
+
return type !== void 0 && kinds.has(type);
|
|
4618
|
+
});
|
|
4619
|
+
}
|
|
4582
4620
|
var Engine = class {
|
|
4583
4621
|
registry;
|
|
4584
4622
|
client;
|
|
@@ -4606,7 +4644,7 @@ var Engine = class {
|
|
|
4606
4644
|
async run(input, opts = {}) {
|
|
4607
4645
|
const validation = await this.validateDeep(input);
|
|
4608
4646
|
if (!validation.ok) throw new ValidationError(validation.issues);
|
|
4609
|
-
if (opts.max_credits !== void 0 && validation.estimatedCredits > opts.max_credits) {
|
|
4647
|
+
if (!opts.stop_before_kinds?.size && opts.max_credits !== void 0 && validation.estimatedCredits > opts.max_credits) {
|
|
4610
4648
|
throw new RunAbortedError(
|
|
4611
4649
|
"cost_cap",
|
|
4612
4650
|
`estimated ${validation.estimatedCredits} credits exceeds the ${opts.max_credits}-credit cap \u2014 nothing was billed; raise --max-credits or shrink the canvas`
|
|
@@ -4625,6 +4663,20 @@ var Engine = class {
|
|
|
4625
4663
|
const counters = { cachedNodes: 0, totalCredits: 0 };
|
|
4626
4664
|
const nodeRuns = [];
|
|
4627
4665
|
const graph = this.pruneToOutput(canvas, buildGraph(canvas));
|
|
4666
|
+
if (opts.max_credits !== void 0 && opts.stop_before_kinds?.size) {
|
|
4667
|
+
const willRun = nodesBeforeCheckpoint(
|
|
4668
|
+
graph,
|
|
4669
|
+
new Map(canvas.nodes.map((n) => [n.id, n.type])),
|
|
4670
|
+
opts.stop_before_kinds
|
|
4671
|
+
);
|
|
4672
|
+
const estimate = estimateCreditsFor(canvas, this.registry, willRun);
|
|
4673
|
+
if (estimate > opts.max_credits) {
|
|
4674
|
+
throw new RunAbortedError(
|
|
4675
|
+
"cost_cap",
|
|
4676
|
+
`estimated ${estimate} credits exceeds the ${opts.max_credits}-credit cap \u2014 nothing was billed; raise --max-credits or shrink the canvas`
|
|
4677
|
+
);
|
|
4678
|
+
}
|
|
4679
|
+
}
|
|
4628
4680
|
const needsBytes = computeNeedsLocalBytes(canvas, graph, this.registry);
|
|
4629
4681
|
this.emitProgress(opts, {
|
|
4630
4682
|
kind: "plan",
|
|
@@ -4669,6 +4721,13 @@ var Engine = class {
|
|
|
4669
4721
|
`spent ${counters.totalCredits} credits, over the ${opts.max_credits}-credit cap \u2014 completed nodes are cached; raise --max-credits to continue where this stopped`
|
|
4670
4722
|
);
|
|
4671
4723
|
}
|
|
4724
|
+
const held = heldByCheckpoint(canvas, layer, opts.stop_before_kinds);
|
|
4725
|
+
if (held.length > 0) {
|
|
4726
|
+
throw new RunAbortedError(
|
|
4727
|
+
"checkpoint",
|
|
4728
|
+
`stopped before ${held.join(", ")} \u2014 everything up to here is done and cached, so continuing this run id pays for none of it again`
|
|
4729
|
+
);
|
|
4730
|
+
}
|
|
4672
4731
|
const settled = await mapWithConcurrency(layer, limit, (nodeId) => {
|
|
4673
4732
|
if (opts.signal?.aborted) {
|
|
4674
4733
|
return Promise.reject(new RunAbortedError("signal", "run aborted before node dispatch"));
|
|
@@ -9230,6 +9289,7 @@ export {
|
|
|
9230
9289
|
describeFailureReason,
|
|
9231
9290
|
AD_FORMAT_PLATFORMS,
|
|
9232
9291
|
platformFormats,
|
|
9292
|
+
frameRealismDirection,
|
|
9233
9293
|
SEEDANCE_DURATIONS,
|
|
9234
9294
|
ELEVENLABS_MAX_MUSIC_LENGTH_MS,
|
|
9235
9295
|
IMAGE_GENERATE_MODELS,
|
|
@@ -9285,4 +9345,4 @@ export {
|
|
|
9285
9345
|
defaultRegistry,
|
|
9286
9346
|
createEngineFromEnv
|
|
9287
9347
|
};
|
|
9288
|
-
//# sourceMappingURL=chunk-
|
|
9348
|
+
//# sourceMappingURL=chunk-Y2GYULGB.js.map
|