@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,322 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A run directory's lock (design section 9): `lock`, created exclusively and holding the pid of
|
|
3
|
+
* the process running the request, with what tells that process apart from a later one with the
|
|
4
|
+
* same pid. A lock held by a live process refuses the run (exit 2 `run_in_progress`); a dead
|
|
5
|
+
* process's lock is taken over.
|
|
6
|
+
*/
|
|
7
|
+
import { createHash, randomBytes } from "node:crypto";
|
|
8
|
+
import { linkSync, mkdirSync, readFileSync, realpathSync, renameSync, rmSync, writeFileSync, } from "node:fs";
|
|
9
|
+
import { uptime } from "node:os";
|
|
10
|
+
import { basename, dirname, join, resolve } from "node:path";
|
|
11
|
+
import { findGitDir } from "../library/lfs.js";
|
|
12
|
+
export const LOCK_FILE = "lock";
|
|
13
|
+
/** A run another live process holds. Exit 2 `run_in_progress`. */
|
|
14
|
+
export class RunInProgressError extends Error {
|
|
15
|
+
code = "run_in_progress";
|
|
16
|
+
pid;
|
|
17
|
+
runDir;
|
|
18
|
+
constructor(runDir, pid) {
|
|
19
|
+
super(`refused: the run ${runDir} is in progress in process ${pid}; repeat the request once it ends` +
|
|
20
|
+
` (if process ${pid} is not running this request, remove ${join(runDir, LOCK_FILE)} and repeat it)`);
|
|
21
|
+
this.name = "RunInProgressError";
|
|
22
|
+
this.pid = pid;
|
|
23
|
+
this.runDir = runDir;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
/** Whether a process with this pid is alive (one this user cannot signal counts as alive). */
|
|
27
|
+
export function pidAlive(pid) {
|
|
28
|
+
if (!Number.isInteger(pid) || pid <= 0)
|
|
29
|
+
return false;
|
|
30
|
+
try {
|
|
31
|
+
process.kill(pid, 0);
|
|
32
|
+
return true;
|
|
33
|
+
}
|
|
34
|
+
catch (error) {
|
|
35
|
+
return error.code === "EPERM";
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
function bootId() {
|
|
39
|
+
try {
|
|
40
|
+
return readFileSync("/proc/sys/kernel/random/boot_id", "utf8").trim() || undefined;
|
|
41
|
+
}
|
|
42
|
+
catch {
|
|
43
|
+
return undefined;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
/** A process's start in clock ticks since boot (`/proc/<pid>/stat` field 22), where readable. */
|
|
47
|
+
function startTicks(pid) {
|
|
48
|
+
try {
|
|
49
|
+
const stat = readFileSync(`/proc/${pid}/stat`, "utf8");
|
|
50
|
+
// The fields after the command name, which ends at the last ")", start with field 3.
|
|
51
|
+
const ticks = stat
|
|
52
|
+
.slice(stat.lastIndexOf(")") + 2)
|
|
53
|
+
.split(" ")
|
|
54
|
+
.at(22 - 3);
|
|
55
|
+
return ticks !== undefined && /^\d+$/.test(ticks) ? ticks : undefined;
|
|
56
|
+
}
|
|
57
|
+
catch {
|
|
58
|
+
return undefined;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
/** What a lock of `pid` records beside the pid. */
|
|
62
|
+
function identity(pid) {
|
|
63
|
+
const boot = bootId();
|
|
64
|
+
const ticks = boot === undefined ? undefined : startTicks(pid);
|
|
65
|
+
if (boot !== undefined && ticks !== undefined)
|
|
66
|
+
return { bootId: boot, startTicks: ticks };
|
|
67
|
+
return pid === process.pid ? { startedMs: Math.floor(Date.now() - process.uptime() * 1000) } : {};
|
|
68
|
+
}
|
|
69
|
+
function holder(path) {
|
|
70
|
+
let text;
|
|
71
|
+
try {
|
|
72
|
+
text = readFileSync(path, "utf8");
|
|
73
|
+
}
|
|
74
|
+
catch {
|
|
75
|
+
return undefined;
|
|
76
|
+
}
|
|
77
|
+
const [first, second] = text.split("\n");
|
|
78
|
+
const pid = Number.parseInt(first?.trim() ?? "", 10);
|
|
79
|
+
if (!Number.isInteger(pid))
|
|
80
|
+
return undefined;
|
|
81
|
+
const held = { pid };
|
|
82
|
+
try {
|
|
83
|
+
const raw = JSON.parse(second ?? "");
|
|
84
|
+
if (typeof raw["bootId"] === "string")
|
|
85
|
+
held.bootId = raw["bootId"];
|
|
86
|
+
if (typeof raw["startTicks"] === "string")
|
|
87
|
+
held.startTicks = raw["startTicks"];
|
|
88
|
+
if (typeof raw["startedMs"] === "number")
|
|
89
|
+
held.startedMs = raw["startedMs"];
|
|
90
|
+
}
|
|
91
|
+
catch {
|
|
92
|
+
// A lock holding only a pid is judged by the pid alone.
|
|
93
|
+
}
|
|
94
|
+
return held;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* How far before the machine's boot, by the wall clock, a holder's start must lie to count as
|
|
98
|
+
* dead: wide, so a clock step on a running machine never ends a live holder's lock.
|
|
99
|
+
*/
|
|
100
|
+
const BOOT_SLACK_MS = 10 * 60_000;
|
|
101
|
+
/**
|
|
102
|
+
* Whether the process that wrote a lock still runs: its pid is alive, and nothing shows the live
|
|
103
|
+
* process with that pid to be a later one. A lock from an earlier boot, or whose holder's start
|
|
104
|
+
* differs from the live process's (a pid reused after a restart), is dead.
|
|
105
|
+
*/
|
|
106
|
+
function holderAlive(held) {
|
|
107
|
+
if (!pidAlive(held.pid))
|
|
108
|
+
return false;
|
|
109
|
+
const boot = bootId();
|
|
110
|
+
if (held.bootId !== undefined && held.startTicks !== undefined && boot !== undefined) {
|
|
111
|
+
if (boot !== held.bootId)
|
|
112
|
+
return false;
|
|
113
|
+
const ticks = startTicks(held.pid);
|
|
114
|
+
return ticks === undefined || ticks === held.startTicks;
|
|
115
|
+
}
|
|
116
|
+
if (held.startedMs !== undefined)
|
|
117
|
+
return held.startedMs >= Date.now() - uptime() * 1000 - BOOT_SLACK_MS;
|
|
118
|
+
return true;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* The lock files this process holds. A lock that names this process's own pid but is not in this
|
|
122
|
+
* set was left by an earlier process that had the same pid (a restarted container, say): it is dead.
|
|
123
|
+
*/
|
|
124
|
+
const heldHere = new Set();
|
|
125
|
+
/** Whether the holder `held` of the lock at `path` is a live process other than a dead namesake. */
|
|
126
|
+
function live(path, held, pid) {
|
|
127
|
+
if (held === undefined)
|
|
128
|
+
return false;
|
|
129
|
+
if (held.pid === pid)
|
|
130
|
+
return heldHere.has(path);
|
|
131
|
+
return holderAlive(held);
|
|
132
|
+
}
|
|
133
|
+
/** Whether the run directory's lock is held by a live process, by the same rule as the takeover. */
|
|
134
|
+
export function runLockLive(runDir, pid = process.pid) {
|
|
135
|
+
const path = join(runDir, LOCK_FILE);
|
|
136
|
+
return live(path, holder(path), pid);
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Creates `path` exclusively holding `pid` and its identity; false when it already exists. The
|
|
140
|
+
* content goes into a file of this call's own first, which is then linked as `path`, so no reader
|
|
141
|
+
* ever sees the lock empty.
|
|
142
|
+
*/
|
|
143
|
+
function createExclusive(path, pid) {
|
|
144
|
+
const temporary = `${path}.${pid}.${randomBytes(8).toString("hex")}`;
|
|
145
|
+
writeFileSync(temporary, `${pid}\n${JSON.stringify(identity(pid))}\n`, { flag: "wx" });
|
|
146
|
+
try {
|
|
147
|
+
linkSync(temporary, path);
|
|
148
|
+
return true;
|
|
149
|
+
}
|
|
150
|
+
catch (error) {
|
|
151
|
+
if (error.code === "EEXIST")
|
|
152
|
+
return false;
|
|
153
|
+
throw error;
|
|
154
|
+
}
|
|
155
|
+
finally {
|
|
156
|
+
rmSync(temporary, { force: true });
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Removes a dead takeover guard. It is moved aside under a name only this call uses, and put
|
|
161
|
+
* back when what was moved turns out to be a live guard taken in the meantime.
|
|
162
|
+
*/
|
|
163
|
+
function clearDeadGuard(guard, dead, pid) {
|
|
164
|
+
const aside = `${guard}.${pid}.${randomBytes(8).toString("hex")}`;
|
|
165
|
+
try {
|
|
166
|
+
renameSync(guard, aside);
|
|
167
|
+
}
|
|
168
|
+
catch (error) {
|
|
169
|
+
if (error.code === "ENOENT")
|
|
170
|
+
return;
|
|
171
|
+
throw error;
|
|
172
|
+
}
|
|
173
|
+
const moved = holder(aside);
|
|
174
|
+
if (moved?.pid !== dead?.pid && live(guard, moved, pid)) {
|
|
175
|
+
try {
|
|
176
|
+
linkSync(aside, guard);
|
|
177
|
+
}
|
|
178
|
+
catch (error) {
|
|
179
|
+
if (error.code !== "EEXIST")
|
|
180
|
+
throw error;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
rmSync(aside, { force: true });
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Takes the lock at `path` for this process, or throws `busy(pid)` when a live process holds it. A
|
|
187
|
+
* lock whose holder is dead or unreadable is taken over by exactly one process: the one that
|
|
188
|
+
* creates the takeover guard `<path>.takeover` exclusively. Only the guard's holder removes a dead
|
|
189
|
+
* lock, and it then creates the lock exclusively again, so two processes repeating the same
|
|
190
|
+
* interrupted request never both run it.
|
|
191
|
+
*/
|
|
192
|
+
export function acquireLock(path, busy, pid = process.pid) {
|
|
193
|
+
mkdirSync(dirname(path), { recursive: true });
|
|
194
|
+
const guard = `${path}.takeover`;
|
|
195
|
+
let tookOver = false;
|
|
196
|
+
for (let attempt = 0;; attempt++) {
|
|
197
|
+
if (createExclusive(path, pid))
|
|
198
|
+
break;
|
|
199
|
+
const held = holder(path);
|
|
200
|
+
if (live(path, held, pid) || attempt >= 8)
|
|
201
|
+
throw busy(held?.pid ?? -1);
|
|
202
|
+
if (!createExclusive(guard, pid)) {
|
|
203
|
+
// Another process is taking the dead lock over; a guard whose process died is cleared.
|
|
204
|
+
const guardHeld = holder(guard);
|
|
205
|
+
if (live(guard, guardHeld, pid))
|
|
206
|
+
throw busy(guardHeld?.pid ?? -1);
|
|
207
|
+
clearDeadGuard(guard, guardHeld, pid);
|
|
208
|
+
continue;
|
|
209
|
+
}
|
|
210
|
+
try {
|
|
211
|
+
// Holding the guard, no other process removes the lock; its owner only removes a live one.
|
|
212
|
+
const now = holder(path);
|
|
213
|
+
if (live(path, now, pid))
|
|
214
|
+
throw busy(now?.pid ?? -1);
|
|
215
|
+
rmSync(path, { force: true });
|
|
216
|
+
if (!createExclusive(path, pid)) {
|
|
217
|
+
const fresh = holder(path);
|
|
218
|
+
throw busy(fresh?.pid ?? -1);
|
|
219
|
+
}
|
|
220
|
+
tookOver = true;
|
|
221
|
+
}
|
|
222
|
+
finally {
|
|
223
|
+
if (holder(guard)?.pid === pid)
|
|
224
|
+
rmSync(guard, { force: true });
|
|
225
|
+
}
|
|
226
|
+
break;
|
|
227
|
+
}
|
|
228
|
+
heldHere.add(path);
|
|
229
|
+
return {
|
|
230
|
+
path,
|
|
231
|
+
tookOver,
|
|
232
|
+
release() {
|
|
233
|
+
heldHere.delete(path);
|
|
234
|
+
if (holder(path)?.pid === pid)
|
|
235
|
+
rmSync(path, { force: true });
|
|
236
|
+
},
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
/** Takes the run directory's lock for this process, or throws `RunInProgressError`. */
|
|
240
|
+
export function acquireRunLock(runDir, pid = process.pid) {
|
|
241
|
+
return acquireLock(join(runDir, LOCK_FILE), (p) => new RunInProgressError(runDir, p), pid);
|
|
242
|
+
}
|
|
243
|
+
/** Another live process is writing the library. Exit 2 `run_in_progress`. */
|
|
244
|
+
export class LibraryInProgressError extends Error {
|
|
245
|
+
code = "run_in_progress";
|
|
246
|
+
pid;
|
|
247
|
+
lockPath;
|
|
248
|
+
constructor(lockPath, pid) {
|
|
249
|
+
super(`refused: another Assetgrove process (${pid}) is writing the library; repeat the request once it ends` +
|
|
250
|
+
` (if process ${pid} is not running, remove ${lockPath} and repeat it)`);
|
|
251
|
+
this.name = "LibraryInProgressError";
|
|
252
|
+
this.pid = pid;
|
|
253
|
+
this.lockPath = lockPath;
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
/** The common Git directory of the repository containing `start`; undefined outside one. */
|
|
257
|
+
export function gitCommonDir(start) {
|
|
258
|
+
return findGitDir(start);
|
|
259
|
+
}
|
|
260
|
+
/**
|
|
261
|
+
* The real path of `path`; while it does not exist yet, the real path of its nearest existing
|
|
262
|
+
* ancestor joined with the rest, so the answer does not change when the folder is created.
|
|
263
|
+
*/
|
|
264
|
+
function realOrResolved(path) {
|
|
265
|
+
const missing = [];
|
|
266
|
+
let at = resolve(path);
|
|
267
|
+
for (;;) {
|
|
268
|
+
try {
|
|
269
|
+
return join(realpathSync(at), ...missing.reverse());
|
|
270
|
+
}
|
|
271
|
+
catch {
|
|
272
|
+
const parent = dirname(at);
|
|
273
|
+
if (parent === at)
|
|
274
|
+
return resolve(path);
|
|
275
|
+
missing.push(basename(at));
|
|
276
|
+
at = parent;
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
/**
|
|
281
|
+
* Takes the one library write lock: `assetgrove/library.lock` in the repository's common Git
|
|
282
|
+
* directory, or, for a library in no repository, a file in `stateDir` named for the library root's
|
|
283
|
+
* real path. Every writer passes the library root, so a pick and a review of one library outside
|
|
284
|
+
* Git take the same lock.
|
|
285
|
+
*/
|
|
286
|
+
export function acquireLibraryLock(libraryRoot, stateDir, pid = process.pid) {
|
|
287
|
+
const common = gitCommonDir(libraryRoot);
|
|
288
|
+
const path = common !== undefined
|
|
289
|
+
? join(common, "assetgrove", "library.lock")
|
|
290
|
+
: join(stateDir, "library-locks", `${createHash("sha256").update(realOrResolved(libraryRoot)).digest("hex").slice(0, 16)}.lock`);
|
|
291
|
+
return acquireLock(path, (p) => new LibraryInProgressError(path, p), pid);
|
|
292
|
+
}
|
|
293
|
+
/** A lock another live process held for longer than a waiter waits. Exit 2 `run_in_progress`. */
|
|
294
|
+
export class LockWaitError extends Error {
|
|
295
|
+
code = "run_in_progress";
|
|
296
|
+
pid;
|
|
297
|
+
lockPath;
|
|
298
|
+
constructor(lockPath, pid) {
|
|
299
|
+
super(`refused: process ${pid} has held ${lockPath} too long; repeat the request once it ends` +
|
|
300
|
+
` (if process ${pid} is not running, remove ${lockPath} and repeat it)`);
|
|
301
|
+
this.name = "LockWaitError";
|
|
302
|
+
this.pid = pid;
|
|
303
|
+
this.lockPath = lockPath;
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
/**
|
|
307
|
+
* Takes the lock at `path`, waiting while another holder (in this process or another) has it, for
|
|
308
|
+
* up to `timeoutMs`; then throws `LockWaitError`. For short writes that should queue, not refuse.
|
|
309
|
+
*/
|
|
310
|
+
export async function waitForLock(path, timeoutMs = 30_000) {
|
|
311
|
+
const deadline = Date.now() + timeoutMs;
|
|
312
|
+
for (;;) {
|
|
313
|
+
try {
|
|
314
|
+
return acquireLock(path, (pid) => new LockWaitError(path, pid));
|
|
315
|
+
}
|
|
316
|
+
catch (error) {
|
|
317
|
+
if (!(error instanceof LockWaitError) || Date.now() >= deadline)
|
|
318
|
+
throw error;
|
|
319
|
+
}
|
|
320
|
+
await new Promise((settle) => setTimeout(settle, 10 + Math.floor(Math.random() * 20)));
|
|
321
|
+
}
|
|
322
|
+
}
|
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
import type { CallParameters, PlannedCallParameters } from "../call-parameters.ts";
|
|
2
|
+
import type { CapSource } from "../budget.ts";
|
|
3
|
+
import type { JsonSchemaObject } from "../commands/types.ts";
|
|
4
|
+
import type { PromptPart, PromptPolicyRecord } from "../policy/text.ts";
|
|
5
|
+
import type { PromptPolicyCut } from "../policy/cuts.ts";
|
|
6
|
+
import type { Route, RouteOptions } from "../routes.ts";
|
|
7
|
+
import type { GenerationProvider } from "../gateway/provider.ts";
|
|
8
|
+
import type { NearMatch, NearMatchOutcome } from "../search/near-match.ts";
|
|
9
|
+
/** One kind of call a request makes: `count` calls on a route, each estimated at `estimatedCostUsd`. */
|
|
10
|
+
export interface PlanJob {
|
|
11
|
+
operation: string;
|
|
12
|
+
/** The settings id of the provider that serves the route; empty when the route names none. */
|
|
13
|
+
provider: string;
|
|
14
|
+
model: string;
|
|
15
|
+
count: number;
|
|
16
|
+
/** The route's estimate of one call, in USD. */
|
|
17
|
+
estimatedCostUsd: number;
|
|
18
|
+
/** The route's options where they differ from its provider's default route, so they enter the request digest; absent otherwise. */
|
|
19
|
+
providerOptions?: Record<string, Record<string, unknown>>;
|
|
20
|
+
/** The route's settable fields where they differ from its provider's default route (`keyedRouteOptions`); absent otherwise, so the digest is unchanged. */
|
|
21
|
+
routeOptions?: RouteOptions;
|
|
22
|
+
/** The typed per-call parameters the calls pass (the palette by path); absent when none, so the digest is unchanged. */
|
|
23
|
+
parameters?: PlannedCallParameters;
|
|
24
|
+
}
|
|
25
|
+
/** What a paid command would do and cost, computed before anything is spent. */
|
|
26
|
+
export interface WorkPlan {
|
|
27
|
+
jobs: PlanJob[];
|
|
28
|
+
/** How many candidates the request makes (0 for a command that makes none). */
|
|
29
|
+
candidates: number;
|
|
30
|
+
/** The sum of every job's `count × estimatedCostUsd`. */
|
|
31
|
+
forecastUsd: number;
|
|
32
|
+
capUsd: number;
|
|
33
|
+
/** Where the cap came from, when the command says. Not part of the request digest. */
|
|
34
|
+
capSource?: CapSource;
|
|
35
|
+
/** Whether a job's provider is billed. */
|
|
36
|
+
paid: boolean;
|
|
37
|
+
/** Each input file's argument name and the sha256 of its bytes. */
|
|
38
|
+
inputs: Record<string, string>;
|
|
39
|
+
/** Every other argument, with the input schema's defaults applied. */
|
|
40
|
+
options: Record<string, unknown>;
|
|
41
|
+
/** sha256 hex of the normalised prompt text the request's inputs carry. */
|
|
42
|
+
policyTextSha256: string;
|
|
43
|
+
/** The prompt policy's check of that text. */
|
|
44
|
+
promptPolicy?: PromptPolicyRecord;
|
|
45
|
+
/**
|
|
46
|
+
* Up to three picked assets of exactly the spec's kind and subject (design section 7.6), when
|
|
47
|
+
* search is loaded and near matches are on. Never part of the digest: a changing index must not
|
|
48
|
+
* void a confirmation.
|
|
49
|
+
*/
|
|
50
|
+
nearMatches?: NearMatch[];
|
|
51
|
+
/** The numbered sheet of `nearMatches`. */
|
|
52
|
+
nearMatchSheet?: string;
|
|
53
|
+
/** Why the near-match search failed; the plan went on without it. */
|
|
54
|
+
searchError?: string;
|
|
55
|
+
/** sha256 hex of the canonical JSON of the request (`requestDigest`). */
|
|
56
|
+
digest: string;
|
|
57
|
+
/** `<runs>/r-<first 16 hex of the digest>/`, absolute. */
|
|
58
|
+
runDir: string;
|
|
59
|
+
}
|
|
60
|
+
/** The round a request is in when it names none. */
|
|
61
|
+
export declare const DEFAULT_ROUND = 1;
|
|
62
|
+
/** The default directory runs are staged under. */
|
|
63
|
+
export declare const DEFAULT_RUNS = ".assetgrove/runs";
|
|
64
|
+
/**
|
|
65
|
+
* JSON with every object's keys sorted and undefined values left out, so equal values always give
|
|
66
|
+
* the same text. Hand-written (docs/decisions.md): the digest must be byte-for-byte deterministic.
|
|
67
|
+
*/
|
|
68
|
+
export declare function canonicalJson(value: unknown): string;
|
|
69
|
+
/** What the request digest covers (design section 6). */
|
|
70
|
+
export interface DigestInput {
|
|
71
|
+
command: string;
|
|
72
|
+
round: number;
|
|
73
|
+
inputs: Record<string, string>;
|
|
74
|
+
options: Record<string, unknown>;
|
|
75
|
+
jobs: PlanJob[];
|
|
76
|
+
forecastUsd: number;
|
|
77
|
+
capUsd: number;
|
|
78
|
+
policyTextSha256?: string;
|
|
79
|
+
}
|
|
80
|
+
/** sha256 hex of the canonical JSON of `{command, round, inputs, options, jobs, forecastUsd, capUsd, policyTextSha256}`. */
|
|
81
|
+
export declare function requestDigest(input: DigestInput): string;
|
|
82
|
+
/**
|
|
83
|
+
* The sha256 of each named input file; a directory hashes to the sha256 of the canonical JSON of
|
|
84
|
+
* its files' relative paths and hashes. Absent arguments are left out.
|
|
85
|
+
*/
|
|
86
|
+
export declare function hashInputs(paths: Record<string, string | undefined>): Promise<Record<string, string>>;
|
|
87
|
+
/** A call as a route plans it: the operation and its route's model and estimate. */
|
|
88
|
+
export interface PlannedCallLike {
|
|
89
|
+
operation: string;
|
|
90
|
+
model: string;
|
|
91
|
+
estimatedCostUsd: number;
|
|
92
|
+
parameters?: CallParameters;
|
|
93
|
+
}
|
|
94
|
+
/** A job of `count` calls of an operation on its route. */
|
|
95
|
+
export declare function jobOf(operation: string, route: Route, count?: number): PlanJob;
|
|
96
|
+
/**
|
|
97
|
+
* The prompt-policy job of a request: one reading call per ambiguous name a person-written part
|
|
98
|
+
* holds (`readings`, src/policy/model.ts), then one decide call, or two when its prompt text holds
|
|
99
|
+
* model-written parts (the second decides on the person's parts alone).
|
|
100
|
+
*/
|
|
101
|
+
export declare function policyJobOf(route: Route, modelWrittenParts: boolean, readings?: number): PlanJob;
|
|
102
|
+
/**
|
|
103
|
+
* Jobs from planned calls, each `count` times; the provider comes from the operation's route.
|
|
104
|
+
* Calls of the same operation, provider, model and estimate merge into one job.
|
|
105
|
+
*/
|
|
106
|
+
export declare function jobsOf(calls: readonly PlannedCallLike[], routes: Record<string, Route>, count?: number): PlanJob[];
|
|
107
|
+
/** Merges jobs of the same operation, provider, model and estimate, adding their counts; drops empty ones. */
|
|
108
|
+
export declare function mergeJobs(jobs: readonly PlanJob[]): PlanJob[];
|
|
109
|
+
/** The forecast of a list of jobs. */
|
|
110
|
+
export declare function forecastOf(jobs: readonly PlanJob[]): number;
|
|
111
|
+
/** What a command gives `buildWorkPlan` beside its name, schema and arguments. */
|
|
112
|
+
export interface WorkPlanParts {
|
|
113
|
+
/** The argument names that are input files; their values are hashed, not listed as options. */
|
|
114
|
+
inputs: readonly string[];
|
|
115
|
+
jobs: readonly PlanJob[];
|
|
116
|
+
capUsd: number;
|
|
117
|
+
capSource?: CapSource;
|
|
118
|
+
/** Whether the provider of a job bills (`billing.paid`); see `paidOf`. */
|
|
119
|
+
paid: boolean;
|
|
120
|
+
/**
|
|
121
|
+
* The command's providers and routes. When the request carries prompt text, the plan adds one
|
|
122
|
+
* `prompt-policy` job on their route (the run's first call, src/runs/execute.ts); reading a
|
|
123
|
+
* route no provider serves throws `RouteUnavailableError` (exit 2 `route_unavailable`).
|
|
124
|
+
*/
|
|
125
|
+
providers: PolicyProviders;
|
|
126
|
+
candidates: number;
|
|
127
|
+
/** The argument that names the runs directory; `runs` when absent. */
|
|
128
|
+
runsArg?: string;
|
|
129
|
+
/** Settings `promptPolicy.allow` terms that clear a blocklist hit in the prompt text. */
|
|
130
|
+
promptAllow?: readonly string[];
|
|
131
|
+
/**
|
|
132
|
+
* Files the request reads through its arguments (a bible's reference images, a spec's key pose,
|
|
133
|
+
* a default template), name to path: hashed into `inputs` beside the arguments' own files, so a
|
|
134
|
+
* changed reference changes the digest. One that cannot be read is left out: the command
|
|
135
|
+
* reports it when it loads it.
|
|
136
|
+
*/
|
|
137
|
+
reads?: Record<string, string>;
|
|
138
|
+
/**
|
|
139
|
+
* Prompt text the request carries outside its input files (a free-text option such as a note or
|
|
140
|
+
* subject, text a shared profile puts in a prompt): checked with the files' text by the
|
|
141
|
+
* blocklist and the model check.
|
|
142
|
+
*/
|
|
143
|
+
promptText?: readonly string[];
|
|
144
|
+
/**
|
|
145
|
+
* Labelled prompt text the request carries beside its input files' (apply: a saved plan's input
|
|
146
|
+
* files and its compiler-written text, src/planning.ts): checked with the rest.
|
|
147
|
+
*/
|
|
148
|
+
promptParts?: readonly PromptPart[];
|
|
149
|
+
/**
|
|
150
|
+
* The prompt-policy check a later run makes on this request's text (plan: its apply), forecast
|
|
151
|
+
* with it: `modelWritten` when that run's text can hold compiler-written parts.
|
|
152
|
+
*/
|
|
153
|
+
applyPolicy?: {
|
|
154
|
+
modelWritten: boolean;
|
|
155
|
+
};
|
|
156
|
+
/** The plan step's near matches (src/search/near-match.ts); kept out of the digest. */
|
|
157
|
+
near?: NearMatchOutcome;
|
|
158
|
+
/**
|
|
159
|
+
* Content the request covers that is not a file it names (search's pending work, the sha256 of
|
|
160
|
+
* the version a change request edits), name to sha256 hex: added to `inputs`, so they are in
|
|
161
|
+
* the digest and other content is another request.
|
|
162
|
+
*/
|
|
163
|
+
hashes?: Record<string, string>;
|
|
164
|
+
}
|
|
165
|
+
/** What the plan step reads from a command's provider set: its routes and its providers' billing. */
|
|
166
|
+
export type PolicyProviders = {
|
|
167
|
+
get(id: string): {
|
|
168
|
+
provider: {
|
|
169
|
+
billing: {
|
|
170
|
+
paid: boolean;
|
|
171
|
+
adapter?: string;
|
|
172
|
+
};
|
|
173
|
+
checkAccount?: GenerationProvider["checkAccount"];
|
|
174
|
+
};
|
|
175
|
+
} | undefined;
|
|
176
|
+
routes: Readonly<Record<string, Route>>;
|
|
177
|
+
/** The cut measured for a decisions route's adapter and model (settings first, then the package). */
|
|
178
|
+
promptPolicyCut?(adapter: string, model: string): PromptPolicyCut | undefined;
|
|
179
|
+
};
|
|
180
|
+
/**
|
|
181
|
+
* The prompt-policy check's cut on the decisions route, or `RouteUnavailableError` (exit 2
|
|
182
|
+
* `route_unavailable`) when that adapter and model have no measured rates: the check is not run
|
|
183
|
+
* on a route nobody measured, and nothing is spent.
|
|
184
|
+
*/
|
|
185
|
+
export declare function promptPolicyCutOf(providers: PolicyProviders): PromptPolicyCut;
|
|
186
|
+
/** The labelled prompt text a plan's prompt-policy job decides on; undefined when it has none. */
|
|
187
|
+
export declare function policyPartsOf(plan: WorkPlan): PromptPart[] | undefined;
|
|
188
|
+
/** The prompt text a plan's prompt-policy job decides on, joined; undefined when it has none. */
|
|
189
|
+
export declare function policyTextOf(plan: WorkPlan): string | undefined;
|
|
190
|
+
/** The files a style view names (its references and perspective sample), as `<arg>/<path>`. */
|
|
191
|
+
export declare function styleBibleReads(arg: string, bible: {
|
|
192
|
+
value: {
|
|
193
|
+
references?: {
|
|
194
|
+
path: string;
|
|
195
|
+
}[];
|
|
196
|
+
perspective?: unknown;
|
|
197
|
+
};
|
|
198
|
+
dir: string;
|
|
199
|
+
}): Record<string, string>;
|
|
200
|
+
/** The key pose an asset spec names, as `<arg>/keyPose`; none when it names none. */
|
|
201
|
+
export declare function specReads(arg: string, spec: {
|
|
202
|
+
value: {
|
|
203
|
+
keyPose?: unknown;
|
|
204
|
+
};
|
|
205
|
+
dir: string;
|
|
206
|
+
}): Record<string, string>;
|
|
207
|
+
/**
|
|
208
|
+
* The files a Markdown bible names, as `<arg>/<path>`: the identity turnaround and references of
|
|
209
|
+
* `subjects`, or every reference (anchors and all identities) when no subjects are given.
|
|
210
|
+
*/
|
|
211
|
+
export declare function bibleReads(arg: string, path: string, subjects?: readonly string[]): Promise<Record<string, string>>;
|
|
212
|
+
/**
|
|
213
|
+
* A command's WorkPlan from its arguments: input hashes, options with the schema's defaults, the
|
|
214
|
+
* merged jobs and their forecast, the digest and the run directory.
|
|
215
|
+
*/
|
|
216
|
+
export declare function buildWorkPlan(spec: {
|
|
217
|
+
name: string;
|
|
218
|
+
input: JsonSchemaObject;
|
|
219
|
+
}, given: object, parts: WorkPlanParts): Promise<WorkPlan>;
|
|
220
|
+
/**
|
|
221
|
+
* Reads the account of each provider the jobs call that offers an account check (an ElevenLabs
|
|
222
|
+
* tier), once per provider, model and options; spends nothing. A plan whose account does not allow
|
|
223
|
+
* a route is refused here, exit 2 `route_unavailable`, before anything is confirmed or reserved.
|
|
224
|
+
*/
|
|
225
|
+
export declare function checkAccounts(providers: PolicyProviders, jobs: readonly PlanJob[]): Promise<void>;
|
|
226
|
+
/** Whether a provider of the jobs bills: `paid(id)` reads a provider's billing by settings id. */
|
|
227
|
+
export declare function paidOf(jobs: readonly PlanJob[], paid: (providerId: string) => boolean | undefined): boolean;
|
|
228
|
+
/** Whether a provider of the jobs bills, read from a provider set's configured providers. */
|
|
229
|
+
export declare function paidBy(providers: {
|
|
230
|
+
get(id: string): {
|
|
231
|
+
provider: {
|
|
232
|
+
billing: {
|
|
233
|
+
paid: boolean;
|
|
234
|
+
};
|
|
235
|
+
};
|
|
236
|
+
} | undefined;
|
|
237
|
+
}, jobs: readonly PlanJob[]): boolean;
|
|
238
|
+
/** The `round` input property every paid command takes. */
|
|
239
|
+
export declare const ROUND_PROPERTY: {
|
|
240
|
+
readonly type: "integer";
|
|
241
|
+
readonly description: "the round of this request, part of its digest";
|
|
242
|
+
readonly default: 1;
|
|
243
|
+
readonly minimum: 1;
|
|
244
|
+
};
|
|
245
|
+
/** The `note` input property of a command that takes an author's note with a new round. */
|
|
246
|
+
export declare const NOTE_PROPERTY: {
|
|
247
|
+
readonly type: "string";
|
|
248
|
+
readonly description: "the author's note for this round, added to the prompts; part of the request's digest";
|
|
249
|
+
readonly placeholder: "<text>";
|
|
250
|
+
};
|
|
251
|
+
/** The `runs` input property of a paid command that stages nothing else under it. */
|
|
252
|
+
export declare const RUNS_PROPERTY: {
|
|
253
|
+
readonly type: "string";
|
|
254
|
+
readonly description: "where the run directory (request.json, run.json) is written";
|
|
255
|
+
readonly default: ".assetgrove/runs";
|
|
256
|
+
};
|
|
257
|
+
/** The `dryRun` input property of every paid command. */
|
|
258
|
+
export declare const DRY_RUN_PROPERTY: {
|
|
259
|
+
readonly type: "boolean";
|
|
260
|
+
readonly description: "print the plan and forecast; spend nothing";
|
|
261
|
+
};
|