@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,545 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Review records: `<assetId>.review.json`, a W3C Web Annotation `AnnotationCollection` beside a
|
|
3
|
+
* picked asset. Each version and annotation sits on its own line, so two branches' appends
|
|
4
|
+
* union-merge; the reader tolerates the missing or extra commas that leaves, and the canonical
|
|
5
|
+
* writer restores strict JSON. Past lines are never rewritten: a resolution is a new annotation.
|
|
6
|
+
*/
|
|
7
|
+
import { z } from "zod";
|
|
8
|
+
import { InputError } from "../errors.js";
|
|
9
|
+
import { readFormat, registerMigration } from "../formats.js";
|
|
10
|
+
import { canonicalJson, sha256Hex } from "./canonical.js";
|
|
11
|
+
import { libraryPath } from "./paths.js";
|
|
12
|
+
/** Every library file kind that carries a format line, with the version this build reads. */
|
|
13
|
+
export const LIBRARY_FORMATS = { card: 1, review: 2 };
|
|
14
|
+
// A /1 review record is valid as /2: the anchors /2 adds (`ag:frames`, `ag:cell`, a `t=` selector)
|
|
15
|
+
// are optional, so every version, note and resolution of a /1 record reads unchanged.
|
|
16
|
+
registerMigration("review", 1, (value) => value);
|
|
17
|
+
const CONTEXT = [
|
|
18
|
+
"http://www.w3.org/ns/anno.jsonld",
|
|
19
|
+
{ ag: "https://github.com/clockgrove/assetgrove/ns/review#" },
|
|
20
|
+
];
|
|
21
|
+
const FORMAT_LINE = `assetgrove-review/${LIBRARY_FORMATS.review}`;
|
|
22
|
+
const CORE_KEYS = new Set(["@context", "id", "type", "ag:format", "ag:versions", "first"]);
|
|
23
|
+
const hex64 = z.string().regex(/^[0-9a-f]{64}$/, "must be a 64-hex sha256");
|
|
24
|
+
const annotationRef = z.string().regex(/^#[0-9a-f]{16}$/, 'must look like "#<16 hex>"');
|
|
25
|
+
const isoUtc = z
|
|
26
|
+
.string()
|
|
27
|
+
.regex(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?Z$/, "must be ISO-8601 UTC");
|
|
28
|
+
export const ACTIONS = [
|
|
29
|
+
"pick",
|
|
30
|
+
"replace",
|
|
31
|
+
"approve",
|
|
32
|
+
"reject",
|
|
33
|
+
"answer",
|
|
34
|
+
"card-edit",
|
|
35
|
+
"adopt",
|
|
36
|
+
"resolve",
|
|
37
|
+
];
|
|
38
|
+
export const MOTIVATIONS = [
|
|
39
|
+
"commenting",
|
|
40
|
+
"replying",
|
|
41
|
+
"assessing",
|
|
42
|
+
"editing",
|
|
43
|
+
"describing",
|
|
44
|
+
"tagging",
|
|
45
|
+
"moderating",
|
|
46
|
+
];
|
|
47
|
+
const MEDIA_FRAGMENTS = "http://www.w3.org/TR/media-frags/";
|
|
48
|
+
const selectorSchema = z
|
|
49
|
+
.looseObject({
|
|
50
|
+
type: z.literal("FragmentSelector"),
|
|
51
|
+
conformsTo: z.literal(MEDIA_FRAGMENTS),
|
|
52
|
+
value: z.string(),
|
|
53
|
+
})
|
|
54
|
+
.superRefine((selector, ctx) => {
|
|
55
|
+
const problem = fragmentProblem(selector.value);
|
|
56
|
+
if (problem)
|
|
57
|
+
ctx.addIssue({ code: "custom", message: problem, path: ["value"] });
|
|
58
|
+
});
|
|
59
|
+
const NUMBER = "(\\d+(?:\\.\\d+)?)";
|
|
60
|
+
function fragmentProblem(value) {
|
|
61
|
+
return value.startsWith("t=") ? timeProblem(value) : boxProblem(value);
|
|
62
|
+
}
|
|
63
|
+
function boxProblem(value) {
|
|
64
|
+
const match = new RegExp(`^xywh=(pixel:|percent:)?${NUMBER},${NUMBER},${NUMBER},${NUMBER}$`).exec(value);
|
|
65
|
+
if (!match)
|
|
66
|
+
return `"${value}" is not a media-fragment box (xywh=[pixel:|percent:]x,y,w,h)`;
|
|
67
|
+
const [x, y, w, h] = match.slice(2, 6).map(Number);
|
|
68
|
+
if (w <= 0 || h <= 0)
|
|
69
|
+
return "a box needs a width and a height above zero";
|
|
70
|
+
if (match[1] === "percent:" && (x + w > 100 || y + h > 100)) {
|
|
71
|
+
return "a percent box must stay within 0 to 100";
|
|
72
|
+
}
|
|
73
|
+
return undefined;
|
|
74
|
+
}
|
|
75
|
+
/** The time range a `t=` fragment names, or undefined when the value is not one. */
|
|
76
|
+
export function parseTimeFragment(value) {
|
|
77
|
+
const match = new RegExp(`^t=(?:npt:)?${NUMBER},${NUMBER}$`).exec(value);
|
|
78
|
+
if (!match)
|
|
79
|
+
return undefined;
|
|
80
|
+
return { start: Number(match[1]), end: Number(match[2]) };
|
|
81
|
+
}
|
|
82
|
+
function timeProblem(value) {
|
|
83
|
+
const range = parseTimeFragment(value);
|
|
84
|
+
if (range === undefined) {
|
|
85
|
+
return `selector "${value}" is not a media-fragment time range (t=[npt:]start,end in seconds)`;
|
|
86
|
+
}
|
|
87
|
+
if (range.end <= range.start) {
|
|
88
|
+
return `selector "${value}": a time range needs its end after its start`;
|
|
89
|
+
}
|
|
90
|
+
return undefined;
|
|
91
|
+
}
|
|
92
|
+
const frameIndex = z.number().int().nonnegative();
|
|
93
|
+
const framesSchema = z
|
|
94
|
+
.looseObject({ from: frameIndex, to: frameIndex })
|
|
95
|
+
.refine((frames) => frames.from <= frames.to, {
|
|
96
|
+
message: "ag:frames needs from at or before to",
|
|
97
|
+
});
|
|
98
|
+
const cellSchema = z.looseObject({ column: frameIndex, row: frameIndex });
|
|
99
|
+
const targetObject = z.looseObject({
|
|
100
|
+
source: z.string().min(1),
|
|
101
|
+
"ag:version": hex64.optional(),
|
|
102
|
+
"ag:frame": z.number().int().nonnegative().optional(),
|
|
103
|
+
"ag:view": z.number().int().nonnegative().optional(),
|
|
104
|
+
"ag:mask": z.string().min(1).optional(),
|
|
105
|
+
"ag:frames": framesSchema.optional(),
|
|
106
|
+
"ag:cell": cellSchema.optional(),
|
|
107
|
+
selector: selectorSchema.optional(),
|
|
108
|
+
});
|
|
109
|
+
const bodyItem = z.union([
|
|
110
|
+
z.looseObject({
|
|
111
|
+
type: z.literal("TextualBody"),
|
|
112
|
+
value: z.string(),
|
|
113
|
+
purpose: z.string().optional(),
|
|
114
|
+
format: z.string().optional(),
|
|
115
|
+
language: z.string().optional(),
|
|
116
|
+
}),
|
|
117
|
+
z.looseObject({
|
|
118
|
+
type: z.literal("SpecificResource"),
|
|
119
|
+
source: z.string().min(1),
|
|
120
|
+
purpose: z.string().optional(),
|
|
121
|
+
}),
|
|
122
|
+
]);
|
|
123
|
+
const confirmationSchema = z.looseObject({
|
|
124
|
+
method: z.string().min(1),
|
|
125
|
+
digest: z.string().optional(),
|
|
126
|
+
operator: z.string().optional(),
|
|
127
|
+
delegatedBy: z.string().optional(),
|
|
128
|
+
});
|
|
129
|
+
const annotationSchema = z.looseObject({
|
|
130
|
+
id: z
|
|
131
|
+
.string()
|
|
132
|
+
.regex(/^#[0-9a-f]{16}$/, 'must look like "#<16 hex>"')
|
|
133
|
+
.optional(),
|
|
134
|
+
type: z.literal("Annotation"),
|
|
135
|
+
motivation: z.enum(MOTIVATIONS),
|
|
136
|
+
created: isoUtc,
|
|
137
|
+
body: z.union([bodyItem, z.array(bodyItem)]).optional(),
|
|
138
|
+
target: z.union([z.string().min(1), targetObject]),
|
|
139
|
+
"ag:action": z.enum(ACTIONS).optional(),
|
|
140
|
+
"ag:resolves": annotationRef.optional(),
|
|
141
|
+
"ag:confirmation": confirmationSchema.optional(),
|
|
142
|
+
});
|
|
143
|
+
const versionSchema = z.looseObject({
|
|
144
|
+
sha256: hex64,
|
|
145
|
+
provenanceSha256: hex64.optional(),
|
|
146
|
+
contentSha256: hex64.optional(),
|
|
147
|
+
run: z.string().optional(),
|
|
148
|
+
candidate: z.string().optional(),
|
|
149
|
+
at: isoUtc,
|
|
150
|
+
answers: z.array(annotationRef).optional(),
|
|
151
|
+
confirmation: confirmationSchema.optional(),
|
|
152
|
+
});
|
|
153
|
+
const collectionSchema = z.looseObject({
|
|
154
|
+
id: z.string().min(1),
|
|
155
|
+
type: z.literal("AnnotationCollection"),
|
|
156
|
+
});
|
|
157
|
+
const versionPositions = new WeakMap();
|
|
158
|
+
export function versionSourceIndex(version, fallback) {
|
|
159
|
+
return versionPositions.get(version) ?? fallback;
|
|
160
|
+
}
|
|
161
|
+
/** The id an annotation's content earns: `#` and the first 16 hex of the hash of it without `id`. */
|
|
162
|
+
export function annotationId(annotation) {
|
|
163
|
+
const content = { ...annotation };
|
|
164
|
+
delete content["id"];
|
|
165
|
+
return `#${sha256Hex(canonicalJson(content)).slice(0, 16)}`;
|
|
166
|
+
}
|
|
167
|
+
/** A copy of the annotation with its id set, first. */
|
|
168
|
+
export function withId(annotation) {
|
|
169
|
+
const content = { ...annotation };
|
|
170
|
+
delete content["id"];
|
|
171
|
+
return { id: annotationId(annotation), ...content };
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* A union's issues come from the branch of the input's own type (a target object, not a target
|
|
175
|
+
* path), so a bad anchor is reported by its member rather than as "Invalid input".
|
|
176
|
+
*/
|
|
177
|
+
function flatten(issue, prefix) {
|
|
178
|
+
const path = [...prefix, ...issue.path];
|
|
179
|
+
if (issue.code !== "invalid_union")
|
|
180
|
+
return [{ ...issue, path }];
|
|
181
|
+
const branches = issue.errors.filter((branch) => !branch.every((i) => i.code === "invalid_type" && i.path.length === 0));
|
|
182
|
+
if (branches.length !== 1)
|
|
183
|
+
return [{ ...issue, path }];
|
|
184
|
+
return branches[0].flatMap((inner) => flatten(inner, path));
|
|
185
|
+
}
|
|
186
|
+
function issues(error) {
|
|
187
|
+
return error.issues
|
|
188
|
+
.flatMap((issue) => flatten(issue, []))
|
|
189
|
+
.map((issue) => `${issue.path.length ? issue.path.join(".") : "(root)"}: ${issue.message}`)
|
|
190
|
+
.join("; ");
|
|
191
|
+
}
|
|
192
|
+
function parseWith(schema, value, where) {
|
|
193
|
+
const result = schema.safeParse(value);
|
|
194
|
+
if (!result.success)
|
|
195
|
+
throw new InputError(`${where}: ${issues(result.error)}`);
|
|
196
|
+
return result.data;
|
|
197
|
+
}
|
|
198
|
+
function checkAnnotation(annotation, where) {
|
|
199
|
+
const action = annotation["ag:action"];
|
|
200
|
+
const fail = (message) => {
|
|
201
|
+
throw new InputError(`${where}: ${message}`);
|
|
202
|
+
};
|
|
203
|
+
switch (annotation.motivation) {
|
|
204
|
+
case "assessing":
|
|
205
|
+
if (action !== "approve" && action !== "reject") {
|
|
206
|
+
fail('an assessing annotation needs "ag:action" of "approve" or "reject"');
|
|
207
|
+
}
|
|
208
|
+
break;
|
|
209
|
+
case "moderating":
|
|
210
|
+
if (action === undefined || action === "approve" || action === "reject") {
|
|
211
|
+
fail('a moderating annotation needs an "ag:action" other than approve or reject');
|
|
212
|
+
}
|
|
213
|
+
break;
|
|
214
|
+
case "describing":
|
|
215
|
+
case "tagging":
|
|
216
|
+
if (action !== undefined && action !== "card-edit") {
|
|
217
|
+
fail('a describing or tagging annotation may only carry "ag:action": "card-edit"');
|
|
218
|
+
}
|
|
219
|
+
break;
|
|
220
|
+
default:
|
|
221
|
+
}
|
|
222
|
+
if (action === "resolve" && annotation["ag:resolves"] === undefined) {
|
|
223
|
+
fail('a resolve annotation names the request in "ag:resolves"');
|
|
224
|
+
}
|
|
225
|
+
const expected = annotationId(annotation);
|
|
226
|
+
if (annotation.id !== expected) {
|
|
227
|
+
fail(`id ${annotation.id} does not match its content (expected ${expected})`);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
function time(at) {
|
|
231
|
+
return Date.parse(at);
|
|
232
|
+
}
|
|
233
|
+
function byTime(key, tie) {
|
|
234
|
+
return (a, b) => {
|
|
235
|
+
const delta = time(a[key]) - time(b[key]);
|
|
236
|
+
if (delta !== 0)
|
|
237
|
+
return delta;
|
|
238
|
+
const left = tie(a);
|
|
239
|
+
const right = tie(b);
|
|
240
|
+
return left < right ? -1 : left > right ? 1 : 0;
|
|
241
|
+
};
|
|
242
|
+
}
|
|
243
|
+
function build(head, versions, annotations, source) {
|
|
244
|
+
const seenAnnotations = new Map();
|
|
245
|
+
for (const annotation of annotations) {
|
|
246
|
+
if (!seenAnnotations.has(annotation.id))
|
|
247
|
+
seenAnnotations.set(annotation.id, annotation);
|
|
248
|
+
}
|
|
249
|
+
const sortedAnnotations = [...seenAnnotations.values()].sort(byTime("created", (a) => a.id));
|
|
250
|
+
const seenVersions = new Map();
|
|
251
|
+
for (const version of [...versions].sort(byTime("at", (v) => v.sha256))) {
|
|
252
|
+
if (!seenVersions.has(version.sha256))
|
|
253
|
+
seenVersions.set(version.sha256, version);
|
|
254
|
+
}
|
|
255
|
+
const sortedVersions = [...seenVersions.values()].sort(byTime("at", (v) => v.sha256));
|
|
256
|
+
const editing = new Set(sortedAnnotations.filter((a) => a.motivation === "editing").map((a) => a.id));
|
|
257
|
+
for (const version of sortedVersions) {
|
|
258
|
+
for (const answered of version.answers ?? []) {
|
|
259
|
+
if (!editing.has(answered)) {
|
|
260
|
+
throw new InputError(`${source}: version ${version.sha256} answers ${answered}, which is not an editing annotation in this record.`);
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
return { ...head, versions: sortedVersions, annotations: sortedAnnotations };
|
|
265
|
+
}
|
|
266
|
+
/** Validates an already-parsed review record; refuses with InputError naming `source`. */
|
|
267
|
+
export function validateReview(value, source) {
|
|
268
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
269
|
+
throw new InputError(`${source}: a review record is a JSON object.`);
|
|
270
|
+
}
|
|
271
|
+
const raw = value;
|
|
272
|
+
const collection = parseWith(collectionSchema, raw, source);
|
|
273
|
+
readFormat("review", { format: raw["ag:format"] }, source, LIBRARY_FORMATS.review);
|
|
274
|
+
const rawVersions = raw["ag:versions"] ?? [];
|
|
275
|
+
if (!Array.isArray(rawVersions))
|
|
276
|
+
throw new InputError(`${source}: "ag:versions" must be an array.`);
|
|
277
|
+
const first = raw["first"];
|
|
278
|
+
const items = first === undefined ? [] : (first?.items ?? []);
|
|
279
|
+
if (!Array.isArray(items))
|
|
280
|
+
throw new InputError(`${source}: "first.items" must be an array.`);
|
|
281
|
+
const versions = rawVersions.map((entry, index) => {
|
|
282
|
+
const version = parseWith(versionSchema, entry, `${source}: ag:versions[${index}]`);
|
|
283
|
+
versionPositions.set(version, index);
|
|
284
|
+
return version;
|
|
285
|
+
});
|
|
286
|
+
const annotations = items.map((entry, index) => {
|
|
287
|
+
const where = `${source}: first.items[${index}]`;
|
|
288
|
+
const parsed = parseWith(annotationSchema, entry, where);
|
|
289
|
+
if (parsed.id === undefined)
|
|
290
|
+
throw new InputError(`${where}: id is required.`);
|
|
291
|
+
const annotation = parsed;
|
|
292
|
+
checkAnnotation(annotation, where);
|
|
293
|
+
return annotation;
|
|
294
|
+
});
|
|
295
|
+
const extra = {};
|
|
296
|
+
for (const [key, member] of Object.entries(raw))
|
|
297
|
+
if (!CORE_KEYS.has(key))
|
|
298
|
+
extra[key] = member;
|
|
299
|
+
return build({ id: collection.id, context: raw["@context"] ?? CONTEXT, extra }, versions, annotations, source);
|
|
300
|
+
}
|
|
301
|
+
function lineFailure(source, line, detail) {
|
|
302
|
+
return new InputError(`${source}: line ${line} is not valid review JSON (${detail}).`);
|
|
303
|
+
}
|
|
304
|
+
/**
|
|
305
|
+
* Reads a review record. Strict JSON parses as is; otherwise each line inside the versions and
|
|
306
|
+
* items sections is read as one object, tolerating a missing, extra or doubled comma. A union
|
|
307
|
+
* merge of two branches that each appended a version and an annotation interleaves the sections
|
|
308
|
+
* and repeats the lines between them; the reader reads that as the union too.
|
|
309
|
+
*/
|
|
310
|
+
export function parseReview(text, source) {
|
|
311
|
+
try {
|
|
312
|
+
return validateReview(JSON.parse(text), source);
|
|
313
|
+
}
|
|
314
|
+
catch (error) {
|
|
315
|
+
if (!(error instanceof SyntaxError))
|
|
316
|
+
throw error;
|
|
317
|
+
}
|
|
318
|
+
const lines = text.split(/\r?\n/);
|
|
319
|
+
const skeleton = [];
|
|
320
|
+
const seen = new Set();
|
|
321
|
+
const versions = [];
|
|
322
|
+
const items = [];
|
|
323
|
+
let section;
|
|
324
|
+
lines.forEach((line, index) => {
|
|
325
|
+
const trimmed = line.trim();
|
|
326
|
+
if (section) {
|
|
327
|
+
if (trimmed.startsWith("]")) {
|
|
328
|
+
section = undefined;
|
|
329
|
+
if (!seen.has(trimmed))
|
|
330
|
+
skeleton.push(line);
|
|
331
|
+
seen.add(trimmed);
|
|
332
|
+
return;
|
|
333
|
+
}
|
|
334
|
+
const body = trimmed.replace(/^,+/, "").replace(/,+$/, "").trim();
|
|
335
|
+
if (body === "")
|
|
336
|
+
return;
|
|
337
|
+
let parsed;
|
|
338
|
+
try {
|
|
339
|
+
parsed = JSON.parse(body);
|
|
340
|
+
}
|
|
341
|
+
catch (error) {
|
|
342
|
+
throw lineFailure(source, index + 1, error.message);
|
|
343
|
+
}
|
|
344
|
+
if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) {
|
|
345
|
+
throw lineFailure(source, index + 1, "expected an object");
|
|
346
|
+
}
|
|
347
|
+
const object = parsed;
|
|
348
|
+
// A union merge can leave a line in the other section: its own shape says which it is.
|
|
349
|
+
if (object["type"] === "Annotation")
|
|
350
|
+
items.push(parsed);
|
|
351
|
+
else if (object["type"] === undefined && typeof object["sha256"] === "string") {
|
|
352
|
+
versions.push(parsed);
|
|
353
|
+
}
|
|
354
|
+
else
|
|
355
|
+
section.push(parsed);
|
|
356
|
+
return;
|
|
357
|
+
}
|
|
358
|
+
// A union merge can repeat a header or footer line; each is read once.
|
|
359
|
+
if (trimmed === "" || !seen.has(trimmed))
|
|
360
|
+
skeleton.push(line);
|
|
361
|
+
seen.add(trimmed);
|
|
362
|
+
if (trimmed.endsWith('"ag:versions": ['))
|
|
363
|
+
section = versions;
|
|
364
|
+
else if (trimmed.endsWith('"items": ['))
|
|
365
|
+
section = items;
|
|
366
|
+
});
|
|
367
|
+
const skeletonText = skeleton.join("\n");
|
|
368
|
+
let head;
|
|
369
|
+
try {
|
|
370
|
+
head = JSON.parse(skeletonText);
|
|
371
|
+
}
|
|
372
|
+
catch {
|
|
373
|
+
try {
|
|
374
|
+
head = JSON.parse(skeletonText.replace(/,(\s*[}\]])/g, "$1"));
|
|
375
|
+
}
|
|
376
|
+
catch (error) {
|
|
377
|
+
throw new InputError(`${source}: the header and footer lines are not valid JSON (${error.message}).`);
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
if (typeof head !== "object" || head === null || Array.isArray(head)) {
|
|
381
|
+
throw new InputError(`${source}: a review record is a JSON object.`);
|
|
382
|
+
}
|
|
383
|
+
const object = head;
|
|
384
|
+
const first = (object["first"] ?? {});
|
|
385
|
+
return validateReview({ ...object, "ag:versions": versions, first: { ...first, items } }, source);
|
|
386
|
+
}
|
|
387
|
+
function leadingKeyLine(object, key) {
|
|
388
|
+
const { [key]: lead, ...rest } = object;
|
|
389
|
+
const tail = canonicalJson(rest);
|
|
390
|
+
return `{${JSON.stringify(key)}:${canonicalJson(lead)}${tail === "{}" ? "}" : `,${tail.slice(1)}`}`;
|
|
391
|
+
}
|
|
392
|
+
function itemLines(items) {
|
|
393
|
+
return items.map((line, index) => (index < items.length - 1 ? `${line},` : line));
|
|
394
|
+
}
|
|
395
|
+
/** The canonical text: fixed header and footer, one line per version and annotation. */
|
|
396
|
+
export function writeReview(record) {
|
|
397
|
+
const lines = [
|
|
398
|
+
"{",
|
|
399
|
+
`"@context": ${canonicalJson(record.context)},`,
|
|
400
|
+
`"id": ${JSON.stringify(record.id)},`,
|
|
401
|
+
`"type": "AnnotationCollection",`,
|
|
402
|
+
`"ag:format": ${JSON.stringify(FORMAT_LINE)},`,
|
|
403
|
+
];
|
|
404
|
+
for (const key of Object.keys(record.extra).sort()) {
|
|
405
|
+
if (record.extra[key] === undefined)
|
|
406
|
+
continue;
|
|
407
|
+
lines.push(`${JSON.stringify(key)}: ${canonicalJson(record.extra[key])},`);
|
|
408
|
+
}
|
|
409
|
+
lines.push('"ag:versions": [', ...itemLines(record.versions.map((v) => leadingKeyLine(v, "sha256"))), "],", '"first": { "type": "AnnotationPage", "items": [', ...itemLines(record.annotations.map((a) => leadingKeyLine(a, "id"))), "] }", "}");
|
|
410
|
+
const text = `${lines.join("\n")}\n`;
|
|
411
|
+
JSON.parse(text);
|
|
412
|
+
return text;
|
|
413
|
+
}
|
|
414
|
+
/** A record with no versions and no annotations; `address` is its collection id. */
|
|
415
|
+
export function emptyReview(address) {
|
|
416
|
+
return { id: address, context: CONTEXT, extra: {}, versions: [], annotations: [] };
|
|
417
|
+
}
|
|
418
|
+
/** A new record with the version added (the same media sha256 keeps its earliest entry). */
|
|
419
|
+
export function appendVersion(record, version) {
|
|
420
|
+
const parsed = parseWith(versionSchema, version, `${record.id}: version`);
|
|
421
|
+
return build(record, [...record.versions, parsed], record.annotations, record.id);
|
|
422
|
+
}
|
|
423
|
+
/**
|
|
424
|
+
* A new record whose version `sha256` derives from `lineage`: each new file entry replaces that
|
|
425
|
+
* file's earlier entry on the version, other entries are kept. Used when a source edit renders the
|
|
426
|
+
* same media again, so the version records the source bytes it now derives from.
|
|
427
|
+
*/
|
|
428
|
+
export function updateVersionLineage(record, sha256, lineage) {
|
|
429
|
+
const versions = record.versions.map((version) => {
|
|
430
|
+
if (version.sha256 !== sha256)
|
|
431
|
+
return version;
|
|
432
|
+
const files = new Set(lineage.map((entry) => entry.file));
|
|
433
|
+
const earlier = Array.isArray(version["lineage"]) ? version["lineage"] : [];
|
|
434
|
+
const kept = earlier.filter((entry) => !(typeof entry === "object" &&
|
|
435
|
+
entry !== null &&
|
|
436
|
+
files.has(entry.file)));
|
|
437
|
+
return { ...version, lineage: [...kept, ...lineage] };
|
|
438
|
+
});
|
|
439
|
+
return build(record, versions, record.annotations, record.id);
|
|
440
|
+
}
|
|
441
|
+
/** A new record with the annotation added, its id computed; the same content is added once. */
|
|
442
|
+
export function appendAnnotation(record, annotation) {
|
|
443
|
+
const parsed = parseWith(annotationSchema, annotation, `${record.id}: annotation`);
|
|
444
|
+
const content = { ...parsed };
|
|
445
|
+
const stamped = { ...content, id: annotationId(content) };
|
|
446
|
+
checkAnnotation(stamped, `${record.id}: annotation`);
|
|
447
|
+
return build(record, record.versions, [...record.annotations, stamped], record.id);
|
|
448
|
+
}
|
|
449
|
+
/**
|
|
450
|
+
* The stamp for the next version or annotation written into `record`: `now`, or 1 ms after the
|
|
451
|
+
* latest stamp already in the record when that is later. Stamps order the record, so what a writer
|
|
452
|
+
* appends sorts after everything already there even when another machine's clock was ahead.
|
|
453
|
+
*/
|
|
454
|
+
export function nextStamp(record, now = new Date()) {
|
|
455
|
+
let latest = Number.NEGATIVE_INFINITY;
|
|
456
|
+
for (const version of record.versions)
|
|
457
|
+
latest = Math.max(latest, time(version.at));
|
|
458
|
+
for (const annotation of record.annotations)
|
|
459
|
+
latest = Math.max(latest, time(annotation.created));
|
|
460
|
+
return new Date(Math.max(now.getTime(), latest + 1)).toISOString();
|
|
461
|
+
}
|
|
462
|
+
/** The 1-based position of a version in the stack, or undefined when it is not there. */
|
|
463
|
+
export function versionNumber(record, sha256) {
|
|
464
|
+
const index = record.versions.findIndex((v) => v.sha256 === sha256);
|
|
465
|
+
return index < 0 ? undefined : index + 1;
|
|
466
|
+
}
|
|
467
|
+
/** The latest version in the stack. */
|
|
468
|
+
export function currentVersion(record) {
|
|
469
|
+
return record.versions.at(-1);
|
|
470
|
+
}
|
|
471
|
+
/** The version an annotation targets, by sha256. */
|
|
472
|
+
export function targetVersion(annotation) {
|
|
473
|
+
const target = annotation.target;
|
|
474
|
+
return typeof target === "string" ? undefined : target["ag:version"];
|
|
475
|
+
}
|
|
476
|
+
/** The latest assessment decides; else an unanswered, unresolved change request; else pending. */
|
|
477
|
+
export function versionStatus(record, sha256) {
|
|
478
|
+
const assessments = record.annotations.filter((a) => a.motivation === "assessing" && targetVersion(a) === sha256);
|
|
479
|
+
const latest = assessments.at(-1);
|
|
480
|
+
if (latest)
|
|
481
|
+
return latest["ag:action"] === "approve" ? "approved" : "rejected";
|
|
482
|
+
const answered = new Set(record.versions.flatMap((v) => v.answers ?? []));
|
|
483
|
+
const resolved = new Set(record.annotations.filter((a) => a["ag:action"] === "resolve").map((a) => a["ag:resolves"]));
|
|
484
|
+
const open = record.annotations.some((a) => a.motivation === "editing" &&
|
|
485
|
+
targetVersion(a) === sha256 &&
|
|
486
|
+
!answered.has(a.id) &&
|
|
487
|
+
!resolved.has(a.id));
|
|
488
|
+
return open ? "changes-requested" : "pending";
|
|
489
|
+
}
|
|
490
|
+
/** The tag a person's `tagging` annotation gives a version to mark it as a placeholder. */
|
|
491
|
+
export const PLACEHOLDER_TAG = "placeholder";
|
|
492
|
+
/** The body of a placeholder mark: a W3C tag. */
|
|
493
|
+
export function placeholderBody() {
|
|
494
|
+
return { type: "TextualBody", purpose: "tagging", value: PLACEHOLDER_TAG };
|
|
495
|
+
}
|
|
496
|
+
/**
|
|
497
|
+
* The annotations that mark version `sha256` as a placeholder, oldest first: each `tagging`
|
|
498
|
+
* annotation targeting that version with a tag body whose value is `placeholder`.
|
|
499
|
+
*/
|
|
500
|
+
export function placeholderMarks(record, sha256) {
|
|
501
|
+
return record.annotations.filter((a) => {
|
|
502
|
+
if (a.motivation !== "tagging" || targetVersion(a) !== sha256)
|
|
503
|
+
return false;
|
|
504
|
+
const bodies = a.body === undefined ? [] : Array.isArray(a.body) ? a.body : [a.body];
|
|
505
|
+
return bodies.some((b) => b.type === "TextualBody" &&
|
|
506
|
+
(b.purpose === undefined || b.purpose === "tagging") &&
|
|
507
|
+
typeof b.value === "string" &&
|
|
508
|
+
b.value.trim().toLowerCase() === PLACEHOLDER_TAG);
|
|
509
|
+
});
|
|
510
|
+
}
|
|
511
|
+
/** Every path the record names: target sources, masks and linked reference files. */
|
|
512
|
+
export function reviewPaths(record) {
|
|
513
|
+
const paths = new Set();
|
|
514
|
+
for (const annotation of record.annotations) {
|
|
515
|
+
const target = annotation.target;
|
|
516
|
+
if (typeof target === "string")
|
|
517
|
+
paths.add(target);
|
|
518
|
+
else {
|
|
519
|
+
paths.add(target.source);
|
|
520
|
+
if (target["ag:mask"] !== undefined)
|
|
521
|
+
paths.add(target["ag:mask"]);
|
|
522
|
+
}
|
|
523
|
+
const body = annotation.body === undefined ? [] : [annotation.body].flat();
|
|
524
|
+
for (const part of body)
|
|
525
|
+
if (part.type === "SpecificResource")
|
|
526
|
+
paths.add(part.source);
|
|
527
|
+
}
|
|
528
|
+
return [...paths];
|
|
529
|
+
}
|
|
530
|
+
/** Refuses (InputError) any named path that leaves the library root. */
|
|
531
|
+
export function checkReviewPaths(record, libraryRoot, recordDir, source) {
|
|
532
|
+
for (const path of reviewPaths(record))
|
|
533
|
+
libraryPath(libraryRoot, recordDir, path, source);
|
|
534
|
+
}
|
|
535
|
+
/**
|
|
536
|
+
* The record's head (design section 3.3): a digest that holds it changes once any line is added,
|
|
537
|
+
* whether by a review action, a pull or a union merge, so a stored confirmation cannot be replayed.
|
|
538
|
+
*/
|
|
539
|
+
export function recordHead(record) {
|
|
540
|
+
const lines = [
|
|
541
|
+
...record.versions.map((v) => leadingKeyLine(v, "sha256")),
|
|
542
|
+
...record.annotations.map((a) => leadingKeyLine(a, "id")),
|
|
543
|
+
];
|
|
544
|
+
return { last: record.annotations.at(-1)?.id ?? null, items: sha256Hex(lines.join("\n")) };
|
|
545
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import type { Caller } from "../calls.ts";
|
|
2
|
+
import type { KindTraits } from "../frames.ts";
|
|
3
|
+
import type { LoadedReference } from "../types.ts";
|
|
4
|
+
/** The `version` of a JSON or Markdown style bible's text; undefined when it has none. */
|
|
5
|
+
export declare function bibleVersionOfText(text: string, json: boolean): string | undefined;
|
|
6
|
+
/** Whether an asset was made under another bible version than the current one: equality only. */
|
|
7
|
+
export declare function madeUnderOtherVersion(cardBible: string | undefined, current: string | undefined): boolean;
|
|
8
|
+
/** One cached answer: whether the asset with this media should be redone for this version pair. */
|
|
9
|
+
export interface StalenessAnswer {
|
|
10
|
+
/** The media's sha256 (the card's `lock.sha256`). */
|
|
11
|
+
sha256: string;
|
|
12
|
+
/** The bible version the asset was made under. */
|
|
13
|
+
from: string;
|
|
14
|
+
/** The bible version it was judged against. */
|
|
15
|
+
to: string;
|
|
16
|
+
/** True when the call answered that the asset should be redone. */
|
|
17
|
+
redo: boolean;
|
|
18
|
+
/** The probability the model gave that it should be redone, when it reported one. */
|
|
19
|
+
probability?: number;
|
|
20
|
+
/**
|
|
21
|
+
* True: the call was given the bible's diff from its Git history (an asset whose version the
|
|
22
|
+
* history does not hold, or whose diff cannot be made, is left unjudged).
|
|
23
|
+
*/
|
|
24
|
+
history: true;
|
|
25
|
+
/** True: the call was shown the asset's thumbnail (an asset with none is left unjudged). */
|
|
26
|
+
thumbnail: true;
|
|
27
|
+
model: string;
|
|
28
|
+
at: string;
|
|
29
|
+
}
|
|
30
|
+
/** The cached answers, one file per asset sha256 and version pair, under `<stateDir>/staleness/`. */
|
|
31
|
+
export declare class StalenessCache {
|
|
32
|
+
readonly dir: string;
|
|
33
|
+
constructor(stateDir: string);
|
|
34
|
+
private file;
|
|
35
|
+
/** The cached answer for the asset and version pair; undefined when it was never judged. */
|
|
36
|
+
get(sha256: string, from: string, to: string): StalenessAnswer | undefined;
|
|
37
|
+
set(answer: StalenessAnswer): void;
|
|
38
|
+
}
|
|
39
|
+
/** What an asset's staleness judgement is: `redo`, `keep`, or `unjudged` while nothing is cached. */
|
|
40
|
+
export type Judgement = "redo" | "keep" | "unjudged";
|
|
41
|
+
/** The cached judgement of an asset made under `from`, against `to`. */
|
|
42
|
+
export declare function judgementOf(cache: StalenessCache, sha256: string | undefined, from: string, to: string): Judgement;
|
|
43
|
+
/** The bible's text at an earlier version, from its Git history. */
|
|
44
|
+
export interface BibleChange {
|
|
45
|
+
/** The commit whose bible text has the earlier version. */
|
|
46
|
+
commit: string;
|
|
47
|
+
/** The unified diff from that text to the current file, or a note that the two texts match. */
|
|
48
|
+
diff: string;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* The bible's change from version `from` to its current text: the newest commit of the bible
|
|
52
|
+
* file whose text carries `from`, diffed with `git diff` against the working file. Undefined when
|
|
53
|
+
* no commit holds that version (the file was never committed at it, or it is outside Git) or the
|
|
54
|
+
* diff cannot be made: with no change to show, the asset is not judged.
|
|
55
|
+
*/
|
|
56
|
+
export declare function bibleChange(biblePath: string, from: string): BibleChange | undefined;
|
|
57
|
+
/** One asset made under another bible version, as the judgement needs it. */
|
|
58
|
+
export interface StaleSubject {
|
|
59
|
+
asset: string;
|
|
60
|
+
/** The media file, absolute. */
|
|
61
|
+
media: string;
|
|
62
|
+
/** The provenance file the card names, absolute: a strip's frame size is read from it. */
|
|
63
|
+
provenance?: string;
|
|
64
|
+
/** The card's `lock.sha256`. */
|
|
65
|
+
sha256: string;
|
|
66
|
+
/** The bible version the card names. */
|
|
67
|
+
from: string;
|
|
68
|
+
kind?: string;
|
|
69
|
+
subject?: string;
|
|
70
|
+
tags: string[];
|
|
71
|
+
}
|
|
72
|
+
/** The thumbnail the call is shown: 512 px at most, a strip's key frames, a 3D asset's turntable. */
|
|
73
|
+
export declare function stalenessThumbnail(subject: StaleSubject, traits?: KindTraits): Promise<LoadedReference[]>;
|
|
74
|
+
/** The text the staleness call is given. */
|
|
75
|
+
export declare function stalenessPrompt(subject: StaleSubject, to: string, change: BibleChange): string;
|
|
76
|
+
/** The Boolean question the staleness call answers. */
|
|
77
|
+
export declare const STALENESS_QUESTION: {
|
|
78
|
+
readonly type: "boolean";
|
|
79
|
+
readonly instructions: "Does this change in the art direction mean this asset should be redone? Answer true only when the change affects how an asset like this one should look; a change that leaves it as the bible now wants (a typo fix, a rule for other kinds or subjects) is false.";
|
|
80
|
+
readonly whenTrue: "the asset should be redone under the current bible";
|
|
81
|
+
readonly whenFalse: "the asset still fits the current bible";
|
|
82
|
+
};
|
|
83
|
+
/**
|
|
84
|
+
* Judges one asset: one `bible-staleness` decision through the caller (inside the run's budget),
|
|
85
|
+
* shown its thumbnail (`stalenessThumbnail`), cached by the asset's sha256 and the version pair.
|
|
86
|
+
* An asset with no thumbnail on this machine is never judged: the caller leaves it unjudged.
|
|
87
|
+
*/
|
|
88
|
+
export declare function judgeStaleness(caller: Caller, subject: StaleSubject, to: string, change: BibleChange, cache: StalenessCache, images: LoadedReference[], now?: () => Date): Promise<StalenessAnswer>;
|