Dual-Process JSON-RPC WebSocket Communication & SlashWorker Lock-Avoidance Queue
Decrypting tui_gateway/server.py state routing dispatch and slash_worker.py serial queuing mechanism
๐ Figure 6-2-1: Dual-process persistent connection routing, WebSocket frame decoding, and SlashWorker serial processing sequence diagram
๐ 1. Dual-Process JSON-RPC 2.0 Persistent Connection Data Routing
When a user sends a command via the hermes --tui input box, the command is routed through a JSON-RPC 2.0 server maintained by tui_gateway/server.py for WebSocket persistent connection frame data distribution.
๐ Figure 6-2-2: Dual-process JSON-RPC uplink/downlink data frames and control flow interaction sequence diagram
๐ฆ 2. SlashWorker Single-Thread Serial Queue
Slash commands like /compress involve heavy database write logging, file reading, and other CPU/IO-intensive operations. The system implements a background SlashWorker single-thread serial queue in tui_gateway/slash_worker.py, ensuring tasks are queued and executed sequentially to prevent database Busy lock deadlocks.