@team-agent/installer 0.5.34 → 0.5.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Cargo.lock +1 -1
- package/Cargo.toml +1 -1
- package/crates/team-agent/src/cli/status.rs +28 -0
- package/crates/team-agent/src/coordinator/steps/abnormal.rs +810 -2
- package/crates/team-agent/src/coordinator/tests/api_error_recovery.rs +480 -0
- package/crates/team-agent/src/coordinator/tests/mod.rs +1 -0
- package/crates/team-agent/src/coordinator/tests/tick_core.rs +7 -0
- package/crates/team-agent/src/coordinator/tick.rs +13 -0
- package/crates/team-agent/src/leader/start.rs +194 -1
- package/crates/team-agent/src/lifecycle/restart/agent.rs +65 -0
- package/crates/team-agent/src/lifecycle/restart.rs +4 -0
- package/crates/team-agent/src/state/repository.rs +15 -0
- package/package.json +4 -4
package/Cargo.lock
CHANGED
package/Cargo.toml
CHANGED
|
@@ -52,6 +52,14 @@ pub fn agent_summary_counts(agents: &Value, health: &Value) -> SummaryCounts {
|
|
|
52
52
|
.and_then(|v| v.get("status"))
|
|
53
53
|
.and_then(Value::as_str)
|
|
54
54
|
.unwrap_or("");
|
|
55
|
+
// 0.5.35 R4 (`.team/artifacts/managed-leader-provider-reentry-locate.md`):
|
|
56
|
+
// canonical `worker_state=UNKNOWN` / `activity.status=uncertain`
|
|
57
|
+
// beats legacy `agent_health.status=WORKING` so the five-line
|
|
58
|
+
// summary stops counting a runtime-honestly-UNKNOWN agent as busy.
|
|
59
|
+
if canonical_worker_state_is_unknown(agent) {
|
|
60
|
+
counts.unknown += 1;
|
|
61
|
+
continue;
|
|
62
|
+
}
|
|
55
63
|
match classify_agent_bucket(raw, hstatus) {
|
|
56
64
|
SummaryBucket::Running => counts.running += 1,
|
|
57
65
|
SummaryBucket::Busy => counts.busy += 1,
|
|
@@ -64,6 +72,22 @@ pub fn agent_summary_counts(agents: &Value, health: &Value) -> SummaryCounts {
|
|
|
64
72
|
counts
|
|
65
73
|
}
|
|
66
74
|
|
|
75
|
+
/// 0.5.35 R4: return true when the runtime classifier has written a
|
|
76
|
+
/// canonical non-decisive observation onto the agent row. Used by
|
|
77
|
+
/// `agent_summary_counts` and `csv_agent_status` so the "UNKNOWN-first"
|
|
78
|
+
/// signal beats legacy `agent_health.status`.
|
|
79
|
+
fn canonical_worker_state_is_unknown(agent: &Value) -> bool {
|
|
80
|
+
let worker_state_unknown = agent
|
|
81
|
+
.get("worker_state")
|
|
82
|
+
.and_then(Value::as_str)
|
|
83
|
+
.is_some_and(|value| value.eq_ignore_ascii_case("UNKNOWN"));
|
|
84
|
+
let activity_uncertain = agent
|
|
85
|
+
.pointer("/activity/status")
|
|
86
|
+
.and_then(Value::as_str)
|
|
87
|
+
.is_some_and(|value| value.eq_ignore_ascii_case("uncertain"));
|
|
88
|
+
worker_state_unknown || activity_uncertain
|
|
89
|
+
}
|
|
90
|
+
|
|
67
91
|
fn stale_agent_bucket(agent: &Value) -> Option<SummaryBucket> {
|
|
68
92
|
if agent.get("stale").and_then(Value::as_bool) != Some(true) {
|
|
69
93
|
return None;
|
|
@@ -224,6 +248,10 @@ fn csv_agent_status(
|
|
|
224
248
|
if matches!(raw.as_str(), "running" | "busy" | "working") && !pane_present {
|
|
225
249
|
return "错误";
|
|
226
250
|
}
|
|
251
|
+
// 0.5.35 R4: canonical UNKNOWN beats legacy WORKING in human CSV too.
|
|
252
|
+
if canonical_worker_state_is_unknown(agent) {
|
|
253
|
+
return "未知";
|
|
254
|
+
}
|
|
227
255
|
if raw == "idle" || hstatus == "idle" {
|
|
228
256
|
return "空闲";
|
|
229
257
|
}
|