Documentation
¶
Overview ¶
Package dashboard provides a real-time web UI for monitoring crew execution via SSE.
Package dashboard provides HTTP handlers for the real-time crew monitoring dashboard.
Package dashboard provides HTTP handlers for the real-time crew monitoring dashboard.
Package dashboard provides HTTP handlers for the real-time crew monitoring dashboard.
Index ¶
- func SubscribeEventBus(d *Dashboard, bus *events.EventBus)
- type A2AConnRegistry
- type A2ARegistryLister
- type CrewController
- type CrewInjecter
- type CrewPauser
- type Dashboard
- func (d *Dashboard) GetStore() SessionStore
- func (d *Dashboard) HandleAPIA2AGraph(w http.ResponseWriter, _ *http.Request)
- func (d *Dashboard) HandleAPIAgentStates(w http.ResponseWriter, _ *http.Request)
- func (d *Dashboard) HandleAPICrewInject(w http.ResponseWriter, r *http.Request)
- func (d *Dashboard) HandleAPICrewPause(w http.ResponseWriter, _ *http.Request)
- func (d *Dashboard) HandleAPICrewResume(w http.ResponseWriter, _ *http.Request)
- func (d *Dashboard) HandleAPICrewTimeline(w http.ResponseWriter, r *http.Request)
- func (d *Dashboard) HandleAPICrewUsage(w http.ResponseWriter, _ *http.Request)
- func (d *Dashboard) HandleAPIErrors(w http.ResponseWriter, _ *http.Request)
- func (d *Dashboard) HandleAPIEvents(w http.ResponseWriter, r *http.Request)
- func (d *Dashboard) HandleAPIMCPTools(w http.ResponseWriter, _ *http.Request)
- func (d *Dashboard) HandleAPISessionReplay(w http.ResponseWriter, r *http.Request)
- func (d *Dashboard) HandleAPISessions(w http.ResponseWriter, r *http.Request)
- func (d *Dashboard) HandleBundle(w http.ResponseWriter, r *http.Request)
- func (d *Dashboard) HandleHTML(w http.ResponseWriter, _ *http.Request)
- func (d *Dashboard) HandleSSE(w http.ResponseWriter, r *http.Request)
- type DashboardOption
- func WithA2ARegistries(reg A2ARegistryLister, conns A2AConnRegistry) DashboardOption
- func WithAuthToken(token string) DashboardOption
- func WithCrew(c CrewController) DashboardOption
- func WithMCPServer(srv MCPServerLister) DashboardOption
- func WithMetricsCollector(mc *telemetry.MetricsCollector) DashboardOption
- func WithTokenTracker(tt *TokenTracker) DashboardOption
- type MCPServerLister
- type SQLiteSessionStore
- func (s *SQLiteSessionStore) AppendEvents(ctx context.Context, id string, newEvents []telemetry.Event) error
- func (s *SQLiteSessionStore) Close() error
- func (s *SQLiteSessionStore) Create(ctx context.Context, id, crewConfig string) error
- func (s *SQLiteSessionStore) Get(ctx context.Context, id string) (*Session, error)
- func (s *SQLiteSessionStore) List(ctx context.Context) ([]Session, error)
- func (s *SQLiteSessionStore) SetStatus(ctx context.Context, id, status string) error
- type Session
- type SessionStore
- type TokenTracker
- type TokenUsage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SubscribeEventBus ¶ added in v0.7.0
SubscribeEventBus subscribes the dashboard to an events.EventBus and forwards all events to connected SSE clients as JSON-encoded messages. @sk-task event-bus#T3.5: Dashboard SSE bridge for events.EventBus (AC-012)
Types ¶
type A2AConnRegistry ¶ added in v0.6.0
type A2AConnRegistry interface {
ActiveConnections() []a2a.A2AConnection
}
A2AConnRegistry provides read-only access to A2A connections.
type A2ARegistryLister ¶ added in v0.6.0
A2ARegistryLister provides read-only access to the A2A agent registry.
type CrewController ¶ added in v0.6.0
type CrewController interface {
CrewPauser
CrewInjecter
}
CrewController combines pause/resume and task injection.
type CrewInjecter ¶ added in v0.6.0
CrewInjecter provides task injection for the dashboard.
type CrewPauser ¶ added in v0.6.0
type CrewPauser interface {
Pause()
ResumeExecution()
}
CrewPauser interface for HITL pause/resume without importing crew package.
type Dashboard ¶
type Dashboard struct {
// contains filtered or unexported fields
}
Dashboard provides a real-time web UI for monitoring crew execution via SSE.
func NewDashboard ¶ added in v0.6.0
func NewDashboard(bus *telemetry.EventBus, store SessionStore, opts ...DashboardOption) *Dashboard
NewDashboard creates a Dashboard backed by a SessionStore with optional data sources.
func (*Dashboard) GetStore ¶ added in v0.6.0
func (d *Dashboard) GetStore() SessionStore
GetStore returns the session store for use by the CLI/main handler.
func (*Dashboard) HandleAPIA2AGraph ¶ added in v0.6.0
func (d *Dashboard) HandleAPIA2AGraph(w http.ResponseWriter, _ *http.Request)
HandleAPIA2AGraph returns the current A2A connection graph.
func (*Dashboard) HandleAPIAgentStates ¶ added in v0.6.0
func (d *Dashboard) HandleAPIAgentStates(w http.ResponseWriter, _ *http.Request)
HandleAPIAgentStates returns current agent states from the event log.
func (*Dashboard) HandleAPICrewInject ¶ added in v0.6.0
func (d *Dashboard) HandleAPICrewInject(w http.ResponseWriter, r *http.Request)
HandleAPICrewInject injects a new task into a running crew.
func (*Dashboard) HandleAPICrewPause ¶ added in v0.6.0
func (d *Dashboard) HandleAPICrewPause(w http.ResponseWriter, _ *http.Request)
HandleAPICrewPause pauses a running crew.
func (*Dashboard) HandleAPICrewResume ¶ added in v0.6.0
func (d *Dashboard) HandleAPICrewResume(w http.ResponseWriter, _ *http.Request)
HandleAPICrewResume resumes a paused crew.
func (*Dashboard) HandleAPICrewTimeline ¶ added in v0.6.0
func (d *Dashboard) HandleAPICrewTimeline(w http.ResponseWriter, r *http.Request)
HandleAPICrewTimeline returns task execution timing from the event log.
func (*Dashboard) HandleAPICrewUsage ¶ added in v0.6.0
func (d *Dashboard) HandleAPICrewUsage(w http.ResponseWriter, _ *http.Request)
HandleAPICrewUsage returns token usage and cost for a crew, its agents, and tasks.
func (*Dashboard) HandleAPIErrors ¶ added in v0.6.0
func (d *Dashboard) HandleAPIErrors(w http.ResponseWriter, _ *http.Request)
HandleAPIErrors returns errors aggregated by failure mode.
func (*Dashboard) HandleAPIEvents ¶ added in v0.6.0
func (d *Dashboard) HandleAPIEvents(w http.ResponseWriter, r *http.Request)
HandleAPIEvents streams all telemetry events as Server-Sent Events at /api/events.
func (*Dashboard) HandleAPIMCPTools ¶ added in v0.6.0
func (d *Dashboard) HandleAPIMCPTools(w http.ResponseWriter, _ *http.Request)
HandleAPIMCPTools returns all discovered MCP tools.
func (*Dashboard) HandleAPISessionReplay ¶ added in v0.6.0
func (d *Dashboard) HandleAPISessionReplay(w http.ResponseWriter, r *http.Request)
HandleAPISessionReplay replays stored events from a session as SSE.
func (*Dashboard) HandleAPISessions ¶ added in v0.6.0
func (d *Dashboard) HandleAPISessions(w http.ResponseWriter, r *http.Request)
HandleAPISessions returns all stored sessions as JSON.
func (*Dashboard) HandleBundle ¶ added in v0.6.0
func (d *Dashboard) HandleBundle(w http.ResponseWriter, r *http.Request)
HandleBundle serves the React SPA bundle when available.
func (*Dashboard) HandleHTML ¶
func (d *Dashboard) HandleHTML(w http.ResponseWriter, _ *http.Request)
HandleHTML serves the embedded dashboard HTML page (fallback) or the SPA index.
type DashboardOption ¶ added in v0.6.0
type DashboardOption func(*Dashboard)
DashboardOption is a functional option for configuring a Dashboard.
func WithA2ARegistries ¶ added in v0.6.0
func WithA2ARegistries(reg A2ARegistryLister, conns A2AConnRegistry) DashboardOption
WithA2ARegistries sets the A2A registries for the network graph.
func WithAuthToken ¶ added in v0.7.0
func WithAuthToken(token string) DashboardOption
WithAuthToken sets the required auth token for SSE connections. When set, HandleSSE returns 401 for requests without a matching token.
func WithCrew ¶ added in v0.6.0
func WithCrew(c CrewController) DashboardOption
WithCrew sets the crew reference for pause/resume and task injection.
func WithMCPServer ¶ added in v0.6.0
func WithMCPServer(srv MCPServerLister) DashboardOption
WithMCPServer sets the MCP server for tool listing.
func WithMetricsCollector ¶ added in v0.6.0
func WithMetricsCollector(mc *telemetry.MetricsCollector) DashboardOption
WithMetricsCollector sets the MetricsCollector for error aggregation.
func WithTokenTracker ¶ added in v0.6.0
func WithTokenTracker(tt *TokenTracker) DashboardOption
WithTokenTracker sets the TokenTracker for usage data.
type MCPServerLister ¶ added in v0.6.0
type MCPServerLister interface {
ListTools() []mcp.ToolDescriptor
}
MCPServerLister provides read-only access to MCP tools for the dashboard.
type SQLiteSessionStore ¶ added in v0.6.0
type SQLiteSessionStore struct {
// contains filtered or unexported fields
}
SQLiteSessionStore implements SessionStore backed by SQLite.
func NewSQLiteSessionStore ¶ added in v0.6.0
func NewSQLiteSessionStore(dbPath string) (*SQLiteSessionStore, error)
NewSQLiteSessionStore opens or creates the SQLite database at the given path.
func (*SQLiteSessionStore) AppendEvents ¶ added in v0.6.0
func (s *SQLiteSessionStore) AppendEvents(ctx context.Context, id string, newEvents []telemetry.Event) error
AppendEvents appends events to an existing session. Loads existing events, merges, and saves.
func (*SQLiteSessionStore) Close ¶ added in v0.6.0
func (s *SQLiteSessionStore) Close() error
Close closes the database connection.
func (*SQLiteSessionStore) Create ¶ added in v0.6.0
func (s *SQLiteSessionStore) Create(ctx context.Context, id, crewConfig string) error
Create inserts a new session record.
type Session ¶ added in v0.6.0
type Session struct {
ID string `json:"id"`
CrewConfig string `json:"crew_config,omitempty"`
Events string `json:"events,omitempty"`
StartedAt time.Time `json:"started_at"`
EndedAt time.Time `json:"ended_at,omitempty"`
Status string `json:"status"`
}
Session represents a persisted crew run.
type SessionStore ¶ added in v0.6.0
type SessionStore interface {
Create(ctx context.Context, id, crewConfig string) error
AppendEvents(ctx context.Context, id string, events []telemetry.Event) error
List(ctx context.Context) ([]Session, error)
Get(ctx context.Context, id string) (*Session, error)
SetStatus(ctx context.Context, id, status string) error
Close() error
}
SessionStore persists and retrieves crew sessions.
type TokenTracker ¶ added in v0.6.0
type TokenTracker struct {
// contains filtered or unexported fields
}
TokenTracker aggregates EventTokenUsage events per agent/task/crew.
func NewTokenTracker ¶ added in v0.6.0
func NewTokenTracker() *TokenTracker
NewTokenTracker creates a TokenTracker with default model rates.
func (*TokenTracker) HandleEvent ¶ added in v0.6.0
func (tt *TokenTracker) HandleEvent(event telemetry.Event)
HandleEvent implements telemetry.EventHandler for token usage events.
func (*TokenTracker) Snapshot ¶ added in v0.6.0
func (tt *TokenTracker) Snapshot() (crew TokenUsage, agents []TokenUsage, tasks []TokenUsage)
Snapshot returns a point-in-time copy of all tracked usage.
type TokenUsage ¶ added in v0.6.0
type TokenUsage struct {
AgentRole string `json:"agent_role,omitempty"`
TaskID string `json:"task_id,omitempty"`
TokensPrompt int64 `json:"tokens_prompt"`
TokensCompletion int64 `json:"tokens_completion"`
TokensTotal int64 `json:"tokens_total"`
CostEstimate float64 `json:"cost_estimate"`
Model string `json:"model,omitempty"`
}
TokenUsage holds token and cost data for one agent/task/crew level.