Documentation Index
Fetch the complete documentation index at: https://mintlify.com/jaypopat/cf_ai_duet/llms.txt
Use this file to discover all available pages before exploring further.
Overview
Theserver package provides the SSH server that handles client connections and manages Bubble Tea sessions for the Duet TUI.
Types
Server
Main server struct that manages SSH connections and room state.Functions
New
Creates a new Duet server instance.The address to listen on (e.g., “localhost:2222”)
Path to the SSH host key file
Optional URL for the AI worker service. If empty, AI features will be disabled
*Server instance
Example:
Start
Starts the SSH server and blocks until shutdown.- Starts SSH server with Bubble Tea middleware
- Listens for OS interrupt signals (SIGINT, SIGTERM)
- Performs graceful shutdown with 10-second timeout
- Logs server lifecycle events
Implementation Details
SSH Middleware
The server uses Wish middleware for SSH handling:- Bubble Tea Middleware: Manages TUI sessions
- Logging Middleware: Logs connection events
Session Handling
Each SSH connection:- Extracts username (defaults to “guest”)
- Creates a Bubble Tea renderer
- Detects terminal type (special handling for xterm-ghostty)
- Initializes a UI model with the room manager
- Launches in alternate screen mode