feat: Complete Pipeline Mutation API implementation

- Add can_hot_swap() function to Pipeline class
- Add cleanup_stage() method to Pipeline class
- Fix remove_stage() to rebuild execution order after removal
- Extend ui_panel.execute_command() with docstrings for mutation commands
- Update WebSocket handler to support pipeline mutation commands
- Add _handle_pipeline_mutation() function for command routing
- Add comprehensive integration tests in test_pipeline_mutation_commands.py
- Update AGENTS.md with mutation API documentation

Issue: #35 (Pipeline Mutation API)
Acceptance criteria met:
-  can_hot_swap() checker for stage compatibility
-  cleanup_stage() cleans up specific stages
-  remove_stage_safe() rebuilds execution order (via remove_stage)
-  Unit tests for all operations
-  Integration with WebSocket commands
-  Documentation in AGENTS.md
This commit is contained in:
2026-03-19 04:33:00 -07:00
parent cd5034ce78
commit ff08b1d6f5
5 changed files with 483 additions and 1 deletions

View File

@@ -370,13 +370,24 @@ class UIPanel:
def execute_command(self, command: dict) -> bool:
"""Execute a command from external control (e.g., WebSocket).
Supported commands:
Supported UI commands:
- {"action": "toggle_stage", "stage": "stage_name"}
- {"action": "select_stage", "stage": "stage_name"}
- {"action": "adjust_param", "stage": "stage_name", "param": "param_name", "delta": 0.1}
- {"action": "change_preset", "preset": "preset_name"}
- {"action": "cycle_preset", "direction": 1}
Pipeline Mutation commands are handled by the WebSocket/runner handler:
- {"action": "add_stage", "stage": "stage_name", "type": "source|display|camera|effect"}
- {"action": "remove_stage", "stage": "stage_name"}
- {"action": "replace_stage", "stage": "old_stage_name", "with": "new_stage_type"}
- {"action": "swap_stages", "stage1": "name1", "stage2": "name2"}
- {"action": "move_stage", "stage": "stage_name", "after": "other_stage"|"before": "other_stage"}
- {"action": "enable_stage", "stage": "stage_name"}
- {"action": "disable_stage", "stage": "stage_name"}
- {"action": "cleanup_stage", "stage": "stage_name"}
- {"action": "can_hot_swap", "stage": "stage_name"}
Returns:
True if command was handled, False if not
"""