@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,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The pack's `http` (design section 11): a `fetch` that reaches only the hosts its adapter declares
|
|
3
|
+
* (`fixedHosts`) and the endpoint its settings entry names (`baseURL`, when the adapter takes one).
|
|
4
|
+
* It follows redirects itself and checks every hop's host before requesting it, so a URL the
|
|
5
|
+
* provider steers (a download link in a result, a redirect) cannot send a request anywhere else.
|
|
6
|
+
*
|
|
7
|
+
* The redirect loop is the Fetch standard's HTTP-redirect fetch, written here: a recorded exception
|
|
8
|
+
* (docs/decisions.md, "A pack's network goes through the injected fetch").
|
|
9
|
+
*
|
|
10
|
+
* It guards provider-steered URLs, not pack code: a pack can still reach the global `fetch` or a
|
|
11
|
+
* socket. A pack's SDK must take this `fetch` (docs/extensions.md#http).
|
|
12
|
+
*/
|
|
13
|
+
import { ProviderError } from "../errors.ts";
|
|
14
|
+
/** The hosts one provider instance may reach: its adapter's fixed hosts and its settings endpoint. */
|
|
15
|
+
export declare function allowedHosts(adapter: {
|
|
16
|
+
fixedHosts: readonly string[];
|
|
17
|
+
endpointFromSettings: boolean;
|
|
18
|
+
}, baseURL?: string): string[];
|
|
19
|
+
/** A request to a host the adapter did not declare: exit 4 `provider_error`, never sent. */
|
|
20
|
+
export declare class HostRefusedError extends ProviderError {
|
|
21
|
+
readonly host: string;
|
|
22
|
+
constructor(adapter: string, host: string, hosts: readonly string[], hop: number);
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* A `fetch` for `adapter` that refuses any URL whose host is not in `hosts`, re-checking every
|
|
26
|
+
* redirect hop. `base` is the fetch it sends through, read at each call (global `fetch` by default).
|
|
27
|
+
*/
|
|
28
|
+
export declare function guardedFetch(options: {
|
|
29
|
+
adapter: string;
|
|
30
|
+
hosts: readonly string[];
|
|
31
|
+
base?: () => typeof fetch;
|
|
32
|
+
}): typeof fetch;
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The pack's `http` (design section 11): a `fetch` that reaches only the hosts its adapter declares
|
|
3
|
+
* (`fixedHosts`) and the endpoint its settings entry names (`baseURL`, when the adapter takes one).
|
|
4
|
+
* It follows redirects itself and checks every hop's host before requesting it, so a URL the
|
|
5
|
+
* provider steers (a download link in a result, a redirect) cannot send a request anywhere else.
|
|
6
|
+
*
|
|
7
|
+
* The redirect loop is the Fetch standard's HTTP-redirect fetch, written here: a recorded exception
|
|
8
|
+
* (docs/decisions.md, "A pack's network goes through the injected fetch").
|
|
9
|
+
*
|
|
10
|
+
* It guards provider-steered URLs, not pack code: a pack can still reach the global `fetch` or a
|
|
11
|
+
* socket. A pack's SDK must take this `fetch` (docs/extensions.md#http).
|
|
12
|
+
*/
|
|
13
|
+
import { ProviderError } from "../errors.js";
|
|
14
|
+
/** At most this many redirects are followed for one request, as the Fetch standard allows. */
|
|
15
|
+
const MAX_REDIRECTS = 20;
|
|
16
|
+
const REDIRECT = new Set([301, 302, 303, 307, 308]);
|
|
17
|
+
/** The Fetch standard's request-body header names, dropped when a redirect drops the body. */
|
|
18
|
+
const REQUEST_BODY_HEADERS = [
|
|
19
|
+
"content-encoding",
|
|
20
|
+
"content-language",
|
|
21
|
+
"content-location",
|
|
22
|
+
"content-type",
|
|
23
|
+
"content-length",
|
|
24
|
+
];
|
|
25
|
+
/** The headers the Fetch standard removes when a redirect changes origin. */
|
|
26
|
+
const CREDENTIAL_HEADERS = ["authorization", "proxy-authorization", "cookie"];
|
|
27
|
+
/** The hosts one provider instance may reach: its adapter's fixed hosts and its settings endpoint. */
|
|
28
|
+
export function allowedHosts(adapter, baseURL) {
|
|
29
|
+
const hosts = adapter.fixedHosts.map((h) => h.toLowerCase());
|
|
30
|
+
if (adapter.endpointFromSettings && baseURL !== undefined) {
|
|
31
|
+
try {
|
|
32
|
+
hosts.push(new URL(baseURL).host.toLowerCase());
|
|
33
|
+
}
|
|
34
|
+
catch {
|
|
35
|
+
// An endpoint that is not a URL admits nothing.
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return [...new Set(hosts)];
|
|
39
|
+
}
|
|
40
|
+
/** A request to a host the adapter did not declare: exit 4 `provider_error`, never sent. */
|
|
41
|
+
export class HostRefusedError extends ProviderError {
|
|
42
|
+
host;
|
|
43
|
+
constructor(adapter, host, hosts, hop) {
|
|
44
|
+
super(`${adapter} may not reach ${host}${hop > 0 ? ` (redirect ${hop})` : ""}: its declared hosts are ${hosts.join(", ") || "none"}`, { providerCode: "host_refused" });
|
|
45
|
+
this.name = "HostRefusedError";
|
|
46
|
+
this.host = host;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* A `fetch` for `adapter` that refuses any URL whose host is not in `hosts`, re-checking every
|
|
51
|
+
* redirect hop. `base` is the fetch it sends through, read at each call (global `fetch` by default).
|
|
52
|
+
*/
|
|
53
|
+
export function guardedFetch(options) {
|
|
54
|
+
const hosts = options.hosts.map((h) => h.toLowerCase());
|
|
55
|
+
const base = options.base ?? (() => globalThis.fetch);
|
|
56
|
+
const check = (url, hop) => {
|
|
57
|
+
if (url.protocol !== "http:" && url.protocol !== "https:")
|
|
58
|
+
throw new HostRefusedError(options.adapter, url.href, hosts, hop);
|
|
59
|
+
if (!hosts.includes(url.host.toLowerCase()))
|
|
60
|
+
throw new HostRefusedError(options.adapter, url.host, hosts, hop);
|
|
61
|
+
};
|
|
62
|
+
const guarded = async (input, init) => {
|
|
63
|
+
const first = new Request(input, init);
|
|
64
|
+
const mode = init?.redirect ?? (input instanceof Request ? input.redirect : "follow");
|
|
65
|
+
let url = new URL(first.url);
|
|
66
|
+
check(url, 0);
|
|
67
|
+
let method = first.method;
|
|
68
|
+
const headers = new Headers(first.headers);
|
|
69
|
+
let body = first.body === null ? undefined : await first.arrayBuffer();
|
|
70
|
+
for (let hop = 0;; hop++) {
|
|
71
|
+
const response = await base()(url, {
|
|
72
|
+
method,
|
|
73
|
+
headers,
|
|
74
|
+
...(body !== undefined && { body }),
|
|
75
|
+
redirect: "manual",
|
|
76
|
+
signal: first.signal,
|
|
77
|
+
});
|
|
78
|
+
const location = response.headers.get("location");
|
|
79
|
+
if (!REDIRECT.has(response.status) || location === null || mode === "manual")
|
|
80
|
+
return response;
|
|
81
|
+
if (mode === "error")
|
|
82
|
+
throw new TypeError(`redirect refused: ${url.href} redirects`);
|
|
83
|
+
if (hop + 1 > MAX_REDIRECTS)
|
|
84
|
+
throw new TypeError(`more than ${MAX_REDIRECTS} redirects from ${first.url}`);
|
|
85
|
+
const next = new URL(location, url);
|
|
86
|
+
check(next, hop + 1);
|
|
87
|
+
await response.body?.cancel();
|
|
88
|
+
if (response.status === 303 ||
|
|
89
|
+
((response.status === 301 || response.status === 302) && method === "POST")) {
|
|
90
|
+
if (method !== "HEAD")
|
|
91
|
+
method = "GET";
|
|
92
|
+
body = undefined;
|
|
93
|
+
for (const name of REQUEST_BODY_HEADERS)
|
|
94
|
+
headers.delete(name);
|
|
95
|
+
}
|
|
96
|
+
// Credentials go no further than the origin they were meant for.
|
|
97
|
+
if (next.origin !== url.origin)
|
|
98
|
+
for (const name of CREDENTIAL_HEADERS)
|
|
99
|
+
headers.delete(name);
|
|
100
|
+
url = next;
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
return guarded;
|
|
104
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { SearchSettings } from "../settings.ts";
|
|
2
|
+
/** One file a pack's setup downloads, pinned to a version and a sha256 or sha512 the pack ships. */
|
|
3
|
+
export interface PinnedDownload {
|
|
4
|
+
/** Where the file is fetched from, tried in order when a host fails; a hash mismatch stops. */
|
|
5
|
+
urls: string[];
|
|
6
|
+
/** The version the hash pins (a release, a commit); never empty. */
|
|
7
|
+
version: string;
|
|
8
|
+
/** The file's sha256, 64 lower-case hex. Exactly one of `sha256` and `sha512` is given. */
|
|
9
|
+
sha256?: string;
|
|
10
|
+
/** The file's sha512, 128 lower-case hex. Exactly one of `sha256` and `sha512` is given. */
|
|
11
|
+
sha512?: string;
|
|
12
|
+
/** Where it lands, `/`-separated, relative to `SetupContext.dir`. */
|
|
13
|
+
path: string;
|
|
14
|
+
}
|
|
15
|
+
/** What `assetgrove extensions setup <name>` hands the pack's `setup`. */
|
|
16
|
+
export interface SetupContext {
|
|
17
|
+
/** The developer settings' state directory. */
|
|
18
|
+
stateDir: string;
|
|
19
|
+
/** Where downloads land: `<stateDir>/models`. */
|
|
20
|
+
dir: string;
|
|
21
|
+
/** The settings' search block, defaults filled (the search package reads its embedder). */
|
|
22
|
+
search: SearchSettings;
|
|
23
|
+
/**
|
|
24
|
+
* Downloads one pinned file to `dir`/`path` and returns its absolute path. A file already there
|
|
25
|
+
* with the pinned hash (sha256 or sha512) is not fetched again. The bytes are hashed before the file is moved into
|
|
26
|
+
* place; a mismatch deletes the file and fails (exit 4 `provider_error`, `hash_mismatch`).
|
|
27
|
+
*/
|
|
28
|
+
download(file: PinnedDownload): Promise<string>;
|
|
29
|
+
/** One line to stderr, prefixed with the pack's name. */
|
|
30
|
+
log(message: string): void;
|
|
31
|
+
}
|
|
32
|
+
export interface PinnedDownloadOptions {
|
|
33
|
+
fetch?: typeof fetch;
|
|
34
|
+
/** How long a host may send no byte before it is given up; default 60 seconds. */
|
|
35
|
+
stallMs?: number;
|
|
36
|
+
log?: (message: string) => void;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Downloads one pinned file to `dir`/`file.path` and returns its absolute path. The bytes are
|
|
40
|
+
* streamed to a sibling partial file and hashed; only a match is renamed into place. A hash
|
|
41
|
+
* mismatch fails at once, without trying another host. Partial files of `dest` left by a setup
|
|
42
|
+
* that was killed mid-download are removed first.
|
|
43
|
+
*/
|
|
44
|
+
export declare function pinnedDownload(dir: string, file: PinnedDownload, options?: PinnedDownloadOptions): Promise<string>;
|
|
45
|
+
/** The context `assetgrove extensions setup <name>` hands a pack's `setup`. */
|
|
46
|
+
export declare function setupContext(input: {
|
|
47
|
+
stateDir: string;
|
|
48
|
+
search: SearchSettings;
|
|
49
|
+
name: string;
|
|
50
|
+
log?: (line: string) => void;
|
|
51
|
+
fetch?: typeof fetch;
|
|
52
|
+
stallMs?: number;
|
|
53
|
+
}): SetupContext;
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A pack's setup (`Extension.setup`, docs/extensions.md#setup): `assetgrove extensions setup
|
|
3
|
+
* <name>` hands it a `SetupContext` whose `download` is the only way it fetches a file. Every
|
|
4
|
+
* download is pinned to a version and a sha256 or sha512 the pack ships, and checked before the file is used.
|
|
5
|
+
*/
|
|
6
|
+
import { createHash, randomBytes } from "node:crypto";
|
|
7
|
+
import { createWriteStream } from "node:fs";
|
|
8
|
+
import { mkdir, readdir, readFile, rename, rm } from "node:fs/promises";
|
|
9
|
+
import { basename, dirname, join, resolve } from "node:path";
|
|
10
|
+
import { Readable } from "node:stream";
|
|
11
|
+
import { pipeline } from "node:stream/promises";
|
|
12
|
+
import { InputError, ProviderError } from "../errors.js";
|
|
13
|
+
function validate(file) {
|
|
14
|
+
const bad = (why) => {
|
|
15
|
+
throw new InputError(`pinned download ${JSON.stringify(file.path)}: ${why}`);
|
|
16
|
+
};
|
|
17
|
+
if (!Array.isArray(file.urls) || file.urls.length === 0)
|
|
18
|
+
bad("urls must be a non-empty list");
|
|
19
|
+
for (const url of file.urls) {
|
|
20
|
+
let protocol = "";
|
|
21
|
+
try {
|
|
22
|
+
protocol = new URL(url).protocol;
|
|
23
|
+
}
|
|
24
|
+
catch {
|
|
25
|
+
/* reported below */
|
|
26
|
+
}
|
|
27
|
+
if (protocol !== "http:" && protocol !== "https:")
|
|
28
|
+
bad(`${String(url)} is not an http(s) URL`);
|
|
29
|
+
}
|
|
30
|
+
if (typeof file.version !== "string" || file.version.trim() === "")
|
|
31
|
+
bad("version must be a non-empty string");
|
|
32
|
+
if (file.sha256 !== undefined && file.sha512 !== undefined)
|
|
33
|
+
bad("give exactly one of sha256 and sha512, not both");
|
|
34
|
+
if (file.sha256 === undefined && file.sha512 === undefined)
|
|
35
|
+
bad("give exactly one of sha256 and sha512");
|
|
36
|
+
if (file.sha512 !== undefined) {
|
|
37
|
+
if (typeof file.sha512 !== "string" || !/^[0-9a-f]{128}$/.test(file.sha512))
|
|
38
|
+
bad("sha512 must be 128 lower-case hex characters");
|
|
39
|
+
}
|
|
40
|
+
else if (typeof file.sha256 !== "string" || !/^[0-9a-f]{64}$/.test(file.sha256))
|
|
41
|
+
bad("sha256 must be 64 lower-case hex characters");
|
|
42
|
+
const path = file.path;
|
|
43
|
+
if (typeof path !== "string" ||
|
|
44
|
+
path.includes("\\") ||
|
|
45
|
+
path.startsWith("/") ||
|
|
46
|
+
/^[A-Za-z]:/.test(path) ||
|
|
47
|
+
path.split("/").some((part) => part === "" || part === "." || part === ".."))
|
|
48
|
+
bad("path must be a relative `/`-separated path without empty, . or .. parts");
|
|
49
|
+
}
|
|
50
|
+
/** The pin's algorithm and expected digest; `validate` has made sure exactly one is given. */
|
|
51
|
+
function pinOf(file) {
|
|
52
|
+
return file.sha512 !== undefined
|
|
53
|
+
? { algorithm: "sha512", want: file.sha512 }
|
|
54
|
+
: { algorithm: "sha256", want: file.sha256 };
|
|
55
|
+
}
|
|
56
|
+
async function digestOf(path, algorithm) {
|
|
57
|
+
try {
|
|
58
|
+
return createHash(algorithm)
|
|
59
|
+
.update(await readFile(path))
|
|
60
|
+
.digest("hex");
|
|
61
|
+
}
|
|
62
|
+
catch {
|
|
63
|
+
return undefined;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
/** Streams one URL to `partial` and returns its digest; a host silent for `stallMs` is given up. */
|
|
67
|
+
async function fetchTo(doFetch, url, partial, stallMs, algorithm) {
|
|
68
|
+
const controller = new AbortController();
|
|
69
|
+
let timer;
|
|
70
|
+
const arm = () => {
|
|
71
|
+
clearTimeout(timer);
|
|
72
|
+
timer = setTimeout(() => controller.abort(new Error(`no data from ${new URL(url).host} for ${stallMs} ms`)), stallMs);
|
|
73
|
+
};
|
|
74
|
+
arm();
|
|
75
|
+
try {
|
|
76
|
+
const res = await doFetch(url, { redirect: "follow", signal: controller.signal });
|
|
77
|
+
if (!res.ok)
|
|
78
|
+
throw new Error(`${res.status} from ${new URL(url).host}`);
|
|
79
|
+
if (!res.body)
|
|
80
|
+
throw new Error(`no body from ${new URL(url).host}`);
|
|
81
|
+
const hash = createHash(algorithm);
|
|
82
|
+
const source = Readable.fromWeb(res.body);
|
|
83
|
+
source.on("data", (chunk) => {
|
|
84
|
+
hash.update(chunk);
|
|
85
|
+
arm();
|
|
86
|
+
});
|
|
87
|
+
await pipeline(source, createWriteStream(partial), { signal: controller.signal });
|
|
88
|
+
return hash.digest("hex");
|
|
89
|
+
}
|
|
90
|
+
catch (error) {
|
|
91
|
+
throw controller.signal.aborted && controller.signal.reason instanceof Error
|
|
92
|
+
? controller.signal.reason
|
|
93
|
+
: error;
|
|
94
|
+
}
|
|
95
|
+
finally {
|
|
96
|
+
clearTimeout(timer);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Downloads one pinned file to `dir`/`file.path` and returns its absolute path. The bytes are
|
|
101
|
+
* streamed to a sibling partial file and hashed; only a match is renamed into place. A hash
|
|
102
|
+
* mismatch fails at once, without trying another host. Partial files of `dest` left by a setup
|
|
103
|
+
* that was killed mid-download are removed first.
|
|
104
|
+
*/
|
|
105
|
+
export async function pinnedDownload(dir, file, options = {}) {
|
|
106
|
+
validate(file);
|
|
107
|
+
const dest = resolve(dir, ...file.path.split("/"));
|
|
108
|
+
await mkdir(dirname(dest), { recursive: true });
|
|
109
|
+
const prefix = `${basename(dest)}.partial-`;
|
|
110
|
+
for (const name of await readdir(dirname(dest)))
|
|
111
|
+
if (name.startsWith(prefix))
|
|
112
|
+
await rm(join(dirname(dest), name), { force: true, recursive: true });
|
|
113
|
+
const { algorithm, want } = pinOf(file);
|
|
114
|
+
if ((await digestOf(dest, algorithm)) === want)
|
|
115
|
+
return dest;
|
|
116
|
+
const doFetch = options.fetch ?? fetch;
|
|
117
|
+
const stallMs = options.stallMs ?? 60_000;
|
|
118
|
+
const failures = [];
|
|
119
|
+
for (const url of file.urls) {
|
|
120
|
+
const partial = `${dest}.partial-${randomBytes(6).toString("hex")}`;
|
|
121
|
+
options.log?.(`${file.path} ${file.version} from ${new URL(url).host}`);
|
|
122
|
+
let got;
|
|
123
|
+
try {
|
|
124
|
+
got = await fetchTo(doFetch, url, partial, stallMs, algorithm);
|
|
125
|
+
}
|
|
126
|
+
catch (error) {
|
|
127
|
+
await rm(partial, { force: true });
|
|
128
|
+
failures.push(`${url}: ${error instanceof Error ? error.message : String(error)}`);
|
|
129
|
+
continue;
|
|
130
|
+
}
|
|
131
|
+
if (got !== want) {
|
|
132
|
+
await rm(partial, { force: true });
|
|
133
|
+
throw new ProviderError(`hash_mismatch: ${file.path} (version ${file.version}) from ${url} has ${algorithm} ${got}, expected ${want}`);
|
|
134
|
+
}
|
|
135
|
+
try {
|
|
136
|
+
await rename(partial, dest);
|
|
137
|
+
}
|
|
138
|
+
catch (error) {
|
|
139
|
+
await rm(partial, { force: true });
|
|
140
|
+
throw error;
|
|
141
|
+
}
|
|
142
|
+
return dest;
|
|
143
|
+
}
|
|
144
|
+
throw new ProviderError(`setup_failed: ${file.path} (version ${file.version}) could not be downloaded: ${failures.join("; ")}`);
|
|
145
|
+
}
|
|
146
|
+
/** The context `assetgrove extensions setup <name>` hands a pack's `setup`. */
|
|
147
|
+
export function setupContext(input) {
|
|
148
|
+
const dir = join(input.stateDir, "models");
|
|
149
|
+
const write = input.log ?? ((line) => void process.stderr.write(`${line}\n`));
|
|
150
|
+
const log = (message) => write(`[${input.name}] ${message}`);
|
|
151
|
+
return {
|
|
152
|
+
stateDir: input.stateDir,
|
|
153
|
+
dir,
|
|
154
|
+
search: input.search,
|
|
155
|
+
download: (file) => pinnedDownload(dir, file, {
|
|
156
|
+
...(input.fetch && { fetch: input.fetch }),
|
|
157
|
+
...(input.stallMs !== undefined && { stallMs: input.stallMs }),
|
|
158
|
+
log,
|
|
159
|
+
}),
|
|
160
|
+
log,
|
|
161
|
+
};
|
|
162
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { type ApprovalGate, type ApprovalMethod, type CommandIdentity } from "../approvals.ts";
|
|
2
|
+
import type { RegisteredTool } from "../extensions/registry.ts";
|
|
3
|
+
/** A tool run as the hand-off records it beside the files its preset wrote. */
|
|
4
|
+
export interface ToolStep {
|
|
5
|
+
kind: "tool";
|
|
6
|
+
/** The tool id, `<name>:<id>`. */
|
|
7
|
+
tool: string;
|
|
8
|
+
/** The approval's hash: of the tool id, argv, the scratch cwd and every hashed file. */
|
|
9
|
+
hash: string;
|
|
10
|
+
method: ApprovalMethod;
|
|
11
|
+
/** For method `delegated`: the command run, who delegated it, the scope and the client. */
|
|
12
|
+
argv?: string[];
|
|
13
|
+
delegatedBy?: string;
|
|
14
|
+
scope?: "command";
|
|
15
|
+
client?: string;
|
|
16
|
+
selfReported?: true;
|
|
17
|
+
}
|
|
18
|
+
/** What a pack passes one run. */
|
|
19
|
+
export interface ToolRunOptions {
|
|
20
|
+
/** The arguments after the executable, relative to the scratch directory. */
|
|
21
|
+
args: string[];
|
|
22
|
+
/**
|
|
23
|
+
* Files written into scratch before the run, by `/`-separated path relative to it: the only way
|
|
24
|
+
* target data reaches a tool.
|
|
25
|
+
*/
|
|
26
|
+
files?: Record<string, Uint8Array | string>;
|
|
27
|
+
/** How long the tool may run; 10 minutes when absent. */
|
|
28
|
+
timeoutMs?: number;
|
|
29
|
+
/** Bytes written to the tool's standard input, which is then closed. */
|
|
30
|
+
stdin?: Uint8Array;
|
|
31
|
+
}
|
|
32
|
+
/** A file the tool left in scratch, new or changed from what the pack passed in. */
|
|
33
|
+
export interface ToolOutputFile {
|
|
34
|
+
/** `/`-separated, relative to scratch. */
|
|
35
|
+
path: string;
|
|
36
|
+
content: Uint8Array;
|
|
37
|
+
}
|
|
38
|
+
export interface ToolResult {
|
|
39
|
+
exitCode: number;
|
|
40
|
+
/** Redacted. */
|
|
41
|
+
stdout: string;
|
|
42
|
+
/** Redacted. */
|
|
43
|
+
stderr: string;
|
|
44
|
+
files: ToolOutputFile[];
|
|
45
|
+
step: ToolStep;
|
|
46
|
+
}
|
|
47
|
+
/** Runs a declared tool of the pack; refused for any id the pack does not declare. */
|
|
48
|
+
export type ToolRunner = (tool: string, options: ToolRunOptions) => Promise<ToolResult>;
|
|
49
|
+
/** What a runner is bound to. */
|
|
50
|
+
export interface ToolScope {
|
|
51
|
+
/** The extension name of the pack whose code runs (its preset's prefix). */
|
|
52
|
+
pack: string | undefined;
|
|
53
|
+
/** Every tool the loaded packs declare. */
|
|
54
|
+
tools: ReadonlyMap<string, RegisteredTool> | undefined;
|
|
55
|
+
gate: ApprovalGate;
|
|
56
|
+
/** The game project's directory: the approval's project, and where scratch never is. */
|
|
57
|
+
projectDir: string;
|
|
58
|
+
/** Receives each run's step once it is approved. */
|
|
59
|
+
onStep?: (step: ToolStep) => void;
|
|
60
|
+
}
|
|
61
|
+
/** The cwd a tool identity records: scratch is a new directory each run. */
|
|
62
|
+
export declare const SCRATCH_CWD = "<scratch>";
|
|
63
|
+
/** The runner for the pack `scope.pack`: only that pack's declared tools run. */
|
|
64
|
+
export declare function toolRunner(scope: ToolScope): ToolRunner;
|
|
65
|
+
/** A runner that refuses every tool, for code that runs no program (the conformance suite). */
|
|
66
|
+
export declare function refusingToolRunner(why: string): ToolRunner;
|
|
67
|
+
/** The runner a preset's context holds: its own pack's tools, in the hand-off's project. */
|
|
68
|
+
export declare function presetToolRunner(presetName: string, scope: Omit<ToolScope, "pack">): ToolRunner;
|
|
69
|
+
/**
|
|
70
|
+
* The executable a tool's settings name: an absolute path to a file, by its real path. Refused
|
|
71
|
+
* (exit 2 `command_refused`) otherwise, and on Windows when it is a `.cmd` or `.bat` shim.
|
|
72
|
+
*/
|
|
73
|
+
export declare function toolExecutable(tool: RegisteredTool, platform?: NodeJS.Platform): string;
|
|
74
|
+
/**
|
|
75
|
+
* The identity of one run: kind `tool`, the tool id, argv `[executable, ...args]` with the args as
|
|
76
|
+
* given (relative to scratch), cwd `<scratch>`, and the sha256 of the executable and of every
|
|
77
|
+
* file the argv names: an argument, or the value after an option's `=`, that is a regular file,
|
|
78
|
+
* and every file under one that is a directory (such as `--path .`). Inside scratch a file is
|
|
79
|
+
* keyed by its `/` path there, elsewhere by its real absolute path. A file the pack passes in
|
|
80
|
+
* `files` is hashed like any other file the argv names, directly or under a named directory: a
|
|
81
|
+
* script cannot sit unhashed beside the data. A link inside a named directory is refused, since
|
|
82
|
+
* what it reaches could change unhashed. Its project is the game project. Reads
|
|
83
|
+
* bytes only; runs nothing.
|
|
84
|
+
*/
|
|
85
|
+
export declare function toolIdentity(input: {
|
|
86
|
+
tool: string;
|
|
87
|
+
executable: string;
|
|
88
|
+
args: readonly string[];
|
|
89
|
+
scratch: string;
|
|
90
|
+
projectDir: string;
|
|
91
|
+
}): CommandIdentity;
|
|
92
|
+
/**
|
|
93
|
+
* Runs one declared tool: makes scratch outside the project, writes the pack's inputs into it,
|
|
94
|
+
* builds the run's identity, requires its approval, runs it there with the key-free environment,
|
|
95
|
+
* reads back the files it left and removes scratch.
|
|
96
|
+
*/
|
|
97
|
+
export declare function runTool(tool: RegisteredTool, options: ToolRunOptions, scope: Pick<ToolScope, "gate" | "projectDir" | "onStep">): Promise<ToolResult>;
|