pixelkiln 0.121.0 → 0.121.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 CHANGED
@@ -2011,7 +2011,11 @@ var CharacterPortraitSchema = z.object({
2011
2011
  /** The base or state to portray, in the same style. */
2012
2012
  of: z.string().min(1),
2013
2013
  size: CharacterPortraitSizeSchema.default(64),
2014
- /** PixelLab's seed for this portrait, in place of the style's `seed`. Part of its identity. */
2014
+ /**
2015
+ * Refused when set. Given a seed, PixelLab ignores the character image and
2016
+ * draws a generic face, so a portrait is never sent one; the key stays so
2017
+ * the refusal can say why instead of "unrecognized key".
2018
+ */
2015
2019
  seed: z.number().int().min(0).optional(),
2016
2020
  /**
2017
2021
  * Attach the drawn portrait to the parent's PixelLab character record, as
@@ -6592,12 +6596,18 @@ async function qualitySource(spec, lock) {
6592
6596
  return existsSync5(source) ? { items: [{ role: "source", path: source }] } : { items: null, reason: `declared source is missing: ${spec.source}` };
6593
6597
  }
6594
6598
  const entry = lock.entries[lockKey(spec.styleId, spec.assetId)];
6595
- if (!entry) return { items: null, reason: "raw provider output is not in the lockfile" };
6599
+ const what = spec.derive ? "derived output" : "raw provider output";
6600
+ if (!entry) {
6601
+ return {
6602
+ items: null,
6603
+ reason: spec.derive ? "derived output is not made yet; `pixelkiln gen` derives it once its source is ready" : `${what} is not in the lockfile`
6604
+ };
6605
+ }
6596
6606
  if (entry.specHash !== spec.specHash) {
6597
- return { items: null, reason: "raw provider output does not match the current generation spec" };
6607
+ return { items: null, reason: `${what} does not match the current generation spec` };
6598
6608
  }
6599
6609
  if (entry.status !== "downloaded") {
6600
- return { items: null, reason: `raw provider output is ${entry.status}, not downloaded` };
6610
+ return { items: null, reason: `${what} is ${entry.status}, not downloaded` };
6601
6611
  }
6602
6612
  const frameSet = spec.generator === "frames";
6603
6613
  if (!frameSet && entry.outputs.length !== 1 || frameSet && entry.outputs.length < 2) {
@@ -6720,7 +6730,7 @@ async function refineQualityProfiles(specs, lock, options = {}) {
6720
6730
  if (!configured.length) {
6721
6731
  throw new Error("No selected style has a quality profile.");
6722
6732
  }
6723
- const result = { processed: 0, skipped: 0, failed: 0, items: [] };
6733
+ const result = { processed: 0, skipped: 0, blocked: 0, failed: 0, items: [] };
6724
6734
  for (const spec of configured) {
6725
6735
  const inspection = await inspectQualityProfile(spec, lock);
6726
6736
  if (!options.force && (inspection.state === "approved" || inspection.state === "needs-approval")) {
@@ -6729,7 +6739,7 @@ async function refineQualityProfiles(specs, lock, options = {}) {
6729
6739
  continue;
6730
6740
  }
6731
6741
  if (inspection.state === "blocked") {
6732
- result.failed++;
6742
+ result.blocked++;
6733
6743
  result.items.push(inspection);
6734
6744
  continue;
6735
6745
  }
@@ -13045,7 +13055,8 @@ var PixelLabProvider = class _PixelLabProvider {
13045
13055
  image: { base64: bytes.toString("base64"), format: "png" },
13046
13056
  view: spec.view,
13047
13057
  resultSize: character.portrait.size,
13048
- seed: spec.seed,
13058
+ // No seed, ever, not even the style's: given one, PixelLab draws a generic face
13059
+ // and ignores the character image (measured, docs/ENDPOINTS.md, "Portrait seeds").
13049
13060
  targetPalette: targetPaletteFor(spec)
13050
13061
  });
13051
13062
  return {
@@ -13055,9 +13066,6 @@ var PixelLabProvider = class _PixelLabProvider {
13055
13066
  kind: "portrait",
13056
13067
  parentCharacterId: parentId,
13057
13068
  backgroundJobId: res2.background_job_id,
13058
- // PixelLab expires finished jobs within about a day, so the seed sent is kept here;
13059
- // poll replaces it with the one the job reports using.
13060
- ...spec.seed != null ? { seed: spec.seed } : {},
13061
13069
  ...character.portrait.attach ? {} : { attach: false }
13062
13070
  }
13063
13071
  }
@@ -13240,7 +13248,7 @@ var PixelLabProvider = class _PixelLabProvider {
13240
13248
  await this.client.setCharacterPortrait(attach, { base64: bytes.toString("base64"), format: "png" });
13241
13249
  }
13242
13250
  const { billed, lastResponse } = await this.readFinishedJob(meta?.backgroundJobId);
13243
- const seed = typeof lastResponse?.seed === "number" ? lastResponse.seed : meta?.seed;
13251
+ const seed = typeof lastResponse?.seed === "number" ? lastResponse.seed : void 0;
13244
13252
  return {
13245
13253
  status: "ready",
13246
13254
  objectId: jobId,
@@ -16650,6 +16658,11 @@ async function resolveSpecs(loaded, filter) {
16650
16658
  `assets.${assetId}: ${asset.portrait ? "portrait" : "outfit"} needs a character style; "${styleId}" generates ${generator}`
16651
16659
  );
16652
16660
  }
16661
+ if (asset.portrait?.seed !== void 0) {
16662
+ throw new Error(
16663
+ `assets.${assetId}.portrait.seed: PixelLab ignores the character and draws a generic face when a portrait is sent a seed (measured November 2026), so pixelkiln never sends one; remove it`
16664
+ );
16665
+ }
16653
16666
  if (asset.layer && generator !== "character") {
16654
16667
  throw new Error(`assets.${assetId}: layer needs a character style; "${styleId}" generates ${generator}`);
16655
16668
  }
@@ -16721,8 +16734,7 @@ async function resolveSpecs(loaded, filter) {
16721
16734
  outline: style.outline,
16722
16735
  shading: style.shading,
16723
16736
  detail: style.detail,
16724
- // A portrait may pin its own; it reaches the wire and the identity like the style's.
16725
- seed: asset.portrait?.seed ?? style.seed,
16737
+ seed: style.seed,
16726
16738
  uiPieces: generator === "uiAsset" ? asset.pieces : void 0,
16727
16739
  uiElements: generator === "uiAsset" ? asset.elements : void 0,
16728
16740
  uiColorPalette: generator === "uiAsset" || generator === "uiElement" ? style.uiColorPalette : void 0,
@@ -19961,12 +19973,27 @@ function providerCache(mode2) {
19961
19973
  return (id) => {
19962
19974
  let resolved = providers.get(id);
19963
19975
  if (!resolved) {
19964
- resolved = createProvider(id, mode2);
19976
+ resolved = lazyProvider(id, () => createProvider(id, mode2));
19965
19977
  providers.set(id, resolved);
19966
19978
  }
19967
19979
  return resolved;
19968
19980
  };
19969
19981
  }
19982
+ function lazyProvider(id, make) {
19983
+ let real;
19984
+ const target = () => real ??= make();
19985
+ return new Proxy({}, {
19986
+ get(_, prop) {
19987
+ if (prop === "id") return id;
19988
+ const provider = target();
19989
+ const value = Reflect.get(provider, prop, provider);
19990
+ return typeof value === "function" ? value.bind(provider) : value;
19991
+ },
19992
+ has(_, prop) {
19993
+ return prop === "id" || prop in target();
19994
+ }
19995
+ });
19996
+ }
19970
19997
 
19971
19998
  // src/cli/commands/account.ts
19972
19999
  async function runBalance(args) {
@@ -25678,7 +25705,8 @@ async function poll(provider, lock, lockPath, opts = {}) {
25678
25705
  var IN_FLIGHT_POLL_MS = 5e3;
25679
25706
  var sleep2 = (ms) => new Promise((r) => setTimeout(r, ms));
25680
25707
  async function submit(provider, loaded, items, lock, lockPath, opts = {}) {
25681
- const limits = provider.rateLimit?.() ?? DEFAULT_RATE_LIMIT;
25708
+ const local = (spec) => Boolean(spec.mirror || spec.derive || isHeldItem(spec));
25709
+ const limits = items.every((item) => local(item.spec)) ? DEFAULT_RATE_LIMIT : provider.rateLimit?.() ?? DEFAULT_RATE_LIMIT;
25682
25710
  const maxInFlight = opts.maxInFlight ?? limits.maxInFlight;
25683
25711
  const spacing = opts.spacingMs ?? limits.spacingMs;
25684
25712
  const slotPollMs = opts.slotPollMs ?? IN_FLIGHT_POLL_MS;
@@ -25687,7 +25715,7 @@ async function submit(provider, loaded, items, lock, lockPath, opts = {}) {
25687
25715
  });
25688
25716
  const estimates = new Map(items.map((item) => [
25689
25717
  item.key,
25690
- item.spec.mirror || item.spec.derive || isHeldItem(item.spec) ? { amount: 0, unit: item.spec.costUnit, candidates: 1 } : validateCostEstimate(provider.id, provider.estimate(item.spec))
25718
+ local(item.spec) ? { amount: 0, unit: item.spec.costUnit, candidates: 1 } : validateCostEstimate(provider.id, provider.estimate(item.spec))
25691
25719
  ]));
25692
25720
  const units = new Set(items.filter((item) => !item.spec.derive).map((item) => estimates.get(item.key).unit));
25693
25721
  if (units.size > 1) {
@@ -34291,10 +34319,12 @@ async function runRefine(args) {
34291
34319
  );
34292
34320
  }
34293
34321
  }
34294
- log(`
34295
- ${result.processed} refined, ${result.skipped} unchanged, ${result.failed} failed`);
34322
+ log(
34323
+ `
34324
+ ${result.processed} refined, ${result.skipped} unchanged, ` + (result.blocked ? `${result.blocked} blocked, ` : "") + `${result.failed} failed`
34325
+ );
34296
34326
  }
34297
- if (result.failed) process.exitCode = 1;
34327
+ if (result.failed || result.blocked) process.exitCode = 1;
34298
34328
  }
34299
34329
 
34300
34330
  // src/cli/commands/anchors.ts