Documentation
¶
Index ¶
- type ConfigValidateRequest
- type ConfigValidateResponse
- type ErrorCode
- type ErrorDetail
- type ErrorResponse
- type Handler
- type HealthChecks
- type HealthDetailedResponse
- type HealthDetails
- type Logger
- type Middleware
- type Server
- type SessionConfig
- type SessionDeleteResponse
- type SessionDetailResponse
- type SessionInfo
- type SessionListResponse
- type SessionLogsResponse
- type SessionStats
- type StatsResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConfigValidateRequest ¶
type ConfigValidateRequest struct {
ConfigPath string `json:"config_path"`
}
ConfigValidateRequest is the request for POST /admin/v1/config/validate.
type ConfigValidateResponse ¶
ConfigValidateResponse is the response for POST /admin/v1/config/validate.
type ErrorDetail ¶
type ErrorDetail struct {
Code ErrorCode `json:"code"`
Message string `json:"message"`
Details map[string]interface{} `json:"details,omitempty"`
}
ErrorDetail contains error details.
type ErrorResponse ¶
type ErrorResponse struct {
Error ErrorDetail `json:"error"`
}
ErrorResponse is the standard error response format.
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler handles admin API requests.
type HealthChecks ¶
type HealthChecks struct {
Database bool `json:"database"`
Config bool `json:"config"`
CliAvailable bool `json:"cli_available"`
WebsocketConnections int `json:"websocket_connections"`
}
HealthChecks contains health check results.
type HealthDetailedResponse ¶
type HealthDetailedResponse struct {
Status string `json:"status"`
Checks HealthChecks `json:"checks"`
Details HealthDetails `json:"details"`
}
HealthDetailedResponse is the response for GET /admin/v1/health/detailed.
type HealthDetails ¶
type HealthDetails struct {
DatabaseLatencyMs int `json:"database_latency_ms"`
CliVersion string `json:"cli_version"`
ConfigFile string `json:"config_file"`
}
HealthDetails contains detailed health information.
type Logger ¶
type Logger interface {
Debug(msg string, args ...any)
Info(msg string, args ...any)
Warn(msg string, args ...any)
Error(msg string, args ...any)
}
Logger interface for logging.
type Middleware ¶
type Middleware struct {
// contains filtered or unexported fields
}
Middleware provides HTTP middleware functions for the admin API.
func NewMiddleware ¶
func NewMiddleware(adminToken string) *Middleware
NewMiddleware creates a new admin middleware.
func (*Middleware) AuthMiddleware ¶
func (m *Middleware) AuthMiddleware(next http.Handler) http.Handler
AuthMiddleware returns an HTTP handler that validates the admin token. If adminToken is empty, authentication is disabled (dev mode).
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is the admin HTTP server.
func NewServer ¶
func NewServer(eng *engine.Engine, port, token string, startTime time.Time, logger *slog.Logger) *Server
NewServer creates a new admin server.
type SessionConfig ¶
SessionConfig contains session configuration details.
type SessionDeleteResponse ¶
SessionDeleteResponse is the response for DELETE /admin/v1/sessions/:id.
type SessionDetailResponse ¶
type SessionDetailResponse struct {
ID string `json:"id"`
Status string `json:"status"`
CreatedAt time.Time `json:"created_at"`
LastActive time.Time `json:"last_active"`
Provider string `json:"provider"`
Config SessionConfig `json:"config,omitempty"`
Stats SessionStats `json:"stats,omitempty"`
}
SessionDetailResponse is the response for GET /admin/v1/sessions/:id.
type SessionInfo ¶
type SessionInfo struct {
ID string `json:"id"`
Status string `json:"status"`
CreatedAt time.Time `json:"created_at"`
LastActive time.Time `json:"last_active"`
Provider string `json:"provider"`
CliVersion string `json:"cli_version,omitempty"`
WorkDir string `json:"work_dir,omitempty"`
InputTokens int64 `json:"input_tokens,omitempty"`
OutputTokens int64 `json:"output_tokens,omitempty"`
DurationSecs int64 `json:"duration_seconds,omitempty"`
}
SessionInfo represents a session in admin API responses.
type SessionListResponse ¶
type SessionListResponse struct {
Sessions []*SessionInfo `json:"sessions"`
Total int `json:"total"`
}
SessionListResponse is the response for GET /admin/v1/sessions.
type SessionLogsResponse ¶
type SessionLogsResponse struct {
SessionID string `json:"session_id"`
LogPath string `json:"log_path"`
SizeBytes int64 `json:"size_bytes"`
LastModified time.Time `json:"last_modified"`
}
SessionLogsResponse is the response for GET /admin/v1/sessions/:id/logs.
type SessionStats ¶
type SessionStats struct {
InputTokens int64 `json:"input_tokens"`
OutputTokens int64 `json:"output_tokens"`
DurationSecs int64 `json:"duration_seconds"`
}
SessionStats contains session statistics.
type StatsResponse ¶
type StatsResponse struct {
TotalSessions int `json:"total_sessions"`
ActiveSessions int `json:"active_sessions"`
StoppedSessions int `json:"stopped_sessions"`
Uptime string `json:"uptime"`
MemoryUsageMB float64 `json:"memory_usage_mb"`
CpuUsagePercent float64 `json:"cpu_usage_percent"`
}
StatsResponse is the response for GET /admin/v1/stats.