pixelkiln 0.144.0 → 0.144.2
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 +63 -13
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +65 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +30 -4
- package/dist/index.d.ts +30 -4
- package/dist/index.js +64 -13
- package/dist/index.js.map +1 -1
- package/docs/CHARACTERS.md +5 -3
- package/docs/CHARACTERS_3D.md +37 -11
- package/docs/CLI.md +5 -4
- package/docs/ENDPOINTS.md +97 -33
- package/docs/GENERATORS.md +27 -21
- package/docs/MANIFEST.md +1 -1
- package/docs/RESEARCH_3D.md +48 -0
- package/package.json +1 -1
- package/skills/pixelkiln/references/pixellab-roadmap.md +2 -1
- package/skills/pixelkiln/references/pixellab.md +2 -2
package/dist/cli.js
CHANGED
|
@@ -2327,7 +2327,7 @@ var CharacterAnimationSchema = z.object({
|
|
|
2327
2327
|
});
|
|
2328
2328
|
}
|
|
2329
2329
|
const sentence = animation.mode === "skeleton-v3" && !animation.template;
|
|
2330
|
-
if (animation.frames !== void 0 && !sentence) {
|
|
2330
|
+
if (animation.frames !== void 0 && !sentence && animation.mode !== "pro") {
|
|
2331
2331
|
if (animation.frames % 2 !== 0) {
|
|
2332
2332
|
context.addIssue({ code: z.ZodIssueCode.custom, message: "frames must be even", path: ["frames"] });
|
|
2333
2333
|
} else if (animation.frames < 4) {
|
|
@@ -9371,6 +9371,13 @@ function targetPaletteBody(palette) {
|
|
|
9371
9371
|
}
|
|
9372
9372
|
var NORMAL_MAP_MODES = ["lite", "pro"];
|
|
9373
9373
|
var NORMAL_MAP_KINDS = ["character", "object", "topdown", "side", "iso", "ui"];
|
|
9374
|
+
function deleteSucceeded(body, what) {
|
|
9375
|
+
if (body && typeof body === "object" && body.success === false) {
|
|
9376
|
+
const reason = body.error;
|
|
9377
|
+
throw new PixelLabError(`${what} \u2192 200 but success: false${typeof reason === "string" && reason ? ` (${reason})` : ""}`, 200, JSON.stringify(body));
|
|
9378
|
+
}
|
|
9379
|
+
return body;
|
|
9380
|
+
}
|
|
9374
9381
|
var PixelLabClient = class {
|
|
9375
9382
|
constructor(apiKey, timeoutMs = 12e4) {
|
|
9376
9383
|
this.apiKey = apiKey;
|
|
@@ -9920,9 +9927,14 @@ var PixelLabClient = class {
|
|
|
9920
9927
|
});
|
|
9921
9928
|
return validateResponse(SelectFramesSchema, raw, "select frames");
|
|
9922
9929
|
}
|
|
9923
|
-
/**
|
|
9924
|
-
|
|
9925
|
-
|
|
9930
|
+
/**
|
|
9931
|
+
* Irreversible. Only reached via `purge`, behind an explicit confirmation.
|
|
9932
|
+
* PixelLab can answer 200 with `success: false` (an object a dismissed
|
|
9933
|
+
* review already removed came back `"error": "Object not found"`), so the
|
|
9934
|
+
* body is checked, not only the status.
|
|
9935
|
+
*/
|
|
9936
|
+
async deleteObject(objectId) {
|
|
9937
|
+
return deleteSucceeded(await this.request(`/objects/${objectId}`, { method: "DELETE" }), `DELETE /objects/${objectId}`);
|
|
9926
9938
|
}
|
|
9927
9939
|
dismissReview(objectId) {
|
|
9928
9940
|
return this.request(`/objects/${objectId}/dismiss-review`, { method: "POST" });
|
|
@@ -10887,9 +10899,19 @@ var PixelLabClient = class {
|
|
|
10887
10899
|
if (bytes.length > MAX_DOWNLOAD_BYTES) throw new Error(`export ${pathname} exceeds the ${MAX_DOWNLOAD_BYTES}-byte safety limit`);
|
|
10888
10900
|
return bytes;
|
|
10889
10901
|
}
|
|
10890
|
-
/**
|
|
10902
|
+
/**
|
|
10903
|
+
* `GET /generate-font-pro/{job_id}`: status, then no-auth atlas and `.ttf`
|
|
10904
|
+
* URLs once completed. PixelLab answers 423 ("Job is still processing")
|
|
10905
|
+
* while the font draws, so that reads as `status: "processing"`.
|
|
10906
|
+
*/
|
|
10891
10907
|
async getFontJob(jobId) {
|
|
10892
|
-
|
|
10908
|
+
let raw;
|
|
10909
|
+
try {
|
|
10910
|
+
raw = await this.request(`/generate-font-pro/${encodeURIComponent(jobId)}`);
|
|
10911
|
+
} catch (error) {
|
|
10912
|
+
if (error instanceof PixelLabError && error.status === 423) return { job_id: jobId, status: "processing" };
|
|
10913
|
+
throw error;
|
|
10914
|
+
}
|
|
10893
10915
|
return validateResponse(FontJobSchema, raw, "generate-font-pro/{job_id}");
|
|
10894
10916
|
}
|
|
10895
10917
|
/**
|
|
@@ -11056,9 +11078,10 @@ var PixelLabClient = class {
|
|
|
11056
11078
|
);
|
|
11057
11079
|
return validateResponse(DeleteAnimationsSchema, raw, "characters/{id}/animations");
|
|
11058
11080
|
}
|
|
11059
|
-
/** Irreversible: the character, its states are separate records, and its animations. */
|
|
11060
|
-
deleteCharacter(characterId) {
|
|
11061
|
-
|
|
11081
|
+
/** Irreversible: the character, its states are separate records, and its animations. Checks `success` like `deleteObject`. */
|
|
11082
|
+
async deleteCharacter(characterId) {
|
|
11083
|
+
const path79 = `/characters/${encodeURIComponent(characterId)}`;
|
|
11084
|
+
return deleteSucceeded(await this.request(path79, { method: "DELETE" }), `DELETE ${path79}`);
|
|
11062
11085
|
}
|
|
11063
11086
|
setCharacterTags(characterId, tags) {
|
|
11064
11087
|
return this.request(`/characters/${encodeURIComponent(characterId)}/tags`, {
|
|
@@ -11775,7 +11798,7 @@ async function generateFont(client2, opts) {
|
|
|
11775
11798
|
}
|
|
11776
11799
|
const sleep3 = opts.sleep ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms)));
|
|
11777
11800
|
const interval = opts.intervalMs ?? 5e3;
|
|
11778
|
-
const timeout = opts.timeoutMs ??
|
|
11801
|
+
const timeout = opts.timeoutMs ?? 15 * 6e4;
|
|
11779
11802
|
const submitted = await client2.generateFontPro({
|
|
11780
11803
|
description: opts.description,
|
|
11781
11804
|
weight: opts.weight,
|
|
@@ -12219,9 +12242,9 @@ function characterCost(spec) {
|
|
|
12219
12242
|
if (animation.mode === "template") return 1;
|
|
12220
12243
|
if (animation.mode === "skeleton-v3") return 4;
|
|
12221
12244
|
if (animation.mode === "v3") return Math.max(1, Math.ceil(px * animation.frames / 65536));
|
|
12222
|
-
return
|
|
12245
|
+
return proCharacterTierCost(spec.width, spec.height);
|
|
12223
12246
|
}
|
|
12224
|
-
if (character.kind === "state" || character.kind === "portrait") return
|
|
12247
|
+
if (character.kind === "state" || character.kind === "portrait") return proCharacterTierCost(spec.width, spec.height);
|
|
12225
12248
|
if (character.kind === "outfit") {
|
|
12226
12249
|
return PRO_TIER_PRICES[0];
|
|
12227
12250
|
}
|
|
@@ -12238,7 +12261,13 @@ function characterCost(spec) {
|
|
|
12238
12261
|
const south = character.reference?.south;
|
|
12239
12262
|
return south ? proFlashCharacterCost(south.width, south.height, true) : proFlashCharacterCost(spec.width, spec.height, false);
|
|
12240
12263
|
}
|
|
12241
|
-
return
|
|
12264
|
+
return proCharacterTierCost(spec.width, spec.height);
|
|
12265
|
+
}
|
|
12266
|
+
function proCharacterTierCost(width, height) {
|
|
12267
|
+
const side = Math.max(width, height);
|
|
12268
|
+
if (side <= 85) return PRO_TIER_PRICES[0];
|
|
12269
|
+
if (side <= 113) return PRO_TIER_PRICES[1];
|
|
12270
|
+
return PRO_TIER_PRICES[2];
|
|
12242
12271
|
}
|
|
12243
12272
|
function proFlashCharacterCost(width, height, fromReference) {
|
|
12244
12273
|
const side = Math.max(32, Math.ceil(Math.max(width, height) / 4) * 4);
|
|
@@ -17466,6 +17495,21 @@ async function resolveSpecs(loaded, filter) {
|
|
|
17466
17495
|
// A state and its animations keep the base's own rotation count.
|
|
17467
17496
|
directions: resolved.objectPro.kind === "base" ? resolved.objectPro.directions : parentSpec.objectPro.directions
|
|
17468
17497
|
};
|
|
17498
|
+
const animation = resolved.objectPro.animation;
|
|
17499
|
+
if (animation?.mode === "pro") {
|
|
17500
|
+
const canvas = Math.max(parentSpec.width, parentSpec.height);
|
|
17501
|
+
const allowed = objectProAnimationFrames(canvas);
|
|
17502
|
+
if (!allowed) {
|
|
17503
|
+
throw new Error(`assets.${assetId}: a pro object animation needs a canvas of 170px or less; ${characterParent} is ${canvas}px, so use mode "v3"`);
|
|
17504
|
+
}
|
|
17505
|
+
if (asset.animation?.frames === void 0) {
|
|
17506
|
+
resolved.objectPro = { ...resolved.objectPro, animation: { ...animation, frames: allowed[0] } };
|
|
17507
|
+
} else if (!allowed.includes(asset.animation.frames)) {
|
|
17508
|
+
throw new Error(
|
|
17509
|
+
`assets.${assetId}: a pro object animation on a ${canvas}px canvas takes ${allowed.join(", ")} frames, got ${asset.animation.frames}; leave frames out to use ${allowed[0]}`
|
|
17510
|
+
);
|
|
17511
|
+
}
|
|
17512
|
+
}
|
|
17469
17513
|
}
|
|
17470
17514
|
if (asset.outfit) {
|
|
17471
17515
|
if (asset.outfit.of === assetId) throw new Error(`assets.${assetId}: an asset cannot re-clothe itself`);
|
|
@@ -18073,6 +18117,12 @@ async function resolveCharacterShape(asset, style, kind, files) {
|
|
|
18073
18117
|
}
|
|
18074
18118
|
return shape;
|
|
18075
18119
|
}
|
|
18120
|
+
function objectProAnimationFrames(canvas) {
|
|
18121
|
+
if (canvas <= 64) return [16];
|
|
18122
|
+
if (canvas <= 128) return [4, 9, 16];
|
|
18123
|
+
if (canvas <= 170) return [9];
|
|
18124
|
+
return null;
|
|
18125
|
+
}
|
|
18076
18126
|
async function resolveObjectProShape(assetId, asset, style, kind, files) {
|
|
18077
18127
|
const directions = style.objectDirections ?? 8;
|
|
18078
18128
|
const shape = {
|