pixelkiln 0.89.2 → 0.89.4

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/index.cjs CHANGED
@@ -2438,7 +2438,8 @@ var PixelLabClient = class {
2438
2438
  });
2439
2439
  const text = await res.text();
2440
2440
  if (!res.ok) {
2441
- throw new PixelLabError(`${init?.method ?? "GET"} ${path39} \u2192 ${res.status}`, res.status, text);
2441
+ const hint = res.status === 500 && text.includes("Failed to start any animation jobs") ? '; a skeleton-v3 loop needs a character with a stored 3D skeleton (a v3 base), use mode: "template" on a standard one' : "";
2442
+ throw new PixelLabError(`${init?.method ?? "GET"} ${path39} \u2192 ${res.status}${hint}`, res.status, text);
2442
2443
  }
2443
2444
  if (!text) return {};
2444
2445
  try {
@@ -6064,6 +6065,11 @@ var PixelLabProvider = class _PixelLabProvider {
6064
6065
  if (character.animation.mode !== "template" && character.animation.mode !== "skeleton-v3" && !spec.prompt.trim()) {
6065
6066
  throw new Error(`${spec.styleId}/${spec.assetId} needs a prompt describing the motion, or a template`);
6066
6067
  }
6068
+ if (character.animation.mode === "skeleton-v3" && character.mode === "standard") {
6069
+ throw new Error(
6070
+ `${spec.styleId}/${spec.assetId}: skeleton-v3 poses a template onto a 3D skeleton, which a ${character.mode} character has none of; use a v3 base (style mode: "v3"), or mode: "template" for this loop`
6071
+ );
6072
+ }
6067
6073
  }
6068
6074
  }
6069
6075
  validateObjectPro(spec, styleImages = []) {
@@ -6370,7 +6376,10 @@ var PixelLabProvider = class _PixelLabProvider {
6370
6376
  stateName: character.state_name ?? null,
6371
6377
  directions: character.directions,
6372
6378
  size: character.size,
6373
- updatedAt: character.updated_at ?? null
6379
+ updatedAt: character.updated_at ?? null,
6380
+ // Kept: this metadata replaces the submit-time `character` entry,
6381
+ // and the job id is the only way to read the bill again later.
6382
+ ...backgroundJobId ? { backgroundJobId } : {}
6374
6383
  }
6375
6384
  },
6376
6385
  billed: await this.billedForJob(backgroundJobId)
@@ -7021,7 +7030,12 @@ var PixelLabProvider = class _PixelLabProvider {
7021
7030
  if (!backgroundJobId) return null;
7022
7031
  try {
7023
7032
  const job = await this.client.getBackgroundJob(backgroundJobId);
7024
- return billedFromUsage(job.usage);
7033
+ const nested = job.last_response?.billing_usage;
7034
+ for (const usage of [job.usage, nested]) {
7035
+ const billed = billedFromUsage(usage);
7036
+ if (billed && !(billed.unit === "usd" && billed.amount === 0)) return billed;
7037
+ }
7038
+ return null;
7025
7039
  } catch {
7026
7040
  return null;
7027
7041
  }
@@ -17021,8 +17035,18 @@ GROUPS.forEach((g, gi) => {
17021
17035
  preview.loading = 'lazy';
17022
17036
  const index = document.createElement('span');
17023
17037
  index.className = 'idx';
17024
- index.textContent = (g.frameLabels?.[i] || String(i + 1)) + ' \xB7 ' +
17025
- g.width + '\xD7' + g.height + ' \xB7 ' + scaleLabel;
17038
+ // A frame's own size, not the manifest's: a 96px loop of a 64px
17039
+ // character is 96\xD796. Known up front for a cached file, else once loaded.
17040
+ const label = (w, h) => {
17041
+ index.textContent = (g.frameLabels?.[i] || String(i + 1)) + ' \xB7 ' + w + '\xD7' + h + ' \xB7 ' + scaleLabel;
17042
+ };
17043
+ const known = g.frameSizes?.[i];
17044
+ label(known ? known.width : g.width, known ? known.height : g.height);
17045
+ if (!known) {
17046
+ preview.addEventListener('load', () => {
17047
+ if (preview.naturalWidth && preview.naturalHeight) label(preview.naturalWidth, preview.naturalHeight);
17048
+ }, { once: true });
17049
+ }
17026
17050
  c.append(preview, index);
17027
17051
  if (g.recommendedIndex != null && i === recommended) {
17028
17052
  const badge = document.createElement('span');
@@ -17284,12 +17308,15 @@ async function prepareReview(provider, lock, opts = {}) {
17284
17308
  const urls = state.status === "review" ? state.candidateUrls : state.frameUrls;
17285
17309
  const frameUrls = [];
17286
17310
  const frameAssets = [];
17311
+ const frameSizes = [];
17287
17312
  for (const [index, url] of urls.entries()) {
17288
17313
  const cached = await cachedFrame(url);
17289
17314
  if (!cached) {
17290
17315
  frameUrls.push(url);
17316
+ frameSizes.push(null);
17291
17317
  continue;
17292
17318
  }
17319
+ frameSizes.push(cached.contentType === "image/png" ? pngSize(await (0, import_promises19.readFile)(cached.path).catch(() => Buffer.alloc(0))) : null);
17293
17320
  const route = `${prefix}/review-frame/${encodeURIComponent(String(groups.length))}/${index}`;
17294
17321
  frameAssets.push([route, cached]);
17295
17322
  frameUrls.push(route);
@@ -17315,6 +17342,7 @@ async function prepareReview(provider, lock, opts = {}) {
17315
17342
  prompt: entry.prompt,
17316
17343
  reviewObjectId: entry.reviewObjectId,
17317
17344
  frameUrls,
17345
+ ...frameSizes.some(Boolean) ? { frameSizes } : {},
17318
17346
  width: entry.width,
17319
17347
  height: entry.height,
17320
17348
  ...state.status === "review-set" ? {