Successfully implemented TUI connection support in the Codebolt agent server.
- ✅ Created singleton TUI connection manager
- ✅ Implemented registration, removal, and message handling
- ✅ Added project association support
- ✅ Included broadcasting capabilities
- ✅ Added TUI manager instance
- ✅ Updated registration to handle 'tui' connection type
- ✅ Updated connection removal to handle TUIs
- ✅ Modified all connection methods to include TUIs
- ✅ Added
getTuiConnectionManager()method
- ✅ Extended
ClientConnection.typeto include 'tui' - ✅ Extended
ConnectionInfo.typeto include 'tui' - ✅ Updated
ConnectionParamsto includetuiId - ✅ Updated
ClientTypeto include 'tui'
- ✅ Added TUI client type to constants
- ✅ Implemented
registerTui()method - ✅ Updated auto-registration logic to handle TUI clients
- ✅ Updated message routing to handle TUI connections
- ✅ Updated registration confirmation to support TUI instance IDs
- ✅ Changed registration from 'app' to 'tui' client type
- TUI Startup: The Go TUI client connects to the WebSocket server
- Registration: TUI sends
{"type": "register", "clientType": "tui"} - Server Processing: Server recognizes 'tui' client type and routes to TUI connection manager
- Connection Management: TUI is registered in the TUI connection manager
- Message Routing: Messages to/from TUI are properly routed through the system
To test the integration:
- Start the agent server:
cd remoteexecutor/updatedAgentServer
npm run dev- Start the TUI client:
cd tui/gotui
go run cmd/gotui/main.go- Verify in server logs that TUI connection is registered:
[INFO] TuiConnectionsManager: TUI registered: [connection-id]
- Test message sending from TUI using the
testcommand in the TUI
- Separation of Concerns: TUI connections are managed separately from apps and agents
- Scalability: Easy to add TUI-specific features and logic
- Consistency: Follows the same patterns as existing connection managers
- Integration: Seamlessly works with existing message routing and handling
The TUI client will now properly register as a TUI connection type and receive messages through the dedicated TUI connection manager.