fix monitor-webui failure to detect running daemon

monitor-webui fails to connect to the bd daemon because it calculates the socket path incorrectly. It expects beads.db.sock in a nested .beads directory, whereas the daemon listens on bd.sock in the .beads directory.

Updated `getSocketPath` function to:
- Check if dbPath directory is already .beads.
- Use bd.sock as the socket name instead of [dbName].sock.
- Handle both nested and non-nested cases correctly.
This commit is contained in:
Matt Wilkie
2025-11-19 14:33:37 -07:00
parent 4ba610dbae
commit e36baee506
4 changed files with 22 additions and 24 deletions

View File

@@ -111,11 +111,9 @@ func main() {
// getSocketPath returns the Unix socket path for the daemon
func getSocketPath(dbPath string) string {
// Use the database directory to determine socket path
// The daemon always creates the socket as "bd.sock" in the same directory as the database
dbDir := filepath.Dir(dbPath)
dbName := filepath.Base(dbPath)
socketName := dbName + ".sock"
return filepath.Join(dbDir, ".beads", socketName)
return filepath.Join(dbDir, "bd.sock")
}
// connectToDaemon establishes connection to the daemon