@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
package/dist/mcp.d.ts
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import type { CallToolResult, RequestStateCodec, ToolAnnotations } from "@modelcontextprotocol/server";
|
|
2
|
+
import type { Readable, Writable } from "node:stream";
|
|
3
|
+
import type { CommandSpec, RunContext } from "./commands/types.ts";
|
|
4
|
+
import type { SealedRequest } from "./confirm/mcp.ts";
|
|
5
|
+
import type { GenerationProvider } from "./gateway/provider.ts";
|
|
6
|
+
import { applyPlan } from "./planning.ts";
|
|
7
|
+
import type { SpendLedger } from "./spend.ts";
|
|
8
|
+
import type { KindTraits } from "./frames.ts";
|
|
9
|
+
export interface ToolContext {
|
|
10
|
+
provider?: GenerationProvider;
|
|
11
|
+
providerName?: string;
|
|
12
|
+
/** The cross-run spend ledger every paid call also reserves against (src/spend.ts). */
|
|
13
|
+
ledger?: SpendLedger;
|
|
14
|
+
/** Receives one line per provider decision call during apply. */
|
|
15
|
+
log?: (message: string) => void;
|
|
16
|
+
/** The developer settings' run cap (`caps.runUsd`), which bounds plan and apply. */
|
|
17
|
+
runCapUsd?: number;
|
|
18
|
+
/** The developer settings' prompt-policy allow terms (`promptPolicy.allow`). */
|
|
19
|
+
promptAllow?: readonly string[];
|
|
20
|
+
/** The plan command's request digest, recorded in the saved plan. */
|
|
21
|
+
requestDigest?: string;
|
|
22
|
+
/** The loaded kinds' `frames` traits (the settings' extensions); core's own kinds when absent. */
|
|
23
|
+
kinds?: KindTraits;
|
|
24
|
+
}
|
|
25
|
+
type Arguments = Record<string, unknown>;
|
|
26
|
+
/** CLI and MCP share the same file loading and generation entry points. */
|
|
27
|
+
export declare function generationTool(name: "apply", args: Arguments, context?: ToolContext): ReturnType<typeof applyPlan>;
|
|
28
|
+
export declare function generationTool(name: string, args: Arguments, context?: ToolContext): Promise<Record<string, unknown>>;
|
|
29
|
+
/**
|
|
30
|
+
* Whether a tool is marked as requiring the person (`anthropic/requiresUserInteraction`): every
|
|
31
|
+
* tool with a confirmation under the server's settings, except spend, pick and write tools when
|
|
32
|
+
* the settings are headless, and the spend tools and the pick and pick_batch tools whose scope the
|
|
33
|
+
* settings' `delegation` names (approve, library adopt and card accept stay marked).
|
|
34
|
+
*/
|
|
35
|
+
export declare function requiresUserInteraction(spec: CommandSpec, headless: boolean, ctx?: RunContext): boolean;
|
|
36
|
+
/**
|
|
37
|
+
* A tool's annotations, from its command's effect (design section 5) and, for a command that
|
|
38
|
+
* spends only under some settings (find and search index with a hosted embedder), these settings.
|
|
39
|
+
*/
|
|
40
|
+
export declare function toolAnnotations(spec: CommandSpec, ctx?: RunContext): ToolAnnotations;
|
|
41
|
+
/**
|
|
42
|
+
* The cat tool's result, carrying the read once so it stays inside the 64 KB a read may hold
|
|
43
|
+
* (design section 2): the document lists each content's `uri` and `mimeType`, and the content
|
|
44
|
+
* follows it in the same order, an image as image content and anything else as an embedded
|
|
45
|
+
* resource, exactly as `resources/read` returns it.
|
|
46
|
+
*/
|
|
47
|
+
export declare function catResult(document: Record<string, unknown>): CallToolResult;
|
|
48
|
+
/**
|
|
49
|
+
* How long a confirmation form stays answerable: a person who walks away and comes back the next
|
|
50
|
+
* day still finds it. A request that changed meanwhile is refused on re-entry by its digest.
|
|
51
|
+
*/
|
|
52
|
+
export declare const FORM_TTL_SECONDS: number;
|
|
53
|
+
/**
|
|
54
|
+
* How long a call waits for a person to answer a confirmation form: long enough to read a contact
|
|
55
|
+
* sheet and choose, short enough that a client that never shows the form loses minutes, not a
|
|
56
|
+
* session. On expiry the call ends as for a client without forms: the request is saved pending and
|
|
57
|
+
* the call exits 8 `confirmation_required`, with nothing recorded as accepted or declined.
|
|
58
|
+
*/
|
|
59
|
+
export declare const FORM_WAIT_MS: number;
|
|
60
|
+
/** The codec that seals each confirmation form's state for `FORM_TTL_SECONDS`, under `key`. */
|
|
61
|
+
export declare function formStateCodec(key?: Uint8Array): RequestStateCodec<SealedRequest>;
|
|
62
|
+
/**
|
|
63
|
+
* Serves the tools, and the asset tree of the project at `target` (else the working directory's
|
|
64
|
+
* Git top level) as resources, over MCP stdio with the official SDK until the input closes; no
|
|
65
|
+
* logs on stdout. Refuses (exit 2 `settings_invalid`) to start in an environment the settings disallow,
|
|
66
|
+
* and (exit 2 `key_tracked`) when a tracked file of the working directory's repository holds a key.
|
|
67
|
+
*/
|
|
68
|
+
export declare function serveMcp(ctx: RunContext, input?: Readable, output?: Writable, options?: {
|
|
69
|
+
target?: string;
|
|
70
|
+
readOnly?: boolean;
|
|
71
|
+
}): Promise<void>;
|
|
72
|
+
export {};
|
package/dist/mcp.js
ADDED
|
@@ -0,0 +1,514 @@
|
|
|
1
|
+
import { McpServer, SdkError, SdkErrorCode, createRequestStateCodec, fromJsonSchema, inputRequired, inputResponse, isInputRequiredResult, } from "@modelcontextprotocol/server";
|
|
2
|
+
import { randomBytes } from "node:crypto";
|
|
3
|
+
import { StdioServerTransport, serveStdio } from "@modelcontextprotocol/server/stdio";
|
|
4
|
+
import { readFileSync } from "node:fs";
|
|
5
|
+
import { readFile } from "node:fs/promises";
|
|
6
|
+
import { join, resolve } from "node:path";
|
|
7
|
+
import { describeBible, useBiblePreset } from "./bible.js";
|
|
8
|
+
import { checkContextEnvironment, createRunContext, canSpend, isPaid, settingsScope, } from "./commands/context.js";
|
|
9
|
+
import { commands } from "./commands/registry.js";
|
|
10
|
+
import { resultDocument } from "./commands/result.js";
|
|
11
|
+
import { availableCommands, errorOutcome, runCommand, toolInputSchema } from "./commands/runner.js";
|
|
12
|
+
import { clientOf, confirmForm, elicitationPort } from "./confirm/mcp.js";
|
|
13
|
+
import { digestOf } from "./confirm/records.js";
|
|
14
|
+
import { InputError, ProviderError } from "./errors.js";
|
|
15
|
+
import { checkTrackedKeys } from "./guard.js";
|
|
16
|
+
import { redact } from "./redact.js";
|
|
17
|
+
import { PlanChangedError, applyPlan, createPlan, savePlan } from "./planning.js";
|
|
18
|
+
import { projectDir } from "./tree/project.js";
|
|
19
|
+
import { runFind } from "./commands/search.js";
|
|
20
|
+
import { TreeServer } from "./tree/serve.js";
|
|
21
|
+
function stringArg(args, key, required = true) {
|
|
22
|
+
const value = args[key];
|
|
23
|
+
if (value === undefined && !required)
|
|
24
|
+
return undefined;
|
|
25
|
+
if (typeof value !== "string" || value.trim() === "")
|
|
26
|
+
throw new InputError(`missing or invalid ${key}`);
|
|
27
|
+
return value;
|
|
28
|
+
}
|
|
29
|
+
export async function generationTool(name, args, context = {}) {
|
|
30
|
+
if (name === "bible_describe")
|
|
31
|
+
return describeBible(stringArg(args, "bible"));
|
|
32
|
+
if (name === "bible_preset") {
|
|
33
|
+
return useBiblePreset({
|
|
34
|
+
biblePath: stringArg(args, "bible"),
|
|
35
|
+
preset: stringArg(args, "preset"),
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
if (name === "plan") {
|
|
39
|
+
const optional = (key) => stringArg(args, key, false);
|
|
40
|
+
const created = await createPlan({
|
|
41
|
+
biblePath: stringArg(args, "bible"),
|
|
42
|
+
specPath: stringArg(args, "spec"),
|
|
43
|
+
profilePath: stringArg(args, "profile"),
|
|
44
|
+
...(optional("brief") && { briefPath: optional("brief") }),
|
|
45
|
+
...(optional("runOptions") && { runOptionsPath: optional("runOptions") }),
|
|
46
|
+
...(optional("template") && { templatePath: optional("template") }),
|
|
47
|
+
...(optional("identityMode") && { identityMode: optional("identityMode") }),
|
|
48
|
+
...context,
|
|
49
|
+
});
|
|
50
|
+
const planPath = resolve(stringArg(args, "out"));
|
|
51
|
+
await savePlan(created.plan, planPath);
|
|
52
|
+
return { planPath, ...created };
|
|
53
|
+
}
|
|
54
|
+
if (name === "apply") {
|
|
55
|
+
if (!context.provider)
|
|
56
|
+
throw new ProviderError("apply requires a generation provider");
|
|
57
|
+
const result = await applyPlan(stringArg(args, "plan"), {
|
|
58
|
+
provider: context.provider,
|
|
59
|
+
providerName: context.providerName,
|
|
60
|
+
...(context.ledger && { ledger: context.ledger }),
|
|
61
|
+
...(context.log && { log: context.log }),
|
|
62
|
+
...(context.runCapUsd !== undefined && { runCapUsd: context.runCapUsd }),
|
|
63
|
+
...(context.promptAllow && { promptAllow: context.promptAllow }),
|
|
64
|
+
...(context.kinds && { kinds: context.kinds }),
|
|
65
|
+
...(stringArg(args, "out", false) && { outDir: args["out"] }),
|
|
66
|
+
});
|
|
67
|
+
return result;
|
|
68
|
+
}
|
|
69
|
+
throw new InputError(`unknown generation tool ${name}`);
|
|
70
|
+
}
|
|
71
|
+
/** The one output schema of every tool: the result document, open to each command's fields. */
|
|
72
|
+
const outputSchema = {
|
|
73
|
+
type: "object",
|
|
74
|
+
properties: {
|
|
75
|
+
ok: { type: "boolean" },
|
|
76
|
+
exitCode: { type: "integer" },
|
|
77
|
+
command: { type: ["string", "null"] },
|
|
78
|
+
error: {
|
|
79
|
+
type: "object",
|
|
80
|
+
properties: { code: { type: "string" }, message: { type: "string" } },
|
|
81
|
+
required: ["code", "message"],
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
required: ["ok", "exitCode", "command"],
|
|
85
|
+
};
|
|
86
|
+
/** The confirmation kinds headless settings answer without a person. */
|
|
87
|
+
const HEADLESS_ANSWERS = new Set(["spend", "pick", "write"]);
|
|
88
|
+
/**
|
|
89
|
+
* The confirmation a tool asks for under these settings: its command's `confirm`, or spend for a
|
|
90
|
+
* command that spends only under some settings (find and search index with a hosted embedder).
|
|
91
|
+
* Find is marked under every embedder: its `--outliers` asks style-outlier decisions under each.
|
|
92
|
+
*/
|
|
93
|
+
function toolConfirm(spec, ctx) {
|
|
94
|
+
if (spec.confirm !== undefined)
|
|
95
|
+
return spec.confirm;
|
|
96
|
+
if (ctx !== undefined && spec.spendsWith !== undefined && canSpend(spec, ctx))
|
|
97
|
+
return "spend";
|
|
98
|
+
return undefined;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Whether a tool is marked as requiring the person (`anthropic/requiresUserInteraction`): every
|
|
102
|
+
* tool with a confirmation under the server's settings, except spend, pick and write tools when
|
|
103
|
+
* the settings are headless, and the spend tools and the pick and pick_batch tools whose scope the
|
|
104
|
+
* settings' `delegation` names (approve, library adopt and card accept stay marked).
|
|
105
|
+
*/
|
|
106
|
+
export function requiresUserInteraction(spec, headless, ctx) {
|
|
107
|
+
const confirm = toolConfirm(spec, ctx);
|
|
108
|
+
if (confirm === undefined)
|
|
109
|
+
return false;
|
|
110
|
+
if (headless && HEADLESS_ANSWERS.has(confirm))
|
|
111
|
+
return false;
|
|
112
|
+
const scopes = ctx?.settings.delegation?.scopes ?? [];
|
|
113
|
+
if (confirm === "spend" && scopes.includes("spend"))
|
|
114
|
+
return false;
|
|
115
|
+
const picks = spec.tool === "pick" || spec.tool === "pick_batch";
|
|
116
|
+
return !(confirm === "pick" && picks && scopes.includes("pick"));
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* A tool's annotations, from its command's effect (design section 5) and, for a command that
|
|
120
|
+
* spends only under some settings (find and search index with a hosted embedder), these settings.
|
|
121
|
+
*/
|
|
122
|
+
export function toolAnnotations(spec, ctx) {
|
|
123
|
+
const paid = ctx === undefined ? isPaid(spec) : canSpend(spec, ctx);
|
|
124
|
+
return {
|
|
125
|
+
readOnlyHint: spec.effect.readOnly,
|
|
126
|
+
destructiveHint: spec.tool === "pick" || spec.tool === "pick_batch" || spec.tool === "write_families",
|
|
127
|
+
idempotentHint: paid,
|
|
128
|
+
openWorldHint: paid,
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* The cat tool's result, carrying the read once so it stays inside the 64 KB a read may hold
|
|
133
|
+
* (design section 2): the document lists each content's `uri` and `mimeType`, and the content
|
|
134
|
+
* follows it in the same order, an image as image content and anything else as an embedded
|
|
135
|
+
* resource, exactly as `resources/read` returns it.
|
|
136
|
+
*/
|
|
137
|
+
export function catResult(document) {
|
|
138
|
+
const contents = document["contents"];
|
|
139
|
+
if (!Array.isArray(contents)) {
|
|
140
|
+
return {
|
|
141
|
+
content: [{ type: "text", text: JSON.stringify(document) }],
|
|
142
|
+
structuredContent: document,
|
|
143
|
+
isError: document["ok"] !== true,
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
const read = contents;
|
|
147
|
+
const listed = {
|
|
148
|
+
...document,
|
|
149
|
+
contents: read.map(({ uri, mimeType }) => ({ uri, mimeType })),
|
|
150
|
+
};
|
|
151
|
+
return {
|
|
152
|
+
content: [
|
|
153
|
+
{ type: "text", text: JSON.stringify(listed) },
|
|
154
|
+
...read.map((c) => "blob" in c && c.mimeType.startsWith("image/")
|
|
155
|
+
? { type: "image", data: c.blob, mimeType: c.mimeType }
|
|
156
|
+
: { type: "resource", resource: c }),
|
|
157
|
+
],
|
|
158
|
+
structuredContent: listed,
|
|
159
|
+
isError: document["ok"] !== true,
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
/** A tool call's arguments with the server's scripted provider and work item filled in. */
|
|
163
|
+
function commandArgs(spec, args, ctx) {
|
|
164
|
+
const properties = spec.input.properties;
|
|
165
|
+
return {
|
|
166
|
+
...(ctx.providerScript !== undefined &&
|
|
167
|
+
"providerScript" in properties && { providerScript: ctx.providerScript }),
|
|
168
|
+
...(ctx.workItem !== undefined && "workItem" in properties && { workItem: ctx.workItem }),
|
|
169
|
+
...args,
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* The context of one tool call: a request that carries a progressToken gets the run's progress
|
|
174
|
+
* as `notifications/progress` while its client is connected. A notification the client can no
|
|
175
|
+
* longer receive is dropped; the run goes on (design section 9).
|
|
176
|
+
*/
|
|
177
|
+
function withProgress(ctx, request) {
|
|
178
|
+
const progressToken = request.mcpReq._meta?.progressToken;
|
|
179
|
+
if (progressToken === undefined)
|
|
180
|
+
return ctx;
|
|
181
|
+
return {
|
|
182
|
+
...ctx,
|
|
183
|
+
progress: (update) => {
|
|
184
|
+
try {
|
|
185
|
+
request.mcpReq
|
|
186
|
+
.notify({ method: "notifications/progress", params: { progressToken, ...update } })
|
|
187
|
+
.catch(() => { });
|
|
188
|
+
}
|
|
189
|
+
catch {
|
|
190
|
+
// The client is gone; the run goes on without it.
|
|
191
|
+
}
|
|
192
|
+
},
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
function packageInfo() {
|
|
196
|
+
return JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf8"));
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* The contact sheet a result names (`runDir` and `contactSheet`), or find's numbered sheet
|
|
200
|
+
* (`sheet`), as MCP image content.
|
|
201
|
+
*/
|
|
202
|
+
async function contactImage(document) {
|
|
203
|
+
const { runDir, contactSheet, sheet, command } = document;
|
|
204
|
+
const path = command === "find" && typeof sheet === "string"
|
|
205
|
+
? sheet
|
|
206
|
+
: typeof runDir === "string" && typeof contactSheet === "string"
|
|
207
|
+
? join(runDir, contactSheet)
|
|
208
|
+
: undefined;
|
|
209
|
+
if (path === undefined)
|
|
210
|
+
return [];
|
|
211
|
+
try {
|
|
212
|
+
const bytes = await readFile(path);
|
|
213
|
+
return [{ type: "image", data: bytes.toString("base64"), mimeType: "image/png" }];
|
|
214
|
+
}
|
|
215
|
+
catch {
|
|
216
|
+
return [];
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* How long a confirmation form stays answerable: a person who walks away and comes back the next
|
|
221
|
+
* day still finds it. A request that changed meanwhile is refused on re-entry by its digest.
|
|
222
|
+
*/
|
|
223
|
+
export const FORM_TTL_SECONDS = 24 * 60 * 60;
|
|
224
|
+
/**
|
|
225
|
+
* How long a call waits for a person to answer a confirmation form: long enough to read a contact
|
|
226
|
+
* sheet and choose, short enough that a client that never shows the form loses minutes, not a
|
|
227
|
+
* session. On expiry the call ends as for a client without forms: the request is saved pending and
|
|
228
|
+
* the call exits 8 `confirmation_required`, with nothing recorded as accepted or declined.
|
|
229
|
+
*/
|
|
230
|
+
export const FORM_WAIT_MS = 5 * 60 * 1000;
|
|
231
|
+
/** The forms one 2025-era call may send before it ends as for a client without forms. */
|
|
232
|
+
const LEGACY_FORM_ROUNDS = 8;
|
|
233
|
+
/** The codec that seals each confirmation form's state for `FORM_TTL_SECONDS`, under `key`. */
|
|
234
|
+
export function formStateCodec(key = randomBytes(32)) {
|
|
235
|
+
return createRequestStateCodec({ key, ttlSeconds: FORM_TTL_SECONDS });
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* The context of one tool call: the server's log, environment, provider script and work item, with
|
|
239
|
+
* the developer settings loaded now (src/commands/context.ts), so a change written by
|
|
240
|
+
* settings_change or by hand holds from the next call. The settings file is checked against the
|
|
241
|
+
* call's target and input files too.
|
|
242
|
+
*/
|
|
243
|
+
async function callContext(server, args) {
|
|
244
|
+
return createRunContext({
|
|
245
|
+
log: server.log,
|
|
246
|
+
...(server.env && { env: server.env }),
|
|
247
|
+
...(server.providerScript !== undefined && { providerScript: server.providerScript }),
|
|
248
|
+
...(server.workItem !== undefined && { workItem: server.workItem }),
|
|
249
|
+
...settingsScope(args),
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* The tree's search paths, while a loaded extension fills the search slot: each runs the `find`
|
|
254
|
+
* command's own search (settings read at the call, like every tool call), so the paths and the
|
|
255
|
+
* command return the same hits. A resource read writes no sheet and never spends.
|
|
256
|
+
*/
|
|
257
|
+
function searchRunner(ctx, dir) {
|
|
258
|
+
if (ctx.extensions?.search === undefined)
|
|
259
|
+
return undefined;
|
|
260
|
+
return async (query) => {
|
|
261
|
+
const call = await callContext(ctx, {});
|
|
262
|
+
const { fields } = await runFind({ ...query, target: dir }, call, { sheet: false });
|
|
263
|
+
return fields;
|
|
264
|
+
};
|
|
265
|
+
}
|
|
266
|
+
/**
|
|
267
|
+
* `ls`, `cat` and the search commands read the tree the server serves unless the call names
|
|
268
|
+
* another project.
|
|
269
|
+
*/
|
|
270
|
+
function browseArgs(spec, args, tree) {
|
|
271
|
+
const browses = spec.tool === "ls" || spec.tool === "cat" || spec.requires === "search";
|
|
272
|
+
if (!browses || args["target"] !== undefined)
|
|
273
|
+
return args;
|
|
274
|
+
return { ...args, target: tree.dir };
|
|
275
|
+
}
|
|
276
|
+
/** The context with each progress update also checking the tree for changes the call made. */
|
|
277
|
+
function withTreeProgress(ctx, check) {
|
|
278
|
+
const report = ctx.progress;
|
|
279
|
+
return {
|
|
280
|
+
...ctx,
|
|
281
|
+
progress: (update) => {
|
|
282
|
+
report?.(update);
|
|
283
|
+
check();
|
|
284
|
+
},
|
|
285
|
+
};
|
|
286
|
+
}
|
|
287
|
+
/** The key of the inputRequired form a confirmation is asked under. */
|
|
288
|
+
const FORM_KEY = "confirm";
|
|
289
|
+
/** The person's response to the form a call's sealed state asked, when the client sent one. */
|
|
290
|
+
function formAnswer(request) {
|
|
291
|
+
const view = inputResponse(request.mcpReq.inputResponses, FORM_KEY);
|
|
292
|
+
if (view.kind !== "elicit")
|
|
293
|
+
return undefined;
|
|
294
|
+
return { action: view.action, ...(view.content && { content: view.content }) };
|
|
295
|
+
}
|
|
296
|
+
function isAsked(result) {
|
|
297
|
+
return "form" in result && "sealed" in result;
|
|
298
|
+
}
|
|
299
|
+
/**
|
|
300
|
+
* Runs one tool call for one turn. With `turn.form` the command gets a port answering the request
|
|
301
|
+
* `turn.sealed` names (src/confirm/mcp.ts) from `turn.answer`; when it reaches a request no answer
|
|
302
|
+
* covers, the result is the form to ask and the state sealing it. Without `turn.form` no form
|
|
303
|
+
* can be asked: the command saves the request pending and exits 8 `confirmation_required`. A call
|
|
304
|
+
* whose arguments differ from the ones its state sealed exits 2 `plan_changed`.
|
|
305
|
+
*/
|
|
306
|
+
async function callTool(spec, args, ctx, request, server, turn, marked, tree, progress = () => { }) {
|
|
307
|
+
const tool = spec.tool;
|
|
308
|
+
const argsDigest = digestOf(args);
|
|
309
|
+
const { sealed, answer } = turn;
|
|
310
|
+
if (sealed !== undefined && (sealed.tool !== tool || sealed.args !== argsDigest)) {
|
|
311
|
+
return errorOutcome(new PlanChangedError(`the ${tool} call changed since its confirmation form was sent`));
|
|
312
|
+
}
|
|
313
|
+
const client = clientOf(request.mcpReq.envelope, {
|
|
314
|
+
capabilities: server.server.getClientCapabilities(),
|
|
315
|
+
name: server.server.getClientVersion()?.name,
|
|
316
|
+
protocolVersion: server.server.getNegotiatedProtocolVersion(),
|
|
317
|
+
});
|
|
318
|
+
const port = turn.form && client.form
|
|
319
|
+
? elicitationPort({
|
|
320
|
+
...(sealed && { sealed }),
|
|
321
|
+
...(answer && { answer }),
|
|
322
|
+
fields: {
|
|
323
|
+
...(client.name !== undefined && { client: client.name }),
|
|
324
|
+
...(client.protocolVersion !== undefined && {
|
|
325
|
+
protocolVersion: client.protocolVersion,
|
|
326
|
+
}),
|
|
327
|
+
toolMarkedRequiresUser: marked,
|
|
328
|
+
},
|
|
329
|
+
})
|
|
330
|
+
: undefined;
|
|
331
|
+
const full = commandArgs(spec, args, ctx);
|
|
332
|
+
let fresh;
|
|
333
|
+
try {
|
|
334
|
+
fresh = await callContext(ctx, full);
|
|
335
|
+
}
|
|
336
|
+
catch (error) {
|
|
337
|
+
return errorOutcome(error);
|
|
338
|
+
}
|
|
339
|
+
// The server's process has no terminal to ask: the form is the only channel.
|
|
340
|
+
const callCtx = withTreeProgress(withProgress(fresh, request), progress);
|
|
341
|
+
delete callCtx.prompt;
|
|
342
|
+
if (port)
|
|
343
|
+
callCtx.prompt = port;
|
|
344
|
+
if (client.name !== undefined)
|
|
345
|
+
callCtx.client = client.name;
|
|
346
|
+
const outcome = await runCommand(spec, full, callCtx);
|
|
347
|
+
const asked = port?.asked();
|
|
348
|
+
if (asked === undefined || outcome.error?.code !== "confirmation_required")
|
|
349
|
+
return outcome;
|
|
350
|
+
let links = [];
|
|
351
|
+
try {
|
|
352
|
+
if (asked.kind === "pick" && typeof asked.details["run"] === "string") {
|
|
353
|
+
const inputs = asked.body?.["inputs"];
|
|
354
|
+
links = await tree.candidateLinks(asked.details["run"], inputs?.candidates);
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
catch (error) {
|
|
358
|
+
return errorOutcome(error);
|
|
359
|
+
}
|
|
360
|
+
const shown = links.length === 0
|
|
361
|
+
? asked
|
|
362
|
+
: { ...asked, details: { ...asked.details, candidateResources: links } };
|
|
363
|
+
return {
|
|
364
|
+
form: confirmForm(shown),
|
|
365
|
+
sealed: { tool, args: argsDigest, kind: asked.kind, id: asked.id },
|
|
366
|
+
};
|
|
367
|
+
}
|
|
368
|
+
/**
|
|
369
|
+
* Runs a tool call on a 2025-era connection: each form is sent as `elicitation/create` and waited
|
|
370
|
+
* for at most `FORM_WAIT_MS`. A form the client does not answer in time, or more forms than
|
|
371
|
+
* `LEGACY_FORM_ROUNDS`, end the call as for a client without forms: one more run with no form
|
|
372
|
+
* saves the request pending and exits 8 `confirmation_required`. A form request the client fails,
|
|
373
|
+
* or a call its client cancelled, throws.
|
|
374
|
+
*/
|
|
375
|
+
async function callLegacy(run, request, server) {
|
|
376
|
+
let turn = { form: true };
|
|
377
|
+
for (let round = 0; round < LEGACY_FORM_ROUNDS; round++) {
|
|
378
|
+
const result = await run(turn);
|
|
379
|
+
if (!isAsked(result))
|
|
380
|
+
return result;
|
|
381
|
+
let answer;
|
|
382
|
+
try {
|
|
383
|
+
const reply = await server.server.request({ method: "elicitation/create", params: result.form }, {
|
|
384
|
+
timeout: FORM_WAIT_MS,
|
|
385
|
+
relatedRequestId: request.mcpReq.id,
|
|
386
|
+
signal: request.mcpReq.signal,
|
|
387
|
+
});
|
|
388
|
+
answer = { action: reply.action, ...(reply.content && { content: reply.content }) };
|
|
389
|
+
}
|
|
390
|
+
catch (error) {
|
|
391
|
+
// Only an unanswered form becomes pending; a client's error reply stays the call's error.
|
|
392
|
+
if (!(error instanceof SdkError && error.code === SdkErrorCode.RequestTimeout))
|
|
393
|
+
throw error;
|
|
394
|
+
break;
|
|
395
|
+
}
|
|
396
|
+
turn = { form: true, sealed: result.sealed, answer };
|
|
397
|
+
}
|
|
398
|
+
const ended = await run({ form: false });
|
|
399
|
+
if (isAsked(ended))
|
|
400
|
+
throw new Error("a call without forms asked a form");
|
|
401
|
+
return ended;
|
|
402
|
+
}
|
|
403
|
+
/**
|
|
404
|
+
* One MCP server instance with a tool per registry command that names one. Each tool runs its
|
|
405
|
+
* command as the CLI does and returns the CLI's --json document as structuredContent and as text.
|
|
406
|
+
* `codec` seals each confirmation form's state; one codec serves every round of a process. The
|
|
407
|
+
* project's asset tree is served as resources (src/tree/serve.ts), and each tool call is checked
|
|
408
|
+
* for the changes it made to it.
|
|
409
|
+
*/
|
|
410
|
+
function createServer(ctx, codec, tree, era, readOnly = false) {
|
|
411
|
+
const { name, version } = packageInfo();
|
|
412
|
+
const headless = ctx.settings.mode === "headless";
|
|
413
|
+
// The tool list is fixed; the resource list follows the library.
|
|
414
|
+
const server = new McpServer({ name, version }, {
|
|
415
|
+
capabilities: {
|
|
416
|
+
tools: { listChanged: false },
|
|
417
|
+
resources: { subscribe: true, listChanged: true },
|
|
418
|
+
},
|
|
419
|
+
requestState: { verify: codec.verify },
|
|
420
|
+
});
|
|
421
|
+
// A search-only command is listed only when a loaded extension fills the search slot.
|
|
422
|
+
for (const spec of availableCommands(commands, ctx.extensions)) {
|
|
423
|
+
if (spec.tool === null)
|
|
424
|
+
continue;
|
|
425
|
+
if (readOnly &&
|
|
426
|
+
!(spec.effect.readOnly &&
|
|
427
|
+
spec.effect.spends === "never" &&
|
|
428
|
+
(spec.effect.writes === "none" || spec.tool === "cat")))
|
|
429
|
+
continue;
|
|
430
|
+
const input = fromJsonSchema(toolInputSchema(spec));
|
|
431
|
+
// tools/list shows the schema; the handler checks it, so a refusal is a result document too.
|
|
432
|
+
const listed = {
|
|
433
|
+
"~standard": { ...input["~standard"], validate: (value) => ({ value }) },
|
|
434
|
+
};
|
|
435
|
+
const marked = requiresUserInteraction(spec, headless, ctx);
|
|
436
|
+
server.registerTool(spec.tool, {
|
|
437
|
+
description: `${spec.summary[0].toUpperCase()}${spec.summary.slice(1)}.`,
|
|
438
|
+
inputSchema: listed,
|
|
439
|
+
outputSchema: fromJsonSchema(outputSchema),
|
|
440
|
+
annotations: toolAnnotations(spec, ctx),
|
|
441
|
+
...(marked && { _meta: { "anthropic/requiresUserInteraction": true } }),
|
|
442
|
+
}, async (args, request) => {
|
|
443
|
+
const checked = await input["~standard"].validate(args ?? {});
|
|
444
|
+
const outcome = checked.issues
|
|
445
|
+
? errorOutcome(new InputError(`invalid ${spec.tool} input: ${checked.issues.map((i) => i.message).join("; ")}`))
|
|
446
|
+
: await tree.around(spec.tool, async (progress) => {
|
|
447
|
+
const run = (turn) => callTool(spec, browseArgs(spec, args ?? {}, tree), ctx, request, server, turn, marked, tree, progress);
|
|
448
|
+
if (era === "legacy")
|
|
449
|
+
return callLegacy(run, request, server);
|
|
450
|
+
const sealed = request.mcpReq.requestState();
|
|
451
|
+
const answer = formAnswer(request);
|
|
452
|
+
const result = await run({
|
|
453
|
+
form: true,
|
|
454
|
+
...(sealed && { sealed }),
|
|
455
|
+
...(answer && { answer }),
|
|
456
|
+
});
|
|
457
|
+
if (!isAsked(result))
|
|
458
|
+
return result;
|
|
459
|
+
return inputRequired({
|
|
460
|
+
inputRequests: { [FORM_KEY]: inputRequired.elicit(result.form) },
|
|
461
|
+
requestState: await codec.mint(result.sealed),
|
|
462
|
+
});
|
|
463
|
+
}, (result) => !isInputRequiredResult(result) && result.exitCode === 0);
|
|
464
|
+
if (isInputRequiredResult(outcome))
|
|
465
|
+
return outcome;
|
|
466
|
+
const document = resultDocument(spec.name, outcome);
|
|
467
|
+
if (spec.tool === "cat")
|
|
468
|
+
return catResult(document);
|
|
469
|
+
// The run's contact sheet goes with the result as image content (design section 10).
|
|
470
|
+
const sheet = await contactImage(document);
|
|
471
|
+
const links = document["ok"] === true && typeof document["runDir"] === "string"
|
|
472
|
+
? await tree.candidateLinks(document["runDir"])
|
|
473
|
+
: [];
|
|
474
|
+
const previews = document["ok"] === true && typeof document["runDir"] === "string"
|
|
475
|
+
? await tree.candidatePreviews(document["runDir"])
|
|
476
|
+
: [];
|
|
477
|
+
return {
|
|
478
|
+
content: [
|
|
479
|
+
{ type: "text", text: JSON.stringify(document) },
|
|
480
|
+
...sheet,
|
|
481
|
+
...links,
|
|
482
|
+
...previews,
|
|
483
|
+
],
|
|
484
|
+
structuredContent: document,
|
|
485
|
+
isError: document["ok"] !== true,
|
|
486
|
+
};
|
|
487
|
+
});
|
|
488
|
+
}
|
|
489
|
+
tree.attach(server, era);
|
|
490
|
+
return server;
|
|
491
|
+
}
|
|
492
|
+
/**
|
|
493
|
+
* Serves the tools, and the asset tree of the project at `target` (else the working directory's
|
|
494
|
+
* Git top level) as resources, over MCP stdio with the official SDK until the input closes; no
|
|
495
|
+
* logs on stdout. Refuses (exit 2 `settings_invalid`) to start in an environment the settings disallow,
|
|
496
|
+
* and (exit 2 `key_tracked`) when a tracked file of the working directory's repository holds a key.
|
|
497
|
+
*/
|
|
498
|
+
export async function serveMcp(ctx, input = process.stdin, output = process.stdout, options = {}) {
|
|
499
|
+
checkContextEnvironment(ctx);
|
|
500
|
+
checkTrackedKeys(process.cwd(), { settings: ctx.settings, ...(ctx.env && { env: ctx.env }) });
|
|
501
|
+
const ended = new Promise((done) => {
|
|
502
|
+
input.once("end", done);
|
|
503
|
+
input.once("close", done);
|
|
504
|
+
});
|
|
505
|
+
// A per-process key: stdio serves every round of a confirmation form in this one process.
|
|
506
|
+
const codec = formStateCodec();
|
|
507
|
+
const dir = projectDir(options.target);
|
|
508
|
+
const handle = serveStdio(({ era }) => createServer(ctx, codec, new TreeServer(dir, ctx.settings.stateDir, options.readOnly ? undefined : searchRunner(ctx, dir), ctx.extensions), era, options.readOnly), {
|
|
509
|
+
transport: new StdioServerTransport(input, output),
|
|
510
|
+
onerror: (error) => ctx.log(redact(`mcp: ${error.message}`)),
|
|
511
|
+
});
|
|
512
|
+
await ended;
|
|
513
|
+
await handle.close();
|
|
514
|
+
}
|
package/dist/media.d.ts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { MediaOutput } from "./types.ts";
|
|
2
|
+
/** What a kind's output is. */
|
|
3
|
+
export type MediaTrait = "image" | "model" | "audio";
|
|
4
|
+
/** The trait values a kind may declare. */
|
|
5
|
+
export declare const MEDIA_TRAITS: readonly MediaTrait[];
|
|
6
|
+
/** The kinds whose media traits a feature reads: a registry, or a list of kinds. */
|
|
7
|
+
export interface KindMedia {
|
|
8
|
+
readonly kinds: ReadonlyArray<{
|
|
9
|
+
readonly kind: string;
|
|
10
|
+
readonly media?: MediaTrait;
|
|
11
|
+
}>;
|
|
12
|
+
}
|
|
13
|
+
/** The kind's media trait: its declared one, else `image`; undefined for a kind not registered. */
|
|
14
|
+
export declare function mediaOf(kind: unknown, traits: KindMedia): MediaTrait | undefined;
|
|
15
|
+
/**
|
|
16
|
+
* What an audio kind's checks read of a candidate: its decoded PCM, one array per channel with
|
|
17
|
+
* samples from −1 to 1, its sample rate and its channel layout.
|
|
18
|
+
*/
|
|
19
|
+
export interface AudioContext {
|
|
20
|
+
/** One array of samples per channel, each from −1 to 1. */
|
|
21
|
+
channels: Float32Array[];
|
|
22
|
+
sampleRate: number;
|
|
23
|
+
channelCount: number;
|
|
24
|
+
/** `mono`, `stereo`, or `<n> channels`. */
|
|
25
|
+
layout: string;
|
|
26
|
+
/** The file's bit depth as wavefile names it: `8`, `16`, `24`, `32` or `32f`, `64`. */
|
|
27
|
+
bitDepth: string;
|
|
28
|
+
}
|
|
29
|
+
/** The layout name of a channel count. */
|
|
30
|
+
export declare function channelLayout(count: number): string;
|
|
31
|
+
/** Decodes a WAV with wavefile; throws when the bytes are not a PCM or float WAV it reads. */
|
|
32
|
+
export declare function decodeWav(bytes: Uint8Array): AudioContext;
|
|
33
|
+
/** The check context a kind's media trait adds for one output: an audio kind's decoded WAV. */
|
|
34
|
+
export declare function mediaCheckContext(media: MediaTrait | undefined, output: MediaOutput): {
|
|
35
|
+
audio?: AudioContext;
|
|
36
|
+
};
|
package/dist/media.js
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A kind's media trait (docs/PRD-audio.md, core change 1): what its output is, `image`, `model` or
|
|
3
|
+
* `audio`. Core features that need a raster (the contact sheet, the frames trait, plan, apply,
|
|
4
|
+
* vary) and the check context ask the trait of a kind, never its name or its output's media type.
|
|
5
|
+
* A registered kind that declares no trait is an image kind, what core assumed before the trait.
|
|
6
|
+
*/
|
|
7
|
+
import wavefile from "wavefile";
|
|
8
|
+
const { WaveFile } = wavefile;
|
|
9
|
+
/** The trait values a kind may declare. */
|
|
10
|
+
export const MEDIA_TRAITS = ["image", "model", "audio"];
|
|
11
|
+
/** The kind's media trait: its declared one, else `image`; undefined for a kind not registered. */
|
|
12
|
+
export function mediaOf(kind, traits) {
|
|
13
|
+
if (typeof kind !== "string")
|
|
14
|
+
return undefined;
|
|
15
|
+
const found = traits.kinds.find((k) => k.kind === kind);
|
|
16
|
+
return found === undefined ? undefined : (found.media ?? "image");
|
|
17
|
+
}
|
|
18
|
+
/** The layout name of a channel count. */
|
|
19
|
+
export function channelLayout(count) {
|
|
20
|
+
return count === 1 ? "mono" : count === 2 ? "stereo" : `${count} channels`;
|
|
21
|
+
}
|
|
22
|
+
/** Decodes a WAV with wavefile; throws when the bytes are not a PCM or float WAV it reads. */
|
|
23
|
+
export function decodeWav(bytes) {
|
|
24
|
+
const wav = new WaveFile(bytes);
|
|
25
|
+
// Read before the conversion below, which rebuilds the header.
|
|
26
|
+
const { numChannels, sampleRate } = wav.fmt;
|
|
27
|
+
const bitDepth = wav.bitDepth;
|
|
28
|
+
// Converted to 32-bit float in this decoded copy, so the samples read −1..1 whatever the file's depth.
|
|
29
|
+
if (bitDepth !== "32f")
|
|
30
|
+
wav.toBitDepth("32f");
|
|
31
|
+
const samples = wav.getSamples(false, Float32Array);
|
|
32
|
+
const channels = numChannels === 1 ? [samples] : samples;
|
|
33
|
+
return {
|
|
34
|
+
channels,
|
|
35
|
+
sampleRate,
|
|
36
|
+
channelCount: numChannels,
|
|
37
|
+
layout: channelLayout(numChannels),
|
|
38
|
+
bitDepth,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
/** The check context a kind's media trait adds for one output: an audio kind's decoded WAV. */
|
|
42
|
+
export function mediaCheckContext(media, output) {
|
|
43
|
+
if (media !== "audio")
|
|
44
|
+
return {};
|
|
45
|
+
return { audio: decodeWav(output.bytes) };
|
|
46
|
+
}
|