Skip to content

Latest commit

 

History

History
75 lines (57 loc) · 2.55 KB

File metadata and controls

75 lines (57 loc) · 2.55 KB

TUI Connection Integration Test

Summary

Successfully implemented TUI connection support in the Codebolt agent server.

Changes Made

1. TUI Connections Manager (tuiConnectionsManager.ts)

  • ✅ Created singleton TUI connection manager
  • ✅ Implemented registration, removal, and message handling
  • ✅ Added project association support
  • ✅ Included broadcasting capabilities

2. Main Connection Manager (connectionManager.ts)

  • ✅ 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

3. Type Definitions

  • ✅ Extended ClientConnection.type to include 'tui'
  • ✅ Extended ConnectionInfo.type to include 'tui'
  • ✅ Updated ConnectionParams to include tuiId
  • ✅ Updated ClientType to include 'tui'

4. WebSocket Server (websocketServer.ts)

  • ✅ 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

5. TUI Client (wsclient.go)

  • ✅ Changed registration from 'app' to 'tui' client type

How It Works

  1. TUI Startup: The Go TUI client connects to the WebSocket server
  2. Registration: TUI sends {"type": "register", "clientType": "tui"}
  3. Server Processing: Server recognizes 'tui' client type and routes to TUI connection manager
  4. Connection Management: TUI is registered in the TUI connection manager
  5. Message Routing: Messages to/from TUI are properly routed through the system

Testing

To test the integration:

  1. Start the agent server:
cd remoteexecutor/updatedAgentServer
npm run dev
  1. Start the TUI client:
cd tui/gotui
go run cmd/gotui/main.go
  1. Verify in server logs that TUI connection is registered:
[INFO] TuiConnectionsManager: TUI registered: [connection-id]
  1. Test message sending from TUI using the test command in the TUI

Benefits

  • 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.