fix(intelligence): Heartbeat 统一健康系统 — 6处断链修复 + 健康面板 + SaaS自动恢复
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
Rust 后端 (heartbeat.rs): - 告警实时推送: OnceLock<AppHandle> + Tauri emit heartbeat:alert - 动态间隔: tokio::select! + Notify 替代不可变 interval - Config 持久化: update_config 写入 VikingStorage - heartbeat_init 从 VikingStorage 恢复 config - 移除 dead code (subscribe, HeartbeatCheckFn) - Memory stats fallback 分层处理 新增 health_snapshot.rs: - HealthSnapshot Tauri 命令 — 按需查询引擎/记忆状态 - 注册到 lib.rs invoke_handler 前端修复: - HeartbeatConfig handleSave 同步到 Rust 后端 - App.tsx 读 localStorage 持久化配置 + heartbeat:alert 监听 + toast - saasStore 降级后指数退避探测恢复 + saas-recovered 事件 - 新增 HealthPanel.tsx 只读健康面板 (4卡片 + 告警列表) - SettingsLayout 添加 health 导航入口 清理: - 删除 intelligence-client/ 目录版 (9文件 -1640行, 单文件版是活跃代码)
This commit is contained in:
@@ -31,6 +31,9 @@ import {
|
||||
type HeartbeatResult,
|
||||
type HeartbeatAlert,
|
||||
} from '../lib/intelligence-client';
|
||||
import { createLogger } from '../lib/logger';
|
||||
|
||||
const log = createLogger('HeartbeatConfig');
|
||||
|
||||
// === Default Config ===
|
||||
|
||||
@@ -312,9 +315,15 @@ export function HeartbeatConfig({ className = '', onConfigChange }: HeartbeatCon
|
||||
});
|
||||
}, []);
|
||||
|
||||
const handleSave = useCallback(() => {
|
||||
const handleSave = useCallback(async () => {
|
||||
localStorage.setItem('zclaw-heartbeat-config', JSON.stringify(config));
|
||||
localStorage.setItem('zclaw-heartbeat-checks', JSON.stringify(checkItems));
|
||||
// Sync to Rust backend (non-blocking — UI updates immediately)
|
||||
try {
|
||||
await intelligenceClient.heartbeat.updateConfig('zclaw-main', config);
|
||||
} catch (err) {
|
||||
log.warn('[HeartbeatConfig] Backend sync failed:', err);
|
||||
}
|
||||
setHasChanges(false);
|
||||
}, [config, checkItems]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user