pixelkiln 0.22.0 → 0.24.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.d.ts +1 -1
- package/dist/cli.js +684 -292
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +429 -84
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +238 -105
- package/dist/index.d.ts +238 -105
- package/dist/index.js +417 -72
- package/dist/index.js.map +1 -1
- package/docs/ARTIFACTS.md +10 -5
- package/docs/CLI.md +42 -5
- package/docs/MANIFEST.md +5 -2
- package/package.json +1 -1
- package/schema/manifest.schema.json +8 -0
- package/skills/pixelkiln/SKILL.md +4 -1
package/dist/index.d.ts
CHANGED
|
@@ -1656,6 +1656,15 @@ declare const AssetSchema: z.ZodEffects<z.ZodObject<{
|
|
|
1656
1656
|
* that wasn't. `prompt` still records what was asked for.
|
|
1657
1657
|
*/
|
|
1658
1658
|
source: z.ZodOptional<z.ZodString>;
|
|
1659
|
+
/**
|
|
1660
|
+
* Per-style replacement for `source`, keyed by style id.
|
|
1661
|
+
*
|
|
1662
|
+
* A hand edit belongs to one generation: the same asset generated in two
|
|
1663
|
+
* styles is two different pictures, so the touch-up of one must not be
|
|
1664
|
+
* placed for the other. `pixelkiln edit` writes here when an asset is in
|
|
1665
|
+
* more than one style, and to `source` when it is in exactly one.
|
|
1666
|
+
*/
|
|
1667
|
+
sourceByStyle: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
1659
1668
|
/** Controlled generation derived from another asset in the same style. */
|
|
1660
1669
|
revision: z.ZodOptional<z.ZodEffects<z.ZodObject<{
|
|
1661
1670
|
/** What kind of controlled change the provider workflow performs. */
|
|
@@ -1716,6 +1725,7 @@ declare const AssetSchema: z.ZodEffects<z.ZodObject<{
|
|
|
1716
1725
|
}, "strict", z.ZodTypeAny, {
|
|
1717
1726
|
tags: string[];
|
|
1718
1727
|
prompt: string;
|
|
1728
|
+
sourceByStyle: Record<string, string>;
|
|
1719
1729
|
styles: string[];
|
|
1720
1730
|
promptByStyle: Record<string, string>;
|
|
1721
1731
|
providerInputs: Record<string, string | number | boolean | (string | number | boolean)[]>;
|
|
@@ -1743,6 +1753,7 @@ declare const AssetSchema: z.ZodEffects<z.ZodObject<{
|
|
|
1743
1753
|
file?: string | undefined;
|
|
1744
1754
|
cell?: [number, number] | undefined;
|
|
1745
1755
|
source?: string | undefined;
|
|
1756
|
+
sourceByStyle?: Record<string, string> | undefined;
|
|
1746
1757
|
revision?: {
|
|
1747
1758
|
mode: "image-to-image" | "inpaint" | "outpaint";
|
|
1748
1759
|
from: string;
|
|
@@ -1756,6 +1767,7 @@ declare const AssetSchema: z.ZodEffects<z.ZodObject<{
|
|
|
1756
1767
|
}>, {
|
|
1757
1768
|
tags: string[];
|
|
1758
1769
|
prompt: string;
|
|
1770
|
+
sourceByStyle: Record<string, string>;
|
|
1759
1771
|
styles: string[];
|
|
1760
1772
|
promptByStyle: Record<string, string>;
|
|
1761
1773
|
providerInputs: Record<string, string | number | boolean | (string | number | boolean)[]>;
|
|
@@ -1783,6 +1795,7 @@ declare const AssetSchema: z.ZodEffects<z.ZodObject<{
|
|
|
1783
1795
|
file?: string | undefined;
|
|
1784
1796
|
cell?: [number, number] | undefined;
|
|
1785
1797
|
source?: string | undefined;
|
|
1798
|
+
sourceByStyle?: Record<string, string> | undefined;
|
|
1786
1799
|
revision?: {
|
|
1787
1800
|
mode: "image-to-image" | "inpaint" | "outpaint";
|
|
1788
1801
|
from: string;
|
|
@@ -2249,6 +2262,15 @@ declare const ManifestSchema: z.ZodObject<{
|
|
|
2249
2262
|
* that wasn't. `prompt` still records what was asked for.
|
|
2250
2263
|
*/
|
|
2251
2264
|
source: z.ZodOptional<z.ZodString>;
|
|
2265
|
+
/**
|
|
2266
|
+
* Per-style replacement for `source`, keyed by style id.
|
|
2267
|
+
*
|
|
2268
|
+
* A hand edit belongs to one generation: the same asset generated in two
|
|
2269
|
+
* styles is two different pictures, so the touch-up of one must not be
|
|
2270
|
+
* placed for the other. `pixelkiln edit` writes here when an asset is in
|
|
2271
|
+
* more than one style, and to `source` when it is in exactly one.
|
|
2272
|
+
*/
|
|
2273
|
+
sourceByStyle: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
2252
2274
|
/** Controlled generation derived from another asset in the same style. */
|
|
2253
2275
|
revision: z.ZodOptional<z.ZodEffects<z.ZodObject<{
|
|
2254
2276
|
/** What kind of controlled change the provider workflow performs. */
|
|
@@ -2309,6 +2331,7 @@ declare const ManifestSchema: z.ZodObject<{
|
|
|
2309
2331
|
}, "strict", z.ZodTypeAny, {
|
|
2310
2332
|
tags: string[];
|
|
2311
2333
|
prompt: string;
|
|
2334
|
+
sourceByStyle: Record<string, string>;
|
|
2312
2335
|
styles: string[];
|
|
2313
2336
|
promptByStyle: Record<string, string>;
|
|
2314
2337
|
providerInputs: Record<string, string | number | boolean | (string | number | boolean)[]>;
|
|
@@ -2336,6 +2359,7 @@ declare const ManifestSchema: z.ZodObject<{
|
|
|
2336
2359
|
file?: string | undefined;
|
|
2337
2360
|
cell?: [number, number] | undefined;
|
|
2338
2361
|
source?: string | undefined;
|
|
2362
|
+
sourceByStyle?: Record<string, string> | undefined;
|
|
2339
2363
|
revision?: {
|
|
2340
2364
|
mode: "image-to-image" | "inpaint" | "outpaint";
|
|
2341
2365
|
from: string;
|
|
@@ -2349,6 +2373,7 @@ declare const ManifestSchema: z.ZodObject<{
|
|
|
2349
2373
|
}>, {
|
|
2350
2374
|
tags: string[];
|
|
2351
2375
|
prompt: string;
|
|
2376
|
+
sourceByStyle: Record<string, string>;
|
|
2352
2377
|
styles: string[];
|
|
2353
2378
|
promptByStyle: Record<string, string>;
|
|
2354
2379
|
providerInputs: Record<string, string | number | boolean | (string | number | boolean)[]>;
|
|
@@ -2376,6 +2401,7 @@ declare const ManifestSchema: z.ZodObject<{
|
|
|
2376
2401
|
file?: string | undefined;
|
|
2377
2402
|
cell?: [number, number] | undefined;
|
|
2378
2403
|
source?: string | undefined;
|
|
2404
|
+
sourceByStyle?: Record<string, string> | undefined;
|
|
2379
2405
|
revision?: {
|
|
2380
2406
|
mode: "image-to-image" | "inpaint" | "outpaint";
|
|
2381
2407
|
from: string;
|
|
@@ -2433,6 +2459,7 @@ declare const ManifestSchema: z.ZodObject<{
|
|
|
2433
2459
|
assets: Record<string, {
|
|
2434
2460
|
tags: string[];
|
|
2435
2461
|
prompt: string;
|
|
2462
|
+
sourceByStyle: Record<string, string>;
|
|
2436
2463
|
styles: string[];
|
|
2437
2464
|
promptByStyle: Record<string, string>;
|
|
2438
2465
|
providerInputs: Record<string, string | number | boolean | (string | number | boolean)[]>;
|
|
@@ -2504,6 +2531,7 @@ declare const ManifestSchema: z.ZodObject<{
|
|
|
2504
2531
|
file?: string | undefined;
|
|
2505
2532
|
cell?: [number, number] | undefined;
|
|
2506
2533
|
source?: string | undefined;
|
|
2534
|
+
sourceByStyle?: Record<string, string> | undefined;
|
|
2507
2535
|
revision?: {
|
|
2508
2536
|
mode: "image-to-image" | "inpaint" | "outpaint";
|
|
2509
2537
|
from: string;
|
|
@@ -3132,6 +3160,15 @@ declare const ManifestInputSchema: z.ZodObject<{
|
|
|
3132
3160
|
* that wasn't. `prompt` still records what was asked for.
|
|
3133
3161
|
*/
|
|
3134
3162
|
source: z.ZodOptional<z.ZodString>;
|
|
3163
|
+
/**
|
|
3164
|
+
* Per-style replacement for `source`, keyed by style id.
|
|
3165
|
+
*
|
|
3166
|
+
* A hand edit belongs to one generation: the same asset generated in two
|
|
3167
|
+
* styles is two different pictures, so the touch-up of one must not be
|
|
3168
|
+
* placed for the other. `pixelkiln edit` writes here when an asset is in
|
|
3169
|
+
* more than one style, and to `source` when it is in exactly one.
|
|
3170
|
+
*/
|
|
3171
|
+
sourceByStyle: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
3135
3172
|
/** Controlled generation derived from another asset in the same style. */
|
|
3136
3173
|
revision: z.ZodOptional<z.ZodEffects<z.ZodObject<{
|
|
3137
3174
|
/** What kind of controlled change the provider workflow performs. */
|
|
@@ -3192,6 +3229,7 @@ declare const ManifestInputSchema: z.ZodObject<{
|
|
|
3192
3229
|
}, "strict", z.ZodTypeAny, {
|
|
3193
3230
|
tags: string[];
|
|
3194
3231
|
prompt: string;
|
|
3232
|
+
sourceByStyle: Record<string, string>;
|
|
3195
3233
|
styles: string[];
|
|
3196
3234
|
promptByStyle: Record<string, string>;
|
|
3197
3235
|
providerInputs: Record<string, string | number | boolean | (string | number | boolean)[]>;
|
|
@@ -3219,6 +3257,7 @@ declare const ManifestInputSchema: z.ZodObject<{
|
|
|
3219
3257
|
file?: string | undefined;
|
|
3220
3258
|
cell?: [number, number] | undefined;
|
|
3221
3259
|
source?: string | undefined;
|
|
3260
|
+
sourceByStyle?: Record<string, string> | undefined;
|
|
3222
3261
|
revision?: {
|
|
3223
3262
|
mode: "image-to-image" | "inpaint" | "outpaint";
|
|
3224
3263
|
from: string;
|
|
@@ -3232,6 +3271,7 @@ declare const ManifestInputSchema: z.ZodObject<{
|
|
|
3232
3271
|
}>, {
|
|
3233
3272
|
tags: string[];
|
|
3234
3273
|
prompt: string;
|
|
3274
|
+
sourceByStyle: Record<string, string>;
|
|
3235
3275
|
styles: string[];
|
|
3236
3276
|
promptByStyle: Record<string, string>;
|
|
3237
3277
|
providerInputs: Record<string, string | number | boolean | (string | number | boolean)[]>;
|
|
@@ -3259,6 +3299,7 @@ declare const ManifestInputSchema: z.ZodObject<{
|
|
|
3259
3299
|
file?: string | undefined;
|
|
3260
3300
|
cell?: [number, number] | undefined;
|
|
3261
3301
|
source?: string | undefined;
|
|
3302
|
+
sourceByStyle?: Record<string, string> | undefined;
|
|
3262
3303
|
revision?: {
|
|
3263
3304
|
mode: "image-to-image" | "inpaint" | "outpaint";
|
|
3264
3305
|
from: string;
|
|
@@ -3356,6 +3397,7 @@ declare const ManifestInputSchema: z.ZodObject<{
|
|
|
3356
3397
|
assets: Record<string, {
|
|
3357
3398
|
tags: string[];
|
|
3358
3399
|
prompt: string;
|
|
3400
|
+
sourceByStyle: Record<string, string>;
|
|
3359
3401
|
styles: string[];
|
|
3360
3402
|
promptByStyle: Record<string, string>;
|
|
3361
3403
|
providerInputs: Record<string, string | number | boolean | (string | number | boolean)[]>;
|
|
@@ -3467,6 +3509,7 @@ declare const ManifestInputSchema: z.ZodObject<{
|
|
|
3467
3509
|
file?: string | undefined;
|
|
3468
3510
|
cell?: [number, number] | undefined;
|
|
3469
3511
|
source?: string | undefined;
|
|
3512
|
+
sourceByStyle?: Record<string, string> | undefined;
|
|
3470
3513
|
revision?: {
|
|
3471
3514
|
mode: "image-to-image" | "inpaint" | "outpaint";
|
|
3472
3515
|
from: string;
|
|
@@ -6997,6 +7040,13 @@ declare function packStyle(lock: Lock, styleId: string, manifestDir: string, opt
|
|
|
6997
7040
|
primaryOnly?: boolean;
|
|
6998
7041
|
/** Approved manifest quality outputs keyed by asset id or role-qualified frame id. */
|
|
6999
7042
|
sourceOverrides?: Record<string, string>;
|
|
7043
|
+
/**
|
|
7044
|
+
* Manifest `source` art keyed by asset id, manifest-relative. A hand edit
|
|
7045
|
+
* or other post-processed file stands in for that asset's single output,
|
|
7046
|
+
* and an asset with a source but no lock entry is packed from it — the
|
|
7047
|
+
* same rule `mount` applies. Structural sets keep their lock outputs.
|
|
7048
|
+
*/
|
|
7049
|
+
sources?: Record<string, string>;
|
|
7000
7050
|
}): PackedSheet;
|
|
7001
7051
|
interface MountPlacement extends SpriteInput {
|
|
7002
7052
|
/** Grid cell this sprite owns, as [column, row]. */
|
|
@@ -7504,9 +7554,20 @@ interface GalleryOutput {
|
|
|
7504
7554
|
mediaType: MediaType | null;
|
|
7505
7555
|
exists: boolean;
|
|
7506
7556
|
bytes: number | null;
|
|
7557
|
+
/** File modification time, for telling an edit from the generation it started from. */
|
|
7558
|
+
modifiedAt: string | null;
|
|
7507
7559
|
/** Served only while the gallery runs; null when the file is missing. */
|
|
7508
7560
|
url: string | null;
|
|
7509
7561
|
}
|
|
7562
|
+
type HandEditStatus =
|
|
7563
|
+
/** The edit file is byte-identical to the generated art. */
|
|
7564
|
+
"same"
|
|
7565
|
+
/** The author changed it. */
|
|
7566
|
+
| "edited"
|
|
7567
|
+
/** The generated art changed after the edit was last saved. */
|
|
7568
|
+
| "regenerated-since"
|
|
7569
|
+
/** The declared file is not on disk. */
|
|
7570
|
+
| "missing";
|
|
7510
7571
|
interface GalleryQuality {
|
|
7511
7572
|
state: QualityProfileInspection["state"];
|
|
7512
7573
|
reason: string;
|
|
@@ -7602,6 +7663,13 @@ interface GalleryItem {
|
|
|
7602
7663
|
asset: Asset | null;
|
|
7603
7664
|
/** Manifest-relative committed art placed instead of generated output. */
|
|
7604
7665
|
source: string | null;
|
|
7666
|
+
/**
|
|
7667
|
+
* The hand edit that stands in for this generation, when the asset has both
|
|
7668
|
+
* a lock entry and a `source`. Placed by mount and pack in place of the
|
|
7669
|
+
* generated file, which stays on disk as the record.
|
|
7670
|
+
*/
|
|
7671
|
+
edit: GalleryOutput | null;
|
|
7672
|
+
editStatus: HandEditStatus | null;
|
|
7605
7673
|
tags: string[];
|
|
7606
7674
|
category: string | null;
|
|
7607
7675
|
}
|
|
@@ -7616,6 +7684,10 @@ interface GalleryStyle {
|
|
|
7616
7684
|
promptPrefix: string;
|
|
7617
7685
|
promptSuffix: string;
|
|
7618
7686
|
palette: string[];
|
|
7687
|
+
/** Provider view name, when the style sets one. */
|
|
7688
|
+
view: string | null;
|
|
7689
|
+
/** Strip the generated background (sent for pixflux and non-PixelLab providers). */
|
|
7690
|
+
noBackground: boolean;
|
|
7619
7691
|
quality: boolean;
|
|
7620
7692
|
tags: string[];
|
|
7621
7693
|
/** Parent style id when this style `extends` one. */
|
|
@@ -7758,6 +7830,111 @@ interface RenderGalleryOptions {
|
|
|
7758
7830
|
}
|
|
7759
7831
|
declare function renderGallery(snapshot: GallerySnapshot, opts?: RenderGalleryOptions): string;
|
|
7760
7832
|
|
|
7833
|
+
/**
|
|
7834
|
+
* Generation from the gallery is the CLI's `gen`, run as a background job:
|
|
7835
|
+
* the same `buildPlan`, the same per-provider budget and balance preflight,
|
|
7836
|
+
* the same `submit → poll → fetch` library calls writing the same lockfile.
|
|
7837
|
+
* The page adds nothing the terminal cannot do; it only shows the estimate,
|
|
7838
|
+
* asks, and reports progress.
|
|
7839
|
+
*
|
|
7840
|
+
* Two ceilings guard spend. The session budget is passed when the gallery
|
|
7841
|
+
* starts (`--budget`, optionally keyed per provider) and every job's estimate
|
|
7842
|
+
* is charged against it up front, so the page can never exceed what the
|
|
7843
|
+
* person typed. Each submission also carries the remaining ceiling as its
|
|
7844
|
+
* own `budget`, the way `gen --budget` does, so a provider estimate that
|
|
7845
|
+
* grows between plan and submit is refused rather than paid.
|
|
7846
|
+
*/
|
|
7847
|
+
type GeneratePhase = "queued" | "submitting" | "polling" | "fetching" | "review" | "done" | "failed";
|
|
7848
|
+
interface GenerateJob {
|
|
7849
|
+
id: string;
|
|
7850
|
+
project: string | null;
|
|
7851
|
+
keys: string[];
|
|
7852
|
+
/** `resume` skips submission: poll, review, and fetch existing work at no cost. */
|
|
7853
|
+
mode: "generate" | "resume";
|
|
7854
|
+
phase: GeneratePhase;
|
|
7855
|
+
startedAt: string;
|
|
7856
|
+
finishedAt: string | null;
|
|
7857
|
+
/** Progress lines, exactly what the CLI would have printed. */
|
|
7858
|
+
messages: string[];
|
|
7859
|
+
error: string | null;
|
|
7860
|
+
/** Successful-submission estimates this job charged, by provider. */
|
|
7861
|
+
spent: Record<string, number>;
|
|
7862
|
+
/** Keys still waiting for a human choice. */
|
|
7863
|
+
review: string[];
|
|
7864
|
+
counts: {
|
|
7865
|
+
submitted: number;
|
|
7866
|
+
failed: number;
|
|
7867
|
+
downloaded: number;
|
|
7868
|
+
};
|
|
7869
|
+
}
|
|
7870
|
+
interface GalleryProjectContext {
|
|
7871
|
+
loaded: LoadedManifest;
|
|
7872
|
+
/** Every spec the project declares, unfiltered. */
|
|
7873
|
+
specs: ResolvedSpec[];
|
|
7874
|
+
lock: Lock;
|
|
7875
|
+
lockPath: string;
|
|
7876
|
+
}
|
|
7877
|
+
interface SessionBudget {
|
|
7878
|
+
/** Unkeyed ceiling, valid only when a run involves a single provider. */
|
|
7879
|
+
amount?: number;
|
|
7880
|
+
/** Provider-keyed ceilings. */
|
|
7881
|
+
byProvider: Record<string, number>;
|
|
7882
|
+
}
|
|
7883
|
+
interface GenerateHandlerOptions {
|
|
7884
|
+
/** Load a project fresh from disk; `project` is the workspace id, if any. */
|
|
7885
|
+
loadProject: (project?: string) => Promise<GalleryProjectContext>;
|
|
7886
|
+
/** An online provider for a project; the caller owns env loading and caching. */
|
|
7887
|
+
providerFor: (project: string | undefined, providerId: string) => Provider;
|
|
7888
|
+
budget: SessionBudget;
|
|
7889
|
+
reload: () => Promise<GalleryBuild>;
|
|
7890
|
+
onProgress?: (msg: string) => void;
|
|
7891
|
+
/** Test hooks. */
|
|
7892
|
+
pollIntervalMs?: number;
|
|
7893
|
+
submitSpacingMs?: number;
|
|
7894
|
+
/** Deterministic clock hook. */
|
|
7895
|
+
now?: () => Date;
|
|
7896
|
+
}
|
|
7897
|
+
interface GenerateStatus {
|
|
7898
|
+
jobs: GenerateJob[];
|
|
7899
|
+
budget: SessionBudget;
|
|
7900
|
+
/** Estimates charged so far this session, by provider. */
|
|
7901
|
+
spent: Record<string, number>;
|
|
7902
|
+
/** Providers whose spend unit is known, for display. */
|
|
7903
|
+
units: Record<string, CostUnit>;
|
|
7904
|
+
}
|
|
7905
|
+
interface GalleryGenerateHandlers {
|
|
7906
|
+
start(body: unknown): Promise<GenerateJob>;
|
|
7907
|
+
status(): GenerateStatus;
|
|
7908
|
+
/** The embedded review sheet for a job's waiting keys; null when nothing waits. */
|
|
7909
|
+
review(jobId: string, options: RenderSheetOptions & {
|
|
7910
|
+
routePrefix: string;
|
|
7911
|
+
}): Promise<ReviewSession | null>;
|
|
7912
|
+
applyReview(jobId: string, body: unknown): Promise<PickResult>;
|
|
7913
|
+
}
|
|
7914
|
+
declare const GenerateRequestSchema: z.ZodObject<{
|
|
7915
|
+
project: z.ZodOptional<z.ZodString>;
|
|
7916
|
+
keys: z.ZodArray<z.ZodString, "many">;
|
|
7917
|
+
/** Regenerate work that is up to date, as `gen --force` does. */
|
|
7918
|
+
force: z.ZodOptional<z.ZodBoolean>;
|
|
7919
|
+
/** Advance in-flight, review, or selected work without submitting anything. */
|
|
7920
|
+
resume: z.ZodOptional<z.ZodBoolean>;
|
|
7921
|
+
}, "strict", z.ZodTypeAny, {
|
|
7922
|
+
keys: string[];
|
|
7923
|
+
resume?: boolean | undefined;
|
|
7924
|
+
force?: boolean | undefined;
|
|
7925
|
+
project?: string | undefined;
|
|
7926
|
+
}, {
|
|
7927
|
+
keys: string[];
|
|
7928
|
+
resume?: boolean | undefined;
|
|
7929
|
+
force?: boolean | undefined;
|
|
7930
|
+
project?: string | undefined;
|
|
7931
|
+
}>;
|
|
7932
|
+
declare class GenerateRequestError extends Error {
|
|
7933
|
+
readonly status: number;
|
|
7934
|
+
constructor(message: string, status?: number);
|
|
7935
|
+
}
|
|
7936
|
+
declare function createGenerateHandlers(opts: GenerateHandlerOptions): GalleryGenerateHandlers;
|
|
7937
|
+
|
|
7761
7938
|
declare const ManifestEditSchema: z.ZodDiscriminatedUnion<"action", [z.ZodObject<{
|
|
7762
7939
|
action: z.ZodLiteral<"patch-asset">;
|
|
7763
7940
|
/** Workspace project id; omitted for a single-project gallery. */
|
|
@@ -7899,6 +8076,46 @@ declare const ManifestEditSchema: z.ZodDiscriminatedUnion<"action", [z.ZodObject
|
|
|
7899
8076
|
expectedSha256: string;
|
|
7900
8077
|
action: "add-asset";
|
|
7901
8078
|
project?: string | undefined;
|
|
8079
|
+
}>, z.ZodObject<{
|
|
8080
|
+
action: z.ZodLiteral<"set-source">;
|
|
8081
|
+
project: z.ZodOptional<z.ZodString>;
|
|
8082
|
+
assetId: z.ZodString;
|
|
8083
|
+
styleId: z.ZodString;
|
|
8084
|
+
/** Manifest-relative path of the art that stands in for this asset in this style. */
|
|
8085
|
+
source: z.ZodString;
|
|
8086
|
+
expectedSha256: z.ZodString;
|
|
8087
|
+
}, "strict", z.ZodTypeAny, {
|
|
8088
|
+
source: string;
|
|
8089
|
+
styleId: string;
|
|
8090
|
+
assetId: string;
|
|
8091
|
+
expectedSha256: string;
|
|
8092
|
+
action: "set-source";
|
|
8093
|
+
project?: string | undefined;
|
|
8094
|
+
}, {
|
|
8095
|
+
source: string;
|
|
8096
|
+
styleId: string;
|
|
8097
|
+
assetId: string;
|
|
8098
|
+
expectedSha256: string;
|
|
8099
|
+
action: "set-source";
|
|
8100
|
+
project?: string | undefined;
|
|
8101
|
+
}>, z.ZodObject<{
|
|
8102
|
+
action: z.ZodLiteral<"clear-source">;
|
|
8103
|
+
project: z.ZodOptional<z.ZodString>;
|
|
8104
|
+
assetId: z.ZodString;
|
|
8105
|
+
styleId: z.ZodString;
|
|
8106
|
+
expectedSha256: z.ZodString;
|
|
8107
|
+
}, "strict", z.ZodTypeAny, {
|
|
8108
|
+
styleId: string;
|
|
8109
|
+
assetId: string;
|
|
8110
|
+
expectedSha256: string;
|
|
8111
|
+
action: "clear-source";
|
|
8112
|
+
project?: string | undefined;
|
|
8113
|
+
}, {
|
|
8114
|
+
styleId: string;
|
|
8115
|
+
assetId: string;
|
|
8116
|
+
expectedSha256: string;
|
|
8117
|
+
action: "clear-source";
|
|
8118
|
+
project?: string | undefined;
|
|
7902
8119
|
}>, z.ZodObject<{
|
|
7903
8120
|
action: z.ZodLiteral<"patch-style">;
|
|
7904
8121
|
project: z.ZodOptional<z.ZodString>;
|
|
@@ -7912,34 +8129,48 @@ declare const ManifestEditSchema: z.ZodDiscriminatedUnion<"action", [z.ZodObject
|
|
|
7912
8129
|
promptSuffix: z.ZodOptional<z.ZodString>;
|
|
7913
8130
|
/** `#rrggbb` values; null or empty clears the style's own palette. */
|
|
7914
8131
|
palette: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString, "many">>>;
|
|
8132
|
+
/** Provider view name (PixelLab: low top-down, high top-down, side); empty clears. */
|
|
8133
|
+
view: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
8134
|
+
/** pixflux only; null clears the style's own value. */
|
|
8135
|
+
noBackground: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
7915
8136
|
}, "strict", z.ZodTypeAny, {
|
|
7916
8137
|
candidates?: number | undefined;
|
|
7917
8138
|
palette?: string[] | null | undefined;
|
|
8139
|
+
view?: string | null | undefined;
|
|
7918
8140
|
promptSuffix?: string | undefined;
|
|
7919
8141
|
promptPrefix?: string | undefined;
|
|
8142
|
+
noBackground?: boolean | null | undefined;
|
|
7920
8143
|
}, {
|
|
7921
8144
|
candidates?: number | undefined;
|
|
7922
8145
|
palette?: string[] | null | undefined;
|
|
8146
|
+
view?: string | null | undefined;
|
|
7923
8147
|
promptSuffix?: string | undefined;
|
|
7924
8148
|
promptPrefix?: string | undefined;
|
|
8149
|
+
noBackground?: boolean | null | undefined;
|
|
7925
8150
|
}>, {
|
|
7926
8151
|
candidates?: number | undefined;
|
|
7927
8152
|
palette?: string[] | null | undefined;
|
|
8153
|
+
view?: string | null | undefined;
|
|
7928
8154
|
promptSuffix?: string | undefined;
|
|
7929
8155
|
promptPrefix?: string | undefined;
|
|
8156
|
+
noBackground?: boolean | null | undefined;
|
|
7930
8157
|
}, {
|
|
7931
8158
|
candidates?: number | undefined;
|
|
7932
8159
|
palette?: string[] | null | undefined;
|
|
8160
|
+
view?: string | null | undefined;
|
|
7933
8161
|
promptSuffix?: string | undefined;
|
|
7934
8162
|
promptPrefix?: string | undefined;
|
|
8163
|
+
noBackground?: boolean | null | undefined;
|
|
7935
8164
|
}>;
|
|
7936
8165
|
}, "strict", z.ZodTypeAny, {
|
|
7937
8166
|
styleId: string;
|
|
7938
8167
|
patch: {
|
|
7939
8168
|
candidates?: number | undefined;
|
|
7940
8169
|
palette?: string[] | null | undefined;
|
|
8170
|
+
view?: string | null | undefined;
|
|
7941
8171
|
promptSuffix?: string | undefined;
|
|
7942
8172
|
promptPrefix?: string | undefined;
|
|
8173
|
+
noBackground?: boolean | null | undefined;
|
|
7943
8174
|
};
|
|
7944
8175
|
expectedSha256: string;
|
|
7945
8176
|
action: "patch-style";
|
|
@@ -7949,8 +8180,10 @@ declare const ManifestEditSchema: z.ZodDiscriminatedUnion<"action", [z.ZodObject
|
|
|
7949
8180
|
patch: {
|
|
7950
8181
|
candidates?: number | undefined;
|
|
7951
8182
|
palette?: string[] | null | undefined;
|
|
8183
|
+
view?: string | null | undefined;
|
|
7952
8184
|
promptSuffix?: string | undefined;
|
|
7953
8185
|
promptPrefix?: string | undefined;
|
|
8186
|
+
noBackground?: boolean | null | undefined;
|
|
7954
8187
|
};
|
|
7955
8188
|
expectedSha256: string;
|
|
7956
8189
|
action: "patch-style";
|
|
@@ -7979,121 +8212,21 @@ interface ManifestEditResult {
|
|
|
7979
8212
|
* manifest fails to load or resolve — an invalid manifest never lands.
|
|
7980
8213
|
*/
|
|
7981
8214
|
declare function applyManifestEdit(manifestPath: string, edit: ManifestEdit): Promise<ManifestEditResult>;
|
|
8215
|
+
|
|
7982
8216
|
interface GalleryEditHandlerOptions {
|
|
7983
8217
|
/** Resolves the manifest an edit may rewrite; must never trust a client path. */
|
|
7984
8218
|
manifestFor: (project?: string) => string | Promise<string>;
|
|
7985
8219
|
/** Rebuilds the gallery after a successful write. */
|
|
7986
8220
|
reload: () => Promise<GalleryBuild>;
|
|
8221
|
+
/** Loads a project for hand-edit actions, which need resolved specs and the lock. */
|
|
8222
|
+
loadProject?: (project?: string) => Promise<GalleryProjectContext>;
|
|
8223
|
+
/** Launches the author's editor; defaults to `openInEditor`. */
|
|
8224
|
+
openEditor?: (file: string) => string;
|
|
7987
8225
|
onProgress?: (msg: string) => void;
|
|
7988
8226
|
}
|
|
7989
8227
|
/** The `edit` callback `serveGallery` expects: validate, apply, rebuild. */
|
|
7990
8228
|
declare function createGalleryEditHandler(opts: GalleryEditHandlerOptions): (body: unknown) => Promise<GalleryBuild>;
|
|
7991
8229
|
|
|
7992
|
-
/**
|
|
7993
|
-
* Generation from the gallery is the CLI's `gen`, run as a background job:
|
|
7994
|
-
* the same `buildPlan`, the same per-provider budget and balance preflight,
|
|
7995
|
-
* the same `submit → poll → fetch` library calls writing the same lockfile.
|
|
7996
|
-
* The page adds nothing the terminal cannot do; it only shows the estimate,
|
|
7997
|
-
* asks, and reports progress.
|
|
7998
|
-
*
|
|
7999
|
-
* Two ceilings guard spend. The session budget is passed when the gallery
|
|
8000
|
-
* starts (`--budget`, optionally keyed per provider) and every job's estimate
|
|
8001
|
-
* is charged against it up front, so the page can never exceed what the
|
|
8002
|
-
* person typed. Each submission also carries the remaining ceiling as its
|
|
8003
|
-
* own `budget`, the way `gen --budget` does, so a provider estimate that
|
|
8004
|
-
* grows between plan and submit is refused rather than paid.
|
|
8005
|
-
*/
|
|
8006
|
-
type GeneratePhase = "queued" | "submitting" | "polling" | "fetching" | "review" | "done" | "failed";
|
|
8007
|
-
interface GenerateJob {
|
|
8008
|
-
id: string;
|
|
8009
|
-
project: string | null;
|
|
8010
|
-
keys: string[];
|
|
8011
|
-
/** `resume` skips submission: poll, review, and fetch existing work at no cost. */
|
|
8012
|
-
mode: "generate" | "resume";
|
|
8013
|
-
phase: GeneratePhase;
|
|
8014
|
-
startedAt: string;
|
|
8015
|
-
finishedAt: string | null;
|
|
8016
|
-
/** Progress lines, exactly what the CLI would have printed. */
|
|
8017
|
-
messages: string[];
|
|
8018
|
-
error: string | null;
|
|
8019
|
-
/** Successful-submission estimates this job charged, by provider. */
|
|
8020
|
-
spent: Record<string, number>;
|
|
8021
|
-
/** Keys still waiting for a human choice. */
|
|
8022
|
-
review: string[];
|
|
8023
|
-
counts: {
|
|
8024
|
-
submitted: number;
|
|
8025
|
-
failed: number;
|
|
8026
|
-
downloaded: number;
|
|
8027
|
-
};
|
|
8028
|
-
}
|
|
8029
|
-
interface GalleryProjectContext {
|
|
8030
|
-
loaded: LoadedManifest;
|
|
8031
|
-
/** Every spec the project declares, unfiltered. */
|
|
8032
|
-
specs: ResolvedSpec[];
|
|
8033
|
-
lock: Lock;
|
|
8034
|
-
lockPath: string;
|
|
8035
|
-
}
|
|
8036
|
-
interface SessionBudget {
|
|
8037
|
-
/** Unkeyed ceiling, valid only when a run involves a single provider. */
|
|
8038
|
-
amount?: number;
|
|
8039
|
-
/** Provider-keyed ceilings. */
|
|
8040
|
-
byProvider: Record<string, number>;
|
|
8041
|
-
}
|
|
8042
|
-
interface GenerateHandlerOptions {
|
|
8043
|
-
/** Load a project fresh from disk; `project` is the workspace id, if any. */
|
|
8044
|
-
loadProject: (project?: string) => Promise<GalleryProjectContext>;
|
|
8045
|
-
/** An online provider for a project; the caller owns env loading and caching. */
|
|
8046
|
-
providerFor: (project: string | undefined, providerId: string) => Provider;
|
|
8047
|
-
budget: SessionBudget;
|
|
8048
|
-
reload: () => Promise<GalleryBuild>;
|
|
8049
|
-
onProgress?: (msg: string) => void;
|
|
8050
|
-
/** Test hooks. */
|
|
8051
|
-
pollIntervalMs?: number;
|
|
8052
|
-
submitSpacingMs?: number;
|
|
8053
|
-
/** Deterministic clock hook. */
|
|
8054
|
-
now?: () => Date;
|
|
8055
|
-
}
|
|
8056
|
-
interface GenerateStatus {
|
|
8057
|
-
jobs: GenerateJob[];
|
|
8058
|
-
budget: SessionBudget;
|
|
8059
|
-
/** Estimates charged so far this session, by provider. */
|
|
8060
|
-
spent: Record<string, number>;
|
|
8061
|
-
/** Providers whose spend unit is known, for display. */
|
|
8062
|
-
units: Record<string, CostUnit>;
|
|
8063
|
-
}
|
|
8064
|
-
interface GalleryGenerateHandlers {
|
|
8065
|
-
start(body: unknown): Promise<GenerateJob>;
|
|
8066
|
-
status(): GenerateStatus;
|
|
8067
|
-
/** The embedded review sheet for a job's waiting keys; null when nothing waits. */
|
|
8068
|
-
review(jobId: string, options: RenderSheetOptions & {
|
|
8069
|
-
routePrefix: string;
|
|
8070
|
-
}): Promise<ReviewSession | null>;
|
|
8071
|
-
applyReview(jobId: string, body: unknown): Promise<PickResult>;
|
|
8072
|
-
}
|
|
8073
|
-
declare const GenerateRequestSchema: z.ZodObject<{
|
|
8074
|
-
project: z.ZodOptional<z.ZodString>;
|
|
8075
|
-
keys: z.ZodArray<z.ZodString, "many">;
|
|
8076
|
-
/** Regenerate work that is up to date, as `gen --force` does. */
|
|
8077
|
-
force: z.ZodOptional<z.ZodBoolean>;
|
|
8078
|
-
/** Advance in-flight, review, or selected work without submitting anything. */
|
|
8079
|
-
resume: z.ZodOptional<z.ZodBoolean>;
|
|
8080
|
-
}, "strict", z.ZodTypeAny, {
|
|
8081
|
-
keys: string[];
|
|
8082
|
-
resume?: boolean | undefined;
|
|
8083
|
-
force?: boolean | undefined;
|
|
8084
|
-
project?: string | undefined;
|
|
8085
|
-
}, {
|
|
8086
|
-
keys: string[];
|
|
8087
|
-
resume?: boolean | undefined;
|
|
8088
|
-
force?: boolean | undefined;
|
|
8089
|
-
project?: string | undefined;
|
|
8090
|
-
}>;
|
|
8091
|
-
declare class GenerateRequestError extends Error {
|
|
8092
|
-
readonly status: number;
|
|
8093
|
-
constructor(message: string, status?: number);
|
|
8094
|
-
}
|
|
8095
|
-
declare function createGenerateHandlers(opts: GenerateHandlerOptions): GalleryGenerateHandlers;
|
|
8096
|
-
|
|
8097
8230
|
/**
|
|
8098
8231
|
* The gallery's HTTP surface. Unlike the review server this is long-lived:
|
|
8099
8232
|
* three GET routes, bound to loopback, running until the caller closes it
|