vibrante-node-runtime 2.5.1__py3-none-any.whl

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.
Files changed (472) hide show
  1. src/__init__.py +1 -0
  2. src/runtime/__init__.py +187 -0
  3. src/runtime/agent_runtime.py +315 -0
  4. src/runtime/ai_planner.py +371 -0
  5. src/runtime/approval_pipeline.py +237 -0
  6. src/runtime/architectural_features/__init__.py +68 -0
  7. src/runtime/architectural_features/architectural_feature_realizer.py +279 -0
  8. src/runtime/architectural_features/architectural_plan.py +421 -0
  9. src/runtime/architectural_features/architectural_plan_builder.py +428 -0
  10. src/runtime/architectural_features/environment_architecture_review.py +398 -0
  11. src/runtime/asset_identity/__init__.py +103 -0
  12. src/runtime/asset_identity/asset_identity_auditor.py +532 -0
  13. src/runtime/asset_identity/identity_review.py +248 -0
  14. src/runtime/asset_identity/identity_serializer.py +76 -0
  15. src/runtime/asset_identity/identity_statistics.py +132 -0
  16. src/runtime/asset_identity/opaque_id_detector.py +167 -0
  17. src/runtime/asset_identity/role_engine_validator.py +134 -0
  18. src/runtime/asset_identity/role_geometry_validator.py +161 -0
  19. src/runtime/asset_knowledge_graph.py +505 -0
  20. src/runtime/asset_staging_manager.py +350 -0
  21. src/runtime/assets/__init__.py +310 -0
  22. src/runtime/assets/acquisition/__init__.py +109 -0
  23. src/runtime/assets/acquisition/acquisition_manager.py +431 -0
  24. src/runtime/assets/acquisition/download_registry.py +324 -0
  25. src/runtime/assets/acquisition/fab_library_scanner.py +384 -0
  26. src/runtime/assets/acquisition/library_index.py +379 -0
  27. src/runtime/assets/acquisition/library_watcher.py +362 -0
  28. src/runtime/assets/acquisition/megascans_scanner.py +551 -0
  29. src/runtime/assets/acquisition_online/__init__.py +211 -0
  30. src/runtime/assets/acquisition_online/acquisition_pipeline.py +279 -0
  31. src/runtime/assets/acquisition_online/asset_cache_manager.py +265 -0
  32. src/runtime/assets/acquisition_online/asset_fetcher.py +361 -0
  33. src/runtime/assets/acquisition_online/asset_provenance_tracker.py +231 -0
  34. src/runtime/assets/acquisition_online/download_queue.py +297 -0
  35. src/runtime/assets/acquisition_online/download_review.py +253 -0
  36. src/runtime/assets/acquisition_online/download_scheduler.py +188 -0
  37. src/runtime/assets/acquisition_online/download_serializer.py +116 -0
  38. src/runtime/assets/acquisition_online/download_statistics.py +145 -0
  39. src/runtime/assets/acquisition_online/fab_socket_receiver.py +449 -0
  40. src/runtime/assets/acquisition_online/megascans_auth.py +408 -0
  41. src/runtime/assets/acquisition_online/megascans_download.py +391 -0
  42. src/runtime/assets/acquisition_online/megascans_search.py +313 -0
  43. src/runtime/assets/acquisition_online/project_asset_staging.py +221 -0
  44. src/runtime/assets/acquisition_online/provider_session_manager.py +182 -0
  45. src/runtime/assets/acquisition_online/quixel_bridge_client.py +380 -0
  46. src/runtime/assets/assembly/__init__.py +288 -0
  47. src/runtime/assets/assembly/anchor_asset_engine.py +387 -0
  48. src/runtime/assets/assembly/architectural_templates.py +493 -0
  49. src/runtime/assets/assembly/asset_clustering_engine.py +343 -0
  50. src/runtime/assets/assembly/asset_placement_engine.py +553 -0
  51. src/runtime/assets/assembly/asset_scale_analyzer.py +278 -0
  52. src/runtime/assets/assembly/bounding_box_extractor.py +227 -0
  53. src/runtime/assets/assembly/clearance_validator.py +204 -0
  54. src/runtime/assets/assembly/collision_detector.py +208 -0
  55. src/runtime/assets/assembly/composition_constraints.py +291 -0
  56. src/runtime/assets/assembly/decorative_population_engine.py +419 -0
  57. src/runtime/assets/assembly/environment_blueprint.py +92 -0
  58. src/runtime/assets/assembly/environment_builder.py +401 -0
  59. src/runtime/assets/assembly/environment_completeness_review.py +500 -0
  60. src/runtime/assets/assembly/environment_review.py +454 -0
  61. src/runtime/assets/assembly/environment_scale_review.py +490 -0
  62. src/runtime/assets/assembly/environment_structure_builder.py +344 -0
  63. src/runtime/assets/assembly/environment_zones.py +332 -0
  64. src/runtime/assets/assembly/footprint_calculator.py +181 -0
  65. src/runtime/assets/assembly/layout_spacing_engine.py +350 -0
  66. src/runtime/assets/assembly/placement_optimizer.py +272 -0
  67. src/runtime/assets/assembly/placement_relationships.py +380 -0
  68. src/runtime/assets/assembly/placement_templates.py +1024 -0
  69. src/runtime/assets/assembly/scene_population_engine.py +351 -0
  70. src/runtime/assets/assembly/semantic_placement_rules.py +323 -0
  71. src/runtime/assets/assembly/spatial_metadata.py +118 -0
  72. src/runtime/assets/assembly/spatial_review.py +304 -0
  73. src/runtime/assets/assembly/storytelling_layout_engine.py +768 -0
  74. src/runtime/assets/assembly/unit_normalizer.py +192 -0
  75. src/runtime/assets/cache/__init__.py +39 -0
  76. src/runtime/assets/cache/asset_cache.py +330 -0
  77. src/runtime/assets/cache/asset_storage.py +234 -0
  78. src/runtime/assets/cache/asset_sync.py +280 -0
  79. src/runtime/assets/discovery/__init__.py +17 -0
  80. src/runtime/assets/discovery/asset_discovery_engine.py +223 -0
  81. src/runtime/assets/download/__init__.py +24 -0
  82. src/runtime/assets/download/asset_download_manager.py +275 -0
  83. src/runtime/assets/geometry/__init__.py +149 -0
  84. src/runtime/assets/geometry/asset_metrics.py +476 -0
  85. src/runtime/assets/geometry/bounding_box_extractor.py +478 -0
  86. src/runtime/assets/geometry/geometry_analyzer.py +251 -0
  87. src/runtime/assets/geometry/geometry_review.py +463 -0
  88. src/runtime/assets/geometry/geometry_serializer.py +121 -0
  89. src/runtime/assets/geometry/geometry_statistics.py +206 -0
  90. src/runtime/assets/geometry/ground_contact_detector.py +277 -0
  91. src/runtime/assets/geometry/pivot_detector.py +248 -0
  92. src/runtime/assets/geometry/support_surface_detector.py +299 -0
  93. src/runtime/assets/logging/__init__.py +17 -0
  94. src/runtime/assets/logging/asset_logger.py +153 -0
  95. src/runtime/assets/metadata/__init__.py +65 -0
  96. src/runtime/assets/metadata/asset_metadata_enricher.py +215 -0
  97. src/runtime/assets/metadata/asset_provenance.py +273 -0
  98. src/runtime/assets/metadata/asset_semantic_mapper.py +265 -0
  99. src/runtime/assets/metadata/provider_normalizer.py +364 -0
  100. src/runtime/assets/providers/__init__.py +38 -0
  101. src/runtime/assets/providers/base.py +218 -0
  102. src/runtime/assets/providers/local_library_provider.py +209 -0
  103. src/runtime/assets/providers/polyhaven_provider.py +268 -0
  104. src/runtime/assets/providers/provider_manager.py +229 -0
  105. src/runtime/assets/providers/quixel_provider.py +277 -0
  106. src/runtime/assets/providers/sketchfab_live_provider.py +515 -0
  107. src/runtime/assets/providers/sketchfab_provider.py +327 -0
  108. src/runtime/assets/providers/studio_library_provider.py +323 -0
  109. src/runtime/assets/providers/usd_library_provider.py +310 -0
  110. src/runtime/assets/ranking/__init__.py +17 -0
  111. src/runtime/assets/ranking/asset_ranking_engine.py +365 -0
  112. src/runtime/assets/real_world_scale.py +189 -0
  113. src/runtime/assets/realization/__init__.py +162 -0
  114. src/runtime/assets/realization/asset_converter.py +282 -0
  115. src/runtime/assets/realization/asset_dependency_resolver.py +285 -0
  116. src/runtime/assets/realization/asset_importer.py +298 -0
  117. src/runtime/assets/realization/asset_instancer.py +269 -0
  118. src/runtime/assets/realization/asset_material_mapper.py +337 -0
  119. src/runtime/assets/realization/asset_normalizer.py +319 -0
  120. src/runtime/assets/realization/asset_realization_review.py +416 -0
  121. src/runtime/assets/realization/asset_validation_pipeline.py +316 -0
  122. src/runtime/assets/realization/realization_serializer.py +172 -0
  123. src/runtime/assets/realization/realization_statistics.py +265 -0
  124. src/runtime/assets/realization/scene_asset_realizer.py +405 -0
  125. src/runtime/assets/realization/usd_builder.py +272 -0
  126. src/runtime/assets/recommendations/__init__.py +17 -0
  127. src/runtime/assets/recommendations/asset_recommendation_engine.py +260 -0
  128. src/runtime/assets/schema/__init__.py +38 -0
  129. src/runtime/assets/schema/asset_descriptor.py +484 -0
  130. src/runtime/assets/semantic/__init__.py +234 -0
  131. src/runtime/assets/semantic/asset_catalog.py +368 -0
  132. src/runtime/assets/semantic/asset_catalog_review.py +266 -0
  133. src/runtime/assets/semantic/asset_catalog_serializer.py +103 -0
  134. src/runtime/assets/semantic/asset_catalog_statistics.py +130 -0
  135. src/runtime/assets/semantic/asset_catalog_sync.py +248 -0
  136. src/runtime/assets/semantic/asset_cinematic_mapper.py +156 -0
  137. src/runtime/assets/semantic/asset_environment_mapper.py +459 -0
  138. src/runtime/assets/semantic/asset_knowledge_graph.py +257 -0
  139. src/runtime/assets/semantic/asset_lookdev_mapper.py +180 -0
  140. src/runtime/assets/semantic/asset_manifest_reader.py +236 -0
  141. src/runtime/assets/semantic/asset_metadata_extractor.py +167 -0
  142. src/runtime/assets/semantic/asset_metadata_provider.py +231 -0
  143. src/runtime/assets/semantic/asset_query_engine.py +240 -0
  144. src/runtime/assets/semantic/asset_role_classifier.py +193 -0
  145. src/runtime/assets/semantic/asset_storytelling_mapper.py +163 -0
  146. src/runtime/assets/semantic/megascans_metadata_client.py +345 -0
  147. src/runtime/assets/semantic/semantic_asset_enricher.py +232 -0
  148. src/runtime/assets/serialization/__init__.py +15 -0
  149. src/runtime/assets/serialization/asset_serializer.py +201 -0
  150. src/runtime/assets/suitability/__init__.py +115 -0
  151. src/runtime/assets/suitability/asset_suitability_engine.py +345 -0
  152. src/runtime/assets/suitability/asset_suitability_review.py +193 -0
  153. src/runtime/assets/suitability/asset_suitability_serializer.py +67 -0
  154. src/runtime/assets/suitability/asset_suitability_statistics.py +141 -0
  155. src/runtime/assets/suitability/environment_affinity.py +290 -0
  156. src/runtime/assets/suitability/material_affinity.py +247 -0
  157. src/runtime/assets/suitability/placement_affinity.py +153 -0
  158. src/runtime/assets/suitability/role_affinity.py +205 -0
  159. src/runtime/assets/suitability/scale_affinity.py +150 -0
  160. src/runtime/assets/suitability/story_affinity.py +235 -0
  161. src/runtime/assets/suitability/style_affinity.py +252 -0
  162. src/runtime/assets/validation/__init__.py +17 -0
  163. src/runtime/assets/validation/asset_validation_engine.py +281 -0
  164. src/runtime/assets/vector_search/__init__.py +193 -0
  165. src/runtime/assets/vector_search/asset_embedding_builder.py +132 -0
  166. src/runtime/assets/vector_search/asset_vector_store.py +264 -0
  167. src/runtime/assets/vector_search/catalog_vector_index_builder.py +155 -0
  168. src/runtime/assets/vector_search/embedding_provider.py +294 -0
  169. src/runtime/assets/vector_search/hybrid_ranking_engine.py +241 -0
  170. src/runtime/assets/vector_search/intent_embedding_engine.py +99 -0
  171. src/runtime/assets/vector_search/intent_parser.py +462 -0
  172. src/runtime/assets/vector_search/retrieval_pipeline.py +275 -0
  173. src/runtime/assets/vector_search/retrieval_review.py +281 -0
  174. src/runtime/assets/vector_search/retrieval_serializer.py +91 -0
  175. src/runtime/assets/vector_search/retrieval_statistics.py +133 -0
  176. src/runtime/assets/vector_search/semantic_similarity.py +116 -0
  177. src/runtime/assets/vector_search/vector_search_engine.py +246 -0
  178. src/runtime/atmosphere_orchestrator.py +412 -0
  179. src/runtime/audit_store.py +230 -0
  180. src/runtime/capability_catalog.py +2324 -0
  181. src/runtime/capability_registry.py +225 -0
  182. src/runtime/cinematic_camera_engine.py +497 -0
  183. src/runtime/cinematic_composition.py +399 -0
  184. src/runtime/cinematic_scene_review.py +539 -0
  185. src/runtime/contextual_reasoning.py +286 -0
  186. src/runtime/dependency_graph.py +205 -0
  187. src/runtime/distributed_runtime.py +348 -0
  188. src/runtime/environment/__init__.py +189 -0
  189. src/runtime/environment/anchor_asset_builder.py +389 -0
  190. src/runtime/environment/atmosphere_builder.py +307 -0
  191. src/runtime/environment/decorative_population.py +320 -0
  192. src/runtime/environment/environment_blueprint.py +107 -0
  193. src/runtime/environment/environment_completeness.py +234 -0
  194. src/runtime/environment/environment_requirements.py +224 -0
  195. src/runtime/environment/environment_review.py +320 -0
  196. src/runtime/environment/environment_serializer.py +100 -0
  197. src/runtime/environment/environment_statistics.py +149 -0
  198. src/runtime/environment/environment_structure_builder.py +391 -0
  199. src/runtime/environment/environment_template_library.py +388 -0
  200. src/runtime/environment/environment_zone_builder.py +334 -0
  201. src/runtime/environment/support_asset_builder.py +243 -0
  202. src/runtime/environment_realization/__init__.py +177 -0
  203. src/runtime/environment_realization/architectural_constraint_solver.py +230 -0
  204. src/runtime/environment_realization/beam_builder.py +221 -0
  205. src/runtime/environment_realization/ceiling_builder.py +186 -0
  206. src/runtime/environment_realization/environment_execution_engine.py +228 -0
  207. src/runtime/environment_realization/environment_realization_engine.py +119 -0
  208. src/runtime/environment_realization/environment_review.py +250 -0
  209. src/runtime/environment_realization/environment_serializer.py +77 -0
  210. src/runtime/environment_realization/environment_statistics.py +134 -0
  211. src/runtime/environment_realization/floor_builder.py +198 -0
  212. src/runtime/environment_realization/opening_builder.py +224 -0
  213. src/runtime/environment_realization/room_shell_builder.py +215 -0
  214. src/runtime/environment_realization/room_shell_completeness_validator.py +303 -0
  215. src/runtime/environment_realization/structural_attachment_enforcer.py +386 -0
  216. src/runtime/environment_realization/structural_builder.py +314 -0
  217. src/runtime/environment_realization/structural_elements.py +258 -0
  218. src/runtime/environment_realization/structural_routing_engine.py +390 -0
  219. src/runtime/environment_realization/wall_builder.py +199 -0
  220. src/runtime/environment_rules.py +239 -0
  221. src/runtime/environment_shell/__init__.py +187 -0
  222. src/runtime/environment_shell/environment_readiness_gate.py +187 -0
  223. src/runtime/environment_shell/environment_shell_audit.py +184 -0
  224. src/runtime/environment_shell/environment_shell_blueprint.py +267 -0
  225. src/runtime/environment_shell/environment_shell_builder.py +265 -0
  226. src/runtime/environment_shell/environment_shell_state.py +133 -0
  227. src/runtime/environment_shell/shell_ceiling_builder.py +114 -0
  228. src/runtime/environment_shell/shell_floor_builder.py +96 -0
  229. src/runtime/environment_shell/shell_phase_result.py +66 -0
  230. src/runtime/environment_shell/shell_review.py +241 -0
  231. src/runtime/environment_shell/shell_serializer.py +67 -0
  232. src/runtime/environment_shell/shell_statistics.py +141 -0
  233. src/runtime/environment_shell/shell_validator.py +138 -0
  234. src/runtime/environment_shell/shell_wall_builder.py +156 -0
  235. src/runtime/environment_shell/structural_anchor_generator.py +200 -0
  236. src/runtime/environment_shell/structural_element_placer.py +193 -0
  237. src/runtime/environments/__init__.py +67 -0
  238. src/runtime/environments/environment_registry.py +1139 -0
  239. src/runtime/environments/environment_statistics.py +219 -0
  240. src/runtime/execution_explainer.py +399 -0
  241. src/runtime/execution_quality.py +258 -0
  242. src/runtime/execution_review.py +221 -0
  243. src/runtime/execution_scheduler.py +263 -0
  244. src/runtime/failure_intelligence.py +341 -0
  245. src/runtime/goal_decomposer.py +532 -0
  246. src/runtime/houdini_asset_realizer.py +329 -0
  247. src/runtime/houdini_runtime.py +992 -0
  248. src/runtime/intent_parser.py +275 -0
  249. src/runtime/knowledge_graph.py +310 -0
  250. src/runtime/layout/__init__.py +172 -0
  251. src/runtime/layout/affordance_engine.py +384 -0
  252. src/runtime/layout/anchor_layout_engine.py +244 -0
  253. src/runtime/layout/decoration_layout_engine.py +325 -0
  254. src/runtime/layout/furniture_cluster_builder.py +381 -0
  255. src/runtime/layout/layout_review.py +265 -0
  256. src/runtime/layout/layout_serializer.py +77 -0
  257. src/runtime/layout/layout_statistics.py +123 -0
  258. src/runtime/layout/relationship_graph.py +165 -0
  259. src/runtime/layout/relationship_graph_builder.py +699 -0
  260. src/runtime/layout/relationship_layout_engine.py +1101 -0
  261. src/runtime/layout/relationship_realization_auditor.py +849 -0
  262. src/runtime/layout/semantic_layout_engine.py +327 -0
  263. src/runtime/layout/surface_placement_engine.py +270 -0
  264. src/runtime/layout/wall_attachment_engine.py +243 -0
  265. src/runtime/layout_realization/__init__.py +183 -0
  266. src/runtime/layout_realization/cluster_realizer.py +212 -0
  267. src/runtime/layout_realization/collision_solver.py +359 -0
  268. src/runtime/layout_realization/identity_metadata_writer.py +257 -0
  269. src/runtime/layout_realization/layout_application_engine.py +242 -0
  270. src/runtime/layout_realization/layout_realization_engine.py +293 -0
  271. src/runtime/layout_realization/layout_validator.py +315 -0
  272. src/runtime/layout_realization/metadata_application_engine.py +187 -0
  273. src/runtime/layout_realization/realization_review.py +268 -0
  274. src/runtime/layout_realization/realization_serializer.py +77 -0
  275. src/runtime/layout_realization/realization_statistics.py +151 -0
  276. src/runtime/layout_realization/relationship_metadata_writer.py +305 -0
  277. src/runtime/layout_realization/relationship_persistence_auditor.py +426 -0
  278. src/runtime/layout_realization/relationship_realizer.py +294 -0
  279. src/runtime/layout_realization/scene_constraint_solver.py +317 -0
  280. src/runtime/layout_realization/surface_realizer.py +195 -0
  281. src/runtime/layout_realization/transform_resolver.py +268 -0
  282. src/runtime/layout_realization/wall_attachment_realizer.py +182 -0
  283. src/runtime/layout_transform_engine.py +341 -0
  284. src/runtime/lighting/__init__.py +215 -0
  285. src/runtime/lighting/lighting_color_engine.py +252 -0
  286. src/runtime/lighting/lighting_environment_mapper.py +792 -0
  287. src/runtime/lighting/lighting_exposure_engine.py +213 -0
  288. src/runtime/lighting/lighting_hierarchy_engine.py +248 -0
  289. src/runtime/lighting/lighting_knowledge.py +342 -0
  290. src/runtime/lighting/lighting_language.py +239 -0
  291. src/runtime/lighting/lighting_mood_engine.py +230 -0
  292. src/runtime/lighting/lighting_patterns.py +522 -0
  293. src/runtime/lighting/lighting_plan_builder.py +320 -0
  294. src/runtime/lighting/lighting_readability_engine.py +273 -0
  295. src/runtime/lighting/lighting_recommendation_engine.py +205 -0
  296. src/runtime/lighting/lighting_review.py +370 -0
  297. src/runtime/lighting/lighting_serializer.py +71 -0
  298. src/runtime/lighting/lighting_statistics.py +142 -0
  299. src/runtime/lighting/lighting_strategy_engine.py +239 -0
  300. src/runtime/lighting/lighting_validation.py +183 -0
  301. src/runtime/llm_provider.py +340 -0
  302. src/runtime/lookdev/__init__.py +137 -0
  303. src/runtime/lookdev/lookdev_patterns.py +216 -0
  304. src/runtime/lookdev/lookdev_review.py +389 -0
  305. src/runtime/lookdev/lookdev_serializer.py +71 -0
  306. src/runtime/lookdev/lookdev_statistics.py +133 -0
  307. src/runtime/lookdev/lookdev_validation.py +203 -0
  308. src/runtime/lookdev/material_assignment_engine.py +331 -0
  309. src/runtime/lookdev/material_knowledge.py +244 -0
  310. src/runtime/lookdev/material_library.py +311 -0
  311. src/runtime/lookdev/material_recommendation.py +394 -0
  312. src/runtime/lookdev/renderer_profiles.py +281 -0
  313. src/runtime/mcp_runtime.py +357 -0
  314. src/runtime/mcp_server_runtime.py +386 -0
  315. src/runtime/mcp_session.py +261 -0
  316. src/runtime/mcp_tool_registry.py +2169 -0
  317. src/runtime/mcp_transport.py +206 -0
  318. src/runtime/multi_dcc_runtime.py +316 -0
  319. src/runtime/orchestration_heuristics.py +360 -0
  320. src/runtime/pattern_library.py +344 -0
  321. src/runtime/plan_validator.py +314 -0
  322. src/runtime/planning/__init__.py +103 -0
  323. src/runtime/planning/camera/__init__.py +1 -0
  324. src/runtime/planning/camera/camera_planner.py +179 -0
  325. src/runtime/planning/composition/__init__.py +1 -0
  326. src/runtime/planning/composition/composition_planner.py +223 -0
  327. src/runtime/planning/logging/__init__.py +1 -0
  328. src/runtime/planning/logging/planning_logger.py +109 -0
  329. src/runtime/planning/planners/__init__.py +1 -0
  330. src/runtime/planning/planners/asset_query_generator.py +265 -0
  331. src/runtime/planning/planners/scene_planner.py +199 -0
  332. src/runtime/planning/planners/zone_planner.py +271 -0
  333. src/runtime/planning/recommendations/__init__.py +1 -0
  334. src/runtime/planning/recommendations/scene_plan_recommendation_engine.py +228 -0
  335. src/runtime/planning/schema/__init__.py +23 -0
  336. src/runtime/planning/schema/scene_plan.py +569 -0
  337. src/runtime/planning/serialization/__init__.py +1 -0
  338. src/runtime/planning/serialization/plan_serializer.py +147 -0
  339. src/runtime/planning/validators/__init__.py +1 -0
  340. src/runtime/planning/validators/scene_plan_validator.py +210 -0
  341. src/runtime/planning_memory.py +242 -0
  342. src/runtime/predictive_execution.py +393 -0
  343. src/runtime/procedural_scene_assembler.py +415 -0
  344. src/runtime/production_memory.py +309 -0
  345. src/runtime/production_scoring.py +422 -0
  346. src/runtime/reality/__init__.py +197 -0
  347. src/runtime/reality/architectural_integrity_validator.py +220 -0
  348. src/runtime/reality/beam_connection_validator.py +205 -0
  349. src/runtime/reality/composition_engine.py +206 -0
  350. src/runtime/reality/correction_applier.py +159 -0
  351. src/runtime/reality/correction_pass_engine.py +253 -0
  352. src/runtime/reality/density_engine.py +145 -0
  353. src/runtime/reality/floating_object_detector.py +206 -0
  354. src/runtime/reality/functional_zone_builder.py +260 -0
  355. src/runtime/reality/geometry_inspector.py +229 -0
  356. src/runtime/reality/human_reasoning_engine.py +284 -0
  357. src/runtime/reality/reality_intelligence_engine.py +182 -0
  358. src/runtime/reality/reality_scene_model.py +351 -0
  359. src/runtime/reality/reality_serializer.py +75 -0
  360. src/runtime/reality/reality_statistics.py +145 -0
  361. src/runtime/reality/support_rule_engine.py +248 -0
  362. src/runtime/reality/visual_review_engine.py +217 -0
  363. src/runtime/recommendation_engine.py +358 -0
  364. src/runtime/render_preparation_engine.py +463 -0
  365. src/runtime/resource_estimator.py +256 -0
  366. src/runtime/resource_optimizer.py +343 -0
  367. src/runtime/review_engine.py +768 -0
  368. src/runtime/review_feedback.py +325 -0
  369. src/runtime/runtime_analytics.py +330 -0
  370. src/runtime/runtime_bootstrap.py +137 -0
  371. src/runtime/runtime_constraints.py +317 -0
  372. src/runtime/runtime_federation_api.py +297 -0
  373. src/runtime/runtime_identity.py +70 -0
  374. src/runtime/runtime_narration.py +493 -0
  375. src/runtime/runtime_prompt_context.py +682 -0
  376. src/runtime/scene_awareness.py +559 -0
  377. src/runtime/scene_cache.py +277 -0
  378. src/runtime/scene_hierarchy_builder.py +258 -0
  379. src/runtime/scene_layout_planner.py +292 -0
  380. src/runtime/scene_realization_review.py +452 -0
  381. src/runtime/scene_recommendation_engine.py +398 -0
  382. src/runtime/scene_validation/__init__.py +118 -0
  383. src/runtime/scene_validation/occupancy_validator.py +176 -0
  384. src/runtime/scene_validation/orphan_detector.py +205 -0
  385. src/runtime/scene_validation/plausibility_engine.py +236 -0
  386. src/runtime/scene_validation/relationship_validator.py +238 -0
  387. src/runtime/scene_validation/routing_audit.py +556 -0
  388. src/runtime/scene_validation/scene_reality_validator.py +229 -0
  389. src/runtime/scene_validation/support_surface_validator.py +155 -0
  390. src/runtime/scene_validation/validation_review.py +207 -0
  391. src/runtime/scene_validation/validation_serializer.py +74 -0
  392. src/runtime/scene_validation/validation_statistics.py +142 -0
  393. src/runtime/semantic/__init__.py +113 -0
  394. src/runtime/semantic/enrichers/__init__.py +12 -0
  395. src/runtime/semantic/enrichers/scene_intent_enricher.py +305 -0
  396. src/runtime/semantic/logging/__init__.py +18 -0
  397. src/runtime/semantic/logging/semantic_logger.py +298 -0
  398. src/runtime/semantic/prompts/__init__.py +12 -0
  399. src/runtime/semantic/prompts/intent_prompt_builder.py +317 -0
  400. src/runtime/semantic/recommendations/__init__.py +17 -0
  401. src/runtime/semantic/recommendations/intent_recommendation_engine.py +434 -0
  402. src/runtime/semantic/scene_intent_extractor.py +455 -0
  403. src/runtime/semantic/schema/__init__.py +40 -0
  404. src/runtime/semantic/schema/scene_intent_schema.py +349 -0
  405. src/runtime/semantic/serialization/__init__.py +16 -0
  406. src/runtime/semantic/serialization/intent_serializer.py +248 -0
  407. src/runtime/semantic/validators/__init__.py +14 -0
  408. src/runtime/semantic/validators/scene_intent_validator.py +284 -0
  409. src/runtime/semantic_execution.py +348 -0
  410. src/runtime/semantic_import_controller.py +408 -0
  411. src/runtime/semantic_lighting_engine.py +566 -0
  412. src/runtime/semantic_memory.py +257 -0
  413. src/runtime/semantic_registry.py +386 -0
  414. src/runtime/semantic_scene_templates.py +387 -0
  415. src/runtime/storage/__init__.py +18 -0
  416. src/runtime/storage/memory_backend.py +294 -0
  417. src/runtime/storage/serialization.py +211 -0
  418. src/runtime/storage/sqlite_backend.py +365 -0
  419. src/runtime/structure/__init__.py +135 -0
  420. src/runtime/structure/environment_structural_affinity.py +254 -0
  421. src/runtime/structure/geometry_role_detector.py +182 -0
  422. src/runtime/structure/metadata_role_classifier.py +279 -0
  423. src/runtime/structure/structural_asset_classifier.py +331 -0
  424. src/runtime/structure/structural_placement_rules.py +326 -0
  425. src/runtime/structure/structural_review.py +682 -0
  426. src/runtime/structure/structural_serializer.py +113 -0
  427. src/runtime/structure/structural_statistics.py +209 -0
  428. src/runtime/studio/__init__.py +71 -0
  429. src/runtime/studio/cross_project_learning.py +263 -0
  430. src/runtime/studio/knowledge_recommendation.py +324 -0
  431. src/runtime/studio/knowledge_serializer.py +154 -0
  432. src/runtime/studio/knowledge_statistics.py +107 -0
  433. src/runtime/studio/production_benchmark.py +240 -0
  434. src/runtime/studio/project_memory.py +250 -0
  435. src/runtime/studio/review_analytics.py +166 -0
  436. src/runtime/studio/studio_knowledge.py +284 -0
  437. src/runtime/studio/studio_metrics.py +155 -0
  438. src/runtime/studio/studio_standards.py +262 -0
  439. src/runtime/studio_knowledge.py +328 -0
  440. src/runtime/transaction_manager.py +367 -0
  441. src/runtime/validation_engine.py +234 -0
  442. src/runtime/visual_hierarchy_engine.py +452 -0
  443. src/runtime/worker_runtime.py +236 -0
  444. src/runtime/workflow_federation.py +316 -0
  445. src/runtime/workflow_optimizer.py +407 -0
  446. src/runtime/workflow_templates.py +421 -0
  447. src/runtime/workflows/__init__.py +129 -0
  448. src/runtime/workflows/workflow_blueprint.py +394 -0
  449. src/runtime/workflows/workflow_executor.py +344 -0
  450. src/runtime/workflows/workflow_pack.py +403 -0
  451. src/runtime/workflows/workflow_recommendation.py +353 -0
  452. src/runtime/workflows/workflow_registry.py +165 -0
  453. src/runtime/workflows/workflow_review.py +336 -0
  454. src/runtime/workflows/workflow_serializer.py +149 -0
  455. src/runtime/workflows/workflow_statistics.py +205 -0
  456. src/runtime/workflows/workflow_validator.py +272 -0
  457. src/utils/__init__.py +0 -0
  458. src/utils/hou_bridge.py +262 -0
  459. src/utils/vibrante_config.py +272 -0
  460. vibrante_node_runtime-2.5.1.dist-info/METADATA +47 -0
  461. vibrante_node_runtime-2.5.1.dist-info/RECORD +472 -0
  462. vibrante_node_runtime-2.5.1.dist-info/WHEEL +5 -0
  463. vibrante_node_runtime-2.5.1.dist-info/licenses/CLA.md +96 -0
  464. vibrante_node_runtime-2.5.1.dist-info/licenses/COMMERCIAL_LICENSE.md +170 -0
  465. vibrante_node_runtime-2.5.1.dist-info/licenses/LICENSE +178 -0
  466. vibrante_node_runtime-2.5.1.dist-info/licenses/LICENSES/AGPL-3.0.txt +661 -0
  467. vibrante_node_runtime-2.5.1.dist-info/licenses/LICENSES/CC-BY-4.0-SCOPE.md +53 -0
  468. vibrante_node_runtime-2.5.1.dist-info/licenses/LICENSES/CC-BY-4.0.txt +396 -0
  469. vibrante_node_runtime-2.5.1.dist-info/licenses/LICENSES/GPL-3.0.txt +674 -0
  470. vibrante_node_runtime-2.5.1.dist-info/licenses/LICENSES/LGPL-3.0.txt +165 -0
  471. vibrante_node_runtime-2.5.1.dist-info/licenses/LICENSES/README.md +65 -0
  472. vibrante_node_runtime-2.5.1.dist-info/top_level.txt +1 -0
@@ -0,0 +1,768 @@
1
+ """
2
+ Storytelling Layout Engine (Tier 9 — Semantic Asset Assembly)
3
+ =============================================================
4
+ Creates visual storytelling structure from an EnvironmentPlan.
5
+
6
+ Identifies the narrative hero area, contextual support areas,
7
+ visual flow direction, and the path a viewer's eye travels through
8
+ the scene.
9
+
10
+ DESIGN RULES:
11
+ 1. Deterministic — same EnvironmentPlan → same layout every time.
12
+ 2. No bridge calls. No Houdini imports. Planning only.
13
+ 3. Layout is driven by zone roles and environment narrative.
14
+ 4. Never raises — errors captured in StoryLayout.errors.
15
+
16
+ Public API:
17
+ StoryBeat
18
+ StoryLayout
19
+ StorytellingLayoutEngine
20
+ get_storytelling_layout_engine()
21
+ reset_storytelling_layout_engine_for_tests()
22
+ """
23
+
24
+ from __future__ import annotations
25
+
26
+ import threading
27
+ import time
28
+ import uuid
29
+ from dataclasses import dataclass, field
30
+ from typing import Any, Dict, List, Optional, Tuple
31
+
32
+ from src.runtime.assets.assembly.environment_builder import EnvironmentPlan
33
+ from src.runtime.assets.assembly.placement_templates import get_placement_templates
34
+
35
+ # ---------------------------------------------------------------------------
36
+ # Environment narrative lookup
37
+ # ---------------------------------------------------------------------------
38
+
39
+ _ENV_NARRATIVES: Dict[str, Dict[str, Any]] = {
40
+ "industrial_hangar": {
41
+ "theme": "industrial operation",
42
+ "hero_beat": "central machinery commands attention and establishes scale",
43
+ "support_beat": "flanking equipment contextualizes the industrial purpose",
44
+ "atmosphere_beat": "depth fog and high ceilings reinforce the sense of scale",
45
+ "viewer_path": ["hero_zone", "midground", "background"],
46
+ "visual_flow": "centrifugal — eye starts at hero, spirals outward",
47
+ },
48
+ "robotics_lab": {
49
+ "theme": "precision engineering",
50
+ "hero_beat": "featured robot at center demonstrates capability",
51
+ "support_beat": "workstations and tools frame the working environment",
52
+ "atmosphere_beat": "clean diffuse light reinforces precision and control",
53
+ "viewer_path": ["hero_zone", "workstation_row", "midground", "background"],
54
+ "visual_flow": "grid — clinical left-to-right scan matches the lab aesthetic",
55
+ },
56
+ "control_room": {
57
+ "theme": "command authority",
58
+ "hero_beat": "central console is the decision nexus; all lines lead to it",
59
+ "support_beat": "surrounding stations establish the command hierarchy",
60
+ "atmosphere_beat": "screen glow creates depth from foreground monitors backward",
61
+ "viewer_path": ["hero_zone", "console_arc", "midground", "background"],
62
+ "visual_flow": "convergent — all perspective lines lead to the central console",
63
+ },
64
+ "sci_fi_corridor": {
65
+ "theme": "corridor traversal",
66
+ "hero_beat": "corridor element at center frames the journey forward",
67
+ "support_beat": "wall panels create spatial rhythm and technological texture",
68
+ "atmosphere_beat": "neon accent guides the eye forward through the corridor",
69
+ "viewer_path": ["hero_zone", "midground", "background"],
70
+ "visual_flow": "linear — forced perspective down corridor depth",
71
+ },
72
+ "abandoned_factory": {
73
+ "theme": "post-industrial decay",
74
+ "hero_beat": "dominant abandoned machinery evokes the scale of past industry",
75
+ "support_beat": "rubble and smaller props build the decay narrative",
76
+ "atmosphere_beat": "heavy fog reveals and conceals — decay is never fully exposed",
77
+ "viewer_path": ["hero_zone", "rubble_field", "midground", "background"],
78
+ "visual_flow": "exploratory — viewer discovers layers of decay progressively",
79
+ },
80
+
81
+ # -----------------------------------------------------------------------
82
+ # §39 Industrial
83
+ # -----------------------------------------------------------------------
84
+ "warehouse": {
85
+ "theme": "logistics operation",
86
+ "hero_beat": "forklift or pallet rack anchors the center and establishes operational scale",
87
+ "support_beat": "stacked crates and shelving bays frame the logistics narrative",
88
+ "atmosphere_beat": "fluorescent rows recede into industrial depth",
89
+ "viewer_path": ["hero_zone", "midground", "background"],
90
+ "visual_flow": "grid — aisle perspective repeats to depth",
91
+ },
92
+ "shipyard": {
93
+ "theme": "maritime construction",
94
+ "hero_beat": "ship hull or drydock crane dominates, asserting monumental industrial scale",
95
+ "support_beat": "chains, anchors, and scaffolding frame the vessel in progress",
96
+ "atmosphere_beat": "sea mist and overcast sky create maritime atmosphere",
97
+ "viewer_path": ["hero_zone", "midground", "background"],
98
+ "visual_flow": "upward — hull scale forces the eye toward the sky",
99
+ },
100
+ "oil_refinery": {
101
+ "theme": "petrochemical complexity",
102
+ "hero_beat": "distillation tower or flare stack establishes industrial scale and danger",
103
+ "support_beat": "pipes, valves, and tanks build the complexity narrative",
104
+ "atmosphere_beat": "chemical haze and flare glow create an ominous industrial mood",
105
+ "viewer_path": ["hero_zone", "midground", "background"],
106
+ "visual_flow": "vertical — towers force the eye upward to sky",
107
+ },
108
+ "power_station": {
109
+ "theme": "energy infrastructure",
110
+ "hero_beat": "turbine hall or generator shows the source of power",
111
+ "support_beat": "control panels and transformers contextualize the system",
112
+ "atmosphere_beat": "cooling tower steam and high-bay scale reinforce critical infrastructure",
113
+ "viewer_path": ["hero_zone", "midground", "background"],
114
+ "visual_flow": "centrifugal — turbine hall radiates operational importance",
115
+ },
116
+ "mining_facility": {
117
+ "theme": "underground extraction",
118
+ "hero_beat": "excavator or drill rig reveals the raw scale of extraction",
119
+ "support_beat": "conveyors and ore carts tell the story of material flow",
120
+ "atmosphere_beat": "rock dust and deep shadows frame the underground world",
121
+ "viewer_path": ["hero_zone", "midground", "background"],
122
+ "visual_flow": "downward — tunnel depth draws the eye into the earth",
123
+ },
124
+ "construction_site": {
125
+ "theme": "creation in progress",
126
+ "hero_beat": "tower crane or partially built structure shows ambition and progress",
127
+ "support_beat": "scaffolding and raw materials contextualize the building process",
128
+ "atmosphere_beat": "cement dust and sky reveal construction as human endeavor",
129
+ "viewer_path": ["hero_zone", "midground", "background"],
130
+ "visual_flow": "upward — steel and concrete frame push the eye skyward",
131
+ },
132
+ # -----------------------------------------------------------------------
133
+ # §39 Scientific
134
+ # -----------------------------------------------------------------------
135
+ "research_lab": {
136
+ "theme": "methodical discovery",
137
+ "hero_beat": "central bench or key apparatus frames the moment of inquiry",
138
+ "support_beat": "instruments and reference materials establish scientific context",
139
+ "atmosphere_beat": "clean diffuse light reinforces precision and objectivity",
140
+ "viewer_path": ["hero_zone", "midground", "background"],
141
+ "visual_flow": "grid — clinical lab rows invite left-to-right scan",
142
+ },
143
+ "medical_lab": {
144
+ "theme": "healing and precision",
145
+ "hero_beat": "operating table or diagnostic scanner commands life-and-death focus",
146
+ "support_beat": "monitors and IV stands build clinical urgency",
147
+ "atmosphere_beat": "surgical white light removes all ambiguity",
148
+ "viewer_path": ["hero_zone", "midground", "background"],
149
+ "visual_flow": "convergent — all tools point toward the patient",
150
+ },
151
+ "clean_room": {
152
+ "theme": "technological purity",
153
+ "hero_beat": "fabrication machine or wafer stage reveals the frontier of miniaturization",
154
+ "support_beat": "containment walls and filters establish the purity contract",
155
+ "atmosphere_beat": "near-shadowless yellow light suggests extreme care",
156
+ "viewer_path": ["hero_zone", "midground", "background"],
157
+ "visual_flow": "grid — symmetrical cleanroom lanes enforce ordered scanning",
158
+ },
159
+ "biohazard_facility": {
160
+ "theme": "contained danger",
161
+ "hero_beat": "containment chamber or biosafety cabinet makes the threat visible",
162
+ "support_beat": "hazmat suits and warning signs build the danger narrative",
163
+ "atmosphere_beat": "warning light and clinical cool create tension through contrast",
164
+ "viewer_path": ["hero_zone", "midground", "background"],
165
+ "visual_flow": "convergent — all paths lead inward to the containment source",
166
+ },
167
+ # -----------------------------------------------------------------------
168
+ # §39 Military
169
+ # -----------------------------------------------------------------------
170
+ "military_base": {
171
+ "theme": "tactical readiness",
172
+ "hero_beat": "armored vehicle or watchtower establishes military authority at a glance",
173
+ "support_beat": "barriers and equipment rows convey operational preparedness",
174
+ "atmosphere_beat": "harsh light, dust, and perimeter fencing enforce order",
175
+ "viewer_path": ["hero_zone", "perimeter", "midground", "background"],
176
+ "visual_flow": "grid — base layout imposes military precision on the eye",
177
+ },
178
+ "command_center": {
179
+ "theme": "strategic authority",
180
+ "hero_beat": "tactical table or situation display is the decision nexus",
181
+ "support_beat": "surrounding monitors and radio equipment build command authority",
182
+ "atmosphere_beat": "low-key dramatic light focuses attention on the mission",
183
+ "viewer_path": ["hero_zone", "midground", "background"],
184
+ "visual_flow": "convergent — all sight lines lead to the tactical display",
185
+ },
186
+ "military_hangar": {
187
+ "theme": "aerial power",
188
+ "hero_beat": "fighter jet or helicopter defines the military capability",
189
+ "support_beat": "maintenance rigs and fuel carts frame readiness",
190
+ "atmosphere_beat": "jet exhaust haze and hangar echo reinforce power",
191
+ "viewer_path": ["hero_zone", "midground", "background"],
192
+ "visual_flow": "upward — aircraft scale forces the eye toward the roof and sky",
193
+ },
194
+ "checkpoint": {
195
+ "theme": "controlled boundary",
196
+ "hero_beat": "barrier gate or guard booth defines the moment of access",
197
+ "support_beat": "wire fencing and bollards establish the perimeter reality",
198
+ "atmosphere_beat": "searchlight beams and night dust build tension",
199
+ "viewer_path": ["hero_zone", "midground", "background"],
200
+ "visual_flow": "linear — forced approach along the single permitted path",
201
+ },
202
+ "bunker": {
203
+ "theme": "underground fortress",
204
+ "hero_beat": "blast door or command table asserts the last resort of authority",
205
+ "support_beat": "supply crates and bunks contextualize long-term survival",
206
+ "atmosphere_beat": "bare bulb flicker and concrete echo reinforce claustrophobia",
207
+ "viewer_path": ["hero_zone", "midground", "background"],
208
+ "visual_flow": "tunnel — forced depth into underground safety",
209
+ },
210
+ # -----------------------------------------------------------------------
211
+ # §39 Sci-Fi
212
+ # -----------------------------------------------------------------------
213
+ "space_station": {
214
+ "theme": "orbital isolation",
215
+ "hero_beat": "observation window or command console frames humanity in orbit",
216
+ "support_beat": "equipment racks and module junctions contextualize daily life in space",
217
+ "atmosphere_beat": "cool panel glow and Earth visible through viewport create depth",
218
+ "viewer_path": ["hero_zone", "module_left", "module_right", "midground", "background"],
219
+ "visual_flow": "radial — modules extend from central hub outward",
220
+ },
221
+ "spaceship_bridge": {
222
+ "theme": "command at the frontier",
223
+ "hero_beat": "captain's chair or viewscreen is the axis of exploration leadership",
224
+ "support_beat": "crew stations build the sense of collective mission",
225
+ "atmosphere_beat": "star field and console glow place the crew in the cosmos",
226
+ "viewer_path": ["hero_zone", "midground", "background"],
227
+ "visual_flow": "convergent — all crew positions face the viewscreen together",
228
+ },
229
+ "engineering_bay": {
230
+ "theme": "technological heart",
231
+ "hero_beat": "power core or reactor reveals the source of the ship's life",
232
+ "support_beat": "conduits and maintenance platforms contextualize the engineers' work",
233
+ "atmosphere_beat": "core glow and plasma heat build tension and wonder",
234
+ "viewer_path": ["hero_zone", "midground", "background"],
235
+ "visual_flow": "centrifugal — core radiates energy and story outward",
236
+ },
237
+ "alien_facility": {
238
+ "theme": "first contact",
239
+ "hero_beat": "alien structure or bioluminescent growth is the moment of encounter",
240
+ "support_beat": "organic walls and alien pods build the otherworldly context",
241
+ "atmosphere_beat": "bioluminescent mist and eerie silence enforce the unknown",
242
+ "viewer_path": ["hero_zone", "midground", "background"],
243
+ "visual_flow": "exploratory — alien architecture resists familiar reading order",
244
+ },
245
+ "cyberpunk_city": {
246
+ "theme": "dystopian society",
247
+ "hero_beat": "megastructure or neon-lit street scene anchors the power imbalance",
248
+ "support_beat": "street vendors and hologram ads show the human cost",
249
+ "atmosphere_beat": "neon rain and city haze compress layers of story",
250
+ "viewer_path": ["hero_zone", "midground", "background"],
251
+ "visual_flow": "centrifugal — neon light radiates outward from hero signage",
252
+ },
253
+ # -----------------------------------------------------------------------
254
+ # §39 Urban
255
+ # -----------------------------------------------------------------------
256
+ "city_street": {
257
+ "theme": "urban life",
258
+ "hero_beat": "street-level scene or iconic vehicle places the viewer in the city",
259
+ "support_beat": "street furniture and building facades frame the urban context",
260
+ "atmosphere_beat": "city haze and golden street light build living atmosphere",
261
+ "viewer_path": ["hero_zone", "midground", "background"],
262
+ "visual_flow": "linear — street perspective forces the eye to the vanishing point",
263
+ },
264
+ "alleyway": {
265
+ "theme": "urban underbelly",
266
+ "hero_beat": "dumpster or fire escape is the hidden world made visible",
267
+ "support_beat": "graffiti and brick walls build the back-street narrative",
268
+ "atmosphere_beat": "spill light and rain puddle reflections create atmosphere",
269
+ "viewer_path": ["hero_zone", "midground", "background"],
270
+ "visual_flow": "linear — narrow alley depth forces linear progression",
271
+ },
272
+ "subway_station": {
273
+ "theme": "underground transit",
274
+ "hero_beat": "arriving train or platform edge frames the commuter drama",
275
+ "support_beat": "pillars and signage build the transit system reality",
276
+ "atmosphere_beat": "tunnel wind and fluorescent flicker place us underground",
277
+ "viewer_path": ["hero_zone", "midground", "background"],
278
+ "visual_flow": "linear — platform extends to tunnel darkness beyond",
279
+ },
280
+ "parking_garage": {
281
+ "theme": "urban isolation",
282
+ "hero_beat": "parked vehicle or ramp entrance defines the hidden space",
283
+ "support_beat": "columns and painted markings build the structural grid",
284
+ "atmosphere_beat": "harsh overhead light and deep column shadow enforce isolation",
285
+ "viewer_path": ["hero_zone", "midground", "background"],
286
+ "visual_flow": "grid — column grid imposes urban structural order",
287
+ },
288
+ "rooftop": {
289
+ "theme": "perspective above",
290
+ "hero_beat": "skyline view or water tower places us above the city",
291
+ "support_beat": "HVAC units and antennae ground the urban context",
292
+ "atmosphere_beat": "city glow at night or golden sky create emotional resonance",
293
+ "viewer_path": ["hero_zone", "midground", "background"],
294
+ "visual_flow": "panoramic — open sky invites free exploration of the horizon",
295
+ },
296
+ "shopping_mall": {
297
+ "theme": "consumer culture",
298
+ "hero_beat": "atrium or escalator frames the commercial world as spectacle",
299
+ "support_beat": "store displays and signage build the consumer environment",
300
+ "atmosphere_beat": "skylight and retail warmth create the seduction of commerce",
301
+ "viewer_path": ["hero_zone", "midground", "background"],
302
+ "visual_flow": "centrifugal — atrium radiates commercial energy outward",
303
+ },
304
+ # -----------------------------------------------------------------------
305
+ # §39 Interior
306
+ # -----------------------------------------------------------------------
307
+ "western_room": {
308
+ "theme": "frontier gathering",
309
+ "hero_beat": "central table or bar counter anchors the social drama",
310
+ "support_beat": "barrels, crates, and period props establish the era",
311
+ "atmosphere_beat": "warm lantern light narrates the time and place without words",
312
+ "viewer_path": ["hero_zone", "bar_area", "midground", "background"],
313
+ "visual_flow": "centrifugal — warmth radiates from the central practical light",
314
+ },
315
+ "saloon": {
316
+ "theme": "frontier social hub",
317
+ "hero_beat": "bar counter or poker table is the stage for confrontation",
318
+ "support_beat": "piano and whiskey bottles build the saloon identity",
319
+ "atmosphere_beat": "amber kerosene warmth and sawdust floor tell the era",
320
+ "viewer_path": ["hero_zone", "bar_area", "midground", "background"],
321
+ "visual_flow": "centrifugal — bar is the social axis of the scene",
322
+ },
323
+ "living_room": {
324
+ "theme": "domestic life",
325
+ "hero_beat": "sofa or fireplace is the heart of domestic comfort",
326
+ "support_beat": "lamps and books frame personal life in quiet detail",
327
+ "atmosphere_beat": "warm ambient light communicates safety and belonging",
328
+ "viewer_path": ["hero_zone", "midground", "background"],
329
+ "visual_flow": "centrifugal — warmth radiates from the domestic center",
330
+ },
331
+ "office": {
332
+ "theme": "professional pursuit",
333
+ "hero_beat": "executive desk or conference table is the center of decisions",
334
+ "support_beat": "monitors and documents frame the corporate reality",
335
+ "atmosphere_beat": "fluorescent cool and corporate neutral reinforce the environment",
336
+ "viewer_path": ["hero_zone", "midground", "background"],
337
+ "visual_flow": "grid — desk rows impose corporate order on the viewer",
338
+ },
339
+ "hotel_lobby": {
340
+ "theme": "luxury arrival",
341
+ "hero_beat": "grand chandelier or reception desk makes the first impression",
342
+ "support_beat": "luggage and plants frame the transient gathering",
343
+ "atmosphere_beat": "warm luxury light and marble floor communicate prestige",
344
+ "viewer_path": ["hero_zone", "midground", "background"],
345
+ "visual_flow": "upward — chandelier and high ceiling draw the eye skyward",
346
+ },
347
+ "restaurant": {
348
+ "theme": "social dining",
349
+ "hero_beat": "table set for dining or open kitchen frames the culinary ritual",
350
+ "support_beat": "candles and wine glasses build romantic or social context",
351
+ "atmosphere_beat": "warm pendant light and ambient hum create dining magic",
352
+ "viewer_path": ["hero_zone", "midground", "background"],
353
+ "visual_flow": "grid — table arrangement guides the eye in social rows",
354
+ },
355
+ "workshop": {
356
+ "theme": "skilled craft",
357
+ "hero_beat": "workbench or power tool is the stage of making",
358
+ "support_beat": "tool racks and blueprints frame expertise and intent",
359
+ "atmosphere_beat": "task lamp warmth and sawdust convey the honesty of craft",
360
+ "viewer_path": ["hero_zone", "midground", "background"],
361
+ "visual_flow": "centrifugal — bench radiates the maker's focused attention",
362
+ },
363
+ "library": {
364
+ "theme": "accumulated knowledge",
365
+ "hero_beat": "bookshelf wall or reading table holds the accumulated mind",
366
+ "support_beat": "lamps and catalog drawers frame the system of knowledge",
367
+ "atmosphere_beat": "warm reading light and dust motes convey time and wisdom",
368
+ "viewer_path": ["hero_zone", "midground", "background"],
369
+ "visual_flow": "grid — shelf rows invite systematic left-to-right reading",
370
+ },
371
+ # -----------------------------------------------------------------------
372
+ # §39 Nature
373
+ # -----------------------------------------------------------------------
374
+ "forest": {
375
+ "theme": "nature immersion",
376
+ "hero_beat": "ancient tree or forest clearing is the still point of the natural world",
377
+ "support_beat": "ferns, mushrooms, and undergrowth build the layered ecosystem",
378
+ "atmosphere_beat": "volumetric light shafts and mist reveal the forest spirit",
379
+ "viewer_path": ["hero_zone", "midground", "background"],
380
+ "visual_flow": "exploratory — scattered trees resist single directional reading",
381
+ },
382
+ "jungle": {
383
+ "theme": "primal nature",
384
+ "hero_beat": "waterfall or jungle canopy break commands the sense of discovery",
385
+ "support_beat": "vines and exotic flora build the lush density narrative",
386
+ "atmosphere_beat": "tropical humidity and diffuse canopy light enforce immersion",
387
+ "viewer_path": ["hero_zone", "midground", "background"],
388
+ "visual_flow": "exploratory — dense growth conceals and reveals progressively",
389
+ },
390
+ "desert": {
391
+ "theme": "elemental isolation",
392
+ "hero_beat": "dune formation or rock arch commands the desolate horizon",
393
+ "support_beat": "scattered cacti and rock establish the arid world",
394
+ "atmosphere_beat": "heat shimmer and bleached light enforce elemental harshness",
395
+ "viewer_path": ["hero_zone", "midground", "background"],
396
+ "visual_flow": "horizontal — open desert invites horizon-to-horizon scanning",
397
+ },
398
+ "canyon": {
399
+ "theme": "geological time",
400
+ "hero_beat": "canyon wall or rock formation makes geological history visible",
401
+ "support_beat": "layered rock and river stones narrate millions of years",
402
+ "atmosphere_beat": "red dust and canyon shadow enforce the weight of time",
403
+ "viewer_path": ["hero_zone", "midground", "background"],
404
+ "visual_flow": "vertical — cliff walls direct the eye upward and downward",
405
+ },
406
+ "mountain": {
407
+ "theme": "epic journey",
408
+ "hero_beat": "mountain peak or glacier reveals the summit as narrative goal",
409
+ "support_beat": "boulders and alpine plants scale the heroic path",
410
+ "atmosphere_beat": "cloud wrap and alpine crisp reinforce the achievement of altitude",
411
+ "viewer_path": ["hero_zone", "midground", "background"],
412
+ "visual_flow": "upward — mountain forces the eye toward summit and sky",
413
+ },
414
+ "coastline": {
415
+ "theme": "boundary of worlds",
416
+ "hero_beat": "sea cliff or lighthouse marks the edge of land and sea",
417
+ "support_beat": "rock pools and sea grass bridge the two worlds",
418
+ "atmosphere_beat": "sea spray and coastal wind enforce the meeting of elements",
419
+ "viewer_path": ["hero_zone", "midground", "background"],
420
+ "visual_flow": "horizontal — shoreline horizon draws the eye to the vanishing line",
421
+ },
422
+ "swamp": {
423
+ "theme": "dark mystery",
424
+ "hero_beat": "cypress tree or murky water surface holds the hidden world",
425
+ "support_beat": "Spanish moss and mangrove roots build the layered wetland",
426
+ "atmosphere_beat": "swamp fog and murky green enforce the sense of hidden danger",
427
+ "viewer_path": ["hero_zone", "midground", "background"],
428
+ "visual_flow": "exploratory — fog conceals and reveals the swamp progressively",
429
+ },
430
+ # -----------------------------------------------------------------------
431
+ # §39 Fantasy
432
+ # -----------------------------------------------------------------------
433
+ "castle_hall": {
434
+ "theme": "royal authority",
435
+ "hero_beat": "throne or great fireplace dominates, establishing the seat of power",
436
+ "support_beat": "tapestries and columns frame the power structure and lineage",
437
+ "atmosphere_beat": "torch light and stone echo medieval grandeur and history",
438
+ "viewer_path": ["hero_zone", "column_run_left", "column_run_right", "midground", "background"],
439
+ "visual_flow": "convergent — column rows guide the eye to the throne",
440
+ },
441
+ "dungeon": {
442
+ "theme": "captivity and consequence",
443
+ "hero_beat": "prison cell or iron door is the visible instrument of power",
444
+ "support_beat": "chains and torches build the oppressive reality",
445
+ "atmosphere_beat": "near-total darkness and damp echo enforce claustrophobia",
446
+ "viewer_path": ["hero_zone", "midground", "background"],
447
+ "visual_flow": "tunnel — single torch light pulls the eye through darkness",
448
+ },
449
+ "wizard_tower": {
450
+ "theme": "arcane knowledge",
451
+ "hero_beat": "crystal orb or magical apparatus is the center of arcane power",
452
+ "support_beat": "spell books and potion bottles frame the scholar's world",
453
+ "atmosphere_beat": "magical mist and candle glow create mystical wonder",
454
+ "viewer_path": ["hero_zone", "midground", "background"],
455
+ "visual_flow": "spiral — tower staircase winds the eye upward through knowledge",
456
+ },
457
+ "ancient_ruins": {
458
+ "theme": "lost civilization",
459
+ "hero_beat": "broken column or ancient statue makes the lost world tangible",
460
+ "support_beat": "overgrown stone and inscriptions fill in the civilization's story",
461
+ "atmosphere_beat": "jungle mist and golden ruin light frame the passage of time",
462
+ "viewer_path": ["hero_zone", "midground", "background"],
463
+ "visual_flow": "exploratory — ruins scatter the eye in archaeological discovery",
464
+ },
465
+ "temple": {
466
+ "theme": "sacred devotion",
467
+ "hero_beat": "altar or deity statue is the focus of spiritual attention",
468
+ "support_beat": "incense holders and offerings build the devotional context",
469
+ "atmosphere_beat": "divine shaft light and incense smoke enforce the sacred",
470
+ "viewer_path": ["hero_zone", "midground", "background"],
471
+ "visual_flow": "convergent — all ritual paths lead to the altar",
472
+ },
473
+ # -----------------------------------------------------------------------
474
+ # §39 Post-Apocalyptic
475
+ # -----------------------------------------------------------------------
476
+ "abandoned_city": {
477
+ "theme": "civilization collapse",
478
+ "hero_beat": "collapsed building or overgrown street makes the fall of civilization visible",
479
+ "support_beat": "abandoned vehicles and broken glass build the scale of loss",
480
+ "atmosphere_beat": "ash haze and overcast grey enforce desolation",
481
+ "viewer_path": ["hero_zone", "midground", "background"],
482
+ "visual_flow": "exploratory — ruins and overgrowth scatter the eye across decay",
483
+ },
484
+ "destroyed_highway": {
485
+ "theme": "last road",
486
+ "hero_beat": "wrecked vehicle pile or overpass ruin frames the collapse of infrastructure",
487
+ "support_beat": "abandoned cars and road debris tell the story of the last journey",
488
+ "atmosphere_beat": "ash drift and grey overcast enforce the silence of the end",
489
+ "viewer_path": ["hero_zone", "midground", "background"],
490
+ "visual_flow": "linear — highway perspective extends to the desolate vanishing point",
491
+ },
492
+ "ruined_industrial_site": {
493
+ "theme": "industrial apocalypse",
494
+ "hero_beat": "collapsed structure or contaminated zone reveals the cost of collapse",
495
+ "support_beat": "warning signs and chemical drums build the toxic narrative",
496
+ "atmosphere_beat": "toxic haze and chemical green light enforce the environmental horror",
497
+ "viewer_path": ["hero_zone", "midground", "background"],
498
+ "visual_flow": "exploratory — structural failure creates unpredictable sight lines",
499
+ },
500
+ "survival_camp": {
501
+ "theme": "human resilience",
502
+ "hero_beat": "campfire or barricade wall holds the survivors in the last community",
503
+ "support_beat": "scavenged supplies and improvised shelters frame the will to survive",
504
+ "atmosphere_beat": "campfire warmth against grey ash creates hope through contrast",
505
+ "viewer_path": ["hero_zone", "perimeter", "midground", "background"],
506
+ "visual_flow": "centrifugal — campfire warmth radiates outward against the grey world",
507
+ },
508
+ }
509
+
510
+ _DEFAULT_NARRATIVE = _ENV_NARRATIVES["industrial_hangar"]
511
+
512
+
513
+ # ---------------------------------------------------------------------------
514
+ # Data models
515
+ # ---------------------------------------------------------------------------
516
+
517
+ @dataclass
518
+ class StoryBeat:
519
+ """A single narrative moment in the scene layout."""
520
+
521
+ beat_id: str
522
+ beat_type: str # hero, support, atmosphere, transition
523
+ zone_name: str
524
+ description: str
525
+ assets: List[Dict[str, Any]] = field(default_factory=list)
526
+ priority: int = 5 # 1 = first seen, 10 = most important
527
+ notes: List[str] = field(default_factory=list)
528
+
529
+ def to_dict(self) -> Dict[str, Any]:
530
+ return {
531
+ "beat_id": self.beat_id,
532
+ "beat_type": self.beat_type,
533
+ "zone_name": self.zone_name,
534
+ "description": self.description,
535
+ "assets": list(self.assets),
536
+ "priority": self.priority,
537
+ "notes": list(self.notes),
538
+ }
539
+
540
+ @classmethod
541
+ def from_dict(cls, d: Dict[str, Any]) -> "StoryBeat":
542
+ return cls(
543
+ beat_id=str(d.get("beat_id", "")),
544
+ beat_type=str(d.get("beat_type", "support")),
545
+ zone_name=str(d.get("zone_name", "")),
546
+ description=str(d.get("description", "")),
547
+ assets=list(d.get("assets") or []),
548
+ priority=int(d.get("priority", 5)),
549
+ notes=list(d.get("notes") or []),
550
+ )
551
+
552
+
553
+ @dataclass
554
+ class StoryLayout:
555
+ """Complete storytelling layout for an environment."""
556
+
557
+ layout_id: str = field(default_factory=lambda: f"story_{uuid.uuid4().hex[:10]}")
558
+ environment: str = ""
559
+ theme: str = ""
560
+ hero_zone: str = ""
561
+ support_zones: List[str] = field(default_factory=list)
562
+ beats: List[StoryBeat] = field(default_factory=list)
563
+ viewer_path: List[str] = field(default_factory=list)
564
+ visual_flow: str = ""
565
+ camera_hint: str = ""
566
+ ok: bool = True
567
+ errors: List[str] = field(default_factory=list)
568
+ warnings: List[str] = field(default_factory=list)
569
+ generated_at: float = field(default_factory=time.time)
570
+
571
+ def to_dict(self) -> Dict[str, Any]:
572
+ return {
573
+ "layout_id": self.layout_id,
574
+ "environment": self.environment,
575
+ "theme": self.theme,
576
+ "hero_zone": self.hero_zone,
577
+ "support_zones": list(self.support_zones),
578
+ "beats": [b.to_dict() for b in self.beats],
579
+ "viewer_path": list(self.viewer_path),
580
+ "visual_flow": self.visual_flow,
581
+ "camera_hint": self.camera_hint,
582
+ "ok": self.ok,
583
+ "errors": list(self.errors),
584
+ "warnings": list(self.warnings),
585
+ "generated_at": self.generated_at,
586
+ }
587
+
588
+ @classmethod
589
+ def from_dict(cls, d: Dict[str, Any]) -> "StoryLayout":
590
+ return cls(
591
+ layout_id=str(d.get("layout_id", f"story_{uuid.uuid4().hex[:10]}")),
592
+ environment=str(d.get("environment", "")),
593
+ theme=str(d.get("theme", "")),
594
+ hero_zone=str(d.get("hero_zone", "")),
595
+ support_zones=list(d.get("support_zones") or []),
596
+ beats=[StoryBeat.from_dict(b) for b in (d.get("beats") or [])],
597
+ viewer_path=list(d.get("viewer_path") or []),
598
+ visual_flow=str(d.get("visual_flow", "")),
599
+ camera_hint=str(d.get("camera_hint", "")),
600
+ ok=bool(d.get("ok", True)),
601
+ errors=list(d.get("errors") or []),
602
+ warnings=list(d.get("warnings") or []),
603
+ generated_at=float(d.get("generated_at", 0.0)),
604
+ )
605
+
606
+
607
+ # ---------------------------------------------------------------------------
608
+ # Engine
609
+ # ---------------------------------------------------------------------------
610
+
611
+ class StorytellingLayoutEngine:
612
+ """
613
+ Generates visual storytelling structure from an EnvironmentPlan.
614
+ Identifies hero, support, and atmosphere beats; derives the viewer's path.
615
+ """
616
+
617
+ def generate_story_layout(self, env_plan: EnvironmentPlan) -> StoryLayout:
618
+ """
619
+ Build a full StoryLayout from an EnvironmentPlan.
620
+ Never raises — errors captured in StoryLayout.errors.
621
+ """
622
+ layout = StoryLayout(environment=env_plan.environment)
623
+ try:
624
+ narrative = _ENV_NARRATIVES.get(env_plan.environment, _DEFAULT_NARRATIVE)
625
+ layout.theme = narrative["theme"]
626
+ layout.visual_flow = narrative["visual_flow"]
627
+
628
+ # Identify zones
629
+ layout.hero_zone = self.identify_hero_area(env_plan)
630
+ layout.support_zones = self.identify_support_areas(env_plan)
631
+
632
+ # Build story beats
633
+ layout.beats = self._build_beats(env_plan, narrative)
634
+
635
+ # Viewer path
636
+ layout.viewer_path = self.generate_viewer_path(env_plan, narrative)
637
+
638
+ # Camera hint from template narrative
639
+ tmpl = get_placement_templates().get_template_or_default(env_plan.environment)
640
+ tmpl_narrative = tmpl.get("narrative", {})
641
+ layout.camera_hint = str(tmpl_narrative.get("atmosphere_beat", ""))
642
+
643
+ if not layout.hero_zone:
644
+ layout.warnings.append("No hero zone identified — visual storytelling will be weak.")
645
+
646
+ layout.ok = True
647
+
648
+ except Exception as exc:
649
+ layout.ok = False
650
+ layout.errors.append(f"Story layout failed: {exc}")
651
+
652
+ return layout
653
+
654
+ def identify_hero_area(self, env_plan: EnvironmentPlan) -> str:
655
+ """Return the name of the primary hero zone."""
656
+ if "hero_zone" in env_plan.zones:
657
+ return "hero_zone"
658
+ # Fallback: zone with 'primary' role
659
+ for name, zone in env_plan.zones.items():
660
+ if zone.role == "primary":
661
+ return name
662
+ return ""
663
+
664
+ def identify_support_areas(self, env_plan: EnvironmentPlan) -> List[str]:
665
+ """Return zone names that provide narrative support (non-hero, non-atmosphere)."""
666
+ result = []
667
+ for name, zone in env_plan.zones.items():
668
+ if zone.role in ("support", "detail") and name != "hero_zone":
669
+ result.append(name)
670
+ return result
671
+
672
+ def generate_visual_flow(self, env_plan: EnvironmentPlan) -> str:
673
+ """Return the visual flow description for the environment."""
674
+ narrative = _ENV_NARRATIVES.get(env_plan.environment, _DEFAULT_NARRATIVE)
675
+ return str(narrative.get("visual_flow", "centrifugal — eye starts at hero"))
676
+
677
+ def generate_viewer_path(
678
+ self,
679
+ env_plan: EnvironmentPlan,
680
+ narrative: Optional[Dict[str, Any]] = None,
681
+ ) -> List[str]:
682
+ """
683
+ Return the ordered list of zones the viewer's eye traverses.
684
+ Only includes zones that exist in the environment plan.
685
+ """
686
+ if narrative is None:
687
+ narrative = _ENV_NARRATIVES.get(env_plan.environment, _DEFAULT_NARRATIVE)
688
+ raw_path = narrative.get("viewer_path", ["hero_zone", "midground", "background"])
689
+ return [z for z in raw_path if z in env_plan.zones]
690
+
691
+ # ------------------------------------------------------------------
692
+ # Internal
693
+ # ------------------------------------------------------------------
694
+
695
+ def _build_beats(
696
+ self,
697
+ env_plan: EnvironmentPlan,
698
+ narrative: Dict[str, Any],
699
+ ) -> List[StoryBeat]:
700
+ """Build ordered story beats from zone roles and narrative data."""
701
+ beats: List[StoryBeat] = []
702
+
703
+ # Hero beat
704
+ hero_zone = self.identify_hero_area(env_plan)
705
+ if hero_zone and hero_zone in env_plan.zones:
706
+ zone = env_plan.zones[hero_zone]
707
+ beats.append(StoryBeat(
708
+ beat_id=f"beat_hero_{uuid.uuid4().hex[:6]}",
709
+ beat_type="hero",
710
+ zone_name=hero_zone,
711
+ description=narrative.get("hero_beat", "Hero asset establishes scene focus"),
712
+ assets=list(zone.assigned_assets),
713
+ priority=10,
714
+ ))
715
+
716
+ # Support beats (one per support zone)
717
+ for zone_name in self.identify_support_areas(env_plan):
718
+ zone = env_plan.zones.get(zone_name)
719
+ if not zone:
720
+ continue
721
+ beats.append(StoryBeat(
722
+ beat_id=f"beat_support_{uuid.uuid4().hex[:6]}",
723
+ beat_type="support",
724
+ zone_name=zone_name,
725
+ description=narrative.get("support_beat", "Support assets contextualise the hero"),
726
+ assets=list(zone.assigned_assets),
727
+ priority=6,
728
+ ))
729
+
730
+ # Atmosphere beat (background / atmosphere zones)
731
+ for zone_name, zone in env_plan.zones.items():
732
+ if zone.role == "atmosphere" or zone_name == "background":
733
+ beats.append(StoryBeat(
734
+ beat_id=f"beat_atm_{uuid.uuid4().hex[:6]}",
735
+ beat_type="atmosphere",
736
+ zone_name=zone_name,
737
+ description=narrative.get("atmosphere_beat", "Atmosphere establishes mood"),
738
+ assets=list(zone.assigned_assets),
739
+ priority=3,
740
+ ))
741
+ break # one atmosphere beat is enough
742
+
743
+ return sorted(beats, key=lambda b: -b.priority)
744
+
745
+
746
+ # ---------------------------------------------------------------------------
747
+ # Singleton
748
+ # ---------------------------------------------------------------------------
749
+
750
+ _INSTANCE: Optional[StorytellingLayoutEngine] = None
751
+ _INSTANCE_LOCK = threading.Lock()
752
+
753
+
754
+ def get_storytelling_layout_engine() -> StorytellingLayoutEngine:
755
+ """Return the module-level singleton StorytellingLayoutEngine."""
756
+ global _INSTANCE
757
+ if _INSTANCE is None:
758
+ with _INSTANCE_LOCK:
759
+ if _INSTANCE is None:
760
+ _INSTANCE = StorytellingLayoutEngine()
761
+ return _INSTANCE
762
+
763
+
764
+ def reset_storytelling_layout_engine_for_tests() -> None:
765
+ """Replace the singleton. For test isolation only."""
766
+ global _INSTANCE
767
+ with _INSTANCE_LOCK:
768
+ _INSTANCE = None