@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,232 @@
|
|
|
1
|
+
import { randomUUID } from "node:crypto";
|
|
2
|
+
import { ProviderError } from "../errors.js";
|
|
3
|
+
import { isQuotaRefusal, ProviderQuotaError } from "./failure.js";
|
|
4
|
+
/** Stability's fixed endpoint; settings never move it. */
|
|
5
|
+
export const STABILITY_BASE_URL = "https://api.stability.ai";
|
|
6
|
+
/** Credits Stability charges for one successful generation; failures are not charged. */
|
|
7
|
+
const CREDITS_PER_GENERATION = 8;
|
|
8
|
+
/** The published price of one credit, in USD. */
|
|
9
|
+
const DEFAULT_USD_PER_CREDIT = 0.01;
|
|
10
|
+
const MODELS = {
|
|
11
|
+
"stable-audio-2.5": { path: "/v2beta/audio/stable-audio-2/text-to-audio", maxS: 190 },
|
|
12
|
+
"stable-audio-3.0": { path: "/v2beta/audio/stable-audio-3/text-to-audio", maxS: 380 },
|
|
13
|
+
};
|
|
14
|
+
function isModel(model) {
|
|
15
|
+
return Object.hasOwn(MODELS, model);
|
|
16
|
+
}
|
|
17
|
+
function isRecord(value) {
|
|
18
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* The Stability audio adapter: Stable Audio 2.5 (one synchronous call) and 3.0 (a job with an id,
|
|
22
|
+
* results kept 24 h). Stability publishes no official JavaScript SDK for its REST API (its only
|
|
23
|
+
* SDK, the Python `stability-sdk`, targets the retired gRPC API), so this adapter speaks the
|
|
24
|
+
* documented REST API directly over the injected `fetch`; the exception is recorded in
|
|
25
|
+
* docs/decisions.md. A successful call costs 8 credits × `usdPerCredit` (default the published
|
|
26
|
+
* $0.01). Stability takes no idempotency key and cannot look a job up by one, so the jobs declare
|
|
27
|
+
* neither `dedupesByKey` nor `find`.
|
|
28
|
+
*/
|
|
29
|
+
export class StabilityProvider {
|
|
30
|
+
billing;
|
|
31
|
+
audioParameters = ["durationS", "seed"];
|
|
32
|
+
#apiKey;
|
|
33
|
+
#keyEnv;
|
|
34
|
+
#rate;
|
|
35
|
+
#baseUrl;
|
|
36
|
+
#fetch;
|
|
37
|
+
#sleep;
|
|
38
|
+
#pollIntervalMs;
|
|
39
|
+
#timeoutMs;
|
|
40
|
+
/** Finished 3.0 results fetched by `status`, so `result` does not download twice. */
|
|
41
|
+
#finished = new Map();
|
|
42
|
+
constructor(options) {
|
|
43
|
+
this.#apiKey = options.apiKey || undefined;
|
|
44
|
+
this.#keyEnv = options.keyEnv ?? "STABILITY_API_KEY";
|
|
45
|
+
this.#rate = options.usdPerCredit ?? DEFAULT_USD_PER_CREDIT;
|
|
46
|
+
this.#baseUrl = (options.baseUrl ?? STABILITY_BASE_URL).replace(/\/+$/, "");
|
|
47
|
+
this.billing = {
|
|
48
|
+
adapter: "stability",
|
|
49
|
+
providerId: "stability",
|
|
50
|
+
paid: true,
|
|
51
|
+
settle: "reported",
|
|
52
|
+
reconcile: "unavailable",
|
|
53
|
+
...options.billing,
|
|
54
|
+
hosts: [new URL(this.#baseUrl).host],
|
|
55
|
+
readLimit: () => this.limitReading(),
|
|
56
|
+
};
|
|
57
|
+
this.#fetch = options.fetch ?? fetch;
|
|
58
|
+
this.#sleep = options.sleep ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms)));
|
|
59
|
+
this.#pollIntervalMs = options.pollIntervalMs ?? 3000;
|
|
60
|
+
this.#timeoutMs = options.timeoutMs ?? 15 * 60 * 1000;
|
|
61
|
+
}
|
|
62
|
+
generateImage() {
|
|
63
|
+
return Promise.reject(new ProviderError("stability's adapter serves audio only"));
|
|
64
|
+
}
|
|
65
|
+
analyzeImages() {
|
|
66
|
+
return Promise.reject(new ProviderError("stability's adapter serves audio only"));
|
|
67
|
+
}
|
|
68
|
+
/** The account's credit balance as a limit reading; spends nothing. */
|
|
69
|
+
async limitReading() {
|
|
70
|
+
const response = await this.#send("balance", "GET", "/v1/user/balance", "application/json");
|
|
71
|
+
const json = await response.json().catch(() => undefined);
|
|
72
|
+
const credits = isRecord(json) ? json["credits"] : undefined;
|
|
73
|
+
if (typeof credits !== "number")
|
|
74
|
+
throw new ProviderError("stability balance: no credits returned");
|
|
75
|
+
return {
|
|
76
|
+
balance: credits,
|
|
77
|
+
unit: "credits",
|
|
78
|
+
balanceUsd: credits * this.#rate,
|
|
79
|
+
source: "stability balance",
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
/** The call's cost in USD, checked before core reserves: an unknown model or duration refuses. */
|
|
83
|
+
estimate(request, kind) {
|
|
84
|
+
if (kind !== "audio")
|
|
85
|
+
throw new ProviderError("stability's adapter serves audio only");
|
|
86
|
+
this.#check(request);
|
|
87
|
+
return this.#cost();
|
|
88
|
+
}
|
|
89
|
+
jobs = {
|
|
90
|
+
audio: {
|
|
91
|
+
serves: (request) => request.model === "stable-audio-3.0",
|
|
92
|
+
submit: (request) => this.#submit(request),
|
|
93
|
+
status: (id) => this.#status(id),
|
|
94
|
+
result: (id, request) => this.#collect(id, request),
|
|
95
|
+
},
|
|
96
|
+
};
|
|
97
|
+
async generateAudio(request) {
|
|
98
|
+
const model = this.#check(request);
|
|
99
|
+
if (model === "stable-audio-2.5") {
|
|
100
|
+
const response = await this.#send("audio", "POST", MODELS[model].path, "audio/*", this.#form(request));
|
|
101
|
+
return this.#audio(response, request, undefined);
|
|
102
|
+
}
|
|
103
|
+
const id = await this.#submit(request);
|
|
104
|
+
let waited = 0;
|
|
105
|
+
for (;;) {
|
|
106
|
+
if ((await this.#status(id)) === "done")
|
|
107
|
+
return this.#collect(id, request);
|
|
108
|
+
if (waited >= this.#timeoutMs)
|
|
109
|
+
throw new ProviderError(`stability audio: job ${id} timed out after ${waited} ms`);
|
|
110
|
+
await this.#sleep(this.#pollIntervalMs);
|
|
111
|
+
waited += this.#pollIntervalMs;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
#cost() {
|
|
115
|
+
return CREDITS_PER_GENERATION * this.#rate;
|
|
116
|
+
}
|
|
117
|
+
#check(request) {
|
|
118
|
+
if (!isModel(request.model))
|
|
119
|
+
throw new ProviderError(`stability: unknown audio model "${request.model}"; use stable-audio-2.5 or stable-audio-3.0`);
|
|
120
|
+
const max = MODELS[request.model].maxS;
|
|
121
|
+
const d = request.durationS;
|
|
122
|
+
if (d !== undefined && !(Number.isFinite(d) && d >= 1 && d <= max))
|
|
123
|
+
throw new ProviderError(`stability: ${request.model} makes 1 to ${max} seconds, not ${String(d)}`);
|
|
124
|
+
return request.model;
|
|
125
|
+
}
|
|
126
|
+
#form(request) {
|
|
127
|
+
const form = new FormData();
|
|
128
|
+
form.append("prompt", request.prompt);
|
|
129
|
+
form.append("model", request.model);
|
|
130
|
+
form.append("output_format", "wav");
|
|
131
|
+
if (request.durationS !== undefined)
|
|
132
|
+
form.append("duration", String(request.durationS));
|
|
133
|
+
if (request.seed !== undefined)
|
|
134
|
+
form.append("seed", String(request.seed));
|
|
135
|
+
return form;
|
|
136
|
+
}
|
|
137
|
+
async #submit(request) {
|
|
138
|
+
const model = this.#check(request);
|
|
139
|
+
const response = await this.#send("audio", "POST", MODELS[model].path, "application/json", this.#form(request));
|
|
140
|
+
const json = await response.json().catch(() => undefined);
|
|
141
|
+
const id = isRecord(json) ? json["id"] : undefined;
|
|
142
|
+
if (typeof id !== "string" || id === "")
|
|
143
|
+
throw new ProviderError("stability audio: no job id returned");
|
|
144
|
+
return id;
|
|
145
|
+
}
|
|
146
|
+
async #status(id) {
|
|
147
|
+
const response = await this.#fetchResult(id);
|
|
148
|
+
if (response.status === 202)
|
|
149
|
+
return "running";
|
|
150
|
+
if (response.status === 404)
|
|
151
|
+
return "unknown";
|
|
152
|
+
if (response.ok) {
|
|
153
|
+
this.#finished.set(id, response);
|
|
154
|
+
return "done";
|
|
155
|
+
}
|
|
156
|
+
// Any other answer (429, 401, 5xx) says nothing about the job itself, which may still
|
|
157
|
+
// finish and be charged: throw, so core keeps the job journaled for the next run rather
|
|
158
|
+
// than settle it and submit again.
|
|
159
|
+
throw await this.#failure("audio", response);
|
|
160
|
+
}
|
|
161
|
+
async #collect(id, request) {
|
|
162
|
+
const cached = this.#finished.get(id);
|
|
163
|
+
this.#finished.delete(id);
|
|
164
|
+
const response = cached ?? (await this.#fetchResult(id));
|
|
165
|
+
if (response.status === 202)
|
|
166
|
+
throw new ProviderError(`stability audio: job ${id} is not done`);
|
|
167
|
+
if (!response.ok)
|
|
168
|
+
throw await this.#failure("audio", response);
|
|
169
|
+
return this.#audio(response, request, id);
|
|
170
|
+
}
|
|
171
|
+
#fetchResult(id) {
|
|
172
|
+
return this.#request("audio", "GET", `/v2beta/results/${encodeURIComponent(id)}`, "audio/*");
|
|
173
|
+
}
|
|
174
|
+
async #audio(response, request, jobId) {
|
|
175
|
+
if (response.headers.get("finish-reason") === "CONTENT_FILTERED")
|
|
176
|
+
throw new ProviderError("stability audio: the output was filtered (CONTENT_FILTERED)", {
|
|
177
|
+
providerCode: "CONTENT_FILTERED",
|
|
178
|
+
});
|
|
179
|
+
const bytes = new Uint8Array(await response.arrayBuffer());
|
|
180
|
+
const mediaType = (response.headers.get("content-type") ?? "").split(";")[0].trim();
|
|
181
|
+
const header = response.headers.get("seed");
|
|
182
|
+
const seed = header !== null && /^\d+$/.test(header) ? Number(header) : undefined;
|
|
183
|
+
const reported = response.headers.get("x-request-id") ?? response.headers.get("request-id");
|
|
184
|
+
const requestId = jobId ?? reported ?? randomUUID();
|
|
185
|
+
const provider = jobId !== undefined || reported !== null;
|
|
186
|
+
return {
|
|
187
|
+
audio: { mediaType: mediaType || "audio/wav", bytes },
|
|
188
|
+
requestId,
|
|
189
|
+
requestIdSource: provider ? "provider" : "local",
|
|
190
|
+
costUsd: this.#cost(),
|
|
191
|
+
...(seed !== undefined ? { seed } : request.seed !== undefined && { seed: request.seed }),
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
/** A request whose error statuses stay the caller's to read; transport failures are thrown. */
|
|
195
|
+
async #request(label, method, path, accept, body) {
|
|
196
|
+
if (this.#apiKey === undefined)
|
|
197
|
+
throw new ProviderError(`stability ${label}: ${this.#keyEnv} is not set`);
|
|
198
|
+
try {
|
|
199
|
+
return await this.#fetch(`${this.#baseUrl}${path}`, {
|
|
200
|
+
method,
|
|
201
|
+
headers: { Authorization: `Bearer ${this.#apiKey}`, Accept: accept },
|
|
202
|
+
...(body !== undefined && { body }),
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
catch (error) {
|
|
206
|
+
throw new ProviderError(`stability ${label}: request failed`, { cause: error });
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
/** A request that must succeed; 202 passes for the poll's caller. */
|
|
210
|
+
async #send(label, method, path, accept, body) {
|
|
211
|
+
const response = await this.#request(label, method, path, accept, body);
|
|
212
|
+
if (!response.ok)
|
|
213
|
+
throw await this.#failure(label, response);
|
|
214
|
+
return response;
|
|
215
|
+
}
|
|
216
|
+
/** Only Stability's `name`, its `errors` and the status; never the rest of the body. */
|
|
217
|
+
async #failure(label, response) {
|
|
218
|
+
const json = await response.json().catch(() => undefined);
|
|
219
|
+
const name = isRecord(json) && typeof json["name"] === "string" ? json["name"] : undefined;
|
|
220
|
+
const errors = isRecord(json) && Array.isArray(json["errors"])
|
|
221
|
+
? json["errors"].filter((e) => typeof e === "string")
|
|
222
|
+
: [];
|
|
223
|
+
const message = errors.length > 0 ? errors.join("; ") : "request failed";
|
|
224
|
+
const text = `stability ${label}: ${message} (HTTP ${response.status}${name ? `, ${name}` : ""})`;
|
|
225
|
+
if (isQuotaRefusal({ message, status: response.status }) || response.status === 429)
|
|
226
|
+
return new ProviderQuotaError(`refused: ${text}`, response.status, name);
|
|
227
|
+
return new ProviderError(text, {
|
|
228
|
+
status: response.status,
|
|
229
|
+
...(name !== undefined && { providerCode: name }),
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What the direct adapters (anthropic, openai, openai-compatible) share: the chat message of a
|
|
3
|
+
* vision or decision call, the request ID of a result, and a typed decision through the AI SDK's
|
|
4
|
+
* structured output (`Output.object`), recorded with `decisionSource: "structured-output"`.
|
|
5
|
+
*/
|
|
6
|
+
import type { LanguageModel } from "ai";
|
|
7
|
+
import type { DecisionRequest, DecisionResult, VisionRequest } from "./provider.ts";
|
|
8
|
+
/** The provider's request ID when it reports one, else a local one marked as such. */
|
|
9
|
+
export declare function requestIdOf(...candidates: unknown[]): {
|
|
10
|
+
requestId: string;
|
|
11
|
+
requestIdSource: "provider" | "local";
|
|
12
|
+
};
|
|
13
|
+
/** One user message: the prompt, then the images in order. */
|
|
14
|
+
export declare function userMessage(prompt: string, images: VisionRequest["images"]): {
|
|
15
|
+
role: "user";
|
|
16
|
+
content: ({
|
|
17
|
+
type: "image";
|
|
18
|
+
image: Uint8Array<ArrayBufferLike>;
|
|
19
|
+
mediaType: string;
|
|
20
|
+
} | {
|
|
21
|
+
type: "text";
|
|
22
|
+
text: string;
|
|
23
|
+
})[];
|
|
24
|
+
}[];
|
|
25
|
+
/**
|
|
26
|
+
* A typed decision through structured output: the model answers a score (the index of one of the
|
|
27
|
+
* question's levels), a probability that the statement holds, or the option that fits with its
|
|
28
|
+
* probability. `guard` maps a thrown SDK error to
|
|
29
|
+
* the adapter's own; `headerId` names the response header that carries the provider's request ID.
|
|
30
|
+
*/
|
|
31
|
+
export declare function decideStructured(provider: string, model: LanguageModel, req: DecisionRequest, guard: <T>(label: string, call: () => Promise<T>) => Promise<T>, headerId?: string): Promise<DecisionResult>;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { ProviderError } from "../errors.js";
|
|
3
|
+
/** The provider's request ID when it reports one, else a local one marked as such. */
|
|
4
|
+
export function requestIdOf(...candidates) {
|
|
5
|
+
for (const c of candidates) {
|
|
6
|
+
if (typeof c === "string" && c !== "")
|
|
7
|
+
return { requestId: c, requestIdSource: "provider" };
|
|
8
|
+
}
|
|
9
|
+
return {
|
|
10
|
+
requestId: `local-${Date.now()}-${Math.random().toString(36).slice(2, 10)}`,
|
|
11
|
+
requestIdSource: "local",
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
/** One user message: the prompt, then the images in order. */
|
|
15
|
+
export function userMessage(prompt, images) {
|
|
16
|
+
return [
|
|
17
|
+
{
|
|
18
|
+
role: "user",
|
|
19
|
+
content: [
|
|
20
|
+
{ type: "text", text: prompt },
|
|
21
|
+
...images.map((i) => ({ type: "image", image: i.bytes, mediaType: i.mediaType })),
|
|
22
|
+
],
|
|
23
|
+
},
|
|
24
|
+
];
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* A typed decision through structured output: the model answers a score (the index of one of the
|
|
28
|
+
* question's levels), a probability that the statement holds, or the option that fits with its
|
|
29
|
+
* probability. `guard` maps a thrown SDK error to
|
|
30
|
+
* the adapter's own; `headerId` names the response header that carries the provider's request ID.
|
|
31
|
+
*/
|
|
32
|
+
export async function decideStructured(provider, model, req, guard, headerId) {
|
|
33
|
+
const q = req.question;
|
|
34
|
+
const top = q.type === "score" ? Math.max(1, q.levels.length - 1) : 1;
|
|
35
|
+
const names = q.type === "choice" ? Object.keys(q.options) : [];
|
|
36
|
+
const schema = q.type === "score"
|
|
37
|
+
? z.object({ score: z.number().min(0).max(top) })
|
|
38
|
+
: q.type === "choice"
|
|
39
|
+
? z.object({
|
|
40
|
+
choice: z.enum(names),
|
|
41
|
+
probability: z.number().min(0).max(1),
|
|
42
|
+
})
|
|
43
|
+
: z.object({ probability: z.number().min(0).max(1) });
|
|
44
|
+
const instructions = q.type === "score"
|
|
45
|
+
? `${q.instructions}\nAnswer with score, the index (0 to ${top}) of the level that fits: ${q.levels.map((l, i) => `${i}: ${l}`).join("; ")}.`
|
|
46
|
+
: q.type === "choice"
|
|
47
|
+
? `${q.instructions}\nAnswer with choice, the one option that fits, and probability, from 0 to 1, that it is right. Options: ${Object.entries(q.options)
|
|
48
|
+
.map(([name, meaning]) => `${name}: ${meaning}`)
|
|
49
|
+
.join("; ")}.`
|
|
50
|
+
: `${q.instructions}\nAnswer with probability, from 0 to 1, that this holds.` +
|
|
51
|
+
`${q.whenTrue !== undefined ? ` True means: ${q.whenTrue}.` : ""}` +
|
|
52
|
+
`${q.whenFalse !== undefined ? ` False means: ${q.whenFalse}.` : ""}`;
|
|
53
|
+
const { generateText, Output } = await import("ai");
|
|
54
|
+
const result = await guard("decide", () => generateText({
|
|
55
|
+
model,
|
|
56
|
+
// One request per reservation: an SDK retry would resend a paid call.
|
|
57
|
+
maxRetries: 0,
|
|
58
|
+
messages: userMessage(`${req.prompt}\n\n${instructions}`, req.images),
|
|
59
|
+
output: Output.object({ schema }),
|
|
60
|
+
}));
|
|
61
|
+
const raw = result.output;
|
|
62
|
+
let answer;
|
|
63
|
+
if (q.type === "score" && typeof raw?.score === "number")
|
|
64
|
+
answer = { type: "score", score: raw.score };
|
|
65
|
+
else if (q.type === "choice" &&
|
|
66
|
+
typeof raw?.choice === "string" &&
|
|
67
|
+
names.includes(raw.choice) &&
|
|
68
|
+
typeof raw.probability === "number")
|
|
69
|
+
answer = {
|
|
70
|
+
type: "choice",
|
|
71
|
+
choice: raw.choice,
|
|
72
|
+
probabilities: { [raw.choice]: raw.probability },
|
|
73
|
+
};
|
|
74
|
+
else if (q.type === "boolean" && typeof raw?.probability === "number")
|
|
75
|
+
answer = { type: "boolean", probability: raw.probability };
|
|
76
|
+
else
|
|
77
|
+
throw new ProviderError(`${provider} decide: the answer did not match the question`);
|
|
78
|
+
return {
|
|
79
|
+
answer,
|
|
80
|
+
decisionSource: "structured-output",
|
|
81
|
+
...requestIdOf(headerId !== undefined ? result.response.headers?.[headerId] : undefined, result.response.id),
|
|
82
|
+
};
|
|
83
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { AnimateRequest, GenerationProvider, ImageResult, VisionResult, Billing, LimitReading, ModelRequest, ModelResult, RigRequest, ProviderJobs } from "./provider.ts";
|
|
2
|
+
/** Tripo's fixed endpoint; settings never move it. */
|
|
3
|
+
export declare const TRIPO_BASE_URL = "https://api.tripo3d.ai/v2/openapi";
|
|
4
|
+
/**
|
|
5
|
+
* The Tripo image-to-3D adapter: model generation, rigging and animation retargeting. A call's
|
|
6
|
+
* cost is the task's reported credits × `usdPerCredit` from settings; without a rate it is unset
|
|
7
|
+
* and the route's estimate stands.
|
|
8
|
+
*/
|
|
9
|
+
export declare class TripoProvider implements GenerationProvider {
|
|
10
|
+
#private;
|
|
11
|
+
readonly billing: Billing;
|
|
12
|
+
constructor(options: {
|
|
13
|
+
apiKey: string | undefined;
|
|
14
|
+
keyEnv?: string;
|
|
15
|
+
/** USD per Tripo credit, from settings (`providers.<id>.usdPerCredit`). */
|
|
16
|
+
usdPerCredit?: number;
|
|
17
|
+
billing?: Omit<Billing, "hosts" | "readLimit" | "callCost">;
|
|
18
|
+
/** Tests only: a loopback fixture. Settings never set it. */
|
|
19
|
+
baseUrl?: string;
|
|
20
|
+
fetch?: typeof fetch;
|
|
21
|
+
sleep?: (ms: number) => Promise<void>;
|
|
22
|
+
pollIntervalMs?: number;
|
|
23
|
+
timeoutMs?: number;
|
|
24
|
+
});
|
|
25
|
+
generateImage(): Promise<ImageResult>;
|
|
26
|
+
analyzeImages(): Promise<VisionResult>;
|
|
27
|
+
/** The account's credit balance; spends nothing. */
|
|
28
|
+
balance(): Promise<number>;
|
|
29
|
+
/** The balance as a limit reading: credits, and USD when settings give `usdPerCredit`. */
|
|
30
|
+
limitReading(): Promise<LimitReading>;
|
|
31
|
+
/**
|
|
32
|
+
* One task's cost in USD by its task ID (the journaled request ID); spends nothing. Undefined
|
|
33
|
+
* while the task is queued or running or reports no credits yet; null when no `usdPerCredit`
|
|
34
|
+
* prices it, a task that ended without a credit count, or a task ID Tripo rejects (it answered
|
|
35
|
+
* with an error code other than an auth, rate or server failure). A transport failure, or an
|
|
36
|
+
* auth, rate or server refusal, is thrown: it says nothing about this one task.
|
|
37
|
+
*/
|
|
38
|
+
callCost(taskId: string): Promise<number | null | undefined>;
|
|
39
|
+
/**
|
|
40
|
+
* Tripo's calls as jobs: submit a task, read its status, fetch its result. Tripo takes no
|
|
41
|
+
* idempotency key and cannot look a task up by one, and a task cannot be cancelled, so none of
|
|
42
|
+
* those are declared.
|
|
43
|
+
*/
|
|
44
|
+
readonly jobs: ProviderJobs;
|
|
45
|
+
generateModel(request: ModelRequest): Promise<ModelResult>;
|
|
46
|
+
rigModel(request: RigRequest): Promise<ModelResult>;
|
|
47
|
+
animateModel(request: AnimateRequest): Promise<ModelResult>;
|
|
48
|
+
}
|