Documentation
¶
Overview ¶
Package api provides HTTP API handlers for TARSy.
Index ¶
- type AlertResponse
- type AlertTypeInfo
- type AlertTypesResponse
- type CancelResponse
- type DefaultToolsResponse
- type FilterOptionsResponse
- type HealthCheck
- type HealthResponse
- type MCPServerStatus
- type MCPServersResponse
- type MCPToolInfo
- type ScoreSessionResponse
- type SendChatMessageRequest
- type SendChatMessageResponse
- type Server
- func (s *Server) SetCancelNotifier(cn events.SessionCancelNotifier)
- func (s *Server) SetChatExecutor(executor *queue.ChatMessageExecutor)
- func (s *Server) SetChatService(svc *services.ChatService)
- func (s *Server) SetDashboardDir(dir string)
- func (s *Server) SetEventPublisher(pub agent.EventPublisher)
- func (s *Server) SetHealthMonitor(monitor *mcp.HealthMonitor)
- func (s *Server) SetInteractionService(svc *services.InteractionService)
- func (s *Server) SetMemoryService(svc *memory.Service)
- func (s *Server) SetRunbookService(rs *runbook.Service)
- func (s *Server) SetScoringExecutor(executor *queue.ScoringExecutor)
- func (s *Server) SetScoringService(svc *services.ScoringService)
- func (s *Server) SetStageService(svc *services.StageService)
- func (s *Server) SetTimelineService(svc *services.TimelineService)
- func (s *Server) SetWarningsService(svc *services.SystemWarningsService)
- func (s *Server) Shutdown(ctx context.Context) error
- func (s *Server) Start(addr string) error
- func (s *Server) StartWithListener(ln net.Listener) error
- func (s *Server) ValidateWiring() error
- type SubmitAlertRequest
- type SystemWarningItem
- type SystemWarningsResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AlertResponse ¶
type AlertResponse struct {
SessionID string `json:"session_id"`
Status string `json:"status"`
Message string `json:"message"`
}
AlertResponse is returned by POST /api/v1/alerts.
type AlertTypeInfo ¶
type AlertTypeInfo struct {
Type string `json:"type"`
ChainID string `json:"chain_id"`
Description string `json:"description"`
}
AlertTypeInfo describes a single alert type and its associated chain.
type AlertTypesResponse ¶
type AlertTypesResponse struct {
AlertTypes []AlertTypeInfo `json:"alert_types"`
DefaultChainID string `json:"default_chain_id"`
DefaultAlertType string `json:"default_alert_type"`
}
AlertTypesResponse is returned by GET /api/v1/alert-types.
type CancelResponse ¶
CancelResponse is returned by POST /api/v1/sessions/:id/cancel.
type DefaultToolsResponse ¶
type DefaultToolsResponse struct {
AlertType string `json:"alert_type,omitempty"`
MCPServers []string `json:"mcp_servers"`
NativeTools map[string]bool `json:"native_tools"`
}
DefaultToolsResponse is returned by GET /api/v1/system/default-tools.
type FilterOptionsResponse ¶
type FilterOptionsResponse struct {
AlertTypes []string `json:"alert_types"`
ChainIDs []string `json:"chain_ids"`
Statuses []string `json:"statuses"`
}
FilterOptionsResponse is returned by GET /api/v1/sessions/filter-options.
type HealthCheck ¶
HealthCheck represents the status of a single health check component.
type HealthResponse ¶
type HealthResponse struct {
Status string `json:"status"`
Version string `json:"version"`
Checks map[string]HealthCheck `json:"checks"`
}
HealthResponse is returned by GET /health.
type MCPServerStatus ¶
type MCPServerStatus struct {
ID string `json:"id"`
Healthy bool `json:"healthy"`
LastCheck string `json:"last_check"`
ToolCount int `json:"tool_count"`
Tools []MCPToolInfo `json:"tools"`
Error *string `json:"error"`
}
MCPServerStatus describes the health and tools of a single MCP server.
type MCPServersResponse ¶
type MCPServersResponse struct {
Servers []MCPServerStatus `json:"servers"`
}
MCPServersResponse is returned by GET /api/v1/system/mcp-servers.
type MCPToolInfo ¶
MCPToolInfo describes a single tool from an MCP server.
type ScoreSessionResponse ¶
type ScoreSessionResponse struct {
ScoreID string `json:"score_id"`
}
ScoreSessionResponse is the HTTP response for POST /sessions/:id/score.
type SendChatMessageRequest ¶
type SendChatMessageRequest struct {
Content string `json:"content"`
}
SendChatMessageRequest is the HTTP request body for POST /sessions/:id/chat/messages.
type SendChatMessageResponse ¶
type SendChatMessageResponse struct {
ChatID string `json:"chat_id"`
MessageID string `json:"message_id"`
StageID string `json:"stage_id"`
}
SendChatMessageResponse is the HTTP response for POST /sessions/:id/chat/messages.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is the HTTP API server.
func NewServer ¶
func NewServer( cfg *config.Config, dbClient *database.Client, alertService *services.AlertService, sessionService *services.SessionService, workerPool *queue.WorkerPool, connManager *events.ConnectionManager, ) *Server
NewServer creates a new API server with Echo v5.
func (*Server) SetCancelNotifier ¶
func (s *Server) SetCancelNotifier(cn events.SessionCancelNotifier)
SetCancelNotifier sets the cross-pod cancel notifier for session cancellation.
func (*Server) SetChatExecutor ¶
func (s *Server) SetChatExecutor(executor *queue.ChatMessageExecutor)
SetChatExecutor sets the chat message executor for follow-up chat processing.
func (*Server) SetChatService ¶
func (s *Server) SetChatService(svc *services.ChatService)
SetChatService sets the chat service for follow-up chat endpoints.
func (*Server) SetDashboardDir ¶
SetDashboardDir sets the path to the dashboard build directory and registers static file serving routes. When set and the directory contains an index.html, assets are served from /assets/* and a SPA fallback is registered for all non-API routes.
Must be called after NewServer (which registers API routes first) so that API routes take priority over the wildcard SPA fallback.
func (*Server) SetEventPublisher ¶
func (s *Server) SetEventPublisher(pub agent.EventPublisher)
SetEventPublisher sets the event publisher for real-time event delivery.
func (*Server) SetHealthMonitor ¶
func (s *Server) SetHealthMonitor(monitor *mcp.HealthMonitor)
SetHealthMonitor sets the MCP health monitor for the health endpoint.
func (*Server) SetInteractionService ¶
func (s *Server) SetInteractionService(svc *services.InteractionService)
SetInteractionService sets the interaction service for trace endpoints.
func (*Server) SetMemoryService ¶
SetMemoryService sets the memory service for memory CRUD endpoints and review-triggered refinement.
func (*Server) SetRunbookService ¶
SetRunbookService sets the runbook service for the runbook listing endpoint.
func (*Server) SetScoringExecutor ¶
func (s *Server) SetScoringExecutor(executor *queue.ScoringExecutor)
SetScoringExecutor sets the scoring executor for the re-score endpoint.
func (*Server) SetScoringService ¶
func (s *Server) SetScoringService(svc *services.ScoringService)
SetScoringService sets the scoring service for score read endpoints.
func (*Server) SetStageService ¶
func (s *Server) SetStageService(svc *services.StageService)
SetStageService sets the stage service for trace endpoints.
func (*Server) SetTimelineService ¶
func (s *Server) SetTimelineService(svc *services.TimelineService)
SetTimelineService sets the timeline service for the timeline endpoint.
func (*Server) SetWarningsService ¶
func (s *Server) SetWarningsService(svc *services.SystemWarningsService)
SetWarningsService sets the system warnings service for the health endpoint.
func (*Server) StartWithListener ¶
StartWithListener starts the HTTP server on a pre-created listener. Used by test infrastructure to serve on a random OS-assigned port.
func (*Server) ValidateWiring ¶
ValidateWiring checks that all required services have been wired via their Set* methods. Call this after all Set* calls and before Start/StartWithListener. Returns an error listing every missing service so that wiring gaps are caught at startup rather than surfacing as 503s at request time.
Services that are legitimately optional (e.g. healthMonitor / warningService when MCP is disabled) are NOT checked here.
type SubmitAlertRequest ¶
type SubmitAlertRequest struct {
AlertType string `json:"alert_type"`
Runbook string `json:"runbook,omitempty"`
Data string `json:"data"`
MCP *models.MCPSelectionConfig `json:"mcp,omitempty"`
SlackMessageFingerprint string `json:"slack_message_fingerprint,omitempty"`
}
SubmitAlertRequest is the HTTP request body for POST /api/v1/alerts.
type SystemWarningItem ¶
type SystemWarningItem struct {
ID string `json:"id"`
Category string `json:"category"`
Message string `json:"message"`
Details string `json:"details"`
ServerID string `json:"server_id,omitempty"`
CreatedAt string `json:"created_at"`
}
SystemWarningItem is a single system warning.
type SystemWarningsResponse ¶
type SystemWarningsResponse struct {
Warnings []SystemWarningItem `json:"warnings"`
}
SystemWarningsResponse is returned by GET /api/v1/system/warnings.
Source Files
¶
- auth.go
- errors.go
- handler_alert.go
- handler_alert_types.go
- handler_chat.go
- handler_filter.go
- handler_health.go
- handler_memory.go
- handler_review.go
- handler_runbook.go
- handler_scoring.go
- handler_session.go
- handler_system.go
- handler_timeline.go
- handler_trace.go
- handler_ws.go
- middleware.go
- requests.go
- responses.go
- server.go