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.
package/CONTRIBUTING.md CHANGED
@@ -46,7 +46,8 @@ npm run pixelkiln -- plan --manifest examples/minimal/pixelkiln.manifest.json
46
46
  ```
47
47
 
48
48
  Tests must not require a live provider account or API key. Use `FakeProvider`
49
- for pipeline behavior and mocked HTTP responses for PixelLab wire contracts.
49
+ for pipeline behavior and mocked HTTP responses for PixelLab or Retro Diffusion
50
+ wire contracts.
50
51
 
51
52
  ## Change guidelines
52
53
 
package/PROVIDERS.md CHANGED
@@ -1,96 +1,134 @@
1
- # Multi-provider status and notes
1
+ # PixelLab and Retro Diffusion
2
2
 
3
- **The seam is built.** `src/provider.ts` defines the interface;
4
- `src/providers/pixellab.ts` is the reference implementation and
5
- `src/providers/fake.ts` is the in-memory test double. Nothing above the
6
- interface knows about PixelLab.
3
+ PixelKiln can route one manifest through either PixelLab or Retro Diffusion.
4
+ The project model keeps planning, hard budgets, lockfile provenance, human
5
+ review, recovery, and packaging. Each adapter owns its service's
6
+ authentication, pricing, validation, request lifecycle, and output formats.
7
7
 
8
- That is an architectural guarantee, not a compatibility claim: PixelLab is the
9
- only production adapter and the only backend exercised against a live account
10
- today. `FakeProvider` verifies the contract without network access. Until a
11
- second production adapter ships, describe PixelKiln as **provider-neutral by
12
- design and proven with PixelLab**, not as already multi-provider.
8
+ PixelLab remains the default so existing manifests and spec hashes remain
9
+ compatible. Select Retro Diffusion with the manifest's top-level `provider`
10
+ field and keep its settings under `providerOptions.retrodiffusion`.
13
11
 
14
- Both concerns this file previously flagged as blockers are resolved:
12
+ Ready to configure a project? Use [Set up PixelLab](./docs/PIXELLAB.md) for the
13
+ production provider or
14
+ [Set up Retro Diffusion](./docs/RETRO_DIFFUSION.md) for the experimental
15
+ adapter. This page focuses on choosing between them.
15
16
 
16
- - **Cost is no longer assumed to be "generations."** `CostEstimate` carries a
17
- `unit` of `generations | usd | free`, `plan` prints it, and `--budget` is
18
- interpreted in it. `resolveSpecs(..., { provider })` asks the adapter for its
19
- offline estimate, submission validates it again, and lock/status accounting
20
- keeps fractional values separated by unit.
21
- - **Free multi-candidate returns are no longer assumed universal.**
22
- `estimate().candidates` is a provider property; `candidateCount()` moved
23
- behind the interface.
17
+ ## Support status
24
18
 
25
- What remains is writing a second adapter. This file records which one and why.
26
-
27
- ## Midjourney is the wrong first target
28
-
29
- Verified 2026-07-29: **Midjourney has no public developer API.** API keys are
30
- restricted to the Enterprise dashboard and require applying for access. Every
31
- third-party "Midjourney API" works by automating the Discord or web interface,
32
- which violates Midjourney's terms of service and risks the underlying account
33
- being banned.
34
-
35
- Building that adapter would mean shipping something fragile, unsupported, and
36
- capable of getting a user's account terminated. Not worth it.
37
-
38
- ## The right first target: Retro Diffusion
39
-
40
- [Retro Diffusion](https://retrodiffusion.ai/) is PixelLab's closest competitor
41
- and the natural second provider:
42
-
43
- - A real, documented developer API, with
44
- [published examples](https://github.com/Retro-Diffusion/api-examples).
45
- - Purpose-built for pixel art, with grid-aligned output and no blur or
46
- anti-aliasing, so it shares this tool's domain model rather than needing a
47
- downscale and quantize pass bolted on.
48
- - Supports seamless tiles, sprite-sheet animation, and free cost estimates,
49
- which map onto `plan` almost directly.
50
-
51
- Other candidates, in rough order of fit:
52
-
53
- | Provider | API | Pixel-native | Notes |
19
+ | Provider | PixelKiln status | Credential | Cost unit |
54
20
  |---|---|---|---|
55
- | Retro Diffusion | yes | yes | Recommended first adapter |
56
- | [Scenario](https://www.scenario.com/) | yes | partly | Game-asset focused, hosts Retro Diffusion models |
57
- | OpenAI `gpt-image-1` | yes | no | Raster; needs downscale + palette quantization |
58
- | Google Gemini image | yes | no | Same caveat |
59
- | Local ComfyUI + pixel LoRA | n/a | yes | No per-call cost, but a GPU dependency |
60
- | Midjourney | **no** | no | See above |
61
-
62
- ## Resolved: the two economic assumptions
63
-
64
- Both were global assumptions baked into `plan`; both are now provider-owned.
65
- Kept here as the rationale, since a second adapter has to honour them.
66
-
67
- 1. **Cost is not universally "generations".** `Plan.cost` used to be a bare
68
- number meaning PixelLab subscription generations. It now carries a unit: USD
69
- for OpenAI, generations for PixelLab, free for local. `plan` prints an honest
70
- figure and `--budget` means something in every backend.
71
-
72
- 2. **Free candidates were a PixelLab quirk.** The core loop is to generate
73
- small, get 16 candidates for one fixed price, and pick the best. It works
74
- because PixelLab charges per *call* and scales candidates inversely with canvas
75
- size. OpenAI charges per *image*, so 16 candidates costs 16×. The picker
76
- still works either way, but the strategy advice in the README does not
77
- generalise, which is why `candidateCount()` moved behind the interface.
78
-
79
- See `src/provider.ts` for the shipped interface. Lock entries carry a
80
- `provider` field plus `costUnit`, defaulted to `pixellab` and `generations` so
81
- pre-provider/pre-unit v2 lockfiles stay readable. The CLI reports both the
82
- successful-submission estimate and the provider balance delta observed across
83
- the run; those are deliberately separate because provider balances may settle
84
- asynchronously.
85
-
86
- ## Done: the integration tests it unblocked
87
-
88
- `FakeProvider` turned out to be exactly the better test double predicted here.
89
- 17 integration tests now cover `submit → poll → fetch`, `pushTags` and `adopt`.
90
- Those are the stages that spend money and previously had zero coverage, where
91
- four of the five real bugs in this project lived. Verified non-vacuous by mutation:
92
- breaking the output hashes, the budget check, or the v1 lock rejection each
93
- fails tests.
94
-
95
- The contact-sheet request paths are covered through the picker and salvage
96
- integration tests as well as their HTML unit tests.
21
+ | PixelLab | Production; paid generation and account workflows live-tested | `PIXELLAB_API_KEY` | generations |
22
+ | Retro Diffusion | Experimental; authenticated paid still generation, download, provenance, and recovery live-tested; advanced workflows pending | `RD_API_KEY` | USD |
23
+ | FakeProvider | Test-only deterministic lifecycle | none | free |
24
+
25
+ Live tests now cover single-candidate RD Fast and RD Plus stills from cost quote
26
+ through submit, poll, PNG download, lockfile provenance, and cache validation.
27
+ The RD Plus run covered isometric-asset, top-down-asset, and environment styles.
28
+ Retro Diffusion's multi-candidate review, tileset, GIF, and spritesheet paths
29
+ have mocked integration coverage but still need representative paid live runs.
30
+
31
+ ## PixelLab vs. Retro Diffusion
32
+
33
+ This comparison describes the adapters PixelKiln ships today, not every feature
34
+ the providers offer directly.
35
+
36
+ | Decision | PixelLab | Retro Diffusion |
37
+ |---|---|---|
38
+ | Best fit today | Established PixelKiln projects, account reconciliation, and fully live-tested generation | Native pixel-art styles, cash-denominated cost control, animation, and alternate tileset workflows |
39
+ | PixelKiln generators | `map`, `pixflux`, `1dir`, `tiles` | `map` and `pixflux` stills, `tiles`, `animation` |
40
+ | Output | PNG stills, candidates, and structural tile members | PNG stills/tiles/spritesheets or animated GIF |
41
+ | Candidate review | Yes; count varies by generator and size | Yes for 1–16 still candidates; animations and tilesets currently use one result |
42
+ | References | `1dir` and tile style modes | Up to nine for supported RD Pro/user still styles; constrained inputs for animation and tiles |
43
+ | Cost model | Subscription generations | Prepaid USD balance |
44
+ | Cost safety | Offline estimate plus hard generation budget | Offline estimate, hard USD budget, then a free authoritative quote before submission |
45
+ | Account lifecycle | Balance, list, adopt, salvage, tag, and confirmed purge | Balance only in the current adapter |
46
+ | Live confidence | Full paid generation workflows exercised | RD Fast and RD Plus single-candidate stills exercised end to end; multi-candidate, tileset, GIF, and spritesheet runs pending |
47
+
48
+ Choose PixelLab when mature account-object recovery and reconciliation matter,
49
+ or when the measured one-generation `map`/`pixflux` routes fit the work. Choose
50
+ Retro Diffusion when a native animation or spritesheet is required, an RD style
51
+ is the desired look, or a USD quote is easier to budget. For a production batch,
52
+ run one representative asset through the selected provider before expanding the
53
+ scope.
54
+
55
+ ## Large environments, mountains, and buildings
56
+
57
+ Start by deciding whether the result is an isolated map object or a complete
58
+ background. That distinction matters more than raw canvas size.
59
+
60
+ | Asset type | PixelLab through PixelKiln | Retro Diffusion through PixelKiln |
61
+ |---|---|---|
62
+ | Isolated house, building, mountain, or landmark | Start with `map`: arbitrary dimensions up to 400×400 and a measured one-generation cost. Live benchmark outputs had opaque backgrounds, so plan for cleanup. Use `1dir` only when references or candidate variety justify 20–40 generations and a square canvas. | Start with `rd_plus__topdown_asset`, `rd_plus__isometric_asset`, or `rd_tile__scene_object`, depending on perspective. `rd_tile__scene_object` is specifically intended for 64–384px objects placed on tile maps. |
63
+ | Full scenic background | Use `pixflux` with `noBackground: false` when an exact palette matters, or `map` for a simple scene. Current PixelKiln routes top out at 400×400. | `rd_plus__environment` targets one-point-perspective scenes; `rd_plus__topdown_map` targets 3/4 top-down maps. These styles support up to 384×384. |
64
+ | Style consistency across a set | `1dir` accepts a style reference and returns size-dependent candidates, but it is more expensive and capped at the square-object range. | RD Pro accepts up to nine references and has stronger prompt following, but its common styles top out at 256×256 and cost $0.18 per image. Environment-specific RD Plus styles trade references for a larger 384px canvas. |
65
+ | Very large final scene | Generate reusable objects, terrain, and background layers separately; assemble them deterministically and integer-upscale the result. | Use the same layered approach. The API has a 512px overall ceiling, but the useful environment and scene-object styles currently cap at 384px. |
66
+
67
+ For production environments, prefer a kit over a monolith: seamless terrain,
68
+ separate landmarks/buildings, foreground occluders, and a distant backdrop.
69
+ This produces reusable assets, cleaner parallax, easier collision/lighting, and
70
+ cheaper targeted re-rolls. Generate at the intended native pixel resolution,
71
+ then scale by an integer with nearest-neighbor filtering.
72
+
73
+ A visual benchmark should use the same briefs for an isolated building, a
74
+ top-down landmark, and a full scenic background. Use the same intended native
75
+ size and review count. Score silhouette readability, perspective, palette,
76
+ edge cleanliness, tiling/layerability, prompt adherence, and usable results per
77
+ provider unit. Seeds are provider-specific, so equal seed numbers do not make
78
+ the outputs directly reproducible across services.
79
+
80
+ See the [environment provider benchmark](./docs/PROVIDER_BENCHMARK.md) for the
81
+ twelve generated images, prompts, manifests, measured costs, and review.
82
+
83
+ ## Cost comparison
84
+
85
+ The services use different billing units, so PixelKiln never adds their costs
86
+ together.
87
+
88
+ PixelLab figures below are measurements from the endpoints PixelKiln currently
89
+ uses; they are not a conversion to dollars:
90
+
91
+ | PixelLab route | Measured cost |
92
+ |---|---:|
93
+ | `map` | 1 generation |
94
+ | `pixflux` | 1 generation |
95
+ | `1dir` | 20–40 generations |
96
+ | `tiles` | 20–40 generations |
97
+
98
+ Retro Diffusion publishes USD formulas and fixed prices. Examples relevant to
99
+ PixelKiln include RD Fast from about $0.015 per image, RD Plus from about $0.025,
100
+ RD Pro at $0.18, animations from $0.07–$0.25, and tilesets at $0.10. Pixel count,
101
+ style, and candidate count affect the exact still-image quote. Treat
102
+ `pixelkiln plan` as the offline ceiling and the provider's free preflight quote
103
+ as the authoritative submit-time check. See Retro Diffusion's
104
+ [official API examples and pricing formulas](https://github.com/Retro-Diffusion/api-examples#pricing).
105
+
106
+ ## Capability boundary
107
+
108
+ The provider boundary owns behavior that differs between services:
109
+
110
+ - supported generators and provider-specific validation;
111
+ - offline estimates, arbitrary non-empty cost units, and candidate counts;
112
+ - submit/poll response schemas and candidate selection when applicable;
113
+ - downloads and optional account capabilities such as balance, listing,
114
+ tagging, and deletion.
115
+
116
+ Planning groups costs by unit instead of adding incompatible values. A budget
117
+ is interpreted in the active provider's unit. Providers without a balance or
118
+ account-management endpoint can still generate safely because the offline
119
+ estimate and hard budget remain enforced.
120
+
121
+ ## Next validation and expansion
122
+
123
+ 1. Complete representative paid Retro Diffusion multi-candidate, tileset, GIF,
124
+ and spritesheet smoke tests without logging credentials. Single-candidate RD
125
+ Fast and RD Plus still paths have passed end to end.
126
+ 2. Promote only the workflows proven against the live service; keep unsupported
127
+ account operations explicit capability errors.
128
+ 3. Evaluate Scenario as another hosted game-asset provider.
129
+ 4. Add a local ComfyUI adapter for GPU-backed, no-per-call-cost generation.
130
+ 5. Consider general raster providers only with explicit nearest-neighbor,
131
+ palette, transparency, and reproducibility checks.
132
+
133
+ Midjourney is not an adapter target without an official public API. Automating
134
+ its consumer UI would be fragile and could violate provider terms.
package/README.md CHANGED
@@ -15,10 +15,15 @@ local contact sheet, and commit exact provenance beside the files. No LLM is in
15
15
  the orchestration loop; provider calls, polling, hashing, downloads, and filing
16
16
  are deterministic software mechanics.
17
17
 
18
- The orchestration layer is provider-neutral by design. PixelLab is currently
19
- the only production adapter and the only live-tested generation backend;
20
- `FakeProvider` exercises the same contract deterministically in tests. A second
21
- production adapter is roadmap work, not current compatibility.
18
+ The orchestration layer is provider-neutral. PixelLab is the production,
19
+ live-tested backend. An experimental Retro Diffusion adapter supports native
20
+ pixel-art stills, candidate batches, tileset sheets, animated GIFs, and PNG
21
+ spritesheets. Authenticated RD Fast and RD Plus single-candidate still paths
22
+ have passed from quote through validated output and recovery. Multi-candidate,
23
+ tileset, GIF, and spritesheet live runs remain. See
24
+ [PixelLab vs. Retro Diffusion](./PROVIDERS.md) for the trade-offs, including
25
+ large environment and building workflows.
26
+ `FakeProvider` exercises the same contract deterministically in tests.
22
27
 
23
28
  > **Release status:** the package is pre-1.0 and the first npm publication is
24
29
  > tracked in [issue #1](https://github.com/gfargo/pixelkiln/issues/1). Until it
@@ -99,7 +104,11 @@ cd ../my-game
99
104
  Put the provider credential in `.env.local` beside the manifest:
100
105
 
101
106
  ```dotenv
107
+ # PixelLab (the default provider)
102
108
  PIXELLAB_API_KEY=...
109
+
110
+ # Or Retro Diffusion when `provider` is `retrodiffusion`
111
+ RD_API_KEY=...
103
112
  ```
104
113
 
105
114
  Validate locally, inspect exact work/cost, then generate with a hard ceiling:
@@ -127,6 +136,9 @@ pixelkiln plan
127
136
  ```
128
137
 
129
138
  See [Getting started](./docs/GETTING_STARTED.md) for new and existing projects.
139
+ Use [Set up PixelLab](./docs/PIXELLAB.md) or
140
+ [Set up Retro Diffusion](./docs/RETRO_DIFFUSION.md) for provider-specific
141
+ credentials, manifest examples, and current limits.
130
142
 
131
143
  ## Agent skill
132
144
 
@@ -149,6 +161,7 @@ packaging layer.
149
161
  {
150
162
  "$schema": "./node_modules/pixelkiln/schema/manifest.schema.json",
151
163
  "name": "my-game",
164
+ "provider": "pixellab",
152
165
  "styles": {
153
166
  "base": {
154
167
  "generator": "map",
@@ -168,7 +181,12 @@ packaging layer.
168
181
  Styles are namespaces. Adding a second style re-derives the same asset ids into
169
182
  a separate output directory and separate lock keys without clobbering the first
170
183
  set. Generator choice, reference-image bytes, dimensions, palette, seed, and
171
- prompt settings participate in deterministic spec identity.
184
+ prompt settings participate in deterministic spec identity. A manifest may
185
+ select `retrodiffusion` instead and pass namespaced `providerOptions`; see
186
+ [Set up PixelLab](./docs/PIXELLAB.md),
187
+ [Set up Retro Diffusion](./docs/RETRO_DIFFUSION.md), and
188
+ [PixelLab vs. Retro Diffusion](./PROVIDERS.md) for configuration, costs,
189
+ current confidence, and limitations.
172
190
 
173
191
  The schema rejects unknown fields and invalid generator combinations before
174
192
  planning. See the [Manifest reference](./docs/MANIFEST.md).
@@ -212,6 +230,11 @@ replace a hard palette or reference-image constraint. See
212
230
  [Generator selection](./docs/GENERATORS.md) and the
213
231
  [measured endpoint reference](./docs/ENDPOINTS.md).
214
232
 
233
+ Generator names describe PixelKiln workflows; their exact capabilities and
234
+ prices depend on the selected provider. Retro Diffusion also supports the
235
+ provider-specific `animation` generator. Compare the adapters in
236
+ [PixelLab vs. Retro Diffusion](./PROVIDERS.md).
237
+
215
238
  ## Derived artifacts
216
239
 
217
240
  ```bash
@@ -264,8 +287,9 @@ pixelkiln salvage --workspace pixelkiln.workspace.json
264
287
  ```
265
288
 
266
289
  A registered project's missing or unreadable lockfile is a hard error for
267
- `workspace claims` and `salvage --workspace` never a silent skip. Purge only
268
- targets objects already tagged discard and requires an explicit confirmation.
290
+ `workspace claims` and `salvage --workspace`. Missing claims are never skipped.
291
+ Purge only targets objects already tagged discard and requires an explicit
292
+ confirmation.
269
293
  See [Recovery and account safety](./docs/RECOVERY.md).
270
294
 
271
295
  ## Automation
@@ -312,10 +336,13 @@ writes, and offline provenance verification. See [Library API](./docs/LIBRARY.md
312
336
  |---|---|
313
337
  | [Documentation index](./docs/README.md) | All user, workflow, reference, and architecture guides. |
314
338
  | [Getting started](./docs/GETTING_STARTED.md) | First project, existing-art onboarding, everyday workflow, and what to commit. |
339
+ | [Set up PixelLab](./docs/PIXELLAB.md) | Production-provider credentials, manifest, generators, and account workflows. |
340
+ | [Set up Retro Diffusion](./docs/RETRO_DIFFUSION.md) | Experimental-provider credentials, styles, formats, cost checks, and limits. |
315
341
  | [CLI reference](./docs/CLI.md) | Every command, flag, JSON mode, and exit contract. |
316
342
  | [Manifest reference](./docs/MANIFEST.md) | Every style/asset field and generator constraint. |
317
- | [Agent workflows](./docs/AGENTS.md) | Official skill install, operating model, and PixelLab MCP pairing. |
343
+ | [Agent workflows](./docs/AGENTS.md) | Official skill install, operating model, and provider-aware safety. |
318
344
  | [Generators](./docs/GENERATORS.md) | Capability choice, measured costs, palettes, style references, and tiles. |
345
+ | [Environment provider benchmark](./docs/PROVIDER_BENCHMARK.md) | Twelve matched outputs comparing buildings, landmarks, backgrounds, cost, and file readiness. |
319
346
  | [Derived artifacts](./docs/ARTIFACTS.md) | Pack, mount, export, provenance, ownership, transactions, and recovery. |
320
347
  | [Recovery](./docs/RECOVERY.md) | Restore, caches, adopt, salvage, claims, and purge safety. |
321
348
  | [Quality gates](./docs/QUALITY.md) | Plan, doctor, audit, cache, JSON, and CI. |
@@ -323,6 +350,7 @@ writes, and offline provenance verification. See [Library API](./docs/LIBRARY.md
323
350
  | [Library API](./docs/LIBRARY.md) | Public TypeScript contracts and examples. |
324
351
  | [Tiles](./docs/TILES.md) | Structural outputs and generic/Tiled/Godot formats. |
325
352
  | [Endpoint research](./docs/ENDPOINTS.md) | Measured PixelLab API behavior and recipes. |
353
+ | [PixelLab vs. Retro Diffusion](./PROVIDERS.md) | Provider selection, costs, supported workflows, confidence, and limitations. |
326
354
 
327
355
  The [public documentation site](https://pixelkiln.griffen.codes/docs) is built by
328
356
  the application in [`website/`](./website/README.md). It reads these Markdown
@@ -330,7 +358,7 @@ files directly at build time, so the website and published package share one
330
358
  documentation source.
331
359
 
332
360
  Project policies: [Contributing](./CONTRIBUTING.md),
333
- [Security](./SECURITY.md), and [provider notes](./PROVIDERS.md).
361
+ [Security](./SECURITY.md), and [provider comparison](./PROVIDERS.md).
334
362
 
335
363
  ## Scope
336
364
 
package/SECURITY.md CHANGED
@@ -28,11 +28,12 @@ reporter.
28
28
 
29
29
  ## Sensitive areas
30
30
 
31
- Pixelkiln handles provider credentials, paid API actions, remote object deletion,
31
+ PixelKiln handles provider credentials, paid API actions, remote object deletion,
32
32
  local output paths, a localhost review server, and generated HTML containing
33
33
  provider data. Reports involving authentication leakage, path traversal,
34
34
  cross-origin review actions, HTML/script injection, unsafe overwrite/delete
35
35
  behavior, lockfile corruption, or budget bypass are security relevant.
36
36
 
37
- Never attach a real `PIXELLAB_API_KEY`, `.env` file, private provider URL, or
38
- unredacted lockfile from a confidential project to a public report.
37
+ Never attach a real `PIXELLAB_API_KEY`, `RD_API_KEY`, `.env` file, private
38
+ provider URL, or unredacted lockfile from a confidential project to a public
39
+ report.