@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,404 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The free plan step of a paid command (design section 6): the jobs a request would run, their
|
|
3
|
+
* forecast against the cap, the hashes of its input files, its options, and the request digest
|
|
4
|
+
* that names its run directory. Building one makes no provider call and no ledger entry.
|
|
5
|
+
*/
|
|
6
|
+
import { createHash } from "node:crypto";
|
|
7
|
+
import { readFile, readdir, stat } from "node:fs/promises";
|
|
8
|
+
import { join, relative, resolve, sep } from "node:path";
|
|
9
|
+
import { plannedCallParameters } from "../call-parameters.js";
|
|
10
|
+
import { bibleReferences, loadBible } from "../bible.js";
|
|
11
|
+
import { InputError } from "../errors.js";
|
|
12
|
+
import { collectPromptParts, enforcePromptPolicy, modelWritten, partsText, readingTerms, } from "../policy/text.js";
|
|
13
|
+
import { PROMPT_POLICY_BAR_RATES, promptPolicyCut } from "../policy/cuts.js";
|
|
14
|
+
import { PROMPT_POLICY_OPERATION, RouteUnavailableError } from "../routes.js";
|
|
15
|
+
import { runDirOf } from "./dir.js";
|
|
16
|
+
/** The round a request is in when it names none. */
|
|
17
|
+
export const DEFAULT_ROUND = 1;
|
|
18
|
+
/** The default directory runs are staged under. */
|
|
19
|
+
export const DEFAULT_RUNS = ".assetgrove/runs";
|
|
20
|
+
/** Arguments that never enter a request's options: how it is answered, counted and where it runs. */
|
|
21
|
+
const NOT_OPTIONS = new Set(["providerScript", "dryRun", "workItem", "round"]);
|
|
22
|
+
/**
|
|
23
|
+
* JSON with every object's keys sorted and undefined values left out, so equal values always give
|
|
24
|
+
* the same text. Hand-written (docs/decisions.md): the digest must be byte-for-byte deterministic.
|
|
25
|
+
*/
|
|
26
|
+
export function canonicalJson(value) {
|
|
27
|
+
if (value === null || typeof value !== "object")
|
|
28
|
+
return JSON.stringify(value) ?? "null";
|
|
29
|
+
if (Array.isArray(value))
|
|
30
|
+
return `[${value.map((v) => (v === undefined ? "null" : canonicalJson(v))).join(",")}]`;
|
|
31
|
+
const entries = Object.entries(value)
|
|
32
|
+
.filter(([, v]) => v !== undefined)
|
|
33
|
+
.sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0));
|
|
34
|
+
return `{${entries.map(([k, v]) => `${JSON.stringify(k)}:${canonicalJson(v)}`).join(",")}}`;
|
|
35
|
+
}
|
|
36
|
+
function sha256Hex(text) {
|
|
37
|
+
return createHash("sha256").update(text).digest("hex");
|
|
38
|
+
}
|
|
39
|
+
/** sha256 hex of the canonical JSON of `{command, round, inputs, options, jobs, forecastUsd, capUsd, policyTextSha256}`. */
|
|
40
|
+
export function requestDigest(input) {
|
|
41
|
+
const { command, round, inputs, options, jobs, forecastUsd, capUsd, policyTextSha256 } = input;
|
|
42
|
+
return sha256Hex(canonicalJson({ command, round, inputs, options, jobs, forecastUsd, capUsd, policyTextSha256 }));
|
|
43
|
+
}
|
|
44
|
+
async function hashDirectory(dir) {
|
|
45
|
+
const files = {};
|
|
46
|
+
const walk = async (at) => {
|
|
47
|
+
for (const entry of await readdir(at, { withFileTypes: true })) {
|
|
48
|
+
const path = join(at, entry.name);
|
|
49
|
+
if (entry.isDirectory())
|
|
50
|
+
await walk(path);
|
|
51
|
+
else if (entry.isFile())
|
|
52
|
+
files[relative(dir, path).split(sep).join("/")] = sha256Hex(await readFile(path));
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
await walk(dir);
|
|
56
|
+
return sha256Hex(canonicalJson(files));
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* The sha256 of each named input file; a directory hashes to the sha256 of the canonical JSON of
|
|
60
|
+
* its files' relative paths and hashes. Absent arguments are left out.
|
|
61
|
+
*/
|
|
62
|
+
export async function hashInputs(paths) {
|
|
63
|
+
const inputs = {};
|
|
64
|
+
for (const [name, path] of Object.entries(paths)) {
|
|
65
|
+
if (path === undefined)
|
|
66
|
+
continue;
|
|
67
|
+
let isDirectory;
|
|
68
|
+
try {
|
|
69
|
+
isDirectory = (await stat(path)).isDirectory();
|
|
70
|
+
}
|
|
71
|
+
catch (error) {
|
|
72
|
+
throw new InputError(`cannot read ${name} ${path}`, { cause: error });
|
|
73
|
+
}
|
|
74
|
+
inputs[name] = isDirectory ? await hashDirectory(path) : sha256Hex(await readFile(path));
|
|
75
|
+
}
|
|
76
|
+
return inputs;
|
|
77
|
+
}
|
|
78
|
+
/** A job of `count` calls of an operation on its route. */
|
|
79
|
+
export function jobOf(operation, route, count = 1) {
|
|
80
|
+
return {
|
|
81
|
+
operation,
|
|
82
|
+
provider: route.provider ?? "",
|
|
83
|
+
model: route.model,
|
|
84
|
+
count,
|
|
85
|
+
estimatedCostUsd: route.estimatedCostUsd,
|
|
86
|
+
...(route.keyedProviderOptions !== undefined && {
|
|
87
|
+
providerOptions: route.keyedProviderOptions,
|
|
88
|
+
}),
|
|
89
|
+
...(route.keyedRouteOptions !== undefined && { routeOptions: route.keyedRouteOptions }),
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* The prompt-policy job of a request: one reading call per ambiguous name a person-written part
|
|
94
|
+
* holds (`readings`, src/policy/model.ts), then one decide call, or two when its prompt text holds
|
|
95
|
+
* model-written parts (the second decides on the person's parts alone).
|
|
96
|
+
*/
|
|
97
|
+
export function policyJobOf(route, modelWrittenParts, readings = 0) {
|
|
98
|
+
return jobOf(PROMPT_POLICY_OPERATION, route, (modelWrittenParts ? 2 : 1) + readings);
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Jobs from planned calls, each `count` times; the provider comes from the operation's route.
|
|
102
|
+
* Calls of the same operation, provider, model and estimate merge into one job.
|
|
103
|
+
*/
|
|
104
|
+
export function jobsOf(calls, routes, count = 1) {
|
|
105
|
+
return mergeJobs(calls.map((c) => {
|
|
106
|
+
const parameters = plannedCallParameters(c.parameters);
|
|
107
|
+
return {
|
|
108
|
+
operation: c.operation,
|
|
109
|
+
provider: providerOf(routes, c.operation),
|
|
110
|
+
model: c.model,
|
|
111
|
+
count,
|
|
112
|
+
estimatedCostUsd: c.estimatedCostUsd,
|
|
113
|
+
...optionsOf(routes, c.operation),
|
|
114
|
+
...(parameters !== undefined && { parameters }),
|
|
115
|
+
};
|
|
116
|
+
}));
|
|
117
|
+
}
|
|
118
|
+
function optionsOf(routes, operation) {
|
|
119
|
+
try {
|
|
120
|
+
const route = Object.hasOwn(routes, operation) ? routes[operation] : undefined;
|
|
121
|
+
return {
|
|
122
|
+
...(route?.keyedProviderOptions !== undefined && {
|
|
123
|
+
providerOptions: route.keyedProviderOptions,
|
|
124
|
+
}),
|
|
125
|
+
...(route?.keyedRouteOptions !== undefined && { routeOptions: route.keyedRouteOptions }),
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
catch {
|
|
129
|
+
return {};
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
function providerOf(routes, operation) {
|
|
133
|
+
try {
|
|
134
|
+
return (Object.hasOwn(routes, operation) && routes[operation]?.provider) || "";
|
|
135
|
+
}
|
|
136
|
+
catch {
|
|
137
|
+
return "";
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
/** Merges jobs of the same operation, provider, model and estimate, adding their counts; drops empty ones. */
|
|
141
|
+
export function mergeJobs(jobs) {
|
|
142
|
+
const merged = [];
|
|
143
|
+
for (const job of jobs) {
|
|
144
|
+
if (job.count <= 0)
|
|
145
|
+
continue;
|
|
146
|
+
const same = merged.find((m) => m.operation === job.operation &&
|
|
147
|
+
m.provider === job.provider &&
|
|
148
|
+
m.model === job.model &&
|
|
149
|
+
m.estimatedCostUsd === job.estimatedCostUsd &&
|
|
150
|
+
canonicalJson(m.providerOptions) === canonicalJson(job.providerOptions) &&
|
|
151
|
+
canonicalJson(m.routeOptions) === canonicalJson(job.routeOptions) &&
|
|
152
|
+
canonicalJson(m.parameters) === canonicalJson(job.parameters));
|
|
153
|
+
if (same)
|
|
154
|
+
same.count += job.count;
|
|
155
|
+
else
|
|
156
|
+
merged.push({ ...job });
|
|
157
|
+
}
|
|
158
|
+
return merged;
|
|
159
|
+
}
|
|
160
|
+
/** The forecast of a list of jobs. */
|
|
161
|
+
export function forecastOf(jobs) {
|
|
162
|
+
return jobs.reduce((sum, j) => sum + j.count * j.estimatedCostUsd, 0);
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* The prompt-policy check's cut on the decisions route, or `RouteUnavailableError` (exit 2
|
|
166
|
+
* `route_unavailable`) when that adapter and model have no measured rates: the check is not run
|
|
167
|
+
* on a route nobody measured, and nothing is spent.
|
|
168
|
+
*/
|
|
169
|
+
export function promptPolicyCutOf(providers) {
|
|
170
|
+
const route = providers.routes[PROMPT_POLICY_OPERATION];
|
|
171
|
+
const adapter = route.provider !== undefined
|
|
172
|
+
? providers.get(route.provider)?.provider.billing.adapter
|
|
173
|
+
: undefined;
|
|
174
|
+
const cut = adapter !== undefined
|
|
175
|
+
? (providers.promptPolicyCut?.(adapter, route.model) ?? promptPolicyCut(adapter, route.model))
|
|
176
|
+
: undefined;
|
|
177
|
+
if (cut === undefined)
|
|
178
|
+
throw new RouteUnavailableError(PROMPT_POLICY_OPERATION, `the prompt-policy check has no measured cut for its decisions route (${adapter ?? "no adapter"}:${route.model}), so it is not run on it: add an entry for it to policy/prompt-policy-cuts.json in the package, or record one you measured on the red-team set (confirmAt, refuseAt, refusalRate >= ${PROMPT_POLICY_BAR_RATES.minRefusalRate}, falseRefusalRate <= ${PROMPT_POLICY_BAR_RATES.maxFalseRefusalRate}) under promptPolicy.cuts in the developer settings, or route the decisions role to a measured model`);
|
|
179
|
+
return cut;
|
|
180
|
+
}
|
|
181
|
+
/** The prompt text each plan checked, kept beside the plan (never printed or digested as text). */
|
|
182
|
+
const policyTexts = new WeakMap();
|
|
183
|
+
/** The labelled prompt text a plan's prompt-policy job decides on; undefined when it has none. */
|
|
184
|
+
export function policyPartsOf(plan) {
|
|
185
|
+
return policyTexts.get(plan);
|
|
186
|
+
}
|
|
187
|
+
/** The prompt text a plan's prompt-policy job decides on, joined; undefined when it has none. */
|
|
188
|
+
export function policyTextOf(plan) {
|
|
189
|
+
const parts = policyTexts.get(plan);
|
|
190
|
+
return parts && partsText(parts);
|
|
191
|
+
}
|
|
192
|
+
/** The sha256 of a file, or undefined when it cannot be read. */
|
|
193
|
+
async function hashIfReadable(path) {
|
|
194
|
+
try {
|
|
195
|
+
return sha256Hex(await readFile(path));
|
|
196
|
+
}
|
|
197
|
+
catch {
|
|
198
|
+
return undefined;
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
/** The files a style view names (its references and perspective sample), as `<arg>/<path>`. */
|
|
202
|
+
export function styleBibleReads(arg, bible) {
|
|
203
|
+
const paths = [
|
|
204
|
+
...(Array.isArray(bible.value.references) ? bible.value.references.map((r) => r.path) : []),
|
|
205
|
+
...(typeof bible.value.perspective === "string" ? [bible.value.perspective] : []),
|
|
206
|
+
];
|
|
207
|
+
return Object.fromEntries(paths.map((path) => [`${arg}/${path}`, resolve(bible.dir, path)]));
|
|
208
|
+
}
|
|
209
|
+
/** The key pose an asset spec names, as `<arg>/keyPose`; none when it names none. */
|
|
210
|
+
export function specReads(arg, spec) {
|
|
211
|
+
return typeof spec.value.keyPose === "string"
|
|
212
|
+
? { [`${arg}/keyPose`]: resolve(spec.dir, spec.value.keyPose) }
|
|
213
|
+
: {};
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* The files a Markdown bible names, as `<arg>/<path>`: the identity turnaround and references of
|
|
217
|
+
* `subjects`, or every reference (anchors and all identities) when no subjects are given.
|
|
218
|
+
*/
|
|
219
|
+
export async function bibleReads(arg, path, subjects) {
|
|
220
|
+
const doc = await loadBible(path);
|
|
221
|
+
const paths = subjects === undefined
|
|
222
|
+
? bibleReferences(doc.data).map((reference) => reference.path)
|
|
223
|
+
: subjects.flatMap((subject) => {
|
|
224
|
+
const lock = doc.data.identities[subject];
|
|
225
|
+
return lock ? [lock.turnaround, ...(lock.references ?? [])] : [];
|
|
226
|
+
});
|
|
227
|
+
return Object.fromEntries(paths.map((p) => [`${arg}/${p}`, resolve(doc.dir, p)]));
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* A command's WorkPlan from its arguments: input hashes, options with the schema's defaults, the
|
|
231
|
+
* merged jobs and their forecast, the digest and the run directory.
|
|
232
|
+
*/
|
|
233
|
+
export async function buildWorkPlan(spec, given, parts) {
|
|
234
|
+
const args = given;
|
|
235
|
+
const runsArg = parts.runsArg ?? "runs";
|
|
236
|
+
const inputNames = new Set(parts.inputs);
|
|
237
|
+
const paths = {};
|
|
238
|
+
for (const name of parts.inputs) {
|
|
239
|
+
const value = args[name];
|
|
240
|
+
paths[name] = typeof value === "string" ? value : undefined;
|
|
241
|
+
}
|
|
242
|
+
const inputs = await hashInputs(paths);
|
|
243
|
+
for (const [name, hash] of Object.entries(parts.hashes ?? {}))
|
|
244
|
+
inputs[name] = hash;
|
|
245
|
+
for (const [name, path] of Object.entries(parts.reads ?? {})) {
|
|
246
|
+
if (name in inputs)
|
|
247
|
+
continue;
|
|
248
|
+
const hash = await hashIfReadable(path);
|
|
249
|
+
if (hash !== undefined)
|
|
250
|
+
inputs[name] = hash;
|
|
251
|
+
}
|
|
252
|
+
const promptFiles = {};
|
|
253
|
+
for (const [name, path] of Object.entries(paths))
|
|
254
|
+
if (path !== undefined)
|
|
255
|
+
promptFiles[name] = path;
|
|
256
|
+
for (const [name, path] of Object.entries(parts.reads ?? {}))
|
|
257
|
+
promptFiles[name] ??= path;
|
|
258
|
+
const promptParts = [
|
|
259
|
+
...(await collectPromptParts(promptFiles)),
|
|
260
|
+
...(parts.promptParts ?? []),
|
|
261
|
+
...(parts.promptText ?? [])
|
|
262
|
+
.filter((text) => text.trim().length > 0)
|
|
263
|
+
.map((text) => ({ label: "text", text })),
|
|
264
|
+
];
|
|
265
|
+
// Free: an unambiguous name refuses here; a phrase or ambiguous-name hit is recorded for the
|
|
266
|
+
// model check to decide when the run starts.
|
|
267
|
+
const promptPolicy = enforcePromptPolicy(promptParts, parts.promptAllow ?? []);
|
|
268
|
+
const policyText = partsText(promptParts);
|
|
269
|
+
// The model check (design section 16): one decide call when there is text to check, and a
|
|
270
|
+
// second, on the person's parts alone, when model-written text could be all it objects to.
|
|
271
|
+
if (policyText.trim())
|
|
272
|
+
promptPolicyCutOf(parts.providers);
|
|
273
|
+
const ownPolicyJobs = policyText.trim()
|
|
274
|
+
? [
|
|
275
|
+
policyJobOf(parts.providers.routes[PROMPT_POLICY_OPERATION], promptParts.some(modelWritten), readingTerms(promptPolicy.hits).length),
|
|
276
|
+
]
|
|
277
|
+
: [];
|
|
278
|
+
// A plan forecasts the prompt-policy check its apply runs too: the same readings, and a second
|
|
279
|
+
// decide call when the compiler can write model-written text.
|
|
280
|
+
const policyJobs = [
|
|
281
|
+
...ownPolicyJobs,
|
|
282
|
+
...(parts.applyPolicy !== undefined
|
|
283
|
+
? [
|
|
284
|
+
policyJobOf(parts.providers.routes[PROMPT_POLICY_OPERATION], parts.applyPolicy.modelWritten, readingTerms(promptPolicy.hits).length),
|
|
285
|
+
]
|
|
286
|
+
: []),
|
|
287
|
+
];
|
|
288
|
+
const policyTextSha256 = promptPolicy.textSha256;
|
|
289
|
+
const options = {};
|
|
290
|
+
for (const [name, property] of Object.entries(spec.input.properties)) {
|
|
291
|
+
if (inputNames.has(name) || NOT_OPTIONS.has(name) || name === runsArg)
|
|
292
|
+
continue;
|
|
293
|
+
const value = args[name] ?? property.default;
|
|
294
|
+
if (value !== undefined)
|
|
295
|
+
options[name] = value;
|
|
296
|
+
}
|
|
297
|
+
const round = typeof args["round"] === "number" ? args["round"] : DEFAULT_ROUND;
|
|
298
|
+
const jobs = mergeJobs([...policyJobs, ...parts.jobs]);
|
|
299
|
+
await checkAccounts(parts.providers, jobs);
|
|
300
|
+
const forecastUsd = forecastOf(jobs);
|
|
301
|
+
const digest = requestDigest({
|
|
302
|
+
command: spec.name,
|
|
303
|
+
round,
|
|
304
|
+
inputs,
|
|
305
|
+
options,
|
|
306
|
+
jobs,
|
|
307
|
+
forecastUsd,
|
|
308
|
+
capUsd: parts.capUsd,
|
|
309
|
+
policyTextSha256,
|
|
310
|
+
});
|
|
311
|
+
const runs = typeof args[runsArg] === "string" ? args[runsArg] : DEFAULT_RUNS;
|
|
312
|
+
const plan = {
|
|
313
|
+
jobs,
|
|
314
|
+
candidates: parts.candidates,
|
|
315
|
+
forecastUsd,
|
|
316
|
+
capUsd: parts.capUsd,
|
|
317
|
+
...(parts.capSource && { capSource: parts.capSource }),
|
|
318
|
+
paid: parts.paid || paidBy(parts.providers, policyJobs),
|
|
319
|
+
inputs,
|
|
320
|
+
options,
|
|
321
|
+
policyTextSha256,
|
|
322
|
+
promptPolicy,
|
|
323
|
+
digest,
|
|
324
|
+
runDir: runDirOf(resolve(runs), digest),
|
|
325
|
+
};
|
|
326
|
+
if (ownPolicyJobs.length > 0)
|
|
327
|
+
policyTexts.set(plan, promptParts);
|
|
328
|
+
if (parts.near?.nearMatches !== undefined)
|
|
329
|
+
plan.nearMatches = parts.near.nearMatches;
|
|
330
|
+
if (parts.near?.nearMatchSheet !== undefined)
|
|
331
|
+
plan.nearMatchSheet = parts.near.nearMatchSheet;
|
|
332
|
+
if (parts.near?.searchError !== undefined)
|
|
333
|
+
plan.searchError = parts.near.searchError;
|
|
334
|
+
return plan;
|
|
335
|
+
}
|
|
336
|
+
/**
|
|
337
|
+
* Reads the account of each provider the jobs call that offers an account check (an ElevenLabs
|
|
338
|
+
* tier), once per provider, model and options; spends nothing. A plan whose account does not allow
|
|
339
|
+
* a route is refused here, exit 2 `route_unavailable`, before anything is confirmed or reserved.
|
|
340
|
+
*/
|
|
341
|
+
export async function checkAccounts(providers, jobs) {
|
|
342
|
+
const seen = new Set();
|
|
343
|
+
for (const job of jobs) {
|
|
344
|
+
if (job.count <= 0)
|
|
345
|
+
continue;
|
|
346
|
+
const check = providers.get(job.provider)?.provider.checkAccount;
|
|
347
|
+
if (check === undefined)
|
|
348
|
+
continue;
|
|
349
|
+
let route;
|
|
350
|
+
try {
|
|
351
|
+
route = Object.hasOwn(providers.routes, job.operation)
|
|
352
|
+
? providers.routes[job.operation]
|
|
353
|
+
: undefined;
|
|
354
|
+
}
|
|
355
|
+
catch {
|
|
356
|
+
route = undefined;
|
|
357
|
+
}
|
|
358
|
+
const providerOptions = route?.providerOptions;
|
|
359
|
+
const key = canonicalJson([job.provider, job.model, providerOptions ?? null]);
|
|
360
|
+
if (seen.has(key))
|
|
361
|
+
continue;
|
|
362
|
+
seen.add(key);
|
|
363
|
+
const provider = providers.get(job.provider).provider;
|
|
364
|
+
const reading = await provider.checkAccount({
|
|
365
|
+
operation: job.operation,
|
|
366
|
+
model: job.model,
|
|
367
|
+
...(providerOptions !== undefined && { providerOptions }),
|
|
368
|
+
});
|
|
369
|
+
if (reading.refused !== undefined)
|
|
370
|
+
throw new RouteUnavailableError(job.operation, `route unavailable: the ${job.operation} operation's provider "${job.provider}" is on the ${reading.plan} plan (${reading.source}), which it refuses: ${reading.refused}`);
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
/** Whether a provider of the jobs bills: `paid(id)` reads a provider's billing by settings id. */
|
|
374
|
+
export function paidOf(jobs, paid) {
|
|
375
|
+
return jobs.some((j) => j.count > 0 && paid(j.provider) === true);
|
|
376
|
+
}
|
|
377
|
+
/** Whether a provider of the jobs bills, read from a provider set's configured providers. */
|
|
378
|
+
export function paidBy(providers, jobs) {
|
|
379
|
+
return paidOf(jobs, (id) => providers.get(id)?.provider.billing.paid);
|
|
380
|
+
}
|
|
381
|
+
/** The `round` input property every paid command takes. */
|
|
382
|
+
export const ROUND_PROPERTY = {
|
|
383
|
+
type: "integer",
|
|
384
|
+
description: "the round of this request, part of its digest",
|
|
385
|
+
default: DEFAULT_ROUND,
|
|
386
|
+
minimum: 1,
|
|
387
|
+
};
|
|
388
|
+
/** The `note` input property of a command that takes an author's note with a new round. */
|
|
389
|
+
export const NOTE_PROPERTY = {
|
|
390
|
+
type: "string",
|
|
391
|
+
description: "the author's note for this round, added to the prompts; part of the request's digest",
|
|
392
|
+
placeholder: "<text>",
|
|
393
|
+
};
|
|
394
|
+
/** The `runs` input property of a paid command that stages nothing else under it. */
|
|
395
|
+
export const RUNS_PROPERTY = {
|
|
396
|
+
type: "string",
|
|
397
|
+
description: "where the run directory (request.json, run.json) is written",
|
|
398
|
+
default: DEFAULT_RUNS,
|
|
399
|
+
};
|
|
400
|
+
/** The `dryRun` input property of every paid command. */
|
|
401
|
+
export const DRY_RUN_PROPERTY = {
|
|
402
|
+
type: "boolean",
|
|
403
|
+
description: "print the plan and forecast; spend nothing",
|
|
404
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { RunContext } from "../commands/types.ts";
|
|
2
|
+
import type { SearchHit } from "../extension/api.ts";
|
|
3
|
+
import type { GenerationBrief } from "../planning.ts";
|
|
4
|
+
import type { AssetSpec, StyleBible } from "../types.ts";
|
|
5
|
+
/** The most near matches a plan lists. */
|
|
6
|
+
export declare const NEAR_MATCH_LIMIT = 3;
|
|
7
|
+
export type NearMatch = SearchHit;
|
|
8
|
+
export interface NearMatchOutcome {
|
|
9
|
+
nearMatches?: NearMatch[];
|
|
10
|
+
nearMatchSheet?: string;
|
|
11
|
+
searchError?: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* The reference images that show the thing requested: the spec's key pose; when the Markdown
|
|
15
|
+
* bible at `biblePath` locks the spec's subject, its approved turnaround; and the JSON style
|
|
16
|
+
* bible's references tagged with the spec's subject (and its look, when the reference names one),
|
|
17
|
+
* the ones generation itself sends for the subject. The Markdown bible's style anchors (positive
|
|
18
|
+
* and negative), the perspective sample and other subjects' references are left out: they show
|
|
19
|
+
* the look of the whole game, not this asset.
|
|
20
|
+
*/
|
|
21
|
+
export declare function subjectReferencePaths(spec: {
|
|
22
|
+
value: AssetSpec;
|
|
23
|
+
dir: string;
|
|
24
|
+
}, biblePath?: string, styleBible?: {
|
|
25
|
+
value: StyleBible;
|
|
26
|
+
dir: string;
|
|
27
|
+
}): Promise<string[]>;
|
|
28
|
+
/**
|
|
29
|
+
* The near matches of one spec: `{}` when no extension fills the search slot or near matches are
|
|
30
|
+
* off, so every field is absent; `searchError` when the search failed.
|
|
31
|
+
*/
|
|
32
|
+
export declare function nearMatchesFor(spec: Pick<AssetSpec, "kind" | "assetId" | "subject">, referencePaths: readonly string[], ctx: RunContext, brief?: GenerationBrief): Promise<NearMatchOutcome>;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Near matches before paid generation (design section 7.6): with search loaded and `search.nearMatch`
|
|
3
|
+
* on, the plan step of plan, stage, apply and generate-sheet lists up to three picked assets of the
|
|
4
|
+
* spec's kind, ranked closest to the request by the slot, for the person to judge: no subject
|
|
5
|
+
* filter and no similarity cut. A failed search records `searchError` and the plan goes on.
|
|
6
|
+
*/
|
|
7
|
+
import { readFile } from "node:fs/promises";
|
|
8
|
+
import { join, resolve } from "node:path";
|
|
9
|
+
import { loadBible } from "../bible.js";
|
|
10
|
+
import { calling, searchCall } from "../commands/search.js";
|
|
11
|
+
import { CORE_REGISTRY } from "../extensions/registry.js";
|
|
12
|
+
import { sniffMediaType, subjectOf } from "../request.js";
|
|
13
|
+
import { writeFindSheet } from "./sheet.js";
|
|
14
|
+
/** The most near matches a plan lists. */
|
|
15
|
+
export const NEAR_MATCH_LIMIT = 3;
|
|
16
|
+
/**
|
|
17
|
+
* The reference images that show the thing requested: the spec's key pose; when the Markdown
|
|
18
|
+
* bible at `biblePath` locks the spec's subject, its approved turnaround; and the JSON style
|
|
19
|
+
* bible's references tagged with the spec's subject (and its look, when the reference names one),
|
|
20
|
+
* the ones generation itself sends for the subject. The Markdown bible's style anchors (positive
|
|
21
|
+
* and negative), the perspective sample and other subjects' references are left out: they show
|
|
22
|
+
* the look of the whole game, not this asset.
|
|
23
|
+
*/
|
|
24
|
+
export async function subjectReferencePaths(spec, biblePath, styleBible) {
|
|
25
|
+
const paths = [];
|
|
26
|
+
const subject = subjectOf(spec.value);
|
|
27
|
+
for (const r of Array.isArray(styleBible?.value.references) ? styleBible.value.references : []) {
|
|
28
|
+
if (r.subject === subject &&
|
|
29
|
+
r.role !== "perspective" &&
|
|
30
|
+
(r.look === undefined || r.look === spec.value.look))
|
|
31
|
+
paths.push(resolve(styleBible.dir, r.path));
|
|
32
|
+
}
|
|
33
|
+
if (biblePath !== undefined) {
|
|
34
|
+
try {
|
|
35
|
+
const doc = await loadBible(biblePath);
|
|
36
|
+
const lock = doc.data.identities[subject];
|
|
37
|
+
if (lock)
|
|
38
|
+
paths.push(resolve(doc.dir, lock.turnaround));
|
|
39
|
+
}
|
|
40
|
+
catch {
|
|
41
|
+
// A bible that does not load has no identity to compare; the plan step reports it itself.
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
if (typeof spec.value.keyPose === "string")
|
|
45
|
+
paths.push(resolve(spec.dir, spec.value.keyPose));
|
|
46
|
+
return paths;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* The near matches of one spec: `{}` when no extension fills the search slot or near matches are
|
|
50
|
+
* off, so every field is absent; `searchError` when the search failed.
|
|
51
|
+
*/
|
|
52
|
+
export async function nearMatchesFor(spec, referencePaths, ctx, brief) {
|
|
53
|
+
const slot = (ctx.extensions ?? CORE_REGISTRY).search;
|
|
54
|
+
if (slot?.nearMatch === undefined || ctx.settings.search?.nearMatch === false)
|
|
55
|
+
return {};
|
|
56
|
+
try {
|
|
57
|
+
const { context, reader } = await searchCall("find", undefined, ctx);
|
|
58
|
+
if (!context.settings.nearMatch)
|
|
59
|
+
return {};
|
|
60
|
+
const references = [];
|
|
61
|
+
for (const path of new Set(referencePaths)) {
|
|
62
|
+
const bytes = new Uint8Array(await readFile(path));
|
|
63
|
+
if (sniffMediaType(bytes).startsWith("image/"))
|
|
64
|
+
references.push(bytes);
|
|
65
|
+
}
|
|
66
|
+
const words = [brief?.purpose, brief?.appearsIn, brief?.mood, brief?.context]
|
|
67
|
+
.filter((v) => typeof v === "string" && v.trim() !== "")
|
|
68
|
+
.join(" ");
|
|
69
|
+
const result = await calling(() => slot.nearMatch({
|
|
70
|
+
kind: spec.kind,
|
|
71
|
+
subject: spec.subject ?? spec.assetId,
|
|
72
|
+
...(words !== "" && { brief: words }),
|
|
73
|
+
references,
|
|
74
|
+
limit: NEAR_MATCH_LIMIT,
|
|
75
|
+
}, context));
|
|
76
|
+
const hits = result.hits.slice(0, NEAR_MATCH_LIMIT);
|
|
77
|
+
if (hits.length === 0)
|
|
78
|
+
return { nearMatches: [] };
|
|
79
|
+
const images = await Promise.all(hits.map((hit) => reader.loadImageByPath(hit.path)));
|
|
80
|
+
const nearMatchSheet = await writeFindSheet(hits, images, join(ctx.settings.stateDir, "search", "sheets"));
|
|
81
|
+
return { nearMatches: hits, nearMatchSheet };
|
|
82
|
+
}
|
|
83
|
+
catch (error) {
|
|
84
|
+
return { searchError: error instanceof Error ? error.message : String(error) };
|
|
85
|
+
}
|
|
86
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { SearchLibrary } from "../extension/api.ts";
|
|
2
|
+
import type { SearchSettings } from "../settings.ts";
|
|
3
|
+
export type LibraryReader = SearchLibrary & {
|
|
4
|
+
game: string;
|
|
5
|
+
/** The bytes of a path the reader lists; undefined for any other path or an unreadable file. */
|
|
6
|
+
loadImageByPath(path: string): Promise<Uint8Array | undefined>;
|
|
7
|
+
changedSince(commit: string): Promise<boolean>;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Opens the reader for the project at `dir`. An asset whose card path leaves the library root, or
|
|
11
|
+
* whose media file is missing, is left out of `list()`, so `load()` refuses its path.
|
|
12
|
+
*/
|
|
13
|
+
export declare function createLibraryReader(options: {
|
|
14
|
+
dir: string;
|
|
15
|
+
stateDir: string;
|
|
16
|
+
settings: Pick<SearchSettings, "folders" | "candidates">;
|
|
17
|
+
}): Promise<LibraryReader>;
|