mirror of
https://github.com/YspCoder/clawgo.git
synced 2026-05-17 23:57:30 +08:00
improve status visibility for autonomy pacing and dialog templates
This commit is contained in:
@@ -132,7 +132,12 @@ func statusCmd() {
|
|||||||
fmt.Printf(" - %s\n", key)
|
fmt.Printf(" - %s\n", key)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fmt.Printf("Autonomy Config: idle_resume=%ds waiting_debounce=%ds\n", cfg.Agents.Defaults.Autonomy.UserIdleResumeSec, cfg.Agents.Defaults.Autonomy.WaitingResumeDebounceSec)
|
fmt.Printf("Autonomy Config: idle_resume=%ds waiting_debounce=%ds notify_cooldown=%ds same_reason_cooldown=%ds\n",
|
||||||
|
cfg.Agents.Defaults.Autonomy.UserIdleResumeSec,
|
||||||
|
cfg.Agents.Defaults.Autonomy.WaitingResumeDebounceSec,
|
||||||
|
cfg.Agents.Defaults.Autonomy.NotifyCooldownSec,
|
||||||
|
cfg.Agents.Defaults.Autonomy.NotifySameReasonCooldownSec,
|
||||||
|
)
|
||||||
if summary, prio, reasons, nextRetry, dedupeHits, err := collectAutonomyTaskSummary(filepath.Join(workspace, "memory", "tasks.json")); err == nil {
|
if summary, prio, reasons, nextRetry, dedupeHits, err := collectAutonomyTaskSummary(filepath.Join(workspace, "memory", "tasks.json")); err == nil {
|
||||||
fmt.Printf("Autonomy Tasks: todo=%d doing=%d waiting=%d blocked=%d done=%d dedupe_hits=%d\n", summary["todo"], summary["doing"], summary["waiting"], summary["blocked"], summary["done"], dedupeHits)
|
fmt.Printf("Autonomy Tasks: todo=%d doing=%d waiting=%d blocked=%d done=%d dedupe_hits=%d\n", summary["todo"], summary["doing"], summary["waiting"], summary["blocked"], summary["done"], dedupeHits)
|
||||||
fmt.Printf("Autonomy Priority: high=%d normal=%d low=%d\n", prio["high"], prio["normal"], prio["low"])
|
fmt.Printf("Autonomy Priority: high=%d normal=%d low=%d\n", prio["high"], prio["normal"], prio["low"])
|
||||||
@@ -159,6 +164,8 @@ func printTemplateStatus(cfg *config.Config) {
|
|||||||
printTemplateField("lang_invalid", cur.LangInvalid, defaults.LangInvalid)
|
printTemplateField("lang_invalid", cur.LangInvalid, defaults.LangInvalid)
|
||||||
printTemplateField("runtime_compaction_note", cur.RuntimeCompactionNote, defaults.RuntimeCompactionNote)
|
printTemplateField("runtime_compaction_note", cur.RuntimeCompactionNote, defaults.RuntimeCompactionNote)
|
||||||
printTemplateField("startup_compaction_note", cur.StartupCompactionNote, defaults.StartupCompactionNote)
|
printTemplateField("startup_compaction_note", cur.StartupCompactionNote, defaults.StartupCompactionNote)
|
||||||
|
printTemplateField("autonomy_completion_template", cur.AutonomyCompletionTemplate, defaults.AutonomyCompletionTemplate)
|
||||||
|
printTemplateField("autonomy_blocked_template", cur.AutonomyBlockedTemplate, defaults.AutonomyBlockedTemplate)
|
||||||
}
|
}
|
||||||
|
|
||||||
func printTemplateField(name, current, def string) {
|
func printTemplateField(name, current, def string) {
|
||||||
@@ -197,10 +204,32 @@ func summarizeAutonomyActions(statsJSON []byte) string {
|
|||||||
rm := payload.Counts["autonomy:resume:manual_pause"]
|
rm := payload.Counts["autonomy:resume:manual_pause"]
|
||||||
if wa+wm+ra+rm > 0 {
|
if wa+wm+ra+rm > 0 {
|
||||||
parts = append(parts, fmt.Sprintf("wait_resume(active_user=%d/%d manual_pause=%d/%d)", wa, ra, wm, rm))
|
parts = append(parts, fmt.Sprintf("wait_resume(active_user=%d/%d manual_pause=%d/%d)", wa, ra, wm, rm))
|
||||||
|
waitTotal := wa + wm
|
||||||
|
resumeTotal := ra + rm
|
||||||
|
if waitTotal >= 8 {
|
||||||
|
parts = append(parts, fmt.Sprintf("flap_risk=%s", flapRisk(waitTotal, resumeTotal)))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return strings.Join(parts, " ")
|
return strings.Join(parts, " ")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func flapRisk(waitTotal, resumeTotal int) string {
|
||||||
|
if waitTotal <= 0 {
|
||||||
|
return "low"
|
||||||
|
}
|
||||||
|
if resumeTotal == 0 {
|
||||||
|
return "high(no_resume)"
|
||||||
|
}
|
||||||
|
ratio := float64(waitTotal) / float64(resumeTotal)
|
||||||
|
if ratio >= 2.0 || ratio <= 0.5 {
|
||||||
|
return "high"
|
||||||
|
}
|
||||||
|
if ratio >= 1.5 || ratio <= 0.67 {
|
||||||
|
return "medium"
|
||||||
|
}
|
||||||
|
return "low"
|
||||||
|
}
|
||||||
|
|
||||||
func autonomyControlState(workspace string) string {
|
func autonomyControlState(workspace string) string {
|
||||||
memDir := filepath.Join(workspace, "memory")
|
memDir := filepath.Join(workspace, "memory")
|
||||||
pausePath := filepath.Join(memDir, "autonomy.pause")
|
pausePath := filepath.Join(memDir, "autonomy.pause")
|
||||||
|
|||||||
Reference in New Issue
Block a user