@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,87 @@
|
|
|
1
|
+
import type { Raster } from "./image/raster.ts";
|
|
2
|
+
import type { Region } from "./regions.ts";
|
|
3
|
+
import type { Reason } from "./types.ts";
|
|
4
|
+
export declare const COMPARE_SHEET_FILE = "compare.png";
|
|
5
|
+
/**
|
|
6
|
+
* The share of the figure's pixels changed outside the regions above which the advisory reason is
|
|
7
|
+
* added. The figure is every pixel not fully transparent in either image and, when the version
|
|
8
|
+
* before has a one-colour opaque border (a turntable render's backdrop), not within the tolerance
|
|
9
|
+
* of that backdrop colour in both images. So a small figure on a large canvas, transparent or
|
|
10
|
+
* opaque, is measured against itself (#376).
|
|
11
|
+
*/
|
|
12
|
+
export declare const OUTSIDE_CHANGE_LIMIT = 0.05;
|
|
13
|
+
/** A pixel counts as changed when a channel differs by more than this (of 255). */
|
|
14
|
+
export declare const CHANGE_TOLERANCE = 8;
|
|
15
|
+
export interface Rect {
|
|
16
|
+
x: number;
|
|
17
|
+
y: number;
|
|
18
|
+
width: number;
|
|
19
|
+
height: number;
|
|
20
|
+
}
|
|
21
|
+
/** Which part of an asset a compare names. */
|
|
22
|
+
export interface ViewSelector {
|
|
23
|
+
/** 1-based frame of a strip. */
|
|
24
|
+
frame?: number;
|
|
25
|
+
/** 1-based view of a 3D asset. */
|
|
26
|
+
view?: number;
|
|
27
|
+
/** A strip's frame width in pixels; its height by default. */
|
|
28
|
+
frameWidth?: number;
|
|
29
|
+
}
|
|
30
|
+
/** The turntable view renders of a 3D asset: a directory's, or those beside a `.glb`. */
|
|
31
|
+
export declare function turntableViews(address: string): string[];
|
|
32
|
+
/** The image an address shows: the file, a strip's named frame, or a 3D asset's named view. */
|
|
33
|
+
export declare function loadView(address: string, select?: ViewSelector): Promise<Raster>;
|
|
34
|
+
/**
|
|
35
|
+
* The regions as one mask at the given size, in the region convention: opaque white inside any
|
|
36
|
+
* region, transparent outside. A mask file of another size is resized by nearest neighbour.
|
|
37
|
+
*/
|
|
38
|
+
export declare function regionMask(regions: readonly Region[], width: number, height: number): Promise<Raster>;
|
|
39
|
+
/** What comparing one candidate with the version before gives. */
|
|
40
|
+
export interface Comparison {
|
|
41
|
+
before: Raster;
|
|
42
|
+
candidate: Raster;
|
|
43
|
+
/** Grey per-pixel difference, black where the pixels are equal. */
|
|
44
|
+
difference: Raster;
|
|
45
|
+
/** Region rectangles on the before image's pixels. */
|
|
46
|
+
outlines: Rect[];
|
|
47
|
+
/** Whether every pixel is equal. */
|
|
48
|
+
identical: boolean;
|
|
49
|
+
/** The share of all pixels that changed. */
|
|
50
|
+
changed: number;
|
|
51
|
+
/**
|
|
52
|
+
* The share of the figure's pixels that changed outside every region (every change when none
|
|
53
|
+
* are given). A pixel fully transparent in both images is not part of the figure, whatever
|
|
54
|
+
* colour it keeps; nor, when the version before has a one-colour opaque border, is a pixel
|
|
55
|
+
* within the tolerance of that backdrop colour in both images.
|
|
56
|
+
*/
|
|
57
|
+
outsideChange: number;
|
|
58
|
+
/** The advisory reason `changed_outside_region`, when regions are given and above the limit. */
|
|
59
|
+
reasons: Reason[];
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Compares a candidate with the version before. A candidate of another size is resized to the
|
|
63
|
+
* before image. `regions` are the ones that name this frame or view (or none).
|
|
64
|
+
*/
|
|
65
|
+
export declare function compareRasters(before: Raster, candidateImage: Raster, regions?: readonly Region[]): Promise<Comparison>;
|
|
66
|
+
/**
|
|
67
|
+
* The backdrop colour of an image whose border is opaque and one colour (a turntable render's
|
|
68
|
+
* grey): the border's median colour, when at least 90% of the border pixels are opaque and within
|
|
69
|
+
* the change tolerance of it. Otherwise none, and the figure is found by alpha alone.
|
|
70
|
+
*/
|
|
71
|
+
export declare function backdropOf(image: Raster): [number, number, number] | undefined;
|
|
72
|
+
/** One row of the sheet: the candidate's number and its comparison. */
|
|
73
|
+
export interface CompareRow {
|
|
74
|
+
number: number;
|
|
75
|
+
comparison: Comparison;
|
|
76
|
+
}
|
|
77
|
+
/** Renders the rows: the number, then the version before, the candidate and the difference map. */
|
|
78
|
+
export declare function renderCompare(rows: readonly CompareRow[]): Raster;
|
|
79
|
+
/** Writes `<dir>/compare.png` (or `file`) for the rows; returns its path. */
|
|
80
|
+
export declare function writeCompareSheet(dir: string, rows: readonly CompareRow[], file?: string): Promise<string>;
|
|
81
|
+
/** The numbers a compare reports for one candidate. */
|
|
82
|
+
export declare function comparisonFields(c: Comparison): {
|
|
83
|
+
identical: boolean;
|
|
84
|
+
changed: number;
|
|
85
|
+
outsideChange: number;
|
|
86
|
+
reasons: Reason[];
|
|
87
|
+
};
|
package/dist/compare.js
ADDED
|
@@ -0,0 +1,306 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The compare sheet (design section 3.5): `<dir>/compare.png`, one numbered row per candidate with
|
|
3
|
+
* the version before, the candidate and a difference map, region outlines drawn on all three.
|
|
4
|
+
* Numbers only: no text from any request input is drawn, so the sheet changes only when an image
|
|
5
|
+
* does. It reuses the raster code of the contact sheet.
|
|
6
|
+
*/
|
|
7
|
+
import { existsSync, readdirSync, statSync } from "node:fs";
|
|
8
|
+
import { readFile, writeFile } from "node:fs/promises";
|
|
9
|
+
import { basename, dirname, extname, join } from "node:path";
|
|
10
|
+
import { splitStrip } from "./animation/strip.js";
|
|
11
|
+
import { CELL_PX, fill, fit } from "./contact.js";
|
|
12
|
+
import { InputError } from "./errors.js";
|
|
13
|
+
import { drawDigits, textWidth } from "./image/digits.js";
|
|
14
|
+
import { createRaster, decodeImage, encodePng, setPixel } from "./image/raster.js";
|
|
15
|
+
import { boxRect, maskInside } from "./regions.js";
|
|
16
|
+
export const COMPARE_SHEET_FILE = "compare.png";
|
|
17
|
+
/**
|
|
18
|
+
* The share of the figure's pixels changed outside the regions above which the advisory reason is
|
|
19
|
+
* added. The figure is every pixel not fully transparent in either image and, when the version
|
|
20
|
+
* before has a one-colour opaque border (a turntable render's backdrop), not within the tolerance
|
|
21
|
+
* of that backdrop colour in both images. So a small figure on a large canvas, transparent or
|
|
22
|
+
* opaque, is measured against itself (#376).
|
|
23
|
+
*/
|
|
24
|
+
export const OUTSIDE_CHANGE_LIMIT = 0.05;
|
|
25
|
+
/** A pixel counts as changed when a channel differs by more than this (of 255). */
|
|
26
|
+
export const CHANGE_TOLERANCE = 8;
|
|
27
|
+
const PAD = 8;
|
|
28
|
+
const DIGIT_SCALE = 3;
|
|
29
|
+
const BACKDROP = [236, 236, 236, 255];
|
|
30
|
+
const CELL = [248, 248, 248, 255];
|
|
31
|
+
const INK = [30, 30, 36, 255];
|
|
32
|
+
const OUTLINE = [230, 40, 40, 255];
|
|
33
|
+
/** The turntable view renders of a 3D asset: a directory's, or those beside a `.glb`. */
|
|
34
|
+
export function turntableViews(address) {
|
|
35
|
+
const dir = existsSync(address) && statSync(address).isDirectory() ? address : undefined;
|
|
36
|
+
const folders = dir !== undefined
|
|
37
|
+
? [dir]
|
|
38
|
+
: readdirSync(dirname(address), { withFileTypes: true })
|
|
39
|
+
.filter((e) => e.isDirectory() && e.name.startsWith(`${basename(address, extname(address))}-`))
|
|
40
|
+
.map((e) => join(dirname(address), e.name))
|
|
41
|
+
.sort();
|
|
42
|
+
return folders.flatMap((folder) => readdirSync(folder)
|
|
43
|
+
.filter((f) => f.endsWith(".png") && !f.startsWith("clip-"))
|
|
44
|
+
.sort()
|
|
45
|
+
.map((f) => join(folder, f)));
|
|
46
|
+
}
|
|
47
|
+
/** The image an address shows: the file, a strip's named frame, or a 3D asset's named view. */
|
|
48
|
+
export async function loadView(address, select = {}) {
|
|
49
|
+
const is3d = extname(address).toLowerCase() === ".glb" || isDirectory(address);
|
|
50
|
+
if (is3d) {
|
|
51
|
+
const views = turntableViews(address);
|
|
52
|
+
const n = select.view ?? 1;
|
|
53
|
+
const file = views[n - 1];
|
|
54
|
+
if (file === undefined)
|
|
55
|
+
throw new InputError(`${address} has ${views.length} view(s); view ${n} does not exist`);
|
|
56
|
+
return decode(address, await readFile(file));
|
|
57
|
+
}
|
|
58
|
+
const image = decode(address, await readFile(address).catch(unreadable(address)));
|
|
59
|
+
if (select.frame === undefined)
|
|
60
|
+
return image;
|
|
61
|
+
const width = select.frameWidth ?? image.height;
|
|
62
|
+
if (width <= 0 || image.width % width !== 0)
|
|
63
|
+
throw new InputError(`${address} is ${image.width} px wide, not a whole number of ${width} px frames`);
|
|
64
|
+
const frames = splitStrip(image, { width, height: image.height });
|
|
65
|
+
const frame = frames[select.frame - 1];
|
|
66
|
+
if (frame === undefined)
|
|
67
|
+
throw new InputError(`${address} has ${frames.length} frame(s); frame ${select.frame} does not exist`);
|
|
68
|
+
return frame;
|
|
69
|
+
}
|
|
70
|
+
function isDirectory(path) {
|
|
71
|
+
try {
|
|
72
|
+
return statSync(path).isDirectory();
|
|
73
|
+
}
|
|
74
|
+
catch {
|
|
75
|
+
return false;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
function unreadable(address) {
|
|
79
|
+
return () => {
|
|
80
|
+
throw new InputError(`cannot read ${address}`);
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
function decode(address, bytes) {
|
|
84
|
+
try {
|
|
85
|
+
return decodeImage(bytes);
|
|
86
|
+
}
|
|
87
|
+
catch (error) {
|
|
88
|
+
throw new InputError(`${address} is not a PNG or JPEG image`, { cause: error });
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
/** `image` at the size of `to`, by nearest neighbour; the same raster when the sizes agree. */
|
|
92
|
+
function sizedTo(image, to) {
|
|
93
|
+
if (image.width === to.width && image.height === to.height)
|
|
94
|
+
return image;
|
|
95
|
+
const out = createRaster(to.width, to.height);
|
|
96
|
+
for (let y = 0; y < to.height; y++)
|
|
97
|
+
for (let x = 0; x < to.width; x++) {
|
|
98
|
+
const sx = Math.min(image.width - 1, Math.floor(((x + 0.5) * image.width) / to.width));
|
|
99
|
+
const sy = Math.min(image.height - 1, Math.floor(((y + 0.5) * image.height) / to.height));
|
|
100
|
+
const i = (sy * image.width + sx) * 4;
|
|
101
|
+
out.data.set(image.data.subarray(i, i + 4), (y * to.width + x) * 4);
|
|
102
|
+
}
|
|
103
|
+
return out;
|
|
104
|
+
}
|
|
105
|
+
async function place(region, width, height) {
|
|
106
|
+
if (region.shape.kind === "time")
|
|
107
|
+
throw new InputError("a time region marks audio; compare takes boxes and masks on images");
|
|
108
|
+
if (region.shape.kind === "box") {
|
|
109
|
+
const rect = boxRect(region.shape, width, height);
|
|
110
|
+
return {
|
|
111
|
+
rect,
|
|
112
|
+
inside: (x, y) => x >= rect.x && x < rect.x + rect.width && y >= rect.y && y < rect.y + rect.height,
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
const mask = sizedTo(decode(region.shape.path, await readFile(region.shape.path).catch(unreadable(region.shape.path))), createRaster(width, height));
|
|
116
|
+
let minX = width;
|
|
117
|
+
let minY = height;
|
|
118
|
+
let maxX = -1;
|
|
119
|
+
let maxY = -1;
|
|
120
|
+
for (let y = 0; y < height; y++)
|
|
121
|
+
for (let x = 0; x < width; x++)
|
|
122
|
+
if (maskInside(mask, x, y)) {
|
|
123
|
+
minX = Math.min(minX, x);
|
|
124
|
+
maxX = Math.max(maxX, x);
|
|
125
|
+
minY = Math.min(minY, y);
|
|
126
|
+
maxY = Math.max(maxY, y);
|
|
127
|
+
}
|
|
128
|
+
const rect = maxX < 0
|
|
129
|
+
? { x: 0, y: 0, width: 0, height: 0 }
|
|
130
|
+
: { x: minX, y: minY, width: maxX - minX + 1, height: maxY - minY + 1 };
|
|
131
|
+
return { rect, inside: (x, y) => maskInside(mask, x, y) };
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* The regions as one mask at the given size, in the region convention: opaque white inside any
|
|
135
|
+
* region, transparent outside. A mask file of another size is resized by nearest neighbour.
|
|
136
|
+
*/
|
|
137
|
+
export async function regionMask(regions, width, height) {
|
|
138
|
+
const placed = await Promise.all(regions.map((r) => place(r, width, height)));
|
|
139
|
+
const out = createRaster(width, height);
|
|
140
|
+
for (let y = 0; y < height; y++)
|
|
141
|
+
for (let x = 0; x < width; x++)
|
|
142
|
+
if (placed.some((p) => p.inside(x, y)))
|
|
143
|
+
out.data.set([255, 255, 255, 255], (y * width + x) * 4);
|
|
144
|
+
return out;
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Compares a candidate with the version before. A candidate of another size is resized to the
|
|
148
|
+
* before image. `regions` are the ones that name this frame or view (or none).
|
|
149
|
+
*/
|
|
150
|
+
export async function compareRasters(before, candidateImage, regions = []) {
|
|
151
|
+
const candidate = sizedTo(candidateImage, before);
|
|
152
|
+
const placed = await Promise.all(regions.map((r) => place(r, before.width, before.height)));
|
|
153
|
+
const difference = createRaster(before.width, before.height);
|
|
154
|
+
let different = 0;
|
|
155
|
+
let changed = 0;
|
|
156
|
+
let outside = 0;
|
|
157
|
+
let figure = 0;
|
|
158
|
+
const backdrop = backdropOf(before);
|
|
159
|
+
for (let y = 0; y < before.height; y++)
|
|
160
|
+
for (let x = 0; x < before.width; x++) {
|
|
161
|
+
const i = (y * before.width + x) * 4;
|
|
162
|
+
let max = 0;
|
|
163
|
+
for (let c = 0; c < 4; c++)
|
|
164
|
+
max = Math.max(max, Math.abs((before.data[i + c] ?? 0) - (candidate.data[i + c] ?? 0)));
|
|
165
|
+
const grey = Math.min(255, max * 4);
|
|
166
|
+
difference.data.set([grey, grey, grey, 255], i);
|
|
167
|
+
if (max > 0)
|
|
168
|
+
different++;
|
|
169
|
+
const shown = ((before.data[i + 3] ?? 0) > 0 || (candidate.data[i + 3] ?? 0) > 0) &&
|
|
170
|
+
(!backdrop || !nearBackdrop(before, i, backdrop) || !nearBackdrop(candidate, i, backdrop));
|
|
171
|
+
if (shown)
|
|
172
|
+
figure++;
|
|
173
|
+
if (max > CHANGE_TOLERANCE) {
|
|
174
|
+
changed++;
|
|
175
|
+
if (shown && !placed.some((p) => p.inside(x, y)))
|
|
176
|
+
outside++;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
const total = Math.max(1, before.width * before.height);
|
|
180
|
+
const outsideChange = outside / Math.max(1, figure);
|
|
181
|
+
return {
|
|
182
|
+
before,
|
|
183
|
+
candidate,
|
|
184
|
+
difference,
|
|
185
|
+
outlines: placed.map((p) => p.rect).filter((r) => r.width > 0 && r.height > 0),
|
|
186
|
+
identical: different === 0,
|
|
187
|
+
changed: changed / total,
|
|
188
|
+
outsideChange,
|
|
189
|
+
reasons: regions.length > 0 && outsideChange > OUTSIDE_CHANGE_LIMIT
|
|
190
|
+
? [
|
|
191
|
+
{
|
|
192
|
+
check: "changed_outside_region",
|
|
193
|
+
passed: false,
|
|
194
|
+
reason: `${(outsideChange * 100).toFixed(1)}% of the figure's pixels changed outside the regions`,
|
|
195
|
+
source: "deterministic",
|
|
196
|
+
shadow: true,
|
|
197
|
+
},
|
|
198
|
+
]
|
|
199
|
+
: [],
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
/** The share of border pixels that must sit within the tolerance of the border's median colour. */
|
|
203
|
+
const BACKDROP_SHARE = 0.9;
|
|
204
|
+
/**
|
|
205
|
+
* The backdrop colour of an image whose border is opaque and one colour (a turntable render's
|
|
206
|
+
* grey): the border's median colour, when at least 90% of the border pixels are opaque and within
|
|
207
|
+
* the change tolerance of it. Otherwise none, and the figure is found by alpha alone.
|
|
208
|
+
*/
|
|
209
|
+
export function backdropOf(image) {
|
|
210
|
+
const { width, height, data } = image;
|
|
211
|
+
if (width === 0 || height === 0)
|
|
212
|
+
return undefined;
|
|
213
|
+
const border = [];
|
|
214
|
+
for (let x = 0; x < width; x++)
|
|
215
|
+
border.push(x, 0, x, height - 1);
|
|
216
|
+
for (let y = 1; y < height - 1; y++)
|
|
217
|
+
border.push(0, y, width - 1, y);
|
|
218
|
+
const offsets = [];
|
|
219
|
+
for (let k = 0; k < border.length; k += 2)
|
|
220
|
+
offsets.push((border[k + 1] * width + border[k]) * 4);
|
|
221
|
+
const median = [0, 1, 2].map((c) => {
|
|
222
|
+
const s = offsets.map((o) => data[o + c]).sort((a, b) => a - b);
|
|
223
|
+
return s[s.length >> 1];
|
|
224
|
+
});
|
|
225
|
+
let near = 0;
|
|
226
|
+
for (const o of offsets)
|
|
227
|
+
if (data[o + 3] === 255 && nearBackdrop(image, o, median))
|
|
228
|
+
near++;
|
|
229
|
+
return near >= offsets.length * BACKDROP_SHARE ? median : undefined;
|
|
230
|
+
}
|
|
231
|
+
function nearBackdrop(image, i, rgb) {
|
|
232
|
+
for (let c = 0; c < 3; c++)
|
|
233
|
+
if (Math.abs((image.data[i + c] ?? 0) - rgb[c]) > CHANGE_TOLERANCE)
|
|
234
|
+
return false;
|
|
235
|
+
return true;
|
|
236
|
+
}
|
|
237
|
+
function outline(cell, rect, scale, ox, oy) {
|
|
238
|
+
const x0 = ox + Math.floor(rect.x * scale);
|
|
239
|
+
const y0 = oy + Math.floor(rect.y * scale);
|
|
240
|
+
const x1 = ox + Math.max(Math.ceil((rect.x + rect.width) * scale) - 1, Math.floor(rect.x * scale));
|
|
241
|
+
const y1 = oy + Math.max(Math.ceil((rect.y + rect.height) * scale) - 1, Math.floor(rect.y * scale));
|
|
242
|
+
for (let x = x0; x <= x1; x++) {
|
|
243
|
+
setPixel(cell, x, y0, OUTLINE);
|
|
244
|
+
setPixel(cell, x, y1, OUTLINE);
|
|
245
|
+
}
|
|
246
|
+
for (let y = y0; y <= y1; y++) {
|
|
247
|
+
setPixel(cell, x0, y, OUTLINE);
|
|
248
|
+
setPixel(cell, x1, y, OUTLINE);
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
/** One image fitted into a cell, with the outlines drawn over it. */
|
|
252
|
+
function cellOf(image, outlines) {
|
|
253
|
+
const cell = createRaster(CELL_PX, CELL_PX);
|
|
254
|
+
fill(cell, 0, 0, CELL_PX, CELL_PX, CELL);
|
|
255
|
+
const scaled = fit(image);
|
|
256
|
+
const ox = Math.floor((CELL_PX - scaled.width) / 2);
|
|
257
|
+
const oy = Math.floor((CELL_PX - scaled.height) / 2);
|
|
258
|
+
for (let y = 0; y < scaled.height; y++)
|
|
259
|
+
for (let x = 0; x < scaled.width; x++) {
|
|
260
|
+
const i = (y * scaled.width + x) * 4;
|
|
261
|
+
const a = (scaled.data[i + 3] ?? 0) / 255;
|
|
262
|
+
const j = ((oy + y) * CELL_PX + ox + x) * 4;
|
|
263
|
+
for (let c = 0; c < 3; c++)
|
|
264
|
+
cell.data[j + c] = Math.round((scaled.data[i + c] ?? 0) * a + (cell.data[j + c] ?? 0) * (1 - a));
|
|
265
|
+
}
|
|
266
|
+
const scale = scaled.width / image.width;
|
|
267
|
+
for (const rect of outlines)
|
|
268
|
+
outline(cell, rect, scale, ox, oy);
|
|
269
|
+
return cell;
|
|
270
|
+
}
|
|
271
|
+
/** Renders the rows: the number, then the version before, the candidate and the difference map. */
|
|
272
|
+
export function renderCompare(rows) {
|
|
273
|
+
const numberW = Math.max(...rows.map((r) => textWidth(String(r.number), DIGIT_SCALE)), 0);
|
|
274
|
+
const x0 = PAD + numberW + PAD;
|
|
275
|
+
const rowH = CELL_PX + PAD;
|
|
276
|
+
const out = createRaster(x0 + 3 * (CELL_PX + PAD), Math.max(PAD + rows.length * rowH, 1));
|
|
277
|
+
for (let i = 0; i < out.data.length; i += 4)
|
|
278
|
+
out.data.set(BACKDROP, i);
|
|
279
|
+
rows.forEach((row, index) => {
|
|
280
|
+
const y = PAD + index * rowH;
|
|
281
|
+
drawDigits(out, String(row.number), PAD, y + Math.floor((CELL_PX - 5 * DIGIT_SCALE) / 2), DIGIT_SCALE, INK);
|
|
282
|
+
const c = row.comparison;
|
|
283
|
+
[c.before, c.candidate, c.difference].forEach((image, i) => {
|
|
284
|
+
const cell = cellOf(image, c.outlines);
|
|
285
|
+
for (let cy = 0; cy < CELL_PX; cy++)
|
|
286
|
+
out.data.set(cell.data.subarray(cy * CELL_PX * 4, (cy + 1) * CELL_PX * 4), ((y + cy) * out.width + x0 + i * (CELL_PX + PAD)) * 4);
|
|
287
|
+
});
|
|
288
|
+
});
|
|
289
|
+
return out;
|
|
290
|
+
}
|
|
291
|
+
/** Writes `<dir>/compare.png` (or `file`) for the rows; returns its path. */
|
|
292
|
+
export async function writeCompareSheet(dir, rows, file = COMPARE_SHEET_FILE) {
|
|
293
|
+
const path = join(dir, file);
|
|
294
|
+
await writeFile(path, encodePng(renderCompare(rows)));
|
|
295
|
+
return path;
|
|
296
|
+
}
|
|
297
|
+
/** The numbers a compare reports for one candidate. */
|
|
298
|
+
export function comparisonFields(c) {
|
|
299
|
+
const round = (n) => Math.round(n * 1e6) / 1e6;
|
|
300
|
+
return {
|
|
301
|
+
identical: c.identical,
|
|
302
|
+
changed: round(c.changed),
|
|
303
|
+
outsideChange: round(c.outsideChange),
|
|
304
|
+
reasons: c.reasons,
|
|
305
|
+
};
|
|
306
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Delegated confirmations (docs/settings.md, "Delegation"): a person present but not answering
|
|
3
|
+
* every confirmation sets `delegation` in the developer settings, outside the repository. Within
|
|
4
|
+
* its scopes, a confirmation that would otherwise ask a person (a form, the inline prompt or exit 8)
|
|
5
|
+
* is answered by the agent's call and recorded as method `delegated`, naming who delegated it, the
|
|
6
|
+
* scope and the client. Nothing here is ever recorded as `tty`, `elicitation` or `headless`.
|
|
7
|
+
*/
|
|
8
|
+
import type { Delegation, DelegationScope, Settings } from "../settings.ts";
|
|
9
|
+
import type { ConfirmRequest } from "./prompt.ts";
|
|
10
|
+
/** The client a record names when no MCP client reported its name: the CLI. */
|
|
11
|
+
export declare const CLI_CLIENT = "cli";
|
|
12
|
+
/** The delegation when its settings delegate `scope`; undefined otherwise. */
|
|
13
|
+
export declare function delegationFor(settings: Pick<Settings, "delegation">, scope: DelegationScope): Delegation | undefined;
|
|
14
|
+
/**
|
|
15
|
+
* The scope a request falls in: `spend` for a spend, `pick` for a pick (a single, batch or
|
|
16
|
+
* turnaround pick). An approval, an adoption, a suggestion's acceptance, a write or a policy
|
|
17
|
+
* clearance is in none, and delegation never answers it.
|
|
18
|
+
*/
|
|
19
|
+
export declare function scopeOf(request: Pick<ConfirmRequest, "kind" | "body">): DelegationScope | undefined;
|
|
20
|
+
/** What a delegated record says of its delegation. */
|
|
21
|
+
export interface DelegatedFields {
|
|
22
|
+
delegatedBy: string;
|
|
23
|
+
scope: DelegationScope;
|
|
24
|
+
client: string;
|
|
25
|
+
selfReported: true;
|
|
26
|
+
}
|
|
27
|
+
/** The fields of a confirmation answered by `delegation` in `scope`, through `client`. */
|
|
28
|
+
export declare function delegatedFields(delegation: Delegation, scope: DelegationScope, client: string | undefined): DelegatedFields;
|
|
29
|
+
/** The line `init` and `doctor` show for a delegation, naming its person and scopes. */
|
|
30
|
+
export declare function delegationLine(delegation: Delegation): string;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/** The client a record names when no MCP client reported its name: the CLI. */
|
|
2
|
+
export const CLI_CLIENT = "cli";
|
|
3
|
+
/** The delegation when its settings delegate `scope`; undefined otherwise. */
|
|
4
|
+
export function delegationFor(settings, scope) {
|
|
5
|
+
const delegation = settings.delegation;
|
|
6
|
+
return delegation?.scopes.includes(scope) ? delegation : undefined;
|
|
7
|
+
}
|
|
8
|
+
/** Commands whose requests are kind `pick` without being a pick: approvals and acceptances. */
|
|
9
|
+
const NOT_PICKS = new Set(["approve", "library adopt", "card accept"]);
|
|
10
|
+
/**
|
|
11
|
+
* The scope a request falls in: `spend` for a spend, `pick` for a pick (a single, batch or
|
|
12
|
+
* turnaround pick). An approval, an adoption, a suggestion's acceptance, a write or a policy
|
|
13
|
+
* clearance is in none, and delegation never answers it.
|
|
14
|
+
*/
|
|
15
|
+
export function scopeOf(request) {
|
|
16
|
+
if (request.kind === "spend")
|
|
17
|
+
return "spend";
|
|
18
|
+
if (request.kind === "pick" && !NOT_PICKS.has(request.body?.["command"]))
|
|
19
|
+
return "pick";
|
|
20
|
+
return undefined;
|
|
21
|
+
}
|
|
22
|
+
/** The fields of a confirmation answered by `delegation` in `scope`, through `client`. */
|
|
23
|
+
export function delegatedFields(delegation, scope, client) {
|
|
24
|
+
return { delegatedBy: delegation.by, scope, client: client ?? CLI_CLIENT, selfReported: true };
|
|
25
|
+
}
|
|
26
|
+
/** The line `init` and `doctor` show for a delegation, naming its person and scopes. */
|
|
27
|
+
export function delegationLine(delegation) {
|
|
28
|
+
const scopes = delegation.scopes.length > 0 ? delegation.scopes.join(", ") : "none";
|
|
29
|
+
const note = delegation.note !== undefined ? ` (${delegation.note})` : "";
|
|
30
|
+
return `Delegation: ${delegation.by} delegated confirmations to the agents acting for them; scopes: ${scopes}${note}. Each is recorded as method delegated, never as a person's answer.`;
|
|
31
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Spend, pick and write confirmation (design section 7). Sources, in order: headless settings
|
|
3
|
+
* (method `headless`; a headless pick must name its candidate); the record at
|
|
4
|
+
* `<configDir>/confirmations/<hex>.json` for the request's digest (a spend's, while it is unbound
|
|
5
|
+
* or bound to this run and that run has not finished); a prior confirmation the
|
|
6
|
+
* command names (apply's plan); the developer settings' `delegation`, within its scopes (method
|
|
7
|
+
* `delegated`, src/confirm/delegation.ts; a delegated pick must name its candidate); an MCP client's form (method `elicitation`, src/confirm/mcp.ts) or
|
|
8
|
+
* the inline prompt of a TTY (method `tty`); otherwise the request
|
|
9
|
+
* is saved to `<stateDir>/pending/<id>.json` and exit 8 `confirmation_required` carries it, and
|
|
10
|
+
* `assetgrove confirm <id>` completes it (method `terminal`). Every method writes the record.
|
|
11
|
+
*/
|
|
12
|
+
import { ConfirmationError } from "../approvals.ts";
|
|
13
|
+
import type { Settings } from "../settings.ts";
|
|
14
|
+
import type { ConfirmationMethod, ConfirmationRecord } from "../types.ts";
|
|
15
|
+
import type { DelegatedFields } from "./delegation.ts";
|
|
16
|
+
import type { ChannelFields, ConfirmPort, ConfirmRequest } from "./prompt.ts";
|
|
17
|
+
export { bindConfirmation, bindingAllows, confirmationPath, digestOf, readConfirmation, writeConfirmation, } from "./records.ts";
|
|
18
|
+
export type { ConfirmationMethod, ConfirmationRecord } from "../types.ts";
|
|
19
|
+
/** The kinds this module confirms. */
|
|
20
|
+
export type RequestKind = ConfirmationRecord["kind"];
|
|
21
|
+
/** A spend, pick or write request: its body hashes to its id. */
|
|
22
|
+
export interface KindRequest extends ConfirmRequest {
|
|
23
|
+
kind: RequestKind;
|
|
24
|
+
body: Record<string, unknown>;
|
|
25
|
+
/** A write's grouping, whose digest its body holds, so `confirm` can check the families shown. */
|
|
26
|
+
grouping?: unknown;
|
|
27
|
+
}
|
|
28
|
+
/** The `error.confirmation` of a spend, pick or write no one confirmed. */
|
|
29
|
+
export interface RequestConfirmation {
|
|
30
|
+
kind: RequestKind;
|
|
31
|
+
id: string;
|
|
32
|
+
summary: string;
|
|
33
|
+
confirmCommand: string;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* What confirming reads: the settings, a channel to ask a person when there is one, and the
|
|
37
|
+
* client's name a delegated record names (an MCP client's; the CLI's when absent).
|
|
38
|
+
*/
|
|
39
|
+
export interface ConfirmGate {
|
|
40
|
+
settings: Pick<Settings, "configDir" | "stateDir" | "mode" | "headless" | "delegation">;
|
|
41
|
+
prompt?: ConfirmPort;
|
|
42
|
+
client?: string;
|
|
43
|
+
}
|
|
44
|
+
/** The gate of a command's context: its settings, its channel and its client. */
|
|
45
|
+
export declare function gateOf<S>(ctx: {
|
|
46
|
+
settings: S;
|
|
47
|
+
prompt?: ConfirmPort;
|
|
48
|
+
client?: string;
|
|
49
|
+
}): {
|
|
50
|
+
settings: S;
|
|
51
|
+
prompt?: ConfirmPort;
|
|
52
|
+
client?: string;
|
|
53
|
+
};
|
|
54
|
+
/** The record of a request confirmed by `method`, with the pick's choice when it has one. */
|
|
55
|
+
export declare function recordOf(request: KindRequest, method: ConfirmationMethod, extra?: {
|
|
56
|
+
choice?: string;
|
|
57
|
+
/** A batch pick's candidate of each entry, in order. */
|
|
58
|
+
choices?: string[];
|
|
59
|
+
operator?: string;
|
|
60
|
+
channel?: ChannelFields;
|
|
61
|
+
/** For method `delegated`: who delegated it, the scope and the client. */
|
|
62
|
+
delegated?: DelegatedFields;
|
|
63
|
+
/** A spend's run directory, which the record is bound to. */
|
|
64
|
+
runDir?: string;
|
|
65
|
+
}): ConfirmationRecord;
|
|
66
|
+
/** True when a pending request's body hashes to its id. */
|
|
67
|
+
export declare function verifiedRequest(request: ConfirmRequest): request is KindRequest;
|
|
68
|
+
/** Exit 8 `confirmation_declined` for a request a person declined. */
|
|
69
|
+
export declare function declined(request: KindRequest): ConfirmationError;
|
|
70
|
+
/**
|
|
71
|
+
* The confirmation of a request, from the first source that has one (see the module comment).
|
|
72
|
+
* `prior` names a confirmation an earlier request gave that covers this one (apply's plan).
|
|
73
|
+
* `runDir` is a spend's run directory: a stored record pays only for the run it is bound to (its
|
|
74
|
+
* first run binds it) until that run finishes, and a new record is bound to `runDir`.
|
|
75
|
+
* Throws exit 8 when no one confirmed, exit 2 for a headless or delegated pick that names no
|
|
76
|
+
* candidate. A
|
|
77
|
+
* request a person declined is saved as pending, so `assetgrove confirm <id>` can still confirm it.
|
|
78
|
+
*/
|
|
79
|
+
export declare function requireConfirmation(request: KindRequest, gate: ConfirmGate, options?: {
|
|
80
|
+
prior?: () => Promise<ConfirmationRecord | undefined>;
|
|
81
|
+
runDir?: string;
|
|
82
|
+
/** Only a person clears it: headless settings do not (a borderline policy request). */
|
|
83
|
+
person?: boolean;
|
|
84
|
+
}): Promise<ConfirmationRecord>;
|