@call-me-sensei/toonlab 0.3.0 → 0.4.19
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/README.md +549 -184
- package/agents/README.md +59 -0
- package/agents/references/anime-art-direction.md +24 -0
- package/agents/references/asset-sourcing-policy.md +23 -0
- package/agents/references/custom-gap-report.md +16 -0
- package/agents/references/geology-playbook.md +118 -0
- package/agents/references/mcp-asset-discovery.md +104 -0
- package/agents/references/runtime-entry-points.md +174 -0
- package/agents/references/style-bundles.md +71 -0
- package/agents/skills/claude/asset-sourcing/SKILL.md +275 -0
- package/agents/skills/claude/environment/SKILL.md +59 -0
- package/agents/skills/claude/game-dev/SKILL.md +100 -0
- package/agents/skills/claude/karst-cliff-construction/SKILL.md +258 -0
- package/agents/skills/claude/outdoor-world/SKILL.md +492 -0
- package/agents/skills/claude/outdoor-world/references/coastal-landform-formation.md +100 -0
- package/agents/skills/claude/post-processing/SKILL.md +44 -0
- package/agents/skills/claude/rock-ground-shaders/SKILL.md +118 -0
- package/agents/skills/claude/rockgen/SKILL.md +30 -0
- package/agents/skills/claude/scene-style-application/SKILL.md +74 -0
- package/agents/skills/claude/style-presets/SKILL.md +101 -0
- package/agents/skills/claude/toon-shading/SKILL.md +44 -0
- package/agents/skills/claude/vegetation-sky/SKILL.md +167 -0
- package/agents/skills/claude/visual-verification/SKILL.md +136 -0
- package/agents/skills/claude/water/SKILL.md +105 -0
- package/agents/skills/codex/asset-sourcing/SKILL.md +275 -0
- package/agents/skills/codex/environment/SKILL.md +59 -0
- package/agents/skills/codex/game-dev/SKILL.md +100 -0
- package/agents/skills/codex/karst-cliff-construction/SKILL.md +258 -0
- package/agents/skills/codex/outdoor-world/SKILL.md +492 -0
- package/agents/skills/codex/outdoor-world/references/coastal-landform-formation.md +100 -0
- package/agents/skills/codex/post-processing/SKILL.md +44 -0
- package/agents/skills/codex/rock-ground-shaders/SKILL.md +118 -0
- package/agents/skills/codex/rockgen/SKILL.md +30 -0
- package/agents/skills/codex/scene-style-application/SKILL.md +74 -0
- package/agents/skills/codex/style-presets/SKILL.md +101 -0
- package/agents/skills/codex/toon-shading/SKILL.md +44 -0
- package/agents/skills/codex/vegetation-sky/SKILL.md +167 -0
- package/agents/skills/codex/visual-verification/SKILL.md +136 -0
- package/agents/skills/codex/water/SKILL.md +105 -0
- package/cli/toonlab.mjs +52 -0
- package/compose.yaml +20 -0
- package/database/apply-sql.mjs +141 -0
- package/database/client.mjs +39 -0
- package/database/creation-tags.mjs +23 -0
- package/database/env.mjs +16 -0
- package/database/generation-service.mjs +314 -0
- package/database/migrations/0001_local_workspace.sql +120 -0
- package/database/migrations/0002_file_ownership.sql +11 -0
- package/database/migrations/0003_remove_autosaves_from_library.sql +7 -0
- package/database/migrations/0004_catalog_asset_packs.sql +39 -0
- package/database/migrations/0005_creation_tag_discovery.sql +1 -0
- package/database/migrations/0006_normalize_creation_tags.sql +28 -0
- package/database/providers.mjs +465 -0
- package/database/repository.mjs +625 -0
- package/database/seeds/catalog/0001_empty_official_catalog.sql +4 -0
- package/database/seeds/catalog/0002_2026-08.sql +19454 -0
- package/mcp/lab-management.mjs +629 -0
- package/mcp/public-catalog.mjs +168 -0
- package/mcp/server.mjs +1026 -63
- package/mcp/vite-plugin.mjs +443 -26
- package/mcp/workspace.mjs +26 -1
- package/package.json +312 -45
- package/scripts/generate-catalog-seed.mjs +297 -0
- package/scripts/setup-local.mjs +128 -0
- package/src/agents/index.js +7 -0
- package/src/agents/sceneStyleOperations.js +169 -0
- package/src/asset-policy/catalogLicenses.js +44 -0
- package/src/asset-policy/index.js +315 -0
- package/src/assetlib/assetRef.js +1 -1
- package/src/assetlib/galleryMaterialFamily.js +165 -0
- package/src/assetlib/index.js +6 -2
- package/src/assetlib/plateau.js +188 -0
- package/src/assetlib/plateauLandmarks.js +144 -0
- package/src/assetlib/plateauViewer.js +348 -0
- package/src/assetlib/sources.js +16 -2
- package/src/catalog/manifest.js +11 -1
- package/src/catalog/officialCatalog.js +4 -0
- package/src/catalog/officialCatalogAssetRuntime.js +313 -0
- package/src/catalog/officialCatalogLod.js +150 -0
- package/src/catalog/officialCatalogPlacement.js +228 -0
- package/src/catalog/officialCatalogProvider.js +334 -0
- package/src/character/animationRetarget.js +1082 -0
- package/src/character/characterRuntime.js +376 -0
- package/src/character/groundStabilizer.js +137 -0
- package/src/character/index.js +8 -0
- package/src/character/locomotionActions.js +74 -0
- package/src/character/locomotionStateMachine.js +241 -0
- package/src/character/mannequinAsset.js +15 -0
- package/src/character/mannequinAssetUrl.browser.js +4 -0
- package/src/character/mannequinAssetUrl.node.js +3 -0
- package/src/character/modelLoader.js +92 -12
- package/src/character/walkableCharacterRuntime.js +284 -0
- package/src/character/waterInteractionController.js +217 -0
- package/src/cloud/ambientSkyBaker.js +248 -0
- package/src/cloud/cloudLighting.js +1114 -0
- package/src/cloud/cloudParams.js +819 -0
- package/src/cloud/cloudReprojection.js +563 -0
- package/src/cloud/cloudStyle.js +780 -0
- package/src/cloud/cloudStyleSnapshots.js +387 -0
- package/src/cloud/cloudVolume.js +1903 -0
- package/src/cloud/heroCloudRecipe.js +404 -0
- package/src/cloud/index.js +42 -0
- package/src/cloud/noise/baseShapeVolume.js +331 -0
- package/src/cloud/noise/cirrusMap.js +131 -0
- package/src/cloud/noise/curlNoise.js +289 -0
- package/src/cloud/noise/erosionVolume.js +188 -0
- package/src/cloud/noise/noiseVolume.js +202 -0
- package/src/cloud/noise/periodicNoise3.js +295 -0
- package/src/cloud/noise/weatherMap.js +470 -0
- package/src/cloud/paramSchema.js +458 -0
- package/src/collisionMetadata.js +320 -0
- package/src/core/systemStylePolicy.js +32 -0
- package/src/environment/dayCurves.js +146 -0
- package/src/environment/environmentGroundFieldPass.js +354 -0
- package/src/environment/environmentMaterialAdapter.js +114 -6
- package/src/environment/environmentPresets.js +396 -90
- package/src/environment/environmentRigs.js +17 -2
- package/src/environment/environmentSettings.js +37 -1
- package/src/environment/environmentShaderMaterials.js +37 -6
- package/src/environment/environmentState.js +133 -0
- package/src/environment/environmentSunShadowPass.js +357 -6
- package/src/environment/environmentTextureResolver.js +7 -0
- package/src/environment/index.js +51 -0
- package/src/environment/manufacturedMaterialContract.js +837 -0
- package/src/environment/manufacturedReflectionProvider.js +114 -0
- package/src/environment/scanAssetStylize.js +4 -4
- package/src/environment/surfaceMaterialModes.js +71 -0
- package/src/environment/toonLabEnvironmentMaterials.js +353 -0
- package/src/environment/toonLabMaterialPassCoupling.js +347 -0
- package/src/environment/toonLabNormalIntegration.js +171 -0
- package/src/environment/toonLabRockMaterialResolver.js +592 -0
- package/src/environment/toonLabSourceDefaultLit.js +444 -0
- package/src/environment/toonLabSourceLibrary.js +762 -0
- package/src/environment/toonLabSourceMaterials.js +3718 -0
- package/src/environment/toonLabSourceSubsurfaceLighting.js +415 -0
- package/src/environment/toonLabSourceTemporal.js +717 -0
- package/src/environment/toonLabSurfaceLighting.js +364 -0
- package/src/environment/toonLabTextureReadiness.js +105 -0
- package/src/environment/toonLabTreeMaterials.js +450 -0
- package/src/environment/transparentMaterialProfile.js +87 -0
- package/src/environment/urbanPropMaterial.js +2874 -0
- package/src/ground-shader/groundPrintLayer.js +375 -0
- package/src/ground-shader/groundShaderMaterial.js +851 -0
- package/src/ground-shader/groundShaderSettings.js +468 -0
- package/src/ground-shader/index.js +3 -0
- package/src/index.js +52 -22
- package/src/lighting/callMeSenseiLightingContract.js +163 -0
- package/src/lighting/index.js +14 -7
- package/src/lighting/lightingCapabilities.js +2 -2
- package/src/lighting/lightingPresets.js +6 -3
- package/src/lighting/lightingStyle.js +41 -6
- package/src/lighting/lightingSystem.js +140 -1
- package/src/lighting/{unrealExport.js → toonLabExport.js} +40 -41
- package/src/post/postProcessing.js +71 -12
- package/src/react/index.js +66 -0
- package/src/renderer/index.js +9 -0
- package/src/renderer/rendererConfiguration.js +250 -0
- package/src/rock-shader/index.js +3 -0
- package/src/rock-shader/rockMaterial.js +1843 -0
- package/src/rock-shader/rockShaderRuntime.js +494 -0
- package/src/rock-shader/rockShaderSettings.js +869 -0
- package/src/rockgen/export/glbExport.js +104 -14
- package/src/rockgen/index.js +4 -3
- package/src/rockgen/lod/index.js +6 -0
- package/src/rockgen/lod/rockLodMetrics.js +168 -0
- package/src/rockgen/lod/rockLodPlanner.js +372 -0
- package/src/rockgen/lod/rockLodPolicy.js +235 -0
- package/src/rockgen/lod/rockLodRuntime.js +124 -0
- package/src/rockgen/lod/rockLodSimplifier.js +173 -0
- package/src/rockgen/lod/rockLodValidation.js +113 -0
- package/src/rockgen/mesh/meshAttributes.js +17 -0
- package/src/rockgen/mesh/meshDocument.js +6 -0
- package/src/rockgen/rockDocument.js +352 -9
- package/src/rockgen/rockgenPresets.js +114 -13
- package/src/rockgen/rockgenSettings.js +62 -11
- package/src/runtime/index.js +14 -0
- package/src/runtime/sceneCollisionRuntime.js +317 -0
- package/src/runtime/sceneSurfaceRuntime.js +451 -0
- package/src/runtime/sceneUpdateScheduler.js +203 -0
- package/src/shaders-tsl/anime.js +9 -2
- package/src/shaders-tsl/chunks/environment-ground-field.js +174 -0
- package/src/shaders-tsl/chunks/environment-state.js +79 -0
- package/src/shaders-tsl/chunks/environment-sun-shadow.js +99 -32
- package/src/shaders-tsl/chunks/normalized-hue.js +41 -0
- package/src/shaders-tsl/chunks/pass-depth-color.js +4 -2
- package/src/shaders-tsl/chunks/scene-depth-color-pass.js +273 -0
- package/src/shaders-tsl/chunks/vegetation-style.js +116 -8
- package/src/shaders-tsl/chunks/water-color.js +19 -5
- package/src/shaders-tsl/chunks/water-shore-state.js +8 -1
- package/src/shaders-tsl/chunks/world-noise.js +30 -0
- package/src/shaders-tsl/environment.js +123 -17
- package/src/shaders-tsl/flower.js +51 -8
- package/src/shaders-tsl/grass.js +194 -29
- package/src/shaders-tsl/post-composite.js +83 -2
- package/src/shaders-tsl/tree-leaf.js +107 -16
- package/src/shaders-tsl/water-breaker.js +18 -4
- package/src/shaders-tsl/water.js +43 -3
- package/src/shaders-tsl/woody-surface.js +59 -7
- package/src/sky/atmosphereDome.js +193 -0
- package/src/sky/atmosphereParams.js +396 -0
- package/src/sky/atmosphereScattering.js +593 -0
- package/src/sky/atmosphereSky.js +371 -0
- package/src/sky/cloudShadow.js +355 -0
- package/src/sky/godRays.js +257 -0
- package/src/sky/index.js +55 -1
- package/src/sky/nightSky.js +1190 -0
- package/src/sky/renderLayers.js +120 -0
- package/src/sky/skyColor.js +582 -0
- package/src/sky/skyDayCycle.js +244 -0
- package/src/sky/skyParams.js +661 -0
- package/src/sky/skyPresets.js +772 -0
- package/src/sky/skyQualityTiers.js +383 -0
- package/src/sky/skyShaderSettings.js +699 -0
- package/src/sky/skyStyleSnapshots.js +211 -0
- package/src/sky/skySystem.js +1438 -0
- package/src/sky/skyTimeKeyframes.js +361 -0
- package/src/sky/stylizedSky.js +405 -116
- package/src/sky/sunDriver.js +499 -0
- package/src/sky/timeOfDay.js +335 -0
- package/src/styles/animeGameProfile.js +44 -0
- package/src/styles/index.js +134 -0
- package/src/styles/manufacturedStyleLabeling.js +204 -0
- package/src/styles/sceneLayerDocuments.js +185 -0
- package/src/styles/sceneLookComposition.js +156 -0
- package/src/styles/sceneQualityApplication.js +152 -0
- package/src/styles/sceneQualityProfiles.js +268 -0
- package/src/styles/sceneStyleAudit.js +512 -0
- package/src/styles/sceneStyleRuntime.js +876 -0
- package/src/styles/styleAdapters.js +166 -0
- package/src/styles/styleApplication.js +369 -0
- package/src/styles/styleBundle.js +444 -91
- package/src/styles/styleBundleProvider.js +83 -0
- package/src/styles/styleDomains.js +21 -0
- package/src/styles/styleInspector.js +262 -0
- package/src/styles/styleMaterialContract.js +375 -0
- package/src/styles/styleMetadata.js +73 -0
- package/src/styles/styleTargetDiscovery.js +162 -0
- package/src/styles/styleTargetLabels.js +206 -0
- package/src/styles/styleTargetMaterialCoverage.js +137 -0
- package/src/styles/styleTransaction.js +272 -0
- package/src/texgen/textureGenerators.js +21 -5
- package/src/toon/toonSettings.js +4 -0
- package/src/vegetation/branchTree.js +302 -0
- package/src/vegetation/callMeSenseiGrass.js +183 -0
- package/src/vegetation/compiledTree.js +506 -0
- package/src/vegetation/contactShadowField.js +107 -0
- package/src/vegetation/flowerSpecies.js +10 -2
- package/src/vegetation/grass.js +13 -0
- package/src/vegetation/grassClump.js +1179 -0
- package/src/vegetation/importedVegetationMaterial.js +183 -0
- package/src/vegetation/index.js +15 -1
- package/src/vegetation/legacyTreePresets.js +120 -0
- package/src/vegetation/scatter.js +322 -3
- package/src/vegetation/stylizedBush.js +14 -0
- package/src/vegetation/stylizedFlower.js +31 -0
- package/src/vegetation/stylizedFlowers.js +59 -7
- package/src/vegetation/stylizedForest.js +455 -147
- package/src/vegetation/stylizedGrass.js +188 -24
- package/src/vegetation/stylizedTree.js +378 -46
- package/src/vegetation/stylizedTreeFoliage.js +889 -38
- package/src/vegetation/stylizedUnderstory.js +230 -0
- package/src/vegetation/treeExport.js +262 -47
- package/src/vegetation/treeSurfaceTextures.js +337 -0
- package/src/vegetation/vegetationShaders.js +617 -28
- package/src/version.js +3 -0
- package/src/water/water.js +2 -0
- package/src/water/waterBreakerSystem.js +2 -0
- package/src/water/waterCurrentField.js +1 -0
- package/src/water/waterMaterial.js +3 -0
- package/src/water/waterRain.js +2 -0
- package/src/water/waterScenePasses.js +170 -7
- package/src/water/waterSettings.js +235 -43
- package/src/water/waterShoreMaterial.js +16 -2
- package/src/water/waterShoreStateField.js +1 -1
- package/src/water/waterSplashSystem.js +2 -0
- package/src/water/waterStageSettings.js +60 -0
- package/src/water/waterSurface.js +144 -4
- package/src/water/waterUnderwaterAtmosphere.js +288 -0
- package/src/water/waterVegetation.js +20 -4
- package/src/worldCollision.js +64 -9
- package/types/agents/index.d.ts +1 -0
- package/types/agents/sceneStyleOperations.d.ts +484 -0
- package/types/asset-policy/catalogLicenses.d.ts +5 -0
- package/types/asset-policy/index.d.ts +18 -0
- package/types/assetlib/ambientcg.d.ts +81 -0
- package/types/assetlib/assetRef.d.ts +26 -0
- package/types/assetlib/galleryMaterialFamily.d.ts +13 -0
- package/types/assetlib/importedEntry.d.ts +18 -0
- package/types/assetlib/index.d.ts +16 -0
- package/types/assetlib/kaykit.d.ts +112 -0
- package/types/assetlib/kaykitStaticIndex.d.ts +38 -0
- package/types/assetlib/loadImported.d.ts +54 -0
- package/types/assetlib/opensource3d.d.ts +55 -0
- package/types/assetlib/plateau.d.ts +67 -0
- package/types/assetlib/plateauLandmarks.d.ts +238 -0
- package/types/assetlib/plateauViewer.d.ts +3 -0
- package/types/assetlib/polyhaven.d.ts +90 -0
- package/types/assetlib/polypizza.d.ts +10 -0
- package/types/assetlib/smithsonian.d.ts +9 -0
- package/types/assetlib/sources.d.ts +22 -0
- package/types/assetlib/zip.d.ts +8 -0
- package/types/catalog/manifest.d.ts +26 -0
- package/types/catalog/officialCatalog.d.ts +4 -0
- package/types/catalog/officialCatalogAssetRuntime.d.ts +2 -0
- package/types/catalog/officialCatalogLod.d.ts +5 -0
- package/types/catalog/officialCatalogPlacement.d.ts +49 -0
- package/types/catalog/officialCatalogProvider.d.ts +7 -0
- package/types/character/animationRetarget.d.ts +20 -0
- package/types/character/characterRig.d.ts +28 -0
- package/types/character/characterRuntime.d.ts +4 -0
- package/types/character/freestyleSwimClip.d.ts +5 -0
- package/types/character/groundStabilizer.d.ts +55 -0
- package/types/character/index.d.ts +10 -0
- package/types/character/locomotionActions.d.ts +4 -0
- package/types/character/locomotionStateMachine.d.ts +62 -0
- package/types/character/mannequinAsset.d.ts +12 -0
- package/types/character/mannequinAssetUrl.node.d.ts +1 -0
- package/types/character/modelLoader.d.ts +7 -0
- package/types/character/walkableCharacterRuntime.d.ts +343 -0
- package/types/character/waterInteractionController.d.ts +114 -0
- package/types/cloud/ambientSkyBaker.d.ts +18 -0
- package/types/cloud/cloudLighting.d.ts +38 -0
- package/types/cloud/cloudParams.d.ts +18 -0
- package/types/cloud/cloudReprojection.d.ts +15 -0
- package/types/cloud/cloudStyle.d.ts +1380 -0
- package/types/cloud/cloudStyleSnapshots.d.ts +10 -0
- package/types/cloud/cloudVolume.d.ts +43 -0
- package/types/cloud/heroCloudRecipe.d.ts +167 -0
- package/types/cloud/index.d.ts +12 -0
- package/types/cloud/noise/baseShapeVolume.d.ts +86 -0
- package/types/cloud/noise/cirrusMap.d.ts +24 -0
- package/types/cloud/noise/curlNoise.d.ts +106 -0
- package/types/cloud/noise/erosionVolume.d.ts +58 -0
- package/types/cloud/noise/noiseVolume.d.ts +63 -0
- package/types/cloud/noise/periodicNoise3.d.ts +75 -0
- package/types/cloud/noise/weatherMap.d.ts +227 -0
- package/types/cloud/paramSchema.d.ts +142 -0
- package/types/collisionMetadata.d.ts +11 -0
- package/types/core/generation.d.ts +95 -0
- package/types/core/materialRoles.d.ts +102 -0
- package/types/core/presetDocuments.d.ts +25 -0
- package/types/core/systemStylePolicy.d.ts +4 -0
- package/types/environment/dayCurves.d.ts +47 -0
- package/types/environment/environmentAmbientProbe.d.ts +2 -0
- package/types/environment/environmentGroundFieldPass.d.ts +2 -0
- package/types/environment/environmentMaterialAdapter.d.ts +42 -0
- package/types/environment/environmentMaterialClassifier.d.ts +26 -0
- package/types/environment/environmentPlanarReflection.d.ts +3 -0
- package/types/environment/environmentPresets.d.ts +171 -0
- package/types/environment/environmentRigs.d.ts +13 -0
- package/types/environment/environmentSettings.d.ts +161 -0
- package/types/environment/environmentShaderMaterials.d.ts +14 -0
- package/types/environment/environmentState.d.ts +6 -0
- package/types/environment/environmentSunShadowPass.d.ts +2 -0
- package/types/environment/environmentTextureResolver.d.ts +30 -0
- package/types/environment/environmentTimeOfDay.d.ts +25 -0
- package/types/environment/environmentVertexAo.d.ts +18 -0
- package/types/environment/index.d.ts +27 -0
- package/types/environment/manufacturedMaterialContract.d.ts +129 -0
- package/types/environment/manufacturedReflectionProvider.d.ts +3 -0
- package/types/environment/scanAssetStylize.d.ts +43 -0
- package/types/environment/surfaceMaterialModes.d.ts +14 -0
- package/types/environment/toonLabEnvironmentMaterials.d.ts +139 -0
- package/types/environment/toonLabMaterialPassCoupling.d.ts +7 -0
- package/types/environment/toonLabNormalIntegration.d.ts +29 -0
- package/types/environment/toonLabRockMaterialResolver.d.ts +270 -0
- package/types/environment/toonLabSourceDefaultLit.d.ts +136 -0
- package/types/environment/toonLabSourceLibrary.d.ts +19 -0
- package/types/environment/toonLabSourceMaterials.d.ts +14 -0
- package/types/environment/toonLabSourceSubsurfaceLighting.d.ts +85 -0
- package/types/environment/toonLabSourceTemporal.d.ts +20 -0
- package/types/environment/toonLabSurfaceLighting.d.ts +136 -0
- package/types/environment/toonLabTextureReadiness.d.ts +8 -0
- package/types/environment/toonLabTreeMaterials.d.ts +7 -0
- package/types/environment/transparentMaterialProfile.d.ts +76 -0
- package/types/environment/urbanPropMaterial.d.ts +25 -0
- package/types/ground-shader/groundPrintLayer.d.ts +4 -0
- package/types/ground-shader/groundShaderMaterial.d.ts +11 -0
- package/types/ground-shader/groundShaderSettings.d.ts +90 -0
- package/types/ground-shader/index.d.ts +3 -0
- package/types/index.d.ts +1502 -0
- package/types/lighting/callMeSenseiLightingContract.d.ts +14 -0
- package/types/lighting/colorIntensity.d.ts +44 -0
- package/types/lighting/index.d.ts +12 -0
- package/types/lighting/lightDescriptors.d.ts +803 -0
- package/types/lighting/lightingCapabilities.d.ts +85 -0
- package/types/lighting/lightingDocuments.d.ts +140 -0
- package/types/lighting/lightingFixtures.d.ts +171 -0
- package/types/lighting/lightingGenerator.d.ts +403 -0
- package/types/lighting/lightingPresets.d.ts +264 -0
- package/types/lighting/lightingRuntime.d.ts +401 -0
- package/types/lighting/lightingStyle.d.ts +156 -0
- package/types/lighting/lightingSystem.d.ts +433 -0
- package/types/lighting/toonLabExport.d.ts +46 -0
- package/types/lighting/utils.d.ts +18 -0
- package/types/loaders/index.d.ts +1 -0
- package/types/post/index.d.ts +2 -0
- package/types/post/postGenerator.d.ts +282 -0
- package/types/post/postProcessing.d.ts +16 -0
- package/types/react/index.d.ts +1765 -0
- package/types/renderer/index.d.ts +1 -0
- package/types/renderer/rendererConfiguration.d.ts +8 -0
- package/types/rock-shader/index.d.ts +3 -0
- package/types/rock-shader/rockMaterial.d.ts +18 -0
- package/types/rock-shader/rockShaderRuntime.d.ts +8 -0
- package/types/rock-shader/rockShaderSettings.d.ts +170 -0
- package/types/rockgen/export/glbExport.d.ts +58 -0
- package/types/rockgen/heightfield/heightfieldErosion.d.ts +10 -0
- package/types/rockgen/heightfield/heightfieldPatch.d.ts +15 -0
- package/types/rockgen/heightfield/stylizedErosionSim.d.ts +41 -0
- package/types/rockgen/index.d.ts +11 -0
- package/types/rockgen/lod/index.d.ts +6 -0
- package/types/rockgen/lod/rockLodMetrics.d.ts +62 -0
- package/types/rockgen/lod/rockLodPlanner.d.ts +86 -0
- package/types/rockgen/lod/rockLodPolicy.d.ts +76 -0
- package/types/rockgen/lod/rockLodRuntime.d.ts +95 -0
- package/types/rockgen/lod/rockLodSimplifier.d.ts +15 -0
- package/types/rockgen/lod/rockLodValidation.d.ts +16 -0
- package/types/rockgen/mesh/meshAttributes.d.ts +32 -0
- package/types/rockgen/mesh/meshDocument.d.ts +40 -0
- package/types/rockgen/mesh/surfaceNets.d.ts +42 -0
- package/types/rockgen/noise/cellularNoise3.d.ts +24 -0
- package/types/rockgen/noise/prng.d.ts +16 -0
- package/types/rockgen/noise/simplexNoise3.d.ts +2 -0
- package/types/rockgen/noise/valueNoise3.d.ts +12 -0
- package/types/rockgen/rockDocument.d.ts +215 -0
- package/types/rockgen/rockHelpers.d.ts +2 -0
- package/types/rockgen/rockgenPresets.d.ts +10 -0
- package/types/rockgen/rockgenSettings.d.ts +531 -0
- package/types/rockgen/sdf/fieldCompiler.d.ts +20 -0
- package/types/rockgen/sdf/sculptEdits.d.ts +30 -0
- package/types/rockgen/sdf/sdfModifiers.d.ts +19 -0
- package/types/rockgen/sdf/sdfOps.d.ts +8 -0
- package/types/rockgen/sdf/sdfPrimitives.d.ts +22 -0
- package/types/runtime/index.d.ts +3 -0
- package/types/runtime/sceneCollisionRuntime.d.ts +94 -0
- package/types/runtime/sceneSurfaceRuntime.d.ts +90 -0
- package/types/runtime/sceneUpdateScheduler.d.ts +28 -0
- package/types/shaders-tsl/anime.d.ts +9 -0
- package/types/shaders-tsl/chunks/character-color.d.ts +6 -0
- package/types/shaders-tsl/chunks/character-highlights.d.ts +12 -0
- package/types/shaders-tsl/chunks/character-lighting.d.ts +20 -0
- package/types/shaders-tsl/chunks/character-material-maps.d.ts +18 -0
- package/types/shaders-tsl/chunks/character-roles.d.ts +21 -0
- package/types/shaders-tsl/chunks/character-scene-lights.d.ts +48 -0
- package/types/shaders-tsl/chunks/character-shadow-color.d.ts +5 -0
- package/types/shaders-tsl/chunks/character-skinning.d.ts +23 -0
- package/types/shaders-tsl/chunks/environment-color.d.ts +9 -0
- package/types/shaders-tsl/chunks/environment-debug.d.ts +24 -0
- package/types/shaders-tsl/chunks/environment-ground-field.d.ts +40 -0
- package/types/shaders-tsl/chunks/environment-lighting.d.ts +22 -0
- package/types/shaders-tsl/chunks/environment-state.d.ts +42 -0
- package/types/shaders-tsl/chunks/environment-sun-shadow.d.ts +19 -0
- package/types/shaders-tsl/chunks/foliage-fog.d.ts +21 -0
- package/types/shaders-tsl/chunks/normalized-hue.d.ts +1 -0
- package/types/shaders-tsl/chunks/pass-depth-color.d.ts +20 -0
- package/types/shaders-tsl/chunks/projected-water-caustics.d.ts +24 -0
- package/types/shaders-tsl/chunks/scene-depth-color-pass.d.ts +39 -0
- package/types/shaders-tsl/chunks/stylized-cloud-shadow.d.ts +9 -0
- package/types/shaders-tsl/chunks/vegetation-style.d.ts +60 -0
- package/types/shaders-tsl/chunks/water-color.d.ts +15 -0
- package/types/shaders-tsl/chunks/water-common.d.ts +9 -0
- package/types/shaders-tsl/chunks/water-foam.d.ts +8 -0
- package/types/shaders-tsl/chunks/water-lighting.d.ts +9 -0
- package/types/shaders-tsl/chunks/water-ripple.d.ts +8 -0
- package/types/shaders-tsl/chunks/water-shore-state.d.ts +7 -0
- package/types/shaders-tsl/chunks/water-waves.d.ts +18 -0
- package/types/shaders-tsl/chunks/world-noise.d.ts +4 -0
- package/types/shaders-tsl/environment-ao-overlay.d.ts +5 -0
- package/types/shaders-tsl/environment.d.ts +34 -0
- package/types/shaders-tsl/flower.d.ts +6 -0
- package/types/shaders-tsl/grass.d.ts +4 -0
- package/types/shaders-tsl/post-composite.d.ts +25 -0
- package/types/shaders-tsl/sky.d.ts +4 -0
- package/types/shaders-tsl/tree-leaf.d.ts +2 -0
- package/types/shaders-tsl/water-breaker.d.ts +15 -0
- package/types/shaders-tsl/water-kelp.d.ts +5 -0
- package/types/shaders-tsl/water-rain.d.ts +10 -0
- package/types/shaders-tsl/water-shore-state-simulation.d.ts +12 -0
- package/types/shaders-tsl/water-simulation.d.ts +5 -0
- package/types/shaders-tsl/water-splash.d.ts +12 -0
- package/types/shaders-tsl/water.d.ts +22 -0
- package/types/shaders-tsl/woody-surface.d.ts +3 -0
- package/types/sky/atmosphereDome.d.ts +2 -0
- package/types/sky/atmosphereParams.d.ts +185 -0
- package/types/sky/atmosphereScattering.d.ts +11 -0
- package/types/sky/atmosphereSky.d.ts +2 -0
- package/types/sky/cloudShadow.d.ts +68 -0
- package/types/sky/godRays.d.ts +5 -0
- package/types/sky/index.d.ts +18 -0
- package/types/sky/nightSky.d.ts +22 -0
- package/types/sky/renderLayers.d.ts +59 -0
- package/types/sky/sceneOverrideLayers.d.ts +10 -0
- package/types/sky/skyColor.d.ts +704 -0
- package/types/sky/skyDayCycle.d.ts +86 -0
- package/types/sky/skyParams.d.ts +3407 -0
- package/types/sky/skyPresets.d.ts +160 -0
- package/types/sky/skyQuality.d.ts +21 -0
- package/types/sky/skyQualityTiers.d.ts +223 -0
- package/types/sky/skyShaderSettings.d.ts +152 -0
- package/types/sky/skyStyleSnapshots.d.ts +11 -0
- package/types/sky/skySystem.d.ts +3 -0
- package/types/sky/skyTimeKeyframes.d.ts +230 -0
- package/types/sky/stylizedSky.d.ts +341 -0
- package/types/sky/sunDriver.d.ts +15 -0
- package/types/sky/timeOfDay.d.ts +145 -0
- package/types/styles/animeGameProfile.d.ts +27 -0
- package/types/styles/index.d.ts +17 -0
- package/types/styles/manufacturedStyleLabeling.d.ts +119 -0
- package/types/styles/sceneLayerDocuments.d.ts +145 -0
- package/types/styles/sceneLookComposition.d.ts +53 -0
- package/types/styles/sceneQualityApplication.d.ts +34 -0
- package/types/styles/sceneQualityProfiles.d.ts +13 -0
- package/types/styles/sceneStyleAudit.d.ts +80 -0
- package/types/styles/sceneStyleRuntime.d.ts +1782 -0
- package/types/styles/styleAdapters.d.ts +14 -0
- package/types/styles/styleApplication.d.ts +47 -0
- package/types/styles/styleBundle.d.ts +19 -0
- package/types/styles/styleBundleProvider.d.ts +44 -0
- package/types/styles/styleDomains.d.ts +18 -0
- package/types/styles/styleInspector.d.ts +59 -0
- package/types/styles/styleMaterialContract.d.ts +46 -0
- package/types/styles/styleMetadata.d.ts +11 -0
- package/types/styles/styleTargetDiscovery.d.ts +48 -0
- package/types/styles/styleTargetLabels.d.ts +32 -0
- package/types/styles/styleTargetMaterialCoverage.d.ts +20 -0
- package/types/styles/styleTransaction.d.ts +10 -0
- package/types/styles/styleTypes.d.ts +66 -0
- package/types/texgen/evaluateTexture.d.ts +40 -0
- package/types/texgen/index.d.ts +7 -0
- package/types/texgen/noise2.d.ts +46 -0
- package/types/texgen/textureAi.d.ts +6 -0
- package/types/texgen/textureGenerators.d.ts +261 -0
- package/types/texgen/texturePresets.d.ts +45 -0
- package/types/texgen/textureSettings.d.ts +121 -0
- package/types/texgen/textureThree.d.ts +13 -0
- package/types/toon/characterRenderPasses.d.ts +3 -0
- package/types/toon/index.d.ts +3 -0
- package/types/toon/settings/alphaSettings.d.ts +125 -0
- package/types/toon/settings/averageShadowSettings.d.ts +39 -0
- package/types/toon/settings/baseTextureSettings.d.ts +39 -0
- package/types/toon/settings/celShadeSettings.d.ts +37 -0
- package/types/toon/settings/contactShadowSettings.d.ts +30 -0
- package/types/toon/settings/eyeHighlightSettings.d.ts +55 -0
- package/types/toon/settings/faceLightingSettings.d.ts +32 -0
- package/types/toon/settings/furSettings.d.ts +23 -0
- package/types/toon/settings/glitterSettings.d.ts +43 -0
- package/types/toon/settings/hairHighlightSettings.d.ts +89 -0
- package/types/toon/settings/indirectLightSettings.d.ts +43 -0
- package/types/toon/settings/localLightSettings.d.ts +46 -0
- package/types/toon/settings/materialMapSettings.d.ts +86 -0
- package/types/toon/settings/outlineSettings.d.ts +125 -0
- package/types/toon/settings/perspectiveRemovalSettings.d.ts +14 -0
- package/types/toon/settings/rimLightSettings.d.ts +79 -0
- package/types/toon/settings/sceneShadowSettings.d.ts +32 -0
- package/types/toon/settings/selfShadowSettings.d.ts +44 -0
- package/types/toon/settings/shadowColorSettings.d.ts +77 -0
- package/types/toon/settings/skinToneSettings.d.ts +30 -0
- package/types/toon/settings/specularSettings.d.ts +96 -0
- package/types/toon/settings/stickerSettings.d.ts +40 -0
- package/types/toon/toonMaterialAdapter.d.ts +883 -0
- package/types/toon/toonSettings.d.ts +1182 -0
- package/types/vegetation/branchTree.d.ts +10 -0
- package/types/vegetation/callMeSenseiGrass.d.ts +8 -0
- package/types/vegetation/compiledTree.d.ts +75 -0
- package/types/vegetation/contactShadowField.d.ts +26 -0
- package/types/vegetation/flowerSpecies.d.ts +107 -0
- package/types/vegetation/grass.d.ts +4 -0
- package/types/vegetation/grassClump.d.ts +7 -0
- package/types/vegetation/grassPalettes.d.ts +29 -0
- package/types/vegetation/importedVegetationMaterial.d.ts +13 -0
- package/types/vegetation/index.d.ts +216 -0
- package/types/vegetation/legacyTreePresets.d.ts +22 -0
- package/types/vegetation/scatter.d.ts +12 -0
- package/types/vegetation/stylizedBush.d.ts +2 -0
- package/types/vegetation/stylizedFlower.d.ts +2 -0
- package/types/vegetation/stylizedFlowers.d.ts +8 -0
- package/types/vegetation/stylizedForest.d.ts +3 -0
- package/types/vegetation/stylizedGrass.d.ts +21 -0
- package/types/vegetation/stylizedTree.d.ts +19 -0
- package/types/vegetation/stylizedTreeFoliage.d.ts +18 -0
- package/types/vegetation/stylizedUnderstory.d.ts +50 -0
- package/types/vegetation/treeExport.d.ts +6 -0
- package/types/vegetation/treeSurfaceTextures.d.ts +72 -0
- package/types/vegetation/vegetationShaders.d.ts +74 -0
- package/types/version.d.ts +1 -0
- package/types/water/index.d.ts +1 -0
- package/types/water/sceneOverrideLayers.d.ts +16 -0
- package/types/water/water.d.ts +17 -0
- package/types/water/waterBreakerSystem.d.ts +46 -0
- package/types/water/waterCurrentField.d.ts +115 -0
- package/types/water/waterInteraction.d.ts +21 -0
- package/types/water/waterMaterial.d.ts +60 -0
- package/types/water/waterNearshorePhase.d.ts +5 -0
- package/types/water/waterRain.d.ts +17 -0
- package/types/water/waterRippleSimulation.d.ts +52 -0
- package/types/water/waterScenePasses.d.ts +70 -0
- package/types/water/waterSettings.d.ts +648 -0
- package/types/water/waterShoreMaterial.d.ts +3 -0
- package/types/water/waterShoreStateField.d.ts +2 -0
- package/types/water/waterSplashSystem.d.ts +2 -0
- package/types/water/waterStageSettings.d.ts +9 -0
- package/types/water/waterSurface.d.ts +2 -0
- package/types/water/waterUnderwaterAtmosphere.d.ts +103 -0
- package/types/water/waterVegetation.d.ts +16 -0
- package/types/worldCollision.d.ts +22 -0
- package/AGENTS.md +0 -254
- package/ATTRIBUTION.md +0 -78
- package/docs/characters.md +0 -144
- package/docs/debug-panel.md +0 -126
- package/docs/docs.css +0 -589
- package/docs/environment.md +0 -186
- package/docs/getting-started.md +0 -180
- package/docs/index.html +0 -14
- package/docs/lab-architecture.md +0 -100
- package/docs/lighting.md +0 -825
- package/docs/main.jsx +0 -739
- package/docs/mcp.md +0 -97
- package/docs/post-processing.md +0 -98
- package/docs/settings-reference.md +0 -1878
- package/docs/shader-constants.md +0 -77
- package/docs/sky.md +0 -182
- package/docs/style-labs.md +0 -309
- package/docs/texture-lab.md +0 -135
- package/docs/toon-shading.md +0 -183
- package/docs/tsl-conventions.md +0 -167
- package/docs/vegetation-sky.md +0 -275
- package/docs/water.md +0 -430
- package/docs/weather.md +0 -200
- package/docs/world-scale.md +0 -111
- package/mcp/style-lab-tools.mjs +0 -371
- package/src/ambientfx/INTEGRATION.md +0 -164
- package/src/ambientfx/ambientFxPresets.js +0 -83
- package/src/ambientfx/ambientFxSettings.js +0 -368
- package/src/ambientfx/emitters.js +0 -169
- package/src/ambientfx/index.js +0 -5
- package/src/ambientfx/particleBackbone.js +0 -493
- package/src/ambientfx/stylizedAmbientFx.js +0 -450
- package/src/biome/biomeGenerator.js +0 -385
- package/src/biome/biomeRuntime.js +0 -299
- package/src/biome/index.js +0 -2
- package/src/buildinggen/buildingAsset.js +0 -44
- package/src/buildinggen/buildingGrammar.js +0 -311
- package/src/buildinggen/buildingMesh.js +0 -451
- package/src/buildinggen/buildingPresets.js +0 -46
- package/src/buildinggen/buildingRecipe.js +0 -100
- package/src/buildinggen/buildingSettings.js +0 -238
- package/src/buildinggen/index.js +0 -6
- package/src/camera/cameraDirector.js +0 -157
- package/src/camera/cameraGenerator.js +0 -367
- package/src/camera/cameraRig.js +0 -570
- package/src/camera/cameraSettings.js +0 -236
- package/src/camera/index.js +0 -7
- package/src/catalog/builtinEntries.js +0 -245
- package/src/catalog/catalog.js +0 -210
- package/src/catalog/index.js +0 -3
- package/src/core/shaderBackend.js +0 -24
- package/src/debrisgen/debrisFields.js +0 -544
- package/src/debrisgen/debrisGenerator.js +0 -1929
- package/src/debrisgen/debrisPalettes.js +0 -71
- package/src/debrisgen/debrisPhysics.js +0 -198
- package/src/debrisgen/debrisPresets.js +0 -162
- package/src/debrisgen/debrisSettings.js +0 -333
- package/src/debrisgen/debrisTextures.js +0 -380
- package/src/debrisgen/index.js +0 -5
- package/src/debug/fieldValues.js +0 -95
- package/src/debug/index.js +0 -7
- package/src/debug/settingsPanel.js +0 -170
- package/src/fauna/INTEGRATION.md +0 -174
- package/src/fauna/boids.js +0 -861
- package/src/fauna/faunaBodies.js +0 -492
- package/src/fauna/faunaPresets.js +0 -52
- package/src/fauna/faunaSettings.js +0 -525
- package/src/fauna/index.js +0 -5
- package/src/fauna/stylizedFauna.js +0 -395
- package/src/game-feel/gameFeelGenerator.js +0 -402
- package/src/game-feel/gameFeelRuntime.js +0 -549
- package/src/game-feel/index.js +0 -2
- package/src/motion/index.js +0 -5
- package/src/motion/motionClip.js +0 -441
- package/src/motion/motionController.js +0 -628
- package/src/motion/motionDocuments.js +0 -225
- package/src/motion/motionGraph.js +0 -307
- package/src/motion/motionSettings.js +0 -222
- package/src/pathgen/index.js +0 -7
- package/src/pathgen/pathBridge.js +0 -232
- package/src/pathgen/pathPresets.js +0 -35
- package/src/pathgen/pathRibbon.js +0 -410
- package/src/pathgen/pathRouter.js +0 -380
- package/src/pathgen/pathSettings.js +0 -335
- package/src/pathgen/pathTextures.js +0 -123
- package/src/pathgen/stylizedPaths.js +0 -453
- package/src/propgen/generatorsWave1.js +0 -379
- package/src/propgen/generatorsWave2.js +0 -462
- package/src/propgen/index.js +0 -5
- package/src/propgen/propAsset.js +0 -323
- package/src/propgen/propParts.js +0 -170
- package/src/propgen/propPlacement.js +0 -459
- package/src/propgen/propPresets.js +0 -82
- package/src/propgen/propSettings.js +0 -395
- package/src/soundscape/index.js +0 -4
- package/src/soundscape/soundscapeGenerator.js +0 -179
- package/src/soundscape/soundscapeRuntime.js +0 -806
- package/src/soundscape/soundscapeSettings.js +0 -292
- package/src/stylizedTerrain.js +0 -631
- package/src/stylizedWorld.js +0 -903
- package/src/vegetation/treeRecipe.js +0 -647
- package/src/vfxgen/INTEGRATION.md +0 -145
- package/src/vfxgen/core/burstBackbone.js +0 -380
- package/src/vfxgen/core/projectileCore.js +0 -92
- package/src/vfxgen/core/spriteShapes.js +0 -98
- package/src/vfxgen/core/trailRibbon.js +0 -272
- package/src/vfxgen/core/vfxRandom.js +0 -29
- package/src/vfxgen/effects/emitHelpers.js +0 -37
- package/src/vfxgen/effects/magicEffects.js +0 -162
- package/src/vfxgen/effects/movementEffects.js +0 -87
- package/src/vfxgen/effects/weaponEffects.js +0 -118
- package/src/vfxgen/index.js +0 -18
- package/src/vfxgen/moves/moveController.js +0 -146
- package/src/vfxgen/moves/moveLibrary.js +0 -335
- package/src/vfxgen/vfxPresets.js +0 -98
- package/src/vfxgen/vfxSettings.js +0 -384
- package/src/vfxgen/vfxSystem.js +0 -449
- package/src/vfxgen/weapons/stylizedWeapons.js +0 -137
- package/src/villagegen/index.js +0 -4
- package/src/villagegen/stylizedVillage.js +0 -490
- package/src/villagegen/villageArchetypes.js +0 -160
- package/src/villagegen/villageNames.js +0 -40
- package/src/villagegen/villageSites.js +0 -105
- package/src/weather/index.js +0 -6
- package/src/weather/weatherPrecipitation.js +0 -221
- package/src/weather/weatherPresets.js +0 -258
- package/src/weather/weatherSettings.js +0 -269
- package/src/weather/weatherSystem.js +0 -871
- package/src/worldMinimap.js +0 -214
- package/src/worldPresets.js +0 -125
package/mcp/server.mjs
CHANGED
|
@@ -1,35 +1,87 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { readFileSync } from 'node:fs';
|
|
4
|
+
import { mkdir, readFile, writeFile } from 'node:fs/promises';
|
|
5
|
+
import { basename, dirname, extname, join } from 'node:path';
|
|
6
|
+
import { publicMcpCatalogEntries } from './public-catalog.mjs';
|
|
5
7
|
import {
|
|
6
8
|
fetchPolyhavenFiles,
|
|
7
9
|
fetchPolyhavenIndex,
|
|
8
|
-
filterAssetRefs,
|
|
9
10
|
resolvePolyhavenModelDownload,
|
|
10
11
|
resolvePolyhavenTextureDownload,
|
|
11
|
-
|
|
12
|
+
} from '../src/assetlib/polyhaven.js';
|
|
13
|
+
import { filterAssetRefs } from '../src/assetlib/assetRef.js';
|
|
14
|
+
import {
|
|
12
15
|
resolveAmbientcgDownload,
|
|
13
|
-
|
|
16
|
+
searchAmbientcg,
|
|
17
|
+
} from '../src/assetlib/ambientcg.js';
|
|
14
18
|
import {
|
|
15
|
-
getWorkspaceInfo,
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
+
getWorkspaceInfo as getLegacyWorkspaceInfo,
|
|
20
|
+
isPersistableStorageKey,
|
|
21
|
+
listLibraryEntries as listLegacyLibraryEntries,
|
|
22
|
+
listStorageDocuments as listLegacyStorageDocuments,
|
|
23
|
+
listWorkspaceFiles as listLegacyWorkspaceFiles,
|
|
19
24
|
matchesText,
|
|
20
|
-
|
|
25
|
+
deleteBrowserStorageValue as deleteLegacyBrowserStorageValue,
|
|
26
|
+
deleteLibraryEntry as deleteLegacyLibraryEntry,
|
|
27
|
+
deleteWorkspaceFile as deleteLegacyWorkspaceFile,
|
|
28
|
+
readBrowserStorage as readLegacyBrowserStorage,
|
|
29
|
+
readWorkspaceFile as readLegacyWorkspaceFile,
|
|
21
30
|
resolveWorkspacePath,
|
|
22
|
-
saveCreation,
|
|
23
|
-
|
|
31
|
+
saveCreation as saveLegacyCreation,
|
|
32
|
+
saveLibraryEntry as saveLegacyLibraryEntry,
|
|
33
|
+
setBrowserStorageValue as setLegacyBrowserStorageValue,
|
|
34
|
+
writeWorkspaceFile as writeLegacyWorkspaceFile,
|
|
24
35
|
} from './workspace.mjs';
|
|
25
36
|
import {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
37
|
+
databaseInfo,
|
|
38
|
+
deleteLabState,
|
|
39
|
+
deleteLibraryEntry as deleteDatabaseLibraryEntry,
|
|
40
|
+
getCatalogAsset as getDatabaseCatalogAsset,
|
|
41
|
+
listCatalogAssets as listDatabaseCatalogAssets,
|
|
42
|
+
listLibraryEntries as listDatabaseLibraryEntries,
|
|
43
|
+
listObjects,
|
|
44
|
+
normalizeCreationTags,
|
|
45
|
+
providerConfiguration,
|
|
46
|
+
readLabState,
|
|
47
|
+
readObject,
|
|
48
|
+
saveLibraryEntry as saveDatabaseLibraryEntry,
|
|
49
|
+
saveCreationDocument,
|
|
50
|
+
saveObject,
|
|
51
|
+
setLabState,
|
|
52
|
+
} from '../database/repository.mjs';
|
|
53
|
+
import {
|
|
54
|
+
getManagedGeneration,
|
|
55
|
+
listManagedGenerations,
|
|
56
|
+
saveManagedGeneration,
|
|
57
|
+
startManagedGeneration,
|
|
58
|
+
} from '../database/generation-service.mjs';
|
|
59
|
+
import {
|
|
60
|
+
LIVE_LAB_IDS,
|
|
61
|
+
applyLabDocumentOperation,
|
|
62
|
+
createLabDocument,
|
|
63
|
+
getLabFeatures,
|
|
64
|
+
listLiveLabs,
|
|
65
|
+
} from './lab-management.mjs';
|
|
66
|
+
import {
|
|
67
|
+
ASSET_POLICY_MODES,
|
|
68
|
+
ASSET_SOURCE_CLASSES,
|
|
69
|
+
createAssetGapRecord,
|
|
70
|
+
evaluateAssetCandidate,
|
|
71
|
+
renderAssetGapReport,
|
|
72
|
+
validateAssetSourcingPolicy,
|
|
73
|
+
} from '../src/asset-policy/index.js';
|
|
74
|
+
import {
|
|
75
|
+
CALL_ME_SENSEI_STYLE_BUNDLE,
|
|
76
|
+
STYLE_DOMAIN_SLOT_ROUTES,
|
|
77
|
+
TOONLAB_ANIME_GAME_PROFILE,
|
|
78
|
+
} from '../src/styles/index.js';
|
|
79
|
+
import { runSceneStyleOperation } from '../src/agents/index.js';
|
|
30
80
|
|
|
31
81
|
const SERVER_NAME = 'toonlab-oss';
|
|
32
|
-
const SERVER_VERSION =
|
|
82
|
+
const SERVER_VERSION = JSON.parse(
|
|
83
|
+
readFileSync(new URL('../package.json', import.meta.url), 'utf8'),
|
|
84
|
+
).version;
|
|
33
85
|
const LATEST_PROTOCOL_VERSION = '2025-11-25';
|
|
34
86
|
const SUPPORTED_PROTOCOL_VERSIONS = new Set([
|
|
35
87
|
LATEST_PROTOCOL_VERSION,
|
|
@@ -51,6 +103,120 @@ function parseArguments(argv) {
|
|
|
51
103
|
}
|
|
52
104
|
|
|
53
105
|
const { workspace } = parseArguments(process.argv.slice(2));
|
|
106
|
+
const legacyWorkspace = process.env.TOONLAB_LEGACY_WORKSPACE === '1';
|
|
107
|
+
|
|
108
|
+
async function getWorkspaceInfo() {
|
|
109
|
+
if (legacyWorkspace) return getLegacyWorkspaceInfo(workspace);
|
|
110
|
+
return {
|
|
111
|
+
database: await databaseInfo(),
|
|
112
|
+
mode: 'postgres',
|
|
113
|
+
path: workspace,
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
async function listLibraryEntries() {
|
|
118
|
+
if (legacyWorkspace) return listLegacyLibraryEntries(workspace);
|
|
119
|
+
return listDatabaseLibraryEntries();
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
async function listStorageDocuments() {
|
|
123
|
+
if (legacyWorkspace) return listLegacyStorageDocuments(workspace);
|
|
124
|
+
const entries = await readLabStateEntries();
|
|
125
|
+
const documents = [];
|
|
126
|
+
for (const [key, raw] of Object.entries(entries)) {
|
|
127
|
+
let parsed;
|
|
128
|
+
try { parsed = JSON.parse(raw); } catch { continue; }
|
|
129
|
+
const values = Array.isArray(parsed) ? parsed : [parsed];
|
|
130
|
+
values.forEach((document, index) => {
|
|
131
|
+
if (!document || typeof document !== 'object') return;
|
|
132
|
+
documents.push({
|
|
133
|
+
cluster: key.match(/^toonlab\.([a-z0-9-]+)/i)?.[1] ?? 'lab',
|
|
134
|
+
document,
|
|
135
|
+
id: `state:${key}:${document.id ?? document.presetId ?? index}`,
|
|
136
|
+
key,
|
|
137
|
+
kind: Array.isArray(parsed) ? 'preset' : 'document',
|
|
138
|
+
label: String(document.label ?? document.name ?? document.id ?? `Document ${index + 1}`),
|
|
139
|
+
source: 'workspace-storage',
|
|
140
|
+
});
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
return documents;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
async function readLabStateEntries() {
|
|
147
|
+
if (legacyWorkspace) return (await readLegacyBrowserStorage(workspace)).entries;
|
|
148
|
+
const entries = await readLabState();
|
|
149
|
+
return Object.fromEntries(
|
|
150
|
+
Object.entries(entries).filter(([key, value]) => isPersistableStorageKey(key) && typeof value === 'string'),
|
|
151
|
+
);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
async function setLabStateEntry(key, value) {
|
|
155
|
+
if (legacyWorkspace) return setLegacyBrowserStorageValue(workspace, key, value);
|
|
156
|
+
await setLabState(key, value);
|
|
157
|
+
return readLabState();
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
async function deleteLabStateEntry(key) {
|
|
161
|
+
if (legacyWorkspace) return deleteLegacyBrowserStorageValue(workspace, key);
|
|
162
|
+
await deleteLabState(key);
|
|
163
|
+
return readLabState();
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
async function saveLibraryEntry(entry) {
|
|
167
|
+
if (legacyWorkspace) return saveLegacyLibraryEntry(workspace, entry);
|
|
168
|
+
return saveDatabaseLibraryEntry(entry);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
async function deleteLibraryEntry(asset, type = null) {
|
|
172
|
+
if (legacyWorkspace) return deleteLegacyLibraryEntry(workspace, asset.id);
|
|
173
|
+
return deleteDatabaseLibraryEntry({
|
|
174
|
+
creationId: asset._local?.creationId,
|
|
175
|
+
docKey: asset.id,
|
|
176
|
+
type: type ?? asset.type,
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
async function deleteWorkspaceFile(relativePath) {
|
|
181
|
+
if (!legacyWorkspace) throw new Error('Database-backed workspace objects are not editable creations.');
|
|
182
|
+
return deleteLegacyWorkspaceFile(workspace, relativePath);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
async function listWorkspaceFiles() {
|
|
186
|
+
if (legacyWorkspace) return listLegacyWorkspaceFiles(workspace);
|
|
187
|
+
return listObjects(workspace);
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
async function readWorkspaceFile(_workspace, relativePath) {
|
|
191
|
+
if (legacyWorkspace) return readLegacyWorkspaceFile(workspace, relativePath);
|
|
192
|
+
return readObject(workspace, relativePath);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
async function saveCreation(_workspace, options) {
|
|
196
|
+
if (legacyWorkspace) return saveLegacyCreation(workspace, options);
|
|
197
|
+
return saveCreationDocument(options);
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
const MIME_BY_EXTENSION = {
|
|
201
|
+
'.bin': 'application/octet-stream',
|
|
202
|
+
'.glb': 'model/gltf-binary',
|
|
203
|
+
'.gltf': 'model/gltf+json',
|
|
204
|
+
'.jpeg': 'image/jpeg',
|
|
205
|
+
'.jpg': 'image/jpeg',
|
|
206
|
+
'.json': 'application/json',
|
|
207
|
+
'.png': 'image/png',
|
|
208
|
+
'.webp': 'image/webp',
|
|
209
|
+
'.zip': 'application/zip',
|
|
210
|
+
};
|
|
211
|
+
|
|
212
|
+
async function writeWorkspaceFile(_workspace, relativePath, data) {
|
|
213
|
+
if (legacyWorkspace) return writeLegacyWorkspaceFile(workspace, relativePath, data);
|
|
214
|
+
const bytes = typeof data === 'string' ? Buffer.from(data) : data;
|
|
215
|
+
return saveObject(workspace, bytes, {
|
|
216
|
+
contentType: MIME_BY_EXTENSION[extname(relativePath).toLowerCase()] ?? 'application/octet-stream',
|
|
217
|
+
name: basename(relativePath),
|
|
218
|
+
});
|
|
219
|
+
}
|
|
54
220
|
|
|
55
221
|
function jsonContent(value) {
|
|
56
222
|
return {
|
|
@@ -84,16 +250,68 @@ function withSeed(recipe, seed) {
|
|
|
84
250
|
return next;
|
|
85
251
|
}
|
|
86
252
|
|
|
253
|
+
const SOURCE_CLASS_BY_SOURCE = Object.freeze({
|
|
254
|
+
builtin: 'procedural',
|
|
255
|
+
library: 'toonlab-library',
|
|
256
|
+
official: 'toonlab-library',
|
|
257
|
+
workspace: 'project-library',
|
|
258
|
+
'workspace-storage': 'project-library',
|
|
259
|
+
});
|
|
260
|
+
|
|
261
|
+
function sourceClassFor(entry) {
|
|
262
|
+
return entry.sourceClass
|
|
263
|
+
?? SOURCE_CLASS_BY_SOURCE[entry.source]
|
|
264
|
+
?? 'project-library';
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
function animeStyleSupport(entry) {
|
|
268
|
+
const tags = normalizeCreationTags(entry.tags);
|
|
269
|
+
const explicit = entry.animeStyleSupport ?? entry.supportLevel;
|
|
270
|
+
if (explicit) return explicit;
|
|
271
|
+
if (tags.some((tag) => ['anime', 'cel-shaded', 'toon', 'stylized'].includes(tag))) {
|
|
272
|
+
return 'reviewed-candidate';
|
|
273
|
+
}
|
|
274
|
+
return 'needs-in-scene-review';
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
function normalizeDiscovery(entry, summary, { domain = '', policy = null } = {}) {
|
|
278
|
+
const sourceClass = sourceClassFor(entry);
|
|
279
|
+
return {
|
|
280
|
+
...summary,
|
|
281
|
+
animeStyleSupport: animeStyleSupport(entry),
|
|
282
|
+
assetKind: entry.kind ?? entry.assetKind ?? null,
|
|
283
|
+
license: entry.license ?? entry.attribution?.license ?? null,
|
|
284
|
+
policyDecision: evaluateAssetCandidate(policy, { domain, sourceClass }),
|
|
285
|
+
provenance: entry.provenance ?? entry.attribution ?? null,
|
|
286
|
+
sourceClass,
|
|
287
|
+
};
|
|
288
|
+
}
|
|
289
|
+
|
|
87
290
|
function summarizeCatalogEntry(entry) {
|
|
291
|
+
const metadata = entry.metadata && typeof entry.metadata === 'object' && !Array.isArray(entry.metadata)
|
|
292
|
+
? entry.metadata
|
|
293
|
+
: {};
|
|
294
|
+
const searchableMetadata = Object.fromEntries([
|
|
295
|
+
'catalog',
|
|
296
|
+
'dimensionsMeters',
|
|
297
|
+
'familyId',
|
|
298
|
+
'profileId',
|
|
299
|
+
'taxonomy',
|
|
300
|
+
'releaseWave',
|
|
301
|
+
'revision',
|
|
302
|
+
'recipeHash',
|
|
303
|
+
].flatMap((key) => metadata[key] == null ? [] : [[key, metadata[key]]]));
|
|
88
304
|
return {
|
|
89
305
|
cluster: entry.cluster,
|
|
90
306
|
description: entry.description ?? null,
|
|
91
307
|
id: entry.id,
|
|
92
308
|
kind: entry.kind,
|
|
93
309
|
label: entry.label,
|
|
310
|
+
managementId: entry._local?.creationId ?? entry.id,
|
|
94
311
|
source: entry.source ?? 'builtin',
|
|
95
312
|
tags: entry.tags ?? [],
|
|
96
313
|
thumbnail: entry.thumbnail ?? null,
|
|
314
|
+
...(Object.keys(searchableMetadata).length > 0 ? { metadata: searchableMetadata } : {}),
|
|
97
315
|
};
|
|
98
316
|
}
|
|
99
317
|
|
|
@@ -105,59 +323,152 @@ function summarizeStorageDocument(entry) {
|
|
|
105
323
|
label: entry.label,
|
|
106
324
|
source: entry.source,
|
|
107
325
|
storageKey: entry.key,
|
|
326
|
+
tags: Array.isArray(entry.document?.tags) ? entry.document.tags : [],
|
|
108
327
|
};
|
|
109
328
|
}
|
|
110
329
|
|
|
111
|
-
|
|
112
|
-
const
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
330
|
+
function normalizeOfficialCatalogAsset(asset) {
|
|
331
|
+
const metadata = asset.metadata && typeof asset.metadata === 'object' && !Array.isArray(asset.metadata)
|
|
332
|
+
? asset.metadata
|
|
333
|
+
: {};
|
|
334
|
+
return {
|
|
335
|
+
catalogProvider: asset.source,
|
|
336
|
+
cluster: metadata.catalog ?? 'official',
|
|
337
|
+
description: asset.description ?? null,
|
|
338
|
+
downloadUrl: asset.download_url ?? null,
|
|
339
|
+
files: asset.files ?? [],
|
|
340
|
+
id: asset.id,
|
|
341
|
+
kind: asset.kind,
|
|
342
|
+
label: asset.name,
|
|
343
|
+
license: asset.license,
|
|
344
|
+
metadata,
|
|
345
|
+
provenance: {
|
|
346
|
+
attribution: asset.attribution ?? null,
|
|
347
|
+
provider: asset.source,
|
|
348
|
+
sourceId: asset.source_id ?? null,
|
|
349
|
+
sourceUrl: asset.source_url ?? null,
|
|
350
|
+
},
|
|
351
|
+
source: 'official',
|
|
352
|
+
sourceClass: 'toonlab-library',
|
|
353
|
+
tags: asset.tags ?? [],
|
|
354
|
+
thumbnail: asset.thumbnail_url ?? null,
|
|
355
|
+
};
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
function withOfficialLabStart(asset) {
|
|
359
|
+
const catalog = String(asset.metadata?.catalog ?? asset.cluster ?? '').toLowerCase();
|
|
360
|
+
const isRock = catalog === 'rock' || catalog === 'rocks' || Boolean(asset.metadata?.variation?.id);
|
|
361
|
+
return isRock
|
|
362
|
+
? { ...asset, labStart: createLabDocument('rock', { source: asset }) }
|
|
363
|
+
: asset;
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
async function listOfficialCatalogEntries() {
|
|
367
|
+
if (legacyWorkspace) return [];
|
|
368
|
+
const entries = [];
|
|
369
|
+
let offset = 0;
|
|
370
|
+
let total = 1;
|
|
371
|
+
while (offset < total) {
|
|
372
|
+
const page = await listDatabaseCatalogAssets({ limit: 100, offset });
|
|
373
|
+
entries.push(...page.items.map(normalizeOfficialCatalogAsset));
|
|
374
|
+
total = page.total;
|
|
375
|
+
offset += page.items.length;
|
|
376
|
+
if (page.items.length === 0) break;
|
|
377
|
+
}
|
|
378
|
+
return entries;
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
async function allAssets(source = null) {
|
|
382
|
+
const includes = (candidate) => source == null || source === candidate;
|
|
383
|
+
const [library, official, storage, files] = await Promise.all([
|
|
384
|
+
includes('library') ? listLibraryEntries(workspace) : [],
|
|
385
|
+
includes('official') ? listOfficialCatalogEntries() : [],
|
|
386
|
+
includes('workspace-storage') ? listStorageDocuments(workspace) : [],
|
|
387
|
+
includes('workspace') ? listWorkspaceFiles(workspace) : [],
|
|
116
388
|
]);
|
|
117
389
|
return [
|
|
118
|
-
...
|
|
390
|
+
...(includes('builtin') ? publicMcpCatalogEntries().map((entry) => ({ ...entry, source: 'builtin' })) : []),
|
|
119
391
|
...library.map((entry) => ({ ...entry, source: 'library' })),
|
|
392
|
+
...official,
|
|
120
393
|
...storage,
|
|
121
394
|
...files,
|
|
122
395
|
];
|
|
123
396
|
}
|
|
124
397
|
|
|
125
398
|
async function findAsset(id, source = null) {
|
|
126
|
-
const assets = await allAssets();
|
|
127
|
-
return assets.find((entry) =>
|
|
399
|
+
const assets = await allAssets(source);
|
|
400
|
+
return assets.find((entry) => (
|
|
401
|
+
(entry.id === id || entry._local?.creationId === id)
|
|
402
|
+
&& (!source || entry.source === source)
|
|
403
|
+
)) ?? null;
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
async function findEditableAsset(id, type = null) {
|
|
407
|
+
const library = (await listLibraryEntries(workspace)).filter((entry) => (
|
|
408
|
+
(entry.id === id || entry._local?.creationId === id)
|
|
409
|
+
&& (!type || entry.type === type)
|
|
410
|
+
));
|
|
411
|
+
if (library.length > 1) {
|
|
412
|
+
throw new Error(
|
|
413
|
+
`Creation document key "${id}" is ambiguous across types (${library.map((entry) => entry.type).join(', ')}). Use the managementId returned by list_my_creations, or pass type.`,
|
|
414
|
+
);
|
|
415
|
+
}
|
|
416
|
+
if (library.length === 1) return { ...library[0], source: 'library' };
|
|
417
|
+
const files = await listWorkspaceFiles(workspace);
|
|
418
|
+
return files.find((entry) => entry.id === id) ?? null;
|
|
128
419
|
}
|
|
129
420
|
|
|
130
421
|
function matchesTags(entry, tags) {
|
|
131
422
|
if (!Array.isArray(tags) || tags.length === 0) return true;
|
|
132
|
-
const actual = new Set((entry.tags
|
|
133
|
-
return tags.every((tag) => actual.has(
|
|
423
|
+
const actual = new Set(normalizeCreationTags(entry.tags));
|
|
424
|
+
return normalizeCreationTags(tags).every((tag) => actual.has(tag));
|
|
134
425
|
}
|
|
135
426
|
|
|
136
427
|
async function searchAssets(args) {
|
|
137
|
-
const assets = await allAssets();
|
|
138
|
-
const
|
|
428
|
+
const assets = await allAssets(args.source ?? null);
|
|
429
|
+
const matched = assets.filter((entry) => {
|
|
139
430
|
if (args.source && entry.source !== args.source) return false;
|
|
140
431
|
if (args.cluster && entry.cluster !== args.cluster) return false;
|
|
141
432
|
if (args.kind && entry.kind !== args.kind) return false;
|
|
142
433
|
if (!matchesTags(entry, args.tags)) return false;
|
|
143
434
|
return matchesText(entry, args.query);
|
|
144
|
-
})
|
|
435
|
+
});
|
|
436
|
+
const offset = Math.max(0, Math.floor(Number(args.offset) || 0));
|
|
437
|
+
const limit = limitValue(args.limit);
|
|
438
|
+
const results = matched.slice(offset, offset + limit);
|
|
145
439
|
return {
|
|
146
440
|
count: results.length,
|
|
441
|
+
total: matched.length,
|
|
442
|
+
offset,
|
|
443
|
+
limit,
|
|
444
|
+
nextOffset: offset + limit < matched.length ? offset + limit : null,
|
|
147
445
|
items: results.map((entry) => {
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
446
|
+
const summary = entry.source === 'workspace'
|
|
447
|
+
? entry
|
|
448
|
+
: entry.source === 'workspace-storage'
|
|
449
|
+
? summarizeStorageDocument(entry)
|
|
450
|
+
: summarizeCatalogEntry(entry);
|
|
451
|
+
return normalizeDiscovery(entry, summary, args);
|
|
151
452
|
}),
|
|
152
453
|
};
|
|
153
454
|
}
|
|
154
455
|
|
|
155
456
|
async function getAsset(args) {
|
|
457
|
+
if (args.source === 'official' && !legacyWorkspace) {
|
|
458
|
+
const complete = await getDatabaseCatalogAsset(args.id);
|
|
459
|
+
if (!complete) throw new Error(`Official asset "${args.id}" was not found.`);
|
|
460
|
+
const normalized = withOfficialLabStart(normalizeOfficialCatalogAsset(complete));
|
|
461
|
+
return normalizeDiscovery(normalized, normalized, args);
|
|
462
|
+
}
|
|
156
463
|
const asset = await findAsset(args.id, args.source);
|
|
157
464
|
if (!asset) throw new Error(`Asset "${args.id}" was not found.`);
|
|
158
|
-
if (asset.source === '
|
|
159
|
-
|
|
160
|
-
|
|
465
|
+
if (asset.source === 'official' && !legacyWorkspace) {
|
|
466
|
+
const complete = await getDatabaseCatalogAsset(asset.id);
|
|
467
|
+
if (!complete) throw new Error(`Official asset "${args.id}" was not found.`);
|
|
468
|
+
const normalized = withOfficialLabStart(normalizeOfficialCatalogAsset(complete));
|
|
469
|
+
return normalizeDiscovery(normalized, normalized, args);
|
|
470
|
+
}
|
|
471
|
+
return normalizeDiscovery(asset, asset, args);
|
|
161
472
|
}
|
|
162
473
|
|
|
163
474
|
async function listMyCreations(args) {
|
|
@@ -167,16 +478,33 @@ async function listMyCreations(args) {
|
|
|
167
478
|
listWorkspaceFiles(workspace, { roots: ['assets', 'creations', 'exports', 'imports', 'presets'] }),
|
|
168
479
|
]);
|
|
169
480
|
const query = args.query ?? null;
|
|
170
|
-
const
|
|
481
|
+
const matched = [
|
|
171
482
|
...library.map((entry) => summarizeCatalogEntry({ ...entry, source: 'library' })),
|
|
172
483
|
...storage.map(summarizeStorageDocument),
|
|
173
484
|
...files,
|
|
174
|
-
].filter((entry) =>
|
|
175
|
-
|
|
485
|
+
].filter((entry) => (
|
|
486
|
+
matchesText(entry, query)
|
|
487
|
+
&& matchesTags(entry, args.tags)
|
|
488
|
+
&& (!args.kind || entry.kind === args.kind || entry.type === args.kind)
|
|
489
|
+
));
|
|
490
|
+
const offset = Math.max(0, Math.floor(Number(args.offset) || 0));
|
|
491
|
+
const limit = limitValue(args.limit, 50, 200);
|
|
492
|
+
const items = matched.slice(offset, offset + limit);
|
|
493
|
+
return {
|
|
494
|
+
count: items.length,
|
|
495
|
+
items,
|
|
496
|
+
limit,
|
|
497
|
+
nextOffset: offset + limit < matched.length ? offset + limit : null,
|
|
498
|
+
offset,
|
|
499
|
+
total: matched.length,
|
|
500
|
+
workspace,
|
|
501
|
+
};
|
|
176
502
|
}
|
|
177
503
|
|
|
178
504
|
async function getMyCreation(args) {
|
|
179
|
-
const
|
|
505
|
+
const id = String(args.id ?? '').trim();
|
|
506
|
+
const asset = await findEditableAsset(id, args.type ?? null)
|
|
507
|
+
?? await findAsset(id, 'workspace-storage');
|
|
180
508
|
if (!asset || asset.source === 'builtin') throw new Error(`Workspace creation "${args.id}" was not found.`);
|
|
181
509
|
if (asset.source !== 'workspace') return asset;
|
|
182
510
|
const file = await readWorkspaceFile(workspace, asset.relativePath);
|
|
@@ -189,9 +517,192 @@ async function getMyCreation(args) {
|
|
|
189
517
|
return { ...asset, base64: file.data.toString('base64'), encoding: 'base64' };
|
|
190
518
|
}
|
|
191
519
|
|
|
520
|
+
function mergePatch(target, patch) {
|
|
521
|
+
if (!patch || typeof patch !== 'object' || Array.isArray(patch)) return clone(patch);
|
|
522
|
+
const next = target && typeof target === 'object' && !Array.isArray(target) ? clone(target) : {};
|
|
523
|
+
for (const [key, value] of Object.entries(patch)) {
|
|
524
|
+
if (value === null) delete next[key];
|
|
525
|
+
else next[key] = mergePatch(next[key], value);
|
|
526
|
+
}
|
|
527
|
+
return next;
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
async function updateCreation(args) {
|
|
531
|
+
const id = String(args.id ?? '').trim();
|
|
532
|
+
const asset = await findEditableAsset(id, args.type ?? null);
|
|
533
|
+
if (!asset) throw new Error(`Editable creation "${id}" was not found.`);
|
|
534
|
+
const hasDocument = args.document && typeof args.document === 'object' && !Array.isArray(args.document);
|
|
535
|
+
const hasPatch = args.patch && typeof args.patch === 'object' && !Array.isArray(args.patch);
|
|
536
|
+
if (hasDocument && hasPatch) throw new Error('Pass document or patch, not both.');
|
|
537
|
+
if (args.document !== undefined && !hasDocument) throw new Error('document must be a JSON object.');
|
|
538
|
+
if (args.patch !== undefined && !hasPatch) throw new Error('patch must be a JSON object.');
|
|
539
|
+
const hasMetadata = args.label !== undefined || args.description !== undefined || args.tags !== undefined;
|
|
540
|
+
if (!hasDocument && !hasPatch && !hasMetadata) throw new Error('No creation changes were provided.');
|
|
541
|
+
if (args.label !== undefined && !String(args.label).trim()) throw new Error('label cannot be empty.');
|
|
542
|
+
if (args.tags !== undefined && !Array.isArray(args.tags)) throw new Error('tags must be an array.');
|
|
543
|
+
if (asset.source === 'workspace') {
|
|
544
|
+
if (!asset.relativePath?.startsWith('creations/')) {
|
|
545
|
+
throw new Error('Only files below .toonlab/creations are editable through update_creation.');
|
|
546
|
+
}
|
|
547
|
+
const currentFile = await readWorkspaceFile(workspace, asset.relativePath);
|
|
548
|
+
let currentDocument;
|
|
549
|
+
try { currentDocument = JSON.parse(currentFile.data.toString('utf8')); } catch {
|
|
550
|
+
throw new Error('Workspace creation is not a JSON document; replace it with save_creation instead.');
|
|
551
|
+
}
|
|
552
|
+
const document = hasDocument
|
|
553
|
+
? clone(args.document)
|
|
554
|
+
: hasPatch ? mergePatch(currentDocument, args.patch) : clone(currentDocument);
|
|
555
|
+
if (args.label !== undefined && document && typeof document === 'object') {
|
|
556
|
+
document.label = String(args.label).trim().slice(0, 120);
|
|
557
|
+
}
|
|
558
|
+
if (args.description !== undefined && document && typeof document === 'object') {
|
|
559
|
+
document.description = args.description === null ? null : String(args.description).slice(0, 2000);
|
|
560
|
+
}
|
|
561
|
+
if (args.tags !== undefined && document && typeof document === 'object') {
|
|
562
|
+
document.tags = normalizeCreationTags(args.tags);
|
|
563
|
+
}
|
|
564
|
+
const file = await writeWorkspaceFile(workspace, asset.relativePath, `${JSON.stringify(document, null, 2)}\n`);
|
|
565
|
+
return { creation: { ...file, document } };
|
|
566
|
+
}
|
|
567
|
+
const documentField = asset.document && typeof asset.document === 'object' && !Array.isArray(asset.document)
|
|
568
|
+
? 'document'
|
|
569
|
+
: asset.recipe && typeof asset.recipe === 'object' && !Array.isArray(asset.recipe)
|
|
570
|
+
? 'recipe'
|
|
571
|
+
: null;
|
|
572
|
+
const currentDocument = documentField ? asset[documentField] : asset;
|
|
573
|
+
const document = hasDocument
|
|
574
|
+
? clone(args.document)
|
|
575
|
+
: hasPatch ? mergePatch(currentDocument, args.patch) : clone(currentDocument);
|
|
576
|
+
const label = String(args.label ?? asset.label ?? document.label ?? document.name ?? id).trim().slice(0, 120);
|
|
577
|
+
if (!label) throw new Error('label cannot be empty.');
|
|
578
|
+
const next = documentField
|
|
579
|
+
? { ...asset, [documentField]: document, label }
|
|
580
|
+
: { ...document, id: asset.id, label, type: asset.type ?? document.type ?? asset.kind };
|
|
581
|
+
if (args.description !== undefined) next.description = String(args.description ?? '').slice(0, 2000);
|
|
582
|
+
if (args.tags !== undefined) next.tags = normalizeCreationTags(args.tags);
|
|
583
|
+
delete next._local;
|
|
584
|
+
delete next.source;
|
|
585
|
+
delete next.sourceClass;
|
|
586
|
+
delete next.policyDecision;
|
|
587
|
+
return { creation: await saveLibraryEntry(next) };
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
async function createLabDocumentTool(args) {
|
|
591
|
+
let source = args.source;
|
|
592
|
+
if (args.source_id) {
|
|
593
|
+
source = await getAsset({ id: args.source_id, source: args.source_kind ?? 'official' });
|
|
594
|
+
}
|
|
595
|
+
return createLabDocument(args.lab, {
|
|
596
|
+
docKey: args.doc_key,
|
|
597
|
+
label: args.label,
|
|
598
|
+
preset: args.preset,
|
|
599
|
+
seed: args.seed,
|
|
600
|
+
source,
|
|
601
|
+
strength: args.strength,
|
|
602
|
+
style: args.style,
|
|
603
|
+
variation: args.variation,
|
|
604
|
+
});
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
async function mutateLabCreation(args) {
|
|
608
|
+
const id = String(args.id ?? '').trim();
|
|
609
|
+
const asset = await findEditableAsset(id, args.type ?? null);
|
|
610
|
+
if (!asset) throw new Error(`Editable creation "${id}" was not found.`);
|
|
611
|
+
const expectedType = getLabFeatures(args.lab).documentContract.creationType;
|
|
612
|
+
if (asset.type && asset.type !== expectedType && asset.kind !== expectedType) {
|
|
613
|
+
throw new Error(`The ${args.lab} lab requires creation type "${expectedType}", not "${asset.type ?? asset.kind}".`);
|
|
614
|
+
}
|
|
615
|
+
let document;
|
|
616
|
+
if (asset.source === 'workspace') {
|
|
617
|
+
if (!asset.relativePath?.startsWith('creations/')) {
|
|
618
|
+
throw new Error('Only JSON files below .toonlab/creations support semantic Lab mutation.');
|
|
619
|
+
}
|
|
620
|
+
const currentFile = await readWorkspaceFile(workspace, asset.relativePath);
|
|
621
|
+
try { document = JSON.parse(currentFile.data.toString('utf8')); } catch {
|
|
622
|
+
throw new Error('Workspace creation is not a JSON document.');
|
|
623
|
+
}
|
|
624
|
+
} else {
|
|
625
|
+
document = asset.document && typeof asset.document === 'object'
|
|
626
|
+
? asset.document
|
|
627
|
+
: asset.recipe && typeof asset.recipe === 'object'
|
|
628
|
+
? asset.recipe
|
|
629
|
+
: asset;
|
|
630
|
+
}
|
|
631
|
+
const next = applyLabDocumentOperation(args.lab, document, args.operation, args);
|
|
632
|
+
return updateCreation({ id, type: args.type ?? expectedType, document: next });
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
async function removeCreation(args) {
|
|
636
|
+
if (args.confirm !== true) throw new Error('confirm must be true to delete a creation.');
|
|
637
|
+
const id = String(args.id ?? '').trim();
|
|
638
|
+
const asset = await findEditableAsset(id, args.type ?? null);
|
|
639
|
+
if (!asset) throw new Error(`Editable creation "${id}" was not found.`);
|
|
640
|
+
if (asset.source === 'workspace') {
|
|
641
|
+
if (!asset.relativePath?.startsWith('creations/')) {
|
|
642
|
+
throw new Error('Only files below .toonlab/creations can be deleted as creations.');
|
|
643
|
+
}
|
|
644
|
+
return { deleted: await deleteWorkspaceFile(asset.relativePath), id };
|
|
645
|
+
}
|
|
646
|
+
return { deleted: await deleteLibraryEntry(asset, args.type ?? null), id };
|
|
647
|
+
}
|
|
648
|
+
|
|
649
|
+
function validLabStateKey(value) {
|
|
650
|
+
const key = String(value ?? '').trim();
|
|
651
|
+
if (!/^(?:toonlab|threejs-toon-shader)\.[a-z0-9._-]{1,240}$/i.test(key) || !isPersistableStorageKey(key)) {
|
|
652
|
+
throw new Error('Lab-state keys must be a non-secret ToonLab browser key using the "toonlab." or "threejs-toon-shader." prefix.');
|
|
653
|
+
}
|
|
654
|
+
return key;
|
|
655
|
+
}
|
|
656
|
+
|
|
657
|
+
function parseLabStateValue(value) {
|
|
658
|
+
try { return JSON.parse(value); } catch { return value; }
|
|
659
|
+
}
|
|
660
|
+
|
|
661
|
+
async function listLabState(args) {
|
|
662
|
+
const entries = await readLabStateEntries();
|
|
663
|
+
const query = String(args.query ?? '').trim().toLowerCase();
|
|
664
|
+
const items = Object.entries(entries)
|
|
665
|
+
.filter(([key]) => isPersistableStorageKey(key))
|
|
666
|
+
.filter(([key]) => !query || key.toLowerCase().includes(query))
|
|
667
|
+
.map(([key, value]) => ({ key, value: parseLabStateValue(value) }));
|
|
668
|
+
return { count: items.length, items };
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
async function getLabState(args) {
|
|
672
|
+
const key = validLabStateKey(args.key);
|
|
673
|
+
const entries = await readLabStateEntries();
|
|
674
|
+
if (!(key in entries)) throw new Error(`Lab-state entry "${key}" was not found.`);
|
|
675
|
+
return { key, value: parseLabStateValue(entries[key]) };
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
async function putLabState(args) {
|
|
679
|
+
const key = validLabStateKey(args.key);
|
|
680
|
+
if (args.value === undefined) throw new Error('value is required.');
|
|
681
|
+
const serialized = typeof args.value === 'string' ? args.value : JSON.stringify(args.value);
|
|
682
|
+
if (Buffer.byteLength(serialized, 'utf8') > 4 * 1024 * 1024) {
|
|
683
|
+
throw new Error('Lab-state value exceeds the 4 MB limit.');
|
|
684
|
+
}
|
|
685
|
+
await setLabStateEntry(key, serialized);
|
|
686
|
+
return { key, value: parseLabStateValue(serialized) };
|
|
687
|
+
}
|
|
688
|
+
|
|
689
|
+
async function removeLabState(args) {
|
|
690
|
+
if (args.confirm !== true) throw new Error('confirm must be true to delete lab state.');
|
|
691
|
+
const key = validLabStateKey(args.key);
|
|
692
|
+
const entries = await readLabStateEntries();
|
|
693
|
+
if (!(key in entries)) return { deleted: false, key };
|
|
694
|
+
await deleteLabStateEntry(key);
|
|
695
|
+
return { deleted: true, key };
|
|
696
|
+
}
|
|
697
|
+
|
|
192
698
|
async function generateAsset(args) {
|
|
193
|
-
const entry =
|
|
699
|
+
const entry = publicMcpCatalogEntries().find((item) => item.id === args.catalog_id);
|
|
194
700
|
if (!entry) throw new Error(`Unknown built-in catalog asset "${args.catalog_id}".`);
|
|
701
|
+
const policyDecision = evaluateAssetCandidate(args.policy ?? null, {
|
|
702
|
+
domain: args.domain ?? entry.domain ?? entry.cluster ?? '',
|
|
703
|
+
sourceClass: 'procedural',
|
|
704
|
+
});
|
|
705
|
+
if (!policyDecision.allowed) throw new Error(policyDecision.reason);
|
|
195
706
|
const seed = Number.isFinite(Number(args.seed)) ? Number(args.seed) : Math.floor(Math.random() * 1_000_000);
|
|
196
707
|
const name = String(args.name ?? `${entry.label} ${seed}`);
|
|
197
708
|
const document = {
|
|
@@ -216,6 +727,7 @@ async function generateAsset(args) {
|
|
|
216
727
|
return {
|
|
217
728
|
document,
|
|
218
729
|
file,
|
|
730
|
+
policyDecision,
|
|
219
731
|
next: entry.cluster === 'water' || entry.cluster === 'sky' || entry.cluster === 'post' || entry.cluster === 'toon'
|
|
220
732
|
? 'Use the spawn snippet in your project; this is a settings preset.'
|
|
221
733
|
: 'Open the matching ToonLab lab to preview or export this recipe as GLB.',
|
|
@@ -234,6 +746,11 @@ function compactCc0Ref(ref) {
|
|
|
234
746
|
source: ref.source,
|
|
235
747
|
tags: ref.tags,
|
|
236
748
|
thumbnailUrl: ref.thumbnailUrl,
|
|
749
|
+
animeStyleSupport: 'needs-in-scene-review',
|
|
750
|
+
assetKind: ref.kind,
|
|
751
|
+
license: ref.attribution?.license ?? 'CC0',
|
|
752
|
+
provenance: ref.attribution ?? null,
|
|
753
|
+
sourceClass: 'external-cc0',
|
|
237
754
|
};
|
|
238
755
|
}
|
|
239
756
|
|
|
@@ -267,15 +784,37 @@ async function searchCc0Assets(args) {
|
|
|
267
784
|
const settled = await Promise.allSettled(searches);
|
|
268
785
|
const results = settled.flatMap((result) => result.status === 'fulfilled' ? result.value : []);
|
|
269
786
|
const errors = settled.flatMap((result) => result.status === 'rejected' ? [result.reason?.message ?? String(result.reason)] : []);
|
|
270
|
-
return {
|
|
787
|
+
return {
|
|
788
|
+
count: Math.min(results.length, limit),
|
|
789
|
+
errors,
|
|
790
|
+
items: results.slice(0, limit).map((ref) => ({
|
|
791
|
+
...compactCc0Ref(ref),
|
|
792
|
+
policyDecision: evaluateAssetCandidate(args.policy ?? null, {
|
|
793
|
+
domain: args.domain ?? '',
|
|
794
|
+
sourceClass: 'external-cc0',
|
|
795
|
+
}),
|
|
796
|
+
})),
|
|
797
|
+
};
|
|
271
798
|
}
|
|
272
799
|
|
|
273
|
-
async function getCc0AssetDetails(
|
|
800
|
+
async function getCc0AssetDetails(args) {
|
|
801
|
+
const {
|
|
802
|
+
domain = '',
|
|
803
|
+
id,
|
|
804
|
+
kind = 'model',
|
|
805
|
+
policy = null,
|
|
806
|
+
provider,
|
|
807
|
+
resolution = '1k',
|
|
808
|
+
} = args;
|
|
809
|
+
const policyDecision = evaluateAssetCandidate(policy, {
|
|
810
|
+
domain,
|
|
811
|
+
sourceClass: 'external-cc0',
|
|
812
|
+
});
|
|
274
813
|
if (provider === 'ambientcg') {
|
|
275
814
|
const [ref] = await searchAmbientcg({ id });
|
|
276
815
|
if (!ref) throw new Error(`ambientCG asset "${id}" was not found.`);
|
|
277
816
|
const download = resolveAmbientcgDownload(ref, { resolution: resolution.toUpperCase() });
|
|
278
|
-
return { download, ref: compactCc0Ref(ref) };
|
|
817
|
+
return { download, policyDecision, ref: compactCc0Ref(ref) };
|
|
279
818
|
}
|
|
280
819
|
if (provider === 'polyhaven') {
|
|
281
820
|
const refs = await fetchPolyhavenIndex({ type: polyhavenType(kind) });
|
|
@@ -287,7 +826,7 @@ async function getCc0AssetDetails({ id, kind = 'model', provider, resolution = '
|
|
|
287
826
|
: kind === 'texture'
|
|
288
827
|
? resolvePolyhavenTextureDownload(files, { resolution })
|
|
289
828
|
: null;
|
|
290
|
-
return { download, ref: compactCc0Ref(ref) };
|
|
829
|
+
return { download, policyDecision, ref: compactCc0Ref(ref) };
|
|
291
830
|
}
|
|
292
831
|
throw new Error('provider must be polyhaven or ambientcg.');
|
|
293
832
|
}
|
|
@@ -307,6 +846,11 @@ function filenameFromUrl(url, fallback) {
|
|
|
307
846
|
}
|
|
308
847
|
|
|
309
848
|
async function importCc0Asset(args) {
|
|
849
|
+
const policyDecision = evaluateAssetCandidate(args.policy ?? null, {
|
|
850
|
+
domain: args.domain ?? '',
|
|
851
|
+
sourceClass: 'external-cc0',
|
|
852
|
+
});
|
|
853
|
+
if (!policyDecision.allowed) throw new Error(policyDecision.reason);
|
|
310
854
|
const details = await getCc0AssetDetails(args);
|
|
311
855
|
if (!details.download) {
|
|
312
856
|
throw new Error('This asset kind does not yet expose a direct downloadable bundle. Use get_cc0_asset for its source page.');
|
|
@@ -332,10 +876,65 @@ async function importCc0Asset(args) {
|
|
|
332
876
|
importedAt: new Date().toISOString(),
|
|
333
877
|
...details,
|
|
334
878
|
}, null, 2)}\n`);
|
|
335
|
-
return { ...details, files: [...files, manifest], workspace };
|
|
879
|
+
return { ...details, files: [...files, manifest], policyDecision, workspace };
|
|
880
|
+
}
|
|
881
|
+
|
|
882
|
+
async function recordAssetGap(args) {
|
|
883
|
+
const record = createAssetGapRecord(args);
|
|
884
|
+
const reportsDirectory = join(workspace, 'reports');
|
|
885
|
+
const jsonPath = join(reportsDirectory, 'style-asset-gaps.json');
|
|
886
|
+
const projectDirectory = basename(workspace) === '.toonlab'
|
|
887
|
+
? dirname(workspace)
|
|
888
|
+
: workspace;
|
|
889
|
+
const markdownPath = join(projectDirectory, 'TOONLAB_ASSET_GAPS.md');
|
|
890
|
+
let records = [];
|
|
891
|
+
try {
|
|
892
|
+
const existing = JSON.parse(await readFile(jsonPath, 'utf8'));
|
|
893
|
+
records = Array.isArray(existing.records) ? existing.records : [];
|
|
894
|
+
} catch {
|
|
895
|
+
records = [];
|
|
896
|
+
}
|
|
897
|
+
const next = records.filter((entry) => entry.id !== record.id);
|
|
898
|
+
next.push(record);
|
|
899
|
+
next.sort((left, right) => left.id.localeCompare(right.id));
|
|
900
|
+
await mkdir(reportsDirectory, { recursive: true });
|
|
901
|
+
await writeFile(jsonPath, `${JSON.stringify({
|
|
902
|
+
records: next,
|
|
903
|
+
schema: 'toonlab/asset-gap-report',
|
|
904
|
+
version: 1,
|
|
905
|
+
}, null, 2)}\n`, 'utf8');
|
|
906
|
+
await writeFile(markdownPath, renderAssetGapReport(next), 'utf8');
|
|
907
|
+
return { jsonPath, markdownPath, record, total: next.length };
|
|
336
908
|
}
|
|
337
909
|
|
|
338
910
|
const TOOLS = [
|
|
911
|
+
...['inspect', 'audit', 'plan', 'apply', 'verify'].map((operation) => ({
|
|
912
|
+
annotations: {
|
|
913
|
+
destructiveHint: false,
|
|
914
|
+
idempotentHint: true,
|
|
915
|
+
readOnlyHint: operation !== 'apply',
|
|
916
|
+
},
|
|
917
|
+
description: `${operation[0].toUpperCase()}${operation.slice(1)} a portable ToonLab scene-style manifest with the same contract used by the toonlab CLI.`,
|
|
918
|
+
inputSchema: {
|
|
919
|
+
additionalProperties: false,
|
|
920
|
+
properties: {
|
|
921
|
+
bundle: { default: 'call-me-sensei', type: ['string', 'object'] },
|
|
922
|
+
manifest: { type: 'object' },
|
|
923
|
+
mode: { default: 'advisory', enum: ['strict', 'advisory'], type: 'string' },
|
|
924
|
+
},
|
|
925
|
+
required: ['manifest'],
|
|
926
|
+
type: 'object',
|
|
927
|
+
},
|
|
928
|
+
name: `${operation}_scene_style`,
|
|
929
|
+
title: `${operation[0].toUpperCase()}${operation.slice(1)} scene style`,
|
|
930
|
+
})),
|
|
931
|
+
{
|
|
932
|
+
annotations: { readOnlyHint: true },
|
|
933
|
+
description: 'Return ToonLab\'s anime-game art direction, canonical Call Me Sensei bundle, and explicit shader-routing table.',
|
|
934
|
+
inputSchema: { additionalProperties: false, properties: {}, type: 'object' },
|
|
935
|
+
name: 'get_anime_game_profile',
|
|
936
|
+
title: 'Get ToonLab anime-game profile',
|
|
937
|
+
},
|
|
339
938
|
{
|
|
340
939
|
annotations: { readOnlyHint: true },
|
|
341
940
|
description: 'Show the local .toonlab workspace path, migration status, and item counts.',
|
|
@@ -345,15 +944,61 @@ const TOOLS = [
|
|
|
345
944
|
},
|
|
346
945
|
{
|
|
347
946
|
annotations: { readOnlyHint: true },
|
|
348
|
-
description: '
|
|
947
|
+
description: 'List every public Beta Lab going live, its portable creation types, runtime package, management operations, and editable feature count.',
|
|
948
|
+
inputSchema: { additionalProperties: false, properties: {}, type: 'object' },
|
|
949
|
+
name: 'list_live_labs',
|
|
950
|
+
title: 'List live ToonLab labs',
|
|
951
|
+
},
|
|
952
|
+
{
|
|
953
|
+
annotations: { readOnlyHint: true },
|
|
954
|
+
description: 'Return the complete machine-readable feature/settings schema plus the portable document discriminator, version, identity paths, JSON envelope, and a valid starter document for one live lab.',
|
|
955
|
+
inputSchema: {
|
|
956
|
+
additionalProperties: false,
|
|
957
|
+
properties: { lab: { enum: LIVE_LAB_IDS, type: 'string' } },
|
|
958
|
+
required: ['lab'],
|
|
959
|
+
type: 'object',
|
|
960
|
+
},
|
|
961
|
+
name: 'get_lab_features',
|
|
962
|
+
title: 'Get all editable lab features',
|
|
963
|
+
},
|
|
964
|
+
{
|
|
965
|
+
annotations: { destructiveHint: false, idempotentHint: true, readOnlyHint: true },
|
|
966
|
+
description: 'Build a validated portable starter document for any live Lab. A Rock source_id returned by official asset search loads that GLB template as the editable starting mesh instead of generating unrelated geometry.',
|
|
967
|
+
inputSchema: {
|
|
968
|
+
additionalProperties: false,
|
|
969
|
+
properties: {
|
|
970
|
+
doc_key: { type: 'string' },
|
|
971
|
+
lab: { enum: LIVE_LAB_IDS, type: 'string' },
|
|
972
|
+
label: { type: 'string' },
|
|
973
|
+
preset: { type: 'string' },
|
|
974
|
+
seed: { type: 'integer' },
|
|
975
|
+
source: { type: 'object' },
|
|
976
|
+
source_id: { type: 'string' },
|
|
977
|
+
source_kind: { enum: ['official', 'library'], type: 'string' },
|
|
978
|
+
strength: { maximum: 1, minimum: 0, type: 'number' },
|
|
979
|
+
style: { type: 'string' },
|
|
980
|
+
variation: { minimum: 0, type: 'integer' },
|
|
981
|
+
},
|
|
982
|
+
required: ['lab'],
|
|
983
|
+
type: 'object',
|
|
984
|
+
},
|
|
985
|
+
name: 'create_lab_document',
|
|
986
|
+
title: 'Create a Lab starter document',
|
|
987
|
+
},
|
|
988
|
+
{
|
|
989
|
+
annotations: { readOnlyHint: true },
|
|
990
|
+
description: 'Search built-in procedural assets, the paginated complete official Gallery catalog, saved library entries, lab presets, and files on disk. Official rock summaries include compact dimensions and taxonomy metadata; follow nextOffset until null.',
|
|
349
991
|
inputSchema: {
|
|
350
992
|
additionalProperties: false,
|
|
351
993
|
properties: {
|
|
352
994
|
cluster: { type: 'string' },
|
|
995
|
+
domain: { type: 'string' },
|
|
353
996
|
kind: { type: 'string' },
|
|
354
997
|
limit: { maximum: 100, minimum: 1, type: 'integer' },
|
|
998
|
+
offset: { minimum: 0, type: 'integer' },
|
|
999
|
+
policy: { type: 'object' },
|
|
355
1000
|
query: { type: 'string' },
|
|
356
|
-
source: { enum: ['builtin', 'library', 'workspace', 'workspace-storage'], type: 'string' },
|
|
1001
|
+
source: { enum: ['builtin', 'official', 'library', 'workspace', 'workspace-storage'], type: 'string' },
|
|
357
1002
|
tags: { items: { type: 'string' }, type: 'array' },
|
|
358
1003
|
},
|
|
359
1004
|
type: 'object',
|
|
@@ -366,7 +1011,12 @@ const TOOLS = [
|
|
|
366
1011
|
description: 'Get a complete asset, recipe, preset, library entry, or workspace file descriptor by id.',
|
|
367
1012
|
inputSchema: {
|
|
368
1013
|
additionalProperties: false,
|
|
369
|
-
properties: {
|
|
1014
|
+
properties: {
|
|
1015
|
+
domain: { type: 'string' },
|
|
1016
|
+
id: { type: 'string' },
|
|
1017
|
+
policy: { type: 'object' },
|
|
1018
|
+
source: { type: 'string' },
|
|
1019
|
+
},
|
|
370
1020
|
required: ['id'],
|
|
371
1021
|
type: 'object',
|
|
372
1022
|
},
|
|
@@ -375,10 +1025,16 @@ const TOOLS = [
|
|
|
375
1025
|
},
|
|
376
1026
|
{
|
|
377
1027
|
annotations: { readOnlyHint: true },
|
|
378
|
-
description: '
|
|
1028
|
+
description: 'Search the developer\'s saved library, lab documents, presets, imports, and exports by text, exact tags, or kind. Paginate with nextOffset.',
|
|
379
1029
|
inputSchema: {
|
|
380
1030
|
additionalProperties: false,
|
|
381
|
-
properties: {
|
|
1031
|
+
properties: {
|
|
1032
|
+
kind: { type: 'string' },
|
|
1033
|
+
limit: { maximum: 200, minimum: 1, type: 'integer' },
|
|
1034
|
+
offset: { minimum: 0, type: 'integer' },
|
|
1035
|
+
query: { type: 'string' },
|
|
1036
|
+
tags: { items: { type: 'string' }, maxItems: 10, type: 'array' },
|
|
1037
|
+
},
|
|
382
1038
|
type: 'object',
|
|
383
1039
|
},
|
|
384
1040
|
name: 'list_my_creations',
|
|
@@ -386,8 +1042,13 @@ const TOOLS = [
|
|
|
386
1042
|
},
|
|
387
1043
|
{
|
|
388
1044
|
annotations: { readOnlyHint: true },
|
|
389
|
-
description: 'Read a saved creation or small workspace file. Binary files are returned as base64 and always include a direct absolute path.',
|
|
390
|
-
inputSchema: {
|
|
1045
|
+
description: 'Read a saved creation or small workspace file. Prefer the immutable managementId returned by list_my_creations; type disambiguates legacy document keys. Binary files are returned as base64 and always include a direct absolute path.',
|
|
1046
|
+
inputSchema: {
|
|
1047
|
+
additionalProperties: false,
|
|
1048
|
+
properties: { id: { type: 'string' }, type: { type: 'string' } },
|
|
1049
|
+
required: ['id'],
|
|
1050
|
+
type: 'object',
|
|
1051
|
+
},
|
|
391
1052
|
name: 'get_my_creation',
|
|
392
1053
|
title: 'Get my ToonLab creation',
|
|
393
1054
|
},
|
|
@@ -398,9 +1059,11 @@ const TOOLS = [
|
|
|
398
1059
|
additionalProperties: false,
|
|
399
1060
|
properties: {
|
|
400
1061
|
document: {},
|
|
1062
|
+
description: { type: ['string', 'null'] },
|
|
401
1063
|
filename: { type: 'string' },
|
|
402
1064
|
kind: { type: 'string' },
|
|
403
1065
|
name: { type: 'string' },
|
|
1066
|
+
tags: { items: { maxLength: 32, type: 'string' }, maxItems: 10, type: 'array' },
|
|
404
1067
|
},
|
|
405
1068
|
required: ['document', 'name'],
|
|
406
1069
|
type: 'object',
|
|
@@ -408,6 +1071,116 @@ const TOOLS = [
|
|
|
408
1071
|
name: 'save_creation',
|
|
409
1072
|
title: 'Save a ToonLab creation',
|
|
410
1073
|
},
|
|
1074
|
+
{
|
|
1075
|
+
annotations: { destructiveHint: false, idempotentHint: true },
|
|
1076
|
+
description: 'Replace or JSON-merge-patch any editable creation in the local OSS library. Local workspaces have no ownership boundary.',
|
|
1077
|
+
inputSchema: {
|
|
1078
|
+
additionalProperties: false,
|
|
1079
|
+
properties: {
|
|
1080
|
+
description: { type: ['string', 'null'] },
|
|
1081
|
+
document: { type: 'object' },
|
|
1082
|
+
id: { description: 'Immutable managementId from list_my_creations, or an unambiguous document key.', type: 'string' },
|
|
1083
|
+
label: { type: 'string' },
|
|
1084
|
+
patch: { description: 'RFC 7396 JSON merge patch applied to the portable document.', type: 'object' },
|
|
1085
|
+
tags: { items: { maxLength: 32, type: 'string' }, maxItems: 10, type: 'array' },
|
|
1086
|
+
type: { description: 'Creation type used to disambiguate a legacy document key.', type: 'string' },
|
|
1087
|
+
},
|
|
1088
|
+
required: ['id'],
|
|
1089
|
+
type: 'object',
|
|
1090
|
+
},
|
|
1091
|
+
name: 'update_creation',
|
|
1092
|
+
title: 'Update any local creation',
|
|
1093
|
+
},
|
|
1094
|
+
{
|
|
1095
|
+
annotations: { destructiveHint: false, idempotentHint: false },
|
|
1096
|
+
description: 'Apply one validated Lab operation to a saved portable creation. Supports set_feature for all 15 Labs and structural Rock operations advertised by get_lab_features.',
|
|
1097
|
+
inputSchema: {
|
|
1098
|
+
additionalProperties: false,
|
|
1099
|
+
properties: {
|
|
1100
|
+
edit: { type: 'object' },
|
|
1101
|
+
finish: { type: 'string' },
|
|
1102
|
+
id: { type: 'string' },
|
|
1103
|
+
lab: { enum: LIVE_LAB_IDS, type: 'string' },
|
|
1104
|
+
operation: { type: 'string' },
|
|
1105
|
+
path: { type: 'string' },
|
|
1106
|
+
piece: {},
|
|
1107
|
+
pieceId: { type: 'string' },
|
|
1108
|
+
pieceIndex: { minimum: 0, type: 'integer' },
|
|
1109
|
+
settings: { type: 'object' },
|
|
1110
|
+
source: { type: 'object' },
|
|
1111
|
+
toIndex: { minimum: 0, type: 'integer' },
|
|
1112
|
+
type: { type: 'string' },
|
|
1113
|
+
value: {},
|
|
1114
|
+
},
|
|
1115
|
+
required: ['id', 'lab', 'operation'],
|
|
1116
|
+
type: 'object',
|
|
1117
|
+
},
|
|
1118
|
+
name: 'mutate_lab_creation',
|
|
1119
|
+
title: 'Apply a semantic Lab edit',
|
|
1120
|
+
},
|
|
1121
|
+
{
|
|
1122
|
+
annotations: { destructiveHint: true, idempotentHint: true },
|
|
1123
|
+
description: 'Delete any editable creation from the local OSS library. Requires confirm=true.',
|
|
1124
|
+
inputSchema: {
|
|
1125
|
+
additionalProperties: false,
|
|
1126
|
+
properties: {
|
|
1127
|
+
confirm: { const: true, type: 'boolean' },
|
|
1128
|
+
id: { description: 'Immutable managementId from list_my_creations, or an unambiguous document key.', type: 'string' },
|
|
1129
|
+
type: { description: 'Creation type used to disambiguate a legacy document key.', type: 'string' },
|
|
1130
|
+
},
|
|
1131
|
+
required: ['id', 'confirm'],
|
|
1132
|
+
type: 'object',
|
|
1133
|
+
},
|
|
1134
|
+
name: 'delete_creation',
|
|
1135
|
+
title: 'Delete any local creation',
|
|
1136
|
+
},
|
|
1137
|
+
{
|
|
1138
|
+
annotations: { readOnlyHint: true },
|
|
1139
|
+
description: 'List raw persisted lab-state entries. This OSS-only surface covers drafts and lab collections that are not yet normalized creations.',
|
|
1140
|
+
inputSchema: {
|
|
1141
|
+
additionalProperties: false,
|
|
1142
|
+
properties: { query: { type: 'string' } },
|
|
1143
|
+
type: 'object',
|
|
1144
|
+
},
|
|
1145
|
+
name: 'list_lab_state',
|
|
1146
|
+
title: 'List local lab state',
|
|
1147
|
+
},
|
|
1148
|
+
{
|
|
1149
|
+
annotations: { readOnlyHint: true },
|
|
1150
|
+
description: 'Read one raw persisted ToonLab lab-state entry by its localStorage-compatible key.',
|
|
1151
|
+
inputSchema: {
|
|
1152
|
+
additionalProperties: false,
|
|
1153
|
+
properties: { key: { type: 'string' } },
|
|
1154
|
+
required: ['key'],
|
|
1155
|
+
type: 'object',
|
|
1156
|
+
},
|
|
1157
|
+
name: 'get_lab_state',
|
|
1158
|
+
title: 'Get local lab state',
|
|
1159
|
+
},
|
|
1160
|
+
{
|
|
1161
|
+
annotations: { destructiveHint: false, idempotentHint: true },
|
|
1162
|
+
description: 'Create or replace any non-secret ToonLab lab-state entry in the local OSS workspace.',
|
|
1163
|
+
inputSchema: {
|
|
1164
|
+
additionalProperties: false,
|
|
1165
|
+
properties: { key: { type: 'string' }, value: {} },
|
|
1166
|
+
required: ['key', 'value'],
|
|
1167
|
+
type: 'object',
|
|
1168
|
+
},
|
|
1169
|
+
name: 'set_lab_state',
|
|
1170
|
+
title: 'Set local lab state',
|
|
1171
|
+
},
|
|
1172
|
+
{
|
|
1173
|
+
annotations: { destructiveHint: true, idempotentHint: true },
|
|
1174
|
+
description: 'Delete one raw lab-state entry from the local OSS workspace. Requires confirm=true.',
|
|
1175
|
+
inputSchema: {
|
|
1176
|
+
additionalProperties: false,
|
|
1177
|
+
properties: { confirm: { const: true, type: 'boolean' }, key: { type: 'string' } },
|
|
1178
|
+
required: ['key', 'confirm'],
|
|
1179
|
+
type: 'object',
|
|
1180
|
+
},
|
|
1181
|
+
name: 'delete_lab_state',
|
|
1182
|
+
title: 'Delete local lab state',
|
|
1183
|
+
},
|
|
411
1184
|
{
|
|
412
1185
|
annotations: { destructiveHint: false, idempotentHint: false },
|
|
413
1186
|
description: 'Generate a deterministic editable asset recipe from a built-in ToonLab catalog entry and optionally save it to disk.',
|
|
@@ -415,7 +1188,9 @@ const TOOLS = [
|
|
|
415
1188
|
additionalProperties: false,
|
|
416
1189
|
properties: {
|
|
417
1190
|
catalog_id: { type: 'string' },
|
|
1191
|
+
domain: { type: 'string' },
|
|
418
1192
|
name: { type: 'string' },
|
|
1193
|
+
policy: { type: 'object' },
|
|
419
1194
|
save: { default: true, type: 'boolean' },
|
|
420
1195
|
seed: { type: 'integer' },
|
|
421
1196
|
},
|
|
@@ -425,14 +1200,83 @@ const TOOLS = [
|
|
|
425
1200
|
name: 'generate_asset',
|
|
426
1201
|
title: 'Generate a procedural ToonLab asset',
|
|
427
1202
|
},
|
|
1203
|
+
{
|
|
1204
|
+
annotations: { destructiveHint: false, idempotentHint: false, openWorldHint: true },
|
|
1205
|
+
description: 'Start local managed image/3D generation with user-configured provider keys. Meshy 7 supports image/multiview-to-3D; text_to_model + Meshy first creates a concept image with image_model, then submits that PNG/JPEG to Meshy as one trackable job.',
|
|
1206
|
+
inputSchema: {
|
|
1207
|
+
additionalProperties: false,
|
|
1208
|
+
properties: {
|
|
1209
|
+
aspect_ratio: { default: '1:1', enum: ['1:1', '16:9', '9:16', '4:3', '3:4'], type: 'string' },
|
|
1210
|
+
domain: { maxLength: 120, minLength: 1, type: 'string' },
|
|
1211
|
+
gap_id: { description: 'ID returned by record_asset_gap.', minLength: 1, type: 'string' },
|
|
1212
|
+
image_model: { enum: ['nano-banana-2-lite', 'nano-banana-2', 'nano-banana-pro'], type: 'string' },
|
|
1213
|
+
kind: { enum: ['image', 'texture_image', 'concept_image', 'text_to_model', 'image_to_model', 'multiview_to_model', 'model_segment'], type: 'string' },
|
|
1214
|
+
model_provider: { default: 'meshy', enum: ['meshy', 'tripo'], type: 'string' },
|
|
1215
|
+
policy: { description: 'Developer-approved asset-sourcing policy.', type: 'object' },
|
|
1216
|
+
prompt: { maxLength: 600, type: 'string' },
|
|
1217
|
+
reference_paths: { items: { type: 'string' }, maxItems: 6, type: 'array' },
|
|
1218
|
+
resolution: { default: '1k', enum: ['1k', '2k', '4k'], type: 'string' },
|
|
1219
|
+
source_image_path: { description: 'Workspace object path for image_to_model.', type: 'string' },
|
|
1220
|
+
source_job_id: { description: 'Succeeded image job for image_to_model, or Tripo model job for model_segment.', type: 'string' },
|
|
1221
|
+
style: { default: 'stylized', enum: ['stylized', 'cartoon', 'raw'], type: 'string' },
|
|
1222
|
+
view_paths: { description: 'multiview_to_model only: [front, left, back, right]. Front plus at least one other view is required.', items: { type: ['string', 'null'] }, maxItems: 4, type: 'array' },
|
|
1223
|
+
},
|
|
1224
|
+
required: ['kind', 'domain', 'policy', 'gap_id'],
|
|
1225
|
+
type: 'object',
|
|
1226
|
+
},
|
|
1227
|
+
name: 'generate_ai_asset',
|
|
1228
|
+
title: 'Generate an image or 3D asset with local provider keys',
|
|
1229
|
+
},
|
|
1230
|
+
{
|
|
1231
|
+
annotations: { readOnlyHint: true, openWorldHint: true },
|
|
1232
|
+
description: 'Poll one local managed generation job. Async Meshy/Tripo tasks are advanced and completed provider files are downloaded into the local workspace.',
|
|
1233
|
+
inputSchema: {
|
|
1234
|
+
additionalProperties: false,
|
|
1235
|
+
properties: { job_id: { type: 'string' } },
|
|
1236
|
+
required: ['job_id'],
|
|
1237
|
+
type: 'object',
|
|
1238
|
+
},
|
|
1239
|
+
name: 'get_generation_job',
|
|
1240
|
+
title: 'Get a local generation job',
|
|
1241
|
+
},
|
|
1242
|
+
{
|
|
1243
|
+
annotations: { readOnlyHint: true, openWorldHint: true },
|
|
1244
|
+
description: 'Poll up to 20 known local generation jobs, or list recent jobs when job_ids is omitted.',
|
|
1245
|
+
inputSchema: {
|
|
1246
|
+
additionalProperties: false,
|
|
1247
|
+
properties: {
|
|
1248
|
+
job_ids: { items: { type: 'string' }, maxItems: 20, minItems: 1, type: 'array' },
|
|
1249
|
+
kind: { type: 'string' },
|
|
1250
|
+
limit: { maximum: 100, minimum: 1, type: 'integer' },
|
|
1251
|
+
query: { type: 'string' },
|
|
1252
|
+
},
|
|
1253
|
+
type: 'object',
|
|
1254
|
+
},
|
|
1255
|
+
name: 'get_generation_jobs',
|
|
1256
|
+
title: 'Get local generation jobs',
|
|
1257
|
+
},
|
|
1258
|
+
{
|
|
1259
|
+
annotations: { destructiveHint: false, idempotentHint: true },
|
|
1260
|
+
description: 'Save a succeeded local 3D generation job into the editable ToonLab library with its provider provenance and local model file.',
|
|
1261
|
+
inputSchema: {
|
|
1262
|
+
additionalProperties: false,
|
|
1263
|
+
properties: { job_id: { type: 'string' }, label: { maxLength: 120, type: 'string' } },
|
|
1264
|
+
required: ['job_id'],
|
|
1265
|
+
type: 'object',
|
|
1266
|
+
},
|
|
1267
|
+
name: 'save_generated_asset',
|
|
1268
|
+
title: 'Save a generated 3D asset',
|
|
1269
|
+
},
|
|
428
1270
|
{
|
|
429
1271
|
annotations: { openWorldHint: true, readOnlyHint: true },
|
|
430
1272
|
description: 'Search CC0 models, textures, or HDRIs from Poly Haven and ambientCG.',
|
|
431
1273
|
inputSchema: {
|
|
432
1274
|
additionalProperties: false,
|
|
433
1275
|
properties: {
|
|
1276
|
+
domain: { type: 'string' },
|
|
434
1277
|
kind: { enum: ['model', 'texture', 'hdri'], type: 'string' },
|
|
435
1278
|
limit: { maximum: 50, minimum: 1, type: 'integer' },
|
|
1279
|
+
policy: { type: 'object' },
|
|
436
1280
|
provider: { enum: ['all', 'polyhaven', 'ambientcg'], type: 'string' },
|
|
437
1281
|
query: { type: 'string' },
|
|
438
1282
|
},
|
|
@@ -447,8 +1291,10 @@ const TOOLS = [
|
|
|
447
1291
|
inputSchema: {
|
|
448
1292
|
additionalProperties: false,
|
|
449
1293
|
properties: {
|
|
1294
|
+
domain: { type: 'string' },
|
|
450
1295
|
id: { type: 'string' },
|
|
451
1296
|
kind: { enum: ['model', 'texture', 'hdri'], type: 'string' },
|
|
1297
|
+
policy: { type: 'object' },
|
|
452
1298
|
provider: { enum: ['polyhaven', 'ambientcg'], type: 'string' },
|
|
453
1299
|
resolution: { default: '1k', type: 'string' },
|
|
454
1300
|
},
|
|
@@ -464,8 +1310,10 @@ const TOOLS = [
|
|
|
464
1310
|
inputSchema: {
|
|
465
1311
|
additionalProperties: false,
|
|
466
1312
|
properties: {
|
|
1313
|
+
domain: { type: 'string' },
|
|
467
1314
|
id: { type: 'string' },
|
|
468
1315
|
kind: { enum: ['model', 'texture', 'hdri'], type: 'string' },
|
|
1316
|
+
policy: { type: 'object' },
|
|
469
1317
|
provider: { enum: ['polyhaven', 'ambientcg'], type: 'string' },
|
|
470
1318
|
resolution: { default: '1k', type: 'string' },
|
|
471
1319
|
},
|
|
@@ -475,6 +1323,54 @@ const TOOLS = [
|
|
|
475
1323
|
name: 'import_cc0_asset',
|
|
476
1324
|
title: 'Import a public CC0 asset',
|
|
477
1325
|
},
|
|
1326
|
+
{
|
|
1327
|
+
annotations: { readOnlyHint: true },
|
|
1328
|
+
description: 'Validate a strict, advisory, or open sourcing policy and evaluate whether one candidate may be selected.',
|
|
1329
|
+
inputSchema: {
|
|
1330
|
+
additionalProperties: false,
|
|
1331
|
+
properties: {
|
|
1332
|
+
candidate: {
|
|
1333
|
+
additionalProperties: false,
|
|
1334
|
+
properties: {
|
|
1335
|
+
domain: { type: 'string' },
|
|
1336
|
+
sourceClass: { enum: ASSET_SOURCE_CLASSES, type: 'string' },
|
|
1337
|
+
},
|
|
1338
|
+
required: ['domain', 'sourceClass'],
|
|
1339
|
+
type: 'object',
|
|
1340
|
+
},
|
|
1341
|
+
policy: { type: 'object' },
|
|
1342
|
+
},
|
|
1343
|
+
required: ['candidate'],
|
|
1344
|
+
type: 'object',
|
|
1345
|
+
},
|
|
1346
|
+
name: 'validate_asset_candidate',
|
|
1347
|
+
title: 'Validate an asset candidate',
|
|
1348
|
+
},
|
|
1349
|
+
{
|
|
1350
|
+
annotations: { destructiveHint: false, idempotentHint: true },
|
|
1351
|
+
description: 'Record why a custom shader or asset was required and regenerate JSON plus Markdown feedback reports.',
|
|
1352
|
+
inputSchema: {
|
|
1353
|
+
additionalProperties: false,
|
|
1354
|
+
properties: {
|
|
1355
|
+
approvedBy: { type: ['string', 'null'] },
|
|
1356
|
+
attempts: { items: { type: 'object' }, type: 'array' },
|
|
1357
|
+
bundleSlot: { type: ['string', 'null'] },
|
|
1358
|
+
customImplementation: {},
|
|
1359
|
+
domain: { type: 'string' },
|
|
1360
|
+
feedbackNeeded: { type: 'string' },
|
|
1361
|
+
id: { type: 'string' },
|
|
1362
|
+
kind: { type: 'string' },
|
|
1363
|
+
provenance: {},
|
|
1364
|
+
reason: { type: 'string' },
|
|
1365
|
+
status: { type: 'string' },
|
|
1366
|
+
targetId: { type: ['string', 'null'] },
|
|
1367
|
+
},
|
|
1368
|
+
required: ['id', 'domain', 'kind', 'reason'],
|
|
1369
|
+
type: 'object',
|
|
1370
|
+
},
|
|
1371
|
+
name: 'record_asset_gap',
|
|
1372
|
+
title: 'Record a custom asset or shader gap',
|
|
1373
|
+
},
|
|
478
1374
|
{
|
|
479
1375
|
annotations: { readOnlyHint: true },
|
|
480
1376
|
description: 'Explain what asset generation is available in the open-source local server.',
|
|
@@ -482,41 +1378,108 @@ const TOOLS = [
|
|
|
482
1378
|
name: 'get_generation_capabilities',
|
|
483
1379
|
title: 'Get local generation capabilities',
|
|
484
1380
|
},
|
|
485
|
-
...STYLE_LAB_TOOLS,
|
|
486
1381
|
];
|
|
487
1382
|
|
|
488
1383
|
async function callTool(name, args = {}) {
|
|
489
1384
|
switch (name) {
|
|
1385
|
+
case 'inspect_scene_style': return runSceneStyleOperation('inspect', args.manifest, args);
|
|
1386
|
+
case 'audit_scene_style': return runSceneStyleOperation('audit', args.manifest, args);
|
|
1387
|
+
case 'plan_scene_style': return runSceneStyleOperation('plan', args.manifest, args);
|
|
1388
|
+
case 'apply_scene_style': return runSceneStyleOperation('apply', args.manifest, args);
|
|
1389
|
+
case 'verify_scene_style': return runSceneStyleOperation('verify', args.manifest, args);
|
|
1390
|
+
case 'get_anime_game_profile': return {
|
|
1391
|
+
artDirection: TOONLAB_ANIME_GAME_PROFILE,
|
|
1392
|
+
defaultStyleBundle: CALL_ME_SENSEI_STYLE_BUNDLE,
|
|
1393
|
+
product: 'Anime-style game, character, and environment development for Three.js',
|
|
1394
|
+
routing: STYLE_DOMAIN_SLOT_ROUTES,
|
|
1395
|
+
};
|
|
490
1396
|
case 'get_workspace_info': return getWorkspaceInfo(workspace);
|
|
1397
|
+
case 'list_live_labs': return listLiveLabs();
|
|
1398
|
+
case 'get_lab_features': return getLabFeatures(args.lab);
|
|
1399
|
+
case 'create_lab_document': return createLabDocumentTool(args);
|
|
491
1400
|
case 'search_assets': return searchAssets(args);
|
|
492
1401
|
case 'get_asset': return getAsset(args);
|
|
493
1402
|
case 'list_my_creations': return listMyCreations(args);
|
|
494
1403
|
case 'get_my_creation': return getMyCreation(args);
|
|
495
1404
|
case 'save_creation': return saveCreation(workspace, args);
|
|
1405
|
+
case 'update_creation': return updateCreation(args);
|
|
1406
|
+
case 'mutate_lab_creation': return mutateLabCreation(args);
|
|
1407
|
+
case 'delete_creation': return removeCreation(args);
|
|
1408
|
+
case 'list_lab_state': return listLabState(args);
|
|
1409
|
+
case 'get_lab_state': return getLabState(args);
|
|
1410
|
+
case 'set_lab_state': return putLabState(args);
|
|
1411
|
+
case 'delete_lab_state': return removeLabState(args);
|
|
496
1412
|
case 'generate_asset': return generateAsset(args);
|
|
1413
|
+
case 'generate_ai_asset': {
|
|
1414
|
+
if (!String(args.gap_id ?? '').trim()) throw new Error('record_asset_gap is required before managed generation.');
|
|
1415
|
+
const policyDecision = evaluateAssetCandidate(args.policy ?? null, {
|
|
1416
|
+
domain: args.domain ?? '',
|
|
1417
|
+
sourceClass: 'custom',
|
|
1418
|
+
});
|
|
1419
|
+
if (!policyDecision.allowed) throw new Error(policyDecision.reason);
|
|
1420
|
+
const job = await startManagedGeneration(workspace, args);
|
|
1421
|
+
return {
|
|
1422
|
+
job,
|
|
1423
|
+
policyDecision,
|
|
1424
|
+
pollAfterMs: 5_000,
|
|
1425
|
+
next: job.status === 'running'
|
|
1426
|
+
? 'Poll get_generation_job until succeeded, failed, or cancelled; then pass a succeeded 3D job to save_generated_asset.'
|
|
1427
|
+
: 'The provider completed inline. Save a succeeded 3D job with save_generated_asset.',
|
|
1428
|
+
};
|
|
1429
|
+
}
|
|
1430
|
+
case 'get_generation_job': {
|
|
1431
|
+
const job = await getManagedGeneration(workspace, String(args.job_id ?? ''));
|
|
1432
|
+
if (!job) throw new Error('Generation job not found.');
|
|
1433
|
+
return { job, pollAfterMs: job.status === 'running' ? 5_000 : null };
|
|
1434
|
+
}
|
|
1435
|
+
case 'get_generation_jobs': {
|
|
1436
|
+
const ids = Array.isArray(args.job_ids) ? [...new Set(args.job_ids.map(String))].slice(0, 20) : [];
|
|
1437
|
+
const jobs = ids.length
|
|
1438
|
+
? (await Promise.all(ids.map((id) => getManagedGeneration(workspace, id)))).filter(Boolean)
|
|
1439
|
+
: await listManagedGenerations({ kind: args.kind ?? '', limit: args.limit ?? 60, q: args.query ?? '' });
|
|
1440
|
+
return { jobs, pollAfterMs: jobs.some((job) => job.status === 'running') ? 5_000 : null };
|
|
1441
|
+
}
|
|
1442
|
+
case 'save_generated_asset': return {
|
|
1443
|
+
creation: await saveManagedGeneration(String(args.job_id ?? ''), { label: args.label }),
|
|
1444
|
+
};
|
|
497
1445
|
case 'search_cc0_assets': return searchCc0Assets(args);
|
|
498
1446
|
case 'get_cc0_asset': return getCc0AssetDetails(args);
|
|
499
1447
|
case 'import_cc0_asset': return importCc0Asset(args);
|
|
1448
|
+
case 'validate_asset_candidate': {
|
|
1449
|
+
const policyValidation = args.policy
|
|
1450
|
+
? validateAssetSourcingPolicy(args.policy)
|
|
1451
|
+
: { ok: true, value: null };
|
|
1452
|
+
return {
|
|
1453
|
+
availableModes: ASSET_POLICY_MODES,
|
|
1454
|
+
policyValidation,
|
|
1455
|
+
result: policyValidation.ok
|
|
1456
|
+
? evaluateAssetCandidate(policyValidation.value, args.candidate)
|
|
1457
|
+
: { allowed: false, decision: 'deny', reason: policyValidation.errors.join(' ') },
|
|
1458
|
+
};
|
|
1459
|
+
}
|
|
1460
|
+
case 'record_asset_gap': return recordAssetGap(args);
|
|
500
1461
|
case 'get_generation_capabilities': return {
|
|
1462
|
+
managedLocal: {
|
|
1463
|
+
...providerConfiguration(),
|
|
1464
|
+
kinds: ['image', 'texture_image', 'concept_image', 'text_to_model', 'image_to_model', 'multiview_to_model', 'model_segment'],
|
|
1465
|
+
meshyTextFlow: 'selected image_model concept_image -> meshy-7 image_to_model',
|
|
1466
|
+
tools: ['generate_ai_asset', 'get_generation_job', 'get_generation_jobs', 'save_generated_asset'],
|
|
1467
|
+
},
|
|
501
1468
|
available: [
|
|
502
|
-
'Generate deterministic recipes from
|
|
503
|
-
'Author, validate, and batch-resolve open-domain recipes for the generative style domains (post, camera, game feel, lighting styles, light fixtures).',
|
|
1469
|
+
'Generate deterministic recipes from the stable public ToonLab catalog entries.',
|
|
504
1470
|
'Save and retrieve editable lab documents through the shared .toonlab workspace.',
|
|
505
1471
|
'Search and import CC0 assets from Poly Haven and ambientCG.',
|
|
506
1472
|
'Use each recipe\'s spawn snippet to integrate it into a Three.js project.',
|
|
507
1473
|
],
|
|
1474
|
+
unsupportedStyleDomains: ['lighting', 'vfx', 'renderer'],
|
|
508
1475
|
hostedProAdds: [
|
|
509
|
-
'
|
|
1476
|
+
'Hosted provider keys, credit billing, and durable background workers',
|
|
510
1477
|
'Cloud library and cross-device sync',
|
|
511
1478
|
'Remote Streamable HTTP transport with OAuth',
|
|
512
1479
|
],
|
|
513
1480
|
mode: 'open-source-local',
|
|
514
1481
|
};
|
|
515
|
-
default:
|
|
516
|
-
if (isStyleLabTool(name)) {
|
|
517
|
-
return callStyleLabTool(name, args, { saveCreation, workspace });
|
|
518
|
-
}
|
|
519
|
-
throw new Error(`Unknown tool "${name}".`);
|
|
1482
|
+
default: throw new Error(`Unknown tool "${name}".`);
|
|
520
1483
|
}
|
|
521
1484
|
}
|
|
522
1485
|
|
|
@@ -555,7 +1518,7 @@ async function handleRequest(message) {
|
|
|
555
1518
|
jsonrpc: '2.0',
|
|
556
1519
|
result: {
|
|
557
1520
|
capabilities: { resources: {}, tools: {} },
|
|
558
|
-
instructions: '
|
|
1521
|
+
instructions: 'ToonLab builds anime-style games, characters, and environments for Three.js. Call list_live_labs and get_lab_features when authoring a Lab artifact, use create_lab_document for a valid starter, and prefer mutate_lab_creation over hand-editing structural arrays. Official Rock details include a source-GLB starter. This OSS server may edit any non-secret creation or lab-state entry in its local workspace; deletions require explicit confirmation. Load the selected style bundle first. If no asset-sourcing policy exists, ask the developer, then continue with library-first advisory discovery while recording the unresolved decision. Search the project and ToonLab libraries before public sources; generate or hand-author only when policy permits. Validate every candidate, preserve provenance, evaluate anime-fit in scene, and record a gap before adding a custom shader, texture, model, or adapter. When local provider keys are configured, generate_ai_asset exposes image generation, Meshy 7 image/multiview-to-3D, and Text -> selected image model -> Meshy 7 through MCP.',
|
|
559
1522
|
protocolVersion: SUPPORTED_PROTOCOL_VERSIONS.has(requested) ? requested : LATEST_PROTOCOL_VERSION,
|
|
560
1523
|
serverInfo: { name: SERVER_NAME, version: SERVER_VERSION },
|
|
561
1524
|
},
|