refactor(desktop): tighten account dedup, probe scheduling, and session cleanup

- Dedup AI platform accounts by platform ID rather than identity key, preferring higher health rank then newer verified_at
- Clean up session data and health records when duplicate or replaced accounts are removed
- Remove reconcileTrackedAccountRemoteState — no longer optimistically trust remote health state
- Spread initial probes over a random window (5s–3min) to avoid thundering-herd on startup
- Stop scheduling a next probe after an account is marked expired
- Update AI platforms stats strip to show authorized/pending instead of configured/authorized

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Xu Liang
2026-05-06 15:38:53 +08:00
parent ccffe87e28
commit a99d7a4971
3 changed files with 95 additions and 85 deletions
@@ -45,9 +45,11 @@ function isLocallyAuthorized(account: AccountRow | null): boolean {
}
const overview = computed(() => ({
configuredPlatforms: desktopMonitoringMediaCatalog.length,
authorized: platformCards.value.filter((platform) => isLocallyAuthorized(platform.account))
.length,
pending: platformCards.value.filter(
(platform) => platform.account && !isLocallyAuthorized(platform.account),
).length,
onlineClients: snapshot.value?.summary.onlineClients ?? 0,
}))
@@ -259,12 +261,12 @@ async function unbindPlatform(account: AccountRow) {
<div class="stats-strip">
<div class="stat-card">
<div class="stat-label">支持平台</div>
<div class="stat-value">{{ overview.configuredPlatforms }}</div>
<div class="stat-label">已授权</div>
<div class="stat-value">{{ overview.authorized }}</div>
</div>
<div class="stat-card">
<div class="stat-label">授权正常</div>
<div class="stat-value">{{ overview.authorized }}</div>
<div class="stat-label">待处理</div>
<div class="stat-value">{{ overview.pending }}</div>
</div>
<div class="stat-card">
<div class="stat-label">在线客户端</div>