dsh-split-workspace 0.5.0 → 0.8.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 +284 -6
- package/lib/client.js +1096 -52
- package/lib/index.js +154 -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.8.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,14 @@ 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
|
+
function readPerformanceMode() {
|
|
133
|
+
return storageGet(PERF_KEY) === "1";
|
|
134
|
+
}
|
|
135
|
+
function writePerformanceMode(value) {
|
|
136
|
+
storageSet(PERF_KEY, value === true ? "1" : "0");
|
|
137
|
+
}
|
|
107
138
|
/* There is exactly one layout policy: AUTO, derived from the pane count.
|
|
108
139
|
The old per-run mode menu (columns/rows/grid) is gone: it only ever
|
|
109
140
|
produced a hand-picked arrangement that the next add/close immediately
|
|
@@ -310,7 +341,8 @@ window.__ModuleLoader__.load({
|
|
|
310
341
|
if (pane === null && sourceEl.nodeType === 1 && sourceEl.classList && sourceEl.classList.contains("dsv-pane")) pane = sourceEl;
|
|
311
342
|
}
|
|
312
343
|
} catch {}
|
|
313
|
-
const simpleOnly = typeof window !== "undefined" && window.__DSV_SIMPLE_PREVIEW === true
|
|
344
|
+
const simpleOnly = (typeof window !== "undefined" && window.__DSV_SIMPLE_PREVIEW === true)
|
|
345
|
+
|| performanceModeOn();
|
|
314
346
|
const realThumb = typeof window !== "undefined" && window.__DSV_REAL_THUMB === true;
|
|
315
347
|
try {
|
|
316
348
|
if (simpleOnly !== true && pane !== null && pane !== undefined) {
|
|
@@ -538,7 +570,7 @@ window.__ModuleLoader__.load({
|
|
|
538
570
|
helpOpen: "Split view help",
|
|
539
571
|
helpClose: "Close",
|
|
540
572
|
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.",
|
|
573
|
+
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
574
|
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
575
|
helpDiagnostics: "Diagnostics: window.__dshSplitWorkspace.health() — see the README section “Safety, recovery and diagnostics”.",
|
|
544
576
|
tipTitle: "Split view is on",
|
|
@@ -576,6 +608,30 @@ window.__ModuleLoader__.load({
|
|
|
576
608
|
addSplitPending: "Pending",
|
|
577
609
|
splitExited: "Split view closed",
|
|
578
610
|
splitLeft: "Left split view",
|
|
611
|
+
menuFloatOpen: "Enter floating window",
|
|
612
|
+
menuFloatClose: "Exit floating window",
|
|
613
|
+
floatDock: "Dock to split",
|
|
614
|
+
floatClose: "Close floating window",
|
|
615
|
+
floatEntered: "Opened in a floating window",
|
|
616
|
+
floatDocked: "Docked to the split view",
|
|
617
|
+
floatClosed: "Floating window closed",
|
|
618
|
+
floatHint: "Drag the title bar to move · drag an edge to resize",
|
|
619
|
+
helpFloat: "Right-click a conversation → Enter floating window detaches it into a movable window; Dock to split puts it back.",
|
|
620
|
+
menuSystemWindow: "Open in system window",
|
|
621
|
+
systemWindowOpened: "Opened in a separate system window",
|
|
622
|
+
systemWindowFailed: "Could not open a system window",
|
|
623
|
+
standaloneFullscreen: "Fullscreen",
|
|
624
|
+
performanceMode: "Performance mode",
|
|
625
|
+
performanceOn: "Performance mode on — animations and background observers are reduced",
|
|
626
|
+
performanceOff: "Performance mode off",
|
|
627
|
+
reloadClient: "Reload interface",
|
|
628
|
+
refreshInterface: "Refresh interface",
|
|
629
|
+
updateReady: "Version {v} is installed — reload to apply",
|
|
630
|
+
updateRestart: "Version {v} is installed — restart DSH to apply",
|
|
631
|
+
reloadNow: "Reload now",
|
|
632
|
+
gotIt: "Got it",
|
|
633
|
+
laterLabel: "Later",
|
|
634
|
+
updatedToast: "Updated to v{v}",
|
|
579
635
|
};
|
|
580
636
|
const ZH = {
|
|
581
637
|
label: "分屏视图",
|
|
@@ -630,7 +686,7 @@ window.__ModuleLoader__.load({
|
|
|
630
686
|
helpOpen: "分屏帮助",
|
|
631
687
|
helpClose: "关闭",
|
|
632
688
|
helpShortcuts: "快捷键",
|
|
633
|
-
helpGestures: "点击侧边栏底部的分屏按钮打开菜单(添加分屏 / 退出分屏 / 最小化分屏 / 重置分屏),或从左侧会话列表把对话拖到页面即可分屏;右键会话可加入 /
|
|
689
|
+
helpGestures: "点击侧边栏底部的分屏按钮打开菜单(添加分屏 / 退出分屏 / 最小化分屏 / 重置分屏),或从左侧会话列表把对话拖到页面即可分屏;右键会话可加入 / 退出分屏,也可以“进入浮窗”把会话变成独立浮窗(浮窗标题栏的“回到分屏”可放回)。拖住面板标题栏可移动面板:原位置收起,虚线空位预览落点。拖动分隔条可调整大小,✕ 关闭面板。",
|
|
634
690
|
helpDisable: "停用分屏:运行 window.__dshSplitWorkspace.setEnabled(false),或将 localStorage 'dsh.split-workspace.enabled.v1' 设为 \"0\"。重置布局:window.__dshSplitWorkspace.reset()。",
|
|
635
691
|
helpDiagnostics: "诊断:window.__dshSplitWorkspace.health() — 详见 README“安全性、恢复与诊断”。",
|
|
636
692
|
tipTitle: "分屏视图已开启",
|
|
@@ -668,6 +724,30 @@ window.__ModuleLoader__.load({
|
|
|
668
724
|
addSplitPending: "待分屏",
|
|
669
725
|
splitExited: "已退出分屏",
|
|
670
726
|
splitLeft: "已退出分屏",
|
|
727
|
+
menuFloatOpen: "进入浮窗",
|
|
728
|
+
menuFloatClose: "退出浮窗",
|
|
729
|
+
floatDock: "回到分屏",
|
|
730
|
+
floatClose: "关闭浮窗",
|
|
731
|
+
floatEntered: "已在浮窗中打开",
|
|
732
|
+
floatDocked: "已回到分屏",
|
|
733
|
+
floatClosed: "浮窗已关闭",
|
|
734
|
+
floatHint: "拖动标题栏移动 · 拖动边缘调整大小",
|
|
735
|
+
helpFloat: "右键会话 → 进入浮窗,可把该会话变成独立浮窗;浮窗标题栏的“回到分屏”可放回分屏。",
|
|
736
|
+
menuSystemWindow: "在系统窗口打开",
|
|
737
|
+
systemWindowOpened: "已在独立系统窗口中打开",
|
|
738
|
+
systemWindowFailed: "无法打开系统窗口",
|
|
739
|
+
standaloneFullscreen: "全屏",
|
|
740
|
+
performanceMode: "性能模式",
|
|
741
|
+
performanceOn: "性能模式已开启:动画与后台观察器已精简",
|
|
742
|
+
performanceOff: "性能模式已关闭",
|
|
743
|
+
reloadClient: "重载界面",
|
|
744
|
+
refreshInterface: "刷新界面",
|
|
745
|
+
updateReady: "已安装 v{v},刷新页面生效",
|
|
746
|
+
updateRestart: "已安装 v{v},请重启 DSH 后生效",
|
|
747
|
+
reloadNow: "刷新页面",
|
|
748
|
+
gotIt: "知道了",
|
|
749
|
+
laterLabel: "稍后",
|
|
750
|
+
updatedToast: "已更新到 v{v}",
|
|
671
751
|
};
|
|
672
752
|
|
|
673
753
|
/** Fallback translator: every locale wrapper unwraps back to this. */
|
|
@@ -916,6 +996,82 @@ window.__ModuleLoader__.load({
|
|
|
916
996
|
@media (prefers-reduced-motion: reduce) {
|
|
917
997
|
.dsv-launcher-menu, .dsv-modal-backdrop { animation: none; }
|
|
918
998
|
}
|
|
999
|
+
/* ---- 0.6.0 floating windows: a movable/resizable in-app window that
|
|
1000
|
+
hosts ONE native conversation. Floats render from the always-mounted
|
|
1001
|
+
shell.overlay seat, sit above the split overlay, and are mutually
|
|
1002
|
+
exclusive with split panes per session (enter/leave switches modes). ---- */
|
|
1003
|
+
.dsv-float-layer {
|
|
1004
|
+
position: fixed; inset: 0; z-index: 85; pointer-events: none;
|
|
1005
|
+
font-family: var(--dsw-font-family, system-ui, sans-serif);
|
|
1006
|
+
color: var(--dsw-alias-label-primary);
|
|
1007
|
+
}
|
|
1008
|
+
.dsv-float-window {
|
|
1009
|
+
position: fixed; display: flex; flex-direction: column;
|
|
1010
|
+
box-sizing: border-box;
|
|
1011
|
+
min-width: 320px; min-height: 220px; overflow: hidden;
|
|
1012
|
+
border: 1px solid var(--dsw-alias-border-l2); border-radius: 14px;
|
|
1013
|
+
background: var(--dsw-alias-bg-base);
|
|
1014
|
+
box-shadow: 0 18px 48px rgba(15, 23, 42, .22), 0 2px 6px rgba(15, 23, 42, .12);
|
|
1015
|
+
pointer-events: auto;
|
|
1016
|
+
animation: dsv-float-in .16s ease-out;
|
|
1017
|
+
transition: box-shadow .16s ease, border-color .16s ease;
|
|
1018
|
+
--dsh-chat-content-width: 748px;
|
|
1019
|
+
--dsh-composer-card-max-width: calc(var(--dsh-chat-content-width) + 32px);
|
|
1020
|
+
--dsh-composer-side-clearance: 16px;
|
|
1021
|
+
--dsh-composer-dock-inset: 8px;
|
|
1022
|
+
}
|
|
1023
|
+
.dsv-float-window.focused {
|
|
1024
|
+
border-color: color-mix(in srgb, var(--dsw-static-deepseek-500) 32%, var(--dsw-alias-border-l2));
|
|
1025
|
+
box-shadow: 0 0 0 1px color-mix(in srgb, var(--dsw-static-deepseek-500) 28%, transparent),
|
|
1026
|
+
0 22px 56px rgba(15, 23, 42, .26);
|
|
1027
|
+
}
|
|
1028
|
+
.dsv-float-body { flex: 1; min-height: 0; display: flex; }
|
|
1029
|
+
.dsv-float-body > .dsv-pane { flex: 1; min-width: 0; min-height: 0; }
|
|
1030
|
+
/* The outer window owns the frame: the re-hosted pane drops its card
|
|
1031
|
+
chrome (border/radius/glow) and keeps only its header + content. */
|
|
1032
|
+
.dsv-float-window .dsv-pane,
|
|
1033
|
+
.dsv-float-window .dsv-pane.focused {
|
|
1034
|
+
border: 0; border-radius: 0; box-shadow: none; background: transparent;
|
|
1035
|
+
}
|
|
1036
|
+
.dsv-float-window .dsv-pane-header { height: 34px; border-top-left-radius: 14px; border-top-right-radius: 14px; }
|
|
1037
|
+
.dsv-float-resize { position: absolute; z-index: 2; touch-action: none; }
|
|
1038
|
+
.dsv-float-resize-n, .dsv-float-resize-s { left: 12px; right: 12px; height: 6px; cursor: row-resize; }
|
|
1039
|
+
.dsv-float-resize-n { top: -3px; }
|
|
1040
|
+
.dsv-float-resize-s { bottom: -3px; }
|
|
1041
|
+
.dsv-float-resize-e, .dsv-float-resize-w { top: 12px; bottom: 12px; width: 6px; cursor: col-resize; }
|
|
1042
|
+
.dsv-float-resize-e { right: -3px; }
|
|
1043
|
+
.dsv-float-resize-w { left: -3px; }
|
|
1044
|
+
.dsv-float-resize-ne, .dsv-float-resize-nw, .dsv-float-resize-se, .dsv-float-resize-sw { width: 16px; height: 16px; }
|
|
1045
|
+
.dsv-float-resize-ne { right: -4px; top: -4px; cursor: nesw-resize; }
|
|
1046
|
+
.dsv-float-resize-nw { left: -4px; top: -4px; cursor: nwse-resize; }
|
|
1047
|
+
.dsv-float-resize-se { right: -4px; bottom: -4px; cursor: nwse-resize; }
|
|
1048
|
+
.dsv-float-resize-sw { left: -4px; bottom: -4px; cursor: nesw-resize; }
|
|
1049
|
+
@keyframes dsv-float-in { from { opacity: 0; transform: translateY(6px) scale(.992); } }
|
|
1050
|
+
@media (prefers-reduced-motion: reduce) {
|
|
1051
|
+
.dsv-float-window { animation: none; transition: none; }
|
|
1052
|
+
}
|
|
1053
|
+
/* ---- standalone system window (hash dsvWindow=<id>): one conversation
|
|
1054
|
+
fills the whole page, rendered into the separate OS/browser window the
|
|
1055
|
+
Host route opened. The window chrome (close/minimize/zoom/fullscreen)
|
|
1056
|
+
is the native window's own. ---- */
|
|
1057
|
+
html[data-dsv-standalone] { overflow: hidden; }
|
|
1058
|
+
html[data-dsv-standalone] body { overflow: hidden; }
|
|
1059
|
+
.dsv-standalone {
|
|
1060
|
+
position: fixed; inset: 0; z-index: 1200;
|
|
1061
|
+
display: flex; flex-direction: column; min-width: 0; min-height: 0;
|
|
1062
|
+
background: var(--dsw-alias-bg-base);
|
|
1063
|
+
color: var(--dsw-alias-label-primary);
|
|
1064
|
+
font-family: var(--dsw-font-family, system-ui, sans-serif);
|
|
1065
|
+
--dsh-chat-content-width: 748px;
|
|
1066
|
+
--dsh-composer-card-max-width: calc(var(--dsh-chat-content-width) + 32px);
|
|
1067
|
+
--dsh-composer-side-clearance: 16px;
|
|
1068
|
+
--dsh-composer-dock-inset: 8px;
|
|
1069
|
+
}
|
|
1070
|
+
.dsv-standalone > .dsv-pane {
|
|
1071
|
+
flex: 1; min-width: 0; min-height: 0;
|
|
1072
|
+
border: 0; border-radius: 0; box-shadow: none;
|
|
1073
|
+
}
|
|
1074
|
+
.dsv-standalone .dsv-pane-header { height: 40px; }
|
|
919
1075
|
/* One title per pane: the pane header owns it. The stock header keeps its
|
|
920
1076
|
view tabs and action rows but not its breadcrumb; the slim header's own
|
|
921
1077
|
title span is removed in JSX. */
|
|
@@ -1829,6 +1985,70 @@ window.__ModuleLoader__.load({
|
|
|
1829
1985
|
@media (prefers-reduced-motion: reduce) {
|
|
1830
1986
|
.dsv-drop-ghost { transition: none; }
|
|
1831
1987
|
}
|
|
1988
|
+
/* ---- performance mode -------------------------------------------------
|
|
1989
|
+
One HTML attribute turns off every non-essential paint/animation cost:
|
|
1990
|
+
no card shadows, no focus glow, no fade/zoom transitions, no render-loop
|
|
1991
|
+
animations. JS-side observers are reduced by performanceModeOn() gates. */
|
|
1992
|
+
html[data-dsv-performance="1"] .dsv-pane,
|
|
1993
|
+
html[data-dsv-performance="1"] .dsv-overlay,
|
|
1994
|
+
html[data-dsv-performance="1"] .dsv-float-window,
|
|
1995
|
+
html[data-dsv-performance="1"] .dsv-minimized-chip,
|
|
1996
|
+
html[data-dsv-performance="1"] .dsv-chip,
|
|
1997
|
+
html[data-dsv-performance="1"] .dsv-launcher-menu,
|
|
1998
|
+
html[data-dsv-performance="1"] .dsv-modal,
|
|
1999
|
+
html[data-dsv-performance="1"] .dsv-drop-ghost,
|
|
2000
|
+
html[data-dsv-performance="1"] .dsv-drag-preview {
|
|
2001
|
+
animation: none !important;
|
|
2002
|
+
transition: none !important;
|
|
2003
|
+
}
|
|
2004
|
+
html[data-dsv-performance="1"] .dsv-pane,
|
|
2005
|
+
html[data-dsv-performance="1"] .dsv-float-window,
|
|
2006
|
+
html[data-dsv-performance="1"] .dsv-chip,
|
|
2007
|
+
html[data-dsv-performance="1"] .dsv-launcher-menu,
|
|
2008
|
+
html[data-dsv-performance="1"] .dsv-modal {
|
|
2009
|
+
box-shadow: none !important;
|
|
2010
|
+
}
|
|
2011
|
+
html[data-dsv-performance="1"] .dsv-pane.focused {
|
|
2012
|
+
border-color: var(--dsw-alias-border-l2) !important;
|
|
2013
|
+
box-shadow: none !important;
|
|
2014
|
+
}
|
|
2015
|
+
html[data-dsv-performance="1"] .dsv-pane-wrap,
|
|
2016
|
+
html[data-dsv-performance="1"] .dsv-split-wrap,
|
|
2017
|
+
html[data-dsv-performance="1"] .dsv-divider::after,
|
|
2018
|
+
html[data-dsv-performance="1"] .dsv-pane-btn,
|
|
2019
|
+
html[data-dsv-performance="1"] .dsv-mode-btn {
|
|
2020
|
+
animation: none !important;
|
|
2021
|
+
transition: none !important;
|
|
2022
|
+
}
|
|
2023
|
+
html[data-dsv-performance="1"] .dsv-pane,
|
|
2024
|
+
html[data-dsv-performance="1"] .dsv-float-window {
|
|
2025
|
+
border-radius: 8px;
|
|
2026
|
+
}
|
|
2027
|
+
html[data-dsv-performance="1"] .dsv-think-root[data-state="running"] .dsv-think-row::after,
|
|
2028
|
+
html[data-dsv-performance="1"] .dsv-rowcard-root[data-state="running"] .dsv-rowcard-row::after {
|
|
2029
|
+
animation: none !important;
|
|
2030
|
+
display: none !important;
|
|
2031
|
+
}
|
|
2032
|
+
/* update-ready chip: shown when the on-disk plugin version differs from
|
|
2033
|
+
the client bundle this page loaded. */
|
|
2034
|
+
.dsv-update-chip {
|
|
2035
|
+
position: fixed; right: 16px; bottom: 16px; z-index: 2147483000;
|
|
2036
|
+
display: flex; align-items: center; gap: 8px;
|
|
2037
|
+
padding: 8px 10px 8px 12px; border-radius: 10px;
|
|
2038
|
+
border: 1px solid var(--dsw-alias-border-l2);
|
|
2039
|
+
background: var(--dsw-alias-bg-overlay, var(--dsw-alias-bg-layer-1));
|
|
2040
|
+
color: var(--dsw-alias-label-primary);
|
|
2041
|
+
box-shadow: 0 6px 24px rgba(0, 0, 0, .16);
|
|
2042
|
+
font-family: var(--dsw-font-family, system-ui, sans-serif); font-size: 12px;
|
|
2043
|
+
}
|
|
2044
|
+
.dsv-update-chip-btn {
|
|
2045
|
+
height: 24px; padding: 0 10px; border-radius: 7px; cursor: pointer;
|
|
2046
|
+
border: 1px solid var(--dsw-alias-border-l2); background: transparent;
|
|
2047
|
+
color: var(--dsw-alias-label-primary); font-family: inherit; font-size: 12px;
|
|
2048
|
+
}
|
|
2049
|
+
.dsv-update-chip-btn.accent { background: var(--dsw-static-deepseek-500); border-color: transparent; color: #fff; }
|
|
2050
|
+
.dsv-update-chip-btn:hover { background: var(--dsw-alias-interactive-bg-hover); }
|
|
2051
|
+
html[data-dsv-performance="1"] .dsv-update-chip { box-shadow: none; }
|
|
1832
2052
|
`;
|
|
1833
2053
|
|
|
1834
2054
|
function insertStyle(css) {
|
|
@@ -1977,6 +2197,8 @@ window.__ModuleLoader__.load({
|
|
|
1977
2197
|
persistedTree: "unknown",
|
|
1978
2198
|
maximized: null,
|
|
1979
2199
|
minimized: readMinimized(),
|
|
2200
|
+
performance: readPerformanceMode(),
|
|
2201
|
+
updateReady: null,
|
|
1980
2202
|
};
|
|
1981
2203
|
const runtimeListeners = new Set();
|
|
1982
2204
|
function runtimeSnapshot() {
|
|
@@ -2007,6 +2229,28 @@ window.__ModuleLoader__.load({
|
|
|
2007
2229
|
return React.useSyncExternalStore(runtimeSubscribe, runtimeSnapshot, runtimeSnapshot);
|
|
2008
2230
|
}
|
|
2009
2231
|
|
|
2232
|
+
/** Performance mode: one boolean consumed by observers and CSS alike. */
|
|
2233
|
+
function performanceModeOn() {
|
|
2234
|
+
return runtimeState.performance === true;
|
|
2235
|
+
}
|
|
2236
|
+
/** Mirror performance mode onto <html> so the stylesheet can drop
|
|
2237
|
+
animations/shadows without re-rendering every pane. */
|
|
2238
|
+
function applyPerformanceClass() {
|
|
2239
|
+
try {
|
|
2240
|
+
if (typeof document !== "undefined" && document.documentElement !== null) {
|
|
2241
|
+
document.documentElement.setAttribute("data-dsv-performance", performanceModeOn() ? "1" : "0");
|
|
2242
|
+
}
|
|
2243
|
+
} catch {}
|
|
2244
|
+
}
|
|
2245
|
+
function setPerformanceMode(value) {
|
|
2246
|
+
const next = value === true;
|
|
2247
|
+
writePerformanceMode(next);
|
|
2248
|
+
setRuntime({ performance: next });
|
|
2249
|
+
applyPerformanceClass();
|
|
2250
|
+
showPaneToast(t(next ? "performanceOn" : "performanceOff"), true);
|
|
2251
|
+
return next;
|
|
2252
|
+
}
|
|
2253
|
+
|
|
2010
2254
|
/** True only when the workspace may take over the viewport at all. The
|
|
2011
2255
|
`geometryBlocked` flag closes the diagnosis's "invisible active" hole:
|
|
2012
2256
|
a persisted split whose column cannot be measured must NOT eat the
|
|
@@ -2150,8 +2394,11 @@ window.__ModuleLoader__.load({
|
|
|
2150
2394
|
safeMode: runtimeState.safeMode,
|
|
2151
2395
|
active: runtimeState.active,
|
|
2152
2396
|
minimized: runtimeState.minimized === true,
|
|
2397
|
+
performance: runtimeState.performance === true,
|
|
2153
2398
|
geometryBlocked: runtimeState.geometryBlocked === true,
|
|
2154
2399
|
panes: (() => { try { return treeStore.leafIds().length; } catch { return 0; } })(),
|
|
2400
|
+
floats: (() => { try { return floatStore.ids(); } catch { return []; } })(),
|
|
2401
|
+
floatLayerMounted: floatLayerMounted,
|
|
2155
2402
|
blockedReason: (() => { try { return blockedReason(); } catch { return "unknown"; } })(),
|
|
2156
2403
|
failures: runtimeState.failures,
|
|
2157
2404
|
lastError: runtimeState.lastError,
|
|
@@ -2517,7 +2764,16 @@ window.__ModuleLoader__.load({
|
|
|
2517
2764
|
const root = parsed !== null && parsed !== undefined && typeof parsed === "object"
|
|
2518
2765
|
? normalizeTree(parsed.root, { depth: 0, seen: new Set(), stats })
|
|
2519
2766
|
: null;
|
|
2520
|
-
if (root !== null) {
|
|
2767
|
+
if (root !== null && leafOf(root, []).length < 2) {
|
|
2768
|
+
// A one-pane tree is not a split. Older builds could persist one
|
|
2769
|
+
// after closing the second-to-last pane; that kept the surviving
|
|
2770
|
+
// conversation tagged "in split" while nothing rendered. Discard it.
|
|
2771
|
+
storageRemove(TREE_KEY);
|
|
2772
|
+
persistedStatus = "absent";
|
|
2773
|
+
try {
|
|
2774
|
+
console.info(LOG_PREFIX + " dropped a persisted one-pane layout on load (a split needs at least two panes).");
|
|
2775
|
+
} catch {}
|
|
2776
|
+
} else if (root !== null) {
|
|
2521
2777
|
state = { root, focus: null };
|
|
2522
2778
|
const repaired = stats.duplicates > 0 || stats.depthLimited > 0;
|
|
2523
2779
|
persistedStatus = repaired ? "repaired" : "ok";
|
|
@@ -2565,6 +2821,21 @@ window.__ModuleLoader__.load({
|
|
|
2565
2821
|
for (const listener of [...listeners]) listener();
|
|
2566
2822
|
}
|
|
2567
2823
|
|
|
2824
|
+
/** The split ended because fewer than two panes remain. Clear the WHOLE
|
|
2825
|
+
tree (not just the closed pane): a one-pane tree is not a split, and
|
|
2826
|
+
keeping it would leave the surviving conversation tagged "in split"
|
|
2827
|
+
in the context menu / add-split dialog while nothing renders. */
|
|
2828
|
+
function endSplitBecauseTooSmall() {
|
|
2829
|
+
const before = leafOf(state.root, []);
|
|
2830
|
+
state = { root: null, focus: null };
|
|
2831
|
+
for (const id of before) deferPaneDisposeCheck(id);
|
|
2832
|
+
storageRemove(TREE_KEY);
|
|
2833
|
+
setRuntime({ persistedTree: "absent", maximized: null, minimized: false });
|
|
2834
|
+
writeMinimized(false);
|
|
2835
|
+
revision += 1;
|
|
2836
|
+
for (const listener of [...listeners]) listener();
|
|
2837
|
+
}
|
|
2838
|
+
|
|
2568
2839
|
return {
|
|
2569
2840
|
getSnapshot: () => state,
|
|
2570
2841
|
getRevision: () => revision,
|
|
@@ -2619,6 +2890,9 @@ window.__ModuleLoader__.load({
|
|
|
2619
2890
|
},
|
|
2620
2891
|
addPane(sessionId) {
|
|
2621
2892
|
if (!isValidSessionId(sessionId)) return;
|
|
2893
|
+
// A conversation is either a pane or a float, never both: any path
|
|
2894
|
+
// that adds a pane retires its floating window first.
|
|
2895
|
+
try { if (floatStore.has(sessionId)) floatStore.remove(sessionId); } catch {}
|
|
2622
2896
|
if (findLeafNode(state.root, sessionId) !== null) {
|
|
2623
2897
|
commit({ root: state.root, focus: sessionId });
|
|
2624
2898
|
return;
|
|
@@ -2656,6 +2930,7 @@ window.__ModuleLoader__.load({
|
|
|
2656
2930
|
},
|
|
2657
2931
|
splitLeaf(leafId, dir, newId, side) {
|
|
2658
2932
|
if (!isValidSessionId(newId)) return;
|
|
2933
|
+
try { if (floatStore.has(newId)) floatStore.remove(newId); } catch {}
|
|
2659
2934
|
if (findLeafNode(state.root, newId) !== null) {
|
|
2660
2935
|
commit({ root: state.root, focus: newId });
|
|
2661
2936
|
return;
|
|
@@ -2669,8 +2944,17 @@ window.__ModuleLoader__.load({
|
|
|
2669
2944
|
if (ok) commit({ root: next, focus: newId });
|
|
2670
2945
|
},
|
|
2671
2946
|
closeLeaf(id) {
|
|
2947
|
+
const before = leafOf(state.root, []);
|
|
2672
2948
|
const [next, removed] = removeLeaf(state.root, id);
|
|
2673
|
-
if (removed)
|
|
2949
|
+
if (!removed) return;
|
|
2950
|
+
// Closing the second-to-last pane ends the split: clear every pane
|
|
2951
|
+
// instead of keeping an invisible one-pane tree with stale membership.
|
|
2952
|
+
if (before.length >= 2 && leafOf(next, []).length < 2) {
|
|
2953
|
+
endSplitBecauseTooSmall();
|
|
2954
|
+
return;
|
|
2955
|
+
}
|
|
2956
|
+
commit({ root: next, focus: state.focus });
|
|
2957
|
+
this.settleAuto();
|
|
2674
2958
|
},
|
|
2675
2959
|
movePane(srcId, dstId, zone) {
|
|
2676
2960
|
if (srcId === dstId) return;
|
|
@@ -2795,6 +3079,362 @@ window.__ModuleLoader__.load({
|
|
|
2795
3079
|
setLauncherState({ mode: "dialog", rect: null, source: source === "footer" ? "footer" : "session" });
|
|
2796
3080
|
}
|
|
2797
3081
|
|
|
3082
|
+
// ---------------------------------------------------------------------
|
|
3083
|
+
// floating windows (0.6.0)
|
|
3084
|
+
//
|
|
3085
|
+
// DSH has no second native window: the Desktop main window denies
|
|
3086
|
+
// window.open() and the Web client has no per-session deep link, so a
|
|
3087
|
+
// "window" here is an in-app floating surface rendered by the
|
|
3088
|
+
// always-mounted shell.overlay seat. It hosts the SAME native ChatPane the
|
|
3089
|
+
// split re-hosts, and it is mutually exclusive with a split pane for one
|
|
3090
|
+
// session: entering a float detaches the pane, docking it back re-attaches
|
|
3091
|
+
// it. Geometry lives in viewport CSS pixels, persisted under FLOAT_KEY and
|
|
3092
|
+
// clamped to the conversation column on every gesture/resize.
|
|
3093
|
+
// ---------------------------------------------------------------------
|
|
3094
|
+
|
|
3095
|
+
const FLOAT_W = 680;
|
|
3096
|
+
const FLOAT_H = 620;
|
|
3097
|
+
const FLOAT_MIN_W = 320;
|
|
3098
|
+
const FLOAT_MIN_H = 220;
|
|
3099
|
+
|
|
3100
|
+
function readFloatWindows() {
|
|
3101
|
+
const raw = storageGet(FLOAT_KEY);
|
|
3102
|
+
if (!raw) return [];
|
|
3103
|
+
let parsed = null;
|
|
3104
|
+
try { parsed = JSON.parse(raw); } catch { return []; }
|
|
3105
|
+
const list = parsed !== null && parsed !== undefined && Array.isArray(parsed.windows) ? parsed.windows : [];
|
|
3106
|
+
const out = [];
|
|
3107
|
+
for (const entry of list) {
|
|
3108
|
+
if (entry === null || typeof entry !== "object") continue;
|
|
3109
|
+
const id = entry.id;
|
|
3110
|
+
if (!isValidSessionId(id)) continue;
|
|
3111
|
+
if (out.some((win) => win.id === id)) continue;
|
|
3112
|
+
const x = Number(entry.x);
|
|
3113
|
+
const y = Number(entry.y);
|
|
3114
|
+
const w = Number(entry.w);
|
|
3115
|
+
const h = Number(entry.h);
|
|
3116
|
+
const z = Number(entry.z);
|
|
3117
|
+
out.push({
|
|
3118
|
+
id,
|
|
3119
|
+
x: Number.isFinite(x) ? x : 0,
|
|
3120
|
+
y: Number.isFinite(y) ? y : 0,
|
|
3121
|
+
w: Number.isFinite(w) && w >= FLOAT_MIN_W ? w : FLOAT_W,
|
|
3122
|
+
h: Number.isFinite(h) && h >= FLOAT_MIN_H ? h : FLOAT_H,
|
|
3123
|
+
z: Number.isFinite(z) ? z : out.length + 1,
|
|
3124
|
+
});
|
|
3125
|
+
}
|
|
3126
|
+
return out;
|
|
3127
|
+
}
|
|
3128
|
+
|
|
3129
|
+
const floatStore = (() => {
|
|
3130
|
+
let windows = readFloatWindows();
|
|
3131
|
+
let focused = windows.length > 0 ? windows[windows.length - 1].id : null;
|
|
3132
|
+
let persistTimer = 0;
|
|
3133
|
+
const listeners = new Set();
|
|
3134
|
+
let snapshot = Object.freeze({ windows: windows.slice(), focused });
|
|
3135
|
+
const emit = () => {
|
|
3136
|
+
for (const listener of [...listeners]) {
|
|
3137
|
+
try { listener(); } catch {}
|
|
3138
|
+
}
|
|
3139
|
+
};
|
|
3140
|
+
const publish = () => {
|
|
3141
|
+
snapshot = Object.freeze({ windows: windows.slice(), focused });
|
|
3142
|
+
emit();
|
|
3143
|
+
};
|
|
3144
|
+
const write = () => {
|
|
3145
|
+
persistTimer = 0;
|
|
3146
|
+
try { storageSet(FLOAT_KEY, JSON.stringify({ windows })); } catch {}
|
|
3147
|
+
};
|
|
3148
|
+
const schedulePersist = (immediate) => {
|
|
3149
|
+
if (persistTimer !== 0) {
|
|
3150
|
+
try { window.clearTimeout(persistTimer); } catch {}
|
|
3151
|
+
persistTimer = 0;
|
|
3152
|
+
}
|
|
3153
|
+
if (immediate === true) { write(); return; }
|
|
3154
|
+
try { persistTimer = window.setTimeout(write, 200); } catch { write(); }
|
|
3155
|
+
};
|
|
3156
|
+
const find = (id) => windows.find((win) => win.id === id);
|
|
3157
|
+
return {
|
|
3158
|
+
getSnapshot: () => snapshot,
|
|
3159
|
+
subscribe(listener) {
|
|
3160
|
+
if (typeof listener !== "function") return () => {};
|
|
3161
|
+
listeners.add(listener);
|
|
3162
|
+
return () => { listeners.delete(listener); };
|
|
3163
|
+
},
|
|
3164
|
+
ids: () => windows.map((win) => win.id),
|
|
3165
|
+
size: () => windows.length,
|
|
3166
|
+
has: (id) => windows.some((win) => win.id === id),
|
|
3167
|
+
focusedId: () => focused,
|
|
3168
|
+
add(id, rect) {
|
|
3169
|
+
if (!isValidSessionId(id) || windows.some((win) => win.id === id)) return false;
|
|
3170
|
+
const max = windows.reduce((acc, win) => Math.max(acc, win.z), 0);
|
|
3171
|
+
windows = windows.concat([{
|
|
3172
|
+
id,
|
|
3173
|
+
x: rect !== null && rect !== undefined && Number.isFinite(rect.x) ? rect.x : 0,
|
|
3174
|
+
y: rect !== null && rect !== undefined && Number.isFinite(rect.y) ? rect.y : 0,
|
|
3175
|
+
w: rect !== null && rect !== undefined && Number.isFinite(rect.w) ? rect.w : FLOAT_W,
|
|
3176
|
+
h: rect !== null && rect !== undefined && Number.isFinite(rect.h) ? rect.h : FLOAT_H,
|
|
3177
|
+
z: max + 1,
|
|
3178
|
+
}]);
|
|
3179
|
+
focused = id;
|
|
3180
|
+
publish();
|
|
3181
|
+
schedulePersist(false);
|
|
3182
|
+
return true;
|
|
3183
|
+
},
|
|
3184
|
+
remove(id) {
|
|
3185
|
+
const next = windows.filter((win) => win.id !== id);
|
|
3186
|
+
if (next.length === windows.length) return false;
|
|
3187
|
+
windows = next;
|
|
3188
|
+
if (focused === id) {
|
|
3189
|
+
const top = windows.reduce((acc, win) => (acc === null || win.z > acc.z ? win : acc), null);
|
|
3190
|
+
focused = top === null ? null : top.id;
|
|
3191
|
+
}
|
|
3192
|
+
publish();
|
|
3193
|
+
schedulePersist(true);
|
|
3194
|
+
return true;
|
|
3195
|
+
},
|
|
3196
|
+
clear() {
|
|
3197
|
+
const had = windows.length > 0 || focused !== null;
|
|
3198
|
+
windows = [];
|
|
3199
|
+
focused = null;
|
|
3200
|
+
if (had) {
|
|
3201
|
+
publish();
|
|
3202
|
+
schedulePersist(true);
|
|
3203
|
+
}
|
|
3204
|
+
},
|
|
3205
|
+
focus(id) {
|
|
3206
|
+
const target = find(id);
|
|
3207
|
+
if (target === undefined) {
|
|
3208
|
+
focused = null;
|
|
3209
|
+
publish();
|
|
3210
|
+
return;
|
|
3211
|
+
}
|
|
3212
|
+
const max = windows.reduce((acc, win) => Math.max(acc, win.z), 0);
|
|
3213
|
+
if (target.z !== max || focused !== id) {
|
|
3214
|
+
target.z = max + 1;
|
|
3215
|
+
focused = id;
|
|
3216
|
+
publish();
|
|
3217
|
+
schedulePersist(false);
|
|
3218
|
+
}
|
|
3219
|
+
},
|
|
3220
|
+
setRect(id, rect, immediate) {
|
|
3221
|
+
const target = find(id);
|
|
3222
|
+
if (target === undefined) return;
|
|
3223
|
+
if (target.x === rect.x && target.y === rect.y && target.w === rect.w && target.h === rect.h) return;
|
|
3224
|
+
target.x = rect.x;
|
|
3225
|
+
target.y = rect.y;
|
|
3226
|
+
target.w = rect.w;
|
|
3227
|
+
target.h = rect.h;
|
|
3228
|
+
windows = windows.slice();
|
|
3229
|
+
publish();
|
|
3230
|
+
schedulePersist(immediate === true);
|
|
3231
|
+
},
|
|
3232
|
+
persistNow() {
|
|
3233
|
+
if (persistTimer !== 0) {
|
|
3234
|
+
try { window.clearTimeout(persistTimer); } catch {}
|
|
3235
|
+
persistTimer = 0;
|
|
3236
|
+
}
|
|
3237
|
+
write();
|
|
3238
|
+
},
|
|
3239
|
+
};
|
|
3240
|
+
})();
|
|
3241
|
+
|
|
3242
|
+
function useFloats() {
|
|
3243
|
+
return React.useSyncExternalStore(floatStore.subscribe, floatStore.getSnapshot, floatStore.getSnapshot);
|
|
3244
|
+
}
|
|
3245
|
+
|
|
3246
|
+
/** Keep a rect inside the conversation column (the same work area the
|
|
3247
|
+
restore chip uses; falls back to the viewport below the title bar). */
|
|
3248
|
+
function clampFloatRect(rect, work) {
|
|
3249
|
+
const width = Math.max(FLOAT_MIN_W, Math.min(rect.w, Math.max(FLOAT_MIN_W, work.width)));
|
|
3250
|
+
const height = Math.max(FLOAT_MIN_H, Math.min(rect.h, Math.max(FLOAT_MIN_H, work.height)));
|
|
3251
|
+
const x = Math.round(Math.min(Math.max(rect.x, work.left), Math.max(work.left, work.left + work.width - width)));
|
|
3252
|
+
const y = Math.round(Math.min(Math.max(rect.y, work.top), Math.max(work.top, work.top + work.height - height)));
|
|
3253
|
+
return { x, y, w: Math.round(width), h: Math.round(height) };
|
|
3254
|
+
}
|
|
3255
|
+
|
|
3256
|
+
function defaultFloatRect() {
|
|
3257
|
+
const work = chipWorkRect();
|
|
3258
|
+
const w = Math.min(FLOAT_W, Math.max(FLOAT_MIN_W, Math.round(work.width * 0.74)));
|
|
3259
|
+
const h = Math.min(FLOAT_H, Math.max(FLOAT_MIN_H, Math.round(work.height * 0.74)));
|
|
3260
|
+
// Cascade successive windows so a second float never lands exactly on
|
|
3261
|
+
// the first one (the user can still drag them anywhere afterwards).
|
|
3262
|
+
let index = 0;
|
|
3263
|
+
try { index = floatStore.size(); } catch {}
|
|
3264
|
+
const offset = (index % 8) * 28;
|
|
3265
|
+
const x = work.left + Math.round((work.width - w) / 2) + offset;
|
|
3266
|
+
const y = work.top + Math.round(Math.max(0, (work.height - h) * 0.16)) + Math.round(offset * 0.5);
|
|
3267
|
+
return clampFloatRect({ x, y, w, h }, work);
|
|
3268
|
+
}
|
|
3269
|
+
|
|
3270
|
+
/** Enter floating-window mode. A split pane (or a parked pending pick) is
|
|
3271
|
+
detached first so the same conversation is never hosted twice. */
|
|
3272
|
+
function floatSession(sessionId) {
|
|
3273
|
+
if (!isValidSessionId(sessionId)) return false;
|
|
3274
|
+
prepareExplicitSplit();
|
|
3275
|
+
if (floatStore.has(sessionId)) {
|
|
3276
|
+
floatStore.focus(sessionId);
|
|
3277
|
+
return false;
|
|
3278
|
+
}
|
|
3279
|
+
pendingSplitStore.remove(sessionId);
|
|
3280
|
+
try {
|
|
3281
|
+
if (treeStore.leafIds().indexOf(sessionId) !== -1) treeStore.closeLeaf(sessionId);
|
|
3282
|
+
} catch {}
|
|
3283
|
+
try {
|
|
3284
|
+
const remaining = treeStore.leafIds();
|
|
3285
|
+
if (remaining.length > 0 && remaining.length < 2) treeStore.reset();
|
|
3286
|
+
} catch {}
|
|
3287
|
+
floatStore.add(sessionId, defaultFloatRect());
|
|
3288
|
+
showPaneToast(t("floatEntered"), true);
|
|
3289
|
+
return true;
|
|
3290
|
+
}
|
|
3291
|
+
|
|
3292
|
+
/** Close a float without putting it back into the split. */
|
|
3293
|
+
function closeFloatWindow(sessionId, options) {
|
|
3294
|
+
if (!floatStore.has(sessionId)) return false;
|
|
3295
|
+
floatStore.remove(sessionId);
|
|
3296
|
+
if (options === undefined || options.silent !== true) showPaneToast(t("floatClosed"), true);
|
|
3297
|
+
return true;
|
|
3298
|
+
}
|
|
3299
|
+
|
|
3300
|
+
/** Switch one float back to split mode: append it to a live split, or
|
|
3301
|
+
rebuild/start from the pending pick when no split is running yet. */
|
|
3302
|
+
function dockFloatToSplit(sessionId) {
|
|
3303
|
+
if (!isValidSessionId(sessionId)) return false;
|
|
3304
|
+
if (!floatStore.has(sessionId)) return false;
|
|
3305
|
+
floatStore.remove(sessionId);
|
|
3306
|
+
const leaves = treeStore.leafIds();
|
|
3307
|
+
if (leaves.indexOf(sessionId) !== -1) {
|
|
3308
|
+
try { treeStore.setFocus(sessionId); } catch {}
|
|
3309
|
+
return true;
|
|
3310
|
+
}
|
|
3311
|
+
if (leaves.length > 0) {
|
|
3312
|
+
prepareExplicitSplit();
|
|
3313
|
+
unminimizeForSplit();
|
|
3314
|
+
try { treeStore.addPane(sessionId); } catch {}
|
|
3315
|
+
showPaneToast(t("floatDocked"), true);
|
|
3316
|
+
return true;
|
|
3317
|
+
}
|
|
3318
|
+
const pending = pendingSplitStore.ids().filter((id) => id !== sessionId);
|
|
3319
|
+
if (pending.length > 0) {
|
|
3320
|
+
pendingSplitStore.clear();
|
|
3321
|
+
buildSplitFromSessions(pending.concat([sessionId]));
|
|
3322
|
+
showPaneToast(t("floatDocked"), true);
|
|
3323
|
+
return true;
|
|
3324
|
+
}
|
|
3325
|
+
pendingSplitStore.add(sessionId);
|
|
3326
|
+
showPaneToast(t("pendingAdded"), true);
|
|
3327
|
+
return true;
|
|
3328
|
+
}
|
|
3329
|
+
|
|
3330
|
+
/** Leave every in-app surface (split pane, pending pick, float) because the
|
|
3331
|
+
conversation now lives in a separate system window. The split ends
|
|
3332
|
+
through closeLeaf's own too-small rule when only one pane would remain. */
|
|
3333
|
+
function detachSessionForSystemWindow(sessionId) {
|
|
3334
|
+
try { if (floatStore.has(sessionId)) floatStore.remove(sessionId); } catch {}
|
|
3335
|
+
pendingSplitStore.remove(sessionId);
|
|
3336
|
+
try {
|
|
3337
|
+
const leaves = treeStore.leafIds();
|
|
3338
|
+
if (leaves.indexOf(sessionId) !== -1) treeStore.closeLeaf(sessionId);
|
|
3339
|
+
else if (leaves.length > 0 && leaves.length < 2) treeStore.reset();
|
|
3340
|
+
} catch {}
|
|
3341
|
+
}
|
|
3342
|
+
|
|
3343
|
+
/** Ask the Host for the authenticated standalone URL and open it as a real
|
|
3344
|
+
separate window. In Desktop the app's window-open handler forwards
|
|
3345
|
+
http/https to the system browser (the only OS window a renderer plugin
|
|
3346
|
+
can create here); in Web mode `window.open` opens a browser window.
|
|
3347
|
+
A blank window is pre-opened in Web mode so the async Host round-trip
|
|
3348
|
+
cannot lose the user-gesture popup permission. */
|
|
3349
|
+
function openSystemWindow(sessionId) {
|
|
3350
|
+
if (!isValidSessionId(sessionId)) return Promise.resolve(false);
|
|
3351
|
+
let preopened = null;
|
|
3352
|
+
if (typeof window.dshDesktop === "undefined") {
|
|
3353
|
+
try { preopened = window.open("", "_blank"); } catch { preopened = null; }
|
|
3354
|
+
}
|
|
3355
|
+
const fail = () => {
|
|
3356
|
+
try { if (preopened !== null && preopened.closed !== true) preopened.close(); } catch {}
|
|
3357
|
+
showPaneToast(t("systemWindowFailed"), true);
|
|
3358
|
+
return false;
|
|
3359
|
+
};
|
|
3360
|
+
return fetch("/dsv/system-window", {
|
|
3361
|
+
method: "POST",
|
|
3362
|
+
headers: { "content-type": "application/json" },
|
|
3363
|
+
body: JSON.stringify({ sessionId }),
|
|
3364
|
+
}).then((response) => (response.ok ? response.json().catch(() => null) : null)).then((payload) => {
|
|
3365
|
+
if (payload === null || payload === undefined || payload.ok !== true
|
|
3366
|
+
|| typeof payload.url !== "string" || payload.url === "") return fail();
|
|
3367
|
+
try {
|
|
3368
|
+
detachSessionForSystemWindow(sessionId);
|
|
3369
|
+
if (preopened !== null && preopened.closed !== true) {
|
|
3370
|
+
try { preopened.opener = null; } catch {}
|
|
3371
|
+
preopened.location.href = payload.url;
|
|
3372
|
+
} else {
|
|
3373
|
+
window.open(payload.url, "_blank", "noopener,noreferrer");
|
|
3374
|
+
}
|
|
3375
|
+
showPaneToast(t("systemWindowOpened"), true);
|
|
3376
|
+
return true;
|
|
3377
|
+
} catch {
|
|
3378
|
+
return fail();
|
|
3379
|
+
}
|
|
3380
|
+
}).catch(() => fail());
|
|
3381
|
+
}
|
|
3382
|
+
|
|
3383
|
+
let floatLayerMounted = false;
|
|
3384
|
+
|
|
3385
|
+
// One gesture at a time (move or resize); the element that captured the
|
|
3386
|
+
// pointer owns it until pointerup/cancel.
|
|
3387
|
+
let floatGesture = null;
|
|
3388
|
+
function beginFloatGesture(sessionId, mode, event) {
|
|
3389
|
+
if (event === null || event === undefined || event.button !== 0) return;
|
|
3390
|
+
const state = floatStore.getSnapshot();
|
|
3391
|
+
const win = state.windows.find((entry) => entry.id === sessionId);
|
|
3392
|
+
if (win === undefined) return;
|
|
3393
|
+
const target = event.target;
|
|
3394
|
+
if (mode === "move" && target !== null && target !== undefined && typeof target.closest === "function"
|
|
3395
|
+
&& target.closest("button,input,.dsv-pane-title-text") !== null) return;
|
|
3396
|
+
event.preventDefault();
|
|
3397
|
+
floatGesture = {
|
|
3398
|
+
id: sessionId,
|
|
3399
|
+
mode,
|
|
3400
|
+
pointerId: event.pointerId,
|
|
3401
|
+
sx: event.clientX,
|
|
3402
|
+
sy: event.clientY,
|
|
3403
|
+
start: { x: win.x, y: win.y, w: win.w, h: win.h },
|
|
3404
|
+
work: chipWorkRect(),
|
|
3405
|
+
};
|
|
3406
|
+
floatStore.focus(sessionId);
|
|
3407
|
+
try { event.currentTarget.setPointerCapture(event.pointerId); } catch {}
|
|
3408
|
+
}
|
|
3409
|
+
function moveFloatGesture(event) {
|
|
3410
|
+
const gesture = floatGesture;
|
|
3411
|
+
if (gesture === null || gesture.pointerId !== event.pointerId) return;
|
|
3412
|
+
const dx = event.clientX - gesture.sx;
|
|
3413
|
+
const dy = event.clientY - gesture.sy;
|
|
3414
|
+
let next;
|
|
3415
|
+
if (gesture.mode === "move") {
|
|
3416
|
+
next = { x: gesture.start.x + dx, y: gesture.start.y + dy, w: gesture.start.w, h: gesture.start.h };
|
|
3417
|
+
} else {
|
|
3418
|
+
let left = gesture.start.x;
|
|
3419
|
+
let top = gesture.start.y;
|
|
3420
|
+
let right = gesture.start.x + gesture.start.w;
|
|
3421
|
+
let bottom = gesture.start.y + gesture.start.h;
|
|
3422
|
+
if (gesture.mode.indexOf("e") !== -1) right = Math.max(left + FLOAT_MIN_W, gesture.start.x + gesture.start.w + dx);
|
|
3423
|
+
if (gesture.mode.indexOf("w") !== -1) left = Math.min(right - FLOAT_MIN_W, gesture.start.x + dx);
|
|
3424
|
+
if (gesture.mode.indexOf("s") !== -1) bottom = Math.max(top + FLOAT_MIN_H, gesture.start.y + gesture.start.h + dy);
|
|
3425
|
+
if (gesture.mode.indexOf("n") !== -1) top = Math.min(bottom - FLOAT_MIN_H, gesture.start.y + dy);
|
|
3426
|
+
next = { x: left, y: top, w: right - left, h: bottom - top };
|
|
3427
|
+
}
|
|
3428
|
+
floatStore.setRect(gesture.id, clampFloatRect(next, gesture.work), false);
|
|
3429
|
+
}
|
|
3430
|
+
function endFloatGesture(event) {
|
|
3431
|
+
const gesture = floatGesture;
|
|
3432
|
+
if (gesture === null || (event !== undefined && event.pointerId !== gesture.pointerId)) return;
|
|
3433
|
+
floatGesture = null;
|
|
3434
|
+
try { event.currentTarget.releasePointerCapture(event.pointerId); } catch {}
|
|
3435
|
+
floatStore.persistNow();
|
|
3436
|
+
}
|
|
3437
|
+
|
|
2798
3438
|
let dragPayload = null; // { kind: 'session' | 'pane', id }
|
|
2799
3439
|
|
|
2800
3440
|
// ---------------------------------------------------------------------
|
|
@@ -4142,6 +4782,10 @@ window.__ModuleLoader__.load({
|
|
|
4142
4782
|
full-sidebar scan. Emits a fresh snapshot object on real changes so
|
|
4143
4783
|
React's identity check re-renders consumers. */
|
|
4144
4784
|
const DOM_LIST_MIN_READ_MS = 200;
|
|
4785
|
+
/** Sidebar scraping cadence; perf mode reads at most once a second. */
|
|
4786
|
+
function domListMinReadMs() {
|
|
4787
|
+
return performanceModeOn() ? 1000 : DOM_LIST_MIN_READ_MS;
|
|
4788
|
+
}
|
|
4145
4789
|
|
|
4146
4790
|
function createDomSessionListSource() {
|
|
4147
4791
|
let snapshot = readSidebarSessions();
|
|
@@ -4168,14 +4812,15 @@ window.__ModuleLoader__.load({
|
|
|
4168
4812
|
}
|
|
4169
4813
|
};
|
|
4170
4814
|
const maybePublish = () => {
|
|
4815
|
+
const minRead = domListMinReadMs();
|
|
4171
4816
|
const since = Date.now() - lastReadAt;
|
|
4172
|
-
if (since <
|
|
4817
|
+
if (since < minRead) {
|
|
4173
4818
|
if (!timerPending) {
|
|
4174
4819
|
timerPending = true;
|
|
4175
4820
|
window.setTimeout(() => {
|
|
4176
4821
|
timerPending = false;
|
|
4177
4822
|
if (active && listeners.size > 0) publish();
|
|
4178
|
-
},
|
|
4823
|
+
}, minRead - since);
|
|
4179
4824
|
}
|
|
4180
4825
|
return;
|
|
4181
4826
|
}
|
|
@@ -7333,6 +7978,7 @@ window.__ModuleLoader__.load({
|
|
|
7333
7978
|
writes would otherwise retrigger the subtree MutationObserver into
|
|
7334
7979
|
an rAF-loop. */
|
|
7335
7980
|
function useComposerAlignedRow(rowRef, leftBuffer, rightInset) {
|
|
7981
|
+
const performanceMode = useRuntime().performance === true;
|
|
7336
7982
|
React.useLayoutEffect(() => {
|
|
7337
7983
|
const row = rowRef.current;
|
|
7338
7984
|
if (row === null) return;
|
|
@@ -7388,17 +8034,19 @@ window.__ModuleLoader__.load({
|
|
|
7388
8034
|
const observer = new ResizeObserver(schedule);
|
|
7389
8035
|
observer.observe(pane);
|
|
7390
8036
|
let mutation = null;
|
|
7391
|
-
if (typeof MutationObserver === "function") {
|
|
8037
|
+
if (!performanceMode && typeof MutationObserver === "function") {
|
|
7392
8038
|
mutation = new MutationObserver(schedule);
|
|
7393
8039
|
mutation.observe(pane, { childList: true, subtree: true, attributes: true, attributeFilter: ["data-composer-card", "data-dsv-composer-card"] });
|
|
7394
8040
|
}
|
|
8041
|
+
const perfTimer = performanceMode ? window.setInterval(schedule, 1500) : 0;
|
|
7395
8042
|
raf = requestAnimationFrame(tick);
|
|
7396
8043
|
return () => {
|
|
7397
8044
|
if (raf !== 0) cancelAnimationFrame(raf);
|
|
7398
8045
|
observer.disconnect();
|
|
7399
8046
|
if (mutation !== null) mutation.disconnect();
|
|
8047
|
+
if (perfTimer !== 0) window.clearInterval(perfTimer);
|
|
7400
8048
|
};
|
|
7401
|
-
}, [leftBuffer, rightInset]);
|
|
8049
|
+
}, [leftBuffer, rightInset, performanceMode]);
|
|
7402
8050
|
}
|
|
7403
8051
|
|
|
7404
8052
|
function DsvInputDock({ children }) {
|
|
@@ -8469,14 +9117,16 @@ window.__ModuleLoader__.load({
|
|
|
8469
9117
|
return zone.side === "before" ? { top: 4, left: 4, right: 4, height: "50%" } : { bottom: 4, left: 4, right: 4, height: "50%" };
|
|
8470
9118
|
}
|
|
8471
9119
|
|
|
8472
|
-
function PaneFrame({ sessionId, session, summary, focused, chrome, onFocus, onClose, pickerFor }) {
|
|
9120
|
+
function PaneFrame({ sessionId, session, summary, focused, chrome, onFocus, onClose, pickerFor, floating, standalone }) {
|
|
8473
9121
|
const runtime = useRuntime();
|
|
9122
|
+
const performanceMode = runtime.performance === true;
|
|
8474
9123
|
const maximized = runtime.maximized === sessionId;
|
|
8475
9124
|
const [renaming, setRenaming] = React.useState(false);
|
|
8476
9125
|
const [renameDraft, setRenameDraft] = React.useState("");
|
|
8477
9126
|
const [zone, setZone] = React.useState(null);
|
|
8478
9127
|
const [invalidDrop, setInvalidDrop] = React.useState(false);
|
|
8479
9128
|
const frameRef = React.useRef(null);
|
|
9129
|
+
const headerRef = React.useRef(null);
|
|
8480
9130
|
const running = summary ? summary.running === true : false;
|
|
8481
9131
|
const title = summary ? summary.displayTitle || summary.title || sessionId : sessionId;
|
|
8482
9132
|
const cwd = summary ? basenameOf(summary.cwd) : "";
|
|
@@ -8678,15 +9328,20 @@ window.__ModuleLoader__.load({
|
|
|
8678
9328
|
};
|
|
8679
9329
|
const observer = new ResizeObserver(schedule);
|
|
8680
9330
|
observer.observe(frame);
|
|
8681
|
-
|
|
9331
|
+
// Perf mode: the pane subtree mutates on EVERY streaming token, and a
|
|
9332
|
+
// subtree MutationObserver here used to re-measure geometry (forced
|
|
9333
|
+
// layout) for each one. Keep resize-driven measuring + a slow poll.
|
|
9334
|
+
const mutation = !performanceMode && typeof MutationObserver === "function" ? new MutationObserver(schedule) : null;
|
|
8682
9335
|
if (mutation !== null) mutation.observe(frame, { childList: true, subtree: true });
|
|
9336
|
+
const perfTimer = performanceMode ? window.setInterval(schedule, 1500) : 0;
|
|
8683
9337
|
schedule();
|
|
8684
9338
|
return () => {
|
|
8685
9339
|
if (raf !== 0) cancelAnimationFrame(raf);
|
|
8686
9340
|
observer.disconnect();
|
|
8687
9341
|
if (mutation !== null) mutation.disconnect();
|
|
9342
|
+
if (perfTimer !== 0) window.clearInterval(perfTimer);
|
|
8688
9343
|
};
|
|
8689
|
-
}, [paneSize.w, composerMode]);
|
|
9344
|
+
}, [paneSize.w, composerMode, performanceMode]);
|
|
8690
9345
|
// a composer is never narrower than this — narrower "boxes" are
|
|
8691
9346
|
// transient seats, not the real input; fall back to stock geometry
|
|
8692
9347
|
const cardBoxSane = cardBox !== null && cardBox.right - cardBox.left >= 160;
|
|
@@ -8881,14 +9536,35 @@ window.__ModuleLoader__.load({
|
|
|
8881
9536
|
onClick(event);
|
|
8882
9537
|
},
|
|
8883
9538
|
}, glyph);
|
|
8884
|
-
const
|
|
8885
|
-
|
|
8886
|
-
|
|
8887
|
-
|
|
8888
|
-
|
|
8889
|
-
|
|
8890
|
-
|
|
8891
|
-
|
|
9539
|
+
const doFullscreen = () => {
|
|
9540
|
+
try {
|
|
9541
|
+
if (document.fullscreenElement !== null && document.fullscreenElement !== undefined) {
|
|
9542
|
+
if (typeof document.exitFullscreen === "function") document.exitFullscreen();
|
|
9543
|
+
} else if (typeof document.documentElement.requestFullscreen === "function") {
|
|
9544
|
+
document.documentElement.requestFullscreen();
|
|
9545
|
+
}
|
|
9546
|
+
} catch {}
|
|
9547
|
+
};
|
|
9548
|
+
const actionButtons = standalone === true
|
|
9549
|
+
? [
|
|
9550
|
+
actionButton("copy", t("copy"), "⧉", doCopy),
|
|
9551
|
+
actionButton("help", t("helpOpen"), "?", doHelp),
|
|
9552
|
+
actionButton("fullscreen", t("standaloneFullscreen"), "⛶", doFullscreen),
|
|
9553
|
+
]
|
|
9554
|
+
: floating === true
|
|
9555
|
+
? [
|
|
9556
|
+
actionButton("dock", t("floatDock"), "⇲", () => { dockFloatToSplit(sessionId); }),
|
|
9557
|
+
actionButton("help", t("helpOpen"), "?", doHelp),
|
|
9558
|
+
actionButton("close", t("floatClose"), h(CloseIcon, { size: 14 }), () => { closeFloatWindow(sessionId); }),
|
|
9559
|
+
]
|
|
9560
|
+
: [
|
|
9561
|
+
actionButton("maximize", maximized ? t("restore") : t("maximize"), maximized ? "⤡" : "⤢", doMaximize),
|
|
9562
|
+
actionButton("copy", t("copy"), "⧉", doCopy),
|
|
9563
|
+
actionButton("help", t("helpOpen"), "?", doHelp),
|
|
9564
|
+
actionButton("splitRight", t("splitRight"), h(SplitIconV, { size: 15 }), (event) => doSplit("h", event.currentTarget)),
|
|
9565
|
+
actionButton("splitDown", t("splitDown"), h(SplitIconH, { size: 15 }), (event) => doSplit("v", event.currentTarget)),
|
|
9566
|
+
actionButton("close", t("closePane"), h(CloseIcon, { size: 14 }), doClose),
|
|
9567
|
+
];
|
|
8892
9568
|
const menuItem = (key, label, onClick, danger) => h("button", {
|
|
8893
9569
|
key,
|
|
8894
9570
|
type: "button",
|
|
@@ -8900,6 +9576,7 @@ window.__ModuleLoader__.load({
|
|
|
8900
9576
|
}, label);
|
|
8901
9577
|
|
|
8902
9578
|
const startHeaderDrag = (event) => {
|
|
9579
|
+
if (floating === true) { beginFloatGesture(sessionId, "move", event); return; }
|
|
8903
9580
|
const target = event.target;
|
|
8904
9581
|
if (target !== null && target !== undefined && typeof target.closest === "function"
|
|
8905
9582
|
&& target.closest("button,input") !== null) {
|
|
@@ -8925,6 +9602,7 @@ window.__ModuleLoader__.load({
|
|
|
8925
9602
|
setInvalidDrop(false);
|
|
8926
9603
|
endDragPreview();
|
|
8927
9604
|
finishPaneReflowGesture();
|
|
9605
|
+
if (headerRef.current !== null) headerRef.current.draggable = false;
|
|
8928
9606
|
};
|
|
8929
9607
|
// A drop outside this pane (or a cancelled drag) never reaches the pane's
|
|
8930
9608
|
// own onDrop, so clear the refusal wash from the document lifecycle too.
|
|
@@ -9040,13 +9718,36 @@ window.__ModuleLoader__.load({
|
|
|
9040
9718
|
chrome !== false ? h(
|
|
9041
9719
|
"div",
|
|
9042
9720
|
{
|
|
9043
|
-
|
|
9044
|
-
|
|
9721
|
+
ref: headerRef,
|
|
9722
|
+
className: "dsv-pane-header", draggable: false,
|
|
9723
|
+
onMouseDown: floating === true || standalone === true ? undefined : (event) => {
|
|
9724
|
+
const header = headerRef.current;
|
|
9725
|
+
if (header === null) return;
|
|
9045
9726
|
const target = event.target;
|
|
9046
|
-
|
|
9047
|
-
|
|
9048
|
-
|
|
9727
|
+
const interactive = target !== null && target !== undefined && typeof target.closest === "function"
|
|
9728
|
+
&& target.closest("button,input,.dsv-pane-title-text") !== null;
|
|
9729
|
+
header.draggable = !interactive;
|
|
9049
9730
|
},
|
|
9731
|
+
onDragStart: floating === true || standalone === true ? undefined : startHeaderDrag,
|
|
9732
|
+
onDragEnd: floating === true || standalone === true ? undefined : endHeaderDrag,
|
|
9733
|
+
onPointerDown: floating === true ? startHeaderDrag : undefined,
|
|
9734
|
+
onPointerMove: floating === true ? moveFloatGesture : undefined,
|
|
9735
|
+
onPointerUp: floating === true ? endFloatGesture : undefined,
|
|
9736
|
+
onPointerCancel: floating === true ? endFloatGesture : undefined,
|
|
9737
|
+
title: floating === true ? t("floatHint") : title,
|
|
9738
|
+
onDoubleClick: floating === true ? undefined : standalone === true
|
|
9739
|
+
? (event) => {
|
|
9740
|
+
const target = event.target;
|
|
9741
|
+
if (target !== null && target !== undefined && typeof target.closest === "function"
|
|
9742
|
+
&& target.closest("button,input,.dsv-pane-title-text") !== null) return;
|
|
9743
|
+
doFullscreen();
|
|
9744
|
+
}
|
|
9745
|
+
: (event) => {
|
|
9746
|
+
const target = event.target;
|
|
9747
|
+
if (target !== null && target !== undefined && typeof target.closest === "function"
|
|
9748
|
+
&& target.closest("button,input,.dsv-pane-title-text") !== null) return;
|
|
9749
|
+
setRuntime({ maximized: maximized ? null : sessionId });
|
|
9750
|
+
},
|
|
9050
9751
|
},
|
|
9051
9752
|
// Reserved even when idle: the dot used to appear/disappear and
|
|
9052
9753
|
// shifted the title's left edge by 15px between panes.
|
|
@@ -9122,12 +9823,22 @@ window.__ModuleLoader__.load({
|
|
|
9122
9823
|
className: "dsv-pane-menu",
|
|
9123
9824
|
onPointerDown: (event) => event.stopPropagation(),
|
|
9124
9825
|
},
|
|
9125
|
-
|
|
9126
|
-
|
|
9127
|
-
|
|
9128
|
-
|
|
9129
|
-
|
|
9130
|
-
|
|
9826
|
+
...(standalone === true ? [
|
|
9827
|
+
menuItem("copy", t("copy"), () => { setMenuOpen(false); doCopy(); }),
|
|
9828
|
+
menuItem("help", t("helpOpen"), () => { setMenuOpen(false); doHelp(); }),
|
|
9829
|
+
menuItem("fullscreen", t("standaloneFullscreen"), () => { setMenuOpen(false); doFullscreen(); }),
|
|
9830
|
+
] : floating === true ? [
|
|
9831
|
+
menuItem("dock", t("floatDock"), () => { setMenuOpen(false); dockFloatToSplit(sessionId); }),
|
|
9832
|
+
menuItem("help", t("helpOpen"), () => { setMenuOpen(false); doHelp(); }),
|
|
9833
|
+
menuItem("close", t("floatClose"), () => { setMenuOpen(false); closeFloatWindow(sessionId); }, true),
|
|
9834
|
+
] : [
|
|
9835
|
+
menuItem("maximize", maximized ? t("restore") : t("maximize"), () => { setMenuOpen(false); doMaximize(); }),
|
|
9836
|
+
menuItem("copy", t("copy"), () => { setMenuOpen(false); doCopy(); }),
|
|
9837
|
+
menuItem("help", t("helpOpen"), () => { setMenuOpen(false); doHelp(); }),
|
|
9838
|
+
menuItem("splitRight", t("splitRight"), (event) => { doSplit("h", event.currentTarget); setMenuOpen(false); }),
|
|
9839
|
+
menuItem("splitDown", t("splitDown"), (event) => { doSplit("v", event.currentTarget); setMenuOpen(false); }),
|
|
9840
|
+
menuItem("close", t("closePane"), () => { setMenuOpen(false); doClose(); }, true),
|
|
9841
|
+
]),
|
|
9131
9842
|
) : null,
|
|
9132
9843
|
zone !== null
|
|
9133
9844
|
? h("div", { className: "dsv-drop-ghost", style: ghostStyle(zone) }, h("span", { className: "dsv-drop-label" }, t(zone.label)))
|
|
@@ -9158,6 +9869,8 @@ window.__ModuleLoader__.load({
|
|
|
9158
9869
|
&& a.session === b.session
|
|
9159
9870
|
&& a.focused === b.focused
|
|
9160
9871
|
&& a.chrome === b.chrome
|
|
9872
|
+
&& a.floating === b.floating
|
|
9873
|
+
&& a.standalone === b.standalone
|
|
9161
9874
|
&& summaryShallowEqual(a.summary, b.summary),
|
|
9162
9875
|
);
|
|
9163
9876
|
|
|
@@ -9172,7 +9885,7 @@ window.__ModuleLoader__.load({
|
|
|
9172
9885
|
return dir === "h" ? { width: basis, height: "100%" } : { height: basis, width: "100%" };
|
|
9173
9886
|
}
|
|
9174
9887
|
|
|
9175
|
-
function RenderLeaf({ id, chrome, generation }) {
|
|
9888
|
+
function RenderLeaf({ id, chrome, generation, floating, standalone }) {
|
|
9176
9889
|
const state = useTree();
|
|
9177
9890
|
const sessions = useSessionsList();
|
|
9178
9891
|
const liveSummary = sessions !== null && sessions !== undefined && sessions.byId !== undefined ? sessions.byId[id] : undefined;
|
|
@@ -9192,14 +9905,16 @@ window.__ModuleLoader__.load({
|
|
|
9192
9905
|
// A lone pane renders without the pane header, so a single
|
|
9193
9906
|
// conversation looks exactly like the stock view.
|
|
9194
9907
|
chrome: chrome !== false,
|
|
9195
|
-
|
|
9196
|
-
|
|
9908
|
+
floating: floating === true,
|
|
9909
|
+
standalone: standalone === true,
|
|
9910
|
+
focused: floating !== true && standalone !== true && state.focus === id,
|
|
9911
|
+
onFocus: floating === true ? (sid) => { floatStore.focus(sid); } : (sid) => treeStore.setFocus(sid),
|
|
9197
9912
|
// Teardown is NOT done here any more: treeStore.commit schedules the
|
|
9198
9913
|
// departed leaf for disposal and ChatPane releases on unmount, so every
|
|
9199
9914
|
// leaf-mutation path (✕, sidebar swap, closeFocused, movePane) is
|
|
9200
9915
|
// covered by the same idempotent path.
|
|
9201
|
-
onClose: (sid) => closePaneAnimated(sid),
|
|
9202
|
-
pickerFor: (...args) => togglePicker(...args),
|
|
9916
|
+
onClose: floating === true ? () => closeFloatWindow(id) : (sid) => closePaneAnimated(sid),
|
|
9917
|
+
pickerFor: floating === true || standalone === true ? () => {} : (...args) => togglePicker(...args),
|
|
9203
9918
|
}));
|
|
9204
9919
|
}
|
|
9205
9920
|
|
|
@@ -9720,7 +10435,11 @@ window.__ModuleLoader__.load({
|
|
|
9720
10435
|
if (ids.length === 0) return null;
|
|
9721
10436
|
const id = resolveFocusedSessionId();
|
|
9722
10437
|
if (id === null || id === undefined) return null;
|
|
9723
|
-
if (ids.length
|
|
10438
|
+
if (ids.length <= 2) {
|
|
10439
|
+
try { treeStore.closeLeaf(id); } catch {}
|
|
10440
|
+
scheduleRightbarHeal(450);
|
|
10441
|
+
return { exit: true, remaining: treeStore.leafIds().length };
|
|
10442
|
+
}
|
|
9724
10443
|
treeStore.closeLeaf(id);
|
|
9725
10444
|
return { exit: false, remaining: treeStore.leafIds().length };
|
|
9726
10445
|
}, null);
|
|
@@ -9770,6 +10489,38 @@ window.__ModuleLoader__.load({
|
|
|
9770
10489
|
removeFromSplit(sessionId) {
|
|
9771
10490
|
return safeCall("removeFromSplit()", () => removeSessionFromSplit(sessionId), false);
|
|
9772
10491
|
},
|
|
10492
|
+
/** Enter floating-window mode for one session (detaches a split pane). */
|
|
10493
|
+
float(sessionId) {
|
|
10494
|
+
return safeCall("float()", () => floatSession(sessionId), false);
|
|
10495
|
+
},
|
|
10496
|
+
/** Dock a floating window back into the split (or the pending pick). */
|
|
10497
|
+
dockFloat(sessionId) {
|
|
10498
|
+
return safeCall("dockFloat()", () => dockFloatToSplit(sessionId), false);
|
|
10499
|
+
},
|
|
10500
|
+
/** Close one floating window without docking it. */
|
|
10501
|
+
closeFloat(sessionId) {
|
|
10502
|
+
return safeCall("closeFloat()", () => closeFloatWindow(sessionId), false);
|
|
10503
|
+
},
|
|
10504
|
+
/** Current floating-window ids, in stable creation order. */
|
|
10505
|
+
floats() {
|
|
10506
|
+
return safeCall("floats()", () => floatStore.ids(), []);
|
|
10507
|
+
},
|
|
10508
|
+
/** Open one conversation in a separate system window (Host-backed URL). */
|
|
10509
|
+
openSystemWindow(sessionId) {
|
|
10510
|
+
return safeCall("openSystemWindow()", () => openSystemWindow(sessionId), false);
|
|
10511
|
+
},
|
|
10512
|
+
/** Toggle performance mode (persisted; reduces animations/observers). */
|
|
10513
|
+
setPerformanceMode(flag) {
|
|
10514
|
+
return safeCall("setPerformanceMode()", () => setPerformanceMode(flag !== false), false);
|
|
10515
|
+
},
|
|
10516
|
+
/** Current performance-mode flag. */
|
|
10517
|
+
performanceMode() {
|
|
10518
|
+
return safeCall("performanceMode()", () => performanceModeOn(), false);
|
|
10519
|
+
},
|
|
10520
|
+
/** Reload the page to pick up an updated client bundle (same as Ctrl+R). */
|
|
10521
|
+
reloadClient() {
|
|
10522
|
+
return safeCall("reloadClient()", () => { try { location.reload(); } catch {} return true; }, false);
|
|
10523
|
+
},
|
|
9773
10524
|
/** Sessions waiting for a second pick before the split starts. */
|
|
9774
10525
|
pending() {
|
|
9775
10526
|
return safeCall("pending()", () => pendingSplitStore.ids(), []);
|
|
@@ -9836,6 +10587,9 @@ window.__ModuleLoader__.load({
|
|
|
9836
10587
|
frameColumns,
|
|
9837
10588
|
selectFrameColumns,
|
|
9838
10589
|
computeColumnBounds,
|
|
10590
|
+
measureColumnBounds,
|
|
10591
|
+
frameChildrenSnapshot,
|
|
10592
|
+
rectSnapshot,
|
|
9839
10593
|
normalizeTree,
|
|
9840
10594
|
isValidSessionId,
|
|
9841
10595
|
noteGeometry,
|
|
@@ -10270,6 +11024,7 @@ window.__ModuleLoader__.load({
|
|
|
10270
11024
|
}
|
|
10271
11025
|
function useRightbarOpen() {
|
|
10272
11026
|
const [open, setOpen] = React.useState(rightbarIsOpen);
|
|
11027
|
+
const performanceMode = useRuntime().performance === true;
|
|
10273
11028
|
React.useEffect(() => {
|
|
10274
11029
|
let column = null;
|
|
10275
11030
|
let observer = null;
|
|
@@ -10292,7 +11047,7 @@ window.__ModuleLoader__.load({
|
|
|
10292
11047
|
// The column can be created/removed by the stock layout; a cheap
|
|
10293
11048
|
// low-frequency re-scan re-attaches the observer and catches toggles
|
|
10294
11049
|
// that did not go through this plugin's button.
|
|
10295
|
-
timer = window.setInterval(sync, 800);
|
|
11050
|
+
timer = window.setInterval(sync, performanceMode ? 3500 : 800);
|
|
10296
11051
|
window.addEventListener("resize", sync);
|
|
10297
11052
|
return () => {
|
|
10298
11053
|
window.clearInterval(timer);
|
|
@@ -10301,7 +11056,7 @@ window.__ModuleLoader__.load({
|
|
|
10301
11056
|
try { observer.disconnect(); } catch {}
|
|
10302
11057
|
}
|
|
10303
11058
|
};
|
|
10304
|
-
}, []);
|
|
11059
|
+
}, [performanceMode]);
|
|
10305
11060
|
return open;
|
|
10306
11061
|
}
|
|
10307
11062
|
/** Two distinct right-sidebar glyphs: a right chevron while the panel is
|
|
@@ -10426,6 +11181,7 @@ window.__ModuleLoader__.load({
|
|
|
10426
11181
|
seatObserver: null,
|
|
10427
11182
|
seatFrame: 0,
|
|
10428
11183
|
timer: 0,
|
|
11184
|
+
lastSyncAt: 0,
|
|
10429
11185
|
};
|
|
10430
11186
|
// Scoped global selectors: prompt-enhancement plugins read the
|
|
10431
11187
|
// transcript with document.querySelector(All) (dsh-prompt-history's
|
|
@@ -10473,6 +11229,13 @@ window.__ModuleLoader__.load({
|
|
|
10473
11229
|
if (typeof MutationObserver === "function") {
|
|
10474
11230
|
state.seatObserver = new MutationObserver(() => {
|
|
10475
11231
|
if (state.seatFrame !== 0) return;
|
|
11232
|
+
// Perf mode: streaming mutates the overlay continuously. Sync at most
|
|
11233
|
+
// twice a second instead of once per animation frame.
|
|
11234
|
+
if (performanceModeOn()) {
|
|
11235
|
+
const now = Date.now();
|
|
11236
|
+
if (now - state.lastSyncAt < 500) return;
|
|
11237
|
+
state.lastSyncAt = now;
|
|
11238
|
+
}
|
|
10476
11239
|
const run = () => { state.seatFrame = 0; sync(); };
|
|
10477
11240
|
state.seatFrame = typeof requestAnimationFrame === "function"
|
|
10478
11241
|
? requestAnimationFrame(run)
|
|
@@ -10663,11 +11426,29 @@ window.__ModuleLoader__.load({
|
|
|
10663
11426
|
return composerAnchorBridge;
|
|
10664
11427
|
}
|
|
10665
11428
|
|
|
11429
|
+
/** Refcounted bridge ownership: the split body and the float layer can
|
|
11430
|
+
both host pane composers, and whichever unmounts last disposes. */
|
|
11431
|
+
let composerAnchorBridgeRefs = 0;
|
|
11432
|
+
function acquireComposerAnchorBridge() {
|
|
11433
|
+
installComposerAnchorBridge();
|
|
11434
|
+
composerAnchorBridgeRefs += 1;
|
|
11435
|
+
let released = false;
|
|
11436
|
+
return () => {
|
|
11437
|
+
if (released) return;
|
|
11438
|
+
released = true;
|
|
11439
|
+
composerAnchorBridgeRefs = Math.max(0, composerAnchorBridgeRefs - 1);
|
|
11440
|
+
if (composerAnchorBridgeRefs === 0 && composerAnchorBridge !== null) {
|
|
11441
|
+
try { composerAnchorBridge.dispose(); } catch {}
|
|
11442
|
+
composerAnchorBridge = null;
|
|
11443
|
+
}
|
|
11444
|
+
};
|
|
11445
|
+
}
|
|
11446
|
+
|
|
10666
11447
|
const WorkspaceBody = React.memo(function WorkspaceBody({ generation }) {
|
|
10667
11448
|
const state = useTree();
|
|
10668
11449
|
React.useLayoutEffect(() => {
|
|
10669
|
-
const
|
|
10670
|
-
return
|
|
11450
|
+
const release = acquireComposerAnchorBridge();
|
|
11451
|
+
return release;
|
|
10671
11452
|
}, []);
|
|
10672
11453
|
// A pane add/close/move mounts new composer cards after this commit.
|
|
10673
11454
|
React.useEffect(() => {
|
|
@@ -10966,12 +11747,80 @@ window.__ModuleLoader__.load({
|
|
|
10966
11747
|
|
|
10967
11748
|
/** The shell.overlay seat component: the workspace (keyed by the retry
|
|
10968
11749
|
epoch, so Retry remounts a crashed/latched boundary) plus the chrome. */
|
|
11750
|
+
/** Update-ready chip: the Host serves the on-disk plugin version, so a
|
|
11751
|
+
running page can notice a freshly installed/updated bundle and reload
|
|
11752
|
+
itself (client-only changes) without a full DSH restart. */
|
|
11753
|
+
function UpdateNotice() {
|
|
11754
|
+
const [ready, setReady] = React.useState(null);
|
|
11755
|
+
React.useEffect(() => {
|
|
11756
|
+
let stopped = false;
|
|
11757
|
+
const check = () => {
|
|
11758
|
+
fetch("/dsv/version", { cache: "no-store" }).then((response) => {
|
|
11759
|
+
if (!response.ok) return null;
|
|
11760
|
+
return response.json().catch(() => null);
|
|
11761
|
+
}).then((payload) => {
|
|
11762
|
+
if (stopped || payload === null || payload === undefined) return;
|
|
11763
|
+
const version = typeof payload.version === "string" ? payload.version : null;
|
|
11764
|
+
if (version === null || version === "" || version === PLUGIN_VERSION) return;
|
|
11765
|
+
if (storageGet(UPDATE_DISMISSED_KEY) === version) return;
|
|
11766
|
+
setReady(version);
|
|
11767
|
+
}).catch(() => {});
|
|
11768
|
+
};
|
|
11769
|
+
const bootTimer = window.setTimeout(check, 4000);
|
|
11770
|
+
const timer = window.setInterval(() => {
|
|
11771
|
+
if (document.visibilityState === "visible") check();
|
|
11772
|
+
}, UPDATE_POLL_MS);
|
|
11773
|
+
return () => {
|
|
11774
|
+
stopped = true;
|
|
11775
|
+
window.clearTimeout(bootTimer);
|
|
11776
|
+
window.clearInterval(timer);
|
|
11777
|
+
};
|
|
11778
|
+
}, []);
|
|
11779
|
+
if (ready === null) return null;
|
|
11780
|
+
const desktop = typeof window !== "undefined" && typeof window.dshDesktop !== "undefined";
|
|
11781
|
+
// DSH Desktop applies profile/plugin changes at startup, so a page reload
|
|
11782
|
+
// cannot pick up a new bundle there; only a restart can. The Web GUI can
|
|
11783
|
+
// apply it with a refresh. Say the right thing instead of offering a
|
|
11784
|
+
// button that silently fails.
|
|
11785
|
+
return h("div", { className: "dsv-update-chip", role: "status" },
|
|
11786
|
+
h("span", null, t(desktop ? "updateRestart" : "updateReady", { v: ready })),
|
|
11787
|
+
desktop ? null : h("button", {
|
|
11788
|
+
type: "button",
|
|
11789
|
+
className: "dsv-update-chip-btn accent",
|
|
11790
|
+
onClick: () => { try { location.reload(); } catch {} },
|
|
11791
|
+
}, t("reloadNow")),
|
|
11792
|
+
h("button", {
|
|
11793
|
+
type: "button",
|
|
11794
|
+
className: "dsv-update-chip-btn",
|
|
11795
|
+
onClick: () => {
|
|
11796
|
+
storageSet(UPDATE_DISMISSED_KEY, ready);
|
|
11797
|
+
setReady(null);
|
|
11798
|
+
},
|
|
11799
|
+
}, t(desktop ? "gotIt" : "laterLabel")),
|
|
11800
|
+
);
|
|
11801
|
+
}
|
|
11802
|
+
|
|
10969
11803
|
function SplitWorkspaceSeat(props) {
|
|
10970
11804
|
const runtime = useRuntime();
|
|
11805
|
+
// A standalone system window renders ONLY its conversation: no split
|
|
11806
|
+
// workspace, no floats, no launcher. WorkspaceApp still mounts (hidden,
|
|
11807
|
+
// inactive) because it publishes the root standard faces the pane host
|
|
11808
|
+
// needs.
|
|
11809
|
+
const standaloneId = standaloneSessionId();
|
|
11810
|
+
if (standaloneId !== null) {
|
|
11811
|
+
try { document.documentElement.setAttribute("data-dsv-standalone", "1"); } catch {}
|
|
11812
|
+
const standaloneProps = Object.assign({}, props, { dsvStandalone: true });
|
|
11813
|
+
return h(React.Fragment, null,
|
|
11814
|
+
h(WorkspaceBoundary, { key: "workspace-" + runtime.epoch }, h(WorkspaceApp, standaloneProps)),
|
|
11815
|
+
h(WorkspaceBoundary, { key: "standalone-" + runtime.epoch }, h(StandaloneSessionWindow, { sessionId: standaloneId })),
|
|
11816
|
+
);
|
|
11817
|
+
}
|
|
10971
11818
|
return h(React.Fragment, null,
|
|
10972
11819
|
h(WorkspaceBoundary, { key: "workspace-" + runtime.epoch }, h(WorkspaceApp, props)),
|
|
10973
11820
|
h(PluginChrome, null),
|
|
11821
|
+
h(WorkspaceBoundary, { key: "floats-" + runtime.epoch }, h(FloatLayer, null)),
|
|
10974
11822
|
h(SplitLauncherLayer, null),
|
|
11823
|
+
h(UpdateNotice, null),
|
|
10975
11824
|
);
|
|
10976
11825
|
}
|
|
10977
11826
|
|
|
@@ -11004,7 +11853,11 @@ window.__ModuleLoader__.load({
|
|
|
11004
11853
|
// The activation gate: >=2 panes AND the kill switch/safe mode allow it.
|
|
11005
11854
|
// Everything below keys off this — observers, DOM scraping, the overlay.
|
|
11006
11855
|
const minimized = runtime.minimized === true;
|
|
11007
|
-
|
|
11856
|
+
// A standalone system window never activates the split overlay: its whole
|
|
11857
|
+
// page is owned by StandaloneSessionWindow.
|
|
11858
|
+
const standaloneWindow = props.dsvStandalone === true;
|
|
11859
|
+
const active = standaloneWindow !== true && leaves.length >= 2
|
|
11860
|
+
&& runtime.enabled === true && runtime.safeMode !== true;
|
|
11008
11861
|
const [picker, setPicker] = React.useState(pickerRequest);
|
|
11009
11862
|
const [bounds, setBounds] = React.useState({ left: 0, right: 0, top: 0, bottom: 0, ok: false });
|
|
11010
11863
|
const geometryWarnedRef = React.useRef(false);
|
|
@@ -11036,7 +11889,7 @@ window.__ModuleLoader__.load({
|
|
|
11036
11889
|
// inside that pane. Portals mount asynchronously, so a body childList
|
|
11037
11890
|
// observer plus a low-frequency re-scan catches new panes.
|
|
11038
11891
|
React.useEffect(() => {
|
|
11039
|
-
if (!operational) {
|
|
11892
|
+
if (!operational || runtime.performance === true) {
|
|
11040
11893
|
tocGripsRestore();
|
|
11041
11894
|
return undefined;
|
|
11042
11895
|
}
|
|
@@ -11072,7 +11925,7 @@ window.__ModuleLoader__.load({
|
|
|
11072
11925
|
document.body.classList.remove("dsv-layout-previewing");
|
|
11073
11926
|
tocGripsRestore();
|
|
11074
11927
|
};
|
|
11075
|
-
}, [operational]);
|
|
11928
|
+
}, [operational, runtime.performance]);
|
|
11076
11929
|
|
|
11077
11930
|
// A plugin/skills/settings panel replaces the whole main view. The split
|
|
11078
11931
|
// overlay would cover it, so step aside automatically and keep the tree;
|
|
@@ -11147,7 +12000,7 @@ window.__ModuleLoader__.load({
|
|
|
11147
12000
|
// (right sidebar open/close, desktop window resize). A single missed
|
|
11148
12001
|
// measurement used to leave the whole workspace invisible until the
|
|
11149
12002
|
// next full reload; this low-frequency backstop re-measures regardless.
|
|
11150
|
-
let fallbackInterval = window.setInterval(schedule, 1000);
|
|
12003
|
+
let fallbackInterval = window.setInterval(schedule, runtime.performance === true ? 3500 : 1000);
|
|
11151
12004
|
let transitionHost = null;
|
|
11152
12005
|
try {
|
|
11153
12006
|
const overlayLayer = document.querySelector("[data-shell-overlay]");
|
|
@@ -11179,7 +12032,7 @@ window.__ModuleLoader__.load({
|
|
|
11179
12032
|
window.removeEventListener("resize", schedule);
|
|
11180
12033
|
document.removeEventListener("visibilitychange", schedule);
|
|
11181
12034
|
};
|
|
11182
|
-
}, [active]);
|
|
12035
|
+
}, [active, runtime.performance]);
|
|
11183
12036
|
|
|
11184
12037
|
// Crash-loop guard timers: a deliberate activation is persisted BEFORE it
|
|
11185
12038
|
// can crash; a healthy, responsive workspace clears the counter after
|
|
@@ -11312,7 +12165,7 @@ window.__ModuleLoader__.load({
|
|
|
11312
12165
|
// stock view) and announce the outcome with a transient toast, so
|
|
11313
12166
|
// "/compact" is never silent.
|
|
11314
12167
|
React.useEffect(() => {
|
|
11315
|
-
if (!operational) return undefined;
|
|
12168
|
+
if (!operational || runtime.performance === true) return undefined;
|
|
11316
12169
|
if (typeof MutationObserver !== "function") return undefined;
|
|
11317
12170
|
const seen = new WeakSet();
|
|
11318
12171
|
const seenText = new Set();
|
|
@@ -11378,7 +12231,7 @@ window.__ModuleLoader__.load({
|
|
|
11378
12231
|
return () => {
|
|
11379
12232
|
try { observer.disconnect(); } catch {}
|
|
11380
12233
|
};
|
|
11381
|
-
}, [operational]);
|
|
12234
|
+
}, [operational, runtime.performance]);
|
|
11382
12235
|
|
|
11383
12236
|
// NOTE: there is deliberately NO "auto-add the current conversation"
|
|
11384
12237
|
// effect any more. The old one flipped the workspace on at boot —
|
|
@@ -11776,6 +12629,15 @@ window.__ModuleLoader__.load({
|
|
|
11776
12629
|
}
|
|
11777
12630
|
function closePaneAnimated(sessionId) {
|
|
11778
12631
|
if (closingPaneSessions.has(sessionId)) return;
|
|
12632
|
+
// Closing one of the last two panes ends the split. The store clears the
|
|
12633
|
+
// whole tree in that case (see endSplitBecauseTooSmall), so the other
|
|
12634
|
+
// conversation immediately loses its "in split" membership.
|
|
12635
|
+
if (treeStore.leafIds().length <= 2) {
|
|
12636
|
+
try { treeStore.closeLeaf(sessionId); } catch {}
|
|
12637
|
+
scheduleRightbarHeal(450);
|
|
12638
|
+
showPaneToast(t("splitExited"), true);
|
|
12639
|
+
return;
|
|
12640
|
+
}
|
|
11779
12641
|
const pane = paneElementForSession(sessionId);
|
|
11780
12642
|
if (pane === null || pane === undefined || prefersReducedMotion()) {
|
|
11781
12643
|
try { treeStore.closeLeaf(sessionId); } catch {}
|
|
@@ -11867,6 +12729,7 @@ window.__ModuleLoader__.load({
|
|
|
11867
12729
|
const ordered = [];
|
|
11868
12730
|
for (const id of Array.isArray(ids) ? ids : []) {
|
|
11869
12731
|
if (!isValidSessionId(id) || ordered.indexOf(id) !== -1) continue;
|
|
12732
|
+
if (floatStore.has(id)) floatStore.remove(id);
|
|
11870
12733
|
ordered.push(id);
|
|
11871
12734
|
}
|
|
11872
12735
|
if (ordered.length < 2) {
|
|
@@ -11886,6 +12749,7 @@ window.__ModuleLoader__.load({
|
|
|
11886
12749
|
split until a second pick exists. Active: append a pane immediately. */
|
|
11887
12750
|
function addSessionToSplit(sessionId) {
|
|
11888
12751
|
if (!isValidSessionId(sessionId)) return false;
|
|
12752
|
+
if (floatStore.has(sessionId)) floatStore.remove(sessionId);
|
|
11889
12753
|
const leaves = treeStore.leafIds();
|
|
11890
12754
|
if (leaves.indexOf(sessionId) !== -1) {
|
|
11891
12755
|
try { treeStore.setFocus(sessionId); } catch {}
|
|
@@ -11957,6 +12821,7 @@ window.__ModuleLoader__.load({
|
|
|
11957
12821
|
try { composerAnchorBridge.dispose(); } catch {}
|
|
11958
12822
|
composerAnchorBridge = null;
|
|
11959
12823
|
}
|
|
12824
|
+
composerAnchorBridgeRefs = 0;
|
|
11960
12825
|
for (const reference of paneSessionReferences.values()) {
|
|
11961
12826
|
try { if (reference !== null && typeof reference.release === "function") reference.release(); } catch {}
|
|
11962
12827
|
}
|
|
@@ -12004,6 +12869,7 @@ window.__ModuleLoader__.load({
|
|
|
12004
12869
|
const cleared = [];
|
|
12005
12870
|
closeLauncher();
|
|
12006
12871
|
pendingSplitStore.clear();
|
|
12872
|
+
floatStore.clear();
|
|
12007
12873
|
try { window.clearTimeout(minimizeTimer); } catch {}
|
|
12008
12874
|
try { window.clearTimeout(exitTimer); } catch {}
|
|
12009
12875
|
minimizeTimer = 0;
|
|
@@ -12048,13 +12914,17 @@ window.__ModuleLoader__.load({
|
|
|
12048
12914
|
}
|
|
12049
12915
|
|
|
12050
12916
|
const SPLIT_STORAGE_PREFIX = "dsh.split-workspace.";
|
|
12917
|
+
// User preferences survive "reset split": a hard reset is about the split
|
|
12918
|
+
// environment (layout/caches), not about the performance setting or the
|
|
12919
|
+
// update notices.
|
|
12920
|
+
const PRESERVED_STORAGE_KEYS = new Set([PERF_KEY, SEEN_VERSION_KEY, UPDATE_DISMISSED_KEY]);
|
|
12051
12921
|
function clearSplitStorage(storage, cleared) {
|
|
12052
12922
|
if (storage === null || storage === undefined) return;
|
|
12053
12923
|
const keys = [];
|
|
12054
12924
|
try {
|
|
12055
12925
|
for (let index = 0; index < storage.length; index += 1) {
|
|
12056
12926
|
const key = storage.key(index);
|
|
12057
|
-
if (typeof key === "string" && key.indexOf(SPLIT_STORAGE_PREFIX) === 0) keys.push(key);
|
|
12927
|
+
if (typeof key === "string" && key.indexOf(SPLIT_STORAGE_PREFIX) === 0 && !PRESERVED_STORAGE_KEYS.has(key)) keys.push(key);
|
|
12058
12928
|
}
|
|
12059
12929
|
} catch {}
|
|
12060
12930
|
for (const key of keys) {
|
|
@@ -12084,18 +12954,19 @@ window.__ModuleLoader__.load({
|
|
|
12084
12954
|
id: "split-workspace.session",
|
|
12085
12955
|
target: "session",
|
|
12086
12956
|
order: 350,
|
|
12087
|
-
observe: () => [treeStore, pendingSplitStore],
|
|
12957
|
+
observe: () => [treeStore, pendingSplitStore, floatStore],
|
|
12088
12958
|
resolve: (target) => {
|
|
12089
12959
|
const id = target !== null && target !== undefined ? target.sessionId : undefined;
|
|
12090
12960
|
if (!isValidSessionId(id)) return [];
|
|
12091
12961
|
const inSplit = treeStore.leafIds().indexOf(id) !== -1;
|
|
12092
12962
|
const pending = pendingSplitStore.has(id);
|
|
12963
|
+
const floating = floatStore.has(id);
|
|
12093
12964
|
return [
|
|
12094
12965
|
{
|
|
12095
12966
|
id: "add",
|
|
12096
12967
|
label: t("menuAddToSplit"),
|
|
12097
12968
|
disabled: inSplit || pending,
|
|
12098
|
-
run: () => { addSessionToSplit(id); },
|
|
12969
|
+
run: () => { if (floatStore.has(id)) dockFloatToSplit(id); else addSessionToSplit(id); },
|
|
12099
12970
|
},
|
|
12100
12971
|
{
|
|
12101
12972
|
id: "remove",
|
|
@@ -12103,6 +12974,22 @@ window.__ModuleLoader__.load({
|
|
|
12103
12974
|
disabled: !inSplit && !pending,
|
|
12104
12975
|
run: () => { removeSessionFromSplit(id); },
|
|
12105
12976
|
},
|
|
12977
|
+
{
|
|
12978
|
+
id: "float",
|
|
12979
|
+
label: t(floating ? "menuFloatClose" : "menuFloatOpen"),
|
|
12980
|
+
separatorBefore: true,
|
|
12981
|
+
run: () => {
|
|
12982
|
+
if (floatStore.has(id)) closeFloatWindow(id);
|
|
12983
|
+
else floatSession(id);
|
|
12984
|
+
},
|
|
12985
|
+
},
|
|
12986
|
+
{
|
|
12987
|
+
id: "system",
|
|
12988
|
+
label: t("menuSystemWindow"),
|
|
12989
|
+
separatorBefore: true,
|
|
12990
|
+
failureLabel: t("systemWindowFailed"),
|
|
12991
|
+
run: () => openSystemWindow(id),
|
|
12992
|
+
},
|
|
12106
12993
|
];
|
|
12107
12994
|
},
|
|
12108
12995
|
});
|
|
@@ -12207,6 +13094,7 @@ window.__ModuleLoader__.load({
|
|
|
12207
13094
|
if (additionsOnly) {
|
|
12208
13095
|
for (const id of ids) {
|
|
12209
13096
|
if (leavesNow.indexOf(id) === -1) {
|
|
13097
|
+
try { floatStore.remove(id); } catch {}
|
|
12210
13098
|
try { treeStore.addPane(id); } catch {}
|
|
12211
13099
|
}
|
|
12212
13100
|
}
|
|
@@ -12373,6 +13261,9 @@ window.__ModuleLoader__.load({
|
|
|
12373
13261
|
disabled: !active || runtime.minimized === true,
|
|
12374
13262
|
}),
|
|
12375
13263
|
h("div", { key: "separator-bottom", className: "dsv-launcher-separator" }),
|
|
13264
|
+
row("performance", "⚡", t("performanceMode") + (runtime.performance === true ? " ✓" : ""),
|
|
13265
|
+
() => { closeLauncher(); setPerformanceMode(runtime.performance !== true); }),
|
|
13266
|
+
row("reload", "↻", t("refreshInterface"), () => { closeLauncher(); try { location.reload(); } catch {} }),
|
|
12376
13267
|
row("reset", "↺", t("menuResetSplit"), () => { closeLauncher(); resetSplitEnvironment(); }, { danger: true }),
|
|
12377
13268
|
);
|
|
12378
13269
|
}
|
|
@@ -12391,6 +13282,131 @@ window.__ModuleLoader__.load({
|
|
|
12391
13282
|
return null;
|
|
12392
13283
|
}
|
|
12393
13284
|
|
|
13285
|
+
|
|
13286
|
+
/** One floating window: a fixed, movable, resizable frame around the real
|
|
13287
|
+
pane (header + transcript + composer). The pane header is the drag
|
|
13288
|
+
handle; the wrapper draws the window frame and owns the resize edges. */
|
|
13289
|
+
function FloatWindow({ id, x, y, width, height, zIndex, focused }) {
|
|
13290
|
+
const runtime = useRuntime();
|
|
13291
|
+
const style = {
|
|
13292
|
+
left: x + "px", top: y + "px", width: width + "px", height: height + "px",
|
|
13293
|
+
zIndex: zIndex,
|
|
13294
|
+
};
|
|
13295
|
+
return h("div", {
|
|
13296
|
+
className: "dsv-float-window" + (focused ? " focused" : ""),
|
|
13297
|
+
"data-dsv-float": id,
|
|
13298
|
+
style,
|
|
13299
|
+
onPointerDownCapture: () => { try { floatStore.focus(id); } catch {} },
|
|
13300
|
+
},
|
|
13301
|
+
h("div", { className: "dsv-float-body" },
|
|
13302
|
+
h(RenderLeaf, { id, chrome: true, generation: runtime.generation, floating: true })),
|
|
13303
|
+
["n", "s", "e", "w", "ne", "nw", "se", "sw"].map((dir) => h("div", {
|
|
13304
|
+
key: dir,
|
|
13305
|
+
className: "dsv-float-resize dsv-float-resize-" + dir,
|
|
13306
|
+
"data-dsv-float-resize": dir,
|
|
13307
|
+
onPointerDown: (event) => beginFloatGesture(id, dir, event),
|
|
13308
|
+
onPointerMove: moveFloatGesture,
|
|
13309
|
+
onPointerUp: endFloatGesture,
|
|
13310
|
+
onPointerCancel: endFloatGesture,
|
|
13311
|
+
})),
|
|
13312
|
+
);
|
|
13313
|
+
}
|
|
13314
|
+
|
|
13315
|
+
/** Always-mounted floating layer. It renders above the split overlay and
|
|
13316
|
+
is independent of the split activation gate: one conversation can float
|
|
13317
|
+
with zero panes. The composer bridge is acquired only while at least one
|
|
13318
|
+
window exists, so the inactive plugin still observes nothing. */
|
|
13319
|
+
function FloatLayer() {
|
|
13320
|
+
const runtime = useRuntime();
|
|
13321
|
+
const floats = useFloats();
|
|
13322
|
+
const windows = floats.windows;
|
|
13323
|
+
const count = windows.length;
|
|
13324
|
+
React.useEffect(() => {
|
|
13325
|
+
if (runtime.enabled !== true || count === 0) return undefined;
|
|
13326
|
+
floatLayerMounted = true;
|
|
13327
|
+
const release = acquireComposerAnchorBridge();
|
|
13328
|
+
return () => { floatLayerMounted = false; release(); };
|
|
13329
|
+
}, [runtime.enabled, count === 0]);
|
|
13330
|
+
React.useEffect(() => {
|
|
13331
|
+
if (count === 0) return undefined;
|
|
13332
|
+
const clampAll = () => {
|
|
13333
|
+
const work = chipWorkRect();
|
|
13334
|
+
for (const win of floatStore.getSnapshot().windows) {
|
|
13335
|
+
const next = clampFloatRect(win, work);
|
|
13336
|
+
if (next.x !== win.x || next.y !== win.y || next.w !== win.w || next.h !== win.h) {
|
|
13337
|
+
floatStore.setRect(win.id, next, false);
|
|
13338
|
+
}
|
|
13339
|
+
}
|
|
13340
|
+
};
|
|
13341
|
+
clampAll();
|
|
13342
|
+
window.addEventListener("resize", clampAll);
|
|
13343
|
+
// The column can change without a window resize (right-sidebar open/
|
|
13344
|
+
// close, shell layout transitions), so re-clamp on a low-frequency
|
|
13345
|
+
// backstop while floats exist. setRect is a no-op when nothing moved.
|
|
13346
|
+
// Perf mode keeps only the resize path.
|
|
13347
|
+
const timer = performanceModeOn() ? 0 : window.setInterval(clampAll, 1000);
|
|
13348
|
+
return () => {
|
|
13349
|
+
window.removeEventListener("resize", clampAll);
|
|
13350
|
+
if (timer !== 0) {
|
|
13351
|
+
try { window.clearInterval(timer); } catch {}
|
|
13352
|
+
}
|
|
13353
|
+
};
|
|
13354
|
+
}, [count, runtime.performance]);
|
|
13355
|
+
if (runtime.enabled !== true || count === 0) return null;
|
|
13356
|
+
// Stacking is a z-index swap, never a DOM reorder: moving a live editor
|
|
13357
|
+
// subtree (keyed React children) would blur the composer.
|
|
13358
|
+
const ranks = new Map();
|
|
13359
|
+
windows.slice().sort((a, b) => a.z - b.z).forEach((win, index) => ranks.set(win.id, index + 1));
|
|
13360
|
+
return h("div", {
|
|
13361
|
+
className: "dsv-float-layer",
|
|
13362
|
+
"data-dsv-float-layer": "true",
|
|
13363
|
+
"data-plugin": PLUGIN_ID,
|
|
13364
|
+
}, windows.map((win) => h(FloatWindow, {
|
|
13365
|
+
key: win.id,
|
|
13366
|
+
id: win.id,
|
|
13367
|
+
x: win.x,
|
|
13368
|
+
y: win.y,
|
|
13369
|
+
width: win.w,
|
|
13370
|
+
height: win.h,
|
|
13371
|
+
zIndex: ranks.get(win.id) || 1,
|
|
13372
|
+
focused: floats.focused === win.id,
|
|
13373
|
+
})));
|
|
13374
|
+
}
|
|
13375
|
+
|
|
13376
|
+
/** Whole-page view used inside a standalone system window: one native
|
|
13377
|
+
conversation, native window controls, no split / floats / launcher. */
|
|
13378
|
+
function StandaloneSessionWindow({ sessionId }) {
|
|
13379
|
+
const runtime = useRuntime();
|
|
13380
|
+
const sessions = useSessionsList();
|
|
13381
|
+
const summary = sessions !== null && sessions !== undefined && sessions.byId !== undefined
|
|
13382
|
+
? sessions.byId[sessionId]
|
|
13383
|
+
: undefined;
|
|
13384
|
+
const title = summary !== null && summary !== undefined
|
|
13385
|
+
? (summary.displayTitle || summary.title || sessionId)
|
|
13386
|
+
: sessionId;
|
|
13387
|
+
React.useEffect(() => {
|
|
13388
|
+
try { document.title = title + " — DeepSeek Harness"; } catch {}
|
|
13389
|
+
}, [title]);
|
|
13390
|
+
// The DOM session-list source normally observes only while a split is
|
|
13391
|
+
// live. This page is a one-conversation workspace, so keep it warm for
|
|
13392
|
+
// the title and the re-hosted header.
|
|
13393
|
+
React.useEffect(() => {
|
|
13394
|
+
const source = sessionsListSource;
|
|
13395
|
+
if (source === undefined || source === null || typeof source.setActive !== "function") return undefined;
|
|
13396
|
+
try { source.setActive(true); } catch {}
|
|
13397
|
+
try { if (typeof source.refresh === "function") source.refresh(); } catch {}
|
|
13398
|
+
return () => {
|
|
13399
|
+
try { source.setActive(false); } catch {}
|
|
13400
|
+
};
|
|
13401
|
+
}, []);
|
|
13402
|
+
return h("div", {
|
|
13403
|
+
className: "dsv-standalone",
|
|
13404
|
+
"data-dsv-standalone-window": sessionId,
|
|
13405
|
+
},
|
|
13406
|
+
h(RenderLeaf, { id: sessionId, chrome: true, generation: runtime.generation, standalone: true }),
|
|
13407
|
+
);
|
|
13408
|
+
}
|
|
13409
|
+
|
|
12394
13410
|
function restoreSplit() {
|
|
12395
13411
|
try {
|
|
12396
13412
|
const tree = treeStore.getSnapshot();
|
|
@@ -12513,6 +13529,34 @@ window.__ModuleLoader__.load({
|
|
|
12513
13529
|
|
|
12514
13530
|
ctx.effect(() => insertStyle(DSV_CSS), "dsh-split-workspace: stylesheet");
|
|
12515
13531
|
|
|
13532
|
+
// Performance mode is a CSS class on <html>; mirror the persisted flag
|
|
13533
|
+
// on every apply so a reload keeps it.
|
|
13534
|
+
ctx.effect(() => {
|
|
13535
|
+
applyPerformanceClass();
|
|
13536
|
+
return () => {
|
|
13537
|
+
try { document.documentElement.removeAttribute("data-dsv-performance"); } catch {}
|
|
13538
|
+
};
|
|
13539
|
+
}, "dsh-split-workspace: performance class");
|
|
13540
|
+
|
|
13541
|
+
// Acknowledge the freshly loaded bundle. When the stored version is older
|
|
13542
|
+
// than this client, the user just got an update (usually after a reload
|
|
13543
|
+
// or a DSH restart) — say so once. The update-ready chip covers the
|
|
13544
|
+
// opposite direction: a newer version sitting on disk while this page
|
|
13545
|
+
// still runs the old bundle.
|
|
13546
|
+
ctx.effect(() => {
|
|
13547
|
+
try {
|
|
13548
|
+
const seen = storageGet(SEEN_VERSION_KEY);
|
|
13549
|
+
storageSet(SEEN_VERSION_KEY, PLUGIN_VERSION);
|
|
13550
|
+
if (seen !== null && seen !== undefined && seen !== "" && seen !== PLUGIN_VERSION) {
|
|
13551
|
+
const timer = window.setTimeout(() => {
|
|
13552
|
+
try { showPaneToast(t("updatedToast", { v: PLUGIN_VERSION }), true); } catch {}
|
|
13553
|
+
}, 1400);
|
|
13554
|
+
return () => { try { window.clearTimeout(timer); } catch {} };
|
|
13555
|
+
}
|
|
13556
|
+
} catch {}
|
|
13557
|
+
return () => {};
|
|
13558
|
+
}, "dsh-split-workspace: version notice");
|
|
13559
|
+
|
|
12516
13560
|
// Global chords (Alt+T, Alt+Shift+Arrows) ride the plugin's OWN
|
|
12517
13561
|
// lifetime now: the old module-scope listeners stacked on every reload
|
|
12518
13562
|
// and were never removed.
|