dsh-split-workspace 0.8.0 → 0.11.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/lib/client.js CHANGED
@@ -75,7 +75,7 @@ window.__ModuleLoader__.load({
75
75
  // ---------------------------------------------------------------------
76
76
 
77
77
  const PLUGIN_ID = "dsh-split-workspace";
78
- const PLUGIN_VERSION = "0.8.0";
78
+ const PLUGIN_VERSION = "0.11.0";
79
79
  const LOG_PREFIX = "[dsh-split-workspace]";
80
80
  const TREE_KEY = "dsh.split-workspace.tree.v1";
81
81
  const OPEN_KEY = "dsh.split-workspace.open.v2";
@@ -90,22 +90,6 @@ window.__ModuleLoader__.load({
90
90
  const SEEN_VERSION_KEY = "dsh.split-workspace.seen-version.v1";
91
91
  const UPDATE_DISMISSED_KEY = "dsh.split-workspace.update-dismissed.v1";
92
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
- }
109
93
  function readChipPos() {
110
94
  const raw = storageGet(CHIP_KEY);
111
95
  if (!raw) return null;
@@ -128,9 +112,11 @@ window.__ModuleLoader__.load({
128
112
  storageSet(MIN_KEY, value === true ? "1" : "0");
129
113
  }
130
114
  /** Performance mode is a persisted, user-visible preference: it trades
131
- optional observers / animations for responsiveness on slow machines. */
115
+ optional observers / animations for responsiveness on slow machines.
116
+ It is ON by default; only an explicit "0" turns it off, so existing
117
+ users who already chose the fast mode keep a normal experience. */
132
118
  function readPerformanceMode() {
133
- return storageGet(PERF_KEY) === "1";
119
+ return storageGet(PERF_KEY) !== "0";
134
120
  }
135
121
  function writePerformanceMode(value) {
136
122
  storageSet(PERF_KEY, value === true ? "1" : "0");
@@ -330,6 +316,12 @@ window.__ModuleLoader__.load({
330
316
 
331
317
  function beginDragPreview(title, hint, sourceEl, size) {
332
318
  endDragPreview();
319
+ // Performance mode: the floating preview is the expensive part of a
320
+ // drag. It clones (or builds) a whole conversation window and moves it
321
+ // with the pointer on every frame, so the fast mode skips it entirely.
322
+ // Dragging still works: the drop target and the reflow hole stay, only
323
+ // the thumbnail preview disappears.
324
+ if (performanceModeOn()) return;
333
325
  // A pane drag carries a real miniature of the conversation window: clone
334
326
  // the live pane, scale it down, and hold the clone as the floating
335
327
  // preview. Sidebar drags of an already-open session find their pane the
@@ -341,8 +333,7 @@ window.__ModuleLoader__.load({
341
333
  if (pane === null && sourceEl.nodeType === 1 && sourceEl.classList && sourceEl.classList.contains("dsv-pane")) pane = sourceEl;
342
334
  }
343
335
  } catch {}
344
- const simpleOnly = (typeof window !== "undefined" && window.__DSV_SIMPLE_PREVIEW === true)
345
- || performanceModeOn();
336
+ const simpleOnly = typeof window !== "undefined" && window.__DSV_SIMPLE_PREVIEW === true;
346
337
  const realThumb = typeof window !== "undefined" && window.__DSV_REAL_THUMB === true;
347
338
  try {
348
339
  if (simpleOnly !== true && pane !== null && pane !== undefined) {
@@ -567,12 +558,18 @@ window.__ModuleLoader__.load({
567
558
  countSuffix: " panes",
568
559
  queuedBadge: "queued",
569
560
  helpTitle: "Split view — shortcuts and help",
561
+ helpShotsTitle: "Where things are",
562
+ helpShotMenu: "Right-click a conversation → Split plugin",
563
+ helpShotFooter: "Split button menu (bottom-left)",
564
+ helpShotSettings: "Settings → Split workspace",
565
+ helpShotZoom: "Click to enlarge",
570
566
  helpOpen: "Split view help",
571
567
  helpClose: "Close",
572
568
  helpShortcuts: "Shortcuts",
573
569
  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.",
574
570
  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().",
575
571
  helpDiagnostics: "Diagnostics: window.__dshSplitWorkspace.health() — see the README section “Safety, recovery and diagnostics”.",
572
+ 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.",
576
573
  tipTitle: "Split view is on",
577
574
  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).",
578
575
  compactionDone: "Context compacted — the summary is in the conversation.",
@@ -616,18 +613,51 @@ window.__ModuleLoader__.load({
616
613
  floatDocked: "Docked to the split view",
617
614
  floatClosed: "Floating window closed",
618
615
  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",
616
+ helpFloat: "Right-click a conversation → Split plugin → Enter floating window detaches it into a movable window; Dock to split puts it back.",
617
+ helpIndependent: "Right-click a conversation → Split plugin → Enter independent window / Enter system window. The independent window is an app-internal single-conversation window; the system window (macOS) is a real OS window with no left sidebar and the stock right sidebar. Neither opens a browser.",
618
+ menuSystemWindow: "Open in independent window",
619
+ systemWindowOpened: "Opened in an independent window",
620
+ systemWindowFailed: "Could not open the independent window",
621
+ systemWindowOpening: "Opening the system window…",
622
+ systemWindowClosing: "Closing the system window…",
623
+ systemWindowNativeOpened: "Entered the system window",
624
+ systemWindowNativeClosed: "System window closed",
625
+ systemWindowUnsupported: "The native system window needs macOS + DSH Desktop. Use Enter independent window instead.",
626
+ menuGroup: "Split plugin",
627
+ menuIndependentOpen: "Enter independent window",
628
+ menuIndependentClose: "Exit independent window",
629
+ menuNativeOpen: "Enter system window",
630
+ menuNativeClose: "Exit system window",
631
+ independentMinimize: "Minimize",
632
+ independentRestore: "Restore window",
633
+ independentClose: "Close window",
634
+ settingsNav: "Split workspace",
635
+ settingsHeading: "Split workspace",
636
+ settingsDesc: "Unlimited native panes, floating windows and app-internal independent windows. These settings apply to the whole plugin.",
637
+ settingsStatus: "Status",
638
+ settingsVersion: "Version",
639
+ settingsPanes: "Panes",
640
+ settingsPending: "Pending split",
641
+ settingsFloats: "Floating windows",
642
+ settingsPerformance: "Performance mode",
643
+ settingsPerformanceDesc: "Reduces animations and background observers, and skips the drag-preview thumbnail.",
644
+ settingsActions: "Actions",
623
645
  standaloneFullscreen: "Fullscreen",
624
646
  performanceMode: "Performance mode",
625
647
  performanceOn: "Performance mode on — animations and background observers are reduced",
626
648
  performanceOff: "Performance mode off",
627
649
  reloadClient: "Reload interface",
628
650
  refreshInterface: "Refresh interface",
651
+ restartApp: "Restart DSH",
652
+ restartTitle: "Restart DSH?",
653
+ 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.",
654
+ restartNow: "Restart now",
655
+ restarting: "Restarting DSH…",
656
+ restartFailed: "Could not restart DSH automatically — quit DSH and open it again.",
657
+ restartUnsupported: "Automatic restart is available in DSH Desktop. In a browser, reload the page or restart the `dsh web` process.",
658
+ fallbackLauncher: "Split view",
629
659
  updateReady: "Version {v} is installed — reload to apply",
630
- updateRestart: "Version {v} is installed — restart DSH to apply",
660
+ updateRestart: "Version {v} is installed — if the interface did not update, restart DSH",
631
661
  reloadNow: "Reload now",
632
662
  gotIt: "Got it",
633
663
  laterLabel: "Later",
@@ -683,12 +713,18 @@ window.__ModuleLoader__.load({
683
713
  countSuffix: " 个面板",
684
714
  queuedBadge: "条排队",
685
715
  helpTitle: "分屏视图 — 快捷键与帮助",
716
+ helpShotsTitle: "界面指引",
717
+ helpShotMenu: "右键会话 → 分屏插件",
718
+ helpShotFooter: "左下角分屏按钮菜单",
719
+ helpShotSettings: "设置 → 分屏工作区",
720
+ helpShotZoom: "点击查看大图",
686
721
  helpOpen: "分屏帮助",
687
722
  helpClose: "关闭",
688
723
  helpShortcuts: "快捷键",
689
724
  helpGestures: "点击侧边栏底部的分屏按钮打开菜单(添加分屏 / 退出分屏 / 最小化分屏 / 重置分屏),或从左侧会话列表把对话拖到页面即可分屏;右键会话可加入 / 退出分屏,也可以“进入浮窗”把会话变成独立浮窗(浮窗标题栏的“回到分屏”可放回)。拖住面板标题栏可移动面板:原位置收起,虚线空位预览落点。拖动分隔条可调整大小,✕ 关闭面板。",
690
725
  helpDisable: "停用分屏:运行 window.__dshSplitWorkspace.setEnabled(false),或将 localStorage 'dsh.split-workspace.enabled.v1' 设为 \"0\"。重置布局:window.__dshSplitWorkspace.reset()。",
691
726
  helpDiagnostics: "诊断:window.__dshSplitWorkspace.health() — 详见 README“安全性、恢复与诊断”。",
727
+ helpRestart: "如果更新或需要完整重启的更改没有生效,可打开分屏菜单选择“重启 DSH”(桌面版),或退出 DSH 后重新打开。DSH 的 HMR 通常会自动加载已安装的插件;重启入口是兜底方案。",
692
728
  tipTitle: "分屏视图已开启",
693
729
  tipBody: "Alt+T 切换紧凑输入行 · Alt+Shift+←/→/↑/↓ 切换面板 · 从左侧拖入对话可分屏 · ✕ 关闭面板。如需停用,运行 window.__dshSplitWorkspace.setEnabled(false)。",
694
730
  compactionDone: "上下文已压缩 — 摘要已写入对话。",
@@ -732,18 +768,51 @@ window.__ModuleLoader__.load({
732
768
  floatDocked: "已回到分屏",
733
769
  floatClosed: "浮窗已关闭",
734
770
  floatHint: "拖动标题栏移动 · 拖动边缘调整大小",
735
- helpFloat: "右键会话 → 进入浮窗,可把该会话变成独立浮窗;浮窗标题栏的“回到分屏”可放回分屏。",
736
- menuSystemWindow: "在系统窗口打开",
737
- systemWindowOpened: "已在独立系统窗口中打开",
738
- systemWindowFailed: "无法打开系统窗口",
771
+ helpFloat: "右键会话 → 分屏插件 → 进入浮窗,可把该会话变成独立浮窗;浮窗标题栏的“回到分屏”可放回分屏。",
772
+ helpIndependent: "右键会话 → 分屏插件 → 进入独立窗口 / 进入系统窗口。独立窗口在应用内单独显示该会话(关闭 / 最小化 / 最大化 / 全屏);系统窗口(macOS)是真正的操作系统窗口,不显示左侧栏、保留右侧栏。两者都不依赖浏览器。",
773
+ menuSystemWindow: "在独立窗口打开",
774
+ systemWindowOpened: "已在独立窗口中打开",
775
+ systemWindowFailed: "无法打开独立窗口",
776
+ systemWindowOpening: "正在打开系统窗口…",
777
+ systemWindowClosing: "正在关闭系统窗口…",
778
+ systemWindowNativeOpened: "已进入系统窗口",
779
+ systemWindowNativeClosed: "已关闭系统窗口",
780
+ systemWindowUnsupported: "系统窗口仅支持 macOS 桌面版;可改用“进入独立窗口”。",
781
+ menuGroup: "分屏插件",
782
+ menuIndependentOpen: "进入独立窗口",
783
+ menuIndependentClose: "退出独立窗口",
784
+ menuNativeOpen: "进入系统窗口",
785
+ menuNativeClose: "退出系统窗口",
786
+ independentMinimize: "最小化",
787
+ independentRestore: "恢复窗口",
788
+ independentClose: "关闭窗口",
789
+ settingsNav: "分屏工作区",
790
+ settingsHeading: "分屏工作区",
791
+ settingsDesc: "无限原生窗格、浮窗与应用内独立窗口。这里的设置对整个插件生效。",
792
+ settingsStatus: "状态",
793
+ settingsVersion: "版本",
794
+ settingsPanes: "窗格",
795
+ settingsPending: "待分屏",
796
+ settingsFloats: "浮窗",
797
+ settingsPerformance: "性能模式",
798
+ settingsPerformanceDesc: "减少动画与后台观察器,并跳过拖动缩略图预览。",
799
+ settingsActions: "操作",
739
800
  standaloneFullscreen: "全屏",
740
801
  performanceMode: "性能模式",
741
802
  performanceOn: "性能模式已开启:动画与后台观察器已精简",
742
803
  performanceOff: "性能模式已关闭",
743
804
  reloadClient: "重载界面",
744
805
  refreshInterface: "刷新界面",
806
+ restartApp: "重启 DSH",
807
+ restartTitle: "重启 DSH?",
808
+ restartBody: "将关闭并重新打开 DeepSeek Harness,以加载新安装的插件或需要完整重启的更改。正在运行的任务会被中断。",
809
+ restartNow: "立即重启",
810
+ restarting: "正在重启 DSH…",
811
+ restartFailed: "无法自动重启 DSH,请退出 DSH 后重新打开。",
812
+ restartUnsupported: "自动重启仅支持 DSH 桌面版;浏览器中请刷新页面或重启 dsh web 进程。",
813
+ fallbackLauncher: "分屏视图",
745
814
  updateReady: "已安装 v{v},刷新页面生效",
746
- updateRestart: "已安装 v{v},请重启 DSH 后生效",
815
+ updateRestart: "已安装 v{v},若界面未更新请重启 DSH",
747
816
  reloadNow: "刷新页面",
748
817
  gotIt: "知道了",
749
818
  laterLabel: "稍后",
@@ -888,6 +957,67 @@ window.__ModuleLoader__.load({
888
957
  box-shadow: 0 0 0 1.5px var(--dsw-alias-bg-layer-1, var(--dsw-alias-bg-base));
889
958
  }
890
959
 
960
+ /* Fallback launcher: shown only when the stock sidebar footer does not
961
+ render the plugin's action, so the split menu stays reachable from the
962
+ conversation column's bottom-left corner. */
963
+ .dsv-fallback-launcher {
964
+ position: fixed; left: 16px; bottom: 16px; z-index: 130;
965
+ display: inline-flex; align-items: center; gap: 6px;
966
+ height: 30px; padding: 0 10px; border-radius: 9px;
967
+ border: 1px solid var(--dsw-alias-border-l2);
968
+ background: var(--dsw-alias-bg-layer-1, var(--dsw-alias-bg-base));
969
+ color: var(--dsw-alias-label-secondary);
970
+ font-family: var(--dsw-font-family, system-ui, sans-serif); font-size: 12px;
971
+ cursor: pointer; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
972
+ }
973
+ .dsv-fallback-launcher:hover { color: var(--dsw-alias-label-primary); background: var(--dsw-alias-interactive-bg-hover); }
974
+ .dsv-fallback-label { white-space: nowrap; }
975
+ html[data-dsv-performance="1"] .dsv-fallback-launcher { box-shadow: none; }
976
+
977
+ /* ---- settings page (0.10.0): the same controls as the footer menu,
978
+ contributed to the system Settings panel through settings.section. ---- */
979
+ .dsv-settings {
980
+ display: flex; flex-direction: column; gap: 14px;
981
+ padding: 2px 2px 28px;
982
+ color: var(--dsw-alias-label-primary);
983
+ font-family: var(--dsw-font-family, system-ui, sans-serif);
984
+ }
985
+ .dsv-settings-desc { font-size: 12px; line-height: 19px; color: var(--dsw-alias-label-tertiary); }
986
+ .dsv-settings-group {
987
+ display: flex; flex-direction: column;
988
+ border: 1px solid var(--dsw-alias-border-l2); border-radius: 12px;
989
+ background: var(--dsw-alias-bg-layer-1, var(--dsw-alias-bg-base));
990
+ padding: 4px 14px;
991
+ }
992
+ .dsv-settings-group-title {
993
+ margin: 0; padding: 10px 0 6px;
994
+ font-size: 12px; font-weight: 600; line-height: 18px;
995
+ color: var(--dsw-alias-label-secondary);
996
+ }
997
+ .dsv-settings-row {
998
+ display: flex; align-items: center; gap: 12px; min-height: 44px;
999
+ padding: 6px 0; border-top: 1px solid color-mix(in srgb, var(--dsw-alias-border-l2) 62%, transparent);
1000
+ }
1001
+ .dsv-settings-group-title + .dsv-settings-row { border-top: 0; }
1002
+ .dsv-settings-label { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
1003
+ .dsv-settings-row-label { flex: 1; min-width: 0; font-size: 13px; line-height: 20px; }
1004
+ .dsv-settings-value {
1005
+ flex: none; max-width: 52%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
1006
+ font-size: 12px; line-height: 19px; color: var(--dsw-alias-label-tertiary);
1007
+ }
1008
+ .dsv-settings-actions { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 0 12px; }
1009
+ .dsv-settings-btn {
1010
+ height: 30px; padding: 0 12px; border-radius: 8px;
1011
+ border: 1px solid var(--dsw-alias-border-l2); background: transparent;
1012
+ color: var(--dsw-alias-label-primary); font-family: inherit; font-size: 12px;
1013
+ cursor: pointer;
1014
+ }
1015
+ .dsv-settings-btn:hover:not(:disabled) { background: var(--dsw-alias-interactive-bg-hover); }
1016
+ .dsv-settings-btn:disabled { opacity: 0.42; cursor: default; }
1017
+ .dsv-settings-btn.accent { background: var(--dsw-static-deepseek-500); border-color: transparent; color: #fff; }
1018
+ .dsv-settings-btn.accent:hover:not(:disabled) { background: var(--dsw-static-deepseek-500); filter: brightness(1.05); }
1019
+ .dsv-settings-btn.danger { color: #e5484d; }
1020
+
891
1021
  /* ---- 0.5.0 launcher: the sidebar footer menu and the multi-select
892
1022
  "add split" dialog. Both mount through the shell overlay seat, so they
893
1023
  are never clipped by the sidebar column or the split overlay. ---- */
@@ -919,7 +1049,7 @@ window.__ModuleLoader__.load({
919
1049
  @keyframes dsv-launcher-in { from { opacity: 0; transform: translateY(4px); } }
920
1050
 
921
1051
  .dsv-modal-backdrop {
922
- position: fixed; inset: 0; z-index: 150;
1052
+ position: fixed; inset: 0; z-index: 2147483002;
923
1053
  display: flex; align-items: center; justify-content: center;
924
1054
  background: rgba(0, 0, 0, 0.32);
925
1055
  animation: dsv-fade-in 0.12s ease-out;
@@ -1050,10 +1180,9 @@ window.__ModuleLoader__.load({
1050
1180
  @media (prefers-reduced-motion: reduce) {
1051
1181
  .dsv-float-window { animation: none; transition: none; }
1052
1182
  }
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. ---- */
1183
+ /* ---- independent window: one conversation fills the surface, rendered
1184
+ inside the in-app window frame with its own close / minimize /
1185
+ maximize / fullscreen controls. ---- */
1057
1186
  html[data-dsv-standalone] { overflow: hidden; }
1058
1187
  html[data-dsv-standalone] body { overflow: hidden; }
1059
1188
  .dsv-standalone {
@@ -1071,6 +1200,38 @@ window.__ModuleLoader__.load({
1071
1200
  flex: 1; min-width: 0; min-height: 0;
1072
1201
  border: 0; border-radius: 0; box-shadow: none;
1073
1202
  }
1203
+
1204
+ /* ---- independent window (0.10.0): a first-class in-app window for one
1205
+ conversation. DSH exposes no plugin-facing BrowserWindow API, so this
1206
+ replaces the old browser window with an application surface. ---- */
1207
+ .dsv-app-window-layer {
1208
+ position: fixed; inset: 0; z-index: 999;
1209
+ display: flex; align-items: center; justify-content: center;
1210
+ background: color-mix(in srgb, #000 18%, transparent);
1211
+ }
1212
+ .dsv-app-window {
1213
+ position: relative; overflow: hidden;
1214
+ width: min(1120px, calc(100vw - 96px));
1215
+ height: min(780px, calc(100vh - 96px));
1216
+ min-width: 0; min-height: 0;
1217
+ border: 1px solid var(--dsw-alias-border-l2); border-radius: 14px;
1218
+ background: var(--dsw-alias-bg-base);
1219
+ box-shadow: 0 24px 64px rgba(0, 0, 0, 0.28), 0 4px 12px rgba(0, 0, 0, 0.12);
1220
+ }
1221
+ .dsv-app-window.maximized {
1222
+ width: 100vw; height: 100vh; border: 0; border-radius: 0; box-shadow: none;
1223
+ }
1224
+ .dsv-app-window .dsv-standalone-embedded {
1225
+ position: absolute; inset: 0; z-index: auto;
1226
+ }
1227
+ .dsv-app-window-chip { left: 16px; right: auto; bottom: 16px; z-index: 1200; }
1228
+ .dsv-app-window-chip .dsv-chip-text {
1229
+ max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
1230
+ }
1231
+ html[data-dsv-performance="1"] .dsv-app-window { box-shadow: none; }
1232
+ @media (max-width: 900px) {
1233
+ .dsv-app-window { width: 100vw; height: 100vh; border: 0; border-radius: 0; }
1234
+ }
1074
1235
  .dsv-standalone .dsv-pane-header { height: 40px; }
1075
1236
  /* One title per pane: the pane header owns it. The stock header keeps its
1076
1237
  view tabs and action rows but not its breadcrumb; the slim header's own
@@ -1968,7 +2129,7 @@ window.__ModuleLoader__.load({
1968
2129
  .dsv-help-title { font-size: 13px; font-weight: 600; margin-bottom: 6px; display: flex; align-items: center; gap: 8px; }
1969
2130
  /* fixed variant: used by the inactive "could not start" chip path, where
1970
2131
  the plugin overlay (the card's normal containing block) is not rendered */
1971
- .dsv-help-card-fixed { position: fixed; bottom: 56px; z-index: 95; }
2132
+ .dsv-help-card-fixed { position: fixed; bottom: 56px; z-index: 2147482999; }
1972
2133
  .dsv-help-row { display: flex; gap: 10px; padding: 2px 0; }
1973
2134
  .dsv-help-keys {
1974
2135
  flex: none; min-width: 150px; font-family: ui-monospace, SFMono-Regular, Consolas, "Courier New", monospace;
@@ -1976,6 +2137,37 @@ window.__ModuleLoader__.load({
1976
2137
  }
1977
2138
  .dsv-help-body { color: var(--dsw-alias-label-secondary); white-space: pre-wrap; overflow-wrap: anywhere; }
1978
2139
  .dsv-help-actions { display: flex; gap: 8px; margin-top: 10px; }
2140
+ /* help-card screenshots: a wider, scrollable card with three thumbnails;
2141
+ clicking one opens a viewport-level lightbox. No transform on the card,
2142
+ so the fixed lightbox is not trapped in a transformed containing block. */
2143
+ .dsv-help-card {
2144
+ left: 0; right: 0; margin-left: auto; margin-right: auto; transform: none;
2145
+ width: min(680px, calc(100% - 32px));
2146
+ max-height: min(78vh, 760px); overflow: auto; overscroll-behavior: contain;
2147
+ }
2148
+ .dsv-help-section-title { margin-top: 10px; font-size: 12px; font-weight: 600; }
2149
+ .dsv-help-shots { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 6px; }
2150
+ .dsv-help-shot {
2151
+ margin: 0; padding: 0; border: 1px solid var(--dsw-alias-border-l2); border-radius: 10px;
2152
+ overflow: hidden; background: var(--dsw-alias-bg-base); cursor: zoom-in;
2153
+ }
2154
+ .dsv-help-shot:hover { border-color: var(--dsw-static-deepseek-500); }
2155
+ .dsv-help-shot img {
2156
+ display: block; width: 100%; height: 124px; object-fit: contain; object-position: top center;
2157
+ background: var(--dsw-alias-bg-layer-1);
2158
+ }
2159
+ .dsv-help-shot figcaption {
2160
+ font-size: 10px; line-height: 14px; padding: 4px 6px;
2161
+ color: var(--dsw-alias-label-tertiary); text-align: center;
2162
+ }
2163
+ .dsv-help-lightbox {
2164
+ position: fixed; inset: 0; z-index: 2147483000; display: flex; align-items: center; justify-content: center;
2165
+ padding: 24px; background: rgba(0, 0, 0, 0.62); cursor: zoom-out;
2166
+ }
2167
+ .dsv-help-lightbox img {
2168
+ max-width: min(92vw, 1200px); max-height: 86vh; border-radius: 12px;
2169
+ box-shadow: 0 18px 60px rgba(0, 0, 0, 0.35); background: var(--dsw-alias-bg-base); cursor: default;
2170
+ }
1979
2171
  .dsv-pane-error {
1980
2172
  flex: 1; min-height: 0; display: flex; flex-direction: column; align-items: center;
1981
2173
  justify-content: center; gap: 8px; padding: 20px; text-align: center;
@@ -2049,6 +2241,25 @@ window.__ModuleLoader__.load({
2049
2241
  .dsv-update-chip-btn.accent { background: var(--dsw-static-deepseek-500); border-color: transparent; color: #fff; }
2050
2242
  .dsv-update-chip-btn:hover { background: var(--dsw-alias-interactive-bg-hover); }
2051
2243
  html[data-dsv-performance="1"] .dsv-update-chip { box-shadow: none; }
2244
+
2245
+ /* Native system window (0.11.0): the OS window shows one conversation.
2246
+ The left sidebar is removed; the right sidebar and every other column
2247
+ stay exactly as the stock layout renders them. The frame's first grid
2248
+ track is also zeroed by the client boot (React owns that inline style). */
2249
+ html[data-dsv-system-window="1"] [data-slot="sidebar"],
2250
+ html[data-dsv-system-window="1"] [data-side="sidebar"],
2251
+ html[data-dsv-system-window="1"] [data-shell-leading],
2252
+ html[data-dsv-system-window="1"] [data-sidebar-mask] {
2253
+ display: none !important;
2254
+ }
2255
+ html[data-dsv-system-window="1"] .dsv-footer-btn,
2256
+ html[data-dsv-system-window="1"] .dsv-fallback-launcher,
2257
+ html[data-dsv-system-window="1"] .dsv-app-window-layer,
2258
+ html[data-dsv-system-window="1"] .dsv-chip,
2259
+ html[data-dsv-system-window="1"] .dsv-update-chip,
2260
+ html[data-dsv-system-window="1"] .dsv-toast {
2261
+ display: none !important;
2262
+ }
2052
2263
  `;
2053
2264
 
2054
2265
  function insertStyle(css) {
@@ -2199,6 +2410,10 @@ window.__ModuleLoader__.load({
2199
2410
  minimized: readMinimized(),
2200
2411
  performance: readPerformanceMode(),
2201
2412
  updateReady: null,
2413
+ // One conversation in an in-app independent window. DSH Desktop has no
2414
+ // plugin-facing BrowserWindow API, so this replaces the old browser
2415
+ // window with a first-class surface inside the application.
2416
+ appWindow: null,
2202
2417
  };
2203
2418
  const runtimeListeners = new Set();
2204
2419
  function runtimeSnapshot() {
@@ -2224,6 +2439,9 @@ window.__ModuleLoader__.load({
2224
2439
  notifyRuntime();
2225
2440
  return runtimeState;
2226
2441
  }
2442
+ /** The same runtime state as a store object, for context-menu observes. */
2443
+ const runtimeStore = { getSnapshot: runtimeSnapshot, subscribe: runtimeSubscribe };
2444
+
2227
2445
  /** The plugin's own state store as a hook (safe before apply() runs). */
2228
2446
  function useRuntime() {
2229
2447
  return React.useSyncExternalStore(runtimeSubscribe, runtimeSnapshot, runtimeSnapshot);
@@ -2399,6 +2617,7 @@ window.__ModuleLoader__.load({
2399
2617
  panes: (() => { try { return treeStore.leafIds().length; } catch { return 0; } })(),
2400
2618
  floats: (() => { try { return floatStore.ids(); } catch { return []; } })(),
2401
2619
  floatLayerMounted: floatLayerMounted,
2620
+ appWindow: runtimeState.appWindow === null ? null : Object.assign({}, runtimeState.appWindow),
2402
2621
  blockedReason: (() => { try { return blockedReason(); } catch { return "unknown"; } })(),
2403
2622
  failures: runtimeState.failures,
2404
2623
  lastError: runtimeState.lastError,
@@ -3078,6 +3297,9 @@ window.__ModuleLoader__.load({
3078
3297
  function openAddSplitDialog(source) {
3079
3298
  setLauncherState({ mode: "dialog", rect: null, source: source === "footer" ? "footer" : "session" });
3080
3299
  }
3300
+ function openRestartDialog() {
3301
+ setLauncherState({ mode: "restart", rect: null, source: "footer" });
3302
+ }
3081
3303
 
3082
3304
  // ---------------------------------------------------------------------
3083
3305
  // floating windows (0.6.0)
@@ -3271,6 +3493,7 @@ window.__ModuleLoader__.load({
3271
3493
  detached first so the same conversation is never hosted twice. */
3272
3494
  function floatSession(sessionId) {
3273
3495
  if (!isValidSessionId(sessionId)) return false;
3496
+ closeAppWindowFor(sessionId);
3274
3497
  prepareExplicitSplit();
3275
3498
  if (floatStore.has(sessionId)) {
3276
3499
  floatStore.focus(sessionId);
@@ -3340,44 +3563,18 @@ window.__ModuleLoader__.load({
3340
3563
  } catch {}
3341
3564
  }
3342
3565
 
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. */
3566
+ /** Open one conversation in the in-app independent window.
3567
+ DSH Desktop exposes no BrowserWindow API to plugins and denies
3568
+ window.open, so a real OS window is impossible here. The independent
3569
+ window is a first-class surface inside the application (no browser
3570
+ dependency): close / minimize / maximize-restore / fullscreen, and the
3571
+ same native conversation component. */
3349
3572
  function openSystemWindow(sessionId) {
3350
3573
  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());
3574
+ detachSessionForSystemWindow(sessionId);
3575
+ const opened = openAppWindow(sessionId);
3576
+ if (opened === true) showPaneToast(t("systemWindowOpened"), true);
3577
+ return Promise.resolve(opened === true);
3381
3578
  }
3382
3579
 
3383
3580
  let floatLayerMounted = false;
@@ -9117,7 +9314,7 @@ window.__ModuleLoader__.load({
9117
9314
  return zone.side === "before" ? { top: 4, left: 4, right: 4, height: "50%" } : { bottom: 4, left: 4, right: 4, height: "50%" };
9118
9315
  }
9119
9316
 
9120
- function PaneFrame({ sessionId, session, summary, focused, chrome, onFocus, onClose, pickerFor, floating, standalone }) {
9317
+ function PaneFrame({ sessionId, session, summary, focused, chrome, onFocus, onClose, pickerFor, floating, standalone, appWindow, appWindowMaximized }) {
9121
9318
  const runtime = useRuntime();
9122
9319
  const performanceMode = runtime.performance === true;
9123
9320
  const maximized = runtime.maximized === sessionId;
@@ -9545,7 +9742,16 @@ window.__ModuleLoader__.load({
9545
9742
  }
9546
9743
  } catch {}
9547
9744
  };
9548
- const actionButtons = standalone === true
9745
+ const actionButtons = appWindow === true
9746
+ ? [
9747
+ actionButton("copy", t("copy"), "⧉", doCopy),
9748
+ actionButton("help", t("helpOpen"), "?", doHelp),
9749
+ actionButton("fullscreen", t("standaloneFullscreen"), "⛶", doFullscreen),
9750
+ actionButton("minimize", t("independentMinimize"), "—", minimizeAppWindow),
9751
+ actionButton("maximize", appWindowMaximized === true ? t("restore") : t("maximize"), appWindowMaximized === true ? "⤡" : "⤢", toggleMaximizeAppWindow),
9752
+ actionButton("close", t("independentClose"), h(CloseIcon, { size: 14 }), closeAppWindow),
9753
+ ]
9754
+ : standalone === true
9549
9755
  ? [
9550
9756
  actionButton("copy", t("copy"), "⧉", doCopy),
9551
9757
  actionButton("help", t("helpOpen"), "?", doHelp),
@@ -9735,7 +9941,14 @@ window.__ModuleLoader__.load({
9735
9941
  onPointerUp: floating === true ? endFloatGesture : undefined,
9736
9942
  onPointerCancel: floating === true ? endFloatGesture : undefined,
9737
9943
  title: floating === true ? t("floatHint") : title,
9738
- onDoubleClick: floating === true ? undefined : standalone === true
9944
+ onDoubleClick: floating === true ? undefined : appWindow === true
9945
+ ? (event) => {
9946
+ const target = event.target;
9947
+ if (target !== null && target !== undefined && typeof target.closest === "function"
9948
+ && target.closest("button,input,.dsv-pane-title-text") !== null) return;
9949
+ toggleMaximizeAppWindow();
9950
+ }
9951
+ : standalone === true
9739
9952
  ? (event) => {
9740
9953
  const target = event.target;
9741
9954
  if (target !== null && target !== undefined && typeof target.closest === "function"
@@ -9823,7 +10036,14 @@ window.__ModuleLoader__.load({
9823
10036
  className: "dsv-pane-menu",
9824
10037
  onPointerDown: (event) => event.stopPropagation(),
9825
10038
  },
9826
- ...(standalone === true ? [
10039
+ ...(appWindow === true ? [
10040
+ menuItem("copy", t("copy"), () => { setMenuOpen(false); doCopy(); }),
10041
+ menuItem("help", t("helpOpen"), () => { setMenuOpen(false); doHelp(); }),
10042
+ menuItem("fullscreen", t("standaloneFullscreen"), () => { setMenuOpen(false); doFullscreen(); }),
10043
+ menuItem("minimize", t("independentMinimize"), () => { setMenuOpen(false); minimizeAppWindow(); }),
10044
+ menuItem("maximize", appWindowMaximized === true ? t("restore") : t("maximize"), () => { setMenuOpen(false); toggleMaximizeAppWindow(); }),
10045
+ menuItem("close", t("independentClose"), () => { setMenuOpen(false); closeAppWindow(); }, true),
10046
+ ] : standalone === true ? [
9827
10047
  menuItem("copy", t("copy"), () => { setMenuOpen(false); doCopy(); }),
9828
10048
  menuItem("help", t("helpOpen"), () => { setMenuOpen(false); doHelp(); }),
9829
10049
  menuItem("fullscreen", t("standaloneFullscreen"), () => { setMenuOpen(false); doFullscreen(); }),
@@ -9871,6 +10091,8 @@ window.__ModuleLoader__.load({
9871
10091
  && a.chrome === b.chrome
9872
10092
  && a.floating === b.floating
9873
10093
  && a.standalone === b.standalone
10094
+ && a.appWindow === b.appWindow
10095
+ && a.appWindowMaximized === b.appWindowMaximized
9874
10096
  && summaryShallowEqual(a.summary, b.summary),
9875
10097
  );
9876
10098
 
@@ -9885,7 +10107,7 @@ window.__ModuleLoader__.load({
9885
10107
  return dir === "h" ? { width: basis, height: "100%" } : { height: basis, width: "100%" };
9886
10108
  }
9887
10109
 
9888
- function RenderLeaf({ id, chrome, generation, floating, standalone }) {
10110
+ function RenderLeaf({ id, chrome, generation, floating, standalone, appWindow, appWindowMaximized }) {
9889
10111
  const state = useTree();
9890
10112
  const sessions = useSessionsList();
9891
10113
  const liveSummary = sessions !== null && sessions !== undefined && sessions.byId !== undefined ? sessions.byId[id] : undefined;
@@ -9907,13 +10129,15 @@ window.__ModuleLoader__.load({
9907
10129
  chrome: chrome !== false,
9908
10130
  floating: floating === true,
9909
10131
  standalone: standalone === true,
10132
+ appWindow: appWindow === true,
10133
+ appWindowMaximized: appWindowMaximized === true,
9910
10134
  focused: floating !== true && standalone !== true && state.focus === id,
9911
10135
  onFocus: floating === true ? (sid) => { floatStore.focus(sid); } : (sid) => treeStore.setFocus(sid),
9912
10136
  // Teardown is NOT done here any more: treeStore.commit schedules the
9913
10137
  // departed leaf for disposal and ChatPane releases on unmount, so every
9914
10138
  // leaf-mutation path (✕, sidebar swap, closeFocused, movePane) is
9915
10139
  // covered by the same idempotent path.
9916
- onClose: floating === true ? () => closeFloatWindow(id) : (sid) => closePaneAnimated(sid),
10140
+ onClose: floating === true ? () => closeFloatWindow(id) : appWindow === true ? () => closeAppWindow() : (sid) => closePaneAnimated(sid),
9917
10141
  pickerFor: floating === true || standalone === true ? () => {} : (...args) => togglePicker(...args),
9918
10142
  }));
9919
10143
  }
@@ -10505,10 +10729,30 @@ window.__ModuleLoader__.load({
10505
10729
  floats() {
10506
10730
  return safeCall("floats()", () => floatStore.ids(), []);
10507
10731
  },
10508
- /** Open one conversation in a separate system window (Host-backed URL). */
10732
+ /** Open one conversation in the app-internal independent window. */
10509
10733
  openSystemWindow(sessionId) {
10510
10734
  return safeCall("openSystemWindow()", () => openSystemWindow(sessionId), false);
10511
10735
  },
10736
+ /** Alias for openSystemWindow: independent of any browser window. */
10737
+ openIndependentWindow(sessionId) {
10738
+ return safeCall("openIndependentWindow()", () => openSystemWindow(sessionId), false);
10739
+ },
10740
+ /** Open one conversation in a real OS window (macOS native window). */
10741
+ openNativeWindow(sessionId) {
10742
+ return safeCall("openNativeWindow()", () => requestSystemWindow(sessionId, "open"), false);
10743
+ },
10744
+ /** Close the native OS window currently showing one conversation. */
10745
+ closeNativeWindow(sessionId) {
10746
+ return safeCall("closeNativeWindow()", () => requestSystemWindow(sessionId, "close"), false);
10747
+ },
10748
+ /** Session ids whose native OS window is currently open. */
10749
+ nativeWindows() {
10750
+ return safeCall("nativeWindows()", () => nativeWindowStore.getSnapshot().slice(), []);
10751
+ },
10752
+ /** Current independent-window state ({ id, minimized, maximized } or null). */
10753
+ appWindow() {
10754
+ return safeCall("appWindow()", () => (runtimeState.appWindow === null ? null : Object.assign({}, runtimeState.appWindow)), null);
10755
+ },
10512
10756
  /** Toggle performance mode (persisted; reduces animations/observers). */
10513
10757
  setPerformanceMode(flag) {
10514
10758
  return safeCall("setPerformanceMode()", () => setPerformanceMode(flag !== false), false);
@@ -10521,6 +10765,10 @@ window.__ModuleLoader__.load({
10521
10765
  reloadClient() {
10522
10766
  return safeCall("reloadClient()", () => { try { location.reload(); } catch {} return true; }, false);
10523
10767
  },
10768
+ /** Close and reopen DSH Desktop so changes that need a full restart load. */
10769
+ restartApp() {
10770
+ return safeCall("restartApp()", () => { restartApplication(); return true; }, false);
10771
+ },
10524
10772
  /** Sessions waiting for a second pick before the split starts. */
10525
10773
  pending() {
10526
10774
  return safeCall("pending()", () => pendingSplitStore.ids(), []);
@@ -11536,11 +11784,45 @@ window.__ModuleLoader__.load({
11536
11784
  );
11537
11785
  }
11538
11786
 
11787
+ /** Screenshots shown in the help card. The Host serves them from
11788
+ docs/screenshots under /dsv/help/, so the same relative URL works in
11789
+ the Desktop shell and the Web client. */
11790
+ const HELP_SHOTS = [
11791
+ { id: "session-menu", src: "/dsv/help/session-menu.png", label: "helpShotMenu" },
11792
+ { id: "footer-menu", src: "/dsv/help/footer-menu.png", label: "helpShotFooter" },
11793
+ { id: "settings", src: "/dsv/help/settings.png", label: "helpShotSettings" },
11794
+ ];
11795
+
11796
+ /** Full-size screenshot opened from a help thumbnail. */
11797
+ function HelpShotLightbox({ shot, onClose }) {
11798
+ React.useEffect(() => {
11799
+ const onKeyDown = (event) => {
11800
+ if (event.key !== "Escape") return;
11801
+ event.preventDefault();
11802
+ event.stopPropagation();
11803
+ onClose();
11804
+ };
11805
+ document.addEventListener("keydown", onKeyDown, true);
11806
+ return () => document.removeEventListener("keydown", onKeyDown, true);
11807
+ }, [onClose]);
11808
+ return h("div", {
11809
+ className: "dsv-help-lightbox",
11810
+ role: "dialog",
11811
+ "aria-modal": "true",
11812
+ "aria-label": t(shot.label),
11813
+ "data-plugin": PLUGIN_ID,
11814
+ onClick: onClose,
11815
+ },
11816
+ h("img", { src: shot.src, alt: t(shot.label), draggable: false, onClick: (event) => event.stopPropagation() }),
11817
+ );
11818
+ }
11819
+
11539
11820
  /** The one help card: opened by the pane header "?" and by the blocked
11540
11821
  chip. Lives inside the plugin overlay when active (fixed variant for the
11541
11822
  inactive chip path). */
11542
11823
  function HelpCard({ fixed }) {
11543
11824
  const help = helpText();
11825
+ const [shot, setShot] = React.useState(null);
11544
11826
  return h("div", {
11545
11827
  className: "dsv-help-card" + (fixed === true ? " dsv-help-card-fixed" : ""),
11546
11828
  role: "dialog",
@@ -11563,8 +11845,21 @@ window.__ModuleLoader__.load({
11563
11845
  h("span", { className: "dsv-help-body" }, item.action),
11564
11846
  )),
11565
11847
  h("div", { className: "dsv-help-body", style: { marginTop: "6px" } }, t("helpGestures")),
11848
+ h("div", { className: "dsv-help-body", style: { marginTop: "6px" } }, t("helpIndependent")),
11849
+ h("div", { className: "dsv-help-section-title" }, t("helpShotsTitle")),
11850
+ h("div", { className: "dsv-help-shots" }, HELP_SHOTS.map((item) => h("figure", {
11851
+ key: item.id,
11852
+ className: "dsv-help-shot",
11853
+ title: t("helpShotZoom"),
11854
+ onClick: () => setShot(item),
11855
+ },
11856
+ h("img", { src: item.src, alt: t(item.label), loading: "lazy", draggable: false }),
11857
+ h("figcaption", null, t(item.label)),
11858
+ ))),
11859
+ shot !== null ? h(HelpShotLightbox, { shot, onClose: () => setShot(null) }) : null,
11566
11860
  h("div", { className: "dsv-help-body", style: { marginTop: "6px" } }, t("helpDisable")),
11567
11861
  h("div", { className: "dsv-help-body", style: { marginTop: "2px" } }, t("helpDiagnostics")),
11862
+ h("div", { className: "dsv-help-body", style: { marginTop: "2px" } }, t("helpRestart")),
11568
11863
  h("div", { className: "dsv-help-actions" },
11569
11864
  h("button", { type: "button", className: "dsv-chip-btn", onClick: closeHelp }, t("helpClose")),
11570
11865
  h("button", { type: "button", className: "dsv-chip-btn", onClick: () => setEnabled(false) }, t("disableLabel")),
@@ -11777,14 +12072,18 @@ window.__ModuleLoader__.load({
11777
12072
  };
11778
12073
  }, []);
11779
12074
  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.
12075
+ const desktop = desktopShell();
12076
+ // Desktop app code is applied through the Host's HMR/rebuild path when
12077
+ // it can be, but a Host-half or linked-package change can still need a
12078
+ // full restart. Offer the restart itself instead of asking the user to
12079
+ // quit the app by hand. The Web GUI reloads the page.
11785
12080
  return h("div", { className: "dsv-update-chip", role: "status" },
11786
12081
  h("span", null, t(desktop ? "updateRestart" : "updateReady", { v: ready })),
11787
- desktop ? null : h("button", {
12082
+ desktop ? h("button", {
12083
+ type: "button",
12084
+ className: "dsv-update-chip-btn accent",
12085
+ onClick: () => { closeLauncher(); openRestartDialog(); },
12086
+ }, t("restartApp")) : h("button", {
11788
12087
  type: "button",
11789
12088
  className: "dsv-update-chip-btn accent",
11790
12089
  onClick: () => { try { location.reload(); } catch {} },
@@ -11802,24 +12101,19 @@ window.__ModuleLoader__.load({
11802
12101
 
11803
12102
  function SplitWorkspaceSeat(props) {
11804
12103
  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
- }
12104
+ const appWindowState = runtime.appWindow;
12105
+ const appWindowOpen = appWindowState !== null && appWindowState !== undefined && appWindowState.minimized !== true;
11818
12106
  return h(React.Fragment, null,
11819
- h(WorkspaceBoundary, { key: "workspace-" + runtime.epoch }, h(WorkspaceApp, props)),
12107
+ h(WorkspaceBoundary, { key: "workspace-" + runtime.epoch },
12108
+ h(WorkspaceApp, Object.assign({}, props, { dsvAppWindowOpen: appWindowOpen }))),
11820
12109
  h(PluginChrome, null),
11821
12110
  h(WorkspaceBoundary, { key: "floats-" + runtime.epoch }, h(FloatLayer, null)),
11822
12111
  h(SplitLauncherLayer, null),
12112
+ h(AppWindowChip, null),
12113
+ h(AppWindowLayer, null),
12114
+ // The settings page and the help action can open the card without a
12115
+ // live split; the pane/overlay path only renders it while active.
12116
+ runtime.helpOpen === true && runtime.active !== true ? h(HelpCard, { fixed: true }) : null,
11823
12117
  h(UpdateNotice, null),
11824
12118
  );
11825
12119
  }
@@ -11853,10 +12147,10 @@ window.__ModuleLoader__.load({
11853
12147
  // The activation gate: >=2 panes AND the kill switch/safe mode allow it.
11854
12148
  // Everything below keys off this — observers, DOM scraping, the overlay.
11855
12149
  const minimized = runtime.minimized === true;
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
12150
+ // An independent window owns the screen while it is open; keep the
12151
+ // split tree (and its observers) quiet underneath.
12152
+ const appWindowOpen = props.dsvAppWindowOpen === true;
12153
+ const active = appWindowOpen !== true && leaves.length >= 2
11860
12154
  && runtime.enabled === true && runtime.safeMode !== true;
11861
12155
  const [picker, setPicker] = React.useState(pickerRequest);
11862
12156
  const [bounds, setBounds] = React.useState({ left: 0, right: 0, top: 0, bottom: 0, ok: false });
@@ -12680,6 +12974,86 @@ window.__ModuleLoader__.load({
12680
12974
  return true;
12681
12975
  }
12682
12976
 
12977
+ /** DSH Desktop exposes its preload product API; the browser Web GUI does
12978
+ not. Restarting the app is only possible from the Desktop. */
12979
+ function desktopShell() {
12980
+ return typeof window !== "undefined" && typeof window.dshDesktop !== "undefined";
12981
+ }
12982
+
12983
+ /** Ask the Host half to close and reopen DSH. The Host is a Node child of
12984
+ the Desktop shell, so it can drive an OS-level quit+relaunch even
12985
+ though production DSH has no in-app restart entry. */
12986
+ function restartApplication() {
12987
+ if (!desktopShell()) {
12988
+ showPaneToast(t("restartUnsupported"), true);
12989
+ return;
12990
+ }
12991
+ showPaneToast(t("restarting"), true);
12992
+ try {
12993
+ fetch("/dsv/restart", {
12994
+ method: "POST",
12995
+ headers: { "content-type": "application/json", "x-dsv-restart": "1" },
12996
+ body: "{\"confirm\":true}",
12997
+ cache: "no-store",
12998
+ keepalive: true,
12999
+ }).then((response) => response.json().catch(() => null)).then((payload) => {
13000
+ if (payload === null || payload === undefined || payload.ok !== true) throw new Error("restart");
13001
+ }).catch(() => {
13002
+ showPaneToast(t("restartFailed"), true);
13003
+ });
13004
+ } catch {
13005
+ showPaneToast(t("restartFailed"), true);
13006
+ }
13007
+ }
13008
+
13009
+ /** Confirmation before the app closes: running tasks are interrupted. */
13010
+ function RestartDialog() {
13011
+ React.useEffect(() => {
13012
+ const onKeyDown = (event) => {
13013
+ if (event.key !== "Escape") return;
13014
+ event.preventDefault();
13015
+ event.stopPropagation();
13016
+ closeLauncher();
13017
+ };
13018
+ document.addEventListener("keydown", onKeyDown, true);
13019
+ return () => document.removeEventListener("keydown", onKeyDown, true);
13020
+ }, []);
13021
+ return h("div", {
13022
+ className: "dsv-modal-backdrop",
13023
+ onPointerDown: (event) => {
13024
+ if (event.target === event.currentTarget) closeLauncher();
13025
+ },
13026
+ },
13027
+ h("div", {
13028
+ className: "dsv-modal",
13029
+ role: "dialog",
13030
+ "aria-modal": "true",
13031
+ "aria-label": t("restartTitle"),
13032
+ },
13033
+ h("div", { className: "dsv-modal-head" },
13034
+ h("span", { className: "dsv-modal-title" }, t("restartTitle")),
13035
+ h("button", {
13036
+ type: "button",
13037
+ className: "dsv-modal-close",
13038
+ title: t("addSplitCancel"),
13039
+ "aria-label": t("addSplitCancel"),
13040
+ onClick: closeLauncher,
13041
+ }, "×"),
13042
+ ),
13043
+ h("div", { className: "dsv-modal-hint" }, t("restartBody")),
13044
+ h("div", { className: "dsv-modal-foot", style: { borderTop: "none", paddingTop: 0 } },
13045
+ h("span", { className: "dsv-modal-count" }, ""),
13046
+ h("button", { type: "button", className: "dsv-modal-btn", onClick: closeLauncher }, t("addSplitCancel")),
13047
+ h("button", {
13048
+ type: "button",
13049
+ className: "dsv-modal-btn accent",
13050
+ onClick: () => { closeLauncher(); restartApplication(); },
13051
+ }, t("restartNow")),
13052
+ ),
13053
+ ),
13054
+ );
13055
+ }
13056
+
12683
13057
  /** Aspect ratio of the conversation column; only decides columns vs rows
12684
13058
  for a two-pane split (the same 1.2 fallback settleAuto uses). */
12685
13059
  function splitColumnAspect() {
@@ -12730,6 +13104,7 @@ window.__ModuleLoader__.load({
12730
13104
  for (const id of Array.isArray(ids) ? ids : []) {
12731
13105
  if (!isValidSessionId(id) || ordered.indexOf(id) !== -1) continue;
12732
13106
  if (floatStore.has(id)) floatStore.remove(id);
13107
+ closeAppWindowFor(id);
12733
13108
  ordered.push(id);
12734
13109
  }
12735
13110
  if (ordered.length < 2) {
@@ -12750,6 +13125,7 @@ window.__ModuleLoader__.load({
12750
13125
  function addSessionToSplit(sessionId) {
12751
13126
  if (!isValidSessionId(sessionId)) return false;
12752
13127
  if (floatStore.has(sessionId)) floatStore.remove(sessionId);
13128
+ closeAppWindowFor(sessionId);
12753
13129
  const leaves = treeStore.leafIds();
12754
13130
  if (leaves.indexOf(sessionId) !== -1) {
12755
13131
  try { treeStore.setFocus(sessionId); } catch {}
@@ -12897,6 +13273,7 @@ window.__ModuleLoader__.load({
12897
13273
  chipDismissed: false,
12898
13274
  tipVisible: false,
12899
13275
  helpOpen: false,
13276
+ appWindow: null,
12900
13277
  });
12901
13278
  const resetEpoch = runtimeState.epoch;
12902
13279
  try {
@@ -12935,6 +13312,64 @@ window.__ModuleLoader__.load({
12935
13312
  }
12936
13313
  }
12937
13314
 
13315
+ /** Rows for one conversation: one "分屏插件" first-level group whose
13316
+ second level holds the split-membership toggle and the three window
13317
+ surfaces. Every entry is a single Enter/Exit toggle that mirrors its
13318
+ live state: split tree / pending pick, float store, app-window runtime
13319
+ store, and the Host-tracked native window list. */
13320
+ function sessionMenuActions(id) {
13321
+ const inSplit = treeStore.leafIds().indexOf(id) !== -1;
13322
+ const pending = pendingSplitStore.has(id);
13323
+ const splitMember = inSplit || pending;
13324
+ const floating = floatStore.has(id);
13325
+ const appWindow = appWindowSnapshot();
13326
+ const independent = appWindow !== null && appWindow.id === id;
13327
+ const nativeWindow = nativeWindowStore.has(id);
13328
+ return [
13329
+ {
13330
+ id: "split-plugin",
13331
+ label: t("menuGroup"),
13332
+ separatorBefore: true,
13333
+ children: [
13334
+ {
13335
+ // 加入分屏 / 退出分屏 is now one toggle: a member (split pane or
13336
+ // pending pick) exits, everything else joins.
13337
+ id: "split",
13338
+ label: t(splitMember ? "exitSplit" : "menuAddToSplit"),
13339
+ run: () => {
13340
+ if (splitMember) removeSessionFromSplit(id);
13341
+ else if (floatStore.has(id)) dockFloatToSplit(id);
13342
+ else addSessionToSplit(id);
13343
+ },
13344
+ },
13345
+ {
13346
+ id: "float",
13347
+ label: t(floating ? "menuFloatClose" : "menuFloatOpen"),
13348
+ run: () => {
13349
+ if (floatStore.has(id)) closeFloatWindow(id);
13350
+ else floatSession(id);
13351
+ },
13352
+ },
13353
+ {
13354
+ id: "independent",
13355
+ label: t(independent ? "menuIndependentClose" : "menuIndependentOpen"),
13356
+ failureLabel: t("systemWindowFailed"),
13357
+ run: () => {
13358
+ if (independent) closeAppWindowFor(id);
13359
+ else openAppWindow(id);
13360
+ },
13361
+ },
13362
+ {
13363
+ id: "native",
13364
+ label: t(nativeWindow ? "menuNativeClose" : "menuNativeOpen"),
13365
+ failureLabel: t("systemWindowFailed"),
13366
+ run: () => requestSystemWindow(id, nativeWindow ? "close" : "open"),
13367
+ },
13368
+ ],
13369
+ },
13370
+ ];
13371
+ }
13372
+
12938
13373
  /** Contribute 加入分屏 / 退出分屏 to the stock session context menu. The
12939
13374
  service is looked up lazily: a host without ui-context-menu simply does
12940
13375
  not get the rows (nothing else changes). */
@@ -12954,43 +13389,13 @@ window.__ModuleLoader__.load({
12954
13389
  id: "split-workspace.session",
12955
13390
  target: "session",
12956
13391
  order: 350,
12957
- observe: () => [treeStore, pendingSplitStore, floatStore],
13392
+ observe: () => [treeStore, pendingSplitStore, floatStore, runtimeStore, nativeWindowStore],
12958
13393
  resolve: (target) => {
12959
13394
  const id = target !== null && target !== undefined ? target.sessionId : undefined;
12960
13395
  if (!isValidSessionId(id)) return [];
12961
- const inSplit = treeStore.leafIds().indexOf(id) !== -1;
12962
- const pending = pendingSplitStore.has(id);
12963
- const floating = floatStore.has(id);
12964
- return [
12965
- {
12966
- id: "add",
12967
- label: t("menuAddToSplit"),
12968
- disabled: inSplit || pending,
12969
- run: () => { if (floatStore.has(id)) dockFloatToSplit(id); else addSessionToSplit(id); },
12970
- },
12971
- {
12972
- id: "remove",
12973
- label: t("exitSplit"),
12974
- disabled: !inSplit && !pending,
12975
- run: () => { removeSessionFromSplit(id); },
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
- },
12993
- ];
13396
+ // Refresh the Host-tracked native-window list before building
13397
+ // the rows, so a window closed outside DSH already shows Enter.
13398
+ return nativeWindowStore.refresh().then(() => sessionMenuActions(id)).catch(() => []);
12994
13399
  },
12995
13400
  });
12996
13401
  } catch (error) {
@@ -13215,6 +13620,7 @@ window.__ModuleLoader__.load({
13215
13620
  try {
13216
13621
  if (target.closest(".dsv-launcher-menu") !== null) return;
13217
13622
  if (target.closest(".dsv-footer-btn") !== null) return;
13623
+ if (target.closest(".dsv-fallback-launcher") !== null) return;
13218
13624
  } catch {}
13219
13625
  }
13220
13626
  closeLauncher();
@@ -13264,10 +13670,137 @@ window.__ModuleLoader__.load({
13264
13670
  row("performance", "⚡", t("performanceMode") + (runtime.performance === true ? " ✓" : ""),
13265
13671
  () => { closeLauncher(); setPerformanceMode(runtime.performance !== true); }),
13266
13672
  row("reload", "↻", t("refreshInterface"), () => { closeLauncher(); try { location.reload(); } catch {} }),
13673
+ desktopShell()
13674
+ ? row("restart", "⏻", t("restartApp"), () => { closeLauncher(); openRestartDialog(); })
13675
+ : null,
13676
+ row("help", "?", t("helpOpen"), () => { closeLauncher(); openHelp(); }),
13267
13677
  row("reset", "↺", t("menuResetSplit"), () => { closeLauncher(); resetSplitEnvironment(); }, { danger: true }),
13268
13678
  );
13269
13679
  }
13270
13680
 
13681
+ /** Settings → Split workspace page: the same controls as the footer menu,
13682
+ reachable from the system Settings panel as well. */
13683
+ function SettingsSection(props) {
13684
+ const runtime = useRuntime();
13685
+ const tree = useTree();
13686
+ const pending = usePendingSplit();
13687
+ const floats = useFloats();
13688
+ const leaves = tree.root === null ? [] : leafOf(tree.root, []);
13689
+ const active = leaves.length >= 2;
13690
+ const appWindow = runtime.appWindow;
13691
+ const closeThen = (fn) => {
13692
+ try { if (props !== null && props !== undefined && typeof props.close === "function") props.close(); } catch {}
13693
+ try { fn(); } catch {}
13694
+ };
13695
+ const value = (text) => h("span", { className: "dsv-settings-value" }, text);
13696
+ const row = (key, label, content) => h("div", { key, className: "dsv-settings-row" },
13697
+ h("span", { className: "dsv-settings-row-label" }, label),
13698
+ content,
13699
+ );
13700
+ const button = (key, label, onClick, options) => h("button", {
13701
+ key,
13702
+ type: "button",
13703
+ className: "dsv-settings-btn"
13704
+ + (options !== undefined && options.accent === true ? " accent" : "")
13705
+ + (options !== undefined && options.danger === true ? " danger" : ""),
13706
+ disabled: options !== undefined && options.disabled === true,
13707
+ onClick: options !== undefined && options.disabled === true ? undefined : onClick,
13708
+ }, label);
13709
+ return h("div", { className: "dsv-settings", "data-plugin": PLUGIN_ID },
13710
+ h("div", { className: "dsv-settings-desc" }, t("settingsDesc")),
13711
+ h("section", { className: "dsv-settings-group" },
13712
+ h("h3", { className: "dsv-settings-group-title" }, t("settingsStatus")),
13713
+ row("version", t("settingsVersion"), value("v" + PLUGIN_VERSION)),
13714
+ row("panes", t("settingsPanes"), value(String(leaves.length))),
13715
+ row("pending", t("settingsPending"), value(String(pending.length))),
13716
+ row("floats", t("settingsFloats"), value(String(floats.windows.length))),
13717
+ appWindow !== null && appWindow !== undefined
13718
+ ? row("appwindow", t("menuSystemWindow"), value(appWindow.id))
13719
+ : null,
13720
+ ),
13721
+ h("section", { className: "dsv-settings-group" },
13722
+ h("h3", { className: "dsv-settings-group-title" }, t("settingsPerformance")),
13723
+ h("div", { className: "dsv-settings-row" },
13724
+ h("div", { className: "dsv-settings-label" },
13725
+ h("span", null, t("settingsPerformance")),
13726
+ h("span", { className: "dsv-settings-value" }, t("settingsPerformanceDesc")),
13727
+ ),
13728
+ button("performance", runtime.performance === true ? t("performanceOn") : t("performanceOff"),
13729
+ () => setPerformanceMode(runtime.performance !== true),
13730
+ { accent: runtime.performance === true }),
13731
+ ),
13732
+ ),
13733
+ h("section", { className: "dsv-settings-group" },
13734
+ h("h3", { className: "dsv-settings-group-title" }, t("settingsActions")),
13735
+ h("div", { className: "dsv-settings-actions" },
13736
+ button("add", t("menuAddSplit"), () => closeThen(() => openAddSplitDialog("footer")), { accent: true }),
13737
+ button("exit", t("exitSplit"), () => { try { exitWorkspace(); } catch {} }, { disabled: !active }),
13738
+ button("minimize", t("menuMinimizeSplit"), () => { try { minimizeWorkspace(); } catch {} }, { disabled: !active || runtime.minimized === true }),
13739
+ button("refresh", t("refreshInterface"), () => { try { location.reload(); } catch {} }),
13740
+ desktopShell()
13741
+ ? button("restart", t("restartApp"), () => closeThen(() => openRestartDialog()))
13742
+ : null,
13743
+ appWindow !== null && appWindow !== undefined
13744
+ ? button("closeappwindow", t("independentClose"), () => closeThen(() => closeAppWindow()))
13745
+ : null,
13746
+ button("help", t("helpOpen"), () => closeThen(() => setRuntime({ helpOpen: true }))),
13747
+ button("reset", t("menuResetSplit"), () => { try { resetSplitEnvironment(); } catch {} }, { danger: true }),
13748
+ ),
13749
+ ),
13750
+ );
13751
+ }
13752
+
13753
+ /** Fallback entry point when the stock sidebar footer does not render this
13754
+ plugin's action (collapsed/absent sidebar, a layout that replaces the
13755
+ footer, or an older host whose footer slot is empty). The launcher menu
13756
+ stays reachable from the conversation column's bottom-left corner. */
13757
+ function LauncherFallback() {
13758
+ const runtime = useRuntime();
13759
+ const launcher = useLauncherState();
13760
+ const pending = usePendingSplit();
13761
+ const [footerVisible, setFooterVisible] = React.useState(true);
13762
+ React.useEffect(() => {
13763
+ const check = () => {
13764
+ let visible = false;
13765
+ try {
13766
+ const button = document.querySelector(".dsv-footer-btn");
13767
+ visible = button !== null && button !== undefined && button.getBoundingClientRect().width > 0;
13768
+ } catch {}
13769
+ setFooterVisible(visible);
13770
+ };
13771
+ check();
13772
+ const timer = window.setInterval(check, runtime.performance === true ? 3000 : 1200);
13773
+ return () => { try { window.clearInterval(timer); } catch {} };
13774
+ }, [runtime.performance, runtime.enabled]);
13775
+ if (runtime.enabled !== true || footerVisible || launcher.mode !== "closed") return null;
13776
+ // Own the conversation column's bottom-left corner when its bounds are
13777
+ // known (so the fallback never sits on the stock sidebar controls); fall
13778
+ // back to the viewport corner when geometry is not measured yet.
13779
+ let style = null;
13780
+ try {
13781
+ const bounds = measureColumnBounds();
13782
+ if (bounds !== null && bounds !== undefined && bounds.ok === true) {
13783
+ style = {
13784
+ left: Math.max(8, bounds.left) + 16 + "px",
13785
+ bottom: Math.max(8, bounds.bottom) + 16 + "px",
13786
+ };
13787
+ }
13788
+ } catch {}
13789
+ return h("button", {
13790
+ type: "button",
13791
+ className: "dsv-fallback-launcher",
13792
+ style,
13793
+ title: t("menuTitle"),
13794
+ "aria-label": t("fallbackLauncher"),
13795
+ "aria-haspopup": "menu",
13796
+ onClick: (event) => openLauncherMenu(event.currentTarget),
13797
+ },
13798
+ h(SplitIconV, { size: 15 }),
13799
+ h("span", { className: "dsv-fallback-label" }, t("fallbackLauncher")),
13800
+ pending.length > 0 ? h("span", { className: "dsv-footer-badge" }, String(pending.length)) : null,
13801
+ );
13802
+ }
13803
+
13271
13804
  /** Always-mounted launcher layer (inside the shell.overlay seat). */
13272
13805
  function SplitLauncherLayer() {
13273
13806
  const launcher = useLauncherState();
@@ -13279,7 +13812,8 @@ window.__ModuleLoader__.load({
13279
13812
  }), []);
13280
13813
  if (launcher.mode === "menu") return h(SplitLauncherMenu, { request: launcher });
13281
13814
  if (launcher.mode === "dialog") return h(AddSplitDialog, null);
13282
- return null;
13815
+ if (launcher.mode === "restart") return h(RestartDialog, null);
13816
+ return h(LauncherFallback, null);
13283
13817
  }
13284
13818
 
13285
13819
 
@@ -13321,6 +13855,8 @@ window.__ModuleLoader__.load({
13321
13855
  const floats = useFloats();
13322
13856
  const windows = floats.windows;
13323
13857
  const count = windows.length;
13858
+ const appWindow = runtime.appWindow;
13859
+ const appWindowOpen = appWindow !== null && appWindow !== undefined && appWindow.minimized !== true;
13324
13860
  React.useEffect(() => {
13325
13861
  if (runtime.enabled !== true || count === 0) return undefined;
13326
13862
  floatLayerMounted = true;
@@ -13352,7 +13888,7 @@ window.__ModuleLoader__.load({
13352
13888
  }
13353
13889
  };
13354
13890
  }, [count, runtime.performance]);
13355
- if (runtime.enabled !== true || count === 0) return null;
13891
+ if (runtime.enabled !== true || count === 0 || appWindowOpen) return null;
13356
13892
  // Stacking is a z-index swap, never a DOM reorder: moving a live editor
13357
13893
  // subtree (keyed React children) would blur the composer.
13358
13894
  const ranks = new Map();
@@ -13375,7 +13911,72 @@ window.__ModuleLoader__.load({
13375
13911
 
13376
13912
  /** Whole-page view used inside a standalone system window: one native
13377
13913
  conversation, native window controls, no split / floats / launcher. */
13378
- function StandaloneSessionWindow({ sessionId }) {
13914
+ // ---------------------------------------------------------------------
13915
+ // independent window (0.10.0)
13916
+ //
13917
+ // DSH Desktop exposes no plugin-facing BrowserWindow API: the main window
13918
+ // denies window.open, and a Host plugin runs in a Node child process. The
13919
+ // old "system window" therefore had to open the default browser. This
13920
+ // surface replaces it with a first-class window inside the application:
13921
+ // one native conversation, close / minimize / maximize-restore /
13922
+ // fullscreen controls, no browser dependency. It covers the app while
13923
+ // open and collapses to a restore chip when minimized.
13924
+ // ---------------------------------------------------------------------
13925
+
13926
+ function appWindowSnapshot() {
13927
+ const state = runtimeState.appWindow;
13928
+ return state === null || state === undefined ? null : state;
13929
+ }
13930
+
13931
+ /** Replace the browser window with the in-app independent window. */
13932
+ function openAppWindow(sessionId) {
13933
+ if (!isValidSessionId(sessionId)) return false;
13934
+ try { closeLauncher(); } catch {}
13935
+ try { if (floatStore.has(sessionId)) floatStore.remove(sessionId); } catch {}
13936
+ pendingSplitStore.remove(sessionId);
13937
+ setRuntime({ appWindow: { id: sessionId, minimized: false, maximized: false } });
13938
+ return true;
13939
+ }
13940
+
13941
+ /** Close the independent window for one session (a different window stays). */
13942
+ function closeAppWindowFor(sessionId) {
13943
+ const state = appWindowSnapshot();
13944
+ if (state === null || state.id !== sessionId) return false;
13945
+ return closeAppWindow();
13946
+ }
13947
+
13948
+ /** Close the independent window and return to the main conversation view. */
13949
+ function closeAppWindow() {
13950
+ const state = appWindowSnapshot();
13951
+ if (state === null) return false;
13952
+ setRuntime({ appWindow: null });
13953
+ try { openSessionInMainView(state.id); } catch {}
13954
+ return true;
13955
+ }
13956
+
13957
+ function minimizeAppWindow() {
13958
+ const state = appWindowSnapshot();
13959
+ if (state === null || state.minimized === true) return false;
13960
+ setRuntime({ appWindow: Object.assign({}, state, { minimized: true }) });
13961
+ return true;
13962
+ }
13963
+
13964
+ function restoreAppWindow() {
13965
+ const state = appWindowSnapshot();
13966
+ if (state === null || state.minimized !== true) return false;
13967
+ setRuntime({ appWindow: Object.assign({}, state, { minimized: false }) });
13968
+ return true;
13969
+ }
13970
+
13971
+ function toggleMaximizeAppWindow() {
13972
+ const state = appWindowSnapshot();
13973
+ if (state === null) return false;
13974
+ setRuntime({ appWindow: Object.assign({}, state, { maximized: state.maximized !== true, minimized: false }) });
13975
+ return true;
13976
+ }
13977
+
13978
+ /** One native conversation filling the independent window. */
13979
+ function IndependentSessionWindow({ sessionId, embedded }) {
13379
13980
  const runtime = useRuntime();
13380
13981
  const sessions = useSessionsList();
13381
13982
  const summary = sessions !== null && sessions !== undefined && sessions.byId !== undefined
@@ -13385,11 +13986,13 @@ window.__ModuleLoader__.load({
13385
13986
  ? (summary.displayTitle || summary.title || sessionId)
13386
13987
  : sessionId;
13387
13988
  React.useEffect(() => {
13989
+ const previous = document.title;
13388
13990
  try { document.title = title + " — DeepSeek Harness"; } catch {}
13991
+ return () => { try { document.title = previous; } catch {} };
13389
13992
  }, [title]);
13390
13993
  // 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.
13994
+ // live. This surface is a one-conversation workspace, so keep it warm
13995
+ // for the title and the re-hosted header.
13393
13996
  React.useEffect(() => {
13394
13997
  const source = sessionsListSource;
13395
13998
  if (source === undefined || source === null || typeof source.setActive !== "function") return undefined;
@@ -13399,14 +14002,293 @@ window.__ModuleLoader__.load({
13399
14002
  try { source.setActive(false); } catch {}
13400
14003
  };
13401
14004
  }, []);
14005
+ const state = appWindowSnapshot();
13402
14006
  return h("div", {
13403
- className: "dsv-standalone",
14007
+ className: "dsv-standalone" + (embedded === true ? " dsv-standalone-embedded" : ""),
13404
14008
  "data-dsv-standalone-window": sessionId,
13405
14009
  },
13406
- h(RenderLeaf, { id: sessionId, chrome: true, generation: runtime.generation, standalone: true }),
14010
+ h(RenderLeaf, {
14011
+ id: sessionId,
14012
+ chrome: true,
14013
+ generation: runtime.generation,
14014
+ standalone: true,
14015
+ appWindow: embedded === true,
14016
+ appWindowMaximized: state !== null && state.maximized === true,
14017
+ }),
14018
+ );
14019
+ }
14020
+
14021
+ /** Window layer, rendered from the always-mounted shell overlay seat. */
14022
+ function AppWindowLayer() {
14023
+ const runtime = useRuntime();
14024
+ const state = runtime.appWindow;
14025
+ if (runtime.enabled !== true) return null;
14026
+ if (state === null || state === undefined || state.minimized === true) return null;
14027
+ return h("div", {
14028
+ className: "dsv-app-window-layer",
14029
+ "data-plugin": PLUGIN_ID,
14030
+ },
14031
+ h("div", {
14032
+ className: "dsv-app-window" + (state.maximized === true ? " maximized" : ""),
14033
+ "data-dsv-app-window": state.id,
14034
+ },
14035
+ h(IndependentSessionWindow, { sessionId: state.id, embedded: true }),
14036
+ ),
13407
14037
  );
13408
14038
  }
13409
14039
 
14040
+ /** Restore chip shown while the independent window is minimized. */
14041
+ function AppWindowChip() {
14042
+ const runtime = useRuntime();
14043
+ const sessions = useSessionsList();
14044
+ const state = runtime.appWindow;
14045
+ if (state === null || state === undefined || state.minimized !== true) return null;
14046
+ const summary = sessions !== null && sessions !== undefined && sessions.byId !== undefined
14047
+ ? sessions.byId[state.id]
14048
+ : undefined;
14049
+ const title = summary !== null && summary !== undefined
14050
+ ? (summary.displayTitle || summary.title || state.id)
14051
+ : state.id;
14052
+ return h("div", {
14053
+ className: "dsv-chip dsv-app-window-chip",
14054
+ "data-plugin": PLUGIN_ID,
14055
+ role: "status",
14056
+ },
14057
+ h("span", { className: "dsv-chip-text", title }, title),
14058
+ h("button", { type: "button", className: "dsv-chip-btn accent", onClick: restoreAppWindow }, t("independentRestore")),
14059
+ h("button", {
14060
+ type: "button", className: "dsv-chip-btn icon",
14061
+ title: t("independentClose"), "aria-label": t("independentClose"),
14062
+ onClick: closeAppWindow,
14063
+ }, "×"),
14064
+ );
14065
+ }
14066
+
14067
+ // ---------------------------------------------------------------------
14068
+ // native system window (0.11.0)
14069
+ //
14070
+ // DSH Desktop has no plugin-facing BrowserWindow API, so the Host opens the
14071
+ // closest native equivalent: a real OS window (macOS AppKit NSWindow with a
14072
+ // WKWebView, driven by osascript) that loads the Host's authenticated web
14073
+ // client. The URL carries a hash marker, and this client boot turns that
14074
+ // page into a one-conversation window: no left sidebar, the requested
14075
+ // conversation active, and every other column (the right sidebar included)
14076
+ // left to the stock shell.
14077
+ // ---------------------------------------------------------------------
14078
+
14079
+ const SYSTEM_WINDOW_HASH = "#dsv-system-window=";
14080
+
14081
+ /** The session id carried by the native window URL hash, if any. */
14082
+ function systemWindowSessionId() {
14083
+ try {
14084
+ const hash = String(window.location.hash || "");
14085
+ if (!hash.startsWith(SYSTEM_WINDOW_HASH)) return null;
14086
+ const value = decodeURIComponent(hash.slice(SYSTEM_WINDOW_HASH.length).split("&")[0] || "");
14087
+ return isValidSessionId(value) ? value : null;
14088
+ } catch {
14089
+ return null;
14090
+ }
14091
+ }
14092
+
14093
+ /** Zero the sidebar grid track while keeping the solved centre and
14094
+ right-sidebar tracks. AppFrame writes the whole track list as an inline
14095
+ React style, so only the first track is rewritten. */
14096
+ function zeroSystemWindowSidebarTrack() {
14097
+ try {
14098
+ const root = document.querySelector('[data-slot="root"]');
14099
+ if (root === null || root === undefined) return false;
14100
+ let frame = null;
14101
+ for (const element of root.querySelectorAll("div[style]")) {
14102
+ if (element.style !== undefined && element.style.gridTemplateColumns !== "") {
14103
+ frame = element;
14104
+ break;
14105
+ }
14106
+ }
14107
+ if (frame === null) return false;
14108
+ const value = String(frame.style.gridTemplateColumns || "");
14109
+ if (value === "" || value.startsWith("0px ")) return true;
14110
+ frame.style.gridTemplateColumns = "0px " + value.replace(/^\s*\S+\s+/, "");
14111
+ return true;
14112
+ } catch {
14113
+ return false;
14114
+ }
14115
+ }
14116
+
14117
+ /** Re-zero the track whenever React re-solves the columns (right sidebar
14118
+ toggles, window resize, drawer mode). */
14119
+ function watchSystemWindowLayout() {
14120
+ let observer = null;
14121
+ let timer = 0;
14122
+ const attach = () => {
14123
+ const root = document.querySelector('[data-slot="root"]');
14124
+ if (root === null || root === undefined) return false;
14125
+ try {
14126
+ observer = new MutationObserver(() => { zeroSystemWindowSidebarTrack(); });
14127
+ observer.observe(root, { attributes: true, subtree: true, attributeFilter: ["style"] });
14128
+ } catch {}
14129
+ zeroSystemWindowSidebarTrack();
14130
+ return true;
14131
+ };
14132
+ if (!attach()) {
14133
+ let tries = 0;
14134
+ timer = window.setInterval(() => {
14135
+ tries += 1;
14136
+ if (attach() || tries >= 40) {
14137
+ window.clearInterval(timer);
14138
+ timer = 0;
14139
+ }
14140
+ }, 250);
14141
+ }
14142
+ return () => {
14143
+ if (observer !== null) {
14144
+ try { observer.disconnect(); } catch {}
14145
+ }
14146
+ if (timer !== 0) {
14147
+ try { window.clearInterval(timer); } catch {}
14148
+ }
14149
+ };
14150
+ }
14151
+
14152
+ /** Activate the requested conversation once the stock shell is ready. The
14153
+ web client boots a fresh session first, so retry until the main view
14154
+ actually shows the requested id. */
14155
+ function activateSystemWindowSession(sessionId) {
14156
+ let tries = 0;
14157
+ const attempt = () => {
14158
+ tries += 1;
14159
+ if (currentSessionId() === sessionId) return;
14160
+ openSessionInMainView(sessionId);
14161
+ if (tries >= 12) return;
14162
+ window.setTimeout(attempt, 350);
14163
+ };
14164
+ window.setTimeout(attempt, 200);
14165
+ }
14166
+
14167
+ /** Boot hook: returns a disposer only in a native system window. */
14168
+ function bootSystemWindow() {
14169
+ const sessionId = systemWindowSessionId();
14170
+ if (sessionId === null) return null;
14171
+ try { document.documentElement.dataset.dsvSystemWindow = "1"; } catch {}
14172
+ const disposeLayout = watchSystemWindowLayout();
14173
+ activateSystemWindowSession(sessionId);
14174
+ return disposeLayout;
14175
+ }
14176
+
14177
+ // The Host owns the system windows. This store mirrors their session ids
14178
+ // so the session menu can offer Enter / Exit; it polls only while a menu
14179
+ // observes it, and every open/close updates it optimistically.
14180
+ const nativeWindowStore = (() => {
14181
+ let sessions = [];
14182
+ const listeners = new Set();
14183
+ let timer = 0;
14184
+ let inflight = null;
14185
+ const emit = () => {
14186
+ for (const listener of [...listeners]) {
14187
+ try { listener(); } catch {}
14188
+ }
14189
+ };
14190
+ const publish = (value) => {
14191
+ const next = [];
14192
+ for (const id of Array.isArray(value) ? value : []) {
14193
+ if (isValidSessionId(id) && next.indexOf(id) === -1) next.push(id);
14194
+ }
14195
+ const same = next.length === sessions.length && next.every((id, index) => sessions[index] === id);
14196
+ if (same) return;
14197
+ sessions = next;
14198
+ emit();
14199
+ };
14200
+ /** Fetch the Host's window list; concurrent callers share one request.
14201
+ The returned promise always settles, so the menu never hangs. */
14202
+ const read = () => {
14203
+ if (inflight !== null) return inflight;
14204
+ inflight = Promise.resolve().then(() => {
14205
+ try {
14206
+ return fetch("/dsv/system-window", {
14207
+ method: "GET",
14208
+ cache: "no-store",
14209
+ headers: { "x-dsv-system-window": "1" },
14210
+ }).then((response) => response.json().catch(() => null)).then((payload) => {
14211
+ if (payload !== null && payload !== undefined && payload.ok === true && Array.isArray(payload.sessions)) {
14212
+ publish(payload.sessions);
14213
+ }
14214
+ }).catch(() => {});
14215
+ } catch {
14216
+ return undefined;
14217
+ }
14218
+ }).finally(() => { inflight = null; });
14219
+ return inflight;
14220
+ };
14221
+ return {
14222
+ getSnapshot: () => sessions,
14223
+ subscribe(listener) {
14224
+ if (typeof listener !== "function") return () => {};
14225
+ listeners.add(listener);
14226
+ if (listeners.size === 1) {
14227
+ read();
14228
+ timer = window.setInterval(read, 2000);
14229
+ }
14230
+ return () => {
14231
+ listeners.delete(listener);
14232
+ if (listeners.size === 0 && timer !== 0) {
14233
+ try { window.clearInterval(timer); } catch {}
14234
+ timer = 0;
14235
+ }
14236
+ };
14237
+ },
14238
+ has: (id) => sessions.indexOf(id) !== -1,
14239
+ markOpen(id) {
14240
+ if (!isValidSessionId(id) || sessions.indexOf(id) !== -1) return;
14241
+ sessions = sessions.concat([id]);
14242
+ emit();
14243
+ },
14244
+ markClosed(id) {
14245
+ if (sessions.indexOf(id) === -1) return;
14246
+ sessions = sessions.filter((entry) => entry !== id);
14247
+ emit();
14248
+ },
14249
+ refresh: () => read(),
14250
+ };
14251
+ })();
14252
+
14253
+ /** Host action: open or close the native (OS) window for one conversation. */
14254
+ function requestSystemWindow(sessionId, mode) {
14255
+ if (!isValidSessionId(sessionId)) return false;
14256
+ const closing = mode === "close";
14257
+ if (!desktopShell()) {
14258
+ showPaneToast(t("systemWindowUnsupported"), true);
14259
+ return false;
14260
+ }
14261
+ showPaneToast(t(closing ? "systemWindowClosing" : "systemWindowOpening"), true);
14262
+ try {
14263
+ fetch("/dsv/system-window", {
14264
+ method: "POST",
14265
+ headers: { "content-type": "application/json", "x-dsv-system-window": "1" },
14266
+ body: JSON.stringify({ sessionId, action: closing ? "close" : "open" }),
14267
+ cache: "no-store",
14268
+ }).then((response) => response.json().catch(() => null)).then((payload) => {
14269
+ if (payload !== null && payload !== undefined && payload.ok === true) {
14270
+ if (closing) {
14271
+ nativeWindowStore.markClosed(sessionId);
14272
+ showPaneToast(t("systemWindowNativeClosed"), true);
14273
+ } else {
14274
+ nativeWindowStore.markOpen(sessionId);
14275
+ showPaneToast(t("systemWindowNativeOpened"), true);
14276
+ }
14277
+ return;
14278
+ }
14279
+ const code = payload !== null && payload !== undefined ? payload.error : undefined;
14280
+ showPaneToast(t(code === "unsupported-platform" || code === "not-desktop"
14281
+ ? "systemWindowUnsupported"
14282
+ : "systemWindowFailed"), true);
14283
+ }).catch(() => {
14284
+ showPaneToast(t("systemWindowFailed"), true);
14285
+ });
14286
+ } catch {
14287
+ showPaneToast(t("systemWindowFailed"), true);
14288
+ return false;
14289
+ }
14290
+ return true;
14291
+ }
13410
14292
  function restoreSplit() {
13411
14293
  try {
13412
14294
  const tree = treeStore.getSnapshot();
@@ -13529,6 +14411,11 @@ window.__ModuleLoader__.load({
13529
14411
 
13530
14412
  ctx.effect(() => insertStyle(DSV_CSS), "dsh-split-workspace: stylesheet");
13531
14413
 
14414
+ // A native system window boots this same client on the plain web origin.
14415
+ // Remove the left sidebar, keep the stock right sidebar, and activate the
14416
+ // conversation named by the URL hash. No-op in every other window.
14417
+ ctx.effect(bootSystemWindow, "dsh-split-workspace: system window");
14418
+
13532
14419
  // Performance mode is a CSS class on <html>; mirror the persisted flag
13533
14420
  // on every apply so a reload keeps it.
13534
14421
  ctx.effect(() => {
@@ -13672,7 +14559,7 @@ window.__ModuleLoader__.load({
13672
14559
  activationMarked = false;
13673
14560
  failureWindow.length = 0;
13674
14561
  failureLog.clear();
13675
- setRuntime({ active: false, geometryBlocked: false, helpOpen: false, tipVisible: false });
14562
+ setRuntime({ active: false, geometryBlocked: false, helpOpen: false, tipVisible: false, appWindow: null });
13676
14563
  appliedOnce = false;
13677
14564
  },
13678
14565
  "dsh-split-workspace: service cleanup",
@@ -13692,6 +14579,21 @@ window.__ModuleLoader__.load({
13692
14579
  h(FooterSplitButton),
13693
14580
  ),
13694
14581
  );
14582
+ // A second entry point in the system Settings panel. The slot is
14583
+ // declared by the settings shell; injection waits until it exists.
14584
+ slots.inject("settings.section", () =>
14585
+ slots.register({
14586
+ name: "settings.section",
14587
+ id: "split-workspace",
14588
+ order: 40,
14589
+ label: () => t("settingsNav"),
14590
+ }, (props) => h(SettingsSection, props)),
14591
+ );
14592
+ slots.inject("settings.section.icon", () =>
14593
+ slots.register({ name: "settings.section.icon", id: "split-workspace" }, (props) =>
14594
+ h(SplitIconV, { size: props !== null && props !== undefined && typeof props.size === "number" ? props.size : 16 }),
14595
+ ),
14596
+ );
13695
14597
  }
13696
14598
 
13697
14599
  // dsh 0.1.5: client services (sessions/locale) are provided asynchronously