pixelkiln 0.91.2 → 0.92.1
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 +47 -0
- package/docs/MANIFEST.md +6 -4
- package/docs/PIXELLAB.md +14 -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.cjs
CHANGED
|
@@ -120,6 +120,7 @@ __export(index_exports, {
|
|
|
120
120
|
ScenarioProvider: () => ScenarioProvider,
|
|
121
121
|
StyleInputSchema: () => StyleInputSchema,
|
|
122
122
|
StyleSchema: () => StyleSchema,
|
|
123
|
+
TARGET_PALETTE_GENERATORS: () => TARGET_PALETTE_GENERATORS,
|
|
123
124
|
TerrainConnectSchema: () => TerrainConnectSchema,
|
|
124
125
|
TerrainLinkSchema: () => TerrainLinkSchema,
|
|
125
126
|
TerrainSideSchema: () => TerrainSideSchema,
|
|
@@ -345,6 +346,7 @@ __export(index_exports, {
|
|
|
345
346
|
submit: () => submit,
|
|
346
347
|
summarize: () => summarize,
|
|
347
348
|
tagAdopted: () => tagAdopted,
|
|
349
|
+
targetPaletteBody: () => targetPaletteBody,
|
|
348
350
|
terrainCost: () => terrainCost,
|
|
349
351
|
terrainSettings: () => terrainSettings,
|
|
350
352
|
terrainTileCount: () => terrainTileCount,
|
|
@@ -385,6 +387,17 @@ var importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
|
|
|
385
387
|
var import_zod = require("zod");
|
|
386
388
|
var MediaTypeSchema = import_zod.z.enum(["image/png", "image/gif"]);
|
|
387
389
|
var GeneratorSchema = import_zod.z.enum(["1dir", "map", "pixflux", "tiles", "animation", "frames", "character", "terrain", "imagePro", "isometricTile", "objectPro", "uiAsset", "uiElement", "imageProFlash", "vfx"]);
|
|
390
|
+
var TARGET_PALETTE_GENERATORS = [
|
|
391
|
+
"imagePro",
|
|
392
|
+
"imageProFlash",
|
|
393
|
+
"objectPro",
|
|
394
|
+
"1dir",
|
|
395
|
+
"character",
|
|
396
|
+
"tiles",
|
|
397
|
+
"terrain",
|
|
398
|
+
"uiAsset",
|
|
399
|
+
"uiElement"
|
|
400
|
+
];
|
|
388
401
|
var GridConfidenceSchema = import_zod.z.enum(["low", "medium", "high"]);
|
|
389
402
|
var RevisionModeSchema = import_zod.z.enum([
|
|
390
403
|
"image-to-image",
|
|
@@ -1341,8 +1354,8 @@ var StyleObjectSchema = import_zod.z.object({
|
|
|
1341
1354
|
seed: import_zod.z.number().int().optional(),
|
|
1342
1355
|
/**
|
|
1343
1356
|
* Forced palette, as `#rrggbb` values. Sent as a swatch to `pixflux`
|
|
1344
|
-
* and the generators that take one, and
|
|
1345
|
-
*
|
|
1357
|
+
* and the generators that take one, and as `target_palette.colors` (2 to
|
|
1358
|
+
* 256 colours) to every PixelLab call that takes it (`TARGET_PALETTE_GENERATORS`).
|
|
1346
1359
|
*
|
|
1347
1360
|
* Unlike prose, this is a hard constraint. The API is handed a swatch
|
|
1348
1361
|
* image and the output is limited to those colours. Verified: a four-colour
|
|
@@ -1352,9 +1365,9 @@ var StyleObjectSchema = import_zod.z.object({
|
|
|
1352
1365
|
* chocolate bar.
|
|
1353
1366
|
*/
|
|
1354
1367
|
palette: import_zod.z.array(HexColorSchema).default([]),
|
|
1355
|
-
/** `
|
|
1368
|
+
/** `target_palette.name` ("Game Boy", "PICO-8"), which PixelLab uses to help the look. Needs `palette`; generators in `TARGET_PALETTE_GENERATORS` only. */
|
|
1356
1369
|
paletteName: import_zod.z.string().min(1).max(100).optional(),
|
|
1357
|
-
/** `
|
|
1370
|
+
/** `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. */
|
|
1358
1371
|
maxColors: import_zod.z.number().int().min(2).max(64).optional(),
|
|
1359
1372
|
/**
|
|
1360
1373
|
* Snap every visible pixel of the downloaded art to the nearest `palette`
|
|
@@ -1410,10 +1423,10 @@ var StyleSchema = StyleObjectSchema.refine((s) => !(s.tileFeature && s.styleImag
|
|
|
1410
1423
|
});
|
|
1411
1424
|
}
|
|
1412
1425
|
for (const field of ["paletteName", "maxColors"]) {
|
|
1413
|
-
if (style[field] !== void 0 && style.generator
|
|
1426
|
+
if (style[field] !== void 0 && !TARGET_PALETTE_GENERATORS.includes(style.generator)) {
|
|
1414
1427
|
ctx.addIssue({
|
|
1415
1428
|
code: import_zod.z.ZodIssueCode.custom,
|
|
1416
|
-
message: `${field} applies to the
|
|
1429
|
+
message: `${field} applies to the ${TARGET_PALETTE_GENERATORS.join(", ")} generators only`,
|
|
1417
1430
|
path: [field]
|
|
1418
1431
|
});
|
|
1419
1432
|
}
|
|
@@ -2461,6 +2474,16 @@ function proportionsPayload(proportions) {
|
|
|
2461
2474
|
...proportions.hipWidth !== void 0 ? { hip_width: proportions.hipWidth } : {}
|
|
2462
2475
|
};
|
|
2463
2476
|
}
|
|
2477
|
+
function targetPaletteBody(palette) {
|
|
2478
|
+
if (!palette || !(palette.colors?.length || palette.maxColors != null)) return {};
|
|
2479
|
+
return {
|
|
2480
|
+
target_palette: {
|
|
2481
|
+
...palette.colors?.length ? { colors: palette.colors } : {},
|
|
2482
|
+
...palette.name ? { name: palette.name } : {},
|
|
2483
|
+
...palette.maxColors != null ? { max_colors: palette.maxColors } : {}
|
|
2484
|
+
}
|
|
2485
|
+
};
|
|
2486
|
+
}
|
|
2464
2487
|
var PixelLabClient = class {
|
|
2465
2488
|
constructor(apiKey, timeoutMs = 12e4) {
|
|
2466
2489
|
this.apiKey = apiKey;
|
|
@@ -2535,6 +2558,7 @@ var PixelLabClient = class {
|
|
|
2535
2558
|
}
|
|
2536
2559
|
if (args.view) body.view = args.view;
|
|
2537
2560
|
if (args.itemDescriptions?.length) body.item_descriptions = args.itemDescriptions;
|
|
2561
|
+
Object.assign(body, targetPaletteBody(args.targetPalette));
|
|
2538
2562
|
const raw = await this.request("/create-1-direction-object", {
|
|
2539
2563
|
method: "POST",
|
|
2540
2564
|
body: JSON.stringify(body)
|
|
@@ -2602,6 +2626,7 @@ var PixelLabClient = class {
|
|
|
2602
2626
|
if (args.outlineMode) body.outline_mode = args.outlineMode;
|
|
2603
2627
|
if (args.seed != null) body.seed = args.seed;
|
|
2604
2628
|
if (args.styleImages?.length) body.style_images = args.styleImages;
|
|
2629
|
+
Object.assign(body, targetPaletteBody(args.targetPalette));
|
|
2605
2630
|
return validateResponse(
|
|
2606
2631
|
TilesSubmitSchema,
|
|
2607
2632
|
await this.request("/create-tiles-pro", { method: "POST", body: JSON.stringify(body) }),
|
|
@@ -2647,6 +2672,7 @@ var PixelLabClient = class {
|
|
|
2647
2672
|
if (args.shading) body.shading = args.shading;
|
|
2648
2673
|
if (args.detail) body.detail = args.detail;
|
|
2649
2674
|
if (args.seed != null) body.seed = args.seed;
|
|
2675
|
+
if (args.mode === "pro") Object.assign(body, targetPaletteBody(args.targetPalette));
|
|
2650
2676
|
return validateResponse(
|
|
2651
2677
|
TilesetSubmitSchema,
|
|
2652
2678
|
await this.request("/create-tileset", { method: "POST", body: JSON.stringify(body) }),
|
|
@@ -2745,6 +2771,7 @@ var PixelLabClient = class {
|
|
|
2745
2771
|
if (args.colorPalette) body.color_palette = args.colorPalette;
|
|
2746
2772
|
if (args.noBackground != null) body.no_background = args.noBackground;
|
|
2747
2773
|
if (args.seed != null) body.seed = args.seed;
|
|
2774
|
+
Object.assign(body, targetPaletteBody(args.targetPalette));
|
|
2748
2775
|
const res = await validateResponse(
|
|
2749
2776
|
UiAssetSubmitSchema,
|
|
2750
2777
|
await this.request("/create-ui-asset", { method: "POST", body: JSON.stringify(body) }),
|
|
@@ -2824,7 +2851,8 @@ var PixelLabClient = class {
|
|
|
2824
2851
|
...traits.shading !== void 0 ? { shading: traits.shading } : {}
|
|
2825
2852
|
}
|
|
2826
2853
|
} : {}
|
|
2827
|
-
} : {}
|
|
2854
|
+
} : {},
|
|
2855
|
+
...targetPaletteBody(args.targetPalette)
|
|
2828
2856
|
};
|
|
2829
2857
|
return validateResponse(
|
|
2830
2858
|
ObjectProSubmitSchema,
|
|
@@ -2839,7 +2867,8 @@ var PixelLabClient = class {
|
|
|
2839
2867
|
body: JSON.stringify({
|
|
2840
2868
|
edit_description: args.editDescription,
|
|
2841
2869
|
...args.stateName ? { state_name: args.stateName } : {},
|
|
2842
|
-
...args.seed != null ? { seed: args.seed } : {}
|
|
2870
|
+
...args.seed != null ? { seed: args.seed } : {},
|
|
2871
|
+
...targetPaletteBody(args.targetPalette)
|
|
2843
2872
|
})
|
|
2844
2873
|
});
|
|
2845
2874
|
return validateResponse(ObjectProSubmitSchema, raw, "create object state");
|
|
@@ -2865,7 +2894,8 @@ var PixelLabClient = class {
|
|
|
2865
2894
|
...args.startFrame ? { custom_start_frame: encode(args.startFrame) } : {},
|
|
2866
2895
|
...args.endFrame ? { end_frame: encode(args.endFrame) } : {},
|
|
2867
2896
|
...args.enhancePrompt ? { enhance_prompt: true } : {},
|
|
2868
|
-
...args.replaceExisting ? { replace_existing: true } : {}
|
|
2897
|
+
...args.replaceExisting ? { replace_existing: true } : {},
|
|
2898
|
+
...args.mode === "pro" ? targetPaletteBody(args.targetPalette) : {}
|
|
2869
2899
|
};
|
|
2870
2900
|
const raw = await this.request(`/objects/${encodeURIComponent(args.objectId)}/animations`, {
|
|
2871
2901
|
method: "POST",
|
|
@@ -3007,6 +3037,7 @@ var PixelLabClient = class {
|
|
|
3007
3037
|
...palette
|
|
3008
3038
|
};
|
|
3009
3039
|
}
|
|
3040
|
+
if (args.mode === "pro" || args.mode === "pro-flash") Object.assign(body, targetPaletteBody(args.targetPalette));
|
|
3010
3041
|
const raw = await this.request(path39, { method: "POST", body: JSON.stringify(body) });
|
|
3011
3042
|
return validateResponse(CharacterSubmitSchema, raw, path39.slice(1));
|
|
3012
3043
|
}
|
|
@@ -3021,7 +3052,8 @@ var PixelLabClient = class {
|
|
|
3021
3052
|
use_color_palette_from_reference: args.paletteFromReference ?? false,
|
|
3022
3053
|
...args.stateName ? { state_name: args.stateName } : {},
|
|
3023
3054
|
...args.canvas ? { override_frame_size: args.canvas } : {},
|
|
3024
|
-
...args.seed != null ? { seed: args.seed } : {}
|
|
3055
|
+
...args.seed != null ? { seed: args.seed } : {},
|
|
3056
|
+
...targetPaletteBody(args.targetPalette)
|
|
3025
3057
|
})
|
|
3026
3058
|
});
|
|
3027
3059
|
return validateResponse(CharacterSubmitSchema, raw, "create-character-state");
|
|
@@ -3090,7 +3122,8 @@ var PixelLabClient = class {
|
|
|
3090
3122
|
image: { type: "base64", base64: args.image.base64, format: args.image.format },
|
|
3091
3123
|
...args.view ? { view: args.view } : {},
|
|
3092
3124
|
...args.resultSize != null ? { result_size: args.resultSize } : {},
|
|
3093
|
-
...args.seed != null ? { seed: args.seed } : {}
|
|
3125
|
+
...args.seed != null ? { seed: args.seed } : {},
|
|
3126
|
+
...targetPaletteBody(args.targetPalette)
|
|
3094
3127
|
})
|
|
3095
3128
|
});
|
|
3096
3129
|
return validateResponse(PortraitSubmitSchema, raw, "portrait-character-pro");
|
|
@@ -3135,7 +3168,8 @@ var PixelLabClient = class {
|
|
|
3135
3168
|
image_size: args.imageSize,
|
|
3136
3169
|
...args.seed != null ? { seed: args.seed } : {},
|
|
3137
3170
|
...args.noBackground !== void 0 ? { no_background: args.noBackground } : {},
|
|
3138
|
-
...args.additionalInstructions ? { additional_instructions: args.additionalInstructions } : {}
|
|
3171
|
+
...args.additionalInstructions ? { additional_instructions: args.additionalInstructions } : {},
|
|
3172
|
+
...targetPaletteBody(args.targetPalette)
|
|
3139
3173
|
})
|
|
3140
3174
|
});
|
|
3141
3175
|
return validateResponse(TransferOutfitSubmitSchema, raw, "transfer-outfit-v2");
|
|
@@ -3254,14 +3288,7 @@ var PixelLabClient = class {
|
|
|
3254
3288
|
};
|
|
3255
3289
|
if (args.noBackground != null) body.no_background = args.noBackground;
|
|
3256
3290
|
if (args.seed != null) body.seed = args.seed;
|
|
3257
|
-
|
|
3258
|
-
if (palette && (palette.colors?.length || palette.maxColors != null)) {
|
|
3259
|
-
body.target_palette = {
|
|
3260
|
-
...palette.colors?.length ? { colors: palette.colors } : {},
|
|
3261
|
-
...palette.name ? { name: palette.name } : {},
|
|
3262
|
-
...palette.maxColors != null ? { max_colors: palette.maxColors } : {}
|
|
3263
|
-
};
|
|
3264
|
-
}
|
|
3291
|
+
Object.assign(body, targetPaletteBody(args.targetPalette));
|
|
3265
3292
|
return validateResponse(
|
|
3266
3293
|
RevisionJobSubmitSchema,
|
|
3267
3294
|
await this.request("/generate-image-v2", { method: "POST", body: JSON.stringify(body) }),
|
|
@@ -3296,6 +3323,7 @@ var PixelLabClient = class {
|
|
|
3296
3323
|
};
|
|
3297
3324
|
}
|
|
3298
3325
|
}
|
|
3326
|
+
Object.assign(body, targetPaletteBody(args.targetPalette));
|
|
3299
3327
|
return validateResponse(
|
|
3300
3328
|
ProFlashImageSubmitSchema,
|
|
3301
3329
|
await this.request("/create-image-pro-flash", { method: "POST", body: JSON.stringify(body) }),
|
|
@@ -3369,6 +3397,7 @@ var PixelLabClient = class {
|
|
|
3369
3397
|
if (args.colorPalette) body.color_palette = args.colorPalette;
|
|
3370
3398
|
if (args.noBackground != null) body.no_background = args.noBackground;
|
|
3371
3399
|
if (args.seed != null) body.seed = args.seed;
|
|
3400
|
+
Object.assign(body, targetPaletteBody(args.targetPalette));
|
|
3372
3401
|
return validateResponse(
|
|
3373
3402
|
RevisionJobSubmitSchema,
|
|
3374
3403
|
await this.request("/generate-ui-v2", { method: "POST", body: JSON.stringify(body) }),
|
|
@@ -3518,6 +3547,7 @@ var PixelLabClient = class {
|
|
|
3518
3547
|
};
|
|
3519
3548
|
if (args.seed != null) body.seed = args.seed;
|
|
3520
3549
|
if (args.noBackground != null) body.no_background = args.noBackground;
|
|
3550
|
+
Object.assign(body, targetPaletteBody(args.targetPalette));
|
|
3521
3551
|
return validateResponse(
|
|
3522
3552
|
RevisionJobSubmitSchema,
|
|
3523
3553
|
await this.request("/interpolation-v2", { method: "POST", body: JSON.stringify(body) }),
|
|
@@ -3540,6 +3570,7 @@ var PixelLabClient = class {
|
|
|
3540
3570
|
};
|
|
3541
3571
|
if (args.seed != null) body.seed = args.seed;
|
|
3542
3572
|
if (args.noBackground != null) body.no_background = args.noBackground;
|
|
3573
|
+
Object.assign(body, targetPaletteBody(args.targetPalette));
|
|
3543
3574
|
return validateResponse(
|
|
3544
3575
|
RevisionJobSubmitSchema,
|
|
3545
3576
|
await this.request("/edit-animation-v2", { method: "POST", body: JSON.stringify(body) }),
|
|
@@ -5790,8 +5821,8 @@ var PixelLabProvider = class _PixelLabProvider {
|
|
|
5790
5821
|
`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)`
|
|
5791
5822
|
);
|
|
5792
5823
|
}
|
|
5793
|
-
if (spec.
|
|
5794
|
-
throw new Error(`PixelLab
|
|
5824
|
+
if (spec.palette.length && (spec.palette.length < 2 || spec.palette.length > 256) && sendsTargetPalette(spec)) {
|
|
5825
|
+
throw new Error(`PixelLab ${spec.generator}'s target palette takes 2 to 256 colours; the style's palette has ${spec.palette.length}`);
|
|
5795
5826
|
}
|
|
5796
5827
|
if (spec.generator === "uiAsset" && (spec.width < 192 || spec.height < 192 || spec.width > 688 || spec.height > 688)) {
|
|
5797
5828
|
throw new Error(
|
|
@@ -6241,7 +6272,8 @@ var PixelLabProvider = class _PixelLabProvider {
|
|
|
6241
6272
|
styleCharacterId: character.styleAnchor ? requireStyleObjectId(spec, context) : void 0,
|
|
6242
6273
|
styleReferenceSize: styleImage ? { width: styleImage.width, height: styleImage.height } : void 0,
|
|
6243
6274
|
styleTraits: character.styleTraits,
|
|
6244
|
-
sourceImageId: character.mode === "pro-flash" ? context?.referenceSourceImageId : void 0
|
|
6275
|
+
sourceImageId: character.mode === "pro-flash" ? context?.referenceSourceImageId : void 0,
|
|
6276
|
+
targetPalette: targetPaletteFor(spec)
|
|
6245
6277
|
});
|
|
6246
6278
|
return { jobId: res2.character_id, metadata: { character: { kind: "base", characterId: res2.character_id, mode: character.mode, directions: character.directions, backgroundJobId: res2.background_job_id } } };
|
|
6247
6279
|
}
|
|
@@ -6269,7 +6301,8 @@ var PixelLabProvider = class _PixelLabProvider {
|
|
|
6269
6301
|
imageSize: { width: spec.width, height: spec.height },
|
|
6270
6302
|
seed: spec.seed,
|
|
6271
6303
|
noBackground: spec.noBackground,
|
|
6272
|
-
additionalInstructions: outfit.additionalInstructions
|
|
6304
|
+
additionalInstructions: outfit.additionalInstructions,
|
|
6305
|
+
targetPalette: targetPaletteFor(spec)
|
|
6273
6306
|
});
|
|
6274
6307
|
return {
|
|
6275
6308
|
jobId: res2.background_job_id,
|
|
@@ -6296,7 +6329,8 @@ var PixelLabProvider = class _PixelLabProvider {
|
|
|
6296
6329
|
paletteFromReference: character.state?.paletteFromReference,
|
|
6297
6330
|
canvas: character.state?.canvas,
|
|
6298
6331
|
seed: spec.seed,
|
|
6299
|
-
noBackground: spec.noBackground
|
|
6332
|
+
noBackground: spec.noBackground,
|
|
6333
|
+
targetPalette: targetPaletteFor(spec)
|
|
6300
6334
|
});
|
|
6301
6335
|
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 } } };
|
|
6302
6336
|
}
|
|
@@ -6311,7 +6345,8 @@ var PixelLabProvider = class _PixelLabProvider {
|
|
|
6311
6345
|
image: { base64: bytes.toString("base64"), format: "png" },
|
|
6312
6346
|
view: spec.view,
|
|
6313
6347
|
resultSize: character.portrait.size,
|
|
6314
|
-
seed: spec.seed
|
|
6348
|
+
seed: spec.seed,
|
|
6349
|
+
targetPalette: targetPaletteFor(spec)
|
|
6315
6350
|
});
|
|
6316
6351
|
return {
|
|
6317
6352
|
jobId: res2.background_job_id,
|
|
@@ -6386,7 +6421,8 @@ var PixelLabProvider = class _PixelLabProvider {
|
|
|
6386
6421
|
styleReference: styleImage ? { base64: styleImage.base64, format: styleImage.format } : void 0,
|
|
6387
6422
|
styleReferenceSize: styleImage ? { width: styleImage.width, height: styleImage.height } : void 0,
|
|
6388
6423
|
styleTraits: object.styleTraits,
|
|
6389
|
-
sourceImageId: context?.referenceSourceImageId
|
|
6424
|
+
sourceImageId: context?.referenceSourceImageId,
|
|
6425
|
+
targetPalette: targetPaletteFor(spec)
|
|
6390
6426
|
});
|
|
6391
6427
|
return { jobId: res2.object_id, metadata: { objectPro: { kind: "base", objectId: res2.object_id, directions: object.directions, backgroundJobId: res2.background_job_id } } };
|
|
6392
6428
|
}
|
|
@@ -6401,7 +6437,8 @@ var PixelLabProvider = class _PixelLabProvider {
|
|
|
6401
6437
|
objectId: parentId,
|
|
6402
6438
|
editDescription: spec.prompt,
|
|
6403
6439
|
stateName: spec.assetId.slice(0, 50),
|
|
6404
|
-
seed: spec.seed
|
|
6440
|
+
seed: spec.seed,
|
|
6441
|
+
targetPalette: targetPaletteFor(spec)
|
|
6405
6442
|
});
|
|
6406
6443
|
return { jobId: res2.object_id, metadata: { objectPro: { kind: "state", objectId: res2.object_id, parentObjectId: parentId, directions: object.directions, backgroundJobId: res2.background_job_id } } };
|
|
6407
6444
|
}
|
|
@@ -6419,7 +6456,8 @@ var PixelLabProvider = class _PixelLabProvider {
|
|
|
6419
6456
|
startFrame: animation.startFrame ? readPose(spec, "start frame", animation.startFrame) : void 0,
|
|
6420
6457
|
endFrame: animation.endFrame ? readPose(spec, "end frame", animation.endFrame) : void 0,
|
|
6421
6458
|
enhancePrompt: animation.enhancePrompt,
|
|
6422
|
-
replaceExisting: true
|
|
6459
|
+
replaceExisting: true,
|
|
6460
|
+
targetPalette: targetPaletteFor(spec)
|
|
6423
6461
|
});
|
|
6424
6462
|
const submission = res.submissions.find((s) => s.direction === animation.direction) ?? res.submissions[0];
|
|
6425
6463
|
const job = { objectId: parentId, name, direction: animation.direction, jobId: submission?.background_job_id ?? null };
|
|
@@ -6685,7 +6723,8 @@ var PixelLabProvider = class _PixelLabProvider {
|
|
|
6685
6723
|
styleImage: styleImages[0] ? { base64: styleImages[0].base64, format: styleImages[0].format } : void 0,
|
|
6686
6724
|
colorPalette: spec.uiColorPalette,
|
|
6687
6725
|
noBackground: spec.noBackground,
|
|
6688
|
-
seed: spec.seed
|
|
6726
|
+
seed: spec.seed,
|
|
6727
|
+
targetPalette: targetPaletteFor(spec)
|
|
6689
6728
|
});
|
|
6690
6729
|
return { jobId: res2.ui_asset_id, metadata: { backgroundJobId: res2.background_job_id } };
|
|
6691
6730
|
}
|
|
@@ -6698,7 +6737,8 @@ var PixelLabProvider = class _PixelLabProvider {
|
|
|
6698
6737
|
noBackground: spec.noBackground,
|
|
6699
6738
|
seed: spec.seed,
|
|
6700
6739
|
styleImage: style ? { image: { base64: style.base64, format: style.format }, width: style.width, height: style.height } : void 0,
|
|
6701
|
-
styleTraits: spec.styleTraits
|
|
6740
|
+
styleTraits: spec.styleTraits,
|
|
6741
|
+
targetPalette: targetPaletteFor(spec)
|
|
6702
6742
|
});
|
|
6703
6743
|
return { jobId: res2.background_job_id, metadata: { imageProFlash: proFlashRecord(res2) } };
|
|
6704
6744
|
}
|
|
@@ -6711,7 +6751,8 @@ var PixelLabProvider = class _PixelLabProvider {
|
|
|
6711
6751
|
conceptImage: concept ? { image: { base64: concept.base64, format: concept.format }, width: concept.width, height: concept.height } : void 0,
|
|
6712
6752
|
colorPalette: spec.uiColorPalette,
|
|
6713
6753
|
noBackground: spec.noBackground,
|
|
6714
|
-
seed: spec.seed
|
|
6754
|
+
seed: spec.seed,
|
|
6755
|
+
targetPalette: targetPaletteFor(spec)
|
|
6715
6756
|
});
|
|
6716
6757
|
return { jobId: res2.background_job_id };
|
|
6717
6758
|
}
|
|
@@ -6751,7 +6792,8 @@ var PixelLabProvider = class _PixelLabProvider {
|
|
|
6751
6792
|
seed: spec.seed,
|
|
6752
6793
|
// TilesProStyleImage is flat and wants the reference's real dimensions,
|
|
6753
6794
|
// unlike 1dir's {type, base64, format} payload.
|
|
6754
|
-
styleImages: styleImages.map(({ base64, width, height }) => ({ base64, width, height }))
|
|
6795
|
+
styleImages: styleImages.map(({ base64, width, height }) => ({ base64, width, height })),
|
|
6796
|
+
targetPalette: targetPaletteFor(spec)
|
|
6755
6797
|
});
|
|
6756
6798
|
return { jobId: res2.tile_id, metadata: { backgroundJobId: res2.background_job_id } };
|
|
6757
6799
|
}
|
|
@@ -6800,7 +6842,8 @@ var PixelLabProvider = class _PixelLabProvider {
|
|
|
6800
6842
|
outline: spec.outline,
|
|
6801
6843
|
shading: spec.shading,
|
|
6802
6844
|
detail: spec.detail,
|
|
6803
|
-
seed: spec.seed
|
|
6845
|
+
seed: spec.seed,
|
|
6846
|
+
targetPalette: targetPaletteFor(spec)
|
|
6804
6847
|
});
|
|
6805
6848
|
return {
|
|
6806
6849
|
jobId: res2.tileset_id,
|
|
@@ -6831,7 +6874,7 @@ var PixelLabProvider = class _PixelLabProvider {
|
|
|
6831
6874
|
height: spec.height,
|
|
6832
6875
|
noBackground: spec.noBackground,
|
|
6833
6876
|
seed: spec.seed,
|
|
6834
|
-
targetPalette:
|
|
6877
|
+
targetPalette: targetPaletteFor(spec)
|
|
6835
6878
|
});
|
|
6836
6879
|
return { jobId: res2.background_job_id };
|
|
6837
6880
|
}
|
|
@@ -6850,7 +6893,8 @@ var PixelLabProvider = class _PixelLabProvider {
|
|
|
6850
6893
|
// items at frames 0/1/2, in order; docs/GENERATORS.md#1dir), so
|
|
6851
6894
|
// sending the same text as `description` too is redundant but
|
|
6852
6895
|
// harmless, not a hedge against ambiguity.
|
|
6853
|
-
itemDescriptions: spec.batch?.role === "leader" ? spec.batch.itemDescriptions : void 0
|
|
6896
|
+
itemDescriptions: spec.batch?.role === "leader" ? spec.batch.itemDescriptions : void 0,
|
|
6897
|
+
targetPalette: targetPaletteFor(spec)
|
|
6854
6898
|
});
|
|
6855
6899
|
return { jobId: res2.object_id, metadata: { backgroundJobId: res2.background_job_id } };
|
|
6856
6900
|
}
|
|
@@ -6992,7 +7036,8 @@ var PixelLabProvider = class _PixelLabProvider {
|
|
|
6992
7036
|
height,
|
|
6993
7037
|
action: spec.prompt,
|
|
6994
7038
|
seed: spec.seed,
|
|
6995
|
-
noBackground: spec.noBackground
|
|
7039
|
+
noBackground: spec.noBackground,
|
|
7040
|
+
targetPalette: targetPaletteFor(spec)
|
|
6996
7041
|
});
|
|
6997
7042
|
return { jobId: res2.background_job_id };
|
|
6998
7043
|
}
|
|
@@ -7003,7 +7048,8 @@ var PixelLabProvider = class _PixelLabProvider {
|
|
|
7003
7048
|
height,
|
|
7004
7049
|
description: spec.prompt,
|
|
7005
7050
|
seed: spec.seed,
|
|
7006
|
-
noBackground: spec.noBackground
|
|
7051
|
+
noBackground: spec.noBackground,
|
|
7052
|
+
targetPalette: targetPaletteFor(spec)
|
|
7007
7053
|
});
|
|
7008
7054
|
return { jobId: res2.background_job_id };
|
|
7009
7055
|
}
|
|
@@ -7948,6 +7994,39 @@ function remoteCharacter(character) {
|
|
|
7948
7994
|
animationCount: character.animation_count
|
|
7949
7995
|
};
|
|
7950
7996
|
}
|
|
7997
|
+
function sendsTargetPalette(spec) {
|
|
7998
|
+
if (spec.revision) return spec.revision.mode === "interpolate" || spec.revision.mode === "edit-animation";
|
|
7999
|
+
if (spec.vfx) return false;
|
|
8000
|
+
switch (spec.generator) {
|
|
8001
|
+
case "imagePro":
|
|
8002
|
+
case "imageProFlash":
|
|
8003
|
+
case "1dir":
|
|
8004
|
+
case "tiles":
|
|
8005
|
+
case "uiAsset":
|
|
8006
|
+
case "uiElement":
|
|
8007
|
+
return true;
|
|
8008
|
+
case "terrain":
|
|
8009
|
+
return spec.terrainOrientation !== "sidescroller" && spec.terrainMode === "pro";
|
|
8010
|
+
case "character": {
|
|
8011
|
+
const character = spec.character;
|
|
8012
|
+
if (!character) return false;
|
|
8013
|
+
if (character.kind === "base") return character.mode === "pro" || character.mode === "pro-flash";
|
|
8014
|
+
return character.kind !== "animation";
|
|
8015
|
+
}
|
|
8016
|
+
case "objectPro": {
|
|
8017
|
+
const object = spec.objectPro;
|
|
8018
|
+
if (!object) return false;
|
|
8019
|
+
return object.kind !== "animation" || object.animation?.mode === "pro";
|
|
8020
|
+
}
|
|
8021
|
+
default:
|
|
8022
|
+
return false;
|
|
8023
|
+
}
|
|
8024
|
+
}
|
|
8025
|
+
function targetPaletteFor(spec) {
|
|
8026
|
+
if (!sendsTargetPalette(spec)) return void 0;
|
|
8027
|
+
if (!spec.palette.length && spec.maxColors == null) return void 0;
|
|
8028
|
+
return { colors: spec.palette, name: spec.paletteName, maxColors: spec.maxColors };
|
|
8029
|
+
}
|
|
7951
8030
|
function requirePixelLabOption(generator, name, value, allowed) {
|
|
7952
8031
|
if (value != null && !allowed.includes(value)) {
|
|
7953
8032
|
throw new Error(`PixelLab ${generator} ${name} must be one of: ${allowed.join(", ")}`);
|
|
@@ -11079,8 +11158,8 @@ async function resolveSpecs(loaded, filter) {
|
|
|
11079
11158
|
uiColorPalette: generator === "uiAsset" || generator === "uiElement" ? style.uiColorPalette : void 0,
|
|
11080
11159
|
...generator === "imageProFlash" && style.styleTraits ? { styleTraits: style.styleTraits } : {},
|
|
11081
11160
|
palette: style.palette,
|
|
11082
|
-
...
|
|
11083
|
-
...
|
|
11161
|
+
...style.paletteName ? { paletteName: style.paletteName } : {},
|
|
11162
|
+
...style.maxColors != null ? { maxColors: style.maxColors } : {},
|
|
11084
11163
|
enforcePalette: style.enforcePalette,
|
|
11085
11164
|
noBackground: style.noBackground,
|
|
11086
11165
|
tileSize: generator === "tiles" ? tileSize : void 0,
|
|
@@ -21397,6 +21476,7 @@ async function workspaceStatus(ws, dir) {
|
|
|
21397
21476
|
ScenarioProvider,
|
|
21398
21477
|
StyleInputSchema,
|
|
21399
21478
|
StyleSchema,
|
|
21479
|
+
TARGET_PALETTE_GENERATORS,
|
|
21400
21480
|
TerrainConnectSchema,
|
|
21401
21481
|
TerrainLinkSchema,
|
|
21402
21482
|
TerrainSideSchema,
|
|
@@ -21622,6 +21702,7 @@ async function workspaceStatus(ws, dir) {
|
|
|
21622
21702
|
submit,
|
|
21623
21703
|
summarize,
|
|
21624
21704
|
tagAdopted,
|
|
21705
|
+
targetPaletteBody,
|
|
21625
21706
|
terrainCost,
|
|
21626
21707
|
terrainSettings,
|
|
21627
21708
|
terrainTileCount,
|