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

@@ -509,6 +509,10 @@ function createBridgeRegistrar(context) {
writeStorage: (key, val) => inspectionStorage.writeStorage(key, val),
// 传入 sessions 用于复用终端 SSH 连接
sessions,
// 地图底图持久化:需要在主进程 userData 下写二进制图片
userDataDir,
path: require("node:path"),
fs: require("node:fs"),
});
// 给 MCP capability dispatch 里的 inspection handlers 也注入 sessions(RCA agent 用)
@@ -1194,6 +1198,63 @@ function createBridgeRegistrar(context) {
return { success: false };
}
});
// ─── 设置同步(主窗口 ↔ 远程浏览器 共享权威源) ───
// 主窗口 Electron 写设置后调这个 handler 写到 inspectionStorage,
// 这样远程浏览器 GET /api/settings 就能看到最新值
// 写完后广播给所有 renderer(主窗口实时更新)
function broadcastSettingsChanged() {
try {
for (const wc of require("electron").webContents.getAllWebContents()) {
wc.send("netcatty:settings:changed");
}
} catch {}
}
ipcMain.handle("netcatty:settings:sync", (_event, { key, value, delete: shouldDelete } = {}) => {
try {
let all = {};
const raw = inspectionStorage.readStorage("__settings__all__");
if (raw) { try { all = typeof raw === "string" ? JSON.parse(raw) : raw; } catch {} }
if (shouldDelete) {
delete all[key];
} else {
all[key] = value;
}
inspectionStorage.writeStorage("__settings__all__", JSON.stringify(all));
broadcastSettingsChanged();
return { ok: true };
} catch (e) {
return { ok: false, error: e?.message || String(e) };
}
});
ipcMain.handle("netcatty:settings:getAll", () => {
try {
const raw = inspectionStorage.readStorage("__settings__all__");
let all = {};
if (raw) { try { all = typeof raw === "string" ? JSON.parse(raw) : raw; } catch {} }
return { ok: true, settings: all };
} catch (e) {
return { ok: false, error: e?.message || String(e), settings: {} };
}
});
ipcMain.handle("netcatty:settings:syncBatch", (_event, { entries } = {}) => {
try {
let all = {};
const raw = inspectionStorage.readStorage("__settings__all__");
if (raw) { try { all = typeof raw === "string" ? JSON.parse(raw) : raw; } catch {} }
if (entries && typeof entries === "object") {
for (const [k, v] of Object.entries(entries)) {
if (v === null || v === undefined) delete all[k];
else all[k] = v;
}
}
inspectionStorage.writeStorage("__settings__all__", JSON.stringify(all));
broadcastSettingsChanged();
return { ok: true, count: entries ? Object.keys(entries).length : 0 };
} catch (e) {
return { ok: false, error: e?.message || String(e) };
}
});
console.log('[Main] All bridges registered successfully');
@@ -1205,7 +1266,8 @@ function createBridgeRegistrar(context) {
ipcMain.handle("remoteHttp:getStatus", () => remoteHttp.getStatus());
ipcMain.handle("remoteHttp:configure", (_e, enabled, port) => remoteHttp.configure(enabled, port));
// 自动启动(打包版才有意义,开发版也启方便调试)
remoteHttp.start({ storage: inspectionStorage }).catch((e) => {
// storage: inspectionStorage 共享权威源,onSettingsChanged 远程写完后广播给主窗口
remoteHttp.start({ storage: inspectionStorage, onSettingsChanged: broadcastSettingsChanged }).catch((e) => {
console.warn("[RemoteHTTP] auto-start failed:", e.message);
});
} catch (e) {