Documentation
¶
Overview ¶
Package taskstats aggregates per-task execution analytics from all available cloop data sources: task state, step log tokens, artifact files, and verification results.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatDuration ¶
FormatDuration renders a duration in a human-readable form: "2h 3m 15s", "45m 2s", "12s".
func VariancePct ¶
VariancePct returns the percentage variance of actual vs estimated minutes. Returns (0, false) when either is zero.
Types ¶
type AggregateStats ¶
type AggregateStats struct {
TotalTasks int
DoneTasks int
SkippedTasks int
FailedTasks int
PendingTasks int
InProgressTasks int
CompletionRate float64 // (done+skipped) / total
SuccessRate float64 // done / (done+failed) when done+failed > 0
TotalEstimatedMinutes int
TotalActualMinutes int
TotalInputTokens int
TotalOutputTokens int
TotalCostUSD float64
TotalHealAttempts int
TotalVerifyPasses int
TotalVerifyFails int
// Ranked sub-lists
SlowestTasks []*TaskStats // top 5 by actual minutes (desc)
MostHealedTasks []*TaskStats // top 5 by HealAttempts (desc)
All []*TaskStats
}
AggregateStats summarises analytics across all tasks in a plan.
func Collect ¶
func Collect(s *state.ProjectState, workDir, model string) *AggregateStats
Collect gathers analytics for all tasks in the plan. workDir is the project root (.cloop is a sub-directory of workDir). model is used for cost estimation and may be empty.
type TaskStats ¶
type TaskStats struct {
TaskID int
TaskTitle string
Status pm.TaskStatus
// Timing
StartedAt *time.Time
CompletedAt *time.Time
WallTime time.Duration // CompletedAt - StartedAt when both set
// Estimate accuracy
EstimatedMinutes int
ActualMinutes int // measured (or derived from StartedAt/CompletedAt)
// Resilience
HealAttempts int
VerifyRetries int
FailCount int
// Verification
VerifyPasses int
VerifyFails int
// Tokens & cost (aggregated from step log)
InputTokens int
OutputTokens int
CostUSD float64
HasCostData bool
// Mini timeline
Phases []Phase
}
TaskStats holds collected analytics for a single task.
func CollectOne ¶
CollectOne gathers analytics for the single task with the given ID. Returns (nil, error) if not found.