@clockgrove/assetgrove 0.0.0-stage → 0.3.2
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/LICENSE +21 -0
- package/README.md +277 -2
- package/dist/animation/commands.d.ts +180 -0
- package/dist/animation/commands.js +515 -0
- package/dist/animation/facing.d.ts +44 -0
- package/dist/animation/facing.js +100 -0
- package/dist/animation/fix.d.ts +136 -0
- package/dist/animation/fix.js +529 -0
- package/dist/animation/flicker.d.ts +44 -0
- package/dist/animation/flicker.js +117 -0
- package/dist/animation/halo.d.ts +72 -0
- package/dist/animation/halo.js +253 -0
- package/dist/animation/holes.d.ts +122 -0
- package/dist/animation/holes.js +262 -0
- package/dist/animation/preview.d.ts +38 -0
- package/dist/animation/preview.js +161 -0
- package/dist/animation/qa.d.ts +57 -0
- package/dist/animation/qa.js +418 -0
- package/dist/animation/run.d.ts +109 -0
- package/dist/animation/run.js +182 -0
- package/dist/animation/strip.d.ts +13 -0
- package/dist/animation/strip.js +41 -0
- package/dist/animation/template-choice.d.ts +75 -0
- package/dist/animation/template-choice.js +153 -0
- package/dist/animation/templates.d.ts +39 -0
- package/dist/animation/templates.js +333 -0
- package/dist/animation/types.d.ts +257 -0
- package/dist/animation/types.js +1 -0
- package/dist/approvals.d.ts +156 -0
- package/dist/approvals.js +369 -0
- package/dist/audio/aac.d.ts +61 -0
- package/dist/audio/aac.js +152 -0
- package/dist/audio/checks.d.ts +38 -0
- package/dist/audio/checks.js +254 -0
- package/dist/audio/delivery.d.ts +52 -0
- package/dist/audio/delivery.js +105 -0
- package/dist/audio/engine.d.ts +65 -0
- package/dist/audio/engine.js +164 -0
- package/dist/audio/handoff.d.ts +75 -0
- package/dist/audio/handoff.js +185 -0
- package/dist/audio/kinds.d.ts +6 -0
- package/dist/audio/kinds.js +315 -0
- package/dist/audio/loudness.d.ts +22 -0
- package/dist/audio/loudness.js +72 -0
- package/dist/audio/ogg.d.ts +27 -0
- package/dist/audio/ogg.js +65 -0
- package/dist/audio/operations.d.ts +20 -0
- package/dist/audio/operations.js +335 -0
- package/dist/audio/opus.d.ts +40 -0
- package/dist/audio/opus.js +108 -0
- package/dist/audio/profile.d.ts +200 -0
- package/dist/audio/profile.js +126 -0
- package/dist/audio/run.d.ts +83 -0
- package/dist/audio/run.js +192 -0
- package/dist/audio/vorbis-comments.d.ts +25 -0
- package/dist/audio/vorbis-comments.js +243 -0
- package/dist/audio/waveform.d.ts +13 -0
- package/dist/audio/waveform.js +52 -0
- package/dist/audio-parameters.d.ts +17 -0
- package/dist/audio-parameters.js +45 -0
- package/dist/audit/bar.d.ts +65 -0
- package/dist/audit/bar.js +97 -0
- package/dist/audit/members.d.ts +40 -0
- package/dist/audit/members.js +119 -0
- package/dist/bible-view.d.ts +10 -0
- package/dist/bible-view.js +122 -0
- package/dist/bible.d.ts +272 -0
- package/dist/bible.js +641 -0
- package/dist/budget.d.ts +119 -0
- package/dist/budget.js +227 -0
- package/dist/call-parameters.d.ts +71 -0
- package/dist/call-parameters.js +90 -0
- package/dist/calls.d.ts +145 -0
- package/dist/calls.js +788 -0
- package/dist/cli/main.d.ts +22 -0
- package/dist/cli/main.js +137 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +5 -0
- package/dist/commands/animation-qa.d.ts +1 -0
- package/dist/commands/animation-qa.js +240 -0
- package/dist/commands/apply.d.ts +12 -0
- package/dist/commands/apply.js +181 -0
- package/dist/commands/audit.d.ts +92 -0
- package/dist/commands/audit.js +555 -0
- package/dist/commands/bible.d.ts +1 -0
- package/dist/commands/bible.js +39 -0
- package/dist/commands/browse.d.ts +12 -0
- package/dist/commands/browse.js +113 -0
- package/dist/commands/card.d.ts +3 -0
- package/dist/commands/card.js +445 -0
- package/dist/commands/compare.d.ts +1 -0
- package/dist/commands/compare.js +90 -0
- package/dist/commands/confirm.d.ts +1 -0
- package/dist/commands/confirm.js +267 -0
- package/dist/commands/context.d.ts +43 -0
- package/dist/commands/context.js +115 -0
- package/dist/commands/deliver.d.ts +1 -0
- package/dist/commands/deliver.js +99 -0
- package/dist/commands/disclosure.d.ts +1 -0
- package/dist/commands/disclosure.js +80 -0
- package/dist/commands/doctor.d.ts +1 -0
- package/dist/commands/doctor.js +112 -0
- package/dist/commands/estimate.d.ts +2 -0
- package/dist/commands/estimate.js +80 -0
- package/dist/commands/extensions.d.ts +2 -0
- package/dist/commands/extensions.js +70 -0
- package/dist/commands/fix-frame.d.ts +1 -0
- package/dist/commands/fix-frame.js +206 -0
- package/dist/commands/generate-sheet.d.ts +1 -0
- package/dist/commands/generate-sheet.js +245 -0
- package/dist/commands/identity-check.d.ts +1 -0
- package/dist/commands/identity-check.js +110 -0
- package/dist/commands/identity-eval.d.ts +1 -0
- package/dist/commands/identity-eval.js +197 -0
- package/dist/commands/import.d.ts +7 -0
- package/dist/commands/import.js +472 -0
- package/dist/commands/init.d.ts +1 -0
- package/dist/commands/init.js +117 -0
- package/dist/commands/intake.d.ts +1 -0
- package/dist/commands/intake.js +56 -0
- package/dist/commands/labels.d.ts +1 -0
- package/dist/commands/labels.js +101 -0
- package/dist/commands/library.d.ts +9 -0
- package/dist/commands/library.js +711 -0
- package/dist/commands/lod.d.ts +1 -0
- package/dist/commands/lod.js +93 -0
- package/dist/commands/look-dev.d.ts +1 -0
- package/dist/commands/look-dev.js +148 -0
- package/dist/commands/materials.d.ts +1 -0
- package/dist/commands/materials.js +223 -0
- package/dist/commands/mcp.d.ts +1 -0
- package/dist/commands/mcp.js +53 -0
- package/dist/commands/migrate.d.ts +1 -0
- package/dist/commands/migrate.js +123 -0
- package/dist/commands/op.d.ts +5 -0
- package/dist/commands/op.js +114 -0
- package/dist/commands/ops.d.ts +1 -0
- package/dist/commands/ops.js +17 -0
- package/dist/commands/pick-batch.d.ts +24 -0
- package/dist/commands/pick-batch.js +343 -0
- package/dist/commands/pick.d.ts +48 -0
- package/dist/commands/pick.js +469 -0
- package/dist/commands/plan.d.ts +3 -0
- package/dist/commands/plan.js +156 -0
- package/dist/commands/recipe.d.ts +1 -0
- package/dist/commands/recipe.js +52 -0
- package/dist/commands/registry.d.ts +5 -0
- package/dist/commands/registry.js +121 -0
- package/dist/commands/render-sprite.d.ts +1 -0
- package/dist/commands/render-sprite.js +67 -0
- package/dist/commands/rendition.d.ts +1 -0
- package/dist/commands/rendition.js +56 -0
- package/dist/commands/request-change.d.ts +2 -0
- package/dist/commands/request-change.js +950 -0
- package/dist/commands/result.d.ts +34 -0
- package/dist/commands/result.js +237 -0
- package/dist/commands/review.d.ts +28 -0
- package/dist/commands/review.js +444 -0
- package/dist/commands/rig.d.ts +1 -0
- package/dist/commands/rig.js +74 -0
- package/dist/commands/runner.d.ts +45 -0
- package/dist/commands/runner.js +297 -0
- package/dist/commands/runs.d.ts +22 -0
- package/dist/commands/runs.js +159 -0
- package/dist/commands/search.d.ts +69 -0
- package/dist/commands/search.js +638 -0
- package/dist/commands/settings.d.ts +2 -0
- package/dist/commands/settings.js +284 -0
- package/dist/commands/spend.d.ts +2 -0
- package/dist/commands/spend.js +159 -0
- package/dist/commands/stage-source.d.ts +1 -0
- package/dist/commands/stage-source.js +58 -0
- package/dist/commands/stage.d.ts +9 -0
- package/dist/commands/stage.js +229 -0
- package/dist/commands/storage.d.ts +3 -0
- package/dist/commands/storage.js +200 -0
- package/dist/commands/turnaround.d.ts +1 -0
- package/dist/commands/turnaround.js +171 -0
- package/dist/commands/types.d.ts +195 -0
- package/dist/commands/types.js +7 -0
- package/dist/commands/vary.d.ts +2 -0
- package/dist/commands/vary.js +222 -0
- package/dist/commands/write-families.d.ts +14 -0
- package/dist/commands/write-families.js +158 -0
- package/dist/compare.d.ts +87 -0
- package/dist/compare.js +306 -0
- package/dist/confirm/delegation.d.ts +30 -0
- package/dist/confirm/delegation.js +31 -0
- package/dist/confirm/index.d.ts +84 -0
- package/dist/confirm/index.js +176 -0
- package/dist/confirm/mcp.d.ts +60 -0
- package/dist/confirm/mcp.js +253 -0
- package/dist/confirm/pending.d.ts +11 -0
- package/dist/confirm/pending.js +40 -0
- package/dist/confirm/prompt.d.ts +65 -0
- package/dist/confirm/prompt.js +68 -0
- package/dist/confirm/records.d.ts +17 -0
- package/dist/confirm/records.js +63 -0
- package/dist/contact.d.ts +80 -0
- package/dist/contact.js +224 -0
- package/dist/credentials.d.ts +170 -0
- package/dist/credentials.js +598 -0
- package/dist/dataflows.d.ts +32 -0
- package/dist/dataflows.js +42 -0
- package/dist/delivery.d.ts +89 -0
- package/dist/delivery.js +355 -0
- package/dist/disclosure.d.ts +84 -0
- package/dist/disclosure.js +397 -0
- package/dist/env.d.ts +90 -0
- package/dist/env.js +236 -0
- package/dist/errors.d.ts +90 -0
- package/dist/errors.js +105 -0
- package/dist/extension/api.d.ts +389 -0
- package/dist/extension/api.js +20 -0
- package/dist/extension/context.d.ts +9 -0
- package/dist/extension/context.js +60 -0
- package/dist/extension/helpers.d.ts +75 -0
- package/dist/extension/helpers.js +107 -0
- package/dist/extension/http.d.ts +32 -0
- package/dist/extension/http.js +104 -0
- package/dist/extension/setup.d.ts +53 -0
- package/dist/extension/setup.js +162 -0
- package/dist/extension/tools.d.ts +97 -0
- package/dist/extension/tools.js +235 -0
- package/dist/extensions/core.d.ts +7 -0
- package/dist/extensions/core.js +18 -0
- package/dist/extensions/errors.d.ts +22 -0
- package/dist/extensions/errors.js +34 -0
- package/dist/extensions/registry.d.ts +119 -0
- package/dist/extensions/registry.js +535 -0
- package/dist/extensions/version.d.ts +9 -0
- package/dist/extensions/version.js +57 -0
- package/dist/formats.d.ts +46 -0
- package/dist/formats.js +81 -0
- package/dist/frames.d.ts +58 -0
- package/dist/frames.js +80 -0
- package/dist/gateway/anthropic.d.ts +22 -0
- package/dist/gateway/anthropic.js +65 -0
- package/dist/gateway/elevenlabs.d.ts +36 -0
- package/dist/gateway/elevenlabs.js +192 -0
- package/dist/gateway/failure.d.ts +29 -0
- package/dist/gateway/failure.js +70 -0
- package/dist/gateway/openai-compatible.d.ts +20 -0
- package/dist/gateway/openai-compatible.js +76 -0
- package/dist/gateway/openai.d.ts +28 -0
- package/dist/gateway/openai.js +101 -0
- package/dist/gateway/provider.d.ts +380 -0
- package/dist/gateway/provider.js +5 -0
- package/dist/gateway/scripted.d.ts +252 -0
- package/dist/gateway/scripted.js +244 -0
- package/dist/gateway/stability.d.ts +38 -0
- package/dist/gateway/stability.js +232 -0
- package/dist/gateway/structured.d.ts +31 -0
- package/dist/gateway/structured.js +83 -0
- package/dist/gateway/tripo.d.ts +48 -0
- package/dist/gateway/tripo.js +374 -0
- package/dist/gateway/vercel.d.ts +52 -0
- package/dist/gateway/vercel.js +298 -0
- package/dist/generators/generator.d.ts +236 -0
- package/dist/generators/generator.js +12 -0
- package/dist/generators/image.d.ts +21 -0
- package/dist/generators/image.js +286 -0
- package/dist/generators/spec-schema.d.ts +29 -0
- package/dist/generators/spec-schema.js +21 -0
- package/dist/git-marker.d.ts +3 -0
- package/dist/git-marker.js +13 -0
- package/dist/gitlfs.d.ts +38 -0
- package/dist/gitlfs.js +171 -0
- package/dist/guard.d.ts +55 -0
- package/dist/guard.js +323 -0
- package/dist/handoff/current-profile.d.ts +48 -0
- package/dist/handoff/current-profile.js +127 -0
- package/dist/handoff/doctor.d.ts +26 -0
- package/dist/handoff/doctor.js +249 -0
- package/dist/handoff/mark-check.d.ts +17 -0
- package/dist/handoff/mark-check.js +66 -0
- package/dist/handoff/presets/aseprite-json.d.ts +5 -0
- package/dist/handoff/presets/aseprite-json.js +45 -0
- package/dist/handoff/presets/atlas-json.d.ts +44 -0
- package/dist/handoff/presets/atlas-json.js +195 -0
- package/dist/handoff/presets/atlas-pack.d.ts +14 -0
- package/dist/handoff/presets/atlas-pack.js +431 -0
- package/dist/handoff/presets/index.d.ts +273 -0
- package/dist/handoff/presets/index.js +58 -0
- package/dist/handoff/presets/manifest.d.ts +2 -0
- package/dist/handoff/presets/manifest.js +49 -0
- package/dist/handoff/usage.d.ts +27 -0
- package/dist/handoff/usage.js +159 -0
- package/dist/handoff.d.ts +345 -0
- package/dist/handoff.js +1221 -0
- package/dist/identity-eval.d.ts +156 -0
- package/dist/identity-eval.js +321 -0
- package/dist/identity.d.ts +293 -0
- package/dist/identity.js +675 -0
- package/dist/image/apply-style.d.ts +4 -0
- package/dist/image/apply-style.js +37 -0
- package/dist/image/digits.d.ts +5 -0
- package/dist/image/digits.js +40 -0
- package/dist/image/ktx2.d.ts +83 -0
- package/dist/image/ktx2.js +196 -0
- package/dist/image/raster.d.ts +23 -0
- package/dist/image/raster.js +77 -0
- package/dist/image/resample.d.ts +10 -0
- package/dist/image/resample.js +82 -0
- package/dist/image/webp.d.ts +17 -0
- package/dist/image/webp.js +323 -0
- package/dist/init.d.ts +132 -0
- package/dist/init.js +425 -0
- package/dist/inputs.d.ts +67 -0
- package/dist/inputs.js +151 -0
- package/dist/json.d.ts +7 -0
- package/dist/json.js +27 -0
- package/dist/keys.d.ts +34 -0
- package/dist/keys.js +198 -0
- package/dist/kind-schemas.d.ts +17 -0
- package/dist/kind-schemas.js +205 -0
- package/dist/library/actions.d.ts +76 -0
- package/dist/library/actions.js +212 -0
- package/dist/library/adopt.d.ts +177 -0
- package/dist/library/adopt.js +624 -0
- package/dist/library/canonical.d.ts +7 -0
- package/dist/library/canonical.js +29 -0
- package/dist/library/card.d.ts +138 -0
- package/dist/library/card.js +532 -0
- package/dist/library/credits.d.ts +70 -0
- package/dist/library/credits.js +222 -0
- package/dist/library/describe.d.ts +48 -0
- package/dist/library/describe.js +199 -0
- package/dist/library/diff.d.ts +26 -0
- package/dist/library/diff.js +208 -0
- package/dist/library/exact.d.ts +15 -0
- package/dist/library/exact.js +47 -0
- package/dist/library/extent.d.ts +56 -0
- package/dist/library/extent.js +205 -0
- package/dist/library/folder.d.ts +85 -0
- package/dist/library/folder.js +291 -0
- package/dist/library/labels.d.ts +29 -0
- package/dist/library/labels.js +112 -0
- package/dist/library/lfs.d.ts +42 -0
- package/dist/library/lfs.js +140 -0
- package/dist/library/maintain.d.ts +100 -0
- package/dist/library/maintain.js +750 -0
- package/dist/library/media-metadata.d.ts +19 -0
- package/dist/library/media-metadata.js +92 -0
- package/dist/library/paths.d.ts +7 -0
- package/dist/library/paths.js +65 -0
- package/dist/library/relations.d.ts +59 -0
- package/dist/library/relations.js +176 -0
- package/dist/library/review.d.ts +204 -0
- package/dist/library/review.js +545 -0
- package/dist/library/stale.d.ts +88 -0
- package/dist/library/stale.js +229 -0
- package/dist/library/suggestions.d.ts +37 -0
- package/dist/library/suggestions.js +146 -0
- package/dist/library/summary.d.ts +65 -0
- package/dist/library/summary.js +138 -0
- package/dist/library/undo.d.ts +18 -0
- package/dist/library/undo.js +141 -0
- package/dist/library/worklist.d.ts +42 -0
- package/dist/library/worklist.js +91 -0
- package/dist/library/write.d.ts +282 -0
- package/dist/library/write.js +790 -0
- package/dist/license.d.ts +67 -0
- package/dist/license.js +205 -0
- package/dist/limits.d.ts +51 -0
- package/dist/limits.js +100 -0
- package/dist/loop.d.ts +244 -0
- package/dist/loop.js +377 -0
- package/dist/material/core.d.ts +70 -0
- package/dist/material/core.js +238 -0
- package/dist/material/engine.d.ts +15 -0
- package/dist/material/engine.js +141 -0
- package/dist/material/flicker.d.ts +26 -0
- package/dist/material/flicker.js +71 -0
- package/dist/material/operations.d.ts +2 -0
- package/dist/material/operations.js +48 -0
- package/dist/material/pipeline.d.ts +51 -0
- package/dist/material/pipeline.js +431 -0
- package/dist/material/profile.d.ts +29 -0
- package/dist/material/profile.js +97 -0
- package/dist/material/rendition.d.ts +5 -0
- package/dist/material/rendition.js +76 -0
- package/dist/mcp.d.ts +72 -0
- package/dist/mcp.js +514 -0
- package/dist/media.d.ts +36 -0
- package/dist/media.js +46 -0
- package/dist/metadata.d.ts +61 -0
- package/dist/metadata.js +748 -0
- package/dist/model-declarations.d.ts +28 -0
- package/dist/model-declarations.js +14 -0
- package/dist/model3d/clip-map.d.ts +49 -0
- package/dist/model3d/clip-map.js +129 -0
- package/dist/model3d/core-checks.d.ts +61 -0
- package/dist/model3d/core-checks.js +278 -0
- package/dist/model3d/facing.d.ts +49 -0
- package/dist/model3d/facing.js +125 -0
- package/dist/model3d/generator.d.ts +19 -0
- package/dist/model3d/generator.js +482 -0
- package/dist/model3d/glb.d.ts +120 -0
- package/dist/model3d/glb.js +155 -0
- package/dist/model3d/handoff.d.ts +37 -0
- package/dist/model3d/handoff.js +131 -0
- package/dist/model3d/lod/chain.d.ts +50 -0
- package/dist/model3d/lod/chain.js +447 -0
- package/dist/model3d/lod/command.d.ts +38 -0
- package/dist/model3d/lod/command.js +377 -0
- package/dist/model3d/lod/qa.d.ts +36 -0
- package/dist/model3d/lod/qa.js +189 -0
- package/dist/model3d/lod/settings.d.ts +36 -0
- package/dist/model3d/lod/settings.js +137 -0
- package/dist/model3d/lod/simplify.d.ts +35 -0
- package/dist/model3d/lod/simplify.js +337 -0
- package/dist/model3d/lod/textures.d.ts +46 -0
- package/dist/model3d/lod/textures.js +190 -0
- package/dist/model3d/lookdev/command.d.ts +219 -0
- package/dist/model3d/lookdev/command.js +1795 -0
- package/dist/model3d/lookdev/edit.d.ts +44 -0
- package/dist/model3d/lookdev/edit.js +241 -0
- package/dist/model3d/lookdev/groom.d.ts +86 -0
- package/dist/model3d/lookdev/groom.js +462 -0
- package/dist/model3d/lookdev/markings.d.ts +98 -0
- package/dist/model3d/lookdev/markings.js +319 -0
- package/dist/model3d/lookdev/project.d.ts +100 -0
- package/dist/model3d/lookdev/project.js +721 -0
- package/dist/model3d/lookdev/settings.d.ts +65 -0
- package/dist/model3d/lookdev/settings.js +103 -0
- package/dist/model3d/lookdev/texels.d.ts +32 -0
- package/dist/model3d/lookdev/texels.js +192 -0
- package/dist/model3d/profile.d.ts +101 -0
- package/dist/model3d/profile.js +132 -0
- package/dist/model3d/prop.d.ts +29 -0
- package/dist/model3d/prop.js +317 -0
- package/dist/model3d/qa.d.ts +27 -0
- package/dist/model3d/qa.js +105 -0
- package/dist/model3d/render.d.ts +172 -0
- package/dist/model3d/render.js +791 -0
- package/dist/model3d/rig/build.d.ts +14 -0
- package/dist/model3d/rig/build.js +210 -0
- package/dist/model3d/rig/candidate.d.ts +50 -0
- package/dist/model3d/rig/candidate.js +132 -0
- package/dist/model3d/rig/command.d.ts +50 -0
- package/dist/model3d/rig/command.js +229 -0
- package/dist/model3d/rig/fit.d.ts +88 -0
- package/dist/model3d/rig/fit.js +568 -0
- package/dist/model3d/rig/gait.d.ts +105 -0
- package/dist/model3d/rig/gait.js +334 -0
- package/dist/model3d/rig/math.d.ts +27 -0
- package/dist/model3d/rig/math.js +92 -0
- package/dist/model3d/rig/motion.d.ts +26 -0
- package/dist/model3d/rig/motion.js +223 -0
- package/dist/model3d/rig/qa.d.ts +76 -0
- package/dist/model3d/rig/qa.js +357 -0
- package/dist/model3d/rig/rig.d.ts +55 -0
- package/dist/model3d/rig/rig.js +213 -0
- package/dist/model3d/rig/template.d.ts +195 -0
- package/dist/model3d/rig/template.js +456 -0
- package/dist/model3d/scene.d.ts +115 -0
- package/dist/model3d/scene.js +684 -0
- package/dist/model3d/views.d.ts +77 -0
- package/dist/model3d/views.js +190 -0
- package/dist/origin.d.ts +162 -0
- package/dist/origin.js +134 -0
- package/dist/paths.d.ts +53 -0
- package/dist/paths.js +240 -0
- package/dist/planning.d.ts +261 -0
- package/dist/planning.js +1470 -0
- package/dist/policy/blocklist.d.ts +28 -0
- package/dist/policy/blocklist.js +58 -0
- package/dist/policy/brief.d.ts +67 -0
- package/dist/policy/brief.js +110 -0
- package/dist/policy/cuts.d.ts +26 -0
- package/dist/policy/cuts.js +80 -0
- package/dist/policy/model.d.ts +69 -0
- package/dist/policy/model.js +202 -0
- package/dist/policy/text.d.ts +183 -0
- package/dist/policy/text.js +285 -0
- package/dist/postprocess.d.ts +68 -0
- package/dist/postprocess.js +302 -0
- package/dist/profile.d.ts +5 -0
- package/dist/profile.js +98 -0
- package/dist/project-rules.d.ts +54 -0
- package/dist/project-rules.js +105 -0
- package/dist/provenance-binding.d.ts +55 -0
- package/dist/provenance-binding.js +352 -0
- package/dist/providers/adapter.d.ts +176 -0
- package/dist/providers/adapter.js +418 -0
- package/dist/providers/index.d.ts +33 -0
- package/dist/providers/index.js +49 -0
- package/dist/providers/script.d.ts +13 -0
- package/dist/providers/script.js +65 -0
- package/dist/providers/set.d.ts +76 -0
- package/dist/providers/set.js +134 -0
- package/dist/pure-cbor.d.ts +1 -0
- package/dist/pure-cbor.js +8 -0
- package/dist/qa/stability.d.ts +215 -0
- package/dist/qa/stability.js +393 -0
- package/dist/qa/stability.json +32 -0
- package/dist/qa.d.ts +36 -0
- package/dist/qa.js +148 -0
- package/dist/reconcile.d.ts +111 -0
- package/dist/reconcile.js +416 -0
- package/dist/redact.d.ts +29 -0
- package/dist/redact.js +74 -0
- package/dist/regions.d.ts +49 -0
- package/dist/regions.js +113 -0
- package/dist/release-policy.d.ts +99 -0
- package/dist/release-policy.js +266 -0
- package/dist/request.d.ts +74 -0
- package/dist/request.js +249 -0
- package/dist/routes.d.ts +327 -0
- package/dist/routes.js +1166 -0
- package/dist/runs/dir.d.ts +33 -0
- package/dist/runs/dir.js +30 -0
- package/dist/runs/execute.d.ts +86 -0
- package/dist/runs/execute.js +422 -0
- package/dist/runs/journal.d.ts +150 -0
- package/dist/runs/journal.js +216 -0
- package/dist/runs/lock.d.ts +57 -0
- package/dist/runs/lock.js +322 -0
- package/dist/runs/plan.d.ts +261 -0
- package/dist/runs/plan.js +404 -0
- package/dist/search/near-match.d.ts +32 -0
- package/dist/search/near-match.js +86 -0
- package/dist/search/reader.d.ts +17 -0
- package/dist/search/reader.js +334 -0
- package/dist/search/sheet.d.ts +4 -0
- package/dist/search/sheet.js +28 -0
- package/dist/search/style-outliers.d.ts +77 -0
- package/dist/search/style-outliers.js +166 -0
- package/dist/settings-write.d.ts +78 -0
- package/dist/settings-write.js +374 -0
- package/dist/settings.d.ts +436 -0
- package/dist/settings.js +622 -0
- package/dist/shared-settings.d.ts +4 -0
- package/dist/shared-settings.js +24 -0
- package/dist/sheet/blobs.d.ts +33 -0
- package/dist/sheet/blobs.js +145 -0
- package/dist/sheet/generate.d.ts +71 -0
- package/dist/sheet/generate.js +278 -0
- package/dist/sheet/group.d.ts +20 -0
- package/dist/sheet/group.js +191 -0
- package/dist/sheet/import.d.ts +315 -0
- package/dist/sheet/import.js +832 -0
- package/dist/sheet/matte.d.ts +25 -0
- package/dist/sheet/matte.js +508 -0
- package/dist/sheet/media-import.d.ts +41 -0
- package/dist/sheet/media-import.js +118 -0
- package/dist/sheet/register.d.ts +17 -0
- package/dist/sheet/register.js +176 -0
- package/dist/sheet/slice.d.ts +73 -0
- package/dist/sheet/slice.js +912 -0
- package/dist/sheet/types.d.ts +225 -0
- package/dist/sheet/types.js +1 -0
- package/dist/source/aseprite.d.ts +14 -0
- package/dist/source/aseprite.js +124 -0
- package/dist/source/stage.d.ts +24 -0
- package/dist/source/stage.js +172 -0
- package/dist/spend.d.ts +220 -0
- package/dist/spend.js +436 -0
- package/dist/sprite/render.d.ts +22 -0
- package/dist/sprite/render.js +272 -0
- package/dist/storage.d.ts +135 -0
- package/dist/storage.js +405 -0
- package/dist/style.d.ts +19 -0
- package/dist/style.js +26 -0
- package/dist/template.d.ts +29 -0
- package/dist/template.js +98 -0
- package/dist/testing/aseprite.d.ts +54 -0
- package/dist/testing/aseprite.js +191 -0
- package/dist/testing/cli.d.ts +24 -0
- package/dist/testing/cli.js +91 -0
- package/dist/testing/conformance.d.ts +61 -0
- package/dist/testing/conformance.js +455 -0
- package/dist/testing/index.d.ts +23 -0
- package/dist/testing/index.js +15 -0
- package/dist/testing/mcp.d.ts +25 -0
- package/dist/testing/mcp.js +80 -0
- package/dist/testing/project.d.ts +81 -0
- package/dist/testing/project.js +215 -0
- package/dist/testing/samples.d.ts +42 -0
- package/dist/testing/samples.js +122 -0
- package/dist/transform/operations.d.ts +5 -0
- package/dist/transform/operations.js +320 -0
- package/dist/transform/raster-engine.d.ts +9 -0
- package/dist/transform/raster-engine.js +329 -0
- package/dist/transform/rendition.d.ts +65 -0
- package/dist/transform/rendition.js +317 -0
- package/dist/transform/run.d.ts +138 -0
- package/dist/transform/run.js +442 -0
- package/dist/transform/schema.d.ts +33 -0
- package/dist/transform/schema.js +73 -0
- package/dist/transform/types.d.ts +101 -0
- package/dist/transform/types.js +1 -0
- package/dist/tree/address.d.ts +18 -0
- package/dist/tree/address.js +59 -0
- package/dist/tree/list.d.ts +18 -0
- package/dist/tree/list.js +101 -0
- package/dist/tree/project.d.ts +61 -0
- package/dist/tree/project.js +145 -0
- package/dist/tree/read.d.ts +43 -0
- package/dist/tree/read.js +715 -0
- package/dist/tree/search.d.ts +20 -0
- package/dist/tree/search.js +44 -0
- package/dist/tree/serve.d.ts +79 -0
- package/dist/tree/serve.js +415 -0
- package/dist/tree/thumbs.d.ts +26 -0
- package/dist/tree/thumbs.js +134 -0
- package/dist/turnaround.d.ts +195 -0
- package/dist/turnaround.js +622 -0
- package/dist/types.d.ts +595 -0
- package/dist/types.js +1 -0
- package/package.json +112 -3
- package/policy/blocklist.json +47 -0
- package/policy/prompt-policy-cuts.json +15 -0
- package/skills/art-direction/SKILL.md +16 -0
- package/skills/art-direction/default.md +14 -0
- package/skills/art-direction/presets/cozy-storybook.md +121 -0
- package/skills/art-direction/presets/dark-gritty-isometric.md +121 -0
- package/skills/art-direction/presets/flat-cartoon-kids.md +121 -0
- package/skills/art-direction/references/bible-format.md +47 -0
- package/skills/assetgrove/SKILL.md +109 -0
- package/skills/assetgrove/references/commands.md +723 -0
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import type { Caller } from "../calls.ts";
|
|
2
|
+
import type { PlannedCall } from "../generators/generator.ts";
|
|
3
|
+
import type { Raster } from "../image/raster.ts";
|
|
4
|
+
import type { Routes } from "../routes.ts";
|
|
5
|
+
import type { ResolvedStyle } from "../style.ts";
|
|
6
|
+
import type { CallRecord, LoadedReference, Point, Provenance, Size, Transform } from "../types.ts";
|
|
7
|
+
export declare const DEFAULT_FIX_CAP_USD = 2;
|
|
8
|
+
export type FixSource = {
|
|
9
|
+
neighbour: number;
|
|
10
|
+
} | {
|
|
11
|
+
keyPose: {
|
|
12
|
+
path: string;
|
|
13
|
+
sha256: string;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
/** One recorded fix of one frame. */
|
|
17
|
+
export interface FrameFix {
|
|
18
|
+
/** 1-based frame number. */
|
|
19
|
+
frame: number;
|
|
20
|
+
from: FixSource;
|
|
21
|
+
prompt: string;
|
|
22
|
+
model: string;
|
|
23
|
+
requestId: string;
|
|
24
|
+
seed?: number;
|
|
25
|
+
costUsd: number;
|
|
26
|
+
at: string;
|
|
27
|
+
beforeHash: string;
|
|
28
|
+
afterHash: string;
|
|
29
|
+
/**
|
|
30
|
+
* The matte step that cut the edited frame from its backdrop, when the edit came back opaque:
|
|
31
|
+
* names the background the edge-halo check measures the frame's fringe against (#548).
|
|
32
|
+
*/
|
|
33
|
+
matte?: Transform;
|
|
34
|
+
/** The size the frame was registered at: the candidates, the one chosen and who chose it. */
|
|
35
|
+
scale?: {
|
|
36
|
+
chosen: string;
|
|
37
|
+
value: number;
|
|
38
|
+
candidates: Record<string, number>;
|
|
39
|
+
/** Present when the candidates differed and the `fix-scale` decision was asked. */
|
|
40
|
+
decision?: {
|
|
41
|
+
model: string;
|
|
42
|
+
requestId: string;
|
|
43
|
+
probability?: number;
|
|
44
|
+
costUsd: number;
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
/** The edit, and the `fix-scale` decision (an upper bound: it is made only when candidates differ). */
|
|
49
|
+
export declare function planFix(routes: Routes): PlannedCall[];
|
|
50
|
+
export declare function buildFixPrompt(input: {
|
|
51
|
+
subject: string;
|
|
52
|
+
family: string;
|
|
53
|
+
frame: number;
|
|
54
|
+
count: number;
|
|
55
|
+
source: "neighbour" | "key pose";
|
|
56
|
+
sourceFrame?: number;
|
|
57
|
+
note?: string;
|
|
58
|
+
}): string;
|
|
59
|
+
export interface FixFrameOptions {
|
|
60
|
+
strip: Raster;
|
|
61
|
+
frame: Size;
|
|
62
|
+
anchor: Point;
|
|
63
|
+
family: string;
|
|
64
|
+
/**
|
|
65
|
+
* The point the fixed frame is registered by, the one its family's strip was registered by
|
|
66
|
+
* (`registrationPin`). The fixed frame's pin point is put on the reference neighbour's measured
|
|
67
|
+
* pin point (and its bottom row on the neighbour's, when the neighbour is on the ground), so a planted family's repaired frame keeps
|
|
68
|
+
* its feet on its neighbours' however the strip was placed; `anchor` is used only for a strip of
|
|
69
|
+
* one frame.
|
|
70
|
+
*/
|
|
71
|
+
pin: "center" | "footprint";
|
|
72
|
+
/**
|
|
73
|
+
* The ground-contact tolerance, a fraction of the figure's height (the profile's
|
|
74
|
+
* `groundTolerance`). The fixed frame's bottom row goes on the neighbour's only when the
|
|
75
|
+
* neighbour stands within it of `anchor.y`; a neighbour off the ground (an airborne beat) leaves
|
|
76
|
+
* the fixed frame on the ground line.
|
|
77
|
+
*/
|
|
78
|
+
groundTolerance?: number;
|
|
79
|
+
subject: string;
|
|
80
|
+
/**
|
|
81
|
+
* Whether the family's cycle loops (its motion template's `loop`). The `fix-scale` decision
|
|
82
|
+
* draws the fixed frame over its neighbours as the onion sheet does, so in a loop the first
|
|
83
|
+
* frame's previous is the last frame and the last frame's next is the first.
|
|
84
|
+
*/
|
|
85
|
+
loop?: boolean;
|
|
86
|
+
/** 1-based frame to fix. */
|
|
87
|
+
index: number;
|
|
88
|
+
from: {
|
|
89
|
+
neighbour: number;
|
|
90
|
+
} | {
|
|
91
|
+
keyPose: LoadedReference;
|
|
92
|
+
};
|
|
93
|
+
style: ResolvedStyle;
|
|
94
|
+
call: Caller;
|
|
95
|
+
/**
|
|
96
|
+
* Calls made for this fix before its edit (the motion-template decision that chose its
|
|
97
|
+
* registration pin): recorded in its provenance ahead of the edit call.
|
|
98
|
+
*/
|
|
99
|
+
decisions?: CallRecord[];
|
|
100
|
+
note?: string;
|
|
101
|
+
provenance?: Provenance;
|
|
102
|
+
stripPath?: string;
|
|
103
|
+
/** The license recorded when the strip has no provenance yet (the target profile's). */
|
|
104
|
+
license?: string;
|
|
105
|
+
/** The style bible version recorded when the strip has no provenance yet. */
|
|
106
|
+
bibleVersion?: string;
|
|
107
|
+
now?: () => Date;
|
|
108
|
+
}
|
|
109
|
+
type FixedProvenance = Provenance & {
|
|
110
|
+
fixes?: FrameFix[];
|
|
111
|
+
};
|
|
112
|
+
/**
|
|
113
|
+
* What stops a record from being extended by a fix, one entry per field the fix reads or appends
|
|
114
|
+
* to. Empty for a strip's provenance (write-families, stage and pick, an earlier fix).
|
|
115
|
+
*/
|
|
116
|
+
export declare function provenanceProblems(value: unknown): string[];
|
|
117
|
+
/**
|
|
118
|
+
* The record a fix extends, from a provenance file Assetgrove wrote. A strip's own provenance is
|
|
119
|
+
* kept as it is. A transform record (`recipe`, `op`) that lists this strip among its outputs
|
|
120
|
+
* becomes a provenance carrying the record's sources, steps, output and third-party origin. Anything else is refused
|
|
121
|
+
* with an InputError, so it is caught before any call is made.
|
|
122
|
+
*/
|
|
123
|
+
export declare function fixBaseProvenance(value: unknown, input: {
|
|
124
|
+
strip: Raster;
|
|
125
|
+
source: string;
|
|
126
|
+
license: string;
|
|
127
|
+
bibleVersion?: string;
|
|
128
|
+
at: string;
|
|
129
|
+
}): Provenance;
|
|
130
|
+
export declare function fixFrame(options: FixFrameOptions): Promise<{
|
|
131
|
+
strip: Raster;
|
|
132
|
+
frame: Raster;
|
|
133
|
+
provenance: FixedProvenance;
|
|
134
|
+
fix: FrameFix;
|
|
135
|
+
}>;
|
|
136
|
+
export {};
|
|
@@ -0,0 +1,529 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The per-frame fix: one bad frame of a strip is regenerated as a reference-guided edit from an
|
|
3
|
+
* approved neighbour or the key pose, registered like every other frame and spliced back in. Only
|
|
4
|
+
* that frame changes, and provenance records the call, the source and the pixels before and after.
|
|
5
|
+
*/
|
|
6
|
+
import { InputError, ProviderError } from "../errors.js";
|
|
7
|
+
import { decodeImage, encodePng } from "../image/raster.js";
|
|
8
|
+
import { forDecision } from "../identity.js";
|
|
9
|
+
import { DIGITAL_SOURCE_TYPES, combineDigitalSourceTypes } from "../metadata.js";
|
|
10
|
+
import { sha256 } from "../request.js";
|
|
11
|
+
import { measureFrame, pinX } from "../sheet/register.js";
|
|
12
|
+
import { sheetImportRecipe } from "../sheet/import.js";
|
|
13
|
+
import { pixelHash, runOperation, runRecipe } from "../transform/run.js";
|
|
14
|
+
import { grantOf, grantProblems } from "../license.js";
|
|
15
|
+
import { parseOrigin } from "../origin.js";
|
|
16
|
+
import { onionCell } from "./preview.js";
|
|
17
|
+
import { joinStrip, measureThreshold, splitStrip } from "./strip.js";
|
|
18
|
+
import { DEFAULT_THRESHOLDS } from "./templates.js";
|
|
19
|
+
export const DEFAULT_FIX_CAP_USD = 2;
|
|
20
|
+
/** The edit, and the `fix-scale` decision (an upper bound: it is made only when candidates differ). */
|
|
21
|
+
export function planFix(routes) {
|
|
22
|
+
const edit = routes["edit"];
|
|
23
|
+
if (!edit)
|
|
24
|
+
throw new InputError('no model route for operation "edit"');
|
|
25
|
+
const scale = routes["fix-scale"];
|
|
26
|
+
if (!scale)
|
|
27
|
+
throw new InputError('no model route for operation "fix-scale"');
|
|
28
|
+
return [
|
|
29
|
+
{ operation: "edit", model: edit.model, estimatedCostUsd: edit.estimatedCostUsd },
|
|
30
|
+
{ operation: "fix-scale", model: scale.model, estimatedCostUsd: scale.estimatedCostUsd },
|
|
31
|
+
];
|
|
32
|
+
}
|
|
33
|
+
export function buildFixPrompt(input) {
|
|
34
|
+
const first = input.source === "neighbour"
|
|
35
|
+
? `Reference image 1 is the approved frame ${input.sourceFrame ?? "?"} of the "${input.family}" cycle of ${input.subject}.`
|
|
36
|
+
: `Reference image 1 is the approved key pose of ${input.subject}.`;
|
|
37
|
+
return [
|
|
38
|
+
first,
|
|
39
|
+
"Reference image 2 is the frame to fix.",
|
|
40
|
+
"Keep the identity, design, colours and scale of image 1 exactly.",
|
|
41
|
+
`Keep the pose of image 2, which is frame ${input.frame} of ${input.count} of the "${input.family}" cycle.`,
|
|
42
|
+
"Draw one whole figure on a plain flat light background or transparent, with the feet at the bottom, no text.",
|
|
43
|
+
...(input.note ? [`Author's note: ${input.note}`] : []),
|
|
44
|
+
].join("\n");
|
|
45
|
+
}
|
|
46
|
+
function pngReference(raster, role, path) {
|
|
47
|
+
const bytes = encodePng(raster);
|
|
48
|
+
return { role, path, mediaType: "image/png", bytes, sha256: sha256(bytes) };
|
|
49
|
+
}
|
|
50
|
+
/** The first row holding a pixel at or above the alpha threshold (measureFrame's baseline is the last). */
|
|
51
|
+
function topRow(raster, threshold) {
|
|
52
|
+
for (let y = 0; y < raster.height; y++)
|
|
53
|
+
for (let x = 0; x < raster.width; x++)
|
|
54
|
+
if (raster.data[(y * raster.width + x) * 4 + 3] >= threshold)
|
|
55
|
+
return y;
|
|
56
|
+
return raster.height;
|
|
57
|
+
}
|
|
58
|
+
/** The area of the bounding box of the figure's top quarter of rows (its head). */
|
|
59
|
+
function headBoxArea(raster, threshold, top, height) {
|
|
60
|
+
const last = Math.min(raster.height - 1, top + Math.ceil(height / 4) - 1);
|
|
61
|
+
let minX = raster.width;
|
|
62
|
+
let maxX = -1;
|
|
63
|
+
let minY = raster.height;
|
|
64
|
+
let maxY = -1;
|
|
65
|
+
for (let y = top; y <= last; y++)
|
|
66
|
+
for (let x = 0; x < raster.width; x++)
|
|
67
|
+
if (raster.data[(y * raster.width + x) * 4 + 3] >= threshold) {
|
|
68
|
+
if (x < minX)
|
|
69
|
+
minX = x;
|
|
70
|
+
if (x > maxX)
|
|
71
|
+
maxX = x;
|
|
72
|
+
if (y < minY)
|
|
73
|
+
minY = y;
|
|
74
|
+
if (y > maxY)
|
|
75
|
+
maxY = y;
|
|
76
|
+
}
|
|
77
|
+
return maxX < 0 ? 0 : (maxX - minX + 1) * (maxY - minY + 1);
|
|
78
|
+
}
|
|
79
|
+
function unique(values) {
|
|
80
|
+
return [...new Set(values)];
|
|
81
|
+
}
|
|
82
|
+
function isObject(value) {
|
|
83
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
84
|
+
}
|
|
85
|
+
function isStrings(value) {
|
|
86
|
+
return Array.isArray(value) && value.every((v) => typeof v === "string");
|
|
87
|
+
}
|
|
88
|
+
const EXTENDABLE = "fix-frame extends a strip's own provenance (from write-families, pick or an earlier fix-frame) " +
|
|
89
|
+
"or the transform record of recipe or op that lists this strip as an output";
|
|
90
|
+
function refuseProvenance(source, problems) {
|
|
91
|
+
return new InputError(`cannot extend the provenance ${source}: ${problems.join("; ")}. ${EXTENDABLE}; ` +
|
|
92
|
+
"give that file with --provenance. Nothing was spent");
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* What stops a record from being extended by a fix, one entry per field the fix reads or appends
|
|
96
|
+
* to. Empty for a strip's provenance (write-families, stage and pick, an earlier fix).
|
|
97
|
+
*/
|
|
98
|
+
export function provenanceProblems(value) {
|
|
99
|
+
if (!isObject(value))
|
|
100
|
+
return ["it is not a JSON object"];
|
|
101
|
+
const problems = [];
|
|
102
|
+
if (typeof value["generator"] !== "string")
|
|
103
|
+
problems.push("generator is not a string");
|
|
104
|
+
for (const key of ["models", "requestIds", "referenceHashes", "providerTerms"]) {
|
|
105
|
+
if (!isStrings(value[key]))
|
|
106
|
+
problems.push(`${key} is not a list of strings`);
|
|
107
|
+
}
|
|
108
|
+
if (!Array.isArray(value["calls"]))
|
|
109
|
+
problems.push("calls is not a list");
|
|
110
|
+
else {
|
|
111
|
+
value["calls"].forEach((call, i) => {
|
|
112
|
+
const grant = isObject(call) ? call["outputGrant"] : undefined;
|
|
113
|
+
if (grant === undefined)
|
|
114
|
+
return;
|
|
115
|
+
const bad = grantProblems(grant);
|
|
116
|
+
if (bad.length > 0)
|
|
117
|
+
problems.push(`call ${i + 1}'s outputGrant: ${bad.join("; ")}`);
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
if (typeof value["costUsd"] !== "number" || !Number.isFinite(value["costUsd"])) {
|
|
121
|
+
problems.push("costUsd is not a number");
|
|
122
|
+
}
|
|
123
|
+
if (value["digitalSourceType"] !== undefined && typeof value["digitalSourceType"] !== "string") {
|
|
124
|
+
problems.push("digitalSourceType is not a string");
|
|
125
|
+
}
|
|
126
|
+
for (const key of ["steps", "fixes"]) {
|
|
127
|
+
if (value[key] !== undefined && !Array.isArray(value[key]))
|
|
128
|
+
problems.push(`${key} is not a list`);
|
|
129
|
+
}
|
|
130
|
+
const frames = value["frames"];
|
|
131
|
+
if (frames !== undefined &&
|
|
132
|
+
!(Array.isArray(frames) &&
|
|
133
|
+
frames.every((f) => isObject(f) && typeof f["index"] === "number" && Array.isArray(f["transforms"])))) {
|
|
134
|
+
problems.push("frames is not a list of frames with an index and transforms");
|
|
135
|
+
}
|
|
136
|
+
return problems;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* The record a fix extends, from a provenance file Assetgrove wrote. A strip's own provenance is
|
|
140
|
+
* kept as it is. A transform record (`recipe`, `op`) that lists this strip among its outputs
|
|
141
|
+
* becomes a provenance carrying the record's sources, steps, output and third-party origin. Anything else is refused
|
|
142
|
+
* with an InputError, so it is caught before any call is made.
|
|
143
|
+
*/
|
|
144
|
+
export function fixBaseProvenance(value, input) {
|
|
145
|
+
if (isObject(value) && value["generator"] === "transform") {
|
|
146
|
+
const problems = [];
|
|
147
|
+
for (const key of ["sources", "steps", "outputs"]) {
|
|
148
|
+
if (!Array.isArray(value[key]))
|
|
149
|
+
problems.push(`the transform record's ${key} is not a list`);
|
|
150
|
+
}
|
|
151
|
+
if (problems.length > 0)
|
|
152
|
+
throw refuseProvenance(input.source, problems);
|
|
153
|
+
const record = value;
|
|
154
|
+
const pixels = pixelHash(input.strip);
|
|
155
|
+
const output = record.outputs.find((o) => isObject(o) && o.pixels === pixels);
|
|
156
|
+
if (!output) {
|
|
157
|
+
throw refuseProvenance(input.source, [
|
|
158
|
+
"it is a transform record, but none of its outputs has this strip's pixels",
|
|
159
|
+
]);
|
|
160
|
+
}
|
|
161
|
+
return {
|
|
162
|
+
...(typeof output.digitalSourceType === "string" && {
|
|
163
|
+
digitalSourceType: output.digitalSourceType,
|
|
164
|
+
}),
|
|
165
|
+
...(record.sourceDeclaration && { sourceDeclaration: record.sourceDeclaration }),
|
|
166
|
+
// A hand-edited origin that does not parse is refused: it may name a third party.
|
|
167
|
+
...(record.origin !== undefined && {
|
|
168
|
+
origin: parseOrigin(record.origin, `origin in ${input.source}`),
|
|
169
|
+
}),
|
|
170
|
+
generator: "transform",
|
|
171
|
+
route: "transform",
|
|
172
|
+
models: [],
|
|
173
|
+
prompt: "",
|
|
174
|
+
parameters: {
|
|
175
|
+
...(record.recipe && { recipe: record.recipe }),
|
|
176
|
+
sources: record.sources,
|
|
177
|
+
output,
|
|
178
|
+
},
|
|
179
|
+
requestIds: [],
|
|
180
|
+
referenceHashes: unique(record.sources.flatMap((s) => isObject(s) && typeof s.sha256 === "string" ? [s.sha256] : [])),
|
|
181
|
+
bibleVersion: input.bibleVersion ?? "unknown",
|
|
182
|
+
license: input.license,
|
|
183
|
+
providerTerms: [],
|
|
184
|
+
startedAt: input.at,
|
|
185
|
+
finishedAt: input.at,
|
|
186
|
+
costUsd: 0,
|
|
187
|
+
calls: [],
|
|
188
|
+
steps: record.steps,
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
const problems = provenanceProblems(value);
|
|
192
|
+
if (problems.length > 0)
|
|
193
|
+
throw refuseProvenance(input.source, problems);
|
|
194
|
+
return value;
|
|
195
|
+
}
|
|
196
|
+
export async function fixFrame(options) {
|
|
197
|
+
const { style, call, index } = options;
|
|
198
|
+
const now = options.now ?? (() => new Date());
|
|
199
|
+
const frames = splitStrip(options.strip, options.frame);
|
|
200
|
+
const count = frames.length;
|
|
201
|
+
if (!Number.isInteger(index) || index < 1 || index > count) {
|
|
202
|
+
throw new InputError(`frame ${index} is not in the strip, which has ${count} frames`);
|
|
203
|
+
}
|
|
204
|
+
const neighbour = "neighbour" in options.from ? options.from.neighbour : undefined;
|
|
205
|
+
if (neighbour !== undefined) {
|
|
206
|
+
if (!Number.isInteger(neighbour) || neighbour < 1 || neighbour > count) {
|
|
207
|
+
throw new InputError(`neighbour frame ${neighbour} is not in the strip of ${count} frames`);
|
|
208
|
+
}
|
|
209
|
+
if (neighbour === index)
|
|
210
|
+
throw new InputError("the neighbour must be a different frame");
|
|
211
|
+
}
|
|
212
|
+
const bad = frames[index - 1];
|
|
213
|
+
const stripName = options.stripPath ?? "(strip)";
|
|
214
|
+
const first = "neighbour" in options.from
|
|
215
|
+
? pngReference(frames[options.from.neighbour - 1], `approved neighbour frame ${options.from.neighbour}`, `${stripName}#frame-${options.from.neighbour}`)
|
|
216
|
+
: options.from.keyPose;
|
|
217
|
+
const second = pngReference(bad, `frame ${index} to fix`, `${stripName}#frame-${index}`);
|
|
218
|
+
const prompt = buildFixPrompt({
|
|
219
|
+
subject: options.subject,
|
|
220
|
+
family: options.family,
|
|
221
|
+
frame: index,
|
|
222
|
+
count,
|
|
223
|
+
source: neighbour === undefined ? "key pose" : "neighbour",
|
|
224
|
+
...(neighbour !== undefined && { sourceFrame: neighbour }),
|
|
225
|
+
...(options.note !== undefined && { note: options.note }),
|
|
226
|
+
});
|
|
227
|
+
if (options.provenance !== undefined) {
|
|
228
|
+
const problems = provenanceProblems(options.provenance);
|
|
229
|
+
if (problems.length > 0)
|
|
230
|
+
throw refuseProvenance("given", problems);
|
|
231
|
+
}
|
|
232
|
+
// The frame the size is judged against, chosen before the paid edit so an empty one refuses
|
|
233
|
+
// with nothing spent: the neighbour; with a key pose the nearest non-empty frame beside the
|
|
234
|
+
// fixed one (the one before first); and only when no other frame has a figure (a strip of one
|
|
235
|
+
// frame, or every other frame empty) the bad frame itself.
|
|
236
|
+
const threshold = measureThreshold(style);
|
|
237
|
+
let beside = neighbour;
|
|
238
|
+
if (beside === undefined) {
|
|
239
|
+
for (let d = 1; d < count && beside === undefined; d++) {
|
|
240
|
+
for (const at of [index - d, index + d]) {
|
|
241
|
+
if (at >= 1 && at <= count && measureFrame(frames[at - 1], threshold)) {
|
|
242
|
+
beside = at;
|
|
243
|
+
break;
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
const referenceFrame = beside === undefined ? bad : frames[beside - 1];
|
|
249
|
+
const reference = measureFrame(referenceFrame, threshold);
|
|
250
|
+
if (!reference) {
|
|
251
|
+
throw new InputError(beside === undefined
|
|
252
|
+
? "every frame of the strip is empty, so the fixed frame's size is unknown"
|
|
253
|
+
: `frame ${beside} is empty, so the fixed frame's size is unknown`);
|
|
254
|
+
}
|
|
255
|
+
const seed = Number.parseInt(sha256(new TextEncoder().encode(prompt)).slice(0, 8), 16);
|
|
256
|
+
const startedAt = now().toISOString();
|
|
257
|
+
const returned = await call.image("edit", prompt, [first, second], seed);
|
|
258
|
+
const record = call.records[call.records.length - 1];
|
|
259
|
+
if (!record)
|
|
260
|
+
throw new Error("the edit call left no record");
|
|
261
|
+
const steps = [];
|
|
262
|
+
const edited = decodeImage(returned.bytes);
|
|
263
|
+
let item = {
|
|
264
|
+
name: "fixed-frame",
|
|
265
|
+
raster: edited,
|
|
266
|
+
mediaType: "image/png",
|
|
267
|
+
meta: {},
|
|
268
|
+
digitalSourceType: DIGITAL_SOURCE_TYPES.generated,
|
|
269
|
+
};
|
|
270
|
+
let transparent = false;
|
|
271
|
+
let matteStep;
|
|
272
|
+
for (let i = 3; i < edited.data.length; i += 4) {
|
|
273
|
+
if (edited.data[i] < 255) {
|
|
274
|
+
transparent = true;
|
|
275
|
+
break;
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
if (!transparent) {
|
|
279
|
+
const matted = runRecipe(sheetImportRecipe({ components: true }), [item], { style });
|
|
280
|
+
steps.push(...matted.steps);
|
|
281
|
+
let largest;
|
|
282
|
+
for (const figure of matted.items) {
|
|
283
|
+
const area = measureFrame(figure.raster, 1)?.area ?? 0;
|
|
284
|
+
if (!largest || area > largest.area)
|
|
285
|
+
largest = { item: figure, area };
|
|
286
|
+
}
|
|
287
|
+
if (!largest || largest.area === 0)
|
|
288
|
+
throw new InputError("the edited frame has no figure");
|
|
289
|
+
item = largest.item;
|
|
290
|
+
// Recorded in the fixed frame's provenance: the background its matte removed.
|
|
291
|
+
matteStep = item.meta["transforms"]?.findLast((t) => t.op === "matte");
|
|
292
|
+
}
|
|
293
|
+
const figure = measureFrame(item.raster, threshold);
|
|
294
|
+
if (!figure)
|
|
295
|
+
throw new InputError("the edited frame has no visible figure");
|
|
296
|
+
const refTop = topRow(referenceFrame, threshold);
|
|
297
|
+
const figTop = topRow(item.raster, threshold);
|
|
298
|
+
const refHeight = reference.baseline - refTop + 1;
|
|
299
|
+
const figHeight = figure.baseline - figTop + 1;
|
|
300
|
+
const refHead = headBoxArea(referenceFrame, threshold, refTop, refHeight);
|
|
301
|
+
const figHead = headBoxArea(item.raster, threshold, figTop, figHeight);
|
|
302
|
+
const candidates = {};
|
|
303
|
+
for (const [name, value] of [
|
|
304
|
+
["area", Math.sqrt(reference.area / figure.area)],
|
|
305
|
+
["height", refHeight / figHeight],
|
|
306
|
+
["head", Math.sqrt(refHead / figHead)],
|
|
307
|
+
]) {
|
|
308
|
+
if (Number.isFinite(value) && value > 0)
|
|
309
|
+
candidates[name] = value;
|
|
310
|
+
}
|
|
311
|
+
// The fixed frame's pin point goes where its neighbour's is, not on the anchor: a strip stage made
|
|
312
|
+
// places each frame by its box centre, so its neighbours' pin points are off the anchor, and
|
|
313
|
+
// footprint-drift compares the fixed frame's feet with theirs. With a key pose, the frame next
|
|
314
|
+
// to the fixed one stands in for the neighbour; with no other non-empty frame the anchor is kept.
|
|
315
|
+
const placedBy = beside === undefined ? undefined : reference;
|
|
316
|
+
const registerAt = (scale) => {
|
|
317
|
+
const register = (anchor) => runOperation([item], {
|
|
318
|
+
op: "register",
|
|
319
|
+
params: {
|
|
320
|
+
frame: options.frame,
|
|
321
|
+
anchor,
|
|
322
|
+
scale,
|
|
323
|
+
measureThreshold: threshold,
|
|
324
|
+
pins: [options.pin],
|
|
325
|
+
},
|
|
326
|
+
}, { style });
|
|
327
|
+
if (placedBy === undefined)
|
|
328
|
+
return register(options.anchor);
|
|
329
|
+
// The anchor is a whole pixel and the pin point is measured to the half pixel, so of the
|
|
330
|
+
// anchor columns either side, keep the one that puts the pin point nearest the neighbour's.
|
|
331
|
+
const target = pinX(placedBy, options.pin);
|
|
332
|
+
// The neighbour's bottom row is the ground only when it stands on the ground line: next to an
|
|
333
|
+
// airborne beat (a `play` landing after a jump), the fixed frame stays on the ground line.
|
|
334
|
+
const tolerance = options.groundTolerance ?? DEFAULT_THRESHOLDS.groundTolerance;
|
|
335
|
+
const height = placedBy.baseline - topRow(frames[beside - 1], threshold) + 1;
|
|
336
|
+
// Rows are whole pixels, so a neighbour one row off the line still counts as standing on it.
|
|
337
|
+
const grounded = Math.abs(placedBy.baseline - options.anchor.y) <= Math.max(1, tolerance * height);
|
|
338
|
+
const row = grounded ? placedBy.baseline : options.anchor.y;
|
|
339
|
+
const near = Math.round(target - 0.5);
|
|
340
|
+
let best;
|
|
341
|
+
for (const x of [near, near - 1, near + 1]) {
|
|
342
|
+
if (x < 0 || x >= options.frame.width)
|
|
343
|
+
continue;
|
|
344
|
+
const tried = register({ x, y: row });
|
|
345
|
+
const m = measureFrame(tried.items[0].raster, threshold);
|
|
346
|
+
const off = m === undefined ? Number.POSITIVE_INFINITY : Math.abs(pinX(m, options.pin) - target);
|
|
347
|
+
if (best === undefined || off < best.off)
|
|
348
|
+
best = { registered: tried, off };
|
|
349
|
+
}
|
|
350
|
+
return best?.registered ?? register(options.anchor);
|
|
351
|
+
};
|
|
352
|
+
// Candidates that register to the same pixels are one candidate, the first in order.
|
|
353
|
+
const distinct = [];
|
|
354
|
+
const seen = new Set();
|
|
355
|
+
for (const [name, scale] of Object.entries(candidates)) {
|
|
356
|
+
const registered = registerAt(scale);
|
|
357
|
+
const hash = pixelHash(registered.items[0].raster);
|
|
358
|
+
if (seen.has(hash))
|
|
359
|
+
continue;
|
|
360
|
+
seen.add(hash);
|
|
361
|
+
distinct.push({ name, registered });
|
|
362
|
+
}
|
|
363
|
+
if (distinct.length === 0)
|
|
364
|
+
throw new InputError("the edited frame has no usable size");
|
|
365
|
+
let chosen = distinct[0];
|
|
366
|
+
let decision;
|
|
367
|
+
// The model judges size against the surrounding frames; a strip of one frame has none to draw,
|
|
368
|
+
// so the first candidate stands without a call.
|
|
369
|
+
const loops = options.loop === true && count > 1;
|
|
370
|
+
const previous = index > 1 ? frames[index - 2] : loops ? frames[count - 1] : undefined;
|
|
371
|
+
const next = index < count ? frames[index] : loops ? frames[0] : undefined;
|
|
372
|
+
if (distinct.length > 1 && (previous || next)) {
|
|
373
|
+
const images = distinct.map(({ name, registered }, i) => {
|
|
374
|
+
const cell = onionCell(registered.items[0].raster, {
|
|
375
|
+
...(previous && { previous }),
|
|
376
|
+
...(next && { next }),
|
|
377
|
+
anchor: options.anchor,
|
|
378
|
+
});
|
|
379
|
+
const bytes = encodePng(cell);
|
|
380
|
+
return forDecision({
|
|
381
|
+
role: `image ${i + 1}`,
|
|
382
|
+
path: `fix-scale-${name}.png`,
|
|
383
|
+
mediaType: "image/png",
|
|
384
|
+
bytes,
|
|
385
|
+
sha256: sha256(bytes),
|
|
386
|
+
}, "crisp");
|
|
387
|
+
});
|
|
388
|
+
const asked = await call.decide("fix-scale", [
|
|
389
|
+
`Each image shows frame ${index} of ${count} of the "${options.family}" cycle of ${options.subject} drawn at a different size,`,
|
|
390
|
+
`at full opacity over ${previous && next
|
|
391
|
+
? loops && (index === 1 || index === count)
|
|
392
|
+
? `the faint previous frame (red) and next frame (blue); the cycle loops, so frame ${index === 1 ? count : 1} is drawn as its ${index === 1 ? "previous" : "next"}`
|
|
393
|
+
: "the faint previous frame (red) and next frame (blue)"
|
|
394
|
+
: previous
|
|
395
|
+
? "the faint previous frame (red); it is the last frame, so no next frame is drawn"
|
|
396
|
+
: "the faint next frame (blue); it is the first frame, so no previous frame is drawn"}.`,
|
|
397
|
+
"Ignore the pose; judge only the size.",
|
|
398
|
+
].join("\n"), images, {
|
|
399
|
+
type: "choice",
|
|
400
|
+
instructions: "In which image is the character the same size as in the surrounding frames?",
|
|
401
|
+
options: Object.fromEntries(distinct.map(({ name }, i) => [name, `image ${i + 1}`])),
|
|
402
|
+
});
|
|
403
|
+
const answer = asked.result.answer;
|
|
404
|
+
if (answer.type !== "choice")
|
|
405
|
+
throw new ProviderError("the fix-scale decision gave no choice");
|
|
406
|
+
const picked = distinct.find((d) => d.name === answer.choice);
|
|
407
|
+
if (!picked) {
|
|
408
|
+
throw new ProviderError(`the fix-scale decision chose "${answer.choice}", not an option`);
|
|
409
|
+
}
|
|
410
|
+
chosen = picked;
|
|
411
|
+
const probability = answer.probabilities?.[answer.choice];
|
|
412
|
+
decision = {
|
|
413
|
+
record: asked.record,
|
|
414
|
+
...(probability !== undefined && { probability }),
|
|
415
|
+
};
|
|
416
|
+
}
|
|
417
|
+
const scale = candidates[chosen.name];
|
|
418
|
+
const registered = chosen.registered;
|
|
419
|
+
const styled = runOperation(registered.items, { op: "apply-style" }, { style });
|
|
420
|
+
steps.push(registered.step, styled.step);
|
|
421
|
+
const fixed = styled.items[0].raster;
|
|
422
|
+
const outFrames = frames.slice();
|
|
423
|
+
outFrames[index - 1] = fixed;
|
|
424
|
+
const strip = joinStrip(outFrames);
|
|
425
|
+
const from = neighbour !== undefined
|
|
426
|
+
? { neighbour }
|
|
427
|
+
: {
|
|
428
|
+
keyPose: {
|
|
429
|
+
path: first.path,
|
|
430
|
+
sha256: first.sha256,
|
|
431
|
+
},
|
|
432
|
+
};
|
|
433
|
+
const at = now().toISOString();
|
|
434
|
+
const fix = {
|
|
435
|
+
frame: index,
|
|
436
|
+
from,
|
|
437
|
+
prompt,
|
|
438
|
+
model: record.model,
|
|
439
|
+
requestId: record.requestId,
|
|
440
|
+
...(record.seed !== undefined && { seed: record.seed }),
|
|
441
|
+
costUsd: record.costUsd,
|
|
442
|
+
at,
|
|
443
|
+
beforeHash: pixelHash(bad),
|
|
444
|
+
afterHash: pixelHash(fixed),
|
|
445
|
+
...(matteStep && { matte: matteStep }),
|
|
446
|
+
scale: {
|
|
447
|
+
chosen: chosen.name,
|
|
448
|
+
value: scale,
|
|
449
|
+
candidates,
|
|
450
|
+
...(decision && {
|
|
451
|
+
decision: {
|
|
452
|
+
model: decision.record.model,
|
|
453
|
+
requestId: decision.record.requestId,
|
|
454
|
+
...(decision.probability !== undefined && { probability: decision.probability }),
|
|
455
|
+
costUsd: decision.record.costUsd,
|
|
456
|
+
},
|
|
457
|
+
}),
|
|
458
|
+
},
|
|
459
|
+
};
|
|
460
|
+
const base = options.provenance ?? {
|
|
461
|
+
generator: "frame-fix",
|
|
462
|
+
route: record.route,
|
|
463
|
+
models: [],
|
|
464
|
+
prompt,
|
|
465
|
+
parameters: {},
|
|
466
|
+
requestIds: [],
|
|
467
|
+
referenceHashes: [],
|
|
468
|
+
bibleVersion: options.bibleVersion ?? "unknown",
|
|
469
|
+
license: options.license ?? "unspecified",
|
|
470
|
+
providerTerms: [],
|
|
471
|
+
startedAt,
|
|
472
|
+
finishedAt: at,
|
|
473
|
+
costUsd: 0,
|
|
474
|
+
calls: [],
|
|
475
|
+
};
|
|
476
|
+
// The decisions that shaped the fix, its edit call, then the fix-scale decision.
|
|
477
|
+
const added = [...(options.decisions ?? []), record, ...(decision ? [decision.record] : [])];
|
|
478
|
+
// The fix adds a call, so the strip is no longer media made outside Assetgrove.
|
|
479
|
+
const { madeOutsideAssetgrove: _outside, ...extended } = base;
|
|
480
|
+
void _outside;
|
|
481
|
+
const provenance = {
|
|
482
|
+
...extended,
|
|
483
|
+
digitalSourceType: combineDigitalSourceTypes([
|
|
484
|
+
base.digitalSourceType ?? DIGITAL_SOURCE_TYPES.undeclared,
|
|
485
|
+
DIGITAL_SOURCE_TYPES.generated,
|
|
486
|
+
]),
|
|
487
|
+
models: unique([...base.models, ...added.map((r) => r.model)]),
|
|
488
|
+
requestIds: [...base.requestIds, ...added.map((r) => r.requestId)],
|
|
489
|
+
referenceHashes: unique([...base.referenceHashes, first.sha256, second.sha256]),
|
|
490
|
+
providerTerms: unique([
|
|
491
|
+
...base.providerTerms,
|
|
492
|
+
...added.flatMap((r) => (r.providerTerms !== undefined ? [r.providerTerms] : [])),
|
|
493
|
+
]),
|
|
494
|
+
finishedAt: at,
|
|
495
|
+
costUsd: added.reduce((sum, r) => sum + r.costUsd, base.costUsd),
|
|
496
|
+
calls: [...base.calls, ...added],
|
|
497
|
+
...grantFields(base, [...base.calls, ...added]),
|
|
498
|
+
steps: [...(base.steps ?? []), ...steps],
|
|
499
|
+
fixes: [...(base.fixes ?? []), fix],
|
|
500
|
+
...(base.frames && {
|
|
501
|
+
frames: base.frames.map((f) => f.index === index - 1
|
|
502
|
+
? {
|
|
503
|
+
...f,
|
|
504
|
+
transforms: [
|
|
505
|
+
...f.transforms,
|
|
506
|
+
{
|
|
507
|
+
op: "edit-frame",
|
|
508
|
+
from,
|
|
509
|
+
model: record.model,
|
|
510
|
+
requestId: record.requestId,
|
|
511
|
+
},
|
|
512
|
+
...(matteStep ? [matteStep] : []),
|
|
513
|
+
],
|
|
514
|
+
}
|
|
515
|
+
: f),
|
|
516
|
+
}),
|
|
517
|
+
};
|
|
518
|
+
return { strip, frame: fixed, provenance, fix };
|
|
519
|
+
}
|
|
520
|
+
/**
|
|
521
|
+
* The combined output grant of a fixed strip's calls, and its licence: the granted licence once a
|
|
522
|
+
* grant does not allow relabelling, else the base record's (the target's) licence.
|
|
523
|
+
*/
|
|
524
|
+
function grantFields(base, calls) {
|
|
525
|
+
const outputGrant = grantOf(calls);
|
|
526
|
+
if (!outputGrant)
|
|
527
|
+
return { license: base.license };
|
|
528
|
+
return { license: outputGrant.relabel ? base.license : outputGrant.license, outputGrant };
|
|
529
|
+
}
|