Documentation
¶
Index ¶
- type APIError
- type FactResponse
- type FactsIndexResponse
- type FactsStats
- type FileMetadataResponse
- type FilesIndexResponse
- type FilesQueryParams
- type FilesQueryResponse
- type HTTPServer
- type HealthMetricsProvider
- type HealthSnapshot
- type IndexProvider
- type RebuildHandler
- type RebuildResponse
- type SSEClient
- type SSEEvent
- type SSEHub
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIError ¶
type APIError struct {
Error string `json:"error"`
Code string `json:"code,omitempty"`
Details string `json:"details,omitempty"`
}
APIError represents an error response
type FactResponse ¶ added in v0.14.0
FactResponse is the response for GET /api/v1/facts/{id}
type FactsIndexResponse ¶ added in v0.14.0
type FactsIndexResponse struct {
Facts []types.Fact `json:"facts"`
Count int `json:"count"`
Stats FactsStats `json:"stats"`
}
FactsIndexResponse is the response for GET /api/v1/facts/index
type FactsStats ¶ added in v0.14.0
FactsStats provides summary statistics for facts
type FileMetadataResponse ¶
FileMetadataResponse is the response for GET /api/v1/files/{path} Uses the new graph-native FileEntry format which includes related files
type FilesIndexResponse ¶ added in v0.14.0
FilesIndexResponse is the response for GET /api/v1/files/index
type FilesQueryParams ¶ added in v0.14.0
type FilesQueryParams struct {
Q string `json:"q,omitempty"`
Category string `json:"category,omitempty"`
Days int `json:"days,omitempty"`
Entity string `json:"entity,omitempty"`
Tag string `json:"tag,omitempty"`
Topic string `json:"topic,omitempty"`
Limit int `json:"limit"`
}
FilesQueryParams echoes back the query parameters used
type FilesQueryResponse ¶ added in v0.14.0
type FilesQueryResponse struct {
Files []graph.SearchResult `json:"files"`
Count int `json:"count"`
Query FilesQueryParams `json:"query"`
}
FilesQueryResponse is the unified response for GET /api/v1/files This replaces POST /api/v1/search, GET /api/v1/files/recent, and GET /api/v1/entities/search
type HTTPServer ¶
type HTTPServer struct {
// contains filtered or unexported fields
}
HTTPServer manages the daemon's unified HTTP API
func NewHTTPServer ¶
func NewHTTPServer(hub *SSEHub, metrics HealthMetricsProvider, graphManager *graph.Manager, memoryRoot string, logger *slog.Logger) *HTTPServer
NewHTTPServer creates a new unified HTTP server
func (*HTTPServer) SetRebuildHandler ¶
func (s *HTTPServer) SetRebuildHandler(handler RebuildHandler)
SetRebuildHandler sets the rebuild handler for the API
func (*HTTPServer) Start ¶
func (s *HTTPServer) Start(port int) error
Start starts the HTTP server on the specified port If a server is already running, it will be stopped first (supports hot-reload)
func (*HTTPServer) Stop ¶
func (s *HTTPServer) Stop() error
Stop gracefully shuts down the HTTP server
type HealthMetricsProvider ¶
type HealthMetricsProvider interface {
GetSnapshot() HealthSnapshot
}
HealthMetricsProvider provides health metrics for the health endpoint
type HealthSnapshot ¶
type HealthSnapshot struct {
StartTime time.Time
Uptime string
UptimeSeconds float64
FilesProcessed int
APICalls int
CacheHits int
Errors int
LastBuildTime time.Time
LastBuildSuccess bool
IndexFileCount int
WatcherActive bool
// Semantic provider info
SemanticEnabled bool
SemanticProvider string
SemanticModel string
// Cache versioning stats
CacheVersion string
CacheTotalEntries int
CacheLegacyEntries int
CacheTotalSize int64
}
HealthSnapshot contains health metrics data
type IndexProvider ¶
IndexProvider is an interface for getting the current index
type RebuildHandler ¶
type RebuildHandler interface {
// Rebuild triggers an immediate index rebuild
Rebuild() error
// RebuildWithSync triggers a rebuild and optionally syncs graph with filesystem
// When sync is true, stale graph nodes (files no longer on disk) are removed
RebuildWithSync(sync bool) error
// ClearGraph clears all data from the graph
ClearGraph() error
// IsRebuilding returns true if a rebuild is in progress
IsRebuilding() bool
}
RebuildHandler provides rebuild functionality from the daemon
type RebuildResponse ¶
RebuildResponse is the response for POST /api/v1/rebuild
type SSEClient ¶
type SSEClient struct {
// contains filtered or unexported fields
}
SSEClient represents a connected SSE client
type SSEEvent ¶
type SSEEvent struct {
Type string `json:"type"`
Timestamp string `json:"timestamp"`
Data *types.FileIndex `json:"data,omitempty"`
}
SSEEvent represents an SSE event with typed data
type SSEHub ¶
type SSEHub struct {
// contains filtered or unexported fields
}
SSEHub manages Server-Sent Events broadcasting for index updates
func (*SSEHub) BroadcastIndexUpdate ¶
func (h *SSEHub) BroadcastIndexUpdate()
BroadcastIndexUpdate sends index update notification to all connected clients
func (*SSEHub) ClientCount ¶
ClientCount returns the number of connected SSE clients
func (*SSEHub) HandleSSE ¶
func (h *SSEHub) HandleSSE(w http.ResponseWriter, r *http.Request)
HandleSSE handles SSE stream requests from MCP servers
func (*SSEHub) SetIndexProvider ¶
func (h *SSEHub) SetIndexProvider(provider IndexProvider)
SetIndexProvider sets the index provider for including index data in events