mirror of
https://github.com/YspCoder/clawgo.git
synced 2026-05-20 09:47:29 +08:00
enhance autonomy with priority scheduling, backoff retry, and status summary
This commit is contained in:
@@ -128,6 +128,9 @@ func statusCmd() {
|
||||
fmt.Printf(" - %s\n", key)
|
||||
}
|
||||
}
|
||||
if summary, err := collectAutonomyTaskSummary(filepath.Join(workspace, "memory", "tasks.json")); err == nil {
|
||||
fmt.Printf("Autonomy Tasks: todo=%d doing=%d blocked=%d done=%d\n", summary["todo"], summary["doing"], summary["blocked"], summary["done"])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -241,6 +244,30 @@ func collectTriggerErrorCounts(path string) (map[string]int, error) {
|
||||
return counts, nil
|
||||
}
|
||||
|
||||
func collectAutonomyTaskSummary(path string) (map[string]int, error) {
|
||||
data, err := os.ReadFile(path)
|
||||
if err != nil {
|
||||
if os.IsNotExist(err) {
|
||||
return map[string]int{"todo": 0, "doing": 0, "blocked": 0, "done": 0}, nil
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
var items []struct {
|
||||
Status string `json:"status"`
|
||||
}
|
||||
if err := json.Unmarshal(data, &items); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
summary := map[string]int{"todo": 0, "doing": 0, "blocked": 0, "done": 0}
|
||||
for _, it := range items {
|
||||
s := strings.ToLower(strings.TrimSpace(it.Status))
|
||||
if _, ok := summary[s]; ok {
|
||||
summary[s]++
|
||||
}
|
||||
}
|
||||
return summary, nil
|
||||
}
|
||||
|
||||
func collectRecentSubagentSessions(sessionsDir string, limit int) ([]string, error) {
|
||||
indexPath := filepath.Join(sessionsDir, "sessions.json")
|
||||
data, err := os.ReadFile(indexPath)
|
||||
|
||||
Reference in New Issue
Block a user