@koda-sl/baker-cli 0.281.11-dev.0c0293389 → 0.282.0-dev.37d65c47b

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.
@@ -17,9 +17,9 @@ import {
17
17
  shouldEscalate
18
18
  } from "./chunk-WFWU3CHS.js";
19
19
 
20
- // ../../.pnpm-store/v10/links/@/safe-stable-stringify/2.5.0/88b6d0c76c4dff408de4044be85791896193f2435af7c280bc59312c3fb9649c/node_modules/safe-stable-stringify/index.js
20
+ // ../../.pnpm-store/v10/links/@/safe-stable-stringify/2.5.0/509a695c9237c6e3727f1f1f99169917f329e3ff3f7877be290b684e24bf153d/node_modules/safe-stable-stringify/index.js
21
21
  var require_safe_stable_stringify = __commonJS({
22
- "../../.pnpm-store/v10/links/@/safe-stable-stringify/2.5.0/88b6d0c76c4dff408de4044be85791896193f2435af7c280bc59312c3fb9649c/node_modules/safe-stable-stringify/index.js"(exports, module) {
22
+ "../../.pnpm-store/v10/links/@/safe-stable-stringify/2.5.0/509a695c9237c6e3727f1f1f99169917f329e3ff3f7877be290b684e24bf153d/node_modules/safe-stable-stringify/index.js"(exports, module) {
23
23
  "use strict";
24
24
  var { hasOwnProperty } = Object.prototype;
25
25
  var stringify = configure2();
@@ -1098,7 +1098,7 @@ function resolveAdaptFormats(params) {
1098
1098
  return params.formats ?? [];
1099
1099
  }
1100
1100
 
1101
- // ../../.pnpm-store/v10/links/@/safe-stable-stringify/2.5.0/88b6d0c76c4dff408de4044be85791896193f2435af7c280bc59312c3fb9649c/node_modules/safe-stable-stringify/esm/wrapper.js
1101
+ // ../../.pnpm-store/v10/links/@/safe-stable-stringify/2.5.0/509a695c9237c6e3727f1f1f99169917f329e3ff3f7877be290b684e24bf153d/node_modules/safe-stable-stringify/esm/wrapper.js
1102
1102
  var import__ = __toESM(require_safe_stable_stringify(), 1);
1103
1103
  var configure = import__.default.configure;
1104
1104
  var wrapper_default = import__.default;
@@ -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"));
@@ -5514,7 +5573,6 @@ var YtDlpError = class extends Error {
5514
5573
  this.stderrTail = stderrTail;
5515
5574
  this.name = "YtDlpError";
5516
5575
  }
5517
- stderrTail;
5518
5576
  };
5519
5577
  function tail(text, maxLines) {
5520
5578
  return text.split("\n").slice(-maxLines).join("\n");
@@ -8478,7 +8536,7 @@ var imageSearchNode = delegated({
8478
8536
  id: "image_search",
8479
8537
  version: "1.0.0",
8480
8538
  category: "image",
8481
- summary: "Agentic image search across Google Images, stock photography (Freepik), and Pinterest. An LLM agent picks the search tools and queries, selects the best matches, and the results are downloaded into canvas assets.",
8539
+ summary: "Agentic image search across Google Images, free stock photography (Pexels and Pixabay), and Pinterest. An LLM agent picks the search tools and queries, selects the best matches, and the results are downloaded into canvas assets.",
8482
8540
  when_to_use: "Use to gather real-world reference or inspiration images for a prompt (e.g. several photos of an australian shepherd) so a later step or the user can pick the best one. Not for creating new imagery \u2014 use image_generate for that.",
8483
8541
  inputs: z23.object({}).loose(),
8484
8542
  params: ImageSearchParams,
@@ -9230,6 +9288,7 @@ export {
9230
9288
  describeFailureReason,
9231
9289
  AD_FORMAT_PLATFORMS,
9232
9290
  platformFormats,
9291
+ frameRealismDirection,
9233
9292
  SEEDANCE_DURATIONS,
9234
9293
  ELEVENLABS_MAX_MUSIC_LENGTH_MS,
9235
9294
  IMAGE_GENERATE_MODELS,
@@ -9285,4 +9344,4 @@ export {
9285
9344
  defaultRegistry,
9286
9345
  createEngineFromEnv
9287
9346
  };
9288
- //# sourceMappingURL=chunk-YNUBWTLR.js.map
9347
+ //# sourceMappingURL=chunk-6KTKYFT4.js.map