dsh-split-workspace 0.9.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.9.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;
@@ -574,6 +558,11 @@ window.__ModuleLoader__.load({
574
558
  countSuffix: " panes",
575
559
  queuedBadge: "queued",
576
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",
577
566
  helpOpen: "Split view help",
578
567
  helpClose: "Close",
579
568
  helpShortcuts: "Shortcuts",
@@ -624,10 +613,35 @@ window.__ModuleLoader__.load({
624
613
  floatDocked: "Docked to the split view",
625
614
  floatClosed: "Floating window closed",
626
615
  floatHint: "Drag the title bar to move · drag an edge to resize",
627
- helpFloat: "Right-click a conversation → Enter floating window detaches it into a movable window; Dock to split puts it back.",
628
- menuSystemWindow: "Open in system window",
629
- systemWindowOpened: "Opened in a separate system window",
630
- systemWindowFailed: "Could not open a system window",
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",
631
645
  standaloneFullscreen: "Fullscreen",
632
646
  performanceMode: "Performance mode",
633
647
  performanceOn: "Performance mode on — animations and background observers are reduced",
@@ -699,6 +713,11 @@ window.__ModuleLoader__.load({
699
713
  countSuffix: " 个面板",
700
714
  queuedBadge: "条排队",
701
715
  helpTitle: "分屏视图 — 快捷键与帮助",
716
+ helpShotsTitle: "界面指引",
717
+ helpShotMenu: "右键会话 → 分屏插件",
718
+ helpShotFooter: "左下角分屏按钮菜单",
719
+ helpShotSettings: "设置 → 分屏工作区",
720
+ helpShotZoom: "点击查看大图",
702
721
  helpOpen: "分屏帮助",
703
722
  helpClose: "关闭",
704
723
  helpShortcuts: "快捷键",
@@ -749,10 +768,35 @@ window.__ModuleLoader__.load({
749
768
  floatDocked: "已回到分屏",
750
769
  floatClosed: "浮窗已关闭",
751
770
  floatHint: "拖动标题栏移动 · 拖动边缘调整大小",
752
- helpFloat: "右键会话 → 进入浮窗,可把该会话变成独立浮窗;浮窗标题栏的“回到分屏”可放回分屏。",
753
- menuSystemWindow: "在系统窗口打开",
754
- systemWindowOpened: "已在独立系统窗口中打开",
755
- 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: "操作",
756
800
  standaloneFullscreen: "全屏",
757
801
  performanceMode: "性能模式",
758
802
  performanceOn: "性能模式已开启:动画与后台观察器已精简",
@@ -930,6 +974,50 @@ window.__ModuleLoader__.load({
930
974
  .dsv-fallback-label { white-space: nowrap; }
931
975
  html[data-dsv-performance="1"] .dsv-fallback-launcher { box-shadow: none; }
932
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
+
933
1021
  /* ---- 0.5.0 launcher: the sidebar footer menu and the multi-select
934
1022
  "add split" dialog. Both mount through the shell overlay seat, so they
935
1023
  are never clipped by the sidebar column or the split overlay. ---- */
@@ -961,7 +1049,7 @@ window.__ModuleLoader__.load({
961
1049
  @keyframes dsv-launcher-in { from { opacity: 0; transform: translateY(4px); } }
962
1050
 
963
1051
  .dsv-modal-backdrop {
964
- position: fixed; inset: 0; z-index: 150;
1052
+ position: fixed; inset: 0; z-index: 2147483002;
965
1053
  display: flex; align-items: center; justify-content: center;
966
1054
  background: rgba(0, 0, 0, 0.32);
967
1055
  animation: dsv-fade-in 0.12s ease-out;
@@ -1092,10 +1180,9 @@ window.__ModuleLoader__.load({
1092
1180
  @media (prefers-reduced-motion: reduce) {
1093
1181
  .dsv-float-window { animation: none; transition: none; }
1094
1182
  }
1095
- /* ---- standalone system window (hash dsvWindow=<id>): one conversation
1096
- fills the whole page, rendered into the separate OS/browser window the
1097
- Host route opened. The window chrome (close/minimize/zoom/fullscreen)
1098
- is the native window's own. ---- */
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. ---- */
1099
1186
  html[data-dsv-standalone] { overflow: hidden; }
1100
1187
  html[data-dsv-standalone] body { overflow: hidden; }
1101
1188
  .dsv-standalone {
@@ -1113,6 +1200,38 @@ window.__ModuleLoader__.load({
1113
1200
  flex: 1; min-width: 0; min-height: 0;
1114
1201
  border: 0; border-radius: 0; box-shadow: none;
1115
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
+ }
1116
1235
  .dsv-standalone .dsv-pane-header { height: 40px; }
1117
1236
  /* One title per pane: the pane header owns it. The stock header keeps its
1118
1237
  view tabs and action rows but not its breadcrumb; the slim header's own
@@ -2010,7 +2129,7 @@ window.__ModuleLoader__.load({
2010
2129
  .dsv-help-title { font-size: 13px; font-weight: 600; margin-bottom: 6px; display: flex; align-items: center; gap: 8px; }
2011
2130
  /* fixed variant: used by the inactive "could not start" chip path, where
2012
2131
  the plugin overlay (the card's normal containing block) is not rendered */
2013
- .dsv-help-card-fixed { position: fixed; bottom: 56px; z-index: 95; }
2132
+ .dsv-help-card-fixed { position: fixed; bottom: 56px; z-index: 2147482999; }
2014
2133
  .dsv-help-row { display: flex; gap: 10px; padding: 2px 0; }
2015
2134
  .dsv-help-keys {
2016
2135
  flex: none; min-width: 150px; font-family: ui-monospace, SFMono-Regular, Consolas, "Courier New", monospace;
@@ -2018,6 +2137,37 @@ window.__ModuleLoader__.load({
2018
2137
  }
2019
2138
  .dsv-help-body { color: var(--dsw-alias-label-secondary); white-space: pre-wrap; overflow-wrap: anywhere; }
2020
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
+ }
2021
2171
  .dsv-pane-error {
2022
2172
  flex: 1; min-height: 0; display: flex; flex-direction: column; align-items: center;
2023
2173
  justify-content: center; gap: 8px; padding: 20px; text-align: center;
@@ -2091,6 +2241,25 @@ window.__ModuleLoader__.load({
2091
2241
  .dsv-update-chip-btn.accent { background: var(--dsw-static-deepseek-500); border-color: transparent; color: #fff; }
2092
2242
  .dsv-update-chip-btn:hover { background: var(--dsw-alias-interactive-bg-hover); }
2093
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
+ }
2094
2263
  `;
2095
2264
 
2096
2265
  function insertStyle(css) {
@@ -2241,6 +2410,10 @@ window.__ModuleLoader__.load({
2241
2410
  minimized: readMinimized(),
2242
2411
  performance: readPerformanceMode(),
2243
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,
2244
2417
  };
2245
2418
  const runtimeListeners = new Set();
2246
2419
  function runtimeSnapshot() {
@@ -2266,6 +2439,9 @@ window.__ModuleLoader__.load({
2266
2439
  notifyRuntime();
2267
2440
  return runtimeState;
2268
2441
  }
2442
+ /** The same runtime state as a store object, for context-menu observes. */
2443
+ const runtimeStore = { getSnapshot: runtimeSnapshot, subscribe: runtimeSubscribe };
2444
+
2269
2445
  /** The plugin's own state store as a hook (safe before apply() runs). */
2270
2446
  function useRuntime() {
2271
2447
  return React.useSyncExternalStore(runtimeSubscribe, runtimeSnapshot, runtimeSnapshot);
@@ -2441,6 +2617,7 @@ window.__ModuleLoader__.load({
2441
2617
  panes: (() => { try { return treeStore.leafIds().length; } catch { return 0; } })(),
2442
2618
  floats: (() => { try { return floatStore.ids(); } catch { return []; } })(),
2443
2619
  floatLayerMounted: floatLayerMounted,
2620
+ appWindow: runtimeState.appWindow === null ? null : Object.assign({}, runtimeState.appWindow),
2444
2621
  blockedReason: (() => { try { return blockedReason(); } catch { return "unknown"; } })(),
2445
2622
  failures: runtimeState.failures,
2446
2623
  lastError: runtimeState.lastError,
@@ -3316,6 +3493,7 @@ window.__ModuleLoader__.load({
3316
3493
  detached first so the same conversation is never hosted twice. */
3317
3494
  function floatSession(sessionId) {
3318
3495
  if (!isValidSessionId(sessionId)) return false;
3496
+ closeAppWindowFor(sessionId);
3319
3497
  prepareExplicitSplit();
3320
3498
  if (floatStore.has(sessionId)) {
3321
3499
  floatStore.focus(sessionId);
@@ -3385,44 +3563,18 @@ window.__ModuleLoader__.load({
3385
3563
  } catch {}
3386
3564
  }
3387
3565
 
3388
- /** Ask the Host for the authenticated standalone URL and open it as a real
3389
- separate window. In Desktop the app's window-open handler forwards
3390
- http/https to the system browser (the only OS window a renderer plugin
3391
- can create here); in Web mode `window.open` opens a browser window.
3392
- A blank window is pre-opened in Web mode so the async Host round-trip
3393
- cannot lose the user-gesture popup permission. */
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. */
3394
3572
  function openSystemWindow(sessionId) {
3395
3573
  if (!isValidSessionId(sessionId)) return Promise.resolve(false);
3396
- let preopened = null;
3397
- if (typeof window.dshDesktop === "undefined") {
3398
- try { preopened = window.open("", "_blank"); } catch { preopened = null; }
3399
- }
3400
- const fail = () => {
3401
- try { if (preopened !== null && preopened.closed !== true) preopened.close(); } catch {}
3402
- showPaneToast(t("systemWindowFailed"), true);
3403
- return false;
3404
- };
3405
- return fetch("/dsv/system-window", {
3406
- method: "POST",
3407
- headers: { "content-type": "application/json" },
3408
- body: JSON.stringify({ sessionId }),
3409
- }).then((response) => (response.ok ? response.json().catch(() => null) : null)).then((payload) => {
3410
- if (payload === null || payload === undefined || payload.ok !== true
3411
- || typeof payload.url !== "string" || payload.url === "") return fail();
3412
- try {
3413
- detachSessionForSystemWindow(sessionId);
3414
- if (preopened !== null && preopened.closed !== true) {
3415
- try { preopened.opener = null; } catch {}
3416
- preopened.location.href = payload.url;
3417
- } else {
3418
- window.open(payload.url, "_blank", "noopener,noreferrer");
3419
- }
3420
- showPaneToast(t("systemWindowOpened"), true);
3421
- return true;
3422
- } catch {
3423
- return fail();
3424
- }
3425
- }).catch(() => fail());
3574
+ detachSessionForSystemWindow(sessionId);
3575
+ const opened = openAppWindow(sessionId);
3576
+ if (opened === true) showPaneToast(t("systemWindowOpened"), true);
3577
+ return Promise.resolve(opened === true);
3426
3578
  }
3427
3579
 
3428
3580
  let floatLayerMounted = false;
@@ -9162,7 +9314,7 @@ window.__ModuleLoader__.load({
9162
9314
  return zone.side === "before" ? { top: 4, left: 4, right: 4, height: "50%" } : { bottom: 4, left: 4, right: 4, height: "50%" };
9163
9315
  }
9164
9316
 
9165
- 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 }) {
9166
9318
  const runtime = useRuntime();
9167
9319
  const performanceMode = runtime.performance === true;
9168
9320
  const maximized = runtime.maximized === sessionId;
@@ -9590,7 +9742,16 @@ window.__ModuleLoader__.load({
9590
9742
  }
9591
9743
  } catch {}
9592
9744
  };
9593
- 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
9594
9755
  ? [
9595
9756
  actionButton("copy", t("copy"), "⧉", doCopy),
9596
9757
  actionButton("help", t("helpOpen"), "?", doHelp),
@@ -9780,7 +9941,14 @@ window.__ModuleLoader__.load({
9780
9941
  onPointerUp: floating === true ? endFloatGesture : undefined,
9781
9942
  onPointerCancel: floating === true ? endFloatGesture : undefined,
9782
9943
  title: floating === true ? t("floatHint") : title,
9783
- 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
9784
9952
  ? (event) => {
9785
9953
  const target = event.target;
9786
9954
  if (target !== null && target !== undefined && typeof target.closest === "function"
@@ -9868,7 +10036,14 @@ window.__ModuleLoader__.load({
9868
10036
  className: "dsv-pane-menu",
9869
10037
  onPointerDown: (event) => event.stopPropagation(),
9870
10038
  },
9871
- ...(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 ? [
9872
10047
  menuItem("copy", t("copy"), () => { setMenuOpen(false); doCopy(); }),
9873
10048
  menuItem("help", t("helpOpen"), () => { setMenuOpen(false); doHelp(); }),
9874
10049
  menuItem("fullscreen", t("standaloneFullscreen"), () => { setMenuOpen(false); doFullscreen(); }),
@@ -9916,6 +10091,8 @@ window.__ModuleLoader__.load({
9916
10091
  && a.chrome === b.chrome
9917
10092
  && a.floating === b.floating
9918
10093
  && a.standalone === b.standalone
10094
+ && a.appWindow === b.appWindow
10095
+ && a.appWindowMaximized === b.appWindowMaximized
9919
10096
  && summaryShallowEqual(a.summary, b.summary),
9920
10097
  );
9921
10098
 
@@ -9930,7 +10107,7 @@ window.__ModuleLoader__.load({
9930
10107
  return dir === "h" ? { width: basis, height: "100%" } : { height: basis, width: "100%" };
9931
10108
  }
9932
10109
 
9933
- function RenderLeaf({ id, chrome, generation, floating, standalone }) {
10110
+ function RenderLeaf({ id, chrome, generation, floating, standalone, appWindow, appWindowMaximized }) {
9934
10111
  const state = useTree();
9935
10112
  const sessions = useSessionsList();
9936
10113
  const liveSummary = sessions !== null && sessions !== undefined && sessions.byId !== undefined ? sessions.byId[id] : undefined;
@@ -9952,13 +10129,15 @@ window.__ModuleLoader__.load({
9952
10129
  chrome: chrome !== false,
9953
10130
  floating: floating === true,
9954
10131
  standalone: standalone === true,
10132
+ appWindow: appWindow === true,
10133
+ appWindowMaximized: appWindowMaximized === true,
9955
10134
  focused: floating !== true && standalone !== true && state.focus === id,
9956
10135
  onFocus: floating === true ? (sid) => { floatStore.focus(sid); } : (sid) => treeStore.setFocus(sid),
9957
10136
  // Teardown is NOT done here any more: treeStore.commit schedules the
9958
10137
  // departed leaf for disposal and ChatPane releases on unmount, so every
9959
10138
  // leaf-mutation path (✕, sidebar swap, closeFocused, movePane) is
9960
10139
  // covered by the same idempotent path.
9961
- onClose: floating === true ? () => closeFloatWindow(id) : (sid) => closePaneAnimated(sid),
10140
+ onClose: floating === true ? () => closeFloatWindow(id) : appWindow === true ? () => closeAppWindow() : (sid) => closePaneAnimated(sid),
9962
10141
  pickerFor: floating === true || standalone === true ? () => {} : (...args) => togglePicker(...args),
9963
10142
  }));
9964
10143
  }
@@ -10550,10 +10729,30 @@ window.__ModuleLoader__.load({
10550
10729
  floats() {
10551
10730
  return safeCall("floats()", () => floatStore.ids(), []);
10552
10731
  },
10553
- /** Open one conversation in a separate system window (Host-backed URL). */
10732
+ /** Open one conversation in the app-internal independent window. */
10554
10733
  openSystemWindow(sessionId) {
10555
10734
  return safeCall("openSystemWindow()", () => openSystemWindow(sessionId), false);
10556
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
+ },
10557
10756
  /** Toggle performance mode (persisted; reduces animations/observers). */
10558
10757
  setPerformanceMode(flag) {
10559
10758
  return safeCall("setPerformanceMode()", () => setPerformanceMode(flag !== false), false);
@@ -11585,11 +11784,45 @@ window.__ModuleLoader__.load({
11585
11784
  );
11586
11785
  }
11587
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
+
11588
11820
  /** The one help card: opened by the pane header "?" and by the blocked
11589
11821
  chip. Lives inside the plugin overlay when active (fixed variant for the
11590
11822
  inactive chip path). */
11591
11823
  function HelpCard({ fixed }) {
11592
11824
  const help = helpText();
11825
+ const [shot, setShot] = React.useState(null);
11593
11826
  return h("div", {
11594
11827
  className: "dsv-help-card" + (fixed === true ? " dsv-help-card-fixed" : ""),
11595
11828
  role: "dialog",
@@ -11612,6 +11845,18 @@ window.__ModuleLoader__.load({
11612
11845
  h("span", { className: "dsv-help-body" }, item.action),
11613
11846
  )),
11614
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,
11615
11860
  h("div", { className: "dsv-help-body", style: { marginTop: "6px" } }, t("helpDisable")),
11616
11861
  h("div", { className: "dsv-help-body", style: { marginTop: "2px" } }, t("helpDiagnostics")),
11617
11862
  h("div", { className: "dsv-help-body", style: { marginTop: "2px" } }, t("helpRestart")),
@@ -11856,24 +12101,19 @@ window.__ModuleLoader__.load({
11856
12101
 
11857
12102
  function SplitWorkspaceSeat(props) {
11858
12103
  const runtime = useRuntime();
11859
- // A standalone system window renders ONLY its conversation: no split
11860
- // workspace, no floats, no launcher. WorkspaceApp still mounts (hidden,
11861
- // inactive) because it publishes the root standard faces the pane host
11862
- // needs.
11863
- const standaloneId = standaloneSessionId();
11864
- if (standaloneId !== null) {
11865
- try { document.documentElement.setAttribute("data-dsv-standalone", "1"); } catch {}
11866
- const standaloneProps = Object.assign({}, props, { dsvStandalone: true });
11867
- return h(React.Fragment, null,
11868
- h(WorkspaceBoundary, { key: "workspace-" + runtime.epoch }, h(WorkspaceApp, standaloneProps)),
11869
- h(WorkspaceBoundary, { key: "standalone-" + runtime.epoch }, h(StandaloneSessionWindow, { sessionId: standaloneId })),
11870
- );
11871
- }
12104
+ const appWindowState = runtime.appWindow;
12105
+ const appWindowOpen = appWindowState !== null && appWindowState !== undefined && appWindowState.minimized !== true;
11872
12106
  return h(React.Fragment, null,
11873
- h(WorkspaceBoundary, { key: "workspace-" + runtime.epoch }, h(WorkspaceApp, props)),
12107
+ h(WorkspaceBoundary, { key: "workspace-" + runtime.epoch },
12108
+ h(WorkspaceApp, Object.assign({}, props, { dsvAppWindowOpen: appWindowOpen }))),
11874
12109
  h(PluginChrome, null),
11875
12110
  h(WorkspaceBoundary, { key: "floats-" + runtime.epoch }, h(FloatLayer, null)),
11876
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,
11877
12117
  h(UpdateNotice, null),
11878
12118
  );
11879
12119
  }
@@ -11907,10 +12147,10 @@ window.__ModuleLoader__.load({
11907
12147
  // The activation gate: >=2 panes AND the kill switch/safe mode allow it.
11908
12148
  // Everything below keys off this — observers, DOM scraping, the overlay.
11909
12149
  const minimized = runtime.minimized === true;
11910
- // A standalone system window never activates the split overlay: its whole
11911
- // page is owned by StandaloneSessionWindow.
11912
- const standaloneWindow = props.dsvStandalone === true;
11913
- const active = standaloneWindow !== true && leaves.length >= 2
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
11914
12154
  && runtime.enabled === true && runtime.safeMode !== true;
11915
12155
  const [picker, setPicker] = React.useState(pickerRequest);
11916
12156
  const [bounds, setBounds] = React.useState({ left: 0, right: 0, top: 0, bottom: 0, ok: false });
@@ -12864,6 +13104,7 @@ window.__ModuleLoader__.load({
12864
13104
  for (const id of Array.isArray(ids) ? ids : []) {
12865
13105
  if (!isValidSessionId(id) || ordered.indexOf(id) !== -1) continue;
12866
13106
  if (floatStore.has(id)) floatStore.remove(id);
13107
+ closeAppWindowFor(id);
12867
13108
  ordered.push(id);
12868
13109
  }
12869
13110
  if (ordered.length < 2) {
@@ -12884,6 +13125,7 @@ window.__ModuleLoader__.load({
12884
13125
  function addSessionToSplit(sessionId) {
12885
13126
  if (!isValidSessionId(sessionId)) return false;
12886
13127
  if (floatStore.has(sessionId)) floatStore.remove(sessionId);
13128
+ closeAppWindowFor(sessionId);
12887
13129
  const leaves = treeStore.leafIds();
12888
13130
  if (leaves.indexOf(sessionId) !== -1) {
12889
13131
  try { treeStore.setFocus(sessionId); } catch {}
@@ -13031,6 +13273,7 @@ window.__ModuleLoader__.load({
13031
13273
  chipDismissed: false,
13032
13274
  tipVisible: false,
13033
13275
  helpOpen: false,
13276
+ appWindow: null,
13034
13277
  });
13035
13278
  const resetEpoch = runtimeState.epoch;
13036
13279
  try {
@@ -13069,6 +13312,64 @@ window.__ModuleLoader__.load({
13069
13312
  }
13070
13313
  }
13071
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
+
13072
13373
  /** Contribute 加入分屏 / 退出分屏 to the stock session context menu. The
13073
13374
  service is looked up lazily: a host without ui-context-menu simply does
13074
13375
  not get the rows (nothing else changes). */
@@ -13088,43 +13389,13 @@ window.__ModuleLoader__.load({
13088
13389
  id: "split-workspace.session",
13089
13390
  target: "session",
13090
13391
  order: 350,
13091
- observe: () => [treeStore, pendingSplitStore, floatStore],
13392
+ observe: () => [treeStore, pendingSplitStore, floatStore, runtimeStore, nativeWindowStore],
13092
13393
  resolve: (target) => {
13093
13394
  const id = target !== null && target !== undefined ? target.sessionId : undefined;
13094
13395
  if (!isValidSessionId(id)) return [];
13095
- const inSplit = treeStore.leafIds().indexOf(id) !== -1;
13096
- const pending = pendingSplitStore.has(id);
13097
- const floating = floatStore.has(id);
13098
- return [
13099
- {
13100
- id: "add",
13101
- label: t("menuAddToSplit"),
13102
- disabled: inSplit || pending,
13103
- run: () => { if (floatStore.has(id)) dockFloatToSplit(id); else addSessionToSplit(id); },
13104
- },
13105
- {
13106
- id: "remove",
13107
- label: t("exitSplit"),
13108
- disabled: !inSplit && !pending,
13109
- run: () => { removeSessionFromSplit(id); },
13110
- },
13111
- {
13112
- id: "float",
13113
- label: t(floating ? "menuFloatClose" : "menuFloatOpen"),
13114
- separatorBefore: true,
13115
- run: () => {
13116
- if (floatStore.has(id)) closeFloatWindow(id);
13117
- else floatSession(id);
13118
- },
13119
- },
13120
- {
13121
- id: "system",
13122
- label: t("menuSystemWindow"),
13123
- separatorBefore: true,
13124
- failureLabel: t("systemWindowFailed"),
13125
- run: () => openSystemWindow(id),
13126
- },
13127
- ];
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(() => []);
13128
13399
  },
13129
13400
  });
13130
13401
  } catch (error) {
@@ -13402,10 +13673,83 @@ window.__ModuleLoader__.load({
13402
13673
  desktopShell()
13403
13674
  ? row("restart", "⏻", t("restartApp"), () => { closeLauncher(); openRestartDialog(); })
13404
13675
  : null,
13676
+ row("help", "?", t("helpOpen"), () => { closeLauncher(); openHelp(); }),
13405
13677
  row("reset", "↺", t("menuResetSplit"), () => { closeLauncher(); resetSplitEnvironment(); }, { danger: true }),
13406
13678
  );
13407
13679
  }
13408
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
+
13409
13753
  /** Fallback entry point when the stock sidebar footer does not render this
13410
13754
  plugin's action (collapsed/absent sidebar, a layout that replaces the
13411
13755
  footer, or an older host whose footer slot is empty). The launcher menu
@@ -13511,6 +13855,8 @@ window.__ModuleLoader__.load({
13511
13855
  const floats = useFloats();
13512
13856
  const windows = floats.windows;
13513
13857
  const count = windows.length;
13858
+ const appWindow = runtime.appWindow;
13859
+ const appWindowOpen = appWindow !== null && appWindow !== undefined && appWindow.minimized !== true;
13514
13860
  React.useEffect(() => {
13515
13861
  if (runtime.enabled !== true || count === 0) return undefined;
13516
13862
  floatLayerMounted = true;
@@ -13542,7 +13888,7 @@ window.__ModuleLoader__.load({
13542
13888
  }
13543
13889
  };
13544
13890
  }, [count, runtime.performance]);
13545
- if (runtime.enabled !== true || count === 0) return null;
13891
+ if (runtime.enabled !== true || count === 0 || appWindowOpen) return null;
13546
13892
  // Stacking is a z-index swap, never a DOM reorder: moving a live editor
13547
13893
  // subtree (keyed React children) would blur the composer.
13548
13894
  const ranks = new Map();
@@ -13565,7 +13911,72 @@ window.__ModuleLoader__.load({
13565
13911
 
13566
13912
  /** Whole-page view used inside a standalone system window: one native
13567
13913
  conversation, native window controls, no split / floats / launcher. */
13568
- 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 }) {
13569
13980
  const runtime = useRuntime();
13570
13981
  const sessions = useSessionsList();
13571
13982
  const summary = sessions !== null && sessions !== undefined && sessions.byId !== undefined
@@ -13575,11 +13986,13 @@ window.__ModuleLoader__.load({
13575
13986
  ? (summary.displayTitle || summary.title || sessionId)
13576
13987
  : sessionId;
13577
13988
  React.useEffect(() => {
13989
+ const previous = document.title;
13578
13990
  try { document.title = title + " — DeepSeek Harness"; } catch {}
13991
+ return () => { try { document.title = previous; } catch {} };
13579
13992
  }, [title]);
13580
13993
  // The DOM session-list source normally observes only while a split is
13581
- // live. This page is a one-conversation workspace, so keep it warm for
13582
- // the title and the re-hosted header.
13994
+ // live. This surface is a one-conversation workspace, so keep it warm
13995
+ // for the title and the re-hosted header.
13583
13996
  React.useEffect(() => {
13584
13997
  const source = sessionsListSource;
13585
13998
  if (source === undefined || source === null || typeof source.setActive !== "function") return undefined;
@@ -13589,14 +14002,293 @@ window.__ModuleLoader__.load({
13589
14002
  try { source.setActive(false); } catch {}
13590
14003
  };
13591
14004
  }, []);
14005
+ const state = appWindowSnapshot();
13592
14006
  return h("div", {
13593
- className: "dsv-standalone",
14007
+ className: "dsv-standalone" + (embedded === true ? " dsv-standalone-embedded" : ""),
13594
14008
  "data-dsv-standalone-window": sessionId,
13595
14009
  },
13596
- 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
+ ),
13597
14037
  );
13598
14038
  }
13599
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
+ }
13600
14292
  function restoreSplit() {
13601
14293
  try {
13602
14294
  const tree = treeStore.getSnapshot();
@@ -13719,6 +14411,11 @@ window.__ModuleLoader__.load({
13719
14411
 
13720
14412
  ctx.effect(() => insertStyle(DSV_CSS), "dsh-split-workspace: stylesheet");
13721
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
+
13722
14419
  // Performance mode is a CSS class on <html>; mirror the persisted flag
13723
14420
  // on every apply so a reload keeps it.
13724
14421
  ctx.effect(() => {
@@ -13862,7 +14559,7 @@ window.__ModuleLoader__.load({
13862
14559
  activationMarked = false;
13863
14560
  failureWindow.length = 0;
13864
14561
  failureLog.clear();
13865
- setRuntime({ active: false, geometryBlocked: false, helpOpen: false, tipVisible: false });
14562
+ setRuntime({ active: false, geometryBlocked: false, helpOpen: false, tipVisible: false, appWindow: null });
13866
14563
  appliedOnce = false;
13867
14564
  },
13868
14565
  "dsh-split-workspace: service cleanup",
@@ -13882,6 +14579,21 @@ window.__ModuleLoader__.load({
13882
14579
  h(FooterSplitButton),
13883
14580
  ),
13884
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
+ );
13885
14597
  }
13886
14598
 
13887
14599
  // dsh 0.1.5: client services (sessions/locale) are provided asynchronously