feat: add monitoring settings tab, workbench view, and inspection alert improvements
Some checks failed
AI automation / Route event (push) Has been cancelled
AI automation / Hand reopened issue to maintainers (push) Has been cancelled
AI automation / Clean source issue state (push) Has been cancelled
AI automation / Reconcile handoffs (push) Has been cancelled
AI automation / Classify issue (push) Has been cancelled
AI automation / Claude Code smoke (push) Has been cancelled
AI automation / Review issue follow-up (push) Has been cancelled
AI automation / Publish issue follow-up (push) Has been cancelled
AI automation / Implement with Claude Code (push) Has been cancelled
AI automation / Publish implement PR (push) Has been cancelled
AI automation / Continue queued issue comments (push) Has been cancelled
AI automation / Codex review loop (push) Has been cancelled
AI automation / Publish Codex fix (push) Has been cancelled
AI automation / Clear Codex dispatch marker (push) Has been cancelled
AI automation / Own PR re-request Codex (push) Has been cancelled
AI automation / External PR re-request Codex (push) Has been cancelled
AI automation / Poll Codex reaction / retry (push) Has been cancelled

This commit is contained in:
2026-10-30 12:12:04 +08:00
committed by trae-solo-agent
parent 16dd04f746
commit 4a02370006
26 changed files with 2569 additions and 233 deletions

View File

@@ -126,6 +126,59 @@ export function AppSideEffects() {
} catch {}
}, []);
// 设置权威源同步(主窗口 Electron ↔ 远程浏览器 共享权威源)
// 1. 启动时:先从权威源拉取填 localStorage(远程先改了数据不丢失),
// 再把 localStorage 里可能的新增 merge 回权威源(单条 syncBatch)
// 2. 运行时:每次 localStorageAdapter 写调 IPC → 权威源
// 3. 主进程广播:远程浏览器改了设置 → 主进程发 IPC → 主窗口静默刷新 localStorage
useEffect(() => {
const isRemote = typeof window !== "undefined" && !!(window as any).__REMOTE_TOKEN__;
if (isRemote) return; // 远程浏览器在 VaultViewLayout 里走 fetch 路径
const nc = (window as any).netcatty;
if (!nc?.settingsSync) return;
(globalThis as any).__NETCATTY_SETTINGS_SYNC__ = (key: string, value: string | null) => {
nc.settingsSync(key, value).catch(() => {});
};
// 实时更新订阅:远程浏览器改了设置 → 主进程广播 → 静默刷新 localStorage
let unsub: null | (() => void) = null;
if (nc.onSettingsChanged) {
unsub = nc.onSettingsChanged(() => { /* 静默刷新,localStorage 已被 preload 填充 */ });
}
// 启动时:先拉后推
(async () => {
try {
// ① 先从权威源拉取(远程可能先改了数据)
const remoteRes = nc.settingsGetAll ? await nc.settingsGetAll() : null;
if (remoteRes?.ok && remoteRes.settings && typeof remoteRes.settings === "object") {
// 权威源值覆盖 localStorage(远程改的优先)
for (const [k, v] of Object.entries(remoteRes.settings)) {
if (v === null || v === undefined) localStorage.removeItem(k);
else localStorage.setItem(k, String(v));
}
}
// ② 再把 localStorage 里所有键 merge 回权威源(本地可能有新增)
const all = {} as Record<string, string>;
for (let i = 0; i < localStorage.length; i++) {
const k = localStorage.key(i);
if (k) all[k] = localStorage.getItem(k) ?? "";
}
if (Object.keys(all).length > 0 && nc.settingsSyncBatch) {
await nc.settingsSyncBatch(all);
}
} catch {}
})();
return () => {
if ((globalThis as any).__NETCATTY_SETTINGS_SYNC__) {
(globalThis as any).__NETCATTY_SETTINGS_SYNC__ = null;
}
unsub?.();
};
}, []);
const [isQuickSwitcherOpen, setIsQuickSwitcherOpen] = useState(false);
const [isCreateWorkspaceOpen, setIsCreateWorkspaceOpen] = useState(false);
// Combined state for the AddToWorkspaceDialog. null = closed; mode