Documentation
¶
Overview ¶
Package web implements the Cognition Engine dashboard served at the root of the Thane HTTP server. It provides a single-page interface with real-time SSE event streaming, REST endpoints for loop state snapshots, and log drill-down via the SQLite log index.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// LoopRegistry provides loop status snapshots. Required.
LoopRegistry LoopRegistry
// EventBus delivers real-time loop events via SSE. Required.
EventBus *events.Bus
// LogQuerier enables log drill-down. Nil disables the feature.
LogQuerier LogQuerier
// ContentQuerier enables request detail drill-down. Nil disables
// the /api/requests/{id} endpoint.
ContentQuerier ContentQuerier
// SystemStatus provides runtime health for the system canvas node.
// Nil disables the system node.
SystemStatus SystemStatusProvider
// Logger for web server operations. Defaults to slog.Default().
Logger *slog.Logger
}
Config holds dependencies for the web server.
type ContentQuerier ¶ added in v0.9.1
type ContentQuerier interface {
QueryRequestDetail(requestID string) (*logging.RequestDetail, error)
}
ContentQuerier fetches live or retained request content (system prompts, tool call details, message bodies). Nil disables the request detail API endpoint.
type LogQuerier ¶ added in v0.8.3
type LogQuerier interface {
Query(params logging.QueryParams) ([]logging.LogEntry, error)
}
LogQuerier queries the structured log index. Implementations wrap logging.Query to decouple the web package from database/sql.
type LoopRegistry ¶ added in v0.8.3
type LoopRegistry interface {
// Statuses returns a snapshot of all registered loops.
Statuses() []loop.Status
// Get returns a single loop by ID, or nil if not found.
Get(id string) *loop.Loop
}
LoopRegistry provides read access to the loop process registry.
type ServiceHealth ¶ added in v0.8.3
type ServiceHealth struct {
// Name is the human-readable service name.
Name string `json:"name"`
// Ready indicates whether the service is currently healthy.
Ready bool `json:"ready"`
// LastCheck is the RFC3339 timestamp of the last health probe.
LastCheck string `json:"last_check,omitempty"`
// LastError is the error from the most recent failed probe.
LastError string `json:"last_error,omitempty"`
}
ServiceHealth describes the health of a single watched service.
type SystemStatusProvider ¶ added in v0.8.3
type SystemStatusProvider interface {
// Health returns the current health state of all watched services.
Health() map[string]ServiceHealth
// Uptime returns how long the process has been running.
Uptime() time.Duration
// Version returns build and runtime metadata.
Version() map[string]string
// ModelRegistry returns the current model-registry snapshot.
ModelRegistry() *models.RegistrySnapshot
// RouterStats returns the current router statistics snapshot.
RouterStats() *router.Stats
// CapabilityCatalog returns the resolved runtime capability catalog.
CapabilityCatalog() *toolcatalog.CapabilityCatalogView
}
SystemStatusProvider exposes runtime health and metadata for the system node on the dashboard canvas. Nil disables the system node.
type WebServer ¶
type WebServer struct {
// contains filtered or unexported fields
}
WebServer serves the Cognition Engine dashboard and its API endpoints.
func NewWebServer ¶
NewWebServer creates a web server with the given configuration.
func (*WebServer) RegisterRoutes ¶
RegisterRoutes registers the visualizer routes on the given mux. This satisfies the [api.WebServerRegistrar] interface.