@koda-sl/baker-cli 0.270.4-dev.719d8b6f3 → 0.270.4-dev.e9d93ca9c
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.
|
@@ -3131,16 +3131,6 @@ function dfsCycle(u, color, stack, reverseAdj) {
|
|
|
3131
3131
|
stack.pop();
|
|
3132
3132
|
return null;
|
|
3133
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
|
-
}
|
|
3144
3134
|
|
|
3145
3135
|
// src/engine/engine/validator.ts
|
|
3146
3136
|
import { readFile as readFile2 } from "fs/promises";
|
|
@@ -3773,19 +3763,6 @@ function checkSlotsForNode(ctx, n, _i) {
|
|
|
3773
3763
|
});
|
|
3774
3764
|
}
|
|
3775
3765
|
}
|
|
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
|
-
}
|
|
3789
3766
|
function estimateCredits(ctx) {
|
|
3790
3767
|
let total = 0;
|
|
3791
3768
|
for (const n of ctx.canvas.nodes) {
|
|
@@ -4644,7 +4621,7 @@ var Engine = class {
|
|
|
4644
4621
|
async run(input, opts = {}) {
|
|
4645
4622
|
const validation = await this.validateDeep(input);
|
|
4646
4623
|
if (!validation.ok) throw new ValidationError(validation.issues);
|
|
4647
|
-
if (
|
|
4624
|
+
if (opts.max_credits !== void 0 && validation.estimatedCredits > opts.max_credits) {
|
|
4648
4625
|
throw new RunAbortedError(
|
|
4649
4626
|
"cost_cap",
|
|
4650
4627
|
`estimated ${validation.estimatedCredits} credits exceeds the ${opts.max_credits}-credit cap \u2014 nothing was billed; raise --max-credits or shrink the canvas`
|
|
@@ -4663,20 +4640,6 @@ var Engine = class {
|
|
|
4663
4640
|
const counters = { cachedNodes: 0, totalCredits: 0 };
|
|
4664
4641
|
const nodeRuns = [];
|
|
4665
4642
|
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
|
-
}
|
|
4680
4643
|
const needsBytes = computeNeedsLocalBytes(canvas, graph, this.registry);
|
|
4681
4644
|
this.emitProgress(opts, {
|
|
4682
4645
|
kind: "plan",
|
|
@@ -9345,4 +9308,4 @@ export {
|
|
|
9345
9308
|
defaultRegistry,
|
|
9346
9309
|
createEngineFromEnv
|
|
9347
9310
|
};
|
|
9348
|
-
//# sourceMappingURL=chunk-
|
|
9311
|
+
//# sourceMappingURL=chunk-6GLEDTUP.js.map
|