dsh-split-workspace 0.8.0 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -49,7 +49,7 @@ dsh --profile web
49
49
 
50
50
  1. 打开 DSH Desktop,侧边栏 **插件市场**,搜索 `dsh-split-workspace` 并安装;或进入 **插件 → 添加插件 → 安装第三方插件**,填入包名。
51
51
  2. 打开 **设置 → 插件**,启用 `dsh-split-workspace`。
52
- 3. **完全退出并重开 DSH Desktop**,让新的客户端 bundle 生效。
52
+ 3. 安装完成后插件通常会被 DSH 的 HMR 立即加载,无需重启;如果几秒后侧边栏底部仍没有分屏图标,再完全退出并重开 DSH Desktop(插件加载后,菜单/更新提示也提供「重启 DSH」入口)。
53
53
 
54
54
  > 桌面端的 `desktop` profile 由 Electron 应用独占管理。不要在终端执行 `dsh plugin --profile desktop add ...`,该命令会拒绝执行;桌面端请用上面的插件市场 / 添加插件界面。
55
55
 
@@ -59,15 +59,15 @@ dsh --profile web
59
59
  2. DSH Desktop → **插件 → 添加插件 → 安装第三方插件**:
60
60
  - 优先填 `.tgz` 的**绝对路径**(安装器会识别为「压缩包」);
61
61
  - 如果当前版本只接受目录,先把 `.tgz` 解压,再填解压后的目录路径(目录根下要有 `package.json`)。
62
- 3. 在 **设置 → 插件** 启用,完全退出并重开 DSH Desktop。
62
+ 3. 在 **设置 → 插件** 启用;通常会被 HMR 立即加载。若侧边栏底部没有出现分屏图标,完全退出并重开 DSH Desktop,或使用插件菜单里的「重启 DSH」。
63
63
  4. 离线机器不需要网络;插件运行时不联网。
64
64
 
65
65
  ### 启用与验证
66
66
 
67
- - 打开 **设置 → 插件**,确认 `dsh-split-workspace` 已启用;桌面端需完整重启,Web 端需重启 `dsh web` 并刷新。
67
+ - 打开 **设置 → 插件**,确认 `dsh-split-workspace` 已启用。DSH 0.2.x 会通过 HMR 热加载新安装的插件;如果没有出现界面,见下方「更新、重载与重启」。
68
68
  - 分屏入口:点击侧边栏底部(设置旁)的分屏图标,或把侧边栏里的会话拖到对话区。
69
69
  - 打开浏览器/桌面端控制台执行 `window.__dshSplitWorkspace.health()`,可看到版本、窗格数和几何状态。
70
- - 如果看不到分屏入口:确认至少有 2 个会话、插件未处于安全模式,并检查 DSH 版本是否匹配。
70
+ - 如果看不到分屏入口:确认插件已启用且没有报错;如果侧边栏底部的 footer 没有渲染,插件会在对话区左下角显示兜底的分屏按钮。
71
71
 
72
72
  ### 开始分屏
73
73
 
@@ -112,12 +112,12 @@ dsh --profile web
112
112
 
113
113
  ## 性能模式与卡顿排查
114
114
 
115
- 在侧边栏底部分屏按钮的菜单里点 **性能模式**(也可用 `window.__dshSplitWorkspace.setPerformanceMode(true)`,设置会持久化)。开启后:
115
+ **性能模式默认开启**(从 0.9.0 起;显式关过一次的保留关闭状态)。在侧边栏底部分屏按钮的菜单里点 **性能模式** 可切换(也可用 `window.__dshSplitWorkspace.setPerformanceMode(true/false)`,设置会持久化)。开启后:
116
116
 
117
117
  - 关闭所有窗格 / 浮窗 / 菜单 / 提示的动画、过渡、卡片阴影和焦点光晕,并停掉工具行跑马灯动画。
118
118
  - 关闭**每个窗格的 composer 几何测量 MutationObserver**。这是最可疑的开销之一:流式输出每个 token 都会改动窗格 DOM,旧逻辑会在每次改动时排队测量(`getBoundingClientRect` + 样式读取),窗格越多越明显;性能模式改为 ResizeObserver + 1.5s 轮询。
119
119
  - 暂停 TOC 握把同步(`dsh-prompt-history` 的 ☰ 定位)、压缩结果监听、浮窗位置巡检、右侧栏 800ms 轮询(保留 resize 监听),几何测量从 1s 降到 3.5s,侧栏会话扫描从 200ms 降到 1s。
120
- - 拖动窗格时不再克隆整段对话 DOM,只显示标题卡预览。
120
+ - 拖动会话/窗格时**完全不渲染缩略图预览**(不克隆对话 DOM,也没有逐帧移动的预览窗口);拖入目标、布局预览和放置反馈仍然保留。
121
121
  - 真实会话、输入、停止、审批、分屏 / 浮窗 / 系统窗口功能全部保留。
122
122
 
123
123
  **仍然可能卡的原因**:每个窗格都是一个完整的原生对话视图,N 个会话同时流式输出就是 N 份 React/DOM 渲染与滚动更新,这是 DSH 客户端本身的主要成本,插件无法消除(除非上游支持离屏暂停/虚拟化)。在 Windows + 低单核性能的机器上,建议同时保持 2–3 个活动窗格、少开浮窗、把不用的分屏最小化;输入框可切到紧凑 TUI 模式;如果装了 `dsh-prompt-history`,它的 TOC 同步在性能模式下会被暂停。
@@ -126,11 +126,19 @@ dsh --profile web
126
126
 
127
127
  ## 更新、重载与重启
128
128
 
129
- - DSH 桌面版的 profile **只在启动时应用插件/客户端变更**(插件管理器安装完会提示“请重启 DSH 使更改生效”)。刷新页面 / 重载界面**不能**加载新的插件 bundle:运行中更新会让该插件停在“等待重启”状态。
130
- - 更新后的正确操作:**退出 DSH 并重新打开**(Windows 从托盘 / 开始菜单彻底退出;macOS 用 ⌘Q)。
131
- - 本插件会尽量提醒:从 0.8.0 起,运行中的宿主会读取磁盘上的 `package.json`;一旦发现版本比当前页面新,右下角出现 **“已安装 vX,请重启 DSH 后生效”**,点 **知道了** 可关闭该版本的提醒。首次安装时插件客户端尚未加载,只能按 DSH 插件管理器的提示重启。
132
- - 底部菜单的 **刷新界面** 只重新加载页面(适合浮层卡住、布局异常),不会应用插件更新;Web 版可以用它加载新的客户端 bundle。
133
- - Host 半边(新增 HTTP 路由等)同样需要完整重启 DSH。
129
+ DSH 0.2.x(含 Desktop 0.2.2-rc.3)带 HMR:新安装的插件会被热加载,重建后的客户端 bundle 也会自动替换,**大多数安装/更新不需要重启 DSH**。以下情况才需要重启:
130
+
131
+ - 插件管理器明确提示 `restart-required`(Host 半边、被链接包的宿主模块发生变化,或包目录被移动);
132
+ - 安装后侧边栏底部几秒内没有出现分屏图标(少数没有 HMR 的旧版 DSH)。
133
+
134
+ DSH **生产版没有内置的“重启”菜单项**(开发版才有 `Restart App and Host`)。从本插件的 0.9.0 起:
135
+
136
+ - 侧边栏底部 **分屏菜单 → 重启 DSH**:先确认(运行中的任务会中断),再由 Host 半调用系统级“退出并重新打开”(macOS 通过 AppleScript 正常退出,Windows 关闭窗口后终止进程并重启)。
137
+ - 检测到磁盘版本比页面新时,右下角的更新提示直接提供 **重启 DSH** 按钮;Web 版提供 **刷新页面**。
138
+ - 也可以用 `window.__dshSplitWorkspace.restartApp()`,或按老办法手动退出后重新打开:Windows 从托盘/开始菜单彻底退出,macOS 用 ⌘Q。
139
+ - 底部菜单的 **刷新界面** 只重新加载页面(适合浮层卡住、布局异常),不会应用需要重启的 Host 变化。
140
+ - 首次安装时插件客户端可能尚未加载,因此插件自身无法显示重启按钮;插件管理器会在安装结果里提示重启,按提示或手动退出重开即可。
141
+ - **安装后看不到分屏入口时,先尝试刷新页面而不是重启**:DSH Desktop 生产版没有页面刷新菜单,但自带 **开发者工具**(macOS `⌘⌥I`,Windows `Ctrl+Shift+I`,或菜单 View → Toggle Developer Tools);在开发者工具里点刷新按钮、按 `⌘R` / `F5`,或在 Console 执行 `location.reload()`,都会重新加载页面并取回最新的插件图,通常无需重启 DSH。仍不生效再完全退出重开。
134
142
 
135
143
  ## 功能
136
144
 
@@ -140,8 +148,9 @@ dsh --profile web
140
148
  - **浮窗模式**:右键会话 → 「进入浮窗」,把会话变成可拖动、可缩放的独立窗口;标题栏 ⇲ 放回分屏、✕ 关闭,浮窗位置/大小/层叠顺序持久化。
141
149
  - **分屏 ⇄ 浮窗双向切换**:同一会话互斥存在于一种形态;进入浮窗自动移出分屏,回到分屏自动关闭浮窗。
142
150
  - **系统窗口**:右键会话 → 「在系统窗口打开」,在系统默认浏览器中打开只含该会话的独立窗口;原生关闭 / 最小化 / 最大化 / 全屏,打开时自动从分屏和浮窗移出。
143
- - **性能模式**:一键关闭动画、阴影、跑马灯和多个后台轮询/观察器,适合低配或 Windows 上多窗格卡顿的场景;设置持久化。
144
- - **更新提示 / 刷新界面**:检测到磁盘上的新版本时右下角提示「请重启 DSH 后生效」,分屏菜单提供「刷新界面」快捷入口(只刷新 UI,不应用插件更新)。
151
+ - **性能模式(默认开启)**:一键关闭动画、阴影、跑马灯和多个后台轮询/观察器,适合低配或 Windows 上多窗格卡顿的场景;设置持久化。性能模式下**不再渲染拖动会话时的缩略图预览**(拖入目标与放置反馈保留),可以再明显减少拖动时的 DOM/合成开销。
152
+ - **更新提示 / 重启 DSH / 刷新界面**:检测到磁盘上的新版本时右下角提示,并提供「重启 DSH」(桌面版)或「刷新页面」(Web 版);分屏菜单同时提供「刷新界面」与「重启 DSH」。
153
+ - **兜底分屏入口**:如果所在 DSH 布局没有渲染侧边栏 footer(或 footer 被隐藏),插件会在对话区左下角显示一个分屏按钮,保证菜单仍可打开。
145
154
  - **一键重置**:清空插件相关的 localStorage / sessionStorage、布局、崩溃保护和临时缓存,避免异常状态卡住分屏。
146
155
  - **不限数量的原生窗格**:没有四窗格上限,窗口放得下多少会话就能开多少。
147
156
  - **自动布局**:2 个窗格左右分栏,3 个呈 L 形,4 个田字 2×2,5 个以上按行优先的均衡网格排列。
@@ -184,7 +193,8 @@ dsh --profile web
184
193
  - `window.__dshSplitWorkspace.openSystemWindow(sessionId)`:在系统窗口打开该会话(宿主生成已认证 URL)。
185
194
  - `window.__dshSplitWorkspace.setPerformanceMode(true/false)`:开关性能模式(持久化)。
186
195
  - `window.__dshSplitWorkspace.performanceMode()`:当前是否处于性能模式。
187
- - `window.__dshSplitWorkspace.reloadClient()`:刷新页面(桌面版不会加载新的插件 bundle,更新需重启 DSH)。
196
+ - `window.__dshSplitWorkspace.reloadClient()`:刷新页面。
197
+ - `window.__dshSplitWorkspace.restartApp()`:退出并重新打开 DSH 桌面版(需要完整重启时使用)。
188
198
  - `window.__dshSplitWorkspace.pending()`:当前待分屏的会话 id。
189
199
  - `window.__dshSplitWorkspace.openAddSplitDialog()`:打开多选添加分屏弹框。
190
200
  - `window.__dshSplitWorkspace.arrange("auto")`:重新适配自动布局(旧模式名会被接受并忽略)。
@@ -323,7 +333,7 @@ dsh --profile web
323
333
 
324
334
  1. Open DSH Desktop → **Plugin market** in the sidebar, search for `dsh-split-workspace`, and install it. Or use **Plugins → Add plugin → Install a third-party plugin** and enter the package name.
325
335
  2. Open **Settings → Plugins** and enable `dsh-split-workspace`.
326
- 3. **Quit and reopen DSH Desktop completely** so the new client bundle is loaded.
336
+ 3. DSH's HMR normally loads a newly installed plugin immediately, so no restart is needed. If the split icon still does not appear in the sidebar footer after a few seconds, quit and reopen DSH Desktop completely (the plugin menu and update chip also offer **Restart DSH**).
327
337
 
328
338
  > The `desktop` profile is owned by the Electron app. Do **not** run `dsh plugin --profile desktop add ...` in a terminal; it is rejected. Use the in-app plugin market / Add plugin UI instead.
329
339
 
@@ -333,15 +343,15 @@ dsh --profile web
333
343
  2. DSH Desktop → **Plugins → Add plugin → Install a third-party plugin**:
334
344
  - prefer the **absolute path to the `.tgz`** (the installer recognises it as a tarball);
335
345
  - if that build only accepts directories, extract the `.tgz` and enter the extracted directory (its root must contain `package.json`).
336
- 3. Enable it in **Settings → Plugins**, then quit and reopen DSH Desktop.
346
+ 3. Enable it in **Settings → Plugins**; HMR usually loads it immediately. If the footer split icon does not appear, quit and reopen DSH Desktop, or use **Restart DSH** in the plugin menu.
337
347
  4. The offline machine needs no network access; the plugin makes no runtime requests.
338
348
 
339
349
  **Enable and verify**
340
350
 
341
- - **Settings → Plugins** must show `dsh-split-workspace` enabled. Restart Desktop completely, or restart `dsh web` and refresh the page for Web.
351
+ - **Settings → Plugins** must show `dsh-split-workspace` enabled. DSH 0.2.x hot-loads newly installed plugins through HMR; if the UI still does not appear, see “Updates, reload and restart”.
342
352
  - Entry points: the split icon in the sidebar footer (beside Settings), or drag a conversation from the sidebar onto the conversation column.
343
353
  - Run `window.__dshSplitWorkspace.health()` in the browser/desktop console to see the version, pane count and geometry.
344
- - If the split entry is missing: make sure at least two sessions exist, the plugin is not in safe mode, and re-check the enable/restart steps.
354
+ - If the split entry is missing: make sure the plugin is enabled and has no error. When the stock sidebar footer does not render this plugin's action, the plugin shows a fallback split button at the conversation area's bottom-left corner.
345
355
 
346
356
  **Start splitting**
347
357
 
@@ -425,8 +435,10 @@ logic stays unchanged.
425
435
 
426
436
  ### Performance mode and lag analysis
427
437
 
428
- Open the sidebar-footer split menu and pick **Performance mode** (or run
429
- `window.__dshSplitWorkspace.setPerformanceMode(true)`; it persists). It turns off:
438
+ **Performance mode is ON by default** since 0.9.0 (an explicit off choice is
439
+ kept). Open the sidebar-footer split menu and pick **Performance mode**, or run
440
+ `window.__dshSplitWorkspace.setPerformanceMode(true/false)`; it persists. It
441
+ turns off:
430
442
 
431
443
  - every pane / float / menu / chip animation, transition, card shadow, focus
432
444
  glow and running-row shimmer;
@@ -438,7 +450,9 @@ Open the sidebar-footer split menu and pick **Performance mode** (or run
438
450
  position polling and the 800 ms right-sidebar poll (resize listeners stay);
439
451
  geometry polling drops from 1 s to 3.5 s and sidebar session scraping from
440
452
  200 ms to 1 s;
441
- - pane-drag previews no longer clone the conversation DOM — only the title card.
453
+ - the floating drag-preview thumbnail for sessions and panes is not rendered at
454
+ all — no DOM clone, no per-frame thumbnail positioning; drop targets and the
455
+ layout reflow hole still work.
442
456
 
443
457
  Real conversations, composers, approval flows, split/float/system-window
444
458
  features all stay available.
@@ -454,21 +468,37 @@ compare DevTools Performance long tasks with the mode on/off.
454
468
 
455
469
  ### Updates, reload and restart
456
470
 
457
- - A DSH Desktop profile **applies plugin/client changes only at startup** (the
458
- plugin manager says “restart DSH to apply”). Refreshing the page / reloading
459
- the interface **cannot** load a new plugin bundle: updating while running
460
- parks the plugin in a restart-required state.
461
- - The correct update step is to **quit DSH completely and reopen it** (Windows:
462
- exit from the tray/Start menu; macOS: ⌘Q).
463
- - The plugin reminds you when it can: from 0.8.0 the running Host reads the
464
- on-disk `package.json`, and when it sees a version newer than the page it
465
- shows “Version vX is installed — restart DSH to apply” with **Got it** to
466
- dismiss that version. A fresh install cannot show this because the plugin
467
- client is not loaded yet — follow the built-in manager notice and restart.
468
- - The launcher's **Refresh interface** only reloads the page (useful for a stuck
469
- overlay or layout glitch); it does not apply plugin updates. In the Web
470
- profile it does load a new client bundle.
471
- - Host-half changes (new HTTP routes, etc.) also require a full DSH restart.
471
+ DSH 0.2.x (including Desktop 0.2.2-rc.3) ships HMR: a newly installed plugin is
472
+ hot-loaded, and a rebuilt client bundle is swapped into the open page. Most
473
+ installs/updates therefore need **no restart**. A restart is only needed when:
474
+
475
+ - the plugin manager reports `restart-required` (Host-half or linked-package
476
+ host modules changed, or the package directory moved);
477
+ - the footer split icon still has not appeared a few seconds after install (some
478
+ older DSH builds without HMR).
479
+
480
+ Production DSH has **no built-in Restart menu item** (development builds do).
481
+ Since dsh-split-workspace 0.9.0:
482
+
483
+ - **Split menu → Restart DSH** confirms first (running tasks are interrupted),
484
+ then the Host half closes and reopens the desktop app at the OS level (a
485
+ normal AppleScript quit on macOS; close-then-terminate and relaunch on
486
+ Windows).
487
+ - The update chip offers **Restart DSH** on Desktop and **Reload page** in the
488
+ Web GUI.
489
+ - `window.__dshSplitWorkspace.restartApp()` does the same. Manually: Windows —
490
+ quit from the tray/Start menu; macOS — ⌘Q; then open DSH again.
491
+ - **Refresh interface** only reloads the page (useful for a stuck overlay or a
492
+ layout glitch); it does not apply changes that need a full restart.
493
+ - On a first install the plugin client is not running yet, so it cannot show
494
+ its own restart button; follow the plugin manager's restart notice or quit
495
+ and reopen DSH manually.
496
+ - **If the split entry is missing after a hot install, try a page reload before a
497
+ restart**: production DSH has no Reload menu item, but it ships Developer
498
+ Tools (macOS `⌘⌥I`, Windows `Ctrl+Shift+I`, or View → Toggle Developer Tools).
499
+ Use the reload button in Developer Tools, press `⌘R` / `F5`, or run
500
+ `location.reload()` in its Console to reload the page and fetch the current
501
+ plugin graph — usually no DSH restart is needed. Quit and reopen only if that still fails.
472
502
 
473
503
  ### Features
474
504
 
@@ -478,8 +508,9 @@ compare DevTools Performance long tasks with the mode on/off.
478
508
  - **Floating windows** — right-click a conversation → Enter floating window turns it into a movable, resizable window; Dock to split / ✕ in its header switch it back or close it, and geometry persists.
479
509
  - **Split ⇄ float switching** — one conversation lives in exactly one mode; entering a float detaches it from the split, docking it back closes the float.
480
510
  - **System window** — right-click → Open in system window opens the conversation alone in a separate OS window (the default browser on Desktop) with native close / minimize / maximize / fullscreen; it is detached from split and float first.
481
- - **Performance mode** — one switch drops animations, shadows, shimmer and several background observers/polls for low-power or laggy Windows machines; the setting persists.
482
- - **Update chip / refresh interface** — a newer on-disk version shows a corner chip asking for a DSH restart, and the split menu offers Refresh interface (UI reload only, not a plugin update).
511
+ - **Performance mode (on by default)** — one switch drops animations, shadows, shimmer and several background observers/polls for low-power or laggy Windows machines; the setting persists. In this mode the floating drag-preview thumbnail is not rendered at all (drop targets and placement feedback stay).
512
+ - **Update chip / Restart DSH / Refresh interface** — a newer on-disk version shows a corner chip with **Restart DSH** on Desktop or **Reload page** in the Web GUI; the split menu also offers Restart DSH and Refresh interface.
513
+ - **Fallback split entry** — when the host layout does not render the sidebar footer action (or hides it), the plugin shows a split button at the conversation area's bottom-left corner so the menu stays reachable.
483
514
  - **One-click reset** — wipes plugin localStorage/sessionStorage, layout, crash guard and temporary caches.
484
515
  - **Unlimited native panes** — no four-pane cap; add as many conversations as
485
516
  the window can show.
@@ -579,8 +610,9 @@ architecture the upstream plugin uses.
579
610
  conversation in a separate system window (Host-minted authenticated URL).
580
611
  - `window.__dshSplitWorkspace.setPerformanceMode(true/false)` /
581
612
  `performanceMode()` — toggle/inspect the persisted performance mode.
582
- - `window.__dshSplitWorkspace.reloadClient()` — reload the page (on Desktop this
583
- does not load a new plugin bundle; restart DSH to update).
613
+ - `window.__dshSplitWorkspace.reloadClient()` — reload the page.
614
+ - `window.__dshSplitWorkspace.restartApp()` — close and reopen DSH Desktop
615
+ (for the rare changes that need a full restart).
584
616
  - `window.__dshSplitWorkspace.pending()` — conversations waiting for a second
585
617
  pick before the split starts.
586
618
  - `window.__dshSplitWorkspace.openAddSplitDialog()` — open the multi-select add
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.9.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";
@@ -128,9 +128,11 @@ window.__ModuleLoader__.load({
128
128
  storageSet(MIN_KEY, value === true ? "1" : "0");
129
129
  }
130
130
  /** Performance mode is a persisted, user-visible preference: it trades
131
- optional observers / animations for responsiveness on slow machines. */
131
+ optional observers / animations for responsiveness on slow machines.
132
+ It is ON by default; only an explicit "0" turns it off, so existing
133
+ users who already chose the fast mode keep a normal experience. */
132
134
  function readPerformanceMode() {
133
- return storageGet(PERF_KEY) === "1";
135
+ return storageGet(PERF_KEY) !== "0";
134
136
  }
135
137
  function writePerformanceMode(value) {
136
138
  storageSet(PERF_KEY, value === true ? "1" : "0");
@@ -330,6 +332,12 @@ window.__ModuleLoader__.load({
330
332
 
331
333
  function beginDragPreview(title, hint, sourceEl, size) {
332
334
  endDragPreview();
335
+ // Performance mode: the floating preview is the expensive part of a
336
+ // drag. It clones (or builds) a whole conversation window and moves it
337
+ // with the pointer on every frame, so the fast mode skips it entirely.
338
+ // Dragging still works: the drop target and the reflow hole stay, only
339
+ // the thumbnail preview disappears.
340
+ if (performanceModeOn()) return;
333
341
  // A pane drag carries a real miniature of the conversation window: clone
334
342
  // the live pane, scale it down, and hold the clone as the floating
335
343
  // preview. Sidebar drags of an already-open session find their pane the
@@ -341,8 +349,7 @@ window.__ModuleLoader__.load({
341
349
  if (pane === null && sourceEl.nodeType === 1 && sourceEl.classList && sourceEl.classList.contains("dsv-pane")) pane = sourceEl;
342
350
  }
343
351
  } catch {}
344
- const simpleOnly = (typeof window !== "undefined" && window.__DSV_SIMPLE_PREVIEW === true)
345
- || performanceModeOn();
352
+ const simpleOnly = typeof window !== "undefined" && window.__DSV_SIMPLE_PREVIEW === true;
346
353
  const realThumb = typeof window !== "undefined" && window.__DSV_REAL_THUMB === true;
347
354
  try {
348
355
  if (simpleOnly !== true && pane !== null && pane !== undefined) {
@@ -573,6 +580,7 @@ window.__ModuleLoader__.load({
573
580
  helpGestures: "Use the sidebar-footer split menu (Add split / Exit split / Minimize / Reset split) or drag a conversation from the sidebar onto the page to start a split. Right-click a conversation for Add to split / Leave split / Enter floating window; a floating window's Dock to split button puts it back. Drag a pane by its header to move it: its slot closes and a dashed hole previews where it will land. Drag the dividers to resize. ✕ closes a pane.",
574
581
  helpDisable: "Disable split view: run window.__dshSplitWorkspace.setEnabled(false), or set localStorage 'dsh.split-workspace.enabled.v1' to \"0\". Reset the layout: window.__dshSplitWorkspace.reset().",
575
582
  helpDiagnostics: "Diagnostics: window.__dshSplitWorkspace.health() — see the README section “Safety, recovery and diagnostics”.",
583
+ helpRestart: "If an update or a full-restart change does not take effect, open the split menu and choose “Restart DSH” (Desktop), or quit DSH and open it again. Installed plugins are normally loaded live by DSH's HMR; the restart entry is the fallback.",
576
584
  tipTitle: "Split view is on",
577
585
  tipBody: "Alt+T toggles the compact composer · Alt+Shift+←/→/↑/↓ moves between panes · drag a conversation from the sidebar to split · ✕ closes a pane. To turn split view off, run window.__dshSplitWorkspace.setEnabled(false).",
578
586
  compactionDone: "Context compacted — the summary is in the conversation.",
@@ -626,8 +634,16 @@ window.__ModuleLoader__.load({
626
634
  performanceOff: "Performance mode off",
627
635
  reloadClient: "Reload interface",
628
636
  refreshInterface: "Refresh interface",
637
+ restartApp: "Restart DSH",
638
+ restartTitle: "Restart DSH?",
639
+ restartBody: "This closes and reopens DeepSeek Harness so newly installed plugins and changes that need a full restart can load. Running tasks will be interrupted.",
640
+ restartNow: "Restart now",
641
+ restarting: "Restarting DSH…",
642
+ restartFailed: "Could not restart DSH automatically — quit DSH and open it again.",
643
+ restartUnsupported: "Automatic restart is available in DSH Desktop. In a browser, reload the page or restart the `dsh web` process.",
644
+ fallbackLauncher: "Split view",
629
645
  updateReady: "Version {v} is installed — reload to apply",
630
- updateRestart: "Version {v} is installed — restart DSH to apply",
646
+ updateRestart: "Version {v} is installed — if the interface did not update, restart DSH",
631
647
  reloadNow: "Reload now",
632
648
  gotIt: "Got it",
633
649
  laterLabel: "Later",
@@ -689,6 +705,7 @@ window.__ModuleLoader__.load({
689
705
  helpGestures: "点击侧边栏底部的分屏按钮打开菜单(添加分屏 / 退出分屏 / 最小化分屏 / 重置分屏),或从左侧会话列表把对话拖到页面即可分屏;右键会话可加入 / 退出分屏,也可以“进入浮窗”把会话变成独立浮窗(浮窗标题栏的“回到分屏”可放回)。拖住面板标题栏可移动面板:原位置收起,虚线空位预览落点。拖动分隔条可调整大小,✕ 关闭面板。",
690
706
  helpDisable: "停用分屏:运行 window.__dshSplitWorkspace.setEnabled(false),或将 localStorage 'dsh.split-workspace.enabled.v1' 设为 \"0\"。重置布局:window.__dshSplitWorkspace.reset()。",
691
707
  helpDiagnostics: "诊断:window.__dshSplitWorkspace.health() — 详见 README“安全性、恢复与诊断”。",
708
+ helpRestart: "如果更新或需要完整重启的更改没有生效,可打开分屏菜单选择“重启 DSH”(桌面版),或退出 DSH 后重新打开。DSH 的 HMR 通常会自动加载已安装的插件;重启入口是兜底方案。",
692
709
  tipTitle: "分屏视图已开启",
693
710
  tipBody: "Alt+T 切换紧凑输入行 · Alt+Shift+←/→/↑/↓ 切换面板 · 从左侧拖入对话可分屏 · ✕ 关闭面板。如需停用,运行 window.__dshSplitWorkspace.setEnabled(false)。",
694
711
  compactionDone: "上下文已压缩 — 摘要已写入对话。",
@@ -742,8 +759,16 @@ window.__ModuleLoader__.load({
742
759
  performanceOff: "性能模式已关闭",
743
760
  reloadClient: "重载界面",
744
761
  refreshInterface: "刷新界面",
762
+ restartApp: "重启 DSH",
763
+ restartTitle: "重启 DSH?",
764
+ restartBody: "将关闭并重新打开 DeepSeek Harness,以加载新安装的插件或需要完整重启的更改。正在运行的任务会被中断。",
765
+ restartNow: "立即重启",
766
+ restarting: "正在重启 DSH…",
767
+ restartFailed: "无法自动重启 DSH,请退出 DSH 后重新打开。",
768
+ restartUnsupported: "自动重启仅支持 DSH 桌面版;浏览器中请刷新页面或重启 dsh web 进程。",
769
+ fallbackLauncher: "分屏视图",
745
770
  updateReady: "已安装 v{v},刷新页面生效",
746
- updateRestart: "已安装 v{v},请重启 DSH 后生效",
771
+ updateRestart: "已安装 v{v},若界面未更新请重启 DSH",
747
772
  reloadNow: "刷新页面",
748
773
  gotIt: "知道了",
749
774
  laterLabel: "稍后",
@@ -888,6 +913,23 @@ window.__ModuleLoader__.load({
888
913
  box-shadow: 0 0 0 1.5px var(--dsw-alias-bg-layer-1, var(--dsw-alias-bg-base));
889
914
  }
890
915
 
916
+ /* Fallback launcher: shown only when the stock sidebar footer does not
917
+ render the plugin's action, so the split menu stays reachable from the
918
+ conversation column's bottom-left corner. */
919
+ .dsv-fallback-launcher {
920
+ position: fixed; left: 16px; bottom: 16px; z-index: 130;
921
+ display: inline-flex; align-items: center; gap: 6px;
922
+ height: 30px; padding: 0 10px; border-radius: 9px;
923
+ border: 1px solid var(--dsw-alias-border-l2);
924
+ background: var(--dsw-alias-bg-layer-1, var(--dsw-alias-bg-base));
925
+ color: var(--dsw-alias-label-secondary);
926
+ font-family: var(--dsw-font-family, system-ui, sans-serif); font-size: 12px;
927
+ cursor: pointer; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
928
+ }
929
+ .dsv-fallback-launcher:hover { color: var(--dsw-alias-label-primary); background: var(--dsw-alias-interactive-bg-hover); }
930
+ .dsv-fallback-label { white-space: nowrap; }
931
+ html[data-dsv-performance="1"] .dsv-fallback-launcher { box-shadow: none; }
932
+
891
933
  /* ---- 0.5.0 launcher: the sidebar footer menu and the multi-select
892
934
  "add split" dialog. Both mount through the shell overlay seat, so they
893
935
  are never clipped by the sidebar column or the split overlay. ---- */
@@ -3078,6 +3120,9 @@ window.__ModuleLoader__.load({
3078
3120
  function openAddSplitDialog(source) {
3079
3121
  setLauncherState({ mode: "dialog", rect: null, source: source === "footer" ? "footer" : "session" });
3080
3122
  }
3123
+ function openRestartDialog() {
3124
+ setLauncherState({ mode: "restart", rect: null, source: "footer" });
3125
+ }
3081
3126
 
3082
3127
  // ---------------------------------------------------------------------
3083
3128
  // floating windows (0.6.0)
@@ -10521,6 +10566,10 @@ window.__ModuleLoader__.load({
10521
10566
  reloadClient() {
10522
10567
  return safeCall("reloadClient()", () => { try { location.reload(); } catch {} return true; }, false);
10523
10568
  },
10569
+ /** Close and reopen DSH Desktop so changes that need a full restart load. */
10570
+ restartApp() {
10571
+ return safeCall("restartApp()", () => { restartApplication(); return true; }, false);
10572
+ },
10524
10573
  /** Sessions waiting for a second pick before the split starts. */
10525
10574
  pending() {
10526
10575
  return safeCall("pending()", () => pendingSplitStore.ids(), []);
@@ -11565,6 +11614,7 @@ window.__ModuleLoader__.load({
11565
11614
  h("div", { className: "dsv-help-body", style: { marginTop: "6px" } }, t("helpGestures")),
11566
11615
  h("div", { className: "dsv-help-body", style: { marginTop: "6px" } }, t("helpDisable")),
11567
11616
  h("div", { className: "dsv-help-body", style: { marginTop: "2px" } }, t("helpDiagnostics")),
11617
+ h("div", { className: "dsv-help-body", style: { marginTop: "2px" } }, t("helpRestart")),
11568
11618
  h("div", { className: "dsv-help-actions" },
11569
11619
  h("button", { type: "button", className: "dsv-chip-btn", onClick: closeHelp }, t("helpClose")),
11570
11620
  h("button", { type: "button", className: "dsv-chip-btn", onClick: () => setEnabled(false) }, t("disableLabel")),
@@ -11777,14 +11827,18 @@ window.__ModuleLoader__.load({
11777
11827
  };
11778
11828
  }, []);
11779
11829
  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.
11830
+ const desktop = desktopShell();
11831
+ // Desktop app code is applied through the Host's HMR/rebuild path when
11832
+ // it can be, but a Host-half or linked-package change can still need a
11833
+ // full restart. Offer the restart itself instead of asking the user to
11834
+ // quit the app by hand. The Web GUI reloads the page.
11785
11835
  return h("div", { className: "dsv-update-chip", role: "status" },
11786
11836
  h("span", null, t(desktop ? "updateRestart" : "updateReady", { v: ready })),
11787
- desktop ? null : h("button", {
11837
+ desktop ? h("button", {
11838
+ type: "button",
11839
+ className: "dsv-update-chip-btn accent",
11840
+ onClick: () => { closeLauncher(); openRestartDialog(); },
11841
+ }, t("restartApp")) : h("button", {
11788
11842
  type: "button",
11789
11843
  className: "dsv-update-chip-btn accent",
11790
11844
  onClick: () => { try { location.reload(); } catch {} },
@@ -12680,6 +12734,86 @@ window.__ModuleLoader__.load({
12680
12734
  return true;
12681
12735
  }
12682
12736
 
12737
+ /** DSH Desktop exposes its preload product API; the browser Web GUI does
12738
+ not. Restarting the app is only possible from the Desktop. */
12739
+ function desktopShell() {
12740
+ return typeof window !== "undefined" && typeof window.dshDesktop !== "undefined";
12741
+ }
12742
+
12743
+ /** Ask the Host half to close and reopen DSH. The Host is a Node child of
12744
+ the Desktop shell, so it can drive an OS-level quit+relaunch even
12745
+ though production DSH has no in-app restart entry. */
12746
+ function restartApplication() {
12747
+ if (!desktopShell()) {
12748
+ showPaneToast(t("restartUnsupported"), true);
12749
+ return;
12750
+ }
12751
+ showPaneToast(t("restarting"), true);
12752
+ try {
12753
+ fetch("/dsv/restart", {
12754
+ method: "POST",
12755
+ headers: { "content-type": "application/json", "x-dsv-restart": "1" },
12756
+ body: "{\"confirm\":true}",
12757
+ cache: "no-store",
12758
+ keepalive: true,
12759
+ }).then((response) => response.json().catch(() => null)).then((payload) => {
12760
+ if (payload === null || payload === undefined || payload.ok !== true) throw new Error("restart");
12761
+ }).catch(() => {
12762
+ showPaneToast(t("restartFailed"), true);
12763
+ });
12764
+ } catch {
12765
+ showPaneToast(t("restartFailed"), true);
12766
+ }
12767
+ }
12768
+
12769
+ /** Confirmation before the app closes: running tasks are interrupted. */
12770
+ function RestartDialog() {
12771
+ React.useEffect(() => {
12772
+ const onKeyDown = (event) => {
12773
+ if (event.key !== "Escape") return;
12774
+ event.preventDefault();
12775
+ event.stopPropagation();
12776
+ closeLauncher();
12777
+ };
12778
+ document.addEventListener("keydown", onKeyDown, true);
12779
+ return () => document.removeEventListener("keydown", onKeyDown, true);
12780
+ }, []);
12781
+ return h("div", {
12782
+ className: "dsv-modal-backdrop",
12783
+ onPointerDown: (event) => {
12784
+ if (event.target === event.currentTarget) closeLauncher();
12785
+ },
12786
+ },
12787
+ h("div", {
12788
+ className: "dsv-modal",
12789
+ role: "dialog",
12790
+ "aria-modal": "true",
12791
+ "aria-label": t("restartTitle"),
12792
+ },
12793
+ h("div", { className: "dsv-modal-head" },
12794
+ h("span", { className: "dsv-modal-title" }, t("restartTitle")),
12795
+ h("button", {
12796
+ type: "button",
12797
+ className: "dsv-modal-close",
12798
+ title: t("addSplitCancel"),
12799
+ "aria-label": t("addSplitCancel"),
12800
+ onClick: closeLauncher,
12801
+ }, "×"),
12802
+ ),
12803
+ h("div", { className: "dsv-modal-hint" }, t("restartBody")),
12804
+ h("div", { className: "dsv-modal-foot", style: { borderTop: "none", paddingTop: 0 } },
12805
+ h("span", { className: "dsv-modal-count" }, ""),
12806
+ h("button", { type: "button", className: "dsv-modal-btn", onClick: closeLauncher }, t("addSplitCancel")),
12807
+ h("button", {
12808
+ type: "button",
12809
+ className: "dsv-modal-btn accent",
12810
+ onClick: () => { closeLauncher(); restartApplication(); },
12811
+ }, t("restartNow")),
12812
+ ),
12813
+ ),
12814
+ );
12815
+ }
12816
+
12683
12817
  /** Aspect ratio of the conversation column; only decides columns vs rows
12684
12818
  for a two-pane split (the same 1.2 fallback settleAuto uses). */
12685
12819
  function splitColumnAspect() {
@@ -13215,6 +13349,7 @@ window.__ModuleLoader__.load({
13215
13349
  try {
13216
13350
  if (target.closest(".dsv-launcher-menu") !== null) return;
13217
13351
  if (target.closest(".dsv-footer-btn") !== null) return;
13352
+ if (target.closest(".dsv-fallback-launcher") !== null) return;
13218
13353
  } catch {}
13219
13354
  }
13220
13355
  closeLauncher();
@@ -13264,10 +13399,64 @@ window.__ModuleLoader__.load({
13264
13399
  row("performance", "⚡", t("performanceMode") + (runtime.performance === true ? " ✓" : ""),
13265
13400
  () => { closeLauncher(); setPerformanceMode(runtime.performance !== true); }),
13266
13401
  row("reload", "↻", t("refreshInterface"), () => { closeLauncher(); try { location.reload(); } catch {} }),
13402
+ desktopShell()
13403
+ ? row("restart", "⏻", t("restartApp"), () => { closeLauncher(); openRestartDialog(); })
13404
+ : null,
13267
13405
  row("reset", "↺", t("menuResetSplit"), () => { closeLauncher(); resetSplitEnvironment(); }, { danger: true }),
13268
13406
  );
13269
13407
  }
13270
13408
 
13409
+ /** Fallback entry point when the stock sidebar footer does not render this
13410
+ plugin's action (collapsed/absent sidebar, a layout that replaces the
13411
+ footer, or an older host whose footer slot is empty). The launcher menu
13412
+ stays reachable from the conversation column's bottom-left corner. */
13413
+ function LauncherFallback() {
13414
+ const runtime = useRuntime();
13415
+ const launcher = useLauncherState();
13416
+ const pending = usePendingSplit();
13417
+ const [footerVisible, setFooterVisible] = React.useState(true);
13418
+ React.useEffect(() => {
13419
+ const check = () => {
13420
+ let visible = false;
13421
+ try {
13422
+ const button = document.querySelector(".dsv-footer-btn");
13423
+ visible = button !== null && button !== undefined && button.getBoundingClientRect().width > 0;
13424
+ } catch {}
13425
+ setFooterVisible(visible);
13426
+ };
13427
+ check();
13428
+ const timer = window.setInterval(check, runtime.performance === true ? 3000 : 1200);
13429
+ return () => { try { window.clearInterval(timer); } catch {} };
13430
+ }, [runtime.performance, runtime.enabled]);
13431
+ if (runtime.enabled !== true || footerVisible || launcher.mode !== "closed") return null;
13432
+ // Own the conversation column's bottom-left corner when its bounds are
13433
+ // known (so the fallback never sits on the stock sidebar controls); fall
13434
+ // back to the viewport corner when geometry is not measured yet.
13435
+ let style = null;
13436
+ try {
13437
+ const bounds = measureColumnBounds();
13438
+ if (bounds !== null && bounds !== undefined && bounds.ok === true) {
13439
+ style = {
13440
+ left: Math.max(8, bounds.left) + 16 + "px",
13441
+ bottom: Math.max(8, bounds.bottom) + 16 + "px",
13442
+ };
13443
+ }
13444
+ } catch {}
13445
+ return h("button", {
13446
+ type: "button",
13447
+ className: "dsv-fallback-launcher",
13448
+ style,
13449
+ title: t("menuTitle"),
13450
+ "aria-label": t("fallbackLauncher"),
13451
+ "aria-haspopup": "menu",
13452
+ onClick: (event) => openLauncherMenu(event.currentTarget),
13453
+ },
13454
+ h(SplitIconV, { size: 15 }),
13455
+ h("span", { className: "dsv-fallback-label" }, t("fallbackLauncher")),
13456
+ pending.length > 0 ? h("span", { className: "dsv-footer-badge" }, String(pending.length)) : null,
13457
+ );
13458
+ }
13459
+
13271
13460
  /** Always-mounted launcher layer (inside the shell.overlay seat). */
13272
13461
  function SplitLauncherLayer() {
13273
13462
  const launcher = useLauncherState();
@@ -13279,7 +13468,8 @@ window.__ModuleLoader__.load({
13279
13468
  }), []);
13280
13469
  if (launcher.mode === "menu") return h(SplitLauncherMenu, { request: launcher });
13281
13470
  if (launcher.mode === "dialog") return h(AddSplitDialog, null);
13282
- return null;
13471
+ if (launcher.mode === "restart") return h(RestartDialog, null);
13472
+ return h(LauncherFallback, null);
13283
13473
  }
13284
13474
 
13285
13475
 
package/lib/index.js CHANGED
@@ -14,15 +14,24 @@
14
14
  * works and `window.open` opens a normal browser window.
15
15
  *
16
16
  * It also serves the on-disk plugin version so a running page can notice a
17
- * freshly installed bundle and offer "reload interface" instead of requiring a
18
- * full DSH restart.
17
+ * freshly installed bundle, and it can close and reopen the Desktop app: DSH
18
+ * production builds have no in-app restart entry, so the split menu's
19
+ * "Restart DSH" action asks this Host to perform the OS-level quit and
20
+ * relaunch (the Host is a Node child of the Electron shell).
19
21
  */
20
22
 
23
+ import { spawn } from "node:child_process";
21
24
  import { readFileSync } from "node:fs";
25
+ import { resolve } from "node:path";
22
26
 
23
27
  const ROUTE_PATH = "/dsv/system-window";
24
28
  const VERSION_PATH = "/dsv/version";
29
+ const RESTART_PATH = "/dsv/restart";
25
30
  const MAX_BODY_BYTES = 64 * 1024;
31
+ /** The Desktop app has no in-app restart entry in production builds; this
32
+ route recreates that one action at the OS level. */
33
+ const RESTART_COOLDOWN_MS = 15000;
34
+ let lastRestartAt = 0;
26
35
  const SESSION_ID = /^[A-Za-z0-9._:@+-]+$/;
27
36
  const MAX_SESSION_ID_LENGTH = 256;
28
37
 
@@ -72,6 +81,85 @@ function respond(res, status, value) {
72
81
  } catch {}
73
82
  }
74
83
 
84
+ /** True when this Host was spawned by the DSH Desktop shell. */
85
+ function runningInDesktop() {
86
+ return typeof process.versions.electron === "string" && process.versions.electron !== "";
87
+ }
88
+
89
+ /** POSIX single-quote escaping for one shell word. */
90
+ function shellQuote(value) {
91
+ return "'" + String(value).replace(/'/g, "'\\''") + "'";
92
+ }
93
+
94
+ /**
95
+ * The detached command that closes DSH and opens it again.
96
+ *
97
+ * macOS asks the application to quit through AppleScript, so DSH's own quit
98
+ * confirmation (running tasks) still runs. Windows has no comparable public
99
+ * quit entry, so it closes the main window and then terminates the process;
100
+ * the renderer warns before calling this route.
101
+ */
102
+ export function restartCommand() {
103
+ const pid = process.ppid;
104
+ const executable = process.execPath;
105
+ if (process.platform === "darwin") {
106
+ const appBundle = resolve(executable, "../../..");
107
+ return {
108
+ command: "/bin/sh",
109
+ args: ["-c", [
110
+ "sleep 1",
111
+ `osascript -e 'tell application id "com.deepseek.dsh" to quit' >/dev/null 2>&1 || kill -TERM ${pid} 2>/dev/null`,
112
+ `n=0; while kill -0 ${pid} 2>/dev/null && [ $n -lt 120 ]; do n=$((n+1)); sleep 0.5; done`,
113
+ `open ${shellQuote(appBundle)} >/dev/null 2>&1`,
114
+ ].join("; ")],
115
+ };
116
+ }
117
+ if (process.platform === "win32") {
118
+ const script = [
119
+ "Start-Sleep -Milliseconds 900",
120
+ `$p = Get-Process -Id ${pid} -ErrorAction SilentlyContinue`,
121
+ "if ($p) { $p.CloseMainWindow() | Out-Null; Start-Sleep -Milliseconds 700 }",
122
+ `$p = Get-Process -Id ${pid} -ErrorAction SilentlyContinue`,
123
+ `if ($p) { Stop-Process -Id ${pid} -Force -ErrorAction SilentlyContinue }`,
124
+ `for ($i = 0; $i -lt 40; $i++) { if (-not (Get-Process -Id ${pid} -ErrorAction SilentlyContinue)) { break }; Start-Sleep -Milliseconds 250 }`,
125
+ `Start-Process -FilePath '${String(executable).replace(/'/g, "''")}'`,
126
+ ].join("; ");
127
+ return {
128
+ command: "powershell.exe",
129
+ args: ["-NoProfile", "-NonInteractive", "-WindowStyle", "Hidden", "-Command", script],
130
+ };
131
+ }
132
+ return {
133
+ command: "/bin/sh",
134
+ args: ["-c", [
135
+ "sleep 1",
136
+ `kill -TERM ${pid} 2>/dev/null`,
137
+ `n=0; while kill -0 ${pid} 2>/dev/null && [ $n -lt 120 ]; do n=$((n+1)); sleep 0.5; done`,
138
+ `setsid ${shellQuote(executable)} >/dev/null 2>&1 &`,
139
+ ].join("; ")],
140
+ };
141
+ }
142
+
143
+ /** Close and reopen the Desktop app without blocking the HTTP response. */
144
+ function scheduleRestart() {
145
+ const now = Date.now();
146
+ if (now - lastRestartAt < RESTART_COOLDOWN_MS) return false;
147
+ lastRestartAt = now;
148
+ setTimeout(() => {
149
+ try {
150
+ const command = restartCommand();
151
+ spawn(command.command, command.args, {
152
+ detached: true,
153
+ stdio: "ignore",
154
+ windowsHide: true,
155
+ }).unref();
156
+ } catch (error) {
157
+ try { console.warn("[dsh-split-workspace] restart failed:", error); } catch {}
158
+ }
159
+ }, 250);
160
+ return true;
161
+ }
162
+
75
163
  /** @param {import('@deepseek-ai/cordis').Context} ctx */
76
164
  export function apply(ctx) {
77
165
  const getService = (name) => {
@@ -150,9 +238,36 @@ export function apply(ctx) {
150
238
  respond(res, 200, { ok: true, version });
151
239
  },
152
240
  });
241
+ const disposeRestart = webCtx.webServer.register({
242
+ kind: "exact",
243
+ path: RESTART_PATH,
244
+ handler: (req, res) => {
245
+ if (req.method !== "POST") {
246
+ respond(res, 405, { ok: false, error: "method" });
247
+ return;
248
+ }
249
+ const origin = req.headers.origin;
250
+ if (typeof origin === "string" && origin !== "" && origin !== "dsh-app://app"
251
+ && !/^https?:\/\/(127\.0\.0\.1|localhost|\[::1\])(:\d+)?$/iu.test(origin)) {
252
+ respond(res, 403, { ok: false, error: "origin" });
253
+ return;
254
+ }
255
+ if (req.headers["x-dsv-restart"] !== "1") {
256
+ respond(res, 403, { ok: false, error: "confirm" });
257
+ return;
258
+ }
259
+ if (!runningInDesktop()) {
260
+ respond(res, 200, { ok: false, mode: "web", error: "not-desktop" });
261
+ return;
262
+ }
263
+ const scheduled = scheduleRestart();
264
+ respond(res, 200, { ok: true, mode: "desktop", platform: process.platform, pending: scheduled !== true });
265
+ },
266
+ });
153
267
  return () => {
154
268
  try { disposeWindow(); } catch {}
155
269
  try { disposeVersion(); } catch {}
270
+ try { disposeRestart(); } catch {}
156
271
  };
157
272
  }, "split-workspace: host routes");
158
273
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-split-workspace",
3
- "version": "0.8.0",
3
+ "version": "0.9.0",
4
4
  "type": "module",
5
5
  "description": "Split-screen workspace for DeepSeek Harness (DSH) Desktop: unlimited native panes, side-by-side, stacked and 2×2 grid layouts, drag to rearrange, movable floating windows, OS-level standalone system windows, and a performance mode for slow machines.",
6
6
  "icon": "./icon.svg",