pixelkiln 0.102.2 → 0.104.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 CHANGED
@@ -1426,6 +1426,11 @@ function specHash(spec, styleImageHashes, providerOptionIdentity = spec.provider
1426
1426
  terrainSideWallThickness: spec.terrainSideWallThickness,
1427
1427
  terrainSideWallPlacement: spec.terrainSideWallPlacement,
1428
1428
  terrainEnhance: spec.terrainEnhance,
1429
+ // Absent unless a pixflux style sets it, so every older hash stands.
1430
+ textGuidanceScale: spec.textGuidanceScale,
1431
+ subjectDirection: spec.subjectDirection,
1432
+ isometric: spec.isometric,
1433
+ backgroundRemoval: spec.backgroundRemoval,
1429
1434
  terrainPlatformThickness: spec.terrainPlatformThickness,
1430
1435
  // Reference images enter as their bytes' hashes, never their paths.
1431
1436
  // The starting image by its bytes, with its strength only when set.
@@ -2696,13 +2701,24 @@ var StyleObjectSchema = z.object({
2696
2701
  /** `character` only, `standard` humanoid bases. A preset or multipliers; an asset may override it. */
2697
2702
  proportions: CharacterProportionsSchema.optional(),
2698
2703
  /**
2699
- * `character` only. How closely a `standard` base and a template loop
2700
- * follow their text, 1 to 20; PixelLab's default is 8. The v3 and pro
2701
- * engines do not take it.
2704
+ * `character` and `pixflux`. How closely a `standard` character base
2705
+ * and a template loop, or a `pixflux` image, follow their text, 1 to 20;
2706
+ * PixelLab's default is 8. The v3 and pro character engines do not take
2707
+ * it. Part of a `pixflux` asset's identity only when set.
2702
2708
  */
2703
2709
  textGuidanceScale: z.number().min(1).max(20).optional(),
2704
- /** `character` only. Draw `standard` bases and every loop in isometric view. */
2710
+ /**
2711
+ * `character` and `pixflux`. Draw `standard` character bases and every
2712
+ * loop, or a `pixflux` image, in isometric view. PixelLab calls it weakly
2713
+ * guiding on `pixflux`. Part of a `pixflux` asset's identity only when true.
2714
+ */
2705
2715
  isometric: z.boolean().optional(),
2716
+ /**
2717
+ * `pixflux` only, with `noBackground`: how the background is cut away.
2718
+ * `simple` is PixelLab's default and faster; `complex` handles fine or
2719
+ * busy edges better. Part of the asset's identity only when set.
2720
+ */
2721
+ backgroundRemoval: z.enum(["simple", "complex"]).optional(),
2706
2722
  /** `character` only, `v3` bases: let PixelLab expand the prompt into a fuller one before drawing. */
2707
2723
  enhancePrompt: z.boolean().optional(),
2708
2724
  /**
@@ -2776,6 +2792,20 @@ var StyleSchema = StyleObjectSchema.refine((s) => !(s.tileFeature && s.styleImag
2776
2792
  message: "tileFeature and styleImages cannot be combined; a connectable set derives its own tile geometry, so remove one or the other",
2777
2793
  path: ["tileFeature"]
2778
2794
  }).superRefine((style, ctx) => {
2795
+ if (style.backgroundRemoval !== void 0 && style.generator !== "pixflux") {
2796
+ ctx.addIssue({
2797
+ code: z.ZodIssueCode.custom,
2798
+ message: `backgroundRemoval is taken by pixflux styles; this one uses "${style.generator}"`,
2799
+ path: ["backgroundRemoval"]
2800
+ });
2801
+ }
2802
+ if (style.backgroundRemoval !== void 0 && !style.noBackground) {
2803
+ ctx.addIssue({
2804
+ code: z.ZodIssueCode.custom,
2805
+ message: "backgroundRemoval chooses how the background is cut away; this style keeps its background (noBackground is false)",
2806
+ path: ["backgroundRemoval"]
2807
+ });
2808
+ }
2779
2809
  if (style.quality && (style.generator === "tiles" || style.generator === "terrain" || style.generator === "animation" || style.generator === "vfx")) {
2780
2810
  ctx.addIssue({
2781
2811
  code: z.ZodIssueCode.custom,
@@ -3009,6 +3039,12 @@ var AssetSchema = z.object({
3009
3039
  * instead of starting from nothing.
3010
3040
  */
3011
3041
  initImage: z.string().min(1).optional(),
3042
+ /**
3043
+ * `pixflux` styles: the way the subject faces. PixelLab calls it weakly
3044
+ * guiding, so treat it as a nudge. Part of the asset's identity only
3045
+ * when set.
3046
+ */
3047
+ direction: CharacterDirectionSchema.optional(),
3012
3048
  /**
3013
3049
  * With `initImage`: how strongly the starting image holds, 1 to 999.
3014
3050
  * PixelLab's default is 300.
@@ -8156,6 +8192,12 @@ var PixelLabClient = class {
8156
8192
  if (args.shading) body.shading = args.shading;
8157
8193
  if (args.detail) body.detail = args.detail;
8158
8194
  if (args.view) body.view = args.view;
8195
+ if (args.textGuidanceScale != null) body.text_guidance_scale = args.textGuidanceScale;
8196
+ if (args.direction) body.direction = args.direction;
8197
+ if (args.isometric) body.isometric = true;
8198
+ if (args.backgroundRemoval) {
8199
+ body.background_removal_task = args.backgroundRemoval === "complex" ? "remove_complex_background" : "remove_simple_background";
8200
+ }
8159
8201
  if (args.seed != null) body.seed = args.seed;
8160
8202
  const res = validateResponse(
8161
8203
  PixfluxResponseSchema,
@@ -11834,6 +11876,10 @@ var PixelLabProvider = class _PixelLabProvider {
11834
11876
  detail: spec.detail,
11835
11877
  // Only a view the style states: the resolved default would steer every scene and banner top-down.
11836
11878
  view: spec.styleView,
11879
+ textGuidanceScale: spec.textGuidanceScale,
11880
+ direction: spec.subjectDirection,
11881
+ isometric: spec.isometric,
11882
+ backgroundRemoval: spec.backgroundRemoval,
11837
11883
  seed: spec.seed,
11838
11884
  ...await initImageArgs(spec)
11839
11885
  });
@@ -14970,6 +15016,9 @@ async function resolveSpecs(loaded, filter) {
14970
15016
  size,
14971
15017
  view: style.view ?? (generator === "1dir" ? "top-down" : generator === "character" ? "low top-down" : "high top-down"),
14972
15018
  ...style.view !== void 0 ? { styleView: style.view } : {},
15019
+ ...generator === "pixflux" && style.textGuidanceScale !== void 0 ? { textGuidanceScale: style.textGuidanceScale } : {},
15020
+ ...generator === "pixflux" && style.isometric ? { isometric: true } : {},
15021
+ ...generator === "pixflux" && style.backgroundRemoval ? { backgroundRemoval: style.backgroundRemoval } : {},
14973
15022
  styleImagePaths: style.styleImages.map((s) => s.path),
14974
15023
  outline: style.outline,
14975
15024
  shading: style.shading,
@@ -15472,6 +15521,12 @@ async function resolveSpecs(loaded, filter) {
15472
15521
  }
15473
15522
  resolved.terrainConnect = links;
15474
15523
  }
15524
+ if (asset.direction) {
15525
+ if (resolved.generator !== "pixflux") {
15526
+ throw new Error(`assets.${assetId}.direction: a facing is taken by pixflux styles; style "${styleId}" uses "${resolved.generator}"`);
15527
+ }
15528
+ resolved.subjectDirection = asset.direction;
15529
+ }
15475
15530
  if (asset.initImage) {
15476
15531
  if (!["pixflux", "map", "isometricTile"].includes(resolved.generator)) {
15477
15532
  throw new Error(