pixelkiln 0.26.0 → 0.27.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.cts CHANGED
@@ -7671,6 +7671,8 @@ interface GalleryItem {
7671
7671
  */
7672
7672
  edit: GalleryOutput | null;
7673
7673
  editStatus: HandEditStatus | null;
7674
+ /** What an in-browser save recorded beside the edit; null for edits made elsewhere. */
7675
+ editMeta: GalleryEditMeta | null;
7674
7676
  /** Where the provider's own app shows this object, when it has one. */
7675
7677
  upstreamUrl: string | null;
7676
7678
  /** Downloaded work with a durable provider reference; `fetch --refresh` can re-pull it. */
@@ -7786,6 +7788,21 @@ interface BuildGalleryOptions {
7786
7788
  /** Route id for one absolute path: stable across refreshes, not enumerable. */
7787
7789
  declare function galleryMediaId(absolutePath: string): string;
7788
7790
  declare function galleryMediaRoute(id: string): string;
7791
+ /**
7792
+ * Build the gallery from the project's offline state. `specs` are the resolved
7793
+ * (possibly filtered) manifest entries the CLI already computed; lock entries
7794
+ * outside the manifest are added here so paid work is never hidden.
7795
+ */
7796
+ interface GalleryEditMeta {
7797
+ editor: string;
7798
+ savedAt: string;
7799
+ /** sha256 of the generation the edit was based on, or null for untracked art. */
7800
+ basedOn: string | null;
7801
+ /** The edit file changed since the editor saved it (another tool touched it). */
7802
+ changedSince: boolean;
7803
+ /** Manifest-relative path of the layered project file kept beside the edit, if present. */
7804
+ project: string | null;
7805
+ }
7789
7806
  declare function buildGallerySnapshot(opts: BuildGalleryOptions): Promise<GalleryBuild>;
7790
7807
  interface BuildWorkspaceGalleryOptions {
7791
7808
  workspace: Workspace;
@@ -7832,6 +7849,8 @@ interface RenderGalleryOptions {
7832
7849
  editable?: boolean;
7833
7850
  /** Generation jobs are enabled (`--budget`). */
7834
7851
  generation?: boolean;
7852
+ /** The in-browser editor can be installed and served (`--edit` without `--no-editor`). */
7853
+ editor?: boolean;
7835
7854
  }
7836
7855
  declare function renderGallery(snapshot: GallerySnapshot, opts?: RenderGalleryOptions): string;
7837
7856
 
@@ -8248,12 +8267,81 @@ interface GalleryEditHandlerOptions {
8248
8267
  /** The `edit` callback `serveGallery` expects: validate, apply, rebuild. */
8249
8268
  declare function createGalleryEditHandler(opts: GalleryEditHandlerOptions): (body: unknown) => Promise<GalleryBuild>;
8250
8269
 
8270
+ /**
8271
+ * The in-gallery editor is a 46 MB web build that is not part of the npm
8272
+ * package. It is fetched once per pinned release into a user-level cache,
8273
+ * every file verified against the hash the package carries, and served from
8274
+ * there by the gallery. Nothing is executed at install; the browser runs the
8275
+ * wasm, and only from files whose hashes matched.
8276
+ *
8277
+ * A user-level cache rather than the project's `.pixelkiln/`: the pin is per
8278
+ * PixelKiln release, not per project, and one copy serves every project.
8279
+ * `PIXELKILN_TOOLS_DIR` moves it; `PIXELKILN_EDITOR_URL` points downloads at
8280
+ * a mirror or a local directory server for offline machines.
8281
+ */
8282
+ interface EditorInstallStatus {
8283
+ /** Release tag the package pins; null means no build has been published for this version. */
8284
+ release: string | null;
8285
+ dir: string;
8286
+ /** Every pinned file is present with the right hash. */
8287
+ installed: boolean;
8288
+ /** Files still to fetch (missing or hash mismatch). */
8289
+ missing: string[];
8290
+ totalBytes: number;
8291
+ installedBytes: number;
8292
+ }
8293
+ interface EditorInstallProgress {
8294
+ file: string;
8295
+ index: number;
8296
+ count: number;
8297
+ bytes: number;
8298
+ totalBytes: number;
8299
+ /** Bytes fetched so far across all files, including the part of this one. */
8300
+ fetchedBytes: number;
8301
+ /** `start` once per file, `progress` as its bytes arrive, `done` once it verified and landed. */
8302
+ phase: "start" | "progress" | "done";
8303
+ }
8304
+
8305
+ /**
8306
+ * The gallery's side of the in-browser editor: it reports whether the pinned
8307
+ * build is on disk, installs it on request, and serves its files.
8308
+ *
8309
+ * Serving is allowlisted twice. The release tag in the URL must be the one
8310
+ * this package pins, and the file name must be one the pin lists; nothing
8311
+ * else under the tools directory is reachable. A file is served only after
8312
+ * the whole build has verified against the pinned hashes, and its size is
8313
+ * checked again on every read, so a build that changed on disk after
8314
+ * verification is refused rather than served.
8315
+ */
8316
+ interface GalleryEditorStatus extends EditorInstallStatus {
8317
+ pixelorama: string;
8318
+ protocol: number;
8319
+ /** Where the page loads the editor from once installed; null until then. */
8320
+ url: string | null;
8321
+ /** The install in flight, if any. */
8322
+ installing: EditorInstallProgress | null;
8323
+ /** Why the last install failed, until the next attempt. */
8324
+ error: string | null;
8325
+ }
8326
+ interface GalleryEditorHandlers {
8327
+ release: string | null;
8328
+ status(): Promise<GalleryEditorStatus>;
8329
+ /** Start an install unless one is running; returns the status right after. */
8330
+ install(): Promise<GalleryEditorStatus>;
8331
+ /** A verified build file, or null when it is not pinned or not installed. */
8332
+ file(release: string, name: string): Promise<{
8333
+ bytes: Buffer;
8334
+ contentType: string;
8335
+ } | null>;
8336
+ }
8337
+
8251
8338
  /**
8252
8339
  * The gallery's HTTP surface. Unlike the review server this is long-lived:
8253
8340
  * three GET routes, bound to loopback, running until the caller closes it
8254
8341
  * (the CLI does so on Ctrl+C). It has no write path unless the caller opts
8255
- * in: `edit` adds one POST route for manifest edits, and `generate` adds the
8256
- * routes that start a generation job and host its review sheet.
8342
+ * in: `edit` adds one POST route for manifest edits, `generate` adds the
8343
+ * routes that start a generation job and host its review sheet, and `editor`
8344
+ * adds the routes that install and serve the in-browser pixel editor.
8257
8345
  *
8258
8346
  * Every POST is guarded twice, because a page on localhost is reachable by
8259
8347
  * every other page in the browser: the request's Origin must be this server,
@@ -8288,6 +8376,11 @@ interface GalleryServerOptions {
8288
8376
  * sheet. The handlers own budgets and provider access; see `generate.ts`.
8289
8377
  */
8290
8378
  generate?: GalleryGenerateHandlers;
8379
+ /**
8380
+ * Enable `GET /api/editor`, `POST /api/editor/install`, and the static
8381
+ * `/editor/<release>/<file>` routes that serve the pinned editor build.
8382
+ */
8383
+ editor?: GalleryEditorHandlers;
8291
8384
  }
8292
8385
  interface GalleryServer {
8293
8386
  url: string;
package/dist/index.d.ts CHANGED
@@ -7671,6 +7671,8 @@ interface GalleryItem {
7671
7671
  */
7672
7672
  edit: GalleryOutput | null;
7673
7673
  editStatus: HandEditStatus | null;
7674
+ /** What an in-browser save recorded beside the edit; null for edits made elsewhere. */
7675
+ editMeta: GalleryEditMeta | null;
7674
7676
  /** Where the provider's own app shows this object, when it has one. */
7675
7677
  upstreamUrl: string | null;
7676
7678
  /** Downloaded work with a durable provider reference; `fetch --refresh` can re-pull it. */
@@ -7786,6 +7788,21 @@ interface BuildGalleryOptions {
7786
7788
  /** Route id for one absolute path: stable across refreshes, not enumerable. */
7787
7789
  declare function galleryMediaId(absolutePath: string): string;
7788
7790
  declare function galleryMediaRoute(id: string): string;
7791
+ /**
7792
+ * Build the gallery from the project's offline state. `specs` are the resolved
7793
+ * (possibly filtered) manifest entries the CLI already computed; lock entries
7794
+ * outside the manifest are added here so paid work is never hidden.
7795
+ */
7796
+ interface GalleryEditMeta {
7797
+ editor: string;
7798
+ savedAt: string;
7799
+ /** sha256 of the generation the edit was based on, or null for untracked art. */
7800
+ basedOn: string | null;
7801
+ /** The edit file changed since the editor saved it (another tool touched it). */
7802
+ changedSince: boolean;
7803
+ /** Manifest-relative path of the layered project file kept beside the edit, if present. */
7804
+ project: string | null;
7805
+ }
7789
7806
  declare function buildGallerySnapshot(opts: BuildGalleryOptions): Promise<GalleryBuild>;
7790
7807
  interface BuildWorkspaceGalleryOptions {
7791
7808
  workspace: Workspace;
@@ -7832,6 +7849,8 @@ interface RenderGalleryOptions {
7832
7849
  editable?: boolean;
7833
7850
  /** Generation jobs are enabled (`--budget`). */
7834
7851
  generation?: boolean;
7852
+ /** The in-browser editor can be installed and served (`--edit` without `--no-editor`). */
7853
+ editor?: boolean;
7835
7854
  }
7836
7855
  declare function renderGallery(snapshot: GallerySnapshot, opts?: RenderGalleryOptions): string;
7837
7856
 
@@ -8248,12 +8267,81 @@ interface GalleryEditHandlerOptions {
8248
8267
  /** The `edit` callback `serveGallery` expects: validate, apply, rebuild. */
8249
8268
  declare function createGalleryEditHandler(opts: GalleryEditHandlerOptions): (body: unknown) => Promise<GalleryBuild>;
8250
8269
 
8270
+ /**
8271
+ * The in-gallery editor is a 46 MB web build that is not part of the npm
8272
+ * package. It is fetched once per pinned release into a user-level cache,
8273
+ * every file verified against the hash the package carries, and served from
8274
+ * there by the gallery. Nothing is executed at install; the browser runs the
8275
+ * wasm, and only from files whose hashes matched.
8276
+ *
8277
+ * A user-level cache rather than the project's `.pixelkiln/`: the pin is per
8278
+ * PixelKiln release, not per project, and one copy serves every project.
8279
+ * `PIXELKILN_TOOLS_DIR` moves it; `PIXELKILN_EDITOR_URL` points downloads at
8280
+ * a mirror or a local directory server for offline machines.
8281
+ */
8282
+ interface EditorInstallStatus {
8283
+ /** Release tag the package pins; null means no build has been published for this version. */
8284
+ release: string | null;
8285
+ dir: string;
8286
+ /** Every pinned file is present with the right hash. */
8287
+ installed: boolean;
8288
+ /** Files still to fetch (missing or hash mismatch). */
8289
+ missing: string[];
8290
+ totalBytes: number;
8291
+ installedBytes: number;
8292
+ }
8293
+ interface EditorInstallProgress {
8294
+ file: string;
8295
+ index: number;
8296
+ count: number;
8297
+ bytes: number;
8298
+ totalBytes: number;
8299
+ /** Bytes fetched so far across all files, including the part of this one. */
8300
+ fetchedBytes: number;
8301
+ /** `start` once per file, `progress` as its bytes arrive, `done` once it verified and landed. */
8302
+ phase: "start" | "progress" | "done";
8303
+ }
8304
+
8305
+ /**
8306
+ * The gallery's side of the in-browser editor: it reports whether the pinned
8307
+ * build is on disk, installs it on request, and serves its files.
8308
+ *
8309
+ * Serving is allowlisted twice. The release tag in the URL must be the one
8310
+ * this package pins, and the file name must be one the pin lists; nothing
8311
+ * else under the tools directory is reachable. A file is served only after
8312
+ * the whole build has verified against the pinned hashes, and its size is
8313
+ * checked again on every read, so a build that changed on disk after
8314
+ * verification is refused rather than served.
8315
+ */
8316
+ interface GalleryEditorStatus extends EditorInstallStatus {
8317
+ pixelorama: string;
8318
+ protocol: number;
8319
+ /** Where the page loads the editor from once installed; null until then. */
8320
+ url: string | null;
8321
+ /** The install in flight, if any. */
8322
+ installing: EditorInstallProgress | null;
8323
+ /** Why the last install failed, until the next attempt. */
8324
+ error: string | null;
8325
+ }
8326
+ interface GalleryEditorHandlers {
8327
+ release: string | null;
8328
+ status(): Promise<GalleryEditorStatus>;
8329
+ /** Start an install unless one is running; returns the status right after. */
8330
+ install(): Promise<GalleryEditorStatus>;
8331
+ /** A verified build file, or null when it is not pinned or not installed. */
8332
+ file(release: string, name: string): Promise<{
8333
+ bytes: Buffer;
8334
+ contentType: string;
8335
+ } | null>;
8336
+ }
8337
+
8251
8338
  /**
8252
8339
  * The gallery's HTTP surface. Unlike the review server this is long-lived:
8253
8340
  * three GET routes, bound to loopback, running until the caller closes it
8254
8341
  * (the CLI does so on Ctrl+C). It has no write path unless the caller opts
8255
- * in: `edit` adds one POST route for manifest edits, and `generate` adds the
8256
- * routes that start a generation job and host its review sheet.
8342
+ * in: `edit` adds one POST route for manifest edits, `generate` adds the
8343
+ * routes that start a generation job and host its review sheet, and `editor`
8344
+ * adds the routes that install and serve the in-browser pixel editor.
8257
8345
  *
8258
8346
  * Every POST is guarded twice, because a page on localhost is reachable by
8259
8347
  * every other page in the browser: the request's Origin must be this server,
@@ -8288,6 +8376,11 @@ interface GalleryServerOptions {
8288
8376
  * sheet. The handlers own budgets and provider access; see `generate.ts`.
8289
8377
  */
8290
8378
  generate?: GalleryGenerateHandlers;
8379
+ /**
8380
+ * Enable `GET /api/editor`, `POST /api/editor/install`, and the static
8381
+ * `/editor/<release>/<file>` routes that serve the pinned editor build.
8382
+ */
8383
+ editor?: GalleryEditorHandlers;
8291
8384
  }
8292
8385
  interface GalleryServer {
8293
8386
  url: string;