@quanta-intellect/vessel-browser 0.1.121 → 0.1.124
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/out/main/index.js
CHANGED
|
@@ -52,10 +52,43 @@ function createLogger(scope) {
|
|
|
52
52
|
error: (...args) => writeLog("error", scope, args)
|
|
53
53
|
};
|
|
54
54
|
}
|
|
55
|
+
const SIDEBAR_MIN_WIDTH = 240;
|
|
56
|
+
const SIDEBAR_MAX_WIDTH = 800;
|
|
57
|
+
const SIDEBAR_RESIZE_HANDLE_OVERLAP = 6;
|
|
58
|
+
const DETACHED_SIDEBAR_MIN_WIDTH = 360;
|
|
59
|
+
const DETACHED_SIDEBAR_MIN_HEIGHT = 480;
|
|
60
|
+
const DETACHED_SIDEBAR_DEFAULT_WIDTH = 420;
|
|
61
|
+
const DETACHED_SIDEBAR_DEFAULT_HEIGHT = 760;
|
|
62
|
+
function clampSidebarWidth(width) {
|
|
63
|
+
return Math.max(
|
|
64
|
+
SIDEBAR_MIN_WIDTH,
|
|
65
|
+
Math.min(SIDEBAR_MAX_WIDTH, Math.round(width))
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
function sanitizeSidebarPanelMode(value) {
|
|
69
|
+
return value === "closed" || value === "docked" || value === "detached" ? value : "docked";
|
|
70
|
+
}
|
|
71
|
+
function sanitizeSidebarDetachedBounds(value) {
|
|
72
|
+
if (!value || typeof value !== "object") return null;
|
|
73
|
+
const bounds = value;
|
|
74
|
+
const width = Number(bounds.width);
|
|
75
|
+
const height = Number(bounds.height);
|
|
76
|
+
if (!Number.isFinite(width) || !Number.isFinite(height)) return null;
|
|
77
|
+
const x = Number(bounds.x);
|
|
78
|
+
const y = Number(bounds.y);
|
|
79
|
+
return {
|
|
80
|
+
...Number.isFinite(x) ? { x: Math.round(x) } : {},
|
|
81
|
+
...Number.isFinite(y) ? { y: Math.round(y) } : {},
|
|
82
|
+
width: Math.max(DETACHED_SIDEBAR_MIN_WIDTH, Math.round(width)),
|
|
83
|
+
height: Math.max(DETACHED_SIDEBAR_MIN_HEIGHT, Math.round(height))
|
|
84
|
+
};
|
|
85
|
+
}
|
|
55
86
|
const defaults = {
|
|
56
87
|
defaultUrl: "https://start.duckduckgo.com",
|
|
57
88
|
theme: "dark",
|
|
89
|
+
sidebarPanelMode: "docked",
|
|
58
90
|
sidebarWidth: 400,
|
|
91
|
+
sidebarDetachedBounds: null,
|
|
59
92
|
mcpPort: 3100,
|
|
60
93
|
autoRestoreSession: true,
|
|
61
94
|
clearBookmarksOnLaunch: false,
|
|
@@ -258,6 +291,10 @@ function loadSettings() {
|
|
|
258
291
|
mergeChatProviderSecret(parsed.chatProvider ?? null)
|
|
259
292
|
),
|
|
260
293
|
mcpPort: sanitizePort(parsed.mcpPort ?? defaults.mcpPort),
|
|
294
|
+
sidebarPanelMode: sanitizeSidebarPanelMode(parsed.sidebarPanelMode),
|
|
295
|
+
sidebarDetachedBounds: sanitizeSidebarDetachedBounds(
|
|
296
|
+
parsed.sidebarDetachedBounds
|
|
297
|
+
),
|
|
261
298
|
sourceDoNotAllowList: sanitizeStringList(
|
|
262
299
|
parsed.sourceDoNotAllowList ?? defaults.sourceDoNotAllowList
|
|
263
300
|
),
|
|
@@ -305,6 +342,10 @@ function setSetting(key2, value) {
|
|
|
305
342
|
loadSettings();
|
|
306
343
|
if (key2 === "mcpPort") {
|
|
307
344
|
settings.mcpPort = sanitizePort(value);
|
|
345
|
+
} else if (key2 === "sidebarPanelMode") {
|
|
346
|
+
settings.sidebarPanelMode = sanitizeSidebarPanelMode(value);
|
|
347
|
+
} else if (key2 === "sidebarDetachedBounds") {
|
|
348
|
+
settings.sidebarDetachedBounds = sanitizeSidebarDetachedBounds(value);
|
|
308
349
|
} else if (key2 === "sourceDoNotAllowList") {
|
|
309
350
|
settings.sourceDoNotAllowList = sanitizeStringList(value);
|
|
310
351
|
} else if (key2 === "chatProvider") {
|
|
@@ -3431,7 +3472,7 @@ class TabManager {
|
|
|
3431
3472
|
}
|
|
3432
3473
|
}
|
|
3433
3474
|
}
|
|
3434
|
-
const Channels
|
|
3475
|
+
const Channels = {
|
|
3435
3476
|
// Tab management
|
|
3436
3477
|
TAB_CREATE: "tab:create",
|
|
3437
3478
|
TAB_CLOSE: "tab:close",
|
|
@@ -6569,7 +6610,7 @@ async function capturePageSnapshot(url, wc, sendToRendererViews) {
|
|
|
6569
6610
|
if (diff.hasChanges) {
|
|
6570
6611
|
const enrichedDiff = enrichWithBurstHistory(key2, diff);
|
|
6571
6612
|
latestPageDiffs.set(key2, enrichedDiff);
|
|
6572
|
-
sendToRendererViews(Channels
|
|
6613
|
+
sendToRendererViews(Channels.PAGE_CHANGED, enrichedDiff);
|
|
6573
6614
|
} else {
|
|
6574
6615
|
latestPageDiffs.delete(key2);
|
|
6575
6616
|
}
|
|
@@ -6634,10 +6675,39 @@ function schedulePageSnapshotCapture(wc, sendToRendererViews, delayMs = 0, optio
|
|
|
6634
6675
|
}
|
|
6635
6676
|
scheduleTimerAt(wc, sendToRendererViews, nextDueAt, options);
|
|
6636
6677
|
}
|
|
6637
|
-
|
|
6638
|
-
|
|
6639
|
-
|
|
6640
|
-
|
|
6678
|
+
function setSidebarPanelMode(state2, mode, reason = "user") {
|
|
6679
|
+
state2.uiState.sidebarPanelMode = mode;
|
|
6680
|
+
if (reason === "user") {
|
|
6681
|
+
setSetting("sidebarPanelMode", mode);
|
|
6682
|
+
}
|
|
6683
|
+
}
|
|
6684
|
+
function persistDetachedBounds(state2) {
|
|
6685
|
+
const sidebarWindow = state2.sidebarWindow;
|
|
6686
|
+
if (!sidebarWindow || sidebarWindow.isDestroyed()) return;
|
|
6687
|
+
const bounds = sidebarWindow.getBounds();
|
|
6688
|
+
state2.uiState.sidebarDetachedBounds = {
|
|
6689
|
+
x: bounds.x,
|
|
6690
|
+
y: bounds.y,
|
|
6691
|
+
width: bounds.width,
|
|
6692
|
+
height: bounds.height
|
|
6693
|
+
};
|
|
6694
|
+
setSetting("sidebarDetachedBounds", state2.uiState.sidebarDetachedBounds);
|
|
6695
|
+
}
|
|
6696
|
+
function closeDetachedSidebarWindow(state2) {
|
|
6697
|
+
const sidebarWindow = state2.sidebarWindow;
|
|
6698
|
+
if (!sidebarWindow) return false;
|
|
6699
|
+
state2.sidebarWindow = null;
|
|
6700
|
+
state2.sidebarWindowClosing = true;
|
|
6701
|
+
sidebarWindow.once("closed", () => {
|
|
6702
|
+
state2.sidebarWindowClosing = false;
|
|
6703
|
+
});
|
|
6704
|
+
sidebarWindow.close();
|
|
6705
|
+
return true;
|
|
6706
|
+
}
|
|
6707
|
+
function moveSidebarToMainWindow(state2) {
|
|
6708
|
+
state2.sidebarWindow?.contentView.removeChildView(state2.sidebarView);
|
|
6709
|
+
state2.mainWindow.contentView.addChildView(state2.sidebarView);
|
|
6710
|
+
}
|
|
6641
6711
|
function getSidebarPanelState(state2) {
|
|
6642
6712
|
return {
|
|
6643
6713
|
open: state2.uiState.sidebarPanelMode !== "closed",
|
|
@@ -6648,11 +6718,11 @@ function getSidebarPanelState(state2) {
|
|
|
6648
6718
|
function emitSidebarPanelState(state2) {
|
|
6649
6719
|
const panelState = getSidebarPanelState(state2);
|
|
6650
6720
|
if (!state2.chromeView.webContents.isDestroyed()) {
|
|
6651
|
-
state2.chromeView.webContents.send(Channels
|
|
6721
|
+
state2.chromeView.webContents.send(Channels.SIDEBAR_STATE_UPDATE, panelState);
|
|
6652
6722
|
}
|
|
6653
6723
|
if (!state2.sidebarView.webContents.isDestroyed()) {
|
|
6654
6724
|
state2.sidebarView.webContents.send(
|
|
6655
|
-
Channels
|
|
6725
|
+
Channels.SIDEBAR_STATE_UPDATE,
|
|
6656
6726
|
panelState
|
|
6657
6727
|
);
|
|
6658
6728
|
}
|
|
@@ -6664,24 +6734,17 @@ function isSidebarAttached(state2) {
|
|
|
6664
6734
|
function isSidebarDetached(state2) {
|
|
6665
6735
|
return state2.uiState.sidebarPanelMode === "detached";
|
|
6666
6736
|
}
|
|
6667
|
-
function closeSidebar(state2, relayout) {
|
|
6668
|
-
|
|
6669
|
-
|
|
6670
|
-
state2
|
|
6671
|
-
sidebarWindow.contentView.removeChildView(state2.sidebarView);
|
|
6672
|
-
state2.mainWindow.contentView.addChildView(state2.sidebarView);
|
|
6673
|
-
state2.sidebarWindowClosing = true;
|
|
6674
|
-
sidebarWindow.once("closed", () => {
|
|
6675
|
-
state2.sidebarWindowClosing = false;
|
|
6676
|
-
});
|
|
6677
|
-
sidebarWindow.close();
|
|
6737
|
+
function closeSidebar(state2, relayout, reason = "user") {
|
|
6738
|
+
if (state2.sidebarWindow) {
|
|
6739
|
+
moveSidebarToMainWindow(state2);
|
|
6740
|
+
closeDetachedSidebarWindow(state2);
|
|
6678
6741
|
}
|
|
6679
|
-
state2
|
|
6742
|
+
setSidebarPanelMode(state2, "closed", reason);
|
|
6680
6743
|
relayout();
|
|
6681
6744
|
return emitSidebarPanelState(state2);
|
|
6682
6745
|
}
|
|
6683
6746
|
function openDockedSidebar(state2, relayout) {
|
|
6684
|
-
state2
|
|
6747
|
+
setSidebarPanelMode(state2, "docked");
|
|
6685
6748
|
relayout();
|
|
6686
6749
|
return emitSidebarPanelState(state2);
|
|
6687
6750
|
}
|
|
@@ -6690,7 +6753,10 @@ function toggleDockedSidebar(state2, relayout) {
|
|
|
6690
6753
|
state2.sidebarWindow?.focus();
|
|
6691
6754
|
return getSidebarPanelState(state2);
|
|
6692
6755
|
}
|
|
6693
|
-
|
|
6756
|
+
setSidebarPanelMode(
|
|
6757
|
+
state2,
|
|
6758
|
+
state2.uiState.sidebarPanelMode === "docked" ? "closed" : "docked"
|
|
6759
|
+
);
|
|
6694
6760
|
relayout();
|
|
6695
6761
|
return emitSidebarPanelState(state2);
|
|
6696
6762
|
}
|
|
@@ -6704,11 +6770,16 @@ function detachSidebar(state2, hooks) {
|
|
|
6704
6770
|
state2.sidebarWindow.focus();
|
|
6705
6771
|
return getSidebarPanelState(state2);
|
|
6706
6772
|
}
|
|
6773
|
+
const detachedBounds = state2.uiState.sidebarDetachedBounds;
|
|
6774
|
+
const detachedWidth = detachedBounds?.width ?? Math.max(DETACHED_SIDEBAR_DEFAULT_WIDTH, state2.uiState.sidebarWidth);
|
|
6775
|
+
const detachedHeight = detachedBounds?.height ?? DETACHED_SIDEBAR_DEFAULT_HEIGHT;
|
|
6707
6776
|
const sidebarWindow = new electron.BaseWindow({
|
|
6708
|
-
|
|
6709
|
-
|
|
6710
|
-
|
|
6711
|
-
|
|
6777
|
+
...typeof detachedBounds?.x === "number" ? { x: detachedBounds.x } : {},
|
|
6778
|
+
...typeof detachedBounds?.y === "number" ? { y: detachedBounds.y } : {},
|
|
6779
|
+
width: Math.max(DETACHED_SIDEBAR_MIN_WIDTH, Math.round(detachedWidth)),
|
|
6780
|
+
height: Math.max(DETACHED_SIDEBAR_MIN_HEIGHT, Math.round(detachedHeight)),
|
|
6781
|
+
minWidth: DETACHED_SIDEBAR_MIN_WIDTH,
|
|
6782
|
+
minHeight: DETACHED_SIDEBAR_MIN_HEIGHT,
|
|
6712
6783
|
frame: true,
|
|
6713
6784
|
show: false,
|
|
6714
6785
|
backgroundColor: "#1a1a1e",
|
|
@@ -6718,8 +6789,12 @@ function detachSidebar(state2, hooks) {
|
|
|
6718
6789
|
state2.mainWindow.contentView.removeChildView(state2.sidebarView);
|
|
6719
6790
|
sidebarWindow.contentView.addChildView(state2.sidebarView);
|
|
6720
6791
|
state2.sidebarWindow = sidebarWindow;
|
|
6721
|
-
state2
|
|
6722
|
-
sidebarWindow.on("resize", () =>
|
|
6792
|
+
setSidebarPanelMode(state2, "detached");
|
|
6793
|
+
sidebarWindow.on("resize", () => {
|
|
6794
|
+
layoutDetachedSidebar(state2);
|
|
6795
|
+
persistDetachedBounds(state2);
|
|
6796
|
+
});
|
|
6797
|
+
sidebarWindow.on("move", () => persistDetachedBounds(state2));
|
|
6723
6798
|
sidebarWindow.on("close", (event) => {
|
|
6724
6799
|
if (state2.sidebarWindowClosing) return;
|
|
6725
6800
|
event.preventDefault();
|
|
@@ -6728,7 +6803,7 @@ function detachSidebar(state2, hooks) {
|
|
|
6728
6803
|
sidebarWindow.on("closed", () => {
|
|
6729
6804
|
if (state2.sidebarWindow !== sidebarWindow) return;
|
|
6730
6805
|
state2.sidebarWindow = null;
|
|
6731
|
-
state2
|
|
6806
|
+
setSidebarPanelMode(state2, "docked");
|
|
6732
6807
|
state2.mainWindow.contentView.addChildView(state2.sidebarView);
|
|
6733
6808
|
hooks.relayout();
|
|
6734
6809
|
emitSidebarPanelState(state2);
|
|
@@ -6742,20 +6817,14 @@ function detachSidebar(state2, hooks) {
|
|
|
6742
6817
|
function dockSidebar(state2, hooks) {
|
|
6743
6818
|
const sidebarWindow = state2.sidebarWindow;
|
|
6744
6819
|
if (!sidebarWindow) {
|
|
6745
|
-
state2
|
|
6820
|
+
setSidebarPanelMode(state2, "docked");
|
|
6746
6821
|
hooks.relayout();
|
|
6747
6822
|
return emitSidebarPanelState(state2);
|
|
6748
6823
|
}
|
|
6749
|
-
state2
|
|
6750
|
-
state2
|
|
6751
|
-
sidebarWindow.contentView.removeChildView(state2.sidebarView);
|
|
6752
|
-
state2.mainWindow.contentView.addChildView(state2.sidebarView);
|
|
6824
|
+
setSidebarPanelMode(state2, "docked");
|
|
6825
|
+
moveSidebarToMainWindow(state2);
|
|
6753
6826
|
hooks.relayout();
|
|
6754
|
-
state2
|
|
6755
|
-
sidebarWindow.once("closed", () => {
|
|
6756
|
-
state2.sidebarWindowClosing = false;
|
|
6757
|
-
});
|
|
6758
|
-
sidebarWindow.close();
|
|
6827
|
+
closeDetachedSidebarWindow(state2);
|
|
6759
6828
|
state2.mainWindow.focus();
|
|
6760
6829
|
return emitSidebarPanelState(state2);
|
|
6761
6830
|
}
|
|
@@ -6956,8 +7025,9 @@ function createMainWindow(onTabStateChange) {
|
|
|
6956
7025
|
enableClipboardShortcuts(devtoolsPanelView);
|
|
6957
7026
|
const settings2 = loadSettings();
|
|
6958
7027
|
const uiState = {
|
|
6959
|
-
sidebarPanelMode: "docked",
|
|
7028
|
+
sidebarPanelMode: settings2.sidebarPanelMode === "detached" ? "docked" : settings2.sidebarPanelMode,
|
|
6960
7029
|
sidebarWidth: settings2.sidebarWidth,
|
|
7030
|
+
sidebarDetachedBounds: settings2.sidebarDetachedBounds,
|
|
6961
7031
|
focusMode: false,
|
|
6962
7032
|
settingsOpen: false,
|
|
6963
7033
|
devtoolsPanelOpen: false,
|
|
@@ -6987,11 +7057,7 @@ function createMainWindow(onTabStateChange) {
|
|
|
6987
7057
|
mainWindow.on("show", () => layoutViews(state2));
|
|
6988
7058
|
mainWindow.on("focus", () => layoutViews(state2));
|
|
6989
7059
|
mainWindow.on("closed", () => {
|
|
6990
|
-
|
|
6991
|
-
if (!sidebarWindow) return;
|
|
6992
|
-
state2.sidebarWindow = null;
|
|
6993
|
-
state2.sidebarWindowClosing = true;
|
|
6994
|
-
sidebarWindow.close();
|
|
7060
|
+
closeDetachedSidebarWindow(state2);
|
|
6995
7061
|
});
|
|
6996
7062
|
sidebarView.webContents.on("context-menu", (event, params) => {
|
|
6997
7063
|
event.preventDefault();
|
|
@@ -7002,6 +7068,9 @@ function createMainWindow(onTabStateChange) {
|
|
|
7002
7068
|
);
|
|
7003
7069
|
});
|
|
7004
7070
|
layoutViews(state2);
|
|
7071
|
+
if (settings2.sidebarPanelMode === "detached") {
|
|
7072
|
+
detachSidebar(state2, { relayout: () => layoutViews(state2), getWindowIconPath });
|
|
7073
|
+
}
|
|
7005
7074
|
return state2;
|
|
7006
7075
|
}
|
|
7007
7076
|
function layoutViews(state2) {
|
|
@@ -7024,12 +7093,11 @@ function layoutViews(state2) {
|
|
|
7024
7093
|
} else {
|
|
7025
7094
|
chromeView.setBounds({ x: 0, y: 0, width, height: chromeHeight });
|
|
7026
7095
|
}
|
|
7027
|
-
const resizeHandleOverlap = 6;
|
|
7028
7096
|
if (sidebarAttached) {
|
|
7029
7097
|
sidebarView.setBounds({
|
|
7030
|
-
x: width - sidebarWidth -
|
|
7098
|
+
x: width - sidebarWidth - SIDEBAR_RESIZE_HANDLE_OVERLAP,
|
|
7031
7099
|
y: chromeHeight,
|
|
7032
|
-
width: sidebarWidth +
|
|
7100
|
+
width: sidebarWidth + SIDEBAR_RESIZE_HANDLE_OVERLAP,
|
|
7033
7101
|
height: height - chromeHeight
|
|
7034
7102
|
});
|
|
7035
7103
|
} else if (uiState.sidebarPanelMode === "closed") {
|
|
@@ -7070,13 +7138,12 @@ function resizeSidebarViews(state2) {
|
|
|
7070
7138
|
const chromeHeight = uiState.focusMode ? 0 : CHROME_HEIGHT;
|
|
7071
7139
|
const sidebarWidth = isSidebarAttached(state2) ? uiState.sidebarWidth : 0;
|
|
7072
7140
|
const devtoolsHeight = uiState.devtoolsPanelOpen ? uiState.devtoolsPanelHeight : 0;
|
|
7073
|
-
const resizeHandleOverlap = 6;
|
|
7074
7141
|
const contentWidth = width - sidebarWidth;
|
|
7075
7142
|
if (uiState.sidebarPanelMode !== "detached") {
|
|
7076
7143
|
sidebarView.setBounds({
|
|
7077
|
-
x: width - sidebarWidth -
|
|
7144
|
+
x: width - sidebarWidth - SIDEBAR_RESIZE_HANDLE_OVERLAP,
|
|
7078
7145
|
y: chromeHeight,
|
|
7079
|
-
width: sidebarWidth +
|
|
7146
|
+
width: sidebarWidth + SIDEBAR_RESIZE_HANDLE_OVERLAP,
|
|
7080
7147
|
height: height - chromeHeight
|
|
7081
7148
|
});
|
|
7082
7149
|
}
|
|
@@ -24839,13 +24906,13 @@ async function fireJob(job, windowState, runtime2) {
|
|
|
24839
24906
|
startedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
24840
24907
|
output: ""
|
|
24841
24908
|
};
|
|
24842
|
-
send(Channels
|
|
24909
|
+
send(Channels.AUTOMATION_ACTIVITY_START, entry);
|
|
24843
24910
|
};
|
|
24844
24911
|
const appendActivity = (chunk) => {
|
|
24845
|
-
send(Channels
|
|
24912
|
+
send(Channels.AUTOMATION_ACTIVITY_CHUNK, { id: activityId, chunk });
|
|
24846
24913
|
};
|
|
24847
24914
|
const finishActivity = (status) => {
|
|
24848
|
-
send(Channels
|
|
24915
|
+
send(Channels.AUTOMATION_ACTIVITY_END, {
|
|
24849
24916
|
id: activityId,
|
|
24850
24917
|
status,
|
|
24851
24918
|
finishedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
@@ -24912,7 +24979,7 @@ function tick(windowState, runtime2) {
|
|
|
24912
24979
|
job.nextRunAt = computeNextRun(job.schedule, firedAt).toISOString();
|
|
24913
24980
|
}
|
|
24914
24981
|
saveJobs();
|
|
24915
|
-
broadcastFn?.(Channels
|
|
24982
|
+
broadcastFn?.(Channels.SCHEDULE_JOBS_UPDATE, jobs);
|
|
24916
24983
|
void fireJob(job, windowState, runtime2).catch((err) => {
|
|
24917
24984
|
logger$b.warn("Unexpected error firing job:", err);
|
|
24918
24985
|
}).finally(fireNext);
|
|
@@ -24934,11 +25001,11 @@ function registerScheduleHandlers(windowState, runtime2, sendToAll) {
|
|
|
24934
25001
|
tick(windowState, runtime2);
|
|
24935
25002
|
pollInterval = setInterval(() => tick(windowState, runtime2), 6e4);
|
|
24936
25003
|
}, msToNextMinute);
|
|
24937
|
-
electron.ipcMain.handle(Channels
|
|
25004
|
+
electron.ipcMain.handle(Channels.SCHEDULE_GET_ALL, (event) => {
|
|
24938
25005
|
assertTrustedIpcSender(event);
|
|
24939
25006
|
return jobs;
|
|
24940
25007
|
});
|
|
24941
|
-
electron.ipcMain.handle(Channels
|
|
25008
|
+
electron.ipcMain.handle(Channels.SCHEDULE_CREATE, (event, rawJob) => {
|
|
24942
25009
|
assertTrustedIpcSender(event);
|
|
24943
25010
|
if (!isValidJobData(rawJob)) {
|
|
24944
25011
|
throw new Error(
|
|
@@ -24953,10 +25020,10 @@ function registerScheduleHandlers(windowState, runtime2, sendToAll) {
|
|
|
24953
25020
|
};
|
|
24954
25021
|
jobs.push(newJob);
|
|
24955
25022
|
saveJobs();
|
|
24956
|
-
sendToAll(Channels
|
|
25023
|
+
sendToAll(Channels.SCHEDULE_JOBS_UPDATE, jobs);
|
|
24957
25024
|
return newJob;
|
|
24958
25025
|
});
|
|
24959
|
-
electron.ipcMain.handle(Channels
|
|
25026
|
+
electron.ipcMain.handle(Channels.SCHEDULE_UPDATE, (event, id, updates) => {
|
|
24960
25027
|
assertTrustedIpcSender(event);
|
|
24961
25028
|
if (typeof id !== "string") throw new Error("id must be a string");
|
|
24962
25029
|
const job = jobs.find((j) => j.id === id);
|
|
@@ -24980,17 +25047,17 @@ function registerScheduleHandlers(windowState, runtime2, sendToAll) {
|
|
|
24980
25047
|
}
|
|
24981
25048
|
}
|
|
24982
25049
|
saveJobs();
|
|
24983
|
-
sendToAll(Channels
|
|
25050
|
+
sendToAll(Channels.SCHEDULE_JOBS_UPDATE, jobs);
|
|
24984
25051
|
return job;
|
|
24985
25052
|
});
|
|
24986
|
-
electron.ipcMain.handle(Channels
|
|
25053
|
+
electron.ipcMain.handle(Channels.SCHEDULE_DELETE, (event, id) => {
|
|
24987
25054
|
assertTrustedIpcSender(event);
|
|
24988
25055
|
if (typeof id !== "string") throw new Error("id must be a string");
|
|
24989
25056
|
const before = jobs.length;
|
|
24990
25057
|
jobs = jobs.filter((j) => j.id !== id);
|
|
24991
25058
|
if (jobs.length === before) return false;
|
|
24992
25059
|
saveJobs();
|
|
24993
|
-
sendToAll(Channels
|
|
25060
|
+
sendToAll(Channels.SCHEDULE_JOBS_UPDATE, jobs);
|
|
24994
25061
|
return true;
|
|
24995
25062
|
});
|
|
24996
25063
|
}
|
|
@@ -25347,28 +25414,28 @@ function sanitizeAutofillUpdates(value) {
|
|
|
25347
25414
|
return updates;
|
|
25348
25415
|
}
|
|
25349
25416
|
function registerAutofillHandlers(windowState) {
|
|
25350
|
-
electron.ipcMain.handle(Channels
|
|
25417
|
+
electron.ipcMain.handle(Channels.AUTOFILL_LIST, (event) => {
|
|
25351
25418
|
assertTrustedIpcSender(event);
|
|
25352
25419
|
return listProfiles();
|
|
25353
25420
|
});
|
|
25354
25421
|
electron.ipcMain.handle(
|
|
25355
|
-
Channels
|
|
25422
|
+
Channels.AUTOFILL_ADD,
|
|
25356
25423
|
(event, profile) => {
|
|
25357
25424
|
assertTrustedIpcSender(event);
|
|
25358
25425
|
return addProfile(sanitizeAutofillProfile(profile));
|
|
25359
25426
|
}
|
|
25360
25427
|
);
|
|
25361
|
-
electron.ipcMain.handle(Channels
|
|
25428
|
+
electron.ipcMain.handle(Channels.AUTOFILL_UPDATE, (event, id, updates) => {
|
|
25362
25429
|
assertTrustedIpcSender(event);
|
|
25363
25430
|
assertString(id, "id");
|
|
25364
25431
|
return updateProfile(id, sanitizeAutofillUpdates(updates));
|
|
25365
25432
|
});
|
|
25366
|
-
electron.ipcMain.handle(Channels
|
|
25433
|
+
electron.ipcMain.handle(Channels.AUTOFILL_DELETE, (event, id) => {
|
|
25367
25434
|
assertTrustedIpcSender(event);
|
|
25368
25435
|
assertString(id, "id");
|
|
25369
25436
|
return deleteProfile(id);
|
|
25370
25437
|
});
|
|
25371
|
-
electron.ipcMain.handle(Channels
|
|
25438
|
+
electron.ipcMain.handle(Channels.AUTOFILL_FILL, async (event, profileId) => {
|
|
25372
25439
|
assertTrustedIpcSender(event);
|
|
25373
25440
|
assertString(profileId, "profileId");
|
|
25374
25441
|
const profile = getProfile(profileId);
|
|
@@ -25416,14 +25483,14 @@ function registerPageDiffHandlers(windowState, sendToRendererViews) {
|
|
|
25416
25483
|
bucket.count += 1;
|
|
25417
25484
|
return bucket.count <= 20;
|
|
25418
25485
|
};
|
|
25419
|
-
electron.ipcMain.handle(Channels
|
|
25486
|
+
electron.ipcMain.handle(Channels.PAGE_DIFF_GET, (event) => {
|
|
25420
25487
|
assertTrustedIpcSender(event);
|
|
25421
25488
|
const activeTab = windowState.tabManager.getActiveTab();
|
|
25422
25489
|
const wc = activeTab?.view.webContents;
|
|
25423
25490
|
if (!wc) return null;
|
|
25424
25491
|
return getLatestPageDiff(wc.getURL());
|
|
25425
25492
|
});
|
|
25426
|
-
electron.ipcMain.handle(Channels
|
|
25493
|
+
electron.ipcMain.handle(Channels.PAGE_DIFF_HISTORY, (event) => {
|
|
25427
25494
|
assertTrustedIpcSender(event);
|
|
25428
25495
|
try {
|
|
25429
25496
|
if (!isPremiumActiveState(getPremiumState())) {
|
|
@@ -25437,7 +25504,7 @@ function registerPageDiffHandlers(windowState, sendToRendererViews) {
|
|
|
25437
25504
|
return [];
|
|
25438
25505
|
}
|
|
25439
25506
|
});
|
|
25440
|
-
electron.ipcMain.on(Channels
|
|
25507
|
+
electron.ipcMain.on(Channels.PAGE_DIFF_ACTIVITY, (event) => {
|
|
25441
25508
|
const wc = event.sender;
|
|
25442
25509
|
if (!wc || wc.isDestroyed()) return;
|
|
25443
25510
|
if (!isManagedTabIpcSender(event, windowState.tabManager)) return;
|
|
@@ -25447,7 +25514,7 @@ function registerPageDiffHandlers(windowState, sendToRendererViews) {
|
|
|
25447
25514
|
isActive: () => isActiveWebContents(wc.id)
|
|
25448
25515
|
});
|
|
25449
25516
|
});
|
|
25450
|
-
electron.ipcMain.on(Channels
|
|
25517
|
+
electron.ipcMain.on(Channels.PAGE_DIFF_DIRTY, (event) => {
|
|
25451
25518
|
const wc = event.sender;
|
|
25452
25519
|
if (!wc || wc.isDestroyed()) return;
|
|
25453
25520
|
if (!isManagedTabIpcSender(event, windowState.tabManager)) return;
|
|
@@ -25518,11 +25585,11 @@ function renderReportAsMarkdown(report, traces) {
|
|
|
25518
25585
|
}
|
|
25519
25586
|
const logger$a = createLogger("ResearchIPC");
|
|
25520
25587
|
function registerResearchHandlers(getOrchestrator) {
|
|
25521
|
-
electron.ipcMain.handle(Channels
|
|
25588
|
+
electron.ipcMain.handle(Channels.RESEARCH_STATE_GET, () => {
|
|
25522
25589
|
return getOrchestrator().getState();
|
|
25523
25590
|
});
|
|
25524
25591
|
electron.ipcMain.handle(
|
|
25525
|
-
Channels
|
|
25592
|
+
Channels.RESEARCH_START_BRIEF,
|
|
25526
25593
|
async (_event, query) => {
|
|
25527
25594
|
try {
|
|
25528
25595
|
const trimmedQuery = query.trim();
|
|
@@ -25540,7 +25607,7 @@ function registerResearchHandlers(getOrchestrator) {
|
|
|
25540
25607
|
}
|
|
25541
25608
|
}
|
|
25542
25609
|
);
|
|
25543
|
-
electron.ipcMain.handle(Channels
|
|
25610
|
+
electron.ipcMain.handle(Channels.RESEARCH_CONFIRM_BRIEF, () => {
|
|
25544
25611
|
try {
|
|
25545
25612
|
if (isToolGated("research_confirm_brief")) {
|
|
25546
25613
|
return { accepted: false, reason: "premium" };
|
|
@@ -25557,7 +25624,7 @@ function registerResearchHandlers(getOrchestrator) {
|
|
|
25557
25624
|
}
|
|
25558
25625
|
});
|
|
25559
25626
|
electron.ipcMain.handle(
|
|
25560
|
-
Channels
|
|
25627
|
+
Channels.RESEARCH_APPROVE_OBJECTIVES,
|
|
25561
25628
|
(_event, options) => {
|
|
25562
25629
|
try {
|
|
25563
25630
|
if (isToolGated("research_approve_objectives")) {
|
|
@@ -25583,24 +25650,24 @@ function registerResearchHandlers(getOrchestrator) {
|
|
|
25583
25650
|
}
|
|
25584
25651
|
);
|
|
25585
25652
|
electron.ipcMain.handle(
|
|
25586
|
-
Channels
|
|
25653
|
+
Channels.RESEARCH_SET_MODE,
|
|
25587
25654
|
(_event, mode) => {
|
|
25588
25655
|
getOrchestrator().setSupervisionMode(mode);
|
|
25589
25656
|
}
|
|
25590
25657
|
);
|
|
25591
25658
|
electron.ipcMain.handle(
|
|
25592
|
-
Channels
|
|
25659
|
+
Channels.RESEARCH_SET_TRACES,
|
|
25593
25660
|
(_event, include) => {
|
|
25594
25661
|
getOrchestrator().setIncludeTraces(include);
|
|
25595
25662
|
}
|
|
25596
25663
|
);
|
|
25597
|
-
electron.ipcMain.handle(Channels
|
|
25664
|
+
electron.ipcMain.handle(Channels.RESEARCH_CANCEL, () => {
|
|
25598
25665
|
getOrchestrator().cancel();
|
|
25599
25666
|
});
|
|
25600
|
-
electron.ipcMain.handle(Channels
|
|
25667
|
+
electron.ipcMain.handle(Channels.RESEARCH_STOP_AND_SYNTHESIZE, () => {
|
|
25601
25668
|
getOrchestrator().stopAndSynthesizeCurrentFindings();
|
|
25602
25669
|
});
|
|
25603
|
-
electron.ipcMain.handle(Channels
|
|
25670
|
+
electron.ipcMain.handle(Channels.RESEARCH_EXPORT_REPORT, async () => {
|
|
25604
25671
|
try {
|
|
25605
25672
|
if (isToolGated("research_export_report")) {
|
|
25606
25673
|
return { accepted: false, reason: "premium" };
|
|
@@ -26419,13 +26486,13 @@ function assertVaultUnlocked() {
|
|
|
26419
26486
|
assertFeatureUnlocked("vault", "Agent Credential Vault");
|
|
26420
26487
|
}
|
|
26421
26488
|
function registerVaultHandlers() {
|
|
26422
|
-
electron.ipcMain.handle(Channels
|
|
26489
|
+
electron.ipcMain.handle(Channels.VAULT_LIST, (event) => {
|
|
26423
26490
|
assertTrustedIpcSender(event);
|
|
26424
26491
|
assertVaultUnlocked();
|
|
26425
26492
|
return listEntries$1();
|
|
26426
26493
|
});
|
|
26427
26494
|
electron.ipcMain.handle(
|
|
26428
|
-
Channels
|
|
26495
|
+
Channels.VAULT_ADD,
|
|
26429
26496
|
(event, entry) => {
|
|
26430
26497
|
assertTrustedIpcSender(event);
|
|
26431
26498
|
assertVaultUnlocked();
|
|
@@ -26452,7 +26519,7 @@ function registerVaultHandlers() {
|
|
|
26452
26519
|
}
|
|
26453
26520
|
);
|
|
26454
26521
|
electron.ipcMain.handle(
|
|
26455
|
-
Channels
|
|
26522
|
+
Channels.VAULT_UPDATE,
|
|
26456
26523
|
(event, id, updates) => {
|
|
26457
26524
|
assertTrustedIpcSender(event);
|
|
26458
26525
|
assertVaultUnlocked();
|
|
@@ -26463,14 +26530,14 @@ function registerVaultHandlers() {
|
|
|
26463
26530
|
return updateEntry$1(id, updates) !== null;
|
|
26464
26531
|
}
|
|
26465
26532
|
);
|
|
26466
|
-
electron.ipcMain.handle(Channels
|
|
26533
|
+
electron.ipcMain.handle(Channels.VAULT_REMOVE, (event, id) => {
|
|
26467
26534
|
assertTrustedIpcSender(event);
|
|
26468
26535
|
assertVaultUnlocked();
|
|
26469
26536
|
assertString(id, "id");
|
|
26470
26537
|
trackVaultAction("credential_removed");
|
|
26471
26538
|
return removeEntry$1(id);
|
|
26472
26539
|
});
|
|
26473
|
-
electron.ipcMain.handle(Channels
|
|
26540
|
+
electron.ipcMain.handle(Channels.VAULT_AUDIT_LOG, (event, limit) => {
|
|
26474
26541
|
assertTrustedIpcSender(event);
|
|
26475
26542
|
assertVaultUnlocked();
|
|
26476
26543
|
return readAuditLog$1(limit);
|
|
@@ -26494,20 +26561,20 @@ function assertHumanVaultUnlocked() {
|
|
|
26494
26561
|
assertFeatureUnlocked("human_vault", "Passwords");
|
|
26495
26562
|
}
|
|
26496
26563
|
function registerHumanVaultHandlers() {
|
|
26497
|
-
electron.ipcMain.handle(Channels
|
|
26564
|
+
electron.ipcMain.handle(Channels.HUMAN_VAULT_LIST, (event, domain) => {
|
|
26498
26565
|
assertTrustedIpcSender(event);
|
|
26499
26566
|
assertHumanVaultUnlocked();
|
|
26500
26567
|
if (domain !== void 0) assertString(domain, "domain");
|
|
26501
26568
|
return domain ? findForDomain(domain) : listEntries();
|
|
26502
26569
|
});
|
|
26503
|
-
electron.ipcMain.handle(Channels
|
|
26570
|
+
electron.ipcMain.handle(Channels.HUMAN_VAULT_GET, (event, id) => {
|
|
26504
26571
|
assertTrustedIpcSender(event);
|
|
26505
26572
|
assertHumanVaultUnlocked();
|
|
26506
26573
|
assertString(id, "id");
|
|
26507
26574
|
return getEntrySafe(id);
|
|
26508
26575
|
});
|
|
26509
26576
|
electron.ipcMain.handle(
|
|
26510
|
-
Channels
|
|
26577
|
+
Channels.HUMAN_VAULT_SAVE,
|
|
26511
26578
|
(event, input) => {
|
|
26512
26579
|
assertTrustedIpcSender(event);
|
|
26513
26580
|
assertHumanVaultUnlocked();
|
|
@@ -26539,7 +26606,7 @@ function registerHumanVaultHandlers() {
|
|
|
26539
26606
|
}
|
|
26540
26607
|
);
|
|
26541
26608
|
electron.ipcMain.handle(
|
|
26542
|
-
Channels
|
|
26609
|
+
Channels.HUMAN_VAULT_UPDATE,
|
|
26543
26610
|
(event, id, updates) => {
|
|
26544
26611
|
assertTrustedIpcSender(event);
|
|
26545
26612
|
assertHumanVaultUnlocked();
|
|
@@ -26584,24 +26651,24 @@ function registerHumanVaultHandlers() {
|
|
|
26584
26651
|
return safe;
|
|
26585
26652
|
}
|
|
26586
26653
|
);
|
|
26587
|
-
electron.ipcMain.handle(Channels
|
|
26654
|
+
electron.ipcMain.handle(Channels.HUMAN_VAULT_REMOVE, (event, id) => {
|
|
26588
26655
|
assertTrustedIpcSender(event);
|
|
26589
26656
|
assertHumanVaultUnlocked();
|
|
26590
26657
|
assertString(id, "id");
|
|
26591
26658
|
return removeEntry(id);
|
|
26592
26659
|
});
|
|
26593
|
-
electron.ipcMain.handle(Channels
|
|
26660
|
+
electron.ipcMain.handle(Channels.HUMAN_VAULT_AUDIT_LOG, (event, limit) => {
|
|
26594
26661
|
assertTrustedIpcSender(event);
|
|
26595
26662
|
assertHumanVaultUnlocked();
|
|
26596
26663
|
return readAuditLog(limit);
|
|
26597
26664
|
});
|
|
26598
26665
|
}
|
|
26599
26666
|
function registerWindowControlHandlers(mainWindow) {
|
|
26600
|
-
electron.ipcMain.handle(Channels
|
|
26667
|
+
electron.ipcMain.handle(Channels.WINDOW_MINIMIZE, (event) => {
|
|
26601
26668
|
assertTrustedIpcSender(event);
|
|
26602
26669
|
mainWindow.minimize();
|
|
26603
26670
|
});
|
|
26604
|
-
electron.ipcMain.handle(Channels
|
|
26671
|
+
electron.ipcMain.handle(Channels.WINDOW_MAXIMIZE, (event) => {
|
|
26605
26672
|
assertTrustedIpcSender(event);
|
|
26606
26673
|
if (mainWindow.isMaximized()) {
|
|
26607
26674
|
mainWindow.unmaximize();
|
|
@@ -26609,7 +26676,7 @@ function registerWindowControlHandlers(mainWindow) {
|
|
|
26609
26676
|
mainWindow.maximize();
|
|
26610
26677
|
}
|
|
26611
26678
|
});
|
|
26612
|
-
electron.ipcMain.handle(Channels
|
|
26679
|
+
electron.ipcMain.handle(Channels.WINDOW_CLOSE, (event) => {
|
|
26613
26680
|
assertTrustedIpcSender(event);
|
|
26614
26681
|
mainWindow.close();
|
|
26615
26682
|
});
|
|
@@ -26801,7 +26868,7 @@ function persist() {
|
|
|
26801
26868
|
persistence$1.schedule();
|
|
26802
26869
|
}
|
|
26803
26870
|
function emit$1() {
|
|
26804
|
-
broadcaster$1?.(Channels
|
|
26871
|
+
broadcaster$1?.(Channels.DOWNLOADS_UPDATE, listDownloads());
|
|
26805
26872
|
}
|
|
26806
26873
|
function setDownloadBroadcaster(fn) {
|
|
26807
26874
|
broadcaster$1 = fn;
|
|
@@ -26901,19 +26968,19 @@ function installDownloadHandlerForSession(targetSession, chromeView) {
|
|
|
26901
26968
|
state: "progressing"
|
|
26902
26969
|
};
|
|
26903
26970
|
const record = upsertDownload(info);
|
|
26904
|
-
send(Channels
|
|
26971
|
+
send(Channels.DOWNLOAD_STARTED, { ...info, id: record.id, startedAt: record.startedAt, updatedAt: record.updatedAt });
|
|
26905
26972
|
item.on("updated", (_event2, state2) => {
|
|
26906
26973
|
info.receivedBytes = item.getReceivedBytes();
|
|
26907
26974
|
info.totalBytes = item.getTotalBytes();
|
|
26908
26975
|
info.state = state2 === "progressing" ? "progressing" : "interrupted";
|
|
26909
26976
|
const record2 = upsertDownload(info);
|
|
26910
|
-
send(Channels
|
|
26977
|
+
send(Channels.DOWNLOAD_PROGRESS, { ...info, id: record2.id, startedAt: record2.startedAt, updatedAt: record2.updatedAt });
|
|
26911
26978
|
});
|
|
26912
26979
|
item.once("done", (_event2, state2) => {
|
|
26913
26980
|
info.receivedBytes = item.getReceivedBytes();
|
|
26914
26981
|
info.state = state2 === "completed" ? "completed" : "cancelled";
|
|
26915
26982
|
const record2 = upsertDownload(info);
|
|
26916
|
-
send(Channels
|
|
26983
|
+
send(Channels.DOWNLOAD_DONE, { ...info, id: record2.id, startedAt: record2.startedAt, updatedAt: record2.updatedAt });
|
|
26917
26984
|
});
|
|
26918
26985
|
});
|
|
26919
26986
|
}
|
|
@@ -27105,7 +27172,7 @@ function createFindInPageBridge(tabManager, chromeView) {
|
|
|
27105
27172
|
if (wc.isDestroyed()) return;
|
|
27106
27173
|
const listener = (_event, result) => {
|
|
27107
27174
|
if (!chromeView.webContents.isDestroyed()) {
|
|
27108
|
-
chromeView.webContents.send(Channels
|
|
27175
|
+
chromeView.webContents.send(Channels.FIND_IN_PAGE_RESULT, result);
|
|
27109
27176
|
}
|
|
27110
27177
|
};
|
|
27111
27178
|
findResultListener = listener;
|
|
@@ -27182,136 +27249,136 @@ function registerPrivateIpcHandlers(state2) {
|
|
|
27182
27249
|
const { chromeView, tabManager } = state2;
|
|
27183
27250
|
const ipc = chromeView.webContents.ipc;
|
|
27184
27251
|
const findBridge = createFindInPageBridge(tabManager, chromeView);
|
|
27185
|
-
ipc.handle(Channels
|
|
27252
|
+
ipc.handle(Channels.TAB_CREATE, (_e, url) => {
|
|
27186
27253
|
return tabManager.createTab(url);
|
|
27187
27254
|
});
|
|
27188
|
-
ipc.handle(Channels
|
|
27255
|
+
ipc.handle(Channels.TAB_CLOSE, (_e, id) => {
|
|
27189
27256
|
tabManager.closeTab(id);
|
|
27190
27257
|
layoutPrivateViews(state2);
|
|
27191
27258
|
});
|
|
27192
|
-
ipc.handle(Channels
|
|
27259
|
+
ipc.handle(Channels.TAB_SWITCH, (_e, id) => {
|
|
27193
27260
|
tabManager.switchTab(id);
|
|
27194
27261
|
layoutPrivateViews(state2);
|
|
27195
27262
|
});
|
|
27196
|
-
ipc.handle(Channels
|
|
27263
|
+
ipc.handle(Channels.TAB_NAVIGATE, (_e, id, url) => {
|
|
27197
27264
|
return tabManager.navigateTab(id, url);
|
|
27198
27265
|
});
|
|
27199
|
-
ipc.handle(Channels
|
|
27266
|
+
ipc.handle(Channels.TAB_BACK, (_e, id) => {
|
|
27200
27267
|
tabManager.goBack(id);
|
|
27201
27268
|
});
|
|
27202
|
-
ipc.handle(Channels
|
|
27269
|
+
ipc.handle(Channels.TAB_FORWARD, (_e, id) => {
|
|
27203
27270
|
tabManager.goForward(id);
|
|
27204
27271
|
});
|
|
27205
|
-
ipc.handle(Channels
|
|
27272
|
+
ipc.handle(Channels.TAB_RELOAD, (_e, id) => {
|
|
27206
27273
|
tabManager.reloadTab(id);
|
|
27207
27274
|
});
|
|
27208
|
-
ipc.handle(Channels
|
|
27275
|
+
ipc.handle(Channels.TAB_TOGGLE_AD_BLOCK, (_e, id) => {
|
|
27209
27276
|
const tab = tabManager.getTab(id);
|
|
27210
27277
|
if (!tab) return null;
|
|
27211
27278
|
const newState = !tab.state.adBlockingEnabled;
|
|
27212
27279
|
tab.setAdBlockingEnabled(newState);
|
|
27213
27280
|
return newState;
|
|
27214
27281
|
});
|
|
27215
|
-
ipc.handle(Channels
|
|
27282
|
+
ipc.handle(Channels.TAB_ZOOM_IN, (_e, id) => {
|
|
27216
27283
|
tabManager.zoomIn(id);
|
|
27217
27284
|
});
|
|
27218
|
-
ipc.handle(Channels
|
|
27285
|
+
ipc.handle(Channels.TAB_ZOOM_OUT, (_e, id) => {
|
|
27219
27286
|
tabManager.zoomOut(id);
|
|
27220
27287
|
});
|
|
27221
|
-
ipc.handle(Channels
|
|
27288
|
+
ipc.handle(Channels.TAB_ZOOM_RESET, (_e, id) => {
|
|
27222
27289
|
tabManager.zoomReset(id);
|
|
27223
27290
|
});
|
|
27224
|
-
ipc.handle(Channels
|
|
27291
|
+
ipc.handle(Channels.TAB_STATE_GET, () => ({
|
|
27225
27292
|
tabs: tabManager.getAllStates(),
|
|
27226
27293
|
activeId: tabManager.getActiveTabId() || ""
|
|
27227
27294
|
}));
|
|
27228
|
-
ipc.handle(Channels
|
|
27295
|
+
ipc.handle(Channels.TAB_REOPEN_CLOSED, () => {
|
|
27229
27296
|
const id = tabManager.reopenClosedTab();
|
|
27230
27297
|
if (id) layoutPrivateViews(state2);
|
|
27231
27298
|
return id;
|
|
27232
27299
|
});
|
|
27233
|
-
ipc.handle(Channels
|
|
27300
|
+
ipc.handle(Channels.TAB_DUPLICATE, (_e, id) => {
|
|
27234
27301
|
const newId = tabManager.duplicateTab(id);
|
|
27235
27302
|
if (newId) layoutPrivateViews(state2);
|
|
27236
27303
|
return newId;
|
|
27237
27304
|
});
|
|
27238
|
-
ipc.handle(Channels
|
|
27305
|
+
ipc.handle(Channels.TAB_PIN, (_e, id) => {
|
|
27239
27306
|
tabManager.pinTab(id);
|
|
27240
27307
|
});
|
|
27241
|
-
ipc.handle(Channels
|
|
27308
|
+
ipc.handle(Channels.TAB_UNPIN, (_e, id) => {
|
|
27242
27309
|
tabManager.unpinTab(id);
|
|
27243
27310
|
});
|
|
27244
|
-
ipc.handle(Channels
|
|
27311
|
+
ipc.handle(Channels.TAB_GROUP_CREATE, (_e, id) => {
|
|
27245
27312
|
return tabManager.createGroupFromTab(id);
|
|
27246
27313
|
});
|
|
27247
|
-
ipc.handle(Channels
|
|
27314
|
+
ipc.handle(Channels.TAB_GROUP_ADD_TAB, (_e, id, groupId) => {
|
|
27248
27315
|
tabManager.assignTabToGroup(id, groupId);
|
|
27249
27316
|
});
|
|
27250
|
-
ipc.handle(Channels
|
|
27317
|
+
ipc.handle(Channels.TAB_GROUP_REMOVE_TAB, (_e, id) => {
|
|
27251
27318
|
tabManager.removeTabFromGroup(id);
|
|
27252
27319
|
});
|
|
27253
|
-
ipc.handle(Channels
|
|
27320
|
+
ipc.handle(Channels.TAB_GROUP_TOGGLE_COLLAPSED, (_e, groupId) => {
|
|
27254
27321
|
return tabManager.toggleGroupCollapsed(groupId);
|
|
27255
27322
|
});
|
|
27256
27323
|
ipc.handle(
|
|
27257
|
-
Channels
|
|
27324
|
+
Channels.TAB_GROUP_SET_COLOR,
|
|
27258
27325
|
(_e, groupId, color) => {
|
|
27259
27326
|
tabManager.setGroupColor(groupId, color);
|
|
27260
27327
|
}
|
|
27261
27328
|
);
|
|
27262
|
-
ipc.handle(Channels
|
|
27329
|
+
ipc.handle(Channels.TAB_TOGGLE_MUTE, (_e, id) => {
|
|
27263
27330
|
return tabManager.toggleMuted(id);
|
|
27264
27331
|
});
|
|
27265
|
-
ipc.handle(Channels
|
|
27332
|
+
ipc.handle(Channels.TAB_PRINT, (_e, id) => {
|
|
27266
27333
|
tabManager.printTab(id);
|
|
27267
27334
|
});
|
|
27268
|
-
ipc.handle(Channels
|
|
27335
|
+
ipc.handle(Channels.TAB_PRINT_TO_PDF, (_e, id) => {
|
|
27269
27336
|
return tabManager.saveTabAsPdf(id);
|
|
27270
27337
|
});
|
|
27271
|
-
ipc.on(Channels
|
|
27338
|
+
ipc.on(Channels.TAB_CONTEXT_MENU, (_e, id) => {
|
|
27272
27339
|
showTabContextMenu(tabManager, id, state2.window, () => layoutPrivateViews(state2));
|
|
27273
27340
|
});
|
|
27274
|
-
ipc.on(Channels
|
|
27341
|
+
ipc.on(Channels.TAB_GROUP_CONTEXT_MENU, (_e, groupId) => {
|
|
27275
27342
|
showGroupContextMenu(tabManager, groupId, state2.window);
|
|
27276
27343
|
});
|
|
27277
|
-
ipc.handle(Channels
|
|
27278
|
-
ipc.handle(Channels
|
|
27344
|
+
ipc.handle(Channels.IS_PRIVATE_MODE, () => true);
|
|
27345
|
+
ipc.handle(Channels.OPEN_PRIVATE_WINDOW, () => {
|
|
27279
27346
|
createPrivateWindow();
|
|
27280
27347
|
});
|
|
27281
|
-
ipc.handle(Channels
|
|
27348
|
+
ipc.handle(Channels.OPEN_NEW_WINDOW, () => {
|
|
27282
27349
|
const { createSecondaryWindow: createSecondaryWindow2 } = require("../secondary/window");
|
|
27283
27350
|
createSecondaryWindow2();
|
|
27284
27351
|
});
|
|
27285
|
-
ipc.handle(Channels
|
|
27352
|
+
ipc.handle(Channels.WINDOW_MINIMIZE, () => {
|
|
27286
27353
|
state2.window.minimize();
|
|
27287
27354
|
});
|
|
27288
|
-
ipc.handle(Channels
|
|
27355
|
+
ipc.handle(Channels.WINDOW_MAXIMIZE, () => {
|
|
27289
27356
|
if (state2.window.isMaximized()) {
|
|
27290
27357
|
state2.window.unmaximize();
|
|
27291
27358
|
} else {
|
|
27292
27359
|
state2.window.maximize();
|
|
27293
27360
|
}
|
|
27294
27361
|
});
|
|
27295
|
-
ipc.handle(Channels
|
|
27362
|
+
ipc.handle(Channels.WINDOW_CLOSE, () => {
|
|
27296
27363
|
state2.window.close();
|
|
27297
27364
|
});
|
|
27298
|
-
ipc.handle(Channels
|
|
27365
|
+
ipc.handle(Channels.SETTINGS_VISIBILITY, () => {
|
|
27299
27366
|
return false;
|
|
27300
27367
|
});
|
|
27301
|
-
ipc.handle(Channels
|
|
27302
|
-
ipc.handle(Channels
|
|
27303
|
-
ipc.handle(Channels
|
|
27368
|
+
ipc.handle(Channels.FOCUS_MODE_TOGGLE, () => false);
|
|
27369
|
+
ipc.handle(Channels.SIDEBAR_TOGGLE, () => ({ open: false, width: 0 }));
|
|
27370
|
+
ipc.handle(Channels.DEVTOOLS_PANEL_TOGGLE, () => ({ open: false }));
|
|
27304
27371
|
ipc.handle(
|
|
27305
|
-
Channels
|
|
27372
|
+
Channels.FIND_IN_PAGE_START,
|
|
27306
27373
|
(_e, text, options) => {
|
|
27307
27374
|
return findBridge.start(text, options);
|
|
27308
27375
|
}
|
|
27309
27376
|
);
|
|
27310
|
-
ipc.handle(Channels
|
|
27377
|
+
ipc.handle(Channels.FIND_IN_PAGE_NEXT, (_e, forward) => {
|
|
27311
27378
|
return findBridge.next(forward);
|
|
27312
27379
|
});
|
|
27313
27380
|
ipc.handle(
|
|
27314
|
-
Channels
|
|
27381
|
+
Channels.FIND_IN_PAGE_STOP,
|
|
27315
27382
|
(_e, action) => {
|
|
27316
27383
|
findBridge.stop(action);
|
|
27317
27384
|
}
|
|
@@ -27345,7 +27412,7 @@ function createPrivateWindow() {
|
|
|
27345
27412
|
win,
|
|
27346
27413
|
(tabs, activeId) => {
|
|
27347
27414
|
if (!chromeView.webContents.isDestroyed()) {
|
|
27348
|
-
chromeView.webContents.send(Channels
|
|
27415
|
+
chromeView.webContents.send(Channels.TAB_STATE_UPDATE, tabs, activeId);
|
|
27349
27416
|
}
|
|
27350
27417
|
layoutPrivateViews(state2);
|
|
27351
27418
|
},
|
|
@@ -27417,113 +27484,113 @@ function registerSecondaryIpcHandlers(state2) {
|
|
|
27417
27484
|
const { chromeView, tabManager } = state2;
|
|
27418
27485
|
const ipc = chromeView.webContents.ipc;
|
|
27419
27486
|
const findBridge = createFindInPageBridge(tabManager, chromeView);
|
|
27420
|
-
ipc.handle(Channels
|
|
27487
|
+
ipc.handle(Channels.TAB_CREATE, (_e, url) => {
|
|
27421
27488
|
return tabManager.createTab(url || loadSettings().defaultUrl);
|
|
27422
27489
|
});
|
|
27423
|
-
ipc.handle(Channels
|
|
27490
|
+
ipc.handle(Channels.TAB_CLOSE, (_e, id) => {
|
|
27424
27491
|
tabManager.closeTab(id);
|
|
27425
27492
|
layoutSecondaryViews(state2);
|
|
27426
27493
|
});
|
|
27427
|
-
ipc.handle(Channels
|
|
27494
|
+
ipc.handle(Channels.TAB_SWITCH, (_e, id) => {
|
|
27428
27495
|
tabManager.switchTab(id);
|
|
27429
27496
|
layoutSecondaryViews(state2);
|
|
27430
27497
|
});
|
|
27431
|
-
ipc.handle(Channels
|
|
27498
|
+
ipc.handle(Channels.TAB_NAVIGATE, (_e, id, url) => {
|
|
27432
27499
|
return tabManager.navigateTab(id, url);
|
|
27433
27500
|
});
|
|
27434
|
-
ipc.handle(Channels
|
|
27435
|
-
ipc.handle(Channels
|
|
27436
|
-
ipc.handle(Channels
|
|
27437
|
-
ipc.handle(Channels
|
|
27501
|
+
ipc.handle(Channels.TAB_BACK, (_e, id) => tabManager.goBack(id));
|
|
27502
|
+
ipc.handle(Channels.TAB_FORWARD, (_e, id) => tabManager.goForward(id));
|
|
27503
|
+
ipc.handle(Channels.TAB_RELOAD, (_e, id) => tabManager.reloadTab(id));
|
|
27504
|
+
ipc.handle(Channels.TAB_TOGGLE_AD_BLOCK, (_e, id) => {
|
|
27438
27505
|
const tab = tabManager.getTab(id);
|
|
27439
27506
|
if (!tab) return null;
|
|
27440
27507
|
const enabled = !tab.state.adBlockingEnabled;
|
|
27441
27508
|
tab.setAdBlockingEnabled(enabled);
|
|
27442
27509
|
return enabled;
|
|
27443
27510
|
});
|
|
27444
|
-
ipc.handle(Channels
|
|
27445
|
-
ipc.handle(Channels
|
|
27446
|
-
ipc.handle(Channels
|
|
27447
|
-
ipc.handle(Channels
|
|
27511
|
+
ipc.handle(Channels.TAB_ZOOM_IN, (_e, id) => tabManager.zoomIn(id));
|
|
27512
|
+
ipc.handle(Channels.TAB_ZOOM_OUT, (_e, id) => tabManager.zoomOut(id));
|
|
27513
|
+
ipc.handle(Channels.TAB_ZOOM_RESET, (_e, id) => tabManager.zoomReset(id));
|
|
27514
|
+
ipc.handle(Channels.TAB_REOPEN_CLOSED, () => {
|
|
27448
27515
|
const id = tabManager.reopenClosedTab();
|
|
27449
27516
|
if (id) layoutSecondaryViews(state2);
|
|
27450
27517
|
return id;
|
|
27451
27518
|
});
|
|
27452
|
-
ipc.handle(Channels
|
|
27519
|
+
ipc.handle(Channels.TAB_DUPLICATE, (_e, id) => {
|
|
27453
27520
|
const newId = tabManager.duplicateTab(id);
|
|
27454
27521
|
if (newId) layoutSecondaryViews(state2);
|
|
27455
27522
|
return newId;
|
|
27456
27523
|
});
|
|
27457
|
-
ipc.handle(Channels
|
|
27458
|
-
ipc.handle(Channels
|
|
27524
|
+
ipc.handle(Channels.TAB_PIN, (_e, id) => tabManager.pinTab(id));
|
|
27525
|
+
ipc.handle(Channels.TAB_UNPIN, (_e, id) => tabManager.unpinTab(id));
|
|
27459
27526
|
ipc.handle(
|
|
27460
|
-
Channels
|
|
27527
|
+
Channels.TAB_GROUP_CREATE,
|
|
27461
27528
|
(_e, id) => tabManager.createGroupFromTab(id)
|
|
27462
27529
|
);
|
|
27463
27530
|
ipc.handle(
|
|
27464
|
-
Channels
|
|
27531
|
+
Channels.TAB_GROUP_ADD_TAB,
|
|
27465
27532
|
(_e, id, groupId) => tabManager.assignTabToGroup(id, groupId)
|
|
27466
27533
|
);
|
|
27467
27534
|
ipc.handle(
|
|
27468
|
-
Channels
|
|
27535
|
+
Channels.TAB_GROUP_REMOVE_TAB,
|
|
27469
27536
|
(_e, id) => tabManager.removeTabFromGroup(id)
|
|
27470
27537
|
);
|
|
27471
27538
|
ipc.handle(
|
|
27472
|
-
Channels
|
|
27539
|
+
Channels.TAB_GROUP_TOGGLE_COLLAPSED,
|
|
27473
27540
|
(_e, groupId) => tabManager.toggleGroupCollapsed(groupId)
|
|
27474
27541
|
);
|
|
27475
27542
|
ipc.handle(
|
|
27476
|
-
Channels
|
|
27543
|
+
Channels.TAB_GROUP_SET_COLOR,
|
|
27477
27544
|
(_e, groupId, color) => tabManager.setGroupColor(groupId, color)
|
|
27478
27545
|
);
|
|
27479
27546
|
ipc.handle(
|
|
27480
|
-
Channels
|
|
27547
|
+
Channels.TAB_TOGGLE_MUTE,
|
|
27481
27548
|
(_e, id) => tabManager.toggleMuted(id)
|
|
27482
27549
|
);
|
|
27483
|
-
ipc.handle(Channels
|
|
27550
|
+
ipc.handle(Channels.TAB_PRINT, (_e, id) => tabManager.printTab(id));
|
|
27484
27551
|
ipc.handle(
|
|
27485
|
-
Channels
|
|
27552
|
+
Channels.TAB_PRINT_TO_PDF,
|
|
27486
27553
|
(_e, id) => tabManager.saveTabAsPdf(id)
|
|
27487
27554
|
);
|
|
27488
|
-
ipc.handle(Channels
|
|
27555
|
+
ipc.handle(Channels.TAB_STATE_GET, () => ({
|
|
27489
27556
|
tabs: tabManager.getAllStates(),
|
|
27490
27557
|
activeId: tabManager.getActiveTabId() || ""
|
|
27491
27558
|
}));
|
|
27492
27559
|
ipc.on(
|
|
27493
|
-
Channels
|
|
27560
|
+
Channels.TAB_CONTEXT_MENU,
|
|
27494
27561
|
(_e, id) => showTabContextMenu(state2.tabManager, id, state2.window, () => layoutSecondaryViews(state2))
|
|
27495
27562
|
);
|
|
27496
27563
|
ipc.on(
|
|
27497
|
-
Channels
|
|
27564
|
+
Channels.TAB_GROUP_CONTEXT_MENU,
|
|
27498
27565
|
(_e, groupId) => showGroupContextMenu(state2.tabManager, groupId, state2.window)
|
|
27499
27566
|
);
|
|
27500
|
-
ipc.handle(Channels
|
|
27501
|
-
ipc.handle(Channels
|
|
27567
|
+
ipc.handle(Channels.OPEN_NEW_WINDOW, () => createSecondaryWindow());
|
|
27568
|
+
ipc.handle(Channels.OPEN_PRIVATE_WINDOW, () => {
|
|
27502
27569
|
const { createPrivateWindow: createPrivateWindow2 } = require("../private/window");
|
|
27503
27570
|
createPrivateWindow2();
|
|
27504
27571
|
});
|
|
27505
|
-
ipc.handle(Channels
|
|
27506
|
-
ipc.handle(Channels
|
|
27507
|
-
ipc.handle(Channels
|
|
27572
|
+
ipc.handle(Channels.IS_PRIVATE_MODE, () => false);
|
|
27573
|
+
ipc.handle(Channels.WINDOW_MINIMIZE, () => state2.window.minimize());
|
|
27574
|
+
ipc.handle(Channels.WINDOW_MAXIMIZE, () => {
|
|
27508
27575
|
if (state2.window.isMaximized()) state2.window.unmaximize();
|
|
27509
27576
|
else state2.window.maximize();
|
|
27510
27577
|
});
|
|
27511
|
-
ipc.handle(Channels
|
|
27512
|
-
ipc.handle(Channels
|
|
27513
|
-
ipc.handle(Channels
|
|
27514
|
-
ipc.handle(Channels
|
|
27515
|
-
ipc.handle(Channels
|
|
27578
|
+
ipc.handle(Channels.WINDOW_CLOSE, () => state2.window.close());
|
|
27579
|
+
ipc.handle(Channels.SETTINGS_VISIBILITY, () => false);
|
|
27580
|
+
ipc.handle(Channels.FOCUS_MODE_TOGGLE, () => false);
|
|
27581
|
+
ipc.handle(Channels.SIDEBAR_TOGGLE, () => ({ open: false, width: 0 }));
|
|
27582
|
+
ipc.handle(Channels.DEVTOOLS_PANEL_TOGGLE, () => ({ open: false }));
|
|
27516
27583
|
ipc.handle(
|
|
27517
|
-
Channels
|
|
27584
|
+
Channels.FIND_IN_PAGE_START,
|
|
27518
27585
|
(_e, text, options) => {
|
|
27519
27586
|
return findBridge.start(text, options);
|
|
27520
27587
|
}
|
|
27521
27588
|
);
|
|
27522
|
-
ipc.handle(Channels
|
|
27589
|
+
ipc.handle(Channels.FIND_IN_PAGE_NEXT, (_e, forward) => {
|
|
27523
27590
|
return findBridge.next(forward);
|
|
27524
27591
|
});
|
|
27525
27592
|
ipc.handle(
|
|
27526
|
-
Channels
|
|
27593
|
+
Channels.FIND_IN_PAGE_STOP,
|
|
27527
27594
|
(_e, action) => {
|
|
27528
27595
|
findBridge.stop(action);
|
|
27529
27596
|
}
|
|
@@ -27552,7 +27619,7 @@ function createSecondaryWindow() {
|
|
|
27552
27619
|
win.contentView.addChildView(chromeView);
|
|
27553
27620
|
const tabManager = new TabManager(win, (tabs, activeId) => {
|
|
27554
27621
|
if (!chromeView.webContents.isDestroyed()) {
|
|
27555
|
-
chromeView.webContents.send(Channels
|
|
27622
|
+
chromeView.webContents.send(Channels.TAB_STATE_UPDATE, tabs, activeId);
|
|
27556
27623
|
}
|
|
27557
27624
|
layoutSecondaryViews(state2);
|
|
27558
27625
|
});
|
|
@@ -27582,12 +27649,12 @@ function getSafeBookmarkExportName(name) {
|
|
|
27582
27649
|
return safeName || "folder";
|
|
27583
27650
|
}
|
|
27584
27651
|
function registerBookmarkHandlers() {
|
|
27585
|
-
electron.ipcMain.handle(Channels
|
|
27652
|
+
electron.ipcMain.handle(Channels.BOOKMARKS_GET, (event) => {
|
|
27586
27653
|
assertTrustedIpcSender(event);
|
|
27587
27654
|
return getState();
|
|
27588
27655
|
});
|
|
27589
27656
|
electron.ipcMain.handle(
|
|
27590
|
-
Channels
|
|
27657
|
+
Channels.FOLDER_CREATE,
|
|
27591
27658
|
(event, name, summary) => {
|
|
27592
27659
|
assertTrustedIpcSender(event);
|
|
27593
27660
|
trackBookmarkAction("folder_create");
|
|
@@ -27595,7 +27662,7 @@ function registerBookmarkHandlers() {
|
|
|
27595
27662
|
}
|
|
27596
27663
|
);
|
|
27597
27664
|
electron.ipcMain.handle(
|
|
27598
|
-
Channels
|
|
27665
|
+
Channels.BOOKMARK_SAVE,
|
|
27599
27666
|
(event, url, title, folderId, note, intent, expectedContent, keyFields, agentHints) => {
|
|
27600
27667
|
assertTrustedIpcSender(event);
|
|
27601
27668
|
trackBookmarkAction("save");
|
|
@@ -27617,20 +27684,20 @@ function registerBookmarkHandlers() {
|
|
|
27617
27684
|
}
|
|
27618
27685
|
);
|
|
27619
27686
|
electron.ipcMain.handle(
|
|
27620
|
-
Channels
|
|
27687
|
+
Channels.BOOKMARK_UPDATE,
|
|
27621
27688
|
(event, id, updates) => {
|
|
27622
27689
|
assertTrustedIpcSender(event);
|
|
27623
27690
|
trackBookmarkAction("save");
|
|
27624
27691
|
return updateBookmark(id, updates);
|
|
27625
27692
|
}
|
|
27626
27693
|
);
|
|
27627
|
-
electron.ipcMain.handle(Channels
|
|
27694
|
+
electron.ipcMain.handle(Channels.BOOKMARK_REMOVE, (event, id) => {
|
|
27628
27695
|
assertTrustedIpcSender(event);
|
|
27629
27696
|
trackBookmarkAction("remove");
|
|
27630
27697
|
return removeBookmark(id);
|
|
27631
27698
|
});
|
|
27632
27699
|
electron.ipcMain.handle(
|
|
27633
|
-
Channels
|
|
27700
|
+
Channels.BOOKMARKS_EXPORT_HTML,
|
|
27634
27701
|
async (event, options) => {
|
|
27635
27702
|
assertTrustedIpcSender(event);
|
|
27636
27703
|
const { canceled, filePath: filePath2 } = await electron.dialog.showSaveDialog({
|
|
@@ -27650,7 +27717,7 @@ function registerBookmarkHandlers() {
|
|
|
27650
27717
|
};
|
|
27651
27718
|
}
|
|
27652
27719
|
);
|
|
27653
|
-
electron.ipcMain.handle(Channels
|
|
27720
|
+
electron.ipcMain.handle(Channels.BOOKMARKS_EXPORT_JSON, async (event) => {
|
|
27654
27721
|
assertTrustedIpcSender(event);
|
|
27655
27722
|
const { canceled, filePath: filePath2 } = await electron.dialog.showSaveDialog({
|
|
27656
27723
|
title: "Export Vessel Bookmark Archive",
|
|
@@ -27667,7 +27734,7 @@ function registerBookmarkHandlers() {
|
|
|
27667
27734
|
};
|
|
27668
27735
|
});
|
|
27669
27736
|
electron.ipcMain.handle(
|
|
27670
|
-
Channels
|
|
27737
|
+
Channels.FOLDER_EXPORT_HTML,
|
|
27671
27738
|
async (event, folderId, options) => {
|
|
27672
27739
|
assertTrustedIpcSender(event);
|
|
27673
27740
|
const folder = getFolder(folderId);
|
|
@@ -27690,7 +27757,7 @@ function registerBookmarkHandlers() {
|
|
|
27690
27757
|
};
|
|
27691
27758
|
}
|
|
27692
27759
|
);
|
|
27693
|
-
electron.ipcMain.handle(Channels
|
|
27760
|
+
electron.ipcMain.handle(Channels.BOOKMARKS_IMPORT_HTML, async (event) => {
|
|
27694
27761
|
assertTrustedIpcSender(event);
|
|
27695
27762
|
const { canceled, filePaths } = await electron.dialog.showOpenDialog({
|
|
27696
27763
|
title: "Import Bookmarks",
|
|
@@ -27704,7 +27771,7 @@ function registerBookmarkHandlers() {
|
|
|
27704
27771
|
trackBookmarkAction("import");
|
|
27705
27772
|
return importBookmarksFromHtml(content);
|
|
27706
27773
|
});
|
|
27707
|
-
electron.ipcMain.handle(Channels
|
|
27774
|
+
electron.ipcMain.handle(Channels.BOOKMARKS_IMPORT_JSON, async (event) => {
|
|
27708
27775
|
assertTrustedIpcSender(event);
|
|
27709
27776
|
const { canceled, filePaths } = await electron.dialog.showOpenDialog({
|
|
27710
27777
|
title: "Import Bookmarks",
|
|
@@ -27718,13 +27785,13 @@ function registerBookmarkHandlers() {
|
|
|
27718
27785
|
trackBookmarkAction("import");
|
|
27719
27786
|
return importBookmarksFromJson(content);
|
|
27720
27787
|
});
|
|
27721
|
-
electron.ipcMain.handle(Channels
|
|
27788
|
+
electron.ipcMain.handle(Channels.FOLDER_REMOVE, (event, id, deleteContents) => {
|
|
27722
27789
|
assertTrustedIpcSender(event);
|
|
27723
27790
|
trackBookmarkAction("folder_remove");
|
|
27724
27791
|
return removeFolder(id, deleteContents ?? false);
|
|
27725
27792
|
});
|
|
27726
27793
|
electron.ipcMain.handle(
|
|
27727
|
-
Channels
|
|
27794
|
+
Channels.FOLDER_RENAME,
|
|
27728
27795
|
(event, id, newName, summary) => {
|
|
27729
27796
|
assertTrustedIpcSender(event);
|
|
27730
27797
|
return renameFolder(id, newName, summary);
|
|
@@ -27732,23 +27799,23 @@ function registerBookmarkHandlers() {
|
|
|
27732
27799
|
);
|
|
27733
27800
|
}
|
|
27734
27801
|
function registerHistoryHandlers() {
|
|
27735
|
-
electron.ipcMain.handle(Channels
|
|
27802
|
+
electron.ipcMain.handle(Channels.HISTORY_GET, (event) => {
|
|
27736
27803
|
assertTrustedIpcSender(event);
|
|
27737
27804
|
return getState$1();
|
|
27738
27805
|
});
|
|
27739
|
-
electron.ipcMain.handle(Channels
|
|
27806
|
+
electron.ipcMain.handle(Channels.HISTORY_LIST, (event, offset, limit) => {
|
|
27740
27807
|
assertTrustedIpcSender(event);
|
|
27741
27808
|
return listEntries$2(offset, limit);
|
|
27742
27809
|
});
|
|
27743
|
-
electron.ipcMain.handle(Channels
|
|
27810
|
+
electron.ipcMain.handle(Channels.HISTORY_SEARCH, (event, query) => {
|
|
27744
27811
|
assertTrustedIpcSender(event);
|
|
27745
27812
|
return search(query);
|
|
27746
27813
|
});
|
|
27747
|
-
electron.ipcMain.handle(Channels
|
|
27814
|
+
electron.ipcMain.handle(Channels.HISTORY_CLEAR, (event) => {
|
|
27748
27815
|
assertTrustedIpcSender(event);
|
|
27749
27816
|
clearAll$1();
|
|
27750
27817
|
});
|
|
27751
|
-
electron.ipcMain.handle(Channels
|
|
27818
|
+
electron.ipcMain.handle(Channels.HISTORY_EXPORT_HTML, async (event) => {
|
|
27752
27819
|
assertTrustedIpcSender(event);
|
|
27753
27820
|
const { canceled, filePath: filePath2 } = await electron.dialog.showSaveDialog({
|
|
27754
27821
|
title: "Export History",
|
|
@@ -27760,7 +27827,7 @@ function registerHistoryHandlers() {
|
|
|
27760
27827
|
await fs.promises.writeFile(filePath2, content, "utf-8");
|
|
27761
27828
|
return { filePath: filePath2, count: getState$1().entries.length };
|
|
27762
27829
|
});
|
|
27763
|
-
electron.ipcMain.handle(Channels
|
|
27830
|
+
electron.ipcMain.handle(Channels.HISTORY_EXPORT_JSON, async (event) => {
|
|
27764
27831
|
assertTrustedIpcSender(event);
|
|
27765
27832
|
const { canceled, filePath: filePath2 } = await electron.dialog.showSaveDialog({
|
|
27766
27833
|
title: "Export History",
|
|
@@ -27772,7 +27839,7 @@ function registerHistoryHandlers() {
|
|
|
27772
27839
|
await fs.promises.writeFile(filePath2, content, "utf-8");
|
|
27773
27840
|
return { filePath: filePath2, count: getState$1().entries.length };
|
|
27774
27841
|
});
|
|
27775
|
-
electron.ipcMain.handle(Channels
|
|
27842
|
+
electron.ipcMain.handle(Channels.HISTORY_IMPORT, async (event) => {
|
|
27776
27843
|
assertTrustedIpcSender(event);
|
|
27777
27844
|
const { canceled, filePaths } = await electron.dialog.showOpenDialog({
|
|
27778
27845
|
title: "Import History",
|
|
@@ -27852,7 +27919,7 @@ function registerPremiumHandlers(tabManager, sendToRendererViews) {
|
|
|
27852
27919
|
const previousStatus = getPremiumState().status;
|
|
27853
27920
|
const state2 = await verifySubscription(sessionId);
|
|
27854
27921
|
if (isPremiumActiveState(state2)) {
|
|
27855
|
-
sendToRendererViews(Channels
|
|
27922
|
+
sendToRendererViews(Channels.PREMIUM_UPDATE, state2);
|
|
27856
27923
|
trackPremiumFunnel("premium_verify_succeeded", {
|
|
27857
27924
|
status: state2.status,
|
|
27858
27925
|
source: "checkout_auto"
|
|
@@ -27887,11 +27954,11 @@ function registerPremiumHandlers(tabManager, sendToRendererViews) {
|
|
|
27887
27954
|
void handleUrl(currentUrl);
|
|
27888
27955
|
}
|
|
27889
27956
|
};
|
|
27890
|
-
electron.ipcMain.handle(Channels
|
|
27957
|
+
electron.ipcMain.handle(Channels.PREMIUM_GET_STATE, (event) => {
|
|
27891
27958
|
assertTrustedIpcSender(event);
|
|
27892
27959
|
return getPremiumState();
|
|
27893
27960
|
});
|
|
27894
|
-
electron.ipcMain.handle(Channels
|
|
27961
|
+
electron.ipcMain.handle(Channels.PREMIUM_ACTIVATION_START, async (event, email) => {
|
|
27895
27962
|
assertTrustedIpcSender(event);
|
|
27896
27963
|
assertString(email, "email");
|
|
27897
27964
|
if (!isValidEmail$1(email)) {
|
|
@@ -27915,7 +27982,7 @@ function registerPremiumHandlers(tabManager, sendToRendererViews) {
|
|
|
27915
27982
|
return result;
|
|
27916
27983
|
});
|
|
27917
27984
|
electron.ipcMain.handle(
|
|
27918
|
-
Channels
|
|
27985
|
+
Channels.PREMIUM_ACTIVATION_VERIFY,
|
|
27919
27986
|
async (event, email, code, challengeToken) => {
|
|
27920
27987
|
assertTrustedIpcSender(event);
|
|
27921
27988
|
assertString(email, "email");
|
|
@@ -27945,7 +28012,7 @@ function registerPremiumHandlers(tabManager, sendToRendererViews) {
|
|
|
27945
28012
|
result.state.status,
|
|
27946
28013
|
"settings_code"
|
|
27947
28014
|
);
|
|
27948
|
-
sendToRendererViews(Channels
|
|
28015
|
+
sendToRendererViews(Channels.PREMIUM_UPDATE, result.state);
|
|
27949
28016
|
} else {
|
|
27950
28017
|
trackPremiumFunnel("premium_verify_failed", {
|
|
27951
28018
|
status: result.state.status,
|
|
@@ -27956,7 +28023,7 @@ function registerPremiumHandlers(tabManager, sendToRendererViews) {
|
|
|
27956
28023
|
return result;
|
|
27957
28024
|
}
|
|
27958
28025
|
);
|
|
27959
|
-
electron.ipcMain.handle(Channels
|
|
28026
|
+
electron.ipcMain.handle(Channels.PREMIUM_CHECKOUT, async (event, email) => {
|
|
27960
28027
|
assertTrustedIpcSender(event);
|
|
27961
28028
|
trackPremiumFunnel("checkout_clicked");
|
|
27962
28029
|
const result = await getCheckoutUrl(email);
|
|
@@ -27968,21 +28035,21 @@ function registerPremiumHandlers(tabManager, sendToRendererViews) {
|
|
|
27968
28035
|
}
|
|
27969
28036
|
return result;
|
|
27970
28037
|
});
|
|
27971
|
-
electron.ipcMain.handle(Channels
|
|
28038
|
+
electron.ipcMain.handle(Channels.PREMIUM_RESET, (event) => {
|
|
27972
28039
|
assertTrustedIpcSender(event);
|
|
27973
28040
|
trackPremiumFunnel("reset");
|
|
27974
28041
|
const state2 = resetPremium();
|
|
27975
|
-
sendToRendererViews(Channels
|
|
28042
|
+
sendToRendererViews(Channels.PREMIUM_UPDATE, state2);
|
|
27976
28043
|
return state2;
|
|
27977
28044
|
});
|
|
27978
|
-
electron.ipcMain.handle(Channels
|
|
28045
|
+
electron.ipcMain.handle(Channels.PREMIUM_TRACK_CONTEXT, (event, step) => {
|
|
27979
28046
|
assertTrustedIpcSender(event);
|
|
27980
28047
|
assertString(step, "step");
|
|
27981
28048
|
if (PREMIUM_TRACKABLE_STEPS.includes(step)) {
|
|
27982
28049
|
trackPremiumFunnel(step);
|
|
27983
28050
|
}
|
|
27984
28051
|
});
|
|
27985
|
-
electron.ipcMain.handle(Channels
|
|
28052
|
+
electron.ipcMain.handle(Channels.PREMIUM_PORTAL, async (event) => {
|
|
27986
28053
|
assertTrustedIpcSender(event);
|
|
27987
28054
|
trackPremiumFunnel("portal_opened");
|
|
27988
28055
|
const result = await getPortalUrl();
|
|
@@ -27993,21 +28060,21 @@ function registerPremiumHandlers(tabManager, sendToRendererViews) {
|
|
|
27993
28060
|
});
|
|
27994
28061
|
}
|
|
27995
28062
|
function registerSessionHandlers(tabManager) {
|
|
27996
|
-
electron.ipcMain.handle(Channels
|
|
28063
|
+
electron.ipcMain.handle(Channels.SESSION_LIST, (event) => {
|
|
27997
28064
|
assertTrustedIpcSender(event);
|
|
27998
28065
|
return listNamedSessions();
|
|
27999
28066
|
});
|
|
28000
|
-
electron.ipcMain.handle(Channels
|
|
28067
|
+
electron.ipcMain.handle(Channels.SESSION_SAVE, async (event, name) => {
|
|
28001
28068
|
assertTrustedIpcSender(event);
|
|
28002
28069
|
assertString(name, "name");
|
|
28003
28070
|
return await saveNamedSession(tabManager, name);
|
|
28004
28071
|
});
|
|
28005
|
-
electron.ipcMain.handle(Channels
|
|
28072
|
+
electron.ipcMain.handle(Channels.SESSION_LOAD, async (event, name) => {
|
|
28006
28073
|
assertTrustedIpcSender(event);
|
|
28007
28074
|
assertString(name, "name");
|
|
28008
28075
|
return await loadNamedSession(tabManager, name);
|
|
28009
28076
|
});
|
|
28010
|
-
electron.ipcMain.handle(Channels
|
|
28077
|
+
electron.ipcMain.handle(Channels.SESSION_DELETE, (event, name) => {
|
|
28011
28078
|
assertTrustedIpcSender(event);
|
|
28012
28079
|
assertString(name, "name");
|
|
28013
28080
|
return deleteNamedSession(name);
|
|
@@ -28045,7 +28112,7 @@ function buildCertificateDetailsHtml(state2) {
|
|
|
28045
28112
|
</html>`;
|
|
28046
28113
|
}
|
|
28047
28114
|
function registerSecurityHandlers(tabManager) {
|
|
28048
|
-
electron.ipcMain.handle(Channels
|
|
28115
|
+
electron.ipcMain.handle(Channels.SECURITY_SHOW_DETAILS, async (event, state2) => {
|
|
28049
28116
|
assertTrustedIpcSender(event);
|
|
28050
28117
|
const domain = (() => {
|
|
28051
28118
|
try {
|
|
@@ -28069,12 +28136,12 @@ function registerSecurityHandlers(tabManager) {
|
|
|
28069
28136
|
});
|
|
28070
28137
|
void loadInternalDataURL(win.webContents, `data:text/html;charset=utf-8,${encodeURIComponent(content)}`);
|
|
28071
28138
|
});
|
|
28072
|
-
electron.ipcMain.handle(Channels
|
|
28139
|
+
electron.ipcMain.handle(Channels.SECURITY_PROCEED_ANYWAY, (event, tabId) => {
|
|
28073
28140
|
assertTrustedIpcSender(event);
|
|
28074
28141
|
assertString(tabId, "tabId");
|
|
28075
28142
|
tabManager.proceedAnyway(tabId);
|
|
28076
28143
|
});
|
|
28077
|
-
electron.ipcMain.handle(Channels
|
|
28144
|
+
electron.ipcMain.handle(Channels.SECURITY_GO_BACK_TO_SAFETY, (event, tabId) => {
|
|
28078
28145
|
assertTrustedIpcSender(event);
|
|
28079
28146
|
assertString(tabId, "tabId");
|
|
28080
28147
|
tabManager.goBackToSafety(tabId);
|
|
@@ -28082,7 +28149,7 @@ function registerSecurityHandlers(tabManager) {
|
|
|
28082
28149
|
}
|
|
28083
28150
|
const logger$7 = createLogger("CodexIPC");
|
|
28084
28151
|
function registerCodexHandlers() {
|
|
28085
|
-
electron.ipcMain.handle(Channels
|
|
28152
|
+
electron.ipcMain.handle(Channels.CODEX_START_AUTH, async (event) => {
|
|
28086
28153
|
assertTrustedIpcSender(event);
|
|
28087
28154
|
if (isAirGapped()) {
|
|
28088
28155
|
return {
|
|
@@ -28099,7 +28166,7 @@ function registerCodexHandlers() {
|
|
|
28099
28166
|
}
|
|
28100
28167
|
const sendStatus = (status, error) => {
|
|
28101
28168
|
try {
|
|
28102
|
-
wc.send(Channels
|
|
28169
|
+
wc.send(Channels.CODEX_AUTH_STATUS, { status, error: error || null });
|
|
28103
28170
|
} catch {
|
|
28104
28171
|
logger$7.warn("Codex auth status send failed — window may be closed");
|
|
28105
28172
|
}
|
|
@@ -28120,12 +28187,12 @@ function registerCodexHandlers() {
|
|
|
28120
28187
|
};
|
|
28121
28188
|
}
|
|
28122
28189
|
});
|
|
28123
|
-
electron.ipcMain.handle(Channels
|
|
28190
|
+
electron.ipcMain.handle(Channels.CODEX_CANCEL_AUTH, (event) => {
|
|
28124
28191
|
assertTrustedIpcSender(event);
|
|
28125
28192
|
cancelCodexOAuth();
|
|
28126
28193
|
return { ok: true };
|
|
28127
28194
|
});
|
|
28128
|
-
electron.ipcMain.handle(Channels
|
|
28195
|
+
electron.ipcMain.handle(Channels.CODEX_DISCONNECT, (event) => {
|
|
28129
28196
|
assertTrustedIpcSender(event);
|
|
28130
28197
|
clearStoredCodexTokens();
|
|
28131
28198
|
return { ok: true };
|
|
@@ -28198,7 +28265,7 @@ function cancelOpenRouterOAuth() {
|
|
|
28198
28265
|
}
|
|
28199
28266
|
const logger$5 = createLogger("OpenRouterIPC");
|
|
28200
28267
|
function registerOpenRouterHandlers(applySettingChange) {
|
|
28201
|
-
electron.ipcMain.handle(Channels
|
|
28268
|
+
electron.ipcMain.handle(Channels.OPENROUTER_START_AUTH, async (event) => {
|
|
28202
28269
|
assertTrustedIpcSender(event);
|
|
28203
28270
|
if (isAirGapped()) {
|
|
28204
28271
|
return {
|
|
@@ -28215,7 +28282,7 @@ function registerOpenRouterHandlers(applySettingChange) {
|
|
|
28215
28282
|
}
|
|
28216
28283
|
const sendStatus = (status, error) => {
|
|
28217
28284
|
try {
|
|
28218
|
-
wc.send(Channels
|
|
28285
|
+
wc.send(Channels.OPENROUTER_AUTH_STATUS, { status, error: error || null });
|
|
28219
28286
|
} catch {
|
|
28220
28287
|
logger$5.warn("OpenRouter auth status send failed - window may be closed");
|
|
28221
28288
|
}
|
|
@@ -28244,7 +28311,7 @@ function registerOpenRouterHandlers(applySettingChange) {
|
|
|
28244
28311
|
};
|
|
28245
28312
|
}
|
|
28246
28313
|
});
|
|
28247
|
-
electron.ipcMain.handle(Channels
|
|
28314
|
+
electron.ipcMain.handle(Channels.OPENROUTER_CANCEL_AUTH, (event) => {
|
|
28248
28315
|
assertTrustedIpcSender(event);
|
|
28249
28316
|
cancelOpenRouterOAuth();
|
|
28250
28317
|
return { ok: true };
|
|
@@ -28275,23 +28342,24 @@ function registerSidebarHandlers(windowState, requireTrusted) {
|
|
|
28275
28342
|
restoreSidebarLayoutAfterResize();
|
|
28276
28343
|
}, 1200);
|
|
28277
28344
|
};
|
|
28278
|
-
|
|
28345
|
+
windowState.mainWindow.once("closed", stopSidebarResize);
|
|
28346
|
+
electron.ipcMain.handle(Channels.SIDEBAR_TOGGLE, (event) => {
|
|
28279
28347
|
requireTrusted(event);
|
|
28280
28348
|
return toggleDockedSidebar(windowState, relayout);
|
|
28281
28349
|
});
|
|
28282
|
-
electron.ipcMain.handle(Channels
|
|
28350
|
+
electron.ipcMain.handle(Channels.SIDEBAR_NAVIGATE, (event, tab) => {
|
|
28283
28351
|
requireTrusted(event);
|
|
28284
28352
|
assertString(tab, "tab");
|
|
28285
28353
|
if (windowState.uiState.sidebarPanelMode === "closed") {
|
|
28286
28354
|
openDockedSidebar(windowState, relayout);
|
|
28287
28355
|
}
|
|
28288
28356
|
if (!windowState.sidebarView.webContents.isDestroyed()) {
|
|
28289
|
-
windowState.sidebarView.webContents.send(Channels
|
|
28357
|
+
windowState.sidebarView.webContents.send(Channels.SIDEBAR_NAVIGATE, tab);
|
|
28290
28358
|
}
|
|
28291
28359
|
windowState.sidebarWindow?.focus();
|
|
28292
28360
|
return emitSidebarPanelState(windowState);
|
|
28293
28361
|
});
|
|
28294
|
-
electron.ipcMain.handle(Channels
|
|
28362
|
+
electron.ipcMain.handle(Channels.SIDEBAR_RESIZE_START, (event) => {
|
|
28295
28363
|
requireTrusted(event);
|
|
28296
28364
|
if (isSidebarDetached(windowState)) return;
|
|
28297
28365
|
sidebarResizeActive = true;
|
|
@@ -28299,35 +28367,34 @@ function registerSidebarHandlers(windowState, requireTrusted) {
|
|
|
28299
28367
|
const [width, height] = windowState.mainWindow.getContentSize();
|
|
28300
28368
|
const chromeHeight = windowState.uiState.focusMode ? 0 : CHROME_HEIGHT;
|
|
28301
28369
|
const sidebarWidth = windowState.uiState.sidebarWidth;
|
|
28302
|
-
const resizeHandleOverlap = 6;
|
|
28303
28370
|
windowState.sidebarView.setBounds({
|
|
28304
|
-
x: width - sidebarWidth -
|
|
28371
|
+
x: width - sidebarWidth - SIDEBAR_RESIZE_HANDLE_OVERLAP,
|
|
28305
28372
|
y: chromeHeight,
|
|
28306
|
-
width: sidebarWidth +
|
|
28373
|
+
width: sidebarWidth + SIDEBAR_RESIZE_HANDLE_OVERLAP,
|
|
28307
28374
|
height: height - chromeHeight
|
|
28308
28375
|
});
|
|
28309
28376
|
scheduleSidebarResizeRecovery();
|
|
28310
28377
|
});
|
|
28311
|
-
electron.ipcMain.handle(Channels
|
|
28378
|
+
electron.ipcMain.handle(Channels.SIDEBAR_RESIZE, (event, width) => {
|
|
28312
28379
|
requireTrusted(event);
|
|
28313
28380
|
assertNumber(width, "width");
|
|
28314
28381
|
if (isSidebarDetached(windowState)) {
|
|
28315
28382
|
return windowState.uiState.sidebarWidth;
|
|
28316
28383
|
}
|
|
28317
|
-
const clamped =
|
|
28384
|
+
const clamped = clampSidebarWidth(width);
|
|
28318
28385
|
windowState.uiState.sidebarWidth = clamped;
|
|
28319
28386
|
resizeSidebarViews(windowState);
|
|
28320
28387
|
emitSidebarPanelState(windowState);
|
|
28321
28388
|
return clamped;
|
|
28322
28389
|
});
|
|
28323
|
-
electron.ipcMain.handle(Channels
|
|
28390
|
+
electron.ipcMain.handle(Channels.SIDEBAR_RESIZE_COMMIT, (event) => {
|
|
28324
28391
|
requireTrusted(event);
|
|
28325
28392
|
if (isSidebarDetached(windowState)) return;
|
|
28326
28393
|
stopSidebarResize();
|
|
28327
28394
|
setSetting("sidebarWidth", windowState.uiState.sidebarWidth);
|
|
28328
28395
|
relayout();
|
|
28329
28396
|
});
|
|
28330
|
-
electron.ipcMain.handle(Channels
|
|
28397
|
+
electron.ipcMain.handle(Channels.SIDEBAR_POPOUT, (event) => {
|
|
28331
28398
|
requireTrusted(event);
|
|
28332
28399
|
stopSidebarResize();
|
|
28333
28400
|
return detachSidebar(windowState, {
|
|
@@ -28335,26 +28402,24 @@ function registerSidebarHandlers(windowState, requireTrusted) {
|
|
|
28335
28402
|
getWindowIconPath
|
|
28336
28403
|
});
|
|
28337
28404
|
});
|
|
28338
|
-
electron.ipcMain.handle(Channels
|
|
28405
|
+
electron.ipcMain.handle(Channels.SIDEBAR_DOCK, (event) => {
|
|
28339
28406
|
requireTrusted(event);
|
|
28340
28407
|
stopSidebarResize();
|
|
28341
28408
|
return dockSidebar(windowState, { relayout });
|
|
28342
28409
|
});
|
|
28343
28410
|
electron.ipcMain.on(
|
|
28344
|
-
Channels
|
|
28411
|
+
Channels.RENDERER_VIEW_READY,
|
|
28345
28412
|
(event, view) => {
|
|
28346
28413
|
requireTrusted(event);
|
|
28347
28414
|
if (view !== "sidebar") return;
|
|
28348
|
-
|
|
28349
|
-
openDockedSidebar(windowState, relayout);
|
|
28350
|
-
}
|
|
28415
|
+
emitSidebarPanelState(windowState);
|
|
28351
28416
|
}
|
|
28352
28417
|
);
|
|
28353
|
-
electron.ipcMain.handle(Channels
|
|
28418
|
+
electron.ipcMain.handle(Channels.SETTINGS_VISIBILITY, (event, open) => {
|
|
28354
28419
|
requireTrusted(event);
|
|
28355
28420
|
windowState.uiState.settingsOpen = open;
|
|
28356
28421
|
if (open) {
|
|
28357
|
-
closeSidebar(windowState, relayout);
|
|
28422
|
+
closeSidebar(windowState, relayout, "temporary");
|
|
28358
28423
|
} else {
|
|
28359
28424
|
relayout();
|
|
28360
28425
|
emitSidebarPanelState(windowState);
|
|
@@ -28445,7 +28510,7 @@ function snapshot() {
|
|
|
28445
28510
|
return records.map((record) => ({ ...record }));
|
|
28446
28511
|
}
|
|
28447
28512
|
function emit() {
|
|
28448
|
-
broadcaster?.(Channels
|
|
28513
|
+
broadcaster?.(Channels.PERMISSIONS_GET, snapshot());
|
|
28449
28514
|
}
|
|
28450
28515
|
function getDecision(origin, permission) {
|
|
28451
28516
|
const existing = records.find((r) => r.origin === origin && r.permission === permission);
|
|
@@ -28658,20 +28723,20 @@ function registerIpcHandlers(windowState, runtime2) {
|
|
|
28658
28723
|
const provider = settings2.chatProvider ? createProvider(settings2.chatProvider) : null;
|
|
28659
28724
|
researchOrchestrator = new ResearchOrchestrator(provider, tabManager, runtime2);
|
|
28660
28725
|
researchOrchestrator.setUpdateListener((state2) => {
|
|
28661
|
-
sendToRendererViews(Channels
|
|
28726
|
+
sendToRendererViews(Channels.RESEARCH_STATE_UPDATE, state2);
|
|
28662
28727
|
});
|
|
28663
28728
|
}
|
|
28664
28729
|
return researchOrchestrator;
|
|
28665
28730
|
};
|
|
28666
|
-
electron.ipcMain.handle(Channels
|
|
28731
|
+
electron.ipcMain.handle(Channels.OPEN_PRIVATE_WINDOW, (event) => {
|
|
28667
28732
|
requireTrusted(event);
|
|
28668
28733
|
createPrivateWindow();
|
|
28669
28734
|
});
|
|
28670
|
-
electron.ipcMain.handle(Channels
|
|
28735
|
+
electron.ipcMain.handle(Channels.OPEN_NEW_WINDOW, (event) => {
|
|
28671
28736
|
requireTrusted(event);
|
|
28672
28737
|
createSecondaryWindow();
|
|
28673
28738
|
});
|
|
28674
|
-
electron.ipcMain.handle(Channels
|
|
28739
|
+
electron.ipcMain.handle(Channels.IS_PRIVATE_MODE, (event) => {
|
|
28675
28740
|
requireTrusted(event);
|
|
28676
28741
|
return false;
|
|
28677
28742
|
});
|
|
@@ -28682,13 +28747,13 @@ function registerIpcHandlers(windowState, runtime2) {
|
|
|
28682
28747
|
if (!pendingRuntimeState) return;
|
|
28683
28748
|
if (!chromeView.webContents.isDestroyed()) {
|
|
28684
28749
|
chromeView.webContents.send(
|
|
28685
|
-
Channels
|
|
28750
|
+
Channels.AGENT_RUNTIME_UPDATE,
|
|
28686
28751
|
pendingRuntimeState
|
|
28687
28752
|
);
|
|
28688
28753
|
}
|
|
28689
28754
|
if (!sidebarView.webContents.isDestroyed()) {
|
|
28690
28755
|
sidebarView.webContents.send(
|
|
28691
|
-
Channels
|
|
28756
|
+
Channels.AGENT_RUNTIME_UPDATE,
|
|
28692
28757
|
pendingRuntimeState
|
|
28693
28758
|
);
|
|
28694
28759
|
}
|
|
@@ -28725,7 +28790,7 @@ function registerIpcHandlers(windowState, runtime2) {
|
|
|
28725
28790
|
};
|
|
28726
28791
|
const emitHighlightCount = async () => {
|
|
28727
28792
|
const count = await getActiveHighlightCountSafe();
|
|
28728
|
-
sendToRendererViews(Channels
|
|
28793
|
+
sendToRendererViews(Channels.HIGHLIGHT_COUNT_UPDATE, count);
|
|
28729
28794
|
};
|
|
28730
28795
|
const applySettingChange = async (key2, value) => {
|
|
28731
28796
|
const updatedSettings = setSetting(key2, value);
|
|
@@ -28744,36 +28809,36 @@ function registerIpcHandlers(windowState, runtime2) {
|
|
|
28744
28809
|
}
|
|
28745
28810
|
}
|
|
28746
28811
|
const rendererSettings = getRendererSettings();
|
|
28747
|
-
sendToRendererViews(Channels
|
|
28812
|
+
sendToRendererViews(Channels.SETTINGS_UPDATE, rendererSettings);
|
|
28748
28813
|
return rendererSettings;
|
|
28749
28814
|
};
|
|
28750
28815
|
runtime2.setUpdateListener((state2) => {
|
|
28751
28816
|
scheduleRuntimeUpdate(state2);
|
|
28752
28817
|
});
|
|
28753
28818
|
onRuntimeHealthChange((health) => {
|
|
28754
|
-
sendToRendererViews(Channels
|
|
28819
|
+
sendToRendererViews(Channels.SETTINGS_HEALTH_UPDATE, health);
|
|
28755
28820
|
});
|
|
28756
28821
|
onAIStreamIdle(() => {
|
|
28757
|
-
sendToRendererViews(Channels
|
|
28822
|
+
sendToRendererViews(Channels.AI_STREAM_IDLE);
|
|
28758
28823
|
});
|
|
28759
|
-
electron.ipcMain.handle(Channels
|
|
28824
|
+
electron.ipcMain.handle(Channels.TAB_CREATE, (event, url) => {
|
|
28760
28825
|
requireTrusted(event);
|
|
28761
28826
|
const id = tabManager.createTab(url || loadSettings().defaultUrl);
|
|
28762
28827
|
layoutViews(windowState);
|
|
28763
28828
|
return id;
|
|
28764
28829
|
});
|
|
28765
|
-
electron.ipcMain.handle(Channels
|
|
28830
|
+
electron.ipcMain.handle(Channels.TAB_CLOSE, (event, id) => {
|
|
28766
28831
|
requireTrusted(event);
|
|
28767
28832
|
tabManager.closeTab(id);
|
|
28768
28833
|
layoutViews(windowState);
|
|
28769
28834
|
});
|
|
28770
|
-
electron.ipcMain.handle(Channels
|
|
28835
|
+
electron.ipcMain.handle(Channels.TAB_SWITCH, (event, id) => {
|
|
28771
28836
|
requireTrusted(event);
|
|
28772
28837
|
tabManager.switchTab(id);
|
|
28773
28838
|
layoutViews(windowState);
|
|
28774
28839
|
});
|
|
28775
28840
|
electron.ipcMain.handle(
|
|
28776
|
-
Channels
|
|
28841
|
+
Channels.TAB_NAVIGATE,
|
|
28777
28842
|
(event, id, url, postBody) => {
|
|
28778
28843
|
requireTrusted(event);
|
|
28779
28844
|
assertString(id, "tabId");
|
|
@@ -28781,19 +28846,19 @@ function registerIpcHandlers(windowState, runtime2) {
|
|
|
28781
28846
|
return tabManager.navigateTab(id, url, postBody);
|
|
28782
28847
|
}
|
|
28783
28848
|
);
|
|
28784
|
-
electron.ipcMain.handle(Channels
|
|
28849
|
+
electron.ipcMain.handle(Channels.TAB_BACK, (event, id) => {
|
|
28785
28850
|
requireTrusted(event);
|
|
28786
28851
|
tabManager.goBack(id);
|
|
28787
28852
|
});
|
|
28788
|
-
electron.ipcMain.handle(Channels
|
|
28853
|
+
electron.ipcMain.handle(Channels.TAB_FORWARD, (event, id) => {
|
|
28789
28854
|
requireTrusted(event);
|
|
28790
28855
|
tabManager.goForward(id);
|
|
28791
28856
|
});
|
|
28792
|
-
electron.ipcMain.handle(Channels
|
|
28857
|
+
electron.ipcMain.handle(Channels.TAB_RELOAD, (event, id) => {
|
|
28793
28858
|
requireTrusted(event);
|
|
28794
28859
|
tabManager.reloadTab(id);
|
|
28795
28860
|
});
|
|
28796
|
-
electron.ipcMain.handle(Channels
|
|
28861
|
+
electron.ipcMain.handle(Channels.TAB_TOGGLE_AD_BLOCK, (event, id) => {
|
|
28797
28862
|
requireTrusted(event);
|
|
28798
28863
|
assertString(id, "id");
|
|
28799
28864
|
const tab = tabManager.getTab(id);
|
|
@@ -28802,67 +28867,67 @@ function registerIpcHandlers(windowState, runtime2) {
|
|
|
28802
28867
|
tab.setAdBlockingEnabled(newState);
|
|
28803
28868
|
return newState;
|
|
28804
28869
|
});
|
|
28805
|
-
electron.ipcMain.handle(Channels
|
|
28870
|
+
electron.ipcMain.handle(Channels.TAB_ZOOM_IN, (event, id) => {
|
|
28806
28871
|
requireTrusted(event);
|
|
28807
28872
|
assertString(id, "id");
|
|
28808
28873
|
tabManager.zoomIn(id);
|
|
28809
28874
|
});
|
|
28810
|
-
electron.ipcMain.handle(Channels
|
|
28875
|
+
electron.ipcMain.handle(Channels.TAB_ZOOM_OUT, (event, id) => {
|
|
28811
28876
|
requireTrusted(event);
|
|
28812
28877
|
assertString(id, "id");
|
|
28813
28878
|
tabManager.zoomOut(id);
|
|
28814
28879
|
});
|
|
28815
|
-
electron.ipcMain.handle(Channels
|
|
28880
|
+
electron.ipcMain.handle(Channels.TAB_ZOOM_RESET, (event, id) => {
|
|
28816
28881
|
requireTrusted(event);
|
|
28817
28882
|
assertString(id, "id");
|
|
28818
28883
|
tabManager.zoomReset(id);
|
|
28819
28884
|
});
|
|
28820
|
-
electron.ipcMain.handle(Channels
|
|
28885
|
+
electron.ipcMain.handle(Channels.TAB_REOPEN_CLOSED, (event) => {
|
|
28821
28886
|
requireTrusted(event);
|
|
28822
28887
|
const id = tabManager.reopenClosedTab();
|
|
28823
28888
|
if (id) layoutViews(windowState);
|
|
28824
28889
|
return id;
|
|
28825
28890
|
});
|
|
28826
|
-
electron.ipcMain.handle(Channels
|
|
28891
|
+
electron.ipcMain.handle(Channels.TAB_DUPLICATE, (event, id) => {
|
|
28827
28892
|
requireTrusted(event);
|
|
28828
28893
|
assertString(id, "id");
|
|
28829
28894
|
const newId = tabManager.duplicateTab(id);
|
|
28830
28895
|
if (newId) layoutViews(windowState);
|
|
28831
28896
|
return newId;
|
|
28832
28897
|
});
|
|
28833
|
-
electron.ipcMain.handle(Channels
|
|
28898
|
+
electron.ipcMain.handle(Channels.TAB_PIN, (event, id) => {
|
|
28834
28899
|
requireTrusted(event);
|
|
28835
28900
|
assertString(id, "id");
|
|
28836
28901
|
tabManager.pinTab(id);
|
|
28837
28902
|
});
|
|
28838
|
-
electron.ipcMain.handle(Channels
|
|
28903
|
+
electron.ipcMain.handle(Channels.TAB_UNPIN, (event, id) => {
|
|
28839
28904
|
requireTrusted(event);
|
|
28840
28905
|
assertString(id, "id");
|
|
28841
28906
|
tabManager.unpinTab(id);
|
|
28842
28907
|
});
|
|
28843
|
-
electron.ipcMain.handle(Channels
|
|
28908
|
+
electron.ipcMain.handle(Channels.TAB_GROUP_CREATE, (event, id) => {
|
|
28844
28909
|
requireTrusted(event);
|
|
28845
28910
|
assertString(id, "id");
|
|
28846
28911
|
return tabManager.createGroupFromTab(id);
|
|
28847
28912
|
});
|
|
28848
|
-
electron.ipcMain.handle(Channels
|
|
28913
|
+
electron.ipcMain.handle(Channels.TAB_GROUP_ADD_TAB, (event, id, groupId) => {
|
|
28849
28914
|
requireTrusted(event);
|
|
28850
28915
|
assertString(id, "id");
|
|
28851
28916
|
assertString(groupId, "groupId");
|
|
28852
28917
|
tabManager.assignTabToGroup(id, groupId);
|
|
28853
28918
|
});
|
|
28854
|
-
electron.ipcMain.handle(Channels
|
|
28919
|
+
electron.ipcMain.handle(Channels.TAB_GROUP_REMOVE_TAB, (event, id) => {
|
|
28855
28920
|
requireTrusted(event);
|
|
28856
28921
|
assertString(id, "id");
|
|
28857
28922
|
tabManager.removeTabFromGroup(id);
|
|
28858
28923
|
});
|
|
28859
|
-
electron.ipcMain.handle(Channels
|
|
28924
|
+
electron.ipcMain.handle(Channels.TAB_GROUP_TOGGLE_COLLAPSED, (event, groupId) => {
|
|
28860
28925
|
requireTrusted(event);
|
|
28861
28926
|
assertString(groupId, "groupId");
|
|
28862
28927
|
return tabManager.toggleGroupCollapsed(groupId);
|
|
28863
28928
|
});
|
|
28864
28929
|
electron.ipcMain.handle(
|
|
28865
|
-
Channels
|
|
28930
|
+
Channels.TAB_GROUP_SET_COLOR,
|
|
28866
28931
|
(event, groupId, color) => {
|
|
28867
28932
|
requireTrusted(event);
|
|
28868
28933
|
assertString(groupId, "groupId");
|
|
@@ -28870,55 +28935,55 @@ function registerIpcHandlers(windowState, runtime2) {
|
|
|
28870
28935
|
tabManager.setGroupColor(groupId, color);
|
|
28871
28936
|
}
|
|
28872
28937
|
);
|
|
28873
|
-
electron.ipcMain.handle(Channels
|
|
28938
|
+
electron.ipcMain.handle(Channels.TAB_TOGGLE_MUTE, (event, id) => {
|
|
28874
28939
|
requireTrusted(event);
|
|
28875
28940
|
assertString(id, "id");
|
|
28876
28941
|
return tabManager.toggleMuted(id);
|
|
28877
28942
|
});
|
|
28878
|
-
electron.ipcMain.handle(Channels
|
|
28943
|
+
electron.ipcMain.handle(Channels.TAB_PRINT, (event, id) => {
|
|
28879
28944
|
requireTrusted(event);
|
|
28880
28945
|
assertString(id, "id");
|
|
28881
28946
|
tabManager.printTab(id);
|
|
28882
28947
|
});
|
|
28883
|
-
electron.ipcMain.handle(Channels
|
|
28948
|
+
electron.ipcMain.handle(Channels.TAB_PRINT_TO_PDF, (event, id) => {
|
|
28884
28949
|
requireTrusted(event);
|
|
28885
28950
|
assertString(id, "id");
|
|
28886
28951
|
return tabManager.saveTabAsPdf(id);
|
|
28887
28952
|
});
|
|
28888
|
-
electron.ipcMain.on(Channels
|
|
28953
|
+
electron.ipcMain.on(Channels.TAB_CONTEXT_MENU, (event, id) => {
|
|
28889
28954
|
requireTrusted(event);
|
|
28890
28955
|
assertString(id, "id");
|
|
28891
28956
|
showTabContextMenu(tabManager, id, mainWindow, () => layoutViews(windowState));
|
|
28892
28957
|
});
|
|
28893
|
-
electron.ipcMain.on(Channels
|
|
28958
|
+
electron.ipcMain.on(Channels.TAB_GROUP_CONTEXT_MENU, (event, groupId) => {
|
|
28894
28959
|
requireTrusted(event);
|
|
28895
28960
|
assertString(groupId, "groupId");
|
|
28896
28961
|
showGroupContextMenu(tabManager, groupId, mainWindow);
|
|
28897
28962
|
});
|
|
28898
|
-
electron.ipcMain.handle(Channels
|
|
28963
|
+
electron.ipcMain.handle(Channels.TAB_STATE_GET, (event) => {
|
|
28899
28964
|
requireTrusted(event);
|
|
28900
28965
|
return {
|
|
28901
28966
|
tabs: tabManager.getAllStates(),
|
|
28902
28967
|
activeId: tabManager.getActiveTabId() || ""
|
|
28903
28968
|
};
|
|
28904
28969
|
});
|
|
28905
|
-
electron.ipcMain.handle(Channels
|
|
28970
|
+
electron.ipcMain.handle(Channels.AI_QUERY, async (event, query, history) => {
|
|
28906
28971
|
requireTrusted(event);
|
|
28907
28972
|
const settings2 = loadSettings();
|
|
28908
28973
|
const chatConfig = settings2.chatProvider;
|
|
28909
28974
|
if (!chatConfig) {
|
|
28910
|
-
sendToRendererViews(Channels
|
|
28975
|
+
sendToRendererViews(Channels.AI_STREAM_START, query);
|
|
28911
28976
|
sendToRendererViews(
|
|
28912
|
-
Channels
|
|
28977
|
+
Channels.AI_STREAM_CHUNK,
|
|
28913
28978
|
"Chat provider not configured. Open Settings (Ctrl+,) to choose a provider."
|
|
28914
28979
|
);
|
|
28915
|
-
sendToRendererViews(Channels
|
|
28980
|
+
sendToRendererViews(Channels.AI_STREAM_END, "failed");
|
|
28916
28981
|
return { accepted: true };
|
|
28917
28982
|
}
|
|
28918
28983
|
if (!tryBeginAIStream("manual")) {
|
|
28919
28984
|
return { accepted: false, reason: "busy" };
|
|
28920
28985
|
}
|
|
28921
|
-
sendToRendererViews(Channels
|
|
28986
|
+
sendToRendererViews(Channels.AI_STREAM_START, query);
|
|
28922
28987
|
(async () => {
|
|
28923
28988
|
try {
|
|
28924
28989
|
activeChatProvider = createProvider(chatConfig);
|
|
@@ -28928,8 +28993,8 @@ function registerIpcHandlers(windowState, runtime2) {
|
|
|
28928
28993
|
query,
|
|
28929
28994
|
activeChatProvider,
|
|
28930
28995
|
activeTab?.view.webContents,
|
|
28931
|
-
(chunk) => sendToRendererViews(Channels
|
|
28932
|
-
() => sendToRendererViews(Channels
|
|
28996
|
+
(chunk) => sendToRendererViews(Channels.AI_STREAM_CHUNK, chunk),
|
|
28997
|
+
() => sendToRendererViews(Channels.AI_STREAM_END, "completed"),
|
|
28933
28998
|
tabManager,
|
|
28934
28999
|
runtime2,
|
|
28935
29000
|
compactProviderHistory(history),
|
|
@@ -28937,9 +29002,9 @@ function registerIpcHandlers(windowState, runtime2) {
|
|
|
28937
29002
|
);
|
|
28938
29003
|
} catch (err) {
|
|
28939
29004
|
const msg = err instanceof Error ? err.message : "Unknown error";
|
|
28940
|
-
sendToRendererViews(Channels
|
|
29005
|
+
sendToRendererViews(Channels.AI_STREAM_CHUNK, `
|
|
28941
29006
|
[Error: ${msg}]`);
|
|
28942
|
-
sendToRendererViews(Channels
|
|
29007
|
+
sendToRendererViews(Channels.AI_STREAM_END, "failed");
|
|
28943
29008
|
} finally {
|
|
28944
29009
|
activeChatProvider = null;
|
|
28945
29010
|
endAIStream("manual");
|
|
@@ -28947,11 +29012,11 @@ function registerIpcHandlers(windowState, runtime2) {
|
|
|
28947
29012
|
})();
|
|
28948
29013
|
return { accepted: true };
|
|
28949
29014
|
});
|
|
28950
|
-
electron.ipcMain.handle(Channels
|
|
29015
|
+
electron.ipcMain.handle(Channels.AI_CANCEL, (event) => {
|
|
28951
29016
|
requireTrusted(event);
|
|
28952
29017
|
activeChatProvider?.cancel();
|
|
28953
29018
|
});
|
|
28954
|
-
electron.ipcMain.handle(Channels
|
|
29019
|
+
electron.ipcMain.handle(Channels.AI_FETCH_MODELS, async (event, config) => {
|
|
28955
29020
|
requireTrusted(event);
|
|
28956
29021
|
try {
|
|
28957
29022
|
if (!config || typeof config !== "object" || !("id" in config)) {
|
|
@@ -28964,13 +29029,13 @@ function registerIpcHandlers(windowState, runtime2) {
|
|
|
28964
29029
|
return errorResult(getErrorMessage(err), { models: [] });
|
|
28965
29030
|
}
|
|
28966
29031
|
});
|
|
28967
|
-
electron.ipcMain.handle(Channels
|
|
29032
|
+
electron.ipcMain.handle(Channels.CONTENT_EXTRACT, async (event) => {
|
|
28968
29033
|
requireTrusted(event);
|
|
28969
29034
|
const activeTab = tabManager.getActiveTab();
|
|
28970
29035
|
if (!activeTab) return null;
|
|
28971
29036
|
return extractContent(activeTab.view.webContents);
|
|
28972
29037
|
});
|
|
28973
|
-
electron.ipcMain.handle(Channels
|
|
29038
|
+
electron.ipcMain.handle(Channels.READER_MODE_TOGGLE, async (event) => {
|
|
28974
29039
|
requireTrusted(event);
|
|
28975
29040
|
const activeTab = tabManager.getActiveTab();
|
|
28976
29041
|
if (!activeTab) return;
|
|
@@ -28991,31 +29056,31 @@ function registerIpcHandlers(windowState, runtime2) {
|
|
|
28991
29056
|
);
|
|
28992
29057
|
}
|
|
28993
29058
|
});
|
|
28994
|
-
electron.ipcMain.handle(Channels
|
|
29059
|
+
electron.ipcMain.handle(Channels.FOCUS_MODE_TOGGLE, (event) => {
|
|
28995
29060
|
requireTrusted(event);
|
|
28996
29061
|
windowState.uiState.focusMode = !windowState.uiState.focusMode;
|
|
28997
29062
|
layoutViews(windowState);
|
|
28998
29063
|
return windowState.uiState.focusMode;
|
|
28999
29064
|
});
|
|
29000
|
-
electron.ipcMain.handle(Channels
|
|
29065
|
+
electron.ipcMain.handle(Channels.SETTINGS_GET, (event) => {
|
|
29001
29066
|
requireTrusted(event);
|
|
29002
29067
|
return getRendererSettings();
|
|
29003
29068
|
});
|
|
29004
|
-
electron.ipcMain.handle(Channels
|
|
29069
|
+
electron.ipcMain.handle(Channels.SETTINGS_HEALTH_GET, (event) => {
|
|
29005
29070
|
requireTrusted(event);
|
|
29006
29071
|
return getRuntimeHealth();
|
|
29007
29072
|
});
|
|
29008
|
-
electron.ipcMain.handle(Channels
|
|
29073
|
+
electron.ipcMain.handle(Channels.MCP_REGENERATE_TOKEN, (event) => {
|
|
29009
29074
|
requireTrusted(event);
|
|
29010
29075
|
return regenerateMcpAuthToken();
|
|
29011
29076
|
});
|
|
29012
|
-
electron.ipcMain.handle(Channels
|
|
29077
|
+
electron.ipcMain.handle(Channels.SUPPORT_SUBMIT_FEEDBACK, async (event, email, message) => {
|
|
29013
29078
|
requireTrusted(event);
|
|
29014
29079
|
assertString(email, "email");
|
|
29015
29080
|
assertString(message, "message");
|
|
29016
29081
|
return submitFeedback({ email, message, source: "settings_account" });
|
|
29017
29082
|
});
|
|
29018
|
-
electron.ipcMain.handle(Channels
|
|
29083
|
+
electron.ipcMain.handle(Channels.SETTINGS_SET, async (event, key2, value) => {
|
|
29019
29084
|
requireTrusted(event);
|
|
29020
29085
|
assertString(key2, "key");
|
|
29021
29086
|
if (!SETTABLE_KEYS.has(key2)) {
|
|
@@ -29024,20 +29089,20 @@ function registerIpcHandlers(windowState, runtime2) {
|
|
|
29024
29089
|
const settingsKey = key2;
|
|
29025
29090
|
return applySettingChange(settingsKey, value);
|
|
29026
29091
|
});
|
|
29027
|
-
electron.ipcMain.handle(Channels
|
|
29092
|
+
electron.ipcMain.handle(Channels.AGENT_RUNTIME_GET, (event) => {
|
|
29028
29093
|
requireTrusted(event);
|
|
29029
29094
|
return runtime2.getState();
|
|
29030
29095
|
});
|
|
29031
|
-
electron.ipcMain.handle(Channels
|
|
29096
|
+
electron.ipcMain.handle(Channels.AGENT_PAUSE, (event) => {
|
|
29032
29097
|
requireTrusted(event);
|
|
29033
29098
|
return runtime2.pause();
|
|
29034
29099
|
});
|
|
29035
|
-
electron.ipcMain.handle(Channels
|
|
29100
|
+
electron.ipcMain.handle(Channels.AGENT_RESUME, (event) => {
|
|
29036
29101
|
requireTrusted(event);
|
|
29037
29102
|
return runtime2.resume();
|
|
29038
29103
|
});
|
|
29039
29104
|
electron.ipcMain.handle(
|
|
29040
|
-
Channels
|
|
29105
|
+
Channels.AGENT_SET_APPROVAL_MODE,
|
|
29041
29106
|
(event, mode) => {
|
|
29042
29107
|
requireTrusted(event);
|
|
29043
29108
|
assertString(mode, "mode");
|
|
@@ -29050,44 +29115,44 @@ function registerIpcHandlers(windowState, runtime2) {
|
|
|
29050
29115
|
}
|
|
29051
29116
|
);
|
|
29052
29117
|
electron.ipcMain.handle(
|
|
29053
|
-
Channels
|
|
29118
|
+
Channels.AGENT_APPROVAL_RESOLVE,
|
|
29054
29119
|
(event, approvalId, approved) => {
|
|
29055
29120
|
requireTrusted(event);
|
|
29056
29121
|
return runtime2.resolveApproval(approvalId, approved);
|
|
29057
29122
|
}
|
|
29058
29123
|
);
|
|
29059
29124
|
electron.ipcMain.handle(
|
|
29060
|
-
Channels
|
|
29125
|
+
Channels.AGENT_CHECKPOINT_CREATE,
|
|
29061
29126
|
(event, name, note) => {
|
|
29062
29127
|
requireTrusted(event);
|
|
29063
29128
|
return runtime2.createCheckpoint(name, note);
|
|
29064
29129
|
}
|
|
29065
29130
|
);
|
|
29066
|
-
electron.ipcMain.handle(Channels
|
|
29131
|
+
electron.ipcMain.handle(Channels.AGENT_CHECKPOINT_RESTORE, (event, checkpointId) => {
|
|
29067
29132
|
requireTrusted(event);
|
|
29068
29133
|
return runtime2.restoreCheckpoint(checkpointId);
|
|
29069
29134
|
});
|
|
29070
|
-
electron.ipcMain.handle(Channels
|
|
29135
|
+
electron.ipcMain.handle(Channels.AGENT_CHECKPOINT_UPDATE_NOTE, (event, checkpointId, note) => {
|
|
29071
29136
|
requireTrusted(event);
|
|
29072
29137
|
return runtime2.updateCheckpointNote(checkpointId, note || "");
|
|
29073
29138
|
});
|
|
29074
|
-
electron.ipcMain.handle(Channels
|
|
29139
|
+
electron.ipcMain.handle(Channels.AGENT_UNDO_LAST_ACTION, (event) => {
|
|
29075
29140
|
requireTrusted(event);
|
|
29076
29141
|
return runtime2.undoLastAction();
|
|
29077
29142
|
});
|
|
29078
|
-
electron.ipcMain.handle(Channels
|
|
29143
|
+
electron.ipcMain.handle(Channels.AGENT_SESSION_CAPTURE, (event, note) => {
|
|
29079
29144
|
requireTrusted(event);
|
|
29080
29145
|
return runtime2.captureSession(note);
|
|
29081
29146
|
});
|
|
29082
29147
|
electron.ipcMain.handle(
|
|
29083
|
-
Channels
|
|
29148
|
+
Channels.AGENT_SESSION_RESTORE,
|
|
29084
29149
|
(event, snapshot2) => {
|
|
29085
29150
|
requireTrusted(event);
|
|
29086
29151
|
return runtime2.restoreSession(snapshot2);
|
|
29087
29152
|
}
|
|
29088
29153
|
);
|
|
29089
29154
|
registerBookmarkHandlers();
|
|
29090
|
-
electron.ipcMain.handle(Channels
|
|
29155
|
+
electron.ipcMain.handle(Channels.HIGHLIGHT_CAPTURE, async (event) => {
|
|
29091
29156
|
requireTrusted(event);
|
|
29092
29157
|
try {
|
|
29093
29158
|
const activeTab = tabManager.getActiveTab();
|
|
@@ -29113,10 +29178,10 @@ function registerIpcHandlers(windowState, runtime2) {
|
|
|
29113
29178
|
void emitHighlightCount();
|
|
29114
29179
|
}
|
|
29115
29180
|
if (!chromeView.webContents.isDestroyed()) {
|
|
29116
|
-
chromeView.webContents.send(Channels
|
|
29181
|
+
chromeView.webContents.send(Channels.HIGHLIGHT_CAPTURE_RESULT, result);
|
|
29117
29182
|
}
|
|
29118
29183
|
});
|
|
29119
|
-
electron.ipcMain.on(Channels
|
|
29184
|
+
electron.ipcMain.on(Channels.HIGHLIGHT_SELECTION, (event, text) => {
|
|
29120
29185
|
try {
|
|
29121
29186
|
const wc = event.sender;
|
|
29122
29187
|
if (wc.isDestroyed()) return;
|
|
@@ -29125,18 +29190,18 @@ function registerIpcHandlers(windowState, runtime2) {
|
|
|
29125
29190
|
void persistAndMarkHighlight(wc, text).then((result) => {
|
|
29126
29191
|
if (result.success && !chromeView.webContents.isDestroyed()) {
|
|
29127
29192
|
void emitHighlightCount();
|
|
29128
|
-
chromeView.webContents.send(Channels
|
|
29193
|
+
chromeView.webContents.send(Channels.HIGHLIGHT_CAPTURE_RESULT, result);
|
|
29129
29194
|
}
|
|
29130
29195
|
});
|
|
29131
29196
|
} catch (err) {
|
|
29132
29197
|
logger$4.warn("Failed to persist auto-highlight selection:", err);
|
|
29133
29198
|
}
|
|
29134
29199
|
});
|
|
29135
|
-
electron.ipcMain.handle(Channels
|
|
29200
|
+
electron.ipcMain.handle(Channels.HIGHLIGHT_NAV_COUNT, (event) => {
|
|
29136
29201
|
requireTrusted(event);
|
|
29137
29202
|
return getActiveHighlightCountSafe();
|
|
29138
29203
|
});
|
|
29139
|
-
electron.ipcMain.handle(Channels
|
|
29204
|
+
electron.ipcMain.handle(Channels.HIGHLIGHT_NAV_SCROLL, (event, index) => {
|
|
29140
29205
|
requireTrusted(event);
|
|
29141
29206
|
const info = getActiveTabInfo(tabManager);
|
|
29142
29207
|
if (!info) return false;
|
|
@@ -29147,7 +29212,7 @@ function registerIpcHandlers(windowState, runtime2) {
|
|
|
29147
29212
|
return false;
|
|
29148
29213
|
}
|
|
29149
29214
|
});
|
|
29150
|
-
electron.ipcMain.handle(Channels
|
|
29215
|
+
electron.ipcMain.handle(Channels.HIGHLIGHT_NAV_REMOVE, async (event, index) => {
|
|
29151
29216
|
requireTrusted(event);
|
|
29152
29217
|
const info = getActiveTabInfo(tabManager);
|
|
29153
29218
|
if (!info) return false;
|
|
@@ -29162,7 +29227,7 @@ function registerIpcHandlers(windowState, runtime2) {
|
|
|
29162
29227
|
return false;
|
|
29163
29228
|
}
|
|
29164
29229
|
});
|
|
29165
|
-
electron.ipcMain.handle(Channels
|
|
29230
|
+
electron.ipcMain.handle(Channels.HIGHLIGHT_NAV_CLEAR, async (event) => {
|
|
29166
29231
|
requireTrusted(event);
|
|
29167
29232
|
const info = getActiveTabInfo(tabManager);
|
|
29168
29233
|
if (!info) return false;
|
|
@@ -29178,26 +29243,26 @@ function registerIpcHandlers(windowState, runtime2) {
|
|
|
29178
29243
|
}
|
|
29179
29244
|
});
|
|
29180
29245
|
const findBridge = createFindInPageBridge(tabManager, chromeView);
|
|
29181
|
-
electron.ipcMain.handle(Channels
|
|
29246
|
+
electron.ipcMain.handle(Channels.FIND_IN_PAGE_START, (event, text, options) => {
|
|
29182
29247
|
requireTrusted(event);
|
|
29183
29248
|
return findBridge.start(text, options);
|
|
29184
29249
|
});
|
|
29185
|
-
electron.ipcMain.handle(Channels
|
|
29250
|
+
electron.ipcMain.handle(Channels.FIND_IN_PAGE_NEXT, (event, forward) => {
|
|
29186
29251
|
requireTrusted(event);
|
|
29187
29252
|
return findBridge.next(forward);
|
|
29188
29253
|
});
|
|
29189
|
-
electron.ipcMain.handle(Channels
|
|
29254
|
+
electron.ipcMain.handle(Channels.FIND_IN_PAGE_STOP, (event, action) => {
|
|
29190
29255
|
requireTrusted(event);
|
|
29191
29256
|
findBridge.stop(action);
|
|
29192
29257
|
});
|
|
29193
29258
|
registerHistoryHandlers();
|
|
29194
|
-
electron.ipcMain.handle(Channels
|
|
29259
|
+
electron.ipcMain.handle(Channels.DEVTOOLS_PANEL_TOGGLE, (event) => {
|
|
29195
29260
|
requireTrusted(event);
|
|
29196
29261
|
windowState.uiState.devtoolsPanelOpen = !windowState.uiState.devtoolsPanelOpen;
|
|
29197
29262
|
layoutViews(windowState);
|
|
29198
29263
|
return { open: windowState.uiState.devtoolsPanelOpen };
|
|
29199
29264
|
});
|
|
29200
|
-
electron.ipcMain.handle(Channels
|
|
29265
|
+
electron.ipcMain.handle(Channels.DEVTOOLS_PANEL_RESIZE, (event, height) => {
|
|
29201
29266
|
requireTrusted(event);
|
|
29202
29267
|
const clamped = Math.max(MIN_DEVTOOLS_PANEL, Math.min(MAX_DEVTOOLS_PANEL, Math.round(height)));
|
|
29203
29268
|
windowState.uiState.devtoolsPanelHeight = clamped;
|
|
@@ -29213,15 +29278,15 @@ function registerIpcHandlers(windowState, runtime2) {
|
|
|
29213
29278
|
registerCodexHandlers();
|
|
29214
29279
|
registerOpenRouterHandlers(applySettingChange);
|
|
29215
29280
|
registerSidebarHandlers(windowState, requireTrusted);
|
|
29216
|
-
electron.ipcMain.handle(Channels
|
|
29281
|
+
electron.ipcMain.handle(Channels.AUTOMATION_GET_INSTALLED, (event) => {
|
|
29217
29282
|
requireTrusted(event);
|
|
29218
29283
|
return getInstalledKits();
|
|
29219
29284
|
});
|
|
29220
|
-
electron.ipcMain.handle(Channels
|
|
29285
|
+
electron.ipcMain.handle(Channels.AUTOMATION_INSTALL_FROM_FILE, async (event) => {
|
|
29221
29286
|
requireTrusted(event);
|
|
29222
29287
|
return await installKitFromFile();
|
|
29223
29288
|
});
|
|
29224
|
-
electron.ipcMain.handle(Channels
|
|
29289
|
+
electron.ipcMain.handle(Channels.AUTOMATION_UNINSTALL, (event, id) => {
|
|
29225
29290
|
requireTrusted(event);
|
|
29226
29291
|
assertString(id, "id");
|
|
29227
29292
|
return uninstallKit(id, getScheduledKitIds());
|
|
@@ -29230,7 +29295,7 @@ function registerIpcHandlers(windowState, runtime2) {
|
|
|
29230
29295
|
registerAutofillHandlers(windowState);
|
|
29231
29296
|
registerPageDiffHandlers(windowState, sendToRendererViews);
|
|
29232
29297
|
registerResearchHandlers(() => getResearchOrchestrator());
|
|
29233
|
-
electron.ipcMain.handle(Channels
|
|
29298
|
+
electron.ipcMain.handle(Channels.CLEAR_BROWSING_DATA, async (event, options) => {
|
|
29234
29299
|
requireTrusted(event);
|
|
29235
29300
|
const { cache, cookies, history, localStorage: clearLs, timeRange } = options;
|
|
29236
29301
|
if (cache) {
|
|
@@ -29248,46 +29313,46 @@ function registerIpcHandlers(windowState, runtime2) {
|
|
|
29248
29313
|
});
|
|
29249
29314
|
setDownloadBroadcaster(sendToRendererViews);
|
|
29250
29315
|
setPermissionBroadcaster(sendToRendererViews);
|
|
29251
|
-
electron.ipcMain.handle(Channels
|
|
29316
|
+
electron.ipcMain.handle(Channels.DOWNLOADS_GET, (event) => {
|
|
29252
29317
|
requireTrusted(event);
|
|
29253
29318
|
return listDownloads();
|
|
29254
29319
|
});
|
|
29255
|
-
electron.ipcMain.handle(Channels
|
|
29320
|
+
electron.ipcMain.handle(Channels.DOWNLOADS_CLEAR, (event) => {
|
|
29256
29321
|
requireTrusted(event);
|
|
29257
29322
|
clearDownloads();
|
|
29258
29323
|
return true;
|
|
29259
29324
|
});
|
|
29260
|
-
electron.ipcMain.handle(Channels
|
|
29325
|
+
electron.ipcMain.handle(Channels.DOWNLOADS_OPEN, (event, id) => {
|
|
29261
29326
|
requireTrusted(event);
|
|
29262
29327
|
return openDownload(id);
|
|
29263
29328
|
});
|
|
29264
|
-
electron.ipcMain.handle(Channels
|
|
29329
|
+
electron.ipcMain.handle(Channels.DOWNLOADS_SHOW_IN_FOLDER, (event, id) => {
|
|
29265
29330
|
requireTrusted(event);
|
|
29266
29331
|
return showDownloadInFolder(id);
|
|
29267
29332
|
});
|
|
29268
|
-
electron.ipcMain.handle(Channels
|
|
29333
|
+
electron.ipcMain.handle(Channels.PERMISSIONS_GET, (event) => {
|
|
29269
29334
|
requireTrusted(event);
|
|
29270
29335
|
return listPermissions();
|
|
29271
29336
|
});
|
|
29272
|
-
electron.ipcMain.handle(Channels
|
|
29337
|
+
electron.ipcMain.handle(Channels.PERMISSIONS_CLEAR, (event) => {
|
|
29273
29338
|
requireTrusted(event);
|
|
29274
29339
|
clearPermissions();
|
|
29275
29340
|
return true;
|
|
29276
29341
|
});
|
|
29277
|
-
electron.ipcMain.handle(Channels
|
|
29342
|
+
electron.ipcMain.handle(Channels.PERMISSIONS_CLEAR_ORIGIN, (event, origin) => {
|
|
29278
29343
|
requireTrusted(event);
|
|
29279
29344
|
clearPermissionsForOrigin(origin);
|
|
29280
29345
|
return true;
|
|
29281
29346
|
});
|
|
29282
|
-
electron.ipcMain.handle(Channels
|
|
29347
|
+
electron.ipcMain.handle(Channels.UPDATES_CHECK, (event) => {
|
|
29283
29348
|
requireTrusted(event);
|
|
29284
29349
|
return checkForUpdates();
|
|
29285
29350
|
});
|
|
29286
|
-
electron.ipcMain.handle(Channels
|
|
29351
|
+
electron.ipcMain.handle(Channels.UPDATES_OPEN_DOWNLOAD, (event) => {
|
|
29287
29352
|
requireTrusted(event);
|
|
29288
29353
|
return openUpdateDownload();
|
|
29289
29354
|
});
|
|
29290
|
-
electron.ipcMain.handle(Channels
|
|
29355
|
+
electron.ipcMain.handle(Channels.TAB_TOGGLE_PIP, async (event) => {
|
|
29291
29356
|
requireTrusted(event);
|
|
29292
29357
|
return togglePictureInPicture(tabManager);
|
|
29293
29358
|
});
|
|
@@ -30629,21 +30694,21 @@ async function bootstrap() {
|
|
|
30629
30694
|
}
|
|
30630
30695
|
}
|
|
30631
30696
|
if (!state2.chromeView.webContents.isDestroyed()) {
|
|
30632
|
-
state2.chromeView.webContents.send(Channels
|
|
30697
|
+
state2.chromeView.webContents.send(Channels.HIGHLIGHT_COUNT_UPDATE, count);
|
|
30633
30698
|
}
|
|
30634
30699
|
if (!state2.sidebarView.webContents.isDestroyed()) {
|
|
30635
|
-
state2.sidebarView.webContents.send(Channels
|
|
30700
|
+
state2.sidebarView.webContents.send(Channels.HIGHLIGHT_COUNT_UPDATE, count);
|
|
30636
30701
|
}
|
|
30637
30702
|
if (!state2.devtoolsPanelView.webContents.isDestroyed()) {
|
|
30638
30703
|
state2.devtoolsPanelView.webContents.send(
|
|
30639
|
-
Channels
|
|
30704
|
+
Channels.HIGHLIGHT_COUNT_UPDATE,
|
|
30640
30705
|
count
|
|
30641
30706
|
);
|
|
30642
30707
|
}
|
|
30643
30708
|
};
|
|
30644
30709
|
const windowState = createMainWindow((tabs, activeId, meta) => {
|
|
30645
30710
|
windowState.chromeView.webContents.send(
|
|
30646
|
-
Channels
|
|
30711
|
+
Channels.TAB_STATE_UPDATE,
|
|
30647
30712
|
tabs,
|
|
30648
30713
|
activeId
|
|
30649
30714
|
);
|
|
@@ -30670,16 +30735,16 @@ async function bootstrap() {
|
|
|
30670
30735
|
installAdBlocking(tabManager);
|
|
30671
30736
|
setDevToolsPanelListener((state2) => {
|
|
30672
30737
|
if (!devtoolsPanelView.webContents.isDestroyed()) {
|
|
30673
|
-
devtoolsPanelView.webContents.send(Channels
|
|
30738
|
+
devtoolsPanelView.webContents.send(Channels.DEVTOOLS_PANEL_STATE, state2);
|
|
30674
30739
|
}
|
|
30675
30740
|
});
|
|
30676
30741
|
registerIpcHandlers(windowState, runtime);
|
|
30677
30742
|
tabManager.onSecurityStateChange((tabId, state2) => {
|
|
30678
30743
|
if (!chromeView.webContents.isDestroyed()) {
|
|
30679
|
-
chromeView.webContents.send(Channels
|
|
30744
|
+
chromeView.webContents.send(Channels.SECURITY_STATE_UPDATE, { tabId, state: state2 });
|
|
30680
30745
|
}
|
|
30681
30746
|
if (!sidebarView.webContents.isDestroyed()) {
|
|
30682
|
-
sidebarView.webContents.send(Channels
|
|
30747
|
+
sidebarView.webContents.send(Channels.SECURITY_STATE_UPDATE, { tabId, state: state2 });
|
|
30683
30748
|
}
|
|
30684
30749
|
});
|
|
30685
30750
|
registerHighlightShortcut(windowState.mainWindow, tabManager);
|
|
@@ -30715,7 +30780,7 @@ async function bootstrap() {
|
|
|
30715
30780
|
},
|
|
30716
30781
|
clearBrowsingData: () => {
|
|
30717
30782
|
if (!chromeView.webContents.isDestroyed()) {
|
|
30718
|
-
chromeView.webContents.send(Channels
|
|
30783
|
+
chromeView.webContents.send(Channels.CLEAR_BROWSING_DATA_OPEN);
|
|
30719
30784
|
}
|
|
30720
30785
|
},
|
|
30721
30786
|
togglePictureInPicture: () => {
|
|
@@ -30723,12 +30788,12 @@ async function bootstrap() {
|
|
|
30723
30788
|
}
|
|
30724
30789
|
});
|
|
30725
30790
|
subscribe((state2) => {
|
|
30726
|
-
chromeView.webContents.send(Channels
|
|
30727
|
-
sidebarView.webContents.send(Channels
|
|
30791
|
+
chromeView.webContents.send(Channels.BOOKMARKS_UPDATE, state2);
|
|
30792
|
+
sidebarView.webContents.send(Channels.BOOKMARKS_UPDATE, state2);
|
|
30728
30793
|
});
|
|
30729
30794
|
subscribe$1((state2) => {
|
|
30730
|
-
chromeView.webContents.send(Channels
|
|
30731
|
-
sidebarView.webContents.send(Channels
|
|
30795
|
+
chromeView.webContents.send(Channels.HISTORY_UPDATE, state2);
|
|
30796
|
+
sidebarView.webContents.send(Channels.HISTORY_UPDATE, state2);
|
|
30732
30797
|
});
|
|
30733
30798
|
installDownloadHandler(chromeView);
|
|
30734
30799
|
installPermissionHandler();
|