The `ComponentRegistry` class has been extensively refactored to improve its structure, maintainability, and functionality. This overhaul simplifies core logic and introduces a new capability for session-level component control.
Key improvements include:
- **Structural Reorganization**: The class is now divided into logical sections (Initialization, Registration, State Management, etc.) for better readability.
- **Simplified Registration**: The main `register_component` method now uses a dictionary-based handler dispatch, replacing a large `match-case` block and improving extensibility.
- **Local State Management**: Introduced a new feature for session-level (stream-specific) component state. This allows temporary enabling/disabling of components within a single conversation via `set_local_component_state` and `is_component_available`.
- **Consistent Methods**: Internal registration, removal, and state-change methods have been streamlined for consistency and robustness.
- **Enhanced Querying**: Component query methods now correctly factor in both global and local (session) availability states.
- **Code Quality**: Improved docstrings, type hints, and general code simplification throughout the module.