Documentation
¶
Overview ¶
Package store handles persistent storage using SQLite
Index ¶
- type AlertRecord
- type MetricRecord
- type SessionRecord
- type Store
- func (s *Store) AppendOutput(sessionID string, chunk string) error
- func (s *Store) Cleanup(maxAgeDays int) error
- func (s *Store) Close() error
- func (s *Store) ExportJSON() ([]byte, error)
- func (s *Store) GetMetrics(agentID string, metric string, since time.Time) ([]*MetricRecord, error)
- func (s *Store) GetOutput(sessionID string) (string, error)
- func (s *Store) GetSession(id string) (*SessionRecord, error)
- func (s *Store) GetStats() (map[string]interface{}, error)
- func (s *Store) ListAlerts(limit int, unreadOnly bool) ([]*AlertRecord, error)
- func (s *Store) ListSessions(limit int, status string) ([]*SessionRecord, error)
- func (s *Store) MarkAlertRead(id string) error
- func (s *Store) MarkAllAlertsRead() error
- func (s *Store) SaveAlert(rec *AlertRecord) error
- func (s *Store) SaveMetric(rec *MetricRecord) error
- func (s *Store) SaveSession(rec *SessionRecord) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AlertRecord ¶
type AlertRecord struct {
ID string `json:"id"`
AgentID string `json:"agent_id"`
Level string `json:"level"`
Message string `json:"message"`
Timestamp time.Time `json:"timestamp"`
Read bool `json:"read"`
Metadata string `json:"metadata"`
}
AlertRecord represents a stored alert
type MetricRecord ¶
type MetricRecord struct {
ID string `json:"id"`
AgentID string `json:"agent_id"`
Metric string `json:"metric"`
Value float64 `json:"value"`
Timestamp time.Time `json:"timestamp"`
}
MetricRecord represents a stored metric point
type SessionRecord ¶
type SessionRecord struct {
ID string `json:"id"`
AgentID string `json:"agent_id"`
AgentType string `json:"agent_type"`
AgentName string `json:"agent_name"`
Directory string `json:"directory"`
ProjectID string `json:"project_id"`
Status string `json:"status"`
StartTime time.Time `json:"start_time"`
EndTime time.Time `json:"end_time"`
LastActivity time.Time `json:"last_activity"`
TokensIn int64 `json:"tokens_in"`
TokensOut int64 `json:"tokens_out"`
EstimatedCost float64 `json:"estimated_cost"`
ToolCalls int `json:"tool_calls"`
ErrorCount int `json:"error_count"`
Output string `json:"output"`
Metadata string `json:"metadata"`
}
SessionRecord represents a stored session
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store handles persistent storage
func (*Store) AppendOutput ¶
AppendOutput appends output to a session
func (*Store) ExportJSON ¶
ExportJSON exports all data as JSON
func (*Store) GetMetrics ¶
GetMetrics gets metrics for an agent
func (*Store) GetSession ¶
func (s *Store) GetSession(id string) (*SessionRecord, error)
GetSession gets a session by ID
func (*Store) ListAlerts ¶
func (s *Store) ListAlerts(limit int, unreadOnly bool) ([]*AlertRecord, error)
ListAlerts lists alerts
func (*Store) ListSessions ¶
func (s *Store) ListSessions(limit int, status string) ([]*SessionRecord, error)
ListSessions lists sessions with optional filters
func (*Store) MarkAlertRead ¶
MarkAlertRead marks an alert as read
func (*Store) MarkAllAlertsRead ¶
MarkAllAlertsRead marks all alerts as read
func (*Store) SaveAlert ¶
func (s *Store) SaveAlert(rec *AlertRecord) error
SaveAlert saves an alert
func (*Store) SaveMetric ¶
func (s *Store) SaveMetric(rec *MetricRecord) error
SaveMetric saves a metric point
func (*Store) SaveSession ¶
func (s *Store) SaveSession(rec *SessionRecord) error
SaveSession saves or updates a session
Click to show internal directories.
Click to hide internal directories.