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"` }