@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,20 @@
|
|
|
1
|
+
/** The search paths' first segments. */
|
|
2
|
+
export declare const SEARCH_PATHS: readonly ["find", "like", "where"];
|
|
3
|
+
export type SearchPath = (typeof SEARCH_PATHS)[number];
|
|
4
|
+
/** The find input of `find`'s own arguments that a search path stands for. */
|
|
5
|
+
export interface PathQuery {
|
|
6
|
+
words?: string;
|
|
7
|
+
like?: string;
|
|
8
|
+
where?: string[];
|
|
9
|
+
}
|
|
10
|
+
/** The search path an address names, with its find input; undefined for any other address. */
|
|
11
|
+
export declare function parseSearchPath(uri: string, game: string): {
|
|
12
|
+
address: string;
|
|
13
|
+
query: PathQuery;
|
|
14
|
+
} | undefined;
|
|
15
|
+
/** The templates `resources/templates/list` adds while the slot is loaded. */
|
|
16
|
+
export declare function searchTemplates(base: string): {
|
|
17
|
+
uriTemplate: string;
|
|
18
|
+
name: string;
|
|
19
|
+
mimeType: string;
|
|
20
|
+
}[];
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The tree's search paths (design sections 2 and 7.5), served while the search slot is loaded:
|
|
3
|
+
* `find/{words}`, `like/{asset}` and `where/{filter}` under the game root. Each runs the same find
|
|
4
|
+
* as the `find` command with the same input, so both return the same hits. A read never spends and
|
|
5
|
+
* writes no sheet.
|
|
6
|
+
*/
|
|
7
|
+
import { InputError } from "../errors.js";
|
|
8
|
+
import { formatAddress, parseAddress } from "./address.js";
|
|
9
|
+
/** The search paths' first segments. */
|
|
10
|
+
export const SEARCH_PATHS = ["find", "like", "where"];
|
|
11
|
+
/** The search path an address names, with its find input; undefined for any other address. */
|
|
12
|
+
export function parseSearchPath(uri, game) {
|
|
13
|
+
let at;
|
|
14
|
+
try {
|
|
15
|
+
at = parseAddress(uri);
|
|
16
|
+
}
|
|
17
|
+
catch {
|
|
18
|
+
return undefined;
|
|
19
|
+
}
|
|
20
|
+
const [first, value, ...rest] = at.segments;
|
|
21
|
+
if (!SEARCH_PATHS.includes(first ?? ""))
|
|
22
|
+
return undefined;
|
|
23
|
+
if (at.game !== game) {
|
|
24
|
+
throw new InputError(`this project's game is "${game}", not "${at.game}"`);
|
|
25
|
+
}
|
|
26
|
+
if (value === undefined || rest.length > 0 || at.folder) {
|
|
27
|
+
throw new InputError(`${uri}: a search path is ${first}/{${first === "find" ? "words" : first === "like" ? "asset" : "filter"}}`);
|
|
28
|
+
}
|
|
29
|
+
const address = formatAddress(at.game, at.segments);
|
|
30
|
+
if (first === "find")
|
|
31
|
+
return { address, query: { words: value } };
|
|
32
|
+
if (first === "where")
|
|
33
|
+
return { address, query: { where: [value] } };
|
|
34
|
+
return { address, query: { like: formatAddress(at.game, [value]) } };
|
|
35
|
+
}
|
|
36
|
+
/** The templates `resources/templates/list` adds while the slot is loaded. */
|
|
37
|
+
export function searchTemplates(base) {
|
|
38
|
+
const json = "application/json";
|
|
39
|
+
return [
|
|
40
|
+
{ uriTemplate: `${base}/find/{words}`, name: "assets found by words", mimeType: json },
|
|
41
|
+
{ uriTemplate: `${base}/like/{asset}`, name: "assets that look like an asset", mimeType: json },
|
|
42
|
+
{ uriTemplate: `${base}/where/{filter}`, name: "assets whose fields match", mimeType: json },
|
|
43
|
+
];
|
|
44
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import type { McpServer } from "@modelcontextprotocol/server";
|
|
2
|
+
import type { KindTraits } from "../frames.ts";
|
|
3
|
+
import type { PathQuery } from "./search.ts";
|
|
4
|
+
/** Runs a find for a search path: the same call as the `find` command, without a sheet. */
|
|
5
|
+
export type SearchRunner = (query: PathQuery) => Promise<Record<string, unknown>>;
|
|
6
|
+
/** The most entries one `resources/list` page returns. */
|
|
7
|
+
export declare const LIST_PAGE = 200;
|
|
8
|
+
export declare class TreeServer {
|
|
9
|
+
/** The project directory served. */
|
|
10
|
+
readonly dir: string;
|
|
11
|
+
private readonly stateDir;
|
|
12
|
+
private readonly subscribed;
|
|
13
|
+
private readonly candidates;
|
|
14
|
+
private server?;
|
|
15
|
+
private legacy;
|
|
16
|
+
private last?;
|
|
17
|
+
/** Tool calls running now. */
|
|
18
|
+
private running;
|
|
19
|
+
/** The fingerprint steps, one at a time. */
|
|
20
|
+
private queue;
|
|
21
|
+
private readonly search;
|
|
22
|
+
/** The loaded kinds' `frames` traits, which a strip kind's thumbnails read; core's when absent. */
|
|
23
|
+
private readonly traits;
|
|
24
|
+
/** `search` is given only while a loaded extension fills the search slot. */
|
|
25
|
+
constructor(dir: string, stateDir: string, search?: SearchRunner, traits?: KindTraits);
|
|
26
|
+
/** The project, opened fresh for each request, so a change on disk shows at the next read. */
|
|
27
|
+
private project;
|
|
28
|
+
private tryProject;
|
|
29
|
+
/** Registers hash-bound links without granting reads of arbitrary client-supplied paths. */
|
|
30
|
+
candidateLinks(runDir: string, expectedCandidatesDigest?: string): Promise<{
|
|
31
|
+
type: "resource_link";
|
|
32
|
+
uri: string;
|
|
33
|
+
name: string;
|
|
34
|
+
mimeType: string;
|
|
35
|
+
description: string;
|
|
36
|
+
}[]>;
|
|
37
|
+
/**
|
|
38
|
+
* Previews of the run's audio candidates. The preview is the staged master itself, so its bytes
|
|
39
|
+
* are the ones the pick digest covers: inline `audio` under the read cap, else a `file://` link.
|
|
40
|
+
* A candidate whose bytes are missing or no longer match its record gets none.
|
|
41
|
+
*/
|
|
42
|
+
candidatePreviews(runDir: string): Promise<({
|
|
43
|
+
type: "audio";
|
|
44
|
+
data: string;
|
|
45
|
+
mimeType: string;
|
|
46
|
+
uri?: undefined;
|
|
47
|
+
name?: undefined;
|
|
48
|
+
description?: undefined;
|
|
49
|
+
} | {
|
|
50
|
+
type: "resource_link";
|
|
51
|
+
uri: string;
|
|
52
|
+
name: string;
|
|
53
|
+
mimeType: string;
|
|
54
|
+
description: string;
|
|
55
|
+
data?: undefined;
|
|
56
|
+
})[]>;
|
|
57
|
+
private candidateRead;
|
|
58
|
+
private facets;
|
|
59
|
+
/** Installs the resource handlers on `server`, for a connection of the given era. */
|
|
60
|
+
attach(server: McpServer, era: "legacy" | "modern"): void;
|
|
61
|
+
/** Takes the fingerprint a tool call's changes are compared with. */
|
|
62
|
+
before(): Promise<void>;
|
|
63
|
+
/**
|
|
64
|
+
* Sends `resources/updated` for each address that changed since the last fingerprint, and
|
|
65
|
+
* `resources/list_changed` when the listing changed or `wrote` (a pick or write it served).
|
|
66
|
+
*/
|
|
67
|
+
after(wrote?: boolean): Promise<void>;
|
|
68
|
+
/**
|
|
69
|
+
* Runs `call` between `before` and `after`; `tool` names it. Fingerprints are taken one at a
|
|
70
|
+
* time; a call that starts while another is running (an `ls` during a `stage`) does not take a
|
|
71
|
+
* new baseline, which would swallow what the running call wrote: it diffs instead, so those
|
|
72
|
+
* changes are announced now and the running call's own check sees the rest.
|
|
73
|
+
*/
|
|
74
|
+
around<T>(tool: string, call: (progress: () => void) => Promise<T>, ok: (r: T) => boolean): Promise<T>;
|
|
75
|
+
/** Runs one fingerprint step after the ones already queued. */
|
|
76
|
+
private serial;
|
|
77
|
+
private updated;
|
|
78
|
+
private notify;
|
|
79
|
+
}
|
|
@@ -0,0 +1,415 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The asset tree as MCP resources on the official SDK (design section 2): `resources/list` (game
|
|
3
|
+
* root, folder and card addresses, paginated by cursor), `resources/templates/list`,
|
|
4
|
+
* `resources/read` through the same resolver as `ls` and `cat`, and `resources/subscribe`.
|
|
5
|
+
*
|
|
6
|
+
* Live: the server compares a fingerprint of the project's assets and run folders before and after
|
|
7
|
+
* each of its own tool calls (and at each progress update of a long one) and sends
|
|
8
|
+
* `resources/updated` for each changed asset or run folder, and `resources/list_changed` after a
|
|
9
|
+
* pick or write it served, or when the listing changed. On a 2025-era connection only addresses
|
|
10
|
+
* the client subscribed to are sent; on a 2026-era one the SDK's listen router filters. Other
|
|
11
|
+
* changes show at the next read.
|
|
12
|
+
*/
|
|
13
|
+
import { readFile } from "node:fs/promises";
|
|
14
|
+
import { join } from "node:path";
|
|
15
|
+
import { pathToFileURL } from "node:url";
|
|
16
|
+
import { libraryPath } from "../library/paths.js";
|
|
17
|
+
import { PlanChangedError } from "../planning.js";
|
|
18
|
+
import { readRun } from "../loop.js";
|
|
19
|
+
import { digestOf } from "../confirm/records.js";
|
|
20
|
+
import { sha256Hex } from "../library/canonical.js";
|
|
21
|
+
import { READ_LIMIT, base64Length } from "./thumbs.js";
|
|
22
|
+
import { loadAssets } from "./project.js";
|
|
23
|
+
import { runIds } from "./read.js";
|
|
24
|
+
import { ProtocolError } from "@modelcontextprotocol/server";
|
|
25
|
+
import { EXIT, InputError } from "../errors.js";
|
|
26
|
+
import { parseAddress, formatAddress } from "./address.js";
|
|
27
|
+
import { changed, fingerprint, listTree } from "./list.js";
|
|
28
|
+
import { openProject } from "./project.js";
|
|
29
|
+
import { canonicalAddress, readTree } from "./read.js";
|
|
30
|
+
import { CORE_REGISTRY } from "../extensions/registry.js";
|
|
31
|
+
import { parseSearchPath, searchTemplates } from "./search.js";
|
|
32
|
+
/** The most entries one `resources/list` page returns. */
|
|
33
|
+
export const LIST_PAGE = 200;
|
|
34
|
+
/** Tools whose success changes what the library lists. */
|
|
35
|
+
const LIBRARY_WRITERS = new Set(["pick", "write_families"]);
|
|
36
|
+
/**
|
|
37
|
+
* The JSON-RPC error a refused read answers with: Invalid Params, carrying the CLI's code. An
|
|
38
|
+
* error with a code of the exit table (a search slot's refusal, say) keeps it, and its hint, if it
|
|
39
|
+
* has one, follows the message.
|
|
40
|
+
*/
|
|
41
|
+
function readError(error, uri) {
|
|
42
|
+
const own = error ?? {};
|
|
43
|
+
const hint = typeof own.hint === "string" ? ` ${own.hint}` : "";
|
|
44
|
+
const message = (error instanceof Error ? error.message : String(error)) + hint;
|
|
45
|
+
const code = error instanceof InputError
|
|
46
|
+
? "invalid_input"
|
|
47
|
+
: typeof own.code === "string" && Object.hasOwn(EXIT, own.code)
|
|
48
|
+
? own.code
|
|
49
|
+
: "internal_error";
|
|
50
|
+
return new ProtocolError(-32602, message, { uri, code, exitCode: EXIT[code] });
|
|
51
|
+
}
|
|
52
|
+
/** The asset file addresses a change to an asset folder also changes. */
|
|
53
|
+
const ASSET_FILES = ["card", "provenance", "review", "log", "image", "image/full"];
|
|
54
|
+
export class TreeServer {
|
|
55
|
+
/** The project directory served. */
|
|
56
|
+
dir;
|
|
57
|
+
stateDir;
|
|
58
|
+
subscribed = new Set();
|
|
59
|
+
candidates = new Map();
|
|
60
|
+
server;
|
|
61
|
+
legacy = true;
|
|
62
|
+
last;
|
|
63
|
+
/** Tool calls running now. */
|
|
64
|
+
running = 0;
|
|
65
|
+
/** The fingerprint steps, one at a time. */
|
|
66
|
+
queue = Promise.resolve();
|
|
67
|
+
search;
|
|
68
|
+
/** The loaded kinds' `frames` traits, which a strip kind's thumbnails read; core's when absent. */
|
|
69
|
+
traits;
|
|
70
|
+
/** `search` is given only while a loaded extension fills the search slot. */
|
|
71
|
+
constructor(dir, stateDir, search, traits = CORE_REGISTRY) {
|
|
72
|
+
this.dir = dir;
|
|
73
|
+
this.stateDir = stateDir;
|
|
74
|
+
this.search = search;
|
|
75
|
+
this.traits = traits;
|
|
76
|
+
}
|
|
77
|
+
/** The project, opened fresh for each request, so a change on disk shows at the next read. */
|
|
78
|
+
project() {
|
|
79
|
+
return openProject(this.dir, this.stateDir);
|
|
80
|
+
}
|
|
81
|
+
async tryProject() {
|
|
82
|
+
try {
|
|
83
|
+
return await this.project();
|
|
84
|
+
}
|
|
85
|
+
catch {
|
|
86
|
+
return undefined;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
/** Registers hash-bound links without granting reads of arbitrary client-supplied paths. */
|
|
90
|
+
async candidateLinks(runDir, expectedCandidatesDigest) {
|
|
91
|
+
let run;
|
|
92
|
+
try {
|
|
93
|
+
run = await readRun(runDir);
|
|
94
|
+
}
|
|
95
|
+
catch {
|
|
96
|
+
return [];
|
|
97
|
+
}
|
|
98
|
+
if (!Array.isArray(run.candidates))
|
|
99
|
+
return [];
|
|
100
|
+
if (expectedCandidatesDigest !== undefined &&
|
|
101
|
+
digestOf(run.candidates.map((c) => ({ id: c.id, sha256: c.sha256 }))) !==
|
|
102
|
+
expectedCandidatesDigest)
|
|
103
|
+
throw new PlanChangedError("the pick candidates changed while preparing their resource links");
|
|
104
|
+
return run.candidates
|
|
105
|
+
.filter((c) => typeof c.id === "string" && typeof c.file === "string" && /^[a-f0-9]{64}$/.test(c.sha256))
|
|
106
|
+
.map((c) => {
|
|
107
|
+
const uri = `assetgrove-candidate://${c.sha256}/${digestOf({ run: runDir, id: c.id })}`;
|
|
108
|
+
this.candidates.set(uri, {
|
|
109
|
+
dir: runDir,
|
|
110
|
+
file: c.file,
|
|
111
|
+
sha256: c.sha256,
|
|
112
|
+
mimeType: c.mediaType,
|
|
113
|
+
name: c.id,
|
|
114
|
+
});
|
|
115
|
+
return {
|
|
116
|
+
type: "resource_link",
|
|
117
|
+
uri,
|
|
118
|
+
name: c.id,
|
|
119
|
+
mimeType: c.mediaType,
|
|
120
|
+
description: `Staged candidate ${c.id}, sha256 ${c.sha256}`,
|
|
121
|
+
};
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Previews of the run's audio candidates. The preview is the staged master itself, so its bytes
|
|
126
|
+
* are the ones the pick digest covers: inline `audio` under the read cap, else a `file://` link.
|
|
127
|
+
* A candidate whose bytes are missing or no longer match its record gets none.
|
|
128
|
+
*/
|
|
129
|
+
async candidatePreviews(runDir) {
|
|
130
|
+
let run;
|
|
131
|
+
try {
|
|
132
|
+
run = await readRun(runDir);
|
|
133
|
+
}
|
|
134
|
+
catch {
|
|
135
|
+
return [];
|
|
136
|
+
}
|
|
137
|
+
if (!Array.isArray(run.candidates))
|
|
138
|
+
return [];
|
|
139
|
+
const previews = [];
|
|
140
|
+
for (const c of run.candidates) {
|
|
141
|
+
if (typeof c.id !== "string" || typeof c.file !== "string")
|
|
142
|
+
continue;
|
|
143
|
+
if (typeof c.mediaType !== "string" || !c.mediaType.startsWith("audio/"))
|
|
144
|
+
continue;
|
|
145
|
+
let file;
|
|
146
|
+
let bytes;
|
|
147
|
+
try {
|
|
148
|
+
file = libraryPath(runDir, runDir, c.file, c.id);
|
|
149
|
+
bytes = await readFile(file);
|
|
150
|
+
}
|
|
151
|
+
catch {
|
|
152
|
+
continue;
|
|
153
|
+
}
|
|
154
|
+
if (sha256Hex(bytes) !== c.sha256)
|
|
155
|
+
continue;
|
|
156
|
+
if (base64Length(bytes.length) <= READ_LIMIT) {
|
|
157
|
+
previews.push({
|
|
158
|
+
type: "audio",
|
|
159
|
+
data: bytes.toString("base64"),
|
|
160
|
+
mimeType: c.mediaType,
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
else {
|
|
164
|
+
previews.push({
|
|
165
|
+
type: "resource_link",
|
|
166
|
+
uri: pathToFileURL(file).href,
|
|
167
|
+
name: `${c.id} preview`,
|
|
168
|
+
mimeType: c.mediaType,
|
|
169
|
+
description: `Preview of staged candidate ${c.id}, sha256 ${c.sha256}, ${bytes.length} bytes: over the 64 KB read cap; play the file`,
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
return previews;
|
|
174
|
+
}
|
|
175
|
+
async candidateRead(uri) {
|
|
176
|
+
const candidate = this.candidates.get(uri);
|
|
177
|
+
if (!candidate)
|
|
178
|
+
throw new InputError(`${uri}: unknown candidate resource`);
|
|
179
|
+
const file = libraryPath(candidate.dir, candidate.dir, candidate.file, uri);
|
|
180
|
+
const bytes = await readFile(file);
|
|
181
|
+
if (sha256Hex(bytes) !== candidate.sha256)
|
|
182
|
+
throw new InputError(`${uri}: candidate bytes changed since staging`);
|
|
183
|
+
if (base64Length(bytes.length) > READ_LIMIT) {
|
|
184
|
+
return {
|
|
185
|
+
contents: [
|
|
186
|
+
{
|
|
187
|
+
uri,
|
|
188
|
+
mimeType: "application/json",
|
|
189
|
+
text: JSON.stringify({
|
|
190
|
+
address: uri,
|
|
191
|
+
kind: "file",
|
|
192
|
+
mediaType: candidate.mimeType,
|
|
193
|
+
sha256: candidate.sha256,
|
|
194
|
+
bytes: bytes.length,
|
|
195
|
+
tooLarge: true,
|
|
196
|
+
limit: READ_LIMIT,
|
|
197
|
+
}),
|
|
198
|
+
},
|
|
199
|
+
],
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
return { contents: [{ uri, mimeType: candidate.mimeType, blob: bytes.toString("base64") }] };
|
|
203
|
+
}
|
|
204
|
+
async facets() {
|
|
205
|
+
const project = await this.project();
|
|
206
|
+
const assets = [...loadAssets(project).values()];
|
|
207
|
+
const kinds = Object.fromEntries([...this.traits.kinds]
|
|
208
|
+
.sort((a, b) => a.kind.localeCompare(b.kind))
|
|
209
|
+
.map((k) => [k.kind, assets.filter((a) => a.kind === k.kind).length]));
|
|
210
|
+
const labels = Object.fromEntries([...new Set(assets.flatMap((a) => a.tags))]
|
|
211
|
+
.sort()
|
|
212
|
+
.map((label) => [label, assets.filter((a) => a.tags.includes(label)).length]));
|
|
213
|
+
return { game: project.library.game, total: assets.length, kinds, labels };
|
|
214
|
+
}
|
|
215
|
+
/** Installs the resource handlers on `server`, for a connection of the given era. */
|
|
216
|
+
attach(server, era) {
|
|
217
|
+
this.server = server;
|
|
218
|
+
this.legacy = era !== "modern";
|
|
219
|
+
const low = server.server;
|
|
220
|
+
low.setRequestHandler("resources/list", async (request) => {
|
|
221
|
+
const project = await this.tryProject();
|
|
222
|
+
const all = project ? listTree(project) : [];
|
|
223
|
+
if (project) {
|
|
224
|
+
all.push({
|
|
225
|
+
uri: "assetgrove-library://facets",
|
|
226
|
+
name: "Library facets",
|
|
227
|
+
mimeType: "application/json",
|
|
228
|
+
});
|
|
229
|
+
for (const run of runIds(project)) {
|
|
230
|
+
const links = await this.candidateLinks(join(project.runsDir, run));
|
|
231
|
+
all.push(...links.map(({ uri, name, mimeType }) => ({ uri, name, mimeType })));
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
for (const [uri, c] of this.candidates)
|
|
235
|
+
if (!all.some((r) => r.uri === uri))
|
|
236
|
+
all.push({ uri, name: c.name, mimeType: c.mimeType });
|
|
237
|
+
const cursor = request.params?.cursor;
|
|
238
|
+
const start = cursor === undefined ? 0 : Number.parseInt(cursor, 10);
|
|
239
|
+
if (!Number.isInteger(start) || start < 0 || start > all.length) {
|
|
240
|
+
throw new ProtocolError(-32602, `invalid cursor "${String(cursor)}"`);
|
|
241
|
+
}
|
|
242
|
+
const end = start + LIST_PAGE;
|
|
243
|
+
return {
|
|
244
|
+
resources: all.slice(start, end),
|
|
245
|
+
...(end < all.length && { nextCursor: String(end) }),
|
|
246
|
+
};
|
|
247
|
+
});
|
|
248
|
+
low.setRequestHandler("resources/templates/list", async () => {
|
|
249
|
+
const project = await this.tryProject();
|
|
250
|
+
if (!project)
|
|
251
|
+
return { resourceTemplates: [] };
|
|
252
|
+
const game = project.library.game;
|
|
253
|
+
const base = `asset://${encodeURIComponent(game)}`;
|
|
254
|
+
const template = (path, name, mimeType) => ({
|
|
255
|
+
uriTemplate: `${base}/${path}`,
|
|
256
|
+
name,
|
|
257
|
+
mimeType,
|
|
258
|
+
});
|
|
259
|
+
return {
|
|
260
|
+
resourceTemplates: [
|
|
261
|
+
template("{asset}/", "an asset's folder", "application/json"),
|
|
262
|
+
template("{asset}/card", "an asset's card", "text/markdown"),
|
|
263
|
+
template("{asset}/provenance", "an asset's provenance", "application/json"),
|
|
264
|
+
template("{asset}/review", "an asset's review record", "application/json"),
|
|
265
|
+
template("{asset}/log", "an asset's log", "text/markdown"),
|
|
266
|
+
template("{asset}/image", "an asset's thumbnail", "image/png"),
|
|
267
|
+
template("{asset}/image/full", "an asset's file", "application/octet-stream"),
|
|
268
|
+
template("{asset}/versions/{n}", "a version of an asset", "application/json"),
|
|
269
|
+
template("by-kind/{kind}/", "the assets of a kind", "application/json"),
|
|
270
|
+
template("by-subject/{subject}/", "the assets of a subject", "application/json"),
|
|
271
|
+
template("by-tag/{tag}/", "the assets with a tag", "application/json"),
|
|
272
|
+
template("runs/{run}/{candidate}", "a run's candidate", "application/json"),
|
|
273
|
+
...(this.search ? searchTemplates(base) : []),
|
|
274
|
+
],
|
|
275
|
+
};
|
|
276
|
+
});
|
|
277
|
+
low.setRequestHandler("resources/read", async (request) => {
|
|
278
|
+
const uri = request.params.uri;
|
|
279
|
+
try {
|
|
280
|
+
if (uri === "assetgrove-library://facets") {
|
|
281
|
+
let text = JSON.stringify(await this.facets());
|
|
282
|
+
const bytes = Buffer.byteLength(text);
|
|
283
|
+
if (bytes > READ_LIMIT)
|
|
284
|
+
text = JSON.stringify({
|
|
285
|
+
address: uri,
|
|
286
|
+
kind: "file",
|
|
287
|
+
mediaType: "application/json",
|
|
288
|
+
bytes,
|
|
289
|
+
tooLarge: true,
|
|
290
|
+
limit: READ_LIMIT,
|
|
291
|
+
});
|
|
292
|
+
return { contents: [{ uri, mimeType: "application/json", text }] };
|
|
293
|
+
}
|
|
294
|
+
if (uri.startsWith("assetgrove-candidate://")) {
|
|
295
|
+
if (!this.candidates.has(uri)) {
|
|
296
|
+
const project = await this.tryProject();
|
|
297
|
+
if (project)
|
|
298
|
+
for (const run of runIds(project))
|
|
299
|
+
await this.candidateLinks(join(project.runsDir, run));
|
|
300
|
+
}
|
|
301
|
+
return await this.candidateRead(uri);
|
|
302
|
+
}
|
|
303
|
+
const path = this.search && parseSearchPath(uri, (await this.project()).library.game);
|
|
304
|
+
if (path && this.search) {
|
|
305
|
+
const document = { address: path.address, ...(await this.search(path.query)) };
|
|
306
|
+
return {
|
|
307
|
+
contents: [
|
|
308
|
+
{ uri: path.address, mimeType: "application/json", text: JSON.stringify(document) },
|
|
309
|
+
],
|
|
310
|
+
};
|
|
311
|
+
}
|
|
312
|
+
const result = await readTree(await this.project(), uri, this.traits);
|
|
313
|
+
return { contents: result.contents };
|
|
314
|
+
}
|
|
315
|
+
catch (error) {
|
|
316
|
+
throw readError(error, uri);
|
|
317
|
+
}
|
|
318
|
+
});
|
|
319
|
+
if (this.legacy) {
|
|
320
|
+
low.setRequestHandler("resources/subscribe", async (request) => {
|
|
321
|
+
this.subscribed.add(canonical(request.params.uri));
|
|
322
|
+
return {};
|
|
323
|
+
});
|
|
324
|
+
low.setRequestHandler("resources/unsubscribe", async (request) => {
|
|
325
|
+
this.subscribed.delete(canonical(request.params.uri));
|
|
326
|
+
return {};
|
|
327
|
+
});
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
/** Takes the fingerprint a tool call's changes are compared with. */
|
|
331
|
+
async before() {
|
|
332
|
+
const project = await this.tryProject();
|
|
333
|
+
this.last = project ? fingerprint(project) : undefined;
|
|
334
|
+
}
|
|
335
|
+
/**
|
|
336
|
+
* Sends `resources/updated` for each address that changed since the last fingerprint, and
|
|
337
|
+
* `resources/list_changed` when the listing changed or `wrote` (a pick or write it served).
|
|
338
|
+
*/
|
|
339
|
+
async after(wrote = false) {
|
|
340
|
+
const project = await this.tryProject();
|
|
341
|
+
const now = project ? fingerprint(project) : undefined;
|
|
342
|
+
const was = this.last;
|
|
343
|
+
this.last = now;
|
|
344
|
+
if (!now || !this.server)
|
|
345
|
+
return;
|
|
346
|
+
const before = was?.addresses ?? new Map();
|
|
347
|
+
for (const address of changed(before, now.addresses))
|
|
348
|
+
this.updated(address);
|
|
349
|
+
if (wrote || (was !== undefined && was.listing !== now.listing)) {
|
|
350
|
+
this.notify(() => this.server.server.sendResourceListChanged());
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
/**
|
|
354
|
+
* Runs `call` between `before` and `after`; `tool` names it. Fingerprints are taken one at a
|
|
355
|
+
* time; a call that starts while another is running (an `ls` during a `stage`) does not take a
|
|
356
|
+
* new baseline, which would swallow what the running call wrote: it diffs instead, so those
|
|
357
|
+
* changes are announced now and the running call's own check sees the rest.
|
|
358
|
+
*/
|
|
359
|
+
async around(tool, call, ok) {
|
|
360
|
+
this.running++;
|
|
361
|
+
try {
|
|
362
|
+
const overlapping = this.running > 1;
|
|
363
|
+
await this.serial(() => (overlapping ? this.after() : this.before()));
|
|
364
|
+
let pending = Promise.resolve();
|
|
365
|
+
const progress = () => {
|
|
366
|
+
pending = pending.then(() => this.serial(() => this.after()));
|
|
367
|
+
};
|
|
368
|
+
const result = await call(progress);
|
|
369
|
+
await pending;
|
|
370
|
+
await this.serial(() => this.after(LIBRARY_WRITERS.has(tool) && ok(result)));
|
|
371
|
+
return result;
|
|
372
|
+
}
|
|
373
|
+
finally {
|
|
374
|
+
this.running--;
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
/** Runs one fingerprint step after the ones already queued. */
|
|
378
|
+
serial(step) {
|
|
379
|
+
const run = this.queue.then(step);
|
|
380
|
+
this.queue = run.catch(() => { });
|
|
381
|
+
return run;
|
|
382
|
+
}
|
|
383
|
+
updated(address) {
|
|
384
|
+
const at = parseAddress(address);
|
|
385
|
+
const addresses = [address];
|
|
386
|
+
if (at.segments.length === 1) {
|
|
387
|
+
for (const file of ASSET_FILES) {
|
|
388
|
+
addresses.push(formatAddress(at.game, [at.segments[0], ...file.split("/")]));
|
|
389
|
+
}
|
|
390
|
+
addresses.push(formatAddress(at.game, [at.segments[0], "versions"], true));
|
|
391
|
+
}
|
|
392
|
+
for (const uri of addresses) {
|
|
393
|
+
if (this.legacy && !this.subscribed.has(uri))
|
|
394
|
+
continue;
|
|
395
|
+
this.notify(() => this.server.server.sendResourceUpdated({ uri }));
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
notify(send) {
|
|
399
|
+
try {
|
|
400
|
+
send().catch(() => { });
|
|
401
|
+
}
|
|
402
|
+
catch {
|
|
403
|
+
// The client is gone; the server goes on without it.
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
/** The canonical form of an address a client subscribed to; anything else is kept as sent. */
|
|
408
|
+
function canonical(uri) {
|
|
409
|
+
try {
|
|
410
|
+
return canonicalAddress(uri);
|
|
411
|
+
}
|
|
412
|
+
catch {
|
|
413
|
+
return uri;
|
|
414
|
+
}
|
|
415
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { KindTraits } from "../frames.ts";
|
|
2
|
+
import type { Raster } from "../image/raster.ts";
|
|
3
|
+
/** The longest side of a thumbnail. */
|
|
4
|
+
export declare const THUMB_PX = 512;
|
|
5
|
+
/** The most a read's encoded content may hold, in bytes (base64 counted for binary content). */
|
|
6
|
+
export declare const READ_LIMIT: number;
|
|
7
|
+
/** The base64 length of `n` bytes. */
|
|
8
|
+
export declare function base64Length(n: number): number;
|
|
9
|
+
/** A strip's frame size and how many frames it holds, as its provenance records them. */
|
|
10
|
+
export interface StripFrame {
|
|
11
|
+
width: number;
|
|
12
|
+
height: number;
|
|
13
|
+
count: number;
|
|
14
|
+
}
|
|
15
|
+
/** A strip's key frames, spread evenly, first and last included; none when `frame` does not fit. */
|
|
16
|
+
export declare function keyFrames(strip: Raster, frame: StripFrame): Raster[];
|
|
17
|
+
export type ThumbShape = "image" | "row" | {
|
|
18
|
+
strip: StripFrame;
|
|
19
|
+
};
|
|
20
|
+
/** A strip's frame from provenance parameters (`frame`, `frameCount`); the whole image when absent. */
|
|
21
|
+
export declare function stripShape(kind: unknown, parameters: unknown, traits?: KindTraits): ThumbShape;
|
|
22
|
+
/**
|
|
23
|
+
* A PNG thumbnail of `sources` (one image, a strip of known frames or a row of frames) whose base64 fits `budget`
|
|
24
|
+
* bytes, or undefined when none fits or a source does not decode.
|
|
25
|
+
*/
|
|
26
|
+
export declare function thumbnail(sources: Uint8Array[], shape: ThumbShape, budget: number, cacheDir?: string): Uint8Array | undefined;
|