pixelkiln 0.146.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/README.md +4 -4
- package/dist/cli.js +246 -101
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +144 -50
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +293 -194
- package/dist/index.d.ts +293 -194
- package/dist/index.js +151 -57
- package/dist/index.js.map +1 -1
- package/docs/CHARACTERS.md +55 -0
- package/docs/CLI.md +25 -3
- package/docs/ENDPOINTS.md +14 -3
- package/docs/GENERATORS.md +1 -1
- package/docs/GETTING_STARTED.md +5 -0
- package/docs/MANIFEST.md +2 -2
- package/package.json +1 -1
- package/schema/manifest.schema.json +7 -1
- package/skills/pixelkiln/SKILL.md +4 -0
- package/skills/pixelkiln/references/pixellab.md +18 -4
package/dist/cli.js
CHANGED
|
@@ -181,6 +181,7 @@ var BOOL_FLAGS = [
|
|
|
181
181
|
"--force",
|
|
182
182
|
"--yes",
|
|
183
183
|
"-y",
|
|
184
|
+
"--accept-first",
|
|
184
185
|
"--dry-run",
|
|
185
186
|
"--all",
|
|
186
187
|
"--json",
|
|
@@ -552,6 +553,7 @@ function parseArgs(argv) {
|
|
|
552
553
|
force: rest.includes("--force"),
|
|
553
554
|
mergeConnected: rest.includes("--merge-connected"),
|
|
554
555
|
yes: rest.includes("--yes") || rest.includes("-y"),
|
|
556
|
+
acceptFirst: rest.includes("--accept-first"),
|
|
555
557
|
budget,
|
|
556
558
|
providerBudgets,
|
|
557
559
|
dryRun: rest.includes("--dry-run"),
|
|
@@ -935,6 +937,7 @@ Options
|
|
|
935
937
|
--check plan/audit/cache: exit nonzero when the selected state is unsafe
|
|
936
938
|
--yes, -y Skip the confirmation prompt; gen also accepts assets with a single
|
|
937
939
|
candidate or one frame set (2+ candidates still open the pick page)
|
|
940
|
+
--accept-first gen/pick: take every asset's first candidate, open no pick page
|
|
938
941
|
--no-open Do not auto-open the browser (pick, salvage, gallery) or editor (edit)
|
|
939
942
|
--edit gallery: allow manifest edits from the page (never spends)
|
|
940
943
|
--no-editor gallery: do not offer or serve the in-browser editor
|
|
@@ -1850,14 +1853,13 @@ function proTierCost(width, height) {
|
|
|
1850
1853
|
if (px <= 102400) return PRO_TIER_PRICES[1];
|
|
1851
1854
|
return PRO_TIER_PRICES[2];
|
|
1852
1855
|
}
|
|
1856
|
+
var PIXMINIMAX_STEPS = [1, 1, 2, 2, 3, 3, 4, 5, 5, 6];
|
|
1853
1857
|
function pixMiniMaxCost(width, height, frames, enhancePrompt = false) {
|
|
1854
|
-
const
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
else units = 6 + (f - 40) / 6;
|
|
1860
|
-
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];
|
|
1861
1863
|
return enhancePrompt ? base + 0.05 : base;
|
|
1862
1864
|
}
|
|
1863
1865
|
function tilesCost(tileSize, variations) {
|
|
@@ -1952,7 +1954,7 @@ var CharacterProportionsSchema = z.union([
|
|
|
1952
1954
|
hipWidth: z.number().min(0.5).max(2).optional()
|
|
1953
1955
|
}).strict()
|
|
1954
1956
|
]);
|
|
1955
|
-
var CharacterAnimationModeSchema = z.enum(["template", "skeleton-v3", "v3", "pro"]);
|
|
1957
|
+
var CharacterAnimationModeSchema = z.enum(["template", "skeleton-v3", "v3", "pixminimax", "pro"]);
|
|
1956
1958
|
var UiPieceSchema = z.discriminatedUnion("kind", [
|
|
1957
1959
|
z.object({
|
|
1958
1960
|
id: z.string().min(1),
|
|
@@ -2276,12 +2278,13 @@ var CharacterAnimationSchema = z.object({
|
|
|
2276
2278
|
motionFrom: z.string().min(1).optional(),
|
|
2277
2279
|
/**
|
|
2278
2280
|
* Frames to generate without a template. A v3 loop takes an even 4 to 16;
|
|
2279
|
-
* a
|
|
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.
|
|
2280
2283
|
*/
|
|
2281
|
-
frames: z.number().int().min(3).max(
|
|
2284
|
+
frames: z.number().int().min(3).max(40).optional(),
|
|
2282
2285
|
/** Playback rate recorded with the frames; PixelLab does not store one. */
|
|
2283
2286
|
fps: z.number().int().min(1).max(60).default(8),
|
|
2284
|
-
/** v3
|
|
2287
|
+
/** v3 and pixminimax: keep the resting pose as frame 0, so `frames` generated frames land as `frames + 1` files. */
|
|
2285
2288
|
keepFirstFrame: z.boolean().default(true),
|
|
2286
2289
|
/**
|
|
2287
2290
|
* `character` loops: strip the ghost pixels an animation model leaves
|
|
@@ -2295,28 +2298,41 @@ var CharacterAnimationSchema = z.object({
|
|
|
2295
2298
|
* `template` when a template is named, otherwise `v3`; `skeleton-v3`
|
|
2296
2299
|
* poses a template with PixelLab's skeleton model instead, or, with no
|
|
2297
2300
|
* template, animates the asset's prompt as a sentence written into one 3D
|
|
2298
|
-
* motion (a v3 base; 3-15 `frames`); `
|
|
2299
|
-
*
|
|
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.
|
|
2300
2304
|
*/
|
|
2301
2305
|
mode: CharacterAnimationModeSchema.optional(),
|
|
2302
2306
|
/**
|
|
2303
|
-
* v3
|
|
2304
|
-
* 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.
|
|
2305
2309
|
*/
|
|
2306
2310
|
startFrame: z.string().min(1).optional(),
|
|
2307
2311
|
/**
|
|
2308
|
-
* v3
|
|
2309
|
-
* start frame (the rotation, or `startFrame`) to this image,
|
|
2310
|
-
* 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.
|
|
2311
2316
|
*/
|
|
2312
2317
|
endFrame: z.string().min(1).optional(),
|
|
2313
|
-
/**
|
|
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
|
+
*/
|
|
2314
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(),
|
|
2315
2331
|
/** Template mode only: style hints for this loop, over the character's own. */
|
|
2316
2332
|
outline: z.string().min(1).optional(),
|
|
2317
2333
|
shading: z.string().min(1).optional(),
|
|
2318
2334
|
detail: z.string().min(1).optional(),
|
|
2319
|
-
/** 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. */
|
|
2320
2336
|
enhancePrompt: z.boolean().optional()
|
|
2321
2337
|
}).strict().superRefine((animation, context) => {
|
|
2322
2338
|
if (animation.directions !== void 0) {
|
|
@@ -2327,22 +2343,29 @@ var CharacterAnimationSchema = z.object({
|
|
|
2327
2343
|
});
|
|
2328
2344
|
}
|
|
2329
2345
|
const sentence = animation.mode === "skeleton-v3" && !animation.template;
|
|
2330
|
-
|
|
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") {
|
|
2331
2352
|
if (animation.frames % 2 !== 0) {
|
|
2332
2353
|
context.addIssue({ code: z.ZodIssueCode.custom, message: "frames must be even", path: ["frames"] });
|
|
2333
|
-
} else if (animation.frames < 4) {
|
|
2334
|
-
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"] });
|
|
2335
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"] });
|
|
2336
2359
|
}
|
|
2337
2360
|
if (animation.frames !== void 0 && sentence && animation.frames > 15) {
|
|
2338
2361
|
context.addIssue({ code: z.ZodIssueCode.custom, message: "a skeleton-v3 loop from a sentence takes 3 to 15 frames", path: ["frames"] });
|
|
2339
2362
|
}
|
|
2340
2363
|
const mode2 = animation.mode ?? (animation.template ? "template" : "v3");
|
|
2341
2364
|
for (const key3 of ["startFrame", "endFrame", "enhancePrompt"]) {
|
|
2342
|
-
if (animation[key3] !== void 0 && mode2 !== "v3") {
|
|
2365
|
+
if (animation[key3] !== void 0 && mode2 !== "v3" && mode2 !== "pixminimax") {
|
|
2343
2366
|
context.addIssue({
|
|
2344
2367
|
code: z.ZodIssueCode.custom,
|
|
2345
|
-
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"}`,
|
|
2346
2369
|
path: [key3]
|
|
2347
2370
|
});
|
|
2348
2371
|
}
|
|
@@ -2352,6 +2375,12 @@ var CharacterAnimationSchema = z.object({
|
|
|
2352
2375
|
context.addIssue({ code: z.ZodIssueCode.custom, message: `${key3} overrides apply to template loops only`, path: [key3] });
|
|
2353
2376
|
}
|
|
2354
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
|
+
}
|
|
2355
2384
|
if (animation.template && animation.mode && animation.mode !== "template" && animation.mode !== "skeleton-v3") {
|
|
2356
2385
|
context.addIssue({
|
|
2357
2386
|
code: z.ZodIssueCode.custom,
|
|
@@ -10075,8 +10104,11 @@ var PixelLabClient = class {
|
|
|
10075
10104
|
* One animation of one character. Template mode costs a generation per
|
|
10076
10105
|
* direction and fixes the frame count; skeleton-v3 poses the same template
|
|
10077
10106
|
* with the skeleton video model (2-4 generations per direction); v3 draws
|
|
10078
|
-
* `frameCount` frames from the action text;
|
|
10079
|
-
*
|
|
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.
|
|
10080
10112
|
*
|
|
10081
10113
|
* Every mode but skeleton-v3 goes to `/animate-character`, the path whose
|
|
10082
10114
|
* shapes were measured live. skeleton-v3 is documented only on
|
|
@@ -10092,6 +10124,7 @@ var PixelLabClient = class {
|
|
|
10092
10124
|
async animateCharacter(args) {
|
|
10093
10125
|
const encode = (image) => ({ type: "base64", base64: image.base64, format: image.format });
|
|
10094
10126
|
const endpoint = args.mode === "skeleton-v3" ? "/characters/animations" : "/animate-character";
|
|
10127
|
+
const custom = args.mode === "v3" || args.mode === "pixminimax";
|
|
10095
10128
|
const raw = await this.request(endpoint, {
|
|
10096
10129
|
method: "POST",
|
|
10097
10130
|
body: JSON.stringify({
|
|
@@ -10103,12 +10136,14 @@ var PixelLabClient = class {
|
|
|
10103
10136
|
...args.template ? { template_animation_id: args.template } : {},
|
|
10104
10137
|
...args.actionDescription ? { action_description: args.actionDescription } : {},
|
|
10105
10138
|
...args.description ? { description: args.description } : {},
|
|
10106
|
-
// A template fixes its own frame count; v3 and a skeleton-v3 sentence take one.
|
|
10107
|
-
...(
|
|
10108
|
-
...
|
|
10109
|
-
...
|
|
10110
|
-
...
|
|
10111
|
-
...
|
|
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 } : {},
|
|
10112
10147
|
...args.mode === "template" && args.textGuidanceScale !== void 0 ? { text_guidance_scale: args.textGuidanceScale } : {},
|
|
10113
10148
|
...args.mode === "template" && args.outline ? { outline: args.outline } : {},
|
|
10114
10149
|
...args.mode === "template" && args.shading ? { shading: args.shading } : {},
|
|
@@ -12262,6 +12297,13 @@ function characterCost(spec) {
|
|
|
12262
12297
|
if (animation.mode === "template") return 1;
|
|
12263
12298
|
if (animation.mode === "skeleton-v3") return 4;
|
|
12264
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
|
+
}
|
|
12265
12307
|
return proCharacterTierCost(spec.width, spec.height);
|
|
12266
12308
|
}
|
|
12267
12309
|
if (character.kind === "state" || character.kind === "portrait") return proCharacterTierCost(spec.width, spec.height);
|
|
@@ -13062,7 +13104,7 @@ var PixelLabProvider = class _PixelLabProvider {
|
|
|
13062
13104
|
const { startFrame, endFrame } = character.animation;
|
|
13063
13105
|
for (const [name, image] of [["start frame", startFrame], ["end frame", endFrame]]) {
|
|
13064
13106
|
if (image && (image.width > 256 || image.height > 256)) {
|
|
13065
|
-
throw new Error(`${label}: ${name} is ${image.width}x${image.height}; PixelLab
|
|
13107
|
+
throw new Error(`${label}: ${name} is ${image.width}x${image.height}; PixelLab ${character.animation.mode} takes up to 256px`);
|
|
13066
13108
|
}
|
|
13067
13109
|
}
|
|
13068
13110
|
if (endFrame) {
|
|
@@ -13177,6 +13219,9 @@ var PixelLabProvider = class _PixelLabProvider {
|
|
|
13177
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")' : "")
|
|
13178
13220
|
);
|
|
13179
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
|
+
}
|
|
13180
13225
|
if (sentence && (character.animation.frames < 3 || character.animation.frames > 15)) {
|
|
13181
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`);
|
|
13182
13227
|
}
|
|
@@ -13488,7 +13533,9 @@ var PixelLabProvider = class _PixelLabProvider {
|
|
|
13488
13533
|
isometric: character.isometric,
|
|
13489
13534
|
startFrame: animation.startFrame ? readPose(spec, "start frame", animation.startFrame) : void 0,
|
|
13490
13535
|
endFrame: animation.endFrame ? readPose(spec, "end frame", animation.endFrame) : void 0,
|
|
13491
|
-
|
|
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 },
|
|
13492
13539
|
outline: animation.outline,
|
|
13493
13540
|
shading: animation.shading,
|
|
13494
13541
|
detail: animation.detail,
|
|
@@ -18135,6 +18182,8 @@ async function resolveCharacterShape(asset, style, kind, files) {
|
|
|
18135
18182
|
...asset.animation.startFrame ? { startFrame: await pose(asset.animation.startFrame, "Animation start frame") } : {},
|
|
18136
18183
|
...asset.animation.endFrame ? { endFrame: await pose(asset.animation.endFrame, "Animation end frame") } : {},
|
|
18137
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 } : {},
|
|
18138
18187
|
...asset.animation.outline ? { outline: asset.animation.outline } : {},
|
|
18139
18188
|
...asset.animation.shading ? { shading: asset.animation.shading } : {},
|
|
18140
18189
|
...asset.animation.detail ? { detail: asset.animation.detail } : {},
|
|
@@ -18173,6 +18222,7 @@ async function resolveObjectProShape(assetId, asset, style, kind, files) {
|
|
|
18173
18222
|
for (const [field, value] of Object.entries({
|
|
18174
18223
|
template: asset.animation.template,
|
|
18175
18224
|
subject: asset.animation.subject,
|
|
18225
|
+
initialPose: asset.animation.initialPose,
|
|
18176
18226
|
outline: asset.animation.outline,
|
|
18177
18227
|
shading: asset.animation.shading,
|
|
18178
18228
|
detail: asset.animation.detail
|
|
@@ -18186,7 +18236,7 @@ async function resolveObjectProShape(assetId, asset, style, kind, files) {
|
|
|
18186
18236
|
if (asset.animation.clean !== void 0) {
|
|
18187
18237
|
throw new Error(`assets.${assetId}: animation.clean applies to character loops; objectPro loops are not cleaned`);
|
|
18188
18238
|
}
|
|
18189
|
-
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") {
|
|
18190
18240
|
throw new Error(`assets.${assetId}: objectPro animations have no "${asset.animation.mode}" mode; use "v3" or "pro"`);
|
|
18191
18241
|
}
|
|
18192
18242
|
const pose = async (rel, what) => {
|
|
@@ -18546,7 +18596,7 @@ async function pushTags(provider, specs, lock, opts = {}) {
|
|
|
18546
18596
|
|
|
18547
18597
|
// src/pipeline/import.ts
|
|
18548
18598
|
import { existsSync as existsSync17 } from "fs";
|
|
18549
|
-
import { readFile as readFile12 } from "fs/promises";
|
|
18599
|
+
import { readdir, readFile as readFile12 } from "fs/promises";
|
|
18550
18600
|
import path22 from "path";
|
|
18551
18601
|
|
|
18552
18602
|
// src/pipeline/history.ts
|
|
@@ -18709,8 +18759,9 @@ async function revertGeneration(provider, spec, lock, lockPath, opts) {
|
|
|
18709
18759
|
}
|
|
18710
18760
|
|
|
18711
18761
|
// src/pipeline/import.ts
|
|
18712
|
-
function buildImportedEntry(spec, bytes, opts = {}, now = /* @__PURE__ */ new Date()) {
|
|
18762
|
+
function buildImportedEntry(spec, bytes, opts = {}, now = /* @__PURE__ */ new Date(), frames) {
|
|
18713
18763
|
const png = decodePng(bytes);
|
|
18764
|
+
for (const frame of frames ?? []) decodePng(frame.bytes);
|
|
18714
18765
|
const at2 = now.toISOString();
|
|
18715
18766
|
const origin = {
|
|
18716
18767
|
...opts.tool ? { tool: opts.tool } : {},
|
|
@@ -18735,7 +18786,14 @@ function buildImportedEntry(spec, bytes, opts = {}, now = /* @__PURE__ */ new Da
|
|
|
18735
18786
|
error: null,
|
|
18736
18787
|
sourceUrl: null,
|
|
18737
18788
|
sourceUrls: [],
|
|
18738
|
-
|
|
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) }],
|
|
18739
18797
|
submittedAt: null,
|
|
18740
18798
|
downloadedAt: at2,
|
|
18741
18799
|
cost: opts.cost ?? 0,
|
|
@@ -18750,6 +18808,32 @@ function buildImportedEntry(spec, bytes, opts = {}, now = /* @__PURE__ */ new Da
|
|
|
18750
18808
|
}
|
|
18751
18809
|
};
|
|
18752
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
|
+
}
|
|
18753
18837
|
function unimportable(spec) {
|
|
18754
18838
|
if (spec.character) return "a character is several files; import it with account adopt";
|
|
18755
18839
|
if (spec.vfx) return "an effect is rendered from its recipe, not imported";
|
|
@@ -18782,9 +18866,18 @@ async function importLocal(specs, lock, lockPath, opts = {}) {
|
|
|
18782
18866
|
skipped.push({ key: key3, reason });
|
|
18783
18867
|
continue;
|
|
18784
18868
|
}
|
|
18869
|
+
let frameFiles;
|
|
18785
18870
|
if (!existsSync17(spec.outFile)) {
|
|
18786
|
-
|
|
18787
|
-
|
|
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;
|
|
18788
18881
|
}
|
|
18789
18882
|
if (lock.entries[key3] && !opts.force) {
|
|
18790
18883
|
skipped.push({ key: key3, reason: "already in the lockfile (use --force to replace it)" });
|
|
@@ -18792,9 +18885,11 @@ async function importLocal(specs, lock, lockPath, opts = {}) {
|
|
|
18792
18885
|
}
|
|
18793
18886
|
let patch;
|
|
18794
18887
|
let bytes;
|
|
18888
|
+
let frames;
|
|
18795
18889
|
try {
|
|
18796
|
-
|
|
18797
|
-
|
|
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);
|
|
18798
18893
|
} catch (error) {
|
|
18799
18894
|
skipped.push({ key: key3, reason: `invalid PNG: ${error instanceof Error ? error.message : String(error)}` });
|
|
18800
18895
|
continue;
|
|
@@ -18804,9 +18899,10 @@ async function importLocal(specs, lock, lockPath, opts = {}) {
|
|
|
18804
18899
|
continue;
|
|
18805
18900
|
}
|
|
18806
18901
|
const existing = lock.entries[key3];
|
|
18807
|
-
const
|
|
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());
|
|
18808
18904
|
if (cacheDir) {
|
|
18809
|
-
await cacheMedia(cacheDir, bytes, MediaType.PNG);
|
|
18905
|
+
for (const member of frames ?? [{ bytes }]) await cacheMedia(cacheDir, member.bytes, MediaType.PNG);
|
|
18810
18906
|
if (rawBytes) await cacheMedia(cacheDir, rawBytes, MediaType.PNG);
|
|
18811
18907
|
}
|
|
18812
18908
|
imported.push({ key: key3, entry: upsert(lock, key3, {
|
|
@@ -19018,12 +19114,12 @@ async function adopt(provider, specs, lock, lockPath, opts = {}) {
|
|
|
19018
19114
|
provider: provider.id
|
|
19019
19115
|
});
|
|
19020
19116
|
matched++;
|
|
19021
|
-
log2(` adopted ${key3} \u2190 ${obj.id}`);
|
|
19117
|
+
log2(` ${opts.dryRun ? "would adopt" : "adopted"} ${key3} \u2190 ${obj.id}`);
|
|
19022
19118
|
}
|
|
19023
19119
|
}
|
|
19024
19120
|
}
|
|
19025
19121
|
await Promise.all(Array.from({ length: Math.min(concurrency, remote.length || 1) }, worker));
|
|
19026
|
-
await saveLock(lockPath, lock);
|
|
19122
|
+
if (!opts.dryRun) await saveLock(lockPath, lock);
|
|
19027
19123
|
if (!opts.noCache) {
|
|
19028
19124
|
pruneCache(cache, new Set(remote.map((o) => o.id)));
|
|
19029
19125
|
await saveCache(cachePath, cache);
|
|
@@ -19098,7 +19194,7 @@ import path24 from "path";
|
|
|
19098
19194
|
async function adoptCharacters(provider, specs, lock, lockPath, opts) {
|
|
19099
19195
|
const log2 = opts.onProgress ?? (() => {
|
|
19100
19196
|
});
|
|
19101
|
-
const result = { scanned: 0, matched: 0, unmatched: [], remaining: [], written: [], differing: [] };
|
|
19197
|
+
const result = { scanned: 0, matched: 0, unmatched: [], remaining: [], written: [], differing: [], engineMismatches: [] };
|
|
19102
19198
|
if (!provider.listCharacters || !provider.getCharacter) return result;
|
|
19103
19199
|
const wanted = specs.filter((spec) => spec.character && !spec.mirror);
|
|
19104
19200
|
if (!wanted.length) return result;
|
|
@@ -19147,6 +19243,8 @@ async function adoptCharacters(provider, specs, lock, lockPath, opts) {
|
|
|
19147
19243
|
const file = expectedOutputPath(spec, source.role, index, sources.length);
|
|
19148
19244
|
if (existsSync20(file)) {
|
|
19149
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));
|
|
19150
19248
|
} else {
|
|
19151
19249
|
await mkdir10(path24.dirname(file), { recursive: true });
|
|
19152
19250
|
await writeFile11(file, bytes);
|
|
@@ -19176,7 +19274,7 @@ async function adoptCharacters(provider, specs, lock, lockPath, opts) {
|
|
|
19176
19274
|
result.unmatched.push(`${key3}: ${err instanceof Error ? err.message : String(err)}`);
|
|
19177
19275
|
}
|
|
19178
19276
|
}
|
|
19179
|
-
if (adoptedThisWave) {
|
|
19277
|
+
if (adoptedThisWave && !opts.dryRun) {
|
|
19180
19278
|
await saveLock(lockPath, lock);
|
|
19181
19279
|
current = await opts.resolve();
|
|
19182
19280
|
}
|
|
@@ -19247,7 +19345,7 @@ async function adoptCharacters(provider, specs, lock, lockPath, opts) {
|
|
|
19247
19345
|
});
|
|
19248
19346
|
claimed.add(full.id);
|
|
19249
19347
|
result.matched++;
|
|
19250
|
-
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})` : ""}`);
|
|
19251
19349
|
return true;
|
|
19252
19350
|
}
|
|
19253
19351
|
async function adoptAnimation(spec, key3) {
|
|
@@ -19289,6 +19387,13 @@ async function adoptCharacters(provider, specs, lock, lockPath, opts) {
|
|
|
19289
19387
|
}
|
|
19290
19388
|
}
|
|
19291
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
|
+
}
|
|
19292
19397
|
const sources = match.frames.map((url, index) => ({ url, role: `frame-${String(index).padStart(2, "0")}` }));
|
|
19293
19398
|
const outputs = await materialize(spec, sources);
|
|
19294
19399
|
const durable = sources.filter((source) => shouldPersistSourceUrl(source.url));
|
|
@@ -19320,6 +19425,10 @@ async function adoptCharacters(provider, specs, lock, lockPath, opts) {
|
|
|
19320
19425
|
animationGroupId: match.groupId,
|
|
19321
19426
|
animationName: match.name,
|
|
19322
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,
|
|
19323
19432
|
adopted: true
|
|
19324
19433
|
}
|
|
19325
19434
|
}
|
|
@@ -19331,10 +19440,10 @@ async function adoptCharacters(provider, specs, lock, lockPath, opts) {
|
|
|
19331
19440
|
provider: provider.id
|
|
19332
19441
|
});
|
|
19333
19442
|
result.matched++;
|
|
19334
|
-
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}`);
|
|
19335
19444
|
return true;
|
|
19336
19445
|
}
|
|
19337
|
-
await saveLock(lockPath, lock);
|
|
19446
|
+
if (!opts.dryRun) await saveLock(lockPath, lock);
|
|
19338
19447
|
if (!opts.noCache) {
|
|
19339
19448
|
pruneCache(cache, new Set(remote.map((character) => character.id)), "character:");
|
|
19340
19449
|
await saveCache(cachePath, cache);
|
|
@@ -20568,52 +20677,63 @@ async function runAdopt(args) {
|
|
|
20568
20677
|
const { loaded, specs, lock, accountProvider } = await openAccountProject(args);
|
|
20569
20678
|
const providerFor = providerCache("online");
|
|
20570
20679
|
const provider = providerFor(accountProvider);
|
|
20571
|
-
|
|
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(`
|
|
20572
20684
|
Reconciling account objects against files already on disk\u2026`);
|
|
20573
|
-
const res = await adopt(provider, specs.filter((spec) => spec.generator !== "character"), lock, args.lock, { onProgress:
|
|
20574
|
-
|
|
20575
|
-
scanned ${res.scanned} remote object(s),
|
|
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;
|
|
20576
20689
|
if (specs.some((spec) => spec.character) && provider.listCharacters) {
|
|
20577
|
-
|
|
20690
|
+
log2(`
|
|
20578
20691
|
Reconciling account characters against the manifest's character assets\u2026`);
|
|
20579
|
-
|
|
20580
|
-
onProgress:
|
|
20692
|
+
characters = await adoptCharacters(provider, specs, lock, args.lock, {
|
|
20693
|
+
onProgress: log2,
|
|
20694
|
+
dryRun,
|
|
20581
20695
|
resolve: async () => (await resolveSpecs(loaded, { styles: args.styles, assets: args.assets })).filter((spec) => spec.provider === accountProvider)
|
|
20582
20696
|
});
|
|
20583
|
-
|
|
20584
|
-
scanned ${characters.scanned} character(s),
|
|
20585
|
-
if (characters.written.length)
|
|
20586
|
-
for (const file of characters.
|
|
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
|
+
}
|
|
20587
20707
|
if (characters.unmatched.length) {
|
|
20588
|
-
|
|
20708
|
+
log2(`
|
|
20589
20709
|
character assets not matched (${characters.unmatched.length}):`);
|
|
20590
|
-
for (const line of characters.unmatched.slice(0, 15))
|
|
20710
|
+
for (const line of characters.unmatched.slice(0, 15)) log2(` ${line}`);
|
|
20591
20711
|
}
|
|
20592
20712
|
if (characters.remaining.length) {
|
|
20593
|
-
|
|
20713
|
+
log2(`
|
|
20594
20714
|
characters on the account no entry claims (${characters.remaining.length}):`);
|
|
20595
20715
|
for (const c of characters.remaining.slice(0, 15)) {
|
|
20596
|
-
|
|
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)`);
|
|
20597
20717
|
}
|
|
20598
|
-
if (characters.remaining.length > 15)
|
|
20599
|
-
|
|
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.`);
|
|
20600
20720
|
}
|
|
20601
20721
|
}
|
|
20602
20722
|
if (res.ambiguous.length) {
|
|
20603
|
-
|
|
20723
|
+
log2(`
|
|
20604
20724
|
ambiguous (${res.ambiguous.length}):`);
|
|
20605
|
-
for (const a of res.ambiguous.slice(0, 10))
|
|
20725
|
+
for (const a of res.ambiguous.slice(0, 10)) log2(` ${a}`);
|
|
20606
20726
|
}
|
|
20607
20727
|
if (res.unmatchedLocal.length) {
|
|
20608
|
-
|
|
20728
|
+
log2(`
|
|
20609
20729
|
local files with no matching remote object (${res.unmatchedLocal.length}):`);
|
|
20610
|
-
for (const u of res.unmatchedLocal.slice(0, 15))
|
|
20730
|
+
for (const u of res.unmatchedLocal.slice(0, 15)) log2(` ${u}`);
|
|
20611
20731
|
}
|
|
20612
20732
|
if (res.unmatchedRemote.length) {
|
|
20613
|
-
|
|
20733
|
+
log2(`
|
|
20614
20734
|
remote objects not matched by THIS manifest (${res.unmatchedRemote.length}):`);
|
|
20615
|
-
|
|
20616
|
-
|
|
20735
|
+
log2(formatUnmatchedRemote(res.unmatchedRemote));
|
|
20736
|
+
log2(
|
|
20617
20737
|
`
|
|
20618
20738
|
One account is shared across projects, so this list mixes discarded
|
|
20619
20739
|
candidates with assets belonging to other manifests. Do not bulk-delete
|
|
@@ -20621,18 +20741,40 @@ async function runAdopt(args) {
|
|
|
20621
20741
|
triage what is left over.`
|
|
20622
20742
|
);
|
|
20623
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
|
+
}
|
|
20624
20766
|
if (args.tag) {
|
|
20625
|
-
const n = await tagAdopted(provider, specs, lock, { onProgress:
|
|
20626
|
-
|
|
20767
|
+
const n = await tagAdopted(provider, specs, lock, { onProgress: log2 });
|
|
20768
|
+
log2(`
|
|
20627
20769
|
tagged ${n} object(s) upstream`);
|
|
20628
20770
|
}
|
|
20629
20771
|
if (args.writePrompts) {
|
|
20630
20772
|
const { filled, stillEmpty } = await writePromptsBack(path30.resolve(args.manifest), lock, {
|
|
20631
|
-
onProgress:
|
|
20773
|
+
onProgress: log2,
|
|
20632
20774
|
provider: provider.id,
|
|
20633
20775
|
assetIds: specs.map((spec) => spec.assetId)
|
|
20634
20776
|
});
|
|
20635
|
-
|
|
20777
|
+
log2(` recovered ${filled} prompt(s) into ${path30.relative(process.cwd(), args.manifest)}`);
|
|
20636
20778
|
const reloaded = await loadManifest(args.manifest);
|
|
20637
20779
|
const rebased = (await resolveSpecs(reloaded, {
|
|
20638
20780
|
styles: args.styles,
|
|
@@ -20646,14 +20788,14 @@ async function runAdopt(args) {
|
|
|
20646
20788
|
n++;
|
|
20647
20789
|
}
|
|
20648
20790
|
await saveLock(args.lock, lock);
|
|
20649
|
-
|
|
20791
|
+
log2(` re-baselined ${n} entr(ies) against the recovered prompts`);
|
|
20650
20792
|
if (stillEmpty.length) {
|
|
20651
|
-
|
|
20652
|
-
for (const id of stillEmpty.slice(0, 10))
|
|
20653
|
-
if (stillEmpty.length > 10)
|
|
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`);
|
|
20654
20796
|
}
|
|
20655
20797
|
}
|
|
20656
|
-
|
|
20798
|
+
log2(`
|
|
20657
20799
|
lockfile written: ${args.lock}`);
|
|
20658
20800
|
}
|
|
20659
20801
|
async function runSalvage2(args) {
|
|
@@ -20798,6 +20940,7 @@ async function runSalvage2(args) {
|
|
|
20798
20940
|
const adopted = await adoptCharacters(provider, await resolve(), lock, args.lock, { onProgress: log, resolve });
|
|
20799
20941
|
log(` adopted ${adopted.matched} of ${assetIds.length} imported character asset(s)`);
|
|
20800
20942
|
for (const line of adopted.unmatched) log(` not adopted: ${line}`);
|
|
20943
|
+
for (const line of adopted.engineMismatches) log(` check mode: ${line}`);
|
|
20801
20944
|
};
|
|
20802
20945
|
const runOne = async (styleId, list) => {
|
|
20803
20946
|
const style = accountManifest.styles[styleId];
|
|
@@ -20976,7 +21119,8 @@ var NewAnimationSchema = z7.object({
|
|
|
20976
21119
|
/** A PixelLab template id (`character` only; `objectPro` has no template concept). */
|
|
20977
21120
|
template: z7.string().min(1).optional(),
|
|
20978
21121
|
direction: CharacterDirectionSchema.optional(),
|
|
20979
|
-
|
|
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(),
|
|
20980
21124
|
fps: z7.number().int().min(1).max(60).optional(),
|
|
20981
21125
|
/** One loop per named direction, plus free mirrors; expanded when the manifest loads. */
|
|
20982
21126
|
directions: z7.array(CharacterDirectionSchema).min(1).optional(),
|
|
@@ -22298,7 +22442,7 @@ import { z as z10 } from "zod";
|
|
|
22298
22442
|
// src/pipeline/model-edit.ts
|
|
22299
22443
|
import { spawn as spawn2 } from "child_process";
|
|
22300
22444
|
import { existsSync as existsSync26, readdirSync } from "fs";
|
|
22301
|
-
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";
|
|
22302
22446
|
import path34 from "path";
|
|
22303
22447
|
import { z as z9 } from "zod";
|
|
22304
22448
|
|
|
@@ -22688,7 +22832,7 @@ async function discoverModels(loaded, opts = {}) {
|
|
|
22688
22832
|
if (depth > MAX_DEPTH || models.length >= MAX_MODELS) return;
|
|
22689
22833
|
let entries;
|
|
22690
22834
|
try {
|
|
22691
|
-
entries = await
|
|
22835
|
+
entries = await readdir2(dir, { withFileTypes: true });
|
|
22692
22836
|
} catch {
|
|
22693
22837
|
return;
|
|
22694
22838
|
}
|
|
@@ -23076,7 +23220,7 @@ async function exportModelTexture(model, ref, opts) {
|
|
|
23076
23220
|
// src/pipeline/model-normals.ts
|
|
23077
23221
|
import { createHash as createHash4 } from "crypto";
|
|
23078
23222
|
import { existsSync as existsSync27 } from "fs";
|
|
23079
|
-
import { mkdir as mkdir15, readdir as
|
|
23223
|
+
import { mkdir as mkdir15, readdir as readdir3, readFile as readFile23, writeFile as writeFile17 } from "fs/promises";
|
|
23080
23224
|
import path35 from "path";
|
|
23081
23225
|
var MODEL_NORMAL_SOURCES = ["texture", "views", "sprites"];
|
|
23082
23226
|
var TILE_MAX = 512;
|
|
@@ -23814,7 +23958,7 @@ function modelSpritesDir(modelFile) {
|
|
|
23814
23958
|
}
|
|
23815
23959
|
async function readSpriteFolder(dir) {
|
|
23816
23960
|
const folder = existsSync27(path35.join(dir, "rotations")) ? path35.join(dir, "rotations") : dir;
|
|
23817
|
-
const names = (await
|
|
23961
|
+
const names = (await readdir3(folder)).filter((name) => name.toLowerCase().endsWith(".png") && VIEW_TURNS[name.slice(0, -4).toLowerCase()] !== void 0).sort();
|
|
23818
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) })));
|
|
23819
23963
|
}
|
|
23820
23964
|
function modelNormalDir(editFile) {
|
|
@@ -26807,7 +26951,7 @@ import { existsSync as existsSync37 } from "fs";
|
|
|
26807
26951
|
import { readFile as readFile33 } from "fs/promises";
|
|
26808
26952
|
|
|
26809
26953
|
// src/pipeline/init.ts
|
|
26810
|
-
import { readdir as
|
|
26954
|
+
import { readdir as readdir4, readFile as readFile32, writeFile as writeFile23 } from "fs/promises";
|
|
26811
26955
|
import { existsSync as existsSync36 } from "fs";
|
|
26812
26956
|
import path44 from "path";
|
|
26813
26957
|
function pngSize(buf) {
|
|
@@ -26822,7 +26966,7 @@ function slugify(value) {
|
|
|
26822
26966
|
}
|
|
26823
26967
|
async function walk(dir, exclude) {
|
|
26824
26968
|
const out = [];
|
|
26825
|
-
for (const entry of await
|
|
26969
|
+
for (const entry of await readdir4(dir, { withFileTypes: true })) {
|
|
26826
26970
|
const full = path44.join(dir, entry.name);
|
|
26827
26971
|
if (exclude.some((x) => full.includes(x))) continue;
|
|
26828
26972
|
if (entry.isDirectory()) out.push(...await walk(full, exclude));
|
|
@@ -28206,12 +28350,12 @@ async function runPicker(provider, lock, lockPath, opts = {}) {
|
|
|
28206
28350
|
});
|
|
28207
28351
|
if (!session) return { selected: 0, skipped: 0 };
|
|
28208
28352
|
let autoSelected = 0;
|
|
28209
|
-
if (opts.autoAcceptSingle) {
|
|
28210
|
-
const singles = session.groups.filter((g) => g.mode === "frame-set" || g.frameUrls.length === 1);
|
|
28353
|
+
if (opts.acceptFirst || opts.autoAcceptSingle) {
|
|
28354
|
+
const singles = opts.acceptFirst ? session.groups : session.groups.filter((g) => g.mode === "frame-set" || g.frameUrls.length === 1);
|
|
28211
28355
|
if (singles.length) {
|
|
28212
28356
|
const res = await session.apply({ selections: singles.map((g) => ({ key: g.key, index: 0 })) }, lockPath);
|
|
28213
28357
|
autoSelected = res.selected;
|
|
28214
|
-
log2(` --yes: accepted ${res.selected} single-candidate asset(s)`);
|
|
28358
|
+
log2(opts.acceptFirst ? ` --accept-first: accepted the first candidate of ${res.selected} asset(s)` : ` --yes: accepted ${res.selected} single-candidate asset(s)`);
|
|
28215
28359
|
const rest = session.groups.filter((g) => !singles.includes(g)).map((g) => g.key);
|
|
28216
28360
|
session = rest.length ? await prepareReview(provider, lock, { onProgress: log2, keys: rest, specs: opts.specs, lockPath }) : null;
|
|
28217
28361
|
if (!session) return { selected: autoSelected, skipped: 0 };
|
|
@@ -29231,6 +29375,7 @@ async function runLifecycle(args, wave, spent) {
|
|
|
29231
29375
|
onProgress: log,
|
|
29232
29376
|
onReady: announceReviewReady,
|
|
29233
29377
|
autoAcceptSingle: args.yes,
|
|
29378
|
+
acceptFirst: args.acceptFirst,
|
|
29234
29379
|
// A reroll from the page is `gen --force` for that one asset, inside
|
|
29235
29380
|
// this run: same plan, same budget ceiling, same submit and poll.
|
|
29236
29381
|
reroll: args.command === "gen" ? async (key3) => {
|
|
@@ -29395,7 +29540,7 @@ import { existsSync as existsSync41 } from "fs";
|
|
|
29395
29540
|
|
|
29396
29541
|
// src/pipeline/cache-health.ts
|
|
29397
29542
|
import { existsSync as existsSync40 } from "fs";
|
|
29398
|
-
import { readFile as readFile36, readdir as
|
|
29543
|
+
import { readFile as readFile36, readdir as readdir5, rm as rm14 } from "fs/promises";
|
|
29399
29544
|
import path48 from "path";
|
|
29400
29545
|
async function inspectCaches(lock, lockPath, options = {}) {
|
|
29401
29546
|
if (options.prune && !existsSync40(lockPath)) {
|
|
@@ -29455,7 +29600,7 @@ async function inspectContentCache(contentDir, referenced) {
|
|
|
29455
29600
|
return report;
|
|
29456
29601
|
}
|
|
29457
29602
|
const present = /* @__PURE__ */ new Set();
|
|
29458
|
-
const entries = await
|
|
29603
|
+
const entries = await readdir5(contentDir, { withFileTypes: true });
|
|
29459
29604
|
for (const entry of entries) {
|
|
29460
29605
|
if (!entry.isFile()) {
|
|
29461
29606
|
report.invalid.push({ name: entry.name, reason: "not a regular file" });
|
|
@@ -33856,7 +34001,7 @@ import path64 from "path";
|
|
|
33856
34001
|
|
|
33857
34002
|
// src/pixellab-assets.ts
|
|
33858
34003
|
import { existsSync as existsSync51 } from "fs";
|
|
33859
|
-
import { mkdir as mkdir23, readdir as
|
|
34004
|
+
import { mkdir as mkdir23, readdir as readdir6, readFile as readFile43, stat as stat6, writeFile as writeFile28 } from "fs/promises";
|
|
33860
34005
|
import path63 from "path";
|
|
33861
34006
|
var ASSET_KINDS = ["object", "character"];
|
|
33862
34007
|
var EXPORT_FORMATS = ["zip", "spritesheet", "aseprite", "gif"];
|
|
@@ -34006,7 +34151,7 @@ async function importTilesetFile(client2, file, opts = {}) {
|
|
|
34006
34151
|
async function pngFilesAt(from) {
|
|
34007
34152
|
if (!existsSync51(from)) throw new Error(`${from} does not exist`);
|
|
34008
34153
|
if (!(await stat6(from)).isDirectory()) return [from];
|
|
34009
|
-
const names = (await
|
|
34154
|
+
const names = (await readdir6(from)).filter((name) => /\.png$/i.test(name)).sort((a, b) => a.localeCompare(b, void 0, { numeric: true }));
|
|
34010
34155
|
if (names.length === 0) throw new Error(`${from} holds no PNG files`);
|
|
34011
34156
|
return names.map((name) => path63.join(from, name));
|
|
34012
34157
|
}
|
|
@@ -35223,7 +35368,7 @@ import path70 from "path";
|
|
|
35223
35368
|
// src/recipes.ts
|
|
35224
35369
|
import path69 from "path";
|
|
35225
35370
|
import { existsSync as existsSync55 } from "fs";
|
|
35226
|
-
import { readdir as
|
|
35371
|
+
import { readdir as readdir7, readFile as readFile49 } from "fs/promises";
|
|
35227
35372
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
35228
35373
|
import { z as z18 } from "zod";
|
|
35229
35374
|
var SHA256_RE2 = /^[0-9a-f]{64}$/;
|
|
@@ -35448,7 +35593,7 @@ async function readRecipeFile(recipePath, bundled) {
|
|
|
35448
35593
|
async function walkRecipeFiles(root) {
|
|
35449
35594
|
if (!existsSync55(root)) return [];
|
|
35450
35595
|
const out = [];
|
|
35451
|
-
for (const entry of await
|
|
35596
|
+
for (const entry of await readdir7(root, { withFileTypes: true })) {
|
|
35452
35597
|
const resolved = path69.join(root, entry.name);
|
|
35453
35598
|
if (entry.isDirectory()) out.push(...await walkRecipeFiles(resolved));
|
|
35454
35599
|
else if (entry.isFile() && entry.name === RECIPE_FILE) out.push(resolved);
|