Documentation
¶
Index ¶
- Constants
- Variables
- type ActivityEntry
- type ActivityResponse
- type AgentInfo
- type AgentSummary
- type AnalyticsFilter
- type AnalyticsSummary
- type DB
- func (db *DB) Close() error
- func (db *DB) CloseConnections() error
- func (db *DB) CopyInsightsFrom(sourcePath string) error
- func (db *DB) DecodeCursor(s string) (SessionCursor, error)
- func (db *DB) DeleteInsight(id int64) error
- func (db *DB) DeleteSession(id string) error
- func (db *DB) DeleteSessions(ids []string) (int, error)
- func (db *DB) DeleteSkippedFile(path string) error
- func (db *DB) DropFTS() error
- func (db *DB) EncodeCursor(endedAt, id string, total ...int) string
- func (db *DB) FileBackedSessionCount(ctx context.Context) (int, error)
- func (db *DB) FindPruneCandidates(f PruneFilter) ([]Session, error)
- func (db *DB) GetAgents(ctx context.Context) ([]AgentInfo, error)
- func (db *DB) GetAllMessages(ctx context.Context, sessionID string) ([]Message, error)
- func (db *DB) GetAnalyticsActivity(ctx context.Context, f AnalyticsFilter, granularity string) (ActivityResponse, error)
- func (db *DB) GetAnalyticsHeatmap(ctx context.Context, f AnalyticsFilter, metric string) (HeatmapResponse, error)
- func (db *DB) GetAnalyticsHourOfWeek(ctx context.Context, f AnalyticsFilter) (HourOfWeekResponse, error)
- func (db *DB) GetAnalyticsProjects(ctx context.Context, f AnalyticsFilter) (ProjectsAnalyticsResponse, error)
- func (db *DB) GetAnalyticsSessionShape(ctx context.Context, f AnalyticsFilter) (SessionShapeResponse, error)
- func (db *DB) GetAnalyticsSummary(ctx context.Context, f AnalyticsFilter) (AnalyticsSummary, error)
- func (db *DB) GetAnalyticsTools(ctx context.Context, f AnalyticsFilter) (ToolsAnalyticsResponse, error)
- func (db *DB) GetAnalyticsTopSessions(ctx context.Context, f AnalyticsFilter, metric string) (TopSessionsResponse, error)
- func (db *DB) GetAnalyticsVelocity(ctx context.Context, f AnalyticsFilter) (VelocityResponse, error)
- func (db *DB) GetChildSessions(ctx context.Context, parentID string) ([]Session, error)
- func (db *DB) GetFileInfoByPath(path string) (size int64, mtime int64, ok bool)
- func (db *DB) GetInsight(ctx context.Context, id int64) (*Insight, error)
- func (db *DB) GetMachines(ctx context.Context) ([]string, error)
- func (db *DB) GetMessageByOrdinal(sessionID string, ordinal int) (*Message, error)
- func (db *DB) GetMessages(ctx context.Context, sessionID string, from, limit int, asc bool) ([]Message, error)
- func (db *DB) GetMinimap(ctx context.Context, sessionID string) ([]MinimapEntry, error)
- func (db *DB) GetMinimapFrom(ctx context.Context, sessionID string, from int) ([]MinimapEntry, error)
- func (db *DB) GetProjects(ctx context.Context) ([]ProjectInfo, error)
- func (db *DB) GetSession(ctx context.Context, id string) (*Session, error)
- func (db *DB) GetSessionFileInfo(id string) (size int64, mtime int64, ok bool)
- func (db *DB) GetSessionFull(ctx context.Context, id string) (*Session, error)
- func (db *DB) GetStats(ctx context.Context) (Stats, error)
- func (db *DB) HasFTS() bool
- func (db *DB) InsertInsight(s Insight) (int64, error)
- func (db *DB) InsertMessages(msgs []Message) error
- func (db *DB) ListInsights(ctx context.Context, f InsightFilter) ([]Insight, error)
- func (db *DB) ListSessions(ctx context.Context, f SessionFilter) (SessionPage, error)
- func (db *DB) LoadSkippedFiles() (map[string]int64, error)
- func (db *DB) MaxOrdinal(sessionID string) int
- func (db *DB) MessageCount(sessionID string) (int, error)
- func (db *DB) Path() string
- func (db *DB) Reader() *sql.DB
- func (db *DB) RebuildFTS() error
- func (db *DB) Reopen() error
- func (db *DB) ReplaceSessionMessages(sessionID string, msgs []Message) error
- func (db *DB) ReplaceSkippedFiles(entries map[string]int64) error
- func (db *DB) ResetAllMtimes() error
- func (db *DB) Search(ctx context.Context, f SearchFilter) (SearchPage, error)
- func (db *DB) SetCursorSecret(secret []byte)
- func (db *DB) Update(fn func(tx *sql.Tx) error) error
- func (db *DB) UpsertSession(s Session) error
- type DistributionBucket
- type HeatmapEntry
- type HeatmapLevels
- type HeatmapResponse
- type HourOfWeekCell
- type HourOfWeekResponse
- type Insight
- type InsightFilter
- type Message
- type MinimapEntry
- type Percentiles
- type ProjectAnalytics
- type ProjectInfo
- type ProjectsAnalyticsResponse
- type PruneFilter
- type SearchFilter
- type SearchPage
- type SearchResult
- type Session
- type SessionCursor
- type SessionFilter
- type SessionPage
- type SessionShapeResponse
- type Stats
- type ToolAgentBreakdown
- type ToolCall
- type ToolCategoryCount
- type ToolResult
- type ToolTrendEntry
- type ToolsAnalyticsResponse
- type TopSession
- type TopSessionsResponse
- type VelocityBreakdown
- type VelocityOverview
- type VelocityResponse
Constants ¶
const ( // DefaultMessageLimit is the default number of messages returned. DefaultMessageLimit = 100 // MaxMessageLimit is the maximum number of messages returned. MaxMessageLimit = 1000 )
const ( DefaultSearchLimit = 50 MaxSearchLimit = 500 )
const ( // DefaultSessionLimit is the default number of sessions returned. DefaultSessionLimit = 200 // MaxSessionLimit is the maximum number of sessions returned. MaxSessionLimit = 500 )
Variables ¶
var ErrInvalidCursor = errors.New("invalid cursor")
ErrInvalidCursor is returned when a cursor cannot be decoded or verified.
Functions ¶
This section is empty.
Types ¶
type ActivityEntry ¶
type ActivityEntry struct {
Date string `json:"date"`
Sessions int `json:"sessions"`
Messages int `json:"messages"`
UserMessages int `json:"user_messages"`
AssistantMessages int `json:"assistant_messages"`
ToolCalls int `json:"tool_calls"`
ThinkingMessages int `json:"thinking_messages"`
ByAgent map[string]int `json:"by_agent"`
}
ActivityEntry is one time bucket in the activity timeline.
type ActivityResponse ¶
type ActivityResponse struct {
Granularity string `json:"granularity"`
Series []ActivityEntry `json:"series"`
}
ActivityResponse wraps the activity series.
type AgentSummary ¶
AgentSummary holds per-agent counts for the summary.
type AnalyticsFilter ¶
type AnalyticsFilter struct {
From string // ISO date YYYY-MM-DD, inclusive
To string // ISO date YYYY-MM-DD, inclusive
Machine string // optional machine filter
Project string // optional project filter
Agent string // optional agent filter
Timezone string // IANA timezone for day bucketing
DayOfWeek *int // nil = all, 0=Mon, 6=Sun (ISO)
Hour *int // nil = all, 0-23
MinUserMessages int // user_message_count >= N
ActiveSince string // ISO timestamp cutoff
}
AnalyticsFilter is the shared filter for all analytics queries.
func (AnalyticsFilter) HasTimeFilter ¶
func (f AnalyticsFilter) HasTimeFilter() bool
HasTimeFilter returns true when hour-of-day or day-of-week filtering is active.
type AnalyticsSummary ¶
type AnalyticsSummary struct {
TotalSessions int `json:"total_sessions"`
TotalMessages int `json:"total_messages"`
ActiveProjects int `json:"active_projects"`
ActiveDays int `json:"active_days"`
AvgMessages float64 `json:"avg_messages"`
MedianMessages int `json:"median_messages"`
P90Messages int `json:"p90_messages"`
MostActive string `json:"most_active_project"`
Concentration float64 `json:"concentration"`
Agents map[string]*AgentSummary `json:"agents"`
}
AnalyticsSummary is the response for the summary endpoint.
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
DB manages a write connection and a read-only pool. The reader and writer fields use atomic.Pointer so that concurrent HTTP handler goroutines can safely read while Reopen/CloseConnections swap the underlying *sql.DB.
func Open ¶
Open creates or opens a SQLite database at the given path. It configures WAL mode, mmap, and returns a DB with separate writer and reader connections.
If an existing database has an outdated schema, it is deleted and recreated from scratch. Session data is re-synced from the source files on the next sync cycle.
func (*DB) Close ¶
Close closes both writer and reader connections, plus any retired pools left over from previous Reopen calls.
func (*DB) CloseConnections ¶ added in v0.8.0
CloseConnections closes both connections without reopening, releasing file locks so the database file can be renamed. Also drains any retired pools from previous Reopen calls. Callers must call Reopen afterwards to restore service.
func (*DB) CopyInsightsFrom ¶ added in v0.8.0
CopyInsightsFrom copies all insights from the database at sourcePath into this database using ATTACH/DETACH.
func (*DB) DecodeCursor ¶
func (db *DB) DecodeCursor(s string) (SessionCursor, error)
DecodeCursor parses a base64-encoded cursor string.
func (*DB) DeleteInsight ¶ added in v0.4.0
DeleteInsight removes an insight by ID.
func (*DB) DeleteSession ¶
DeleteSession removes a session and its messages (cascading).
func (*DB) DeleteSessions ¶
DeleteSessions removes multiple sessions by ID in a single transaction. Batches DELETEs in groups of 500 to stay under SQLite variable limits. Returns count of deleted rows.
func (*DB) DeleteSkippedFile ¶ added in v0.5.0
DeleteSkippedFile removes a single skip cache entry.
func (*DB) DropFTS ¶ added in v0.8.0
DropFTS drops the FTS table and its triggers. This makes bulk message delete+reinsert fast by avoiding per-row FTS index updates. Call RebuildFTS after to restore search.
func (*DB) EncodeCursor ¶
EncodeCursor returns a base64-encoded cursor string.
func (*DB) FileBackedSessionCount ¶ added in v0.8.0
FileBackedSessionCount returns the number of root sessions synced from files (excludes OpenCode, which is DB-backed). Used by ResyncAll to decide whether empty file discovery should abort the swap.
func (*DB) FindPruneCandidates ¶
func (db *DB) FindPruneCandidates( f PruneFilter, ) ([]Session, error)
FindPruneCandidates returns sessions matching all filter criteria. Returns full Session rows including file metadata.
func (*DB) GetAllMessages ¶
GetAllMessages returns all messages for a session ordered by ordinal.
func (*DB) GetAnalyticsActivity ¶
func (db *DB) GetAnalyticsActivity( ctx context.Context, f AnalyticsFilter, granularity string, ) (ActivityResponse, error)
GetAnalyticsActivity returns session/message counts grouped by time bucket.
func (*DB) GetAnalyticsHeatmap ¶
func (db *DB) GetAnalyticsHeatmap( ctx context.Context, f AnalyticsFilter, metric string, ) (HeatmapResponse, error)
GetAnalyticsHeatmap returns daily counts with intensity levels.
func (*DB) GetAnalyticsHourOfWeek ¶
func (db *DB) GetAnalyticsHourOfWeek( ctx context.Context, f AnalyticsFilter, ) (HourOfWeekResponse, error)
GetAnalyticsHourOfWeek returns message counts bucketed by day-of-week and hour-of-day in the user's timezone.
func (*DB) GetAnalyticsProjects ¶
func (db *DB) GetAnalyticsProjects( ctx context.Context, f AnalyticsFilter, ) (ProjectsAnalyticsResponse, error)
GetAnalyticsProjects returns per-project analytics.
func (*DB) GetAnalyticsSessionShape ¶
func (db *DB) GetAnalyticsSessionShape( ctx context.Context, f AnalyticsFilter, ) (SessionShapeResponse, error)
GetAnalyticsSessionShape returns distribution histograms for session length, duration, and autonomy ratio.
func (*DB) GetAnalyticsSummary ¶
func (db *DB) GetAnalyticsSummary( ctx context.Context, f AnalyticsFilter, ) (AnalyticsSummary, error)
GetAnalyticsSummary returns aggregate statistics.
func (*DB) GetAnalyticsTools ¶
func (db *DB) GetAnalyticsTools( ctx context.Context, f AnalyticsFilter, ) (ToolsAnalyticsResponse, error)
GetAnalyticsTools returns tool usage analytics aggregated from the tool_calls table.
func (*DB) GetAnalyticsTopSessions ¶
func (db *DB) GetAnalyticsTopSessions( ctx context.Context, f AnalyticsFilter, metric string, ) (TopSessionsResponse, error)
GetAnalyticsTopSessions returns the top 10 sessions by the given metric ("messages" or "duration") within the filter.
func (*DB) GetAnalyticsVelocity ¶
func (db *DB) GetAnalyticsVelocity( ctx context.Context, f AnalyticsFilter, ) (VelocityResponse, error)
GetAnalyticsVelocity computes turn cycle, first response, and throughput metrics with breakdowns by agent and complexity.
func (*DB) GetChildSessions ¶ added in v0.7.0
GetChildSessions returns sessions whose parent_session_id matches the given parentID, ordered by started_at ascending.
func (*DB) GetFileInfoByPath ¶ added in v0.4.1
GetFileInfoByPath returns file_size and file_mtime for a session identified by file_path. Used for codex/gemini files where the session ID requires parsing.
func (*DB) GetInsight ¶ added in v0.4.0
GetInsight returns a single insight by ID. Returns nil, nil if not found.
func (*DB) GetMachines ¶
GetMachines returns distinct machine names.
func (*DB) GetMessageByOrdinal ¶
GetMessageByOrdinal returns a single message by session ID and ordinal.
func (*DB) GetMessages ¶
func (db *DB) GetMessages( ctx context.Context, sessionID string, from, limit int, asc bool, ) ([]Message, error)
GetMessages returns paginated messages for a session. from: starting ordinal (inclusive) limit: max messages to return asc: true for ascending ordinal order, false for descending
func (*DB) GetMinimap ¶
GetMinimap returns lightweight metadata for all messages in a session.
func (*DB) GetMinimapFrom ¶
func (db *DB) GetMinimapFrom( ctx context.Context, sessionID string, from int, ) ([]MinimapEntry, error)
GetMinimapFrom returns lightweight metadata for messages in a session starting at ordinal >= from.
func (*DB) GetProjects ¶
func (db *DB) GetProjects( ctx context.Context, ) ([]ProjectInfo, error)
GetProjects returns project names with session counts.
func (*DB) GetSession ¶
GetSession returns a single session by ID.
func (*DB) GetSessionFileInfo ¶
GetSessionFileInfo returns file_size and file_mtime for a session. Used for fast skip checks during sync.
func (*DB) GetSessionFull ¶
GetSessionFull returns a single session by ID with all file metadata.
func (*DB) GetStats ¶
GetStats returns database statistics, counting only root sessions with messages (matching the session list filter).
func (*DB) InsertInsight ¶ added in v0.4.0
InsertInsight inserts an insight and returns its ID.
func (*DB) InsertMessages ¶
InsertMessages batch-inserts messages for a session.
func (*DB) ListInsights ¶ added in v0.4.0
ListInsights returns insights matching the filter, ordered by created_at DESC, capped at 500 rows.
func (*DB) ListSessions ¶
func (db *DB) ListSessions( ctx context.Context, f SessionFilter, ) (SessionPage, error)
ListSessions returns a cursor-paginated list of sessions.
func (*DB) LoadSkippedFiles ¶ added in v0.5.0
LoadSkippedFiles returns all persisted skip cache entries as a map from file_path to file_mtime.
func (*DB) MaxOrdinal ¶ added in v0.5.0
MaxOrdinal returns the highest ordinal for a session, or -1 if the session has no messages.
func (*DB) MessageCount ¶
MessageCount returns the number of messages for a session.
func (*DB) RebuildFTS ¶ added in v0.8.0
RebuildFTS recreates the FTS table, triggers, and repopulates the index from the messages table.
func (*DB) Reopen ¶ added in v0.8.0
Reopen closes and reopens both connections to the same path. Used after an atomic file swap to pick up the new database contents. Preserves cursorSecret.
func (*DB) ReplaceSessionMessages ¶
ReplaceSessionMessages deletes existing and inserts new messages in a single transaction.
func (*DB) ReplaceSkippedFiles ¶ added in v0.5.0
ReplaceSkippedFiles replaces all skip cache entries in a single transaction. This is called after each sync cycle to persist the in-memory skip cache.
func (*DB) ResetAllMtimes ¶ added in v0.6.0
ResetAllMtimes zeroes file_mtime for every session, forcing the next sync to re-process all files regardless of whether their size+mtime matches what was previously stored.
func (*DB) Search ¶
func (db *DB) Search( ctx context.Context, f SearchFilter, ) (SearchPage, error)
Search performs FTS5 full-text search across messages.
func (*DB) SetCursorSecret ¶
SetCursorSecret updates the secret key used for cursor signing.
func (*DB) Update ¶
Update executes fn within a write lock and transaction. The transaction is committed if fn returns nil, rolled back otherwise.
func (*DB) UpsertSession ¶
UpsertSession inserts or updates a session.
type DistributionBucket ¶
DistributionBucket is a labeled count for histogram display.
type HeatmapEntry ¶
type HeatmapEntry struct {
Date string `json:"date"`
Value int `json:"value"`
Level int `json:"level"`
}
HeatmapEntry is one day in the heatmap calendar.
type HeatmapLevels ¶
type HeatmapLevels struct {
L1 int `json:"l1"`
L2 int `json:"l2"`
L3 int `json:"l3"`
L4 int `json:"l4"`
}
HeatmapLevels defines the quartile thresholds for levels 1-4.
type HeatmapResponse ¶
type HeatmapResponse struct {
Metric string `json:"metric"`
Entries []HeatmapEntry `json:"entries"`
Levels HeatmapLevels `json:"levels"`
}
HeatmapResponse wraps the heatmap data.
type HourOfWeekCell ¶
type HourOfWeekCell struct {
DayOfWeek int `json:"day_of_week"` // 0=Mon, 6=Sun
Hour int `json:"hour"` // 0-23
Messages int `json:"messages"`
}
HourOfWeekCell is one cell in the 7x24 hour-of-week grid.
type HourOfWeekResponse ¶
type HourOfWeekResponse struct {
Cells []HourOfWeekCell `json:"cells"`
}
HourOfWeekResponse wraps the hour-of-week heatmap data.
type Insight ¶ added in v0.4.0
type Insight struct {
ID int64 `json:"id"`
Type string `json:"type"`
DateFrom string `json:"date_from"`
DateTo string `json:"date_to"`
Project *string `json:"project"`
Agent string `json:"agent"`
Model *string `json:"model"`
Prompt *string `json:"prompt"`
Content string `json:"content"`
CreatedAt string `json:"created_at"`
}
Insight represents a row in the insights table.
type InsightFilter ¶ added in v0.4.0
type InsightFilter struct {
Type string // "daily_activity" or "agent_analysis"
Project string // "" = no filter
GlobalOnly bool // true = project IS NULL only
}
InsightFilter specifies how to query insights.
type Message ¶
type Message struct {
ID int64 `json:"id"`
SessionID string `json:"session_id"`
Ordinal int `json:"ordinal"`
Role string `json:"role"`
Content string `json:"content"`
Timestamp string `json:"timestamp"`
HasThinking bool `json:"has_thinking"`
HasToolUse bool `json:"has_tool_use"`
ContentLength int `json:"content_length"`
ToolCalls []ToolCall `json:"tool_calls,omitempty"`
ToolResults []ToolResult `json:"-"` // transient, for pairing
}
Message represents a row in the messages table.
type MinimapEntry ¶
type MinimapEntry struct {
Ordinal int `json:"ordinal"`
Role string `json:"role"`
ContentLength int `json:"content_length"`
HasThinking bool `json:"has_thinking"`
HasToolUse bool `json:"has_tool_use"`
}
MinimapEntry is a lightweight message summary for minimap rendering.
func SampleMinimap ¶
func SampleMinimap( entries []MinimapEntry, max int, ) []MinimapEntry
SampleMinimap downsamples entries to at most max points while preserving ordering and both endpoints.
type Percentiles ¶
Percentiles holds p50 and p90 values.
type ProjectAnalytics ¶
type ProjectAnalytics struct {
Name string `json:"name"`
Sessions int `json:"sessions"`
Messages int `json:"messages"`
FirstSession string `json:"first_session"`
LastSession string `json:"last_session"`
AvgMessages float64 `json:"avg_messages"`
MedianMessages int `json:"median_messages"`
Agents map[string]int `json:"agents"`
DailyTrend float64 `json:"daily_trend"`
}
ProjectAnalytics holds analytics for a single project.
type ProjectInfo ¶
ProjectInfo holds a project name and its session count.
type ProjectsAnalyticsResponse ¶
type ProjectsAnalyticsResponse struct {
Projects []ProjectAnalytics `json:"projects"`
}
ProjectsAnalyticsResponse wraps the projects list.
type PruneFilter ¶
type PruneFilter struct {
Project string // substring match (LIKE '%x%')
MaxMessages *int // user messages <= N (nil = no filter)
Before string // ended_at < date (YYYY-MM-DD)
FirstMessage string // first_message LIKE 'prefix%'
}
PruneFilter defines criteria for finding sessions to prune. Filters combine with AND. At least one must be set.
func (PruneFilter) HasFilters ¶
func (f PruneFilter) HasFilters() bool
HasFilters reports whether at least one filter is set.
type SearchFilter ¶
type SearchFilter struct {
Query string
Project string
Cursor int // offset for pagination
Limit int
}
SearchFilter specifies search parameters.
type SearchPage ¶
type SearchPage struct {
Results []SearchResult `json:"results"`
NextCursor int `json:"next_cursor,omitempty"`
}
SearchPage holds paginated search results.
type SearchResult ¶
type SearchResult struct {
SessionID string `json:"session_id"`
Project string `json:"project"`
Ordinal int `json:"ordinal"`
Role string `json:"role"`
Timestamp string `json:"timestamp"`
Snippet string `json:"snippet"`
Rank float64 `json:"rank"`
}
SearchResult holds a message match with session context.
type Session ¶
type Session struct {
ID string `json:"id"`
Project string `json:"project"`
Machine string `json:"machine"`
Agent string `json:"agent"`
FirstMessage *string `json:"first_message"`
StartedAt *string `json:"started_at"`
EndedAt *string `json:"ended_at"`
MessageCount int `json:"message_count"`
UserMessageCount int `json:"user_message_count"`
ParentSessionID *string `json:"parent_session_id,omitempty"`
RelationshipType string `json:"relationship_type,omitempty"`
FilePath *string `json:"file_path,omitempty"`
FileSize *int64 `json:"file_size,omitempty"`
FileMtime *int64 `json:"file_mtime,omitempty"`
FileHash *string `json:"file_hash,omitempty"`
CreatedAt string `json:"created_at"`
}
Session represents a row in the sessions table.
type SessionCursor ¶
type SessionCursor struct {
EndedAt string `json:"e"`
ID string `json:"i"`
Total int `json:"t,omitempty"`
}
SessionCursor is the opaque pagination token.
type SessionFilter ¶
type SessionFilter struct {
Project string
ExcludeProject string // exclude sessions with this project name
Machine string
Agent string
Date string // exact date YYYY-MM-DD
DateFrom string // range start (inclusive)
DateTo string // range end (inclusive)
ActiveSince string // ISO-8601 timestamp; filters on most recent activity
MinMessages int // message_count >= N (0 = no filter)
MaxMessages int // message_count <= N (0 = no filter)
MinUserMessages int // user_message_count >= N (0 = no filter)
Cursor string // opaque cursor from previous page
Limit int
}
SessionFilter specifies how to query sessions.
type SessionPage ¶
type SessionPage struct {
Sessions []Session `json:"sessions"`
NextCursor string `json:"next_cursor,omitempty"`
Total int `json:"total"`
}
SessionPage is a page of session results.
type SessionShapeResponse ¶
type SessionShapeResponse struct {
Count int `json:"count"`
LengthDistribution []DistributionBucket `json:"length_distribution"`
DurationDistribution []DistributionBucket `json:"duration_distribution"`
AutonomyDistribution []DistributionBucket `json:"autonomy_distribution"`
}
SessionShapeResponse holds distribution histograms for session characteristics.
type Stats ¶
type Stats struct {
SessionCount int `json:"session_count"`
MessageCount int `json:"message_count"`
ProjectCount int `json:"project_count"`
MachineCount int `json:"machine_count"`
}
Stats holds database-wide statistics.
type ToolAgentBreakdown ¶
type ToolAgentBreakdown struct {
Agent string `json:"agent"`
Total int `json:"total"`
Categories []ToolCategoryCount `json:"categories"`
}
ToolAgentBreakdown holds tool usage breakdown for one agent.
type ToolCall ¶
type ToolCall struct {
MessageID int64 `json:"-"`
SessionID string `json:"-"`
ToolName string `json:"tool_name"`
Category string `json:"category"`
ToolUseID string `json:"tool_use_id,omitempty"`
InputJSON string `json:"input_json,omitempty"`
SkillName string `json:"skill_name,omitempty"`
ResultContentLength int `json:"result_content_length,omitempty"`
SubagentSessionID string `json:"subagent_session_id,omitempty"`
}
ToolCall represents a single tool invocation stored in the tool_calls table.
type ToolCategoryCount ¶
type ToolCategoryCount struct {
Category string `json:"category"`
Count int `json:"count"`
Pct float64 `json:"pct"`
}
ToolCategoryCount holds a count and percentage for one tool category.
type ToolResult ¶ added in v0.4.0
ToolResult holds a tool_result content length for pairing.
type ToolTrendEntry ¶
ToolTrendEntry holds tool call counts for one time bucket.
type ToolsAnalyticsResponse ¶
type ToolsAnalyticsResponse struct {
TotalCalls int `json:"total_calls"`
ByCategory []ToolCategoryCount `json:"by_category"`
ByAgent []ToolAgentBreakdown `json:"by_agent"`
Trend []ToolTrendEntry `json:"trend"`
}
ToolsAnalyticsResponse wraps tool usage analytics.
type TopSession ¶
type TopSession struct {
ID string `json:"id"`
Project string `json:"project"`
FirstMessage *string `json:"first_message"`
MessageCount int `json:"message_count"`
DurationMin float64 `json:"duration_min"`
}
TopSession holds summary info for a ranked session.
type TopSessionsResponse ¶
type TopSessionsResponse struct {
Metric string `json:"metric"`
Sessions []TopSession `json:"sessions"`
}
TopSessionsResponse wraps the top sessions list.
type VelocityBreakdown ¶
type VelocityBreakdown struct {
Label string `json:"label"`
Sessions int `json:"sessions"`
Overview VelocityOverview `json:"overview"`
}
VelocityBreakdown is velocity metrics for a subgroup.
type VelocityOverview ¶
type VelocityOverview struct {
TurnCycleSec Percentiles `json:"turn_cycle_sec"`
FirstResponseSec Percentiles `json:"first_response_sec"`
MsgsPerActiveMin float64 `json:"msgs_per_active_min"`
CharsPerActiveMin float64 `json:"chars_per_active_min"`
ToolCallsPerActiveMin float64 `json:"tool_calls_per_active_min"`
}
VelocityOverview holds aggregate velocity metrics.
type VelocityResponse ¶
type VelocityResponse struct {
Overall VelocityOverview `json:"overall"`
ByAgent []VelocityBreakdown `json:"by_agent"`
ByComplexity []VelocityBreakdown `json:"by_complexity"`
}
VelocityResponse wraps overall and grouped velocity metrics.