dsh-split-workspace 0.5.0 → 0.9.0
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/README.md +324 -14
- package/lib/client.js +1286 -52
- package/lib/index.js +269 -6
- package/package.json +17 -5
package/lib/client.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
// GENERATED FILE — edit src/client/*.js and run `npm run build`.
|
|
2
|
+
// The sections share one module-loader closure; their order matters.
|
|
1
3
|
// dsh-split-workspace — browser half (module-loader bundle)
|
|
2
4
|
//
|
|
3
5
|
// ARCHITECTURE MAP (top → bottom):
|
|
@@ -73,7 +75,7 @@ window.__ModuleLoader__.load({
|
|
|
73
75
|
// ---------------------------------------------------------------------
|
|
74
76
|
|
|
75
77
|
const PLUGIN_ID = "dsh-split-workspace";
|
|
76
|
-
const PLUGIN_VERSION = "0.
|
|
78
|
+
const PLUGIN_VERSION = "0.9.0";
|
|
77
79
|
const LOG_PREFIX = "[dsh-split-workspace]";
|
|
78
80
|
const TREE_KEY = "dsh.split-workspace.tree.v1";
|
|
79
81
|
const OPEN_KEY = "dsh.split-workspace.open.v2";
|
|
@@ -83,6 +85,27 @@ window.__ModuleLoader__.load({
|
|
|
83
85
|
const HINT_KEY = "dsh.split-workspace.hint.v1";
|
|
84
86
|
const MIN_KEY = "dsh.split-workspace.minimized.v1";
|
|
85
87
|
const CHIP_KEY = "dsh.split-workspace.chip.v1";
|
|
88
|
+
const FLOAT_KEY = "dsh.split-workspace.float.v1";
|
|
89
|
+
const PERF_KEY = "dsh.split-workspace.performance.v1";
|
|
90
|
+
const SEEN_VERSION_KEY = "dsh.split-workspace.seen-version.v1";
|
|
91
|
+
const UPDATE_DISMISSED_KEY = "dsh.split-workspace.update-dismissed.v1";
|
|
92
|
+
const UPDATE_POLL_MS = 120000;
|
|
93
|
+
/** `#dsvWindow=<sessionId>` marks a standalone system window opened by
|
|
94
|
+
the Host route: that page renders exactly one conversation and nothing
|
|
95
|
+
else (the split workspace and floats are skipped there). Read lazily on
|
|
96
|
+
every seat render: the fragment can be applied after a plugin bundle is
|
|
97
|
+
evaluated on some hosts, so a load-time snapshot is not reliable. */
|
|
98
|
+
function standaloneSessionId() {
|
|
99
|
+
try {
|
|
100
|
+
if (typeof window === "undefined" || window.location === undefined) return null;
|
|
101
|
+
const hash = String(window.location.hash || "");
|
|
102
|
+
if (hash.length < 2) return null;
|
|
103
|
+
const id = new URLSearchParams(hash.slice(1)).get("dsvWindow");
|
|
104
|
+
return id !== null && id !== undefined && id !== "" && isValidSessionId(id) ? id : null;
|
|
105
|
+
} catch {
|
|
106
|
+
return null;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
86
109
|
function readChipPos() {
|
|
87
110
|
const raw = storageGet(CHIP_KEY);
|
|
88
111
|
if (!raw) return null;
|
|
@@ -104,6 +127,16 @@ window.__ModuleLoader__.load({
|
|
|
104
127
|
function writeMinimized(value) {
|
|
105
128
|
storageSet(MIN_KEY, value === true ? "1" : "0");
|
|
106
129
|
}
|
|
130
|
+
/** Performance mode is a persisted, user-visible preference: it trades
|
|
131
|
+
optional observers / animations for responsiveness on slow machines.
|
|
132
|
+
It is ON by default; only an explicit "0" turns it off, so existing
|
|
133
|
+
users who already chose the fast mode keep a normal experience. */
|
|
134
|
+
function readPerformanceMode() {
|
|
135
|
+
return storageGet(PERF_KEY) !== "0";
|
|
136
|
+
}
|
|
137
|
+
function writePerformanceMode(value) {
|
|
138
|
+
storageSet(PERF_KEY, value === true ? "1" : "0");
|
|
139
|
+
}
|
|
107
140
|
/* There is exactly one layout policy: AUTO, derived from the pane count.
|
|
108
141
|
The old per-run mode menu (columns/rows/grid) is gone: it only ever
|
|
109
142
|
produced a hand-picked arrangement that the next add/close immediately
|
|
@@ -299,6 +332,12 @@ window.__ModuleLoader__.load({
|
|
|
299
332
|
|
|
300
333
|
function beginDragPreview(title, hint, sourceEl, size) {
|
|
301
334
|
endDragPreview();
|
|
335
|
+
// Performance mode: the floating preview is the expensive part of a
|
|
336
|
+
// drag. It clones (or builds) a whole conversation window and moves it
|
|
337
|
+
// with the pointer on every frame, so the fast mode skips it entirely.
|
|
338
|
+
// Dragging still works: the drop target and the reflow hole stay, only
|
|
339
|
+
// the thumbnail preview disappears.
|
|
340
|
+
if (performanceModeOn()) return;
|
|
302
341
|
// A pane drag carries a real miniature of the conversation window: clone
|
|
303
342
|
// the live pane, scale it down, and hold the clone as the floating
|
|
304
343
|
// preview. Sidebar drags of an already-open session find their pane the
|
|
@@ -538,9 +577,10 @@ window.__ModuleLoader__.load({
|
|
|
538
577
|
helpOpen: "Split view help",
|
|
539
578
|
helpClose: "Close",
|
|
540
579
|
helpShortcuts: "Shortcuts",
|
|
541
|
-
helpGestures: "Use the sidebar-footer split menu (Add split / Exit split / Minimize / Reset split) or drag a conversation from the sidebar onto the page to start a split. Right-click a conversation for Add to split / Leave split. Drag a pane by its header to move it: its slot closes and a dashed hole previews where it will land. Drag the dividers to resize. ✕ closes a pane.",
|
|
580
|
+
helpGestures: "Use the sidebar-footer split menu (Add split / Exit split / Minimize / Reset split) or drag a conversation from the sidebar onto the page to start a split. Right-click a conversation for Add to split / Leave split / Enter floating window; a floating window's Dock to split button puts it back. Drag a pane by its header to move it: its slot closes and a dashed hole previews where it will land. Drag the dividers to resize. ✕ closes a pane.",
|
|
542
581
|
helpDisable: "Disable split view: run window.__dshSplitWorkspace.setEnabled(false), or set localStorage 'dsh.split-workspace.enabled.v1' to \"0\". Reset the layout: window.__dshSplitWorkspace.reset().",
|
|
543
582
|
helpDiagnostics: "Diagnostics: window.__dshSplitWorkspace.health() — see the README section “Safety, recovery and diagnostics”.",
|
|
583
|
+
helpRestart: "If an update or a full-restart change does not take effect, open the split menu and choose “Restart DSH” (Desktop), or quit DSH and open it again. Installed plugins are normally loaded live by DSH's HMR; the restart entry is the fallback.",
|
|
544
584
|
tipTitle: "Split view is on",
|
|
545
585
|
tipBody: "Alt+T toggles the compact composer · Alt+Shift+←/→/↑/↓ moves between panes · drag a conversation from the sidebar to split · ✕ closes a pane. To turn split view off, run window.__dshSplitWorkspace.setEnabled(false).",
|
|
546
586
|
compactionDone: "Context compacted — the summary is in the conversation.",
|
|
@@ -576,6 +616,38 @@ window.__ModuleLoader__.load({
|
|
|
576
616
|
addSplitPending: "Pending",
|
|
577
617
|
splitExited: "Split view closed",
|
|
578
618
|
splitLeft: "Left split view",
|
|
619
|
+
menuFloatOpen: "Enter floating window",
|
|
620
|
+
menuFloatClose: "Exit floating window",
|
|
621
|
+
floatDock: "Dock to split",
|
|
622
|
+
floatClose: "Close floating window",
|
|
623
|
+
floatEntered: "Opened in a floating window",
|
|
624
|
+
floatDocked: "Docked to the split view",
|
|
625
|
+
floatClosed: "Floating window closed",
|
|
626
|
+
floatHint: "Drag the title bar to move · drag an edge to resize",
|
|
627
|
+
helpFloat: "Right-click a conversation → Enter floating window detaches it into a movable window; Dock to split puts it back.",
|
|
628
|
+
menuSystemWindow: "Open in system window",
|
|
629
|
+
systemWindowOpened: "Opened in a separate system window",
|
|
630
|
+
systemWindowFailed: "Could not open a system window",
|
|
631
|
+
standaloneFullscreen: "Fullscreen",
|
|
632
|
+
performanceMode: "Performance mode",
|
|
633
|
+
performanceOn: "Performance mode on — animations and background observers are reduced",
|
|
634
|
+
performanceOff: "Performance mode off",
|
|
635
|
+
reloadClient: "Reload interface",
|
|
636
|
+
refreshInterface: "Refresh interface",
|
|
637
|
+
restartApp: "Restart DSH",
|
|
638
|
+
restartTitle: "Restart DSH?",
|
|
639
|
+
restartBody: "This closes and reopens DeepSeek Harness so newly installed plugins and changes that need a full restart can load. Running tasks will be interrupted.",
|
|
640
|
+
restartNow: "Restart now",
|
|
641
|
+
restarting: "Restarting DSH…",
|
|
642
|
+
restartFailed: "Could not restart DSH automatically — quit DSH and open it again.",
|
|
643
|
+
restartUnsupported: "Automatic restart is available in DSH Desktop. In a browser, reload the page or restart the `dsh web` process.",
|
|
644
|
+
fallbackLauncher: "Split view",
|
|
645
|
+
updateReady: "Version {v} is installed — reload to apply",
|
|
646
|
+
updateRestart: "Version {v} is installed — if the interface did not update, restart DSH",
|
|
647
|
+
reloadNow: "Reload now",
|
|
648
|
+
gotIt: "Got it",
|
|
649
|
+
laterLabel: "Later",
|
|
650
|
+
updatedToast: "Updated to v{v}",
|
|
579
651
|
};
|
|
580
652
|
const ZH = {
|
|
581
653
|
label: "分屏视图",
|
|
@@ -630,9 +702,10 @@ window.__ModuleLoader__.load({
|
|
|
630
702
|
helpOpen: "分屏帮助",
|
|
631
703
|
helpClose: "关闭",
|
|
632
704
|
helpShortcuts: "快捷键",
|
|
633
|
-
helpGestures: "点击侧边栏底部的分屏按钮打开菜单(添加分屏 / 退出分屏 / 最小化分屏 / 重置分屏),或从左侧会话列表把对话拖到页面即可分屏;右键会话可加入 /
|
|
705
|
+
helpGestures: "点击侧边栏底部的分屏按钮打开菜单(添加分屏 / 退出分屏 / 最小化分屏 / 重置分屏),或从左侧会话列表把对话拖到页面即可分屏;右键会话可加入 / 退出分屏,也可以“进入浮窗”把会话变成独立浮窗(浮窗标题栏的“回到分屏”可放回)。拖住面板标题栏可移动面板:原位置收起,虚线空位预览落点。拖动分隔条可调整大小,✕ 关闭面板。",
|
|
634
706
|
helpDisable: "停用分屏:运行 window.__dshSplitWorkspace.setEnabled(false),或将 localStorage 'dsh.split-workspace.enabled.v1' 设为 \"0\"。重置布局:window.__dshSplitWorkspace.reset()。",
|
|
635
707
|
helpDiagnostics: "诊断:window.__dshSplitWorkspace.health() — 详见 README“安全性、恢复与诊断”。",
|
|
708
|
+
helpRestart: "如果更新或需要完整重启的更改没有生效,可打开分屏菜单选择“重启 DSH”(桌面版),或退出 DSH 后重新打开。DSH 的 HMR 通常会自动加载已安装的插件;重启入口是兜底方案。",
|
|
636
709
|
tipTitle: "分屏视图已开启",
|
|
637
710
|
tipBody: "Alt+T 切换紧凑输入行 · Alt+Shift+←/→/↑/↓ 切换面板 · 从左侧拖入对话可分屏 · ✕ 关闭面板。如需停用,运行 window.__dshSplitWorkspace.setEnabled(false)。",
|
|
638
711
|
compactionDone: "上下文已压缩 — 摘要已写入对话。",
|
|
@@ -668,6 +741,38 @@ window.__ModuleLoader__.load({
|
|
|
668
741
|
addSplitPending: "待分屏",
|
|
669
742
|
splitExited: "已退出分屏",
|
|
670
743
|
splitLeft: "已退出分屏",
|
|
744
|
+
menuFloatOpen: "进入浮窗",
|
|
745
|
+
menuFloatClose: "退出浮窗",
|
|
746
|
+
floatDock: "回到分屏",
|
|
747
|
+
floatClose: "关闭浮窗",
|
|
748
|
+
floatEntered: "已在浮窗中打开",
|
|
749
|
+
floatDocked: "已回到分屏",
|
|
750
|
+
floatClosed: "浮窗已关闭",
|
|
751
|
+
floatHint: "拖动标题栏移动 · 拖动边缘调整大小",
|
|
752
|
+
helpFloat: "右键会话 → 进入浮窗,可把该会话变成独立浮窗;浮窗标题栏的“回到分屏”可放回分屏。",
|
|
753
|
+
menuSystemWindow: "在系统窗口打开",
|
|
754
|
+
systemWindowOpened: "已在独立系统窗口中打开",
|
|
755
|
+
systemWindowFailed: "无法打开系统窗口",
|
|
756
|
+
standaloneFullscreen: "全屏",
|
|
757
|
+
performanceMode: "性能模式",
|
|
758
|
+
performanceOn: "性能模式已开启:动画与后台观察器已精简",
|
|
759
|
+
performanceOff: "性能模式已关闭",
|
|
760
|
+
reloadClient: "重载界面",
|
|
761
|
+
refreshInterface: "刷新界面",
|
|
762
|
+
restartApp: "重启 DSH",
|
|
763
|
+
restartTitle: "重启 DSH?",
|
|
764
|
+
restartBody: "将关闭并重新打开 DeepSeek Harness,以加载新安装的插件或需要完整重启的更改。正在运行的任务会被中断。",
|
|
765
|
+
restartNow: "立即重启",
|
|
766
|
+
restarting: "正在重启 DSH…",
|
|
767
|
+
restartFailed: "无法自动重启 DSH,请退出 DSH 后重新打开。",
|
|
768
|
+
restartUnsupported: "自动重启仅支持 DSH 桌面版;浏览器中请刷新页面或重启 dsh web 进程。",
|
|
769
|
+
fallbackLauncher: "分屏视图",
|
|
770
|
+
updateReady: "已安装 v{v},刷新页面生效",
|
|
771
|
+
updateRestart: "已安装 v{v},若界面未更新请重启 DSH",
|
|
772
|
+
reloadNow: "刷新页面",
|
|
773
|
+
gotIt: "知道了",
|
|
774
|
+
laterLabel: "稍后",
|
|
775
|
+
updatedToast: "已更新到 v{v}",
|
|
671
776
|
};
|
|
672
777
|
|
|
673
778
|
/** Fallback translator: every locale wrapper unwraps back to this. */
|
|
@@ -808,6 +913,23 @@ window.__ModuleLoader__.load({
|
|
|
808
913
|
box-shadow: 0 0 0 1.5px var(--dsw-alias-bg-layer-1, var(--dsw-alias-bg-base));
|
|
809
914
|
}
|
|
810
915
|
|
|
916
|
+
/* Fallback launcher: shown only when the stock sidebar footer does not
|
|
917
|
+
render the plugin's action, so the split menu stays reachable from the
|
|
918
|
+
conversation column's bottom-left corner. */
|
|
919
|
+
.dsv-fallback-launcher {
|
|
920
|
+
position: fixed; left: 16px; bottom: 16px; z-index: 130;
|
|
921
|
+
display: inline-flex; align-items: center; gap: 6px;
|
|
922
|
+
height: 30px; padding: 0 10px; border-radius: 9px;
|
|
923
|
+
border: 1px solid var(--dsw-alias-border-l2);
|
|
924
|
+
background: var(--dsw-alias-bg-layer-1, var(--dsw-alias-bg-base));
|
|
925
|
+
color: var(--dsw-alias-label-secondary);
|
|
926
|
+
font-family: var(--dsw-font-family, system-ui, sans-serif); font-size: 12px;
|
|
927
|
+
cursor: pointer; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
|
|
928
|
+
}
|
|
929
|
+
.dsv-fallback-launcher:hover { color: var(--dsw-alias-label-primary); background: var(--dsw-alias-interactive-bg-hover); }
|
|
930
|
+
.dsv-fallback-label { white-space: nowrap; }
|
|
931
|
+
html[data-dsv-performance="1"] .dsv-fallback-launcher { box-shadow: none; }
|
|
932
|
+
|
|
811
933
|
/* ---- 0.5.0 launcher: the sidebar footer menu and the multi-select
|
|
812
934
|
"add split" dialog. Both mount through the shell overlay seat, so they
|
|
813
935
|
are never clipped by the sidebar column or the split overlay. ---- */
|
|
@@ -916,6 +1038,82 @@ window.__ModuleLoader__.load({
|
|
|
916
1038
|
@media (prefers-reduced-motion: reduce) {
|
|
917
1039
|
.dsv-launcher-menu, .dsv-modal-backdrop { animation: none; }
|
|
918
1040
|
}
|
|
1041
|
+
/* ---- 0.6.0 floating windows: a movable/resizable in-app window that
|
|
1042
|
+
hosts ONE native conversation. Floats render from the always-mounted
|
|
1043
|
+
shell.overlay seat, sit above the split overlay, and are mutually
|
|
1044
|
+
exclusive with split panes per session (enter/leave switches modes). ---- */
|
|
1045
|
+
.dsv-float-layer {
|
|
1046
|
+
position: fixed; inset: 0; z-index: 85; pointer-events: none;
|
|
1047
|
+
font-family: var(--dsw-font-family, system-ui, sans-serif);
|
|
1048
|
+
color: var(--dsw-alias-label-primary);
|
|
1049
|
+
}
|
|
1050
|
+
.dsv-float-window {
|
|
1051
|
+
position: fixed; display: flex; flex-direction: column;
|
|
1052
|
+
box-sizing: border-box;
|
|
1053
|
+
min-width: 320px; min-height: 220px; overflow: hidden;
|
|
1054
|
+
border: 1px solid var(--dsw-alias-border-l2); border-radius: 14px;
|
|
1055
|
+
background: var(--dsw-alias-bg-base);
|
|
1056
|
+
box-shadow: 0 18px 48px rgba(15, 23, 42, .22), 0 2px 6px rgba(15, 23, 42, .12);
|
|
1057
|
+
pointer-events: auto;
|
|
1058
|
+
animation: dsv-float-in .16s ease-out;
|
|
1059
|
+
transition: box-shadow .16s ease, border-color .16s ease;
|
|
1060
|
+
--dsh-chat-content-width: 748px;
|
|
1061
|
+
--dsh-composer-card-max-width: calc(var(--dsh-chat-content-width) + 32px);
|
|
1062
|
+
--dsh-composer-side-clearance: 16px;
|
|
1063
|
+
--dsh-composer-dock-inset: 8px;
|
|
1064
|
+
}
|
|
1065
|
+
.dsv-float-window.focused {
|
|
1066
|
+
border-color: color-mix(in srgb, var(--dsw-static-deepseek-500) 32%, var(--dsw-alias-border-l2));
|
|
1067
|
+
box-shadow: 0 0 0 1px color-mix(in srgb, var(--dsw-static-deepseek-500) 28%, transparent),
|
|
1068
|
+
0 22px 56px rgba(15, 23, 42, .26);
|
|
1069
|
+
}
|
|
1070
|
+
.dsv-float-body { flex: 1; min-height: 0; display: flex; }
|
|
1071
|
+
.dsv-float-body > .dsv-pane { flex: 1; min-width: 0; min-height: 0; }
|
|
1072
|
+
/* The outer window owns the frame: the re-hosted pane drops its card
|
|
1073
|
+
chrome (border/radius/glow) and keeps only its header + content. */
|
|
1074
|
+
.dsv-float-window .dsv-pane,
|
|
1075
|
+
.dsv-float-window .dsv-pane.focused {
|
|
1076
|
+
border: 0; border-radius: 0; box-shadow: none; background: transparent;
|
|
1077
|
+
}
|
|
1078
|
+
.dsv-float-window .dsv-pane-header { height: 34px; border-top-left-radius: 14px; border-top-right-radius: 14px; }
|
|
1079
|
+
.dsv-float-resize { position: absolute; z-index: 2; touch-action: none; }
|
|
1080
|
+
.dsv-float-resize-n, .dsv-float-resize-s { left: 12px; right: 12px; height: 6px; cursor: row-resize; }
|
|
1081
|
+
.dsv-float-resize-n { top: -3px; }
|
|
1082
|
+
.dsv-float-resize-s { bottom: -3px; }
|
|
1083
|
+
.dsv-float-resize-e, .dsv-float-resize-w { top: 12px; bottom: 12px; width: 6px; cursor: col-resize; }
|
|
1084
|
+
.dsv-float-resize-e { right: -3px; }
|
|
1085
|
+
.dsv-float-resize-w { left: -3px; }
|
|
1086
|
+
.dsv-float-resize-ne, .dsv-float-resize-nw, .dsv-float-resize-se, .dsv-float-resize-sw { width: 16px; height: 16px; }
|
|
1087
|
+
.dsv-float-resize-ne { right: -4px; top: -4px; cursor: nesw-resize; }
|
|
1088
|
+
.dsv-float-resize-nw { left: -4px; top: -4px; cursor: nwse-resize; }
|
|
1089
|
+
.dsv-float-resize-se { right: -4px; bottom: -4px; cursor: nwse-resize; }
|
|
1090
|
+
.dsv-float-resize-sw { left: -4px; bottom: -4px; cursor: nesw-resize; }
|
|
1091
|
+
@keyframes dsv-float-in { from { opacity: 0; transform: translateY(6px) scale(.992); } }
|
|
1092
|
+
@media (prefers-reduced-motion: reduce) {
|
|
1093
|
+
.dsv-float-window { animation: none; transition: none; }
|
|
1094
|
+
}
|
|
1095
|
+
/* ---- standalone system window (hash dsvWindow=<id>): one conversation
|
|
1096
|
+
fills the whole page, rendered into the separate OS/browser window the
|
|
1097
|
+
Host route opened. The window chrome (close/minimize/zoom/fullscreen)
|
|
1098
|
+
is the native window's own. ---- */
|
|
1099
|
+
html[data-dsv-standalone] { overflow: hidden; }
|
|
1100
|
+
html[data-dsv-standalone] body { overflow: hidden; }
|
|
1101
|
+
.dsv-standalone {
|
|
1102
|
+
position: fixed; inset: 0; z-index: 1200;
|
|
1103
|
+
display: flex; flex-direction: column; min-width: 0; min-height: 0;
|
|
1104
|
+
background: var(--dsw-alias-bg-base);
|
|
1105
|
+
color: var(--dsw-alias-label-primary);
|
|
1106
|
+
font-family: var(--dsw-font-family, system-ui, sans-serif);
|
|
1107
|
+
--dsh-chat-content-width: 748px;
|
|
1108
|
+
--dsh-composer-card-max-width: calc(var(--dsh-chat-content-width) + 32px);
|
|
1109
|
+
--dsh-composer-side-clearance: 16px;
|
|
1110
|
+
--dsh-composer-dock-inset: 8px;
|
|
1111
|
+
}
|
|
1112
|
+
.dsv-standalone > .dsv-pane {
|
|
1113
|
+
flex: 1; min-width: 0; min-height: 0;
|
|
1114
|
+
border: 0; border-radius: 0; box-shadow: none;
|
|
1115
|
+
}
|
|
1116
|
+
.dsv-standalone .dsv-pane-header { height: 40px; }
|
|
919
1117
|
/* One title per pane: the pane header owns it. The stock header keeps its
|
|
920
1118
|
view tabs and action rows but not its breadcrumb; the slim header's own
|
|
921
1119
|
title span is removed in JSX. */
|
|
@@ -1829,6 +2027,70 @@ window.__ModuleLoader__.load({
|
|
|
1829
2027
|
@media (prefers-reduced-motion: reduce) {
|
|
1830
2028
|
.dsv-drop-ghost { transition: none; }
|
|
1831
2029
|
}
|
|
2030
|
+
/* ---- performance mode -------------------------------------------------
|
|
2031
|
+
One HTML attribute turns off every non-essential paint/animation cost:
|
|
2032
|
+
no card shadows, no focus glow, no fade/zoom transitions, no render-loop
|
|
2033
|
+
animations. JS-side observers are reduced by performanceModeOn() gates. */
|
|
2034
|
+
html[data-dsv-performance="1"] .dsv-pane,
|
|
2035
|
+
html[data-dsv-performance="1"] .dsv-overlay,
|
|
2036
|
+
html[data-dsv-performance="1"] .dsv-float-window,
|
|
2037
|
+
html[data-dsv-performance="1"] .dsv-minimized-chip,
|
|
2038
|
+
html[data-dsv-performance="1"] .dsv-chip,
|
|
2039
|
+
html[data-dsv-performance="1"] .dsv-launcher-menu,
|
|
2040
|
+
html[data-dsv-performance="1"] .dsv-modal,
|
|
2041
|
+
html[data-dsv-performance="1"] .dsv-drop-ghost,
|
|
2042
|
+
html[data-dsv-performance="1"] .dsv-drag-preview {
|
|
2043
|
+
animation: none !important;
|
|
2044
|
+
transition: none !important;
|
|
2045
|
+
}
|
|
2046
|
+
html[data-dsv-performance="1"] .dsv-pane,
|
|
2047
|
+
html[data-dsv-performance="1"] .dsv-float-window,
|
|
2048
|
+
html[data-dsv-performance="1"] .dsv-chip,
|
|
2049
|
+
html[data-dsv-performance="1"] .dsv-launcher-menu,
|
|
2050
|
+
html[data-dsv-performance="1"] .dsv-modal {
|
|
2051
|
+
box-shadow: none !important;
|
|
2052
|
+
}
|
|
2053
|
+
html[data-dsv-performance="1"] .dsv-pane.focused {
|
|
2054
|
+
border-color: var(--dsw-alias-border-l2) !important;
|
|
2055
|
+
box-shadow: none !important;
|
|
2056
|
+
}
|
|
2057
|
+
html[data-dsv-performance="1"] .dsv-pane-wrap,
|
|
2058
|
+
html[data-dsv-performance="1"] .dsv-split-wrap,
|
|
2059
|
+
html[data-dsv-performance="1"] .dsv-divider::after,
|
|
2060
|
+
html[data-dsv-performance="1"] .dsv-pane-btn,
|
|
2061
|
+
html[data-dsv-performance="1"] .dsv-mode-btn {
|
|
2062
|
+
animation: none !important;
|
|
2063
|
+
transition: none !important;
|
|
2064
|
+
}
|
|
2065
|
+
html[data-dsv-performance="1"] .dsv-pane,
|
|
2066
|
+
html[data-dsv-performance="1"] .dsv-float-window {
|
|
2067
|
+
border-radius: 8px;
|
|
2068
|
+
}
|
|
2069
|
+
html[data-dsv-performance="1"] .dsv-think-root[data-state="running"] .dsv-think-row::after,
|
|
2070
|
+
html[data-dsv-performance="1"] .dsv-rowcard-root[data-state="running"] .dsv-rowcard-row::after {
|
|
2071
|
+
animation: none !important;
|
|
2072
|
+
display: none !important;
|
|
2073
|
+
}
|
|
2074
|
+
/* update-ready chip: shown when the on-disk plugin version differs from
|
|
2075
|
+
the client bundle this page loaded. */
|
|
2076
|
+
.dsv-update-chip {
|
|
2077
|
+
position: fixed; right: 16px; bottom: 16px; z-index: 2147483000;
|
|
2078
|
+
display: flex; align-items: center; gap: 8px;
|
|
2079
|
+
padding: 8px 10px 8px 12px; border-radius: 10px;
|
|
2080
|
+
border: 1px solid var(--dsw-alias-border-l2);
|
|
2081
|
+
background: var(--dsw-alias-bg-overlay, var(--dsw-alias-bg-layer-1));
|
|
2082
|
+
color: var(--dsw-alias-label-primary);
|
|
2083
|
+
box-shadow: 0 6px 24px rgba(0, 0, 0, .16);
|
|
2084
|
+
font-family: var(--dsw-font-family, system-ui, sans-serif); font-size: 12px;
|
|
2085
|
+
}
|
|
2086
|
+
.dsv-update-chip-btn {
|
|
2087
|
+
height: 24px; padding: 0 10px; border-radius: 7px; cursor: pointer;
|
|
2088
|
+
border: 1px solid var(--dsw-alias-border-l2); background: transparent;
|
|
2089
|
+
color: var(--dsw-alias-label-primary); font-family: inherit; font-size: 12px;
|
|
2090
|
+
}
|
|
2091
|
+
.dsv-update-chip-btn.accent { background: var(--dsw-static-deepseek-500); border-color: transparent; color: #fff; }
|
|
2092
|
+
.dsv-update-chip-btn:hover { background: var(--dsw-alias-interactive-bg-hover); }
|
|
2093
|
+
html[data-dsv-performance="1"] .dsv-update-chip { box-shadow: none; }
|
|
1832
2094
|
`;
|
|
1833
2095
|
|
|
1834
2096
|
function insertStyle(css) {
|
|
@@ -1977,6 +2239,8 @@ window.__ModuleLoader__.load({
|
|
|
1977
2239
|
persistedTree: "unknown",
|
|
1978
2240
|
maximized: null,
|
|
1979
2241
|
minimized: readMinimized(),
|
|
2242
|
+
performance: readPerformanceMode(),
|
|
2243
|
+
updateReady: null,
|
|
1980
2244
|
};
|
|
1981
2245
|
const runtimeListeners = new Set();
|
|
1982
2246
|
function runtimeSnapshot() {
|
|
@@ -2007,6 +2271,28 @@ window.__ModuleLoader__.load({
|
|
|
2007
2271
|
return React.useSyncExternalStore(runtimeSubscribe, runtimeSnapshot, runtimeSnapshot);
|
|
2008
2272
|
}
|
|
2009
2273
|
|
|
2274
|
+
/** Performance mode: one boolean consumed by observers and CSS alike. */
|
|
2275
|
+
function performanceModeOn() {
|
|
2276
|
+
return runtimeState.performance === true;
|
|
2277
|
+
}
|
|
2278
|
+
/** Mirror performance mode onto <html> so the stylesheet can drop
|
|
2279
|
+
animations/shadows without re-rendering every pane. */
|
|
2280
|
+
function applyPerformanceClass() {
|
|
2281
|
+
try {
|
|
2282
|
+
if (typeof document !== "undefined" && document.documentElement !== null) {
|
|
2283
|
+
document.documentElement.setAttribute("data-dsv-performance", performanceModeOn() ? "1" : "0");
|
|
2284
|
+
}
|
|
2285
|
+
} catch {}
|
|
2286
|
+
}
|
|
2287
|
+
function setPerformanceMode(value) {
|
|
2288
|
+
const next = value === true;
|
|
2289
|
+
writePerformanceMode(next);
|
|
2290
|
+
setRuntime({ performance: next });
|
|
2291
|
+
applyPerformanceClass();
|
|
2292
|
+
showPaneToast(t(next ? "performanceOn" : "performanceOff"), true);
|
|
2293
|
+
return next;
|
|
2294
|
+
}
|
|
2295
|
+
|
|
2010
2296
|
/** True only when the workspace may take over the viewport at all. The
|
|
2011
2297
|
`geometryBlocked` flag closes the diagnosis's "invisible active" hole:
|
|
2012
2298
|
a persisted split whose column cannot be measured must NOT eat the
|
|
@@ -2150,8 +2436,11 @@ window.__ModuleLoader__.load({
|
|
|
2150
2436
|
safeMode: runtimeState.safeMode,
|
|
2151
2437
|
active: runtimeState.active,
|
|
2152
2438
|
minimized: runtimeState.minimized === true,
|
|
2439
|
+
performance: runtimeState.performance === true,
|
|
2153
2440
|
geometryBlocked: runtimeState.geometryBlocked === true,
|
|
2154
2441
|
panes: (() => { try { return treeStore.leafIds().length; } catch { return 0; } })(),
|
|
2442
|
+
floats: (() => { try { return floatStore.ids(); } catch { return []; } })(),
|
|
2443
|
+
floatLayerMounted: floatLayerMounted,
|
|
2155
2444
|
blockedReason: (() => { try { return blockedReason(); } catch { return "unknown"; } })(),
|
|
2156
2445
|
failures: runtimeState.failures,
|
|
2157
2446
|
lastError: runtimeState.lastError,
|
|
@@ -2517,7 +2806,16 @@ window.__ModuleLoader__.load({
|
|
|
2517
2806
|
const root = parsed !== null && parsed !== undefined && typeof parsed === "object"
|
|
2518
2807
|
? normalizeTree(parsed.root, { depth: 0, seen: new Set(), stats })
|
|
2519
2808
|
: null;
|
|
2520
|
-
if (root !== null) {
|
|
2809
|
+
if (root !== null && leafOf(root, []).length < 2) {
|
|
2810
|
+
// A one-pane tree is not a split. Older builds could persist one
|
|
2811
|
+
// after closing the second-to-last pane; that kept the surviving
|
|
2812
|
+
// conversation tagged "in split" while nothing rendered. Discard it.
|
|
2813
|
+
storageRemove(TREE_KEY);
|
|
2814
|
+
persistedStatus = "absent";
|
|
2815
|
+
try {
|
|
2816
|
+
console.info(LOG_PREFIX + " dropped a persisted one-pane layout on load (a split needs at least two panes).");
|
|
2817
|
+
} catch {}
|
|
2818
|
+
} else if (root !== null) {
|
|
2521
2819
|
state = { root, focus: null };
|
|
2522
2820
|
const repaired = stats.duplicates > 0 || stats.depthLimited > 0;
|
|
2523
2821
|
persistedStatus = repaired ? "repaired" : "ok";
|
|
@@ -2565,6 +2863,21 @@ window.__ModuleLoader__.load({
|
|
|
2565
2863
|
for (const listener of [...listeners]) listener();
|
|
2566
2864
|
}
|
|
2567
2865
|
|
|
2866
|
+
/** The split ended because fewer than two panes remain. Clear the WHOLE
|
|
2867
|
+
tree (not just the closed pane): a one-pane tree is not a split, and
|
|
2868
|
+
keeping it would leave the surviving conversation tagged "in split"
|
|
2869
|
+
in the context menu / add-split dialog while nothing renders. */
|
|
2870
|
+
function endSplitBecauseTooSmall() {
|
|
2871
|
+
const before = leafOf(state.root, []);
|
|
2872
|
+
state = { root: null, focus: null };
|
|
2873
|
+
for (const id of before) deferPaneDisposeCheck(id);
|
|
2874
|
+
storageRemove(TREE_KEY);
|
|
2875
|
+
setRuntime({ persistedTree: "absent", maximized: null, minimized: false });
|
|
2876
|
+
writeMinimized(false);
|
|
2877
|
+
revision += 1;
|
|
2878
|
+
for (const listener of [...listeners]) listener();
|
|
2879
|
+
}
|
|
2880
|
+
|
|
2568
2881
|
return {
|
|
2569
2882
|
getSnapshot: () => state,
|
|
2570
2883
|
getRevision: () => revision,
|
|
@@ -2619,6 +2932,9 @@ window.__ModuleLoader__.load({
|
|
|
2619
2932
|
},
|
|
2620
2933
|
addPane(sessionId) {
|
|
2621
2934
|
if (!isValidSessionId(sessionId)) return;
|
|
2935
|
+
// A conversation is either a pane or a float, never both: any path
|
|
2936
|
+
// that adds a pane retires its floating window first.
|
|
2937
|
+
try { if (floatStore.has(sessionId)) floatStore.remove(sessionId); } catch {}
|
|
2622
2938
|
if (findLeafNode(state.root, sessionId) !== null) {
|
|
2623
2939
|
commit({ root: state.root, focus: sessionId });
|
|
2624
2940
|
return;
|
|
@@ -2656,6 +2972,7 @@ window.__ModuleLoader__.load({
|
|
|
2656
2972
|
},
|
|
2657
2973
|
splitLeaf(leafId, dir, newId, side) {
|
|
2658
2974
|
if (!isValidSessionId(newId)) return;
|
|
2975
|
+
try { if (floatStore.has(newId)) floatStore.remove(newId); } catch {}
|
|
2659
2976
|
if (findLeafNode(state.root, newId) !== null) {
|
|
2660
2977
|
commit({ root: state.root, focus: newId });
|
|
2661
2978
|
return;
|
|
@@ -2669,8 +2986,17 @@ window.__ModuleLoader__.load({
|
|
|
2669
2986
|
if (ok) commit({ root: next, focus: newId });
|
|
2670
2987
|
},
|
|
2671
2988
|
closeLeaf(id) {
|
|
2989
|
+
const before = leafOf(state.root, []);
|
|
2672
2990
|
const [next, removed] = removeLeaf(state.root, id);
|
|
2673
|
-
if (removed)
|
|
2991
|
+
if (!removed) return;
|
|
2992
|
+
// Closing the second-to-last pane ends the split: clear every pane
|
|
2993
|
+
// instead of keeping an invisible one-pane tree with stale membership.
|
|
2994
|
+
if (before.length >= 2 && leafOf(next, []).length < 2) {
|
|
2995
|
+
endSplitBecauseTooSmall();
|
|
2996
|
+
return;
|
|
2997
|
+
}
|
|
2998
|
+
commit({ root: next, focus: state.focus });
|
|
2999
|
+
this.settleAuto();
|
|
2674
3000
|
},
|
|
2675
3001
|
movePane(srcId, dstId, zone) {
|
|
2676
3002
|
if (srcId === dstId) return;
|
|
@@ -2794,6 +3120,365 @@ window.__ModuleLoader__.load({
|
|
|
2794
3120
|
function openAddSplitDialog(source) {
|
|
2795
3121
|
setLauncherState({ mode: "dialog", rect: null, source: source === "footer" ? "footer" : "session" });
|
|
2796
3122
|
}
|
|
3123
|
+
function openRestartDialog() {
|
|
3124
|
+
setLauncherState({ mode: "restart", rect: null, source: "footer" });
|
|
3125
|
+
}
|
|
3126
|
+
|
|
3127
|
+
// ---------------------------------------------------------------------
|
|
3128
|
+
// floating windows (0.6.0)
|
|
3129
|
+
//
|
|
3130
|
+
// DSH has no second native window: the Desktop main window denies
|
|
3131
|
+
// window.open() and the Web client has no per-session deep link, so a
|
|
3132
|
+
// "window" here is an in-app floating surface rendered by the
|
|
3133
|
+
// always-mounted shell.overlay seat. It hosts the SAME native ChatPane the
|
|
3134
|
+
// split re-hosts, and it is mutually exclusive with a split pane for one
|
|
3135
|
+
// session: entering a float detaches the pane, docking it back re-attaches
|
|
3136
|
+
// it. Geometry lives in viewport CSS pixels, persisted under FLOAT_KEY and
|
|
3137
|
+
// clamped to the conversation column on every gesture/resize.
|
|
3138
|
+
// ---------------------------------------------------------------------
|
|
3139
|
+
|
|
3140
|
+
const FLOAT_W = 680;
|
|
3141
|
+
const FLOAT_H = 620;
|
|
3142
|
+
const FLOAT_MIN_W = 320;
|
|
3143
|
+
const FLOAT_MIN_H = 220;
|
|
3144
|
+
|
|
3145
|
+
function readFloatWindows() {
|
|
3146
|
+
const raw = storageGet(FLOAT_KEY);
|
|
3147
|
+
if (!raw) return [];
|
|
3148
|
+
let parsed = null;
|
|
3149
|
+
try { parsed = JSON.parse(raw); } catch { return []; }
|
|
3150
|
+
const list = parsed !== null && parsed !== undefined && Array.isArray(parsed.windows) ? parsed.windows : [];
|
|
3151
|
+
const out = [];
|
|
3152
|
+
for (const entry of list) {
|
|
3153
|
+
if (entry === null || typeof entry !== "object") continue;
|
|
3154
|
+
const id = entry.id;
|
|
3155
|
+
if (!isValidSessionId(id)) continue;
|
|
3156
|
+
if (out.some((win) => win.id === id)) continue;
|
|
3157
|
+
const x = Number(entry.x);
|
|
3158
|
+
const y = Number(entry.y);
|
|
3159
|
+
const w = Number(entry.w);
|
|
3160
|
+
const h = Number(entry.h);
|
|
3161
|
+
const z = Number(entry.z);
|
|
3162
|
+
out.push({
|
|
3163
|
+
id,
|
|
3164
|
+
x: Number.isFinite(x) ? x : 0,
|
|
3165
|
+
y: Number.isFinite(y) ? y : 0,
|
|
3166
|
+
w: Number.isFinite(w) && w >= FLOAT_MIN_W ? w : FLOAT_W,
|
|
3167
|
+
h: Number.isFinite(h) && h >= FLOAT_MIN_H ? h : FLOAT_H,
|
|
3168
|
+
z: Number.isFinite(z) ? z : out.length + 1,
|
|
3169
|
+
});
|
|
3170
|
+
}
|
|
3171
|
+
return out;
|
|
3172
|
+
}
|
|
3173
|
+
|
|
3174
|
+
const floatStore = (() => {
|
|
3175
|
+
let windows = readFloatWindows();
|
|
3176
|
+
let focused = windows.length > 0 ? windows[windows.length - 1].id : null;
|
|
3177
|
+
let persistTimer = 0;
|
|
3178
|
+
const listeners = new Set();
|
|
3179
|
+
let snapshot = Object.freeze({ windows: windows.slice(), focused });
|
|
3180
|
+
const emit = () => {
|
|
3181
|
+
for (const listener of [...listeners]) {
|
|
3182
|
+
try { listener(); } catch {}
|
|
3183
|
+
}
|
|
3184
|
+
};
|
|
3185
|
+
const publish = () => {
|
|
3186
|
+
snapshot = Object.freeze({ windows: windows.slice(), focused });
|
|
3187
|
+
emit();
|
|
3188
|
+
};
|
|
3189
|
+
const write = () => {
|
|
3190
|
+
persistTimer = 0;
|
|
3191
|
+
try { storageSet(FLOAT_KEY, JSON.stringify({ windows })); } catch {}
|
|
3192
|
+
};
|
|
3193
|
+
const schedulePersist = (immediate) => {
|
|
3194
|
+
if (persistTimer !== 0) {
|
|
3195
|
+
try { window.clearTimeout(persistTimer); } catch {}
|
|
3196
|
+
persistTimer = 0;
|
|
3197
|
+
}
|
|
3198
|
+
if (immediate === true) { write(); return; }
|
|
3199
|
+
try { persistTimer = window.setTimeout(write, 200); } catch { write(); }
|
|
3200
|
+
};
|
|
3201
|
+
const find = (id) => windows.find((win) => win.id === id);
|
|
3202
|
+
return {
|
|
3203
|
+
getSnapshot: () => snapshot,
|
|
3204
|
+
subscribe(listener) {
|
|
3205
|
+
if (typeof listener !== "function") return () => {};
|
|
3206
|
+
listeners.add(listener);
|
|
3207
|
+
return () => { listeners.delete(listener); };
|
|
3208
|
+
},
|
|
3209
|
+
ids: () => windows.map((win) => win.id),
|
|
3210
|
+
size: () => windows.length,
|
|
3211
|
+
has: (id) => windows.some((win) => win.id === id),
|
|
3212
|
+
focusedId: () => focused,
|
|
3213
|
+
add(id, rect) {
|
|
3214
|
+
if (!isValidSessionId(id) || windows.some((win) => win.id === id)) return false;
|
|
3215
|
+
const max = windows.reduce((acc, win) => Math.max(acc, win.z), 0);
|
|
3216
|
+
windows = windows.concat([{
|
|
3217
|
+
id,
|
|
3218
|
+
x: rect !== null && rect !== undefined && Number.isFinite(rect.x) ? rect.x : 0,
|
|
3219
|
+
y: rect !== null && rect !== undefined && Number.isFinite(rect.y) ? rect.y : 0,
|
|
3220
|
+
w: rect !== null && rect !== undefined && Number.isFinite(rect.w) ? rect.w : FLOAT_W,
|
|
3221
|
+
h: rect !== null && rect !== undefined && Number.isFinite(rect.h) ? rect.h : FLOAT_H,
|
|
3222
|
+
z: max + 1,
|
|
3223
|
+
}]);
|
|
3224
|
+
focused = id;
|
|
3225
|
+
publish();
|
|
3226
|
+
schedulePersist(false);
|
|
3227
|
+
return true;
|
|
3228
|
+
},
|
|
3229
|
+
remove(id) {
|
|
3230
|
+
const next = windows.filter((win) => win.id !== id);
|
|
3231
|
+
if (next.length === windows.length) return false;
|
|
3232
|
+
windows = next;
|
|
3233
|
+
if (focused === id) {
|
|
3234
|
+
const top = windows.reduce((acc, win) => (acc === null || win.z > acc.z ? win : acc), null);
|
|
3235
|
+
focused = top === null ? null : top.id;
|
|
3236
|
+
}
|
|
3237
|
+
publish();
|
|
3238
|
+
schedulePersist(true);
|
|
3239
|
+
return true;
|
|
3240
|
+
},
|
|
3241
|
+
clear() {
|
|
3242
|
+
const had = windows.length > 0 || focused !== null;
|
|
3243
|
+
windows = [];
|
|
3244
|
+
focused = null;
|
|
3245
|
+
if (had) {
|
|
3246
|
+
publish();
|
|
3247
|
+
schedulePersist(true);
|
|
3248
|
+
}
|
|
3249
|
+
},
|
|
3250
|
+
focus(id) {
|
|
3251
|
+
const target = find(id);
|
|
3252
|
+
if (target === undefined) {
|
|
3253
|
+
focused = null;
|
|
3254
|
+
publish();
|
|
3255
|
+
return;
|
|
3256
|
+
}
|
|
3257
|
+
const max = windows.reduce((acc, win) => Math.max(acc, win.z), 0);
|
|
3258
|
+
if (target.z !== max || focused !== id) {
|
|
3259
|
+
target.z = max + 1;
|
|
3260
|
+
focused = id;
|
|
3261
|
+
publish();
|
|
3262
|
+
schedulePersist(false);
|
|
3263
|
+
}
|
|
3264
|
+
},
|
|
3265
|
+
setRect(id, rect, immediate) {
|
|
3266
|
+
const target = find(id);
|
|
3267
|
+
if (target === undefined) return;
|
|
3268
|
+
if (target.x === rect.x && target.y === rect.y && target.w === rect.w && target.h === rect.h) return;
|
|
3269
|
+
target.x = rect.x;
|
|
3270
|
+
target.y = rect.y;
|
|
3271
|
+
target.w = rect.w;
|
|
3272
|
+
target.h = rect.h;
|
|
3273
|
+
windows = windows.slice();
|
|
3274
|
+
publish();
|
|
3275
|
+
schedulePersist(immediate === true);
|
|
3276
|
+
},
|
|
3277
|
+
persistNow() {
|
|
3278
|
+
if (persistTimer !== 0) {
|
|
3279
|
+
try { window.clearTimeout(persistTimer); } catch {}
|
|
3280
|
+
persistTimer = 0;
|
|
3281
|
+
}
|
|
3282
|
+
write();
|
|
3283
|
+
},
|
|
3284
|
+
};
|
|
3285
|
+
})();
|
|
3286
|
+
|
|
3287
|
+
function useFloats() {
|
|
3288
|
+
return React.useSyncExternalStore(floatStore.subscribe, floatStore.getSnapshot, floatStore.getSnapshot);
|
|
3289
|
+
}
|
|
3290
|
+
|
|
3291
|
+
/** Keep a rect inside the conversation column (the same work area the
|
|
3292
|
+
restore chip uses; falls back to the viewport below the title bar). */
|
|
3293
|
+
function clampFloatRect(rect, work) {
|
|
3294
|
+
const width = Math.max(FLOAT_MIN_W, Math.min(rect.w, Math.max(FLOAT_MIN_W, work.width)));
|
|
3295
|
+
const height = Math.max(FLOAT_MIN_H, Math.min(rect.h, Math.max(FLOAT_MIN_H, work.height)));
|
|
3296
|
+
const x = Math.round(Math.min(Math.max(rect.x, work.left), Math.max(work.left, work.left + work.width - width)));
|
|
3297
|
+
const y = Math.round(Math.min(Math.max(rect.y, work.top), Math.max(work.top, work.top + work.height - height)));
|
|
3298
|
+
return { x, y, w: Math.round(width), h: Math.round(height) };
|
|
3299
|
+
}
|
|
3300
|
+
|
|
3301
|
+
function defaultFloatRect() {
|
|
3302
|
+
const work = chipWorkRect();
|
|
3303
|
+
const w = Math.min(FLOAT_W, Math.max(FLOAT_MIN_W, Math.round(work.width * 0.74)));
|
|
3304
|
+
const h = Math.min(FLOAT_H, Math.max(FLOAT_MIN_H, Math.round(work.height * 0.74)));
|
|
3305
|
+
// Cascade successive windows so a second float never lands exactly on
|
|
3306
|
+
// the first one (the user can still drag them anywhere afterwards).
|
|
3307
|
+
let index = 0;
|
|
3308
|
+
try { index = floatStore.size(); } catch {}
|
|
3309
|
+
const offset = (index % 8) * 28;
|
|
3310
|
+
const x = work.left + Math.round((work.width - w) / 2) + offset;
|
|
3311
|
+
const y = work.top + Math.round(Math.max(0, (work.height - h) * 0.16)) + Math.round(offset * 0.5);
|
|
3312
|
+
return clampFloatRect({ x, y, w, h }, work);
|
|
3313
|
+
}
|
|
3314
|
+
|
|
3315
|
+
/** Enter floating-window mode. A split pane (or a parked pending pick) is
|
|
3316
|
+
detached first so the same conversation is never hosted twice. */
|
|
3317
|
+
function floatSession(sessionId) {
|
|
3318
|
+
if (!isValidSessionId(sessionId)) return false;
|
|
3319
|
+
prepareExplicitSplit();
|
|
3320
|
+
if (floatStore.has(sessionId)) {
|
|
3321
|
+
floatStore.focus(sessionId);
|
|
3322
|
+
return false;
|
|
3323
|
+
}
|
|
3324
|
+
pendingSplitStore.remove(sessionId);
|
|
3325
|
+
try {
|
|
3326
|
+
if (treeStore.leafIds().indexOf(sessionId) !== -1) treeStore.closeLeaf(sessionId);
|
|
3327
|
+
} catch {}
|
|
3328
|
+
try {
|
|
3329
|
+
const remaining = treeStore.leafIds();
|
|
3330
|
+
if (remaining.length > 0 && remaining.length < 2) treeStore.reset();
|
|
3331
|
+
} catch {}
|
|
3332
|
+
floatStore.add(sessionId, defaultFloatRect());
|
|
3333
|
+
showPaneToast(t("floatEntered"), true);
|
|
3334
|
+
return true;
|
|
3335
|
+
}
|
|
3336
|
+
|
|
3337
|
+
/** Close a float without putting it back into the split. */
|
|
3338
|
+
function closeFloatWindow(sessionId, options) {
|
|
3339
|
+
if (!floatStore.has(sessionId)) return false;
|
|
3340
|
+
floatStore.remove(sessionId);
|
|
3341
|
+
if (options === undefined || options.silent !== true) showPaneToast(t("floatClosed"), true);
|
|
3342
|
+
return true;
|
|
3343
|
+
}
|
|
3344
|
+
|
|
3345
|
+
/** Switch one float back to split mode: append it to a live split, or
|
|
3346
|
+
rebuild/start from the pending pick when no split is running yet. */
|
|
3347
|
+
function dockFloatToSplit(sessionId) {
|
|
3348
|
+
if (!isValidSessionId(sessionId)) return false;
|
|
3349
|
+
if (!floatStore.has(sessionId)) return false;
|
|
3350
|
+
floatStore.remove(sessionId);
|
|
3351
|
+
const leaves = treeStore.leafIds();
|
|
3352
|
+
if (leaves.indexOf(sessionId) !== -1) {
|
|
3353
|
+
try { treeStore.setFocus(sessionId); } catch {}
|
|
3354
|
+
return true;
|
|
3355
|
+
}
|
|
3356
|
+
if (leaves.length > 0) {
|
|
3357
|
+
prepareExplicitSplit();
|
|
3358
|
+
unminimizeForSplit();
|
|
3359
|
+
try { treeStore.addPane(sessionId); } catch {}
|
|
3360
|
+
showPaneToast(t("floatDocked"), true);
|
|
3361
|
+
return true;
|
|
3362
|
+
}
|
|
3363
|
+
const pending = pendingSplitStore.ids().filter((id) => id !== sessionId);
|
|
3364
|
+
if (pending.length > 0) {
|
|
3365
|
+
pendingSplitStore.clear();
|
|
3366
|
+
buildSplitFromSessions(pending.concat([sessionId]));
|
|
3367
|
+
showPaneToast(t("floatDocked"), true);
|
|
3368
|
+
return true;
|
|
3369
|
+
}
|
|
3370
|
+
pendingSplitStore.add(sessionId);
|
|
3371
|
+
showPaneToast(t("pendingAdded"), true);
|
|
3372
|
+
return true;
|
|
3373
|
+
}
|
|
3374
|
+
|
|
3375
|
+
/** Leave every in-app surface (split pane, pending pick, float) because the
|
|
3376
|
+
conversation now lives in a separate system window. The split ends
|
|
3377
|
+
through closeLeaf's own too-small rule when only one pane would remain. */
|
|
3378
|
+
function detachSessionForSystemWindow(sessionId) {
|
|
3379
|
+
try { if (floatStore.has(sessionId)) floatStore.remove(sessionId); } catch {}
|
|
3380
|
+
pendingSplitStore.remove(sessionId);
|
|
3381
|
+
try {
|
|
3382
|
+
const leaves = treeStore.leafIds();
|
|
3383
|
+
if (leaves.indexOf(sessionId) !== -1) treeStore.closeLeaf(sessionId);
|
|
3384
|
+
else if (leaves.length > 0 && leaves.length < 2) treeStore.reset();
|
|
3385
|
+
} catch {}
|
|
3386
|
+
}
|
|
3387
|
+
|
|
3388
|
+
/** Ask the Host for the authenticated standalone URL and open it as a real
|
|
3389
|
+
separate window. In Desktop the app's window-open handler forwards
|
|
3390
|
+
http/https to the system browser (the only OS window a renderer plugin
|
|
3391
|
+
can create here); in Web mode `window.open` opens a browser window.
|
|
3392
|
+
A blank window is pre-opened in Web mode so the async Host round-trip
|
|
3393
|
+
cannot lose the user-gesture popup permission. */
|
|
3394
|
+
function openSystemWindow(sessionId) {
|
|
3395
|
+
if (!isValidSessionId(sessionId)) return Promise.resolve(false);
|
|
3396
|
+
let preopened = null;
|
|
3397
|
+
if (typeof window.dshDesktop === "undefined") {
|
|
3398
|
+
try { preopened = window.open("", "_blank"); } catch { preopened = null; }
|
|
3399
|
+
}
|
|
3400
|
+
const fail = () => {
|
|
3401
|
+
try { if (preopened !== null && preopened.closed !== true) preopened.close(); } catch {}
|
|
3402
|
+
showPaneToast(t("systemWindowFailed"), true);
|
|
3403
|
+
return false;
|
|
3404
|
+
};
|
|
3405
|
+
return fetch("/dsv/system-window", {
|
|
3406
|
+
method: "POST",
|
|
3407
|
+
headers: { "content-type": "application/json" },
|
|
3408
|
+
body: JSON.stringify({ sessionId }),
|
|
3409
|
+
}).then((response) => (response.ok ? response.json().catch(() => null) : null)).then((payload) => {
|
|
3410
|
+
if (payload === null || payload === undefined || payload.ok !== true
|
|
3411
|
+
|| typeof payload.url !== "string" || payload.url === "") return fail();
|
|
3412
|
+
try {
|
|
3413
|
+
detachSessionForSystemWindow(sessionId);
|
|
3414
|
+
if (preopened !== null && preopened.closed !== true) {
|
|
3415
|
+
try { preopened.opener = null; } catch {}
|
|
3416
|
+
preopened.location.href = payload.url;
|
|
3417
|
+
} else {
|
|
3418
|
+
window.open(payload.url, "_blank", "noopener,noreferrer");
|
|
3419
|
+
}
|
|
3420
|
+
showPaneToast(t("systemWindowOpened"), true);
|
|
3421
|
+
return true;
|
|
3422
|
+
} catch {
|
|
3423
|
+
return fail();
|
|
3424
|
+
}
|
|
3425
|
+
}).catch(() => fail());
|
|
3426
|
+
}
|
|
3427
|
+
|
|
3428
|
+
let floatLayerMounted = false;
|
|
3429
|
+
|
|
3430
|
+
// One gesture at a time (move or resize); the element that captured the
|
|
3431
|
+
// pointer owns it until pointerup/cancel.
|
|
3432
|
+
let floatGesture = null;
|
|
3433
|
+
function beginFloatGesture(sessionId, mode, event) {
|
|
3434
|
+
if (event === null || event === undefined || event.button !== 0) return;
|
|
3435
|
+
const state = floatStore.getSnapshot();
|
|
3436
|
+
const win = state.windows.find((entry) => entry.id === sessionId);
|
|
3437
|
+
if (win === undefined) return;
|
|
3438
|
+
const target = event.target;
|
|
3439
|
+
if (mode === "move" && target !== null && target !== undefined && typeof target.closest === "function"
|
|
3440
|
+
&& target.closest("button,input,.dsv-pane-title-text") !== null) return;
|
|
3441
|
+
event.preventDefault();
|
|
3442
|
+
floatGesture = {
|
|
3443
|
+
id: sessionId,
|
|
3444
|
+
mode,
|
|
3445
|
+
pointerId: event.pointerId,
|
|
3446
|
+
sx: event.clientX,
|
|
3447
|
+
sy: event.clientY,
|
|
3448
|
+
start: { x: win.x, y: win.y, w: win.w, h: win.h },
|
|
3449
|
+
work: chipWorkRect(),
|
|
3450
|
+
};
|
|
3451
|
+
floatStore.focus(sessionId);
|
|
3452
|
+
try { event.currentTarget.setPointerCapture(event.pointerId); } catch {}
|
|
3453
|
+
}
|
|
3454
|
+
function moveFloatGesture(event) {
|
|
3455
|
+
const gesture = floatGesture;
|
|
3456
|
+
if (gesture === null || gesture.pointerId !== event.pointerId) return;
|
|
3457
|
+
const dx = event.clientX - gesture.sx;
|
|
3458
|
+
const dy = event.clientY - gesture.sy;
|
|
3459
|
+
let next;
|
|
3460
|
+
if (gesture.mode === "move") {
|
|
3461
|
+
next = { x: gesture.start.x + dx, y: gesture.start.y + dy, w: gesture.start.w, h: gesture.start.h };
|
|
3462
|
+
} else {
|
|
3463
|
+
let left = gesture.start.x;
|
|
3464
|
+
let top = gesture.start.y;
|
|
3465
|
+
let right = gesture.start.x + gesture.start.w;
|
|
3466
|
+
let bottom = gesture.start.y + gesture.start.h;
|
|
3467
|
+
if (gesture.mode.indexOf("e") !== -1) right = Math.max(left + FLOAT_MIN_W, gesture.start.x + gesture.start.w + dx);
|
|
3468
|
+
if (gesture.mode.indexOf("w") !== -1) left = Math.min(right - FLOAT_MIN_W, gesture.start.x + dx);
|
|
3469
|
+
if (gesture.mode.indexOf("s") !== -1) bottom = Math.max(top + FLOAT_MIN_H, gesture.start.y + gesture.start.h + dy);
|
|
3470
|
+
if (gesture.mode.indexOf("n") !== -1) top = Math.min(bottom - FLOAT_MIN_H, gesture.start.y + dy);
|
|
3471
|
+
next = { x: left, y: top, w: right - left, h: bottom - top };
|
|
3472
|
+
}
|
|
3473
|
+
floatStore.setRect(gesture.id, clampFloatRect(next, gesture.work), false);
|
|
3474
|
+
}
|
|
3475
|
+
function endFloatGesture(event) {
|
|
3476
|
+
const gesture = floatGesture;
|
|
3477
|
+
if (gesture === null || (event !== undefined && event.pointerId !== gesture.pointerId)) return;
|
|
3478
|
+
floatGesture = null;
|
|
3479
|
+
try { event.currentTarget.releasePointerCapture(event.pointerId); } catch {}
|
|
3480
|
+
floatStore.persistNow();
|
|
3481
|
+
}
|
|
2797
3482
|
|
|
2798
3483
|
let dragPayload = null; // { kind: 'session' | 'pane', id }
|
|
2799
3484
|
|
|
@@ -4142,6 +4827,10 @@ window.__ModuleLoader__.load({
|
|
|
4142
4827
|
full-sidebar scan. Emits a fresh snapshot object on real changes so
|
|
4143
4828
|
React's identity check re-renders consumers. */
|
|
4144
4829
|
const DOM_LIST_MIN_READ_MS = 200;
|
|
4830
|
+
/** Sidebar scraping cadence; perf mode reads at most once a second. */
|
|
4831
|
+
function domListMinReadMs() {
|
|
4832
|
+
return performanceModeOn() ? 1000 : DOM_LIST_MIN_READ_MS;
|
|
4833
|
+
}
|
|
4145
4834
|
|
|
4146
4835
|
function createDomSessionListSource() {
|
|
4147
4836
|
let snapshot = readSidebarSessions();
|
|
@@ -4168,14 +4857,15 @@ window.__ModuleLoader__.load({
|
|
|
4168
4857
|
}
|
|
4169
4858
|
};
|
|
4170
4859
|
const maybePublish = () => {
|
|
4860
|
+
const minRead = domListMinReadMs();
|
|
4171
4861
|
const since = Date.now() - lastReadAt;
|
|
4172
|
-
if (since <
|
|
4862
|
+
if (since < minRead) {
|
|
4173
4863
|
if (!timerPending) {
|
|
4174
4864
|
timerPending = true;
|
|
4175
4865
|
window.setTimeout(() => {
|
|
4176
4866
|
timerPending = false;
|
|
4177
4867
|
if (active && listeners.size > 0) publish();
|
|
4178
|
-
},
|
|
4868
|
+
}, minRead - since);
|
|
4179
4869
|
}
|
|
4180
4870
|
return;
|
|
4181
4871
|
}
|
|
@@ -7333,6 +8023,7 @@ window.__ModuleLoader__.load({
|
|
|
7333
8023
|
writes would otherwise retrigger the subtree MutationObserver into
|
|
7334
8024
|
an rAF-loop. */
|
|
7335
8025
|
function useComposerAlignedRow(rowRef, leftBuffer, rightInset) {
|
|
8026
|
+
const performanceMode = useRuntime().performance === true;
|
|
7336
8027
|
React.useLayoutEffect(() => {
|
|
7337
8028
|
const row = rowRef.current;
|
|
7338
8029
|
if (row === null) return;
|
|
@@ -7388,17 +8079,19 @@ window.__ModuleLoader__.load({
|
|
|
7388
8079
|
const observer = new ResizeObserver(schedule);
|
|
7389
8080
|
observer.observe(pane);
|
|
7390
8081
|
let mutation = null;
|
|
7391
|
-
if (typeof MutationObserver === "function") {
|
|
8082
|
+
if (!performanceMode && typeof MutationObserver === "function") {
|
|
7392
8083
|
mutation = new MutationObserver(schedule);
|
|
7393
8084
|
mutation.observe(pane, { childList: true, subtree: true, attributes: true, attributeFilter: ["data-composer-card", "data-dsv-composer-card"] });
|
|
7394
8085
|
}
|
|
8086
|
+
const perfTimer = performanceMode ? window.setInterval(schedule, 1500) : 0;
|
|
7395
8087
|
raf = requestAnimationFrame(tick);
|
|
7396
8088
|
return () => {
|
|
7397
8089
|
if (raf !== 0) cancelAnimationFrame(raf);
|
|
7398
8090
|
observer.disconnect();
|
|
7399
8091
|
if (mutation !== null) mutation.disconnect();
|
|
8092
|
+
if (perfTimer !== 0) window.clearInterval(perfTimer);
|
|
7400
8093
|
};
|
|
7401
|
-
}, [leftBuffer, rightInset]);
|
|
8094
|
+
}, [leftBuffer, rightInset, performanceMode]);
|
|
7402
8095
|
}
|
|
7403
8096
|
|
|
7404
8097
|
function DsvInputDock({ children }) {
|
|
@@ -8469,14 +9162,16 @@ window.__ModuleLoader__.load({
|
|
|
8469
9162
|
return zone.side === "before" ? { top: 4, left: 4, right: 4, height: "50%" } : { bottom: 4, left: 4, right: 4, height: "50%" };
|
|
8470
9163
|
}
|
|
8471
9164
|
|
|
8472
|
-
function PaneFrame({ sessionId, session, summary, focused, chrome, onFocus, onClose, pickerFor }) {
|
|
9165
|
+
function PaneFrame({ sessionId, session, summary, focused, chrome, onFocus, onClose, pickerFor, floating, standalone }) {
|
|
8473
9166
|
const runtime = useRuntime();
|
|
9167
|
+
const performanceMode = runtime.performance === true;
|
|
8474
9168
|
const maximized = runtime.maximized === sessionId;
|
|
8475
9169
|
const [renaming, setRenaming] = React.useState(false);
|
|
8476
9170
|
const [renameDraft, setRenameDraft] = React.useState("");
|
|
8477
9171
|
const [zone, setZone] = React.useState(null);
|
|
8478
9172
|
const [invalidDrop, setInvalidDrop] = React.useState(false);
|
|
8479
9173
|
const frameRef = React.useRef(null);
|
|
9174
|
+
const headerRef = React.useRef(null);
|
|
8480
9175
|
const running = summary ? summary.running === true : false;
|
|
8481
9176
|
const title = summary ? summary.displayTitle || summary.title || sessionId : sessionId;
|
|
8482
9177
|
const cwd = summary ? basenameOf(summary.cwd) : "";
|
|
@@ -8678,15 +9373,20 @@ window.__ModuleLoader__.load({
|
|
|
8678
9373
|
};
|
|
8679
9374
|
const observer = new ResizeObserver(schedule);
|
|
8680
9375
|
observer.observe(frame);
|
|
8681
|
-
|
|
9376
|
+
// Perf mode: the pane subtree mutates on EVERY streaming token, and a
|
|
9377
|
+
// subtree MutationObserver here used to re-measure geometry (forced
|
|
9378
|
+
// layout) for each one. Keep resize-driven measuring + a slow poll.
|
|
9379
|
+
const mutation = !performanceMode && typeof MutationObserver === "function" ? new MutationObserver(schedule) : null;
|
|
8682
9380
|
if (mutation !== null) mutation.observe(frame, { childList: true, subtree: true });
|
|
9381
|
+
const perfTimer = performanceMode ? window.setInterval(schedule, 1500) : 0;
|
|
8683
9382
|
schedule();
|
|
8684
9383
|
return () => {
|
|
8685
9384
|
if (raf !== 0) cancelAnimationFrame(raf);
|
|
8686
9385
|
observer.disconnect();
|
|
8687
9386
|
if (mutation !== null) mutation.disconnect();
|
|
9387
|
+
if (perfTimer !== 0) window.clearInterval(perfTimer);
|
|
8688
9388
|
};
|
|
8689
|
-
}, [paneSize.w, composerMode]);
|
|
9389
|
+
}, [paneSize.w, composerMode, performanceMode]);
|
|
8690
9390
|
// a composer is never narrower than this — narrower "boxes" are
|
|
8691
9391
|
// transient seats, not the real input; fall back to stock geometry
|
|
8692
9392
|
const cardBoxSane = cardBox !== null && cardBox.right - cardBox.left >= 160;
|
|
@@ -8881,14 +9581,35 @@ window.__ModuleLoader__.load({
|
|
|
8881
9581
|
onClick(event);
|
|
8882
9582
|
},
|
|
8883
9583
|
}, glyph);
|
|
8884
|
-
const
|
|
8885
|
-
|
|
8886
|
-
|
|
8887
|
-
|
|
8888
|
-
|
|
8889
|
-
|
|
8890
|
-
|
|
8891
|
-
|
|
9584
|
+
const doFullscreen = () => {
|
|
9585
|
+
try {
|
|
9586
|
+
if (document.fullscreenElement !== null && document.fullscreenElement !== undefined) {
|
|
9587
|
+
if (typeof document.exitFullscreen === "function") document.exitFullscreen();
|
|
9588
|
+
} else if (typeof document.documentElement.requestFullscreen === "function") {
|
|
9589
|
+
document.documentElement.requestFullscreen();
|
|
9590
|
+
}
|
|
9591
|
+
} catch {}
|
|
9592
|
+
};
|
|
9593
|
+
const actionButtons = standalone === true
|
|
9594
|
+
? [
|
|
9595
|
+
actionButton("copy", t("copy"), "⧉", doCopy),
|
|
9596
|
+
actionButton("help", t("helpOpen"), "?", doHelp),
|
|
9597
|
+
actionButton("fullscreen", t("standaloneFullscreen"), "⛶", doFullscreen),
|
|
9598
|
+
]
|
|
9599
|
+
: floating === true
|
|
9600
|
+
? [
|
|
9601
|
+
actionButton("dock", t("floatDock"), "⇲", () => { dockFloatToSplit(sessionId); }),
|
|
9602
|
+
actionButton("help", t("helpOpen"), "?", doHelp),
|
|
9603
|
+
actionButton("close", t("floatClose"), h(CloseIcon, { size: 14 }), () => { closeFloatWindow(sessionId); }),
|
|
9604
|
+
]
|
|
9605
|
+
: [
|
|
9606
|
+
actionButton("maximize", maximized ? t("restore") : t("maximize"), maximized ? "⤡" : "⤢", doMaximize),
|
|
9607
|
+
actionButton("copy", t("copy"), "⧉", doCopy),
|
|
9608
|
+
actionButton("help", t("helpOpen"), "?", doHelp),
|
|
9609
|
+
actionButton("splitRight", t("splitRight"), h(SplitIconV, { size: 15 }), (event) => doSplit("h", event.currentTarget)),
|
|
9610
|
+
actionButton("splitDown", t("splitDown"), h(SplitIconH, { size: 15 }), (event) => doSplit("v", event.currentTarget)),
|
|
9611
|
+
actionButton("close", t("closePane"), h(CloseIcon, { size: 14 }), doClose),
|
|
9612
|
+
];
|
|
8892
9613
|
const menuItem = (key, label, onClick, danger) => h("button", {
|
|
8893
9614
|
key,
|
|
8894
9615
|
type: "button",
|
|
@@ -8900,6 +9621,7 @@ window.__ModuleLoader__.load({
|
|
|
8900
9621
|
}, label);
|
|
8901
9622
|
|
|
8902
9623
|
const startHeaderDrag = (event) => {
|
|
9624
|
+
if (floating === true) { beginFloatGesture(sessionId, "move", event); return; }
|
|
8903
9625
|
const target = event.target;
|
|
8904
9626
|
if (target !== null && target !== undefined && typeof target.closest === "function"
|
|
8905
9627
|
&& target.closest("button,input") !== null) {
|
|
@@ -8925,6 +9647,7 @@ window.__ModuleLoader__.load({
|
|
|
8925
9647
|
setInvalidDrop(false);
|
|
8926
9648
|
endDragPreview();
|
|
8927
9649
|
finishPaneReflowGesture();
|
|
9650
|
+
if (headerRef.current !== null) headerRef.current.draggable = false;
|
|
8928
9651
|
};
|
|
8929
9652
|
// A drop outside this pane (or a cancelled drag) never reaches the pane's
|
|
8930
9653
|
// own onDrop, so clear the refusal wash from the document lifecycle too.
|
|
@@ -9040,13 +9763,36 @@ window.__ModuleLoader__.load({
|
|
|
9040
9763
|
chrome !== false ? h(
|
|
9041
9764
|
"div",
|
|
9042
9765
|
{
|
|
9043
|
-
|
|
9044
|
-
|
|
9766
|
+
ref: headerRef,
|
|
9767
|
+
className: "dsv-pane-header", draggable: false,
|
|
9768
|
+
onMouseDown: floating === true || standalone === true ? undefined : (event) => {
|
|
9769
|
+
const header = headerRef.current;
|
|
9770
|
+
if (header === null) return;
|
|
9045
9771
|
const target = event.target;
|
|
9046
|
-
|
|
9047
|
-
|
|
9048
|
-
|
|
9772
|
+
const interactive = target !== null && target !== undefined && typeof target.closest === "function"
|
|
9773
|
+
&& target.closest("button,input,.dsv-pane-title-text") !== null;
|
|
9774
|
+
header.draggable = !interactive;
|
|
9049
9775
|
},
|
|
9776
|
+
onDragStart: floating === true || standalone === true ? undefined : startHeaderDrag,
|
|
9777
|
+
onDragEnd: floating === true || standalone === true ? undefined : endHeaderDrag,
|
|
9778
|
+
onPointerDown: floating === true ? startHeaderDrag : undefined,
|
|
9779
|
+
onPointerMove: floating === true ? moveFloatGesture : undefined,
|
|
9780
|
+
onPointerUp: floating === true ? endFloatGesture : undefined,
|
|
9781
|
+
onPointerCancel: floating === true ? endFloatGesture : undefined,
|
|
9782
|
+
title: floating === true ? t("floatHint") : title,
|
|
9783
|
+
onDoubleClick: floating === true ? undefined : standalone === true
|
|
9784
|
+
? (event) => {
|
|
9785
|
+
const target = event.target;
|
|
9786
|
+
if (target !== null && target !== undefined && typeof target.closest === "function"
|
|
9787
|
+
&& target.closest("button,input,.dsv-pane-title-text") !== null) return;
|
|
9788
|
+
doFullscreen();
|
|
9789
|
+
}
|
|
9790
|
+
: (event) => {
|
|
9791
|
+
const target = event.target;
|
|
9792
|
+
if (target !== null && target !== undefined && typeof target.closest === "function"
|
|
9793
|
+
&& target.closest("button,input,.dsv-pane-title-text") !== null) return;
|
|
9794
|
+
setRuntime({ maximized: maximized ? null : sessionId });
|
|
9795
|
+
},
|
|
9050
9796
|
},
|
|
9051
9797
|
// Reserved even when idle: the dot used to appear/disappear and
|
|
9052
9798
|
// shifted the title's left edge by 15px between panes.
|
|
@@ -9122,12 +9868,22 @@ window.__ModuleLoader__.load({
|
|
|
9122
9868
|
className: "dsv-pane-menu",
|
|
9123
9869
|
onPointerDown: (event) => event.stopPropagation(),
|
|
9124
9870
|
},
|
|
9125
|
-
|
|
9126
|
-
|
|
9127
|
-
|
|
9128
|
-
|
|
9129
|
-
|
|
9130
|
-
|
|
9871
|
+
...(standalone === true ? [
|
|
9872
|
+
menuItem("copy", t("copy"), () => { setMenuOpen(false); doCopy(); }),
|
|
9873
|
+
menuItem("help", t("helpOpen"), () => { setMenuOpen(false); doHelp(); }),
|
|
9874
|
+
menuItem("fullscreen", t("standaloneFullscreen"), () => { setMenuOpen(false); doFullscreen(); }),
|
|
9875
|
+
] : floating === true ? [
|
|
9876
|
+
menuItem("dock", t("floatDock"), () => { setMenuOpen(false); dockFloatToSplit(sessionId); }),
|
|
9877
|
+
menuItem("help", t("helpOpen"), () => { setMenuOpen(false); doHelp(); }),
|
|
9878
|
+
menuItem("close", t("floatClose"), () => { setMenuOpen(false); closeFloatWindow(sessionId); }, true),
|
|
9879
|
+
] : [
|
|
9880
|
+
menuItem("maximize", maximized ? t("restore") : t("maximize"), () => { setMenuOpen(false); doMaximize(); }),
|
|
9881
|
+
menuItem("copy", t("copy"), () => { setMenuOpen(false); doCopy(); }),
|
|
9882
|
+
menuItem("help", t("helpOpen"), () => { setMenuOpen(false); doHelp(); }),
|
|
9883
|
+
menuItem("splitRight", t("splitRight"), (event) => { doSplit("h", event.currentTarget); setMenuOpen(false); }),
|
|
9884
|
+
menuItem("splitDown", t("splitDown"), (event) => { doSplit("v", event.currentTarget); setMenuOpen(false); }),
|
|
9885
|
+
menuItem("close", t("closePane"), () => { setMenuOpen(false); doClose(); }, true),
|
|
9886
|
+
]),
|
|
9131
9887
|
) : null,
|
|
9132
9888
|
zone !== null
|
|
9133
9889
|
? h("div", { className: "dsv-drop-ghost", style: ghostStyle(zone) }, h("span", { className: "dsv-drop-label" }, t(zone.label)))
|
|
@@ -9158,6 +9914,8 @@ window.__ModuleLoader__.load({
|
|
|
9158
9914
|
&& a.session === b.session
|
|
9159
9915
|
&& a.focused === b.focused
|
|
9160
9916
|
&& a.chrome === b.chrome
|
|
9917
|
+
&& a.floating === b.floating
|
|
9918
|
+
&& a.standalone === b.standalone
|
|
9161
9919
|
&& summaryShallowEqual(a.summary, b.summary),
|
|
9162
9920
|
);
|
|
9163
9921
|
|
|
@@ -9172,7 +9930,7 @@ window.__ModuleLoader__.load({
|
|
|
9172
9930
|
return dir === "h" ? { width: basis, height: "100%" } : { height: basis, width: "100%" };
|
|
9173
9931
|
}
|
|
9174
9932
|
|
|
9175
|
-
function RenderLeaf({ id, chrome, generation }) {
|
|
9933
|
+
function RenderLeaf({ id, chrome, generation, floating, standalone }) {
|
|
9176
9934
|
const state = useTree();
|
|
9177
9935
|
const sessions = useSessionsList();
|
|
9178
9936
|
const liveSummary = sessions !== null && sessions !== undefined && sessions.byId !== undefined ? sessions.byId[id] : undefined;
|
|
@@ -9192,14 +9950,16 @@ window.__ModuleLoader__.load({
|
|
|
9192
9950
|
// A lone pane renders without the pane header, so a single
|
|
9193
9951
|
// conversation looks exactly like the stock view.
|
|
9194
9952
|
chrome: chrome !== false,
|
|
9195
|
-
|
|
9196
|
-
|
|
9953
|
+
floating: floating === true,
|
|
9954
|
+
standalone: standalone === true,
|
|
9955
|
+
focused: floating !== true && standalone !== true && state.focus === id,
|
|
9956
|
+
onFocus: floating === true ? (sid) => { floatStore.focus(sid); } : (sid) => treeStore.setFocus(sid),
|
|
9197
9957
|
// Teardown is NOT done here any more: treeStore.commit schedules the
|
|
9198
9958
|
// departed leaf for disposal and ChatPane releases on unmount, so every
|
|
9199
9959
|
// leaf-mutation path (✕, sidebar swap, closeFocused, movePane) is
|
|
9200
9960
|
// covered by the same idempotent path.
|
|
9201
|
-
onClose: (sid) => closePaneAnimated(sid),
|
|
9202
|
-
pickerFor: (...args) => togglePicker(...args),
|
|
9961
|
+
onClose: floating === true ? () => closeFloatWindow(id) : (sid) => closePaneAnimated(sid),
|
|
9962
|
+
pickerFor: floating === true || standalone === true ? () => {} : (...args) => togglePicker(...args),
|
|
9203
9963
|
}));
|
|
9204
9964
|
}
|
|
9205
9965
|
|
|
@@ -9720,7 +10480,11 @@ window.__ModuleLoader__.load({
|
|
|
9720
10480
|
if (ids.length === 0) return null;
|
|
9721
10481
|
const id = resolveFocusedSessionId();
|
|
9722
10482
|
if (id === null || id === undefined) return null;
|
|
9723
|
-
if (ids.length
|
|
10483
|
+
if (ids.length <= 2) {
|
|
10484
|
+
try { treeStore.closeLeaf(id); } catch {}
|
|
10485
|
+
scheduleRightbarHeal(450);
|
|
10486
|
+
return { exit: true, remaining: treeStore.leafIds().length };
|
|
10487
|
+
}
|
|
9724
10488
|
treeStore.closeLeaf(id);
|
|
9725
10489
|
return { exit: false, remaining: treeStore.leafIds().length };
|
|
9726
10490
|
}, null);
|
|
@@ -9770,6 +10534,42 @@ window.__ModuleLoader__.load({
|
|
|
9770
10534
|
removeFromSplit(sessionId) {
|
|
9771
10535
|
return safeCall("removeFromSplit()", () => removeSessionFromSplit(sessionId), false);
|
|
9772
10536
|
},
|
|
10537
|
+
/** Enter floating-window mode for one session (detaches a split pane). */
|
|
10538
|
+
float(sessionId) {
|
|
10539
|
+
return safeCall("float()", () => floatSession(sessionId), false);
|
|
10540
|
+
},
|
|
10541
|
+
/** Dock a floating window back into the split (or the pending pick). */
|
|
10542
|
+
dockFloat(sessionId) {
|
|
10543
|
+
return safeCall("dockFloat()", () => dockFloatToSplit(sessionId), false);
|
|
10544
|
+
},
|
|
10545
|
+
/** Close one floating window without docking it. */
|
|
10546
|
+
closeFloat(sessionId) {
|
|
10547
|
+
return safeCall("closeFloat()", () => closeFloatWindow(sessionId), false);
|
|
10548
|
+
},
|
|
10549
|
+
/** Current floating-window ids, in stable creation order. */
|
|
10550
|
+
floats() {
|
|
10551
|
+
return safeCall("floats()", () => floatStore.ids(), []);
|
|
10552
|
+
},
|
|
10553
|
+
/** Open one conversation in a separate system window (Host-backed URL). */
|
|
10554
|
+
openSystemWindow(sessionId) {
|
|
10555
|
+
return safeCall("openSystemWindow()", () => openSystemWindow(sessionId), false);
|
|
10556
|
+
},
|
|
10557
|
+
/** Toggle performance mode (persisted; reduces animations/observers). */
|
|
10558
|
+
setPerformanceMode(flag) {
|
|
10559
|
+
return safeCall("setPerformanceMode()", () => setPerformanceMode(flag !== false), false);
|
|
10560
|
+
},
|
|
10561
|
+
/** Current performance-mode flag. */
|
|
10562
|
+
performanceMode() {
|
|
10563
|
+
return safeCall("performanceMode()", () => performanceModeOn(), false);
|
|
10564
|
+
},
|
|
10565
|
+
/** Reload the page to pick up an updated client bundle (same as Ctrl+R). */
|
|
10566
|
+
reloadClient() {
|
|
10567
|
+
return safeCall("reloadClient()", () => { try { location.reload(); } catch {} return true; }, false);
|
|
10568
|
+
},
|
|
10569
|
+
/** Close and reopen DSH Desktop so changes that need a full restart load. */
|
|
10570
|
+
restartApp() {
|
|
10571
|
+
return safeCall("restartApp()", () => { restartApplication(); return true; }, false);
|
|
10572
|
+
},
|
|
9773
10573
|
/** Sessions waiting for a second pick before the split starts. */
|
|
9774
10574
|
pending() {
|
|
9775
10575
|
return safeCall("pending()", () => pendingSplitStore.ids(), []);
|
|
@@ -9836,6 +10636,9 @@ window.__ModuleLoader__.load({
|
|
|
9836
10636
|
frameColumns,
|
|
9837
10637
|
selectFrameColumns,
|
|
9838
10638
|
computeColumnBounds,
|
|
10639
|
+
measureColumnBounds,
|
|
10640
|
+
frameChildrenSnapshot,
|
|
10641
|
+
rectSnapshot,
|
|
9839
10642
|
normalizeTree,
|
|
9840
10643
|
isValidSessionId,
|
|
9841
10644
|
noteGeometry,
|
|
@@ -10270,6 +11073,7 @@ window.__ModuleLoader__.load({
|
|
|
10270
11073
|
}
|
|
10271
11074
|
function useRightbarOpen() {
|
|
10272
11075
|
const [open, setOpen] = React.useState(rightbarIsOpen);
|
|
11076
|
+
const performanceMode = useRuntime().performance === true;
|
|
10273
11077
|
React.useEffect(() => {
|
|
10274
11078
|
let column = null;
|
|
10275
11079
|
let observer = null;
|
|
@@ -10292,7 +11096,7 @@ window.__ModuleLoader__.load({
|
|
|
10292
11096
|
// The column can be created/removed by the stock layout; a cheap
|
|
10293
11097
|
// low-frequency re-scan re-attaches the observer and catches toggles
|
|
10294
11098
|
// that did not go through this plugin's button.
|
|
10295
|
-
timer = window.setInterval(sync, 800);
|
|
11099
|
+
timer = window.setInterval(sync, performanceMode ? 3500 : 800);
|
|
10296
11100
|
window.addEventListener("resize", sync);
|
|
10297
11101
|
return () => {
|
|
10298
11102
|
window.clearInterval(timer);
|
|
@@ -10301,7 +11105,7 @@ window.__ModuleLoader__.load({
|
|
|
10301
11105
|
try { observer.disconnect(); } catch {}
|
|
10302
11106
|
}
|
|
10303
11107
|
};
|
|
10304
|
-
}, []);
|
|
11108
|
+
}, [performanceMode]);
|
|
10305
11109
|
return open;
|
|
10306
11110
|
}
|
|
10307
11111
|
/** Two distinct right-sidebar glyphs: a right chevron while the panel is
|
|
@@ -10426,6 +11230,7 @@ window.__ModuleLoader__.load({
|
|
|
10426
11230
|
seatObserver: null,
|
|
10427
11231
|
seatFrame: 0,
|
|
10428
11232
|
timer: 0,
|
|
11233
|
+
lastSyncAt: 0,
|
|
10429
11234
|
};
|
|
10430
11235
|
// Scoped global selectors: prompt-enhancement plugins read the
|
|
10431
11236
|
// transcript with document.querySelector(All) (dsh-prompt-history's
|
|
@@ -10473,6 +11278,13 @@ window.__ModuleLoader__.load({
|
|
|
10473
11278
|
if (typeof MutationObserver === "function") {
|
|
10474
11279
|
state.seatObserver = new MutationObserver(() => {
|
|
10475
11280
|
if (state.seatFrame !== 0) return;
|
|
11281
|
+
// Perf mode: streaming mutates the overlay continuously. Sync at most
|
|
11282
|
+
// twice a second instead of once per animation frame.
|
|
11283
|
+
if (performanceModeOn()) {
|
|
11284
|
+
const now = Date.now();
|
|
11285
|
+
if (now - state.lastSyncAt < 500) return;
|
|
11286
|
+
state.lastSyncAt = now;
|
|
11287
|
+
}
|
|
10476
11288
|
const run = () => { state.seatFrame = 0; sync(); };
|
|
10477
11289
|
state.seatFrame = typeof requestAnimationFrame === "function"
|
|
10478
11290
|
? requestAnimationFrame(run)
|
|
@@ -10663,11 +11475,29 @@ window.__ModuleLoader__.load({
|
|
|
10663
11475
|
return composerAnchorBridge;
|
|
10664
11476
|
}
|
|
10665
11477
|
|
|
11478
|
+
/** Refcounted bridge ownership: the split body and the float layer can
|
|
11479
|
+
both host pane composers, and whichever unmounts last disposes. */
|
|
11480
|
+
let composerAnchorBridgeRefs = 0;
|
|
11481
|
+
function acquireComposerAnchorBridge() {
|
|
11482
|
+
installComposerAnchorBridge();
|
|
11483
|
+
composerAnchorBridgeRefs += 1;
|
|
11484
|
+
let released = false;
|
|
11485
|
+
return () => {
|
|
11486
|
+
if (released) return;
|
|
11487
|
+
released = true;
|
|
11488
|
+
composerAnchorBridgeRefs = Math.max(0, composerAnchorBridgeRefs - 1);
|
|
11489
|
+
if (composerAnchorBridgeRefs === 0 && composerAnchorBridge !== null) {
|
|
11490
|
+
try { composerAnchorBridge.dispose(); } catch {}
|
|
11491
|
+
composerAnchorBridge = null;
|
|
11492
|
+
}
|
|
11493
|
+
};
|
|
11494
|
+
}
|
|
11495
|
+
|
|
10666
11496
|
const WorkspaceBody = React.memo(function WorkspaceBody({ generation }) {
|
|
10667
11497
|
const state = useTree();
|
|
10668
11498
|
React.useLayoutEffect(() => {
|
|
10669
|
-
const
|
|
10670
|
-
return
|
|
11499
|
+
const release = acquireComposerAnchorBridge();
|
|
11500
|
+
return release;
|
|
10671
11501
|
}, []);
|
|
10672
11502
|
// A pane add/close/move mounts new composer cards after this commit.
|
|
10673
11503
|
React.useEffect(() => {
|
|
@@ -10784,6 +11614,7 @@ window.__ModuleLoader__.load({
|
|
|
10784
11614
|
h("div", { className: "dsv-help-body", style: { marginTop: "6px" } }, t("helpGestures")),
|
|
10785
11615
|
h("div", { className: "dsv-help-body", style: { marginTop: "6px" } }, t("helpDisable")),
|
|
10786
11616
|
h("div", { className: "dsv-help-body", style: { marginTop: "2px" } }, t("helpDiagnostics")),
|
|
11617
|
+
h("div", { className: "dsv-help-body", style: { marginTop: "2px" } }, t("helpRestart")),
|
|
10787
11618
|
h("div", { className: "dsv-help-actions" },
|
|
10788
11619
|
h("button", { type: "button", className: "dsv-chip-btn", onClick: closeHelp }, t("helpClose")),
|
|
10789
11620
|
h("button", { type: "button", className: "dsv-chip-btn", onClick: () => setEnabled(false) }, t("disableLabel")),
|
|
@@ -10966,12 +11797,84 @@ window.__ModuleLoader__.load({
|
|
|
10966
11797
|
|
|
10967
11798
|
/** The shell.overlay seat component: the workspace (keyed by the retry
|
|
10968
11799
|
epoch, so Retry remounts a crashed/latched boundary) plus the chrome. */
|
|
11800
|
+
/** Update-ready chip: the Host serves the on-disk plugin version, so a
|
|
11801
|
+
running page can notice a freshly installed/updated bundle and reload
|
|
11802
|
+
itself (client-only changes) without a full DSH restart. */
|
|
11803
|
+
function UpdateNotice() {
|
|
11804
|
+
const [ready, setReady] = React.useState(null);
|
|
11805
|
+
React.useEffect(() => {
|
|
11806
|
+
let stopped = false;
|
|
11807
|
+
const check = () => {
|
|
11808
|
+
fetch("/dsv/version", { cache: "no-store" }).then((response) => {
|
|
11809
|
+
if (!response.ok) return null;
|
|
11810
|
+
return response.json().catch(() => null);
|
|
11811
|
+
}).then((payload) => {
|
|
11812
|
+
if (stopped || payload === null || payload === undefined) return;
|
|
11813
|
+
const version = typeof payload.version === "string" ? payload.version : null;
|
|
11814
|
+
if (version === null || version === "" || version === PLUGIN_VERSION) return;
|
|
11815
|
+
if (storageGet(UPDATE_DISMISSED_KEY) === version) return;
|
|
11816
|
+
setReady(version);
|
|
11817
|
+
}).catch(() => {});
|
|
11818
|
+
};
|
|
11819
|
+
const bootTimer = window.setTimeout(check, 4000);
|
|
11820
|
+
const timer = window.setInterval(() => {
|
|
11821
|
+
if (document.visibilityState === "visible") check();
|
|
11822
|
+
}, UPDATE_POLL_MS);
|
|
11823
|
+
return () => {
|
|
11824
|
+
stopped = true;
|
|
11825
|
+
window.clearTimeout(bootTimer);
|
|
11826
|
+
window.clearInterval(timer);
|
|
11827
|
+
};
|
|
11828
|
+
}, []);
|
|
11829
|
+
if (ready === null) return null;
|
|
11830
|
+
const desktop = desktopShell();
|
|
11831
|
+
// Desktop app code is applied through the Host's HMR/rebuild path when
|
|
11832
|
+
// it can be, but a Host-half or linked-package change can still need a
|
|
11833
|
+
// full restart. Offer the restart itself instead of asking the user to
|
|
11834
|
+
// quit the app by hand. The Web GUI reloads the page.
|
|
11835
|
+
return h("div", { className: "dsv-update-chip", role: "status" },
|
|
11836
|
+
h("span", null, t(desktop ? "updateRestart" : "updateReady", { v: ready })),
|
|
11837
|
+
desktop ? h("button", {
|
|
11838
|
+
type: "button",
|
|
11839
|
+
className: "dsv-update-chip-btn accent",
|
|
11840
|
+
onClick: () => { closeLauncher(); openRestartDialog(); },
|
|
11841
|
+
}, t("restartApp")) : h("button", {
|
|
11842
|
+
type: "button",
|
|
11843
|
+
className: "dsv-update-chip-btn accent",
|
|
11844
|
+
onClick: () => { try { location.reload(); } catch {} },
|
|
11845
|
+
}, t("reloadNow")),
|
|
11846
|
+
h("button", {
|
|
11847
|
+
type: "button",
|
|
11848
|
+
className: "dsv-update-chip-btn",
|
|
11849
|
+
onClick: () => {
|
|
11850
|
+
storageSet(UPDATE_DISMISSED_KEY, ready);
|
|
11851
|
+
setReady(null);
|
|
11852
|
+
},
|
|
11853
|
+
}, t(desktop ? "gotIt" : "laterLabel")),
|
|
11854
|
+
);
|
|
11855
|
+
}
|
|
11856
|
+
|
|
10969
11857
|
function SplitWorkspaceSeat(props) {
|
|
10970
11858
|
const runtime = useRuntime();
|
|
11859
|
+
// A standalone system window renders ONLY its conversation: no split
|
|
11860
|
+
// workspace, no floats, no launcher. WorkspaceApp still mounts (hidden,
|
|
11861
|
+
// inactive) because it publishes the root standard faces the pane host
|
|
11862
|
+
// needs.
|
|
11863
|
+
const standaloneId = standaloneSessionId();
|
|
11864
|
+
if (standaloneId !== null) {
|
|
11865
|
+
try { document.documentElement.setAttribute("data-dsv-standalone", "1"); } catch {}
|
|
11866
|
+
const standaloneProps = Object.assign({}, props, { dsvStandalone: true });
|
|
11867
|
+
return h(React.Fragment, null,
|
|
11868
|
+
h(WorkspaceBoundary, { key: "workspace-" + runtime.epoch }, h(WorkspaceApp, standaloneProps)),
|
|
11869
|
+
h(WorkspaceBoundary, { key: "standalone-" + runtime.epoch }, h(StandaloneSessionWindow, { sessionId: standaloneId })),
|
|
11870
|
+
);
|
|
11871
|
+
}
|
|
10971
11872
|
return h(React.Fragment, null,
|
|
10972
11873
|
h(WorkspaceBoundary, { key: "workspace-" + runtime.epoch }, h(WorkspaceApp, props)),
|
|
10973
11874
|
h(PluginChrome, null),
|
|
11875
|
+
h(WorkspaceBoundary, { key: "floats-" + runtime.epoch }, h(FloatLayer, null)),
|
|
10974
11876
|
h(SplitLauncherLayer, null),
|
|
11877
|
+
h(UpdateNotice, null),
|
|
10975
11878
|
);
|
|
10976
11879
|
}
|
|
10977
11880
|
|
|
@@ -11004,7 +11907,11 @@ window.__ModuleLoader__.load({
|
|
|
11004
11907
|
// The activation gate: >=2 panes AND the kill switch/safe mode allow it.
|
|
11005
11908
|
// Everything below keys off this — observers, DOM scraping, the overlay.
|
|
11006
11909
|
const minimized = runtime.minimized === true;
|
|
11007
|
-
|
|
11910
|
+
// A standalone system window never activates the split overlay: its whole
|
|
11911
|
+
// page is owned by StandaloneSessionWindow.
|
|
11912
|
+
const standaloneWindow = props.dsvStandalone === true;
|
|
11913
|
+
const active = standaloneWindow !== true && leaves.length >= 2
|
|
11914
|
+
&& runtime.enabled === true && runtime.safeMode !== true;
|
|
11008
11915
|
const [picker, setPicker] = React.useState(pickerRequest);
|
|
11009
11916
|
const [bounds, setBounds] = React.useState({ left: 0, right: 0, top: 0, bottom: 0, ok: false });
|
|
11010
11917
|
const geometryWarnedRef = React.useRef(false);
|
|
@@ -11036,7 +11943,7 @@ window.__ModuleLoader__.load({
|
|
|
11036
11943
|
// inside that pane. Portals mount asynchronously, so a body childList
|
|
11037
11944
|
// observer plus a low-frequency re-scan catches new panes.
|
|
11038
11945
|
React.useEffect(() => {
|
|
11039
|
-
if (!operational) {
|
|
11946
|
+
if (!operational || runtime.performance === true) {
|
|
11040
11947
|
tocGripsRestore();
|
|
11041
11948
|
return undefined;
|
|
11042
11949
|
}
|
|
@@ -11072,7 +11979,7 @@ window.__ModuleLoader__.load({
|
|
|
11072
11979
|
document.body.classList.remove("dsv-layout-previewing");
|
|
11073
11980
|
tocGripsRestore();
|
|
11074
11981
|
};
|
|
11075
|
-
}, [operational]);
|
|
11982
|
+
}, [operational, runtime.performance]);
|
|
11076
11983
|
|
|
11077
11984
|
// A plugin/skills/settings panel replaces the whole main view. The split
|
|
11078
11985
|
// overlay would cover it, so step aside automatically and keep the tree;
|
|
@@ -11147,7 +12054,7 @@ window.__ModuleLoader__.load({
|
|
|
11147
12054
|
// (right sidebar open/close, desktop window resize). A single missed
|
|
11148
12055
|
// measurement used to leave the whole workspace invisible until the
|
|
11149
12056
|
// next full reload; this low-frequency backstop re-measures regardless.
|
|
11150
|
-
let fallbackInterval = window.setInterval(schedule, 1000);
|
|
12057
|
+
let fallbackInterval = window.setInterval(schedule, runtime.performance === true ? 3500 : 1000);
|
|
11151
12058
|
let transitionHost = null;
|
|
11152
12059
|
try {
|
|
11153
12060
|
const overlayLayer = document.querySelector("[data-shell-overlay]");
|
|
@@ -11179,7 +12086,7 @@ window.__ModuleLoader__.load({
|
|
|
11179
12086
|
window.removeEventListener("resize", schedule);
|
|
11180
12087
|
document.removeEventListener("visibilitychange", schedule);
|
|
11181
12088
|
};
|
|
11182
|
-
}, [active]);
|
|
12089
|
+
}, [active, runtime.performance]);
|
|
11183
12090
|
|
|
11184
12091
|
// Crash-loop guard timers: a deliberate activation is persisted BEFORE it
|
|
11185
12092
|
// can crash; a healthy, responsive workspace clears the counter after
|
|
@@ -11312,7 +12219,7 @@ window.__ModuleLoader__.load({
|
|
|
11312
12219
|
// stock view) and announce the outcome with a transient toast, so
|
|
11313
12220
|
// "/compact" is never silent.
|
|
11314
12221
|
React.useEffect(() => {
|
|
11315
|
-
if (!operational) return undefined;
|
|
12222
|
+
if (!operational || runtime.performance === true) return undefined;
|
|
11316
12223
|
if (typeof MutationObserver !== "function") return undefined;
|
|
11317
12224
|
const seen = new WeakSet();
|
|
11318
12225
|
const seenText = new Set();
|
|
@@ -11378,7 +12285,7 @@ window.__ModuleLoader__.load({
|
|
|
11378
12285
|
return () => {
|
|
11379
12286
|
try { observer.disconnect(); } catch {}
|
|
11380
12287
|
};
|
|
11381
|
-
}, [operational]);
|
|
12288
|
+
}, [operational, runtime.performance]);
|
|
11382
12289
|
|
|
11383
12290
|
// NOTE: there is deliberately NO "auto-add the current conversation"
|
|
11384
12291
|
// effect any more. The old one flipped the workspace on at boot —
|
|
@@ -11776,6 +12683,15 @@ window.__ModuleLoader__.load({
|
|
|
11776
12683
|
}
|
|
11777
12684
|
function closePaneAnimated(sessionId) {
|
|
11778
12685
|
if (closingPaneSessions.has(sessionId)) return;
|
|
12686
|
+
// Closing one of the last two panes ends the split. The store clears the
|
|
12687
|
+
// whole tree in that case (see endSplitBecauseTooSmall), so the other
|
|
12688
|
+
// conversation immediately loses its "in split" membership.
|
|
12689
|
+
if (treeStore.leafIds().length <= 2) {
|
|
12690
|
+
try { treeStore.closeLeaf(sessionId); } catch {}
|
|
12691
|
+
scheduleRightbarHeal(450);
|
|
12692
|
+
showPaneToast(t("splitExited"), true);
|
|
12693
|
+
return;
|
|
12694
|
+
}
|
|
11779
12695
|
const pane = paneElementForSession(sessionId);
|
|
11780
12696
|
if (pane === null || pane === undefined || prefersReducedMotion()) {
|
|
11781
12697
|
try { treeStore.closeLeaf(sessionId); } catch {}
|
|
@@ -11818,6 +12734,86 @@ window.__ModuleLoader__.load({
|
|
|
11818
12734
|
return true;
|
|
11819
12735
|
}
|
|
11820
12736
|
|
|
12737
|
+
/** DSH Desktop exposes its preload product API; the browser Web GUI does
|
|
12738
|
+
not. Restarting the app is only possible from the Desktop. */
|
|
12739
|
+
function desktopShell() {
|
|
12740
|
+
return typeof window !== "undefined" && typeof window.dshDesktop !== "undefined";
|
|
12741
|
+
}
|
|
12742
|
+
|
|
12743
|
+
/** Ask the Host half to close and reopen DSH. The Host is a Node child of
|
|
12744
|
+
the Desktop shell, so it can drive an OS-level quit+relaunch even
|
|
12745
|
+
though production DSH has no in-app restart entry. */
|
|
12746
|
+
function restartApplication() {
|
|
12747
|
+
if (!desktopShell()) {
|
|
12748
|
+
showPaneToast(t("restartUnsupported"), true);
|
|
12749
|
+
return;
|
|
12750
|
+
}
|
|
12751
|
+
showPaneToast(t("restarting"), true);
|
|
12752
|
+
try {
|
|
12753
|
+
fetch("/dsv/restart", {
|
|
12754
|
+
method: "POST",
|
|
12755
|
+
headers: { "content-type": "application/json", "x-dsv-restart": "1" },
|
|
12756
|
+
body: "{\"confirm\":true}",
|
|
12757
|
+
cache: "no-store",
|
|
12758
|
+
keepalive: true,
|
|
12759
|
+
}).then((response) => response.json().catch(() => null)).then((payload) => {
|
|
12760
|
+
if (payload === null || payload === undefined || payload.ok !== true) throw new Error("restart");
|
|
12761
|
+
}).catch(() => {
|
|
12762
|
+
showPaneToast(t("restartFailed"), true);
|
|
12763
|
+
});
|
|
12764
|
+
} catch {
|
|
12765
|
+
showPaneToast(t("restartFailed"), true);
|
|
12766
|
+
}
|
|
12767
|
+
}
|
|
12768
|
+
|
|
12769
|
+
/** Confirmation before the app closes: running tasks are interrupted. */
|
|
12770
|
+
function RestartDialog() {
|
|
12771
|
+
React.useEffect(() => {
|
|
12772
|
+
const onKeyDown = (event) => {
|
|
12773
|
+
if (event.key !== "Escape") return;
|
|
12774
|
+
event.preventDefault();
|
|
12775
|
+
event.stopPropagation();
|
|
12776
|
+
closeLauncher();
|
|
12777
|
+
};
|
|
12778
|
+
document.addEventListener("keydown", onKeyDown, true);
|
|
12779
|
+
return () => document.removeEventListener("keydown", onKeyDown, true);
|
|
12780
|
+
}, []);
|
|
12781
|
+
return h("div", {
|
|
12782
|
+
className: "dsv-modal-backdrop",
|
|
12783
|
+
onPointerDown: (event) => {
|
|
12784
|
+
if (event.target === event.currentTarget) closeLauncher();
|
|
12785
|
+
},
|
|
12786
|
+
},
|
|
12787
|
+
h("div", {
|
|
12788
|
+
className: "dsv-modal",
|
|
12789
|
+
role: "dialog",
|
|
12790
|
+
"aria-modal": "true",
|
|
12791
|
+
"aria-label": t("restartTitle"),
|
|
12792
|
+
},
|
|
12793
|
+
h("div", { className: "dsv-modal-head" },
|
|
12794
|
+
h("span", { className: "dsv-modal-title" }, t("restartTitle")),
|
|
12795
|
+
h("button", {
|
|
12796
|
+
type: "button",
|
|
12797
|
+
className: "dsv-modal-close",
|
|
12798
|
+
title: t("addSplitCancel"),
|
|
12799
|
+
"aria-label": t("addSplitCancel"),
|
|
12800
|
+
onClick: closeLauncher,
|
|
12801
|
+
}, "×"),
|
|
12802
|
+
),
|
|
12803
|
+
h("div", { className: "dsv-modal-hint" }, t("restartBody")),
|
|
12804
|
+
h("div", { className: "dsv-modal-foot", style: { borderTop: "none", paddingTop: 0 } },
|
|
12805
|
+
h("span", { className: "dsv-modal-count" }, ""),
|
|
12806
|
+
h("button", { type: "button", className: "dsv-modal-btn", onClick: closeLauncher }, t("addSplitCancel")),
|
|
12807
|
+
h("button", {
|
|
12808
|
+
type: "button",
|
|
12809
|
+
className: "dsv-modal-btn accent",
|
|
12810
|
+
onClick: () => { closeLauncher(); restartApplication(); },
|
|
12811
|
+
}, t("restartNow")),
|
|
12812
|
+
),
|
|
12813
|
+
),
|
|
12814
|
+
);
|
|
12815
|
+
}
|
|
12816
|
+
|
|
11821
12817
|
/** Aspect ratio of the conversation column; only decides columns vs rows
|
|
11822
12818
|
for a two-pane split (the same 1.2 fallback settleAuto uses). */
|
|
11823
12819
|
function splitColumnAspect() {
|
|
@@ -11867,6 +12863,7 @@ window.__ModuleLoader__.load({
|
|
|
11867
12863
|
const ordered = [];
|
|
11868
12864
|
for (const id of Array.isArray(ids) ? ids : []) {
|
|
11869
12865
|
if (!isValidSessionId(id) || ordered.indexOf(id) !== -1) continue;
|
|
12866
|
+
if (floatStore.has(id)) floatStore.remove(id);
|
|
11870
12867
|
ordered.push(id);
|
|
11871
12868
|
}
|
|
11872
12869
|
if (ordered.length < 2) {
|
|
@@ -11886,6 +12883,7 @@ window.__ModuleLoader__.load({
|
|
|
11886
12883
|
split until a second pick exists. Active: append a pane immediately. */
|
|
11887
12884
|
function addSessionToSplit(sessionId) {
|
|
11888
12885
|
if (!isValidSessionId(sessionId)) return false;
|
|
12886
|
+
if (floatStore.has(sessionId)) floatStore.remove(sessionId);
|
|
11889
12887
|
const leaves = treeStore.leafIds();
|
|
11890
12888
|
if (leaves.indexOf(sessionId) !== -1) {
|
|
11891
12889
|
try { treeStore.setFocus(sessionId); } catch {}
|
|
@@ -11957,6 +12955,7 @@ window.__ModuleLoader__.load({
|
|
|
11957
12955
|
try { composerAnchorBridge.dispose(); } catch {}
|
|
11958
12956
|
composerAnchorBridge = null;
|
|
11959
12957
|
}
|
|
12958
|
+
composerAnchorBridgeRefs = 0;
|
|
11960
12959
|
for (const reference of paneSessionReferences.values()) {
|
|
11961
12960
|
try { if (reference !== null && typeof reference.release === "function") reference.release(); } catch {}
|
|
11962
12961
|
}
|
|
@@ -12004,6 +13003,7 @@ window.__ModuleLoader__.load({
|
|
|
12004
13003
|
const cleared = [];
|
|
12005
13004
|
closeLauncher();
|
|
12006
13005
|
pendingSplitStore.clear();
|
|
13006
|
+
floatStore.clear();
|
|
12007
13007
|
try { window.clearTimeout(minimizeTimer); } catch {}
|
|
12008
13008
|
try { window.clearTimeout(exitTimer); } catch {}
|
|
12009
13009
|
minimizeTimer = 0;
|
|
@@ -12048,13 +13048,17 @@ window.__ModuleLoader__.load({
|
|
|
12048
13048
|
}
|
|
12049
13049
|
|
|
12050
13050
|
const SPLIT_STORAGE_PREFIX = "dsh.split-workspace.";
|
|
13051
|
+
// User preferences survive "reset split": a hard reset is about the split
|
|
13052
|
+
// environment (layout/caches), not about the performance setting or the
|
|
13053
|
+
// update notices.
|
|
13054
|
+
const PRESERVED_STORAGE_KEYS = new Set([PERF_KEY, SEEN_VERSION_KEY, UPDATE_DISMISSED_KEY]);
|
|
12051
13055
|
function clearSplitStorage(storage, cleared) {
|
|
12052
13056
|
if (storage === null || storage === undefined) return;
|
|
12053
13057
|
const keys = [];
|
|
12054
13058
|
try {
|
|
12055
13059
|
for (let index = 0; index < storage.length; index += 1) {
|
|
12056
13060
|
const key = storage.key(index);
|
|
12057
|
-
if (typeof key === "string" && key.indexOf(SPLIT_STORAGE_PREFIX) === 0) keys.push(key);
|
|
13061
|
+
if (typeof key === "string" && key.indexOf(SPLIT_STORAGE_PREFIX) === 0 && !PRESERVED_STORAGE_KEYS.has(key)) keys.push(key);
|
|
12058
13062
|
}
|
|
12059
13063
|
} catch {}
|
|
12060
13064
|
for (const key of keys) {
|
|
@@ -12084,18 +13088,19 @@ window.__ModuleLoader__.load({
|
|
|
12084
13088
|
id: "split-workspace.session",
|
|
12085
13089
|
target: "session",
|
|
12086
13090
|
order: 350,
|
|
12087
|
-
observe: () => [treeStore, pendingSplitStore],
|
|
13091
|
+
observe: () => [treeStore, pendingSplitStore, floatStore],
|
|
12088
13092
|
resolve: (target) => {
|
|
12089
13093
|
const id = target !== null && target !== undefined ? target.sessionId : undefined;
|
|
12090
13094
|
if (!isValidSessionId(id)) return [];
|
|
12091
13095
|
const inSplit = treeStore.leafIds().indexOf(id) !== -1;
|
|
12092
13096
|
const pending = pendingSplitStore.has(id);
|
|
13097
|
+
const floating = floatStore.has(id);
|
|
12093
13098
|
return [
|
|
12094
13099
|
{
|
|
12095
13100
|
id: "add",
|
|
12096
13101
|
label: t("menuAddToSplit"),
|
|
12097
13102
|
disabled: inSplit || pending,
|
|
12098
|
-
run: () => { addSessionToSplit(id); },
|
|
13103
|
+
run: () => { if (floatStore.has(id)) dockFloatToSplit(id); else addSessionToSplit(id); },
|
|
12099
13104
|
},
|
|
12100
13105
|
{
|
|
12101
13106
|
id: "remove",
|
|
@@ -12103,6 +13108,22 @@ window.__ModuleLoader__.load({
|
|
|
12103
13108
|
disabled: !inSplit && !pending,
|
|
12104
13109
|
run: () => { removeSessionFromSplit(id); },
|
|
12105
13110
|
},
|
|
13111
|
+
{
|
|
13112
|
+
id: "float",
|
|
13113
|
+
label: t(floating ? "menuFloatClose" : "menuFloatOpen"),
|
|
13114
|
+
separatorBefore: true,
|
|
13115
|
+
run: () => {
|
|
13116
|
+
if (floatStore.has(id)) closeFloatWindow(id);
|
|
13117
|
+
else floatSession(id);
|
|
13118
|
+
},
|
|
13119
|
+
},
|
|
13120
|
+
{
|
|
13121
|
+
id: "system",
|
|
13122
|
+
label: t("menuSystemWindow"),
|
|
13123
|
+
separatorBefore: true,
|
|
13124
|
+
failureLabel: t("systemWindowFailed"),
|
|
13125
|
+
run: () => openSystemWindow(id),
|
|
13126
|
+
},
|
|
12106
13127
|
];
|
|
12107
13128
|
},
|
|
12108
13129
|
});
|
|
@@ -12207,6 +13228,7 @@ window.__ModuleLoader__.load({
|
|
|
12207
13228
|
if (additionsOnly) {
|
|
12208
13229
|
for (const id of ids) {
|
|
12209
13230
|
if (leavesNow.indexOf(id) === -1) {
|
|
13231
|
+
try { floatStore.remove(id); } catch {}
|
|
12210
13232
|
try { treeStore.addPane(id); } catch {}
|
|
12211
13233
|
}
|
|
12212
13234
|
}
|
|
@@ -12327,6 +13349,7 @@ window.__ModuleLoader__.load({
|
|
|
12327
13349
|
try {
|
|
12328
13350
|
if (target.closest(".dsv-launcher-menu") !== null) return;
|
|
12329
13351
|
if (target.closest(".dsv-footer-btn") !== null) return;
|
|
13352
|
+
if (target.closest(".dsv-fallback-launcher") !== null) return;
|
|
12330
13353
|
} catch {}
|
|
12331
13354
|
}
|
|
12332
13355
|
closeLauncher();
|
|
@@ -12373,10 +13396,67 @@ window.__ModuleLoader__.load({
|
|
|
12373
13396
|
disabled: !active || runtime.minimized === true,
|
|
12374
13397
|
}),
|
|
12375
13398
|
h("div", { key: "separator-bottom", className: "dsv-launcher-separator" }),
|
|
13399
|
+
row("performance", "⚡", t("performanceMode") + (runtime.performance === true ? " ✓" : ""),
|
|
13400
|
+
() => { closeLauncher(); setPerformanceMode(runtime.performance !== true); }),
|
|
13401
|
+
row("reload", "↻", t("refreshInterface"), () => { closeLauncher(); try { location.reload(); } catch {} }),
|
|
13402
|
+
desktopShell()
|
|
13403
|
+
? row("restart", "⏻", t("restartApp"), () => { closeLauncher(); openRestartDialog(); })
|
|
13404
|
+
: null,
|
|
12376
13405
|
row("reset", "↺", t("menuResetSplit"), () => { closeLauncher(); resetSplitEnvironment(); }, { danger: true }),
|
|
12377
13406
|
);
|
|
12378
13407
|
}
|
|
12379
13408
|
|
|
13409
|
+
/** Fallback entry point when the stock sidebar footer does not render this
|
|
13410
|
+
plugin's action (collapsed/absent sidebar, a layout that replaces the
|
|
13411
|
+
footer, or an older host whose footer slot is empty). The launcher menu
|
|
13412
|
+
stays reachable from the conversation column's bottom-left corner. */
|
|
13413
|
+
function LauncherFallback() {
|
|
13414
|
+
const runtime = useRuntime();
|
|
13415
|
+
const launcher = useLauncherState();
|
|
13416
|
+
const pending = usePendingSplit();
|
|
13417
|
+
const [footerVisible, setFooterVisible] = React.useState(true);
|
|
13418
|
+
React.useEffect(() => {
|
|
13419
|
+
const check = () => {
|
|
13420
|
+
let visible = false;
|
|
13421
|
+
try {
|
|
13422
|
+
const button = document.querySelector(".dsv-footer-btn");
|
|
13423
|
+
visible = button !== null && button !== undefined && button.getBoundingClientRect().width > 0;
|
|
13424
|
+
} catch {}
|
|
13425
|
+
setFooterVisible(visible);
|
|
13426
|
+
};
|
|
13427
|
+
check();
|
|
13428
|
+
const timer = window.setInterval(check, runtime.performance === true ? 3000 : 1200);
|
|
13429
|
+
return () => { try { window.clearInterval(timer); } catch {} };
|
|
13430
|
+
}, [runtime.performance, runtime.enabled]);
|
|
13431
|
+
if (runtime.enabled !== true || footerVisible || launcher.mode !== "closed") return null;
|
|
13432
|
+
// Own the conversation column's bottom-left corner when its bounds are
|
|
13433
|
+
// known (so the fallback never sits on the stock sidebar controls); fall
|
|
13434
|
+
// back to the viewport corner when geometry is not measured yet.
|
|
13435
|
+
let style = null;
|
|
13436
|
+
try {
|
|
13437
|
+
const bounds = measureColumnBounds();
|
|
13438
|
+
if (bounds !== null && bounds !== undefined && bounds.ok === true) {
|
|
13439
|
+
style = {
|
|
13440
|
+
left: Math.max(8, bounds.left) + 16 + "px",
|
|
13441
|
+
bottom: Math.max(8, bounds.bottom) + 16 + "px",
|
|
13442
|
+
};
|
|
13443
|
+
}
|
|
13444
|
+
} catch {}
|
|
13445
|
+
return h("button", {
|
|
13446
|
+
type: "button",
|
|
13447
|
+
className: "dsv-fallback-launcher",
|
|
13448
|
+
style,
|
|
13449
|
+
title: t("menuTitle"),
|
|
13450
|
+
"aria-label": t("fallbackLauncher"),
|
|
13451
|
+
"aria-haspopup": "menu",
|
|
13452
|
+
onClick: (event) => openLauncherMenu(event.currentTarget),
|
|
13453
|
+
},
|
|
13454
|
+
h(SplitIconV, { size: 15 }),
|
|
13455
|
+
h("span", { className: "dsv-fallback-label" }, t("fallbackLauncher")),
|
|
13456
|
+
pending.length > 0 ? h("span", { className: "dsv-footer-badge" }, String(pending.length)) : null,
|
|
13457
|
+
);
|
|
13458
|
+
}
|
|
13459
|
+
|
|
12380
13460
|
/** Always-mounted launcher layer (inside the shell.overlay seat). */
|
|
12381
13461
|
function SplitLauncherLayer() {
|
|
12382
13462
|
const launcher = useLauncherState();
|
|
@@ -12388,7 +13468,133 @@ window.__ModuleLoader__.load({
|
|
|
12388
13468
|
}), []);
|
|
12389
13469
|
if (launcher.mode === "menu") return h(SplitLauncherMenu, { request: launcher });
|
|
12390
13470
|
if (launcher.mode === "dialog") return h(AddSplitDialog, null);
|
|
12391
|
-
return null;
|
|
13471
|
+
if (launcher.mode === "restart") return h(RestartDialog, null);
|
|
13472
|
+
return h(LauncherFallback, null);
|
|
13473
|
+
}
|
|
13474
|
+
|
|
13475
|
+
|
|
13476
|
+
/** One floating window: a fixed, movable, resizable frame around the real
|
|
13477
|
+
pane (header + transcript + composer). The pane header is the drag
|
|
13478
|
+
handle; the wrapper draws the window frame and owns the resize edges. */
|
|
13479
|
+
function FloatWindow({ id, x, y, width, height, zIndex, focused }) {
|
|
13480
|
+
const runtime = useRuntime();
|
|
13481
|
+
const style = {
|
|
13482
|
+
left: x + "px", top: y + "px", width: width + "px", height: height + "px",
|
|
13483
|
+
zIndex: zIndex,
|
|
13484
|
+
};
|
|
13485
|
+
return h("div", {
|
|
13486
|
+
className: "dsv-float-window" + (focused ? " focused" : ""),
|
|
13487
|
+
"data-dsv-float": id,
|
|
13488
|
+
style,
|
|
13489
|
+
onPointerDownCapture: () => { try { floatStore.focus(id); } catch {} },
|
|
13490
|
+
},
|
|
13491
|
+
h("div", { className: "dsv-float-body" },
|
|
13492
|
+
h(RenderLeaf, { id, chrome: true, generation: runtime.generation, floating: true })),
|
|
13493
|
+
["n", "s", "e", "w", "ne", "nw", "se", "sw"].map((dir) => h("div", {
|
|
13494
|
+
key: dir,
|
|
13495
|
+
className: "dsv-float-resize dsv-float-resize-" + dir,
|
|
13496
|
+
"data-dsv-float-resize": dir,
|
|
13497
|
+
onPointerDown: (event) => beginFloatGesture(id, dir, event),
|
|
13498
|
+
onPointerMove: moveFloatGesture,
|
|
13499
|
+
onPointerUp: endFloatGesture,
|
|
13500
|
+
onPointerCancel: endFloatGesture,
|
|
13501
|
+
})),
|
|
13502
|
+
);
|
|
13503
|
+
}
|
|
13504
|
+
|
|
13505
|
+
/** Always-mounted floating layer. It renders above the split overlay and
|
|
13506
|
+
is independent of the split activation gate: one conversation can float
|
|
13507
|
+
with zero panes. The composer bridge is acquired only while at least one
|
|
13508
|
+
window exists, so the inactive plugin still observes nothing. */
|
|
13509
|
+
function FloatLayer() {
|
|
13510
|
+
const runtime = useRuntime();
|
|
13511
|
+
const floats = useFloats();
|
|
13512
|
+
const windows = floats.windows;
|
|
13513
|
+
const count = windows.length;
|
|
13514
|
+
React.useEffect(() => {
|
|
13515
|
+
if (runtime.enabled !== true || count === 0) return undefined;
|
|
13516
|
+
floatLayerMounted = true;
|
|
13517
|
+
const release = acquireComposerAnchorBridge();
|
|
13518
|
+
return () => { floatLayerMounted = false; release(); };
|
|
13519
|
+
}, [runtime.enabled, count === 0]);
|
|
13520
|
+
React.useEffect(() => {
|
|
13521
|
+
if (count === 0) return undefined;
|
|
13522
|
+
const clampAll = () => {
|
|
13523
|
+
const work = chipWorkRect();
|
|
13524
|
+
for (const win of floatStore.getSnapshot().windows) {
|
|
13525
|
+
const next = clampFloatRect(win, work);
|
|
13526
|
+
if (next.x !== win.x || next.y !== win.y || next.w !== win.w || next.h !== win.h) {
|
|
13527
|
+
floatStore.setRect(win.id, next, false);
|
|
13528
|
+
}
|
|
13529
|
+
}
|
|
13530
|
+
};
|
|
13531
|
+
clampAll();
|
|
13532
|
+
window.addEventListener("resize", clampAll);
|
|
13533
|
+
// The column can change without a window resize (right-sidebar open/
|
|
13534
|
+
// close, shell layout transitions), so re-clamp on a low-frequency
|
|
13535
|
+
// backstop while floats exist. setRect is a no-op when nothing moved.
|
|
13536
|
+
// Perf mode keeps only the resize path.
|
|
13537
|
+
const timer = performanceModeOn() ? 0 : window.setInterval(clampAll, 1000);
|
|
13538
|
+
return () => {
|
|
13539
|
+
window.removeEventListener("resize", clampAll);
|
|
13540
|
+
if (timer !== 0) {
|
|
13541
|
+
try { window.clearInterval(timer); } catch {}
|
|
13542
|
+
}
|
|
13543
|
+
};
|
|
13544
|
+
}, [count, runtime.performance]);
|
|
13545
|
+
if (runtime.enabled !== true || count === 0) return null;
|
|
13546
|
+
// Stacking is a z-index swap, never a DOM reorder: moving a live editor
|
|
13547
|
+
// subtree (keyed React children) would blur the composer.
|
|
13548
|
+
const ranks = new Map();
|
|
13549
|
+
windows.slice().sort((a, b) => a.z - b.z).forEach((win, index) => ranks.set(win.id, index + 1));
|
|
13550
|
+
return h("div", {
|
|
13551
|
+
className: "dsv-float-layer",
|
|
13552
|
+
"data-dsv-float-layer": "true",
|
|
13553
|
+
"data-plugin": PLUGIN_ID,
|
|
13554
|
+
}, windows.map((win) => h(FloatWindow, {
|
|
13555
|
+
key: win.id,
|
|
13556
|
+
id: win.id,
|
|
13557
|
+
x: win.x,
|
|
13558
|
+
y: win.y,
|
|
13559
|
+
width: win.w,
|
|
13560
|
+
height: win.h,
|
|
13561
|
+
zIndex: ranks.get(win.id) || 1,
|
|
13562
|
+
focused: floats.focused === win.id,
|
|
13563
|
+
})));
|
|
13564
|
+
}
|
|
13565
|
+
|
|
13566
|
+
/** Whole-page view used inside a standalone system window: one native
|
|
13567
|
+
conversation, native window controls, no split / floats / launcher. */
|
|
13568
|
+
function StandaloneSessionWindow({ sessionId }) {
|
|
13569
|
+
const runtime = useRuntime();
|
|
13570
|
+
const sessions = useSessionsList();
|
|
13571
|
+
const summary = sessions !== null && sessions !== undefined && sessions.byId !== undefined
|
|
13572
|
+
? sessions.byId[sessionId]
|
|
13573
|
+
: undefined;
|
|
13574
|
+
const title = summary !== null && summary !== undefined
|
|
13575
|
+
? (summary.displayTitle || summary.title || sessionId)
|
|
13576
|
+
: sessionId;
|
|
13577
|
+
React.useEffect(() => {
|
|
13578
|
+
try { document.title = title + " — DeepSeek Harness"; } catch {}
|
|
13579
|
+
}, [title]);
|
|
13580
|
+
// The DOM session-list source normally observes only while a split is
|
|
13581
|
+
// live. This page is a one-conversation workspace, so keep it warm for
|
|
13582
|
+
// the title and the re-hosted header.
|
|
13583
|
+
React.useEffect(() => {
|
|
13584
|
+
const source = sessionsListSource;
|
|
13585
|
+
if (source === undefined || source === null || typeof source.setActive !== "function") return undefined;
|
|
13586
|
+
try { source.setActive(true); } catch {}
|
|
13587
|
+
try { if (typeof source.refresh === "function") source.refresh(); } catch {}
|
|
13588
|
+
return () => {
|
|
13589
|
+
try { source.setActive(false); } catch {}
|
|
13590
|
+
};
|
|
13591
|
+
}, []);
|
|
13592
|
+
return h("div", {
|
|
13593
|
+
className: "dsv-standalone",
|
|
13594
|
+
"data-dsv-standalone-window": sessionId,
|
|
13595
|
+
},
|
|
13596
|
+
h(RenderLeaf, { id: sessionId, chrome: true, generation: runtime.generation, standalone: true }),
|
|
13597
|
+
);
|
|
12392
13598
|
}
|
|
12393
13599
|
|
|
12394
13600
|
function restoreSplit() {
|
|
@@ -12513,6 +13719,34 @@ window.__ModuleLoader__.load({
|
|
|
12513
13719
|
|
|
12514
13720
|
ctx.effect(() => insertStyle(DSV_CSS), "dsh-split-workspace: stylesheet");
|
|
12515
13721
|
|
|
13722
|
+
// Performance mode is a CSS class on <html>; mirror the persisted flag
|
|
13723
|
+
// on every apply so a reload keeps it.
|
|
13724
|
+
ctx.effect(() => {
|
|
13725
|
+
applyPerformanceClass();
|
|
13726
|
+
return () => {
|
|
13727
|
+
try { document.documentElement.removeAttribute("data-dsv-performance"); } catch {}
|
|
13728
|
+
};
|
|
13729
|
+
}, "dsh-split-workspace: performance class");
|
|
13730
|
+
|
|
13731
|
+
// Acknowledge the freshly loaded bundle. When the stored version is older
|
|
13732
|
+
// than this client, the user just got an update (usually after a reload
|
|
13733
|
+
// or a DSH restart) — say so once. The update-ready chip covers the
|
|
13734
|
+
// opposite direction: a newer version sitting on disk while this page
|
|
13735
|
+
// still runs the old bundle.
|
|
13736
|
+
ctx.effect(() => {
|
|
13737
|
+
try {
|
|
13738
|
+
const seen = storageGet(SEEN_VERSION_KEY);
|
|
13739
|
+
storageSet(SEEN_VERSION_KEY, PLUGIN_VERSION);
|
|
13740
|
+
if (seen !== null && seen !== undefined && seen !== "" && seen !== PLUGIN_VERSION) {
|
|
13741
|
+
const timer = window.setTimeout(() => {
|
|
13742
|
+
try { showPaneToast(t("updatedToast", { v: PLUGIN_VERSION }), true); } catch {}
|
|
13743
|
+
}, 1400);
|
|
13744
|
+
return () => { try { window.clearTimeout(timer); } catch {} };
|
|
13745
|
+
}
|
|
13746
|
+
} catch {}
|
|
13747
|
+
return () => {};
|
|
13748
|
+
}, "dsh-split-workspace: version notice");
|
|
13749
|
+
|
|
12516
13750
|
// Global chords (Alt+T, Alt+Shift+Arrows) ride the plugin's OWN
|
|
12517
13751
|
// lifetime now: the old module-scope listeners stacked on every reload
|
|
12518
13752
|
// and were never removed.
|