pixelkiln 0.28.0 → 0.30.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/index.d.ts CHANGED
@@ -4782,6 +4782,26 @@ declare function portableOutputPath(file: string, manifestDir: string): string;
4782
4782
  declare function resolveOutputPath(recordedPath: string, manifestDir: string): string;
4783
4783
  /** Deterministic current destination for one provider output. */
4784
4784
  declare function expectedOutputPath(spec: ResolvedSpec, role: string | undefined, index: number, total: number, mediaType?: MediaType): string;
4785
+ /**
4786
+ * One member of a set beside a stem file: `<stem>-<role><ext>`, or the stem
4787
+ * itself for a single output. Generated outputs and a `source` for a frame
4788
+ * set follow the same rule, so an edit's members sit where its generation's do.
4789
+ */
4790
+ declare function memberPath(file: string, role: string | undefined, index: number, total: number, mediaType?: MediaType): string;
4791
+ /** Several PNG outputs — a frame set, a tile set — that a hand edit covers one file per member. */
4792
+ declare function isMemberSetEntry(entry: Pick<LockEntry, "outputs">): boolean;
4793
+ /** An ordered animation: the members are frames, played at the recorded fps. */
4794
+ declare function isFrameSetEntry(entry: Pick<LockEntry, "generator" | "outputs">): boolean;
4795
+ /**
4796
+ * Whether a declared `source` for this entry names a stem with one file per
4797
+ * member (`<stem>-<role>.png`, the rule generated outputs follow) rather than
4798
+ * one file. A hand edit of a set is always the former; a file that exists at
4799
+ * the source path itself is one committed image placed for the whole set, as
4800
+ * it always was.
4801
+ */
4802
+ declare function sourceIsStem(source: string, entry: Pick<LockEntry, "outputs">, manifestDir: string): boolean;
4803
+ /** Where a declared `source` places one output of an entry. */
4804
+ declare function sourceOutputPath(source: string, entry: Pick<LockEntry, "outputs">, index: number, manifestDir: string): string;
4785
4805
  /** Resolve one recorded output from the current manifest-owned destination. */
4786
4806
  declare function currentOutputPath(output: Pick<LockOutput, "path" | "role" | "mediaType">, spec: ResolvedSpec, index: number, total: number): string;
4787
4807
  /** Resolve an entry member using the complete source-set order when available. */
@@ -7036,7 +7056,9 @@ declare function packStyle(lock: Lock, styleId: string, manifestDir: string, opt
7036
7056
  * Manifest `source` art keyed by asset id, manifest-relative. A hand edit
7037
7057
  * or other post-processed file stands in for that asset's single output,
7038
7058
  * and an asset with a source but no lock entry is packed from it — the
7039
- * same rule `mount` applies. Structural sets keep their lock outputs.
7059
+ * same rule `mount` applies. A set's hand edit is a stem: each member is
7060
+ * packed from `<stem>-<role>.png`. A set whose source is one existing
7061
+ * file keeps its lock outputs, as before.
7040
7062
  */
7041
7063
  sources?: Record<string, string>;
7042
7064
  }): PackedSheet;
@@ -7564,7 +7586,7 @@ interface GalleryOutput {
7564
7586
  url: string | null;
7565
7587
  }
7566
7588
  type HandEditStatus =
7567
- /** The edit file is byte-identical to the generated art. */
7589
+ /** The edit file has the generated art's pixels — nothing has been changed yet. */
7568
7590
  "same"
7569
7591
  /** The author changed it. */
7570
7592
  | "edited"
@@ -7673,6 +7695,18 @@ interface GalleryItem {
7673
7695
  * generated file, which stays on disk as the record.
7674
7696
  */
7675
7697
  edit: GalleryOutput | null;
7698
+ /**
7699
+ * Every file of the edit, one per output in the same order — the edit
7700
+ * itself for a single image, `<stem>-<role>.png` per member of a set.
7701
+ * Empty without a source.
7702
+ */
7703
+ edits: GalleryOutput[];
7704
+ /**
7705
+ * Per member of `edits`: true where its pixels differ from the generated
7706
+ * file. Compared by pixels, not bytes, because every editor re-encodes a
7707
+ * PNG it merely opened and saved.
7708
+ */
7709
+ editChanged: boolean[];
7676
7710
  editStatus: HandEditStatus | null;
7677
7711
  /** What an in-browser save recorded beside the edit; null for edits made elsewhere. */
7678
7712
  editMeta: GalleryEditMeta | null;
@@ -7799,9 +7833,9 @@ declare function galleryMediaRoute(id: string): string;
7799
7833
  interface GalleryEditMeta {
7800
7834
  editor: string;
7801
7835
  savedAt: string;
7802
- /** sha256 of the generation the edit was based on, or null for untracked art. */
7836
+ /** sha256 of the generation the edit was based on (its first member for a set), or null for untracked art. */
7803
7837
  basedOn: string | null;
7804
- /** The edit file changed since the editor saved it (another tool touched it). */
7838
+ /** An edit file changed since the editor saved it (another tool touched it). */
7805
7839
  changedSince: boolean;
7806
7840
  /** Manifest-relative path of the layered project file kept beside the edit, if present. */
7807
7841
  project: string | null;
@@ -7859,6 +7893,406 @@ interface RenderGalleryOptions {
7859
7893
  }
7860
7894
  declare function renderGallery(snapshot: GallerySnapshot, opts?: RenderGalleryOptions): string;
7861
7895
 
7896
+ /**
7897
+ * Hand edits never touch the generated file. The generated PNG is the
7898
+ * provenance record — its hash is in the lockfile, `plan` verifies it, and a
7899
+ * regeneration replaces it — so an author's touch-up lives in a sibling file
7900
+ * that the manifest points at with `source` (or `sourceByStyle`). `mount` and
7901
+ * `pack` place that file, quality profiles read it, and revisions start from
7902
+ * it, while `plan` keeps reporting the generation itself as `ok`.
7903
+ *
7904
+ * A set — an ordered frame set, a tile set, any entry with several PNG
7905
+ * outputs — is edited the same way, one file per member: the manifest's
7906
+ * `source` names the stem, and each member is `<stem>-<role>.png` beside it,
7907
+ * the rule its generated outputs already follow.
7908
+ *
7909
+ * The author edits with whatever they already use: `PIXELKILN_EDITOR` names
7910
+ * the program, otherwise the file opens with the OS default.
7911
+ */
7912
+ declare const HAND_EDIT_DIR = "edits";
7913
+ /** One file of a hand edit: the whole edit for a single image, one frame of a set. */
7914
+ interface HandEditMember {
7915
+ /** Output role for a set member; null for a single image. */
7916
+ role: string | null;
7917
+ /** Absolute path of the file the author edits. */
7918
+ path: string;
7919
+ /** The generated file it starts from, when on disk. */
7920
+ base: string | null;
7921
+ }
7922
+ interface HandEditStart {
7923
+ /** Absolute path of the file the author edits; the stem for a frame set. */
7924
+ editPath: string;
7925
+ /** Every file of the edit, in output order. One entry for a single image. */
7926
+ members: HandEditMember[];
7927
+ /** Manifest-relative form recorded in the manifest. */
7928
+ source: string;
7929
+ /** True when any file was created now as a copy of the generated art. */
7930
+ created: boolean;
7931
+ /** True when the manifest was rewritten to point at it. */
7932
+ declared: boolean;
7933
+ /** Manifest hash after the write, for a page that quotes it on the next edit. */
7934
+ manifestSha256: string;
7935
+ }
7936
+ /** Where a hand edit of this spec lives: an `edits/` mirror under the style's outDir. */
7937
+ declare function handEditPath(loaded: LoadedManifest, spec: ResolvedSpec): string;
7938
+ /**
7939
+ * The generated (or untracked) art a fresh edit starts from, per member.
7940
+ * Null when the asset is not something a hand edit covers: a GIF, a set with
7941
+ * a GIF in it, or nothing on disk to copy.
7942
+ */
7943
+ declare function handEditBases(spec: ResolvedSpec, lock: Lock): Array<{
7944
+ role: string | null;
7945
+ path: string;
7946
+ }> | null;
7947
+ /** The generated (or untracked) art a fresh single-image edit starts from, if it is on disk. */
7948
+ declare function handEditBase(spec: ResolvedSpec, lock: Lock): string | null;
7949
+ /** The files a declared `source` stands for, in output order; the source itself for a single image. */
7950
+ declare function handEditMembers(loaded: LoadedManifest, spec: ResolvedSpec, lock: Lock, editPath: string): HandEditMember[];
7951
+ /**
7952
+ * Make (or reuse) the edit file for one asset in one style and declare it in
7953
+ * the manifest. Idempotent: a second call finds the same file and changes
7954
+ * nothing, so "open my edit again" and "start editing" are one action. A
7955
+ * set gets one file per member; a member already there is kept.
7956
+ */
7957
+ declare function startHandEdit(loaded: LoadedManifest, lock: Lock, spec: ResolvedSpec, opts?: {
7958
+ expectedSha256?: string;
7959
+ }): Promise<HandEditStart>;
7960
+ /** Stop placing the edit. The file stays where it is; only the manifest changes. */
7961
+ declare function detachHandEdit(loaded: LoadedManifest, spec: ResolvedSpec, opts?: {
7962
+ expectedSha256?: string;
7963
+ }): Promise<{
7964
+ manifestSha256: string;
7965
+ changed: boolean;
7966
+ }>;
7967
+ declare const CompanionV2Schema: z.ZodObject<{
7968
+ version: z.ZodLiteral<2>;
7969
+ /** Editor identity the bridge reported, e.g. `pixelorama@v1.2.2-stable`. */
7970
+ editor: z.ZodString;
7971
+ protocol: z.ZodNumber;
7972
+ savedAt: z.ZodString;
7973
+ /** Basename of the layered project file beside the edit, when one was kept. */
7974
+ project: z.ZodNullable<z.ZodString>;
7975
+ /** One entry per file, in output order. */
7976
+ outputs: z.ZodArray<z.ZodObject<{
7977
+ /** Output role for a set member; null for a single image. */
7978
+ role: z.ZodNullable<z.ZodString>;
7979
+ /** sha256 of the generated file this member started from; null when it started from untracked art. */
7980
+ basedOn: z.ZodNullable<z.ZodString>;
7981
+ /** sha256 of the member as saved, so a later change by another tool is visible. */
7982
+ sha256: z.ZodString;
7983
+ }, "strict", z.ZodTypeAny, {
7984
+ sha256: string;
7985
+ role: string | null;
7986
+ basedOn: string | null;
7987
+ }, {
7988
+ sha256: string;
7989
+ role: string | null;
7990
+ basedOn: string | null;
7991
+ }>, "many">;
7992
+ }, "strict", z.ZodTypeAny, {
7993
+ outputs: {
7994
+ sha256: string;
7995
+ role: string | null;
7996
+ basedOn: string | null;
7997
+ }[];
7998
+ version: 2;
7999
+ protocol: number;
8000
+ project: string | null;
8001
+ editor: string;
8002
+ savedAt: string;
8003
+ }, {
8004
+ outputs: {
8005
+ sha256: string;
8006
+ role: string | null;
8007
+ basedOn: string | null;
8008
+ }[];
8009
+ version: 2;
8010
+ protocol: number;
8011
+ project: string | null;
8012
+ editor: string;
8013
+ savedAt: string;
8014
+ }>;
8015
+ declare const HandEditCompanionSchema: z.ZodEffects<z.ZodUnion<[z.ZodObject<{
8016
+ version: z.ZodLiteral<2>;
8017
+ /** Editor identity the bridge reported, e.g. `pixelorama@v1.2.2-stable`. */
8018
+ editor: z.ZodString;
8019
+ protocol: z.ZodNumber;
8020
+ savedAt: z.ZodString;
8021
+ /** Basename of the layered project file beside the edit, when one was kept. */
8022
+ project: z.ZodNullable<z.ZodString>;
8023
+ /** One entry per file, in output order. */
8024
+ outputs: z.ZodArray<z.ZodObject<{
8025
+ /** Output role for a set member; null for a single image. */
8026
+ role: z.ZodNullable<z.ZodString>;
8027
+ /** sha256 of the generated file this member started from; null when it started from untracked art. */
8028
+ basedOn: z.ZodNullable<z.ZodString>;
8029
+ /** sha256 of the member as saved, so a later change by another tool is visible. */
8030
+ sha256: z.ZodString;
8031
+ }, "strict", z.ZodTypeAny, {
8032
+ sha256: string;
8033
+ role: string | null;
8034
+ basedOn: string | null;
8035
+ }, {
8036
+ sha256: string;
8037
+ role: string | null;
8038
+ basedOn: string | null;
8039
+ }>, "many">;
8040
+ }, "strict", z.ZodTypeAny, {
8041
+ outputs: {
8042
+ sha256: string;
8043
+ role: string | null;
8044
+ basedOn: string | null;
8045
+ }[];
8046
+ version: 2;
8047
+ protocol: number;
8048
+ project: string | null;
8049
+ editor: string;
8050
+ savedAt: string;
8051
+ }, {
8052
+ outputs: {
8053
+ sha256: string;
8054
+ role: string | null;
8055
+ basedOn: string | null;
8056
+ }[];
8057
+ version: 2;
8058
+ protocol: number;
8059
+ project: string | null;
8060
+ editor: string;
8061
+ savedAt: string;
8062
+ }>, z.ZodObject<{
8063
+ version: z.ZodLiteral<1>;
8064
+ basedOn: z.ZodNullable<z.ZodString>;
8065
+ sha256: z.ZodString;
8066
+ editor: z.ZodString;
8067
+ protocol: z.ZodNumber;
8068
+ savedAt: z.ZodString;
8069
+ project: z.ZodNullable<z.ZodString>;
8070
+ }, "strict", z.ZodTypeAny, {
8071
+ sha256: string;
8072
+ version: 1;
8073
+ protocol: number;
8074
+ project: string | null;
8075
+ basedOn: string | null;
8076
+ editor: string;
8077
+ savedAt: string;
8078
+ }, {
8079
+ sha256: string;
8080
+ version: 1;
8081
+ protocol: number;
8082
+ project: string | null;
8083
+ basedOn: string | null;
8084
+ editor: string;
8085
+ savedAt: string;
8086
+ }>]>, {
8087
+ outputs: {
8088
+ sha256: string;
8089
+ role: string | null;
8090
+ basedOn: string | null;
8091
+ }[];
8092
+ version: 2;
8093
+ protocol: number;
8094
+ project: string | null;
8095
+ editor: string;
8096
+ savedAt: string;
8097
+ }, {
8098
+ outputs: {
8099
+ sha256: string;
8100
+ role: string | null;
8101
+ basedOn: string | null;
8102
+ }[];
8103
+ version: 2;
8104
+ protocol: number;
8105
+ project: string | null;
8106
+ editor: string;
8107
+ savedAt: string;
8108
+ } | {
8109
+ sha256: string;
8110
+ version: 1;
8111
+ protocol: number;
8112
+ project: string | null;
8113
+ basedOn: string | null;
8114
+ editor: string;
8115
+ savedAt: string;
8116
+ }>;
8117
+ type HandEditCompanion = z.infer<typeof CompanionV2Schema>;
8118
+ declare function handEditCompanionPath(editPath: string): string;
8119
+ /** The layered project (Pixelorama `.pxo`) kept beside the edit for re-editing. */
8120
+ declare function handEditProjectPath(editPath: string): string;
8121
+ declare function readHandEditCompanion(editPath: string): Promise<HandEditCompanion | null>;
8122
+ /** Edits bigger than this are refused before decoding; a sprite sheet is far smaller. */
8123
+ declare const MAX_HAND_EDIT_BYTES: number;
8124
+ interface HandEditSaveInput {
8125
+ /** The flattened image, as PNG bytes. For a frame set, use `frames`. */
8126
+ png?: Buffer;
8127
+ /** Every frame of a set, tagged with the role it was opened under (null for one added in the editor). */
8128
+ frames?: Array<{
8129
+ role: string | null;
8130
+ png: Buffer;
8131
+ }>;
8132
+ /** The editor's own layered project file, kept beside the edit when given. */
8133
+ project?: Buffer;
8134
+ editor: string;
8135
+ protocol: number;
8136
+ expectedSha256?: string;
8137
+ now?: Date;
8138
+ }
8139
+ interface HandEditSave extends HandEditStart {
8140
+ /** sha256 of the edit as saved; of the first member for a frame set. */
8141
+ sha256: string;
8142
+ /** Hash of the generation the edit started from; of the first member for a frame set. */
8143
+ basedOn: string | null;
8144
+ companion: HandEditCompanion;
8145
+ companionPath: string;
8146
+ projectPath: string | null;
8147
+ }
8148
+ /**
8149
+ * Save an edit made in the in-browser editor. Every PNG must be a valid
8150
+ * image at the asset's generated size, a set must come back with the same
8151
+ * members it was opened with, and the files replace the edit
8152
+ * atomically; the companion records what each was based on, and the
8153
+ * manifest declares the edit if it does not yet — the same path
8154
+ * `startHandEdit` takes, so the first save from the browser and
8155
+ * `pixelkiln edit` leave the same manifest.
8156
+ */
8157
+ declare function saveHandEdit(loaded: LoadedManifest, lock: Lock, spec: ResolvedSpec, input: HandEditSaveInput): Promise<HandEditSave>;
8158
+ /**
8159
+ * Open a file in the author's editor. `PIXELKILN_EDITOR` may be a program
8160
+ * name or a command with arguments (`aseprite`, `"open -a Aseprite"`); the
8161
+ * file path is appended. Without it the OS default handler is used.
8162
+ */
8163
+ declare function openInEditor(file: string, editor?: string | undefined): string;
8164
+
8165
+ /**
8166
+ * The one editor build a PixelKiln release trusts. The source of truth is
8167
+ * `tools/pixelorama-bridge/pin.json`, written when a build is published; the
8168
+ * bundler inlines it here so the shipped package carries the exact hashes.
8169
+ */
8170
+ interface EditorPin {
8171
+ /** Upstream Pixelorama tag the build was made from. */
8172
+ pixelorama: string;
8173
+ godot: string;
8174
+ extensionsApi: number;
8175
+ /** Bridge protocol version the page must speak. */
8176
+ protocol: number;
8177
+ /** GitHub release tag carrying the files, or null before the first publish. */
8178
+ release: string | null;
8179
+ files: Record<string, {
8180
+ sha256: string;
8181
+ bytes: number;
8182
+ }>;
8183
+ }
8184
+ declare const EDITOR_PIN: EditorPin;
8185
+ /** Where a published build's files are downloaded from, unless overridden. */
8186
+ declare const EDITOR_RELEASE_BASE = "https://github.com/gfargo/pixelkiln/releases/download";
8187
+
8188
+ /**
8189
+ * The in-gallery editor is a 46 MB web build that is not part of the npm
8190
+ * package. It is fetched once per pinned release into a user-level cache,
8191
+ * every file verified against the hash the package carries, and served from
8192
+ * there by the gallery. Nothing is executed at install; the browser runs the
8193
+ * wasm, and only from files whose hashes matched.
8194
+ *
8195
+ * A user-level cache rather than the project's `.pixelkiln/`: the pin is per
8196
+ * PixelKiln release, not per project, and one copy serves every project.
8197
+ * `PIXELKILN_TOOLS_DIR` moves it; `PIXELKILN_EDITOR_URL` points downloads at
8198
+ * a mirror or a local directory server for offline machines.
8199
+ */
8200
+ interface EditorInstallStatus {
8201
+ /** Release tag the package pins; null means no build has been published for this version. */
8202
+ release: string | null;
8203
+ dir: string;
8204
+ /** Every pinned file is present with the right hash. */
8205
+ installed: boolean;
8206
+ /** Files still to fetch (missing or hash mismatch). */
8207
+ missing: string[];
8208
+ totalBytes: number;
8209
+ installedBytes: number;
8210
+ }
8211
+ interface EditorInstallProgress {
8212
+ file: string;
8213
+ index: number;
8214
+ count: number;
8215
+ bytes: number;
8216
+ totalBytes: number;
8217
+ /** Bytes fetched so far across all files, including the part of this one. */
8218
+ fetchedBytes: number;
8219
+ /** `start` once per file, `progress` as its bytes arrive, `done` once it verified and landed. */
8220
+ phase: "start" | "progress" | "done";
8221
+ }
8222
+ interface EditorInstallOptions {
8223
+ pin?: EditorPin;
8224
+ dir?: string;
8225
+ /** Base URL (or `file://`-less local directory) the files are fetched from. */
8226
+ baseUrl?: string;
8227
+ fetch?: typeof fetch;
8228
+ onProgress?: (progress: EditorInstallProgress) => void;
8229
+ signal?: AbortSignal;
8230
+ }
8231
+ interface EditorInstallResult extends EditorInstallStatus {
8232
+ downloaded: string[];
8233
+ skipped: string[];
8234
+ }
8235
+ declare class EditorInstallError extends Error {
8236
+ readonly file?: string | undefined;
8237
+ constructor(message: string, file?: string | undefined);
8238
+ }
8239
+ /** Default cache root: XDG on Linux, ~/Library/Caches on macOS, LOCALAPPDATA on Windows. */
8240
+ declare function editorToolsRoot(): string;
8241
+ /** Where one pinned release lives; the tag is part of the path so upgrades never overwrite. */
8242
+ declare function editorDir(pin?: EditorPin, root?: string): string;
8243
+ /** Download base for a pinned release; `PIXELKILN_EDITOR_URL` overrides it. */
8244
+ declare function editorBaseUrl(pin?: EditorPin): string | null;
8245
+ /** What is on disk versus what the pin expects, without touching the network. */
8246
+ declare function editorStatus(opts?: {
8247
+ pin?: EditorPin;
8248
+ dir?: string;
8249
+ }): Promise<EditorInstallStatus>;
8250
+ /**
8251
+ * Fetch every pinned file that is missing or wrong, verifying each against
8252
+ * its hash before it lands. A file that fails verification is discarded and
8253
+ * the install fails; nothing partial is ever left under the final name.
8254
+ */
8255
+ declare function installEditor(opts?: EditorInstallOptions): Promise<EditorInstallResult>;
8256
+
8257
+ /**
8258
+ * The gallery's side of the in-browser editor: it reports whether the pinned
8259
+ * build is on disk, installs it on request, and serves its files.
8260
+ *
8261
+ * Serving is allowlisted twice. The release tag in the URL must be the one
8262
+ * this package pins, and the file name must be one the pin lists; nothing
8263
+ * else under the tools directory is reachable. A file is served only after
8264
+ * the whole build has verified against the pinned hashes, and its size is
8265
+ * checked again on every read, so a build that changed on disk after
8266
+ * verification is refused rather than served.
8267
+ */
8268
+ interface GalleryEditorStatus extends EditorInstallStatus {
8269
+ pixelorama: string;
8270
+ protocol: number;
8271
+ /** Where the page loads the editor from once installed; null until then. */
8272
+ url: string | null;
8273
+ /** The install in flight, if any. */
8274
+ installing: EditorInstallProgress | null;
8275
+ /** Why the last install failed, until the next attempt. */
8276
+ error: string | null;
8277
+ }
8278
+ interface GalleryEditorHandlers {
8279
+ release: string | null;
8280
+ status(): Promise<GalleryEditorStatus>;
8281
+ /** Start an install unless one is running; returns the status right after. */
8282
+ install(): Promise<GalleryEditorStatus>;
8283
+ /** A verified build file, or null when it is not pinned or not installed. */
8284
+ file(release: string, name: string): Promise<{
8285
+ bytes: Buffer;
8286
+ contentType: string;
8287
+ } | null>;
8288
+ }
8289
+ interface GalleryEditorOptions extends Pick<EditorInstallOptions, "dir" | "baseUrl" | "fetch"> {
8290
+ pin?: EditorPin;
8291
+ onProgress?: (msg: string) => void;
8292
+ }
8293
+ declare function editorRoute(release: string, name?: string): string;
8294
+ declare function createGalleryEditorHandlers(opts?: GalleryEditorOptions): GalleryEditorHandlers;
8295
+
7862
8296
  /**
7863
8297
  * Generation from the gallery is the CLI's `gen`, run as a background job:
7864
8298
  * the same `buildPlan`, the same per-provider budget and balance preflight,
@@ -8272,74 +8706,6 @@ interface GalleryEditHandlerOptions {
8272
8706
  /** The `edit` callback `serveGallery` expects: validate, apply, rebuild. */
8273
8707
  declare function createGalleryEditHandler(opts: GalleryEditHandlerOptions): (body: unknown) => Promise<GalleryBuild>;
8274
8708
 
8275
- /**
8276
- * The in-gallery editor is a 46 MB web build that is not part of the npm
8277
- * package. It is fetched once per pinned release into a user-level cache,
8278
- * every file verified against the hash the package carries, and served from
8279
- * there by the gallery. Nothing is executed at install; the browser runs the
8280
- * wasm, and only from files whose hashes matched.
8281
- *
8282
- * A user-level cache rather than the project's `.pixelkiln/`: the pin is per
8283
- * PixelKiln release, not per project, and one copy serves every project.
8284
- * `PIXELKILN_TOOLS_DIR` moves it; `PIXELKILN_EDITOR_URL` points downloads at
8285
- * a mirror or a local directory server for offline machines.
8286
- */
8287
- interface EditorInstallStatus {
8288
- /** Release tag the package pins; null means no build has been published for this version. */
8289
- release: string | null;
8290
- dir: string;
8291
- /** Every pinned file is present with the right hash. */
8292
- installed: boolean;
8293
- /** Files still to fetch (missing or hash mismatch). */
8294
- missing: string[];
8295
- totalBytes: number;
8296
- installedBytes: number;
8297
- }
8298
- interface EditorInstallProgress {
8299
- file: string;
8300
- index: number;
8301
- count: number;
8302
- bytes: number;
8303
- totalBytes: number;
8304
- /** Bytes fetched so far across all files, including the part of this one. */
8305
- fetchedBytes: number;
8306
- /** `start` once per file, `progress` as its bytes arrive, `done` once it verified and landed. */
8307
- phase: "start" | "progress" | "done";
8308
- }
8309
-
8310
- /**
8311
- * The gallery's side of the in-browser editor: it reports whether the pinned
8312
- * build is on disk, installs it on request, and serves its files.
8313
- *
8314
- * Serving is allowlisted twice. The release tag in the URL must be the one
8315
- * this package pins, and the file name must be one the pin lists; nothing
8316
- * else under the tools directory is reachable. A file is served only after
8317
- * the whole build has verified against the pinned hashes, and its size is
8318
- * checked again on every read, so a build that changed on disk after
8319
- * verification is refused rather than served.
8320
- */
8321
- interface GalleryEditorStatus extends EditorInstallStatus {
8322
- pixelorama: string;
8323
- protocol: number;
8324
- /** Where the page loads the editor from once installed; null until then. */
8325
- url: string | null;
8326
- /** The install in flight, if any. */
8327
- installing: EditorInstallProgress | null;
8328
- /** Why the last install failed, until the next attempt. */
8329
- error: string | null;
8330
- }
8331
- interface GalleryEditorHandlers {
8332
- release: string | null;
8333
- status(): Promise<GalleryEditorStatus>;
8334
- /** Start an install unless one is running; returns the status right after. */
8335
- install(): Promise<GalleryEditorStatus>;
8336
- /** A verified build file, or null when it is not pinned or not installed. */
8337
- file(release: string, name: string): Promise<{
8338
- bytes: Buffer;
8339
- contentType: string;
8340
- } | null>;
8341
- }
8342
-
8343
8709
  /**
8344
8710
  * The gallery's HTTP surface. Unlike the review server this is long-lived:
8345
8711
  * three GET routes, bound to loopback, running until the caller closes it
@@ -8647,4 +9013,4 @@ interface WorkspaceStatusReport {
8647
9013
  */
8648
9014
  declare function workspaceStatus(ws: Workspace, dir: string): Promise<WorkspaceStatusReport>;
8649
9015
 
8650
- export { type AdoptResult, type ApproveQualityOptions, type ApprovedQualityReview, 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 BuildGalleryOptions, type BuildWorkspaceGalleryOptions, type CacheHealthOptions, type CacheHealthReport, type CandidateSelection, type ComfyUIBinding, type ComfyUIBindings, type ComfyUIFramesOptions, type ComfyUIImageInput, type ComfyUIOptions, ComfyUIProvider, type ContentCacheHealth, type ContentCacheIssue, type CostEstimate, type CostUnit, DEFAULT_QUALITY_TOLERANCES, DEFAULT_RATE_LIMIT, type DoctorCheck, type DoctorLevel, type DoctorOptions, type DoctorReport, FAKE_PNG, type FakeOptions, FakeProvider, type FetchResult, type GalleryBuild, type GalleryEditHandlerOptions, type GalleryGenerateHandlers, type GalleryItem, type GalleryMedia, type GalleryOutput, type GalleryProject, type GalleryProjectContext, type GalleryQuality, type GalleryServer, type GalleryServerOptions, type GallerySnapshot, type GalleryState, type GalleryStyle, type GenerateHandlerOptions, type GenerateJob, type GeneratePhase, GenerateRequestError, GenerateRequestSchema, type GenerateStatus, type Generator, GeneratorSchema, type GenericTileset, type GridConfidence, GridConfidenceSchema, type ImageQualityMetrics, ImageQualityMetricsSchema, InheritedStyleSchema, type InstallRecipeOptions, type InstallRecipeResult, type JobState, type LoadedManifest, type LoadedRecipe, type Lock, type LockEntry, LockEntrySchema, type LockOutput, LockSchema, MAX_DOWNLOAD_BYTES, MAX_RETRIES, type ManagedArtifactBundleOptions, type Manifest, ManifestDriftError, type ManifestEdit, ManifestEditError, type ManifestEditResult, ManifestEditSchema, ManifestInputSchema, ManifestSchema, type MapObject, MediaType, type MountPlacement, type MountedSheet, type NormalizedTileRules, type Orphan, type OrphanGroups, type OutputSelection, type OutputSource, PIXEL_ART_FIXER_REVISION, PIXEL_ART_FIXER_URL, type PackedFrame, type PackedSheet, type PackedSource, type PendingQualityReview, type PickResult, type PixelArtFixerDetection, PixelLabClient, PixelLabError, type PixelLabObject, PixelLabProvider, type Plan, type PlanItem, type PlanState, type PollContext, type PollOptions, type PollResult, type PrepareReviewOptions, type Provider, type ProviderFactory, type ProviderInputContext, type ProviderInputScalar, type ProviderInputValue, type ProviderMetadata, type ProviderMode, type ProviderOptionContext, type ProviderSubmission, type QualityBaseline, QualityBaselineSchema, type QualityCheck, type QualityProfile, type QualityProfileInspection, QualityProfileSchema, type QualityProfileState, type QualityRegressionCaseResult, type QualityRegressionReport, type QualitySnapshotResult, QualityToleranceSchema, type QualityTolerances, type RateLimit, type Recipe, type RecipeFileVerification, type RecipeModelVerification, RecipeSchema, type RecipeVerification, type RefineAudit, type RefineFrameSetOptions, type RefineFrameSetResult, type RefineOptions, type RefineQualityProfilesOptions, type RefineQualityProfilesResult, type RefineRecordOptions, type RefineResult, type RemoteAsset, type RemoteHashCacheHealth, type RenderGalleryOptions, type RenderSheetOptions, type ResolvedOutput, type ResolvedProviderInputs, type ResolvedProviderOptions, type ResolvedQualityInput, type ResolvedQualityProfile, type ResolvedRevision, type ResolvedSpec, type ResolvedStyleImage, type ResumeAction, type ResumeCommand, type RetroDiffusionOptions, RetroDiffusionProvider, type ReviewReadyInfo, type ReviewSession, type Revision, type RevisionMode, RevisionModeSchema, type RevisionReadiness, RevisionSchema, type SalvageAction, type SalvageResult, type ScannedAsset, type ScenarioOptions, ScenarioProvider, type SessionBudget, type SheetGroup, type SiblingManifest, type SpriteInput, type Style, type StyleAudit, type StyleInput, StyleInputSchema, StyleSchema, type SubmissionCheckpoint, type SubmitContext, 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, applyManifestEdit, applyTags, approveQualityRecord, auditStyle, availableProviders, backoffMs, buildGallerySnapshot, buildManifest, buildPlan, buildWorkspaceGallerySnapshot, bundledRecipeRoot, cacheFileName, candidateCount, checkQualityBaseline, checkQualityRecord, clientFromEnv, colorDistance, countNumberedDescriptions, createArtifactBundleManifest, createGalleryEditHandler, createGenerateHandlers, createProvider, currentEntryOutputPath, currentOutputPath, detectMediaType, doctor, evaluateAudit, expectedOutputPath, exportTileset, fallbackOutputRole, fetchAssets, findOrphans, formatCost, galleryMediaId, galleryMediaRoute, generationCost, groupOrphansByStyle, hex, idFromPrompt, imageMetadata, inspectCaches, inspectQualityProfile, inspectRevisionReadiness, installRecipe, isSensitiveSourceUrl, listBundledRecipes, loadClaims, loadLock, loadManifest, loadSiblingManifests, loadWorkspace, lockKey, matchOrphanStyle, measureBalanceChange, measureDecodedImageQuality, measureImageQuality, mediaExtension, mediaTypeFromExtension, mergePalettes, mountSprites, mountStyle, normalizeLockOutputPaths, normalizeRefinementPalette, normalizeTileRules, outliers, outputId, packSprites, packStyle, paletteDistance, parseLock, parseWorkspace, pngSize, poll, portableOutputPath, prepareReview, primaryOutput, providerCredentialEnvs, providerFactory, pushTags, qualityFrameOutputPath, qualityRecordPath, quantizeToPalette, readArtifactBundleManifest, readQualityBaseline, recipeDigest, refineAsset, refineFrameSet, refineQualityProfiles, registerProvider, remove, renderGallery, renderSalvageSheet, renderSheet, requireApprovedQualitySources, requireBalance, requireDelete, requireList, requireRevisionReady, requireSelectCandidate, resolveEntryOutputs, resolveOutputPath, resolvePackInputs, resolveProject, resolveQualityInputs, resolveRecipe, resolveSpecEntryOutputs, resolveSpecOutputs, resolveSpecs, resolveStyleImages, resolveStyleOutputs, resumeActions, resumeCommandForStatus, retryAfterMs, runPicker, runSalvage, saveLock, saveWorkspace, scanAssets, selectEntryOutput, serveGallery, sha256, sha256File, shouldPersistSourceUrl, shouldRetry, slugify, snapshotQualityBaseline, specHash, spendByUnit, styleImagesBase64, submit, summarize, tagAdopted, tileFeatureOutputCount, tileVariationCount, tilesCost, toPortablePath, totalSpend, upsert, validateCostEstimate, validateMedia, validateWorkspace, verifyArtifactBundle, verifyRecipe, withArtifactManifest, workspaceClaims, workspaceStatus, writeArtifactBundle, writeManagedArtifactBundle };
9016
+ export { type AdoptResult, type ApproveQualityOptions, type ApprovedQualityReview, 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 BuildGalleryOptions, type BuildWorkspaceGalleryOptions, type CacheHealthOptions, type CacheHealthReport, type CandidateSelection, type ComfyUIBinding, type ComfyUIBindings, type ComfyUIFramesOptions, type ComfyUIImageInput, type ComfyUIOptions, ComfyUIProvider, type ContentCacheHealth, type ContentCacheIssue, type CostEstimate, type CostUnit, DEFAULT_QUALITY_TOLERANCES, DEFAULT_RATE_LIMIT, type DoctorCheck, type DoctorLevel, type DoctorOptions, type DoctorReport, EDITOR_PIN, EDITOR_RELEASE_BASE, EditorInstallError, type EditorInstallOptions, type EditorInstallProgress, type EditorInstallResult, type EditorInstallStatus, type EditorPin, FAKE_PNG, type FakeOptions, FakeProvider, type FetchResult, type GalleryBuild, type GalleryEditHandlerOptions, type GalleryEditMeta, type GalleryEditorHandlers, type GalleryEditorOptions, type GalleryEditorStatus, type GalleryGenerateHandlers, type GalleryItem, type GalleryMedia, type GalleryOutput, type GalleryProject, type GalleryProjectContext, type GalleryQuality, type GalleryServer, type GalleryServerOptions, type GallerySnapshot, type GalleryState, type GalleryStyle, type GenerateHandlerOptions, type GenerateJob, type GeneratePhase, GenerateRequestError, GenerateRequestSchema, type GenerateStatus, type Generator, GeneratorSchema, type GenericTileset, type GridConfidence, GridConfidenceSchema, HAND_EDIT_DIR, type HandEditCompanion, HandEditCompanionSchema, type HandEditMember, type HandEditSave, type HandEditSaveInput, type HandEditStart, type HandEditStatus, type ImageQualityMetrics, ImageQualityMetricsSchema, InheritedStyleSchema, type InstallRecipeOptions, type InstallRecipeResult, type JobState, type LoadedManifest, type LoadedRecipe, type Lock, type LockEntry, LockEntrySchema, type LockOutput, LockSchema, MAX_DOWNLOAD_BYTES, MAX_HAND_EDIT_BYTES, MAX_RETRIES, type ManagedArtifactBundleOptions, type Manifest, ManifestDriftError, type ManifestEdit, ManifestEditError, type ManifestEditResult, ManifestEditSchema, ManifestInputSchema, ManifestSchema, type MapObject, MediaType, type MountPlacement, type MountedSheet, type NormalizedTileRules, type Orphan, type OrphanGroups, type OutputSelection, type OutputSource, PIXEL_ART_FIXER_REVISION, PIXEL_ART_FIXER_URL, type PackedFrame, type PackedSheet, type PackedSource, type PendingQualityReview, type PickResult, type PixelArtFixerDetection, PixelLabClient, PixelLabError, type PixelLabObject, PixelLabProvider, type Plan, type PlanItem, type PlanState, type PollContext, type PollOptions, type PollResult, type PrepareReviewOptions, type Provider, type ProviderFactory, type ProviderInputContext, type ProviderInputScalar, type ProviderInputValue, type ProviderMetadata, type ProviderMode, type ProviderOptionContext, type ProviderSubmission, type QualityBaseline, QualityBaselineSchema, type QualityCheck, type QualityProfile, type QualityProfileInspection, QualityProfileSchema, type QualityProfileState, type QualityRegressionCaseResult, type QualityRegressionReport, type QualitySnapshotResult, QualityToleranceSchema, type QualityTolerances, type RateLimit, type Recipe, type RecipeFileVerification, type RecipeModelVerification, RecipeSchema, type RecipeVerification, type RefineAudit, type RefineFrameSetOptions, type RefineFrameSetResult, type RefineOptions, type RefineQualityProfilesOptions, type RefineQualityProfilesResult, type RefineRecordOptions, type RefineResult, type RemoteAsset, type RemoteHashCacheHealth, type RenderGalleryOptions, type RenderSheetOptions, type ResolvedOutput, type ResolvedProviderInputs, type ResolvedProviderOptions, type ResolvedQualityInput, type ResolvedQualityProfile, type ResolvedRevision, type ResolvedSpec, type ResolvedStyleImage, type ResumeAction, type ResumeCommand, type RetroDiffusionOptions, RetroDiffusionProvider, type ReviewReadyInfo, type ReviewSession, type Revision, type RevisionMode, RevisionModeSchema, type RevisionReadiness, RevisionSchema, type SalvageAction, type SalvageResult, type ScannedAsset, type ScenarioOptions, ScenarioProvider, type SessionBudget, type SheetGroup, type SiblingManifest, type SpriteInput, type Style, type StyleAudit, type StyleInput, StyleInputSchema, StyleSchema, type SubmissionCheckpoint, type SubmitContext, 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, applyManifestEdit, applyTags, approveQualityRecord, auditStyle, availableProviders, backoffMs, buildGallerySnapshot, buildManifest, buildPlan, buildWorkspaceGallerySnapshot, bundledRecipeRoot, cacheFileName, candidateCount, checkQualityBaseline, checkQualityRecord, clientFromEnv, colorDistance, countNumberedDescriptions, createArtifactBundleManifest, createGalleryEditHandler, createGalleryEditorHandlers, createGenerateHandlers, createProvider, currentEntryOutputPath, currentOutputPath, detachHandEdit, detectMediaType, doctor, editorBaseUrl, editorDir, editorRoute, editorStatus, editorToolsRoot, evaluateAudit, expectedOutputPath, exportTileset, fallbackOutputRole, fetchAssets, findOrphans, formatCost, galleryMediaId, galleryMediaRoute, generationCost, groupOrphansByStyle, handEditBase, handEditBases, handEditCompanionPath, handEditMembers, handEditPath, handEditProjectPath, hex, idFromPrompt, imageMetadata, inspectCaches, inspectQualityProfile, inspectRevisionReadiness, installEditor, installRecipe, isFrameSetEntry, isMemberSetEntry, isSensitiveSourceUrl, listBundledRecipes, loadClaims, loadLock, loadManifest, loadSiblingManifests, loadWorkspace, lockKey, matchOrphanStyle, measureBalanceChange, measureDecodedImageQuality, measureImageQuality, mediaExtension, mediaTypeFromExtension, memberPath, mergePalettes, mountSprites, mountStyle, normalizeLockOutputPaths, normalizeRefinementPalette, normalizeTileRules, openInEditor, outliers, outputId, packSprites, packStyle, paletteDistance, parseLock, parseWorkspace, pngSize, poll, portableOutputPath, prepareReview, primaryOutput, providerCredentialEnvs, providerFactory, pushTags, qualityFrameOutputPath, qualityRecordPath, quantizeToPalette, readArtifactBundleManifest, readHandEditCompanion, readQualityBaseline, recipeDigest, refineAsset, refineFrameSet, refineQualityProfiles, registerProvider, remove, renderGallery, renderSalvageSheet, renderSheet, requireApprovedQualitySources, requireBalance, requireDelete, requireList, requireRevisionReady, requireSelectCandidate, resolveEntryOutputs, resolveOutputPath, resolvePackInputs, resolveProject, resolveQualityInputs, resolveRecipe, resolveSpecEntryOutputs, resolveSpecOutputs, resolveSpecs, resolveStyleImages, resolveStyleOutputs, resumeActions, resumeCommandForStatus, retryAfterMs, runPicker, runSalvage, saveHandEdit, saveLock, saveWorkspace, scanAssets, selectEntryOutput, serveGallery, sha256, sha256File, shouldPersistSourceUrl, shouldRetry, slugify, snapshotQualityBaseline, sourceIsStem, sourceOutputPath, specHash, spendByUnit, startHandEdit, styleImagesBase64, submit, summarize, tagAdopted, tileFeatureOutputCount, tileVariationCount, tilesCost, toPortablePath, totalSpend, upsert, validateCostEstimate, validateMedia, validateWorkspace, verifyArtifactBundle, verifyRecipe, withArtifactManifest, workspaceClaims, workspaceStatus, writeArtifactBundle, writeManagedArtifactBundle };