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/index.js
CHANGED
|
@@ -2,6 +2,17 @@
|
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
var MediaTypeSchema = z.enum(["image/png", "image/gif"]);
|
|
4
4
|
var GeneratorSchema = z.enum(["1dir", "map", "pixflux", "tiles", "animation", "frames", "character", "terrain", "imagePro", "isometricTile", "objectPro", "uiAsset", "uiElement", "imageProFlash", "vfx"]);
|
|
5
|
+
var TARGET_PALETTE_GENERATORS = [
|
|
6
|
+
"imagePro",
|
|
7
|
+
"imageProFlash",
|
|
8
|
+
"objectPro",
|
|
9
|
+
"1dir",
|
|
10
|
+
"character",
|
|
11
|
+
"tiles",
|
|
12
|
+
"terrain",
|
|
13
|
+
"uiAsset",
|
|
14
|
+
"uiElement"
|
|
15
|
+
];
|
|
5
16
|
var GridConfidenceSchema = z.enum(["low", "medium", "high"]);
|
|
6
17
|
var RevisionModeSchema = z.enum([
|
|
7
18
|
"image-to-image",
|
|
@@ -958,8 +969,8 @@ var StyleObjectSchema = z.object({
|
|
|
958
969
|
seed: z.number().int().optional(),
|
|
959
970
|
/**
|
|
960
971
|
* Forced palette, as `#rrggbb` values. Sent as a swatch to `pixflux`
|
|
961
|
-
* and the generators that take one, and
|
|
962
|
-
*
|
|
972
|
+
* and the generators that take one, and as `target_palette.colors` (2 to
|
|
973
|
+
* 256 colours) to every PixelLab call that takes it (`TARGET_PALETTE_GENERATORS`).
|
|
963
974
|
*
|
|
964
975
|
* Unlike prose, this is a hard constraint. The API is handed a swatch
|
|
965
976
|
* image and the output is limited to those colours. Verified: a four-colour
|
|
@@ -969,9 +980,9 @@ var StyleObjectSchema = z.object({
|
|
|
969
980
|
* chocolate bar.
|
|
970
981
|
*/
|
|
971
982
|
palette: z.array(HexColorSchema).default([]),
|
|
972
|
-
/** `
|
|
983
|
+
/** `target_palette.name` ("Game Boy", "PICO-8"), which PixelLab uses to help the look. Needs `palette`; generators in `TARGET_PALETTE_GENERATORS` only. */
|
|
973
984
|
paletteName: z.string().min(1).max(100).optional(),
|
|
974
|
-
/** `
|
|
985
|
+
/** `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. */
|
|
975
986
|
maxColors: z.number().int().min(2).max(64).optional(),
|
|
976
987
|
/**
|
|
977
988
|
* Snap every visible pixel of the downloaded art to the nearest `palette`
|
|
@@ -1027,10 +1038,10 @@ var StyleSchema = StyleObjectSchema.refine((s) => !(s.tileFeature && s.styleImag
|
|
|
1027
1038
|
});
|
|
1028
1039
|
}
|
|
1029
1040
|
for (const field of ["paletteName", "maxColors"]) {
|
|
1030
|
-
if (style[field] !== void 0 && style.generator
|
|
1041
|
+
if (style[field] !== void 0 && !TARGET_PALETTE_GENERATORS.includes(style.generator)) {
|
|
1031
1042
|
ctx.addIssue({
|
|
1032
1043
|
code: z.ZodIssueCode.custom,
|
|
1033
|
-
message: `${field} applies to the
|
|
1044
|
+
message: `${field} applies to the ${TARGET_PALETTE_GENERATORS.join(", ")} generators only`,
|
|
1034
1045
|
path: [field]
|
|
1035
1046
|
});
|
|
1036
1047
|
}
|
|
@@ -2078,6 +2089,16 @@ function proportionsPayload(proportions) {
|
|
|
2078
2089
|
...proportions.hipWidth !== void 0 ? { hip_width: proportions.hipWidth } : {}
|
|
2079
2090
|
};
|
|
2080
2091
|
}
|
|
2092
|
+
function targetPaletteBody(palette) {
|
|
2093
|
+
if (!palette || !(palette.colors?.length || palette.maxColors != null)) return {};
|
|
2094
|
+
return {
|
|
2095
|
+
target_palette: {
|
|
2096
|
+
...palette.colors?.length ? { colors: palette.colors } : {},
|
|
2097
|
+
...palette.name ? { name: palette.name } : {},
|
|
2098
|
+
...palette.maxColors != null ? { max_colors: palette.maxColors } : {}
|
|
2099
|
+
}
|
|
2100
|
+
};
|
|
2101
|
+
}
|
|
2081
2102
|
var PixelLabClient = class {
|
|
2082
2103
|
constructor(apiKey, timeoutMs = 12e4) {
|
|
2083
2104
|
this.apiKey = apiKey;
|
|
@@ -2152,6 +2173,7 @@ var PixelLabClient = class {
|
|
|
2152
2173
|
}
|
|
2153
2174
|
if (args.view) body.view = args.view;
|
|
2154
2175
|
if (args.itemDescriptions?.length) body.item_descriptions = args.itemDescriptions;
|
|
2176
|
+
Object.assign(body, targetPaletteBody(args.targetPalette));
|
|
2155
2177
|
const raw = await this.request("/create-1-direction-object", {
|
|
2156
2178
|
method: "POST",
|
|
2157
2179
|
body: JSON.stringify(body)
|
|
@@ -2219,6 +2241,7 @@ var PixelLabClient = class {
|
|
|
2219
2241
|
if (args.outlineMode) body.outline_mode = args.outlineMode;
|
|
2220
2242
|
if (args.seed != null) body.seed = args.seed;
|
|
2221
2243
|
if (args.styleImages?.length) body.style_images = args.styleImages;
|
|
2244
|
+
Object.assign(body, targetPaletteBody(args.targetPalette));
|
|
2222
2245
|
return validateResponse(
|
|
2223
2246
|
TilesSubmitSchema,
|
|
2224
2247
|
await this.request("/create-tiles-pro", { method: "POST", body: JSON.stringify(body) }),
|
|
@@ -2264,6 +2287,7 @@ var PixelLabClient = class {
|
|
|
2264
2287
|
if (args.shading) body.shading = args.shading;
|
|
2265
2288
|
if (args.detail) body.detail = args.detail;
|
|
2266
2289
|
if (args.seed != null) body.seed = args.seed;
|
|
2290
|
+
if (args.mode === "pro") Object.assign(body, targetPaletteBody(args.targetPalette));
|
|
2267
2291
|
return validateResponse(
|
|
2268
2292
|
TilesetSubmitSchema,
|
|
2269
2293
|
await this.request("/create-tileset", { method: "POST", body: JSON.stringify(body) }),
|
|
@@ -2362,6 +2386,7 @@ var PixelLabClient = class {
|
|
|
2362
2386
|
if (args.colorPalette) body.color_palette = args.colorPalette;
|
|
2363
2387
|
if (args.noBackground != null) body.no_background = args.noBackground;
|
|
2364
2388
|
if (args.seed != null) body.seed = args.seed;
|
|
2389
|
+
Object.assign(body, targetPaletteBody(args.targetPalette));
|
|
2365
2390
|
const res = await validateResponse(
|
|
2366
2391
|
UiAssetSubmitSchema,
|
|
2367
2392
|
await this.request("/create-ui-asset", { method: "POST", body: JSON.stringify(body) }),
|
|
@@ -2441,7 +2466,8 @@ var PixelLabClient = class {
|
|
|
2441
2466
|
...traits.shading !== void 0 ? { shading: traits.shading } : {}
|
|
2442
2467
|
}
|
|
2443
2468
|
} : {}
|
|
2444
|
-
} : {}
|
|
2469
|
+
} : {},
|
|
2470
|
+
...targetPaletteBody(args.targetPalette)
|
|
2445
2471
|
};
|
|
2446
2472
|
return validateResponse(
|
|
2447
2473
|
ObjectProSubmitSchema,
|
|
@@ -2456,7 +2482,8 @@ var PixelLabClient = class {
|
|
|
2456
2482
|
body: JSON.stringify({
|
|
2457
2483
|
edit_description: args.editDescription,
|
|
2458
2484
|
...args.stateName ? { state_name: args.stateName } : {},
|
|
2459
|
-
...args.seed != null ? { seed: args.seed } : {}
|
|
2485
|
+
...args.seed != null ? { seed: args.seed } : {},
|
|
2486
|
+
...targetPaletteBody(args.targetPalette)
|
|
2460
2487
|
})
|
|
2461
2488
|
});
|
|
2462
2489
|
return validateResponse(ObjectProSubmitSchema, raw, "create object state");
|
|
@@ -2482,7 +2509,8 @@ var PixelLabClient = class {
|
|
|
2482
2509
|
...args.startFrame ? { custom_start_frame: encode(args.startFrame) } : {},
|
|
2483
2510
|
...args.endFrame ? { end_frame: encode(args.endFrame) } : {},
|
|
2484
2511
|
...args.enhancePrompt ? { enhance_prompt: true } : {},
|
|
2485
|
-
...args.replaceExisting ? { replace_existing: true } : {}
|
|
2512
|
+
...args.replaceExisting ? { replace_existing: true } : {},
|
|
2513
|
+
...args.mode === "pro" ? targetPaletteBody(args.targetPalette) : {}
|
|
2486
2514
|
};
|
|
2487
2515
|
const raw = await this.request(`/objects/${encodeURIComponent(args.objectId)}/animations`, {
|
|
2488
2516
|
method: "POST",
|
|
@@ -2624,6 +2652,7 @@ var PixelLabClient = class {
|
|
|
2624
2652
|
...palette
|
|
2625
2653
|
};
|
|
2626
2654
|
}
|
|
2655
|
+
if (args.mode === "pro" || args.mode === "pro-flash") Object.assign(body, targetPaletteBody(args.targetPalette));
|
|
2627
2656
|
const raw = await this.request(path39, { method: "POST", body: JSON.stringify(body) });
|
|
2628
2657
|
return validateResponse(CharacterSubmitSchema, raw, path39.slice(1));
|
|
2629
2658
|
}
|
|
@@ -2638,7 +2667,8 @@ var PixelLabClient = class {
|
|
|
2638
2667
|
use_color_palette_from_reference: args.paletteFromReference ?? false,
|
|
2639
2668
|
...args.stateName ? { state_name: args.stateName } : {},
|
|
2640
2669
|
...args.canvas ? { override_frame_size: args.canvas } : {},
|
|
2641
|
-
...args.seed != null ? { seed: args.seed } : {}
|
|
2670
|
+
...args.seed != null ? { seed: args.seed } : {},
|
|
2671
|
+
...targetPaletteBody(args.targetPalette)
|
|
2642
2672
|
})
|
|
2643
2673
|
});
|
|
2644
2674
|
return validateResponse(CharacterSubmitSchema, raw, "create-character-state");
|
|
@@ -2707,7 +2737,8 @@ var PixelLabClient = class {
|
|
|
2707
2737
|
image: { type: "base64", base64: args.image.base64, format: args.image.format },
|
|
2708
2738
|
...args.view ? { view: args.view } : {},
|
|
2709
2739
|
...args.resultSize != null ? { result_size: args.resultSize } : {},
|
|
2710
|
-
...args.seed != null ? { seed: args.seed } : {}
|
|
2740
|
+
...args.seed != null ? { seed: args.seed } : {},
|
|
2741
|
+
...targetPaletteBody(args.targetPalette)
|
|
2711
2742
|
})
|
|
2712
2743
|
});
|
|
2713
2744
|
return validateResponse(PortraitSubmitSchema, raw, "portrait-character-pro");
|
|
@@ -2752,7 +2783,8 @@ var PixelLabClient = class {
|
|
|
2752
2783
|
image_size: args.imageSize,
|
|
2753
2784
|
...args.seed != null ? { seed: args.seed } : {},
|
|
2754
2785
|
...args.noBackground !== void 0 ? { no_background: args.noBackground } : {},
|
|
2755
|
-
...args.additionalInstructions ? { additional_instructions: args.additionalInstructions } : {}
|
|
2786
|
+
...args.additionalInstructions ? { additional_instructions: args.additionalInstructions } : {},
|
|
2787
|
+
...targetPaletteBody(args.targetPalette)
|
|
2756
2788
|
})
|
|
2757
2789
|
});
|
|
2758
2790
|
return validateResponse(TransferOutfitSubmitSchema, raw, "transfer-outfit-v2");
|
|
@@ -2871,14 +2903,7 @@ var PixelLabClient = class {
|
|
|
2871
2903
|
};
|
|
2872
2904
|
if (args.noBackground != null) body.no_background = args.noBackground;
|
|
2873
2905
|
if (args.seed != null) body.seed = args.seed;
|
|
2874
|
-
|
|
2875
|
-
if (palette && (palette.colors?.length || palette.maxColors != null)) {
|
|
2876
|
-
body.target_palette = {
|
|
2877
|
-
...palette.colors?.length ? { colors: palette.colors } : {},
|
|
2878
|
-
...palette.name ? { name: palette.name } : {},
|
|
2879
|
-
...palette.maxColors != null ? { max_colors: palette.maxColors } : {}
|
|
2880
|
-
};
|
|
2881
|
-
}
|
|
2906
|
+
Object.assign(body, targetPaletteBody(args.targetPalette));
|
|
2882
2907
|
return validateResponse(
|
|
2883
2908
|
RevisionJobSubmitSchema,
|
|
2884
2909
|
await this.request("/generate-image-v2", { method: "POST", body: JSON.stringify(body) }),
|
|
@@ -2913,6 +2938,7 @@ var PixelLabClient = class {
|
|
|
2913
2938
|
};
|
|
2914
2939
|
}
|
|
2915
2940
|
}
|
|
2941
|
+
Object.assign(body, targetPaletteBody(args.targetPalette));
|
|
2916
2942
|
return validateResponse(
|
|
2917
2943
|
ProFlashImageSubmitSchema,
|
|
2918
2944
|
await this.request("/create-image-pro-flash", { method: "POST", body: JSON.stringify(body) }),
|
|
@@ -2986,6 +3012,7 @@ var PixelLabClient = class {
|
|
|
2986
3012
|
if (args.colorPalette) body.color_palette = args.colorPalette;
|
|
2987
3013
|
if (args.noBackground != null) body.no_background = args.noBackground;
|
|
2988
3014
|
if (args.seed != null) body.seed = args.seed;
|
|
3015
|
+
Object.assign(body, targetPaletteBody(args.targetPalette));
|
|
2989
3016
|
return validateResponse(
|
|
2990
3017
|
RevisionJobSubmitSchema,
|
|
2991
3018
|
await this.request("/generate-ui-v2", { method: "POST", body: JSON.stringify(body) }),
|
|
@@ -3135,6 +3162,7 @@ var PixelLabClient = class {
|
|
|
3135
3162
|
};
|
|
3136
3163
|
if (args.seed != null) body.seed = args.seed;
|
|
3137
3164
|
if (args.noBackground != null) body.no_background = args.noBackground;
|
|
3165
|
+
Object.assign(body, targetPaletteBody(args.targetPalette));
|
|
3138
3166
|
return validateResponse(
|
|
3139
3167
|
RevisionJobSubmitSchema,
|
|
3140
3168
|
await this.request("/interpolation-v2", { method: "POST", body: JSON.stringify(body) }),
|
|
@@ -3157,6 +3185,7 @@ var PixelLabClient = class {
|
|
|
3157
3185
|
};
|
|
3158
3186
|
if (args.seed != null) body.seed = args.seed;
|
|
3159
3187
|
if (args.noBackground != null) body.no_background = args.noBackground;
|
|
3188
|
+
Object.assign(body, targetPaletteBody(args.targetPalette));
|
|
3160
3189
|
return validateResponse(
|
|
3161
3190
|
RevisionJobSubmitSchema,
|
|
3162
3191
|
await this.request("/edit-animation-v2", { method: "POST", body: JSON.stringify(body) }),
|
|
@@ -5407,8 +5436,8 @@ var PixelLabProvider = class _PixelLabProvider {
|
|
|
5407
5436
|
`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)`
|
|
5408
5437
|
);
|
|
5409
5438
|
}
|
|
5410
|
-
if (spec.
|
|
5411
|
-
throw new Error(`PixelLab
|
|
5439
|
+
if (spec.palette.length && (spec.palette.length < 2 || spec.palette.length > 256) && sendsTargetPalette(spec)) {
|
|
5440
|
+
throw new Error(`PixelLab ${spec.generator}'s target palette takes 2 to 256 colours; the style's palette has ${spec.palette.length}`);
|
|
5412
5441
|
}
|
|
5413
5442
|
if (spec.generator === "uiAsset" && (spec.width < 192 || spec.height < 192 || spec.width > 688 || spec.height > 688)) {
|
|
5414
5443
|
throw new Error(
|
|
@@ -5858,7 +5887,8 @@ var PixelLabProvider = class _PixelLabProvider {
|
|
|
5858
5887
|
styleCharacterId: character.styleAnchor ? requireStyleObjectId(spec, context) : void 0,
|
|
5859
5888
|
styleReferenceSize: styleImage ? { width: styleImage.width, height: styleImage.height } : void 0,
|
|
5860
5889
|
styleTraits: character.styleTraits,
|
|
5861
|
-
sourceImageId: character.mode === "pro-flash" ? context?.referenceSourceImageId : void 0
|
|
5890
|
+
sourceImageId: character.mode === "pro-flash" ? context?.referenceSourceImageId : void 0,
|
|
5891
|
+
targetPalette: targetPaletteFor(spec)
|
|
5862
5892
|
});
|
|
5863
5893
|
return { jobId: res2.character_id, metadata: { character: { kind: "base", characterId: res2.character_id, mode: character.mode, directions: character.directions, backgroundJobId: res2.background_job_id } } };
|
|
5864
5894
|
}
|
|
@@ -5886,7 +5916,8 @@ var PixelLabProvider = class _PixelLabProvider {
|
|
|
5886
5916
|
imageSize: { width: spec.width, height: spec.height },
|
|
5887
5917
|
seed: spec.seed,
|
|
5888
5918
|
noBackground: spec.noBackground,
|
|
5889
|
-
additionalInstructions: outfit.additionalInstructions
|
|
5919
|
+
additionalInstructions: outfit.additionalInstructions,
|
|
5920
|
+
targetPalette: targetPaletteFor(spec)
|
|
5890
5921
|
});
|
|
5891
5922
|
return {
|
|
5892
5923
|
jobId: res2.background_job_id,
|
|
@@ -5913,7 +5944,8 @@ var PixelLabProvider = class _PixelLabProvider {
|
|
|
5913
5944
|
paletteFromReference: character.state?.paletteFromReference,
|
|
5914
5945
|
canvas: character.state?.canvas,
|
|
5915
5946
|
seed: spec.seed,
|
|
5916
|
-
noBackground: spec.noBackground
|
|
5947
|
+
noBackground: spec.noBackground,
|
|
5948
|
+
targetPalette: targetPaletteFor(spec)
|
|
5917
5949
|
});
|
|
5918
5950
|
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 } } };
|
|
5919
5951
|
}
|
|
@@ -5928,7 +5960,8 @@ var PixelLabProvider = class _PixelLabProvider {
|
|
|
5928
5960
|
image: { base64: bytes.toString("base64"), format: "png" },
|
|
5929
5961
|
view: spec.view,
|
|
5930
5962
|
resultSize: character.portrait.size,
|
|
5931
|
-
seed: spec.seed
|
|
5963
|
+
seed: spec.seed,
|
|
5964
|
+
targetPalette: targetPaletteFor(spec)
|
|
5932
5965
|
});
|
|
5933
5966
|
return {
|
|
5934
5967
|
jobId: res2.background_job_id,
|
|
@@ -6003,7 +6036,8 @@ var PixelLabProvider = class _PixelLabProvider {
|
|
|
6003
6036
|
styleReference: styleImage ? { base64: styleImage.base64, format: styleImage.format } : void 0,
|
|
6004
6037
|
styleReferenceSize: styleImage ? { width: styleImage.width, height: styleImage.height } : void 0,
|
|
6005
6038
|
styleTraits: object.styleTraits,
|
|
6006
|
-
sourceImageId: context?.referenceSourceImageId
|
|
6039
|
+
sourceImageId: context?.referenceSourceImageId,
|
|
6040
|
+
targetPalette: targetPaletteFor(spec)
|
|
6007
6041
|
});
|
|
6008
6042
|
return { jobId: res2.object_id, metadata: { objectPro: { kind: "base", objectId: res2.object_id, directions: object.directions, backgroundJobId: res2.background_job_id } } };
|
|
6009
6043
|
}
|
|
@@ -6018,7 +6052,8 @@ var PixelLabProvider = class _PixelLabProvider {
|
|
|
6018
6052
|
objectId: parentId,
|
|
6019
6053
|
editDescription: spec.prompt,
|
|
6020
6054
|
stateName: spec.assetId.slice(0, 50),
|
|
6021
|
-
seed: spec.seed
|
|
6055
|
+
seed: spec.seed,
|
|
6056
|
+
targetPalette: targetPaletteFor(spec)
|
|
6022
6057
|
});
|
|
6023
6058
|
return { jobId: res2.object_id, metadata: { objectPro: { kind: "state", objectId: res2.object_id, parentObjectId: parentId, directions: object.directions, backgroundJobId: res2.background_job_id } } };
|
|
6024
6059
|
}
|
|
@@ -6036,7 +6071,8 @@ var PixelLabProvider = class _PixelLabProvider {
|
|
|
6036
6071
|
startFrame: animation.startFrame ? readPose(spec, "start frame", animation.startFrame) : void 0,
|
|
6037
6072
|
endFrame: animation.endFrame ? readPose(spec, "end frame", animation.endFrame) : void 0,
|
|
6038
6073
|
enhancePrompt: animation.enhancePrompt,
|
|
6039
|
-
replaceExisting: true
|
|
6074
|
+
replaceExisting: true,
|
|
6075
|
+
targetPalette: targetPaletteFor(spec)
|
|
6040
6076
|
});
|
|
6041
6077
|
const submission = res.submissions.find((s) => s.direction === animation.direction) ?? res.submissions[0];
|
|
6042
6078
|
const job = { objectId: parentId, name, direction: animation.direction, jobId: submission?.background_job_id ?? null };
|
|
@@ -6302,7 +6338,8 @@ var PixelLabProvider = class _PixelLabProvider {
|
|
|
6302
6338
|
styleImage: styleImages[0] ? { base64: styleImages[0].base64, format: styleImages[0].format } : void 0,
|
|
6303
6339
|
colorPalette: spec.uiColorPalette,
|
|
6304
6340
|
noBackground: spec.noBackground,
|
|
6305
|
-
seed: spec.seed
|
|
6341
|
+
seed: spec.seed,
|
|
6342
|
+
targetPalette: targetPaletteFor(spec)
|
|
6306
6343
|
});
|
|
6307
6344
|
return { jobId: res2.ui_asset_id, metadata: { backgroundJobId: res2.background_job_id } };
|
|
6308
6345
|
}
|
|
@@ -6315,7 +6352,8 @@ var PixelLabProvider = class _PixelLabProvider {
|
|
|
6315
6352
|
noBackground: spec.noBackground,
|
|
6316
6353
|
seed: spec.seed,
|
|
6317
6354
|
styleImage: style ? { image: { base64: style.base64, format: style.format }, width: style.width, height: style.height } : void 0,
|
|
6318
|
-
styleTraits: spec.styleTraits
|
|
6355
|
+
styleTraits: spec.styleTraits,
|
|
6356
|
+
targetPalette: targetPaletteFor(spec)
|
|
6319
6357
|
});
|
|
6320
6358
|
return { jobId: res2.background_job_id, metadata: { imageProFlash: proFlashRecord(res2) } };
|
|
6321
6359
|
}
|
|
@@ -6328,7 +6366,8 @@ var PixelLabProvider = class _PixelLabProvider {
|
|
|
6328
6366
|
conceptImage: concept ? { image: { base64: concept.base64, format: concept.format }, width: concept.width, height: concept.height } : void 0,
|
|
6329
6367
|
colorPalette: spec.uiColorPalette,
|
|
6330
6368
|
noBackground: spec.noBackground,
|
|
6331
|
-
seed: spec.seed
|
|
6369
|
+
seed: spec.seed,
|
|
6370
|
+
targetPalette: targetPaletteFor(spec)
|
|
6332
6371
|
});
|
|
6333
6372
|
return { jobId: res2.background_job_id };
|
|
6334
6373
|
}
|
|
@@ -6368,7 +6407,8 @@ var PixelLabProvider = class _PixelLabProvider {
|
|
|
6368
6407
|
seed: spec.seed,
|
|
6369
6408
|
// TilesProStyleImage is flat and wants the reference's real dimensions,
|
|
6370
6409
|
// unlike 1dir's {type, base64, format} payload.
|
|
6371
|
-
styleImages: styleImages.map(({ base64, width, height }) => ({ base64, width, height }))
|
|
6410
|
+
styleImages: styleImages.map(({ base64, width, height }) => ({ base64, width, height })),
|
|
6411
|
+
targetPalette: targetPaletteFor(spec)
|
|
6372
6412
|
});
|
|
6373
6413
|
return { jobId: res2.tile_id, metadata: { backgroundJobId: res2.background_job_id } };
|
|
6374
6414
|
}
|
|
@@ -6417,7 +6457,8 @@ var PixelLabProvider = class _PixelLabProvider {
|
|
|
6417
6457
|
outline: spec.outline,
|
|
6418
6458
|
shading: spec.shading,
|
|
6419
6459
|
detail: spec.detail,
|
|
6420
|
-
seed: spec.seed
|
|
6460
|
+
seed: spec.seed,
|
|
6461
|
+
targetPalette: targetPaletteFor(spec)
|
|
6421
6462
|
});
|
|
6422
6463
|
return {
|
|
6423
6464
|
jobId: res2.tileset_id,
|
|
@@ -6448,7 +6489,7 @@ var PixelLabProvider = class _PixelLabProvider {
|
|
|
6448
6489
|
height: spec.height,
|
|
6449
6490
|
noBackground: spec.noBackground,
|
|
6450
6491
|
seed: spec.seed,
|
|
6451
|
-
targetPalette:
|
|
6492
|
+
targetPalette: targetPaletteFor(spec)
|
|
6452
6493
|
});
|
|
6453
6494
|
return { jobId: res2.background_job_id };
|
|
6454
6495
|
}
|
|
@@ -6467,7 +6508,8 @@ var PixelLabProvider = class _PixelLabProvider {
|
|
|
6467
6508
|
// items at frames 0/1/2, in order; docs/GENERATORS.md#1dir), so
|
|
6468
6509
|
// sending the same text as `description` too is redundant but
|
|
6469
6510
|
// harmless, not a hedge against ambiguity.
|
|
6470
|
-
itemDescriptions: spec.batch?.role === "leader" ? spec.batch.itemDescriptions : void 0
|
|
6511
|
+
itemDescriptions: spec.batch?.role === "leader" ? spec.batch.itemDescriptions : void 0,
|
|
6512
|
+
targetPalette: targetPaletteFor(spec)
|
|
6471
6513
|
});
|
|
6472
6514
|
return { jobId: res2.object_id, metadata: { backgroundJobId: res2.background_job_id } };
|
|
6473
6515
|
}
|
|
@@ -6609,7 +6651,8 @@ var PixelLabProvider = class _PixelLabProvider {
|
|
|
6609
6651
|
height,
|
|
6610
6652
|
action: spec.prompt,
|
|
6611
6653
|
seed: spec.seed,
|
|
6612
|
-
noBackground: spec.noBackground
|
|
6654
|
+
noBackground: spec.noBackground,
|
|
6655
|
+
targetPalette: targetPaletteFor(spec)
|
|
6613
6656
|
});
|
|
6614
6657
|
return { jobId: res2.background_job_id };
|
|
6615
6658
|
}
|
|
@@ -6620,7 +6663,8 @@ var PixelLabProvider = class _PixelLabProvider {
|
|
|
6620
6663
|
height,
|
|
6621
6664
|
description: spec.prompt,
|
|
6622
6665
|
seed: spec.seed,
|
|
6623
|
-
noBackground: spec.noBackground
|
|
6666
|
+
noBackground: spec.noBackground,
|
|
6667
|
+
targetPalette: targetPaletteFor(spec)
|
|
6624
6668
|
});
|
|
6625
6669
|
return { jobId: res2.background_job_id };
|
|
6626
6670
|
}
|
|
@@ -7565,6 +7609,39 @@ function remoteCharacter(character) {
|
|
|
7565
7609
|
animationCount: character.animation_count
|
|
7566
7610
|
};
|
|
7567
7611
|
}
|
|
7612
|
+
function sendsTargetPalette(spec) {
|
|
7613
|
+
if (spec.revision) return spec.revision.mode === "interpolate" || spec.revision.mode === "edit-animation";
|
|
7614
|
+
if (spec.vfx) return false;
|
|
7615
|
+
switch (spec.generator) {
|
|
7616
|
+
case "imagePro":
|
|
7617
|
+
case "imageProFlash":
|
|
7618
|
+
case "1dir":
|
|
7619
|
+
case "tiles":
|
|
7620
|
+
case "uiAsset":
|
|
7621
|
+
case "uiElement":
|
|
7622
|
+
return true;
|
|
7623
|
+
case "terrain":
|
|
7624
|
+
return spec.terrainOrientation !== "sidescroller" && spec.terrainMode === "pro";
|
|
7625
|
+
case "character": {
|
|
7626
|
+
const character = spec.character;
|
|
7627
|
+
if (!character) return false;
|
|
7628
|
+
if (character.kind === "base") return character.mode === "pro" || character.mode === "pro-flash";
|
|
7629
|
+
return character.kind !== "animation";
|
|
7630
|
+
}
|
|
7631
|
+
case "objectPro": {
|
|
7632
|
+
const object = spec.objectPro;
|
|
7633
|
+
if (!object) return false;
|
|
7634
|
+
return object.kind !== "animation" || object.animation?.mode === "pro";
|
|
7635
|
+
}
|
|
7636
|
+
default:
|
|
7637
|
+
return false;
|
|
7638
|
+
}
|
|
7639
|
+
}
|
|
7640
|
+
function targetPaletteFor(spec) {
|
|
7641
|
+
if (!sendsTargetPalette(spec)) return void 0;
|
|
7642
|
+
if (!spec.palette.length && spec.maxColors == null) return void 0;
|
|
7643
|
+
return { colors: spec.palette, name: spec.paletteName, maxColors: spec.maxColors };
|
|
7644
|
+
}
|
|
7568
7645
|
function requirePixelLabOption(generator, name, value, allowed) {
|
|
7569
7646
|
if (value != null && !allowed.includes(value)) {
|
|
7570
7647
|
throw new Error(`PixelLab ${generator} ${name} must be one of: ${allowed.join(", ")}`);
|
|
@@ -10696,8 +10773,8 @@ async function resolveSpecs(loaded, filter) {
|
|
|
10696
10773
|
uiColorPalette: generator === "uiAsset" || generator === "uiElement" ? style.uiColorPalette : void 0,
|
|
10697
10774
|
...generator === "imageProFlash" && style.styleTraits ? { styleTraits: style.styleTraits } : {},
|
|
10698
10775
|
palette: style.palette,
|
|
10699
|
-
...
|
|
10700
|
-
...
|
|
10776
|
+
...style.paletteName ? { paletteName: style.paletteName } : {},
|
|
10777
|
+
...style.maxColors != null ? { maxColors: style.maxColors } : {},
|
|
10701
10778
|
enforcePalette: style.enforcePalette,
|
|
10702
10779
|
noBackground: style.noBackground,
|
|
10703
10780
|
tileSize: generator === "tiles" ? tileSize : void 0,
|
|
@@ -21013,6 +21090,7 @@ export {
|
|
|
21013
21090
|
ScenarioProvider,
|
|
21014
21091
|
StyleInputSchema,
|
|
21015
21092
|
StyleSchema,
|
|
21093
|
+
TARGET_PALETTE_GENERATORS,
|
|
21016
21094
|
TerrainConnectSchema,
|
|
21017
21095
|
TerrainLinkSchema,
|
|
21018
21096
|
TerrainSideSchema,
|
|
@@ -21238,6 +21316,7 @@ export {
|
|
|
21238
21316
|
submit,
|
|
21239
21317
|
summarize,
|
|
21240
21318
|
tagAdopted,
|
|
21319
|
+
targetPaletteBody,
|
|
21241
21320
|
terrainCost,
|
|
21242
21321
|
terrainSettings,
|
|
21243
21322
|
terrainTileCount,
|