pixelkiln 0.91.2 → 0.92.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 +117 -40
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +121 -40
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +63 -23
- package/dist/index.d.ts +63 -23
- package/dist/index.js +119 -40
- package/dist/index.js.map +1 -1
- package/docs/ENDPOINTS.md +36 -0
- package/docs/GENERATORS.md +44 -0
- package/docs/MANIFEST.md +6 -4
- package/docs/PIXELLAB.md +13 -1
- package/package.json +1 -1
- package/skills/pixelkiln/references/pixellab-roadmap.md +15 -0
- package/skills/pixelkiln/references/pixellab.md +9 -1
package/dist/cli.js
CHANGED
|
@@ -934,6 +934,17 @@ import path2 from "path";
|
|
|
934
934
|
import { z } from "zod";
|
|
935
935
|
var MediaTypeSchema = z.enum(["image/png", "image/gif"]);
|
|
936
936
|
var GeneratorSchema = z.enum(["1dir", "map", "pixflux", "tiles", "animation", "frames", "character", "terrain", "imagePro", "isometricTile", "objectPro", "uiAsset", "uiElement", "imageProFlash", "vfx"]);
|
|
937
|
+
var TARGET_PALETTE_GENERATORS = [
|
|
938
|
+
"imagePro",
|
|
939
|
+
"imageProFlash",
|
|
940
|
+
"objectPro",
|
|
941
|
+
"1dir",
|
|
942
|
+
"character",
|
|
943
|
+
"tiles",
|
|
944
|
+
"terrain",
|
|
945
|
+
"uiAsset",
|
|
946
|
+
"uiElement"
|
|
947
|
+
];
|
|
937
948
|
var GridConfidenceSchema = z.enum(["low", "medium", "high"]);
|
|
938
949
|
var RevisionModeSchema = z.enum([
|
|
939
950
|
"image-to-image",
|
|
@@ -1890,8 +1901,8 @@ var StyleObjectSchema = z.object({
|
|
|
1890
1901
|
seed: z.number().int().optional(),
|
|
1891
1902
|
/**
|
|
1892
1903
|
* Forced palette, as `#rrggbb` values. Sent as a swatch to `pixflux`
|
|
1893
|
-
* and the generators that take one, and
|
|
1894
|
-
*
|
|
1904
|
+
* and the generators that take one, and as `target_palette.colors` (2 to
|
|
1905
|
+
* 256 colours) to every PixelLab call that takes it (`TARGET_PALETTE_GENERATORS`).
|
|
1895
1906
|
*
|
|
1896
1907
|
* Unlike prose, this is a hard constraint. The API is handed a swatch
|
|
1897
1908
|
* image and the output is limited to those colours. Verified: a four-colour
|
|
@@ -1901,9 +1912,9 @@ var StyleObjectSchema = z.object({
|
|
|
1901
1912
|
* chocolate bar.
|
|
1902
1913
|
*/
|
|
1903
1914
|
palette: z.array(HexColorSchema).default([]),
|
|
1904
|
-
/** `
|
|
1915
|
+
/** `target_palette.name` ("Game Boy", "PICO-8"), which PixelLab uses to help the look. Needs `palette`; generators in `TARGET_PALETTE_GENERATORS` only. */
|
|
1905
1916
|
paletteName: z.string().min(1).max(100).optional(),
|
|
1906
|
-
/** `
|
|
1917
|
+
/** `target_palette.max_colors`: at most this many colours in each image, 2 to 64 (drawn from `palette` when one is set). Generators in `TARGET_PALETTE_GENERATORS` only. */
|
|
1907
1918
|
maxColors: z.number().int().min(2).max(64).optional(),
|
|
1908
1919
|
/**
|
|
1909
1920
|
* Snap every visible pixel of the downloaded art to the nearest `palette`
|
|
@@ -1959,10 +1970,10 @@ var StyleSchema = StyleObjectSchema.refine((s) => !(s.tileFeature && s.styleImag
|
|
|
1959
1970
|
});
|
|
1960
1971
|
}
|
|
1961
1972
|
for (const field of ["paletteName", "maxColors"]) {
|
|
1962
|
-
if (style[field] !== void 0 && style.generator
|
|
1973
|
+
if (style[field] !== void 0 && !TARGET_PALETTE_GENERATORS.includes(style.generator)) {
|
|
1963
1974
|
ctx.addIssue({
|
|
1964
1975
|
code: z.ZodIssueCode.custom,
|
|
1965
|
-
message: `${field} applies to the
|
|
1976
|
+
message: `${field} applies to the ${TARGET_PALETTE_GENERATORS.join(", ")} generators only`,
|
|
1966
1977
|
path: [field]
|
|
1967
1978
|
});
|
|
1968
1979
|
}
|
|
@@ -6767,6 +6778,16 @@ function proportionsPayload(proportions) {
|
|
|
6767
6778
|
...proportions.hipWidth !== void 0 ? { hip_width: proportions.hipWidth } : {}
|
|
6768
6779
|
};
|
|
6769
6780
|
}
|
|
6781
|
+
function targetPaletteBody(palette) {
|
|
6782
|
+
if (!palette || !(palette.colors?.length || palette.maxColors != null)) return {};
|
|
6783
|
+
return {
|
|
6784
|
+
target_palette: {
|
|
6785
|
+
...palette.colors?.length ? { colors: palette.colors } : {},
|
|
6786
|
+
...palette.name ? { name: palette.name } : {},
|
|
6787
|
+
...palette.maxColors != null ? { max_colors: palette.maxColors } : {}
|
|
6788
|
+
}
|
|
6789
|
+
};
|
|
6790
|
+
}
|
|
6770
6791
|
var PixelLabClient = class {
|
|
6771
6792
|
constructor(apiKey, timeoutMs = 12e4) {
|
|
6772
6793
|
this.apiKey = apiKey;
|
|
@@ -6841,6 +6862,7 @@ var PixelLabClient = class {
|
|
|
6841
6862
|
}
|
|
6842
6863
|
if (args.view) body.view = args.view;
|
|
6843
6864
|
if (args.itemDescriptions?.length) body.item_descriptions = args.itemDescriptions;
|
|
6865
|
+
Object.assign(body, targetPaletteBody(args.targetPalette));
|
|
6844
6866
|
const raw = await this.request("/create-1-direction-object", {
|
|
6845
6867
|
method: "POST",
|
|
6846
6868
|
body: JSON.stringify(body)
|
|
@@ -6908,6 +6930,7 @@ var PixelLabClient = class {
|
|
|
6908
6930
|
if (args.outlineMode) body.outline_mode = args.outlineMode;
|
|
6909
6931
|
if (args.seed != null) body.seed = args.seed;
|
|
6910
6932
|
if (args.styleImages?.length) body.style_images = args.styleImages;
|
|
6933
|
+
Object.assign(body, targetPaletteBody(args.targetPalette));
|
|
6911
6934
|
return validateResponse(
|
|
6912
6935
|
TilesSubmitSchema,
|
|
6913
6936
|
await this.request("/create-tiles-pro", { method: "POST", body: JSON.stringify(body) }),
|
|
@@ -6953,6 +6976,7 @@ var PixelLabClient = class {
|
|
|
6953
6976
|
if (args.shading) body.shading = args.shading;
|
|
6954
6977
|
if (args.detail) body.detail = args.detail;
|
|
6955
6978
|
if (args.seed != null) body.seed = args.seed;
|
|
6979
|
+
if (args.mode === "pro") Object.assign(body, targetPaletteBody(args.targetPalette));
|
|
6956
6980
|
return validateResponse(
|
|
6957
6981
|
TilesetSubmitSchema,
|
|
6958
6982
|
await this.request("/create-tileset", { method: "POST", body: JSON.stringify(body) }),
|
|
@@ -7051,6 +7075,7 @@ var PixelLabClient = class {
|
|
|
7051
7075
|
if (args.colorPalette) body.color_palette = args.colorPalette;
|
|
7052
7076
|
if (args.noBackground != null) body.no_background = args.noBackground;
|
|
7053
7077
|
if (args.seed != null) body.seed = args.seed;
|
|
7078
|
+
Object.assign(body, targetPaletteBody(args.targetPalette));
|
|
7054
7079
|
const res = await validateResponse(
|
|
7055
7080
|
UiAssetSubmitSchema,
|
|
7056
7081
|
await this.request("/create-ui-asset", { method: "POST", body: JSON.stringify(body) }),
|
|
@@ -7130,7 +7155,8 @@ var PixelLabClient = class {
|
|
|
7130
7155
|
...traits.shading !== void 0 ? { shading: traits.shading } : {}
|
|
7131
7156
|
}
|
|
7132
7157
|
} : {}
|
|
7133
|
-
} : {}
|
|
7158
|
+
} : {},
|
|
7159
|
+
...targetPaletteBody(args.targetPalette)
|
|
7134
7160
|
};
|
|
7135
7161
|
return validateResponse(
|
|
7136
7162
|
ObjectProSubmitSchema,
|
|
@@ -7145,7 +7171,8 @@ var PixelLabClient = class {
|
|
|
7145
7171
|
body: JSON.stringify({
|
|
7146
7172
|
edit_description: args.editDescription,
|
|
7147
7173
|
...args.stateName ? { state_name: args.stateName } : {},
|
|
7148
|
-
...args.seed != null ? { seed: args.seed } : {}
|
|
7174
|
+
...args.seed != null ? { seed: args.seed } : {},
|
|
7175
|
+
...targetPaletteBody(args.targetPalette)
|
|
7149
7176
|
})
|
|
7150
7177
|
});
|
|
7151
7178
|
return validateResponse(ObjectProSubmitSchema, raw, "create object state");
|
|
@@ -7171,7 +7198,8 @@ var PixelLabClient = class {
|
|
|
7171
7198
|
...args.startFrame ? { custom_start_frame: encode(args.startFrame) } : {},
|
|
7172
7199
|
...args.endFrame ? { end_frame: encode(args.endFrame) } : {},
|
|
7173
7200
|
...args.enhancePrompt ? { enhance_prompt: true } : {},
|
|
7174
|
-
...args.replaceExisting ? { replace_existing: true } : {}
|
|
7201
|
+
...args.replaceExisting ? { replace_existing: true } : {},
|
|
7202
|
+
...args.mode === "pro" ? targetPaletteBody(args.targetPalette) : {}
|
|
7175
7203
|
};
|
|
7176
7204
|
const raw = await this.request(`/objects/${encodeURIComponent(args.objectId)}/animations`, {
|
|
7177
7205
|
method: "POST",
|
|
@@ -7313,6 +7341,7 @@ var PixelLabClient = class {
|
|
|
7313
7341
|
...palette
|
|
7314
7342
|
};
|
|
7315
7343
|
}
|
|
7344
|
+
if (args.mode === "pro" || args.mode === "pro-flash") Object.assign(body, targetPaletteBody(args.targetPalette));
|
|
7316
7345
|
const raw = await this.request(path53, { method: "POST", body: JSON.stringify(body) });
|
|
7317
7346
|
return validateResponse(CharacterSubmitSchema, raw, path53.slice(1));
|
|
7318
7347
|
}
|
|
@@ -7327,7 +7356,8 @@ var PixelLabClient = class {
|
|
|
7327
7356
|
use_color_palette_from_reference: args.paletteFromReference ?? false,
|
|
7328
7357
|
...args.stateName ? { state_name: args.stateName } : {},
|
|
7329
7358
|
...args.canvas ? { override_frame_size: args.canvas } : {},
|
|
7330
|
-
...args.seed != null ? { seed: args.seed } : {}
|
|
7359
|
+
...args.seed != null ? { seed: args.seed } : {},
|
|
7360
|
+
...targetPaletteBody(args.targetPalette)
|
|
7331
7361
|
})
|
|
7332
7362
|
});
|
|
7333
7363
|
return validateResponse(CharacterSubmitSchema, raw, "create-character-state");
|
|
@@ -7396,7 +7426,8 @@ var PixelLabClient = class {
|
|
|
7396
7426
|
image: { type: "base64", base64: args.image.base64, format: args.image.format },
|
|
7397
7427
|
...args.view ? { view: args.view } : {},
|
|
7398
7428
|
...args.resultSize != null ? { result_size: args.resultSize } : {},
|
|
7399
|
-
...args.seed != null ? { seed: args.seed } : {}
|
|
7429
|
+
...args.seed != null ? { seed: args.seed } : {},
|
|
7430
|
+
...targetPaletteBody(args.targetPalette)
|
|
7400
7431
|
})
|
|
7401
7432
|
});
|
|
7402
7433
|
return validateResponse(PortraitSubmitSchema, raw, "portrait-character-pro");
|
|
@@ -7441,7 +7472,8 @@ var PixelLabClient = class {
|
|
|
7441
7472
|
image_size: args.imageSize,
|
|
7442
7473
|
...args.seed != null ? { seed: args.seed } : {},
|
|
7443
7474
|
...args.noBackground !== void 0 ? { no_background: args.noBackground } : {},
|
|
7444
|
-
...args.additionalInstructions ? { additional_instructions: args.additionalInstructions } : {}
|
|
7475
|
+
...args.additionalInstructions ? { additional_instructions: args.additionalInstructions } : {},
|
|
7476
|
+
...targetPaletteBody(args.targetPalette)
|
|
7445
7477
|
})
|
|
7446
7478
|
});
|
|
7447
7479
|
return validateResponse(TransferOutfitSubmitSchema, raw, "transfer-outfit-v2");
|
|
@@ -7560,14 +7592,7 @@ var PixelLabClient = class {
|
|
|
7560
7592
|
};
|
|
7561
7593
|
if (args.noBackground != null) body.no_background = args.noBackground;
|
|
7562
7594
|
if (args.seed != null) body.seed = args.seed;
|
|
7563
|
-
|
|
7564
|
-
if (palette && (palette.colors?.length || palette.maxColors != null)) {
|
|
7565
|
-
body.target_palette = {
|
|
7566
|
-
...palette.colors?.length ? { colors: palette.colors } : {},
|
|
7567
|
-
...palette.name ? { name: palette.name } : {},
|
|
7568
|
-
...palette.maxColors != null ? { max_colors: palette.maxColors } : {}
|
|
7569
|
-
};
|
|
7570
|
-
}
|
|
7595
|
+
Object.assign(body, targetPaletteBody(args.targetPalette));
|
|
7571
7596
|
return validateResponse(
|
|
7572
7597
|
RevisionJobSubmitSchema,
|
|
7573
7598
|
await this.request("/generate-image-v2", { method: "POST", body: JSON.stringify(body) }),
|
|
@@ -7602,6 +7627,7 @@ var PixelLabClient = class {
|
|
|
7602
7627
|
};
|
|
7603
7628
|
}
|
|
7604
7629
|
}
|
|
7630
|
+
Object.assign(body, targetPaletteBody(args.targetPalette));
|
|
7605
7631
|
return validateResponse(
|
|
7606
7632
|
ProFlashImageSubmitSchema,
|
|
7607
7633
|
await this.request("/create-image-pro-flash", { method: "POST", body: JSON.stringify(body) }),
|
|
@@ -7675,6 +7701,7 @@ var PixelLabClient = class {
|
|
|
7675
7701
|
if (args.colorPalette) body.color_palette = args.colorPalette;
|
|
7676
7702
|
if (args.noBackground != null) body.no_background = args.noBackground;
|
|
7677
7703
|
if (args.seed != null) body.seed = args.seed;
|
|
7704
|
+
Object.assign(body, targetPaletteBody(args.targetPalette));
|
|
7678
7705
|
return validateResponse(
|
|
7679
7706
|
RevisionJobSubmitSchema,
|
|
7680
7707
|
await this.request("/generate-ui-v2", { method: "POST", body: JSON.stringify(body) }),
|
|
@@ -7824,6 +7851,7 @@ var PixelLabClient = class {
|
|
|
7824
7851
|
};
|
|
7825
7852
|
if (args.seed != null) body.seed = args.seed;
|
|
7826
7853
|
if (args.noBackground != null) body.no_background = args.noBackground;
|
|
7854
|
+
Object.assign(body, targetPaletteBody(args.targetPalette));
|
|
7827
7855
|
return validateResponse(
|
|
7828
7856
|
RevisionJobSubmitSchema,
|
|
7829
7857
|
await this.request("/interpolation-v2", { method: "POST", body: JSON.stringify(body) }),
|
|
@@ -7846,6 +7874,7 @@ var PixelLabClient = class {
|
|
|
7846
7874
|
};
|
|
7847
7875
|
if (args.seed != null) body.seed = args.seed;
|
|
7848
7876
|
if (args.noBackground != null) body.no_background = args.noBackground;
|
|
7877
|
+
Object.assign(body, targetPaletteBody(args.targetPalette));
|
|
7849
7878
|
return validateResponse(
|
|
7850
7879
|
RevisionJobSubmitSchema,
|
|
7851
7880
|
await this.request("/edit-animation-v2", { method: "POST", body: JSON.stringify(body) }),
|
|
@@ -9360,8 +9389,8 @@ var PixelLabProvider = class _PixelLabProvider {
|
|
|
9360
9389
|
`PixelLab imagePro is ${spec.width}x${spec.height}; the API takes 16 to 792 wide and 16 to 688 tall (the exact ceiling also depends on aspect ratio)`
|
|
9361
9390
|
);
|
|
9362
9391
|
}
|
|
9363
|
-
if (spec.
|
|
9364
|
-
throw new Error(`PixelLab
|
|
9392
|
+
if (spec.palette.length && (spec.palette.length < 2 || spec.palette.length > 256) && sendsTargetPalette(spec)) {
|
|
9393
|
+
throw new Error(`PixelLab ${spec.generator}'s target palette takes 2 to 256 colours; the style's palette has ${spec.palette.length}`);
|
|
9365
9394
|
}
|
|
9366
9395
|
if (spec.generator === "uiAsset" && (spec.width < 192 || spec.height < 192 || spec.width > 688 || spec.height > 688)) {
|
|
9367
9396
|
throw new Error(
|
|
@@ -9811,7 +9840,8 @@ var PixelLabProvider = class _PixelLabProvider {
|
|
|
9811
9840
|
styleCharacterId: character.styleAnchor ? requireStyleObjectId(spec, context) : void 0,
|
|
9812
9841
|
styleReferenceSize: styleImage ? { width: styleImage.width, height: styleImage.height } : void 0,
|
|
9813
9842
|
styleTraits: character.styleTraits,
|
|
9814
|
-
sourceImageId: character.mode === "pro-flash" ? context?.referenceSourceImageId : void 0
|
|
9843
|
+
sourceImageId: character.mode === "pro-flash" ? context?.referenceSourceImageId : void 0,
|
|
9844
|
+
targetPalette: targetPaletteFor(spec)
|
|
9815
9845
|
});
|
|
9816
9846
|
return { jobId: res2.character_id, metadata: { character: { kind: "base", characterId: res2.character_id, mode: character.mode, directions: character.directions, backgroundJobId: res2.background_job_id } } };
|
|
9817
9847
|
}
|
|
@@ -9839,7 +9869,8 @@ var PixelLabProvider = class _PixelLabProvider {
|
|
|
9839
9869
|
imageSize: { width: spec.width, height: spec.height },
|
|
9840
9870
|
seed: spec.seed,
|
|
9841
9871
|
noBackground: spec.noBackground,
|
|
9842
|
-
additionalInstructions: outfit.additionalInstructions
|
|
9872
|
+
additionalInstructions: outfit.additionalInstructions,
|
|
9873
|
+
targetPalette: targetPaletteFor(spec)
|
|
9843
9874
|
});
|
|
9844
9875
|
return {
|
|
9845
9876
|
jobId: res2.background_job_id,
|
|
@@ -9866,7 +9897,8 @@ var PixelLabProvider = class _PixelLabProvider {
|
|
|
9866
9897
|
paletteFromReference: character.state?.paletteFromReference,
|
|
9867
9898
|
canvas: character.state?.canvas,
|
|
9868
9899
|
seed: spec.seed,
|
|
9869
|
-
noBackground: spec.noBackground
|
|
9900
|
+
noBackground: spec.noBackground,
|
|
9901
|
+
targetPalette: targetPaletteFor(spec)
|
|
9870
9902
|
});
|
|
9871
9903
|
return { jobId: res2.character_id, metadata: { character: { kind: "state", characterId: res2.character_id, parentCharacterId: parentId, mode: character.mode, directions: character.directions, backgroundJobId: res2.background_job_id } } };
|
|
9872
9904
|
}
|
|
@@ -9881,7 +9913,8 @@ var PixelLabProvider = class _PixelLabProvider {
|
|
|
9881
9913
|
image: { base64: bytes.toString("base64"), format: "png" },
|
|
9882
9914
|
view: spec.view,
|
|
9883
9915
|
resultSize: character.portrait.size,
|
|
9884
|
-
seed: spec.seed
|
|
9916
|
+
seed: spec.seed,
|
|
9917
|
+
targetPalette: targetPaletteFor(spec)
|
|
9885
9918
|
});
|
|
9886
9919
|
return {
|
|
9887
9920
|
jobId: res2.background_job_id,
|
|
@@ -9956,7 +9989,8 @@ var PixelLabProvider = class _PixelLabProvider {
|
|
|
9956
9989
|
styleReference: styleImage ? { base64: styleImage.base64, format: styleImage.format } : void 0,
|
|
9957
9990
|
styleReferenceSize: styleImage ? { width: styleImage.width, height: styleImage.height } : void 0,
|
|
9958
9991
|
styleTraits: object.styleTraits,
|
|
9959
|
-
sourceImageId: context?.referenceSourceImageId
|
|
9992
|
+
sourceImageId: context?.referenceSourceImageId,
|
|
9993
|
+
targetPalette: targetPaletteFor(spec)
|
|
9960
9994
|
});
|
|
9961
9995
|
return { jobId: res2.object_id, metadata: { objectPro: { kind: "base", objectId: res2.object_id, directions: object.directions, backgroundJobId: res2.background_job_id } } };
|
|
9962
9996
|
}
|
|
@@ -9971,7 +10005,8 @@ var PixelLabProvider = class _PixelLabProvider {
|
|
|
9971
10005
|
objectId: parentId,
|
|
9972
10006
|
editDescription: spec.prompt,
|
|
9973
10007
|
stateName: spec.assetId.slice(0, 50),
|
|
9974
|
-
seed: spec.seed
|
|
10008
|
+
seed: spec.seed,
|
|
10009
|
+
targetPalette: targetPaletteFor(spec)
|
|
9975
10010
|
});
|
|
9976
10011
|
return { jobId: res2.object_id, metadata: { objectPro: { kind: "state", objectId: res2.object_id, parentObjectId: parentId, directions: object.directions, backgroundJobId: res2.background_job_id } } };
|
|
9977
10012
|
}
|
|
@@ -9989,7 +10024,8 @@ var PixelLabProvider = class _PixelLabProvider {
|
|
|
9989
10024
|
startFrame: animation.startFrame ? readPose(spec, "start frame", animation.startFrame) : void 0,
|
|
9990
10025
|
endFrame: animation.endFrame ? readPose(spec, "end frame", animation.endFrame) : void 0,
|
|
9991
10026
|
enhancePrompt: animation.enhancePrompt,
|
|
9992
|
-
replaceExisting: true
|
|
10027
|
+
replaceExisting: true,
|
|
10028
|
+
targetPalette: targetPaletteFor(spec)
|
|
9993
10029
|
});
|
|
9994
10030
|
const submission = res.submissions.find((s) => s.direction === animation.direction) ?? res.submissions[0];
|
|
9995
10031
|
const job = { objectId: parentId, name, direction: animation.direction, jobId: submission?.background_job_id ?? null };
|
|
@@ -10255,7 +10291,8 @@ var PixelLabProvider = class _PixelLabProvider {
|
|
|
10255
10291
|
styleImage: styleImages[0] ? { base64: styleImages[0].base64, format: styleImages[0].format } : void 0,
|
|
10256
10292
|
colorPalette: spec.uiColorPalette,
|
|
10257
10293
|
noBackground: spec.noBackground,
|
|
10258
|
-
seed: spec.seed
|
|
10294
|
+
seed: spec.seed,
|
|
10295
|
+
targetPalette: targetPaletteFor(spec)
|
|
10259
10296
|
});
|
|
10260
10297
|
return { jobId: res2.ui_asset_id, metadata: { backgroundJobId: res2.background_job_id } };
|
|
10261
10298
|
}
|
|
@@ -10268,7 +10305,8 @@ var PixelLabProvider = class _PixelLabProvider {
|
|
|
10268
10305
|
noBackground: spec.noBackground,
|
|
10269
10306
|
seed: spec.seed,
|
|
10270
10307
|
styleImage: style ? { image: { base64: style.base64, format: style.format }, width: style.width, height: style.height } : void 0,
|
|
10271
|
-
styleTraits: spec.styleTraits
|
|
10308
|
+
styleTraits: spec.styleTraits,
|
|
10309
|
+
targetPalette: targetPaletteFor(spec)
|
|
10272
10310
|
});
|
|
10273
10311
|
return { jobId: res2.background_job_id, metadata: { imageProFlash: proFlashRecord(res2) } };
|
|
10274
10312
|
}
|
|
@@ -10281,7 +10319,8 @@ var PixelLabProvider = class _PixelLabProvider {
|
|
|
10281
10319
|
conceptImage: concept ? { image: { base64: concept.base64, format: concept.format }, width: concept.width, height: concept.height } : void 0,
|
|
10282
10320
|
colorPalette: spec.uiColorPalette,
|
|
10283
10321
|
noBackground: spec.noBackground,
|
|
10284
|
-
seed: spec.seed
|
|
10322
|
+
seed: spec.seed,
|
|
10323
|
+
targetPalette: targetPaletteFor(spec)
|
|
10285
10324
|
});
|
|
10286
10325
|
return { jobId: res2.background_job_id };
|
|
10287
10326
|
}
|
|
@@ -10321,7 +10360,8 @@ var PixelLabProvider = class _PixelLabProvider {
|
|
|
10321
10360
|
seed: spec.seed,
|
|
10322
10361
|
// TilesProStyleImage is flat and wants the reference's real dimensions,
|
|
10323
10362
|
// unlike 1dir's {type, base64, format} payload.
|
|
10324
|
-
styleImages: styleImages.map(({ base64, width, height }) => ({ base64, width, height }))
|
|
10363
|
+
styleImages: styleImages.map(({ base64, width, height }) => ({ base64, width, height })),
|
|
10364
|
+
targetPalette: targetPaletteFor(spec)
|
|
10325
10365
|
});
|
|
10326
10366
|
return { jobId: res2.tile_id, metadata: { backgroundJobId: res2.background_job_id } };
|
|
10327
10367
|
}
|
|
@@ -10370,7 +10410,8 @@ var PixelLabProvider = class _PixelLabProvider {
|
|
|
10370
10410
|
outline: spec.outline,
|
|
10371
10411
|
shading: spec.shading,
|
|
10372
10412
|
detail: spec.detail,
|
|
10373
|
-
seed: spec.seed
|
|
10413
|
+
seed: spec.seed,
|
|
10414
|
+
targetPalette: targetPaletteFor(spec)
|
|
10374
10415
|
});
|
|
10375
10416
|
return {
|
|
10376
10417
|
jobId: res2.tileset_id,
|
|
@@ -10401,7 +10442,7 @@ var PixelLabProvider = class _PixelLabProvider {
|
|
|
10401
10442
|
height: spec.height,
|
|
10402
10443
|
noBackground: spec.noBackground,
|
|
10403
10444
|
seed: spec.seed,
|
|
10404
|
-
targetPalette:
|
|
10445
|
+
targetPalette: targetPaletteFor(spec)
|
|
10405
10446
|
});
|
|
10406
10447
|
return { jobId: res2.background_job_id };
|
|
10407
10448
|
}
|
|
@@ -10420,7 +10461,8 @@ var PixelLabProvider = class _PixelLabProvider {
|
|
|
10420
10461
|
// items at frames 0/1/2, in order; docs/GENERATORS.md#1dir), so
|
|
10421
10462
|
// sending the same text as `description` too is redundant but
|
|
10422
10463
|
// harmless, not a hedge against ambiguity.
|
|
10423
|
-
itemDescriptions: spec.batch?.role === "leader" ? spec.batch.itemDescriptions : void 0
|
|
10464
|
+
itemDescriptions: spec.batch?.role === "leader" ? spec.batch.itemDescriptions : void 0,
|
|
10465
|
+
targetPalette: targetPaletteFor(spec)
|
|
10424
10466
|
});
|
|
10425
10467
|
return { jobId: res2.object_id, metadata: { backgroundJobId: res2.background_job_id } };
|
|
10426
10468
|
}
|
|
@@ -10562,7 +10604,8 @@ var PixelLabProvider = class _PixelLabProvider {
|
|
|
10562
10604
|
height,
|
|
10563
10605
|
action: spec.prompt,
|
|
10564
10606
|
seed: spec.seed,
|
|
10565
|
-
noBackground: spec.noBackground
|
|
10607
|
+
noBackground: spec.noBackground,
|
|
10608
|
+
targetPalette: targetPaletteFor(spec)
|
|
10566
10609
|
});
|
|
10567
10610
|
return { jobId: res2.background_job_id };
|
|
10568
10611
|
}
|
|
@@ -10573,7 +10616,8 @@ var PixelLabProvider = class _PixelLabProvider {
|
|
|
10573
10616
|
height,
|
|
10574
10617
|
description: spec.prompt,
|
|
10575
10618
|
seed: spec.seed,
|
|
10576
|
-
noBackground: spec.noBackground
|
|
10619
|
+
noBackground: spec.noBackground,
|
|
10620
|
+
targetPalette: targetPaletteFor(spec)
|
|
10577
10621
|
});
|
|
10578
10622
|
return { jobId: res2.background_job_id };
|
|
10579
10623
|
}
|
|
@@ -11518,6 +11562,39 @@ function remoteCharacter(character) {
|
|
|
11518
11562
|
animationCount: character.animation_count
|
|
11519
11563
|
};
|
|
11520
11564
|
}
|
|
11565
|
+
function sendsTargetPalette(spec) {
|
|
11566
|
+
if (spec.revision) return spec.revision.mode === "interpolate" || spec.revision.mode === "edit-animation";
|
|
11567
|
+
if (spec.vfx) return false;
|
|
11568
|
+
switch (spec.generator) {
|
|
11569
|
+
case "imagePro":
|
|
11570
|
+
case "imageProFlash":
|
|
11571
|
+
case "1dir":
|
|
11572
|
+
case "tiles":
|
|
11573
|
+
case "uiAsset":
|
|
11574
|
+
case "uiElement":
|
|
11575
|
+
return true;
|
|
11576
|
+
case "terrain":
|
|
11577
|
+
return spec.terrainOrientation !== "sidescroller" && spec.terrainMode === "pro";
|
|
11578
|
+
case "character": {
|
|
11579
|
+
const character = spec.character;
|
|
11580
|
+
if (!character) return false;
|
|
11581
|
+
if (character.kind === "base") return character.mode === "pro" || character.mode === "pro-flash";
|
|
11582
|
+
return character.kind !== "animation";
|
|
11583
|
+
}
|
|
11584
|
+
case "objectPro": {
|
|
11585
|
+
const object = spec.objectPro;
|
|
11586
|
+
if (!object) return false;
|
|
11587
|
+
return object.kind !== "animation" || object.animation?.mode === "pro";
|
|
11588
|
+
}
|
|
11589
|
+
default:
|
|
11590
|
+
return false;
|
|
11591
|
+
}
|
|
11592
|
+
}
|
|
11593
|
+
function targetPaletteFor(spec) {
|
|
11594
|
+
if (!sendsTargetPalette(spec)) return void 0;
|
|
11595
|
+
if (!spec.palette.length && spec.maxColors == null) return void 0;
|
|
11596
|
+
return { colors: spec.palette, name: spec.paletteName, maxColors: spec.maxColors };
|
|
11597
|
+
}
|
|
11521
11598
|
function requirePixelLabOption(generator, name, value, allowed) {
|
|
11522
11599
|
if (value != null && !allowed.includes(value)) {
|
|
11523
11600
|
throw new Error(`PixelLab ${generator} ${name} must be one of: ${allowed.join(", ")}`);
|
|
@@ -13231,8 +13308,8 @@ async function resolveSpecs(loaded, filter) {
|
|
|
13231
13308
|
uiColorPalette: generator === "uiAsset" || generator === "uiElement" ? style.uiColorPalette : void 0,
|
|
13232
13309
|
...generator === "imageProFlash" && style.styleTraits ? { styleTraits: style.styleTraits } : {},
|
|
13233
13310
|
palette: style.palette,
|
|
13234
|
-
...
|
|
13235
|
-
...
|
|
13311
|
+
...style.paletteName ? { paletteName: style.paletteName } : {},
|
|
13312
|
+
...style.maxColors != null ? { maxColors: style.maxColors } : {},
|
|
13236
13313
|
enforcePalette: style.enforcePalette,
|
|
13237
13314
|
noBackground: style.noBackground,
|
|
13238
13315
|
tileSize: generator === "tiles" ? tileSize : void 0,
|