Extract socket controller into dedicated domain module#340
Extract socket controller into dedicated domain module#340senamakel merged 14 commits intotinyhumansai:mainfrom
Conversation
…bilityEngine directly - Updated the test suite to eliminate the use of global_engine, replacing it with a direct instantiation of AccessibilityEngine. - This change enhances test isolation and clarity by ensuring that each test operates with its own instance of the engine, improving reliability and maintainability.
- Introduced a new `socket` module to facilitate communication between skills, enhancing the modularity and organization of the codebase. - Updated imports in `qjs_engine.rs` to reference the new `SocketManager` from the `socket` module, streamlining socket management for skill interactions. - Removed the deprecated `socket_manager` module from the skills module, improving clarity and reducing redundancy in the code structure.
- Added socket-related registered controllers and schemas to the core build functions, enhancing the communication capabilities within the OpenHuman framework. - Updated the `build_registered_controllers` and `build_declared_controller_schemas` functions to include socket components, ensuring comprehensive integration of the new socket module.
- Updated the `bootstrap_skill_runtime` function to initialize and register the `SocketManager` globally, allowing RPC handlers to access socket functionalities. - Improved documentation to reflect the addition of socket management capabilities alongside the QuickJS skill runtime. - Cleaned up imports in `event_handlers.rs` to streamline the codebase.
- Removed the `SocketManager` integration from the `bootstrap_skill_runtime` function, simplifying the socket management process. - Eliminated the `socket_manager` field and related methods from the `RuntimeEngine` struct, streamlining the codebase. - Cleaned up unused MCP handlers and socket-related imports in the event handlers, enhancing code clarity and maintainability.
- Eliminated unnecessary calls to `sync_tools()` in the `RuntimeEngine` during skill status changes, simplifying the skill lifecycle management. - This change enhances performance by reducing redundant synchronization operations during skill execution and shutdown processes.
- Added logging for incoming socket events to improve observability, including event name and data size. - Implemented detailed debug logging for event payloads, ensuring clarity on the data being processed. - Updated event handling logic to streamline routing for webhook requests and inbound channel messages, enhancing the overall responsiveness of the system. - Introduced logging for unhandled events to aid in debugging and monitoring.
- Updated the `bootstrap_skill_runtime` function to clone the `SocketManager` instance for global registration, ensuring proper socket management. - Introduced background tasks for auto-starting skills and auto-connecting to the backend using stored session tokens, improving startup efficiency and user experience. - Added detailed logging for session token checks and connection attempts, enhancing observability and debugging capabilities during socket operations.
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 6 minutes and 24 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (22)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
- Introduced a new `manifests_in_dir` function to retrieve skill manifests from a specified directory, improving skill discovery. - Added `select_skill_id` function to prioritize skill selection based on environment variables and preferred candidates, enhancing flexibility in test configurations. - Updated the test suite to utilize the new skill selection logic, ensuring more robust and configurable test scenarios. - Improved handling of tool selection with enhanced logging and fallback mechanisms for better debugging and usability.
- Introduced new scripts for Rust checks and formatting in both the main and app package.json files. - Updated pre-push hook to include Rust compile checks, enhancing pre-push validation. - Modified existing format commands to integrate Rust formatting, ensuring consistency across codebases.
- Adjusted the formatting of the description text for better readability by breaking it into multiple lines within the `ScreenIntelligencePanel` component.
The socket auto-connect was panicking with "Could not automatically determine the process-level CryptoProvider" because tokio-tungstenite uses rustls for wss:// but no crypto provider was installed. Install the ring provider before each connect attempt. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The tests hardcoded 'example-skill' which no longer exists in the skills directory. Now dynamically picks the first available skill (preferring server-ping) so tests work regardless of which skills are present. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Summary
src/openhuman/skills/into its ownsrc/openhuman/socket/domain module, following the controller migration checklistsocket_manager.rsinto 5 focused files:types.rs,manager.rs,ws_loop.rs,event_handlers.rs,schemas.rssocket.connect,socket.disconnect,socket.state,socket.emit,socket.connect_with_session) replacing the old stubs:message(e.g.telegram:message,channel:message) triggers the agent loopTest plan
cargo checkpasses cleanly (no warnings)cargo test --lib— all 1935 unit tests pass[socket] Auto-connect initiatedin logsnode scripts/test-channel-receive.mjsto verify Telegram messages arriveopenhuman.socket_stateRPC to verify connection status🤖 Generated with Claude Code
Co-Authored-By: Claude Opus 4.6 (1M context) noreply@anthropic.com