pixelkiln 0.147.0 → 0.148.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/dist/cli.js CHANGED
@@ -1853,14 +1853,13 @@ function proTierCost(width, height) {
1853
1853
  if (px <= 102400) return PRO_TIER_PRICES[1];
1854
1854
  return PRO_TIER_PRICES[2];
1855
1855
  }
1856
+ var PIXMINIMAX_STEPS = [1, 1, 2, 2, 3, 3, 4, 5, 5, 6];
1856
1857
  function pixMiniMaxCost(width, height, frames, enhancePrompt = false) {
1857
- const f = width * height * Math.max(1, frames) / 4096;
1858
- let units;
1859
- if (f <= 8) units = 1;
1860
- else if (f <= 16) units = 1 + (f - 8) / 8;
1861
- else if (f <= 40) units = 2 + (f - 16) / 6;
1862
- else units = 6 + (f - 40) / 6;
1863
- const base = Math.max(1, Math.ceil(units - 1e-9));
1858
+ const side = Math.max(1, width, height);
1859
+ const upscaled = side * (side <= 64 ? 4 : side <= 128 ? 2 : 1);
1860
+ const reference = Math.max(1, frames) * upscaled * upscaled / 65536;
1861
+ const step = Math.max(1, Math.ceil(reference / 4 - 1e-9));
1862
+ const base = PIXMINIMAX_STEPS[Math.min(step, PIXMINIMAX_STEPS.length) - 1];
1864
1863
  return enhancePrompt ? base + 0.05 : base;
1865
1864
  }
1866
1865
  function tilesCost(tileSize, variations) {
@@ -1955,7 +1954,7 @@ var CharacterProportionsSchema = z.union([
1955
1954
  hipWidth: z.number().min(0.5).max(2).optional()
1956
1955
  }).strict()
1957
1956
  ]);
1958
- var CharacterAnimationModeSchema = z.enum(["template", "skeleton-v3", "v3", "pro"]);
1957
+ var CharacterAnimationModeSchema = z.enum(["template", "skeleton-v3", "v3", "pixminimax", "pro"]);
1959
1958
  var UiPieceSchema = z.discriminatedUnion("kind", [
1960
1959
  z.object({
1961
1960
  id: z.string().min(1),
@@ -2279,12 +2278,13 @@ var CharacterAnimationSchema = z.object({
2279
2278
  motionFrom: z.string().min(1).optional(),
2280
2279
  /**
2281
2280
  * Frames to generate without a template. A v3 loop takes an even 4 to 16;
2282
- * a sentence loop (`mode: "skeleton-v3"` with no `template`) takes 3 to 15.
2281
+ * a pixminimax loop a multiple of 4 from 4 to 40; a sentence loop
2282
+ * (`mode: "skeleton-v3"` with no `template`) takes 3 to 15.
2283
2283
  */
2284
- frames: z.number().int().min(3).max(16).optional(),
2284
+ frames: z.number().int().min(3).max(40).optional(),
2285
2285
  /** Playback rate recorded with the frames; PixelLab does not store one. */
2286
2286
  fps: z.number().int().min(1).max(60).default(8),
2287
- /** v3 only: keep the resting pose as frame 0, so `frames` generated frames land as `frames + 1` files. */
2287
+ /** v3 and pixminimax: keep the resting pose as frame 0, so `frames` generated frames land as `frames + 1` files. */
2288
2288
  keepFirstFrame: z.boolean().default(true),
2289
2289
  /**
2290
2290
  * `character` loops: strip the ghost pixels an animation model leaves
@@ -2298,28 +2298,41 @@ var CharacterAnimationSchema = z.object({
2298
2298
  * `template` when a template is named, otherwise `v3`; `skeleton-v3`
2299
2299
  * poses a template with PixelLab's skeleton model instead, or, with no
2300
2300
  * template, animates the asset's prompt as a sentence written into one 3D
2301
- * motion (a v3 base; 3-15 `frames`); `pro` for the sequential
2302
- * high-quality engine.
2301
+ * motion (a v3 base; 3-15 `frames`); `pixminimax` draws from the
2302
+ * prompt on PixelLab's PixMiniMax engine (4 to 40 `frames`, a multiple
2303
+ * of 4); `pro` for the sequential high-quality engine.
2303
2304
  */
2304
2305
  mode: CharacterAnimationModeSchema.optional(),
2305
2306
  /**
2306
- * v3 only: a manifest-relative image of the pose to start from, instead
2307
- * of the character's rotation for this direction. Up to 256px.
2307
+ * v3 and pixminimax: a manifest-relative image of the pose to start from,
2308
+ * instead of the character's rotation for this direction. Up to 256px.
2308
2309
  */
2309
2310
  startFrame: z.string().min(1).optional(),
2310
2311
  /**
2311
- * v3 only: a pose to animate toward. The loop then interpolates from the
2312
- * start frame (the rotation, or `startFrame`) to this image, which must
2313
- * be the same size as the start frame.
2312
+ * v3 and pixminimax: a pose to animate toward. The loop then interpolates
2313
+ * from the start frame (the rotation, or `startFrame`) to this image,
2314
+ * which must be the same size as the start frame. The same image as
2315
+ * `startFrame` closes a loop.
2314
2316
  */
2315
2317
  endFrame: z.string().min(1).optional(),
2316
- /** What is being animated, when the character's own description would mislead the model. */
2318
+ /**
2319
+ * What is being animated, when the character's own description would
2320
+ * mislead the model. On a pixminimax loop it is PixelLab's
2321
+ * `subject_description`, one noun phrase of up to 300 characters; left
2322
+ * out, PixelLab reads it off the start frame.
2323
+ */
2317
2324
  subject: z.string().min(1).optional(),
2325
+ /**
2326
+ * pixminimax only: the pose the start frame shows, up to 300 characters
2327
+ * ("standing beside the pole, one hand on it"). Left out, PixelLab reads
2328
+ * it off the image.
2329
+ */
2330
+ initialPose: z.string().min(1).max(300).optional(),
2318
2331
  /** Template mode only: style hints for this loop, over the character's own. */
2319
2332
  outline: z.string().min(1).optional(),
2320
2333
  shading: z.string().min(1).optional(),
2321
2334
  detail: z.string().min(1).optional(),
2322
- /** v3 text loops only: let PixelLab expand the action into a fuller motion description first. */
2335
+ /** v3 and pixminimax text loops only: let PixelLab expand the action into a fuller motion description first. */
2323
2336
  enhancePrompt: z.boolean().optional()
2324
2337
  }).strict().superRefine((animation, context) => {
2325
2338
  if (animation.directions !== void 0) {
@@ -2330,22 +2343,29 @@ var CharacterAnimationSchema = z.object({
2330
2343
  });
2331
2344
  }
2332
2345
  const sentence = animation.mode === "skeleton-v3" && !animation.template;
2333
- if (animation.frames !== void 0 && !sentence && animation.mode !== "pro") {
2346
+ const pixminimax = animation.mode === "pixminimax";
2347
+ if (animation.frames !== void 0 && pixminimax) {
2348
+ if (animation.frames % 4 !== 0 || animation.frames < 4) {
2349
+ context.addIssue({ code: z.ZodIssueCode.custom, message: "a pixminimax loop takes a multiple of 4 frames, 4 to 40", path: ["frames"] });
2350
+ }
2351
+ } else if (animation.frames !== void 0 && !sentence && animation.mode !== "pro") {
2334
2352
  if (animation.frames % 2 !== 0) {
2335
2353
  context.addIssue({ code: z.ZodIssueCode.custom, message: "frames must be even", path: ["frames"] });
2336
- } else if (animation.frames < 4) {
2337
- context.addIssue({ code: z.ZodIssueCode.custom, message: "frames must be 4 to 16", path: ["frames"] });
2354
+ } else if (animation.frames < 4 || animation.frames > 16) {
2355
+ context.addIssue({ code: z.ZodIssueCode.custom, message: "frames must be 4 to 16 (a pixminimax loop takes up to 40)", path: ["frames"] });
2338
2356
  }
2357
+ } else if (animation.frames !== void 0 && animation.mode === "pro" && animation.frames > 16) {
2358
+ context.addIssue({ code: z.ZodIssueCode.custom, message: "frames must be 16 or fewer", path: ["frames"] });
2339
2359
  }
2340
2360
  if (animation.frames !== void 0 && sentence && animation.frames > 15) {
2341
2361
  context.addIssue({ code: z.ZodIssueCode.custom, message: "a skeleton-v3 loop from a sentence takes 3 to 15 frames", path: ["frames"] });
2342
2362
  }
2343
2363
  const mode2 = animation.mode ?? (animation.template ? "template" : "v3");
2344
2364
  for (const key3 of ["startFrame", "endFrame", "enhancePrompt"]) {
2345
- if (animation[key3] !== void 0 && mode2 !== "v3") {
2365
+ if (animation[key3] !== void 0 && mode2 !== "v3" && mode2 !== "pixminimax") {
2346
2366
  context.addIssue({
2347
2367
  code: z.ZodIssueCode.custom,
2348
- message: `${key3} is for v3 loops; a ${mode2} loop ${mode2 === "template" || mode2 === "skeleton-v3" ? `starts from the character's rotation and ${animation.template ? "follows its template" : "animates its sentence"}` : "takes neither"}`,
2368
+ message: `${key3} is for v3 and pixminimax loops; a ${mode2} loop ${mode2 === "template" || mode2 === "skeleton-v3" ? `starts from the character's rotation and ${animation.template ? "follows its template" : "animates its sentence"}` : "takes neither"}`,
2349
2369
  path: [key3]
2350
2370
  });
2351
2371
  }
@@ -2355,6 +2375,12 @@ var CharacterAnimationSchema = z.object({
2355
2375
  context.addIssue({ code: z.ZodIssueCode.custom, message: `${key3} overrides apply to template loops only`, path: [key3] });
2356
2376
  }
2357
2377
  }
2378
+ if (animation.initialPose !== void 0 && mode2 !== "pixminimax") {
2379
+ context.addIssue({ code: z.ZodIssueCode.custom, message: `initialPose is for pixminimax loops; PixelLab's ${mode2} engine takes no pose caption`, path: ["initialPose"] });
2380
+ }
2381
+ if (pixminimax && animation.subject !== void 0 && animation.subject.length > 300) {
2382
+ context.addIssue({ code: z.ZodIssueCode.custom, message: "a pixminimax loop's subject is one noun phrase of up to 300 characters", path: ["subject"] });
2383
+ }
2358
2384
  if (animation.template && animation.mode && animation.mode !== "template" && animation.mode !== "skeleton-v3") {
2359
2385
  context.addIssue({
2360
2386
  code: z.ZodIssueCode.custom,
@@ -10078,8 +10104,11 @@ var PixelLabClient = class {
10078
10104
  * One animation of one character. Template mode costs a generation per
10079
10105
  * direction and fixes the frame count; skeleton-v3 poses the same template
10080
10106
  * with the skeleton video model (2-4 generations per direction); v3 draws
10081
- * `frameCount` frames from the action text; pro is the sequential engine.
10082
- * One job per direction.
10107
+ * `frameCount` frames from the action text; pixminimax does the same on
10108
+ * PixelLab's PixMiniMax engine (a multiple of 4 frames up to 40, the same
10109
+ * start/end frames, `keep_first_frame` and `enhance_prompt`, plus its own
10110
+ * `subject_description` and `initial_pose` captions); pro is the
10111
+ * sequential engine. One job per direction.
10083
10112
  *
10084
10113
  * Every mode but skeleton-v3 goes to `/animate-character`, the path whose
10085
10114
  * shapes were measured live. skeleton-v3 is documented only on
@@ -10095,6 +10124,7 @@ var PixelLabClient = class {
10095
10124
  async animateCharacter(args) {
10096
10125
  const encode = (image) => ({ type: "base64", base64: image.base64, format: image.format });
10097
10126
  const endpoint = args.mode === "skeleton-v3" ? "/characters/animations" : "/animate-character";
10127
+ const custom = args.mode === "v3" || args.mode === "pixminimax";
10098
10128
  const raw = await this.request(endpoint, {
10099
10129
  method: "POST",
10100
10130
  body: JSON.stringify({
@@ -10106,12 +10136,14 @@ var PixelLabClient = class {
10106
10136
  ...args.template ? { template_animation_id: args.template } : {},
10107
10137
  ...args.actionDescription ? { action_description: args.actionDescription } : {},
10108
10138
  ...args.description ? { description: args.description } : {},
10109
- // A template fixes its own frame count; v3 and a skeleton-v3 sentence take one.
10110
- ...(args.mode === "v3" || args.mode === "skeleton-v3" && !args.template) && args.frameCount ? { frame_count: args.frameCount } : {},
10111
- ...args.mode === "v3" && args.keepFirstFrame === false ? { keep_first_frame: false } : {},
10112
- ...args.mode === "v3" && args.startFrame ? { custom_start_frame: encode(args.startFrame) } : {},
10113
- ...args.mode === "v3" && args.endFrame ? { end_frame: encode(args.endFrame) } : {},
10114
- ...args.mode === "v3" && args.enhancePrompt ? { enhance_prompt: true } : {},
10139
+ // A template fixes its own frame count; v3, pixminimax and a skeleton-v3 sentence take one.
10140
+ ...(custom || args.mode === "skeleton-v3" && !args.template) && args.frameCount ? { frame_count: args.frameCount } : {},
10141
+ ...custom && args.keepFirstFrame === false ? { keep_first_frame: false } : {},
10142
+ ...custom && args.startFrame ? { custom_start_frame: encode(args.startFrame) } : {},
10143
+ ...custom && args.endFrame ? { end_frame: encode(args.endFrame) } : {},
10144
+ ...custom && args.enhancePrompt ? { enhance_prompt: true } : {},
10145
+ ...args.mode === "pixminimax" && args.subjectDescription ? { subject_description: args.subjectDescription } : {},
10146
+ ...args.mode === "pixminimax" && args.initialPose ? { initial_pose: args.initialPose } : {},
10115
10147
  ...args.mode === "template" && args.textGuidanceScale !== void 0 ? { text_guidance_scale: args.textGuidanceScale } : {},
10116
10148
  ...args.mode === "template" && args.outline ? { outline: args.outline } : {},
10117
10149
  ...args.mode === "template" && args.shading ? { shading: args.shading } : {},
@@ -12265,6 +12297,13 @@ function characterCost(spec) {
12265
12297
  if (animation.mode === "template") return 1;
12266
12298
  if (animation.mode === "skeleton-v3") return 4;
12267
12299
  if (animation.mode === "v3") return Math.max(1, Math.ceil(px * animation.frames / 65536));
12300
+ if (animation.mode === "pixminimax") {
12301
+ const start = animation.startFrame;
12302
+ return Math.max(
12303
+ pixMiniMaxCost(spec.width, spec.height, animation.frames, animation.enhancePrompt),
12304
+ start ? pixMiniMaxCost(start.width, start.height, animation.frames, animation.enhancePrompt) : 0
12305
+ );
12306
+ }
12268
12307
  return proCharacterTierCost(spec.width, spec.height);
12269
12308
  }
12270
12309
  if (character.kind === "state" || character.kind === "portrait") return proCharacterTierCost(spec.width, spec.height);
@@ -13065,7 +13104,7 @@ var PixelLabProvider = class _PixelLabProvider {
13065
13104
  const { startFrame, endFrame } = character.animation;
13066
13105
  for (const [name, image] of [["start frame", startFrame], ["end frame", endFrame]]) {
13067
13106
  if (image && (image.width > 256 || image.height > 256)) {
13068
- throw new Error(`${label}: ${name} is ${image.width}x${image.height}; PixelLab v3 takes up to 256px`);
13107
+ throw new Error(`${label}: ${name} is ${image.width}x${image.height}; PixelLab ${character.animation.mode} takes up to 256px`);
13069
13108
  }
13070
13109
  }
13071
13110
  if (endFrame) {
@@ -13180,6 +13219,9 @@ var PixelLabProvider = class _PixelLabProvider {
13180
13219
  `${spec.styleId}/${spec.assetId} needs a prompt describing the motion, or a template` + (sentence ? ' (a skeleton-v3 loop with no template animates its prompt, e.g. "swinging a sword in a wide arc")' : "")
13181
13220
  );
13182
13221
  }
13222
+ if (character.animation.mode === "pixminimax" && (character.animation.frames % 4 !== 0 || character.animation.frames < 4 || character.animation.frames > 40)) {
13223
+ throw new Error(`${spec.styleId}/${spec.assetId}: a pixminimax loop takes a multiple of 4 frames, 4 to 40; ${character.animation.frames} is not one`);
13224
+ }
13183
13225
  if (sentence && (character.animation.frames < 3 || character.animation.frames > 15)) {
13184
13226
  throw new Error(`${spec.styleId}/${spec.assetId}: a skeleton-v3 loop from a sentence takes 3 to 15 frames; ${character.animation.frames} is out of range`);
13185
13227
  }
@@ -13491,7 +13533,9 @@ var PixelLabProvider = class _PixelLabProvider {
13491
13533
  isometric: character.isometric,
13492
13534
  startFrame: animation.startFrame ? readPose(spec, "start frame", animation.startFrame) : void 0,
13493
13535
  endFrame: animation.endFrame ? readPose(spec, "end frame", animation.endFrame) : void 0,
13494
- description: animation.subject,
13536
+ // PixMiniMax captions its start frame with its own two fields; the
13537
+ // other engines take `subject` as the general `description`.
13538
+ ...animation.mode === "pixminimax" ? { subjectDescription: animation.subject, initialPose: animation.initialPose } : { description: animation.subject },
13495
13539
  outline: animation.outline,
13496
13540
  shading: animation.shading,
13497
13541
  detail: animation.detail,
@@ -18138,6 +18182,8 @@ async function resolveCharacterShape(asset, style, kind, files) {
18138
18182
  ...asset.animation.startFrame ? { startFrame: await pose(asset.animation.startFrame, "Animation start frame") } : {},
18139
18183
  ...asset.animation.endFrame ? { endFrame: await pose(asset.animation.endFrame, "Animation end frame") } : {},
18140
18184
  ...asset.animation.subject ? { subject: asset.animation.subject } : {},
18185
+ // Set only on a pixminimax loop (the schema refuses it elsewhere), so no other spec's hash moves.
18186
+ ...asset.animation.initialPose ? { initialPose: asset.animation.initialPose } : {},
18141
18187
  ...asset.animation.outline ? { outline: asset.animation.outline } : {},
18142
18188
  ...asset.animation.shading ? { shading: asset.animation.shading } : {},
18143
18189
  ...asset.animation.detail ? { detail: asset.animation.detail } : {},
@@ -18176,6 +18222,7 @@ async function resolveObjectProShape(assetId, asset, style, kind, files) {
18176
18222
  for (const [field, value] of Object.entries({
18177
18223
  template: asset.animation.template,
18178
18224
  subject: asset.animation.subject,
18225
+ initialPose: asset.animation.initialPose,
18179
18226
  outline: asset.animation.outline,
18180
18227
  shading: asset.animation.shading,
18181
18228
  detail: asset.animation.detail
@@ -18189,7 +18236,7 @@ async function resolveObjectProShape(assetId, asset, style, kind, files) {
18189
18236
  if (asset.animation.clean !== void 0) {
18190
18237
  throw new Error(`assets.${assetId}: animation.clean applies to character loops; objectPro loops are not cleaned`);
18191
18238
  }
18192
- if (asset.animation.mode === "template" || asset.animation.mode === "skeleton-v3") {
18239
+ if (asset.animation.mode === "template" || asset.animation.mode === "skeleton-v3" || asset.animation.mode === "pixminimax") {
18193
18240
  throw new Error(`assets.${assetId}: objectPro animations have no "${asset.animation.mode}" mode; use "v3" or "pro"`);
18194
18241
  }
18195
18242
  const pose = async (rel, what) => {
@@ -18549,7 +18596,7 @@ async function pushTags(provider, specs, lock, opts = {}) {
18549
18596
 
18550
18597
  // src/pipeline/import.ts
18551
18598
  import { existsSync as existsSync17 } from "fs";
18552
- import { readFile as readFile12 } from "fs/promises";
18599
+ import { readdir, readFile as readFile12 } from "fs/promises";
18553
18600
  import path22 from "path";
18554
18601
 
18555
18602
  // src/pipeline/history.ts
@@ -18712,8 +18759,9 @@ async function revertGeneration(provider, spec, lock, lockPath, opts) {
18712
18759
  }
18713
18760
 
18714
18761
  // src/pipeline/import.ts
18715
- function buildImportedEntry(spec, bytes, opts = {}, now = /* @__PURE__ */ new Date()) {
18762
+ function buildImportedEntry(spec, bytes, opts = {}, now = /* @__PURE__ */ new Date(), frames) {
18716
18763
  const png = decodePng(bytes);
18764
+ for (const frame of frames ?? []) decodePng(frame.bytes);
18717
18765
  const at2 = now.toISOString();
18718
18766
  const origin = {
18719
18767
  ...opts.tool ? { tool: opts.tool } : {},
@@ -18738,7 +18786,14 @@ function buildImportedEntry(spec, bytes, opts = {}, now = /* @__PURE__ */ new Da
18738
18786
  error: null,
18739
18787
  sourceUrl: null,
18740
18788
  sourceUrls: [],
18741
- outputs: [{ path: portableOutputPath(spec.outFile, spec.root), sha256: sha256(bytes) }],
18789
+ // A frame set is recorded the way fetch records one: an output per frame,
18790
+ // in order, each with its `frame-NN` role, so `plan` resolves the same paths.
18791
+ outputs: frames?.length ? frames.map((frame) => ({
18792
+ path: portableOutputPath(frame.file, spec.root),
18793
+ sha256: sha256(frame.bytes),
18794
+ role: frame.role,
18795
+ mediaType: MediaType.PNG
18796
+ })) : [{ path: portableOutputPath(spec.outFile, spec.root), sha256: sha256(bytes) }],
18742
18797
  submittedAt: null,
18743
18798
  downloadedAt: at2,
18744
18799
  cost: opts.cost ?? 0,
@@ -18753,6 +18808,32 @@ function buildImportedEntry(spec, bytes, opts = {}, now = /* @__PURE__ */ new Da
18753
18808
  }
18754
18809
  };
18755
18810
  }
18811
+ var frameRole2 = (index) => `frame-${String(index).padStart(2, "0")}`;
18812
+ async function findFrames(spec) {
18813
+ const at2 = (index) => memberPath(spec.outFile, frameRole2(index), 0, 2, MediaType.PNG);
18814
+ const base = path22.basename(at2(0)).replace(/00\.png$/, "");
18815
+ let names = [];
18816
+ try {
18817
+ names = await readdir(path22.dirname(spec.outFile));
18818
+ } catch {
18819
+ names = [];
18820
+ }
18821
+ const found = /* @__PURE__ */ new Set();
18822
+ for (const name of names) {
18823
+ if (!name.startsWith(base)) continue;
18824
+ const match = /^(\d+)\.png$/i.exec(name.slice(base.length));
18825
+ if (match) found.add(Number(match[1]));
18826
+ }
18827
+ const expected = spec.revision?.frames;
18828
+ const expectsFrames = expected !== void 0 || spec.generator === "frames";
18829
+ if (!found.size && !expectsFrames) return null;
18830
+ const highest = found.size ? Math.max(...found) : -1;
18831
+ const upTo = Math.max(highest + 1, expected ?? 0, expectsFrames ? 1 : 0);
18832
+ const missing = [];
18833
+ for (let index = 0; index < upTo; index++) if (!found.has(index)) missing.push(at2(index));
18834
+ if (missing.length) return { missing };
18835
+ return { files: Array.from({ length: upTo }, (_, index) => ({ role: frameRole2(index), file: at2(index) })) };
18836
+ }
18756
18837
  function unimportable(spec) {
18757
18838
  if (spec.character) return "a character is several files; import it with account adopt";
18758
18839
  if (spec.vfx) return "an effect is rendered from its recipe, not imported";
@@ -18785,9 +18866,18 @@ async function importLocal(specs, lock, lockPath, opts = {}) {
18785
18866
  skipped.push({ key: key3, reason });
18786
18867
  continue;
18787
18868
  }
18869
+ let frameFiles;
18788
18870
  if (!existsSync17(spec.outFile)) {
18789
- skipped.push({ key: key3, reason: `no file at ${spec.outFile}` });
18790
- continue;
18871
+ const frames2 = await findFrames(spec);
18872
+ if (!frames2) {
18873
+ skipped.push({ key: key3, reason: `no file at ${spec.outFile}` });
18874
+ continue;
18875
+ }
18876
+ if ("missing" in frames2) {
18877
+ skipped.push({ key: key3, reason: `frame set is missing ${frames2.missing.map((file) => path22.basename(file)).join(", ")} (in ${path22.dirname(spec.outFile)})` });
18878
+ continue;
18879
+ }
18880
+ frameFiles = frames2.files;
18791
18881
  }
18792
18882
  if (lock.entries[key3] && !opts.force) {
18793
18883
  skipped.push({ key: key3, reason: "already in the lockfile (use --force to replace it)" });
@@ -18795,9 +18885,11 @@ async function importLocal(specs, lock, lockPath, opts = {}) {
18795
18885
  }
18796
18886
  let patch;
18797
18887
  let bytes;
18888
+ let frames;
18798
18889
  try {
18799
- bytes = await readFile12(spec.outFile);
18800
- patch = buildImportedEntry(spec, bytes, { ...opts, rawSha256 }, /* @__PURE__ */ new Date());
18890
+ frames = frameFiles ? await Promise.all(frameFiles.map(async (frame) => ({ ...frame, bytes: await readFile12(frame.file) }))) : void 0;
18891
+ bytes = frames ? frames[0].bytes : await readFile12(spec.outFile);
18892
+ patch = buildImportedEntry(spec, bytes, { ...opts, rawSha256 }, /* @__PURE__ */ new Date(), frames);
18801
18893
  } catch (error) {
18802
18894
  skipped.push({ key: key3, reason: `invalid PNG: ${error instanceof Error ? error.message : String(error)}` });
18803
18895
  continue;
@@ -18807,9 +18899,10 @@ async function importLocal(specs, lock, lockPath, opts = {}) {
18807
18899
  continue;
18808
18900
  }
18809
18901
  const existing = lock.entries[key3];
18810
- const history = existing?.outputs[0]?.sha256 === sha256(bytes) ? existing.history : historyAfterReplacing(existing, opts.historyLimit ?? DEFAULT_HISTORY_LIMIT, patch.downloadedAt ?? (/* @__PURE__ */ new Date()).toISOString());
18902
+ const sameBytes = existing !== void 0 && existing.outputs.length === patch.outputs.length && existing.outputs.every((output, index) => output.sha256 === patch.outputs[index].sha256);
18903
+ const history = sameBytes ? existing.history : historyAfterReplacing(existing, opts.historyLimit ?? DEFAULT_HISTORY_LIMIT, patch.downloadedAt ?? (/* @__PURE__ */ new Date()).toISOString());
18811
18904
  if (cacheDir) {
18812
- await cacheMedia(cacheDir, bytes, MediaType.PNG);
18905
+ for (const member of frames ?? [{ bytes }]) await cacheMedia(cacheDir, member.bytes, MediaType.PNG);
18813
18906
  if (rawBytes) await cacheMedia(cacheDir, rawBytes, MediaType.PNG);
18814
18907
  }
18815
18908
  imported.push({ key: key3, entry: upsert(lock, key3, {
@@ -19021,12 +19114,12 @@ async function adopt(provider, specs, lock, lockPath, opts = {}) {
19021
19114
  provider: provider.id
19022
19115
  });
19023
19116
  matched++;
19024
- log2(` adopted ${key3} \u2190 ${obj.id}`);
19117
+ log2(` ${opts.dryRun ? "would adopt" : "adopted"} ${key3} \u2190 ${obj.id}`);
19025
19118
  }
19026
19119
  }
19027
19120
  }
19028
19121
  await Promise.all(Array.from({ length: Math.min(concurrency, remote.length || 1) }, worker));
19029
- await saveLock(lockPath, lock);
19122
+ if (!opts.dryRun) await saveLock(lockPath, lock);
19030
19123
  if (!opts.noCache) {
19031
19124
  pruneCache(cache, new Set(remote.map((o) => o.id)));
19032
19125
  await saveCache(cachePath, cache);
@@ -19101,7 +19194,7 @@ import path24 from "path";
19101
19194
  async function adoptCharacters(provider, specs, lock, lockPath, opts) {
19102
19195
  const log2 = opts.onProgress ?? (() => {
19103
19196
  });
19104
- const result = { scanned: 0, matched: 0, unmatched: [], remaining: [], written: [], differing: [] };
19197
+ const result = { scanned: 0, matched: 0, unmatched: [], remaining: [], written: [], differing: [], engineMismatches: [] };
19105
19198
  if (!provider.listCharacters || !provider.getCharacter) return result;
19106
19199
  const wanted = specs.filter((spec) => spec.character && !spec.mirror);
19107
19200
  if (!wanted.length) return result;
@@ -19150,6 +19243,8 @@ async function adoptCharacters(provider, specs, lock, lockPath, opts) {
19150
19243
  const file = expectedOutputPath(spec, source.role, index, sources.length);
19151
19244
  if (existsSync20(file)) {
19152
19245
  if (sha256(await readFile15(file)) !== hash) result.differing.push(path24.relative(process.cwd(), file));
19246
+ } else if (opts.dryRun) {
19247
+ result.written.push(path24.relative(process.cwd(), file));
19153
19248
  } else {
19154
19249
  await mkdir10(path24.dirname(file), { recursive: true });
19155
19250
  await writeFile11(file, bytes);
@@ -19179,7 +19274,7 @@ async function adoptCharacters(provider, specs, lock, lockPath, opts) {
19179
19274
  result.unmatched.push(`${key3}: ${err instanceof Error ? err.message : String(err)}`);
19180
19275
  }
19181
19276
  }
19182
- if (adoptedThisWave) {
19277
+ if (adoptedThisWave && !opts.dryRun) {
19183
19278
  await saveLock(lockPath, lock);
19184
19279
  current = await opts.resolve();
19185
19280
  }
@@ -19250,7 +19345,7 @@ async function adoptCharacters(provider, specs, lock, lockPath, opts) {
19250
19345
  });
19251
19346
  claimed.add(full.id);
19252
19347
  result.matched++;
19253
- log2(` adopted ${key3} \u2190 character ${full.id}${full.stateName && full.stateName !== "Idle" ? ` (${full.stateName})` : ""}`);
19348
+ log2(` ${opts.dryRun ? "would adopt" : "adopted"} ${key3} \u2190 character ${full.id}${full.stateName && full.stateName !== "Idle" ? ` (${full.stateName})` : ""}`);
19254
19349
  return true;
19255
19350
  }
19256
19351
  async function adoptAnimation(spec, key3) {
@@ -19292,6 +19387,13 @@ async function adoptCharacters(provider, specs, lock, lockPath, opts) {
19292
19387
  }
19293
19388
  }
19294
19389
  }
19390
+ const declaredCustom = animation.mode !== "template";
19391
+ const remoteCustom = match.type.startsWith("custom");
19392
+ if (animation.mode !== "skeleton-v3" && declaredCustom !== remoteCustom) {
19393
+ result.engineMismatches.push(
19394
+ `${key3}: declared mode "${animation.mode}", but the account's record reads "${match.type}", ` + (remoteCustom ? "a loop drawn from text, not a template" : "a template loop")
19395
+ );
19396
+ }
19295
19397
  const sources = match.frames.map((url, index) => ({ url, role: `frame-${String(index).padStart(2, "0")}` }));
19296
19398
  const outputs = await materialize(spec, sources);
19297
19399
  const durable = sources.filter((source) => shouldPersistSourceUrl(source.url));
@@ -19323,6 +19425,10 @@ async function adoptCharacters(provider, specs, lock, lockPath, opts) {
19323
19425
  animationGroupId: match.groupId,
19324
19426
  animationName: match.name,
19325
19427
  direction: animation.direction,
19428
+ // The engine, taken from the manifest: the provider does not report it.
19429
+ mode: animation.mode,
19430
+ modeFrom: "manifest",
19431
+ animationType: match.type,
19326
19432
  adopted: true
19327
19433
  }
19328
19434
  }
@@ -19334,10 +19440,10 @@ async function adoptCharacters(provider, specs, lock, lockPath, opts) {
19334
19440
  provider: provider.id
19335
19441
  });
19336
19442
  result.matched++;
19337
- log2(` adopted ${key3} \u2190 ${animation.direction} animation ${match.groupId ?? animationId ?? match.type} of ${parentId}`);
19443
+ log2(` ${opts.dryRun ? "would adopt" : "adopted"} ${key3} \u2190 ${animation.direction} animation ${match.groupId ?? animationId ?? match.type} of ${parentId}`);
19338
19444
  return true;
19339
19445
  }
19340
- await saveLock(lockPath, lock);
19446
+ if (!opts.dryRun) await saveLock(lockPath, lock);
19341
19447
  if (!opts.noCache) {
19342
19448
  pruneCache(cache, new Set(remote.map((character) => character.id)), "character:");
19343
19449
  await saveCache(cachePath, cache);
@@ -20571,52 +20677,63 @@ async function runAdopt(args) {
20571
20677
  const { loaded, specs, lock, accountProvider } = await openAccountProject(args);
20572
20678
  const providerFor = providerCache("online");
20573
20679
  const provider = providerFor(accountProvider);
20574
- log(`
20680
+ const dryRun = args.dryRun;
20681
+ const log2 = dryRun && args.json ? (msg = "") => console.error(msg) : log;
20682
+ const verb = dryRun ? "would adopt" : "adopted";
20683
+ log2(`
20575
20684
  Reconciling account objects against files already on disk\u2026`);
20576
- const res = await adopt(provider, specs.filter((spec) => spec.generator !== "character"), lock, args.lock, { onProgress: log });
20577
- log(`
20578
- scanned ${res.scanned} remote object(s), adopted ${res.matched}`);
20685
+ const res = await adopt(provider, specs.filter((spec) => spec.generator !== "character"), lock, args.lock, { onProgress: log2, dryRun });
20686
+ log2(`
20687
+ scanned ${res.scanned} remote object(s), ${verb} ${res.matched}`);
20688
+ let characters = null;
20579
20689
  if (specs.some((spec) => spec.character) && provider.listCharacters) {
20580
- log(`
20690
+ log2(`
20581
20691
  Reconciling account characters against the manifest's character assets\u2026`);
20582
- const characters = await adoptCharacters(provider, specs, lock, args.lock, {
20583
- onProgress: log,
20692
+ characters = await adoptCharacters(provider, specs, lock, args.lock, {
20693
+ onProgress: log2,
20694
+ dryRun,
20584
20695
  resolve: async () => (await resolveSpecs(loaded, { styles: args.styles, assets: args.assets })).filter((spec) => spec.provider === accountProvider)
20585
20696
  });
20586
- log(`
20587
- scanned ${characters.scanned} character(s), adopted ${characters.matched}`);
20588
- if (characters.written.length) log(` wrote ${characters.written.length} file(s) that were not on disk`);
20589
- for (const file of characters.differing) log(` differs from the account, left alone: ${file}`);
20697
+ log2(`
20698
+ scanned ${characters.scanned} character(s), ${verb} ${characters.matched}`);
20699
+ if (characters.written.length) log2(` ${dryRun ? "would write" : "wrote"} ${characters.written.length} file(s) that were not on disk`);
20700
+ if (dryRun) for (const file of characters.written) log2(` ${file}`);
20701
+ for (const file of characters.differing) log2(` differs from the account, left alone: ${file}`);
20702
+ if (characters.engineMismatches.length) {
20703
+ log2(`
20704
+ adopted loops whose record contradicts the declared mode (check animation.mode):`);
20705
+ for (const line of characters.engineMismatches) log2(` ${line}`);
20706
+ }
20590
20707
  if (characters.unmatched.length) {
20591
- log(`
20708
+ log2(`
20592
20709
  character assets not matched (${characters.unmatched.length}):`);
20593
- for (const line of characters.unmatched.slice(0, 15)) log(` ${line}`);
20710
+ for (const line of characters.unmatched.slice(0, 15)) log2(` ${line}`);
20594
20711
  }
20595
20712
  if (characters.remaining.length) {
20596
- log(`
20713
+ log2(`
20597
20714
  characters on the account no entry claims (${characters.remaining.length}):`);
20598
20715
  for (const c of characters.remaining.slice(0, 15)) {
20599
- log(` ${c.id} ${c.name}${c.stateName && c.stateName !== "Idle" ? ` / ${c.stateName}` : ""} ${c.directions}dir ${c.width}x${c.height} ${c.animationCount} animation(s)`);
20716
+ log2(` ${c.id} ${c.name}${c.stateName && c.stateName !== "Idle" ? ` / ${c.stateName}` : ""} ${c.directions}dir ${c.width}x${c.height} ${c.animationCount} animation(s)`);
20600
20717
  }
20601
- if (characters.remaining.length > 15) log(` \u2026 and ${characters.remaining.length - 15} more`);
20602
- log(` Declare one as a character asset with "remoteId" and run adopt again to bring it in.`);
20718
+ if (characters.remaining.length > 15) log2(` \u2026 and ${characters.remaining.length - 15} more`);
20719
+ log2(` Declare one as a character asset with "remoteId" and run adopt again to bring it in.`);
20603
20720
  }
20604
20721
  }
20605
20722
  if (res.ambiguous.length) {
20606
- log(`
20723
+ log2(`
20607
20724
  ambiguous (${res.ambiguous.length}):`);
20608
- for (const a of res.ambiguous.slice(0, 10)) log(` ${a}`);
20725
+ for (const a of res.ambiguous.slice(0, 10)) log2(` ${a}`);
20609
20726
  }
20610
20727
  if (res.unmatchedLocal.length) {
20611
- log(`
20728
+ log2(`
20612
20729
  local files with no matching remote object (${res.unmatchedLocal.length}):`);
20613
- for (const u of res.unmatchedLocal.slice(0, 15)) log(` ${u}`);
20730
+ for (const u of res.unmatchedLocal.slice(0, 15)) log2(` ${u}`);
20614
20731
  }
20615
20732
  if (res.unmatchedRemote.length) {
20616
- log(`
20733
+ log2(`
20617
20734
  remote objects not matched by THIS manifest (${res.unmatchedRemote.length}):`);
20618
- log(formatUnmatchedRemote(res.unmatchedRemote));
20619
- log(
20735
+ log2(formatUnmatchedRemote(res.unmatchedRemote));
20736
+ log2(
20620
20737
  `
20621
20738
  One account is shared across projects, so this list mixes discarded
20622
20739
  candidates with assets belonging to other manifests. Do not bulk-delete
@@ -20624,18 +20741,40 @@ async function runAdopt(args) {
20624
20741
  triage what is left over.`
20625
20742
  );
20626
20743
  }
20744
+ if (dryRun) {
20745
+ if (args.tag) log2(`
20746
+ --tag skipped: --dry-run pushes nothing upstream`);
20747
+ if (args.writePrompts) log2(` --write-prompts skipped: --dry-run leaves the manifest alone`);
20748
+ log2(`
20749
+ dry run: nothing written to disk, lockfile untouched (${args.lock})`);
20750
+ if (args.json) {
20751
+ console.log(JSON.stringify({
20752
+ dryRun: true,
20753
+ objects: { scanned: res.scanned, matched: res.matched, ambiguous: res.ambiguous, unmatchedLocal: res.unmatchedLocal, unmatchedRemote: res.unmatchedRemote.length },
20754
+ characters: characters && {
20755
+ scanned: characters.scanned,
20756
+ matched: characters.matched,
20757
+ wouldWrite: characters.written,
20758
+ differing: characters.differing,
20759
+ unmatched: characters.unmatched,
20760
+ remaining: characters.remaining.map((c) => c.id)
20761
+ }
20762
+ }, null, 2));
20763
+ }
20764
+ return;
20765
+ }
20627
20766
  if (args.tag) {
20628
- const n = await tagAdopted(provider, specs, lock, { onProgress: log });
20629
- log(`
20767
+ const n = await tagAdopted(provider, specs, lock, { onProgress: log2 });
20768
+ log2(`
20630
20769
  tagged ${n} object(s) upstream`);
20631
20770
  }
20632
20771
  if (args.writePrompts) {
20633
20772
  const { filled, stillEmpty } = await writePromptsBack(path30.resolve(args.manifest), lock, {
20634
- onProgress: log,
20773
+ onProgress: log2,
20635
20774
  provider: provider.id,
20636
20775
  assetIds: specs.map((spec) => spec.assetId)
20637
20776
  });
20638
- log(` recovered ${filled} prompt(s) into ${path30.relative(process.cwd(), args.manifest)}`);
20777
+ log2(` recovered ${filled} prompt(s) into ${path30.relative(process.cwd(), args.manifest)}`);
20639
20778
  const reloaded = await loadManifest(args.manifest);
20640
20779
  const rebased = (await resolveSpecs(reloaded, {
20641
20780
  styles: args.styles,
@@ -20649,14 +20788,14 @@ async function runAdopt(args) {
20649
20788
  n++;
20650
20789
  }
20651
20790
  await saveLock(args.lock, lock);
20652
- log(` re-baselined ${n} entr(ies) against the recovered prompts`);
20791
+ log2(` re-baselined ${n} entr(ies) against the recovered prompts`);
20653
20792
  if (stillEmpty.length) {
20654
- log(` ${stillEmpty.length} asset(s) still have no prompt (not matched upstream):`);
20655
- for (const id of stillEmpty.slice(0, 10)) log(` ${id}`);
20656
- if (stillEmpty.length > 10) log(` \u2026 and ${stillEmpty.length - 10} more`);
20793
+ log2(` ${stillEmpty.length} asset(s) still have no prompt (not matched upstream):`);
20794
+ for (const id of stillEmpty.slice(0, 10)) log2(` ${id}`);
20795
+ if (stillEmpty.length > 10) log2(` \u2026 and ${stillEmpty.length - 10} more`);
20657
20796
  }
20658
20797
  }
20659
- log(`
20798
+ log2(`
20660
20799
  lockfile written: ${args.lock}`);
20661
20800
  }
20662
20801
  async function runSalvage2(args) {
@@ -20801,6 +20940,7 @@ async function runSalvage2(args) {
20801
20940
  const adopted = await adoptCharacters(provider, await resolve(), lock, args.lock, { onProgress: log, resolve });
20802
20941
  log(` adopted ${adopted.matched} of ${assetIds.length} imported character asset(s)`);
20803
20942
  for (const line of adopted.unmatched) log(` not adopted: ${line}`);
20943
+ for (const line of adopted.engineMismatches) log(` check mode: ${line}`);
20804
20944
  };
20805
20945
  const runOne = async (styleId, list) => {
20806
20946
  const style = accountManifest.styles[styleId];
@@ -20979,7 +21119,8 @@ var NewAnimationSchema = z7.object({
20979
21119
  /** A PixelLab template id (`character` only; `objectPro` has no template concept). */
20980
21120
  template: z7.string().min(1).optional(),
20981
21121
  direction: CharacterDirectionSchema.optional(),
20982
- frames: z7.number().int().min(4).max(16).optional(),
21122
+ /** 4 to 16; a pixminimax loop takes a multiple of 4 up to 40. The manifest's own schema checks the rest. */
21123
+ frames: z7.number().int().min(4).max(40).optional(),
20983
21124
  fps: z7.number().int().min(1).max(60).optional(),
20984
21125
  /** One loop per named direction, plus free mirrors; expanded when the manifest loads. */
20985
21126
  directions: z7.array(CharacterDirectionSchema).min(1).optional(),
@@ -22301,7 +22442,7 @@ import { z as z10 } from "zod";
22301
22442
  // src/pipeline/model-edit.ts
22302
22443
  import { spawn as spawn2 } from "child_process";
22303
22444
  import { existsSync as existsSync26, readdirSync } from "fs";
22304
- import { mkdir as mkdir14, readdir, readFile as readFile22, rename as rename11, rm as rm9, writeFile as writeFile16 } from "fs/promises";
22445
+ import { mkdir as mkdir14, readdir as readdir2, readFile as readFile22, rename as rename11, rm as rm9, writeFile as writeFile16 } from "fs/promises";
22305
22446
  import path34 from "path";
22306
22447
  import { z as z9 } from "zod";
22307
22448
 
@@ -22691,7 +22832,7 @@ async function discoverModels(loaded, opts = {}) {
22691
22832
  if (depth > MAX_DEPTH || models.length >= MAX_MODELS) return;
22692
22833
  let entries;
22693
22834
  try {
22694
- entries = await readdir(dir, { withFileTypes: true });
22835
+ entries = await readdir2(dir, { withFileTypes: true });
22695
22836
  } catch {
22696
22837
  return;
22697
22838
  }
@@ -23079,7 +23220,7 @@ async function exportModelTexture(model, ref, opts) {
23079
23220
  // src/pipeline/model-normals.ts
23080
23221
  import { createHash as createHash4 } from "crypto";
23081
23222
  import { existsSync as existsSync27 } from "fs";
23082
- import { mkdir as mkdir15, readdir as readdir2, readFile as readFile23, writeFile as writeFile17 } from "fs/promises";
23223
+ import { mkdir as mkdir15, readdir as readdir3, readFile as readFile23, writeFile as writeFile17 } from "fs/promises";
23083
23224
  import path35 from "path";
23084
23225
  var MODEL_NORMAL_SOURCES = ["texture", "views", "sprites"];
23085
23226
  var TILE_MAX = 512;
@@ -23817,7 +23958,7 @@ function modelSpritesDir(modelFile) {
23817
23958
  }
23818
23959
  async function readSpriteFolder(dir) {
23819
23960
  const folder = existsSync27(path35.join(dir, "rotations")) ? path35.join(dir, "rotations") : dir;
23820
- const names = (await readdir2(folder)).filter((name) => name.toLowerCase().endsWith(".png") && VIEW_TURNS[name.slice(0, -4).toLowerCase()] !== void 0).sort();
23961
+ const names = (await readdir3(folder)).filter((name) => name.toLowerCase().endsWith(".png") && VIEW_TURNS[name.slice(0, -4).toLowerCase()] !== void 0).sort();
23821
23962
  return Promise.all(names.map(async (name) => ({ direction: name.slice(0, -4).toLowerCase(), png: await readFile23(path35.join(folder, name)), file: path35.join(folder, name) })));
23822
23963
  }
23823
23964
  function modelNormalDir(editFile) {
@@ -26810,7 +26951,7 @@ import { existsSync as existsSync37 } from "fs";
26810
26951
  import { readFile as readFile33 } from "fs/promises";
26811
26952
 
26812
26953
  // src/pipeline/init.ts
26813
- import { readdir as readdir3, readFile as readFile32, writeFile as writeFile23 } from "fs/promises";
26954
+ import { readdir as readdir4, readFile as readFile32, writeFile as writeFile23 } from "fs/promises";
26814
26955
  import { existsSync as existsSync36 } from "fs";
26815
26956
  import path44 from "path";
26816
26957
  function pngSize(buf) {
@@ -26825,7 +26966,7 @@ function slugify(value) {
26825
26966
  }
26826
26967
  async function walk(dir, exclude) {
26827
26968
  const out = [];
26828
- for (const entry of await readdir3(dir, { withFileTypes: true })) {
26969
+ for (const entry of await readdir4(dir, { withFileTypes: true })) {
26829
26970
  const full = path44.join(dir, entry.name);
26830
26971
  if (exclude.some((x) => full.includes(x))) continue;
26831
26972
  if (entry.isDirectory()) out.push(...await walk(full, exclude));
@@ -29399,7 +29540,7 @@ import { existsSync as existsSync41 } from "fs";
29399
29540
 
29400
29541
  // src/pipeline/cache-health.ts
29401
29542
  import { existsSync as existsSync40 } from "fs";
29402
- import { readFile as readFile36, readdir as readdir4, rm as rm14 } from "fs/promises";
29543
+ import { readFile as readFile36, readdir as readdir5, rm as rm14 } from "fs/promises";
29403
29544
  import path48 from "path";
29404
29545
  async function inspectCaches(lock, lockPath, options = {}) {
29405
29546
  if (options.prune && !existsSync40(lockPath)) {
@@ -29459,7 +29600,7 @@ async function inspectContentCache(contentDir, referenced) {
29459
29600
  return report;
29460
29601
  }
29461
29602
  const present = /* @__PURE__ */ new Set();
29462
- const entries = await readdir4(contentDir, { withFileTypes: true });
29603
+ const entries = await readdir5(contentDir, { withFileTypes: true });
29463
29604
  for (const entry of entries) {
29464
29605
  if (!entry.isFile()) {
29465
29606
  report.invalid.push({ name: entry.name, reason: "not a regular file" });
@@ -33860,7 +34001,7 @@ import path64 from "path";
33860
34001
 
33861
34002
  // src/pixellab-assets.ts
33862
34003
  import { existsSync as existsSync51 } from "fs";
33863
- import { mkdir as mkdir23, readdir as readdir5, readFile as readFile43, stat as stat6, writeFile as writeFile28 } from "fs/promises";
34004
+ import { mkdir as mkdir23, readdir as readdir6, readFile as readFile43, stat as stat6, writeFile as writeFile28 } from "fs/promises";
33864
34005
  import path63 from "path";
33865
34006
  var ASSET_KINDS = ["object", "character"];
33866
34007
  var EXPORT_FORMATS = ["zip", "spritesheet", "aseprite", "gif"];
@@ -34010,7 +34151,7 @@ async function importTilesetFile(client2, file, opts = {}) {
34010
34151
  async function pngFilesAt(from) {
34011
34152
  if (!existsSync51(from)) throw new Error(`${from} does not exist`);
34012
34153
  if (!(await stat6(from)).isDirectory()) return [from];
34013
- const names = (await readdir5(from)).filter((name) => /\.png$/i.test(name)).sort((a, b) => a.localeCompare(b, void 0, { numeric: true }));
34154
+ const names = (await readdir6(from)).filter((name) => /\.png$/i.test(name)).sort((a, b) => a.localeCompare(b, void 0, { numeric: true }));
34014
34155
  if (names.length === 0) throw new Error(`${from} holds no PNG files`);
34015
34156
  return names.map((name) => path63.join(from, name));
34016
34157
  }
@@ -35227,7 +35368,7 @@ import path70 from "path";
35227
35368
  // src/recipes.ts
35228
35369
  import path69 from "path";
35229
35370
  import { existsSync as existsSync55 } from "fs";
35230
- import { readdir as readdir6, readFile as readFile49 } from "fs/promises";
35371
+ import { readdir as readdir7, readFile as readFile49 } from "fs/promises";
35231
35372
  import { fileURLToPath as fileURLToPath2 } from "url";
35232
35373
  import { z as z18 } from "zod";
35233
35374
  var SHA256_RE2 = /^[0-9a-f]{64}$/;
@@ -35452,7 +35593,7 @@ async function readRecipeFile(recipePath, bundled) {
35452
35593
  async function walkRecipeFiles(root) {
35453
35594
  if (!existsSync55(root)) return [];
35454
35595
  const out = [];
35455
- for (const entry of await readdir6(root, { withFileTypes: true })) {
35596
+ for (const entry of await readdir7(root, { withFileTypes: true })) {
35456
35597
  const resolved = path69.join(root, entry.name);
35457
35598
  if (entry.isDirectory()) out.push(...await walkRecipeFiles(resolved));
35458
35599
  else if (entry.isFile() && entry.name === RECIPE_FILE) out.push(resolved);