pixelkiln 0.65.0 → 0.66.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 +209 -17
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +209 -17
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +252 -86
- package/dist/index.d.ts +252 -86
- package/dist/index.js +209 -17
- package/dist/index.js.map +1 -1
- package/docs/CHARACTERS.md +10 -0
- package/docs/GENERATORS.md +44 -0
- package/docs/MANIFEST.md +3 -2
- package/docs/REVISIONS.md +13 -0
- package/package.json +1 -1
- package/schema/manifest.schema.json +10 -2
- package/schema/recipe.schema.json +2 -1
- package/skills/pixelkiln/references/pixellab-roadmap.md +9 -6
- package/skills/pixelkiln/references/pixellab.md +10 -0
package/dist/index.cjs
CHANGED
|
@@ -322,7 +322,7 @@ var importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
|
|
|
322
322
|
// src/types.ts
|
|
323
323
|
var import_zod = require("zod");
|
|
324
324
|
var MediaTypeSchema = import_zod.z.enum(["image/png", "image/gif"]);
|
|
325
|
-
var GeneratorSchema = import_zod.z.enum(["1dir", "map", "pixflux", "tiles", "animation", "frames", "character", "terrain", "imagePro", "isometricTile", "objectPro", "uiAsset", "uiElement"]);
|
|
325
|
+
var GeneratorSchema = import_zod.z.enum(["1dir", "map", "pixflux", "tiles", "animation", "frames", "character", "terrain", "imagePro", "isometricTile", "objectPro", "uiAsset", "uiElement", "imageProFlash"]);
|
|
326
326
|
var GridConfidenceSchema = import_zod.z.enum(["low", "medium", "high"]);
|
|
327
327
|
var RevisionModeSchema = import_zod.z.enum([
|
|
328
328
|
"image-to-image",
|
|
@@ -649,8 +649,22 @@ var RevisionSchema = import_zod.z.object({
|
|
|
649
649
|
/** `animate-pixminimax` only: facing direction, used only alongside `enhancePrompt` to hold the sprite's facing. */
|
|
650
650
|
direction: CharacterDirectionSchema.optional(),
|
|
651
651
|
/** `animate`/`animate-pixminimax` only: let PixelLab expand the action into a fuller motion description first. */
|
|
652
|
-
enhancePrompt: import_zod.z.boolean().optional()
|
|
652
|
+
enhancePrompt: import_zod.z.boolean().optional(),
|
|
653
|
+
/**
|
|
654
|
+
* `image-to-image`/`inpaint` only: which provider engine draws the
|
|
655
|
+
* edit. `pro-flash` selects PixelLab's Pro Flash edit and inpaint tier
|
|
656
|
+
* (`/edit-image-pro-flash`, `/inpaint-image-pro-flash`) instead of the
|
|
657
|
+
* default Pro endpoints; omit it for the default.
|
|
658
|
+
*/
|
|
659
|
+
engine: import_zod.z.enum(["pro-flash"]).optional()
|
|
653
660
|
}).strict().superRefine((revision, context) => {
|
|
661
|
+
if (revision.engine !== void 0 && revision.mode !== "image-to-image" && revision.mode !== "inpaint") {
|
|
662
|
+
context.addIssue({
|
|
663
|
+
code: import_zod.z.ZodIssueCode.custom,
|
|
664
|
+
message: "engine applies to image-to-image and inpaint revisions only",
|
|
665
|
+
path: ["engine"]
|
|
666
|
+
});
|
|
667
|
+
}
|
|
654
668
|
if (revision.mode === "inpaint" && !revision.mask) {
|
|
655
669
|
context.addIssue({
|
|
656
670
|
code: import_zod.z.ZodIssueCode.custom,
|
|
@@ -939,8 +953,8 @@ var StyleObjectSchema = import_zod.z.object({
|
|
|
939
953
|
/** `character` only. Body template: `mannequin` (default), a quadruped (`bear`, `cat`, `dog`, `horse`, `lion`), or `custom` for `pro-flash`. */
|
|
940
954
|
template: import_zod.z.string().min(1).optional(),
|
|
941
955
|
/**
|
|
942
|
-
* `character`
|
|
943
|
-
* the style image lends. Each defaults to true.
|
|
956
|
+
* `character` `pro-flash` bases and `imageProFlash` styles, with a
|
|
957
|
+
* style image: which traits the style image lends. Each defaults to true.
|
|
944
958
|
*/
|
|
945
959
|
styleTraits: import_zod.z.object({
|
|
946
960
|
palette: import_zod.z.boolean().optional(),
|
|
@@ -1373,7 +1387,8 @@ var LockEntrySchema = import_zod.z.object({
|
|
|
1373
1387
|
fps: import_zod.z.number().int().min(1).max(60).optional(),
|
|
1374
1388
|
lastFrameSha256: import_zod.z.string().regex(/^[0-9a-f]{64}$/).optional(),
|
|
1375
1389
|
direction: CharacterDirectionSchema.optional(),
|
|
1376
|
-
enhancePrompt: import_zod.z.boolean().optional()
|
|
1390
|
+
enhancePrompt: import_zod.z.boolean().optional(),
|
|
1391
|
+
engine: import_zod.z.enum(["pro-flash"]).optional()
|
|
1377
1392
|
}).strict().nullable().default(null),
|
|
1378
1393
|
/** For a mirror: the asset it flips and a hash over that asset's output hashes when this was made. */
|
|
1379
1394
|
mirror: import_zod.z.object({
|
|
@@ -1750,6 +1765,14 @@ var CorrectPixelartResponseSchema = import_zod2.z.object({
|
|
|
1750
1765
|
images: import_zod2.z.array(import_zod2.z.object({ base64: import_zod2.z.string().min(1) }).passthrough()).min(1),
|
|
1751
1766
|
usage: import_zod2.z.unknown().optional()
|
|
1752
1767
|
}).passthrough();
|
|
1768
|
+
var ProFlashImageSubmitSchema = import_zod2.z.object({
|
|
1769
|
+
background_job_id: import_zod2.z.string().min(1),
|
|
1770
|
+
image_id: import_zod2.z.string().min(1),
|
|
1771
|
+
source_image_id: import_zod2.z.string().min(1),
|
|
1772
|
+
status: import_zod2.z.string().default("processing"),
|
|
1773
|
+
estimated_generations: import_zod2.z.number().nullable().optional(),
|
|
1774
|
+
usage: import_zod2.z.unknown().optional()
|
|
1775
|
+
}).passthrough();
|
|
1753
1776
|
var UnzoomResponseSchema = import_zod2.z.object({
|
|
1754
1777
|
image: import_zod2.z.object({ base64: import_zod2.z.string().min(1) }).passthrough(),
|
|
1755
1778
|
original_size: import_zod2.z.object({ width: import_zod2.z.number().int(), height: import_zod2.z.number().int() }).passthrough(),
|
|
@@ -2190,7 +2213,7 @@ var PixelLabClient = class {
|
|
|
2190
2213
|
const body = {
|
|
2191
2214
|
description: args.description,
|
|
2192
2215
|
n_directions: args.directions,
|
|
2193
|
-
...args.reference ? { first_frame: encode(args.reference) } : { image_size: { width: args.size, height: args.size } },
|
|
2216
|
+
...args.sourceImageId ? { source_image_id: args.sourceImageId } : args.reference ? { first_frame: encode(args.reference) } : { image_size: { width: args.size, height: args.size } },
|
|
2194
2217
|
...args.view ? { view: args.view } : {},
|
|
2195
2218
|
...args.seed != null ? { seed: args.seed } : {},
|
|
2196
2219
|
...args.styleReference && args.styleReferenceSize ? {
|
|
@@ -2337,8 +2360,9 @@ var PixelLabClient = class {
|
|
|
2337
2360
|
description: args.description,
|
|
2338
2361
|
template_id: args.template,
|
|
2339
2362
|
n_directions: 8,
|
|
2340
|
-
// The author's sprite sets the canvas; a size only applies to text
|
|
2341
|
-
|
|
2363
|
+
// The author's sprite sets the canvas; a size only applies to text
|
|
2364
|
+
// creation. An owned copy of the same sprite is referenced by id.
|
|
2365
|
+
...args.sourceImageId ? { source_image_id: args.sourceImageId } : south ? { first_frame: encode(south) } : { image_size: imageSize },
|
|
2342
2366
|
...args.view ? { view: args.view } : {},
|
|
2343
2367
|
...args.seed != null ? { seed: args.seed } : {},
|
|
2344
2368
|
...args.styleReference && args.styleReferenceSize ? {
|
|
@@ -2610,6 +2634,66 @@ var PixelLabClient = class {
|
|
|
2610
2634
|
"generate-image-v2"
|
|
2611
2635
|
);
|
|
2612
2636
|
}
|
|
2637
|
+
/**
|
|
2638
|
+
* `/create-image-pro-flash`: one native pixel-art image from a
|
|
2639
|
+
* description, optionally styled after a style image with per-trait
|
|
2640
|
+
* toggles, on the same Pro Flash model `character`/`objectPro` use for
|
|
2641
|
+
* their `pro-flash` engine. Sizes run 16 to 256 per side in multiples of 4.
|
|
2642
|
+
* A plain background job; `pollRevision`'s generic reader takes the
|
|
2643
|
+
* finished image. The response's `source_image_id` is what a Pro Flash
|
|
2644
|
+
* character or object can reuse instead of an upload.
|
|
2645
|
+
*/
|
|
2646
|
+
async createImageProFlash(args) {
|
|
2647
|
+
const body = {
|
|
2648
|
+
description: args.description,
|
|
2649
|
+
image_size: { width: args.width, height: args.height }
|
|
2650
|
+
};
|
|
2651
|
+
if (args.noBackground != null) body.no_background = args.noBackground;
|
|
2652
|
+
if (args.seed != null) body.seed = args.seed;
|
|
2653
|
+
if (args.styleImage) {
|
|
2654
|
+
body.style_image = { image: args.styleImage.image, size: { width: args.styleImage.width, height: args.styleImage.height } };
|
|
2655
|
+
const traits = args.styleTraits;
|
|
2656
|
+
if (traits) {
|
|
2657
|
+
body.style_options = {
|
|
2658
|
+
...traits.palette !== void 0 ? { color_palette: traits.palette } : {},
|
|
2659
|
+
...traits.outline !== void 0 ? { outline: traits.outline } : {},
|
|
2660
|
+
...traits.detail !== void 0 ? { detail: traits.detail } : {},
|
|
2661
|
+
...traits.shading !== void 0 ? { shading: traits.shading } : {}
|
|
2662
|
+
};
|
|
2663
|
+
}
|
|
2664
|
+
}
|
|
2665
|
+
return validateResponse(
|
|
2666
|
+
ProFlashImageSubmitSchema,
|
|
2667
|
+
await this.request("/create-image-pro-flash", { method: "POST", body: JSON.stringify(body) }),
|
|
2668
|
+
"create-image-pro-flash"
|
|
2669
|
+
);
|
|
2670
|
+
}
|
|
2671
|
+
/** `/edit-image-pro-flash`, text method: edit one image at its own size. The canvas never grows or resizes. */
|
|
2672
|
+
async editImageProFlash(args) {
|
|
2673
|
+
const body = { image: args.image, method: "text", description: args.description };
|
|
2674
|
+
if (args.noBackground != null) body.no_background = args.noBackground;
|
|
2675
|
+
if (args.seed != null) body.seed = args.seed;
|
|
2676
|
+
return validateResponse(
|
|
2677
|
+
ProFlashImageSubmitSchema,
|
|
2678
|
+
await this.request("/edit-image-pro-flash", { method: "POST", body: JSON.stringify(body) }),
|
|
2679
|
+
"edit-image-pro-flash"
|
|
2680
|
+
);
|
|
2681
|
+
}
|
|
2682
|
+
/**
|
|
2683
|
+
* `/inpaint-image-pro-flash`: replace only the white pixels of a same-size
|
|
2684
|
+
* black/white mask, keeping everything else exactly. `Modify current
|
|
2685
|
+
* layer` (the endpoint's default) returns the full composite.
|
|
2686
|
+
*/
|
|
2687
|
+
async inpaintImageProFlash(args) {
|
|
2688
|
+
const body = { image: args.image, mask_image: args.maskImage, description: args.description };
|
|
2689
|
+
if (args.noBackground != null) body.no_background = args.noBackground;
|
|
2690
|
+
if (args.seed != null) body.seed = args.seed;
|
|
2691
|
+
return validateResponse(
|
|
2692
|
+
ProFlashImageSubmitSchema,
|
|
2693
|
+
await this.request("/inpaint-image-pro-flash", { method: "POST", body: JSON.stringify(body) }),
|
|
2694
|
+
"inpaint-image-pro-flash"
|
|
2695
|
+
);
|
|
2696
|
+
}
|
|
2613
2697
|
/**
|
|
2614
2698
|
* `/generate-ui-v2` ("Generate UI (Pro)"): one UI element (a button, a
|
|
2615
2699
|
* health bar, an inventory slot, a dialogue box) from a description,
|
|
@@ -3490,6 +3574,7 @@ function specHash(spec, styleImageHashes, providerOptionIdentity = spec.provider
|
|
|
3490
3574
|
uiPieces: spec.uiPieces,
|
|
3491
3575
|
uiElements: spec.uiElements,
|
|
3492
3576
|
uiColorPalette: spec.uiColorPalette,
|
|
3577
|
+
styleTraits: spec.styleTraits,
|
|
3493
3578
|
styleImages: styleImageHashes,
|
|
3494
3579
|
// A character family: the engine and rotations of a base, the parent's
|
|
3495
3580
|
// generated bytes for a state or animation (so a regenerated parent
|
|
@@ -3566,7 +3651,8 @@ function specHash(spec, styleImageHashes, providerOptionIdentity = spec.provider
|
|
|
3566
3651
|
fps: spec.revision.fps,
|
|
3567
3652
|
lastFrameSha256: spec.revision.lastFrameSha256,
|
|
3568
3653
|
direction: spec.revision.direction,
|
|
3569
|
-
enhancePrompt: spec.revision.enhancePrompt
|
|
3654
|
+
enhancePrompt: spec.revision.enhancePrompt,
|
|
3655
|
+
engine: spec.revision.engine
|
|
3570
3656
|
} : void 0
|
|
3571
3657
|
})
|
|
3572
3658
|
);
|
|
@@ -3622,8 +3708,11 @@ function proFlashCharacterCost(width, height, fromReference) {
|
|
|
3622
3708
|
const side = Math.max(32, Math.ceil(Math.max(width, height) / 4) * 4);
|
|
3623
3709
|
const rotations = Math.max(1, Math.ceil(side * side * 8 / 65536));
|
|
3624
3710
|
if (fromReference) return rotations;
|
|
3625
|
-
|
|
3626
|
-
|
|
3711
|
+
return proFlashImageCost(side, side) + rotations;
|
|
3712
|
+
}
|
|
3713
|
+
function proFlashImageCost(width, height) {
|
|
3714
|
+
const side = Math.max(width, height);
|
|
3715
|
+
return side <= 96 ? 5 : side <= 208 ? 6 : 9;
|
|
3627
3716
|
}
|
|
3628
3717
|
function characterAnimationName(spec) {
|
|
3629
3718
|
return `pixelkiln:${spec.styleId}/${spec.assetId}`;
|
|
@@ -3699,7 +3788,7 @@ var PixelLabProvider = class _PixelLabProvider {
|
|
|
3699
3788
|
return new _PixelLabProvider(new PixelLabClient("download-only"));
|
|
3700
3789
|
}
|
|
3701
3790
|
supports(generator) {
|
|
3702
|
-
return generator === "1dir" || generator === "map" || generator === "pixflux" || generator === "tiles" || generator === "terrain" || generator === "imagePro" || generator === "character" || generator === "isometricTile" || generator === "objectPro" || generator === "uiAsset" || generator === "uiElement";
|
|
3791
|
+
return generator === "1dir" || generator === "map" || generator === "pixflux" || generator === "tiles" || generator === "terrain" || generator === "imagePro" || generator === "character" || generator === "isometricTile" || generator === "objectPro" || generator === "uiAsset" || generator === "uiElement" || generator === "imageProFlash";
|
|
3703
3792
|
}
|
|
3704
3793
|
/**
|
|
3705
3794
|
* `inpaint` (`/inpaint-v3`, a mask) and `image-to-image` (`/edit-images-v2`,
|
|
@@ -3761,6 +3850,13 @@ var PixelLabProvider = class _PixelLabProvider {
|
|
|
3761
3850
|
const base = Math.max(1, Math.ceil(width * height * frames / 65536));
|
|
3762
3851
|
return { unit: "generations", amount: spec.revision.enhancePrompt ? base + 0.05 : base, candidates: 1 };
|
|
3763
3852
|
}
|
|
3853
|
+
if (spec.revision?.engine === "pro-flash") {
|
|
3854
|
+
return {
|
|
3855
|
+
unit: "generations",
|
|
3856
|
+
amount: proFlashImageCost(spec.revision.sourceWidth ?? spec.width, spec.revision.sourceHeight ?? spec.height),
|
|
3857
|
+
candidates: 1
|
|
3858
|
+
};
|
|
3859
|
+
}
|
|
3764
3860
|
if (spec.revision) {
|
|
3765
3861
|
const width = spec.revision.sourceWidth ?? spec.width;
|
|
3766
3862
|
const height = spec.revision.sourceHeight ?? spec.height;
|
|
@@ -3775,6 +3871,9 @@ var PixelLabProvider = class _PixelLabProvider {
|
|
|
3775
3871
|
if (spec.generator === "objectPro") {
|
|
3776
3872
|
return { unit: "generations", amount: objectProCost(spec), candidates: 1 };
|
|
3777
3873
|
}
|
|
3874
|
+
if (spec.generator === "imageProFlash") {
|
|
3875
|
+
return { unit: "generations", amount: proFlashImageCost(spec.width, spec.height), candidates: 1 };
|
|
3876
|
+
}
|
|
3778
3877
|
return {
|
|
3779
3878
|
unit: "generations",
|
|
3780
3879
|
amount: generationCost(spec.width, spec.height, spec.generator),
|
|
@@ -3788,7 +3887,17 @@ var PixelLabProvider = class _PixelLabProvider {
|
|
|
3788
3887
|
`PixelLab ${spec.revision.mode} reads one source image; ${spec.revision.sourceAssetId} is a ${members.length}-member set (${members[0].role}, ...). Revise one member through a declared source, or use reduce-colors, correct-pixelart, or edit-animation, which take the whole set`
|
|
3789
3888
|
);
|
|
3790
3889
|
}
|
|
3791
|
-
if (spec.revision?.
|
|
3890
|
+
if (spec.revision?.engine === "pro-flash") {
|
|
3891
|
+
const { sourceWidth: width, sourceHeight: height, mode: mode2 } = spec.revision;
|
|
3892
|
+
if (width != null && height != null && (width < 32 || height < 32 || width > 256 || height > 256 || width % 4 || height % 4)) {
|
|
3893
|
+
throw new Error(
|
|
3894
|
+
`PixelLab pro-flash ${mode2} source is ${width}x${height}; the API takes 32 to 256 pixels per side, in multiples of 4`
|
|
3895
|
+
);
|
|
3896
|
+
}
|
|
3897
|
+
if (spec.revision.strength != null) {
|
|
3898
|
+
throw new Error(`PixelLab pro-flash ${mode2} takes no strength; the edit applies in full`);
|
|
3899
|
+
}
|
|
3900
|
+
} else if (spec.revision?.mode === "inpaint") {
|
|
3792
3901
|
const { sourceWidth: width, sourceHeight: height } = spec.revision;
|
|
3793
3902
|
if (width != null && height != null && (width < 32 || height < 32 || width > 512 || height > 512)) {
|
|
3794
3903
|
throw new Error(`PixelLab inpaint source is ${width}x${height}; the API takes 32 to 512 pixels per side`);
|
|
@@ -3869,6 +3978,19 @@ var PixelLabProvider = class _PixelLabProvider {
|
|
|
3869
3978
|
`PixelLab uiAsset is ${spec.width}x${spec.height}; the API takes 192 to 688 pixels per side (the exact ceiling also depends on aspect ratio \u2014 square tops out at 512, 16:9 at 688x384, 9:16 at 384x688, 4:3 at 600x448, 3:4 at 448x600)`
|
|
3870
3979
|
);
|
|
3871
3980
|
}
|
|
3981
|
+
if (spec.generator === "imageProFlash") {
|
|
3982
|
+
if (spec.width < 16 || spec.height < 16 || spec.width > 256 || spec.height > 256 || spec.width % 4 || spec.height % 4) {
|
|
3983
|
+
throw new Error(
|
|
3984
|
+
`PixelLab imageProFlash is ${spec.width}x${spec.height}; the API takes 16 to 256 pixels per side, in multiples of 4`
|
|
3985
|
+
);
|
|
3986
|
+
}
|
|
3987
|
+
if (styleImages.length > 1) {
|
|
3988
|
+
throw new Error("PixelLab imageProFlash takes one style image; list at most one styleImages entry");
|
|
3989
|
+
}
|
|
3990
|
+
if (spec.styleTraits && !styleImages.length) {
|
|
3991
|
+
throw new Error("PixelLab imageProFlash: styleTraits choose what a style image lends; add a styleImages entry or drop them");
|
|
3992
|
+
}
|
|
3993
|
+
}
|
|
3872
3994
|
if (spec.generator === "uiElement" && (spec.width < 16 || spec.height < 16 || spec.width > 792 || spec.height > 688)) {
|
|
3873
3995
|
throw new Error(
|
|
3874
3996
|
`PixelLab uiElement is ${spec.width}x${spec.height}; the API takes 16 to 792 wide and 16 to 688 tall (the exact ceiling depends on aspect ratio \u2014 square tops out at 512, 16:9 at 688x384)`
|
|
@@ -4222,7 +4344,8 @@ var PixelLabProvider = class _PixelLabProvider {
|
|
|
4222
4344
|
concept: character.concept ? readPose(spec, "concept image", character.concept) : void 0,
|
|
4223
4345
|
styleCharacterId: character.styleAnchor ? requireStyleObjectId(spec, context) : void 0,
|
|
4224
4346
|
styleReferenceSize: styleImage ? { width: styleImage.width, height: styleImage.height } : void 0,
|
|
4225
|
-
styleTraits: character.styleTraits
|
|
4347
|
+
styleTraits: character.styleTraits,
|
|
4348
|
+
sourceImageId: character.mode === "pro-flash" ? context?.referenceSourceImageId : void 0
|
|
4226
4349
|
});
|
|
4227
4350
|
return { jobId: res2.character_id, metadata: { character: { kind: "base", characterId: res2.character_id, mode: character.mode, directions: character.directions, backgroundJobId: res2.background_job_id } } };
|
|
4228
4351
|
}
|
|
@@ -4357,7 +4480,8 @@ var PixelLabProvider = class _PixelLabProvider {
|
|
|
4357
4480
|
reference: object.reference ? readPose(spec, "reference sprite", object.reference) : void 0,
|
|
4358
4481
|
styleReference: styleImage ? { base64: styleImage.base64, format: styleImage.format } : void 0,
|
|
4359
4482
|
styleReferenceSize: styleImage ? { width: styleImage.width, height: styleImage.height } : void 0,
|
|
4360
|
-
styleTraits: object.styleTraits
|
|
4483
|
+
styleTraits: object.styleTraits,
|
|
4484
|
+
sourceImageId: context?.referenceSourceImageId
|
|
4361
4485
|
});
|
|
4362
4486
|
return { jobId: res2.object_id, metadata: { objectPro: { kind: "base", objectId: res2.object_id, directions: object.directions, backgroundJobId: res2.background_job_id } } };
|
|
4363
4487
|
}
|
|
@@ -4656,6 +4780,19 @@ var PixelLabProvider = class _PixelLabProvider {
|
|
|
4656
4780
|
});
|
|
4657
4781
|
return { jobId: res2.ui_asset_id, metadata: { backgroundJobId: res2.background_job_id } };
|
|
4658
4782
|
}
|
|
4783
|
+
if (spec.generator === "imageProFlash") {
|
|
4784
|
+
const style = styleImages[0];
|
|
4785
|
+
const res2 = await this.client.createImageProFlash({
|
|
4786
|
+
description: spec.prompt,
|
|
4787
|
+
width: spec.width,
|
|
4788
|
+
height: spec.height,
|
|
4789
|
+
noBackground: spec.noBackground,
|
|
4790
|
+
seed: spec.seed,
|
|
4791
|
+
styleImage: style ? { image: { base64: style.base64, format: style.format }, width: style.width, height: style.height } : void 0,
|
|
4792
|
+
styleTraits: spec.styleTraits
|
|
4793
|
+
});
|
|
4794
|
+
return { jobId: res2.background_job_id, metadata: { imageProFlash: proFlashRecord(res2) } };
|
|
4795
|
+
}
|
|
4659
4796
|
if (spec.generator === "uiElement") {
|
|
4660
4797
|
const concept = styleImages[0];
|
|
4661
4798
|
const res2 = await this.client.generateUiV2({
|
|
@@ -4809,6 +4946,32 @@ var PixelLabProvider = class _PixelLabProvider {
|
|
|
4809
4946
|
const width = revision.sourceWidth;
|
|
4810
4947
|
const height = revision.sourceHeight;
|
|
4811
4948
|
const roles = revision.sourceMembers?.map((member) => member.role);
|
|
4949
|
+
if (revision.engine === "pro-flash") {
|
|
4950
|
+
if (revision.mode === "inpaint") {
|
|
4951
|
+
if (!revision.maskFile || !revision.maskSha256 || !revision.maskFormat) {
|
|
4952
|
+
throw new Error(`${spec.styleId}/${spec.assetId}: revision mask is not ready`);
|
|
4953
|
+
}
|
|
4954
|
+
const maskBytes = (0, import_node_fs2.readFileSync)(revision.maskFile);
|
|
4955
|
+
if (sha256(maskBytes) !== revision.maskSha256) {
|
|
4956
|
+
throw new Error(`${spec.styleId}/${spec.assetId}: revision mask changed after the manifest was resolved`);
|
|
4957
|
+
}
|
|
4958
|
+
const res3 = await this.client.inpaintImageProFlash({
|
|
4959
|
+
image,
|
|
4960
|
+
maskImage: { base64: maskBytes.toString("base64"), format: revision.maskFormat },
|
|
4961
|
+
description: spec.prompt,
|
|
4962
|
+
noBackground: spec.noBackground,
|
|
4963
|
+
seed: spec.seed
|
|
4964
|
+
});
|
|
4965
|
+
return { jobId: res3.background_job_id, metadata: { imageProFlash: proFlashRecord(res3) } };
|
|
4966
|
+
}
|
|
4967
|
+
const res2 = await this.client.editImageProFlash({
|
|
4968
|
+
image,
|
|
4969
|
+
description: spec.prompt,
|
|
4970
|
+
noBackground: spec.noBackground,
|
|
4971
|
+
seed: spec.seed
|
|
4972
|
+
});
|
|
4973
|
+
return { jobId: res2.background_job_id, metadata: { imageProFlash: proFlashRecord(res2) } };
|
|
4974
|
+
}
|
|
4812
4975
|
if (revision.mode === "inpaint") {
|
|
4813
4976
|
if (!revision.maskFile || !revision.maskSha256 || !revision.maskFormat) {
|
|
4814
4977
|
throw new Error(`${spec.styleId}/${spec.assetId}: revision mask is not ready`);
|
|
@@ -4973,6 +5136,7 @@ var PixelLabProvider = class _PixelLabProvider {
|
|
|
4973
5136
|
return this.pollAnimateRevision(jobId, context);
|
|
4974
5137
|
}
|
|
4975
5138
|
if (context?.spec?.revision) return this.pollRevision(jobId);
|
|
5139
|
+
if (generator === "imageProFlash") return this.pollRevision(jobId);
|
|
4976
5140
|
if (generator === "pixflux") {
|
|
4977
5141
|
const file = import_node_path.default.join(_PixelLabProvider.cacheDir(), `${jobId}.png`);
|
|
4978
5142
|
if ((0, import_node_fs2.existsSync)(file)) {
|
|
@@ -5553,6 +5717,13 @@ function readPose(spec, what, image) {
|
|
|
5553
5717
|
}
|
|
5554
5718
|
return { base64: bytes.toString("base64"), format: image.format };
|
|
5555
5719
|
}
|
|
5720
|
+
function proFlashRecord(res) {
|
|
5721
|
+
return {
|
|
5722
|
+
imageId: res.image_id,
|
|
5723
|
+
sourceImageId: res.source_image_id,
|
|
5724
|
+
...res.estimated_generations != null ? { estimatedGenerations: res.estimated_generations } : {}
|
|
5725
|
+
};
|
|
5726
|
+
}
|
|
5556
5727
|
function editAnimationFrameCeiling(width, height) {
|
|
5557
5728
|
const side = Math.max(width, height);
|
|
5558
5729
|
if (side <= 64) return 16;
|
|
@@ -6756,6 +6927,11 @@ var ComfyUIProvider = class _ComfyUIProvider {
|
|
|
6756
6927
|
throw new Error("ComfyUI providerOptions.frames requires generator: frames");
|
|
6757
6928
|
}
|
|
6758
6929
|
if (spec.revision) {
|
|
6930
|
+
if (spec.revision.engine) {
|
|
6931
|
+
throw new Error(
|
|
6932
|
+
`ComfyUI has no "${spec.revision.engine}" revision engine; that selects PixelLab's Pro Flash edit/inpaint endpoints. Drop engine to run the revision through this style's own workflow.`
|
|
6933
|
+
);
|
|
6934
|
+
}
|
|
6759
6935
|
if (spec.revision.sourceMembers) {
|
|
6760
6936
|
throw new Error(
|
|
6761
6937
|
`ComfyUI revisions read one source image; ${spec.revision.sourceAssetId} is a ${spec.revision.sourceMembers.length}-member set (directions or frames)`
|
|
@@ -8353,6 +8529,7 @@ async function resolveSpecs(loaded, filter) {
|
|
|
8353
8529
|
uiPieces: generator === "uiAsset" ? asset.pieces : void 0,
|
|
8354
8530
|
uiElements: generator === "uiAsset" ? asset.elements : void 0,
|
|
8355
8531
|
uiColorPalette: generator === "uiAsset" || generator === "uiElement" ? style.uiColorPalette : void 0,
|
|
8532
|
+
...generator === "imageProFlash" && style.styleTraits ? { styleTraits: style.styleTraits } : {},
|
|
8356
8533
|
palette: style.palette,
|
|
8357
8534
|
enforcePalette: style.enforcePalette,
|
|
8358
8535
|
noBackground: style.noBackground,
|
|
@@ -8636,7 +8813,8 @@ async function resolveSpecs(loaded, filter) {
|
|
|
8636
8813
|
lastFrameFormat: lastFrame?.format ?? null
|
|
8637
8814
|
} : {},
|
|
8638
8815
|
...asset.revision.direction ? { direction: asset.revision.direction } : {},
|
|
8639
|
-
...asset.revision.enhancePrompt == null ? {} : { enhancePrompt: asset.revision.enhancePrompt }
|
|
8816
|
+
...asset.revision.enhancePrompt == null ? {} : { enhancePrompt: asset.revision.enhancePrompt },
|
|
8817
|
+
...asset.revision.engine ? { engine: asset.revision.engine } : {}
|
|
8640
8818
|
};
|
|
8641
8819
|
}
|
|
8642
8820
|
if (asset.batch) {
|
|
@@ -13408,7 +13586,8 @@ async function submit(provider, loaded, items, lock, lockPath, opts = {}) {
|
|
|
13408
13586
|
...spec.revision.fps == null ? {} : { fps: spec.revision.fps },
|
|
13409
13587
|
...spec.revision.lastFrameSha256 ? { lastFrameSha256: spec.revision.lastFrameSha256 } : {},
|
|
13410
13588
|
...spec.revision.direction ? { direction: spec.revision.direction } : {},
|
|
13411
|
-
...spec.revision.enhancePrompt == null ? {} : { enhancePrompt: spec.revision.enhancePrompt }
|
|
13589
|
+
...spec.revision.enhancePrompt == null ? {} : { enhancePrompt: spec.revision.enhancePrompt },
|
|
13590
|
+
...spec.revision.engine ? { engine: spec.revision.engine } : {}
|
|
13412
13591
|
} : null,
|
|
13413
13592
|
outfit: spec.character?.kind === "outfit" && outfitParentEntry ? {
|
|
13414
13593
|
sourceAssetId: spec.character.parentAssetId,
|
|
@@ -13452,8 +13631,10 @@ async function submit(provider, loaded, items, lock, lockPath, opts = {}) {
|
|
|
13452
13631
|
path: currentEntryOutputPath(parentEntry, spec.character.parentSpec, index),
|
|
13453
13632
|
role: output.role
|
|
13454
13633
|
})) : void 0;
|
|
13634
|
+
const referenceSourceImageId = ownedReferenceImageId(spec, lock, provider.id);
|
|
13455
13635
|
const { jobId, metadata } = await provider.submit(spec, refs, {
|
|
13456
13636
|
...previousJobId ? { previousJobId } : {},
|
|
13637
|
+
...referenceSourceImageId ? { referenceSourceImageId } : {},
|
|
13457
13638
|
...parentEntry?.objectId ? { parentObjectId: parentEntry.objectId } : {},
|
|
13458
13639
|
...anchorEntry?.objectId ? { styleObjectId: anchorEntry.objectId } : {},
|
|
13459
13640
|
...parentOutputs ? { parentOutputs } : {},
|
|
@@ -13520,6 +13701,17 @@ async function submit(provider, loaded, items, lock, lockPath, opts = {}) {
|
|
|
13520
13701
|
}
|
|
13521
13702
|
return { submitted, failed, spent, unit };
|
|
13522
13703
|
}
|
|
13704
|
+
function ownedReferenceImageId(spec, lock, providerId) {
|
|
13705
|
+
const sha2562 = spec.character?.kind === "base" && spec.character.mode === "pro-flash" ? spec.character.reference?.south?.sha256 : spec.objectPro?.kind === "base" ? spec.objectPro.reference?.sha256 : void 0;
|
|
13706
|
+
if (!sha2562) return void 0;
|
|
13707
|
+
for (const entry of Object.values(lock.entries)) {
|
|
13708
|
+
if (entry.provider !== providerId || entry.generator !== "imageProFlash" || entry.status !== "downloaded") continue;
|
|
13709
|
+
if (entry.outputs.length !== 1 || entry.outputs[0].sha256 !== sha2562) continue;
|
|
13710
|
+
const recorded = entry.providerMetadata?.[providerId]?.imageProFlash;
|
|
13711
|
+
if (typeof recorded?.sourceImageId === "string" && recorded.sourceImageId) return recorded.sourceImageId;
|
|
13712
|
+
}
|
|
13713
|
+
return void 0;
|
|
13714
|
+
}
|
|
13523
13715
|
|
|
13524
13716
|
// src/pipeline/poll.ts
|
|
13525
13717
|
var sleep2 = (ms) => new Promise((r) => setTimeout(r, ms));
|