@instruktlabs/kiln 0.0.0-stage → 1.0.0
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/.agents/plugins/marketplace.json +20 -0
- package/.claude-plugin/marketplace.json +19 -0
- package/.claude-plugin/plugin.json +30 -0
- package/.codex-plugin/plugin.json +37 -0
- package/.mcp.json +10 -0
- package/CHANGELOG.md +2579 -0
- package/CONTRIBUTING.md +130 -0
- package/LICENSE +21 -0
- package/README.md +443 -2
- package/THIRD_PARTY_NOTICES.md +62 -0
- package/dist/agent-providers.mjs +310 -0
- package/dist/agent-run.mjs +40433 -0
- package/dist/build.json +215 -0
- package/dist/cli.mjs +48027 -0
- package/dist/evaluator-worker.mjs +27572 -0
- package/dist/mcp-engine.mjs +43537 -0
- package/dist/mcp-server.mjs +2388 -0
- package/dist/viewer/app.js +4281 -0
- package/dist/viewer/chat.html +4409 -0
- package/dist/viewer/index.html +51 -0
- package/dist/viewer/style.css +51 -0
- package/docs/architecture.md +77 -0
- package/docs/cameras.md +181 -0
- package/docs/chatgpt.md +48 -0
- package/docs/collections.md +195 -0
- package/docs/community-exporter.md +95 -0
- package/docs/engine-handoff.md +221 -0
- package/docs/examples.md +171 -0
- package/docs/export-profiles.md +223 -0
- package/docs/extending.md +43 -0
- package/docs/geometry.md +505 -0
- package/docs/google.md +121 -0
- package/docs/harnesses.md +372 -0
- package/docs/install.md +542 -0
- package/docs/material-library.md +133 -0
- package/docs/migration.md +809 -0
- package/docs/programs.md +123 -0
- package/docs/projects-and-live-review.md +94 -0
- package/docs/rendering.md +250 -0
- package/docs/runtime.md +223 -0
- package/docs/sdk.md +137 -0
- package/docs/tools.md +1874 -0
- package/lib/_types/render-service/src/build-identity.d.mts +24 -0
- package/lib/_types/render-service/src/instance.d.mts +47 -0
- package/lib/agent/call-budget.d.ts +55 -0
- package/lib/agent/call-budget.js +52 -0
- package/lib/agent/compaction.d.ts +83 -0
- package/lib/agent/compaction.js +124 -0
- package/lib/agent/concurrency.d.ts +8 -0
- package/lib/agent/concurrency.js +24 -0
- package/lib/agent/diff.d.ts +23 -0
- package/lib/agent/diff.js +124 -0
- package/lib/agent/generate.d.ts +192 -0
- package/lib/agent/generate.js +240 -0
- package/lib/agent/hooks.d.ts +91 -0
- package/lib/agent/hooks.js +158 -0
- package/lib/agent/index.d.ts +42 -0
- package/lib/agent/index.js +30 -0
- package/lib/agent/native-prompt.d.ts +15 -0
- package/lib/agent/native-prompt.js +29 -0
- package/lib/agent/native-workflow.d.ts +4 -0
- package/lib/agent/native-workflow.js +30 -0
- package/lib/agent/providers.d.ts +188 -0
- package/lib/agent/providers.js +392 -0
- package/lib/agent/run.d.ts +72 -0
- package/lib/agent/run.js +245 -0
- package/lib/agent/skill-resources.d.ts +9 -0
- package/lib/agent/skill-resources.js +178 -0
- package/lib/agent/split-tool-result-images.d.ts +33 -0
- package/lib/agent/split-tool-result-images.js +47 -0
- package/lib/agent/stream-start.d.ts +30 -0
- package/lib/agent/stream-start.js +32 -0
- package/lib/agent/tools.d.ts +12 -0
- package/lib/agent/tools.js +77 -0
- package/lib/agent/view-render-timeout.d.ts +40 -0
- package/lib/agent/view-render-timeout.js +71 -0
- package/lib/animation-cubic.d.ts +12 -0
- package/lib/animation-cubic.js +44 -0
- package/lib/animation-spline.d.ts +50 -0
- package/lib/animation-spline.js +168 -0
- package/lib/architecture.d.ts +146 -0
- package/lib/architecture.js +498 -0
- package/lib/arena/adaptive.d.ts +38 -0
- package/lib/arena/adaptive.js +87 -0
- package/lib/arena/bradley-terry.d.ts +63 -0
- package/lib/arena/bradley-terry.js +165 -0
- package/lib/arena/index.d.ts +15 -0
- package/lib/arena/index.js +13 -0
- package/lib/assembly-transform.d.ts +7 -0
- package/lib/assembly-transform.js +21 -0
- package/lib/assembly.d.ts +105 -0
- package/lib/assembly.js +587 -0
- package/lib/asset-catalog.d.ts +13 -0
- package/lib/asset-catalog.js +21 -0
- package/lib/asset-export.d.ts +41 -0
- package/lib/asset-export.js +106 -0
- package/lib/asset-materials-node.d.ts +5 -0
- package/lib/asset-materials-node.js +56 -0
- package/lib/asset-widget.d.ts +10 -0
- package/lib/asset-widget.js +23 -0
- package/lib/assets-node.d.ts +33 -0
- package/lib/assets-node.js +348 -0
- package/lib/assets-resources.d.ts +33 -0
- package/lib/assets-resources.js +109 -0
- package/lib/assets.d.ts +91 -0
- package/lib/assets.js +205 -0
- package/lib/atomic-directory.d.ts +9 -0
- package/lib/atomic-directory.js +31 -0
- package/lib/authoring-style.d.ts +3 -0
- package/lib/authoring-style.js +42 -0
- package/lib/build-cache-node.d.ts +12 -0
- package/lib/build-cache-node.js +87 -0
- package/lib/build-cache.d.ts +24 -0
- package/lib/build-cache.js +229 -0
- package/lib/character.d.ts +132 -0
- package/lib/character.js +612 -0
- package/lib/cli-render-mode.d.ts +31 -0
- package/lib/cli-render-mode.js +204 -0
- package/lib/community-exporter.d.ts +13 -0
- package/lib/community-exporter.js +237 -0
- package/lib/composer/agent/compaction.d.ts +72 -0
- package/lib/composer/agent/compaction.js +103 -0
- package/lib/composer/agent/index.d.ts +25 -0
- package/lib/composer/agent/index.js +19 -0
- package/lib/composer/agent/prompt.d.ts +25 -0
- package/lib/composer/agent/prompt.js +100 -0
- package/lib/composer/agent/run.d.ts +91 -0
- package/lib/composer/agent/run.js +212 -0
- package/lib/composer/agent/tools.d.ts +75 -0
- package/lib/composer/agent/tools.js +643 -0
- package/lib/composer/agent/world-run.d.ts +50 -0
- package/lib/composer/agent/world-run.js +295 -0
- package/lib/composer/agent/world-tools.d.ts +20 -0
- package/lib/composer/agent/world-tools.js +311 -0
- package/lib/composer/collision.d.ts +109 -0
- package/lib/composer/collision.js +339 -0
- package/lib/composer/contract-utils.d.ts +6 -0
- package/lib/composer/contract-utils.js +48 -0
- package/lib/composer/dsl.d.ts +52 -0
- package/lib/composer/dsl.js +147 -0
- package/lib/composer/ground.d.ts +22 -0
- package/lib/composer/ground.js +9 -0
- package/lib/composer/index.d.ts +19 -0
- package/lib/composer/index.js +19 -0
- package/lib/composer/layout.d.ts +106 -0
- package/lib/composer/layout.js +216 -0
- package/lib/composer/model.d.ts +298 -0
- package/lib/composer/model.js +441 -0
- package/lib/composer/overlap.d.ts +89 -0
- package/lib/composer/overlap.js +139 -0
- package/lib/composer/presentation.d.ts +123 -0
- package/lib/composer/presentation.js +256 -0
- package/lib/composer/reachability.d.ts +78 -0
- package/lib/composer/reachability.js +303 -0
- package/lib/composer/render-port.d.ts +293 -0
- package/lib/composer/render-port.js +172 -0
- package/lib/composer/terrain-runtime.d.ts +73 -0
- package/lib/composer/terrain-runtime.js +328 -0
- package/lib/composer/terrain.d.ts +43 -0
- package/lib/composer/terrain.js +49 -0
- package/lib/composer/world-document.d.ts +722 -0
- package/lib/composer/world-document.js +857 -0
- package/lib/composer/world-integration.d.ts +78 -0
- package/lib/composer/world-integration.js +452 -0
- package/lib/composer/world-package.d.ts +312 -0
- package/lib/composer/world-package.js +209 -0
- package/lib/contracts/asset.d.ts +270 -0
- package/lib/contracts/asset.js +1616 -0
- package/lib/contracts/breadth.d.ts +197 -0
- package/lib/contracts/breadth.js +631 -0
- package/lib/contracts/environment.d.ts +13 -0
- package/lib/contracts/environment.js +67 -0
- package/lib/contracts/index.d.ts +5 -0
- package/lib/contracts/index.js +5 -0
- package/lib/contracts/integration.d.ts +94 -0
- package/lib/contracts/integration.js +10 -0
- package/lib/contracts/requirements-migration.d.ts +61 -0
- package/lib/contracts/requirements-migration.js +401 -0
- package/lib/contracts/requirements.d.ts +815 -0
- package/lib/contracts/requirements.js +266 -0
- package/lib/contracts/semantic.d.ts +124 -0
- package/lib/contracts/semantic.js +421 -0
- package/lib/deform.d.ts +31 -0
- package/lib/deform.js +137 -0
- package/lib/deformation-normals.d.ts +3 -0
- package/lib/deformation-normals.js +72 -0
- package/lib/discovery/articulation-recipes.d.ts +6 -0
- package/lib/discovery/articulation-recipes.js +184 -0
- package/lib/discovery/catalog-schema.d.ts +175 -0
- package/lib/discovery/catalog-schema.js +118 -0
- package/lib/discovery/catalog.d.ts +25 -0
- package/lib/discovery/catalog.js +84 -0
- package/lib/discovery/construction-recipes.d.ts +7 -0
- package/lib/discovery/construction-recipes.js +236 -0
- package/lib/discovery/helper-contracts.d.ts +19 -0
- package/lib/discovery/helper-contracts.js +1940 -0
- package/lib/discovery/helper-specs.d.ts +40 -0
- package/lib/discovery/helper-specs.js +800 -0
- package/lib/discovery/index.d.ts +9 -0
- package/lib/discovery/index.js +20 -0
- package/lib/discovery/intents.d.ts +3 -0
- package/lib/discovery/intents.js +117 -0
- package/lib/discovery/lexical-index.d.ts +5 -0
- package/lib/discovery/lexical-index.js +67 -0
- package/lib/discovery/query-schema.d.ts +35 -0
- package/lib/discovery/query-schema.js +66 -0
- package/lib/discovery/recipes.d.ts +6 -0
- package/lib/discovery/recipes.js +191 -0
- package/lib/discovery/service.d.ts +57 -0
- package/lib/discovery/service.js +234 -0
- package/lib/discovery/shapes.d.ts +6 -0
- package/lib/discovery/shapes.js +65 -0
- package/lib/discovery/structural-recipes.d.ts +6 -0
- package/lib/discovery/structural-recipes.js +193 -0
- package/lib/discovery/surface-recipes.d.ts +7 -0
- package/lib/discovery/surface-recipes.js +124 -0
- package/lib/draw-diagnostics.d.ts +57 -0
- package/lib/draw-diagnostics.js +239 -0
- package/lib/edit-buffer.d.ts +86 -0
- package/lib/edit-buffer.js +99 -0
- package/lib/engine-identity.d.ts +44 -0
- package/lib/engine-identity.js +41 -0
- package/lib/evaluator/authoring-diagnostic.d.ts +38 -0
- package/lib/evaluator/authoring-diagnostic.js +128 -0
- package/lib/evaluator/handler.d.ts +14 -0
- package/lib/evaluator/handler.js +86 -0
- package/lib/evaluator/index.d.ts +4 -0
- package/lib/evaluator/index.js +4 -0
- package/lib/evaluator/isolation.d.ts +45 -0
- package/lib/evaluator/isolation.js +362 -0
- package/lib/evaluator/probe-invariants.d.ts +2 -0
- package/lib/evaluator/probe-invariants.js +7 -0
- package/lib/evaluator/probe-worker.d.ts +1 -0
- package/lib/evaluator/probe-worker.js +134 -0
- package/lib/evaluator/protocol.d.ts +105 -0
- package/lib/evaluator/protocol.js +512 -0
- package/lib/evaluator/source-check.d.ts +7 -0
- package/lib/evaluator/source-check.js +57 -0
- package/lib/evaluator/subprocess.d.ts +26 -0
- package/lib/evaluator/subprocess.js +212 -0
- package/lib/evaluator/transport-worker.d.mts +1 -0
- package/lib/evaluator/transport-worker.mjs +3 -0
- package/lib/evaluator/worker-urls.d.ts +6 -0
- package/lib/evaluator/worker-urls.js +12 -0
- package/lib/evaluator/worker.d.ts +1 -0
- package/lib/evaluator/worker.js +26 -0
- package/lib/exporter-node.d.ts +16 -0
- package/lib/exporter-node.js +58 -0
- package/lib/gears.d.ts +68 -0
- package/lib/gears.js +259 -0
- package/lib/geometry-budget.d.ts +15 -0
- package/lib/geometry-budget.js +36 -0
- package/lib/geometry-catalog.d.ts +5 -0
- package/lib/geometry-catalog.js +161 -0
- package/lib/geometry-export.d.ts +11 -0
- package/lib/geometry-export.js +160 -0
- package/lib/geometry.d.ts +46 -0
- package/lib/geometry.js +311 -0
- package/lib/gltf-io.d.ts +38 -0
- package/lib/gltf-io.js +95 -0
- package/lib/implicit.d.ts +20 -0
- package/lib/implicit.js +58 -0
- package/lib/index-policy.d.ts +13 -0
- package/lib/index-policy.js +41 -0
- package/lib/index.d.ts +5 -0
- package/lib/index.js +5 -0
- package/lib/inspect.d.ts +76 -0
- package/lib/inspect.js +206 -0
- package/lib/kit.d.ts +90 -0
- package/lib/kit.js +459 -0
- package/lib/live-review-node.d.ts +70 -0
- package/lib/live-review-node.js +961 -0
- package/lib/live-review.d.ts +65 -0
- package/lib/live-review.js +1 -0
- package/lib/local-runtime.d.ts +25 -0
- package/lib/local-runtime.js +272 -0
- package/lib/lod-export.d.ts +39 -0
- package/lib/lod-export.js +102 -0
- package/lib/lod.d.ts +56 -0
- package/lib/lod.js +138 -0
- package/lib/material-library-node.d.ts +56 -0
- package/lib/material-library-node.js +402 -0
- package/lib/material-library.d.ts +731 -0
- package/lib/material-library.js +425 -0
- package/lib/material-metrics.d.ts +72 -0
- package/lib/material-metrics.js +276 -0
- package/lib/material-presets.d.ts +29 -0
- package/lib/material-presets.js +181 -0
- package/lib/material-recipe-prompt.d.ts +23 -0
- package/lib/material-recipe-prompt.js +72 -0
- package/lib/material-recipe-runtime.d.ts +31 -0
- package/lib/material-recipe-runtime.js +91 -0
- package/lib/material-recipes.d.ts +131 -0
- package/lib/material-recipes.js +543 -0
- package/lib/material-resources.d.ts +181 -0
- package/lib/material-resources.js +416 -0
- package/lib/material-texture-library.generated.d.ts +1311 -0
- package/lib/material-texture-library.generated.js +11308 -0
- package/lib/metrics.d.ts +98 -0
- package/lib/metrics.js +210 -0
- package/lib/node-visibility.d.ts +31 -0
- package/lib/node-visibility.js +105 -0
- package/lib/open-shell.d.ts +21 -0
- package/lib/open-shell.js +83 -0
- package/lib/ops.d.ts +197 -0
- package/lib/ops.js +630 -0
- package/lib/palette-snap.d.ts +74 -0
- package/lib/palette-snap.js +151 -0
- package/lib/palette.d.ts +75 -0
- package/lib/palette.js +273 -0
- package/lib/portable-material-runtime.d.ts +14 -0
- package/lib/portable-material-runtime.js +81 -0
- package/lib/primitives.d.ts +483 -0
- package/lib/primitives.js +1553 -0
- package/lib/procedural-material-v2.d.ts +189 -0
- package/lib/procedural-material-v2.js +452 -0
- package/lib/procedural-texture.d.ts +90 -0
- package/lib/procedural-texture.js +306 -0
- package/lib/profile.d.ts +190 -0
- package/lib/profile.js +366 -0
- package/lib/program-store-node.d.ts +14 -0
- package/lib/program-store-node.js +137 -0
- package/lib/program-store.d.ts +43 -0
- package/lib/program-store.js +89 -0
- package/lib/project-bundle-node.d.ts +15 -0
- package/lib/project-bundle-node.js +175 -0
- package/lib/project-bundle.d.ts +65 -0
- package/lib/project-bundle.js +322 -0
- package/lib/projects-node.d.ts +17 -0
- package/lib/projects-node.js +227 -0
- package/lib/projects.d.ts +312 -0
- package/lib/projects.js +216 -0
- package/lib/prompt-api.d.ts +32 -0
- package/lib/prompt-api.js +223 -0
- package/lib/qa/architecture-corpus.d.ts +31 -0
- package/lib/qa/architecture-corpus.js +438 -0
- package/lib/qa/architecture-repairs.d.ts +17 -0
- package/lib/qa/architecture-repairs.js +73 -0
- package/lib/qa/architecture.d.ts +56 -0
- package/lib/qa/architecture.js +985 -0
- package/lib/qa/benchmark-fixtures.d.ts +42 -0
- package/lib/qa/benchmark-fixtures.js +191 -0
- package/lib/qa/breadth-corpus.d.ts +17 -0
- package/lib/qa/breadth-corpus.js +125 -0
- package/lib/qa/breadth-evidence.d.ts +18 -0
- package/lib/qa/breadth-evidence.js +514 -0
- package/lib/qa/breadth-final.d.ts +46 -0
- package/lib/qa/breadth-final.js +359 -0
- package/lib/qa/breadth.d.ts +66 -0
- package/lib/qa/breadth.js +539 -0
- package/lib/qa/character-advisory.d.ts +7 -0
- package/lib/qa/character-advisory.js +488 -0
- package/lib/qa/character-repairs.d.ts +11 -0
- package/lib/qa/character-repairs.js +68 -0
- package/lib/qa/character-vehicle-corpus.d.ts +32 -0
- package/lib/qa/character-vehicle-corpus.js +525 -0
- package/lib/qa/character.d.ts +66 -0
- package/lib/qa/character.js +712 -0
- package/lib/qa/corpus.d.ts +185 -0
- package/lib/qa/corpus.js +396 -0
- package/lib/qa/environment.d.ts +44 -0
- package/lib/qa/environment.js +725 -0
- package/lib/qa/geometry-relations.d.ts +94 -0
- package/lib/qa/geometry-relations.js +552 -0
- package/lib/qa/gltf.d.ts +29 -0
- package/lib/qa/gltf.js +66 -0
- package/lib/qa/index.d.ts +32 -0
- package/lib/qa/index.js +34 -0
- package/lib/qa/lod.d.ts +14 -0
- package/lib/qa/lod.js +25 -0
- package/lib/qa/material.d.ts +5 -0
- package/lib/qa/material.js +223 -0
- package/lib/qa/part-connectivity.d.ts +73 -0
- package/lib/qa/part-connectivity.js +216 -0
- package/lib/qa/prop-environment-prompt.d.ts +6 -0
- package/lib/qa/prop-environment-prompt.js +43 -0
- package/lib/qa/prop-helper-policy.d.ts +37 -0
- package/lib/qa/prop-helper-policy.js +65 -0
- package/lib/qa/prop.d.ts +44 -0
- package/lib/qa/prop.js +702 -0
- package/lib/qa/reference-comparison.d.ts +183 -0
- package/lib/qa/reference-comparison.js +420 -0
- package/lib/qa/registry.d.ts +159 -0
- package/lib/qa/registry.js +406 -0
- package/lib/qa/requirements-applicability.d.ts +33 -0
- package/lib/qa/requirements-applicability.js +189 -0
- package/lib/qa/requirements-report.d.ts +38 -0
- package/lib/qa/requirements-report.js +202 -0
- package/lib/qa/requirements-run.d.ts +20 -0
- package/lib/qa/requirements-run.js +370 -0
- package/lib/qa/run.d.ts +54 -0
- package/lib/qa/run.js +240 -0
- package/lib/qa/self-intersection.d.ts +157 -0
- package/lib/qa/self-intersection.js +633 -0
- package/lib/qa/sweep.d.ts +4 -0
- package/lib/qa/sweep.js +65 -0
- package/lib/qa/types.d.ts +90 -0
- package/lib/qa/types.js +81 -0
- package/lib/qa/universal.d.ts +14 -0
- package/lib/qa/universal.js +398 -0
- package/lib/qa/vegetation-corpus.d.ts +18 -0
- package/lib/qa/vegetation-corpus.js +304 -0
- package/lib/qa/vegetation.d.ts +133 -0
- package/lib/qa/vegetation.js +933 -0
- package/lib/qa/vehicle-advisory.d.ts +8 -0
- package/lib/qa/vehicle-advisory.js +395 -0
- package/lib/qa/vehicle.d.ts +19 -0
- package/lib/qa/vehicle.js +594 -0
- package/lib/rebuild-options.d.ts +31 -0
- package/lib/rebuild-options.js +13 -0
- package/lib/render-capabilities.d.ts +25 -0
- package/lib/render-capabilities.js +100 -0
- package/lib/render-service-client.d.ts +59 -0
- package/lib/render-service-client.js +194 -0
- package/lib/render-service-host.d.ts +44 -0
- package/lib/render-service-host.js +236 -0
- package/lib/render-service-windows.d.ts +12 -0
- package/lib/render-service-windows.js +72 -0
- package/lib/render.d.ts +565 -0
- package/lib/render.js +1978 -0
- package/lib/requirements-assets.d.ts +6 -0
- package/lib/requirements-assets.js +33 -0
- package/lib/requirements-context.d.ts +1658 -0
- package/lib/requirements-context.js +126 -0
- package/lib/requirements-identity.d.ts +3 -0
- package/lib/requirements-identity.js +38 -0
- package/lib/requirements-json.d.ts +12 -0
- package/lib/requirements-json.js +58 -0
- package/lib/requirements-store.d.ts +42 -0
- package/lib/requirements-store.js +86 -0
- package/lib/requirements.d.ts +4 -0
- package/lib/requirements.js +4 -0
- package/lib/revision-comparison.d.ts +85 -0
- package/lib/revision-comparison.js +334 -0
- package/lib/rig-export.d.ts +5 -0
- package/lib/rig-export.js +19 -0
- package/lib/rigid-merge.d.ts +90 -0
- package/lib/rigid-merge.js +585 -0
- package/lib/runtime-identity.d.ts +20 -0
- package/lib/runtime-identity.js +193 -0
- package/lib/solids.d.ts +29 -0
- package/lib/solids.js +523 -0
- package/lib/source-bindings.d.ts +6 -0
- package/lib/source-bindings.js +96 -0
- package/lib/source-runtime-checks.d.ts +14 -0
- package/lib/source-runtime-checks.js +169 -0
- package/lib/sweep-analysis.d.ts +22 -0
- package/lib/sweep-analysis.js +109 -0
- package/lib/sweep.d.ts +34 -0
- package/lib/sweep.js +347 -0
- package/lib/texture-bake.d.ts +125 -0
- package/lib/texture-bake.js +395 -0
- package/lib/texture-contract.d.ts +3 -0
- package/lib/texture-contract.js +10 -0
- package/lib/texture-resolver.d.ts +22 -0
- package/lib/texture-resolver.js +28 -0
- package/lib/textures.d.ts +90 -0
- package/lib/textures.js +240 -0
- package/lib/tools/actions.d.ts +35 -0
- package/lib/tools/actions.js +69 -0
- package/lib/tools/capture-input.d.ts +373 -0
- package/lib/tools/capture-input.js +193 -0
- package/lib/tools/discovery.d.ts +3 -0
- package/lib/tools/discovery.js +177 -0
- package/lib/tools/materials.d.ts +29 -0
- package/lib/tools/materials.js +168 -0
- package/lib/tools/preview-fidelity.d.ts +6 -0
- package/lib/tools/preview-fidelity.js +23 -0
- package/lib/tools/program-artifacts.d.ts +30 -0
- package/lib/tools/program-artifacts.js +76 -0
- package/lib/tools/programs.d.ts +9 -0
- package/lib/tools/programs.js +151 -0
- package/lib/tools/projects.d.ts +27 -0
- package/lib/tools/projects.js +98 -0
- package/lib/tools/registry.d.ts +792 -0
- package/lib/tools/registry.js +2123 -0
- package/lib/tools/review-detail.d.ts +106 -0
- package/lib/tools/review-detail.js +740 -0
- package/lib/tools/review.d.ts +40 -0
- package/lib/tools/review.js +230 -0
- package/lib/tools/skill-resource.d.ts +8 -0
- package/lib/tools/skill-resource.js +1 -0
- package/lib/tools/workspace.d.ts +8 -0
- package/lib/tools/workspace.js +87 -0
- package/lib/user-data-extras.d.ts +40 -0
- package/lib/user-data-extras.js +158 -0
- package/lib/user-data-validation.d.ts +18 -0
- package/lib/user-data-validation.js +201 -0
- package/lib/uv-project.d.ts +14 -0
- package/lib/uv-project.js +145 -0
- package/lib/uv-shapes.d.ts +11 -0
- package/lib/uv-shapes.js +48 -0
- package/lib/uv.d.ts +39 -0
- package/lib/uv.js +216 -0
- package/lib/validation.d.ts +90 -0
- package/lib/validation.js +1099 -0
- package/lib/vehicle.d.ts +128 -0
- package/lib/vehicle.js +487 -0
- package/lib/views/annotate.d.ts +41 -0
- package/lib/views/annotate.js +131 -0
- package/lib/views/architecture.d.ts +22 -0
- package/lib/views/architecture.js +55 -0
- package/lib/views/background.d.ts +54 -0
- package/lib/views/background.js +65 -0
- package/lib/views/camera-capture.d.ts +15 -0
- package/lib/views/camera-capture.js +101 -0
- package/lib/views/camera.d.ts +106 -0
- package/lib/views/camera.js +488 -0
- package/lib/views/capture-cache.d.ts +48 -0
- package/lib/views/capture-cache.js +239 -0
- package/lib/views/capture-limits.d.ts +19 -0
- package/lib/views/capture-limits.js +61 -0
- package/lib/views/capture.d.ts +124 -0
- package/lib/views/capture.js +210 -0
- package/lib/views/character-capture.d.ts +20 -0
- package/lib/views/character-capture.js +180 -0
- package/lib/views/character.d.ts +64 -0
- package/lib/views/character.js +176 -0
- package/lib/views/diagnostic.d.ts +90 -0
- package/lib/views/diagnostic.js +627 -0
- package/lib/views/evidence-history.d.ts +13 -0
- package/lib/views/evidence-history.js +131 -0
- package/lib/views/glb.d.ts +36 -0
- package/lib/views/glb.js +524 -0
- package/lib/views/grid.d.ts +46 -0
- package/lib/views/grid.js +81 -0
- package/lib/views/index.d.ts +257 -0
- package/lib/views/index.js +624 -0
- package/lib/views/inspect.d.ts +110 -0
- package/lib/views/inspect.js +195 -0
- package/lib/views/lod.d.ts +30 -0
- package/lib/views/lod.js +79 -0
- package/lib/views/measurement.d.ts +47 -0
- package/lib/views/measurement.js +60 -0
- package/lib/views/part-placement.d.ts +25 -0
- package/lib/views/part-placement.js +26 -0
- package/lib/views/png.d.ts +23 -0
- package/lib/views/png.js +162 -0
- package/lib/views/port.d.ts +74 -0
- package/lib/views/port.js +250 -0
- package/lib/views/pose.d.ts +113 -0
- package/lib/views/pose.js +433 -0
- package/lib/views/raster.d.ts +164 -0
- package/lib/views/raster.js +508 -0
- package/lib/views/renderer-id.d.ts +11 -0
- package/lib/views/renderer-id.js +29 -0
- package/lib/views/scene-raster.d.ts +41 -0
- package/lib/views/scene-raster.js +84 -0
- package/lib/views/surface-distance.d.ts +51 -0
- package/lib/views/surface-distance.js +343 -0
- package/lib/views/vehicle.d.ts +57 -0
- package/lib/views/vehicle.js +288 -0
- package/lib/wall-panels.d.ts +38 -0
- package/lib/wall-panels.js +99 -0
- package/lib/widget-transfer.d.ts +12 -0
- package/lib/widget-transfer.js +117 -0
- package/lib/workspace-location.d.ts +6 -0
- package/lib/workspace-location.js +16 -0
- package/lib/workspace-node.d.ts +15 -0
- package/lib/workspace-node.js +74 -0
- package/lib/workspace.d.ts +26 -0
- package/lib/workspace.js +22 -0
- package/lib/written-nodes.d.ts +10 -0
- package/lib/written-nodes.js +32 -0
- package/package.json +385 -4
- package/plugin.json +16 -0
- package/plugins/kiln-engine/.claude-plugin/plugin.json +18 -0
- package/plugins/kiln-engine/LICENSE +21 -0
- package/plugins/kiln-engine/README.md +25 -0
- package/plugins/kiln-engine/package-provenance.json +15 -0
- package/plugins/kiln-engine/plugin.json +38 -0
- package/plugins/kiln-engine/runtime.json +4 -0
- package/plugins/kiln-engine/scripts/setup-workspace.mjs +337 -0
- package/plugins/kiln-engine/skills/kiln-setup-workspace/SKILL.md +108 -0
- package/plugins/kiln-engine/skills/kiln-setup-workspace/references/plugin-install.md +66 -0
- package/render-service/README.md +139 -0
- package/render-service/package-lock.json +72 -0
- package/render-service/package.json +22 -0
- package/render-service/src/backdrops.mjs +26 -0
- package/render-service/src/bind-policy.mjs +80 -0
- package/render-service/src/build-identity.mjs +83 -0
- package/render-service/src/cache-identity.mjs +65 -0
- package/render-service/src/contract.mjs +494 -0
- package/render-service/src/display-output.mjs +18 -0
- package/render-service/src/display-transform.mjs +192 -0
- package/render-service/src/framing.mjs +114 -0
- package/render-service/src/glb-input.mjs +259 -0
- package/render-service/src/gpu.mjs +101 -0
- package/render-service/src/health-contract.mjs +40 -0
- package/render-service/src/instance.mjs +146 -0
- package/render-service/src/node-visibility.mjs +49 -0
- package/render-service/src/png-input.mjs +77 -0
- package/render-service/src/presentation-presets.mjs +216 -0
- package/render-service/src/readback.mjs +16 -0
- package/render-service/src/register-hooks.mjs +2 -0
- package/render-service/src/render-queue.mjs +144 -0
- package/render-service/src/renderer.mjs +473 -0
- package/render-service/src/request-limits.mjs +72 -0
- package/render-service/src/review-tone-mapping.mjs +55 -0
- package/render-service/src/server.mjs +387 -0
- package/render-service/src/three-alias-hooks.mjs +6 -0
- package/scripts/create-workspace.mjs +808 -0
- package/scripts/package-plugin.mjs +67 -0
- package/skills/kiln-author-asset/SKILL.md +104 -0
- package/skills/kiln-author-asset/references/camera-cli.md +33 -0
- package/skills/kiln-author-asset/references/camera-recipes.md +73 -0
- package/skills/kiln-author-asset/references/export-profiles.md +216 -0
- package/skills/kiln-author-asset/references/geometry-recipes.md +329 -0
- package/skills/kiln-author-asset/references/program-contract.md +44 -0
- package/skills/kiln-author-asset/references/projects-and-materials.md +158 -0
- package/skills/kiln-author-asset/references/reusable-frame.kiln.js +32 -0
- package/skills/kiln-batch-dispatch/SKILL.md +22 -0
- package/skills/kiln-batch-dispatch/references/clean-room-evaluation.md +35 -0
- package/skills/kiln-compose-scene/SKILL.md +38 -0
- package/skills/kiln-compose-scene/references/composition-api.md +29 -0
- package/skills/kiln-compose-scene/references/runtime-scenes.md +363 -0
- package/skills/kiln-qa-asset/SKILL.md +99 -0
- package/skills/kiln-qa-asset/references/engine-handoff.md +246 -0
- package/skills/kiln-qa-asset/references/integration-checks.md +96 -0
- package/skills/kiln-refine-asset/SKILL.md +136 -0
- package/skills/kiln-refine-asset/references/revision-and-views.md +205 -0
- package/skills/kiln-refine-asset/references/revision-cli.md +39 -0
- package/skills/kiln-setup-workspace/SKILL.md +108 -0
- package/skills/kiln-setup-workspace/references/plugin-install.md +66 -0
- package/src/agent/call-budget.ts +106 -0
- package/src/agent/compaction.ts +197 -0
- package/src/agent/concurrency.ts +30 -0
- package/src/agent/diff.ts +141 -0
- package/src/agent/generate.ts +448 -0
- package/src/agent/hooks.ts +204 -0
- package/src/agent/index.ts +114 -0
- package/src/agent/native-prompt.ts +51 -0
- package/src/agent/native-workflow.ts +33 -0
- package/src/agent/providers.ts +529 -0
- package/src/agent/run.ts +356 -0
- package/src/agent/skill-resources.ts +198 -0
- package/src/agent/split-tool-result-images.ts +80 -0
- package/src/agent/stream-start.ts +61 -0
- package/src/agent/tools.ts +113 -0
- package/src/agent/view-render-timeout.ts +110 -0
- package/src/animation-cli.ts +251 -0
- package/src/animation-cubic.ts +57 -0
- package/src/animation-spline.ts +183 -0
- package/src/architecture.ts +871 -0
- package/src/arena/adaptive.ts +119 -0
- package/src/arena/bradley-terry.ts +221 -0
- package/src/arena/index.ts +21 -0
- package/src/assembly-transform.ts +34 -0
- package/src/assembly.ts +762 -0
- package/src/asset-catalog.ts +30 -0
- package/src/asset-cli.ts +505 -0
- package/src/asset-export.ts +141 -0
- package/src/asset-materials-node.ts +78 -0
- package/src/asset-viewer.ts +160 -0
- package/src/asset-widget-uri.ts +9 -0
- package/src/asset-widget.ts +38 -0
- package/src/assets-node.ts +412 -0
- package/src/assets-resources.ts +137 -0
- package/src/assets.ts +252 -0
- package/src/atomic-directory.ts +45 -0
- package/src/authoring-style.ts +49 -0
- package/src/breadth-prompt.ts +79 -0
- package/src/build-cache-node.ts +99 -0
- package/src/build-cache.ts +253 -0
- package/src/character.ts +776 -0
- package/src/cli-json.ts +29 -0
- package/src/cli-output.ts +135 -0
- package/src/cli-render-mode.ts +270 -0
- package/src/cli.ts +809 -0
- package/src/community-exporter.ts +268 -0
- package/src/composer/agent/compaction.ts +146 -0
- package/src/composer/agent/index.ts +41 -0
- package/src/composer/agent/prompt.ts +126 -0
- package/src/composer/agent/run.ts +317 -0
- package/src/composer/agent/tools.ts +847 -0
- package/src/composer/agent/world-run.ts +421 -0
- package/src/composer/agent/world-tools.ts +411 -0
- package/src/composer/collision.ts +448 -0
- package/src/composer/contract-utils.ts +52 -0
- package/src/composer/dsl.ts +196 -0
- package/src/composer/ground.ts +27 -0
- package/src/composer/index.ts +19 -0
- package/src/composer/layout.ts +357 -0
- package/src/composer/model.ts +688 -0
- package/src/composer/overlap.ts +220 -0
- package/src/composer/presentation.ts +309 -0
- package/src/composer/reachability.ts +407 -0
- package/src/composer/render-port.ts +516 -0
- package/src/composer/terrain-runtime.ts +415 -0
- package/src/composer/terrain.ts +53 -0
- package/src/composer/world-document.ts +1019 -0
- package/src/composer/world-integration.ts +589 -0
- package/src/composer/world-package.ts +255 -0
- package/src/contracts/asset.ts +2030 -0
- package/src/contracts/breadth.ts +888 -0
- package/src/contracts/environment.ts +81 -0
- package/src/contracts/index.ts +5 -0
- package/src/contracts/integration.ts +100 -0
- package/src/contracts/requirements-migration.ts +536 -0
- package/src/contracts/requirements.ts +357 -0
- package/src/contracts/semantic.ts +544 -0
- package/src/deform.ts +215 -0
- package/src/deformation-normals.ts +84 -0
- package/src/direct-entry.ts +28 -0
- package/src/discovery/articulation-recipes.ts +190 -0
- package/src/discovery/catalog-schema.ts +125 -0
- package/src/discovery/catalog.ts +88 -0
- package/src/discovery/construction-recipes.ts +243 -0
- package/src/discovery/helper-contracts.ts +2388 -0
- package/src/discovery/helper-specs.ts +1046 -0
- package/src/discovery/index.ts +36 -0
- package/src/discovery/intents.ts +120 -0
- package/src/discovery/lexical-index.ts +72 -0
- package/src/discovery/query-schema.ts +71 -0
- package/src/discovery/recipes.ts +215 -0
- package/src/discovery/service.ts +329 -0
- package/src/discovery/shapes.ts +120 -0
- package/src/discovery/structural-recipes.ts +199 -0
- package/src/discovery/surface-recipes.ts +130 -0
- package/src/discovery-cli.ts +106 -0
- package/src/draw-diagnostics.ts +313 -0
- package/src/edit-buffer.ts +134 -0
- package/src/edit-cli.ts +125 -0
- package/src/engine-identity.ts +50 -0
- package/src/evaluator/authoring-diagnostic.ts +168 -0
- package/src/evaluator/handler.ts +114 -0
- package/src/evaluator/index.ts +50 -0
- package/src/evaluator/isolation.ts +454 -0
- package/src/evaluator/probe-invariants.ts +9 -0
- package/src/evaluator/probe-worker.ts +158 -0
- package/src/evaluator/protocol.ts +701 -0
- package/src/evaluator/source-check.ts +64 -0
- package/src/evaluator/subprocess.ts +294 -0
- package/src/evaluator/transport-worker.mjs +8 -0
- package/src/evaluator/worker-urls.ts +16 -0
- package/src/evaluator/worker.ts +26 -0
- package/src/experiments/geometry-acceptance.ts +278 -0
- package/src/experiments/geometry-frontier.ts +181 -0
- package/src/experiments/program-aliases.ts +96 -0
- package/src/experiments/run-w6-material-vegetation.ts +7 -0
- package/src/experiments/run-w7-vegetation-lod.ts +6 -0
- package/src/experiments/w6-material-vegetation.ts +772 -0
- package/src/experiments/w7-vegetation-lod.ts +335 -0
- package/src/exporter-node.ts +68 -0
- package/src/gears.ts +334 -0
- package/src/generated/mcp-manifest.json +2050 -0
- package/src/geometry-budget.ts +50 -0
- package/src/geometry-catalog.ts +215 -0
- package/src/geometry-export.ts +193 -0
- package/src/geometry.ts +379 -0
- package/src/gltf-io.ts +129 -0
- package/src/gltf-validator-shims.d.ts +12 -0
- package/src/implicit.ts +106 -0
- package/src/index-policy.ts +52 -0
- package/src/index.ts +5 -0
- package/src/inspect-cli.ts +198 -0
- package/src/inspect.ts +290 -0
- package/src/kit.ts +547 -0
- package/src/live-review-node.ts +1011 -0
- package/src/live-review.ts +55 -0
- package/src/local-runtime.ts +336 -0
- package/src/lod-export.ts +120 -0
- package/src/lod.ts +192 -0
- package/src/loopback.ts +6 -0
- package/src/material-library-node.ts +488 -0
- package/src/material-library.ts +481 -0
- package/src/material-metrics.ts +392 -0
- package/src/material-presets.ts +207 -0
- package/src/material-recipe-prompt.ts +99 -0
- package/src/material-recipe-runtime.ts +162 -0
- package/src/material-recipes.ts +748 -0
- package/src/material-resources.ts +640 -0
- package/src/material-texture-library.generated.ts +11408 -0
- package/src/mcp-core.ts +437 -0
- package/src/mcp-engine.ts +383 -0
- package/src/mcp-manifest.ts +104 -0
- package/src/mcp-server.ts +118 -0
- package/src/metrics.ts +277 -0
- package/src/migration-cli.ts +105 -0
- package/src/migration-rebuild.ts +265 -0
- package/src/node-visibility.ts +116 -0
- package/src/open-shell.ts +104 -0
- package/src/ops.ts +751 -0
- package/src/palette-snap.ts +209 -0
- package/src/palette.ts +307 -0
- package/src/portable-material-runtime.ts +109 -0
- package/src/primitives.ts +2299 -0
- package/src/procedural-material-v2.ts +720 -0
- package/src/procedural-texture.ts +427 -0
- package/src/profile.ts +485 -0
- package/src/program-store-node.ts +138 -0
- package/src/program-store.ts +116 -0
- package/src/project-bundle-node.ts +220 -0
- package/src/project-bundle.ts +392 -0
- package/src/project-cli.ts +248 -0
- package/src/projects-node.ts +270 -0
- package/src/projects.ts +274 -0
- package/src/prompt-api.ts +231 -0
- package/src/qa/architecture-corpus.ts +828 -0
- package/src/qa/architecture-repairs.ts +92 -0
- package/src/qa/architecture.ts +1358 -0
- package/src/qa/benchmark-fixtures.ts +441 -0
- package/src/qa/breadth-corpus.ts +168 -0
- package/src/qa/breadth-evidence.ts +595 -0
- package/src/qa/breadth-final.ts +453 -0
- package/src/qa/breadth.ts +690 -0
- package/src/qa/character-advisory.ts +596 -0
- package/src/qa/character-repairs.ts +185 -0
- package/src/qa/character-vehicle-corpus.ts +802 -0
- package/src/qa/character.ts +998 -0
- package/src/qa/corpus.ts +499 -0
- package/src/qa/environment.ts +903 -0
- package/src/qa/geometry-relations.ts +843 -0
- package/src/qa/gltf.ts +103 -0
- package/src/qa/index.ts +34 -0
- package/src/qa/lod.ts +28 -0
- package/src/qa/material.ts +302 -0
- package/src/qa/part-connectivity.ts +252 -0
- package/src/qa/prop-environment-prompt.ts +58 -0
- package/src/qa/prop-helper-policy.ts +118 -0
- package/src/qa/prop.ts +828 -0
- package/src/qa/reference-comparison.ts +495 -0
- package/src/qa/registry.ts +604 -0
- package/src/qa/requirements-applicability.ts +241 -0
- package/src/qa/requirements-report.ts +280 -0
- package/src/qa/requirements-run.ts +470 -0
- package/src/qa/run.ts +329 -0
- package/src/qa/self-intersection.ts +741 -0
- package/src/qa/sweep.ts +68 -0
- package/src/qa/types.ts +187 -0
- package/src/qa/universal.ts +506 -0
- package/src/qa/vegetation-corpus.ts +404 -0
- package/src/qa/vegetation.ts +1174 -0
- package/src/qa/vehicle-advisory.ts +468 -0
- package/src/qa/vehicle.ts +756 -0
- package/src/rebuild-options.ts +16 -0
- package/src/render-capabilities.ts +140 -0
- package/src/render-service-client.ts +297 -0
- package/src/render-service-host.ts +278 -0
- package/src/render-service-windows.ts +80 -0
- package/src/render.ts +2748 -0
- package/src/requirements-assets.ts +53 -0
- package/src/requirements-context.ts +170 -0
- package/src/requirements-file.ts +10 -0
- package/src/requirements-identity.ts +43 -0
- package/src/requirements-json.ts +65 -0
- package/src/requirements-store.ts +150 -0
- package/src/requirements.ts +4 -0
- package/src/review-cli.ts +81 -0
- package/src/revision-comparison.ts +425 -0
- package/src/rig-export.ts +29 -0
- package/src/rigid-merge.ts +691 -0
- package/src/runtime-identity.ts +207 -0
- package/src/runtime-support.mjs +20 -0
- package/src/service-cli.ts +210 -0
- package/src/solids.ts +650 -0
- package/src/source-bindings.ts +90 -0
- package/src/source-runtime-checks.ts +189 -0
- package/src/sweep-analysis.ts +168 -0
- package/src/sweep.ts +482 -0
- package/src/texture-bake.ts +526 -0
- package/src/texture-contract.ts +12 -0
- package/src/texture-resolver.ts +61 -0
- package/src/textures.ts +345 -0
- package/src/tools/actions.ts +124 -0
- package/src/tools/capture-input.ts +233 -0
- package/src/tools/discovery.ts +194 -0
- package/src/tools/materials.ts +206 -0
- package/src/tools/preview-fidelity.ts +31 -0
- package/src/tools/program-artifacts.ts +107 -0
- package/src/tools/programs.ts +190 -0
- package/src/tools/projects.ts +141 -0
- package/src/tools/registry.ts +3111 -0
- package/src/tools/review-detail.ts +788 -0
- package/src/tools/review.ts +269 -0
- package/src/tools/skill-resource.ts +9 -0
- package/src/tools/workspace.ts +112 -0
- package/src/user-data-extras.ts +181 -0
- package/src/user-data-validation.ts +211 -0
- package/src/uv-project.ts +185 -0
- package/src/uv-shapes.ts +63 -0
- package/src/uv.ts +301 -0
- package/src/validation.ts +1257 -0
- package/src/vegetation-prompt.ts +109 -0
- package/src/vehicle.ts +742 -0
- package/src/viewer/app.ts +666 -0
- package/src/viewer/attribution.ts +17 -0
- package/src/viewer/camera-state.ts +45 -0
- package/src/viewer/chat-app.ts +221 -0
- package/src/viewer/chat-download.ts +53 -0
- package/src/viewer/dashboard.ts +59 -0
- package/src/viewer/deep-link.ts +34 -0
- package/src/viewer/dom.ts +63 -0
- package/src/viewer/framing.ts +55 -0
- package/src/viewer/library-state.ts +34 -0
- package/src/viewer/live-panel.ts +742 -0
- package/src/viewer/live-state.ts +99 -0
- package/src/viewer/load-guard.ts +10 -0
- package/src/viewer/lod-control.ts +98 -0
- package/src/viewer/lod.ts +172 -0
- package/src/viewer/material-preset-form.ts +34 -0
- package/src/viewer/materials-panel.ts +335 -0
- package/src/viewer/membership-panel.ts +122 -0
- package/src/viewer/navigation.ts +9 -0
- package/src/viewer/performance-control.ts +75 -0
- package/src/viewer/performance.ts +61 -0
- package/src/viewer/project-editor.ts +37 -0
- package/src/viewer/project-membership.ts +20 -0
- package/src/viewer/projects-panel.ts +374 -0
- package/src/viewer/scene.ts +426 -0
- package/src/viewer/visibility.ts +73 -0
- package/src/views/annotate.ts +138 -0
- package/src/views/architecture.ts +77 -0
- package/src/views/background.ts +87 -0
- package/src/views/camera-capture.ts +143 -0
- package/src/views/camera.ts +622 -0
- package/src/views/capture-cache.ts +272 -0
- package/src/views/capture-limits.ts +73 -0
- package/src/views/capture.ts +300 -0
- package/src/views/character-capture.ts +279 -0
- package/src/views/character.ts +267 -0
- package/src/views/diagnostic.ts +853 -0
- package/src/views/evidence-history.ts +166 -0
- package/src/views/glb.ts +747 -0
- package/src/views/grid.ts +118 -0
- package/src/views/index.ts +1071 -0
- package/src/views/inspect.ts +296 -0
- package/src/views/lod.ts +117 -0
- package/src/views/measurement.ts +69 -0
- package/src/views/part-placement.ts +50 -0
- package/src/views/png.ts +175 -0
- package/src/views/port.ts +335 -0
- package/src/views/pose.ts +541 -0
- package/src/views/raster.ts +627 -0
- package/src/views/renderer-id.ts +31 -0
- package/src/views/scene-raster.ts +139 -0
- package/src/views/surface-distance.ts +403 -0
- package/src/views/vehicle.ts +431 -0
- package/src/wall-panels.ts +127 -0
- package/src/widget-transfer.ts +115 -0
- package/src/workspace-cli.ts +41 -0
- package/src/workspace-http.ts +219 -0
- package/src/workspace-location.ts +20 -0
- package/src/workspace-node.ts +91 -0
- package/src/workspace.ts +43 -0
- package/src/written-nodes.ts +39 -0
- package/src/xatlasjs-shims.d.ts +16 -0
|
@@ -0,0 +1,1358 @@
|
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
|
|
3
|
+
import { readSemanticMetadataV1FromExtras, type SemanticRelationshipV1 } from '../contracts';
|
|
4
|
+
import type { AssetRequirementsV1 } from '../contracts/requirements';
|
|
5
|
+
import { withArchitectureRepair } from './architecture-repairs';
|
|
6
|
+
import { conformancePromotionAuthorization, KILN_ENGINE_QA_OWNER, type QaRule } from './registry';
|
|
7
|
+
import type { QaContext, QaFinding } from './types';
|
|
8
|
+
|
|
9
|
+
export type StructureRequirements = Extract<
|
|
10
|
+
NonNullable<AssetRequirementsV1['requirements']['structure']>,
|
|
11
|
+
{ value: unknown }
|
|
12
|
+
>['value'];
|
|
13
|
+
export interface StructureQaInput {
|
|
14
|
+
scene?: unknown;
|
|
15
|
+
profile?: string;
|
|
16
|
+
structure?: StructureRequirements;
|
|
17
|
+
opening?: boolean;
|
|
18
|
+
}
|
|
19
|
+
type MeasuredRoof = StructureRequirements & {
|
|
20
|
+
footprint: NonNullable<StructureRequirements['footprint']>;
|
|
21
|
+
roof: NonNullable<StructureRequirements['roof']> & {
|
|
22
|
+
ridgeAxis: 'x' | 'z';
|
|
23
|
+
rise: number;
|
|
24
|
+
overhang: number;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
function hasRoofDimensions(value: StructureRequirements): value is MeasuredRoof {
|
|
28
|
+
return (
|
|
29
|
+
value.footprint !== undefined &&
|
|
30
|
+
value.roof?.ridgeAxis !== undefined &&
|
|
31
|
+
value.roof.rise !== undefined &&
|
|
32
|
+
value.roof.overhang !== undefined
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
type Axis = 'x' | 'y' | 'z';
|
|
37
|
+
type HorizontalAxis = 'x' | 'z';
|
|
38
|
+
|
|
39
|
+
interface Bounds3 {
|
|
40
|
+
min: THREE.Vector3;
|
|
41
|
+
max: THREE.Vector3;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
interface ArchitectureTriangle {
|
|
45
|
+
a: THREE.Vector3;
|
|
46
|
+
b: THREE.Vector3;
|
|
47
|
+
c: THREE.Vector3;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
interface ArchitecturePart {
|
|
51
|
+
node: THREE.Object3D;
|
|
52
|
+
nodeName: string;
|
|
53
|
+
nodePath: string;
|
|
54
|
+
directRoles: readonly string[];
|
|
55
|
+
directRelationships: readonly SemanticRelationshipV1[];
|
|
56
|
+
roles: readonly string[];
|
|
57
|
+
isMesh: boolean;
|
|
58
|
+
bounds: Bounds3;
|
|
59
|
+
vertices: readonly THREE.Vector3[];
|
|
60
|
+
triangles: readonly ArchitectureTriangle[];
|
|
61
|
+
/** Normal of the geometry's thinnest local axis, expressed asset-locally. */
|
|
62
|
+
planeNormal?: THREE.Vector3;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
interface ArchitectureSceneEvidence {
|
|
66
|
+
root: THREE.Object3D;
|
|
67
|
+
parts: ArchitecturePart[];
|
|
68
|
+
semanticRoles: Set<string>;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
interface ArchitectureAggregate {
|
|
72
|
+
parts: ArchitecturePart[];
|
|
73
|
+
bounds: Bounds3;
|
|
74
|
+
vertices: THREE.Vector3[];
|
|
75
|
+
triangles: ArchitectureTriangle[];
|
|
76
|
+
normals: THREE.Vector3[];
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
const PROFILE_RULE_ID = 'ARCHITECTURE_PROFILE';
|
|
80
|
+
const EPSILON = 1e-6;
|
|
81
|
+
|
|
82
|
+
export const ARCHITECTURE_REALISTIC_SCALE_BANDS = Object.freeze({
|
|
83
|
+
doorWidth: Object.freeze({ minimum: 0.75, maximum: 2.5, unit: 'm' as const }),
|
|
84
|
+
doorHeight: Object.freeze({ minimum: 1.8, maximum: 3.2, unit: 'm' as const }),
|
|
85
|
+
ceilingHeight: Object.freeze({ minimum: 2.1, maximum: 6, unit: 'm' as const }),
|
|
86
|
+
stairRiser: Object.freeze({ minimum: 0.1, maximum: 0.25, unit: 'm' as const }),
|
|
87
|
+
stairTread: Object.freeze({ minimum: 0.2, maximum: 0.45, unit: 'm' as const }),
|
|
88
|
+
wallThickness: Object.freeze({ minimum: 0.05, maximum: 0.6, unit: 'm' as const }),
|
|
89
|
+
footprint: Object.freeze({ minimum: 1.5, maximum: 200, unit: 'm' as const }),
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
const emptyBounds = (): Bounds3 => ({
|
|
93
|
+
min: new THREE.Vector3(Infinity, Infinity, Infinity),
|
|
94
|
+
max: new THREE.Vector3(-Infinity, -Infinity, -Infinity),
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
const expandBounds = (bounds: Bounds3, point: THREE.Vector3): void => {
|
|
98
|
+
bounds.min.min(point);
|
|
99
|
+
bounds.max.max(point);
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
const boundsFinite = (bounds: Bounds3): boolean => Number.isFinite(bounds.min.x);
|
|
103
|
+
|
|
104
|
+
const extent = (bounds: Bounds3, axis: Axis): number => bounds.max[axis] - bounds.min[axis];
|
|
105
|
+
|
|
106
|
+
function semanticMetadata(node: THREE.Object3D) {
|
|
107
|
+
return readSemanticMetadataV1FromExtras(node.userData);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
function markerBounds(matrix: THREE.Matrix4): Bounds3 {
|
|
111
|
+
const bounds = emptyBounds();
|
|
112
|
+
for (let corner = 0; corner < 8; corner++) {
|
|
113
|
+
expandBounds(
|
|
114
|
+
bounds,
|
|
115
|
+
new THREE.Vector3(
|
|
116
|
+
corner & 1 ? 0.5 : -0.5,
|
|
117
|
+
corner & 2 ? 0.5 : -0.5,
|
|
118
|
+
corner & 4 ? 0.5 : -0.5,
|
|
119
|
+
).applyMatrix4(matrix),
|
|
120
|
+
);
|
|
121
|
+
}
|
|
122
|
+
return bounds;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
function geometryPlaneNormal(
|
|
126
|
+
geometry: THREE.BufferGeometry,
|
|
127
|
+
relativeMatrix: THREE.Matrix4,
|
|
128
|
+
): THREE.Vector3 | undefined {
|
|
129
|
+
geometry.computeBoundingBox();
|
|
130
|
+
const local = geometry.boundingBox;
|
|
131
|
+
if (!local) return undefined;
|
|
132
|
+
const size = local.getSize(new THREE.Vector3());
|
|
133
|
+
const dimensions: Array<[Axis, number]> = [
|
|
134
|
+
['x', size.x],
|
|
135
|
+
['y', size.y],
|
|
136
|
+
['z', size.z],
|
|
137
|
+
];
|
|
138
|
+
dimensions.sort((a, b) => a[1] - b[1]);
|
|
139
|
+
const axis = dimensions[0]?.[0];
|
|
140
|
+
if (!axis) return undefined;
|
|
141
|
+
const normal = new THREE.Vector3(
|
|
142
|
+
axis === 'x' ? 1 : 0,
|
|
143
|
+
axis === 'y' ? 1 : 0,
|
|
144
|
+
axis === 'z' ? 1 : 0,
|
|
145
|
+
).transformDirection(relativeMatrix);
|
|
146
|
+
if (normal.y < 0) normal.multiplyScalar(-1);
|
|
147
|
+
return normal.normalize();
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
function geometryEvidence(
|
|
151
|
+
geometry: THREE.BufferGeometry,
|
|
152
|
+
relativeMatrix: THREE.Matrix4,
|
|
153
|
+
): {
|
|
154
|
+
bounds: Bounds3;
|
|
155
|
+
vertices: THREE.Vector3[];
|
|
156
|
+
triangles: ArchitectureTriangle[];
|
|
157
|
+
planeNormal?: THREE.Vector3;
|
|
158
|
+
} {
|
|
159
|
+
const position = geometry.getAttribute('position');
|
|
160
|
+
const bounds = emptyBounds();
|
|
161
|
+
const vertices: THREE.Vector3[] = [];
|
|
162
|
+
if (position?.itemSize !== 3) return { bounds, vertices, triangles: [] };
|
|
163
|
+
|
|
164
|
+
for (let index = 0; index < position.count; index++) {
|
|
165
|
+
const point = new THREE.Vector3(
|
|
166
|
+
position.getX(index),
|
|
167
|
+
position.getY(index),
|
|
168
|
+
position.getZ(index),
|
|
169
|
+
);
|
|
170
|
+
point.applyMatrix4(relativeMatrix);
|
|
171
|
+
vertices.push(point);
|
|
172
|
+
expandBounds(bounds, point);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
const triangles: ArchitectureTriangle[] = [];
|
|
176
|
+
const indices = geometry.getIndex();
|
|
177
|
+
const addTriangle = (a: number, b: number, c: number): void => {
|
|
178
|
+
const va = vertices[a];
|
|
179
|
+
const vb = vertices[b];
|
|
180
|
+
const vc = vertices[c];
|
|
181
|
+
if (va && vb && vc) triangles.push({ a: va, b: vb, c: vc });
|
|
182
|
+
};
|
|
183
|
+
if (indices) {
|
|
184
|
+
for (let index = 0; index + 2 < indices.count; index += 3) {
|
|
185
|
+
addTriangle(indices.getX(index), indices.getX(index + 1), indices.getX(index + 2));
|
|
186
|
+
}
|
|
187
|
+
} else {
|
|
188
|
+
for (let index = 0; index + 2 < vertices.length; index += 3) {
|
|
189
|
+
addTriangle(index, index + 1, index + 2);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
const planeNormal = geometryPlaneNormal(geometry, relativeMatrix);
|
|
194
|
+
return { bounds, vertices, triangles, ...(planeNormal ? { planeNormal } : {}) };
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
function collectArchitectureEvidence(scene: unknown): ArchitectureSceneEvidence | undefined {
|
|
198
|
+
if (!(scene instanceof THREE.Object3D)) return undefined;
|
|
199
|
+
scene.updateMatrixWorld(true);
|
|
200
|
+
const rootInverse = scene.matrixWorld.clone().invert();
|
|
201
|
+
const parts: ArchitecturePart[] = [];
|
|
202
|
+
const allRoles = new Set<string>();
|
|
203
|
+
|
|
204
|
+
const visit = (
|
|
205
|
+
node: THREE.Object3D,
|
|
206
|
+
parentPath: string,
|
|
207
|
+
siblingIndex: number,
|
|
208
|
+
inheritedRoles: readonly string[],
|
|
209
|
+
): void => {
|
|
210
|
+
if (!node.visible) return;
|
|
211
|
+
const metadata = semanticMetadata(node);
|
|
212
|
+
const directRoles = metadata?.roles ?? [];
|
|
213
|
+
const directRelationships = metadata?.relationships ?? [];
|
|
214
|
+
directRoles.forEach((role) => {
|
|
215
|
+
allRoles.add(role);
|
|
216
|
+
});
|
|
217
|
+
const roles = [...new Set([...inheritedRoles, ...directRoles])];
|
|
218
|
+
const segment = `${node.name.trim() || node.type || 'Object3D'}[${siblingIndex}]`;
|
|
219
|
+
const nodePath = parentPath ? `${parentPath}/${segment}` : segment;
|
|
220
|
+
const relativeMatrix = rootInverse.clone().multiply(node.matrixWorld);
|
|
221
|
+
const mesh = node as THREE.Mesh;
|
|
222
|
+
const isMesh = mesh.isMesh === true && mesh.geometry instanceof THREE.BufferGeometry;
|
|
223
|
+
const evidence = isMesh
|
|
224
|
+
? geometryEvidence(mesh.geometry, relativeMatrix)
|
|
225
|
+
: {
|
|
226
|
+
bounds: markerBounds(relativeMatrix),
|
|
227
|
+
vertices: [] as THREE.Vector3[],
|
|
228
|
+
triangles: [] as ArchitectureTriangle[],
|
|
229
|
+
};
|
|
230
|
+
|
|
231
|
+
if (isMesh || directRoles.length > 0) {
|
|
232
|
+
parts.push({
|
|
233
|
+
node,
|
|
234
|
+
nodeName: node.name || node.type,
|
|
235
|
+
nodePath,
|
|
236
|
+
directRoles,
|
|
237
|
+
directRelationships,
|
|
238
|
+
roles,
|
|
239
|
+
isMesh,
|
|
240
|
+
...evidence,
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
node.children.forEach((child, index) => {
|
|
244
|
+
visit(child, nodePath, index, roles);
|
|
245
|
+
});
|
|
246
|
+
};
|
|
247
|
+
|
|
248
|
+
visit(scene, '', 0, []);
|
|
249
|
+
return { root: scene, parts, semanticRoles: allRoles };
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
const hasRole = (part: ArchitecturePart, role: string): boolean => part.roles.includes(role);
|
|
253
|
+
|
|
254
|
+
const hasRolePrefix = (part: ArchitecturePart, prefix: string): boolean =>
|
|
255
|
+
part.roles.some((role) => role.startsWith(prefix));
|
|
256
|
+
|
|
257
|
+
function aggregate(parts: readonly ArchitecturePart[]): ArchitectureAggregate | undefined {
|
|
258
|
+
if (parts.length === 0) return undefined;
|
|
259
|
+
const bounds = emptyBounds();
|
|
260
|
+
const vertices: THREE.Vector3[] = [];
|
|
261
|
+
const triangles: ArchitectureTriangle[] = [];
|
|
262
|
+
const normals: THREE.Vector3[] = [];
|
|
263
|
+
for (const part of parts) {
|
|
264
|
+
if (boundsFinite(part.bounds)) {
|
|
265
|
+
expandBounds(bounds, part.bounds.min);
|
|
266
|
+
expandBounds(bounds, part.bounds.max);
|
|
267
|
+
}
|
|
268
|
+
vertices.push(...part.vertices);
|
|
269
|
+
triangles.push(...part.triangles);
|
|
270
|
+
if (part.planeNormal) normals.push(part.planeNormal);
|
|
271
|
+
}
|
|
272
|
+
if (!boundsFinite(bounds)) return undefined;
|
|
273
|
+
return { parts: [...parts], bounds, vertices, triangles, normals };
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
function aggregateRole(
|
|
277
|
+
evidence: ArchitectureSceneEvidence,
|
|
278
|
+
role: string,
|
|
279
|
+
): ArchitectureAggregate | undefined {
|
|
280
|
+
return aggregate(evidence.parts.filter((part) => hasRole(part, role)));
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
function architectureFinding(
|
|
284
|
+
context: StructureQaInput,
|
|
285
|
+
value: Omit<QaFinding, 'profile' | 'dimension'>,
|
|
286
|
+
): QaFinding {
|
|
287
|
+
return withArchitectureRepair({
|
|
288
|
+
...value,
|
|
289
|
+
profile: context.profile ?? 'asset.requirements.v1',
|
|
290
|
+
dimension: 'categoryReadiness',
|
|
291
|
+
});
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
function averageNormal(normals: readonly THREE.Vector3[]): THREE.Vector3 | undefined {
|
|
295
|
+
if (normals.length === 0) return undefined;
|
|
296
|
+
const result = normals.reduce((sum, normal) => sum.add(normal), new THREE.Vector3());
|
|
297
|
+
return result.lengthSq() > EPSILON ? result.normalize() : undefined;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
function intervalCoverage(
|
|
301
|
+
min: number,
|
|
302
|
+
max: number,
|
|
303
|
+
expectedMin: number,
|
|
304
|
+
expectedMax: number,
|
|
305
|
+
): number {
|
|
306
|
+
const expected = expectedMax - expectedMin;
|
|
307
|
+
if (expected <= EPSILON) return 1;
|
|
308
|
+
return Math.max(0, Math.min(max, expectedMax) - Math.max(min, expectedMin)) / expected;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
function intervalSeparation(aMin: number, aMax: number, bMin: number, bMax: number): number {
|
|
312
|
+
if (aMax < bMin) return bMin - aMax;
|
|
313
|
+
if (bMax < aMin) return aMin - bMax;
|
|
314
|
+
return 0;
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
function requestedGable(architecture: StructureRequirements): boolean {
|
|
318
|
+
return architecture.roof?.type === 'gable';
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
function taggedGable(evidence: ArchitectureSceneEvidence): boolean {
|
|
322
|
+
return [...evidence.semanticRoles].some(
|
|
323
|
+
(role) =>
|
|
324
|
+
role === 'architecture.shell.gable' ||
|
|
325
|
+
role.startsWith('roof.slope.') ||
|
|
326
|
+
role.startsWith('roof.gable.'),
|
|
327
|
+
);
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
function highEdgeVertices(aggregateValue: ArchitectureAggregate, rise: number): THREE.Vector3[] {
|
|
331
|
+
const band = Math.max(0.006, rise * 0.02);
|
|
332
|
+
const maximumY = aggregateValue.bounds.max.y;
|
|
333
|
+
return aggregateValue.vertices.filter((point) => point.y >= maximumY - band);
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
function ridgeCrossSectionDistance(
|
|
337
|
+
positive: ArchitectureAggregate,
|
|
338
|
+
negative: ArchitectureAggregate,
|
|
339
|
+
lateralAxis: HorizontalAxis,
|
|
340
|
+
rise: number,
|
|
341
|
+
): number {
|
|
342
|
+
const a = highEdgeVertices(positive, rise);
|
|
343
|
+
const b = highEdgeVertices(negative, rise);
|
|
344
|
+
let distance = Infinity;
|
|
345
|
+
for (const pointA of a) {
|
|
346
|
+
for (const pointB of b) {
|
|
347
|
+
distance = Math.min(
|
|
348
|
+
distance,
|
|
349
|
+
Math.hypot(pointA[lateralAxis] - pointB[lateralAxis], pointA.y - pointB.y),
|
|
350
|
+
);
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
return distance;
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
function roofFindings(
|
|
357
|
+
context: StructureQaInput,
|
|
358
|
+
architecture: StructureRequirements,
|
|
359
|
+
evidence: ArchitectureSceneEvidence,
|
|
360
|
+
): QaFinding[] {
|
|
361
|
+
if (!requestedGable(architecture)) return [];
|
|
362
|
+
const positive = aggregateRole(evidence, 'roof.slope.positive');
|
|
363
|
+
const negative = aggregateRole(evidence, 'roof.slope.negative');
|
|
364
|
+
const tagged = taggedGable(evidence);
|
|
365
|
+
const exactDisposition = tagged ? ('block' as const) : ('warn' as const);
|
|
366
|
+
const findings: QaFinding[] = [];
|
|
367
|
+
|
|
368
|
+
if (!positive || !negative) {
|
|
369
|
+
findings.push(
|
|
370
|
+
architectureFinding(context, {
|
|
371
|
+
code: 'ARCH_ROOF_AXIS',
|
|
372
|
+
disposition: exactDisposition,
|
|
373
|
+
message: `A gable requires exactly two semantic slope roles; found ${positive ? 1 : 0} positive and ${negative ? 1 : 0} negative slope surfaces.`,
|
|
374
|
+
measurement: {
|
|
375
|
+
name: 'semanticSlopeRoleCount',
|
|
376
|
+
actual: Number(Boolean(positive)) + Number(Boolean(negative)),
|
|
377
|
+
expected: 2,
|
|
378
|
+
threshold: 2,
|
|
379
|
+
},
|
|
380
|
+
affected: { node: evidence.root.name || 'architecture-root' },
|
|
381
|
+
}),
|
|
382
|
+
);
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
const semanticRoofRoles = [...evidence.semanticRoles].filter((role) => role.startsWith('roof.'));
|
|
386
|
+
if (semanticRoofRoles.length === 0) {
|
|
387
|
+
const inferredRoof = evidence.parts.find(
|
|
388
|
+
(part) => part.isMesh && /(?:^|[_ .-])roof(?:$|[_ .-])/i.test(part.nodeName),
|
|
389
|
+
);
|
|
390
|
+
findings.push(
|
|
391
|
+
architectureFinding(context, {
|
|
392
|
+
code: 'ARCH_MISSING_ROOF_ROLES',
|
|
393
|
+
disposition: 'warn',
|
|
394
|
+
message:
|
|
395
|
+
'The architecture has no portable roof.* semantic roles, so ridge, coverage, diagnostic cutaway, and separability checks cannot be exact.',
|
|
396
|
+
affected: inferredRoof
|
|
397
|
+
? { node: inferredRoof.nodeName, nodePath: inferredRoof.nodePath }
|
|
398
|
+
: { node: evidence.root.name || 'architecture-root' },
|
|
399
|
+
viewHints: ['generic.top.semantic-overlay', 'architecture.cutaway.dollhouse'],
|
|
400
|
+
repairText:
|
|
401
|
+
'Build the roof with the gable shell helper or stamp roof.slope.positive/negative and roof.gable.positive/negative roles plus separable-from relationships.',
|
|
402
|
+
}),
|
|
403
|
+
);
|
|
404
|
+
return findings;
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
if (!positive || !negative || !hasRoofDimensions(architecture)) return findings;
|
|
408
|
+
|
|
409
|
+
const ridgeAxis = architecture.roof.ridgeAxis;
|
|
410
|
+
const lateralAxis: HorizontalAxis = ridgeAxis === 'x' ? 'z' : 'x';
|
|
411
|
+
const positiveNormal = averageNormal(positive.normals);
|
|
412
|
+
const negativeNormal = averageNormal(negative.normals);
|
|
413
|
+
const lateralProduct =
|
|
414
|
+
positiveNormal && negativeNormal
|
|
415
|
+
? positiveNormal[lateralAxis] * negativeNormal[lateralAxis]
|
|
416
|
+
: null;
|
|
417
|
+
if (lateralProduct === null || lateralProduct >= -0.0025) {
|
|
418
|
+
findings.push(
|
|
419
|
+
architectureFinding(context, {
|
|
420
|
+
code: 'ARCH_ROOF_AXIS',
|
|
421
|
+
disposition: exactDisposition,
|
|
422
|
+
message:
|
|
423
|
+
'The two semantic gable slopes do not face opposite downhill directions in the declared roof-local frame.',
|
|
424
|
+
affected: { node: negative.parts[0]?.nodeName ?? 'roof.slope.negative' },
|
|
425
|
+
measurement: {
|
|
426
|
+
name: 'slopeLateralNormalProduct',
|
|
427
|
+
actual: lateralProduct,
|
|
428
|
+
expected: '< -0.0025',
|
|
429
|
+
threshold: -0.0025,
|
|
430
|
+
},
|
|
431
|
+
}),
|
|
432
|
+
);
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
const { spanX, spanZ } = architecture.footprint;
|
|
436
|
+
const expectedRidgeSpan = (ridgeAxis === 'x' ? spanX : spanZ) + architecture.roof.overhang * 2;
|
|
437
|
+
const expectedLateralSpan =
|
|
438
|
+
(lateralAxis === 'x' ? spanX : spanZ) + architecture.roof.overhang * 2;
|
|
439
|
+
const ridgeCoverage = Math.min(
|
|
440
|
+
extent(positive.bounds, ridgeAxis) / expectedRidgeSpan,
|
|
441
|
+
extent(negative.bounds, ridgeAxis) / expectedRidgeSpan,
|
|
442
|
+
);
|
|
443
|
+
const roofMinLateral = Math.min(
|
|
444
|
+
positive.bounds.min[lateralAxis],
|
|
445
|
+
negative.bounds.min[lateralAxis],
|
|
446
|
+
);
|
|
447
|
+
const roofMaxLateral = Math.max(
|
|
448
|
+
positive.bounds.max[lateralAxis],
|
|
449
|
+
negative.bounds.max[lateralAxis],
|
|
450
|
+
);
|
|
451
|
+
const lateralCoverage = intervalCoverage(
|
|
452
|
+
roofMinLateral,
|
|
453
|
+
roofMaxLateral,
|
|
454
|
+
-expectedLateralSpan / 2,
|
|
455
|
+
expectedLateralSpan / 2,
|
|
456
|
+
);
|
|
457
|
+
if (ridgeCoverage < 0.9 || lateralCoverage < 0.9) {
|
|
458
|
+
const actual = Math.min(ridgeCoverage, lateralCoverage);
|
|
459
|
+
findings.push(
|
|
460
|
+
architectureFinding(context, {
|
|
461
|
+
code: 'ARCH_ROOF_AXIS',
|
|
462
|
+
disposition: exactDisposition,
|
|
463
|
+
message: `The semantic slopes cover ${(ridgeCoverage * 100).toFixed(1)}% of the ridge span and ${(lateralCoverage * 100).toFixed(1)}% of the ridge-to-eave span.`,
|
|
464
|
+
measurement: {
|
|
465
|
+
name: 'minimumRoofFootprintCoverageRatio',
|
|
466
|
+
actual,
|
|
467
|
+
expected: '>= 0.9',
|
|
468
|
+
threshold: 0.9,
|
|
469
|
+
},
|
|
470
|
+
affected: { node: positive.parts[0]?.nodeName ?? 'roof.slope.positive' },
|
|
471
|
+
}),
|
|
472
|
+
);
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
const panels = evidence.parts.filter(
|
|
476
|
+
(part) =>
|
|
477
|
+
part.isMesh &&
|
|
478
|
+
(part.directRoles.some((role) => role.startsWith('roof.panel.')) ||
|
|
479
|
+
hasRole(part, 'roof.surface.panels') ||
|
|
480
|
+
(hasRolePrefix(part, 'roof.') && /panel|sheet|shingle|seam|corrugat/i.test(part.nodeName))),
|
|
481
|
+
);
|
|
482
|
+
const wrongPanel = panels.find((panel) => {
|
|
483
|
+
const ridgeExtent = extent(panel.bounds, ridgeAxis);
|
|
484
|
+
const downhillExtent = Math.hypot(extent(panel.bounds, lateralAxis), extent(panel.bounds, 'y'));
|
|
485
|
+
return ridgeExtent > downhillExtent * 1.05;
|
|
486
|
+
});
|
|
487
|
+
if (wrongPanel) {
|
|
488
|
+
const ridgeExtent = extent(wrongPanel.bounds, ridgeAxis);
|
|
489
|
+
const downhillExtent = Math.hypot(
|
|
490
|
+
extent(wrongPanel.bounds, lateralAxis),
|
|
491
|
+
extent(wrongPanel.bounds, 'y'),
|
|
492
|
+
);
|
|
493
|
+
findings.push(
|
|
494
|
+
architectureFinding(context, {
|
|
495
|
+
code: 'ARCH_ROOF_AXIS',
|
|
496
|
+
disposition: exactDisposition,
|
|
497
|
+
message: `Roof panel ${wrongPanel.nodeName} runs along the ridge instead of ridge-to-eave.`,
|
|
498
|
+
affected: { node: wrongPanel.nodeName, nodePath: wrongPanel.nodePath },
|
|
499
|
+
measurement: {
|
|
500
|
+
name: 'panelRidgeToDownhillExtentRatio',
|
|
501
|
+
actual: ridgeExtent / Math.max(EPSILON, downhillExtent),
|
|
502
|
+
expected: '<= 1.05',
|
|
503
|
+
threshold: 1.05,
|
|
504
|
+
},
|
|
505
|
+
}),
|
|
506
|
+
);
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
const ridgeDistance = ridgeCrossSectionDistance(
|
|
510
|
+
positive,
|
|
511
|
+
negative,
|
|
512
|
+
lateralAxis,
|
|
513
|
+
architecture.roof.rise,
|
|
514
|
+
);
|
|
515
|
+
const ridgeTolerance = Math.max(0.04, expectedLateralSpan * 0.0125);
|
|
516
|
+
if (!Number.isFinite(ridgeDistance) || ridgeDistance > ridgeTolerance) {
|
|
517
|
+
findings.push(
|
|
518
|
+
architectureFinding(context, {
|
|
519
|
+
code: 'ARCH_RIDGE_GAP',
|
|
520
|
+
disposition: exactDisposition,
|
|
521
|
+
message: `The two slope high edges miss the declared ridge by ${Number.isFinite(ridgeDistance) ? ridgeDistance.toFixed(3) : 'an unmeasurable'} m.`,
|
|
522
|
+
affected: { node: negative.parts[0]?.nodeName ?? 'roof.slope.negative' },
|
|
523
|
+
measurement: {
|
|
524
|
+
name: 'ridgeCrossSectionGap',
|
|
525
|
+
actual: Number.isFinite(ridgeDistance) ? ridgeDistance : null,
|
|
526
|
+
expected: `<= ${ridgeTolerance}`,
|
|
527
|
+
threshold: ridgeTolerance,
|
|
528
|
+
unit: 'm',
|
|
529
|
+
},
|
|
530
|
+
}),
|
|
531
|
+
);
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
return findings;
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
function projectedGableArea(
|
|
538
|
+
aggregateValue: ArchitectureAggregate,
|
|
539
|
+
lateralAxis: HorizontalAxis,
|
|
540
|
+
): number {
|
|
541
|
+
let area = 0;
|
|
542
|
+
for (const triangle of aggregateValue.triangles) {
|
|
543
|
+
const abLateral = triangle.b[lateralAxis] - triangle.a[lateralAxis];
|
|
544
|
+
const abY = triangle.b.y - triangle.a.y;
|
|
545
|
+
const acLateral = triangle.c[lateralAxis] - triangle.a[lateralAxis];
|
|
546
|
+
const acY = triangle.c.y - triangle.a.y;
|
|
547
|
+
area += Math.abs(abLateral * acY - abY * acLateral) / 2;
|
|
548
|
+
}
|
|
549
|
+
return area;
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
function endFindings(
|
|
553
|
+
context: StructureQaInput,
|
|
554
|
+
architecture: StructureRequirements,
|
|
555
|
+
evidence: ArchitectureSceneEvidence,
|
|
556
|
+
): QaFinding[] {
|
|
557
|
+
if (!requestedGable(architecture) || !hasRoofDimensions(architecture)) return [];
|
|
558
|
+
const closedEnds = architecture.roof.closedEnds;
|
|
559
|
+
if (!closedEnds) return [];
|
|
560
|
+
|
|
561
|
+
const positive = aggregateRole(evidence, 'roof.gable.positive');
|
|
562
|
+
const negative = aggregateRole(evidence, 'roof.gable.negative');
|
|
563
|
+
const hasTaggedRoof = taggedGable(evidence);
|
|
564
|
+
const disposition = hasTaggedRoof ? ('block' as const) : ('warn' as const);
|
|
565
|
+
const ridgeAxis = architecture.roof.ridgeAxis;
|
|
566
|
+
const lateralAxis: HorizontalAxis = ridgeAxis === 'x' ? 'z' : 'x';
|
|
567
|
+
const lateralSpan =
|
|
568
|
+
lateralAxis === 'x' ? architecture.footprint.spanX : architecture.footprint.spanZ;
|
|
569
|
+
const ridgeSpan = ridgeAxis === 'x' ? architecture.footprint.spanX : architecture.footprint.spanZ;
|
|
570
|
+
const expectedArea = (lateralSpan * architecture.roof.rise) / 2;
|
|
571
|
+
const findings: QaFinding[] = [];
|
|
572
|
+
|
|
573
|
+
for (const [end, aggregateValue] of [
|
|
574
|
+
['positive', positive],
|
|
575
|
+
['negative', negative],
|
|
576
|
+
] as const) {
|
|
577
|
+
if (!aggregateValue) {
|
|
578
|
+
findings.push(
|
|
579
|
+
architectureFinding(context, {
|
|
580
|
+
code: 'ARCH_OPEN_GABLE',
|
|
581
|
+
disposition,
|
|
582
|
+
message: `closedEnds=true but roof.gable.${end} is missing.`,
|
|
583
|
+
affected: { node: `roof.gable.${end}` },
|
|
584
|
+
measurement: {
|
|
585
|
+
name: `${end}GableCoverageRatio`,
|
|
586
|
+
actual: 0,
|
|
587
|
+
expected: '>= 0.9 boundary coverage',
|
|
588
|
+
threshold: 0.9,
|
|
589
|
+
},
|
|
590
|
+
}),
|
|
591
|
+
);
|
|
592
|
+
continue;
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
const wallRole =
|
|
596
|
+
ridgeAxis === 'x'
|
|
597
|
+
? end === 'positive'
|
|
598
|
+
? 'wall.front'
|
|
599
|
+
: 'wall.back'
|
|
600
|
+
: end === 'positive'
|
|
601
|
+
? 'wall.right'
|
|
602
|
+
: 'wall.left';
|
|
603
|
+
const endWall = aggregate(
|
|
604
|
+
evidence.parts.filter((part) => part.isMesh && hasRole(part, wallRole)),
|
|
605
|
+
);
|
|
606
|
+
const gableCenter =
|
|
607
|
+
(aggregateValue.bounds.min[ridgeAxis] + aggregateValue.bounds.max[ridgeAxis]) / 2;
|
|
608
|
+
const expectedCenter = (end === 'positive' ? 1 : -1) * (ridgeSpan / 2);
|
|
609
|
+
const endSeparation = endWall
|
|
610
|
+
? intervalSeparation(
|
|
611
|
+
aggregateValue.bounds.min[ridgeAxis],
|
|
612
|
+
aggregateValue.bounds.max[ridgeAxis],
|
|
613
|
+
endWall.bounds.min[ridgeAxis],
|
|
614
|
+
endWall.bounds.max[ridgeAxis],
|
|
615
|
+
)
|
|
616
|
+
: Math.abs(gableCenter - expectedCenter);
|
|
617
|
+
const endTolerance = 0.05;
|
|
618
|
+
if (endSeparation > endTolerance) {
|
|
619
|
+
findings.push(
|
|
620
|
+
architectureFinding(context, {
|
|
621
|
+
code: 'ARCH_OPEN_GABLE',
|
|
622
|
+
disposition,
|
|
623
|
+
message: `roof.gable.${end} is ${endSeparation.toFixed(3)} m away from its ${wallRole} end boundary, so it does not close the shell.`,
|
|
624
|
+
affected: {
|
|
625
|
+
node: aggregateValue.parts[0]?.nodeName ?? `roof.gable.${end}`,
|
|
626
|
+
nodePath: aggregateValue.parts[0]?.nodePath,
|
|
627
|
+
},
|
|
628
|
+
measurement: {
|
|
629
|
+
name: `${end}GableEndSeparation`,
|
|
630
|
+
actual: endSeparation,
|
|
631
|
+
expected: `<= ${endTolerance}`,
|
|
632
|
+
threshold: endTolerance,
|
|
633
|
+
unit: 'm',
|
|
634
|
+
},
|
|
635
|
+
}),
|
|
636
|
+
);
|
|
637
|
+
continue;
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
const lateralCoverage = extent(aggregateValue.bounds, lateralAxis) / lateralSpan;
|
|
641
|
+
const heightCoverage = extent(aggregateValue.bounds, 'y') / architecture.roof.rise;
|
|
642
|
+
const areaCoverage =
|
|
643
|
+
expectedArea > EPSILON ? projectedGableArea(aggregateValue, lateralAxis) / expectedArea : 1;
|
|
644
|
+
const boundaryCoverage = Math.min(lateralCoverage, heightCoverage);
|
|
645
|
+
if (boundaryCoverage < 0.9 || areaCoverage < 0.45) {
|
|
646
|
+
findings.push(
|
|
647
|
+
architectureFinding(context, {
|
|
648
|
+
code: 'ARCH_OPEN_GABLE',
|
|
649
|
+
disposition,
|
|
650
|
+
message: `roof.gable.${end} is sparse: boundary coverage ${(boundaryCoverage * 100).toFixed(1)}%, projected filled area ${(areaCoverage * 100).toFixed(1)}%.`,
|
|
651
|
+
affected: {
|
|
652
|
+
node: aggregateValue.parts[0]?.nodeName ?? `roof.gable.${end}`,
|
|
653
|
+
nodePath: aggregateValue.parts[0]?.nodePath,
|
|
654
|
+
},
|
|
655
|
+
measurement: {
|
|
656
|
+
name: `${end}GableMinimumCoverageRatio`,
|
|
657
|
+
actual: Math.min(boundaryCoverage, areaCoverage / 0.5),
|
|
658
|
+
expected: '>= 0.9 boundary and >= 0.45 area',
|
|
659
|
+
threshold: 0.9,
|
|
660
|
+
},
|
|
661
|
+
}),
|
|
662
|
+
);
|
|
663
|
+
}
|
|
664
|
+
}
|
|
665
|
+
|
|
666
|
+
return findings;
|
|
667
|
+
}
|
|
668
|
+
|
|
669
|
+
function pointInProjectedTriangle(
|
|
670
|
+
x: number,
|
|
671
|
+
z: number,
|
|
672
|
+
triangle: ArchitectureTriangle,
|
|
673
|
+
): { inside: boolean; weights: [number, number, number] } {
|
|
674
|
+
const ax = triangle.a.x;
|
|
675
|
+
const az = triangle.a.z;
|
|
676
|
+
const bx = triangle.b.x;
|
|
677
|
+
const bz = triangle.b.z;
|
|
678
|
+
const cx = triangle.c.x;
|
|
679
|
+
const cz = triangle.c.z;
|
|
680
|
+
const denominator = (bz - cz) * (ax - cx) + (cx - bx) * (az - cz);
|
|
681
|
+
if (Math.abs(denominator) <= EPSILON) return { inside: false, weights: [0, 0, 0] };
|
|
682
|
+
const wa = ((bz - cz) * (x - cx) + (cx - bx) * (z - cz)) / denominator;
|
|
683
|
+
const wb = ((cz - az) * (x - cx) + (ax - cx) * (z - cz)) / denominator;
|
|
684
|
+
const wc = 1 - wa - wb;
|
|
685
|
+
const tolerance = 1e-5;
|
|
686
|
+
return {
|
|
687
|
+
inside: wa >= -tolerance && wb >= -tolerance && wc >= -tolerance,
|
|
688
|
+
weights: [wa, wb, wc],
|
|
689
|
+
};
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
function nearestRoofHeight(
|
|
693
|
+
triangles: readonly ArchitectureTriangle[],
|
|
694
|
+
x: number,
|
|
695
|
+
z: number,
|
|
696
|
+
targetY: number,
|
|
697
|
+
): number | undefined {
|
|
698
|
+
const heights: number[] = [];
|
|
699
|
+
for (const triangle of triangles) {
|
|
700
|
+
const projected = pointInProjectedTriangle(x, z, triangle);
|
|
701
|
+
if (!projected.inside) continue;
|
|
702
|
+
const [wa, wb, wc] = projected.weights;
|
|
703
|
+
heights.push(wa * triangle.a.y + wb * triangle.b.y + wc * triangle.c.y);
|
|
704
|
+
}
|
|
705
|
+
return heights.sort((a, b) => Math.abs(a - targetY) - Math.abs(b - targetY))[0];
|
|
706
|
+
}
|
|
707
|
+
|
|
708
|
+
function envelopeFindings(
|
|
709
|
+
context: StructureQaInput,
|
|
710
|
+
architecture: StructureRequirements,
|
|
711
|
+
evidence: ArchitectureSceneEvidence,
|
|
712
|
+
): QaFinding[] {
|
|
713
|
+
if (!requestedGable(architecture) || !hasRoofDimensions(architecture)) return [];
|
|
714
|
+
const roof = aggregate(
|
|
715
|
+
evidence.parts.filter(
|
|
716
|
+
(part) =>
|
|
717
|
+
part.isMesh &&
|
|
718
|
+
(hasRole(part, 'roof.slope.positive') || hasRole(part, 'roof.slope.negative')),
|
|
719
|
+
),
|
|
720
|
+
);
|
|
721
|
+
if (!roof || roof.triangles.length === 0) return [];
|
|
722
|
+
|
|
723
|
+
const ridgeAxis = architecture.roof.ridgeAxis;
|
|
724
|
+
const lateralAxis: HorizontalAxis = ridgeAxis === 'x' ? 'z' : 'x';
|
|
725
|
+
const ridgeSpan = ridgeAxis === 'x' ? architecture.footprint.spanX : architecture.footprint.spanZ;
|
|
726
|
+
const lateralSpan =
|
|
727
|
+
lateralAxis === 'x' ? architecture.footprint.spanX : architecture.footprint.spanZ;
|
|
728
|
+
const wallRoles =
|
|
729
|
+
ridgeAxis === 'x'
|
|
730
|
+
? (['wall.left', 'wall.right'] as const)
|
|
731
|
+
: (['wall.front', 'wall.back'] as const);
|
|
732
|
+
const findings: QaFinding[] = [];
|
|
733
|
+
const gapTolerance = 0.05;
|
|
734
|
+
const penetrationTolerance = 0.12;
|
|
735
|
+
|
|
736
|
+
for (const [sideIndex, wallRole] of wallRoles.entries()) {
|
|
737
|
+
const wall = aggregateRole(evidence, wallRole);
|
|
738
|
+
if (!wall) continue;
|
|
739
|
+
const sign = sideIndex === 0 ? -1 : 1;
|
|
740
|
+
const lateral = sign * (lateralSpan / 2);
|
|
741
|
+
const wallTop = wall.bounds.max.y;
|
|
742
|
+
const offsets = [-0.4, 0, 0.4];
|
|
743
|
+
const separations: number[] = [];
|
|
744
|
+
for (const offset of offsets) {
|
|
745
|
+
const ridge = offset * ridgeSpan;
|
|
746
|
+
const x = ridgeAxis === 'x' ? ridge : lateral;
|
|
747
|
+
const z = ridgeAxis === 'x' ? lateral : ridge;
|
|
748
|
+
const roofY = nearestRoofHeight(roof.triangles, x, z, wallTop);
|
|
749
|
+
if (roofY !== undefined) separations.push(roofY - wallTop);
|
|
750
|
+
}
|
|
751
|
+
if (separations.length === 0) continue;
|
|
752
|
+
const worstGap = Math.max(...separations);
|
|
753
|
+
const worstPenetration = -Math.min(...separations);
|
|
754
|
+
if (worstGap > gapTolerance || worstPenetration > penetrationTolerance) {
|
|
755
|
+
const daylight = worstGap > gapTolerance;
|
|
756
|
+
findings.push(
|
|
757
|
+
architectureFinding(context, {
|
|
758
|
+
code: 'ARCH_ENVELOPE_GAP',
|
|
759
|
+
disposition: 'warn',
|
|
760
|
+
message: daylight
|
|
761
|
+
? `${wallRole} has a ${worstGap.toFixed(3)} m daylight gap to the roof underside at sampled bearing points.`
|
|
762
|
+
: `${wallRole} penetrates the roof envelope by ${worstPenetration.toFixed(3)} m at sampled bearing points.`,
|
|
763
|
+
affected: {
|
|
764
|
+
node: wall.parts[0]?.nodeName ?? wallRole,
|
|
765
|
+
nodePath: wall.parts[0]?.nodePath,
|
|
766
|
+
},
|
|
767
|
+
measurement: {
|
|
768
|
+
name: daylight ? 'maximumWallRoofGap' : 'maximumWallRoofPenetration',
|
|
769
|
+
actual: daylight ? worstGap : worstPenetration,
|
|
770
|
+
expected: daylight ? `<= ${gapTolerance}` : `<= ${penetrationTolerance}`,
|
|
771
|
+
threshold: daylight ? gapTolerance : penetrationTolerance,
|
|
772
|
+
unit: 'm',
|
|
773
|
+
},
|
|
774
|
+
}),
|
|
775
|
+
);
|
|
776
|
+
}
|
|
777
|
+
}
|
|
778
|
+
|
|
779
|
+
return findings;
|
|
780
|
+
}
|
|
781
|
+
|
|
782
|
+
function boundsOverlap(a: Bounds3, b: Bounds3, tolerance = 0): boolean {
|
|
783
|
+
return (
|
|
784
|
+
a.min.x < b.max.x - tolerance &&
|
|
785
|
+
a.max.x > b.min.x + tolerance &&
|
|
786
|
+
a.min.y < b.max.y - tolerance &&
|
|
787
|
+
a.max.y > b.min.y + tolerance &&
|
|
788
|
+
a.min.z < b.max.z - tolerance &&
|
|
789
|
+
a.max.z > b.min.z + tolerance
|
|
790
|
+
);
|
|
791
|
+
}
|
|
792
|
+
|
|
793
|
+
function shrunkenPortalBounds(bounds: Bounds3, wall: string): Bounds3 {
|
|
794
|
+
const result = { min: bounds.min.clone(), max: bounds.max.clone() };
|
|
795
|
+
const widthAxis: HorizontalAxis = wall === 'front' || wall === 'back' ? 'z' : 'x';
|
|
796
|
+
const normalAxis: HorizontalAxis = widthAxis === 'x' ? 'z' : 'x';
|
|
797
|
+
const widthInset = Math.min(0.04, extent(result, widthAxis) * 0.08);
|
|
798
|
+
const heightInset = Math.min(0.04, extent(result, 'y') * 0.04);
|
|
799
|
+
result.min[widthAxis] += widthInset;
|
|
800
|
+
result.max[widthAxis] -= widthInset;
|
|
801
|
+
result.min.y += heightInset;
|
|
802
|
+
result.max.y -= heightInset;
|
|
803
|
+
// Keep the full normal passage depth: a wall or painted door crossing any of
|
|
804
|
+
// it is a real blocker, not an edge-contact artifact.
|
|
805
|
+
if (extent(result, normalAxis) <= EPSILON) {
|
|
806
|
+
result.min[normalAxis] -= 0.01;
|
|
807
|
+
result.max[normalAxis] += 0.01;
|
|
808
|
+
}
|
|
809
|
+
return result;
|
|
810
|
+
}
|
|
811
|
+
|
|
812
|
+
function portalRoleWall(roles: readonly string[]): string | undefined {
|
|
813
|
+
for (const role of roles) {
|
|
814
|
+
const match = /^opening\.(front|back|left|right)\.(?:door|portal|entry)(?:\.|$)/.exec(role);
|
|
815
|
+
if (match) return match[1];
|
|
816
|
+
}
|
|
817
|
+
return undefined;
|
|
818
|
+
}
|
|
819
|
+
|
|
820
|
+
function portalFindings(
|
|
821
|
+
context: StructureQaInput,
|
|
822
|
+
architecture: StructureRequirements,
|
|
823
|
+
evidence: ArchitectureSceneEvidence,
|
|
824
|
+
): QaFinding[] {
|
|
825
|
+
if (
|
|
826
|
+
architecture.enterable !== true &&
|
|
827
|
+
architecture.interiorMode !== 'navigable' &&
|
|
828
|
+
!architecture.portal
|
|
829
|
+
)
|
|
830
|
+
return [];
|
|
831
|
+
const requested = architecture.portal ?? { width: 1.1, height: 2.1, depth: 0.15 };
|
|
832
|
+
const markers = evidence.parts.filter(
|
|
833
|
+
(part) => !part.isMesh && portalRoleWall(part.directRoles) !== undefined,
|
|
834
|
+
);
|
|
835
|
+
if (markers.length === 0) {
|
|
836
|
+
return [
|
|
837
|
+
architectureFinding(context, {
|
|
838
|
+
code: 'ARCH_BLOCKED_PORTAL',
|
|
839
|
+
disposition: 'block',
|
|
840
|
+
message:
|
|
841
|
+
'enterable=true requires a non-rendered semantic opening.<wall>.door clearance node; no exterior-to-interior portal was found.',
|
|
842
|
+
affected: { node: evidence.root.name || 'architecture-root' },
|
|
843
|
+
measurement: {
|
|
844
|
+
name: 'semanticPortalCount',
|
|
845
|
+
actual: 0,
|
|
846
|
+
expected: '>= 1',
|
|
847
|
+
threshold: 1,
|
|
848
|
+
},
|
|
849
|
+
}),
|
|
850
|
+
];
|
|
851
|
+
}
|
|
852
|
+
|
|
853
|
+
const failures: Array<{
|
|
854
|
+
marker: ArchitecturePart;
|
|
855
|
+
wall: string;
|
|
856
|
+
blocker?: ArchitecturePart;
|
|
857
|
+
width: number;
|
|
858
|
+
height: number;
|
|
859
|
+
depth: number;
|
|
860
|
+
placementCoverage: number;
|
|
861
|
+
undersized: boolean;
|
|
862
|
+
misplaced: boolean;
|
|
863
|
+
}> = [];
|
|
864
|
+
|
|
865
|
+
for (const marker of markers) {
|
|
866
|
+
const wall = portalRoleWall(marker.directRoles)!;
|
|
867
|
+
const widthAxis: HorizontalAxis = wall === 'front' || wall === 'back' ? 'z' : 'x';
|
|
868
|
+
const depthAxis: HorizontalAxis = widthAxis === 'x' ? 'z' : 'x';
|
|
869
|
+
const width = extent(marker.bounds, widthAxis);
|
|
870
|
+
const height = extent(marker.bounds, 'y');
|
|
871
|
+
const depth = extent(marker.bounds, depthAxis);
|
|
872
|
+
const claimedWall = aggregate(
|
|
873
|
+
evidence.parts.filter(
|
|
874
|
+
(part) => part.isMesh && hasRole(part, `wall.${wall}`) && !hasRolePrefix(part, 'opening.'),
|
|
875
|
+
),
|
|
876
|
+
);
|
|
877
|
+
const placementCoverage = claimedWall
|
|
878
|
+
? Math.min(
|
|
879
|
+
intervalCoverage(
|
|
880
|
+
marker.bounds.min[depthAxis],
|
|
881
|
+
marker.bounds.max[depthAxis],
|
|
882
|
+
claimedWall.bounds.min[depthAxis],
|
|
883
|
+
claimedWall.bounds.max[depthAxis],
|
|
884
|
+
),
|
|
885
|
+
intervalCoverage(
|
|
886
|
+
claimedWall.bounds.min[widthAxis],
|
|
887
|
+
claimedWall.bounds.max[widthAxis],
|
|
888
|
+
marker.bounds.min[widthAxis],
|
|
889
|
+
marker.bounds.max[widthAxis],
|
|
890
|
+
),
|
|
891
|
+
intervalCoverage(
|
|
892
|
+
claimedWall.bounds.min.y,
|
|
893
|
+
claimedWall.bounds.max.y,
|
|
894
|
+
marker.bounds.min.y,
|
|
895
|
+
marker.bounds.max.y,
|
|
896
|
+
),
|
|
897
|
+
)
|
|
898
|
+
: 0;
|
|
899
|
+
const misplaced = placementCoverage < 0.9;
|
|
900
|
+
const clearance = shrunkenPortalBounds(marker.bounds, wall);
|
|
901
|
+
const blocker = evidence.parts.find((part) => {
|
|
902
|
+
if (!part.isMesh) return false;
|
|
903
|
+
if (
|
|
904
|
+
hasRolePrefix(part, 'roof.') ||
|
|
905
|
+
hasRole(part, 'floor') ||
|
|
906
|
+
hasRolePrefix(part, 'opening.')
|
|
907
|
+
) {
|
|
908
|
+
return false;
|
|
909
|
+
}
|
|
910
|
+
if (
|
|
911
|
+
context.opening === true &&
|
|
912
|
+
part.roles.some((role) => role === 'door.leaf' || role.startsWith('door.leaf.'))
|
|
913
|
+
) {
|
|
914
|
+
return false;
|
|
915
|
+
}
|
|
916
|
+
return boundsOverlap(part.bounds, clearance, 0.004);
|
|
917
|
+
});
|
|
918
|
+
const undersized =
|
|
919
|
+
width + 0.01 < requested.width ||
|
|
920
|
+
height + 0.01 < requested.height ||
|
|
921
|
+
depth + 0.01 < requested.depth;
|
|
922
|
+
if (!blocker && !undersized && !misplaced) return [];
|
|
923
|
+
failures.push({
|
|
924
|
+
marker,
|
|
925
|
+
wall,
|
|
926
|
+
...(blocker ? { blocker } : {}),
|
|
927
|
+
width,
|
|
928
|
+
height,
|
|
929
|
+
depth,
|
|
930
|
+
placementCoverage,
|
|
931
|
+
undersized,
|
|
932
|
+
misplaced,
|
|
933
|
+
});
|
|
934
|
+
}
|
|
935
|
+
|
|
936
|
+
const failure = failures[0]!;
|
|
937
|
+
const undersizedBy = Math.max(
|
|
938
|
+
0,
|
|
939
|
+
requested.width - failure.width,
|
|
940
|
+
requested.height - failure.height,
|
|
941
|
+
requested.depth - failure.depth,
|
|
942
|
+
);
|
|
943
|
+
return [
|
|
944
|
+
architectureFinding(context, {
|
|
945
|
+
code: 'ARCH_BLOCKED_PORTAL',
|
|
946
|
+
disposition: 'block',
|
|
947
|
+
message: failure.blocker
|
|
948
|
+
? `Portal ${failure.marker.nodeName} is blocked by ${failure.blocker.nodeName}; the semantic clearance does not connect exterior to interior.`
|
|
949
|
+
: failure.undersized
|
|
950
|
+
? `Portal ${failure.marker.nodeName} is smaller than the requested ${requested.width.toFixed(2)} x ${requested.height.toFixed(2)} x ${requested.depth.toFixed(2)} m clearance.`
|
|
951
|
+
: `Portal ${failure.marker.nodeName} overlaps only ${(failure.placementCoverage * 100).toFixed(1)}% of its claimed wall passage, so it does not connect exterior to interior through wall.${failure.wall}.`,
|
|
952
|
+
affected: failure.blocker
|
|
953
|
+
? { node: failure.blocker.nodeName, nodePath: failure.blocker.nodePath }
|
|
954
|
+
: { node: failure.marker.nodeName, nodePath: failure.marker.nodePath },
|
|
955
|
+
measurement: failure.blocker
|
|
956
|
+
? {
|
|
957
|
+
name: 'portalBlockerCount',
|
|
958
|
+
actual: 1,
|
|
959
|
+
expected: 0,
|
|
960
|
+
threshold: 0,
|
|
961
|
+
}
|
|
962
|
+
: failure.undersized
|
|
963
|
+
? {
|
|
964
|
+
name: 'maximumPortalClearanceDeficit',
|
|
965
|
+
actual: undersizedBy,
|
|
966
|
+
expected: 0,
|
|
967
|
+
threshold: 0.01,
|
|
968
|
+
unit: 'm',
|
|
969
|
+
}
|
|
970
|
+
: {
|
|
971
|
+
name: 'portalClaimedWallCoverageRatio',
|
|
972
|
+
actual: failure.placementCoverage,
|
|
973
|
+
expected: '>= 0.9',
|
|
974
|
+
threshold: 0.9,
|
|
975
|
+
},
|
|
976
|
+
viewHints: ['architecture.portal.eye'],
|
|
977
|
+
}),
|
|
978
|
+
];
|
|
979
|
+
}
|
|
980
|
+
|
|
981
|
+
function storeyFindings(
|
|
982
|
+
context: StructureQaInput,
|
|
983
|
+
architecture: StructureRequirements,
|
|
984
|
+
evidence: ArchitectureSceneEvidence,
|
|
985
|
+
): QaFinding[] {
|
|
986
|
+
const requested = architecture.storeyCount;
|
|
987
|
+
if (requested === undefined) return [];
|
|
988
|
+
const indexes = new Set<number>();
|
|
989
|
+
for (const role of evidence.semanticRoles) {
|
|
990
|
+
const match = /^(?:architecture\.)?floor\.storey\.(\d+)$/.exec(role);
|
|
991
|
+
if (match) indexes.add(Number(match[1]));
|
|
992
|
+
}
|
|
993
|
+
// An unindexed floor can substantiate one storey; absence of all floor evidence cannot.
|
|
994
|
+
if (
|
|
995
|
+
requested === 1 &&
|
|
996
|
+
indexes.size === 0 &&
|
|
997
|
+
evidence.parts.some((part) => part.isMesh && hasRole(part, 'floor'))
|
|
998
|
+
)
|
|
999
|
+
return [];
|
|
1000
|
+
const actual = indexes.size;
|
|
1001
|
+
if (actual === requested) return [];
|
|
1002
|
+
return [
|
|
1003
|
+
architectureFinding(context, {
|
|
1004
|
+
code: 'ARCH_STOREY_COUNT',
|
|
1005
|
+
disposition: 'block',
|
|
1006
|
+
message: `Requested ${requested} storeys but found ${actual} distinct portable floor.storey.<index> roles.`,
|
|
1007
|
+
affected: { node: evidence.root.name || 'architecture-root' },
|
|
1008
|
+
measurement: {
|
|
1009
|
+
name: 'semanticStoreyCount',
|
|
1010
|
+
actual,
|
|
1011
|
+
expected: requested,
|
|
1012
|
+
threshold: requested,
|
|
1013
|
+
},
|
|
1014
|
+
viewHints: ['architecture.cutaway.dollhouse', 'generic.top.semantic-overlay'],
|
|
1015
|
+
repairText:
|
|
1016
|
+
'Add or remove only the requested floor levels, stamp each level once as floor.storey.<index>, and keep stairs and clearances aligned between consecutive levels.',
|
|
1017
|
+
}),
|
|
1018
|
+
];
|
|
1019
|
+
}
|
|
1020
|
+
|
|
1021
|
+
function interiorModeFindings(
|
|
1022
|
+
context: StructureQaInput,
|
|
1023
|
+
architecture: StructureRequirements,
|
|
1024
|
+
evidence: ArchitectureSceneEvidence,
|
|
1025
|
+
): QaFinding[] {
|
|
1026
|
+
const mode = architecture.interiorMode;
|
|
1027
|
+
if (mode === undefined) return [];
|
|
1028
|
+
const interiorEvidence = evidence.parts.filter((part) =>
|
|
1029
|
+
part.roles.some(
|
|
1030
|
+
(role) => role === 'architecture.interior.shell' || role.startsWith('interior.'),
|
|
1031
|
+
),
|
|
1032
|
+
);
|
|
1033
|
+
const valid =
|
|
1034
|
+
mode === 'shell'
|
|
1035
|
+
? interiorEvidence.length > 0
|
|
1036
|
+
: mode !== 'none' || interiorEvidence.length === 0;
|
|
1037
|
+
if (valid) return [];
|
|
1038
|
+
return [
|
|
1039
|
+
architectureFinding(context, {
|
|
1040
|
+
code: 'ARCH_INTERIOR_MODE',
|
|
1041
|
+
disposition: 'block',
|
|
1042
|
+
message:
|
|
1043
|
+
mode === 'shell'
|
|
1044
|
+
? 'interiorMode=shell requires a portable architecture.interior.shell semantic volume.'
|
|
1045
|
+
: 'interiorMode=none conflicts with semantic interior geometry.',
|
|
1046
|
+
affected: {
|
|
1047
|
+
node: interiorEvidence[0]?.nodeName ?? evidence.root.name ?? 'architecture-root',
|
|
1048
|
+
nodePath: interiorEvidence[0]?.nodePath,
|
|
1049
|
+
},
|
|
1050
|
+
measurement: {
|
|
1051
|
+
name: 'semanticInteriorShellCount',
|
|
1052
|
+
actual: interiorEvidence.length,
|
|
1053
|
+
expected: mode === 'shell' ? '>= 1' : 0,
|
|
1054
|
+
threshold: mode === 'shell' ? 1 : 0,
|
|
1055
|
+
},
|
|
1056
|
+
viewHints: ['architecture.cutaway.dollhouse', 'architecture.floor-plan'],
|
|
1057
|
+
repairText:
|
|
1058
|
+
mode === 'shell'
|
|
1059
|
+
? 'Add one non-rendering architecture.interior.shell volume matching the usable inner envelope; do not fake the interior with a painted exterior face.'
|
|
1060
|
+
: 'Remove the unrequested interior semantic volume or change trusted intent to shell/navigable before generation.',
|
|
1061
|
+
}),
|
|
1062
|
+
];
|
|
1063
|
+
}
|
|
1064
|
+
|
|
1065
|
+
function roofModeFindings(
|
|
1066
|
+
context: StructureQaInput,
|
|
1067
|
+
architecture: StructureRequirements,
|
|
1068
|
+
evidence: ArchitectureSceneEvidence,
|
|
1069
|
+
): QaFinding[] {
|
|
1070
|
+
const mode = architecture.roofMode ?? (architecture.roof?.type === 'none' ? 'none' : undefined);
|
|
1071
|
+
if (mode === undefined) return [];
|
|
1072
|
+
if (mode === 'auto') return [];
|
|
1073
|
+
const roofParts = evidence.parts.filter((part) => hasRolePrefix(part, 'roof.'));
|
|
1074
|
+
const removableRelationships = roofParts.flatMap((part) =>
|
|
1075
|
+
part.directRelationships.filter((relationship) => relationship.kind === 'separable-from'),
|
|
1076
|
+
);
|
|
1077
|
+
const present = roofParts.length > 0;
|
|
1078
|
+
const valid =
|
|
1079
|
+
mode === 'none'
|
|
1080
|
+
? !present
|
|
1081
|
+
: mode === 'fixed'
|
|
1082
|
+
? present && removableRelationships.length === 0
|
|
1083
|
+
: present && removableRelationships.length > 0;
|
|
1084
|
+
if (valid) return [];
|
|
1085
|
+
const measurement =
|
|
1086
|
+
mode === 'removable'
|
|
1087
|
+
? {
|
|
1088
|
+
name: 'removableRoofRelationshipCount',
|
|
1089
|
+
actual: removableRelationships.length,
|
|
1090
|
+
expected: '>= 1',
|
|
1091
|
+
threshold: 1,
|
|
1092
|
+
}
|
|
1093
|
+
: {
|
|
1094
|
+
name: 'semanticRoofPartCount',
|
|
1095
|
+
actual: roofParts.length,
|
|
1096
|
+
expected: mode === 'none' ? 0 : '>= 1',
|
|
1097
|
+
threshold: mode === 'none' ? 0 : 1,
|
|
1098
|
+
};
|
|
1099
|
+
return [
|
|
1100
|
+
architectureFinding(context, {
|
|
1101
|
+
code: 'ARCH_ROOF_MODE',
|
|
1102
|
+
disposition: 'block',
|
|
1103
|
+
message: `roofMode=${mode} conflicts with ${roofParts.length} semantic roof parts and ${removableRelationships.length} separable-from relationships.`,
|
|
1104
|
+
affected: {
|
|
1105
|
+
node: roofParts[0]?.nodeName ?? evidence.root.name ?? 'architecture-root',
|
|
1106
|
+
nodePath: roofParts[0]?.nodePath,
|
|
1107
|
+
},
|
|
1108
|
+
measurement,
|
|
1109
|
+
viewHints: ['generic.top.semantic-overlay', 'architecture.cutaway.dollhouse'],
|
|
1110
|
+
repairText:
|
|
1111
|
+
'Match trusted roofMode exactly: omit all roof.* roles for none, keep fixed roofs attached, or stamp one roof assembly with a separable-from relationship for removable.',
|
|
1112
|
+
}),
|
|
1113
|
+
];
|
|
1114
|
+
}
|
|
1115
|
+
|
|
1116
|
+
function domeFindings(
|
|
1117
|
+
context: StructureQaInput,
|
|
1118
|
+
architecture: StructureRequirements,
|
|
1119
|
+
evidence: ArchitectureSceneEvidence,
|
|
1120
|
+
): QaFinding[] {
|
|
1121
|
+
if (
|
|
1122
|
+
architecture.roof?.type !== 'dome' ||
|
|
1123
|
+
!architecture.footprint ||
|
|
1124
|
+
architecture.roof.rise === undefined
|
|
1125
|
+
)
|
|
1126
|
+
return [];
|
|
1127
|
+
const dome = aggregate(
|
|
1128
|
+
evidence.parts.filter(
|
|
1129
|
+
(part) => part.isMesh && (hasRole(part, 'roof.dome') || hasRole(part, 'roof.surface.dome')),
|
|
1130
|
+
),
|
|
1131
|
+
);
|
|
1132
|
+
const spanXCoverage = dome ? extent(dome.bounds, 'x') / architecture.footprint.spanX : 0;
|
|
1133
|
+
const spanZCoverage = dome ? extent(dome.bounds, 'z') / architecture.footprint.spanZ : 0;
|
|
1134
|
+
const riseCoverage = dome ? extent(dome.bounds, 'y') / architecture.roof.rise : 0;
|
|
1135
|
+
const minimumCoverage = Math.min(spanXCoverage, spanZCoverage, riseCoverage);
|
|
1136
|
+
if (minimumCoverage >= 0.9) return [];
|
|
1137
|
+
return [
|
|
1138
|
+
architectureFinding(context, {
|
|
1139
|
+
code: 'ARCH_DOME_PROFILE',
|
|
1140
|
+
disposition: 'block',
|
|
1141
|
+
message: `The semantic rotunda dome covers ${(spanXCoverage * 100).toFixed(1)}% X, ${(spanZCoverage * 100).toFixed(1)}% Z, and ${(riseCoverage * 100).toFixed(1)}% of declared rise.`,
|
|
1142
|
+
affected: {
|
|
1143
|
+
node: dome?.parts[0]?.nodeName ?? evidence.root.name ?? 'architecture-root',
|
|
1144
|
+
nodePath: dome?.parts[0]?.nodePath,
|
|
1145
|
+
},
|
|
1146
|
+
measurement: {
|
|
1147
|
+
name: 'minimumDomeCoverageRatio',
|
|
1148
|
+
actual: minimumCoverage,
|
|
1149
|
+
expected: '>= 0.9',
|
|
1150
|
+
threshold: 0.9,
|
|
1151
|
+
},
|
|
1152
|
+
viewHints: ['generic.top.semantic-overlay', 'architecture.cutaway.dollhouse'],
|
|
1153
|
+
repairText:
|
|
1154
|
+
'Rebuild the roof.dome hemisphere to cover the declared circular rotunda footprint and rise; preserve any intentional oculus as a bounded opening rather than shrinking the whole dome.',
|
|
1155
|
+
}),
|
|
1156
|
+
];
|
|
1157
|
+
}
|
|
1158
|
+
|
|
1159
|
+
interface ScaleBand {
|
|
1160
|
+
code: string;
|
|
1161
|
+
label: string;
|
|
1162
|
+
actual: number;
|
|
1163
|
+
minimum: number;
|
|
1164
|
+
maximum: number;
|
|
1165
|
+
unit: 'm';
|
|
1166
|
+
affected?: ArchitecturePart;
|
|
1167
|
+
}
|
|
1168
|
+
|
|
1169
|
+
function scaleBandFinding(context: StructureQaInput, band: ScaleBand): QaFinding | undefined {
|
|
1170
|
+
if (band.actual >= band.minimum && band.actual <= band.maximum) return undefined;
|
|
1171
|
+
return architectureFinding(context, {
|
|
1172
|
+
code: band.code,
|
|
1173
|
+
disposition: 'warn',
|
|
1174
|
+
message: `${band.label} is ${band.actual.toFixed(3)} m; the realistic-scale observation band is ${band.minimum.toFixed(3)}–${band.maximum.toFixed(3)} m.`,
|
|
1175
|
+
...(band.affected
|
|
1176
|
+
? { affected: { node: band.affected.nodeName, nodePath: band.affected.nodePath } }
|
|
1177
|
+
: {}),
|
|
1178
|
+
measurement: {
|
|
1179
|
+
name: band.label,
|
|
1180
|
+
actual: band.actual,
|
|
1181
|
+
expected: `${band.minimum}..${band.maximum}`,
|
|
1182
|
+
threshold: band.actual < band.minimum ? band.minimum : band.maximum,
|
|
1183
|
+
unit: band.unit,
|
|
1184
|
+
},
|
|
1185
|
+
viewHints: ['architecture.cutaway.dollhouse'],
|
|
1186
|
+
repairText:
|
|
1187
|
+
'Adjust only the reported architecture dimension into the realistic band, or explicitly select scaleMode=stylized to retain intentional exaggeration.',
|
|
1188
|
+
});
|
|
1189
|
+
}
|
|
1190
|
+
|
|
1191
|
+
function scaleFindings(
|
|
1192
|
+
context: StructureQaInput,
|
|
1193
|
+
architecture: StructureRequirements,
|
|
1194
|
+
evidence: ArchitectureSceneEvidence,
|
|
1195
|
+
): QaFinding[] {
|
|
1196
|
+
if (architecture.scaleMode !== 'realistic') return [];
|
|
1197
|
+
const scaleBands = ARCHITECTURE_REALISTIC_SCALE_BANDS;
|
|
1198
|
+
const bands: ScaleBand[] = [];
|
|
1199
|
+
if (architecture.wallHeight !== undefined)
|
|
1200
|
+
bands.push({
|
|
1201
|
+
code: 'ARCH_SCALE_CEILING_HEIGHT',
|
|
1202
|
+
label: 'ceilingHeight',
|
|
1203
|
+
actual: architecture.wallHeight,
|
|
1204
|
+
...scaleBands.ceilingHeight,
|
|
1205
|
+
});
|
|
1206
|
+
if (architecture.footprint)
|
|
1207
|
+
for (const axis of ['X', 'Z'] as const)
|
|
1208
|
+
bands.push({
|
|
1209
|
+
code: `ARCH_SCALE_FOOTPRINT_${axis}`,
|
|
1210
|
+
label: `footprintSpan${axis}`,
|
|
1211
|
+
actual: architecture.footprint[`span${axis}`],
|
|
1212
|
+
...scaleBands.footprint,
|
|
1213
|
+
});
|
|
1214
|
+
|
|
1215
|
+
const portal = evidence.parts.find(
|
|
1216
|
+
(part) => !part.isMesh && portalRoleWall(part.directRoles) !== undefined,
|
|
1217
|
+
);
|
|
1218
|
+
if (portal) {
|
|
1219
|
+
const wall = portalRoleWall(portal.directRoles)!;
|
|
1220
|
+
const widthAxis: HorizontalAxis = wall === 'front' || wall === 'back' ? 'z' : 'x';
|
|
1221
|
+
bands.push(
|
|
1222
|
+
{
|
|
1223
|
+
code: 'ARCH_SCALE_DOOR_WIDTH',
|
|
1224
|
+
label: 'doorClearWidth',
|
|
1225
|
+
actual: extent(portal.bounds, widthAxis),
|
|
1226
|
+
minimum: scaleBands.doorWidth.minimum,
|
|
1227
|
+
maximum: scaleBands.doorWidth.maximum,
|
|
1228
|
+
unit: 'm',
|
|
1229
|
+
affected: portal,
|
|
1230
|
+
},
|
|
1231
|
+
{
|
|
1232
|
+
code: 'ARCH_SCALE_DOOR_HEIGHT',
|
|
1233
|
+
label: 'doorClearHeight',
|
|
1234
|
+
actual: extent(portal.bounds, 'y'),
|
|
1235
|
+
minimum: scaleBands.doorHeight.minimum,
|
|
1236
|
+
maximum: scaleBands.doorHeight.maximum,
|
|
1237
|
+
unit: 'm',
|
|
1238
|
+
affected: portal,
|
|
1239
|
+
},
|
|
1240
|
+
);
|
|
1241
|
+
}
|
|
1242
|
+
|
|
1243
|
+
const wallParts = evidence.parts.filter(
|
|
1244
|
+
(part) => part.isMesh && part.roles.some((role) => role.startsWith('wall.')),
|
|
1245
|
+
);
|
|
1246
|
+
for (const wall of wallParts) {
|
|
1247
|
+
const thickness = Math.min(extent(wall.bounds, 'x'), extent(wall.bounds, 'z'));
|
|
1248
|
+
bands.push({
|
|
1249
|
+
code: 'ARCH_SCALE_WALL_THICKNESS',
|
|
1250
|
+
label: 'wallThickness',
|
|
1251
|
+
actual: thickness,
|
|
1252
|
+
minimum: scaleBands.wallThickness.minimum,
|
|
1253
|
+
maximum: scaleBands.wallThickness.maximum,
|
|
1254
|
+
unit: 'm',
|
|
1255
|
+
affected: wall,
|
|
1256
|
+
});
|
|
1257
|
+
}
|
|
1258
|
+
|
|
1259
|
+
const steps = evidence.parts.filter(
|
|
1260
|
+
(part) => part.isMesh && part.directRoles.some((role) => role.startsWith('stair.step')),
|
|
1261
|
+
);
|
|
1262
|
+
for (const step of steps) {
|
|
1263
|
+
bands.push(
|
|
1264
|
+
{
|
|
1265
|
+
code: 'ARCH_SCALE_STAIR_RISER',
|
|
1266
|
+
label: 'stairRiser',
|
|
1267
|
+
actual: extent(step.bounds, 'y'),
|
|
1268
|
+
minimum: scaleBands.stairRiser.minimum,
|
|
1269
|
+
maximum: scaleBands.stairRiser.maximum,
|
|
1270
|
+
unit: 'm',
|
|
1271
|
+
affected: step,
|
|
1272
|
+
},
|
|
1273
|
+
{
|
|
1274
|
+
code: 'ARCH_SCALE_STAIR_TREAD',
|
|
1275
|
+
label: 'stairTread',
|
|
1276
|
+
actual: Math.min(extent(step.bounds, 'x'), extent(step.bounds, 'z')),
|
|
1277
|
+
minimum: scaleBands.stairTread.minimum,
|
|
1278
|
+
maximum: scaleBands.stairTread.maximum,
|
|
1279
|
+
unit: 'm',
|
|
1280
|
+
affected: step,
|
|
1281
|
+
},
|
|
1282
|
+
);
|
|
1283
|
+
}
|
|
1284
|
+
|
|
1285
|
+
return bands.flatMap((band) => {
|
|
1286
|
+
const finding = scaleBandFinding(context, band);
|
|
1287
|
+
return finding ? [finding] : [];
|
|
1288
|
+
});
|
|
1289
|
+
}
|
|
1290
|
+
|
|
1291
|
+
/* Structural measurements consume explicit requests, independently of asset labels. */
|
|
1292
|
+
export function inspectStructure(context: StructureQaInput): readonly QaFinding[] {
|
|
1293
|
+
const architecture = context.structure;
|
|
1294
|
+
if (!architecture) return [];
|
|
1295
|
+
const evidence = collectArchitectureEvidence(context.scene);
|
|
1296
|
+
if (!evidence) return [];
|
|
1297
|
+
return [
|
|
1298
|
+
...storeyFindings(context, architecture, evidence),
|
|
1299
|
+
...interiorModeFindings(context, architecture, evidence),
|
|
1300
|
+
...roofModeFindings(context, architecture, evidence),
|
|
1301
|
+
...domeFindings(context, architecture, evidence),
|
|
1302
|
+
...roofFindings(context, architecture, evidence),
|
|
1303
|
+
...endFindings(context, architecture, evidence),
|
|
1304
|
+
...envelopeFindings(context, architecture, evidence),
|
|
1305
|
+
...portalFindings(context, architecture, evidence),
|
|
1306
|
+
...scaleFindings(context, architecture, evidence),
|
|
1307
|
+
];
|
|
1308
|
+
}
|
|
1309
|
+
|
|
1310
|
+
/** Old-data conformance adapter; not used by the neutral runtime. */
|
|
1311
|
+
export function evaluateArchitectureQa(context: QaContext): readonly QaFinding[] {
|
|
1312
|
+
if (context.intent.category !== 'architecture') return [];
|
|
1313
|
+
return inspectStructure({
|
|
1314
|
+
scene: context.scene,
|
|
1315
|
+
profile: context.intent.qaProfile,
|
|
1316
|
+
structure: context.intent.architecture,
|
|
1317
|
+
opening: context.intent.capabilities.includes('openable'),
|
|
1318
|
+
});
|
|
1319
|
+
}
|
|
1320
|
+
|
|
1321
|
+
export const ARCHITECTURE_QA_RULE: QaRule = {
|
|
1322
|
+
id: PROFILE_RULE_ID,
|
|
1323
|
+
profile: 'architecture.default',
|
|
1324
|
+
scope: { kind: 'category', category: 'architecture' },
|
|
1325
|
+
ruleClass: 'exact',
|
|
1326
|
+
owner: KILN_ENGINE_QA_OWNER,
|
|
1327
|
+
promotion: conformancePromotionAuthorization(
|
|
1328
|
+
'architecture-qa-v1',
|
|
1329
|
+
'src/qa/architecture.test.ts',
|
|
1330
|
+
// Full-mode export now retains the semantic boundaries directly. Only the
|
|
1331
|
+
// mode assertion/title changed; all architecture conformance assertions remain.
|
|
1332
|
+
'ce42ab6baef737d109f272413d902ea0903bd66c4da13ea723a52aff2f9e6c66',
|
|
1333
|
+
KILN_ENGINE_QA_OWNER,
|
|
1334
|
+
'2026-10-03T05:45:42.000Z',
|
|
1335
|
+
'enforce',
|
|
1336
|
+
'cpu-raster:0.10.0',
|
|
1337
|
+
),
|
|
1338
|
+
defaultMode: 'enforce',
|
|
1339
|
+
evaluate: (context) =>
|
|
1340
|
+
evaluateArchitectureQa(context).filter((finding) => finding.disposition === 'block'),
|
|
1341
|
+
};
|
|
1342
|
+
|
|
1343
|
+
/** Inferred geometry and realistic-scale bands remain observe-only until QA-026 calibration. */
|
|
1344
|
+
export const ARCHITECTURE_ADVISORY_QA_RULE: QaRule = {
|
|
1345
|
+
id: 'ARCHITECTURE_ADVISORY_PROFILE',
|
|
1346
|
+
profile: 'architecture.advisory',
|
|
1347
|
+
scope: { kind: 'category', category: 'architecture' },
|
|
1348
|
+
ruleClass: 'heuristic',
|
|
1349
|
+
owner: KILN_ENGINE_QA_OWNER,
|
|
1350
|
+
defaultMode: 'observe',
|
|
1351
|
+
evaluate: (context) =>
|
|
1352
|
+
evaluateArchitectureQa(context).filter((finding) => finding.disposition !== 'block'),
|
|
1353
|
+
};
|
|
1354
|
+
|
|
1355
|
+
export const ARCHITECTURE_QA_RULES: readonly QaRule[] = [
|
|
1356
|
+
ARCHITECTURE_QA_RULE,
|
|
1357
|
+
ARCHITECTURE_ADVISORY_QA_RULE,
|
|
1358
|
+
] as const;
|