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.
- src/__init__.py +1 -0
- src/runtime/__init__.py +187 -0
- src/runtime/agent_runtime.py +315 -0
- src/runtime/ai_planner.py +371 -0
- src/runtime/approval_pipeline.py +237 -0
- src/runtime/architectural_features/__init__.py +68 -0
- src/runtime/architectural_features/architectural_feature_realizer.py +279 -0
- src/runtime/architectural_features/architectural_plan.py +421 -0
- src/runtime/architectural_features/architectural_plan_builder.py +428 -0
- src/runtime/architectural_features/environment_architecture_review.py +398 -0
- src/runtime/asset_identity/__init__.py +103 -0
- src/runtime/asset_identity/asset_identity_auditor.py +532 -0
- src/runtime/asset_identity/identity_review.py +248 -0
- src/runtime/asset_identity/identity_serializer.py +76 -0
- src/runtime/asset_identity/identity_statistics.py +132 -0
- src/runtime/asset_identity/opaque_id_detector.py +167 -0
- src/runtime/asset_identity/role_engine_validator.py +134 -0
- src/runtime/asset_identity/role_geometry_validator.py +161 -0
- src/runtime/asset_knowledge_graph.py +505 -0
- src/runtime/asset_staging_manager.py +350 -0
- src/runtime/assets/__init__.py +310 -0
- src/runtime/assets/acquisition/__init__.py +109 -0
- src/runtime/assets/acquisition/acquisition_manager.py +431 -0
- src/runtime/assets/acquisition/download_registry.py +324 -0
- src/runtime/assets/acquisition/fab_library_scanner.py +384 -0
- src/runtime/assets/acquisition/library_index.py +379 -0
- src/runtime/assets/acquisition/library_watcher.py +362 -0
- src/runtime/assets/acquisition/megascans_scanner.py +551 -0
- src/runtime/assets/acquisition_online/__init__.py +211 -0
- src/runtime/assets/acquisition_online/acquisition_pipeline.py +279 -0
- src/runtime/assets/acquisition_online/asset_cache_manager.py +265 -0
- src/runtime/assets/acquisition_online/asset_fetcher.py +361 -0
- src/runtime/assets/acquisition_online/asset_provenance_tracker.py +231 -0
- src/runtime/assets/acquisition_online/download_queue.py +297 -0
- src/runtime/assets/acquisition_online/download_review.py +253 -0
- src/runtime/assets/acquisition_online/download_scheduler.py +188 -0
- src/runtime/assets/acquisition_online/download_serializer.py +116 -0
- src/runtime/assets/acquisition_online/download_statistics.py +145 -0
- src/runtime/assets/acquisition_online/fab_socket_receiver.py +449 -0
- src/runtime/assets/acquisition_online/megascans_auth.py +408 -0
- src/runtime/assets/acquisition_online/megascans_download.py +391 -0
- src/runtime/assets/acquisition_online/megascans_search.py +313 -0
- src/runtime/assets/acquisition_online/project_asset_staging.py +221 -0
- src/runtime/assets/acquisition_online/provider_session_manager.py +182 -0
- src/runtime/assets/acquisition_online/quixel_bridge_client.py +380 -0
- src/runtime/assets/assembly/__init__.py +288 -0
- src/runtime/assets/assembly/anchor_asset_engine.py +387 -0
- src/runtime/assets/assembly/architectural_templates.py +493 -0
- src/runtime/assets/assembly/asset_clustering_engine.py +343 -0
- src/runtime/assets/assembly/asset_placement_engine.py +553 -0
- src/runtime/assets/assembly/asset_scale_analyzer.py +278 -0
- src/runtime/assets/assembly/bounding_box_extractor.py +227 -0
- src/runtime/assets/assembly/clearance_validator.py +204 -0
- src/runtime/assets/assembly/collision_detector.py +208 -0
- src/runtime/assets/assembly/composition_constraints.py +291 -0
- src/runtime/assets/assembly/decorative_population_engine.py +419 -0
- src/runtime/assets/assembly/environment_blueprint.py +92 -0
- src/runtime/assets/assembly/environment_builder.py +401 -0
- src/runtime/assets/assembly/environment_completeness_review.py +500 -0
- src/runtime/assets/assembly/environment_review.py +454 -0
- src/runtime/assets/assembly/environment_scale_review.py +490 -0
- src/runtime/assets/assembly/environment_structure_builder.py +344 -0
- src/runtime/assets/assembly/environment_zones.py +332 -0
- src/runtime/assets/assembly/footprint_calculator.py +181 -0
- src/runtime/assets/assembly/layout_spacing_engine.py +350 -0
- src/runtime/assets/assembly/placement_optimizer.py +272 -0
- src/runtime/assets/assembly/placement_relationships.py +380 -0
- src/runtime/assets/assembly/placement_templates.py +1024 -0
- src/runtime/assets/assembly/scene_population_engine.py +351 -0
- src/runtime/assets/assembly/semantic_placement_rules.py +323 -0
- src/runtime/assets/assembly/spatial_metadata.py +118 -0
- src/runtime/assets/assembly/spatial_review.py +304 -0
- src/runtime/assets/assembly/storytelling_layout_engine.py +768 -0
- src/runtime/assets/assembly/unit_normalizer.py +192 -0
- src/runtime/assets/cache/__init__.py +39 -0
- src/runtime/assets/cache/asset_cache.py +330 -0
- src/runtime/assets/cache/asset_storage.py +234 -0
- src/runtime/assets/cache/asset_sync.py +280 -0
- src/runtime/assets/discovery/__init__.py +17 -0
- src/runtime/assets/discovery/asset_discovery_engine.py +223 -0
- src/runtime/assets/download/__init__.py +24 -0
- src/runtime/assets/download/asset_download_manager.py +275 -0
- src/runtime/assets/geometry/__init__.py +149 -0
- src/runtime/assets/geometry/asset_metrics.py +476 -0
- src/runtime/assets/geometry/bounding_box_extractor.py +478 -0
- src/runtime/assets/geometry/geometry_analyzer.py +251 -0
- src/runtime/assets/geometry/geometry_review.py +463 -0
- src/runtime/assets/geometry/geometry_serializer.py +121 -0
- src/runtime/assets/geometry/geometry_statistics.py +206 -0
- src/runtime/assets/geometry/ground_contact_detector.py +277 -0
- src/runtime/assets/geometry/pivot_detector.py +248 -0
- src/runtime/assets/geometry/support_surface_detector.py +299 -0
- src/runtime/assets/logging/__init__.py +17 -0
- src/runtime/assets/logging/asset_logger.py +153 -0
- src/runtime/assets/metadata/__init__.py +65 -0
- src/runtime/assets/metadata/asset_metadata_enricher.py +215 -0
- src/runtime/assets/metadata/asset_provenance.py +273 -0
- src/runtime/assets/metadata/asset_semantic_mapper.py +265 -0
- src/runtime/assets/metadata/provider_normalizer.py +364 -0
- src/runtime/assets/providers/__init__.py +38 -0
- src/runtime/assets/providers/base.py +218 -0
- src/runtime/assets/providers/local_library_provider.py +209 -0
- src/runtime/assets/providers/polyhaven_provider.py +268 -0
- src/runtime/assets/providers/provider_manager.py +229 -0
- src/runtime/assets/providers/quixel_provider.py +277 -0
- src/runtime/assets/providers/sketchfab_live_provider.py +515 -0
- src/runtime/assets/providers/sketchfab_provider.py +327 -0
- src/runtime/assets/providers/studio_library_provider.py +323 -0
- src/runtime/assets/providers/usd_library_provider.py +310 -0
- src/runtime/assets/ranking/__init__.py +17 -0
- src/runtime/assets/ranking/asset_ranking_engine.py +365 -0
- src/runtime/assets/real_world_scale.py +189 -0
- src/runtime/assets/realization/__init__.py +162 -0
- src/runtime/assets/realization/asset_converter.py +282 -0
- src/runtime/assets/realization/asset_dependency_resolver.py +285 -0
- src/runtime/assets/realization/asset_importer.py +298 -0
- src/runtime/assets/realization/asset_instancer.py +269 -0
- src/runtime/assets/realization/asset_material_mapper.py +337 -0
- src/runtime/assets/realization/asset_normalizer.py +319 -0
- src/runtime/assets/realization/asset_realization_review.py +416 -0
- src/runtime/assets/realization/asset_validation_pipeline.py +316 -0
- src/runtime/assets/realization/realization_serializer.py +172 -0
- src/runtime/assets/realization/realization_statistics.py +265 -0
- src/runtime/assets/realization/scene_asset_realizer.py +405 -0
- src/runtime/assets/realization/usd_builder.py +272 -0
- src/runtime/assets/recommendations/__init__.py +17 -0
- src/runtime/assets/recommendations/asset_recommendation_engine.py +260 -0
- src/runtime/assets/schema/__init__.py +38 -0
- src/runtime/assets/schema/asset_descriptor.py +484 -0
- src/runtime/assets/semantic/__init__.py +234 -0
- src/runtime/assets/semantic/asset_catalog.py +368 -0
- src/runtime/assets/semantic/asset_catalog_review.py +266 -0
- src/runtime/assets/semantic/asset_catalog_serializer.py +103 -0
- src/runtime/assets/semantic/asset_catalog_statistics.py +130 -0
- src/runtime/assets/semantic/asset_catalog_sync.py +248 -0
- src/runtime/assets/semantic/asset_cinematic_mapper.py +156 -0
- src/runtime/assets/semantic/asset_environment_mapper.py +459 -0
- src/runtime/assets/semantic/asset_knowledge_graph.py +257 -0
- src/runtime/assets/semantic/asset_lookdev_mapper.py +180 -0
- src/runtime/assets/semantic/asset_manifest_reader.py +236 -0
- src/runtime/assets/semantic/asset_metadata_extractor.py +167 -0
- src/runtime/assets/semantic/asset_metadata_provider.py +231 -0
- src/runtime/assets/semantic/asset_query_engine.py +240 -0
- src/runtime/assets/semantic/asset_role_classifier.py +193 -0
- src/runtime/assets/semantic/asset_storytelling_mapper.py +163 -0
- src/runtime/assets/semantic/megascans_metadata_client.py +345 -0
- src/runtime/assets/semantic/semantic_asset_enricher.py +232 -0
- src/runtime/assets/serialization/__init__.py +15 -0
- src/runtime/assets/serialization/asset_serializer.py +201 -0
- src/runtime/assets/suitability/__init__.py +115 -0
- src/runtime/assets/suitability/asset_suitability_engine.py +345 -0
- src/runtime/assets/suitability/asset_suitability_review.py +193 -0
- src/runtime/assets/suitability/asset_suitability_serializer.py +67 -0
- src/runtime/assets/suitability/asset_suitability_statistics.py +141 -0
- src/runtime/assets/suitability/environment_affinity.py +290 -0
- src/runtime/assets/suitability/material_affinity.py +247 -0
- src/runtime/assets/suitability/placement_affinity.py +153 -0
- src/runtime/assets/suitability/role_affinity.py +205 -0
- src/runtime/assets/suitability/scale_affinity.py +150 -0
- src/runtime/assets/suitability/story_affinity.py +235 -0
- src/runtime/assets/suitability/style_affinity.py +252 -0
- src/runtime/assets/validation/__init__.py +17 -0
- src/runtime/assets/validation/asset_validation_engine.py +281 -0
- src/runtime/assets/vector_search/__init__.py +193 -0
- src/runtime/assets/vector_search/asset_embedding_builder.py +132 -0
- src/runtime/assets/vector_search/asset_vector_store.py +264 -0
- src/runtime/assets/vector_search/catalog_vector_index_builder.py +155 -0
- src/runtime/assets/vector_search/embedding_provider.py +294 -0
- src/runtime/assets/vector_search/hybrid_ranking_engine.py +241 -0
- src/runtime/assets/vector_search/intent_embedding_engine.py +99 -0
- src/runtime/assets/vector_search/intent_parser.py +462 -0
- src/runtime/assets/vector_search/retrieval_pipeline.py +275 -0
- src/runtime/assets/vector_search/retrieval_review.py +281 -0
- src/runtime/assets/vector_search/retrieval_serializer.py +91 -0
- src/runtime/assets/vector_search/retrieval_statistics.py +133 -0
- src/runtime/assets/vector_search/semantic_similarity.py +116 -0
- src/runtime/assets/vector_search/vector_search_engine.py +246 -0
- src/runtime/atmosphere_orchestrator.py +412 -0
- src/runtime/audit_store.py +230 -0
- src/runtime/capability_catalog.py +2324 -0
- src/runtime/capability_registry.py +225 -0
- src/runtime/cinematic_camera_engine.py +497 -0
- src/runtime/cinematic_composition.py +399 -0
- src/runtime/cinematic_scene_review.py +539 -0
- src/runtime/contextual_reasoning.py +286 -0
- src/runtime/dependency_graph.py +205 -0
- src/runtime/distributed_runtime.py +348 -0
- src/runtime/environment/__init__.py +189 -0
- src/runtime/environment/anchor_asset_builder.py +389 -0
- src/runtime/environment/atmosphere_builder.py +307 -0
- src/runtime/environment/decorative_population.py +320 -0
- src/runtime/environment/environment_blueprint.py +107 -0
- src/runtime/environment/environment_completeness.py +234 -0
- src/runtime/environment/environment_requirements.py +224 -0
- src/runtime/environment/environment_review.py +320 -0
- src/runtime/environment/environment_serializer.py +100 -0
- src/runtime/environment/environment_statistics.py +149 -0
- src/runtime/environment/environment_structure_builder.py +391 -0
- src/runtime/environment/environment_template_library.py +388 -0
- src/runtime/environment/environment_zone_builder.py +334 -0
- src/runtime/environment/support_asset_builder.py +243 -0
- src/runtime/environment_realization/__init__.py +177 -0
- src/runtime/environment_realization/architectural_constraint_solver.py +230 -0
- src/runtime/environment_realization/beam_builder.py +221 -0
- src/runtime/environment_realization/ceiling_builder.py +186 -0
- src/runtime/environment_realization/environment_execution_engine.py +228 -0
- src/runtime/environment_realization/environment_realization_engine.py +119 -0
- src/runtime/environment_realization/environment_review.py +250 -0
- src/runtime/environment_realization/environment_serializer.py +77 -0
- src/runtime/environment_realization/environment_statistics.py +134 -0
- src/runtime/environment_realization/floor_builder.py +198 -0
- src/runtime/environment_realization/opening_builder.py +224 -0
- src/runtime/environment_realization/room_shell_builder.py +215 -0
- src/runtime/environment_realization/room_shell_completeness_validator.py +303 -0
- src/runtime/environment_realization/structural_attachment_enforcer.py +386 -0
- src/runtime/environment_realization/structural_builder.py +314 -0
- src/runtime/environment_realization/structural_elements.py +258 -0
- src/runtime/environment_realization/structural_routing_engine.py +390 -0
- src/runtime/environment_realization/wall_builder.py +199 -0
- src/runtime/environment_rules.py +239 -0
- src/runtime/environment_shell/__init__.py +187 -0
- src/runtime/environment_shell/environment_readiness_gate.py +187 -0
- src/runtime/environment_shell/environment_shell_audit.py +184 -0
- src/runtime/environment_shell/environment_shell_blueprint.py +267 -0
- src/runtime/environment_shell/environment_shell_builder.py +265 -0
- src/runtime/environment_shell/environment_shell_state.py +133 -0
- src/runtime/environment_shell/shell_ceiling_builder.py +114 -0
- src/runtime/environment_shell/shell_floor_builder.py +96 -0
- src/runtime/environment_shell/shell_phase_result.py +66 -0
- src/runtime/environment_shell/shell_review.py +241 -0
- src/runtime/environment_shell/shell_serializer.py +67 -0
- src/runtime/environment_shell/shell_statistics.py +141 -0
- src/runtime/environment_shell/shell_validator.py +138 -0
- src/runtime/environment_shell/shell_wall_builder.py +156 -0
- src/runtime/environment_shell/structural_anchor_generator.py +200 -0
- src/runtime/environment_shell/structural_element_placer.py +193 -0
- src/runtime/environments/__init__.py +67 -0
- src/runtime/environments/environment_registry.py +1139 -0
- src/runtime/environments/environment_statistics.py +219 -0
- src/runtime/execution_explainer.py +399 -0
- src/runtime/execution_quality.py +258 -0
- src/runtime/execution_review.py +221 -0
- src/runtime/execution_scheduler.py +263 -0
- src/runtime/failure_intelligence.py +341 -0
- src/runtime/goal_decomposer.py +532 -0
- src/runtime/houdini_asset_realizer.py +329 -0
- src/runtime/houdini_runtime.py +992 -0
- src/runtime/intent_parser.py +275 -0
- src/runtime/knowledge_graph.py +310 -0
- src/runtime/layout/__init__.py +172 -0
- src/runtime/layout/affordance_engine.py +384 -0
- src/runtime/layout/anchor_layout_engine.py +244 -0
- src/runtime/layout/decoration_layout_engine.py +325 -0
- src/runtime/layout/furniture_cluster_builder.py +381 -0
- src/runtime/layout/layout_review.py +265 -0
- src/runtime/layout/layout_serializer.py +77 -0
- src/runtime/layout/layout_statistics.py +123 -0
- src/runtime/layout/relationship_graph.py +165 -0
- src/runtime/layout/relationship_graph_builder.py +699 -0
- src/runtime/layout/relationship_layout_engine.py +1101 -0
- src/runtime/layout/relationship_realization_auditor.py +849 -0
- src/runtime/layout/semantic_layout_engine.py +327 -0
- src/runtime/layout/surface_placement_engine.py +270 -0
- src/runtime/layout/wall_attachment_engine.py +243 -0
- src/runtime/layout_realization/__init__.py +183 -0
- src/runtime/layout_realization/cluster_realizer.py +212 -0
- src/runtime/layout_realization/collision_solver.py +359 -0
- src/runtime/layout_realization/identity_metadata_writer.py +257 -0
- src/runtime/layout_realization/layout_application_engine.py +242 -0
- src/runtime/layout_realization/layout_realization_engine.py +293 -0
- src/runtime/layout_realization/layout_validator.py +315 -0
- src/runtime/layout_realization/metadata_application_engine.py +187 -0
- src/runtime/layout_realization/realization_review.py +268 -0
- src/runtime/layout_realization/realization_serializer.py +77 -0
- src/runtime/layout_realization/realization_statistics.py +151 -0
- src/runtime/layout_realization/relationship_metadata_writer.py +305 -0
- src/runtime/layout_realization/relationship_persistence_auditor.py +426 -0
- src/runtime/layout_realization/relationship_realizer.py +294 -0
- src/runtime/layout_realization/scene_constraint_solver.py +317 -0
- src/runtime/layout_realization/surface_realizer.py +195 -0
- src/runtime/layout_realization/transform_resolver.py +268 -0
- src/runtime/layout_realization/wall_attachment_realizer.py +182 -0
- src/runtime/layout_transform_engine.py +341 -0
- src/runtime/lighting/__init__.py +215 -0
- src/runtime/lighting/lighting_color_engine.py +252 -0
- src/runtime/lighting/lighting_environment_mapper.py +792 -0
- src/runtime/lighting/lighting_exposure_engine.py +213 -0
- src/runtime/lighting/lighting_hierarchy_engine.py +248 -0
- src/runtime/lighting/lighting_knowledge.py +342 -0
- src/runtime/lighting/lighting_language.py +239 -0
- src/runtime/lighting/lighting_mood_engine.py +230 -0
- src/runtime/lighting/lighting_patterns.py +522 -0
- src/runtime/lighting/lighting_plan_builder.py +320 -0
- src/runtime/lighting/lighting_readability_engine.py +273 -0
- src/runtime/lighting/lighting_recommendation_engine.py +205 -0
- src/runtime/lighting/lighting_review.py +370 -0
- src/runtime/lighting/lighting_serializer.py +71 -0
- src/runtime/lighting/lighting_statistics.py +142 -0
- src/runtime/lighting/lighting_strategy_engine.py +239 -0
- src/runtime/lighting/lighting_validation.py +183 -0
- src/runtime/llm_provider.py +340 -0
- src/runtime/lookdev/__init__.py +137 -0
- src/runtime/lookdev/lookdev_patterns.py +216 -0
- src/runtime/lookdev/lookdev_review.py +389 -0
- src/runtime/lookdev/lookdev_serializer.py +71 -0
- src/runtime/lookdev/lookdev_statistics.py +133 -0
- src/runtime/lookdev/lookdev_validation.py +203 -0
- src/runtime/lookdev/material_assignment_engine.py +331 -0
- src/runtime/lookdev/material_knowledge.py +244 -0
- src/runtime/lookdev/material_library.py +311 -0
- src/runtime/lookdev/material_recommendation.py +394 -0
- src/runtime/lookdev/renderer_profiles.py +281 -0
- src/runtime/mcp_runtime.py +357 -0
- src/runtime/mcp_server_runtime.py +386 -0
- src/runtime/mcp_session.py +261 -0
- src/runtime/mcp_tool_registry.py +2169 -0
- src/runtime/mcp_transport.py +206 -0
- src/runtime/multi_dcc_runtime.py +316 -0
- src/runtime/orchestration_heuristics.py +360 -0
- src/runtime/pattern_library.py +344 -0
- src/runtime/plan_validator.py +314 -0
- src/runtime/planning/__init__.py +103 -0
- src/runtime/planning/camera/__init__.py +1 -0
- src/runtime/planning/camera/camera_planner.py +179 -0
- src/runtime/planning/composition/__init__.py +1 -0
- src/runtime/planning/composition/composition_planner.py +223 -0
- src/runtime/planning/logging/__init__.py +1 -0
- src/runtime/planning/logging/planning_logger.py +109 -0
- src/runtime/planning/planners/__init__.py +1 -0
- src/runtime/planning/planners/asset_query_generator.py +265 -0
- src/runtime/planning/planners/scene_planner.py +199 -0
- src/runtime/planning/planners/zone_planner.py +271 -0
- src/runtime/planning/recommendations/__init__.py +1 -0
- src/runtime/planning/recommendations/scene_plan_recommendation_engine.py +228 -0
- src/runtime/planning/schema/__init__.py +23 -0
- src/runtime/planning/schema/scene_plan.py +569 -0
- src/runtime/planning/serialization/__init__.py +1 -0
- src/runtime/planning/serialization/plan_serializer.py +147 -0
- src/runtime/planning/validators/__init__.py +1 -0
- src/runtime/planning/validators/scene_plan_validator.py +210 -0
- src/runtime/planning_memory.py +242 -0
- src/runtime/predictive_execution.py +393 -0
- src/runtime/procedural_scene_assembler.py +415 -0
- src/runtime/production_memory.py +309 -0
- src/runtime/production_scoring.py +422 -0
- src/runtime/reality/__init__.py +197 -0
- src/runtime/reality/architectural_integrity_validator.py +220 -0
- src/runtime/reality/beam_connection_validator.py +205 -0
- src/runtime/reality/composition_engine.py +206 -0
- src/runtime/reality/correction_applier.py +159 -0
- src/runtime/reality/correction_pass_engine.py +253 -0
- src/runtime/reality/density_engine.py +145 -0
- src/runtime/reality/floating_object_detector.py +206 -0
- src/runtime/reality/functional_zone_builder.py +260 -0
- src/runtime/reality/geometry_inspector.py +229 -0
- src/runtime/reality/human_reasoning_engine.py +284 -0
- src/runtime/reality/reality_intelligence_engine.py +182 -0
- src/runtime/reality/reality_scene_model.py +351 -0
- src/runtime/reality/reality_serializer.py +75 -0
- src/runtime/reality/reality_statistics.py +145 -0
- src/runtime/reality/support_rule_engine.py +248 -0
- src/runtime/reality/visual_review_engine.py +217 -0
- src/runtime/recommendation_engine.py +358 -0
- src/runtime/render_preparation_engine.py +463 -0
- src/runtime/resource_estimator.py +256 -0
- src/runtime/resource_optimizer.py +343 -0
- src/runtime/review_engine.py +768 -0
- src/runtime/review_feedback.py +325 -0
- src/runtime/runtime_analytics.py +330 -0
- src/runtime/runtime_bootstrap.py +137 -0
- src/runtime/runtime_constraints.py +317 -0
- src/runtime/runtime_federation_api.py +297 -0
- src/runtime/runtime_identity.py +70 -0
- src/runtime/runtime_narration.py +493 -0
- src/runtime/runtime_prompt_context.py +682 -0
- src/runtime/scene_awareness.py +559 -0
- src/runtime/scene_cache.py +277 -0
- src/runtime/scene_hierarchy_builder.py +258 -0
- src/runtime/scene_layout_planner.py +292 -0
- src/runtime/scene_realization_review.py +452 -0
- src/runtime/scene_recommendation_engine.py +398 -0
- src/runtime/scene_validation/__init__.py +118 -0
- src/runtime/scene_validation/occupancy_validator.py +176 -0
- src/runtime/scene_validation/orphan_detector.py +205 -0
- src/runtime/scene_validation/plausibility_engine.py +236 -0
- src/runtime/scene_validation/relationship_validator.py +238 -0
- src/runtime/scene_validation/routing_audit.py +556 -0
- src/runtime/scene_validation/scene_reality_validator.py +229 -0
- src/runtime/scene_validation/support_surface_validator.py +155 -0
- src/runtime/scene_validation/validation_review.py +207 -0
- src/runtime/scene_validation/validation_serializer.py +74 -0
- src/runtime/scene_validation/validation_statistics.py +142 -0
- src/runtime/semantic/__init__.py +113 -0
- src/runtime/semantic/enrichers/__init__.py +12 -0
- src/runtime/semantic/enrichers/scene_intent_enricher.py +305 -0
- src/runtime/semantic/logging/__init__.py +18 -0
- src/runtime/semantic/logging/semantic_logger.py +298 -0
- src/runtime/semantic/prompts/__init__.py +12 -0
- src/runtime/semantic/prompts/intent_prompt_builder.py +317 -0
- src/runtime/semantic/recommendations/__init__.py +17 -0
- src/runtime/semantic/recommendations/intent_recommendation_engine.py +434 -0
- src/runtime/semantic/scene_intent_extractor.py +455 -0
- src/runtime/semantic/schema/__init__.py +40 -0
- src/runtime/semantic/schema/scene_intent_schema.py +349 -0
- src/runtime/semantic/serialization/__init__.py +16 -0
- src/runtime/semantic/serialization/intent_serializer.py +248 -0
- src/runtime/semantic/validators/__init__.py +14 -0
- src/runtime/semantic/validators/scene_intent_validator.py +284 -0
- src/runtime/semantic_execution.py +348 -0
- src/runtime/semantic_import_controller.py +408 -0
- src/runtime/semantic_lighting_engine.py +566 -0
- src/runtime/semantic_memory.py +257 -0
- src/runtime/semantic_registry.py +386 -0
- src/runtime/semantic_scene_templates.py +387 -0
- src/runtime/storage/__init__.py +18 -0
- src/runtime/storage/memory_backend.py +294 -0
- src/runtime/storage/serialization.py +211 -0
- src/runtime/storage/sqlite_backend.py +365 -0
- src/runtime/structure/__init__.py +135 -0
- src/runtime/structure/environment_structural_affinity.py +254 -0
- src/runtime/structure/geometry_role_detector.py +182 -0
- src/runtime/structure/metadata_role_classifier.py +279 -0
- src/runtime/structure/structural_asset_classifier.py +331 -0
- src/runtime/structure/structural_placement_rules.py +326 -0
- src/runtime/structure/structural_review.py +682 -0
- src/runtime/structure/structural_serializer.py +113 -0
- src/runtime/structure/structural_statistics.py +209 -0
- src/runtime/studio/__init__.py +71 -0
- src/runtime/studio/cross_project_learning.py +263 -0
- src/runtime/studio/knowledge_recommendation.py +324 -0
- src/runtime/studio/knowledge_serializer.py +154 -0
- src/runtime/studio/knowledge_statistics.py +107 -0
- src/runtime/studio/production_benchmark.py +240 -0
- src/runtime/studio/project_memory.py +250 -0
- src/runtime/studio/review_analytics.py +166 -0
- src/runtime/studio/studio_knowledge.py +284 -0
- src/runtime/studio/studio_metrics.py +155 -0
- src/runtime/studio/studio_standards.py +262 -0
- src/runtime/studio_knowledge.py +328 -0
- src/runtime/transaction_manager.py +367 -0
- src/runtime/validation_engine.py +234 -0
- src/runtime/visual_hierarchy_engine.py +452 -0
- src/runtime/worker_runtime.py +236 -0
- src/runtime/workflow_federation.py +316 -0
- src/runtime/workflow_optimizer.py +407 -0
- src/runtime/workflow_templates.py +421 -0
- src/runtime/workflows/__init__.py +129 -0
- src/runtime/workflows/workflow_blueprint.py +394 -0
- src/runtime/workflows/workflow_executor.py +344 -0
- src/runtime/workflows/workflow_pack.py +403 -0
- src/runtime/workflows/workflow_recommendation.py +353 -0
- src/runtime/workflows/workflow_registry.py +165 -0
- src/runtime/workflows/workflow_review.py +336 -0
- src/runtime/workflows/workflow_serializer.py +149 -0
- src/runtime/workflows/workflow_statistics.py +205 -0
- src/runtime/workflows/workflow_validator.py +272 -0
- src/utils/__init__.py +0 -0
- src/utils/hou_bridge.py +262 -0
- src/utils/vibrante_config.py +272 -0
- vibrante_node_runtime-2.5.1.dist-info/METADATA +47 -0
- vibrante_node_runtime-2.5.1.dist-info/RECORD +472 -0
- vibrante_node_runtime-2.5.1.dist-info/WHEEL +5 -0
- vibrante_node_runtime-2.5.1.dist-info/licenses/CLA.md +96 -0
- vibrante_node_runtime-2.5.1.dist-info/licenses/COMMERCIAL_LICENSE.md +170 -0
- vibrante_node_runtime-2.5.1.dist-info/licenses/LICENSE +178 -0
- vibrante_node_runtime-2.5.1.dist-info/licenses/LICENSES/AGPL-3.0.txt +661 -0
- vibrante_node_runtime-2.5.1.dist-info/licenses/LICENSES/CC-BY-4.0-SCOPE.md +53 -0
- vibrante_node_runtime-2.5.1.dist-info/licenses/LICENSES/CC-BY-4.0.txt +396 -0
- vibrante_node_runtime-2.5.1.dist-info/licenses/LICENSES/GPL-3.0.txt +674 -0
- vibrante_node_runtime-2.5.1.dist-info/licenses/LICENSES/LGPL-3.0.txt +165 -0
- vibrante_node_runtime-2.5.1.dist-info/licenses/LICENSES/README.md +65 -0
- vibrante_node_runtime-2.5.1.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,325 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Review Feedback Engine (Tier 5 — Production Knowledge System)
|
|
3
|
+
==============================================================
|
|
4
|
+
Converts production reviews into structured, actionable knowledge.
|
|
5
|
+
Extracts failure categories, strength categories, and improvement
|
|
6
|
+
actions. Optionally persists feedback to ProductionMemory.
|
|
7
|
+
|
|
8
|
+
DESIGN RULE: NO bridge calls. Deterministic extraction from review dicts.
|
|
9
|
+
|
|
10
|
+
Public API:
|
|
11
|
+
ReviewFeedbackEngine
|
|
12
|
+
.extract_feedback(review) -> dict
|
|
13
|
+
.extract_failures(review) -> list[str]
|
|
14
|
+
.extract_strengths(review) -> list[str]
|
|
15
|
+
.build_improvement_actions(feedback) -> list[dict]
|
|
16
|
+
.update_production_memory(review, scene_id=None) -> dict
|
|
17
|
+
.stats() -> dict
|
|
18
|
+
|
|
19
|
+
get_review_feedback_engine() -> ReviewFeedbackEngine (singleton)
|
|
20
|
+
reset_review_feedback_engine_for_tests()
|
|
21
|
+
"""
|
|
22
|
+
|
|
23
|
+
from __future__ import annotations
|
|
24
|
+
|
|
25
|
+
import threading
|
|
26
|
+
from typing import Any, Dict, List, Optional
|
|
27
|
+
|
|
28
|
+
# ---------------------------------------------------------------------------
|
|
29
|
+
# Keyword → failure category mapping
|
|
30
|
+
# ---------------------------------------------------------------------------
|
|
31
|
+
|
|
32
|
+
_FAILURE_KEYWORD_MAP: Dict[str, str] = {
|
|
33
|
+
"fog too dense": "fog_density_high",
|
|
34
|
+
"density too high": "fog_density_high",
|
|
35
|
+
"density exceeds": "fog_density_high",
|
|
36
|
+
"obscured": "fog_density_high",
|
|
37
|
+
"hero readability": "hero_focus_low",
|
|
38
|
+
"no hero": "hero_absent",
|
|
39
|
+
"focal point": "hero_focus_low",
|
|
40
|
+
"flat": "depth_flat",
|
|
41
|
+
"depth is flat": "depth_flat",
|
|
42
|
+
"depth layering is absent": "depth_flat",
|
|
43
|
+
"no depth": "depth_flat",
|
|
44
|
+
"midground": "midground_empty",
|
|
45
|
+
"background zone is empty": "background_empty",
|
|
46
|
+
"key light absent": "key_light_missing",
|
|
47
|
+
"key light": "key_light_missing",
|
|
48
|
+
"rim light absent": "rim_light_missing",
|
|
49
|
+
"rim light": "rim_light_missing",
|
|
50
|
+
"light balance": "light_balance_poor",
|
|
51
|
+
"fill light": "fill_light_excessive",
|
|
52
|
+
"camera shake": "camera_shake_high",
|
|
53
|
+
"shake intensity": "camera_shake_high",
|
|
54
|
+
"establishing shot": "establishing_shot_missing",
|
|
55
|
+
"no camera": "camera_absent",
|
|
56
|
+
"framing is undefined": "camera_absent",
|
|
57
|
+
"render": "render_issue",
|
|
58
|
+
"production_ready": "production_not_ready",
|
|
59
|
+
"aa samples": "sampling_low",
|
|
60
|
+
"motion blur": "motion_blur_off",
|
|
61
|
+
"exr": "output_format_wrong",
|
|
62
|
+
"emission": "aov_missing",
|
|
63
|
+
"cryptomatte": "aov_missing",
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
_STRENGTH_KEYWORD_MAP: Dict[str, str] = {
|
|
67
|
+
"hero": "hero_focus_strong",
|
|
68
|
+
"depth separation": "depth_strong",
|
|
69
|
+
"zone layering": "depth_strong",
|
|
70
|
+
"balanced": "light_balance_good",
|
|
71
|
+
"practical lighting": "practicals_good",
|
|
72
|
+
"cinematic": "cinematic_quality",
|
|
73
|
+
"push-in": "camera_motion_cinematic",
|
|
74
|
+
"orbital": "camera_motion_cinematic",
|
|
75
|
+
"hero_focus": "camera_hero_focus",
|
|
76
|
+
"establishing": "establishing_shot_present",
|
|
77
|
+
"production-ready": "production_ready",
|
|
78
|
+
"atmosphere": "atmosphere_supports_depth",
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
# Improvement action templates keyed by failure category
|
|
82
|
+
_IMPROVEMENT_ACTIONS: Dict[str, Dict[str, Any]] = {
|
|
83
|
+
"fog_density_high": {"action": "reduce_fog_density", "target": "atmosphere_plan", "priority": "high"},
|
|
84
|
+
"hero_absent": {"action": "add_hero_asset", "target": "zones.hero_area", "priority": "critical"},
|
|
85
|
+
"hero_focus_low": {"action": "reduce_hero_count", "target": "zones.hero_area", "priority": "high"},
|
|
86
|
+
"depth_flat": {"action": "add_depth_layers", "target": "scene_layout", "priority": "high"},
|
|
87
|
+
"midground_empty": {"action": "populate_midground", "target": "zones.midground", "priority": "medium"},
|
|
88
|
+
"background_empty": {"action": "populate_background", "target": "zones.background", "priority": "medium"},
|
|
89
|
+
"key_light_missing": {"action": "add_key_light", "target": "lighting_plan", "priority": "critical"},
|
|
90
|
+
"rim_light_missing": {"action": "add_rim_light", "target": "lighting_plan", "priority": "high"},
|
|
91
|
+
"light_balance_poor": {"action": "rebalance_lights", "target": "lighting_plan", "priority": "medium"},
|
|
92
|
+
"fill_light_excessive": {"action": "reduce_fill_intensity", "target": "lighting_plan", "priority": "medium"},
|
|
93
|
+
"camera_shake_high": {"action": "reduce_shake_intensity", "target": "camera_plan", "priority": "medium"},
|
|
94
|
+
"camera_absent": {"action": "add_camera_plan", "target": "camera_plan", "priority": "critical"},
|
|
95
|
+
"establishing_shot_missing": {"action": "add_establishing_shot", "target": "camera_plan", "priority": "high"},
|
|
96
|
+
"render_issue": {"action": "review_render_settings", "target": "render_plan", "priority": "medium"},
|
|
97
|
+
"sampling_low": {"action": "increase_aa_samples", "target": "render_plan", "priority": "medium"},
|
|
98
|
+
"motion_blur_off": {"action": "enable_motion_blur", "target": "render_plan", "priority": "medium"},
|
|
99
|
+
"output_format_wrong": {"action": "set_exr_output", "target": "render_plan", "priority": "high"},
|
|
100
|
+
"aov_missing": {"action": "add_required_aovs", "target": "render_plan", "priority": "medium"},
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
class ReviewFeedbackEngine:
|
|
105
|
+
"""Converts reviews into structured production feedback."""
|
|
106
|
+
|
|
107
|
+
def __init__(self) -> None:
|
|
108
|
+
self._lock = threading.Lock()
|
|
109
|
+
self._extraction_count = 0
|
|
110
|
+
|
|
111
|
+
def extract_feedback(self, review: Dict[str, Any]) -> Dict[str, Any]:
|
|
112
|
+
"""Extract structured feedback from a review dict.
|
|
113
|
+
|
|
114
|
+
Works with any review format: cinematic_scene_review,
|
|
115
|
+
scene_realization_review, or custom review dicts.
|
|
116
|
+
|
|
117
|
+
Returns:
|
|
118
|
+
{failures, strengths, issues, recommendations,
|
|
119
|
+
overall_score, production_ready, grade}
|
|
120
|
+
"""
|
|
121
|
+
failures = self.extract_failures(review)
|
|
122
|
+
strengths = self.extract_strengths(review)
|
|
123
|
+
|
|
124
|
+
overall_score = float(review.get("overall_score", 0.0))
|
|
125
|
+
production_ready = bool(review.get("production_ready", False))
|
|
126
|
+
grade = str(review.get("grade", _grade(overall_score)))
|
|
127
|
+
|
|
128
|
+
# Collect raw issue text
|
|
129
|
+
raw_issues: List[str] = []
|
|
130
|
+
for key in ("findings", "issues", "critical_findings", "blocking_issues"):
|
|
131
|
+
val = review.get(key)
|
|
132
|
+
if isinstance(val, list):
|
|
133
|
+
raw_issues.extend(str(x) for x in val)
|
|
134
|
+
|
|
135
|
+
raw_recs: List[str] = []
|
|
136
|
+
for key in ("recommendations",):
|
|
137
|
+
val = review.get(key)
|
|
138
|
+
if isinstance(val, list):
|
|
139
|
+
raw_recs.extend(str(x) for x in val)
|
|
140
|
+
|
|
141
|
+
with self._lock:
|
|
142
|
+
self._extraction_count += 1
|
|
143
|
+
|
|
144
|
+
return {
|
|
145
|
+
"failures": failures,
|
|
146
|
+
"strengths": strengths,
|
|
147
|
+
"issues": raw_issues,
|
|
148
|
+
"recommendations": raw_recs,
|
|
149
|
+
"overall_score": overall_score,
|
|
150
|
+
"production_ready": production_ready,
|
|
151
|
+
"grade": grade,
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
def extract_failures(self, review: Dict[str, Any]) -> List[str]:
|
|
155
|
+
"""Extract structured failure category names from a review.
|
|
156
|
+
|
|
157
|
+
Returns list of failure category strings (e.g. "fog_density_high").
|
|
158
|
+
"""
|
|
159
|
+
raw_text: List[str] = []
|
|
160
|
+
for key in ("findings", "issues", "critical_findings", "blocking_issues"):
|
|
161
|
+
val = review.get(key)
|
|
162
|
+
if isinstance(val, list):
|
|
163
|
+
raw_text.extend(str(x).lower() for x in val)
|
|
164
|
+
if isinstance(review.get("review_summary"), str):
|
|
165
|
+
raw_text.append(review["review_summary"].lower())
|
|
166
|
+
|
|
167
|
+
seen: set = set()
|
|
168
|
+
failures: List[str] = []
|
|
169
|
+
for text in raw_text:
|
|
170
|
+
for kw, category in _FAILURE_KEYWORD_MAP.items():
|
|
171
|
+
if kw.lower() in text and category not in seen:
|
|
172
|
+
seen.add(category)
|
|
173
|
+
failures.append(category)
|
|
174
|
+
return failures
|
|
175
|
+
|
|
176
|
+
def extract_strengths(self, review: Dict[str, Any]) -> List[str]:
|
|
177
|
+
"""Extract structured strength category names from a review."""
|
|
178
|
+
raw_text: List[str] = []
|
|
179
|
+
for key in ("strengths", "findings"):
|
|
180
|
+
val = review.get(key)
|
|
181
|
+
if isinstance(val, list):
|
|
182
|
+
raw_text.extend(str(x).lower() for x in val)
|
|
183
|
+
if isinstance(review.get("review_summary"), str):
|
|
184
|
+
raw_text.append(review["review_summary"].lower())
|
|
185
|
+
|
|
186
|
+
seen: set = set()
|
|
187
|
+
strengths: List[str] = []
|
|
188
|
+
for text in raw_text:
|
|
189
|
+
for kw, category in _STRENGTH_KEYWORD_MAP.items():
|
|
190
|
+
if kw.lower() in text and category not in seen:
|
|
191
|
+
seen.add(category)
|
|
192
|
+
strengths.append(category)
|
|
193
|
+
return strengths
|
|
194
|
+
|
|
195
|
+
def build_improvement_actions(
|
|
196
|
+
self, feedback: Dict[str, Any]
|
|
197
|
+
) -> List[Dict[str, Any]]:
|
|
198
|
+
"""Convert failure categories into actionable improvement steps.
|
|
199
|
+
|
|
200
|
+
Args:
|
|
201
|
+
feedback: Return value of extract_feedback().
|
|
202
|
+
|
|
203
|
+
Returns:
|
|
204
|
+
List of action dicts sorted by priority (critical first).
|
|
205
|
+
"""
|
|
206
|
+
_priority_order = {"critical": 0, "high": 1, "medium": 2, "low": 3}
|
|
207
|
+
actions: List[Dict[str, Any]] = []
|
|
208
|
+
seen: set = set()
|
|
209
|
+
|
|
210
|
+
for failure in feedback.get("failures", []):
|
|
211
|
+
if failure in _IMPROVEMENT_ACTIONS and failure not in seen:
|
|
212
|
+
seen.add(failure)
|
|
213
|
+
action = dict(_IMPROVEMENT_ACTIONS[failure])
|
|
214
|
+
action["failure_category"] = failure
|
|
215
|
+
actions.append(action)
|
|
216
|
+
|
|
217
|
+
actions.sort(key=lambda a: _priority_order.get(a.get("priority", "low"), 3))
|
|
218
|
+
return actions
|
|
219
|
+
|
|
220
|
+
def update_production_memory(
|
|
221
|
+
self,
|
|
222
|
+
review: Dict[str, Any],
|
|
223
|
+
scene_id: Optional[str] = None,
|
|
224
|
+
scene_type: Optional[str] = None,
|
|
225
|
+
lighting_style: Optional[str] = None,
|
|
226
|
+
camera_style: Optional[str] = None,
|
|
227
|
+
) -> Dict[str, Any]:
|
|
228
|
+
"""Extract feedback and record it to ProductionMemory.
|
|
229
|
+
|
|
230
|
+
Does NOT raise if ProductionMemory is unavailable — returns error key
|
|
231
|
+
instead so callers can handle gracefully.
|
|
232
|
+
|
|
233
|
+
Returns:
|
|
234
|
+
{feedback, actions, memory_updated, scene_record_id, review_record_id}
|
|
235
|
+
"""
|
|
236
|
+
feedback = self.extract_feedback(review)
|
|
237
|
+
actions = self.build_improvement_actions(feedback)
|
|
238
|
+
|
|
239
|
+
result: Dict[str, Any] = {
|
|
240
|
+
"feedback": feedback,
|
|
241
|
+
"actions": actions,
|
|
242
|
+
"memory_updated": False,
|
|
243
|
+
"scene_record_id": None,
|
|
244
|
+
"review_record_id": None,
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
try:
|
|
248
|
+
from src.runtime.production_memory import get_production_memory
|
|
249
|
+
mem = get_production_memory()
|
|
250
|
+
|
|
251
|
+
# Record the scene if we have enough info
|
|
252
|
+
if scene_type or scene_id:
|
|
253
|
+
score = feedback["overall_score"]
|
|
254
|
+
status = (
|
|
255
|
+
"success" if feedback["production_ready"]
|
|
256
|
+
else "partial" if score >= 0.5
|
|
257
|
+
else "failure"
|
|
258
|
+
)
|
|
259
|
+
sid = mem.record_scene({
|
|
260
|
+
"scene_type": scene_type or "unknown",
|
|
261
|
+
"lighting_style": lighting_style or "",
|
|
262
|
+
"camera_style": camera_style or "",
|
|
263
|
+
"score": score,
|
|
264
|
+
"status": status,
|
|
265
|
+
})
|
|
266
|
+
result["scene_record_id"] = sid
|
|
267
|
+
|
|
268
|
+
# Record failure patterns for each failure category
|
|
269
|
+
for failure in feedback["failures"]:
|
|
270
|
+
mem.record_failure({
|
|
271
|
+
"scene_type": scene_type or "unknown",
|
|
272
|
+
"failure_type": failure,
|
|
273
|
+
"description": failure,
|
|
274
|
+
"lighting_style": lighting_style or "",
|
|
275
|
+
"camera_style": camera_style or "",
|
|
276
|
+
})
|
|
277
|
+
|
|
278
|
+
# Record the review
|
|
279
|
+
rev_id = mem.record_review(scene_id or result.get("scene_record_id") or "", review)
|
|
280
|
+
result["review_record_id"] = rev_id
|
|
281
|
+
result["memory_updated"] = True
|
|
282
|
+
|
|
283
|
+
except Exception as exc:
|
|
284
|
+
result["error"] = str(exc)
|
|
285
|
+
|
|
286
|
+
return result
|
|
287
|
+
|
|
288
|
+
def stats(self) -> Dict[str, Any]:
|
|
289
|
+
with self._lock:
|
|
290
|
+
return {"extraction_count": self._extraction_count}
|
|
291
|
+
|
|
292
|
+
|
|
293
|
+
# ---------------------------------------------------------------------------
|
|
294
|
+
# Helpers
|
|
295
|
+
# ---------------------------------------------------------------------------
|
|
296
|
+
|
|
297
|
+
def _grade(score: float) -> str:
|
|
298
|
+
if score >= 0.9: return "A"
|
|
299
|
+
if score >= 0.8: return "B"
|
|
300
|
+
if score >= 0.7: return "C"
|
|
301
|
+
if score >= 0.6: return "D"
|
|
302
|
+
return "F"
|
|
303
|
+
|
|
304
|
+
|
|
305
|
+
# ---------------------------------------------------------------------------
|
|
306
|
+
# Singleton
|
|
307
|
+
# ---------------------------------------------------------------------------
|
|
308
|
+
|
|
309
|
+
_INSTANCE: Optional[ReviewFeedbackEngine] = None
|
|
310
|
+
_INSTANCE_LOCK = threading.Lock()
|
|
311
|
+
|
|
312
|
+
|
|
313
|
+
def get_review_feedback_engine() -> ReviewFeedbackEngine:
|
|
314
|
+
global _INSTANCE
|
|
315
|
+
if _INSTANCE is None:
|
|
316
|
+
with _INSTANCE_LOCK:
|
|
317
|
+
if _INSTANCE is None:
|
|
318
|
+
_INSTANCE = ReviewFeedbackEngine()
|
|
319
|
+
return _INSTANCE
|
|
320
|
+
|
|
321
|
+
|
|
322
|
+
def reset_review_feedback_engine_for_tests() -> None:
|
|
323
|
+
global _INSTANCE
|
|
324
|
+
with _INSTANCE_LOCK:
|
|
325
|
+
_INSTANCE = None
|
|
@@ -0,0 +1,330 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Runtime Analytics
|
|
3
|
+
=================
|
|
4
|
+
Tracks and aggregates execution performance data across the Vibrante-Node
|
|
5
|
+
runtime. Records execution durations, transaction success rates, rollback
|
|
6
|
+
frequency, worker utilisation, orchestration bottlenecks, and validation
|
|
7
|
+
failures.
|
|
8
|
+
|
|
9
|
+
This module NEVER:
|
|
10
|
+
• executes operations or calls the bridge
|
|
11
|
+
• modifies execution plans
|
|
12
|
+
• interacts with TransactionManager or ExecutionScheduler directly
|
|
13
|
+
|
|
14
|
+
It ONLY collects metrics and produces structured reports.
|
|
15
|
+
|
|
16
|
+
Output shape (from get_report):
|
|
17
|
+
{
|
|
18
|
+
"execution_metrics": {avg_duration_sec, total_executions, success_rate, ...},
|
|
19
|
+
"failure_metrics": {total_rollbacks, rollback_rate, top_failure_ops, ...},
|
|
20
|
+
"resource_metrics": {worker_utilization, avg_queue_depth, ...},
|
|
21
|
+
"workflow_statistics": {by_intent, by_template, by_status},
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
Public API:
|
|
25
|
+
get_runtime_analytics() -> RuntimeAnalytics (singleton)
|
|
26
|
+
reset_runtime_analytics_for_tests() (test isolation only)
|
|
27
|
+
|
|
28
|
+
analytics.record_execution(data) -> str
|
|
29
|
+
analytics.record_validation(data) -> str
|
|
30
|
+
analytics.record_worker_event(data) -> str
|
|
31
|
+
analytics.get_report() -> dict
|
|
32
|
+
analytics.get_execution_trends(window_sec=300) -> dict
|
|
33
|
+
analytics.stats() -> dict
|
|
34
|
+
"""
|
|
35
|
+
|
|
36
|
+
from __future__ import annotations
|
|
37
|
+
|
|
38
|
+
import threading
|
|
39
|
+
import time
|
|
40
|
+
import uuid
|
|
41
|
+
from collections import defaultdict
|
|
42
|
+
from typing import Any, Dict, List, Optional
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
class RuntimeAnalytics:
|
|
46
|
+
"""Execution performance data collector and aggregator."""
|
|
47
|
+
|
|
48
|
+
def __init__(self) -> None:
|
|
49
|
+
self._lock = threading.Lock()
|
|
50
|
+
|
|
51
|
+
# Execution records: [{id, intent, status, duration_sec, op_count, timestamp, ...}]
|
|
52
|
+
self._executions: List[Dict[str, Any]] = []
|
|
53
|
+
|
|
54
|
+
# Validation records: [{id, intent, valid, error_count, warning_count, timestamp}]
|
|
55
|
+
self._validations: List[Dict[str, Any]] = []
|
|
56
|
+
|
|
57
|
+
# Worker events: [{id, event_type, worker_id, timestamp, ...}]
|
|
58
|
+
self._worker_events: List[Dict[str, Any]] = []
|
|
59
|
+
|
|
60
|
+
self._max_records = 2000
|
|
61
|
+
|
|
62
|
+
# ------------------------------------------------------------------
|
|
63
|
+
# Recording
|
|
64
|
+
# ------------------------------------------------------------------
|
|
65
|
+
|
|
66
|
+
def record_execution(self, data: Dict[str, Any]) -> str:
|
|
67
|
+
"""Record a completed transaction execution.
|
|
68
|
+
|
|
69
|
+
Expected data keys:
|
|
70
|
+
intent, status ("committed"|"rolled_back"|"failed"), duration_sec,
|
|
71
|
+
op_count, template_id (optional), rollback_performed (bool), errors (list)
|
|
72
|
+
Returns record id.
|
|
73
|
+
"""
|
|
74
|
+
record_id = str(uuid.uuid4())
|
|
75
|
+
record = {
|
|
76
|
+
"id": record_id,
|
|
77
|
+
"intent": data.get("intent", ""),
|
|
78
|
+
"status": data.get("status", "unknown"),
|
|
79
|
+
"duration_sec": float(data.get("duration_sec", 0.0)),
|
|
80
|
+
"op_count": int(data.get("op_count", 0)),
|
|
81
|
+
"template_id": data.get("template_id", ""),
|
|
82
|
+
"rollback_performed": bool(data.get("rollback_performed", False)),
|
|
83
|
+
"error_count": len(data.get("errors", [])),
|
|
84
|
+
"timestamp": time.time(),
|
|
85
|
+
}
|
|
86
|
+
with self._lock:
|
|
87
|
+
self._executions.append(record)
|
|
88
|
+
self._prune(self._executions)
|
|
89
|
+
return record_id
|
|
90
|
+
|
|
91
|
+
def record_validation(self, data: Dict[str, Any]) -> str:
|
|
92
|
+
"""Record a pre-execution validation result.
|
|
93
|
+
|
|
94
|
+
Expected data keys:
|
|
95
|
+
intent, valid (bool), error_count, warning_count, risk_level
|
|
96
|
+
Returns record id.
|
|
97
|
+
"""
|
|
98
|
+
record_id = str(uuid.uuid4())
|
|
99
|
+
record = {
|
|
100
|
+
"id": record_id,
|
|
101
|
+
"intent": data.get("intent", ""),
|
|
102
|
+
"valid": bool(data.get("valid", True)),
|
|
103
|
+
"error_count": int(data.get("error_count", 0)),
|
|
104
|
+
"warning_count": int(data.get("warning_count", 0)),
|
|
105
|
+
"risk_level": data.get("risk_level", "low"),
|
|
106
|
+
"timestamp": time.time(),
|
|
107
|
+
}
|
|
108
|
+
with self._lock:
|
|
109
|
+
self._validations.append(record)
|
|
110
|
+
self._prune(self._validations)
|
|
111
|
+
return record_id
|
|
112
|
+
|
|
113
|
+
def record_worker_event(self, data: Dict[str, Any]) -> str:
|
|
114
|
+
"""Record a worker pool event.
|
|
115
|
+
|
|
116
|
+
Expected data keys:
|
|
117
|
+
event_type ("acquired"|"released"|"stale"|"registered"|"deregistered"),
|
|
118
|
+
worker_id, capabilities (list), current_load, max_load
|
|
119
|
+
Returns record id.
|
|
120
|
+
"""
|
|
121
|
+
record_id = str(uuid.uuid4())
|
|
122
|
+
record = {
|
|
123
|
+
"id": record_id,
|
|
124
|
+
"event_type": data.get("event_type", "unknown"),
|
|
125
|
+
"worker_id": data.get("worker_id", ""),
|
|
126
|
+
"current_load": int(data.get("current_load", 0)),
|
|
127
|
+
"max_load": int(data.get("max_load", 1)),
|
|
128
|
+
"timestamp": time.time(),
|
|
129
|
+
}
|
|
130
|
+
with self._lock:
|
|
131
|
+
self._worker_events.append(record)
|
|
132
|
+
self._prune(self._worker_events)
|
|
133
|
+
return record_id
|
|
134
|
+
|
|
135
|
+
# ------------------------------------------------------------------
|
|
136
|
+
# Report generation
|
|
137
|
+
# ------------------------------------------------------------------
|
|
138
|
+
|
|
139
|
+
def get_report(self) -> Dict[str, Any]:
|
|
140
|
+
"""Return a full analytics report.
|
|
141
|
+
|
|
142
|
+
Returns:
|
|
143
|
+
{
|
|
144
|
+
"execution_metrics": {...},
|
|
145
|
+
"failure_metrics": {...},
|
|
146
|
+
"resource_metrics": {...},
|
|
147
|
+
"workflow_statistics": {...},
|
|
148
|
+
"generated_at": float,
|
|
149
|
+
}
|
|
150
|
+
"""
|
|
151
|
+
with self._lock:
|
|
152
|
+
execs = list(self._executions)
|
|
153
|
+
vals = list(self._validations)
|
|
154
|
+
wevts = list(self._worker_events)
|
|
155
|
+
|
|
156
|
+
execution_metrics = self._compute_execution_metrics(execs)
|
|
157
|
+
failure_metrics = self._compute_failure_metrics(execs)
|
|
158
|
+
resource_metrics = self._compute_resource_metrics(wevts)
|
|
159
|
+
workflow_stats = self._compute_workflow_statistics(execs, vals)
|
|
160
|
+
|
|
161
|
+
return {
|
|
162
|
+
"execution_metrics": execution_metrics,
|
|
163
|
+
"failure_metrics": failure_metrics,
|
|
164
|
+
"resource_metrics": resource_metrics,
|
|
165
|
+
"workflow_statistics": workflow_stats,
|
|
166
|
+
"generated_at": time.time(),
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
def _compute_execution_metrics(self, execs: List[Dict]) -> Dict[str, Any]:
|
|
170
|
+
if not execs:
|
|
171
|
+
return {
|
|
172
|
+
"total_executions": 0, "success_count": 0, "success_rate": 0.0,
|
|
173
|
+
"avg_duration_sec": 0.0, "max_duration_sec": 0.0, "avg_op_count": 0.0,
|
|
174
|
+
}
|
|
175
|
+
total = len(execs)
|
|
176
|
+
success = sum(1 for e in execs if e["status"] == "committed")
|
|
177
|
+
durations = [e["duration_sec"] for e in execs]
|
|
178
|
+
op_counts = [e["op_count"] for e in execs]
|
|
179
|
+
return {
|
|
180
|
+
"total_executions": total,
|
|
181
|
+
"success_count": success,
|
|
182
|
+
"success_rate": round(success / total, 3),
|
|
183
|
+
"avg_duration_sec": round(sum(durations) / total, 3),
|
|
184
|
+
"max_duration_sec": round(max(durations), 3),
|
|
185
|
+
"avg_op_count": round(sum(op_counts) / total, 2),
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
def _compute_failure_metrics(self, execs: List[Dict]) -> Dict[str, Any]:
|
|
189
|
+
if not execs:
|
|
190
|
+
return {
|
|
191
|
+
"total_rollbacks": 0, "rollback_rate": 0.0,
|
|
192
|
+
"total_failures": 0, "failure_rate": 0.0,
|
|
193
|
+
"avg_errors_per_failure": 0.0, "top_failure_intents": [],
|
|
194
|
+
}
|
|
195
|
+
total = len(execs)
|
|
196
|
+
rollbacks = [e for e in execs if e.get("rollback_performed")]
|
|
197
|
+
failures = [e for e in execs if e["status"] in ("failed", "rolled_back")]
|
|
198
|
+
error_counts = [e["error_count"] for e in failures]
|
|
199
|
+
|
|
200
|
+
intent_fails: Dict[str, int] = defaultdict(int)
|
|
201
|
+
for e in failures:
|
|
202
|
+
if e["intent"]:
|
|
203
|
+
intent_fails[e["intent"]] += 1
|
|
204
|
+
top_fails = sorted(intent_fails.items(), key=lambda x: x[1], reverse=True)[:5]
|
|
205
|
+
|
|
206
|
+
return {
|
|
207
|
+
"total_rollbacks": len(rollbacks),
|
|
208
|
+
"rollback_rate": round(len(rollbacks) / total, 3),
|
|
209
|
+
"total_failures": len(failures),
|
|
210
|
+
"failure_rate": round(len(failures) / total, 3),
|
|
211
|
+
"avg_errors_per_failure": round(sum(error_counts) / len(error_counts), 2) if error_counts else 0.0,
|
|
212
|
+
"top_failure_intents": [{"intent": k, "count": v} for k, v in top_fails],
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
def _compute_resource_metrics(self, wevts: List[Dict]) -> Dict[str, Any]:
|
|
216
|
+
if not wevts:
|
|
217
|
+
return {
|
|
218
|
+
"total_worker_events": 0, "acquire_count": 0, "release_count": 0,
|
|
219
|
+
"stale_count": 0, "avg_utilization": 0.0,
|
|
220
|
+
}
|
|
221
|
+
acquire = [e for e in wevts if e["event_type"] == "acquired"]
|
|
222
|
+
release = [e for e in wevts if e["event_type"] == "released"]
|
|
223
|
+
stale = [e for e in wevts if e["event_type"] == "stale"]
|
|
224
|
+
|
|
225
|
+
loads = [e["current_load"] / max(e["max_load"], 1) for e in wevts if e["max_load"] > 0]
|
|
226
|
+
avg_util = round(sum(loads) / len(loads), 3) if loads else 0.0
|
|
227
|
+
|
|
228
|
+
return {
|
|
229
|
+
"total_worker_events": len(wevts),
|
|
230
|
+
"acquire_count": len(acquire),
|
|
231
|
+
"release_count": len(release),
|
|
232
|
+
"stale_count": len(stale),
|
|
233
|
+
"avg_utilization": avg_util,
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
def _compute_workflow_statistics(
|
|
237
|
+
self, execs: List[Dict], vals: List[Dict]
|
|
238
|
+
) -> Dict[str, Any]:
|
|
239
|
+
by_intent: Dict[str, int] = defaultdict(int)
|
|
240
|
+
by_template: Dict[str, int] = defaultdict(int)
|
|
241
|
+
by_status: Dict[str, int] = defaultdict(int)
|
|
242
|
+
|
|
243
|
+
for e in execs:
|
|
244
|
+
if e["intent"]:
|
|
245
|
+
by_intent[e["intent"]] += 1
|
|
246
|
+
if e["template_id"]:
|
|
247
|
+
by_template[e["template_id"]] += 1
|
|
248
|
+
by_status[e["status"]] += 1
|
|
249
|
+
|
|
250
|
+
val_total = len(vals)
|
|
251
|
+
val_failed = sum(1 for v in vals if not v["valid"])
|
|
252
|
+
val_rate = round(val_failed / val_total, 3) if val_total else 0.0
|
|
253
|
+
|
|
254
|
+
return {
|
|
255
|
+
"by_intent": dict(by_intent),
|
|
256
|
+
"by_template": dict(by_template),
|
|
257
|
+
"by_status": dict(by_status),
|
|
258
|
+
"validation_total": val_total,
|
|
259
|
+
"validation_failure_rate": val_rate,
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
# ------------------------------------------------------------------
|
|
263
|
+
# Trend window
|
|
264
|
+
# ------------------------------------------------------------------
|
|
265
|
+
|
|
266
|
+
def get_execution_trends(self, window_sec: float = 300.0) -> Dict[str, Any]:
|
|
267
|
+
"""Return metrics for executions within the last `window_sec` seconds."""
|
|
268
|
+
cutoff = time.time() - window_sec
|
|
269
|
+
with self._lock:
|
|
270
|
+
recent = [e for e in self._executions if e["timestamp"] >= cutoff]
|
|
271
|
+
|
|
272
|
+
if not recent:
|
|
273
|
+
return {
|
|
274
|
+
"window_sec": window_sec, "count": 0, "success_rate": 0.0,
|
|
275
|
+
"avg_duration_sec": 0.0, "rollback_count": 0,
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
success = sum(1 for e in recent if e["status"] == "committed")
|
|
279
|
+
rollbacks = sum(1 for e in recent if e.get("rollback_performed"))
|
|
280
|
+
durations = [e["duration_sec"] for e in recent]
|
|
281
|
+
|
|
282
|
+
return {
|
|
283
|
+
"window_sec": window_sec,
|
|
284
|
+
"count": len(recent),
|
|
285
|
+
"success_rate": round(success / len(recent), 3),
|
|
286
|
+
"avg_duration_sec": round(sum(durations) / len(recent), 3),
|
|
287
|
+
"rollback_count": rollbacks,
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
# ------------------------------------------------------------------
|
|
291
|
+
# Stats
|
|
292
|
+
# ------------------------------------------------------------------
|
|
293
|
+
|
|
294
|
+
def stats(self) -> Dict[str, Any]:
|
|
295
|
+
with self._lock:
|
|
296
|
+
return {
|
|
297
|
+
"execution_records": len(self._executions),
|
|
298
|
+
"validation_records": len(self._validations),
|
|
299
|
+
"worker_events": len(self._worker_events),
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
# ------------------------------------------------------------------
|
|
303
|
+
# Internal
|
|
304
|
+
# ------------------------------------------------------------------
|
|
305
|
+
|
|
306
|
+
def _prune(self, lst: List) -> None:
|
|
307
|
+
if len(lst) > self._max_records:
|
|
308
|
+
del lst[:len(lst) - self._max_records]
|
|
309
|
+
|
|
310
|
+
|
|
311
|
+
# ---------------------------------------------------------------------------
|
|
312
|
+
# Singleton
|
|
313
|
+
# ---------------------------------------------------------------------------
|
|
314
|
+
|
|
315
|
+
_INSTANCE: Optional[RuntimeAnalytics] = None
|
|
316
|
+
_INSTANCE_LOCK = threading.Lock()
|
|
317
|
+
|
|
318
|
+
|
|
319
|
+
def get_runtime_analytics() -> RuntimeAnalytics:
|
|
320
|
+
global _INSTANCE
|
|
321
|
+
with _INSTANCE_LOCK:
|
|
322
|
+
if _INSTANCE is None:
|
|
323
|
+
_INSTANCE = RuntimeAnalytics()
|
|
324
|
+
return _INSTANCE
|
|
325
|
+
|
|
326
|
+
|
|
327
|
+
def reset_runtime_analytics_for_tests() -> None:
|
|
328
|
+
global _INSTANCE
|
|
329
|
+
with _INSTANCE_LOCK:
|
|
330
|
+
_INSTANCE = None
|