server

package
v0.13.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 7, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handlers

type Handlers struct {
	AuthProvider     *auth.Provider
	Version          string
	SubscriptionType string
	RateLimitTier    string
	StuckThreshold   time.Duration
	Forecast         *forecast.Service
	// contains filtered or unexported fields
}

func NewHandlers

func NewHandlers(claudeDir string, st *store.Store) *Handlers

func (*Handlers) HandleAuthStatus added in v0.7.0

func (h *Handlers) HandleAuthStatus(w http.ResponseWriter, r *http.Request)

func (*Handlers) HandleForecast added in v0.10.0

func (h *Handlers) HandleForecast(w http.ResponseWriter, r *http.Request)

HandleForecast returns the latest cached forecast embedded in the usage payload. The poll loop owns the actual forecasting; this endpoint is a pull-style convenience for clients that don't want to drive SSE.

Response is always {"available": bool, "data": {...}}: data is nil when available is false.

func (*Handlers) HandleForecastSample added in v0.11.0

func (h *Handlers) HandleForecastSample(w http.ResponseWriter, r *http.Request)

HandleForecastSample re-runs the MC for one gauge with trajectories collected, and returns the materials needed by the visualization modal. On-demand: only fires when the user clicks the projected-percent trigger.

Query: ?gauge=session|weekly (required).

func (*Handlers) HandleHeatmap added in v0.9.1

func (h *Handlers) HandleHeatmap(w http.ResponseWriter, r *http.Request)

func (*Handlers) HandleHistory

func (h *Handlers) HandleHistory(w http.ResponseWriter, r *http.Request)

func (*Handlers) HandleInfo

func (h *Handlers) HandleInfo(w http.ResponseWriter, r *http.Request)

func (*Handlers) HandleKillProcess added in v0.6.0

func (h *Handlers) HandleKillProcess(w http.ResponseWriter, r *http.Request)

func (*Handlers) HandleKillSession added in v0.6.0

func (h *Handlers) HandleKillSession(w http.ResponseWriter, r *http.Request)

func (*Handlers) HandleMemories

func (h *Handlers) HandleMemories(w http.ResponseWriter, r *http.Request)

func (*Handlers) HandleMemoriesConsolidation added in v0.2.0

func (h *Handlers) HandleMemoriesConsolidation(w http.ResponseWriter, r *http.Request)

func (*Handlers) HandleMemoriesGraph

func (h *Handlers) HandleMemoriesGraph(w http.ResponseWriter, r *http.Request)

func (*Handlers) HandleMemoriesHealth added in v0.5.0

func (h *Handlers) HandleMemoriesHealth(w http.ResponseWriter, r *http.Request)

func (*Handlers) HandleMemoriesSearch

func (h *Handlers) HandleMemoriesSearch(w http.ResponseWriter, r *http.Request)

func (*Handlers) HandleMemoriesStaleness

func (h *Handlers) HandleMemoriesStaleness(w http.ResponseWriter, r *http.Request)

func (*Handlers) HandleProcesses added in v0.6.0

func (h *Handlers) HandleProcesses(w http.ResponseWriter, r *http.Request)

func (*Handlers) HandleSessionDetail

func (h *Handlers) HandleSessionDetail(w http.ResponseWriter, r *http.Request)

func (*Handlers) HandleSessions

func (h *Handlers) HandleSessions(w http.ResponseWriter, r *http.Request)

func (*Handlers) HandleToday

func (h *Handlers) HandleToday(w http.ResponseWriter, r *http.Request)

func (*Handlers) HandleUsage

func (h *Handlers) HandleUsage(w http.ResponseWriter, r *http.Request)

func (*Handlers) RefreshMemories

func (h *Handlers) RefreshMemories()

func (*Handlers) SetLatestUsage

func (h *Handlers) SetLatestUsage(data map[string]interface{})

func (*Handlers) SetPollError added in v0.8.4

func (h *Handlers) SetPollError(errMsg string)

type SSEBroker

type SSEBroker struct {
	// contains filtered or unexported fields
}

func NewBroker

func NewBroker() *SSEBroker

func (*SSEBroker) Run

func (b *SSEBroker) Run(ctx context.Context)

func (*SSEBroker) Send

func (b *SSEBroker) Send(event SSEEvent)

func (*SSEBroker) SendJSON added in v0.8.7

func (b *SSEBroker) SendJSON(event string, payload interface{})

SendJSON marshals payload and broadcasts it as an SSE event. Marshal failures are logged — callers broadcasting transient updates can't recover meaningfully.

func (*SSEBroker) ServeHTTP

func (b *SSEBroker) ServeHTTP(w http.ResponseWriter, r *http.Request)

type SSEEvent

type SSEEvent struct {
	Event string
	Data  string
}

type Server

type Server struct {
	Mux      *http.ServeMux
	Broker   *SSEBroker
	Handlers *Handlers
}

func New

func New(claudeDir string, st *store.Store, webFS fs.FS) *Server

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL