Documentation
¶
Index ¶
Constants ¶
View Source
const DefaultPort = 7421
DefaultPort is the preferred port. If busy, the server tries sequential ports.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConversationItem ¶
type ConversationItem struct {
Role string `json:"role"`
Text string `json:"text"`
Timestamp time.Time `json:"timestamp"`
}
ConversationItem represents a conversation message.
type SSEPayload ¶
type SSEPayload struct {
Sessions []SessionItem `json:"sessions"`
Stats StatsResponse `json:"stats"`
}
SSEPayload is the data pushed on each SSE "update" event.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is the lazyagent HTTP API server.
func New ¶
func New(host string, provider core.SessionProvider) (*Server, error)
New creates a new API server. If host is non-empty it binds to that address (e.g. ":7421" or "0.0.0.0:7421"). If host is empty it binds to 127.0.0.1 on DefaultPort with fallback.
type SessionFull ¶
type SessionFull struct {
SessionItem
Version string `json:"version"`
IsWorktree bool `json:"is_worktree"`
MainRepo string `json:"main_repo"`
InputTokens int `json:"input_tokens"`
OutputTokens int `json:"output_tokens"`
CacheCreationTokens int `json:"cache_creation_tokens"`
CacheReadTokens int `json:"cache_read_tokens"`
UserMessages int `json:"user_messages"`
AssistantMessages int `json:"assistant_messages"`
CurrentTool string `json:"current_tool"`
LastFileWrite string `json:"last_file_write"`
LastFileWriteAt time.Time `json:"last_file_write_at"`
RecentTools []ToolItem `json:"recent_tools"`
RecentMessages []ConversationItem `json:"recent_messages"`
DesktopTitle string `json:"desktop_title,omitempty"`
DesktopID string `json:"desktop_id,omitempty"`
PermissionMode string `json:"permission_mode,omitempty"`
}
SessionFull is the detailed session representation.
type SessionItem ¶
type SessionItem struct {
SessionID string `json:"session_id"`
Agent string `json:"agent"`
Source string `json:"source"` // "cli" or "desktop"
CWD string `json:"cwd"`
ShortName string `json:"short_name"`
AgentName string `json:"agent_name,omitempty"`
CustomName string `json:"custom_name,omitempty"`
Activity string `json:"activity"`
IsActive bool `json:"is_active"`
Model string `json:"model"`
GitBranch string `json:"git_branch"`
CostUSD float64 `json:"cost_usd"`
LastActivity time.Time `json:"last_activity"`
TotalMessages int `json:"total_messages"`
}
SessionItem is a lightweight session for list views.
type StatsResponse ¶
type StatsResponse struct {
TotalSessions int `json:"total_sessions"`
ActiveSessions int `json:"active_sessions"`
WindowMinutes int `json:"window_minutes"`
}
StatsResponse is returned by GET /api/stats and included in SSE frames.
Click to show internal directories.
Click to hide internal directories.