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,371 @@
|
|
|
1
|
+
"""
|
|
2
|
+
AI Planning Engine (Tier 3)
|
|
3
|
+
============================
|
|
4
|
+
Generate semantic execution plans from a parsed intent + contextual analysis.
|
|
5
|
+
|
|
6
|
+
The planner is DETERMINISTIC by default:
|
|
7
|
+
- Uses SemanticRegistry, WorkflowTemplates, RuntimeConstraints, ResourceEstimator
|
|
8
|
+
- An optional LLM provider (llm_provider.py) can suggest plan refinements
|
|
9
|
+
- LLM suggestions are advisory only; they never bypass constraint/validation
|
|
10
|
+
- The planner NEVER executes operations or mutates Houdini state
|
|
11
|
+
|
|
12
|
+
Input:
|
|
13
|
+
- parsed intent dict (from intent_parser.py)
|
|
14
|
+
- context analysis dict (from contextual_reasoning.py)
|
|
15
|
+
- optional scene_context (from houdini_runtime.scene_context)
|
|
16
|
+
|
|
17
|
+
Output: a plan dict ready for SemanticExecutor.execute() or dry-run preview
|
|
18
|
+
|
|
19
|
+
Public API:
|
|
20
|
+
get_ai_planner() -> AIPlanner
|
|
21
|
+
reset_ai_planner_for_tests()
|
|
22
|
+
|
|
23
|
+
AIPlanner.plan(parsed_intent, context_analysis, scene_context=None) -> dict
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
|
+
import threading
|
|
27
|
+
import uuid
|
|
28
|
+
import time
|
|
29
|
+
from typing import Any, Dict, List, Optional
|
|
30
|
+
|
|
31
|
+
from src.runtime.semantic_registry import get_semantic_registry
|
|
32
|
+
from src.runtime.workflow_templates import get_workflow_templates
|
|
33
|
+
from src.runtime.runtime_constraints import get_runtime_constraints
|
|
34
|
+
from src.runtime.resource_estimator import get_resource_estimator
|
|
35
|
+
from src.runtime.llm_provider import get_llm_provider
|
|
36
|
+
|
|
37
|
+
# Risk thresholds that automatically flag a plan for approval
|
|
38
|
+
_APPROVAL_RISK_THRESHOLD = "high"
|
|
39
|
+
_APPROVAL_COST_THRESHOLD = 0.8 # estimated_cook_cost above this → requires_approval
|
|
40
|
+
_APPROVAL_OP_COUNT = 20 # plan with > N ops → requires_approval
|
|
41
|
+
_DESTRUCTIVE_OPS = frozenset({"delete_node"})
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def _select_strategy(
|
|
45
|
+
intent: str,
|
|
46
|
+
context_analysis: Dict[str, Any],
|
|
47
|
+
parameters: Dict[str, Any],
|
|
48
|
+
) -> Dict[str, Any]:
|
|
49
|
+
"""Decide the best execution strategy: extend existing vs create new."""
|
|
50
|
+
existing = context_analysis.get("existing_workflows", [])
|
|
51
|
+
recommended = context_analysis.get("recommended_actions", [])
|
|
52
|
+
|
|
53
|
+
if "extend_existing" in recommended and existing:
|
|
54
|
+
best = existing[0]
|
|
55
|
+
return {
|
|
56
|
+
"strategy": "extend_existing",
|
|
57
|
+
"target_path": best.get("path", ""),
|
|
58
|
+
"source": best.get("source", ""),
|
|
59
|
+
"rationale": f"Existing {intent} workflow detected; extending it is safer than duplication.",
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
return {
|
|
63
|
+
"strategy": "create_new",
|
|
64
|
+
"target_path": parameters.get("parent", "/obj"),
|
|
65
|
+
"source": "none",
|
|
66
|
+
"rationale": "No existing workflow detected; creating new.",
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
def _build_template_params(
|
|
71
|
+
intent: str,
|
|
72
|
+
parameters: Dict[str, Any],
|
|
73
|
+
strategy: Dict[str, Any],
|
|
74
|
+
) -> Dict[str, str]:
|
|
75
|
+
"""Merge intent parameters into template variable format (all strings)."""
|
|
76
|
+
params: Dict[str, str] = {}
|
|
77
|
+
|
|
78
|
+
# Intent-level parameters
|
|
79
|
+
for k, v in parameters.items():
|
|
80
|
+
params[k] = str(v)
|
|
81
|
+
|
|
82
|
+
# Defaults from strategy
|
|
83
|
+
if "parent" not in params:
|
|
84
|
+
params["parent"] = strategy.get("target_path", "/obj")
|
|
85
|
+
|
|
86
|
+
# Intent-specific defaults
|
|
87
|
+
defaults: Dict[str, Dict[str, str]] = {
|
|
88
|
+
"build_pyro_source": {
|
|
89
|
+
"name": "pyro_src",
|
|
90
|
+
"style": "fire",
|
|
91
|
+
},
|
|
92
|
+
"create_geo_container": {
|
|
93
|
+
"name": "geo1",
|
|
94
|
+
},
|
|
95
|
+
"setup_karma_renderer": {
|
|
96
|
+
"name": "karma1",
|
|
97
|
+
"stage_path": "/stage",
|
|
98
|
+
},
|
|
99
|
+
"export_to_usd": {
|
|
100
|
+
"name": "usd_export",
|
|
101
|
+
"output_path": "$HIP/export/scene.usd",
|
|
102
|
+
},
|
|
103
|
+
"cache_geometry": {
|
|
104
|
+
"name": "filecache1",
|
|
105
|
+
"output_path": "$HIP/cache/$OS.$F4.bgeo.sc",
|
|
106
|
+
},
|
|
107
|
+
"asset_publish_scaffold": {
|
|
108
|
+
"name": "asset_root",
|
|
109
|
+
},
|
|
110
|
+
"solaris_lighting_setup": {
|
|
111
|
+
"name": "lighting_rig",
|
|
112
|
+
"stage_path": "/stage",
|
|
113
|
+
},
|
|
114
|
+
}
|
|
115
|
+
for key, val in defaults.get(intent, {}).items():
|
|
116
|
+
params.setdefault(key, val)
|
|
117
|
+
|
|
118
|
+
return params
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
def _assess_approval(
|
|
122
|
+
ops: List[Dict[str, Any]],
|
|
123
|
+
resource_estimate: Dict[str, Any],
|
|
124
|
+
constraint_result: Dict[str, Any],
|
|
125
|
+
context_analysis: Dict[str, Any],
|
|
126
|
+
) -> Dict[str, Any]:
|
|
127
|
+
"""Return approval assessment: requires_approval + reasons."""
|
|
128
|
+
reasons: List[str] = []
|
|
129
|
+
|
|
130
|
+
risk = resource_estimate.get("risk_level", "low")
|
|
131
|
+
if risk == _APPROVAL_RISK_THRESHOLD:
|
|
132
|
+
reasons.append(f"Risk level is '{risk}'.")
|
|
133
|
+
|
|
134
|
+
cook_cost = resource_estimate.get("estimated_cook_cost", 0.0)
|
|
135
|
+
if cook_cost > _APPROVAL_COST_THRESHOLD:
|
|
136
|
+
reasons.append(f"Estimated cook cost {cook_cost:.2f} exceeds threshold {_APPROVAL_COST_THRESHOLD}.")
|
|
137
|
+
|
|
138
|
+
if len(ops) > _APPROVAL_OP_COUNT:
|
|
139
|
+
reasons.append(f"Plan contains {len(ops)} operations (threshold {_APPROVAL_OP_COUNT}).")
|
|
140
|
+
|
|
141
|
+
destructive = [op for op in ops if op.get("op") in _DESTRUCTIVE_OPS]
|
|
142
|
+
if destructive:
|
|
143
|
+
reasons.append(f"{len(destructive)} destructive operation(s) detected (delete_node).")
|
|
144
|
+
|
|
145
|
+
violations = constraint_result.get("violations", [])
|
|
146
|
+
if violations:
|
|
147
|
+
reasons.append(f"{len(violations)} constraint violation(s) detected.")
|
|
148
|
+
|
|
149
|
+
conflicts = context_analysis.get("conflicts", [])
|
|
150
|
+
if conflicts:
|
|
151
|
+
reasons.append(f"{len(conflicts)} dependency conflict(s) in scene.")
|
|
152
|
+
|
|
153
|
+
requires_approval = len(reasons) > 0
|
|
154
|
+
return {
|
|
155
|
+
"requires_approval": requires_approval,
|
|
156
|
+
"approval_reasons": reasons,
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
class AIPlanner:
|
|
161
|
+
"""Generate validated execution plans from parsed intents.
|
|
162
|
+
|
|
163
|
+
Never executes operations. Never mutates state. Returns plans that can
|
|
164
|
+
be submitted to SemanticExecutor.execute() or inspected/approved first.
|
|
165
|
+
"""
|
|
166
|
+
|
|
167
|
+
async def plan(
|
|
168
|
+
self,
|
|
169
|
+
parsed_intent: Dict[str, Any],
|
|
170
|
+
context_analysis: Optional[Dict[str, Any]] = None,
|
|
171
|
+
scene_context: Optional[Dict[str, Any]] = None,
|
|
172
|
+
) -> Dict[str, Any]:
|
|
173
|
+
"""Generate an execution plan for the given parsed intent.
|
|
174
|
+
|
|
175
|
+
Args:
|
|
176
|
+
parsed_intent: Output of IntentParser.parse().
|
|
177
|
+
context_analysis: Output of ContextualReasoner.analyze().
|
|
178
|
+
scene_context: Optional scene snapshot (from houdini_runtime).
|
|
179
|
+
|
|
180
|
+
Returns:
|
|
181
|
+
{
|
|
182
|
+
"plan_id": str,
|
|
183
|
+
"ok": bool,
|
|
184
|
+
"intent": str | None,
|
|
185
|
+
"confidence": float,
|
|
186
|
+
"selected_template": str | None,
|
|
187
|
+
"execution_strategy": dict,
|
|
188
|
+
"operations": list[dict],
|
|
189
|
+
"op_count": int,
|
|
190
|
+
"parameters": dict,
|
|
191
|
+
"warnings": list[str],
|
|
192
|
+
"errors": list[str],
|
|
193
|
+
"requires_approval": bool,
|
|
194
|
+
"approval_reasons": list[str],
|
|
195
|
+
"resource_estimate": dict,
|
|
196
|
+
"constraint_result": dict,
|
|
197
|
+
"reasoning": list[str],
|
|
198
|
+
"llm_refined": bool,
|
|
199
|
+
"timestamp": float,
|
|
200
|
+
}
|
|
201
|
+
"""
|
|
202
|
+
plan_id = str(uuid.uuid4())
|
|
203
|
+
ts = time.time()
|
|
204
|
+
warnings: List[str] = []
|
|
205
|
+
errors: List[str] = []
|
|
206
|
+
reasoning: List[str] = []
|
|
207
|
+
|
|
208
|
+
context_analysis = dict(context_analysis or {})
|
|
209
|
+
parsed_intent = dict(parsed_intent)
|
|
210
|
+
|
|
211
|
+
intent = parsed_intent.get("intent")
|
|
212
|
+
parameters = dict(parsed_intent.get("parameters", {}))
|
|
213
|
+
confidence = float(parsed_intent.get("confidence", 0.0))
|
|
214
|
+
|
|
215
|
+
# --- No intent found ---
|
|
216
|
+
if not intent:
|
|
217
|
+
return {
|
|
218
|
+
"plan_id": plan_id,
|
|
219
|
+
"ok": False,
|
|
220
|
+
"intent": None,
|
|
221
|
+
"confidence": confidence,
|
|
222
|
+
"selected_template": None,
|
|
223
|
+
"execution_strategy": {},
|
|
224
|
+
"operations": [],
|
|
225
|
+
"op_count": 0,
|
|
226
|
+
"parameters": parameters,
|
|
227
|
+
"warnings": warnings,
|
|
228
|
+
"errors": ["No semantic intent could be resolved from the prompt."],
|
|
229
|
+
"requires_approval": False,
|
|
230
|
+
"approval_reasons": [],
|
|
231
|
+
"resource_estimate": {},
|
|
232
|
+
"constraint_result": {},
|
|
233
|
+
"reasoning": ["Intent parser returned no intent."],
|
|
234
|
+
"llm_refined": False,
|
|
235
|
+
"timestamp": ts,
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
# --- Ambiguity warning ---
|
|
239
|
+
if parsed_intent.get("ambiguous"):
|
|
240
|
+
alts = parsed_intent.get("alternatives", [])
|
|
241
|
+
alt_labels = ", ".join(a.get("intent", "") for a in alts[:2])
|
|
242
|
+
warnings.append(
|
|
243
|
+
f"Intent '{intent}' is ambiguous with: {alt_labels}. "
|
|
244
|
+
"Proceeding with best match — verify the plan before executing."
|
|
245
|
+
)
|
|
246
|
+
reasoning.append(f"Resolved intent: '{intent}' (confidence={confidence:.2f})")
|
|
247
|
+
|
|
248
|
+
# --- Select strategy ---
|
|
249
|
+
strategy = _select_strategy(intent, context_analysis, parameters)
|
|
250
|
+
reasoning.append(f"Execution strategy: {strategy['strategy']} — {strategy['rationale']}")
|
|
251
|
+
|
|
252
|
+
# --- Optimization suggestions from context ---
|
|
253
|
+
for sug in context_analysis.get("optimization_suggestions", []):
|
|
254
|
+
warnings.append(f"Optimization hint: {sug}")
|
|
255
|
+
|
|
256
|
+
# --- Resolve template parameters ---
|
|
257
|
+
template_params = _build_template_params(intent, parameters, strategy)
|
|
258
|
+
|
|
259
|
+
# --- Resolve ops: try workflow template first, then semantic registry ---
|
|
260
|
+
wt = get_workflow_templates()
|
|
261
|
+
ops: List[Dict[str, Any]] = []
|
|
262
|
+
selected_template: Optional[str] = None
|
|
263
|
+
|
|
264
|
+
# Map intent id to template id (they share names by convention)
|
|
265
|
+
template_map: Dict[str, str] = {
|
|
266
|
+
"build_pyro_source": "pyro_source",
|
|
267
|
+
"setup_karma_renderer": "karma_render",
|
|
268
|
+
"export_to_usd": "usd_export",
|
|
269
|
+
"cache_geometry": "geometry_cache",
|
|
270
|
+
"asset_publish_scaffold": "asset_publish",
|
|
271
|
+
"solaris_lighting_setup": "solaris_lighting_setup",
|
|
272
|
+
"create_geo_container": "vfx_container",
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
template_id = template_map.get(intent)
|
|
276
|
+
if template_id and wt.get_template(template_id):
|
|
277
|
+
try:
|
|
278
|
+
ops = wt.apply_template(template_id, template_params)
|
|
279
|
+
selected_template = template_id
|
|
280
|
+
reasoning.append(f"Resolved via workflow template '{template_id}': {len(ops)} op(s).")
|
|
281
|
+
except Exception as exc:
|
|
282
|
+
warnings.append(f"Workflow template '{template_id}' failed: {exc}. Falling back to semantic registry.")
|
|
283
|
+
|
|
284
|
+
if not ops:
|
|
285
|
+
reg = get_semantic_registry()
|
|
286
|
+
plan_data = reg.resolve_to_execution_plan(intent, template_params)
|
|
287
|
+
if plan_data["ok"]:
|
|
288
|
+
ops = plan_data["operations"]
|
|
289
|
+
reasoning.append(f"Resolved via semantic registry: {len(ops)} op(s).")
|
|
290
|
+
else:
|
|
291
|
+
errors.append(f"Could not resolve intent '{intent}': {plan_data.get('error', 'unknown error')}")
|
|
292
|
+
|
|
293
|
+
# --- Constraint check ---
|
|
294
|
+
constraint_result = get_runtime_constraints().validate_transaction(ops) if ops else {"valid": True, "violations": []}
|
|
295
|
+
for violation in constraint_result.get("violations", []):
|
|
296
|
+
errors.append(f"Constraint '{violation.get('policy_id', '?')}': {violation.get('message', '')}")
|
|
297
|
+
|
|
298
|
+
# --- Resource estimate ---
|
|
299
|
+
resource_estimate = get_resource_estimator().estimate_transaction(ops) if ops else {}
|
|
300
|
+
|
|
301
|
+
# --- Approval assessment ---
|
|
302
|
+
approval = _assess_approval(ops, resource_estimate, constraint_result, context_analysis)
|
|
303
|
+
|
|
304
|
+
# --- Optional LLM refinement ---
|
|
305
|
+
llm_refined = False
|
|
306
|
+
provider = get_llm_provider()
|
|
307
|
+
if ops and provider.is_available and provider.provider_name != "noop":
|
|
308
|
+
try:
|
|
309
|
+
refinement = await provider.suggest_plan_refinement(
|
|
310
|
+
intent,
|
|
311
|
+
{
|
|
312
|
+
"operations": ops,
|
|
313
|
+
"parameters": template_params,
|
|
314
|
+
"strategy": strategy,
|
|
315
|
+
},
|
|
316
|
+
scene_context,
|
|
317
|
+
)
|
|
318
|
+
if refinement.get("refined"):
|
|
319
|
+
for sug in refinement.get("suggestions", []):
|
|
320
|
+
warnings.append(f"LLM refinement: {sug}")
|
|
321
|
+
for warn in refinement.get("warnings", []):
|
|
322
|
+
warnings.append(f"LLM warning: {warn}")
|
|
323
|
+
llm_refined = True
|
|
324
|
+
reasoning.append(f"LLM ({provider.provider_name}) provided refinement suggestions.")
|
|
325
|
+
except Exception as exc:
|
|
326
|
+
warnings.append(f"LLM plan refinement failed (non-fatal): {exc}")
|
|
327
|
+
|
|
328
|
+
ok = len(errors) == 0
|
|
329
|
+
|
|
330
|
+
return {
|
|
331
|
+
"plan_id": plan_id,
|
|
332
|
+
"ok": ok,
|
|
333
|
+
"intent": intent,
|
|
334
|
+
"confidence": confidence,
|
|
335
|
+
"selected_template": selected_template,
|
|
336
|
+
"execution_strategy": strategy,
|
|
337
|
+
"operations": ops,
|
|
338
|
+
"op_count": len(ops),
|
|
339
|
+
"parameters": template_params,
|
|
340
|
+
"warnings": warnings,
|
|
341
|
+
"errors": errors,
|
|
342
|
+
"requires_approval": approval["requires_approval"],
|
|
343
|
+
"approval_reasons": approval["approval_reasons"],
|
|
344
|
+
"resource_estimate": resource_estimate,
|
|
345
|
+
"constraint_result": constraint_result,
|
|
346
|
+
"reasoning": reasoning,
|
|
347
|
+
"llm_refined": llm_refined,
|
|
348
|
+
"timestamp": ts,
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
|
|
352
|
+
# ---------------------------------------------------------------------------
|
|
353
|
+
# Singleton
|
|
354
|
+
# ---------------------------------------------------------------------------
|
|
355
|
+
|
|
356
|
+
_PLANNER: Optional[AIPlanner] = None
|
|
357
|
+
_LOCK = threading.Lock()
|
|
358
|
+
|
|
359
|
+
|
|
360
|
+
def get_ai_planner() -> AIPlanner:
|
|
361
|
+
global _PLANNER
|
|
362
|
+
with _LOCK:
|
|
363
|
+
if _PLANNER is None:
|
|
364
|
+
_PLANNER = AIPlanner()
|
|
365
|
+
return _PLANNER
|
|
366
|
+
|
|
367
|
+
|
|
368
|
+
def reset_ai_planner_for_tests() -> None:
|
|
369
|
+
global _PLANNER
|
|
370
|
+
with _LOCK:
|
|
371
|
+
_PLANNER = None
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Human Approval Pipeline (Tier 3)
|
|
3
|
+
===================================
|
|
4
|
+
Approval gate between AI planning and execution. Ensures high-risk,
|
|
5
|
+
destructive, or large plans receive explicit human authorization before
|
|
6
|
+
running.
|
|
7
|
+
|
|
8
|
+
State machine per approval request:
|
|
9
|
+
pending → approved → (caller executes)
|
|
10
|
+
pending → rejected → (caller aborts)
|
|
11
|
+
pending → deferred → (caller skips until re-submitted)
|
|
12
|
+
|
|
13
|
+
Auto-approval: if risk_level != "high" and no destructive ops and no
|
|
14
|
+
approval_reasons in the plan → auto-approved immediately.
|
|
15
|
+
|
|
16
|
+
The pipeline is SYNCHRONOUS (planning decisions should not block on async).
|
|
17
|
+
Approvals are stored in an in-memory registry with an optional expiry.
|
|
18
|
+
|
|
19
|
+
Public API:
|
|
20
|
+
get_approval_pipeline() -> ApprovalPipeline
|
|
21
|
+
reset_approval_pipeline_for_tests()
|
|
22
|
+
|
|
23
|
+
ApprovalPipeline.requires_approval(plan) -> bool
|
|
24
|
+
ApprovalPipeline.submit_for_approval(plan, submitter=None) -> str # → request_id
|
|
25
|
+
ApprovalPipeline.approve(request_id, approver=None, notes="") -> bool
|
|
26
|
+
ApprovalPipeline.reject(request_id, approver=None, reason="") -> bool
|
|
27
|
+
ApprovalPipeline.defer(request_id, approver=None, notes="") -> bool
|
|
28
|
+
ApprovalPipeline.get_status(request_id) -> dict | None
|
|
29
|
+
ApprovalPipeline.auto_approve(plan) -> dict # skip pipeline if safe
|
|
30
|
+
ApprovalPipeline.list_pending() -> list[dict]
|
|
31
|
+
ApprovalPipeline.clear()
|
|
32
|
+
"""
|
|
33
|
+
|
|
34
|
+
import threading
|
|
35
|
+
import time
|
|
36
|
+
import uuid
|
|
37
|
+
from typing import Any, Dict, List, Optional
|
|
38
|
+
|
|
39
|
+
_VALID_STATUSES = frozenset({"pending", "approved", "rejected", "deferred", "auto"})
|
|
40
|
+
_DESTRUCTIVE_OPS = frozenset({"delete_node"})
|
|
41
|
+
|
|
42
|
+
# After this many seconds a pending request auto-expires (0 = never)
|
|
43
|
+
_DEFAULT_EXPIRY_SEC = 0
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def _has_destructive_ops(ops: List[Dict[str, Any]]) -> bool:
|
|
47
|
+
return any(op.get("op") in _DESTRUCTIVE_OPS for op in ops)
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
class ApprovalPipeline:
|
|
51
|
+
"""Synchronous approval state machine.
|
|
52
|
+
|
|
53
|
+
Args:
|
|
54
|
+
expiry_sec: Seconds before a pending request expires (0 = never).
|
|
55
|
+
"""
|
|
56
|
+
|
|
57
|
+
def __init__(self, expiry_sec: int = _DEFAULT_EXPIRY_SEC):
|
|
58
|
+
self._expiry_sec = expiry_sec
|
|
59
|
+
self._store: Dict[str, Dict[str, Any]] = {}
|
|
60
|
+
self._lock = threading.Lock()
|
|
61
|
+
|
|
62
|
+
# ------------------------------------------------------------------
|
|
63
|
+
# Public API
|
|
64
|
+
# ------------------------------------------------------------------
|
|
65
|
+
|
|
66
|
+
def requires_approval(self, plan: Dict[str, Any]) -> bool:
|
|
67
|
+
"""Return True if the plan must go through the human approval gate."""
|
|
68
|
+
if plan.get("requires_approval"):
|
|
69
|
+
return True
|
|
70
|
+
resource = plan.get("resource_estimate", {})
|
|
71
|
+
if resource.get("risk_level") == "high":
|
|
72
|
+
return True
|
|
73
|
+
ops = plan.get("operations", [])
|
|
74
|
+
if _has_destructive_ops(ops):
|
|
75
|
+
return True
|
|
76
|
+
return False
|
|
77
|
+
|
|
78
|
+
def submit_for_approval(
|
|
79
|
+
self,
|
|
80
|
+
plan: Dict[str, Any],
|
|
81
|
+
submitter: Optional[str] = None,
|
|
82
|
+
) -> str:
|
|
83
|
+
"""Create a pending approval request for the plan.
|
|
84
|
+
|
|
85
|
+
Returns the request_id (uuid4 string).
|
|
86
|
+
"""
|
|
87
|
+
request_id = str(uuid.uuid4())
|
|
88
|
+
now = time.time()
|
|
89
|
+
record = {
|
|
90
|
+
"request_id": request_id,
|
|
91
|
+
"status": "pending",
|
|
92
|
+
"plan_id": plan.get("plan_id", ""),
|
|
93
|
+
"intent": plan.get("intent", ""),
|
|
94
|
+
"op_count": plan.get("op_count", len(plan.get("operations", []))),
|
|
95
|
+
"risk_level": plan.get("resource_estimate", {}).get("risk_level", "low"),
|
|
96
|
+
"approval_reasons": list(plan.get("approval_reasons", [])),
|
|
97
|
+
"submitter": submitter or "system",
|
|
98
|
+
"approver": None,
|
|
99
|
+
"notes": "",
|
|
100
|
+
"submitted_at": now,
|
|
101
|
+
"decided_at": None,
|
|
102
|
+
"expires_at": now + self._expiry_sec if self._expiry_sec > 0 else None,
|
|
103
|
+
}
|
|
104
|
+
with self._lock:
|
|
105
|
+
self._store[request_id] = record
|
|
106
|
+
return request_id
|
|
107
|
+
|
|
108
|
+
def auto_approve(self, plan: Dict[str, Any]) -> Dict[str, Any]:
|
|
109
|
+
"""Return an auto-approved decision dict for safe plans (bypass gate).
|
|
110
|
+
|
|
111
|
+
The caller is responsible for checking requires_approval() first.
|
|
112
|
+
Only call this if requires_approval() returns False.
|
|
113
|
+
"""
|
|
114
|
+
return {
|
|
115
|
+
"request_id": str(uuid.uuid4()),
|
|
116
|
+
"status": "auto",
|
|
117
|
+
"plan_id": plan.get("plan_id", ""),
|
|
118
|
+
"intent": plan.get("intent", ""),
|
|
119
|
+
"notes": "Auto-approved: risk is below approval threshold.",
|
|
120
|
+
"decided_at": time.time(),
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
def approve(
|
|
124
|
+
self,
|
|
125
|
+
request_id: str,
|
|
126
|
+
approver: Optional[str] = None,
|
|
127
|
+
notes: str = "",
|
|
128
|
+
) -> bool:
|
|
129
|
+
"""Approve a pending request. Returns True if state changed."""
|
|
130
|
+
return self._transition(request_id, "approved", approver, notes)
|
|
131
|
+
|
|
132
|
+
def reject(
|
|
133
|
+
self,
|
|
134
|
+
request_id: str,
|
|
135
|
+
approver: Optional[str] = None,
|
|
136
|
+
reason: str = "",
|
|
137
|
+
) -> bool:
|
|
138
|
+
"""Reject a pending request. Returns True if state changed."""
|
|
139
|
+
return self._transition(request_id, "rejected", approver, reason)
|
|
140
|
+
|
|
141
|
+
def defer(
|
|
142
|
+
self,
|
|
143
|
+
request_id: str,
|
|
144
|
+
approver: Optional[str] = None,
|
|
145
|
+
notes: str = "",
|
|
146
|
+
) -> bool:
|
|
147
|
+
"""Defer a pending request. Returns True if state changed."""
|
|
148
|
+
return self._transition(request_id, "deferred", approver, notes)
|
|
149
|
+
|
|
150
|
+
def get_status(self, request_id: str) -> Optional[Dict[str, Any]]:
|
|
151
|
+
"""Return the approval record, or None if not found / expired."""
|
|
152
|
+
with self._lock:
|
|
153
|
+
record = self._store.get(request_id)
|
|
154
|
+
if record is None:
|
|
155
|
+
return None
|
|
156
|
+
if self._is_expired(record):
|
|
157
|
+
record = dict(record)
|
|
158
|
+
record["status"] = "expired"
|
|
159
|
+
return record
|
|
160
|
+
return dict(record)
|
|
161
|
+
|
|
162
|
+
def list_pending(self) -> List[Dict[str, Any]]:
|
|
163
|
+
"""Return all non-expired pending requests, oldest first."""
|
|
164
|
+
now = time.time()
|
|
165
|
+
with self._lock:
|
|
166
|
+
result = [
|
|
167
|
+
dict(r) for r in self._store.values()
|
|
168
|
+
if r["status"] == "pending"
|
|
169
|
+
and (r.get("expires_at") is None or r["expires_at"] > now)
|
|
170
|
+
]
|
|
171
|
+
result.sort(key=lambda r: r["submitted_at"])
|
|
172
|
+
return result
|
|
173
|
+
|
|
174
|
+
def clear(self) -> None:
|
|
175
|
+
"""Remove all records (test helper)."""
|
|
176
|
+
with self._lock:
|
|
177
|
+
self._store.clear()
|
|
178
|
+
|
|
179
|
+
def stats(self) -> Dict[str, Any]:
|
|
180
|
+
with self._lock:
|
|
181
|
+
counts: Dict[str, int] = {}
|
|
182
|
+
for r in self._store.values():
|
|
183
|
+
s = r["status"]
|
|
184
|
+
counts[s] = counts.get(s, 0) + 1
|
|
185
|
+
return {"total": len(self._store), "by_status": counts}
|
|
186
|
+
|
|
187
|
+
# ------------------------------------------------------------------
|
|
188
|
+
# Internal helpers
|
|
189
|
+
# ------------------------------------------------------------------
|
|
190
|
+
|
|
191
|
+
def _transition(
|
|
192
|
+
self,
|
|
193
|
+
request_id: str,
|
|
194
|
+
new_status: str,
|
|
195
|
+
approver: Optional[str],
|
|
196
|
+
notes: str,
|
|
197
|
+
) -> bool:
|
|
198
|
+
with self._lock:
|
|
199
|
+
record = self._store.get(request_id)
|
|
200
|
+
if record is None:
|
|
201
|
+
return False
|
|
202
|
+
if record["status"] != "pending":
|
|
203
|
+
return False
|
|
204
|
+
if self._is_expired(record):
|
|
205
|
+
return False
|
|
206
|
+
record["status"] = new_status
|
|
207
|
+
record["approver"] = approver or "system"
|
|
208
|
+
record["notes"] = notes
|
|
209
|
+
record["decided_at"] = time.time()
|
|
210
|
+
return True
|
|
211
|
+
|
|
212
|
+
@staticmethod
|
|
213
|
+
def _is_expired(record: Dict[str, Any]) -> bool:
|
|
214
|
+
exp = record.get("expires_at")
|
|
215
|
+
return exp is not None and time.time() > exp
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
# ---------------------------------------------------------------------------
|
|
219
|
+
# Singleton
|
|
220
|
+
# ---------------------------------------------------------------------------
|
|
221
|
+
|
|
222
|
+
_PIPELINE: Optional[ApprovalPipeline] = None
|
|
223
|
+
_LOCK = threading.Lock()
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
def get_approval_pipeline() -> ApprovalPipeline:
|
|
227
|
+
global _PIPELINE
|
|
228
|
+
with _LOCK:
|
|
229
|
+
if _PIPELINE is None:
|
|
230
|
+
_PIPELINE = ApprovalPipeline()
|
|
231
|
+
return _PIPELINE
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
def reset_approval_pipeline_for_tests() -> None:
|
|
235
|
+
global _PIPELINE
|
|
236
|
+
with _LOCK:
|
|
237
|
+
_PIPELINE = None
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"""
|
|
2
|
+
src/runtime/architectural_features — Tier 10.5 Structural Openings & Architectural Features
|
|
3
|
+
============================================================================================
|
|
4
|
+
Converts EnvironmentShell from a logical enclosure into a real architectural room
|
|
5
|
+
by generating physical openings, beam placements, fireplace attachments, and wall shelves.
|
|
6
|
+
|
|
7
|
+
Pipeline:
|
|
8
|
+
EnvironmentShell (Tier 10.4)
|
|
9
|
+
→ ArchitecturalPlanBuilder builds ArchitecturalPlan from shell anchors
|
|
10
|
+
→ EnvironmentArchitectureReview validates plan; produces ARCHITECTURE_STATUS
|
|
11
|
+
→ ArchitecturalFeatureRealizer creates Houdini geometry (/obj/sh_door_opening_*, etc.)
|
|
12
|
+
|
|
13
|
+
Design rules:
|
|
14
|
+
- No bridge calls except in ArchitecturalFeatureRealizer.
|
|
15
|
+
- Deterministic throughout.
|
|
16
|
+
- Never raises in public methods.
|
|
17
|
+
- Singleton + reset_for_tests on every class.
|
|
18
|
+
"""
|
|
19
|
+
|
|
20
|
+
from src.runtime.architectural_features.architectural_plan import (
|
|
21
|
+
ArchitecturalOpening,
|
|
22
|
+
FireplacePlacement,
|
|
23
|
+
BeamPlacement,
|
|
24
|
+
WallShelfPlacement,
|
|
25
|
+
ArchitecturalPlan,
|
|
26
|
+
WALL_THICKNESS,
|
|
27
|
+
)
|
|
28
|
+
from src.runtime.architectural_features.architectural_plan_builder import (
|
|
29
|
+
ArchitecturalPlanBuilder,
|
|
30
|
+
get_architectural_plan_builder,
|
|
31
|
+
reset_architectural_plan_builder_for_tests,
|
|
32
|
+
)
|
|
33
|
+
from src.runtime.architectural_features.environment_architecture_review import (
|
|
34
|
+
ARCHITECTURE_STATUS_PASS,
|
|
35
|
+
ARCHITECTURE_STATUS_FAIL,
|
|
36
|
+
ArchitectureReviewResult,
|
|
37
|
+
EnvironmentArchitectureReview,
|
|
38
|
+
get_environment_architecture_review,
|
|
39
|
+
reset_environment_architecture_review_for_tests,
|
|
40
|
+
)
|
|
41
|
+
from src.runtime.architectural_features.architectural_feature_realizer import (
|
|
42
|
+
RealizationRecord,
|
|
43
|
+
RealizationResult,
|
|
44
|
+
ArchitecturalFeatureRealizer,
|
|
45
|
+
get_architectural_feature_realizer,
|
|
46
|
+
reset_architectural_feature_realizer_for_tests,
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
__all__ = [
|
|
50
|
+
# Data models
|
|
51
|
+
"ArchitecturalOpening", "FireplacePlacement",
|
|
52
|
+
"BeamPlacement", "WallShelfPlacement",
|
|
53
|
+
"ArchitecturalPlan", "WALL_THICKNESS",
|
|
54
|
+
# Plan builder
|
|
55
|
+
"ArchitecturalPlanBuilder",
|
|
56
|
+
"get_architectural_plan_builder",
|
|
57
|
+
"reset_architectural_plan_builder_for_tests",
|
|
58
|
+
# Review
|
|
59
|
+
"ARCHITECTURE_STATUS_PASS", "ARCHITECTURE_STATUS_FAIL",
|
|
60
|
+
"ArchitectureReviewResult", "EnvironmentArchitectureReview",
|
|
61
|
+
"get_environment_architecture_review",
|
|
62
|
+
"reset_environment_architecture_review_for_tests",
|
|
63
|
+
# Realizer
|
|
64
|
+
"RealizationRecord", "RealizationResult",
|
|
65
|
+
"ArchitecturalFeatureRealizer",
|
|
66
|
+
"get_architectural_feature_realizer",
|
|
67
|
+
"reset_architectural_feature_realizer_for_tests",
|
|
68
|
+
]
|