Documentation
¶
Index ¶
- Constants
- Variables
- func EnsurePushVAPIDKeys(profile, subject string) (publicKey, privateKey string, generated bool, err error)
- type Config
- type MemoryMenuData
- type MenuDataLoader
- type MenuGroup
- type MenuItem
- type MenuSession
- type MenuSessionState
- type MenuSnapshot
- type Server
- type SessionDataService
Constants ¶
const ( MenuItemTypeGroup = "group" MenuItemTypeSession = "session" )
Variables ¶
var ErrTmuxSessionNotFound = errors.New("tmux session not found")
Functions ¶
Types ¶
type Config ¶
type Config struct {
ListenAddr string
Profile string
ReadOnly bool
Token string
MenuData MenuDataLoader
PushVAPIDPublicKey string
PushVAPIDPrivateKey string
PushVAPIDSubject string
PushTestInterval time.Duration
}
Config defines runtime options for the web server.
type MemoryMenuData ¶
type MemoryMenuData struct {
// contains filtered or unexported fields
}
MemoryMenuData is an in-memory menu snapshot store used by web mode. It can optionally fall back to a loader (e.g. storage-backed) until the first in-memory snapshot is published.
func NewMemoryMenuData ¶
func NewMemoryMenuData(fallback MenuDataLoader) *MemoryMenuData
NewMemoryMenuData creates an in-memory menu data store.
func (*MemoryMenuData) LoadMenuSnapshot ¶
func (m *MemoryMenuData) LoadMenuSnapshot() (*MenuSnapshot, error)
LoadMenuSnapshot returns the latest in-memory snapshot. If no snapshot exists yet, it falls back once to the configured loader.
func (*MemoryMenuData) SetSnapshot ¶
func (m *MemoryMenuData) SetSnapshot(snapshot *MenuSnapshot)
SetSnapshot replaces the stored menu snapshot.
func (*MemoryMenuData) UpdateSessionStates ¶
func (m *MemoryMenuData) UpdateSessionStates(states map[string]MenuSessionState, generatedAt time.Time)
UpdateSessionStates updates status/tool fields in-place for existing sessions.
type MenuDataLoader ¶
type MenuDataLoader interface {
LoadMenuSnapshot() (*MenuSnapshot, error)
}
MenuDataLoader provides menu snapshots for web APIs and push notifications.
type MenuGroup ¶
type MenuGroup struct {
Name string `json:"name"`
Path string `json:"path"`
Expanded bool `json:"expanded"`
Order int `json:"order"`
SessionCount int `json:"sessionCount"`
}
MenuGroup contains metadata for a group item.
type MenuItem ¶
type MenuItem struct {
Index int `json:"index"`
Type string `json:"type"`
Level int `json:"level"`
Path string `json:"path,omitempty"`
Group *MenuGroup `json:"group,omitempty"`
Session *MenuSession `json:"session,omitempty"`
IsLastInGroup bool `json:"isLastInGroup,omitempty"`
IsSubSession bool `json:"isSubSession,omitempty"`
IsLastSubSession bool `json:"isLastSubSession,omitempty"`
ParentIsLastInGroup bool `json:"parentIsLastInGroup,omitempty"`
}
MenuItem represents one row in the flattened navigation list.
type MenuSession ¶
type MenuSession struct {
ID string `json:"id"`
Title string `json:"title"`
Tool string `json:"tool"`
Status session.Status `json:"status"`
GroupPath string `json:"groupPath"`
ProjectPath string `json:"projectPath"`
ParentSessionID string `json:"parentSessionId,omitempty"`
Order int `json:"order"`
TmuxSession string `json:"tmuxSession,omitempty"`
CreatedAt time.Time `json:"createdAt"`
LastAccessedAt time.Time `json:"lastAccessedAt,omitempty"`
}
MenuSession contains metadata for a session item.
type MenuSessionState ¶
MenuSessionState is a lightweight status/tool update for one session.
type MenuSnapshot ¶
type MenuSnapshot struct {
Profile string `json:"profile"`
GeneratedAt time.Time `json:"generatedAt"`
TotalGroups int `json:"totalGroups"`
TotalSessions int `json:"totalSessions"`
Items []MenuItem `json:"items"`
}
MenuSnapshot is a flattened, ordered representation of session navigation data.
func BuildMenuSnapshot ¶
func BuildMenuSnapshot(profile string, instances []*session.Instance, groupsData []*session.GroupData, generatedAt time.Time) *MenuSnapshot
BuildMenuSnapshot converts in-memory session/group state into a flattened web DTO.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server wraps an HTTP server for Agent Deck web mode.
type SessionDataService ¶
type SessionDataService struct {
// contains filtered or unexported fields
}
SessionDataService loads profile session data and transforms it into web-friendly DTOs.
func NewSessionDataService ¶
func NewSessionDataService(profile string) *SessionDataService
NewSessionDataService creates a SessionDataService for a profile.
func (*SessionDataService) LoadMenuSnapshot ¶
func (s *SessionDataService) LoadMenuSnapshot() (*MenuSnapshot, error)
LoadMenuSnapshot loads sessions/groups and returns a deterministic flattened menu DTO.
func (*SessionDataService) Profile ¶
func (s *SessionDataService) Profile() string
Profile returns the effective profile this service reads from.