expose gateway autonomy in CLI help and add autonomy action ratios

This commit is contained in:
DBT
2026-02-24 04:10:58 +00:00
parent ee91d6e479
commit 4c38b9ac25
2 changed files with 10 additions and 1 deletions

View File

@@ -108,6 +108,7 @@ func printHelp() {
fmt.Println(" clawgo gateway # register service")
fmt.Println(" clawgo gateway start|stop|restart|status")
fmt.Println(" clawgo gateway run # run foreground")
fmt.Println(" clawgo gateway autonomy on|off|status")
fmt.Println()
fmt.Println("Uninstall:")
fmt.Println(" clawgo uninstall # remove gateway service")

View File

@@ -177,12 +177,20 @@ func summarizeAutonomyActions(statsJSON []byte) string {
return ""
}
keys := []string{"autonomy:dispatch", "autonomy:waiting", "autonomy:resume", "autonomy:blocked", "autonomy:complete"}
parts := make([]string, 0, len(keys))
parts := make([]string, 0, len(keys)+1)
total := 0
for _, k := range keys {
if v, ok := payload.Counts[k]; ok {
parts = append(parts, fmt.Sprintf("%s=%d", strings.TrimPrefix(k, "autonomy:"), v))
total += v
}
}
if total > 0 {
d := payload.Counts["autonomy:dispatch"]
w := payload.Counts["autonomy:waiting"]
b := payload.Counts["autonomy:blocked"]
parts = append(parts, fmt.Sprintf("ratios(dispatch/waiting/blocked)=%.2f/%.2f/%.2f", float64(d)/float64(total), float64(w)/float64(total), float64(b)/float64(total)))
}
return strings.Join(parts, " ")
}