Files
vmux/protocol.go
Pierre Martin efbe31928e feat(04-01): integrate notifications and focus mode into daemon
- Notifier + FocusTimer fields in Daemon, initialized in NewDaemon
- processHookEvent notifies on Working -> Needs Input only (D-01)
- Focus mode suppresses notifications when active (D-05)
- FocusArgs in protocol, "focus" handler in daemon
- CLI "vmux focus <minutes>" command
- Tests for all notification transitions and focus handler
2026-03-23 21:26:02 +01:00

51 lines
1.5 KiB
Go

package main
import (
"encoding/json"
"time"
)
// Request is the JSON message sent by a client to the daemon over the Unix socket.
type Request struct {
Action string `json:"action"` // "list", "switch", "label", "stop"
Args json.RawMessage `json:"args,omitempty"`
}
// Response is the JSON message sent back by the daemon.
type Response struct {
OK bool `json:"ok"`
Error string `json:"error,omitempty"`
Sessions []SessionInfo `json:"sessions,omitempty"`
FocusRemaining float64 `json:"focus_remaining,omitempty"`
}
// SessionInfo is the wire format for a session in IPC responses.
type SessionInfo struct {
PID int `json:"pid"`
SessionID string `json:"session_id"`
Cwd string `json:"cwd"`
GitBranch string `json:"git_branch"`
State string `json:"state"`
Preview string `json:"preview"`
Workspace string `json:"workspace"`
Label string `json:"label,omitempty"`
WaitType string `json:"wait_type,omitempty"`
WaitingSince *time.Time `json:"waiting_since,omitempty"`
}
// SwitchArgs carries the query for workspace switching.
type SwitchArgs struct {
Query string `json:"query"`
}
// LabelArgs carries the session ID and label for the label action.
type LabelArgs struct {
SessionID string `json:"session_id"`
Label string `json:"label"`
}
// FocusArgs carries the duration for the focus command.
type FocusArgs struct {
Minutes int `json:"minutes"`
}