Documentation
¶
Index ¶
- Constants
- Variables
- func EnsurePushVAPIDKeys(profile, subject string) (publicKey, privateKey string, generated bool, err error)
- type Assets
- type Config
- type CreateGroupRequest
- type CreateSessionRequest
- type MemoryMenuData
- type MenuDataLoader
- type MenuGroup
- type MenuItem
- type MenuSession
- type MenuSessionState
- type MenuSnapshot
- type ProfilesResponse
- type RenameGroupRequest
- type SSECostEvent
- type SSEDeleteEvent
- type SSEGroupDeleteEvent
- type SSEGroupEvent
- type SSESessionEvent
- type Server
- type SessionActionResponse
- type SessionDataService
- type SessionMutator
- type SettingsResponse
Constants ¶
const ( ErrCodeForbidden = "MUTATIONS_DISABLED" ErrCodeNotFound = "NOT_FOUND" ErrCodeBadRequest = "INVALID_REQUEST" ErrCodeMethodNotAllowed = "METHOD_NOT_ALLOWED" ErrCodeRateLimited = "RATE_LIMITED" ErrCodeInternalError = "INTERNAL_ERROR" ErrCodeNotImplemented = "NOT_IMPLEMENTED" ErrCodeReadOnly = "READ_ONLY" )
Error code constants for API error responses.
const ( MenuItemTypeGroup = "group" MenuItemTypeSession = "session" )
Variables ¶
var ErrTmuxSessionNotFound = errors.New("tmux session not found")
Functions ¶
Types ¶
type Assets ¶ added in v1.5.0
type Assets struct {
// contains filtered or unexported fields
}
Assets manages the manifest-based mapping from logical source paths (e.g. "app/main.js") to hashed bundle output paths (e.g. "dist/main.a1b2c3.js"). In dev mode (no manifest present) or when the AGENTDECK_WEB_BUNDLE=0 env var is set, ResolveAsset falls back to serving the unbundled source file at /static/<logical>.
PERF-H: the manifest is emitted by bundle.go (go:generate entry point) which drives github.com/evanw/esbuild/pkg/api. The dev/prod fork keeps live-reload friendly while shipping hashed, bundled JS in production.
func LoadAssets ¶ added in v1.5.0
LoadAssets reads a manifest file from a filesystem path and returns an Assets instance. A missing manifest is NOT an error — the returned instance operates in dev mode (fallback to /static/<logical>). The AGENTDECK_WEB_BUNDLE=0 env var forces dev mode even if the manifest is present, which is the rollback lever.
func LoadAssetsFromFS ¶ added in v1.5.0
LoadAssetsFromFS reads a manifest from an io/fs.FS (e.g. the server's embed.FS). Used by the server at startup so the manifest can travel inside the binary. Missing file → dev mode.
func (*Assets) ResolveAsset ¶ added in v1.5.0
ResolveAsset maps a logical source path to the URL the browser should fetch. In dev mode: "/static/<logical>". In prod mode: "/static/<hashed>". Unknown logical paths fall back to the logical form so missing-asset regressions surface as 404s rather than silent manifest lookups.
func (*Assets) SubstitutePlaceholders ¶ added in v1.5.0
SubstitutePlaceholders replaces every {{ASSET:logical}} token in the input string with the resolved URL. Used to fill index.html at serve time so the on-disk file stays hand-written (Pitfall 3 mitigation: dirty-tree check remains clean because the bundler never writes back to index.html).
type Config ¶
type Config struct {
ListenAddr string
Profile string
ReadOnly bool
WebMutations bool // When false, POST/PATCH/DELETE endpoints return 403
Token string
MenuData MenuDataLoader
PushVAPIDPublicKey string
PushVAPIDPrivateKey string
PushVAPIDSubject string
PushTestInterval time.Duration
}
Config defines runtime options for the web server.
type CreateGroupRequest ¶ added in v1.3.4
type CreateGroupRequest struct {
Name string `json:"name"`
ParentPath string `json:"parentPath,omitempty"`
}
CreateGroupRequest is the body for POST /api/groups.
type CreateSessionRequest ¶ added in v1.3.4
type CreateSessionRequest struct {
Title string `json:"title"`
Tool string `json:"tool"`
ProjectPath string `json:"projectPath"`
GroupPath string `json:"groupPath,omitempty"`
}
CreateSessionRequest is the body for POST /api/sessions.
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 ProfilesResponse ¶ added in v1.3.4
type ProfilesResponse struct {
Current string `json:"current"`
Profiles []string `json:"profiles"`
}
ProfilesResponse is returned by GET /api/profiles.
type RenameGroupRequest ¶ added in v1.3.4
type RenameGroupRequest struct {
Name string `json:"name"`
}
RenameGroupRequest is the body for PATCH /api/groups/:path.
type SSECostEvent ¶ added in v1.3.4
type SSECostEvent struct {
EventType string `json:"eventType"`
SessionID string `json:"sessionId"`
Cost float64 `json:"cost"`
}
SSECostEvent is emitted on cost:updated events.
type SSEDeleteEvent ¶ added in v1.3.4
SSEDeleteEvent is emitted on session:deleted events.
type SSEGroupDeleteEvent ¶ added in v1.3.4
SSEGroupDeleteEvent is emitted on group:deleted events.
type SSEGroupEvent ¶ added in v1.3.4
SSEGroupEvent is emitted on group:created and group:updated events.
type SSESessionEvent ¶ added in v1.3.4
type SSESessionEvent struct {
EventType string `json:"eventType"`
Session *MenuSession `json:"session"`
}
SSESessionEvent is emitted on session:created and session:updated events.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server wraps an HTTP server for Agent Deck web mode.
func (*Server) SetCostStore ¶ added in v0.26.4
func (*Server) SetMutator ¶ added in v1.3.4
func (s *Server) SetMutator(m SessionMutator)
SetMutator injects the session mutator implementation (typically *ui.WebMutator).
type SessionActionResponse ¶ added in v1.3.4
type SessionActionResponse struct {
SessionID string `json:"sessionId"`
Status session.Status `json:"status"`
}
SessionActionResponse is returned by session action endpoints.
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.
type SessionMutator ¶ added in v1.3.4
type SessionMutator interface {
CreateSession(title, tool, projectPath, groupPath string) (string, error)
StartSession(sessionID string) error
StopSession(sessionID string) error
RestartSession(sessionID string) error
DeleteSession(sessionID string) error
ForkSession(sessionID string) (string, error)
CreateGroup(name, parentPath string) (string, error)
RenameGroup(groupPath, newName string) error
DeleteGroup(groupPath string) error
}
SessionMutator is implemented by internal/ui.WebMutator and injected at startup. It bridges web HTTP handlers to the TUI session/group management methods.
Source Files
¶
- api_types.go
- assets.go
- auth.go
- handlers_costs.go
- handlers_events.go
- handlers_groups.go
- handlers_menu.go
- handlers_push.go
- handlers_sessions.go
- handlers_settings.go
- handlers_system.go
- handlers_ws.go
- memory_menu_data.go
- menu_snapshot_builder.go
- middleware.go
- push_service.go
- server.go
- session_data_service.go
- static_files.go
- terminal_bridge.go
- vapid_keys.go