pixelkiln 0.3.0 → 0.4.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.
@@ -0,0 +1,134 @@
1
+ # Environment provider benchmark
2
+
3
+ This benchmark compares PixelLab and Retro Diffusion on three 256×256 game-art
4
+ briefs. Each brief has two attempts. The test uses the same prompt text and seed
5
+ numbers for both providers, but seeds are not portable between models.
6
+
7
+ The benchmark tests the adapters that PixelKiln ships. It does not rank every
8
+ model or endpoint sold by either provider.
9
+
10
+ ## Setup
11
+
12
+ | Brief | PixelLab route | Retro Diffusion style | Intended output |
13
+ |---|---|---|---|
14
+ | Mountain observatory | `map`, high top-down view | `rd_plus__isometric_asset` | Isolated building on a snowy ridge |
15
+ | River gate | `map`, low top-down view | `rd_plus__topdown_asset` | Isolated landmark spanning water |
16
+ | Alpine valley | `pixflux`, background kept | `rd_plus__environment` | Full scenic background |
17
+
18
+ Both manifests request 256×256 output with seeds `31415` and `27182`. The
19
+ provider-specific route or style is allowed to do its job. No image was picked,
20
+ edited, cropped, or post-processed.
21
+
22
+ PixelLab rejected `view: "isometric"` on the `map` endpoint with HTTP 422. The
23
+ successful observatory attempts use the supported `high top-down` view while
24
+ the shared prompt still asks for an isometric three-quarter view. This is a
25
+ real adapter constraint, so the benchmark records it instead of hiding it.
26
+
27
+ The committed manifests and lockfiles are here:
28
+
29
+ - [PixelLab manifest](../benchmarks/provider-environments/pixellab/pixelkiln.manifest.json)
30
+ - [PixelLab lockfile](../benchmarks/provider-environments/pixellab/pixelkiln.lock.json)
31
+ - [Retro Diffusion manifest](../benchmarks/provider-environments/retrodiffusion/pixelkiln.manifest.json)
32
+ - [Retro Diffusion lockfile](../benchmarks/provider-environments/retrodiffusion/pixelkiln.lock.json)
33
+
34
+ ## Mountain observatory
35
+
36
+ Prompt: `a compact stone observatory built into a snowy mountain ridge,
37
+ isometric three-quarter view, cedar roof, warm windows, isolated with no
38
+ scenery`
39
+
40
+ | PixelLab A | PixelLab B | Retro Diffusion A | Retro Diffusion B |
41
+ |---|---|---|---|
42
+ | ![PixelLab mountain observatory attempt A](../website/public/benchmarks/provider-environments/pixellab/isolated/a/mountain-observatory.png) | ![PixelLab mountain observatory attempt B](../website/public/benchmarks/provider-environments/pixellab/isolated/b/mountain-observatory.png) | ![Retro Diffusion mountain observatory attempt A](../website/public/benchmarks/provider-environments/retrodiffusion/isolated/a/mountain-observatory.png) | ![Retro Diffusion mountain observatory attempt B](../website/public/benchmarks/provider-environments/retrodiffusion/isolated/b/mountain-observatory.png) |
43
+
44
+ PixelLab followed more of the brief. Both attempts place a substantial stone
45
+ building on a snowy ridge, and the first reads as an observatory. Retro
46
+ Diffusion produced tidy cutouts, but both are small cabins on snow-covered
47
+ rocks. The observatory and mountain-ridge ideas mostly disappeared.
48
+
49
+ The trade-off is file readiness. Retro Diffusion removed the background and
50
+ used 35 and 36 colors. PixelLab returned opaque pale backgrounds and used 264
51
+ and 266 colors. PixelLab wins prompt coverage. Retro Diffusion needs less
52
+ cleanup before placement in a game map.
53
+
54
+ ## River gate
55
+
56
+ Prompt: `a fortified village gate spanning a narrow river, three-quarter
57
+ top-down view, stone towers, timber bridge, isolated with no scenery`
58
+
59
+ | PixelLab A | PixelLab B | Retro Diffusion A | Retro Diffusion B |
60
+ |---|---|---|---|
61
+ | ![PixelLab river gate attempt A](../website/public/benchmarks/provider-environments/pixellab/topdown/a/river-gate.png) | ![PixelLab river gate attempt B](../website/public/benchmarks/provider-environments/pixellab/topdown/b/river-gate.png) | ![Retro Diffusion river gate attempt A](../website/public/benchmarks/provider-environments/retrodiffusion/topdown/a/river-gate.png) | ![Retro Diffusion river gate attempt B](../website/public/benchmarks/provider-environments/retrodiffusion/topdown/b/river-gate.png) |
62
+
63
+ All four results are usable concepts. PixelLab shows more of the surrounding
64
+ riverbank and makes the bridge-water relationship obvious. Its outputs are
65
+ opaque scene patches. Retro Diffusion gives cleaner standalone fortifications.
66
+ Attempt B carries water through the gate; attempt A reads more like a drawbridge
67
+ than a river crossing.
68
+
69
+ PixelLab again follows the whole brief more reliably. Retro Diffusion is easier
70
+ to drop onto an existing map because its outputs have 56% to 64% transparent
71
+ pixels. The Retro Diffusion files also stay between 43 and 47 colors, compared
72
+ with PixelLab's 226 to 240.
73
+
74
+ ## Alpine valley background
75
+
76
+ Prompt: `a wide alpine valley at dusk, layered mountains, pine forest, winding
77
+ river, small warm-lit village, full-bleed scenic background`
78
+
79
+ | PixelLab A | PixelLab B | Retro Diffusion A | Retro Diffusion B |
80
+ |---|---|---|---|
81
+ | ![PixelLab alpine valley attempt A](../website/public/benchmarks/provider-environments/pixellab/background/a/alpine-valley.png) | ![PixelLab alpine valley attempt B](../website/public/benchmarks/provider-environments/pixellab/background/b/alpine-valley.png) | ![Retro Diffusion alpine valley attempt A](../website/public/benchmarks/provider-environments/retrodiffusion/background/a/alpine-valley.png) | ![Retro Diffusion alpine valley attempt B](../website/public/benchmarks/provider-environments/retrodiffusion/background/b/alpine-valley.png) |
82
+
83
+ PixelLab's Pixflux route is the surprise here. Both results preserve the wide
84
+ valley, layered mountains, dusk light, winding river, and tiny settlement. They
85
+ also use only 22 and 38 colors. The shapes read cleanly at native size.
86
+
87
+ Retro Diffusion produced attractive scenes with stronger foreground framing
88
+ and more conventional depth. They feel like places the player could enter, but
89
+ the framing narrows the valley and pushes the result toward illustration rather
90
+ than a reusable background layer. They use 37 and 46 colors.
91
+
92
+ For this brief, PixelLab wins on prompt coverage, graphic clarity, consistency,
93
+ and cost. Retro Diffusion wins if the desired result is a closer, more cinematic
94
+ scene.
95
+
96
+ ## Cost and operational results
97
+
98
+ | Provider | Successful images | Charged amount | Final balance |
99
+ |---|---:|---:|---:|
100
+ | PixelLab | 6 | 6 generations | 4,415 generations |
101
+ | Retro Diffusion | 6 | $0.348 | $0.135 |
102
+
103
+ PixelLab charged one generation per image. Retro Diffusion quoted and charged
104
+ $0.058 per RD Plus image.
105
+
106
+ The run also caught two integration details:
107
+
108
+ - PixelLab's `map` endpoint rejected the literal `isometric` view. PixelKiln
109
+ should document or validate the accepted values before submission.
110
+ - Retro Diffusion rounded its live quote up from PixelKiln's formula result of
111
+ $0.057768 to $0.058. PixelKiln now rounds offline estimates up to the live
112
+ quote precision, so planning remains a safe ceiling.
113
+
114
+ Both manifests now pass `doctor`, report a current plan, and have six healthy
115
+ PNG cache entries.
116
+
117
+ ## Recommendation
118
+
119
+ For large isolated buildings or landmarks, start with PixelLab when prompt
120
+ coverage matters most. Budget for background cleanup. Start with Retro
121
+ Diffusion when a transparent, compact, low-color asset matters more than
122
+ capturing every noun in a complex prompt.
123
+
124
+ For full scenic backgrounds, start with PixelLab Pixflux. These two attempts
125
+ were cheaper and more faithful to the brief. Try Retro Diffusion when you want
126
+ foreground framing and a closer illustrated scene.
127
+
128
+ Do not ask either provider for one giant finished level. Generate terrain,
129
+ background, buildings, landmarks, and foreground pieces separately. Compose
130
+ them in the engine, then use integer nearest-neighbor scaling for display.
131
+
132
+ This sample is useful, not definitive. Two attempts expose obvious tendencies,
133
+ but they do not measure every style, prompt family, or model update. Rerun the
134
+ committed manifests when either provider changes its models.
package/docs/README.md CHANGED
@@ -10,6 +10,8 @@ This source also renders at
10
10
  | Guide | Use it for |
11
11
  |---|---|
12
12
  | [Getting started](./GETTING_STARTED.md) | Install from a checkout, create or adopt a project, run the everyday workflow, and decide what belongs in Git. |
13
+ | [Set up PixelLab](./PIXELLAB.md) | Configure the production provider, choose a generator, and use its account workflows. |
14
+ | [Set up Retro Diffusion](./RETRO_DIFFUSION.md) | Configure the experimental provider, choose a style, and understand its live-tested boundary. |
13
15
  | [CLI reference](./CLI.md) | Every command and flag, offline/provider requirements, JSON output, and exit behavior. |
14
16
  | [Manifest reference](./MANIFEST.md) | Every style and asset field, inheritance, generator-specific constraints, mounting, and schema validation. |
15
17
  | [Agent workflows](./AGENTS.md) | Install the official skill and pair agent guidance with the deterministic CLI. |
@@ -19,6 +21,7 @@ This source also renders at
19
21
  | Guide | Use it for |
20
22
  |---|---|
21
23
  | [Generators](./GENERATORS.md) | Choose between `map`, `1dir`, `pixflux`, and `tiles`; understand measured costs and capability trade-offs. |
24
+ | [Environment provider benchmark](./PROVIDER_BENCHMARK.md) | Compare PixelLab and Retro Diffusion on buildings, landmarks, backgrounds, cost, transparency, and prompt coverage. |
22
25
  | [Derived artifacts](./ARTIFACTS.md) | Pack, mount, and export; provenance companions; ownership; force takeover; transactional and crash recovery. |
23
26
  | [Recovery and account safety](./RECOVERY.md) | Restore, caches, adopt, salvage, cross-project claims, tagging, and confirmed purge. |
24
27
  | [Quality gates](./QUALITY.md) | Plan, doctor, audit, cache checks, JSON contracts, and CI usage. |
@@ -31,7 +34,7 @@ This source also renders at
31
34
  | [Library API](./LIBRARY.md) | Public TypeScript imports for planning, auditing, providers, packing, exporting, and managed artifact writes. |
32
35
  | [Tiles and engine exports](./TILES.md) | Structural tile roles, provider rule preservation, generic JSON, Tiled Wang sets, and Godot terrain sets. |
33
36
  | [Measured PixelLab endpoints](./ENDPOINTS.md) | Live-account cost and payload research, endpoint recipes, limits, and unresolved API behavior. |
34
- | [Provider notes](../PROVIDERS.md) | Current provider seam and the next adapter work. |
37
+ | [PixelLab vs. Retro Diffusion](../PROVIDERS.md) | Provider selection, costs, adapter capabilities, confidence, and next work. Start with the provider-specific setup guides above when you are ready to configure a project. |
35
38
 
36
39
  ## Project policies
37
40
 
package/docs/RECOVERY.md CHANGED
@@ -23,7 +23,8 @@ retries at zero generation cost.
23
23
 
24
24
  Two ignored caches accelerate recovery:
25
25
 
26
- - `.pixelkiln/cache/<sha256>.png`: content-addressed generated PNG bytes;
26
+ - `.pixelkiln/cache/<sha256>.png` or `<sha256>.gif`: content-addressed,
27
+ structurally validated generated media bytes;
27
28
  - `pixelkiln.cache.json`: provider object id → remote image hash.
28
29
 
29
30
  ```bash
@@ -90,7 +91,7 @@ rename them before treating them as stable application ids.
90
91
 
91
92
  For a single project, its own lockfile is the whole claim set. On a shared
92
93
  account with several sibling projects, repeating `--claims` on every salvage
93
- run is easy to get wrong — a forgotten lockfile makes another project's paid
94
+ run is easy to get wrong. A forgotten lockfile makes another project's paid
94
95
  art look unclaimed. `workspace` fixes that by registering every sibling once,
95
96
  outside any one manifest:
96
97
 
@@ -104,13 +105,13 @@ pixelkiln workspace claims
104
105
  `workspace status` reports aggregate provider, spend-by-unit, and plan state
105
106
  per project, offline. `workspace claims` validates the catalog and emits the
106
107
  exact union of `objectId`/`reviewObjectId`/`jobId` across every registered
107
- lock — the same union rule `--claims` uses, so the two paths cannot drift.
108
+ lock. This is the same union rule `--claims` uses, so the two paths cannot drift.
108
109
 
109
110
  A registered lockfile that is missing or unreadable is a hard error for
110
111
  `claims`, never a silent skip: an incomplete claim set is precisely what makes
111
112
  another project's shipped art look orphaned. `workspace add` still lets you
112
- register a brand-new project before its first `gen` — it warns rather than
113
- refusing, since the project genuinely has no lock yet — but `claims` and
113
+ register a brand-new project before its first `gen`. It warns rather than
114
+ refusing because the project has no lock yet, but `claims` and
114
115
  `salvage --workspace` both refuse until every registered project has one.
115
116
 
116
117
  Salvage accepts the catalog directly instead of a repeated `--claims` list:
@@ -120,12 +121,12 @@ pixelkiln salvage --workspace pixelkiln.workspace.json --dry-run
120
121
  pixelkiln salvage --workspace pixelkiln.workspace.json
121
122
  ```
122
123
 
123
- `--claims` still works and unions with a workspace's claim set — useful for a
124
+ `--claims` still works and unions with a workspace's claim set. This helps a
124
125
  one-off lockfile that isn't part of the catalog. Choose one workflow per
125
126
  account: `--claims` for an occasional cross-project check, `workspace` once
126
127
  sibling projects are a standing arrangement worth registering once.
127
128
 
128
- The catalog stores paths and project identity, never a credential — each
129
+ The catalog stores paths and project identity, never a credential. Each
129
130
  project still loads its own provider key from its own `.env`. `workspace
130
131
  remove` only edits the catalog file; it never touches art, a lock, or the
131
132
  provider account.
@@ -0,0 +1,110 @@
1
+ # Set up Retro Diffusion
2
+
3
+ Retro Diffusion support is experimental. Authenticated RD Fast and RD Plus
4
+ single-candidate stills have passed from the provider's cost quote through
5
+ validated download, provenance, and recovery. Multi-candidate, tileset, GIF,
6
+ and PNG spritesheet paths have integration tests but still need representative
7
+ paid live runs.
8
+
9
+ [Visit Retro Diffusion](https://www.retrodiffusion.ai/) or open the
10
+ [official API guide](https://www.retrodiffusion.ai/app/guide/api).
11
+
12
+ ## Add the credential
13
+
14
+ Create `.env.local` beside `pixelkiln.manifest.json`:
15
+
16
+ ```dotenv
17
+ RD_API_KEY=...
18
+ ```
19
+
20
+ Keep this file out of Git. PixelKiln also reads the variable from the current
21
+ process environment.
22
+
23
+ ## Select Retro Diffusion
24
+
25
+ Set the top-level provider and keep service-specific choices under the provider
26
+ namespace:
27
+
28
+ ```jsonc
29
+ {
30
+ "name": "my-game",
31
+ "provider": "retrodiffusion",
32
+ "styles": {
33
+ "props": {
34
+ "generator": "map",
35
+ "outDir": "assets/generated/props",
36
+ "providerOptions": {
37
+ "retrodiffusion": {
38
+ "promptStyle": "rd_plus__default",
39
+ "numImages": 4,
40
+ "removeBg": true
41
+ }
42
+ }
43
+ }
44
+ },
45
+ "assets": {
46
+ "anvil": {
47
+ "prompt": "a compact blacksmith anvil",
48
+ "width": 64,
49
+ "height": 64
50
+ }
51
+ }
52
+ }
53
+ ```
54
+
55
+ Run the free checks before a paid request:
56
+
57
+ ```bash
58
+ pixelkiln doctor --dry-run
59
+ pixelkiln plan
60
+ pixelkiln gen --budget 0.1
61
+ ```
62
+
63
+ Copy the exact USD estimate from `plan` into `--budget`. Before PixelKiln sends
64
+ the paid request, it asks Retro Diffusion for a free authoritative quote and
65
+ stops if that quote exceeds the remaining budget.
66
+
67
+ ## Match the style to the workflow
68
+
69
+ | PixelKiln generator | Retro Diffusion selector | Output |
70
+ |---|---|---|
71
+ | `map` or `pixflux` | A normal RD still style such as `rd_fast__default`, `rd_plus__default`, or an environment style | 1 to 16 PNG candidates |
72
+ | `tiles` | `rd_tile__*` | One PNG tileset or tile asset |
73
+ | `animation` | `rd_animation__*` or `rd_advanced_animation__*` | Animated GIF or PNG spritesheet |
74
+
75
+ The provider's style catalog can change. Use its live catalog when choosing a
76
+ selector instead of assuming an example name will remain available.
77
+
78
+ Useful options under `providerOptions.retrodiffusion` include:
79
+
80
+ - `numImages`: 1 to 16 still candidates
81
+ - `removeBg`: background removal for stills
82
+ - `framesDuration`: 4, 6, 8, 10, 12, or 16 for animation
83
+ - `returnSpritesheet`: PNG spritesheet instead of the default GIF
84
+ - `tileX` and `tileY`: seamless axes for supported still styles
85
+ - `extraPrompt`: outside texture for `rd_tile__tileset_advanced`
86
+
87
+ RD Pro and user still styles accept up to nine reference images. Advanced
88
+ animation and tile modes have narrower input rules. PixelKiln validates those
89
+ rules during planning. See the [manifest reference](./MANIFEST.md#experimental-retro-diffusion)
90
+ for complete examples.
91
+
92
+ ## Current operational limits
93
+
94
+ The adapter can report `balance`, but it does not yet expose Retro Diffusion
95
+ account listing, adoption, salvage, tagging, or deletion. Paid output still has
96
+ PixelKiln lockfile provenance and local cache recovery.
97
+
98
+ The shared PixelKiln manifest currently allows arbitrary width and height from
99
+ 16 to 400 pixels, while Retro Diffusion styles can impose smaller limits. In
100
+ the current service catalog, the useful environment and scene-object styles
101
+ top out at 384px. Build very large scenes from separate terrain, background,
102
+ building, landmark, and foreground layers.
103
+
104
+ The [environment benchmark](./PROVIDER_BENCHMARK.md) found clean transparent,
105
+ low-color Retro Diffusion cutouts, while PixelLab followed the more complex
106
+ building prompts more closely. Read [PixelLab vs. Retro Diffusion](../PROVIDERS.md)
107
+ before committing to a large batch.
108
+
109
+ Retro Diffusion publishes its API examples and pricing formulas in the
110
+ [official API repository](https://github.com/Retro-Diffusion/api-examples).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pixelkiln",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "description": "Manifest-driven pixel-art generation, review, recovery, and packaging with deterministic provenance.",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -78,6 +78,8 @@
78
78
  "sprites",
79
79
  "game-assets",
80
80
  "pixellab",
81
+ "retro-diffusion",
82
+ "image-generation",
81
83
  "asset-pipeline",
82
84
  "generative",
83
85
  "lockfile",
@@ -10,6 +10,11 @@
10
10
  "name": {
11
11
  "type": "string"
12
12
  },
13
+ "provider": {
14
+ "type": "string",
15
+ "minLength": 1,
16
+ "default": "pixellab"
17
+ },
13
18
  "styles": {
14
19
  "type": "object",
15
20
  "additionalProperties": {
@@ -21,7 +26,8 @@
21
26
  "1dir",
22
27
  "map",
23
28
  "pixflux",
24
- "tiles"
29
+ "tiles",
30
+ "animation"
25
31
  ],
26
32
  "default": "map"
27
33
  },
@@ -155,6 +161,14 @@
155
161
  "type": "string"
156
162
  },
157
163
  "default": []
164
+ },
165
+ "providerOptions": {
166
+ "type": "object",
167
+ "additionalProperties": {
168
+ "type": "object",
169
+ "additionalProperties": {}
170
+ },
171
+ "default": {}
158
172
  }
159
173
  },
160
174
  "required": [
@@ -11,9 +11,10 @@ submission, reviewed by a human, and recorded with exact provenance.
11
11
  ## Working rules
12
12
 
13
13
  - Locate `pixelkiln.manifest.json` first. Paths are manifest-relative.
14
- - Never inspect, print, or commit provider credentials. PixelKiln can load
15
- `PIXELLAB_API_KEY` from `.env.local` beside the manifest or from the current
16
- working directory.
14
+ - Never inspect, print, or commit provider credentials. Read the manifest's
15
+ top-level `provider`: PixelKiln loads `PIXELLAB_API_KEY` for `pixellab` and
16
+ `RD_API_KEY` for experimental `retrodiffusion` from `.env.local` beside the
17
+ manifest or from the current working directory.
17
18
  - Run `pixelkiln doctor --dry-run` and `pixelkiln plan` before paid work. Report
18
19
  actionable, recoverable, and estimated cost figures with their provider unit.
19
20
  - Do not regenerate recoverable work. Use `pixelkiln restore` first.
@@ -42,10 +43,16 @@ debugging one phase. Use `restore` for missing bytes, `adopt` for exact matches
42
43
  already in the provider account, and `salvage` for reviewed unclaimed objects.
43
44
  Use `pack`, `mount`, or `export` only for the artifact format the project needs.
44
45
 
45
- PixelKiln's orchestration is provider-neutral. PixelLab is currently its only
46
- production and live-tested adapter; `FakeProvider` is the deterministic test
47
- adapter. Do not imply that other production providers already work.
46
+ PixelKiln's orchestration is provider-neutral. PixelLab is its production and
47
+ paid-generation-tested adapter. Retro Diffusion stills, tileset sheets,
48
+ animated GIFs, and PNG spritesheets are experimental. Authenticated RD Fast and
49
+ RD Plus single-candidate stills have passed from quote through validated output
50
+ and recovery. Advanced workflows remain mock-tested.
51
+ `FakeProvider` is the deterministic test adapter. Do not describe Retro
52
+ Diffusion as production-ready until representative multi-candidate, tileset,
53
+ GIF, and spritesheet live smoke tests pass.
48
54
 
49
55
  When working in the PixelKiln repository, consult `docs/GETTING_STARTED.md` for
50
- the full workflow, `docs/CLI.md` for flags, `docs/MANIFEST.md` for the schema,
51
- and `docs/RECOVERY.md` before account adoption, salvage, discard, or purge.
56
+ the full workflow, `docs/PIXELLAB.md` or `docs/RETRO_DIFFUSION.md` for provider
57
+ setup, `docs/CLI.md` for flags, `docs/MANIFEST.md` for the schema, and
58
+ `docs/RECOVERY.md` before account adoption, salvage, discard, or purge.