pixelkiln 0.70.0 → 0.71.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
@@ -18099,6 +18099,8 @@ interface GallerySkeleton {
18099
18099
  keypointsFile: string;
18100
18100
  /** The parsed file; null until it exists. A malformed file fails the whole resolve, as in `plan`. */
18101
18101
  set: SkeletonSet | null;
18102
+ /** The file's bytes as resolved; a save from the page must quote it, so a concurrent edit is refused. */
18103
+ sha256: string | null;
18102
18104
  }
18103
18105
  interface GalleryCharacter {
18104
18106
  /** Which family this belongs to: a skeleton-based `character`, or a skeleton-free `objectPro`. */
@@ -18329,7 +18331,19 @@ interface RenderGalleryOptions {
18329
18331
  generation?: boolean;
18330
18332
  /** The in-browser editor can be installed and served (`--edit` without `--no-editor`). */
18331
18333
  editor?: boolean;
18334
+ /**
18335
+ * Marks the page's one inline script and stylesheet for a
18336
+ * `galleryContentSecurityPolicy(nonce)` header, so nothing else inline can run.
18337
+ */
18338
+ nonce?: string;
18332
18339
  }
18340
+ /**
18341
+ * The policy the gallery serves its page under. Its own script and styles
18342
+ * run by nonce; media, the review sheet, and the editor all come from this
18343
+ * server; nothing may frame it or post a form anywhere. A prompt or path
18344
+ * that ever reached the DOM as markup could still not run.
18345
+ */
18346
+ declare function galleryContentSecurityPolicy(nonce: string): string;
18333
18347
  declare function renderGallery(snapshot: GallerySnapshot, opts?: RenderGalleryOptions): string;
18334
18348
 
18335
18349
  /**
@@ -19636,11 +19650,24 @@ interface GalleryEditHandlerOptions {
19636
19650
  /** The `edit` callback `serveGallery` expects: validate, apply, rebuild. */
19637
19651
  declare function createGalleryEditHandler(opts: GalleryEditHandlerOptions): (body: unknown) => Promise<GalleryBuild>;
19638
19652
 
19653
+ /**
19654
+ * Estimates this gallery session has made, against its cap, and what
19655
+ * PixelLab reported billing for them, in whatever unit each response named.
19656
+ * Kept apart from the generation budget: PixelLab documents this endpoint in
19657
+ * dollars, and dollars do not convert to generations.
19658
+ */
19659
+ interface SkeletonEstimateSession {
19660
+ used: number;
19661
+ limit: number;
19662
+ spent: Record<string, number>;
19663
+ }
19639
19664
  interface GallerySkeletonHandlers {
19640
19665
  estimate(body: unknown): Promise<{
19641
19666
  set: SkeletonSet;
19642
19667
  source: string;
19668
+ session: SkeletonEstimateSession;
19643
19669
  }>;
19670
+ status(): SkeletonEstimateSession;
19644
19671
  }
19645
19672
 
19646
19673
  /**
@@ -19689,7 +19716,7 @@ interface GalleryServerOptions {
19689
19716
  * `/editor/<release>/<file>` routes that serve the pinned editor build.
19690
19717
  */
19691
19718
  editor?: GalleryEditorHandlers;
19692
- /** Enable `POST /api/skeleton/estimate`, a direct PixelLab call the page confirms first. */
19719
+ /** Enable `POST /api/skeleton/estimate` (a direct PixelLab call the page confirms first) and `GET /api/skeleton`, its session count. */
19693
19720
  skeleton?: GallerySkeletonHandlers;
19694
19721
  }
19695
19722
  interface GalleryServer {
@@ -19977,4 +20004,4 @@ interface WorkspaceStatusReport {
19977
20004
  */
19978
20005
  declare function workspaceStatus(ws: Workspace, dir: string): Promise<WorkspaceStatusReport>;
19979
20006
 
19980
- 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, type AssetBatch, AssetBatchSchema, AssetSchema, type AtlasSet, type AuditEvaluation, type AuditThresholds, type AuditViolation, type Balance, type BalanceChange, type BalanceInfo, type Base64Image, type BilledAmount, BudgetError, type BuildGalleryOptions, type BuildWorkspaceGalleryOptions, CHARACTER_DIRECTIONS_4, CHARACTER_DIRECTIONS_8, CHARACTER_PROPORTION_PRESETS, type CacheHealthOptions, type CacheHealthReport, type CandidateSelection, type CharacterAnimation, type CharacterAnimationMode, CharacterAnimationModeSchema, CharacterAnimationSchema$1 as CharacterAnimationSchema, type CharacterDirection, CharacterDirectionSchema, type CharacterMode, CharacterModeSchema, type CharacterOutfit, CharacterOutfitSchema, type CharacterPortrait, CharacterPortraitSchema, type CharacterPortraitSize, CharacterPortraitSizeSchema, type CharacterProportions, CharacterProportionsSchema, type CharacterState, CharacterStateSchema, type ComfyUIBinding, type ComfyUIBindings, type ComfyUIFramesOptions, type ComfyUIImageInput, type ComfyUIOptions, ComfyUIProvider, type ContentCacheHealth, type ContentCacheIssue, type CostEstimate, type CostUnit, DEFAULT_HISTORY_LIMIT, DEFAULT_QUALITY_TOLERANCES, DEFAULT_RATE_LIMIT, DEFAULT_TIMEOUT_MS, type DoctorCheck, type DoctorLevel, type DoctorOptions, type DoctorReport, EDITOR_PIN, EDITOR_RELEASE_BASE, EXIT_CODES, EditorInstallError, type EditorInstallOptions, type EditorInstallProgress, type EditorInstallResult, type EditorInstallStatus, type EditorPin, type ErrorCode, FAKE_PNG, FONT_COST_GENERATIONS, FONT_GLYPH_SIZES, FONT_WEIGHTS, FRAME_SET_REVISION_MODES, type FakeOptions, FakeProvider, type FetchResult, type FontGlyphSize, type FontWeight, type GalleryBuild, type GalleryEditHandlerOptions, type GalleryEditMeta, type GalleryEditorHandlers, type GalleryEditorOptions, type GalleryEditorStatus, type GalleryGenerateHandlers, type GalleryGeneration, type GalleryItem, type GalleryMedia, type GalleryOutput, type GalleryProject, type GalleryProjectContext, type GalleryQuality, type GalleryServer, type GalleryServerOptions, type GallerySnapshot, type GalleryState, type GalleryStyle, type GenerateFontOptions, type GenerateFontResult, type GenerateHandlerOptions, type GenerateJob, type GeneratePhase, GenerateRequestError, GenerateRequestSchema, type GenerateStatus, type Generator, GeneratorSchema, type GenericTileset, type GridConfidence, GridConfidenceSchema, HAND_EDIT_DIR, HISTORY_ENV, type HandEditCompanion, HandEditCompanionSchema, type HandEditMember, type HandEditSave, type HandEditSaveInput, type HandEditStart, type HandEditStatus, type HistoryPick, type ImageQualityMetrics, ImageQualityMetricsSchema, InheritedStyleSchema, type InstallRecipeOptions, type InstallRecipeResult, type JobState, type LoadedManifest, type LoadedRecipe, type Lock, type LockEntry, LockEntrySchema, type LockHistoryEntry, LockHistoryEntrySchema, type LockOutput, LockSchema, MAX_DOWNLOAD_BYTES, MAX_HAND_EDIT_BYTES, MAX_RETRIES, MEMBER_SET_REVISION_MODES, MIRRORED_DIRECTION, type ManagedArtifactBundleOptions, type Manifest, ManifestDriftError, type ManifestEdit, ManifestEditError, type ManifestEditResult, ManifestEditSchema, ManifestInputSchema, ManifestSchema, type MapObject, type MapScene, type MapScenePlacement, MapScenePlacementSchema, MapSceneSchema, MediaType, type MountPlacement, type MountedSheet, type NormalizedTileRules, type ObjectAnimationGroup, type OpenProjectOptions, type Orphan, type OrphanGroups, type OutputSelection, type OutputSource, OverwriteRefusedError, PIXEL_ART_FIXER_REVISION, PIXEL_ART_FIXER_URL, type PackedFrame, type PackedSheet, type PackedSource, type PendingQualityReview, type PickResult, type PixelArtFixerDetection, PixelKilnError, type PixelKilnErrorOptions, type PixelLabCharacter, type PixelLabCharacterAnimation, PixelLabClient, PixelLabError, type PixelLabObject, PixelLabProvider, type PixelLabUsage, type Plan, type PlanItem, type PlanState, type PollContext, type PollOptions, type PollResult, type Postprocess, PostprocessSchema, type PrepareReviewOptions, type Project, ProjectError, type Provider, ProviderError, 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 RefreshContext, type RemoteAsset, type RemoteCharacter, type RemoteCharacterDetail, type RemoteHashCacheHealth, type RenderGalleryOptions, type RenderSheetOptions, type ResolvedBatch, type ResolvedCharacter, type ResolvedMapScene, type ResolvedMirror, type ResolvedObjectPro, type ResolvedOutput, type ResolvedProviderInputs, type ResolvedProviderOptions, type ResolvedQualityInput, type ResolvedQualityProfile, type ResolvedReferenceImage, type ResolvedRevision, type ResolvedRevisionMember, type ResolvedSpec, type ResolvedStyleAnchor, type ResolvedStyleImage, type ResumeAction, type ResumeCommand, type RetroDiffusionOptions, RetroDiffusionProvider, type RetryInit, type RetryOptions, type RetryingFetch, type RevertOptions, type RevertResult, type ReviewReadyInfo, type ReviewSession, type Revision, type RevisionDithering, RevisionDitheringSchema, type RevisionMode, RevisionModeSchema, type RevisionReadiness, RevisionSchema, SHEET_FORMATS, type SalvageAction, type SalvageResult, type ScannedAsset, type ScenarioOptions, ScenarioProvider, type SessionBudget, type SheetAtlas, type SheetFormat, type SheetFormatOptions, 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 Tileset, type TilesetExport, type TilesetExportOptions, type TilesetFormat, type TilesetTile, UNZOOM_MAX_AREA, UNZOOM_MIN_SIDE, type UiElement, UiElementSchema, type UiPiece, UiPieceSchema, UnsupportedCapabilityError, type UnzoomFileResult, UsageError, 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, characterDirections, checkQualityBaseline, checkQualityRecord, clientFromEnv, colorDistance, countNumberedDescriptions, createArtifactBundleManifest, createGalleryEditHandler, createGalleryEditorHandlers, createGenerateHandlers, createProvider, currentEntryOutputPath, currentOutputPath, defaultOpenCommand, defaultUnzoomOut, detachHandEdit, detectMediaType, doctor, editorBaseUrl, editorDir, editorRoute, editorStatus, editorToolsRoot, errorCode, evaluateAudit, exitCodeFor, expectedOutputPath, exportTileset, fallbackOutputRole, fetchAssets, fetchWithRetry, findOrphans, fontOutputPaths, formatCost, frameSetFps, galleryMediaId, galleryMediaRoute, generateFont, generationCost, groupOrphansByStyle, handEditBase, handEditBases, handEditCompanionPath, handEditMembers, handEditPath, handEditProjectPath, hex, historyAfterReplacing, historyLimit, idFromPrompt, imageMetadata, inspectCaches, inspectQualityProfile, inspectRevisionReadiness, installEditor, installRecipe, isFrameSetEntry, isMemberSetEntry, isSensitiveSourceUrl, isometricTileCost, listBundledRecipes, loadClaims, loadLock, loadManifest, loadSiblingManifests, loadWorkspace, lockKey, matchOrphanStyle, measureBalanceChange, measureDecodedImageQuality, measureImageQuality, mediaExtension, mediaTypeFromExtension, memberPath, mergePalettes, mountSprites, mountStyle, normalizeLockOutputPaths, normalizeRefinementPalette, normalizeTerrainTiles, normalizeTileRules, openExternal, openInEditor, openProject, outliers, outputId, packSprites, packStyle, paletteDistance, parentAssetId, parseLock, parseTerrainDescriptions, parseWorkspace, pickHistory, pngSize, poll, portableOutputPath, prepareReview, primaryOutput, proportionsPayload, providerCredentialEnvs, providerFactory, pushTags, qualityFrameOutputPath, qualityRecordPath, quantizeToPalette, readArtifactBundleManifest, readHandEditCompanion, readQualityBaseline, recipeDigest, referencedHashes, refineAsset, refineFrameSet, refineQualityProfiles, registerProvider, remove, renderAsepriteSheet, renderGallery, renderGodotSpriteFrames, renderSalvageSheet, renderSheet, renderSheetDocument, requireApprovedQualitySources, requireBalance, requireDelete, requireList, requireRevisionReady, requireSelectCandidate, resolveEntryOutputs, resolveOutputPath, resolvePackInputs, resolveProject, resolveQualityInputs, resolveRecipe, resolveSpecEntryOutputs, resolveSpecOutputs, resolveSpecs, resolveStyleImages, resolveStyleOutputs, resumeActions, resumeCommandForStatus, retireGeneration, retryAfterMs, revertGeneration, runPicker, runSalvage, saveHandEdit, saveLock, saveWorkspace, scanAssets, selectEntryOutput, serveGallery, sha256, sha256File, shouldPersistSourceUrl, shouldRetry, slugify, snapshotQualityBaseline, sourceIsStem, sourceOutputPath, specHash, spendByUnit, startHandEdit, styleImagesBase64, submit, summarize, tagAdopted, terrainTileCount, tileFeatureOutputCount, tileVariationCount, tilesCost, toPortablePath, totalSpend, unzoomFile, upsert, validateCostEstimate, validateMedia, validateWorkspace, verifyArtifactBundle, verifyRecipe, withArtifactManifest, workspaceClaims, workspaceStatus, writeArtifactBundle, writeManagedArtifactBundle };
20007
+ 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, type AssetBatch, AssetBatchSchema, AssetSchema, type AtlasSet, type AuditEvaluation, type AuditThresholds, type AuditViolation, type Balance, type BalanceChange, type BalanceInfo, type Base64Image, type BilledAmount, BudgetError, type BuildGalleryOptions, type BuildWorkspaceGalleryOptions, CHARACTER_DIRECTIONS_4, CHARACTER_DIRECTIONS_8, CHARACTER_PROPORTION_PRESETS, type CacheHealthOptions, type CacheHealthReport, type CandidateSelection, type CharacterAnimation, type CharacterAnimationMode, CharacterAnimationModeSchema, CharacterAnimationSchema$1 as CharacterAnimationSchema, type CharacterDirection, CharacterDirectionSchema, type CharacterMode, CharacterModeSchema, type CharacterOutfit, CharacterOutfitSchema, type CharacterPortrait, CharacterPortraitSchema, type CharacterPortraitSize, CharacterPortraitSizeSchema, type CharacterProportions, CharacterProportionsSchema, type CharacterState, CharacterStateSchema, type ComfyUIBinding, type ComfyUIBindings, type ComfyUIFramesOptions, type ComfyUIImageInput, type ComfyUIOptions, ComfyUIProvider, type ContentCacheHealth, type ContentCacheIssue, type CostEstimate, type CostUnit, DEFAULT_HISTORY_LIMIT, DEFAULT_QUALITY_TOLERANCES, DEFAULT_RATE_LIMIT, DEFAULT_TIMEOUT_MS, type DoctorCheck, type DoctorLevel, type DoctorOptions, type DoctorReport, EDITOR_PIN, EDITOR_RELEASE_BASE, EXIT_CODES, EditorInstallError, type EditorInstallOptions, type EditorInstallProgress, type EditorInstallResult, type EditorInstallStatus, type EditorPin, type ErrorCode, FAKE_PNG, FONT_COST_GENERATIONS, FONT_GLYPH_SIZES, FONT_WEIGHTS, FRAME_SET_REVISION_MODES, type FakeOptions, FakeProvider, type FetchResult, type FontGlyphSize, type FontWeight, type GalleryBuild, type GalleryEditHandlerOptions, type GalleryEditMeta, type GalleryEditorHandlers, type GalleryEditorOptions, type GalleryEditorStatus, type GalleryGenerateHandlers, type GalleryGeneration, type GalleryItem, type GalleryMedia, type GalleryOutput, type GalleryProject, type GalleryProjectContext, type GalleryQuality, type GalleryServer, type GalleryServerOptions, type GallerySnapshot, type GalleryState, type GalleryStyle, type GenerateFontOptions, type GenerateFontResult, type GenerateHandlerOptions, type GenerateJob, type GeneratePhase, GenerateRequestError, GenerateRequestSchema, type GenerateStatus, type Generator, GeneratorSchema, type GenericTileset, type GridConfidence, GridConfidenceSchema, HAND_EDIT_DIR, HISTORY_ENV, type HandEditCompanion, HandEditCompanionSchema, type HandEditMember, type HandEditSave, type HandEditSaveInput, type HandEditStart, type HandEditStatus, type HistoryPick, type ImageQualityMetrics, ImageQualityMetricsSchema, InheritedStyleSchema, type InstallRecipeOptions, type InstallRecipeResult, type JobState, type LoadedManifest, type LoadedRecipe, type Lock, type LockEntry, LockEntrySchema, type LockHistoryEntry, LockHistoryEntrySchema, type LockOutput, LockSchema, MAX_DOWNLOAD_BYTES, MAX_HAND_EDIT_BYTES, MAX_RETRIES, MEMBER_SET_REVISION_MODES, MIRRORED_DIRECTION, type ManagedArtifactBundleOptions, type Manifest, ManifestDriftError, type ManifestEdit, ManifestEditError, type ManifestEditResult, ManifestEditSchema, ManifestInputSchema, ManifestSchema, type MapObject, type MapScene, type MapScenePlacement, MapScenePlacementSchema, MapSceneSchema, MediaType, type MountPlacement, type MountedSheet, type NormalizedTileRules, type ObjectAnimationGroup, type OpenProjectOptions, type Orphan, type OrphanGroups, type OutputSelection, type OutputSource, OverwriteRefusedError, PIXEL_ART_FIXER_REVISION, PIXEL_ART_FIXER_URL, type PackedFrame, type PackedSheet, type PackedSource, type PendingQualityReview, type PickResult, type PixelArtFixerDetection, PixelKilnError, type PixelKilnErrorOptions, type PixelLabCharacter, type PixelLabCharacterAnimation, PixelLabClient, PixelLabError, type PixelLabObject, PixelLabProvider, type PixelLabUsage, type Plan, type PlanItem, type PlanState, type PollContext, type PollOptions, type PollResult, type Postprocess, PostprocessSchema, type PrepareReviewOptions, type Project, ProjectError, type Provider, ProviderError, 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 RefreshContext, type RemoteAsset, type RemoteCharacter, type RemoteCharacterDetail, type RemoteHashCacheHealth, type RenderGalleryOptions, type RenderSheetOptions, type ResolvedBatch, type ResolvedCharacter, type ResolvedMapScene, type ResolvedMirror, type ResolvedObjectPro, type ResolvedOutput, type ResolvedProviderInputs, type ResolvedProviderOptions, type ResolvedQualityInput, type ResolvedQualityProfile, type ResolvedReferenceImage, type ResolvedRevision, type ResolvedRevisionMember, type ResolvedSpec, type ResolvedStyleAnchor, type ResolvedStyleImage, type ResumeAction, type ResumeCommand, type RetroDiffusionOptions, RetroDiffusionProvider, type RetryInit, type RetryOptions, type RetryingFetch, type RevertOptions, type RevertResult, type ReviewReadyInfo, type ReviewSession, type Revision, type RevisionDithering, RevisionDitheringSchema, type RevisionMode, RevisionModeSchema, type RevisionReadiness, RevisionSchema, SHEET_FORMATS, type SalvageAction, type SalvageResult, type ScannedAsset, type ScenarioOptions, ScenarioProvider, type SessionBudget, type SheetAtlas, type SheetFormat, type SheetFormatOptions, 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 Tileset, type TilesetExport, type TilesetExportOptions, type TilesetFormat, type TilesetTile, UNZOOM_MAX_AREA, UNZOOM_MIN_SIDE, type UiElement, UiElementSchema, type UiPiece, UiPieceSchema, UnsupportedCapabilityError, type UnzoomFileResult, UsageError, 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, characterDirections, checkQualityBaseline, checkQualityRecord, clientFromEnv, colorDistance, countNumberedDescriptions, createArtifactBundleManifest, createGalleryEditHandler, createGalleryEditorHandlers, createGenerateHandlers, createProvider, currentEntryOutputPath, currentOutputPath, defaultOpenCommand, defaultUnzoomOut, detachHandEdit, detectMediaType, doctor, editorBaseUrl, editorDir, editorRoute, editorStatus, editorToolsRoot, errorCode, evaluateAudit, exitCodeFor, expectedOutputPath, exportTileset, fallbackOutputRole, fetchAssets, fetchWithRetry, findOrphans, fontOutputPaths, formatCost, frameSetFps, galleryContentSecurityPolicy, galleryMediaId, galleryMediaRoute, generateFont, generationCost, groupOrphansByStyle, handEditBase, handEditBases, handEditCompanionPath, handEditMembers, handEditPath, handEditProjectPath, hex, historyAfterReplacing, historyLimit, idFromPrompt, imageMetadata, inspectCaches, inspectQualityProfile, inspectRevisionReadiness, installEditor, installRecipe, isFrameSetEntry, isMemberSetEntry, isSensitiveSourceUrl, isometricTileCost, listBundledRecipes, loadClaims, loadLock, loadManifest, loadSiblingManifests, loadWorkspace, lockKey, matchOrphanStyle, measureBalanceChange, measureDecodedImageQuality, measureImageQuality, mediaExtension, mediaTypeFromExtension, memberPath, mergePalettes, mountSprites, mountStyle, normalizeLockOutputPaths, normalizeRefinementPalette, normalizeTerrainTiles, normalizeTileRules, openExternal, openInEditor, openProject, outliers, outputId, packSprites, packStyle, paletteDistance, parentAssetId, parseLock, parseTerrainDescriptions, parseWorkspace, pickHistory, pngSize, poll, portableOutputPath, prepareReview, primaryOutput, proportionsPayload, providerCredentialEnvs, providerFactory, pushTags, qualityFrameOutputPath, qualityRecordPath, quantizeToPalette, readArtifactBundleManifest, readHandEditCompanion, readQualityBaseline, recipeDigest, referencedHashes, refineAsset, refineFrameSet, refineQualityProfiles, registerProvider, remove, renderAsepriteSheet, renderGallery, renderGodotSpriteFrames, renderSalvageSheet, renderSheet, renderSheetDocument, requireApprovedQualitySources, requireBalance, requireDelete, requireList, requireRevisionReady, requireSelectCandidate, resolveEntryOutputs, resolveOutputPath, resolvePackInputs, resolveProject, resolveQualityInputs, resolveRecipe, resolveSpecEntryOutputs, resolveSpecOutputs, resolveSpecs, resolveStyleImages, resolveStyleOutputs, resumeActions, resumeCommandForStatus, retireGeneration, retryAfterMs, revertGeneration, runPicker, runSalvage, saveHandEdit, saveLock, saveWorkspace, scanAssets, selectEntryOutput, serveGallery, sha256, sha256File, shouldPersistSourceUrl, shouldRetry, slugify, snapshotQualityBaseline, sourceIsStem, sourceOutputPath, specHash, spendByUnit, startHandEdit, styleImagesBase64, submit, summarize, tagAdopted, terrainTileCount, tileFeatureOutputCount, tileVariationCount, tilesCost, toPortablePath, totalSpend, unzoomFile, upsert, validateCostEstimate, validateMedia, validateWorkspace, verifyArtifactBundle, verifyRecipe, withArtifactManifest, workspaceClaims, workspaceStatus, writeArtifactBundle, writeManagedArtifactBundle };
package/dist/index.d.ts CHANGED
@@ -18099,6 +18099,8 @@ interface GallerySkeleton {
18099
18099
  keypointsFile: string;
18100
18100
  /** The parsed file; null until it exists. A malformed file fails the whole resolve, as in `plan`. */
18101
18101
  set: SkeletonSet | null;
18102
+ /** The file's bytes as resolved; a save from the page must quote it, so a concurrent edit is refused. */
18103
+ sha256: string | null;
18102
18104
  }
18103
18105
  interface GalleryCharacter {
18104
18106
  /** Which family this belongs to: a skeleton-based `character`, or a skeleton-free `objectPro`. */
@@ -18329,7 +18331,19 @@ interface RenderGalleryOptions {
18329
18331
  generation?: boolean;
18330
18332
  /** The in-browser editor can be installed and served (`--edit` without `--no-editor`). */
18331
18333
  editor?: boolean;
18334
+ /**
18335
+ * Marks the page's one inline script and stylesheet for a
18336
+ * `galleryContentSecurityPolicy(nonce)` header, so nothing else inline can run.
18337
+ */
18338
+ nonce?: string;
18332
18339
  }
18340
+ /**
18341
+ * The policy the gallery serves its page under. Its own script and styles
18342
+ * run by nonce; media, the review sheet, and the editor all come from this
18343
+ * server; nothing may frame it or post a form anywhere. A prompt or path
18344
+ * that ever reached the DOM as markup could still not run.
18345
+ */
18346
+ declare function galleryContentSecurityPolicy(nonce: string): string;
18333
18347
  declare function renderGallery(snapshot: GallerySnapshot, opts?: RenderGalleryOptions): string;
18334
18348
 
18335
18349
  /**
@@ -19636,11 +19650,24 @@ interface GalleryEditHandlerOptions {
19636
19650
  /** The `edit` callback `serveGallery` expects: validate, apply, rebuild. */
19637
19651
  declare function createGalleryEditHandler(opts: GalleryEditHandlerOptions): (body: unknown) => Promise<GalleryBuild>;
19638
19652
 
19653
+ /**
19654
+ * Estimates this gallery session has made, against its cap, and what
19655
+ * PixelLab reported billing for them, in whatever unit each response named.
19656
+ * Kept apart from the generation budget: PixelLab documents this endpoint in
19657
+ * dollars, and dollars do not convert to generations.
19658
+ */
19659
+ interface SkeletonEstimateSession {
19660
+ used: number;
19661
+ limit: number;
19662
+ spent: Record<string, number>;
19663
+ }
19639
19664
  interface GallerySkeletonHandlers {
19640
19665
  estimate(body: unknown): Promise<{
19641
19666
  set: SkeletonSet;
19642
19667
  source: string;
19668
+ session: SkeletonEstimateSession;
19643
19669
  }>;
19670
+ status(): SkeletonEstimateSession;
19644
19671
  }
19645
19672
 
19646
19673
  /**
@@ -19689,7 +19716,7 @@ interface GalleryServerOptions {
19689
19716
  * `/editor/<release>/<file>` routes that serve the pinned editor build.
19690
19717
  */
19691
19718
  editor?: GalleryEditorHandlers;
19692
- /** Enable `POST /api/skeleton/estimate`, a direct PixelLab call the page confirms first. */
19719
+ /** Enable `POST /api/skeleton/estimate` (a direct PixelLab call the page confirms first) and `GET /api/skeleton`, its session count. */
19693
19720
  skeleton?: GallerySkeletonHandlers;
19694
19721
  }
19695
19722
  interface GalleryServer {
@@ -19977,4 +20004,4 @@ interface WorkspaceStatusReport {
19977
20004
  */
19978
20005
  declare function workspaceStatus(ws: Workspace, dir: string): Promise<WorkspaceStatusReport>;
19979
20006
 
19980
- 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, type AssetBatch, AssetBatchSchema, AssetSchema, type AtlasSet, type AuditEvaluation, type AuditThresholds, type AuditViolation, type Balance, type BalanceChange, type BalanceInfo, type Base64Image, type BilledAmount, BudgetError, type BuildGalleryOptions, type BuildWorkspaceGalleryOptions, CHARACTER_DIRECTIONS_4, CHARACTER_DIRECTIONS_8, CHARACTER_PROPORTION_PRESETS, type CacheHealthOptions, type CacheHealthReport, type CandidateSelection, type CharacterAnimation, type CharacterAnimationMode, CharacterAnimationModeSchema, CharacterAnimationSchema$1 as CharacterAnimationSchema, type CharacterDirection, CharacterDirectionSchema, type CharacterMode, CharacterModeSchema, type CharacterOutfit, CharacterOutfitSchema, type CharacterPortrait, CharacterPortraitSchema, type CharacterPortraitSize, CharacterPortraitSizeSchema, type CharacterProportions, CharacterProportionsSchema, type CharacterState, CharacterStateSchema, type ComfyUIBinding, type ComfyUIBindings, type ComfyUIFramesOptions, type ComfyUIImageInput, type ComfyUIOptions, ComfyUIProvider, type ContentCacheHealth, type ContentCacheIssue, type CostEstimate, type CostUnit, DEFAULT_HISTORY_LIMIT, DEFAULT_QUALITY_TOLERANCES, DEFAULT_RATE_LIMIT, DEFAULT_TIMEOUT_MS, type DoctorCheck, type DoctorLevel, type DoctorOptions, type DoctorReport, EDITOR_PIN, EDITOR_RELEASE_BASE, EXIT_CODES, EditorInstallError, type EditorInstallOptions, type EditorInstallProgress, type EditorInstallResult, type EditorInstallStatus, type EditorPin, type ErrorCode, FAKE_PNG, FONT_COST_GENERATIONS, FONT_GLYPH_SIZES, FONT_WEIGHTS, FRAME_SET_REVISION_MODES, type FakeOptions, FakeProvider, type FetchResult, type FontGlyphSize, type FontWeight, type GalleryBuild, type GalleryEditHandlerOptions, type GalleryEditMeta, type GalleryEditorHandlers, type GalleryEditorOptions, type GalleryEditorStatus, type GalleryGenerateHandlers, type GalleryGeneration, type GalleryItem, type GalleryMedia, type GalleryOutput, type GalleryProject, type GalleryProjectContext, type GalleryQuality, type GalleryServer, type GalleryServerOptions, type GallerySnapshot, type GalleryState, type GalleryStyle, type GenerateFontOptions, type GenerateFontResult, type GenerateHandlerOptions, type GenerateJob, type GeneratePhase, GenerateRequestError, GenerateRequestSchema, type GenerateStatus, type Generator, GeneratorSchema, type GenericTileset, type GridConfidence, GridConfidenceSchema, HAND_EDIT_DIR, HISTORY_ENV, type HandEditCompanion, HandEditCompanionSchema, type HandEditMember, type HandEditSave, type HandEditSaveInput, type HandEditStart, type HandEditStatus, type HistoryPick, type ImageQualityMetrics, ImageQualityMetricsSchema, InheritedStyleSchema, type InstallRecipeOptions, type InstallRecipeResult, type JobState, type LoadedManifest, type LoadedRecipe, type Lock, type LockEntry, LockEntrySchema, type LockHistoryEntry, LockHistoryEntrySchema, type LockOutput, LockSchema, MAX_DOWNLOAD_BYTES, MAX_HAND_EDIT_BYTES, MAX_RETRIES, MEMBER_SET_REVISION_MODES, MIRRORED_DIRECTION, type ManagedArtifactBundleOptions, type Manifest, ManifestDriftError, type ManifestEdit, ManifestEditError, type ManifestEditResult, ManifestEditSchema, ManifestInputSchema, ManifestSchema, type MapObject, type MapScene, type MapScenePlacement, MapScenePlacementSchema, MapSceneSchema, MediaType, type MountPlacement, type MountedSheet, type NormalizedTileRules, type ObjectAnimationGroup, type OpenProjectOptions, type Orphan, type OrphanGroups, type OutputSelection, type OutputSource, OverwriteRefusedError, PIXEL_ART_FIXER_REVISION, PIXEL_ART_FIXER_URL, type PackedFrame, type PackedSheet, type PackedSource, type PendingQualityReview, type PickResult, type PixelArtFixerDetection, PixelKilnError, type PixelKilnErrorOptions, type PixelLabCharacter, type PixelLabCharacterAnimation, PixelLabClient, PixelLabError, type PixelLabObject, PixelLabProvider, type PixelLabUsage, type Plan, type PlanItem, type PlanState, type PollContext, type PollOptions, type PollResult, type Postprocess, PostprocessSchema, type PrepareReviewOptions, type Project, ProjectError, type Provider, ProviderError, 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 RefreshContext, type RemoteAsset, type RemoteCharacter, type RemoteCharacterDetail, type RemoteHashCacheHealth, type RenderGalleryOptions, type RenderSheetOptions, type ResolvedBatch, type ResolvedCharacter, type ResolvedMapScene, type ResolvedMirror, type ResolvedObjectPro, type ResolvedOutput, type ResolvedProviderInputs, type ResolvedProviderOptions, type ResolvedQualityInput, type ResolvedQualityProfile, type ResolvedReferenceImage, type ResolvedRevision, type ResolvedRevisionMember, type ResolvedSpec, type ResolvedStyleAnchor, type ResolvedStyleImage, type ResumeAction, type ResumeCommand, type RetroDiffusionOptions, RetroDiffusionProvider, type RetryInit, type RetryOptions, type RetryingFetch, type RevertOptions, type RevertResult, type ReviewReadyInfo, type ReviewSession, type Revision, type RevisionDithering, RevisionDitheringSchema, type RevisionMode, RevisionModeSchema, type RevisionReadiness, RevisionSchema, SHEET_FORMATS, type SalvageAction, type SalvageResult, type ScannedAsset, type ScenarioOptions, ScenarioProvider, type SessionBudget, type SheetAtlas, type SheetFormat, type SheetFormatOptions, 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 Tileset, type TilesetExport, type TilesetExportOptions, type TilesetFormat, type TilesetTile, UNZOOM_MAX_AREA, UNZOOM_MIN_SIDE, type UiElement, UiElementSchema, type UiPiece, UiPieceSchema, UnsupportedCapabilityError, type UnzoomFileResult, UsageError, 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, characterDirections, checkQualityBaseline, checkQualityRecord, clientFromEnv, colorDistance, countNumberedDescriptions, createArtifactBundleManifest, createGalleryEditHandler, createGalleryEditorHandlers, createGenerateHandlers, createProvider, currentEntryOutputPath, currentOutputPath, defaultOpenCommand, defaultUnzoomOut, detachHandEdit, detectMediaType, doctor, editorBaseUrl, editorDir, editorRoute, editorStatus, editorToolsRoot, errorCode, evaluateAudit, exitCodeFor, expectedOutputPath, exportTileset, fallbackOutputRole, fetchAssets, fetchWithRetry, findOrphans, fontOutputPaths, formatCost, frameSetFps, galleryMediaId, galleryMediaRoute, generateFont, generationCost, groupOrphansByStyle, handEditBase, handEditBases, handEditCompanionPath, handEditMembers, handEditPath, handEditProjectPath, hex, historyAfterReplacing, historyLimit, idFromPrompt, imageMetadata, inspectCaches, inspectQualityProfile, inspectRevisionReadiness, installEditor, installRecipe, isFrameSetEntry, isMemberSetEntry, isSensitiveSourceUrl, isometricTileCost, listBundledRecipes, loadClaims, loadLock, loadManifest, loadSiblingManifests, loadWorkspace, lockKey, matchOrphanStyle, measureBalanceChange, measureDecodedImageQuality, measureImageQuality, mediaExtension, mediaTypeFromExtension, memberPath, mergePalettes, mountSprites, mountStyle, normalizeLockOutputPaths, normalizeRefinementPalette, normalizeTerrainTiles, normalizeTileRules, openExternal, openInEditor, openProject, outliers, outputId, packSprites, packStyle, paletteDistance, parentAssetId, parseLock, parseTerrainDescriptions, parseWorkspace, pickHistory, pngSize, poll, portableOutputPath, prepareReview, primaryOutput, proportionsPayload, providerCredentialEnvs, providerFactory, pushTags, qualityFrameOutputPath, qualityRecordPath, quantizeToPalette, readArtifactBundleManifest, readHandEditCompanion, readQualityBaseline, recipeDigest, referencedHashes, refineAsset, refineFrameSet, refineQualityProfiles, registerProvider, remove, renderAsepriteSheet, renderGallery, renderGodotSpriteFrames, renderSalvageSheet, renderSheet, renderSheetDocument, requireApprovedQualitySources, requireBalance, requireDelete, requireList, requireRevisionReady, requireSelectCandidate, resolveEntryOutputs, resolveOutputPath, resolvePackInputs, resolveProject, resolveQualityInputs, resolveRecipe, resolveSpecEntryOutputs, resolveSpecOutputs, resolveSpecs, resolveStyleImages, resolveStyleOutputs, resumeActions, resumeCommandForStatus, retireGeneration, retryAfterMs, revertGeneration, runPicker, runSalvage, saveHandEdit, saveLock, saveWorkspace, scanAssets, selectEntryOutput, serveGallery, sha256, sha256File, shouldPersistSourceUrl, shouldRetry, slugify, snapshotQualityBaseline, sourceIsStem, sourceOutputPath, specHash, spendByUnit, startHandEdit, styleImagesBase64, submit, summarize, tagAdopted, terrainTileCount, tileFeatureOutputCount, tileVariationCount, tilesCost, toPortablePath, totalSpend, unzoomFile, upsert, validateCostEstimate, validateMedia, validateWorkspace, verifyArtifactBundle, verifyRecipe, withArtifactManifest, workspaceClaims, workspaceStatus, writeArtifactBundle, writeManagedArtifactBundle };
20007
+ 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, type AssetBatch, AssetBatchSchema, AssetSchema, type AtlasSet, type AuditEvaluation, type AuditThresholds, type AuditViolation, type Balance, type BalanceChange, type BalanceInfo, type Base64Image, type BilledAmount, BudgetError, type BuildGalleryOptions, type BuildWorkspaceGalleryOptions, CHARACTER_DIRECTIONS_4, CHARACTER_DIRECTIONS_8, CHARACTER_PROPORTION_PRESETS, type CacheHealthOptions, type CacheHealthReport, type CandidateSelection, type CharacterAnimation, type CharacterAnimationMode, CharacterAnimationModeSchema, CharacterAnimationSchema$1 as CharacterAnimationSchema, type CharacterDirection, CharacterDirectionSchema, type CharacterMode, CharacterModeSchema, type CharacterOutfit, CharacterOutfitSchema, type CharacterPortrait, CharacterPortraitSchema, type CharacterPortraitSize, CharacterPortraitSizeSchema, type CharacterProportions, CharacterProportionsSchema, type CharacterState, CharacterStateSchema, type ComfyUIBinding, type ComfyUIBindings, type ComfyUIFramesOptions, type ComfyUIImageInput, type ComfyUIOptions, ComfyUIProvider, type ContentCacheHealth, type ContentCacheIssue, type CostEstimate, type CostUnit, DEFAULT_HISTORY_LIMIT, DEFAULT_QUALITY_TOLERANCES, DEFAULT_RATE_LIMIT, DEFAULT_TIMEOUT_MS, type DoctorCheck, type DoctorLevel, type DoctorOptions, type DoctorReport, EDITOR_PIN, EDITOR_RELEASE_BASE, EXIT_CODES, EditorInstallError, type EditorInstallOptions, type EditorInstallProgress, type EditorInstallResult, type EditorInstallStatus, type EditorPin, type ErrorCode, FAKE_PNG, FONT_COST_GENERATIONS, FONT_GLYPH_SIZES, FONT_WEIGHTS, FRAME_SET_REVISION_MODES, type FakeOptions, FakeProvider, type FetchResult, type FontGlyphSize, type FontWeight, type GalleryBuild, type GalleryEditHandlerOptions, type GalleryEditMeta, type GalleryEditorHandlers, type GalleryEditorOptions, type GalleryEditorStatus, type GalleryGenerateHandlers, type GalleryGeneration, type GalleryItem, type GalleryMedia, type GalleryOutput, type GalleryProject, type GalleryProjectContext, type GalleryQuality, type GalleryServer, type GalleryServerOptions, type GallerySnapshot, type GalleryState, type GalleryStyle, type GenerateFontOptions, type GenerateFontResult, type GenerateHandlerOptions, type GenerateJob, type GeneratePhase, GenerateRequestError, GenerateRequestSchema, type GenerateStatus, type Generator, GeneratorSchema, type GenericTileset, type GridConfidence, GridConfidenceSchema, HAND_EDIT_DIR, HISTORY_ENV, type HandEditCompanion, HandEditCompanionSchema, type HandEditMember, type HandEditSave, type HandEditSaveInput, type HandEditStart, type HandEditStatus, type HistoryPick, type ImageQualityMetrics, ImageQualityMetricsSchema, InheritedStyleSchema, type InstallRecipeOptions, type InstallRecipeResult, type JobState, type LoadedManifest, type LoadedRecipe, type Lock, type LockEntry, LockEntrySchema, type LockHistoryEntry, LockHistoryEntrySchema, type LockOutput, LockSchema, MAX_DOWNLOAD_BYTES, MAX_HAND_EDIT_BYTES, MAX_RETRIES, MEMBER_SET_REVISION_MODES, MIRRORED_DIRECTION, type ManagedArtifactBundleOptions, type Manifest, ManifestDriftError, type ManifestEdit, ManifestEditError, type ManifestEditResult, ManifestEditSchema, ManifestInputSchema, ManifestSchema, type MapObject, type MapScene, type MapScenePlacement, MapScenePlacementSchema, MapSceneSchema, MediaType, type MountPlacement, type MountedSheet, type NormalizedTileRules, type ObjectAnimationGroup, type OpenProjectOptions, type Orphan, type OrphanGroups, type OutputSelection, type OutputSource, OverwriteRefusedError, PIXEL_ART_FIXER_REVISION, PIXEL_ART_FIXER_URL, type PackedFrame, type PackedSheet, type PackedSource, type PendingQualityReview, type PickResult, type PixelArtFixerDetection, PixelKilnError, type PixelKilnErrorOptions, type PixelLabCharacter, type PixelLabCharacterAnimation, PixelLabClient, PixelLabError, type PixelLabObject, PixelLabProvider, type PixelLabUsage, type Plan, type PlanItem, type PlanState, type PollContext, type PollOptions, type PollResult, type Postprocess, PostprocessSchema, type PrepareReviewOptions, type Project, ProjectError, type Provider, ProviderError, 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 RefreshContext, type RemoteAsset, type RemoteCharacter, type RemoteCharacterDetail, type RemoteHashCacheHealth, type RenderGalleryOptions, type RenderSheetOptions, type ResolvedBatch, type ResolvedCharacter, type ResolvedMapScene, type ResolvedMirror, type ResolvedObjectPro, type ResolvedOutput, type ResolvedProviderInputs, type ResolvedProviderOptions, type ResolvedQualityInput, type ResolvedQualityProfile, type ResolvedReferenceImage, type ResolvedRevision, type ResolvedRevisionMember, type ResolvedSpec, type ResolvedStyleAnchor, type ResolvedStyleImage, type ResumeAction, type ResumeCommand, type RetroDiffusionOptions, RetroDiffusionProvider, type RetryInit, type RetryOptions, type RetryingFetch, type RevertOptions, type RevertResult, type ReviewReadyInfo, type ReviewSession, type Revision, type RevisionDithering, RevisionDitheringSchema, type RevisionMode, RevisionModeSchema, type RevisionReadiness, RevisionSchema, SHEET_FORMATS, type SalvageAction, type SalvageResult, type ScannedAsset, type ScenarioOptions, ScenarioProvider, type SessionBudget, type SheetAtlas, type SheetFormat, type SheetFormatOptions, 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 Tileset, type TilesetExport, type TilesetExportOptions, type TilesetFormat, type TilesetTile, UNZOOM_MAX_AREA, UNZOOM_MIN_SIDE, type UiElement, UiElementSchema, type UiPiece, UiPieceSchema, UnsupportedCapabilityError, type UnzoomFileResult, UsageError, 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, characterDirections, checkQualityBaseline, checkQualityRecord, clientFromEnv, colorDistance, countNumberedDescriptions, createArtifactBundleManifest, createGalleryEditHandler, createGalleryEditorHandlers, createGenerateHandlers, createProvider, currentEntryOutputPath, currentOutputPath, defaultOpenCommand, defaultUnzoomOut, detachHandEdit, detectMediaType, doctor, editorBaseUrl, editorDir, editorRoute, editorStatus, editorToolsRoot, errorCode, evaluateAudit, exitCodeFor, expectedOutputPath, exportTileset, fallbackOutputRole, fetchAssets, fetchWithRetry, findOrphans, fontOutputPaths, formatCost, frameSetFps, galleryContentSecurityPolicy, galleryMediaId, galleryMediaRoute, generateFont, generationCost, groupOrphansByStyle, handEditBase, handEditBases, handEditCompanionPath, handEditMembers, handEditPath, handEditProjectPath, hex, historyAfterReplacing, historyLimit, idFromPrompt, imageMetadata, inspectCaches, inspectQualityProfile, inspectRevisionReadiness, installEditor, installRecipe, isFrameSetEntry, isMemberSetEntry, isSensitiveSourceUrl, isometricTileCost, listBundledRecipes, loadClaims, loadLock, loadManifest, loadSiblingManifests, loadWorkspace, lockKey, matchOrphanStyle, measureBalanceChange, measureDecodedImageQuality, measureImageQuality, mediaExtension, mediaTypeFromExtension, memberPath, mergePalettes, mountSprites, mountStyle, normalizeLockOutputPaths, normalizeRefinementPalette, normalizeTerrainTiles, normalizeTileRules, openExternal, openInEditor, openProject, outliers, outputId, packSprites, packStyle, paletteDistance, parentAssetId, parseLock, parseTerrainDescriptions, parseWorkspace, pickHistory, pngSize, poll, portableOutputPath, prepareReview, primaryOutput, proportionsPayload, providerCredentialEnvs, providerFactory, pushTags, qualityFrameOutputPath, qualityRecordPath, quantizeToPalette, readArtifactBundleManifest, readHandEditCompanion, readQualityBaseline, recipeDigest, referencedHashes, refineAsset, refineFrameSet, refineQualityProfiles, registerProvider, remove, renderAsepriteSheet, renderGallery, renderGodotSpriteFrames, renderSalvageSheet, renderSheet, renderSheetDocument, requireApprovedQualitySources, requireBalance, requireDelete, requireList, requireRevisionReady, requireSelectCandidate, resolveEntryOutputs, resolveOutputPath, resolvePackInputs, resolveProject, resolveQualityInputs, resolveRecipe, resolveSpecEntryOutputs, resolveSpecOutputs, resolveSpecs, resolveStyleImages, resolveStyleOutputs, resumeActions, resumeCommandForStatus, retireGeneration, retryAfterMs, revertGeneration, runPicker, runSalvage, saveHandEdit, saveLock, saveWorkspace, scanAssets, selectEntryOutput, serveGallery, sha256, sha256File, shouldPersistSourceUrl, shouldRetry, slugify, snapshotQualityBaseline, sourceIsStem, sourceOutputPath, specHash, spendByUnit, startHandEdit, styleImagesBase64, submit, summarize, tagAdopted, terrainTileCount, tileFeatureOutputCount, tileVariationCount, tilesCost, toPortablePath, totalSpend, unzoomFile, upsert, validateCostEstimate, validateMedia, validateWorkspace, verifyArtifactBundle, verifyRecipe, withArtifactManifest, workspaceClaims, workspaceStatus, writeArtifactBundle, writeManagedArtifactBundle };
package/dist/index.js CHANGED
@@ -15623,6 +15623,15 @@ var SkeletonAnimationRequestSchema = z10.object({
15623
15623
  /** Replace an existing `keypointsFile` with `set`. */
15624
15624
  overwrite: z10.boolean().optional()
15625
15625
  }).strict();
15626
+ var SkeletonKeypointsUpdateSchema = z10.object({
15627
+ action: z10.literal("update-skeleton-keypoints"),
15628
+ project: z10.string().min(1).optional(),
15629
+ styleId: z10.string().min(1),
15630
+ assetId: z10.string().min(1),
15631
+ /** The file's SHA-256 when the page loaded it; anything else on disk is a concurrent edit. */
15632
+ expectedSha256: z10.string().regex(/^[0-9a-f]{64}$/),
15633
+ set: SkeletonSetSchema
15634
+ }).strict();
15626
15635
  async function createSkeletonAnimation(manifestPath, request) {
15627
15636
  const root = path28.dirname(path28.resolve(manifestPath));
15628
15637
  const file = path28.resolve(root, request.keypointsFile);
@@ -15668,6 +15677,26 @@ async function createSkeletonAnimation(manifestPath, request) {
15668
15677
  throw error;
15669
15678
  }
15670
15679
  }
15680
+ async function updateSkeletonKeypoints(ctx, request) {
15681
+ const key = lockKey(request.styleId, request.assetId);
15682
+ const spec = ctx.specs.find((candidate) => lockKey(candidate.styleId, candidate.assetId) === key);
15683
+ if (!spec) throw new ManifestEditError(`"${key}" is not declared by the manifest`);
15684
+ const file = spec.revision?.mode === "animate-skeleton" ? spec.revision.keypointsFile : void 0;
15685
+ if (!file) throw new ManifestEditError(`${key} is not an animate-skeleton revision`);
15686
+ const relative = path28.relative(ctx.loaded.root, file);
15687
+ if (relative.startsWith("..") || path28.isAbsolute(relative)) {
15688
+ throw new ManifestEditError(`${key}'s keypoints file is outside the project; edit it by hand`);
15689
+ }
15690
+ const current = existsSync23(file) ? sha256(await readFile21(file)) : null;
15691
+ if (current !== request.expectedSha256) {
15692
+ throw Object.assign(
15693
+ new Error(`${relative.split(path28.sep).join("/")} changed on disk since this page loaded it; press Refresh and edit again`),
15694
+ { status: 409 }
15695
+ );
15696
+ }
15697
+ await writeFile12(file, JSON.stringify(request.set, null, 2) + "\n");
15698
+ return relative.split(path28.sep).join("/");
15699
+ }
15671
15700
 
15672
15701
  // src/gallery/edit.ts
15673
15702
  var Base64 = z11.string().regex(/^[A-Za-z0-9+/]*={0,2}$/).max(Math.ceil(MAX_HAND_EDIT_BYTES / 3) * 4);
@@ -15744,6 +15773,18 @@ function createGalleryEditHandler(opts) {
15744
15773
  }
15745
15774
  return opts.reload();
15746
15775
  }
15776
+ const poses = SkeletonKeypointsUpdateSchema.safeParse(body);
15777
+ if (poses.success) {
15778
+ if (!opts.loadProject) throw new ManifestEditError("pose edits are not available in this gallery");
15779
+ const written = await updateSkeletonKeypoints(await opts.loadProject(poses.data.project), poses.data);
15780
+ log(` poses saved: ${written} (${poses.data.styleId}/${poses.data.assetId} is stale until generated again)`);
15781
+ return opts.reload();
15782
+ }
15783
+ if (body?.action === "update-skeleton-keypoints") {
15784
+ throw new ManifestEditError(
15785
+ "invalid pose edit: " + poses.error.issues.slice(0, 3).map((issue) => `${issue.path.join(".")}: ${issue.message}`).join("; ")
15786
+ );
15787
+ }
15747
15788
  const skeleton = SkeletonAnimationRequestSchema.safeParse(body);
15748
15789
  if (skeleton.success) {
15749
15790
  let manifestPath2;
@@ -16117,7 +16158,8 @@ async function buildGallerySnapshot(opts) {
16117
16158
  mirrorOfKey: spec.mirror ? lockKey(spec.styleId, spec.mirror.sourceAssetId) : entry?.mirror ? lockKey(spec.styleId, entry.mirror.sourceAssetId) : null,
16118
16159
  skeleton: spec.revision?.mode === "animate-skeleton" && spec.revision.keypointsFile ? {
16119
16160
  keypointsFile: portableOutputPath(spec.revision.keypointsFile, root),
16120
- set: spec.revision.skeleton ?? null
16161
+ set: spec.revision.skeleton ?? null,
16162
+ sha256: spec.revision.keypointsSha256 ?? null
16121
16163
  } : null,
16122
16164
  character: describeCharacter(spec, entry),
16123
16165
  outputs,
@@ -16404,13 +16446,48 @@ async function buildWorkspaceGallerySnapshot(opts) {
16404
16446
  }
16405
16447
 
16406
16448
  // src/gallery/page.ts
16407
- import { readFileSync as readFileSync5 } from "fs";
16449
+ import { existsSync as existsSync25, readFileSync as readFileSync5 } from "fs";
16450
+
16451
+ // src/gallery/client-bundle.ts
16452
+ import { createRequire } from "module";
16453
+ import { fileURLToPath as fileURLToPath2 } from "url";
16454
+ function bundleGalleryClient(entry = fileURLToPath2(new URL("./client/src/main.ts", import.meta.url))) {
16455
+ const esbuild = createRequire(import.meta.url)("esbuild");
16456
+ const result = esbuild.buildSync({
16457
+ entryPoints: [entry],
16458
+ bundle: true,
16459
+ format: "iife",
16460
+ target: "es2020",
16461
+ platform: "browser",
16462
+ write: false,
16463
+ legalComments: "none",
16464
+ charset: "utf8"
16465
+ });
16466
+ return result.outputFiles[0].text;
16467
+ }
16468
+
16469
+ // src/gallery/page.ts
16470
+ function galleryContentSecurityPolicy(nonce) {
16471
+ return [
16472
+ "default-src 'self'",
16473
+ `script-src 'nonce-${nonce}'`,
16474
+ `style-src 'nonce-${nonce}'`,
16475
+ "img-src 'self' data: blob:",
16476
+ "frame-src 'self'",
16477
+ "connect-src 'self'",
16478
+ "object-src 'none'",
16479
+ "base-uri 'none'",
16480
+ "form-action 'none'",
16481
+ "frame-ancestors 'none'"
16482
+ ].join("; ");
16483
+ }
16408
16484
  var CLIENT_DIR = new URL("./client/", import.meta.url);
16409
16485
  var client;
16410
16486
  function clientAssets() {
16487
+ const prebuilt = new URL("gallery.js", CLIENT_DIR);
16411
16488
  client ??= {
16412
16489
  css: readFileSync5(new URL("gallery.css", CLIENT_DIR), "utf8"),
16413
- js: readFileSync5(new URL("gallery.js", CLIENT_DIR), "utf8")
16490
+ js: existsSync25(prebuilt) ? readFileSync5(prebuilt, "utf8") : bundleGalleryClient()
16414
16491
  };
16415
16492
  return client;
16416
16493
  }
@@ -16422,6 +16499,7 @@ function renderGallery(snapshot, opts = {}) {
16422
16499
  const editor = JSON.stringify(Boolean(opts.editor && opts.session));
16423
16500
  const title = `${snapshot.project?.name ?? "workspace"} | pixelkiln`;
16424
16501
  const { css, js } = clientAssets();
16502
+ const nonce = opts.nonce ? ` nonce="${escapeHtml2(opts.nonce)}"` : "";
16425
16503
  return `<!doctype html>
16426
16504
  <html lang="en">
16427
16505
  <head>
@@ -16429,7 +16507,7 @@ function renderGallery(snapshot, opts = {}) {
16429
16507
  <meta name="viewport" content="width=device-width, initial-scale=1">
16430
16508
  <title>${escapeHtml2(title)}</title>
16431
16509
  <link rel="icon" href="data:,">
16432
- <style>
16510
+ <style${nonce}>
16433
16511
  ${css}</style>
16434
16512
  </head>
16435
16513
  <body>
@@ -16471,7 +16549,7 @@ ${css}</style>
16471
16549
  <div id="drawer-host"></div>
16472
16550
  <div id="dialog-host"></div>
16473
16551
  <datalist id="view-options"><option value="low top-down"><option value="high top-down"><option value="side"><option value="sidescroller"></datalist>
16474
- <script>
16552
+ <script${nonce}>
16475
16553
  const INITIAL = ${data};
16476
16554
  const SESSION = ${session};
16477
16555
  const EDITABLE = ${editable};
@@ -16536,7 +16614,7 @@ var EDITOR_RELEASE_BASE = "https://github.com/gfargo/pixelkiln/releases/download
16536
16614
 
16537
16615
  // src/editor/install.ts
16538
16616
  import { createHash as createHash5 } from "crypto";
16539
- import { existsSync as existsSync25 } from "fs";
16617
+ import { existsSync as existsSync26 } from "fs";
16540
16618
  import { mkdir as mkdir10, readFile as readFile23, rename as rename9, rm as rm11, stat as stat4, writeFile as writeFile13 } from "fs/promises";
16541
16619
  import os2 from "os";
16542
16620
  import path31 from "path";
@@ -16582,7 +16660,7 @@ async function editorStatus(opts = {}) {
16582
16660
  for (const [name, expected] of Object.entries(pin.files)) {
16583
16661
  totalBytes += expected.bytes;
16584
16662
  const file = path31.join(dir, name);
16585
- const info = existsSync25(file) ? await stat4(file).catch(() => null) : null;
16663
+ const info = existsSync26(file) ? await stat4(file).catch(() => null) : null;
16586
16664
  if (info && info.size === expected.bytes && await sha256Of(file) === expected.sha256) {
16587
16665
  installedBytes += expected.bytes;
16588
16666
  } else {
@@ -16964,6 +17042,10 @@ async function serveGallery(opts) {
16964
17042
  }
16965
17043
  }
16966
17044
  if (req.method !== "GET" && req.method !== "HEAD") return fail(405, "the gallery is read-only");
17045
+ if (url2.pathname === "/api/skeleton") {
17046
+ if (!opts.skeleton) return fail(404, "skeleton estimates need the gallery started with --edit");
17047
+ return json(200, opts.skeleton.status());
17048
+ }
16967
17049
  if (url2.pathname === "/api/jobs") {
16968
17050
  if (!opts.generate) return fail(404, "generation is off");
16969
17051
  return json(200, opts.generate.status());
@@ -16997,12 +17079,15 @@ async function serveGallery(opts) {
16997
17079
  try {
16998
17080
  if (url2.pathname === "/") {
16999
17081
  const { snapshot } = await load();
17082
+ const nonce = randomBytes(16).toString("base64");
17000
17083
  res.writeHead(200, {
17001
17084
  "Content-Type": "text/html; charset=utf-8",
17002
17085
  "Cache-Control": "no-store",
17003
- "X-Content-Type-Options": "nosniff"
17086
+ "X-Content-Type-Options": "nosniff",
17087
+ "Content-Security-Policy": galleryContentSecurityPolicy(nonce)
17004
17088
  });
17005
17089
  res.end(renderGallery(snapshot, {
17090
+ nonce,
17006
17091
  ...session ? { session } : {},
17007
17092
  editable: Boolean(opts.edit),
17008
17093
  generation: Boolean(opts.generate),
@@ -17401,7 +17486,7 @@ function createGenerateHandlers(opts) {
17401
17486
 
17402
17487
  // src/pipeline/salvage.ts
17403
17488
  import { readFile as readFile26 } from "fs/promises";
17404
- import { existsSync as existsSync26 } from "fs";
17489
+ import { existsSync as existsSync27 } from "fs";
17405
17490
  import path33 from "path";
17406
17491
  function providerClaimId(provider, objectId) {
17407
17492
  return `${encodeURIComponent(provider)}:${encodeURIComponent(objectId)}`;
@@ -17409,7 +17494,7 @@ function providerClaimId(provider, objectId) {
17409
17494
  async function loadClaims(lockPaths, opts = {}) {
17410
17495
  const claimed = /* @__PURE__ */ new Set();
17411
17496
  for (const p of lockPaths) {
17412
- if (!existsSync26(p)) throw new Error(`Claim lockfile not found: ${p}`);
17497
+ if (!existsSync27(p)) throw new Error(`Claim lockfile not found: ${p}`);
17413
17498
  let parsed;
17414
17499
  try {
17415
17500
  parsed = parseLock(JSON.parse(await readFile26(p, "utf8")));
@@ -17526,7 +17611,7 @@ async function loadSiblingManifests(ownManifestPath, workspaceManifestPaths, cla
17526
17611
  const siblings = [];
17527
17612
  for (const siblingManifestPath of siblingManifestPaths) {
17528
17613
  if (path33.resolve(siblingManifestPath) === own) continue;
17529
- if (!existsSync26(siblingManifestPath)) continue;
17614
+ if (!existsSync27(siblingManifestPath)) continue;
17530
17615
  try {
17531
17616
  const { manifest } = await loadManifest(siblingManifestPath);
17532
17617
  siblings.push({ label: path33.basename(path33.dirname(siblingManifestPath)), manifest });
@@ -18175,6 +18260,7 @@ export {
18175
18260
  fontOutputPaths,
18176
18261
  formatCost,
18177
18262
  frameSetFps,
18263
+ galleryContentSecurityPolicy,
18178
18264
  galleryMediaId,
18179
18265
  galleryMediaRoute,
18180
18266
  generateFont,