pixelkiln 0.2.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 +50 -1
- package/NAMING.md +15 -15
- package/PROVIDERS.md +128 -90
- package/README.md +57 -16
- package/SECURITY.md +4 -3
- package/dist/cli.d.ts +18 -1
- package/dist/cli.js +1248 -281
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +911 -102
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +547 -228
- package/dist/index.d.ts +547 -228
- package/dist/index.js +887 -102
- package/dist/index.js.map +1 -1
- package/docs/AGENTS.md +13 -6
- package/docs/ARCHITECTURE.md +27 -15
- package/docs/CLI.md +57 -4
- package/docs/ENDPOINTS.md +39 -38
- package/docs/GENERATORS.md +6 -1
- package/docs/GETTING_STARTED.md +24 -5
- package/docs/LIBRARY.md +4 -4
- package/docs/MANIFEST.md +103 -5
- package/docs/PIXELLAB.md +100 -0
- package/docs/PROVIDER_BENCHMARK.md +134 -0
- package/docs/README.md +4 -1
- package/docs/RECOVERY.md +46 -1
- package/docs/RETRO_DIFFUSION.md +110 -0
- package/docs/TILES.md +1 -1
- package/examples/minimal/README.md +2 -2
- package/package.json +3 -1
- package/schema/manifest.schema.json +15 -1
- package/schema/workspace.schema.json +54 -0
- package/skills/pixelkiln/SKILL.md +15 -8
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,185 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
|
|
3
|
+
declare const MediaType: {
|
|
4
|
+
readonly PNG: "image/png";
|
|
5
|
+
readonly GIF: "image/gif";
|
|
6
|
+
};
|
|
7
|
+
type MediaType = (typeof MediaType)[keyof typeof MediaType];
|
|
8
|
+
declare function mediaExtension(mediaType: MediaType): ".png" | ".gif";
|
|
9
|
+
declare function mediaTypeFromExtension(file: string): MediaType | null;
|
|
10
|
+
declare function detectMediaType(bytes: Buffer): MediaType | null;
|
|
11
|
+
/** Validate durable provider output before it reaches disk or the recovery cache. */
|
|
12
|
+
declare function validateMedia(bytes: Buffer, expected?: MediaType): MediaType;
|
|
13
|
+
declare function cacheFileName(hash: string, mediaType?: MediaType): string;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* What a provider charges in. Cost is not universally "generations": PixelLab
|
|
17
|
+
* bills a subscription quota, OpenAI bills dollars per image, a local model
|
|
18
|
+
* bills nothing. `plan` prints the unit alongside the number so the figure is
|
|
19
|
+
* never silently misread, and `--budget` is interpreted in the active unit.
|
|
20
|
+
*/
|
|
21
|
+
/**
|
|
22
|
+
* Human-readable unit attached to every estimate and recorded charge.
|
|
23
|
+
* Built-ins use generations/USD/free; adapters may report non-convertible
|
|
24
|
+
* units such as "credits" without pretending they are dollars.
|
|
25
|
+
*/
|
|
26
|
+
type CostUnit = "generations" | "usd" | "free" | (string & {});
|
|
27
|
+
interface CostEstimate {
|
|
28
|
+
unit: CostUnit;
|
|
29
|
+
amount: number;
|
|
30
|
+
/**
|
|
31
|
+
* How many candidates one call returns. This is a provider property, not a
|
|
32
|
+
* universal truth — PixelLab's `1dir` returns up to 64 for a single fixed
|
|
33
|
+
* price, whereas a per-image provider returns one and charges N times for N.
|
|
34
|
+
* The "generate small, pick from many" strategy only pays off where this is
|
|
35
|
+
* greater than 1 at no extra cost.
|
|
36
|
+
*/
|
|
37
|
+
candidates: number;
|
|
38
|
+
}
|
|
39
|
+
/** Runtime guard for third-party adapters before estimates influence a budget. */
|
|
40
|
+
declare function validateCostEstimate(providerId: string, value: unknown): CostEstimate;
|
|
41
|
+
interface OutputSource {
|
|
42
|
+
url: string;
|
|
43
|
+
/** Stable semantic/index role used in filenames and lockfile outputs. */
|
|
44
|
+
role?: string;
|
|
45
|
+
/** Durable byte format. Omission preserves legacy PNG behavior. */
|
|
46
|
+
mediaType?: MediaType;
|
|
47
|
+
}
|
|
48
|
+
interface PollContext {
|
|
49
|
+
/** Distinguishes structural tile sets from independent tile candidates. */
|
|
50
|
+
tileFeature?: string;
|
|
51
|
+
/** Current resolved intent, needed when output media depends on provider options. */
|
|
52
|
+
spec?: ResolvedSpec;
|
|
53
|
+
}
|
|
54
|
+
/** Provider-owned, JSON-serializable details needed by downstream exporters. */
|
|
55
|
+
type ProviderMetadata = Record<string, unknown>;
|
|
56
|
+
/** Terminal and non-terminal states a queued job can be observed in. */
|
|
57
|
+
type JobState = {
|
|
58
|
+
status: "processing";
|
|
59
|
+
progressPercent?: number | null;
|
|
60
|
+
etaSeconds?: number | null;
|
|
61
|
+
} | {
|
|
62
|
+
status: "review";
|
|
63
|
+
candidateUrls: string[];
|
|
64
|
+
} | {
|
|
65
|
+
status: "ready";
|
|
66
|
+
objectId: string;
|
|
67
|
+
/** Kept for compatibility with single-output provider implementations. */
|
|
68
|
+
sourceUrl: string | null;
|
|
69
|
+
/** Present for structural multi-output results. */
|
|
70
|
+
sources?: OutputSource[];
|
|
71
|
+
/** Preserved under the provider's namespace in the lockfile. */
|
|
72
|
+
metadata?: ProviderMetadata;
|
|
73
|
+
} | {
|
|
74
|
+
status: "failed";
|
|
75
|
+
error: string;
|
|
76
|
+
};
|
|
77
|
+
/** A previously generated asset as the provider reports it. */
|
|
78
|
+
interface RemoteAsset {
|
|
79
|
+
id: string;
|
|
80
|
+
prompt: string;
|
|
81
|
+
width: number;
|
|
82
|
+
height: number;
|
|
83
|
+
createdAt: string;
|
|
84
|
+
previewUrl: string | null;
|
|
85
|
+
tags: string[];
|
|
86
|
+
status: string;
|
|
87
|
+
}
|
|
88
|
+
interface BalanceInfo {
|
|
89
|
+
unit: CostUnit;
|
|
90
|
+
remaining: number;
|
|
91
|
+
total?: number;
|
|
92
|
+
plan?: string;
|
|
93
|
+
}
|
|
94
|
+
interface BalanceChange {
|
|
95
|
+
unit: CostUnit;
|
|
96
|
+
before: number;
|
|
97
|
+
after: number;
|
|
98
|
+
/** Provider-reported quota/currency consumed between the two readings. */
|
|
99
|
+
spent: number;
|
|
100
|
+
/** Quota/currency added between readings, e.g. a refill during the run. */
|
|
101
|
+
credited: number;
|
|
102
|
+
}
|
|
103
|
+
/** Compare two provider readings without ever combining incompatible units. */
|
|
104
|
+
declare function measureBalanceChange(before: BalanceInfo, after: BalanceInfo): BalanceChange | null;
|
|
105
|
+
/**
|
|
106
|
+
* Submission constraints a backend enforces upstream, in its own units —
|
|
107
|
+
* `submit` has no business knowing these numbers itself.
|
|
108
|
+
*/
|
|
109
|
+
interface RateLimit {
|
|
110
|
+
/** Minimum time between successive submissions, global across the account. */
|
|
111
|
+
spacingMs: number;
|
|
112
|
+
/** Background jobs allowed in flight at once. */
|
|
113
|
+
maxInFlight: number;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Used when a provider doesn't declare `rateLimit()` — conservative enough
|
|
117
|
+
* not to be a real constraint for a provider that has none of its own, and
|
|
118
|
+
* overridable per run via `submit`'s own options regardless.
|
|
119
|
+
*/
|
|
120
|
+
declare const DEFAULT_RATE_LIMIT: RateLimit;
|
|
121
|
+
/**
|
|
122
|
+
* A backend that turns a resolved spec into durable image or animation bytes.
|
|
123
|
+
*
|
|
124
|
+
* Everything above this interface — the manifest, the lockfile, plan diffing,
|
|
125
|
+
* salvage, the contact sheets — is provider-agnostic. Everything that knows a
|
|
126
|
+
* URL shape or an auth header lives below it.
|
|
127
|
+
*
|
|
128
|
+
* The optional members are genuinely optional capabilities rather than
|
|
129
|
+
* convenience: a provider with no queryable asset list cannot support `adopt`
|
|
130
|
+
* or `salvage`, and the CLI reports that rather than failing obscurely.
|
|
131
|
+
*/
|
|
132
|
+
interface Provider {
|
|
133
|
+
readonly id: string;
|
|
134
|
+
/** False for a generator this backend cannot express (e.g. non-square). */
|
|
135
|
+
supports(generator: Generator): boolean;
|
|
136
|
+
/** Never performs I/O — `plan` must stay free and offline. */
|
|
137
|
+
estimate(spec: ResolvedSpec): CostEstimate;
|
|
138
|
+
/** Provider-specific, offline validation after references resolve. */
|
|
139
|
+
validate?(spec: ResolvedSpec, styleImages: ResolvedStyleImage[]): void;
|
|
140
|
+
/** This backend's own submission constraints. Falls back to
|
|
141
|
+
* `DEFAULT_RATE_LIMIT` when absent — see that constant's doc. */
|
|
142
|
+
rateLimit?(): RateLimit;
|
|
143
|
+
submit(spec: ResolvedSpec, styleImages: ResolvedStyleImage[]): Promise<{
|
|
144
|
+
jobId: string;
|
|
145
|
+
}>;
|
|
146
|
+
poll(jobId: string, generator: Generator, context?: PollContext): Promise<JobState>;
|
|
147
|
+
/**
|
|
148
|
+
* Promote one candidate from a review-status job to a standalone asset.
|
|
149
|
+
* Only meaningful where `estimate().candidates > 1`.
|
|
150
|
+
*
|
|
151
|
+
* `generator` is passed because "promote" is not universal: PixelLab's
|
|
152
|
+
* frame-based generators create a new account object, while a tiles
|
|
153
|
+
* variation is already a finished image and there is nothing to promote.
|
|
154
|
+
* A provider that treats every candidate alike can ignore it.
|
|
155
|
+
*/
|
|
156
|
+
selectCandidate?(jobId: string, index: number, commonTag?: string, generator?: Generator): Promise<{
|
|
157
|
+
objectId: string;
|
|
158
|
+
sourceUrl: string | null;
|
|
159
|
+
}>;
|
|
160
|
+
/** Storage URLs are usually public; implementations should not send auth. */
|
|
161
|
+
download(url: string): Promise<Buffer>;
|
|
162
|
+
/** Query an authoritative account balance when the service exposes one. */
|
|
163
|
+
balance?(): Promise<BalanceInfo>;
|
|
164
|
+
/** Free-form labels on the remote asset. Absent if unsupported. */
|
|
165
|
+
setTags?(objectId: string, tags: string[]): Promise<void>;
|
|
166
|
+
/** Walk every asset on the account. Required by `adopt` and `salvage`. */
|
|
167
|
+
list?(): AsyncGenerator<RemoteAsset>;
|
|
168
|
+
/** Irreversible. Only reached via `purge`, behind explicit confirmation. */
|
|
169
|
+
delete?(assetId: string): Promise<void>;
|
|
170
|
+
}
|
|
171
|
+
declare class UnsupportedCapabilityError extends Error {
|
|
172
|
+
constructor(providerId: string, capability: string);
|
|
173
|
+
}
|
|
174
|
+
/** Narrowing helpers so call sites fail with a clear message, not `undefined is not a function`. */
|
|
175
|
+
declare function requireList(provider: Provider): NonNullable<Provider["list"]>;
|
|
176
|
+
declare function requireDelete(provider: Provider): NonNullable<Provider["delete"]>;
|
|
177
|
+
declare function requireSelectCandidate(provider: Provider): NonNullable<Provider["selectCandidate"]>;
|
|
178
|
+
declare function requireBalance(provider: Provider): NonNullable<Provider["balance"]>;
|
|
179
|
+
declare function formatCost(unit: CostUnit, amount: number): string;
|
|
180
|
+
|
|
3
181
|
/**
|
|
4
|
-
* Which
|
|
182
|
+
* Which provider capability produces the asset. The choice is mostly about cost,
|
|
5
183
|
* and the gap is enormous — all figures measured against a live account.
|
|
6
184
|
*
|
|
7
185
|
* map POST /map-objects — THE DEFAULT.
|
|
@@ -31,7 +209,7 @@ import { z } from 'zod';
|
|
|
31
209
|
* parameter on /map-objects returns a 500, so the palette lock is
|
|
32
210
|
* pixflux-only. Its rendering is flatter than 1dir's.
|
|
33
211
|
*/
|
|
34
|
-
declare const GeneratorSchema: z.ZodEnum<["1dir", "map", "pixflux", "tiles"]>;
|
|
212
|
+
declare const GeneratorSchema: z.ZodEnum<["1dir", "map", "pixflux", "tiles", "animation"]>;
|
|
35
213
|
type Generator = z.infer<typeof GeneratorSchema>;
|
|
36
214
|
/** A decoded style reference ready for a provider-specific request body. */
|
|
37
215
|
interface ResolvedStyleImage {
|
|
@@ -116,7 +294,7 @@ declare function generationCost(width: number, height: number, generator?: Gener
|
|
|
116
294
|
*/
|
|
117
295
|
declare function tilesCost(tileSize: number, variations: number): number;
|
|
118
296
|
declare const StyleSchema: z.ZodEffects<z.ZodObject<{
|
|
119
|
-
generator: z.ZodDefault<z.ZodEnum<["1dir", "map", "pixflux", "tiles"]>>;
|
|
297
|
+
generator: z.ZodDefault<z.ZodEnum<["1dir", "map", "pixflux", "tiles", "animation"]>>;
|
|
120
298
|
/** Square edge length for `1dir`. 32-256. */
|
|
121
299
|
size: z.ZodOptional<z.ZodNumber>;
|
|
122
300
|
view: z.ZodOptional<z.ZodString>;
|
|
@@ -126,7 +304,7 @@ declare const StyleSchema: z.ZodEffects<z.ZodObject<{
|
|
|
126
304
|
promptPrefix: z.ZodDefault<z.ZodString>;
|
|
127
305
|
/** Style reference images. */
|
|
128
306
|
styleImages: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
129
|
-
/** Path to a PNG/JPEG, relative to the manifest
|
|
307
|
+
/** Path to a PNG/JPEG, relative to the manifest; the active provider validates limits. */
|
|
130
308
|
path: z.ZodString;
|
|
131
309
|
}, "strip", z.ZodTypeAny, {
|
|
132
310
|
path: string;
|
|
@@ -239,8 +417,10 @@ declare const StyleSchema: z.ZodEffects<z.ZodObject<{
|
|
|
239
417
|
}>>;
|
|
240
418
|
/** Tags applied to every object generated in this style, for server-side filtering. */
|
|
241
419
|
tags: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
420
|
+
/** Adapter-owned settings, keyed by provider id. */
|
|
421
|
+
providerOptions: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
242
422
|
}, "strict", z.ZodTypeAny, {
|
|
243
|
-
generator: "
|
|
423
|
+
generator: "map" | "1dir" | "pixflux" | "tiles" | "animation";
|
|
244
424
|
promptSuffix: string;
|
|
245
425
|
promptPrefix: string;
|
|
246
426
|
styleImages: {
|
|
@@ -250,6 +430,7 @@ declare const StyleSchema: z.ZodEffects<z.ZodObject<{
|
|
|
250
430
|
noBackground: boolean;
|
|
251
431
|
palette: string[];
|
|
252
432
|
tags: string[];
|
|
433
|
+
providerOptions: Record<string, Record<string, unknown>>;
|
|
253
434
|
size?: number | undefined;
|
|
254
435
|
view?: string | undefined;
|
|
255
436
|
outline?: string | undefined;
|
|
@@ -269,7 +450,7 @@ declare const StyleSchema: z.ZodEffects<z.ZodObject<{
|
|
|
269
450
|
} | undefined;
|
|
270
451
|
}, {
|
|
271
452
|
outDir: string;
|
|
272
|
-
generator?: "
|
|
453
|
+
generator?: "map" | "1dir" | "pixflux" | "tiles" | "animation" | undefined;
|
|
273
454
|
size?: number | undefined;
|
|
274
455
|
view?: string | undefined;
|
|
275
456
|
promptSuffix?: string | undefined;
|
|
@@ -295,8 +476,9 @@ declare const StyleSchema: z.ZodEffects<z.ZodObject<{
|
|
|
295
476
|
base?: string | undefined;
|
|
296
477
|
} | undefined;
|
|
297
478
|
tags?: string[] | undefined;
|
|
479
|
+
providerOptions?: Record<string, Record<string, unknown>> | undefined;
|
|
298
480
|
}>, {
|
|
299
|
-
generator: "
|
|
481
|
+
generator: "map" | "1dir" | "pixflux" | "tiles" | "animation";
|
|
300
482
|
promptSuffix: string;
|
|
301
483
|
promptPrefix: string;
|
|
302
484
|
styleImages: {
|
|
@@ -306,6 +488,7 @@ declare const StyleSchema: z.ZodEffects<z.ZodObject<{
|
|
|
306
488
|
noBackground: boolean;
|
|
307
489
|
palette: string[];
|
|
308
490
|
tags: string[];
|
|
491
|
+
providerOptions: Record<string, Record<string, unknown>>;
|
|
309
492
|
size?: number | undefined;
|
|
310
493
|
view?: string | undefined;
|
|
311
494
|
outline?: string | undefined;
|
|
@@ -325,7 +508,7 @@ declare const StyleSchema: z.ZodEffects<z.ZodObject<{
|
|
|
325
508
|
} | undefined;
|
|
326
509
|
}, {
|
|
327
510
|
outDir: string;
|
|
328
|
-
generator?: "
|
|
511
|
+
generator?: "map" | "1dir" | "pixflux" | "tiles" | "animation" | undefined;
|
|
329
512
|
size?: number | undefined;
|
|
330
513
|
view?: string | undefined;
|
|
331
514
|
promptSuffix?: string | undefined;
|
|
@@ -351,6 +534,7 @@ declare const StyleSchema: z.ZodEffects<z.ZodObject<{
|
|
|
351
534
|
base?: string | undefined;
|
|
352
535
|
} | undefined;
|
|
353
536
|
tags?: string[] | undefined;
|
|
537
|
+
providerOptions?: Record<string, Record<string, unknown>> | undefined;
|
|
354
538
|
}>;
|
|
355
539
|
declare const AssetSchema: z.ZodObject<{
|
|
356
540
|
/** The subject. Style wrapping comes from the style's prefix/suffix. */
|
|
@@ -362,7 +546,7 @@ declare const AssetSchema: z.ZodObject<{
|
|
|
362
546
|
height: z.ZodOptional<z.ZodNumber>;
|
|
363
547
|
/** Overrides the style default. `1dir` generator only. */
|
|
364
548
|
size: z.ZodOptional<z.ZodNumber>;
|
|
365
|
-
/** Explicit output path relative to outDir.
|
|
549
|
+
/** Explicit output path relative to outDir. Media-aware providers may replace its extension. */
|
|
366
550
|
file: z.ZodOptional<z.ZodString>;
|
|
367
551
|
/**
|
|
368
552
|
* Grid cell this asset owns in a mounted style, as [column, row].
|
|
@@ -415,21 +599,21 @@ declare const AssetSchema: z.ZodObject<{
|
|
|
415
599
|
prompt: string;
|
|
416
600
|
styles: string[];
|
|
417
601
|
promptByStyle: Record<string, string>;
|
|
418
|
-
size?: number | undefined;
|
|
419
|
-
category?: string | undefined;
|
|
420
602
|
width?: number | undefined;
|
|
421
603
|
height?: number | undefined;
|
|
604
|
+
size?: number | undefined;
|
|
605
|
+
category?: string | undefined;
|
|
422
606
|
file?: string | undefined;
|
|
423
607
|
cell?: [number, number] | undefined;
|
|
424
608
|
source?: string | undefined;
|
|
425
609
|
outputRole?: string | undefined;
|
|
426
610
|
}, {
|
|
427
611
|
prompt: string;
|
|
612
|
+
width?: number | undefined;
|
|
613
|
+
height?: number | undefined;
|
|
428
614
|
size?: number | undefined;
|
|
429
615
|
tags?: string[] | undefined;
|
|
430
616
|
category?: string | undefined;
|
|
431
|
-
width?: number | undefined;
|
|
432
|
-
height?: number | undefined;
|
|
433
617
|
file?: string | undefined;
|
|
434
618
|
cell?: [number, number] | undefined;
|
|
435
619
|
source?: string | undefined;
|
|
@@ -440,8 +624,10 @@ declare const AssetSchema: z.ZodObject<{
|
|
|
440
624
|
declare const ManifestSchema: z.ZodObject<{
|
|
441
625
|
$schema: z.ZodOptional<z.ZodString>;
|
|
442
626
|
name: z.ZodString;
|
|
627
|
+
/** Generation backend. Existing manifests remain PixelLab by default. */
|
|
628
|
+
provider: z.ZodDefault<z.ZodString>;
|
|
443
629
|
styles: z.ZodRecord<z.ZodString, z.ZodEffects<z.ZodObject<{
|
|
444
|
-
generator: z.ZodDefault<z.ZodEnum<["1dir", "map", "pixflux", "tiles"]>>;
|
|
630
|
+
generator: z.ZodDefault<z.ZodEnum<["1dir", "map", "pixflux", "tiles", "animation"]>>;
|
|
445
631
|
/** Square edge length for `1dir`. 32-256. */
|
|
446
632
|
size: z.ZodOptional<z.ZodNumber>;
|
|
447
633
|
view: z.ZodOptional<z.ZodString>;
|
|
@@ -451,7 +637,7 @@ declare const ManifestSchema: z.ZodObject<{
|
|
|
451
637
|
promptPrefix: z.ZodDefault<z.ZodString>;
|
|
452
638
|
/** Style reference images. */
|
|
453
639
|
styleImages: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
454
|
-
/** Path to a PNG/JPEG, relative to the manifest
|
|
640
|
+
/** Path to a PNG/JPEG, relative to the manifest; the active provider validates limits. */
|
|
455
641
|
path: z.ZodString;
|
|
456
642
|
}, "strip", z.ZodTypeAny, {
|
|
457
643
|
path: string;
|
|
@@ -564,8 +750,10 @@ declare const ManifestSchema: z.ZodObject<{
|
|
|
564
750
|
}>>;
|
|
565
751
|
/** Tags applied to every object generated in this style, for server-side filtering. */
|
|
566
752
|
tags: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
753
|
+
/** Adapter-owned settings, keyed by provider id. */
|
|
754
|
+
providerOptions: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
567
755
|
}, "strict", z.ZodTypeAny, {
|
|
568
|
-
generator: "
|
|
756
|
+
generator: "map" | "1dir" | "pixflux" | "tiles" | "animation";
|
|
569
757
|
promptSuffix: string;
|
|
570
758
|
promptPrefix: string;
|
|
571
759
|
styleImages: {
|
|
@@ -575,6 +763,7 @@ declare const ManifestSchema: z.ZodObject<{
|
|
|
575
763
|
noBackground: boolean;
|
|
576
764
|
palette: string[];
|
|
577
765
|
tags: string[];
|
|
766
|
+
providerOptions: Record<string, Record<string, unknown>>;
|
|
578
767
|
size?: number | undefined;
|
|
579
768
|
view?: string | undefined;
|
|
580
769
|
outline?: string | undefined;
|
|
@@ -594,7 +783,7 @@ declare const ManifestSchema: z.ZodObject<{
|
|
|
594
783
|
} | undefined;
|
|
595
784
|
}, {
|
|
596
785
|
outDir: string;
|
|
597
|
-
generator?: "
|
|
786
|
+
generator?: "map" | "1dir" | "pixflux" | "tiles" | "animation" | undefined;
|
|
598
787
|
size?: number | undefined;
|
|
599
788
|
view?: string | undefined;
|
|
600
789
|
promptSuffix?: string | undefined;
|
|
@@ -620,8 +809,9 @@ declare const ManifestSchema: z.ZodObject<{
|
|
|
620
809
|
base?: string | undefined;
|
|
621
810
|
} | undefined;
|
|
622
811
|
tags?: string[] | undefined;
|
|
812
|
+
providerOptions?: Record<string, Record<string, unknown>> | undefined;
|
|
623
813
|
}>, {
|
|
624
|
-
generator: "
|
|
814
|
+
generator: "map" | "1dir" | "pixflux" | "tiles" | "animation";
|
|
625
815
|
promptSuffix: string;
|
|
626
816
|
promptPrefix: string;
|
|
627
817
|
styleImages: {
|
|
@@ -631,6 +821,7 @@ declare const ManifestSchema: z.ZodObject<{
|
|
|
631
821
|
noBackground: boolean;
|
|
632
822
|
palette: string[];
|
|
633
823
|
tags: string[];
|
|
824
|
+
providerOptions: Record<string, Record<string, unknown>>;
|
|
634
825
|
size?: number | undefined;
|
|
635
826
|
view?: string | undefined;
|
|
636
827
|
outline?: string | undefined;
|
|
@@ -650,7 +841,7 @@ declare const ManifestSchema: z.ZodObject<{
|
|
|
650
841
|
} | undefined;
|
|
651
842
|
}, {
|
|
652
843
|
outDir: string;
|
|
653
|
-
generator?: "
|
|
844
|
+
generator?: "map" | "1dir" | "pixflux" | "tiles" | "animation" | undefined;
|
|
654
845
|
size?: number | undefined;
|
|
655
846
|
view?: string | undefined;
|
|
656
847
|
promptSuffix?: string | undefined;
|
|
@@ -676,6 +867,7 @@ declare const ManifestSchema: z.ZodObject<{
|
|
|
676
867
|
base?: string | undefined;
|
|
677
868
|
} | undefined;
|
|
678
869
|
tags?: string[] | undefined;
|
|
870
|
+
providerOptions?: Record<string, Record<string, unknown>> | undefined;
|
|
679
871
|
}>>;
|
|
680
872
|
assets: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
681
873
|
/** The subject. Style wrapping comes from the style's prefix/suffix. */
|
|
@@ -687,7 +879,7 @@ declare const ManifestSchema: z.ZodObject<{
|
|
|
687
879
|
height: z.ZodOptional<z.ZodNumber>;
|
|
688
880
|
/** Overrides the style default. `1dir` generator only. */
|
|
689
881
|
size: z.ZodOptional<z.ZodNumber>;
|
|
690
|
-
/** Explicit output path relative to outDir.
|
|
882
|
+
/** Explicit output path relative to outDir. Media-aware providers may replace its extension. */
|
|
691
883
|
file: z.ZodOptional<z.ZodString>;
|
|
692
884
|
/**
|
|
693
885
|
* Grid cell this asset owns in a mounted style, as [column, row].
|
|
@@ -740,21 +932,21 @@ declare const ManifestSchema: z.ZodObject<{
|
|
|
740
932
|
prompt: string;
|
|
741
933
|
styles: string[];
|
|
742
934
|
promptByStyle: Record<string, string>;
|
|
743
|
-
size?: number | undefined;
|
|
744
|
-
category?: string | undefined;
|
|
745
935
|
width?: number | undefined;
|
|
746
936
|
height?: number | undefined;
|
|
937
|
+
size?: number | undefined;
|
|
938
|
+
category?: string | undefined;
|
|
747
939
|
file?: string | undefined;
|
|
748
940
|
cell?: [number, number] | undefined;
|
|
749
941
|
source?: string | undefined;
|
|
750
942
|
outputRole?: string | undefined;
|
|
751
943
|
}, {
|
|
752
944
|
prompt: string;
|
|
945
|
+
width?: number | undefined;
|
|
946
|
+
height?: number | undefined;
|
|
753
947
|
size?: number | undefined;
|
|
754
948
|
tags?: string[] | undefined;
|
|
755
949
|
category?: string | undefined;
|
|
756
|
-
width?: number | undefined;
|
|
757
|
-
height?: number | undefined;
|
|
758
950
|
file?: string | undefined;
|
|
759
951
|
cell?: [number, number] | undefined;
|
|
760
952
|
source?: string | undefined;
|
|
@@ -764,7 +956,7 @@ declare const ManifestSchema: z.ZodObject<{
|
|
|
764
956
|
}>>;
|
|
765
957
|
}, "strict", z.ZodTypeAny, {
|
|
766
958
|
styles: Record<string, {
|
|
767
|
-
generator: "
|
|
959
|
+
generator: "map" | "1dir" | "pixflux" | "tiles" | "animation";
|
|
768
960
|
promptSuffix: string;
|
|
769
961
|
promptPrefix: string;
|
|
770
962
|
styleImages: {
|
|
@@ -774,6 +966,7 @@ declare const ManifestSchema: z.ZodObject<{
|
|
|
774
966
|
noBackground: boolean;
|
|
775
967
|
palette: string[];
|
|
776
968
|
tags: string[];
|
|
969
|
+
providerOptions: Record<string, Record<string, unknown>>;
|
|
777
970
|
size?: number | undefined;
|
|
778
971
|
view?: string | undefined;
|
|
779
972
|
outline?: string | undefined;
|
|
@@ -793,15 +986,16 @@ declare const ManifestSchema: z.ZodObject<{
|
|
|
793
986
|
} | undefined;
|
|
794
987
|
}>;
|
|
795
988
|
name: string;
|
|
989
|
+
provider: string;
|
|
796
990
|
assets: Record<string, {
|
|
797
991
|
tags: string[];
|
|
798
992
|
prompt: string;
|
|
799
993
|
styles: string[];
|
|
800
994
|
promptByStyle: Record<string, string>;
|
|
801
|
-
size?: number | undefined;
|
|
802
|
-
category?: string | undefined;
|
|
803
995
|
width?: number | undefined;
|
|
804
996
|
height?: number | undefined;
|
|
997
|
+
size?: number | undefined;
|
|
998
|
+
category?: string | undefined;
|
|
805
999
|
file?: string | undefined;
|
|
806
1000
|
cell?: [number, number] | undefined;
|
|
807
1001
|
source?: string | undefined;
|
|
@@ -811,7 +1005,7 @@ declare const ManifestSchema: z.ZodObject<{
|
|
|
811
1005
|
}, {
|
|
812
1006
|
styles: Record<string, {
|
|
813
1007
|
outDir: string;
|
|
814
|
-
generator?: "
|
|
1008
|
+
generator?: "map" | "1dir" | "pixflux" | "tiles" | "animation" | undefined;
|
|
815
1009
|
size?: number | undefined;
|
|
816
1010
|
view?: string | undefined;
|
|
817
1011
|
promptSuffix?: string | undefined;
|
|
@@ -837,15 +1031,16 @@ declare const ManifestSchema: z.ZodObject<{
|
|
|
837
1031
|
base?: string | undefined;
|
|
838
1032
|
} | undefined;
|
|
839
1033
|
tags?: string[] | undefined;
|
|
1034
|
+
providerOptions?: Record<string, Record<string, unknown>> | undefined;
|
|
840
1035
|
}>;
|
|
841
1036
|
name: string;
|
|
842
1037
|
assets: Record<string, {
|
|
843
1038
|
prompt: string;
|
|
1039
|
+
width?: number | undefined;
|
|
1040
|
+
height?: number | undefined;
|
|
844
1041
|
size?: number | undefined;
|
|
845
1042
|
tags?: string[] | undefined;
|
|
846
1043
|
category?: string | undefined;
|
|
847
|
-
width?: number | undefined;
|
|
848
|
-
height?: number | undefined;
|
|
849
1044
|
file?: string | undefined;
|
|
850
1045
|
cell?: [number, number] | undefined;
|
|
851
1046
|
source?: string | undefined;
|
|
@@ -854,12 +1049,13 @@ declare const ManifestSchema: z.ZodObject<{
|
|
|
854
1049
|
promptByStyle?: Record<string, string> | undefined;
|
|
855
1050
|
}>;
|
|
856
1051
|
$schema?: string | undefined;
|
|
1052
|
+
provider?: string | undefined;
|
|
857
1053
|
}>;
|
|
858
1054
|
type Manifest = z.infer<typeof ManifestSchema>;
|
|
859
1055
|
type Style = z.infer<typeof StyleSchema>;
|
|
860
1056
|
type Asset = z.infer<typeof AssetSchema>;
|
|
861
1057
|
/**
|
|
862
|
-
* One line of the lockfile: the mapping from a spec to the
|
|
1058
|
+
* One line of the lockfile: the mapping from a spec to the provider work that
|
|
863
1059
|
* satisfies it and the file on disk that came from it. This is the record that
|
|
864
1060
|
* did not exist before — without it, generated objects and downloaded files are
|
|
865
1061
|
* two unrelated piles.
|
|
@@ -869,7 +1065,7 @@ declare const LockEntrySchema: z.ZodObject<{
|
|
|
869
1065
|
assetId: z.ZodString;
|
|
870
1066
|
/** sha256 of the resolved spec. Changing a prompt/size/style invalidates it. */
|
|
871
1067
|
specHash: z.ZodString;
|
|
872
|
-
generator: z.ZodEnum<["1dir", "map", "pixflux", "tiles"]>;
|
|
1068
|
+
generator: z.ZodEnum<["1dir", "map", "pixflux", "tiles", "animation"]>;
|
|
873
1069
|
/** Connectable tiles must remain multi-output even when polling is resumed later. */
|
|
874
1070
|
tileFeature: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
875
1071
|
/** The resolved prompt actually sent, kept for auditing and for adopt matching. */
|
|
@@ -890,12 +1086,15 @@ declare const LockEntrySchema: z.ZodObject<{
|
|
|
890
1086
|
sourceUrls: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
891
1087
|
url: z.ZodString;
|
|
892
1088
|
role: z.ZodOptional<z.ZodString>;
|
|
1089
|
+
mediaType: z.ZodOptional<z.ZodEnum<["image/png", "image/gif"]>>;
|
|
893
1090
|
}, "strip", z.ZodTypeAny, {
|
|
894
1091
|
url: string;
|
|
895
1092
|
role?: string | undefined;
|
|
1093
|
+
mediaType?: "image/png" | "image/gif" | undefined;
|
|
896
1094
|
}, {
|
|
897
1095
|
url: string;
|
|
898
1096
|
role?: string | undefined;
|
|
1097
|
+
mediaType?: "image/png" | "image/gif" | undefined;
|
|
899
1098
|
}>, "many">>;
|
|
900
1099
|
/**
|
|
901
1100
|
* Files this entry produced. A plain object generates one; asset kinds that
|
|
@@ -909,14 +1108,17 @@ declare const LockEntrySchema: z.ZodObject<{
|
|
|
909
1108
|
path: z.ZodString;
|
|
910
1109
|
sha256: z.ZodString;
|
|
911
1110
|
role: z.ZodOptional<z.ZodString>;
|
|
1111
|
+
mediaType: z.ZodOptional<z.ZodEnum<["image/png", "image/gif"]>>;
|
|
912
1112
|
}, "strip", z.ZodTypeAny, {
|
|
913
1113
|
path: string;
|
|
914
1114
|
sha256: string;
|
|
915
1115
|
role?: string | undefined;
|
|
1116
|
+
mediaType?: "image/png" | "image/gif" | undefined;
|
|
916
1117
|
}, {
|
|
917
1118
|
path: string;
|
|
918
1119
|
sha256: string;
|
|
919
1120
|
role?: string | undefined;
|
|
1121
|
+
mediaType?: "image/png" | "image/gif" | undefined;
|
|
920
1122
|
}>, "many">>;
|
|
921
1123
|
/**
|
|
922
1124
|
* Provider-owned data retained for downstream consumers, namespaced by
|
|
@@ -929,16 +1131,17 @@ declare const LockEntrySchema: z.ZodObject<{
|
|
|
929
1131
|
/** Successful-submission estimate in `costUnit`; may be fractional USD. */
|
|
930
1132
|
cost: z.ZodDefault<z.ZodNumber>;
|
|
931
1133
|
/** Unit for `cost`. Defaults preserve pre-unit PixelLab lockfiles. */
|
|
932
|
-
costUnit: z.ZodDefault<z.
|
|
1134
|
+
costUnit: z.ZodDefault<z.ZodString>;
|
|
933
1135
|
/** Which provider produced this. Absent on entries written before providers. */
|
|
934
1136
|
provider: z.ZodDefault<z.ZodString>;
|
|
935
1137
|
}, "strip", z.ZodTypeAny, {
|
|
936
|
-
status: "pending" | "processing" | "review" | "selected" | "downloaded" | "download-failed" | "failed";
|
|
937
|
-
generator: "1dir" | "map" | "pixflux" | "tiles";
|
|
938
|
-
tileFeature: string | null;
|
|
939
|
-
prompt: string;
|
|
940
1138
|
width: number;
|
|
941
1139
|
height: number;
|
|
1140
|
+
status: "processing" | "review" | "failed" | "pending" | "selected" | "downloaded" | "download-failed";
|
|
1141
|
+
generator: "map" | "1dir" | "pixflux" | "tiles" | "animation";
|
|
1142
|
+
tileFeature: string | null;
|
|
1143
|
+
prompt: string;
|
|
1144
|
+
provider: string;
|
|
942
1145
|
styleId: string;
|
|
943
1146
|
assetId: string;
|
|
944
1147
|
specHash: string;
|
|
@@ -951,28 +1154,30 @@ declare const LockEntrySchema: z.ZodObject<{
|
|
|
951
1154
|
sourceUrls: {
|
|
952
1155
|
url: string;
|
|
953
1156
|
role?: string | undefined;
|
|
1157
|
+
mediaType?: "image/png" | "image/gif" | undefined;
|
|
954
1158
|
}[];
|
|
955
1159
|
outputs: {
|
|
956
1160
|
path: string;
|
|
957
1161
|
sha256: string;
|
|
958
1162
|
role?: string | undefined;
|
|
1163
|
+
mediaType?: "image/png" | "image/gif" | undefined;
|
|
959
1164
|
}[];
|
|
960
1165
|
providerMetadata: Record<string, Record<string, unknown>>;
|
|
961
1166
|
submittedAt: string | null;
|
|
962
1167
|
downloadedAt: string | null;
|
|
963
1168
|
cost: number;
|
|
964
|
-
costUnit:
|
|
965
|
-
provider: string;
|
|
1169
|
+
costUnit: string;
|
|
966
1170
|
}, {
|
|
967
|
-
generator: "1dir" | "map" | "pixflux" | "tiles";
|
|
968
|
-
prompt: string;
|
|
969
1171
|
width: number;
|
|
970
1172
|
height: number;
|
|
1173
|
+
generator: "map" | "1dir" | "pixflux" | "tiles" | "animation";
|
|
1174
|
+
prompt: string;
|
|
971
1175
|
styleId: string;
|
|
972
1176
|
assetId: string;
|
|
973
1177
|
specHash: string;
|
|
974
|
-
status?: "
|
|
1178
|
+
status?: "processing" | "review" | "failed" | "pending" | "selected" | "downloaded" | "download-failed" | undefined;
|
|
975
1179
|
tileFeature?: string | null | undefined;
|
|
1180
|
+
provider?: string | undefined;
|
|
976
1181
|
jobId?: string | null | undefined;
|
|
977
1182
|
reviewObjectId?: string | null | undefined;
|
|
978
1183
|
objectId?: string | null | undefined;
|
|
@@ -982,18 +1187,19 @@ declare const LockEntrySchema: z.ZodObject<{
|
|
|
982
1187
|
sourceUrls?: {
|
|
983
1188
|
url: string;
|
|
984
1189
|
role?: string | undefined;
|
|
1190
|
+
mediaType?: "image/png" | "image/gif" | undefined;
|
|
985
1191
|
}[] | undefined;
|
|
986
1192
|
outputs?: {
|
|
987
1193
|
path: string;
|
|
988
1194
|
sha256: string;
|
|
989
1195
|
role?: string | undefined;
|
|
1196
|
+
mediaType?: "image/png" | "image/gif" | undefined;
|
|
990
1197
|
}[] | undefined;
|
|
991
1198
|
providerMetadata?: Record<string, Record<string, unknown>> | undefined;
|
|
992
1199
|
submittedAt?: string | null | undefined;
|
|
993
1200
|
downloadedAt?: string | null | undefined;
|
|
994
1201
|
cost?: number | undefined;
|
|
995
|
-
costUnit?:
|
|
996
|
-
provider?: string | undefined;
|
|
1202
|
+
costUnit?: string | undefined;
|
|
997
1203
|
}>;
|
|
998
1204
|
declare const LockSchema: z.ZodObject<{
|
|
999
1205
|
version: z.ZodLiteral<2>;
|
|
@@ -1002,7 +1208,7 @@ declare const LockSchema: z.ZodObject<{
|
|
|
1002
1208
|
assetId: z.ZodString;
|
|
1003
1209
|
/** sha256 of the resolved spec. Changing a prompt/size/style invalidates it. */
|
|
1004
1210
|
specHash: z.ZodString;
|
|
1005
|
-
generator: z.ZodEnum<["1dir", "map", "pixflux", "tiles"]>;
|
|
1211
|
+
generator: z.ZodEnum<["1dir", "map", "pixflux", "tiles", "animation"]>;
|
|
1006
1212
|
/** Connectable tiles must remain multi-output even when polling is resumed later. */
|
|
1007
1213
|
tileFeature: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
1008
1214
|
/** The resolved prompt actually sent, kept for auditing and for adopt matching. */
|
|
@@ -1023,12 +1229,15 @@ declare const LockSchema: z.ZodObject<{
|
|
|
1023
1229
|
sourceUrls: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
1024
1230
|
url: z.ZodString;
|
|
1025
1231
|
role: z.ZodOptional<z.ZodString>;
|
|
1232
|
+
mediaType: z.ZodOptional<z.ZodEnum<["image/png", "image/gif"]>>;
|
|
1026
1233
|
}, "strip", z.ZodTypeAny, {
|
|
1027
1234
|
url: string;
|
|
1028
1235
|
role?: string | undefined;
|
|
1236
|
+
mediaType?: "image/png" | "image/gif" | undefined;
|
|
1029
1237
|
}, {
|
|
1030
1238
|
url: string;
|
|
1031
1239
|
role?: string | undefined;
|
|
1240
|
+
mediaType?: "image/png" | "image/gif" | undefined;
|
|
1032
1241
|
}>, "many">>;
|
|
1033
1242
|
/**
|
|
1034
1243
|
* Files this entry produced. A plain object generates one; asset kinds that
|
|
@@ -1042,14 +1251,17 @@ declare const LockSchema: z.ZodObject<{
|
|
|
1042
1251
|
path: z.ZodString;
|
|
1043
1252
|
sha256: z.ZodString;
|
|
1044
1253
|
role: z.ZodOptional<z.ZodString>;
|
|
1254
|
+
mediaType: z.ZodOptional<z.ZodEnum<["image/png", "image/gif"]>>;
|
|
1045
1255
|
}, "strip", z.ZodTypeAny, {
|
|
1046
1256
|
path: string;
|
|
1047
1257
|
sha256: string;
|
|
1048
1258
|
role?: string | undefined;
|
|
1259
|
+
mediaType?: "image/png" | "image/gif" | undefined;
|
|
1049
1260
|
}, {
|
|
1050
1261
|
path: string;
|
|
1051
1262
|
sha256: string;
|
|
1052
1263
|
role?: string | undefined;
|
|
1264
|
+
mediaType?: "image/png" | "image/gif" | undefined;
|
|
1053
1265
|
}>, "many">>;
|
|
1054
1266
|
/**
|
|
1055
1267
|
* Provider-owned data retained for downstream consumers, namespaced by
|
|
@@ -1062,16 +1274,17 @@ declare const LockSchema: z.ZodObject<{
|
|
|
1062
1274
|
/** Successful-submission estimate in `costUnit`; may be fractional USD. */
|
|
1063
1275
|
cost: z.ZodDefault<z.ZodNumber>;
|
|
1064
1276
|
/** Unit for `cost`. Defaults preserve pre-unit PixelLab lockfiles. */
|
|
1065
|
-
costUnit: z.ZodDefault<z.
|
|
1277
|
+
costUnit: z.ZodDefault<z.ZodString>;
|
|
1066
1278
|
/** Which provider produced this. Absent on entries written before providers. */
|
|
1067
1279
|
provider: z.ZodDefault<z.ZodString>;
|
|
1068
1280
|
}, "strip", z.ZodTypeAny, {
|
|
1069
|
-
status: "pending" | "processing" | "review" | "selected" | "downloaded" | "download-failed" | "failed";
|
|
1070
|
-
generator: "1dir" | "map" | "pixflux" | "tiles";
|
|
1071
|
-
tileFeature: string | null;
|
|
1072
|
-
prompt: string;
|
|
1073
1281
|
width: number;
|
|
1074
1282
|
height: number;
|
|
1283
|
+
status: "processing" | "review" | "failed" | "pending" | "selected" | "downloaded" | "download-failed";
|
|
1284
|
+
generator: "map" | "1dir" | "pixflux" | "tiles" | "animation";
|
|
1285
|
+
tileFeature: string | null;
|
|
1286
|
+
prompt: string;
|
|
1287
|
+
provider: string;
|
|
1075
1288
|
styleId: string;
|
|
1076
1289
|
assetId: string;
|
|
1077
1290
|
specHash: string;
|
|
@@ -1084,28 +1297,30 @@ declare const LockSchema: z.ZodObject<{
|
|
|
1084
1297
|
sourceUrls: {
|
|
1085
1298
|
url: string;
|
|
1086
1299
|
role?: string | undefined;
|
|
1300
|
+
mediaType?: "image/png" | "image/gif" | undefined;
|
|
1087
1301
|
}[];
|
|
1088
1302
|
outputs: {
|
|
1089
1303
|
path: string;
|
|
1090
1304
|
sha256: string;
|
|
1091
1305
|
role?: string | undefined;
|
|
1306
|
+
mediaType?: "image/png" | "image/gif" | undefined;
|
|
1092
1307
|
}[];
|
|
1093
1308
|
providerMetadata: Record<string, Record<string, unknown>>;
|
|
1094
1309
|
submittedAt: string | null;
|
|
1095
1310
|
downloadedAt: string | null;
|
|
1096
1311
|
cost: number;
|
|
1097
|
-
costUnit:
|
|
1098
|
-
provider: string;
|
|
1312
|
+
costUnit: string;
|
|
1099
1313
|
}, {
|
|
1100
|
-
generator: "1dir" | "map" | "pixflux" | "tiles";
|
|
1101
|
-
prompt: string;
|
|
1102
1314
|
width: number;
|
|
1103
1315
|
height: number;
|
|
1316
|
+
generator: "map" | "1dir" | "pixflux" | "tiles" | "animation";
|
|
1317
|
+
prompt: string;
|
|
1104
1318
|
styleId: string;
|
|
1105
1319
|
assetId: string;
|
|
1106
1320
|
specHash: string;
|
|
1107
|
-
status?: "
|
|
1321
|
+
status?: "processing" | "review" | "failed" | "pending" | "selected" | "downloaded" | "download-failed" | undefined;
|
|
1108
1322
|
tileFeature?: string | null | undefined;
|
|
1323
|
+
provider?: string | undefined;
|
|
1109
1324
|
jobId?: string | null | undefined;
|
|
1110
1325
|
reviewObjectId?: string | null | undefined;
|
|
1111
1326
|
objectId?: string | null | undefined;
|
|
@@ -1115,27 +1330,29 @@ declare const LockSchema: z.ZodObject<{
|
|
|
1115
1330
|
sourceUrls?: {
|
|
1116
1331
|
url: string;
|
|
1117
1332
|
role?: string | undefined;
|
|
1333
|
+
mediaType?: "image/png" | "image/gif" | undefined;
|
|
1118
1334
|
}[] | undefined;
|
|
1119
1335
|
outputs?: {
|
|
1120
1336
|
path: string;
|
|
1121
1337
|
sha256: string;
|
|
1122
1338
|
role?: string | undefined;
|
|
1339
|
+
mediaType?: "image/png" | "image/gif" | undefined;
|
|
1123
1340
|
}[] | undefined;
|
|
1124
1341
|
providerMetadata?: Record<string, Record<string, unknown>> | undefined;
|
|
1125
1342
|
submittedAt?: string | null | undefined;
|
|
1126
1343
|
downloadedAt?: string | null | undefined;
|
|
1127
1344
|
cost?: number | undefined;
|
|
1128
|
-
costUnit?:
|
|
1129
|
-
provider?: string | undefined;
|
|
1345
|
+
costUnit?: string | undefined;
|
|
1130
1346
|
}>>;
|
|
1131
1347
|
}, "strip", z.ZodTypeAny, {
|
|
1132
1348
|
entries: Record<string, {
|
|
1133
|
-
status: "pending" | "processing" | "review" | "selected" | "downloaded" | "download-failed" | "failed";
|
|
1134
|
-
generator: "1dir" | "map" | "pixflux" | "tiles";
|
|
1135
|
-
tileFeature: string | null;
|
|
1136
|
-
prompt: string;
|
|
1137
1349
|
width: number;
|
|
1138
1350
|
height: number;
|
|
1351
|
+
status: "processing" | "review" | "failed" | "pending" | "selected" | "downloaded" | "download-failed";
|
|
1352
|
+
generator: "map" | "1dir" | "pixflux" | "tiles" | "animation";
|
|
1353
|
+
tileFeature: string | null;
|
|
1354
|
+
prompt: string;
|
|
1355
|
+
provider: string;
|
|
1139
1356
|
styleId: string;
|
|
1140
1357
|
assetId: string;
|
|
1141
1358
|
specHash: string;
|
|
@@ -1148,31 +1365,33 @@ declare const LockSchema: z.ZodObject<{
|
|
|
1148
1365
|
sourceUrls: {
|
|
1149
1366
|
url: string;
|
|
1150
1367
|
role?: string | undefined;
|
|
1368
|
+
mediaType?: "image/png" | "image/gif" | undefined;
|
|
1151
1369
|
}[];
|
|
1152
1370
|
outputs: {
|
|
1153
1371
|
path: string;
|
|
1154
1372
|
sha256: string;
|
|
1155
1373
|
role?: string | undefined;
|
|
1374
|
+
mediaType?: "image/png" | "image/gif" | undefined;
|
|
1156
1375
|
}[];
|
|
1157
1376
|
providerMetadata: Record<string, Record<string, unknown>>;
|
|
1158
1377
|
submittedAt: string | null;
|
|
1159
1378
|
downloadedAt: string | null;
|
|
1160
1379
|
cost: number;
|
|
1161
|
-
costUnit:
|
|
1162
|
-
provider: string;
|
|
1380
|
+
costUnit: string;
|
|
1163
1381
|
}>;
|
|
1164
1382
|
version: 2;
|
|
1165
1383
|
}, {
|
|
1166
1384
|
entries: Record<string, {
|
|
1167
|
-
generator: "1dir" | "map" | "pixflux" | "tiles";
|
|
1168
|
-
prompt: string;
|
|
1169
1385
|
width: number;
|
|
1170
1386
|
height: number;
|
|
1387
|
+
generator: "map" | "1dir" | "pixflux" | "tiles" | "animation";
|
|
1388
|
+
prompt: string;
|
|
1171
1389
|
styleId: string;
|
|
1172
1390
|
assetId: string;
|
|
1173
1391
|
specHash: string;
|
|
1174
|
-
status?: "
|
|
1392
|
+
status?: "processing" | "review" | "failed" | "pending" | "selected" | "downloaded" | "download-failed" | undefined;
|
|
1175
1393
|
tileFeature?: string | null | undefined;
|
|
1394
|
+
provider?: string | undefined;
|
|
1176
1395
|
jobId?: string | null | undefined;
|
|
1177
1396
|
reviewObjectId?: string | null | undefined;
|
|
1178
1397
|
objectId?: string | null | undefined;
|
|
@@ -1182,18 +1401,19 @@ declare const LockSchema: z.ZodObject<{
|
|
|
1182
1401
|
sourceUrls?: {
|
|
1183
1402
|
url: string;
|
|
1184
1403
|
role?: string | undefined;
|
|
1404
|
+
mediaType?: "image/png" | "image/gif" | undefined;
|
|
1185
1405
|
}[] | undefined;
|
|
1186
1406
|
outputs?: {
|
|
1187
1407
|
path: string;
|
|
1188
1408
|
sha256: string;
|
|
1189
1409
|
role?: string | undefined;
|
|
1410
|
+
mediaType?: "image/png" | "image/gif" | undefined;
|
|
1190
1411
|
}[] | undefined;
|
|
1191
1412
|
providerMetadata?: Record<string, Record<string, unknown>> | undefined;
|
|
1192
1413
|
submittedAt?: string | null | undefined;
|
|
1193
1414
|
downloadedAt?: string | null | undefined;
|
|
1194
1415
|
cost?: number | undefined;
|
|
1195
|
-
costUnit?:
|
|
1196
|
-
provider?: string | undefined;
|
|
1416
|
+
costUnit?: string | undefined;
|
|
1197
1417
|
}>;
|
|
1198
1418
|
version: 2;
|
|
1199
1419
|
}>;
|
|
@@ -1219,6 +1439,10 @@ interface ResolvedSpec {
|
|
|
1219
1439
|
root: string;
|
|
1220
1440
|
styleId: string;
|
|
1221
1441
|
assetId: string;
|
|
1442
|
+
/** Backend whose request semantics and estimate produced this spec. */
|
|
1443
|
+
provider: string;
|
|
1444
|
+
/** Adapter-owned settings selected from the active provider namespace. */
|
|
1445
|
+
providerOptions: Record<string, unknown>;
|
|
1222
1446
|
generator: Generator;
|
|
1223
1447
|
prompt: string;
|
|
1224
1448
|
width: number;
|
|
@@ -1236,7 +1460,7 @@ interface ResolvedSpec {
|
|
|
1236
1460
|
tags: string[];
|
|
1237
1461
|
specHash: string;
|
|
1238
1462
|
cost: number;
|
|
1239
|
-
costUnit:
|
|
1463
|
+
costUnit: CostUnit;
|
|
1240
1464
|
candidates: number;
|
|
1241
1465
|
outline?: string;
|
|
1242
1466
|
shading?: string;
|
|
@@ -1439,158 +1663,6 @@ declare class PixelLabClient {
|
|
|
1439
1663
|
}
|
|
1440
1664
|
declare function clientFromEnv(): PixelLabClient;
|
|
1441
1665
|
|
|
1442
|
-
/**
|
|
1443
|
-
* What a provider charges in. Cost is not universally "generations": PixelLab
|
|
1444
|
-
* bills a subscription quota, OpenAI bills dollars per image, a local model
|
|
1445
|
-
* bills nothing. `plan` prints the unit alongside the number so the figure is
|
|
1446
|
-
* never silently misread, and `--budget` is interpreted in the active unit.
|
|
1447
|
-
*/
|
|
1448
|
-
type CostUnit = "generations" | "usd" | "free";
|
|
1449
|
-
interface CostEstimate {
|
|
1450
|
-
unit: CostUnit;
|
|
1451
|
-
amount: number;
|
|
1452
|
-
/**
|
|
1453
|
-
* How many candidates one call returns. This is a provider property, not a
|
|
1454
|
-
* universal truth — PixelLab's `1dir` returns up to 64 for a single fixed
|
|
1455
|
-
* price, whereas a per-image provider returns one and charges N times for N.
|
|
1456
|
-
* The "generate small, pick from many" strategy only pays off where this is
|
|
1457
|
-
* greater than 1 at no extra cost.
|
|
1458
|
-
*/
|
|
1459
|
-
candidates: number;
|
|
1460
|
-
}
|
|
1461
|
-
/** Runtime guard for third-party adapters before estimates influence a budget. */
|
|
1462
|
-
declare function validateCostEstimate(providerId: string, value: unknown): CostEstimate;
|
|
1463
|
-
interface OutputSource {
|
|
1464
|
-
url: string;
|
|
1465
|
-
/** Stable semantic/index role used in filenames and lockfile outputs. */
|
|
1466
|
-
role?: string;
|
|
1467
|
-
}
|
|
1468
|
-
interface PollContext {
|
|
1469
|
-
/** Distinguishes structural tile sets from independent tile candidates. */
|
|
1470
|
-
tileFeature?: string;
|
|
1471
|
-
}
|
|
1472
|
-
/** Provider-owned, JSON-serializable details needed by downstream exporters. */
|
|
1473
|
-
type ProviderMetadata = Record<string, unknown>;
|
|
1474
|
-
/** Terminal and non-terminal states a queued job can be observed in. */
|
|
1475
|
-
type JobState = {
|
|
1476
|
-
status: "processing";
|
|
1477
|
-
progressPercent?: number | null;
|
|
1478
|
-
etaSeconds?: number | null;
|
|
1479
|
-
} | {
|
|
1480
|
-
status: "review";
|
|
1481
|
-
candidateUrls: string[];
|
|
1482
|
-
} | {
|
|
1483
|
-
status: "ready";
|
|
1484
|
-
objectId: string;
|
|
1485
|
-
/** Kept for compatibility with single-output provider implementations. */
|
|
1486
|
-
sourceUrl: string | null;
|
|
1487
|
-
/** Present for structural multi-output results. */
|
|
1488
|
-
sources?: OutputSource[];
|
|
1489
|
-
/** Preserved under the provider's namespace in the lockfile. */
|
|
1490
|
-
metadata?: ProviderMetadata;
|
|
1491
|
-
} | {
|
|
1492
|
-
status: "failed";
|
|
1493
|
-
error: string;
|
|
1494
|
-
};
|
|
1495
|
-
/** A previously generated asset as the provider reports it. */
|
|
1496
|
-
interface RemoteAsset {
|
|
1497
|
-
id: string;
|
|
1498
|
-
prompt: string;
|
|
1499
|
-
width: number;
|
|
1500
|
-
height: number;
|
|
1501
|
-
createdAt: string;
|
|
1502
|
-
previewUrl: string | null;
|
|
1503
|
-
tags: string[];
|
|
1504
|
-
status: string;
|
|
1505
|
-
}
|
|
1506
|
-
interface BalanceInfo {
|
|
1507
|
-
unit: CostUnit;
|
|
1508
|
-
remaining: number;
|
|
1509
|
-
total?: number;
|
|
1510
|
-
plan?: string;
|
|
1511
|
-
}
|
|
1512
|
-
interface BalanceChange {
|
|
1513
|
-
unit: CostUnit;
|
|
1514
|
-
before: number;
|
|
1515
|
-
after: number;
|
|
1516
|
-
/** Provider-reported quota/currency consumed between the two readings. */
|
|
1517
|
-
spent: number;
|
|
1518
|
-
/** Quota/currency added between readings, e.g. a refill during the run. */
|
|
1519
|
-
credited: number;
|
|
1520
|
-
}
|
|
1521
|
-
/** Compare two provider readings without ever combining incompatible units. */
|
|
1522
|
-
declare function measureBalanceChange(before: BalanceInfo, after: BalanceInfo): BalanceChange | null;
|
|
1523
|
-
/**
|
|
1524
|
-
* Submission constraints a backend enforces upstream, in its own units —
|
|
1525
|
-
* `submit` has no business knowing these numbers itself.
|
|
1526
|
-
*/
|
|
1527
|
-
interface RateLimit {
|
|
1528
|
-
/** Minimum time between successive submissions, global across the account. */
|
|
1529
|
-
spacingMs: number;
|
|
1530
|
-
/** Background jobs allowed in flight at once. */
|
|
1531
|
-
maxInFlight: number;
|
|
1532
|
-
}
|
|
1533
|
-
/**
|
|
1534
|
-
* Used when a provider doesn't declare `rateLimit()` — conservative enough
|
|
1535
|
-
* not to be a real constraint for a provider that has none of its own, and
|
|
1536
|
-
* overridable per run via `submit`'s own options regardless.
|
|
1537
|
-
*/
|
|
1538
|
-
declare const DEFAULT_RATE_LIMIT: RateLimit;
|
|
1539
|
-
/**
|
|
1540
|
-
* A backend that turns a resolved spec into image bytes.
|
|
1541
|
-
*
|
|
1542
|
-
* Everything above this interface — the manifest, the lockfile, plan diffing,
|
|
1543
|
-
* salvage, the contact sheets — is provider-agnostic. Everything that knows a
|
|
1544
|
-
* URL shape or an auth header lives below it.
|
|
1545
|
-
*
|
|
1546
|
-
* The optional members are genuinely optional capabilities rather than
|
|
1547
|
-
* convenience: a provider with no queryable asset list cannot support `adopt`
|
|
1548
|
-
* or `salvage`, and the CLI reports that rather than failing obscurely.
|
|
1549
|
-
*/
|
|
1550
|
-
interface Provider {
|
|
1551
|
-
readonly id: string;
|
|
1552
|
-
/** False for a generator this backend cannot express (e.g. non-square). */
|
|
1553
|
-
supports(generator: Generator): boolean;
|
|
1554
|
-
/** Never performs I/O — `plan` must stay free and offline. */
|
|
1555
|
-
estimate(spec: ResolvedSpec): CostEstimate;
|
|
1556
|
-
/** This backend's own submission constraints. Falls back to
|
|
1557
|
-
* `DEFAULT_RATE_LIMIT` when absent — see that constant's doc. */
|
|
1558
|
-
rateLimit?(): RateLimit;
|
|
1559
|
-
submit(spec: ResolvedSpec, styleImages: ResolvedStyleImage[]): Promise<{
|
|
1560
|
-
jobId: string;
|
|
1561
|
-
}>;
|
|
1562
|
-
poll(jobId: string, generator: Generator, context?: PollContext): Promise<JobState>;
|
|
1563
|
-
/**
|
|
1564
|
-
* Promote one candidate from a review-status job to a standalone asset.
|
|
1565
|
-
* Only meaningful where `estimate().candidates > 1`.
|
|
1566
|
-
*
|
|
1567
|
-
* `generator` is passed because "promote" is not universal: PixelLab's
|
|
1568
|
-
* frame-based generators create a new account object, while a tiles
|
|
1569
|
-
* variation is already a finished image and there is nothing to promote.
|
|
1570
|
-
* A provider that treats every candidate alike can ignore it.
|
|
1571
|
-
*/
|
|
1572
|
-
selectCandidate(jobId: string, index: number, commonTag?: string, generator?: Generator): Promise<{
|
|
1573
|
-
objectId: string;
|
|
1574
|
-
sourceUrl: string | null;
|
|
1575
|
-
}>;
|
|
1576
|
-
/** Storage URLs are usually public; implementations should not send auth. */
|
|
1577
|
-
download(url: string): Promise<Buffer>;
|
|
1578
|
-
balance(): Promise<BalanceInfo>;
|
|
1579
|
-
/** Free-form labels on the remote asset. Absent if unsupported. */
|
|
1580
|
-
setTags?(objectId: string, tags: string[]): Promise<void>;
|
|
1581
|
-
/** Walk every asset on the account. Required by `adopt` and `salvage`. */
|
|
1582
|
-
list?(): AsyncGenerator<RemoteAsset>;
|
|
1583
|
-
/** Irreversible. Only reached via `purge`, behind explicit confirmation. */
|
|
1584
|
-
delete?(assetId: string): Promise<void>;
|
|
1585
|
-
}
|
|
1586
|
-
declare class UnsupportedCapabilityError extends Error {
|
|
1587
|
-
constructor(providerId: string, capability: string);
|
|
1588
|
-
}
|
|
1589
|
-
/** Narrowing helpers so call sites fail with a clear message, not `undefined is not a function`. */
|
|
1590
|
-
declare function requireList(provider: Provider): NonNullable<Provider["list"]>;
|
|
1591
|
-
declare function requireDelete(provider: Provider): NonNullable<Provider["delete"]>;
|
|
1592
|
-
declare function formatCost(unit: CostUnit, amount: number): string;
|
|
1593
|
-
|
|
1594
1666
|
/**
|
|
1595
1667
|
* PixelLab, the reference implementation.
|
|
1596
1668
|
*
|
|
@@ -1623,6 +1695,7 @@ declare class PixelLabProvider implements Provider {
|
|
|
1623
1695
|
*/
|
|
1624
1696
|
private static cacheDir;
|
|
1625
1697
|
estimate(spec: ResolvedSpec): CostEstimate;
|
|
1698
|
+
validate(spec: ResolvedSpec, styleImages: ResolvedStyleImage[]): void;
|
|
1626
1699
|
submit(spec: ResolvedSpec, styleImages: ResolvedStyleImage[]): Promise<{
|
|
1627
1700
|
jobId: string;
|
|
1628
1701
|
}>;
|
|
@@ -1652,6 +1725,70 @@ declare class PixelLabProvider implements Provider {
|
|
|
1652
1725
|
delete(assetId: string): Promise<void>;
|
|
1653
1726
|
}
|
|
1654
1727
|
|
|
1728
|
+
interface RetroDiffusionOptions {
|
|
1729
|
+
/** Live style id returned by GET /styles/selector. */
|
|
1730
|
+
promptStyle?: string;
|
|
1731
|
+
/** Candidate images produced by one request. */
|
|
1732
|
+
numImages?: number;
|
|
1733
|
+
/** Override the style's shared noBackground setting. */
|
|
1734
|
+
removeBg?: boolean;
|
|
1735
|
+
/** Animation frame duration accepted by Retro Diffusion. */
|
|
1736
|
+
framesDuration?: 4 | 6 | 8 | 10 | 12 | 16;
|
|
1737
|
+
/** Return a PNG spritesheet instead of the default animated GIF. */
|
|
1738
|
+
returnSpritesheet?: boolean;
|
|
1739
|
+
/** Outside texture description for rd_tile__tileset_advanced. */
|
|
1740
|
+
extraPrompt?: string;
|
|
1741
|
+
/** Ask a still image to tile seamlessly on each axis. */
|
|
1742
|
+
tileX?: boolean;
|
|
1743
|
+
tileY?: boolean;
|
|
1744
|
+
}
|
|
1745
|
+
interface InferenceResult {
|
|
1746
|
+
balance_cost?: number;
|
|
1747
|
+
remaining_balance?: number;
|
|
1748
|
+
base64_images?: string[];
|
|
1749
|
+
output_urls?: string[];
|
|
1750
|
+
}
|
|
1751
|
+
interface TaskResponse {
|
|
1752
|
+
status: "pending" | "running" | "succeeded" | "failed";
|
|
1753
|
+
result?: InferenceResult | null;
|
|
1754
|
+
error?: string | {
|
|
1755
|
+
message?: string;
|
|
1756
|
+
} | null;
|
|
1757
|
+
}
|
|
1758
|
+
declare class RetroDiffusionClient {
|
|
1759
|
+
private readonly token;
|
|
1760
|
+
private readonly baseUrl;
|
|
1761
|
+
private readonly request;
|
|
1762
|
+
constructor(token: string | undefined, baseUrl?: string, request?: typeof fetch);
|
|
1763
|
+
submit(body: Record<string, unknown>): Promise<string>;
|
|
1764
|
+
quote(body: Record<string, unknown>): Promise<number>;
|
|
1765
|
+
task(id: string): Promise<TaskResponse>;
|
|
1766
|
+
balance(): Promise<number>;
|
|
1767
|
+
private call;
|
|
1768
|
+
}
|
|
1769
|
+
/** Experimental native pixel-art still, tileset, and animation adapter. */
|
|
1770
|
+
declare class RetroDiffusionProvider implements Provider {
|
|
1771
|
+
private readonly client;
|
|
1772
|
+
readonly id = "retrodiffusion";
|
|
1773
|
+
constructor(client: RetroDiffusionClient);
|
|
1774
|
+
static fromEnv(): RetroDiffusionProvider;
|
|
1775
|
+
static forOffline(): RetroDiffusionProvider;
|
|
1776
|
+
static forDownloads(): RetroDiffusionProvider;
|
|
1777
|
+
supports(generator: Generator): boolean;
|
|
1778
|
+
estimate(spec: ResolvedSpec): CostEstimate;
|
|
1779
|
+
validate(spec: ResolvedSpec, styleImages: ResolvedStyleImage[]): void;
|
|
1780
|
+
submit(spec: ResolvedSpec, styleImages: ResolvedStyleImage[]): Promise<{
|
|
1781
|
+
jobId: string;
|
|
1782
|
+
}>;
|
|
1783
|
+
poll(jobId: string, generator: Generator, context?: PollContext): Promise<JobState>;
|
|
1784
|
+
selectCandidate(jobId: string, index: number): Promise<{
|
|
1785
|
+
objectId: string;
|
|
1786
|
+
sourceUrl: string | null;
|
|
1787
|
+
}>;
|
|
1788
|
+
download(url: string): Promise<Buffer>;
|
|
1789
|
+
balance(): Promise<BalanceInfo>;
|
|
1790
|
+
}
|
|
1791
|
+
|
|
1655
1792
|
/**
|
|
1656
1793
|
* An in-memory Provider for tests.
|
|
1657
1794
|
*
|
|
@@ -1731,6 +1868,20 @@ declare class FakeProvider implements Provider {
|
|
|
1731
1868
|
private register;
|
|
1732
1869
|
}
|
|
1733
1870
|
|
|
1871
|
+
type ProviderMode = "online" | "offline" | "downloads";
|
|
1872
|
+
/** Construction metadata kept outside adapters so the CLI stays generic. */
|
|
1873
|
+
interface ProviderFactory {
|
|
1874
|
+
readonly id: string;
|
|
1875
|
+
/** Environment variable expected for authenticated operations, if any. */
|
|
1876
|
+
readonly credentialEnv?: string;
|
|
1877
|
+
create(mode: ProviderMode): Provider;
|
|
1878
|
+
}
|
|
1879
|
+
/** Register a provider without allowing import order to replace an existing id. */
|
|
1880
|
+
declare function registerProvider(factory: ProviderFactory): void;
|
|
1881
|
+
declare function providerFactory(id: string): ProviderFactory;
|
|
1882
|
+
declare function createProvider(id: string, mode: ProviderMode): Provider;
|
|
1883
|
+
declare function availableProviders(): string[];
|
|
1884
|
+
|
|
1734
1885
|
interface LoadedManifest {
|
|
1735
1886
|
manifest: Manifest;
|
|
1736
1887
|
/** Directory the manifest lives in. All relative paths resolve against it. */
|
|
@@ -1748,7 +1899,7 @@ declare function resolveSpecs(loaded: LoadedManifest, filter?: {
|
|
|
1748
1899
|
styles?: string[];
|
|
1749
1900
|
assets?: string[];
|
|
1750
1901
|
/** Optional provider makes offline plan cost/candidate estimates adapter-owned. */
|
|
1751
|
-
provider?: Pick<Provider, "supports" | "estimate" | "id">;
|
|
1902
|
+
provider?: Pick<Provider, "supports" | "estimate" | "validate" | "id">;
|
|
1752
1903
|
}): Promise<ResolvedSpec[]>;
|
|
1753
1904
|
/** Reference image bytes and measured dimensions, in manifest order. */
|
|
1754
1905
|
declare function resolveStyleImages(loaded: LoadedManifest, styleId: string): Promise<ResolvedStyleImage[]>;
|
|
@@ -1758,7 +1909,7 @@ declare function styleImagesBase64(loaded: LoadedManifest, styleId: string): Pro
|
|
|
1758
1909
|
declare function imageMetadata(buf: Buffer): Pick<ResolvedStyleImage, "width" | "height" | "format"> | null;
|
|
1759
1910
|
|
|
1760
1911
|
/**
|
|
1761
|
-
* The lockfile is the record that maps a spec to the
|
|
1912
|
+
* The lockfile is the record that maps a spec to the provider work that
|
|
1762
1913
|
* satisfies it and the file on disk that came from it. It is written after
|
|
1763
1914
|
* every state transition — including immediately after submitting, before the
|
|
1764
1915
|
* job is awaited — so an interrupted run never loses track of paid-for work.
|
|
@@ -1811,9 +1962,9 @@ declare function portableOutputPath(file: string, manifestDir: string): string;
|
|
|
1811
1962
|
/** Resolve a portable lock path against the manifest, never the process cwd. */
|
|
1812
1963
|
declare function resolveOutputPath(recordedPath: string, manifestDir: string): string;
|
|
1813
1964
|
/** Deterministic current destination for one provider output. */
|
|
1814
|
-
declare function expectedOutputPath(spec: ResolvedSpec, role: string | undefined, index: number, total: number): string;
|
|
1965
|
+
declare function expectedOutputPath(spec: ResolvedSpec, role: string | undefined, index: number, total: number, mediaType?: MediaType): string;
|
|
1815
1966
|
/** Resolve one recorded output from the current manifest-owned destination. */
|
|
1816
|
-
declare function currentOutputPath(output: Pick<LockOutput, "path" | "role">, spec: ResolvedSpec, index: number, total: number): string;
|
|
1967
|
+
declare function currentOutputPath(output: Pick<LockOutput, "path" | "role" | "mediaType">, spec: ResolvedSpec, index: number, total: number): string;
|
|
1817
1968
|
/** Resolve an entry member using the complete source-set order when available. */
|
|
1818
1969
|
declare function currentEntryOutputPath(entry: LockEntry, spec: ResolvedSpec, index: number): string;
|
|
1819
1970
|
/**
|
|
@@ -2395,7 +2546,7 @@ declare function fetchAssets(provider: Provider, specs: ResolvedSpec[], lock: Lo
|
|
|
2395
2546
|
onProgress?: (msg: string) => void;
|
|
2396
2547
|
concurrency?: number;
|
|
2397
2548
|
repair?: boolean;
|
|
2398
|
-
/** Content-addressed
|
|
2549
|
+
/** Content-addressed media cache. Defaults beside the lockfile; false disables it. */
|
|
2399
2550
|
cacheDir?: string | false;
|
|
2400
2551
|
}): Promise<FetchResult>;
|
|
2401
2552
|
/**
|
|
@@ -2423,6 +2574,7 @@ interface DoctorOptions {
|
|
|
2423
2574
|
/** Skip provider connectivity while retaining every local check. */
|
|
2424
2575
|
offline?: boolean;
|
|
2425
2576
|
apiKeyPresent?: boolean;
|
|
2577
|
+
credentialEnv?: string;
|
|
2426
2578
|
}
|
|
2427
2579
|
/**
|
|
2428
2580
|
* Checks the whole project without changing it. Loading/resolving the manifest
|
|
@@ -2466,7 +2618,7 @@ interface PickResult {
|
|
|
2466
2618
|
* Serves the contact sheet on localhost, waits for the selections to be
|
|
2467
2619
|
* applied, then shuts down.
|
|
2468
2620
|
*
|
|
2469
|
-
* Selections are committed
|
|
2621
|
+
* Selections are committed through the provider (`select-frames` promotes the chosen
|
|
2470
2622
|
* candidate to its own object and drops the rest) and written to the lockfile
|
|
2471
2623
|
* before the browser gets its response, so a closed tab never loses a choice.
|
|
2472
2624
|
*/
|
|
@@ -2576,6 +2728,18 @@ interface SiblingManifest {
|
|
|
2576
2728
|
label: string;
|
|
2577
2729
|
manifest: Manifest;
|
|
2578
2730
|
}
|
|
2731
|
+
/**
|
|
2732
|
+
* Loads every sibling project's manifest for `groupOrphansByStyle`'s
|
|
2733
|
+
* sibling-exclusion signal, from the union of a workspace catalog's
|
|
2734
|
+
* registered manifests and the conventional sibling beside each `--claims`
|
|
2735
|
+
* lockfile (same directory, by the convention `--lock` defaults from
|
|
2736
|
+
* `--manifest`). The two sources are meant to combine, not choose between
|
|
2737
|
+
* (docs/RECOVERY.md: "`--claims` still works and unions with a workspace's
|
|
2738
|
+
* claim set") — a `--claims` path passed alongside `--workspace` must still
|
|
2739
|
+
* contribute its own style signal. Best-effort: a missing or malformed
|
|
2740
|
+
* sibling just means no extra signal for that orphan, not an error.
|
|
2741
|
+
*/
|
|
2742
|
+
declare function loadSiblingManifests(ownManifestPath: string, workspaceManifestPaths: string[], claimPaths: string[]): Promise<SiblingManifest[]>;
|
|
2579
2743
|
interface OrphanGroups {
|
|
2580
2744
|
/** styleId → its matched orphans, in manifest style order. */
|
|
2581
2745
|
matched: Map<string, Orphan[]>;
|
|
@@ -2676,4 +2840,159 @@ interface SalvageSheetContext {
|
|
|
2676
2840
|
*/
|
|
2677
2841
|
declare function renderSalvageSheet(orphans: Orphan[], ctx?: SalvageSheetContext): string;
|
|
2678
2842
|
|
|
2679
|
-
|
|
2843
|
+
/**
|
|
2844
|
+
* One sibling project registered in a workspace catalog. Only paths and
|
|
2845
|
+
* identity live here — never a credential. Each project keeps loading its own
|
|
2846
|
+
* key from its own `.env`, the same as it does standalone.
|
|
2847
|
+
*/
|
|
2848
|
+
declare const WorkspaceProjectSchema: z.ZodObject<{
|
|
2849
|
+
id: z.ZodString;
|
|
2850
|
+
/** Manifest path, relative to the catalog file's own directory. */
|
|
2851
|
+
manifest: z.ZodString;
|
|
2852
|
+
/** Lockfile path, relative to the catalog file's own directory. */
|
|
2853
|
+
lock: z.ZodString;
|
|
2854
|
+
provider: z.ZodDefault<z.ZodString>;
|
|
2855
|
+
/** Free-form label for a shared account, e.g. distinguishing sandboxes. */
|
|
2856
|
+
account: z.ZodOptional<z.ZodString>;
|
|
2857
|
+
}, "strict", z.ZodTypeAny, {
|
|
2858
|
+
provider: string;
|
|
2859
|
+
id: string;
|
|
2860
|
+
manifest: string;
|
|
2861
|
+
lock: string;
|
|
2862
|
+
account?: string | undefined;
|
|
2863
|
+
}, {
|
|
2864
|
+
id: string;
|
|
2865
|
+
manifest: string;
|
|
2866
|
+
lock: string;
|
|
2867
|
+
provider?: string | undefined;
|
|
2868
|
+
account?: string | undefined;
|
|
2869
|
+
}>;
|
|
2870
|
+
declare const WorkspaceSchema: z.ZodObject<{
|
|
2871
|
+
version: z.ZodLiteral<1>;
|
|
2872
|
+
projects: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
2873
|
+
id: z.ZodString;
|
|
2874
|
+
/** Manifest path, relative to the catalog file's own directory. */
|
|
2875
|
+
manifest: z.ZodString;
|
|
2876
|
+
/** Lockfile path, relative to the catalog file's own directory. */
|
|
2877
|
+
lock: z.ZodString;
|
|
2878
|
+
provider: z.ZodDefault<z.ZodString>;
|
|
2879
|
+
/** Free-form label for a shared account, e.g. distinguishing sandboxes. */
|
|
2880
|
+
account: z.ZodOptional<z.ZodString>;
|
|
2881
|
+
}, "strict", z.ZodTypeAny, {
|
|
2882
|
+
provider: string;
|
|
2883
|
+
id: string;
|
|
2884
|
+
manifest: string;
|
|
2885
|
+
lock: string;
|
|
2886
|
+
account?: string | undefined;
|
|
2887
|
+
}, {
|
|
2888
|
+
id: string;
|
|
2889
|
+
manifest: string;
|
|
2890
|
+
lock: string;
|
|
2891
|
+
provider?: string | undefined;
|
|
2892
|
+
account?: string | undefined;
|
|
2893
|
+
}>, "many">>;
|
|
2894
|
+
}, "strict", z.ZodTypeAny, {
|
|
2895
|
+
version: 1;
|
|
2896
|
+
projects: {
|
|
2897
|
+
provider: string;
|
|
2898
|
+
id: string;
|
|
2899
|
+
manifest: string;
|
|
2900
|
+
lock: string;
|
|
2901
|
+
account?: string | undefined;
|
|
2902
|
+
}[];
|
|
2903
|
+
}, {
|
|
2904
|
+
version: 1;
|
|
2905
|
+
projects?: {
|
|
2906
|
+
id: string;
|
|
2907
|
+
manifest: string;
|
|
2908
|
+
lock: string;
|
|
2909
|
+
provider?: string | undefined;
|
|
2910
|
+
account?: string | undefined;
|
|
2911
|
+
}[] | undefined;
|
|
2912
|
+
}>;
|
|
2913
|
+
type WorkspaceProject = z.infer<typeof WorkspaceProjectSchema>;
|
|
2914
|
+
type Workspace = z.infer<typeof WorkspaceSchema>;
|
|
2915
|
+
/**
|
|
2916
|
+
* Parses a workspace catalog, rejecting anything that is not v1.
|
|
2917
|
+
*
|
|
2918
|
+
* Mirrors `parseLock`'s stance: no migration path, fail loudly rather than
|
|
2919
|
+
* guess at a hand-edited or corrupted file's intent.
|
|
2920
|
+
*/
|
|
2921
|
+
declare function parseWorkspace(raw: unknown): Workspace;
|
|
2922
|
+
declare function loadWorkspace(workspacePath: string): Promise<Workspace>;
|
|
2923
|
+
/** Atomic write — a crash mid-save must not leave a truncated catalog. */
|
|
2924
|
+
declare function saveWorkspace(workspacePath: string, ws: Workspace): Promise<void>;
|
|
2925
|
+
/** Stored path convention: relative to the catalog's directory, forward-slash. */
|
|
2926
|
+
declare function toPortablePath(dir: string, absolute: string): string;
|
|
2927
|
+
/** Resolve a registered project's stored paths against the catalog's directory. */
|
|
2928
|
+
declare function resolveProject(dir: string, project: WorkspaceProject): {
|
|
2929
|
+
manifestPath: string;
|
|
2930
|
+
lockPath: string;
|
|
2931
|
+
};
|
|
2932
|
+
interface WorkspaceDiagnostic {
|
|
2933
|
+
id: "duplicate-id" | "duplicate-lock" | "duplicate-manifest" | "missing-manifest" | "missing-lock" | "absolute-path" | "mixed-provider";
|
|
2934
|
+
level: "error" | "warning";
|
|
2935
|
+
message: string;
|
|
2936
|
+
}
|
|
2937
|
+
/**
|
|
2938
|
+
* Checks the catalog without touching the network or any registered
|
|
2939
|
+
* project's files. Duplicate ids and duplicate lock paths are errors — either
|
|
2940
|
+
* would corrupt the union claim set. A duplicate manifest is only a warning,
|
|
2941
|
+
* because a manifest paired with a variant `--lock` is an already-supported
|
|
2942
|
+
* pattern (see `cachePathFor`). Missing files are errors: a claim set derived
|
|
2943
|
+
* from a workspace that silently skipped a project is the exact hazard this
|
|
2944
|
+
* catalog exists to prevent.
|
|
2945
|
+
*/
|
|
2946
|
+
declare function validateWorkspace(ws: Workspace, dir: string): WorkspaceDiagnostic[];
|
|
2947
|
+
|
|
2948
|
+
interface WorkspaceClaims {
|
|
2949
|
+
claimed: Set<string>;
|
|
2950
|
+
/** Claim count contributed by each registered project. */
|
|
2951
|
+
byProject: Record<string, number>;
|
|
2952
|
+
lockPaths: string[];
|
|
2953
|
+
}
|
|
2954
|
+
/**
|
|
2955
|
+
* The complete account-wide claim set, derived from every registered lock.
|
|
2956
|
+
*
|
|
2957
|
+
* Delegates the union rule itself to `loadClaims` rather than reimplementing
|
|
2958
|
+
* it, so the workspace and single-project `--claims` paths cannot drift. Each
|
|
2959
|
+
* lock is loaded one at a time — rather than handing `loadClaims` the whole
|
|
2960
|
+
* path list at once — purely so a failure can be attributed to the project
|
|
2961
|
+
* that owns it; the safety property (any unreadable registered lock aborts
|
|
2962
|
+
* before returning a claim set) is identical either way.
|
|
2963
|
+
*/
|
|
2964
|
+
declare function workspaceClaims(ws: Workspace, dir: string): Promise<WorkspaceClaims>;
|
|
2965
|
+
interface WorkspaceProjectStatus {
|
|
2966
|
+
id: string;
|
|
2967
|
+
provider: string;
|
|
2968
|
+
account: string | null;
|
|
2969
|
+
manifest: string;
|
|
2970
|
+
lock: string;
|
|
2971
|
+
entries: number;
|
|
2972
|
+
byState: Record<PlanState, number>;
|
|
2973
|
+
spendByUnit: Record<CostUnit, number>;
|
|
2974
|
+
error: string | null;
|
|
2975
|
+
}
|
|
2976
|
+
interface WorkspaceStatusReport {
|
|
2977
|
+
version: 1;
|
|
2978
|
+
safe: boolean;
|
|
2979
|
+
/** The catalog's own directory — resolved paths in `projects` sit under it. */
|
|
2980
|
+
dir: string;
|
|
2981
|
+
projects: WorkspaceProjectStatus[];
|
|
2982
|
+
totals: {
|
|
2983
|
+
byState: Record<PlanState, number>;
|
|
2984
|
+
spendByUnit: Record<CostUnit, number>;
|
|
2985
|
+
claims: number;
|
|
2986
|
+
};
|
|
2987
|
+
diagnostics: WorkspaceDiagnostic[];
|
|
2988
|
+
}
|
|
2989
|
+
/**
|
|
2990
|
+
* Aggregate, read-only account/project state — offline throughout, using the
|
|
2991
|
+
* same offline cost estimator `plan` uses. A project whose manifest or lock
|
|
2992
|
+
* fails to load surfaces as that project's own `error` rather than aborting
|
|
2993
|
+
* the whole report, so one broken sibling does not hide every other
|
|
2994
|
+
* project's status. It never writes to any registered project's lock.
|
|
2995
|
+
*/
|
|
2996
|
+
declare function workspaceStatus(ws: Workspace, dir: string): Promise<WorkspaceStatusReport>;
|
|
2997
|
+
|
|
2998
|
+
export { type AdoptResult, type ArtifactBundleManifest, type ArtifactBundleOptions, type ArtifactBundleResult, type ArtifactFile, type ArtifactProvenance, type ArtifactSource, type ArtifactVerification, type Asset, type AssetAudit, AssetSchema, type AuditEvaluation, type AuditThresholds, type AuditViolation, type Balance, type BalanceChange, type BalanceInfo, type CacheHealthOptions, type CacheHealthReport, type ContentCacheHealth, type ContentCacheIssue, type CostEstimate, type CostUnit, DEFAULT_RATE_LIMIT, type DoctorCheck, type DoctorLevel, type DoctorOptions, type DoctorReport, FAKE_PNG, type FakeOptions, FakeProvider, type FetchResult, type Generator, GeneratorSchema, type GenericTileset, type JobState, type LoadedManifest, type Lock, type LockEntry, LockEntrySchema, type LockOutput, LockSchema, MAX_DOWNLOAD_BYTES, MAX_RETRIES, type ManagedArtifactBundleOptions, type Manifest, ManifestSchema, type MapObject, MediaType, type MountPlacement, type MountedSheet, type NormalizedTileRules, type Orphan, type OrphanGroups, type OutputSelection, type OutputSource, type PackedFrame, type PackedSheet, type PackedSource, type PickResult, PixelLabClient, PixelLabError, type PixelLabObject, PixelLabProvider, type Plan, type PlanItem, type PlanState, type PollContext, type PollOptions, type PollResult, type Provider, type ProviderFactory, type ProviderMetadata, type ProviderMode, type RateLimit, type RemoteAsset, type RemoteHashCacheHealth, type ResolvedOutput, type ResolvedSpec, type ResolvedStyleImage, type RetroDiffusionOptions, RetroDiffusionProvider, type SalvageAction, type SalvageResult, type ScannedAsset, type SheetGroup, type SiblingManifest, type SpriteInput, type Style, type StyleAudit, StyleSchema, type SubmitOptions, type SubmitResult, type TilesPro, type TilesetExport, type TilesetExportOptions, type TilesetFormat, UnsupportedCapabilityError, type Workspace, type WorkspaceClaims, type WorkspaceDiagnostic, type WorkspaceProject, WorkspaceProjectSchema, type WorkspaceProjectStatus, WorkspaceSchema, type WorkspaceStatusReport, adopt, applyTags, auditStyle, availableProviders, backoffMs, buildManifest, buildPlan, cacheFileName, candidateCount, clientFromEnv, colorDistance, countNumberedDescriptions, createArtifactBundleManifest, createProvider, currentEntryOutputPath, currentOutputPath, detectMediaType, doctor, evaluateAudit, expectedOutputPath, exportTileset, fallbackOutputRole, fetchAssets, findOrphans, formatCost, generationCost, groupOrphansByStyle, hex, idFromPrompt, imageMetadata, inspectCaches, loadClaims, loadLock, loadManifest, loadSiblingManifests, loadWorkspace, lockKey, matchOrphanStyle, measureBalanceChange, mediaExtension, mediaTypeFromExtension, mergePalettes, mountSprites, mountStyle, normalizeLockOutputPaths, normalizeTileRules, outliers, outputId, packSprites, packStyle, paletteDistance, parseLock, parseWorkspace, pngSize, poll, portableOutputPath, primaryOutput, providerFactory, pushTags, registerProvider, remove, renderSalvageSheet, renderSheet, requireBalance, requireDelete, requireList, requireSelectCandidate, resolveEntryOutputs, resolveOutputPath, resolvePackInputs, resolveProject, resolveSpecEntryOutputs, resolveSpecOutputs, resolveSpecs, resolveStyleImages, resolveStyleOutputs, retryAfterMs, runPicker, runSalvage, saveLock, saveWorkspace, scanAssets, selectEntryOutput, sha256, sha256File, shouldRetry, slugify, specHash, spendByUnit, styleImagesBase64, submit, summarize, tagAdopted, tileFeatureOutputCount, tileVariationCount, tilesCost, toPortablePath, totalSpend, upsert, validateCostEstimate, validateMedia, validateWorkspace, verifyArtifactBundle, withArtifactManifest, workspaceClaims, workspaceStatus, writeArtifactBundle, writeManagedArtifactBundle };
|