How seruman/hauntty works
hauntty is a terminal-session persistence service. The principal workflow is ht parsing a command and configuration, connecting over a Unix socket, then asking the daemon to create or reattach to a shell-backed PTY session; PTY output updates terminal state and is streamed to attached clients. The daemon also supports session control, inspection, screen dumps, and persistence/restoration of dead sessions. README capabilities inform the map; where handler source was not sampled, uncertain internal links are omitted.
Main entry points: server.go Socket server · client.go Client API · session_lifecycle.go Session lifecycle · main.go ht commands
Components 18
Command line
- ht commands
cmd/ht/main.go - Configuration
internal/config/config.go
Client transport
- Client API
internal/client/client.go - Attach client
internal/client/attach.go - Wire messages
internal/protocol/messages.go
Daemon sessions
- Socket server
internal/daemon/server.go - Session controls
internal/daemon/server_control.go - Session inspection
internal/daemon/server_inspect.go - Attach handling
internal/daemon/server_attach.go - Session lifecycle
internal/daemon/session_lifecycle.go - Attached clients
internal/daemon/session_clients.go - Saved sessions
internal/daemon/persist.go - Socket paths
internal/config/paths.go
Terminal state
- Terminal state
internal/daemon/terminal_state.go - VT engine
libghostty/terminal.go - Screen dumps
internal/protocol/dump.go
Other components
- Terminal user
- Shell in PTY
Connections 24
- Terminal user → ht commands: runs commands
- ht commands → Configuration: loads settings
- ht commands → Client API: invokes operations
- Client API → Socket paths: resolves socket
- Client API → Wire messages: encodes requests
- Client API → Socket server: sends over socket
- Socket server → Wire messages: decodes messages
- Socket server → Session controls: dispatches controls
- Socket server → Session inspection: dispatches inspection
- Socket server → Attach handling: dispatches attach
- Session controls → Session lifecycle: controls sessions
- Attach handling → Session lifecycle: attaches to session
- Session lifecycle → Shell in PTY: starts PTY process
- Shell in PTY → Session lifecycle: writes PTY output
- Session lifecycle → Terminal state: feeds terminal bytes
- Terminal state → VT engine: updates VT state
- Attach handling → Attached clients: registers client
- Attached clients → Wire messages: streams output
- Session inspection → Screen dumps: formats screen
- Terminal state → Screen dumps: provides screen state
- Socket server → Saved sessions: persists sessions
- Saved sessions → Socket server: restores sessions
- Attach client → Client API: uses client API
- Client API → Attach client: runs interactive attach