Documentation
¶
Overview ¶
Package web provides the web dashboard and chat interface for Thane.
Index ¶
- func RegisterRoutes(mux *http.ServeMux)
- type AnticipationStore
- type AnticipationsData
- type ChatData
- type Config
- type ContactDetailData
- type ContactStore
- type ContactsData
- type DashboardData
- type FactStore
- type FactsData
- type HealthFunc
- type HealthStatus
- type LiveMessageSource
- type LogStore
- type PageData
- type RouterFunc
- type RouterInfo
- type SessionDetailData
- type SessionLogsData
- type SessionStore
- type SessionsData
- type StatsFunc
- type StatsSnapshot
- type TaskDetailData
- type TaskStore
- type TasksData
- type WebServer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterRoutes ¶
RegisterRoutes adds the chat UI routes to a mux. This is the legacy package-level function kept for backward compatibility when no WebServer is wired in.
Types ¶
type AnticipationStore ¶
type AnticipationStore interface {
Active() ([]*scheduler.Anticipation, error)
All() ([]*scheduler.Anticipation, error)
Get(id string) (*scheduler.Anticipation, error)
}
AnticipationStore is the subset of scheduler.AnticipationStore used by the dashboard.
type AnticipationsData ¶
type AnticipationsData struct {
PageData
Anticipations []*anticipationRow
Filter string // "active" or "all"
}
AnticipationsData is the template context for the anticipations list page.
type ChatData ¶
type ChatData struct {
PageData
}
ChatData is the template context for the chat page.
type Config ¶
type Config struct {
BrandName string // Display name in the nav bar. Defaults to "Thane".
StatsFunc StatsFunc
RouterFunc RouterFunc
HealthFunc HealthFunc
ContactStore ContactStore
FactStore FactStore
TaskStore TaskStore
AnticipationStore AnticipationStore
SessionStore SessionStore
LogStore LogStore // Optional: structured log index queries.
LiveMessageSource LiveMessageSource // Optional: live messages for active sessions.
Logger *slog.Logger
}
Config holds the dependencies needed to construct a WebServer.
type ContactDetailData ¶
type ContactDetailData struct {
PageData
ID uuid.UUID
Name string
Kind string
TrustZone string
Org string
Title string
AISummary string
Note string
CreatedAt string
UpdatedAt string
Properties []contacts.Property
}
ContactDetailData is the template context for a single contact.
type ContactStore ¶
type ContactStore interface {
ListAll() ([]*contacts.Contact, error)
Search(query string) ([]*contacts.Contact, error)
GetWithProperties(id uuid.UUID) (*contacts.Contact, error)
FindByTrustZone(zone string) ([]*contacts.Contact, error)
ListByKind(kind string) ([]*contacts.Contact, error)
}
ContactStore is the subset of contacts.Store used by the dashboard.
type ContactsData ¶
type ContactsData struct {
PageData
Contacts []*contactRow
Query string
TrustZone string
Kind string
}
ContactsData is the template context for the contacts list page.
type DashboardData ¶
type DashboardData struct {
PageData
Stats StatsSnapshot
Router RouterInfo
Health map[string]HealthStatus
Uptime time.Duration
}
DashboardData is the template context for the runtime overview page.
type FactStore ¶
type FactStore interface {
GetAll() ([]*knowledge.Fact, error)
GetByCategory(category knowledge.Category) ([]*knowledge.Fact, error)
Search(query string) ([]*knowledge.Fact, error)
}
FactStore is the subset of knowledge.Store used by the dashboard.
type HealthFunc ¶
type HealthFunc func() map[string]HealthStatus
HealthFunc returns dependency health keyed by service name.
type HealthStatus ¶
type HealthStatus struct {
Connected bool `json:"connected"`
Since time.Time `json:"since,omitempty"`
LastError string `json:"last_error,omitempty"`
}
HealthStatus describes the health of a single dependency.
type LiveMessageSource ¶
LiveMessageSource provides access to live (unarchived) conversation messages. Used as a fallback for active sessions whose messages haven't been archived yet.
type LogStore ¶ added in v0.8.1
type LogStore interface {
QueryBySession(sessionID, level, subsystem string, limit int) ([]logging.LogEntry, error)
}
LogStore queries the structured log index for session-scoped entries.
type PageData ¶
type PageData struct {
BrandName string
}
PageData contains fields shared by all page templates. Every template data struct should embed this so the layout can render the nav bar.
type RouterFunc ¶
type RouterFunc func() RouterInfo
RouterFunc returns combined router statistics and model list.
type RouterInfo ¶
RouterInfo combines routing stats and the model roster.
type SessionDetailData ¶
type SessionDetailData struct {
PageData
Session *sessionDetailView
Messages []*messageRow
ToolCalls []*toolCallRow
ToolSummary []*toolSummaryRow
Iterations []*iterationRow
UnattributedToolCalls []*toolCallRow
LogsEnabled bool
}
SessionDetailData is the template context for the session detail page.
type SessionLogsData ¶ added in v0.8.1
type SessionLogsData struct {
PageData
SessionID string
Entries []*logEntryRow
Level string // current filter value
Subsystem string // current filter value
}
SessionLogsData is the template data for the session_logs.html partial.
type SessionStore ¶
type SessionStore interface {
ListSessions(conversationID string, limit int) ([]*memory.Session, error)
ListChildSessions(parentSessionID string) ([]*memory.Session, error)
GetSession(sessionID string) (*memory.Session, error)
GetSessionTranscript(sessionID string) ([]memory.Message, error)
GetSessionToolCalls(sessionID string) ([]memory.ArchivedToolCall, error)
GetSessionIterations(sessionID string) ([]memory.ArchivedIteration, error)
}
SessionStore is the subset of memory.ArchiveStore used by the web dashboard's session inspector.
type SessionsData ¶
SessionsData is the template context for the sessions list page.
type StatsFunc ¶
type StatsFunc func() StatsSnapshot
StatsFunc returns a snapshot of session statistics.
type StatsSnapshot ¶
StatsSnapshot holds runtime info for the dashboard. Currently only build metadata is needed; per-conversation stats were removed because they are misleading in Thane's multi-conversation architecture.
type TaskDetailData ¶
type TaskDetailData struct {
PageData
Task *scheduler.Task
NextFire string
Executions []*scheduler.Execution
}
TaskDetailData is the template context for a single task.
type TaskStore ¶
type TaskStore interface {
ListTasks(enabledOnly bool) ([]*scheduler.Task, error)
GetTask(id string) (*scheduler.Task, error)
GetTaskExecutions(taskID string, limit int) ([]*scheduler.Execution, error)
}
TaskStore is the subset of scheduler.Scheduler used by the dashboard.
type TasksData ¶
type TasksData struct {
PageData
Tasks []*taskRow
}
TasksData is the template context for the tasks list page.
type WebServer ¶
type WebServer struct {
// contains filtered or unexported fields
}
WebServer serves the web dashboard and chat UI.
func NewWebServer ¶
NewWebServer creates a WebServer with parsed templates. It panics if templates contain syntax errors, providing fail-fast behavior at startup.
func (*WebServer) RegisterRoutes ¶
RegisterRoutes adds dashboard, chat UI, and static file routes to the mux.