pi-agent: Implement progressive Target detection

This commit is contained in:
proxyctl coordinator
2026-07-17 21:01:35 +08:00
parent fbb81ffb40
commit ad651402fd
15 changed files with 558 additions and 31 deletions
+11 -1
View File
@@ -23,7 +23,7 @@ type targetCatalog struct {
func newTargetCatalog(snapshot app.Snapshot, includeUnavailable bool) targetCatalog {
items := make([]app.TargetSnapshot, 0, len(snapshot.Targets))
for _, item := range snapshot.Targets {
if item.Available || includeUnavailable {
if item.Available || includeUnavailable || item.DetectionPhase != app.TargetReady {
items = append(items, item)
}
}
@@ -84,11 +84,21 @@ type targetStateCounts struct {
disabled int
external int
drifted int
checking int
failed int
}
func countAvailableTargetStates(snapshot app.Snapshot) targetStateCounts {
var counts targetStateCounts
for _, item := range snapshot.Targets {
switch item.DetectionPhase {
case app.TargetChecking:
counts.checking++
continue
case app.TargetDetectionFailed:
counts.failed++
continue
}
if !item.Available {
continue
}