mirror of
https://github.com/YspCoder/clawgo.git
synced 2026-05-13 11:07:31 +08:00
add autonomy action stats view and document runtime autonomy controls
This commit is contained in:
@@ -57,6 +57,11 @@ clawgo gateway status
|
|||||||
|
|
||||||
# 前台运行
|
# 前台运行
|
||||||
clawgo gateway run
|
clawgo gateway run
|
||||||
|
|
||||||
|
# 自治开关(运行态)
|
||||||
|
clawgo gateway autonomy status
|
||||||
|
clawgo gateway autonomy on
|
||||||
|
clawgo gateway autonomy off
|
||||||
```
|
```
|
||||||
|
|
||||||
## 📌 命令总览
|
## 📌 命令总览
|
||||||
|
|||||||
@@ -57,6 +57,11 @@ clawgo gateway status
|
|||||||
|
|
||||||
# foreground run
|
# foreground run
|
||||||
clawgo gateway run
|
clawgo gateway run
|
||||||
|
|
||||||
|
# runtime autonomy switches
|
||||||
|
clawgo gateway autonomy status
|
||||||
|
clawgo gateway autonomy on
|
||||||
|
clawgo gateway autonomy off
|
||||||
```
|
```
|
||||||
|
|
||||||
## 📌 Command Reference
|
## 📌 Command Reference
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ type taskState struct {
|
|||||||
DueAt string
|
DueAt string
|
||||||
Status string // idle|running|waiting|blocked|completed
|
Status string // idle|running|waiting|blocked|completed
|
||||||
BlockReason string
|
BlockReason string
|
||||||
|
WaitingSince time.Time
|
||||||
LastRunAt time.Time
|
LastRunAt time.Time
|
||||||
LastAutonomyAt time.Time
|
LastAutonomyAt time.Time
|
||||||
RetryAfter time.Time
|
RetryAfter time.Time
|
||||||
@@ -126,6 +127,7 @@ func (e *Engine) tick() {
|
|||||||
if st.Status == "running" {
|
if st.Status == "running" {
|
||||||
st.Status = "waiting"
|
st.Status = "waiting"
|
||||||
st.BlockReason = "manual_pause"
|
st.BlockReason = "manual_pause"
|
||||||
|
st.WaitingSince = now
|
||||||
e.writeReflectLog("waiting", st, "paused by manual switch")
|
e.writeReflectLog("waiting", st, "paused by manual switch")
|
||||||
e.writeTriggerAudit("waiting", st, "manual_pause")
|
e.writeTriggerAudit("waiting", st, "manual_pause")
|
||||||
}
|
}
|
||||||
@@ -139,6 +141,7 @@ func (e *Engine) tick() {
|
|||||||
if st.Status == "running" {
|
if st.Status == "running" {
|
||||||
st.Status = "waiting"
|
st.Status = "waiting"
|
||||||
st.BlockReason = "active_user"
|
st.BlockReason = "active_user"
|
||||||
|
st.WaitingSince = now
|
||||||
e.writeReflectLog("waiting", st, "paused due to active user conversation")
|
e.writeReflectLog("waiting", st, "paused due to active user conversation")
|
||||||
e.writeTriggerAudit("waiting", st, "active_user")
|
e.writeTriggerAudit("waiting", st, "active_user")
|
||||||
}
|
}
|
||||||
@@ -223,9 +226,14 @@ func (e *Engine) tick() {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if st.Status == "waiting" {
|
if st.Status == "waiting" {
|
||||||
|
// Debounce waiting/resume flapping
|
||||||
|
if !st.WaitingSince.IsZero() && now.Sub(st.WaitingSince) < 5*time.Second {
|
||||||
|
continue
|
||||||
|
}
|
||||||
reason := st.BlockReason
|
reason := st.BlockReason
|
||||||
st.Status = "idle"
|
st.Status = "idle"
|
||||||
st.BlockReason = ""
|
st.BlockReason = ""
|
||||||
|
st.WaitingSince = time.Time{}
|
||||||
e.writeReflectLog("resume", st, "autonomy resumed from waiting")
|
e.writeReflectLog("resume", st, "autonomy resumed from waiting")
|
||||||
e.writeTriggerAudit("resume", st, reason)
|
e.writeTriggerAudit("resume", st, reason)
|
||||||
}
|
}
|
||||||
@@ -257,6 +265,7 @@ func (e *Engine) tick() {
|
|||||||
e.dispatchTask(st)
|
e.dispatchTask(st)
|
||||||
st.Status = "running"
|
st.Status = "running"
|
||||||
st.BlockReason = ""
|
st.BlockReason = ""
|
||||||
|
st.WaitingSince = time.Time{}
|
||||||
st.LastRunAt = now
|
st.LastRunAt = now
|
||||||
st.LastAutonomyAt = now
|
st.LastAutonomyAt = now
|
||||||
e.writeReflectLog("dispatch", st, "task dispatched to agent loop")
|
e.writeReflectLog("dispatch", st, "task dispatched to agent loop")
|
||||||
|
|||||||
Reference in New Issue
Block a user