dsh-split-workspace 0.13.2 → 0.14.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/CHANGELOG.md +22 -0
- package/README.md +62 -14
- package/THIRD-PARTY-NOTICES.md +17 -0
- package/lib/client.js +230 -8
- package/lib/index.js +118 -20
- package/native/system-window.ps1 +230 -0
- package/native/webview2/LICENSE.txt +27 -0
- package/native/webview2/Microsoft.Web.WebView2.Core.dll +0 -0
- package/native/webview2/Microsoft.Web.WebView2.WinForms.dll +0 -0
- package/native/webview2/NOTICE.txt +85 -0
- package/native/webview2/arm64/WebView2Loader.dll +0 -0
- package/native/webview2/x64/WebView2Loader.dll +0 -0
- package/package.json +5 -2
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,28 @@
|
|
|
4
4
|
|
|
5
5
|
This file records public releases of `dsh-split-workspace`; each version ends with a one-line English summary.
|
|
6
6
|
|
|
7
|
+
## [0.14.0] - 2026-11-19
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
- **Windows 也有真正的系统窗口了(PowerShell + WebView2)。** 右键会话 → 分屏插件 → **进入系统窗口** 以前只在 macOS 可用,Windows 上点击会提示“系统窗口仅支持 macOS 桌面版”。现在 Host 在 Windows 上启动 `native/system-window.ps1`,由 PowerShell + WinForms 建一个真正的 OS 窗口、内嵌 WebView2 控件加载 Host 的**本机认证 Web 客户端**;窗口可拖出 DSH 主窗口、单独缩放/最小化/关闭,不显示左侧栏,右侧栏与对话区照常保留,菜单的「进入 / 退出系统窗口」状态与关窗同步逻辑和 macOS 完全一致。
|
|
12
|
+
- Windows 实现随包附带 WebView2 SDK(`Microsoft.Web.WebView2.Core.dll`、`Microsoft.Web.WebView2.WinForms.dll`、x64 / arm64 `WebView2Loader.dll`,BSD-3-Clause,约 1.1 MB),不需要本地编译;每个窗口使用独立的临时 WebView2 配置目录,关窗/退出 DSH 时连同 `msedgewebview2` 进程树一起结束。
|
|
13
|
+
- 缺少 Microsoft Edge WebView2 运行时时,菜单会给出明确提示(而不是笼统失败):Windows 11 自带、Windows 10 装过新版 Edge 即有。
|
|
14
|
+
- 平台判断收敛为 `nativeWindowSupported()`(macOS / Windows),Linux 与 Web 客户端仍提示改用「进入独立窗口」;Windows 会等待 Helper 启动窗口,如果进程在启动窗口内退出,会把原因(WebView2 缺失 / Helper 资源损坏)返回给客户端。
|
|
15
|
+
|
|
16
|
+
### Fixed
|
|
17
|
+
|
|
18
|
+
- **修复 macOS 系统窗口里弹层菜单跑到窗口左上角。** 模型选择器、权限 / 审查模式等下拉菜单在系统窗口里会出现在左上角、盖住标题栏。根因是 DSH 的 Menu 用 **CSS Anchor Positioning**(`position-anchor` + `anchor()`)把 portal 面板挂在触发按钮旁,而 macOS 系统窗口是 **WKWebView(WebKit)**,没有实现这两个特性:`anchor()` 声明被丢弃,菜单只剩 CSS 兜底的 `top: 12px; left: 12px`。Chromium 主窗口支持该特性,所以只在系统窗口复现。
|
|
19
|
+
- 修复:系统窗口模式检测到缺少锚点定位能力时安装轻量回落——按菜单自带的 `data-anchor-side` / `data-anchor-align`,以及模型选择器共享在触发按钮上的 `--dsh-model-anchor` 自定义属性,重新计算面板的 `top / bottom / left / right`;向上打开的菜单贴着按钮上沿、右对齐,并按可用空间限制最大高度。菜单关闭即停止跟随;引擎支持锚点定位时完全不生效。
|
|
20
|
+
- 验证:新增 `npm run check:anchor`,在真实 WKWebView 里跑两个场景(模型选择器菜单、stock Menu portal):修复前菜单位于 (12, 12),修复后分别落在触发按钮上方 8px / 4px 且右对齐。
|
|
21
|
+
|
|
22
|
+
### Changed
|
|
23
|
+
|
|
24
|
+
- `native/system-window.jxa` 保持 macOS 实现不变;Host 抽出 `systemWindowCommand()` 统一生成两个平台的 Helper 命令(Windows 用 base64 传递认证 URL,避免 PowerShell 参数解析)。
|
|
25
|
+
- README / 使用帮助 / 提示文案同步更新为「macOS / Windows」。
|
|
26
|
+
|
|
27
|
+
**English summary:** The native system window now works on Windows too: the Host starts `native/system-window.ps1`, a PowerShell + WinForms window hosting WebView2 (vendored SDK, about 1.1 MB, BSD-3-Clause) that loads the Host's authenticated web client with the same hash-marker mode and menu state sync as macOS. Each window gets its own temporary WebView2 profile, closing it ends the whole helper process tree, and a missing Microsoft Edge WebView2 Runtime is reported explicitly. Linux and the Web client still fall back to the independent window. The macOS system window also fixes dropdown menus (model selector, permission presets) landing in the window's top-left corner: WebKit drops CSS anchor positioning, so the plugin re-anchors those portaled panels next to the trigger they opened from, with height caps; `npm run check:anchor` verifies it in a real WKWebView.
|
|
28
|
+
|
|
7
29
|
## [0.13.2] - 2026-11-19
|
|
8
30
|
|
|
9
31
|
### Fixed
|
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
**中文(默认)** · [English](#english)
|
|
4
4
|
|
|
5
|
-
把 DeepSeek Harness 的对话区拆成原生多窗格工作区——左右分屏、上下分屏、田字 2×2 或自动网格,窗口放得下多少会话就开多少。每个窗格都是真实会话,拥有自己的输入框、流式输出、停止、队列、待办、附件、`/` 命令、`ask_user_question`、审批与视图页,桌面端(`dsh-app://`)同样可用。还可以把任意会话变成可拖动、可缩放的**浮窗**,在分屏与浮窗两种模式之间来回切换;或把它放进**应用内独立窗口**(关闭 / 最小化 / 最大化 /
|
|
5
|
+
把 DeepSeek Harness 的对话区拆成原生多窗格工作区——左右分屏、上下分屏、田字 2×2 或自动网格,窗口放得下多少会话就开多少。每个窗格都是真实会话,拥有自己的输入框、流式输出、停止、队列、待办、附件、`/` 命令、`ask_user_question`、审批与视图页,桌面端(`dsh-app://`)同样可用。还可以把任意会话变成可拖动、可缩放的**浮窗**,在分屏与浮窗两种模式之间来回切换;或把它放进**应用内独立窗口**(关闭 / 最小化 / 最大化 / 全屏),桌面版还可以把它放进**真正的系统窗口**(macOS 用系统 WebView、Windows 用 WebView2,独立于 DSH 主窗口,不经过浏览器);并支持从侧边栏菜单和**系统设置**两个入口操作。版本历史见 [CHANGELOG.md](CHANGELOG.md)。
|
|
6
6
|
|
|
7
7
|
## 快速开始
|
|
8
8
|
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
| 桌面端 DSH Desktop(`dsh-app://`) | 日常使用,支持完整桌面能力,推荐 | `desktop` profile,由桌面端管理 |
|
|
15
15
|
|
|
16
16
|
- 支持 DSH 0.2.0 / 0.2.1,当前针对 0.2.1-rc.2 构建。
|
|
17
|
-
- 包内 `lib/client.js`
|
|
17
|
+
- 包内 `lib/client.js` 已预构建,无 Node 原生模块、无安装脚本,客户端的 macOS / Windows / Linux 行为一致;Windows 的「系统窗口」随包附带 WebView2 SDK(约 1.1 MB,BSD-3-Clause),无需本地编译,但需要机器已安装 Microsoft Edge WebView2 运行时(Windows 11 自带,Windows 10 装过新版 Edge 即有)。
|
|
18
18
|
- 插件本身运行时不联网。
|
|
19
19
|
|
|
20
20
|
### Web:在线安装
|
|
@@ -127,16 +127,18 @@ dsh --profile web
|
|
|
127
127
|
|
|
128
128
|
- **进入独立窗口**(0.11.0 起收在「分屏插件」二级菜单;早期版本为「在独立窗口打开」):在 DSH 应用内部打开一个只显示该会话的窗口,提供 **关闭 / 最小化 / 最大化-还原 / 全屏**;双击标题栏切换最大化,最小化后收成左下角的恢复胶囊。该会话已经在这个窗口里时,菜单显示 **退出独立窗口**;关闭窗口后菜单回到「进入独立窗口」。
|
|
129
129
|
- 打开时该会话会从分屏 / 浮窗 / 待分屏中移出,避免同一会话同时被两个输入框编辑;关闭独立窗口不会删除会话,它仍在侧栏里,可随时重新加入分屏。
|
|
130
|
-
- **为什么不是 Electron 原生窗口?** DSH Desktop 的 Electron 主进程只保留一个应用窗口,主窗口的 `setWindowOpenHandler` 拒绝用 `window.open` 创建第二个原生窗口(http/https 只交给系统浏览器);插件的 Host 进程是 Node 子进程,没有 Electron `BrowserWindow` API。所以 0.10.0 把这一层做成**应用内独立窗口**(不再打开浏览器、没有地址栏,窗口控制由插件自己绘制);macOS
|
|
130
|
+
- **为什么不是 Electron 原生窗口?** DSH Desktop 的 Electron 主进程只保留一个应用窗口,主窗口的 `setWindowOpenHandler` 拒绝用 `window.open` 创建第二个原生窗口(http/https 只交给系统浏览器);插件的 Host 进程是 Node 子进程,没有 Electron `BrowserWindow` API。所以 0.10.0 把这一层做成**应用内独立窗口**(不再打开浏览器、没有地址栏,窗口控制由插件自己绘制);macOS / Windows 上另见下一节的「系统窗口」,分别用系统 WebView 与 WebView2 实现真正的独立窗口。
|
|
131
131
|
- 限制:它仍在 DSH 主窗口内部(不是操作系统级第二窗口),不能拖到 DSH 窗口之外。
|
|
132
132
|
|
|
133
|
-
##
|
|
133
|
+
## 系统窗口(原生独立窗口,0.11.0 macOS / 0.14.0 Windows)
|
|
134
134
|
|
|
135
|
-
- 右键会话 → **分屏插件** → **进入系统窗口**:在 macOS 上打开一个**真正的操作系统窗口**。它不是 DSH 主窗口里的一层浮层,可以拖到主窗口之外、单独缩放和关闭,不会打开浏览器,也没有地址栏。该会话的系统窗口已经打开时,菜单显示 **退出系统窗口**;在窗口里点关闭(或从菜单退出)后,菜单会自动回到「进入系统窗口」。
|
|
135
|
+
- 右键会话 → **分屏插件** → **进入系统窗口**:在 macOS 或 Windows 上打开一个**真正的操作系统窗口**。它不是 DSH 主窗口里的一层浮层,可以拖到主窗口之外、单独缩放和关闭,不会打开浏览器,也没有地址栏。该会话的系统窗口已经打开时,菜单显示 **退出系统窗口**;在窗口里点关闭(或从菜单退出)后,菜单会自动回到「进入系统窗口」。
|
|
136
136
|
- 窗口内容仍然是这个会话的真实客户端:**左侧栏不显示**(会话占满窗口),**右侧栏、对话头部、输入框、视图页等都照常保留**,右上角的「打开右侧边栏」依然可用。
|
|
137
|
-
-
|
|
138
|
-
-
|
|
139
|
-
-
|
|
137
|
+
- **实现方式(macOS)**:DSH 没有向插件开放 Electron `BrowserWindow`,所以插件 Host 用系统自带的 AppKit `NSWindow` + `WKWebView`(`osascript` 运行 `native/system-window.jxa`)打开窗口,并让这个 WebView 加载 Host 的**本机认证 Web 客户端**。认证 URL 由 Host 在进程内生成,只传给本机 Helper,**不会返回给渲染层**;哈希标记让同一份客户端代码在窗口内切换成「系统窗口模式」。
|
|
138
|
+
- **实现方式(Windows)**:Host 用 `powershell.exe` 启动 `native/system-window.ps1`,由 PowerShell + WinForms 建窗口、内嵌 WebView2 控件加载同一份认证 Web 客户端。`native/webview2/` 随包附带 WebView2 SDK(`Microsoft.Web.WebView2.Core.dll`、`Microsoft.Web.WebView2.WinForms.dll` 与 x64/arm64 的 `WebView2Loader.dll`,BSD-3-Clause),每个窗口使用独立的临时 WebView2 配置目录;关窗或退出 DSH 时连同 `msedgewebview2` 进程树一起结束。
|
|
139
|
+
- **平台**:macOS 与 Windows。Linux(或 Web 客户端)上点击会提示改用「进入独立窗口」,不会退回浏览器。Windows 缺少 **Microsoft Edge WebView2 运行时**时会提示先安装再试。窗口标题跟随会话标题;关闭窗口即结束 Helper 进程,退出 DSH 时也会一并关闭这些窗口。
|
|
140
|
+
- macOS 的 Helper 是辅助型进程,不占 Dock 图标,因此**没有最小化按钮**(避免最小化后无法从 Dock 恢复);提供关闭、缩放和标题栏拖动。Windows 使用系统标题栏,最小化 / 最大化 / 关闭都可用。
|
|
141
|
+
- **菜单定位**:DSH 的弹层菜单用 CSS Anchor Positioning(`position-anchor` + `anchor()`)把自己挂在触发按钮旁边;Chromium(主窗口)支持,但 macOS 的 WKWebView 不支持,菜单会退到窗口左上角、盖住标题栏。系统窗口模式下插件会检测这一能力缺失,并按菜单自带的 `data-anchor-side` / `data-anchor-align`(以及模型选择器的锚点自定义属性)在触发按钮旁重新定位:向上打开的菜单贴着按钮上沿、右对齐,并限制最大高度。
|
|
140
142
|
- **注意**:系统窗口是独立的 Web 客户端,所以桌面端专属能力(如原生文件拖拽、系统目录选择器)在窗口内的行为以 Web 客户端为准;会话数据与主窗口共享同一个 Host,输入、流式输出和右侧栏功能正常。
|
|
141
143
|
|
|
142
144
|

|
|
@@ -243,7 +245,7 @@ DSH **生产版没有内置的“重启”菜单项**(开发版才有 `Restart
|
|
|
243
245
|
- `window.__dshSplitWorkspace.closeFloat(sessionId)`:关闭浮窗(不放回分屏)。
|
|
244
246
|
- `window.__dshSplitWorkspace.floats()`:当前浮窗的会话 id 列表(按创建顺序)。
|
|
245
247
|
- `window.__dshSplitWorkspace.openSystemWindow(sessionId)`:在应用内独立窗口打开该会话(`openIndependentWindow` 是同一功能的别名)。
|
|
246
|
-
- `window.__dshSplitWorkspace.openNativeWindow(sessionId)
|
|
248
|
+
- `window.__dshSplitWorkspace.openNativeWindow(sessionId)`:在原生系统窗口(macOS / Windows)打开该会话;Linux 或非桌面版会提示改用独立窗口。
|
|
247
249
|
- `window.__dshSplitWorkspace.closeNativeWindow(sessionId)`:关闭该会话的系统窗口。
|
|
248
250
|
- `window.__dshSplitWorkspace.nativeWindows()`:当前已打开系统窗口的会话 id 列表。
|
|
249
251
|
- `window.__dshSplitWorkspace.appWindow()`:当前独立窗口状态(`{ id, minimized, maximized }` 或 `null`)。
|
|
@@ -285,8 +287,11 @@ DSH **生产版没有内置的“重启”菜单项**(开发版才有 `Restart
|
|
|
285
287
|
| `16-standalone` | 应用内独立窗口组件、窗口层与恢复胶囊,以及系统窗口的模式切换与请求 |
|
|
286
288
|
| `17-api-apply` | `window.__dshSplitWorkspace` API、`apply()` 与导出 |
|
|
287
289
|
| `native/system-window.jxa` | macOS 系统窗口 Helper(AppKit `NSWindow` + `WKWebView`,由 Host 通过 `osascript` 启动) |
|
|
290
|
+
| `native/system-window.ps1` | Windows 系统窗口 Helper(PowerShell + WinForms 宿主 WebView2,由 Host 通过 `powershell.exe` 启动) |
|
|
291
|
+
| `native/webview2/` | 随包附带的 WebView2 SDK 二进制(BSD-3-Clause,约 1.1 MB,含 x64 / arm64 loader) |
|
|
288
292
|
|
|
289
293
|
- `npm run build`:重新生成 `lib/client.js`;`npm test` 会先跑 `build:check`,源码/产物不一致会失败。
|
|
294
|
+
- `npm run check:anchor`:在真实 WKWebView 里验证系统窗口的菜单锚点回落(macOS 专用;CI 在 Ubuntu 上不跑)。
|
|
290
295
|
- 为什么不用打包器:DSH 客户端只加载一个 `<plugin>/client.js`,片段共享同一个 module-loader 闭包,按顺序拼接即可;这样发布包保持零依赖、无构建依赖。
|
|
291
296
|
- 修改代码时改 `src/client/` 对应片段,然后 `npm run build`;`lib/client.js` 顶部有一行 GENERATED 标记。
|
|
292
297
|
|
|
@@ -312,7 +317,8 @@ will land:
|
|
|
312
317
|
- 没有窗格数量上限;持久化树会校验(会话唯一、深度),损坏的树会被丢弃,而不是恢复一个坏掉的工作区。
|
|
313
318
|
- 「浮窗」是应用内窗口,不是 Electron 原生第二窗口:DSH Desktop 主窗口禁用了 `window.open`,Web 客户端也没有会话深链;浮窗复用真实会话组件、可拖动缩放,但仍在 DSH 主窗口内渲染(详见上面的「为什么浮窗不是系统级独立窗口?」)。
|
|
314
319
|
- 浮窗和分屏窗格互斥;同一会话不会同时以两种形态渲染,避免共享编辑器冲突。
|
|
315
|
-
- 「独立窗口」是应用内窗口:它不打开浏览器、没有地址栏,但不能移出 DSH
|
|
320
|
+
- 「独立窗口」是应用内窗口:它不打开浏览器、没有地址栏,但不能移出 DSH 主窗口。桌面版(macOS / Windows)另提供「进入系统窗口」(系统 WebView / WebView2,真正的独立窗口);DSH 本身仍未向插件开放 Electron `BrowserWindow`。独立窗口内的会话同样互斥于分屏和浮窗。
|
|
321
|
+
- 「系统窗口」是独立的 Web 客户端:需要 DSH 桌面版 + macOS,或 Windows + Microsoft Edge WebView2 运行时;它不共享主窗口的桌面专属能力(原生文件拖拽、系统目录选择器)。
|
|
316
322
|
- 持久化递归深度上限为 32 层,是为了手改数据时的栈安全,不是窗格上限。
|
|
317
323
|
- 隐藏的原生会话仍在遮罩下流式运行;窗格重新挂载原生输入框,所以每个窗格自己的输入框拥有该会话的编辑器。
|
|
318
324
|
- 窗格重命名拒绝空会话(原生重命名对话框同样如此)。
|
|
@@ -330,8 +336,9 @@ MIT。见 `THIRD-PARTY-NOTICES.md`。
|
|
|
330
336
|
as you need, side by side, stacked, or in a 2×2 / automatic grid.** Any
|
|
331
337
|
conversation can also become a movable, resizable **floating window**, switch
|
|
332
338
|
between the two modes at any time, move into an **in-app independent window**
|
|
333
|
-
(close / minimize / maximize / fullscreen), or —
|
|
334
|
-
**native OS window** (system WebView
|
|
339
|
+
(close / minimize / maximize / fullscreen), or — in DSH Desktop on macOS or
|
|
340
|
+
Windows — open a real **native OS window** (system WebView on macOS, WebView2 on
|
|
341
|
+
Windows; no browser, no left sidebar) for one
|
|
335
342
|
conversation. The session menu's **Split plugin** submenu holds the
|
|
336
343
|
`Join split / Leave split` toggle together with all three window surfaces,
|
|
337
344
|
each showing **Exit …** while that surface is open.
|
|
@@ -351,7 +358,8 @@ attachments, `/` commands, `ask_user_question`, approvals and view tabs.
|
|
|
351
358
|
**Search terms / 搜索关键词**:split screen, split view, split pane, multi-pane,
|
|
352
359
|
multi-session, multi-window, tiled workspace, unlimited panes, DSH Desktop,
|
|
353
360
|
分屏, 分屏插件, 多窗格, 多窗口, 多会话, 左右分屏, 上下分屏, 并排, 田字布局,
|
|
354
|
-
系统窗口, 原生窗口, macOS system window,
|
|
361
|
+
系统窗口, 原生窗口, macOS system window, Windows system window, WebView2,
|
|
362
|
+
native window.
|
|
355
363
|
|
|
356
364
|
The pane engine is derived from
|
|
357
365
|
[dsh-split-screen](https://github.com/YEYEYEYESHIFU/dsh-split-screen) 1.7.0
|
|
@@ -368,7 +376,7 @@ layout, the unlimited pane count, rename/copy/maximize and the compact toolbar.
|
|
|
368
376
|
| DSH Desktop (`dsh-app://`) | Daily use with full desktop features (recommended) | `desktop`, managed by the app |
|
|
369
377
|
|
|
370
378
|
- DSH 0.2.0 / 0.2.1 are supported; this build targets 0.2.1-rc.2.
|
|
371
|
-
- The package ships a prebuilt `lib/client.js
|
|
379
|
+
- The package ships a prebuilt `lib/client.js` with no Node native modules and no install scripts; the client behaves the same on macOS / Windows / Linux. The Windows system window ships the WebView2 SDK (about 1.1 MB, BSD-3-Clause) and only needs the Microsoft Edge WebView2 Runtime (built into Windows 11, present on Windows 10 with a current Edge).
|
|
372
380
|
- The plugin itself makes no network requests at runtime.
|
|
373
381
|
|
|
374
382
|
**Web: online install**
|
|
@@ -538,6 +546,38 @@ logic stays unchanged.
|
|
|
538
546
|
multi-window support, this layer can become a real system window without
|
|
539
547
|
changing the conversation-switching logic.
|
|
540
548
|
|
|
549
|
+
### System window (native OS window, macOS + Windows)
|
|
550
|
+
|
|
551
|
+
- Right-click a conversation → **Split plugin** → **Enter system window** opens a
|
|
552
|
+
**real OS window**: movable outside the DSH main window, resizable and closable
|
|
553
|
+
on its own, with no browser and no address bar. While it is open the menu shows
|
|
554
|
+
**Exit system window**, and closing the window itself flips the menu back.
|
|
555
|
+
- The window shows the real conversation client: **no left sidebar** (the
|
|
556
|
+
conversation fills the window) while the **right sidebar**, header, composer and
|
|
557
|
+
view tabs stay available.
|
|
558
|
+
- **macOS** uses an AppKit `NSWindow` + `WKWebView` helper
|
|
559
|
+
(`native/system-window.jxa`, started with `osascript`); **Windows** uses a
|
|
560
|
+
WinForms window hosting WebView2 (`native/system-window.ps1`, started with
|
|
561
|
+
`powershell.exe`). Both load the Host's **locally authenticated web client**:
|
|
562
|
+
the URL is minted inside the Host and never returned to the renderer, and a hash
|
|
563
|
+
marker turns the same client into the single-conversation system-window mode.
|
|
564
|
+
- **Platforms**: macOS and Windows. Linux (or the Web client) is told to use the
|
|
565
|
+
independent window instead, and a missing Microsoft Edge WebView2 Runtime is
|
|
566
|
+
reported explicitly on Windows. The helper ships with the package (about 1.1 MB)
|
|
567
|
+
and needs no local build; each window gets its own temporary WebView2 profile,
|
|
568
|
+
and closing it ends the whole helper process tree.
|
|
569
|
+
- **Menu placement**: the stock DSH menus portal themselves next to their trigger
|
|
570
|
+
with CSS Anchor Positioning (`position-anchor` + `anchor()`). Chromium supports
|
|
571
|
+
it, WebKit/WKWebView does not, so dropdowns would otherwise fall back to the
|
|
572
|
+
window's top-left corner. In the system window the plugin detects that gap and
|
|
573
|
+
re-anchors those panels next to the trigger they opened from, using the
|
|
574
|
+
`data-anchor-side` / `data-anchor-align` attributes and the model selector's
|
|
575
|
+
anchor custom property; upward menus sit above the trigger, right-aligned and
|
|
576
|
+
height-capped.
|
|
577
|
+
- Desktop-only capabilities (native file drag, system directory picker) follow the
|
|
578
|
+
Web client inside the window; conversations share the same Host, so input,
|
|
579
|
+
streaming and the right sidebar work normally.
|
|
580
|
+
|
|
541
581
|
### Settings entry
|
|
542
582
|
|
|
543
583
|
Besides the sidebar-footer split button, the plugin registers a **Settings → Split workspace** page (`settings.section`) so the controls remain reachable when the footer entry is hidden. The page shows:
|
|
@@ -815,9 +855,14 @@ architecture the upstream plugin uses.
|
|
|
815
855
|
|
|
816
856
|
- `npm run build` regenerates `lib/client.js`; `npm test` runs `build:check` first
|
|
817
857
|
and fails when the source and artifact disagree.
|
|
858
|
+
- `npm run check:anchor` verifies the system window's menu anchoring fallback in a
|
|
859
|
+
real WKWebView (macOS only; CI runs on Ubuntu).
|
|
818
860
|
- No bundler: the DSH client loads exactly one `<plugin>/client.js`, the sections
|
|
819
861
|
share one module-loader closure, and ordered concatenation keeps the published
|
|
820
862
|
package dependency-free.
|
|
863
|
+
- `native/` holds the platform helpers: `system-window.jxa` (macOS AppKit),
|
|
864
|
+
`system-window.ps1` (Windows PowerShell + WinForms + WebView2) and the vendored
|
|
865
|
+
`webview2/` SDK binaries (BSD-3-Clause; see `THIRD-PARTY-NOTICES.md`).
|
|
821
866
|
- Edit the matching `src/client/` section and run `npm run build`; the generated
|
|
822
867
|
file starts with a GENERATED marker.
|
|
823
868
|
|
|
@@ -841,6 +886,9 @@ architecture the upstream plugin uses.
|
|
|
841
886
|
has no Electron `BrowserWindow` API. It opens no browser and has no address
|
|
842
887
|
bar, but it cannot leave the DSH main window; a conversation in it is likewise
|
|
843
888
|
detached from split and float.
|
|
889
|
+
- The **system window** is a second OS-level web client: it needs DSH Desktop on
|
|
890
|
+
macOS, or Windows with the Microsoft Edge WebView2 Runtime, and it does not
|
|
891
|
+
carry desktop-only integrations such as native file drag.
|
|
844
892
|
- The persisted recursion depth is capped at 32 levels as a stack-safety guard
|
|
845
893
|
for hand-edited payloads, not as a pane limit.
|
|
846
894
|
- The hidden stock conversation still streams under the overlay; panes re-host
|
package/THIRD-PARTY-NOTICES.md
CHANGED
|
@@ -20,3 +20,20 @@ It has been adapted and extended for the DeepSeek Harness Desktop shell:
|
|
|
20
20
|
|
|
21
21
|
The upstream MIT license is reproduced in `LICENSE`; the upstream copyright
|
|
22
22
|
notice is retained here.
|
|
23
|
+
|
|
24
|
+
## Microsoft Edge WebView2 SDK
|
|
25
|
+
|
|
26
|
+
The Windows system window ships the **Microsoft WebView2 SDK 1.0.4314.35**
|
|
27
|
+
binaries in `native/webview2/`:
|
|
28
|
+
|
|
29
|
+
- `Microsoft.Web.WebView2.Core.dll`
|
|
30
|
+
- `Microsoft.Web.WebView2.WinForms.dll`
|
|
31
|
+
- `x64/WebView2Loader.dll`, `arm64/WebView2Loader.dll`
|
|
32
|
+
|
|
33
|
+
- Package: https://www.nuget.org/packages/Microsoft.Web.WebView2
|
|
34
|
+
- License: BSD-3-Clause, Copyright (C) Microsoft Corporation.
|
|
35
|
+
|
|
36
|
+
The complete upstream `LICENSE.txt` and `NOTICE.txt` are shipped alongside the
|
|
37
|
+
binaries in `native/webview2/`. The WebView2 **Runtime** itself is not
|
|
38
|
+
redistributed: it is installed with Microsoft Edge (built into Windows 11 and
|
|
39
|
+
present on Windows 10 with a current Edge).
|
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.
|
|
78
|
+
const PLUGIN_VERSION = "0.14.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";
|
|
@@ -766,7 +766,7 @@ window.__ModuleLoader__.load({
|
|
|
766
766
|
floatClosed: "Floating window closed",
|
|
767
767
|
floatHint: "Drag the title bar to move · drag an edge to resize",
|
|
768
768
|
helpFloat: "Right-click a conversation → Split plugin → Enter floating window detaches it into a movable window; Dock to split puts it back.",
|
|
769
|
-
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.",
|
|
769
|
+
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, or Windows with the WebView2 Runtime) is a real OS window with no left sidebar and the stock right sidebar. Neither opens a browser.",
|
|
770
770
|
menuSystemWindow: "Open in independent window",
|
|
771
771
|
systemWindowOpened: "Opened in an independent window",
|
|
772
772
|
systemWindowFailed: "Could not open the independent window",
|
|
@@ -774,7 +774,8 @@ window.__ModuleLoader__.load({
|
|
|
774
774
|
systemWindowClosing: "Closing the system window…",
|
|
775
775
|
systemWindowNativeOpened: "Entered the system window",
|
|
776
776
|
systemWindowNativeClosed: "System window closed",
|
|
777
|
-
systemWindowUnsupported: "The native system window needs macOS
|
|
777
|
+
systemWindowUnsupported: "The native system window needs DSH Desktop on macOS or Windows. Use Enter independent window instead.",
|
|
778
|
+
systemWindowWebView2Missing: "The native system window needs the Microsoft Edge WebView2 Runtime. Install it, then try again, or use Enter independent window.",
|
|
778
779
|
menuGroup: "Split plugin",
|
|
779
780
|
menuIndependentOpen: "Enter independent window",
|
|
780
781
|
menuIndependentClose: "Exit independent window",
|
|
@@ -935,7 +936,7 @@ window.__ModuleLoader__.load({
|
|
|
935
936
|
floatClosed: "浮窗已关闭",
|
|
936
937
|
floatHint: "拖动标题栏移动 · 拖动边缘调整大小",
|
|
937
938
|
helpFloat: "右键会话 → 分屏插件 → 进入浮窗,可把该会话变成独立浮窗;浮窗标题栏的“回到分屏”可放回分屏。",
|
|
938
|
-
helpIndependent: "右键会话 → 分屏插件 → 进入独立窗口 / 进入系统窗口。独立窗口在应用内单独显示该会话(关闭 / 最小化 / 最大化 / 全屏);系统窗口(macOS)是真正的操作系统窗口,不显示左侧栏、保留右侧栏。两者都不依赖浏览器。",
|
|
939
|
+
helpIndependent: "右键会话 → 分屏插件 → 进入独立窗口 / 进入系统窗口。独立窗口在应用内单独显示该会话(关闭 / 最小化 / 最大化 / 全屏);系统窗口(macOS,或装了 WebView2 运行时的 Windows)是真正的操作系统窗口,不显示左侧栏、保留右侧栏。两者都不依赖浏览器。",
|
|
939
940
|
menuSystemWindow: "在独立窗口打开",
|
|
940
941
|
systemWindowOpened: "已在独立窗口中打开",
|
|
941
942
|
systemWindowFailed: "无法打开独立窗口",
|
|
@@ -943,7 +944,8 @@ window.__ModuleLoader__.load({
|
|
|
943
944
|
systemWindowClosing: "正在关闭系统窗口…",
|
|
944
945
|
systemWindowNativeOpened: "已进入系统窗口",
|
|
945
946
|
systemWindowNativeClosed: "已关闭系统窗口",
|
|
946
|
-
systemWindowUnsupported: "系统窗口仅支持 macOS
|
|
947
|
+
systemWindowUnsupported: "系统窗口仅支持 DSH 桌面版(macOS / Windows);可改用“进入独立窗口”。",
|
|
948
|
+
systemWindowWebView2Missing: "系统窗口需要 Microsoft Edge WebView2 运行时,请先安装再试;也可改用“进入独立窗口”。",
|
|
947
949
|
menuGroup: "分屏插件",
|
|
948
950
|
menuIndependentOpen: "进入独立窗口",
|
|
949
951
|
menuIndependentClose: "退出独立窗口",
|
|
@@ -15064,14 +15066,233 @@ window.__ModuleLoader__.load({
|
|
|
15064
15066
|
window.setTimeout(attempt, 200);
|
|
15065
15067
|
}
|
|
15066
15068
|
|
|
15069
|
+
// ---------------------------------------------------------------------
|
|
15070
|
+
// CSS anchor positioning fallback (native system window only)
|
|
15071
|
+
//
|
|
15072
|
+
// DSH's menus place portaled panels with CSS anchor positioning
|
|
15073
|
+
// (`position-anchor` + `anchor()` insets). Chromium implements it; WebKit /
|
|
15074
|
+
// WKWebView does not, so every dropdown loses its insets and falls back to
|
|
15075
|
+
// `top: 12px; left: 12px` — the top-left corner of the window, on top of the
|
|
15076
|
+
// header. This fallback reproduces the placement from the trigger that
|
|
15077
|
+
// opened the panel, using the placement attributes the stock Menu primitive
|
|
15078
|
+
// already publishes (`data-anchor-side` / `data-anchor-align`) and the
|
|
15079
|
+
// anchor custom properties the model selector keeps inline. It is inert on
|
|
15080
|
+
// engines with real anchor positioning support.
|
|
15081
|
+
// ---------------------------------------------------------------------
|
|
15082
|
+
|
|
15083
|
+
// dsv-anchor-fallback:start — self-contained fallback (WKWebView fixture test).
|
|
15084
|
+
/** True when the engine can lay out `position: fixed` panels from anchors. */
|
|
15085
|
+
function cssAnchorPositioningSupported() {
|
|
15086
|
+
try {
|
|
15087
|
+
return typeof CSS !== "undefined"
|
|
15088
|
+
&& typeof CSS.supports === "function"
|
|
15089
|
+
&& CSS.supports("position-anchor: --dsv-probe")
|
|
15090
|
+
&& CSS.supports("top: anchor(top)");
|
|
15091
|
+
} catch {
|
|
15092
|
+
return false;
|
|
15093
|
+
}
|
|
15094
|
+
}
|
|
15095
|
+
|
|
15096
|
+
// dsv-anchor-math:start — pure placement math (unit-tested in test.mjs).
|
|
15097
|
+
function anchorPanelInsets(anchorRect, viewport, side, align, gap) {
|
|
15098
|
+
const margin = 12;
|
|
15099
|
+
const width = Math.max(0, viewport.width);
|
|
15100
|
+
const height = Math.max(0, viewport.height);
|
|
15101
|
+
const insets = {
|
|
15102
|
+
left: null, right: null, top: null, bottom: null,
|
|
15103
|
+
maxWidth: Math.max(120, width - margin * 2), maxHeight: null,
|
|
15104
|
+
};
|
|
15105
|
+
if (side === "top" || side === "bottom") {
|
|
15106
|
+
const space = side === "top"
|
|
15107
|
+
? anchorRect.top - gap - margin
|
|
15108
|
+
: height - anchorRect.bottom - gap - margin;
|
|
15109
|
+
insets.maxHeight = Math.max(80, Math.min(space, height - margin * 2));
|
|
15110
|
+
if (side === "top") insets.bottom = height - anchorRect.top + gap;
|
|
15111
|
+
else insets.top = anchorRect.bottom + gap;
|
|
15112
|
+
if (align === "end") insets.right = Math.max(margin, width - anchorRect.right);
|
|
15113
|
+
else insets.left = Math.max(margin, anchorRect.left);
|
|
15114
|
+
return insets;
|
|
15115
|
+
}
|
|
15116
|
+
if (side === "right" || side === "left") {
|
|
15117
|
+
insets.top = Math.max(margin, Math.min(anchorRect.top, height - margin - 80));
|
|
15118
|
+
insets.maxHeight = Math.max(80, height - margin * 2);
|
|
15119
|
+
if (side === "right") insets.left = anchorRect.right + gap;
|
|
15120
|
+
else insets.right = Math.max(margin, width - anchorRect.left + gap);
|
|
15121
|
+
return insets;
|
|
15122
|
+
}
|
|
15123
|
+
return null;
|
|
15124
|
+
}
|
|
15125
|
+
// dsv-anchor-math:end
|
|
15126
|
+
|
|
15127
|
+
/** Apply one computed placement to a portaled panel. */
|
|
15128
|
+
function applyAnchorPanelInsets(panel, anchor, side, align, gap) {
|
|
15129
|
+
const rect = anchor.getBoundingClientRect();
|
|
15130
|
+
if (rect.width <= 0 && rect.height <= 0) return false;
|
|
15131
|
+
const insets = anchorPanelInsets(rect, {
|
|
15132
|
+
width: document.documentElement.clientWidth || window.innerWidth || 0,
|
|
15133
|
+
height: document.documentElement.clientHeight || window.innerHeight || 0,
|
|
15134
|
+
}, side, align, gap);
|
|
15135
|
+
if (insets === null) return false;
|
|
15136
|
+
const style = panel.style;
|
|
15137
|
+
style.position = "fixed";
|
|
15138
|
+
style.top = insets.top === null ? "auto" : insets.top + "px";
|
|
15139
|
+
style.bottom = insets.bottom === null ? "auto" : insets.bottom + "px";
|
|
15140
|
+
style.left = insets.left === null ? "auto" : insets.left + "px";
|
|
15141
|
+
style.right = insets.right === null ? "auto" : insets.right + "px";
|
|
15142
|
+
style.maxHeight = insets.maxHeight + "px";
|
|
15143
|
+
style.maxWidth = insets.maxWidth + "px";
|
|
15144
|
+
try { panel.dataset.dsvAnchorFallback = ""; } catch {}
|
|
15145
|
+
return true;
|
|
15146
|
+
}
|
|
15147
|
+
|
|
15148
|
+
/** The trigger a panel points at, when DSH shares it as a custom property
|
|
15149
|
+
with the trigger (the model selector does: --dsh-model-anchor). */
|
|
15150
|
+
function anchorFromCustomProperty(panel) {
|
|
15151
|
+
if (panel.style === undefined) return null;
|
|
15152
|
+
let name = "";
|
|
15153
|
+
let value = "";
|
|
15154
|
+
for (let index = 0; index < panel.style.length; index += 1) {
|
|
15155
|
+
const property = panel.style.item(index);
|
|
15156
|
+
if (typeof property !== "string" || !property.startsWith("--")) continue;
|
|
15157
|
+
const candidate = String(panel.style.getPropertyValue(property) || "").trim();
|
|
15158
|
+
if (!candidate.startsWith("--")) continue;
|
|
15159
|
+
name = property;
|
|
15160
|
+
value = candidate;
|
|
15161
|
+
break;
|
|
15162
|
+
}
|
|
15163
|
+
if (name === "" || value === "") return null;
|
|
15164
|
+
for (const node of document.querySelectorAll("[style]")) {
|
|
15165
|
+
if (node === panel || panel.contains(node)) continue;
|
|
15166
|
+
if (node.hasAttribute("data-menu-backing")) continue;
|
|
15167
|
+
if (String(node.style.getPropertyValue(name) || "").trim() !== value) continue;
|
|
15168
|
+
const rect = node.getBoundingClientRect();
|
|
15169
|
+
if (rect.width > 0 || rect.height > 0) return node;
|
|
15170
|
+
}
|
|
15171
|
+
return null;
|
|
15172
|
+
}
|
|
15173
|
+
|
|
15174
|
+
/** Re-place stock menus while CSS anchor positioning is unavailable. */
|
|
15175
|
+
function installAnchorFallback() {
|
|
15176
|
+
if (cssAnchorPositioningSupported()) return null;
|
|
15177
|
+
if (document.body === null || document.body === undefined) return null;
|
|
15178
|
+
const state = { target: null, at: 0 };
|
|
15179
|
+
const timers = new Map();
|
|
15180
|
+
|
|
15181
|
+
const remember = (element) => {
|
|
15182
|
+
if (element === null || element === undefined) return;
|
|
15183
|
+
state.target = element;
|
|
15184
|
+
state.at = Date.now();
|
|
15185
|
+
};
|
|
15186
|
+
const buttonFrom = (target) => (target instanceof Element
|
|
15187
|
+
? target.closest('button, [role="button"], [role="menuitem"], [aria-haspopup]')
|
|
15188
|
+
: null);
|
|
15189
|
+
const onPointerDown = (event) => { remember(buttonFrom(event.target)); };
|
|
15190
|
+
const onPointerOver = (event) => {
|
|
15191
|
+
remember(event.target instanceof Element ? event.target.closest('[aria-haspopup="menu"]') : null);
|
|
15192
|
+
};
|
|
15193
|
+
const onKeyDown = (event) => {
|
|
15194
|
+
if (event.key !== "Enter" && event.key !== " " && event.key !== "Spacebar") return;
|
|
15195
|
+
remember(buttonFrom(event.target));
|
|
15196
|
+
};
|
|
15197
|
+
window.addEventListener("pointerdown", onPointerDown, true);
|
|
15198
|
+
window.addEventListener("pointerover", onPointerOver, true);
|
|
15199
|
+
window.addEventListener("keydown", onKeyDown, true);
|
|
15200
|
+
|
|
15201
|
+
/** A trigger is usable when it is still mounted and has a box. Menu rows
|
|
15202
|
+
stay usable: a submenu anchors to the row that opened it. */
|
|
15203
|
+
const visibleAnchor = (element) => {
|
|
15204
|
+
if (!(element instanceof Element) || element.isConnected !== true) return null;
|
|
15205
|
+
const rect = element.getBoundingClientRect();
|
|
15206
|
+
return rect.width > 0 || rect.height > 0 ? element : null;
|
|
15207
|
+
};
|
|
15208
|
+
const recentAnchor = () => {
|
|
15209
|
+
if (state.target === null || Date.now() - state.at > 4000) return null;
|
|
15210
|
+
return visibleAnchor(state.target);
|
|
15211
|
+
};
|
|
15212
|
+
const activeAnchor = () => {
|
|
15213
|
+
const active = document.activeElement;
|
|
15214
|
+
if (!(active instanceof Element)) return null;
|
|
15215
|
+
// Focus usually moves into the opened menu; a menu row is not a trigger.
|
|
15216
|
+
if (active.closest('[role="menu"], [role="listbox"]') !== null) return null;
|
|
15217
|
+
return visibleAnchor(active.closest('button, [role="button"], [aria-haspopup]') || active);
|
|
15218
|
+
};
|
|
15219
|
+
|
|
15220
|
+
const stop = (panel) => {
|
|
15221
|
+
const timer = timers.get(panel);
|
|
15222
|
+
if (timer === undefined) return;
|
|
15223
|
+
try { window.clearInterval(timer); } catch {}
|
|
15224
|
+
timers.delete(panel);
|
|
15225
|
+
};
|
|
15226
|
+
|
|
15227
|
+
const update = (panel, anchor) => {
|
|
15228
|
+
if (panel.isConnected !== true) { stop(panel); return false; }
|
|
15229
|
+
const current = anchor.isConnected === true ? anchor : (recentAnchor() || activeAnchor());
|
|
15230
|
+
if (current === null) return false;
|
|
15231
|
+
const menu = panel.hasAttribute("data-anchor-side");
|
|
15232
|
+
const side = menu ? (panel.getAttribute("data-anchor-side") || "bottom") : "top";
|
|
15233
|
+
const align = menu ? (panel.getAttribute("data-anchor-align") || "start") : "end";
|
|
15234
|
+
const gap = String(panel.style.getPropertyValue("--dsh-model-anchor") || "") === "" ? 4 : 8;
|
|
15235
|
+
return applyAnchorPanelInsets(panel, current, side, align, gap);
|
|
15236
|
+
};
|
|
15237
|
+
|
|
15238
|
+
const place = (panel) => {
|
|
15239
|
+
if (!(panel instanceof Element) || timers.has(panel)) return false;
|
|
15240
|
+
const menu = panel.hasAttribute("data-anchor-side");
|
|
15241
|
+
const model = panel.style !== undefined
|
|
15242
|
+
&& String(panel.style.getPropertyValue("--dsh-model-anchor") || "") !== "";
|
|
15243
|
+
if (!menu && !model) return false;
|
|
15244
|
+
const anchor = anchorFromCustomProperty(panel) || recentAnchor() || activeAnchor();
|
|
15245
|
+
if (anchor === null) return false;
|
|
15246
|
+
update(panel, anchor);
|
|
15247
|
+
timers.set(panel, window.setInterval(() => { update(panel, anchor); }, 150));
|
|
15248
|
+
return true;
|
|
15249
|
+
};
|
|
15250
|
+
|
|
15251
|
+
const observer = new MutationObserver((records) => {
|
|
15252
|
+
for (const record of records) {
|
|
15253
|
+
for (const node of record.addedNodes) {
|
|
15254
|
+
if (!(node instanceof Element)) continue;
|
|
15255
|
+
if (place(node)) continue;
|
|
15256
|
+
for (const panel of node.querySelectorAll("[data-anchor-side]")) place(panel);
|
|
15257
|
+
}
|
|
15258
|
+
for (const node of record.removedNodes) {
|
|
15259
|
+
if (!(node instanceof Element)) continue;
|
|
15260
|
+
stop(node);
|
|
15261
|
+
for (const panel of node.querySelectorAll("[data-anchor-side]")) stop(panel);
|
|
15262
|
+
}
|
|
15263
|
+
}
|
|
15264
|
+
});
|
|
15265
|
+
try {
|
|
15266
|
+
observer.observe(document.body, { childList: true, subtree: false });
|
|
15267
|
+
} catch {
|
|
15268
|
+
return null;
|
|
15269
|
+
}
|
|
15270
|
+
|
|
15271
|
+
return () => {
|
|
15272
|
+
try { observer.disconnect(); } catch {}
|
|
15273
|
+
window.removeEventListener("pointerdown", onPointerDown, true);
|
|
15274
|
+
window.removeEventListener("pointerover", onPointerOver, true);
|
|
15275
|
+
window.removeEventListener("keydown", onKeyDown, true);
|
|
15276
|
+
for (const [, timer] of timers) {
|
|
15277
|
+
try { window.clearInterval(timer); } catch {}
|
|
15278
|
+
}
|
|
15279
|
+
timers.clear();
|
|
15280
|
+
};
|
|
15281
|
+
}
|
|
15282
|
+
// dsv-anchor-fallback:end
|
|
15283
|
+
|
|
15067
15284
|
/** Boot hook: returns a disposer only in a native system window. */
|
|
15068
15285
|
function bootSystemWindow() {
|
|
15069
15286
|
const sessionId = systemWindowSessionId();
|
|
15070
15287
|
if (sessionId === null) return null;
|
|
15071
15288
|
try { document.documentElement.dataset.dsvSystemWindow = "1"; } catch {}
|
|
15072
15289
|
const disposeLayout = watchSystemWindowLayout();
|
|
15290
|
+
const disposeAnchorFallback = installAnchorFallback();
|
|
15073
15291
|
activateSystemWindowSession(sessionId);
|
|
15074
|
-
return
|
|
15292
|
+
return () => {
|
|
15293
|
+
try { disposeLayout(); } catch {}
|
|
15294
|
+
try { if (typeof disposeAnchorFallback === "function") disposeAnchorFallback(); } catch {}
|
|
15295
|
+
};
|
|
15075
15296
|
}
|
|
15076
15297
|
|
|
15077
15298
|
// The Host owns the system windows. This store mirrors their session ids
|
|
@@ -15177,9 +15398,10 @@ window.__ModuleLoader__.load({
|
|
|
15177
15398
|
return;
|
|
15178
15399
|
}
|
|
15179
15400
|
const code = payload !== null && payload !== undefined ? payload.error : undefined;
|
|
15180
|
-
|
|
15401
|
+
const failure = code === "unsupported-platform" || code === "not-desktop"
|
|
15181
15402
|
? "systemWindowUnsupported"
|
|
15182
|
-
: "systemWindowFailed")
|
|
15403
|
+
: (code === "webview2" ? "systemWindowWebView2Missing" : "systemWindowFailed");
|
|
15404
|
+
showPaneToast(t(failure), true);
|
|
15183
15405
|
}).catch(() => {
|
|
15184
15406
|
showPaneToast(t("systemWindowFailed"), true);
|
|
15185
15407
|
});
|
package/lib/index.js
CHANGED
|
@@ -12,9 +12,10 @@
|
|
|
12
12
|
* installed bundle;
|
|
13
13
|
* - it closes and reopens the Desktop app, because production DSH builds have
|
|
14
14
|
* no in-app restart entry (the split menu and update chip call this);
|
|
15
|
-
* - it opens a real, independent OS window
|
|
16
|
-
*
|
|
17
|
-
*
|
|
15
|
+
* - it opens a real, independent OS window: an AppKit NSWindow hosted by the
|
|
16
|
+
* system WebView on macOS (osascript), or a WinForms window hosting the
|
|
17
|
+
* WebView2 control on Windows. Both load the Host's authenticated web client
|
|
18
|
+
* with a hash marker; the renderer never receives the launch token.
|
|
18
19
|
*/
|
|
19
20
|
|
|
20
21
|
import { spawn } from "node:child_process";
|
|
@@ -37,6 +38,12 @@ const HELP_ASSETS = {
|
|
|
37
38
|
/** Header a same-page action must send; blocks cross-site form posts. */
|
|
38
39
|
const NATIVE_WINDOW_CONFIRM = "x-dsv-system-window";
|
|
39
40
|
const NATIVE_WINDOW_SCRIPT = fileURLToPath(new URL("../native/system-window.jxa", import.meta.url));
|
|
41
|
+
/** Windows counterpart: a WinForms window hosting the WebView2 control. */
|
|
42
|
+
const NATIVE_WINDOW_SCRIPT_WIN = fileURLToPath(new URL("../native/system-window.ps1", import.meta.url));
|
|
43
|
+
/** Vendored WebView2 SDK assets (BSD-3-Clause; see THIRD-PARTY-NOTICES.md). */
|
|
44
|
+
const NATIVE_WINDOW_WEBVIEW2_DIR = fileURLToPath(new URL("../native/webview2", import.meta.url));
|
|
45
|
+
/** How long a Windows helper may run before the window counts as opening. */
|
|
46
|
+
const NATIVE_WINDOW_STARTUP_MS = 1500;
|
|
40
47
|
const NATIVE_WINDOW_LOG = resolve(tmpdir(), "dsh-split-workspace-system-window.log");
|
|
41
48
|
/** The Desktop app has no in-app restart entry in production builds; this
|
|
42
49
|
route recreates that one action at the OS level. */
|
|
@@ -98,13 +105,87 @@ function nativeWindowSessions() {
|
|
|
98
105
|
return sessions;
|
|
99
106
|
}
|
|
100
107
|
|
|
108
|
+
/** Platforms that can host a real, independent OS window from the plugin. */
|
|
109
|
+
export function nativeWindowSupported(platform) {
|
|
110
|
+
return platform === "darwin" || platform === "win32";
|
|
111
|
+
}
|
|
112
|
+
|
|
101
113
|
/**
|
|
102
|
-
*
|
|
103
|
-
*
|
|
104
|
-
* renderer.
|
|
114
|
+
* The detached helper command for one system window. The authenticated URL is
|
|
115
|
+
* handed to a same-user local process (an osascript argument on macOS, a
|
|
116
|
+
* base64 argument on Windows) and is never returned to the renderer.
|
|
105
117
|
*/
|
|
118
|
+
export function systemWindowCommand(platform, authenticatedUrl, sessionId) {
|
|
119
|
+
if (typeof authenticatedUrl !== "string" || authenticatedUrl === "") return null;
|
|
120
|
+
if (typeof sessionId !== "string" || !SESSION_ID_PATTERN.test(sessionId)) return null;
|
|
121
|
+
const target = authenticatedUrl + "#dsv-system-window=" + encodeURIComponent(sessionId);
|
|
122
|
+
if (platform === "darwin") {
|
|
123
|
+
return {
|
|
124
|
+
command: "/usr/bin/osascript",
|
|
125
|
+
args: ["-l", "JavaScript", NATIVE_WINDOW_SCRIPT, target],
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
if (platform === "win32") {
|
|
129
|
+
return {
|
|
130
|
+
command: "powershell.exe",
|
|
131
|
+
args: [
|
|
132
|
+
"-NoProfile",
|
|
133
|
+
"-NonInteractive",
|
|
134
|
+
"-Sta",
|
|
135
|
+
"-ExecutionPolicy", "Bypass",
|
|
136
|
+
"-WindowStyle", "Hidden",
|
|
137
|
+
"-File", NATIVE_WINDOW_SCRIPT_WIN,
|
|
138
|
+
"-UrlB64", Buffer.from(target, "utf8").toString("base64"),
|
|
139
|
+
"-WebView2Dir", NATIVE_WINDOW_WEBVIEW2_DIR,
|
|
140
|
+
],
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
return null;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/** Resolve true only when the helper dies before its window is up. */
|
|
147
|
+
function waitForEarlyExit(child, timeoutMs) {
|
|
148
|
+
return new Promise((resolve) => {
|
|
149
|
+
if (child.exitCode !== null || child.signalCode !== null) {
|
|
150
|
+
resolve(true);
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
let settled = false;
|
|
154
|
+
const timer = setTimeout(() => {
|
|
155
|
+
if (settled) return;
|
|
156
|
+
settled = true;
|
|
157
|
+
resolve(false);
|
|
158
|
+
}, timeoutMs);
|
|
159
|
+
child.once("exit", () => {
|
|
160
|
+
if (settled) return;
|
|
161
|
+
settled = true;
|
|
162
|
+
clearTimeout(timer);
|
|
163
|
+
resolve(true);
|
|
164
|
+
});
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/** End one helper process. On Windows the whole tree must go, otherwise the
|
|
169
|
+
WebView2 browser process outlives the window it belonged to. */
|
|
170
|
+
function killNativeWindow(child) {
|
|
171
|
+
try {
|
|
172
|
+
if (process.platform === "win32" && typeof child.pid === "number" && child.pid > 0) {
|
|
173
|
+
spawn("taskkill.exe", ["/PID", String(child.pid), "/T", "/F"], {
|
|
174
|
+
stdio: "ignore",
|
|
175
|
+
windowsHide: true,
|
|
176
|
+
}).unref();
|
|
177
|
+
return true;
|
|
178
|
+
}
|
|
179
|
+
return child.kill() === true;
|
|
180
|
+
} catch (error) {
|
|
181
|
+
nativeWindowLog("warn", "could not close the system window: " + String(error));
|
|
182
|
+
return false;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/** Spawn the platform helper window (macOS AppKit, Windows WinForms+WebView2). */
|
|
106
187
|
function openNativeSystemWindow(webCtx, res, sessionId) {
|
|
107
|
-
if (process.platform
|
|
188
|
+
if (!nativeWindowSupported(process.platform)) {
|
|
108
189
|
respond(res, 200, { ok: false, error: "unsupported-platform", platform: process.platform });
|
|
109
190
|
return;
|
|
110
191
|
}
|
|
@@ -128,13 +209,19 @@ function openNativeSystemWindow(webCtx, res, sessionId) {
|
|
|
128
209
|
respond(res, 503, { ok: false, error: "web-server" });
|
|
129
210
|
return;
|
|
130
211
|
}
|
|
131
|
-
const
|
|
212
|
+
const command = systemWindowCommand(process.platform, url, sessionId);
|
|
213
|
+
if (command === null) {
|
|
214
|
+
nativeWindowLog("warn", "unsupported system window command on " + process.platform);
|
|
215
|
+
respond(res, 500, { ok: false, error: "spawn" });
|
|
216
|
+
return;
|
|
217
|
+
}
|
|
132
218
|
let child;
|
|
133
219
|
try {
|
|
134
220
|
const logFd = openSync(NATIVE_WINDOW_LOG, "a");
|
|
135
221
|
try {
|
|
136
|
-
child = spawn(
|
|
222
|
+
child = spawn(command.command, command.args, {
|
|
137
223
|
detached: true,
|
|
224
|
+
windowsHide: true,
|
|
138
225
|
stdio: ["ignore", logFd, logFd],
|
|
139
226
|
});
|
|
140
227
|
} finally {
|
|
@@ -155,7 +242,24 @@ function openNativeSystemWindow(webCtx, res, sessionId) {
|
|
|
155
242
|
nativeWindowLog("warn", "system window process error: " + String(error));
|
|
156
243
|
});
|
|
157
244
|
child.unref();
|
|
158
|
-
|
|
245
|
+
if (process.platform !== "win32") {
|
|
246
|
+
respond(res, 200, { ok: true, mode: "native", platform: process.platform });
|
|
247
|
+
return;
|
|
248
|
+
}
|
|
249
|
+
// The Windows helper has to start PowerShell and load WebView2: a missing
|
|
250
|
+
// Runtime or broken helper exits within the startup window, and the user
|
|
251
|
+
// deserves the reason instead of a success toast.
|
|
252
|
+
waitForEarlyExit(child, NATIVE_WINDOW_STARTUP_MS).then((exited) => {
|
|
253
|
+
if (exited === true) {
|
|
254
|
+
respond(res, 200, {
|
|
255
|
+
ok: false,
|
|
256
|
+
error: child.exitCode === 3 ? "webview2" : "window-failed",
|
|
257
|
+
platform: process.platform,
|
|
258
|
+
});
|
|
259
|
+
return;
|
|
260
|
+
}
|
|
261
|
+
respond(res, 200, { ok: true, mode: "native", platform: process.platform });
|
|
262
|
+
});
|
|
159
263
|
}
|
|
160
264
|
|
|
161
265
|
/** Close one session's native window, if it is still open. */
|
|
@@ -166,13 +270,7 @@ function closeNativeSystemWindow(res, sessionId) {
|
|
|
166
270
|
return;
|
|
167
271
|
}
|
|
168
272
|
nativeWindows.delete(sessionId);
|
|
169
|
-
|
|
170
|
-
try {
|
|
171
|
-
closed = child.kill() === true;
|
|
172
|
-
} catch (error) {
|
|
173
|
-
nativeWindowLog("warn", "could not close the system window: " + String(error));
|
|
174
|
-
}
|
|
175
|
-
respond(res, 200, { ok: true, mode: "native", closed });
|
|
273
|
+
respond(res, 200, { ok: true, mode: "native", closed: killNativeWindow(child) });
|
|
176
274
|
}
|
|
177
275
|
|
|
178
276
|
/** Read a bounded JSON body and hand back one validated window request. */
|
|
@@ -290,8 +388,8 @@ export function apply(ctx) {
|
|
|
290
388
|
if (!nativeWindowExitHook) {
|
|
291
389
|
nativeWindowExitHook = true;
|
|
292
390
|
process.once("exit", () => {
|
|
293
|
-
for (const child of nativeWindows) {
|
|
294
|
-
try { child
|
|
391
|
+
for (const child of nativeWindows.values()) {
|
|
392
|
+
try { killNativeWindow(child); } catch {}
|
|
295
393
|
}
|
|
296
394
|
});
|
|
297
395
|
}
|
|
@@ -402,7 +500,7 @@ export function apply(ctx) {
|
|
|
402
500
|
return;
|
|
403
501
|
}
|
|
404
502
|
if (request.action === "close") {
|
|
405
|
-
if (process.platform
|
|
503
|
+
if (!nativeWindowSupported(process.platform)) {
|
|
406
504
|
respond(res, 200, { ok: false, error: "unsupported-platform", platform: process.platform });
|
|
407
505
|
return;
|
|
408
506
|
}
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
<#
|
|
2
|
+
dsh-split-workspace - native Windows system window (WebView2 host).
|
|
3
|
+
|
|
4
|
+
DSH Desktop exposes no plugin-facing BrowserWindow API: the plugin Host is
|
|
5
|
+
Electron running in Node mode (ELECTRON_RUN_AS_NODE=1), and the renderer is
|
|
6
|
+
sandboxed with no window-creation surface. This helper is the Windows
|
|
7
|
+
counterpart of native/system-window.jxa: a WinForms form hosting a WebView2
|
|
8
|
+
control that loads the Host's authenticated web client, so the window is a
|
|
9
|
+
real, independent OS window with no browser chrome.
|
|
10
|
+
|
|
11
|
+
Usage (started by the plugin Host, never by the user):
|
|
12
|
+
powershell.exe -NoProfile -NonInteractive -Sta -ExecutionPolicy Bypass \
|
|
13
|
+
-WindowStyle Hidden -File system-window.ps1 \
|
|
14
|
+
-UrlB64 <base64 of the authenticated client URL> \
|
|
15
|
+
-WebView2Dir <directory with the WebView2 SDK assets>
|
|
16
|
+
|
|
17
|
+
The URL is base64 encoded so session identifiers or query values can never
|
|
18
|
+
be reinterpreted by the PowerShell argument parser. It carries the Host
|
|
19
|
+
launch token once; the page then redirects itself to the clean URL and the
|
|
20
|
+
WebView2 profile keeps the cookie for the rest of the window's life.
|
|
21
|
+
|
|
22
|
+
Exit codes: 0 = window closed by the user, 2 = bad arguments,
|
|
23
|
+
3 = WebView2 Runtime missing, 4 = helper assets unusable,
|
|
24
|
+
5 = WebView2 initialization failed, 1 = unexpected failure.
|
|
25
|
+
#>
|
|
26
|
+
|
|
27
|
+
param(
|
|
28
|
+
[Parameter(Mandatory = $true)][string]$UrlB64,
|
|
29
|
+
[string]$WebView2Dir = ''
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
$ErrorActionPreference = 'Stop'
|
|
33
|
+
|
|
34
|
+
function Write-DsvError([string]$Message) {
|
|
35
|
+
try { [Console]::Error.WriteLine('[dsh-split-workspace] ' + $Message) } catch { }
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function Exit-Fail([string]$Message, [int]$Code) {
|
|
39
|
+
Write-DsvError $Message
|
|
40
|
+
[Environment]::Exit($Code)
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
$script:form = $null
|
|
44
|
+
$script:web = $null
|
|
45
|
+
$script:dataDir = $null
|
|
46
|
+
|
|
47
|
+
try {
|
|
48
|
+
# ---- target ----------------------------------------------------------
|
|
49
|
+
try {
|
|
50
|
+
$target = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($UrlB64))
|
|
51
|
+
} catch {
|
|
52
|
+
Exit-Fail 'invalid UrlB64 payload' 2
|
|
53
|
+
}
|
|
54
|
+
if ([string]::IsNullOrWhiteSpace($target)) { Exit-Fail 'empty system window URL' 2 }
|
|
55
|
+
|
|
56
|
+
# ---- DPI awareness (best effort) -------------------------------------
|
|
57
|
+
try {
|
|
58
|
+
Add-Type -Namespace Dsv -Name Dpi -MemberDefinition @'
|
|
59
|
+
[System.Runtime.InteropServices.DllImport("user32.dll")]
|
|
60
|
+
public static extern bool SetProcessDpiAwarenessContext(System.IntPtr value);
|
|
61
|
+
[System.Runtime.InteropServices.DllImport("user32.dll")]
|
|
62
|
+
public static extern bool SetProcessDPIAware();
|
|
63
|
+
'@ | Out-Null
|
|
64
|
+
try { [Dsv.Dpi]::SetProcessDpiAwarenessContext([System.IntPtr]::new(-4)) | Out-Null } catch { }
|
|
65
|
+
try { [Dsv.Dpi]::SetProcessDPIAware() | Out-Null } catch { }
|
|
66
|
+
} catch { }
|
|
67
|
+
|
|
68
|
+
# ---- helper assets ---------------------------------------------------
|
|
69
|
+
if ([string]::IsNullOrWhiteSpace($WebView2Dir)) { $WebView2Dir = Join-Path $PSScriptRoot 'webview2' }
|
|
70
|
+
$corePath = Join-Path $WebView2Dir 'Microsoft.Web.WebView2.Core.dll'
|
|
71
|
+
$winFormsPath = Join-Path $WebView2Dir 'Microsoft.Web.WebView2.WinForms.dll'
|
|
72
|
+
$arch = [string]$env:PROCESSOR_ARCHITECTURE
|
|
73
|
+
switch ($arch) {
|
|
74
|
+
'AMD64' { $loaderDir = Join-Path $WebView2Dir 'x64' }
|
|
75
|
+
'ARM64' { $loaderDir = Join-Path $WebView2Dir 'arm64' }
|
|
76
|
+
default { Exit-Fail ('unsupported processor architecture: ' + $arch) 4 }
|
|
77
|
+
}
|
|
78
|
+
$loaderPath = Join-Path $loaderDir 'WebView2Loader.dll'
|
|
79
|
+
foreach ($path in @($corePath, $winFormsPath, $loaderPath)) {
|
|
80
|
+
if (-not (Test-Path -LiteralPath $path)) { Exit-Fail ('missing WebView2 asset: ' + $path) 4 }
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
Add-Type -AssemblyName System.Windows.Forms
|
|
84
|
+
Add-Type -AssemblyName System.Drawing
|
|
85
|
+
|
|
86
|
+
# WebView2Loader.dll is resolved through DllImport from the Core assembly,
|
|
87
|
+
# so its folder must be on the process DLL search path before any call.
|
|
88
|
+
try {
|
|
89
|
+
Add-Type -Namespace Dsv -Name Native -MemberDefinition @'
|
|
90
|
+
[System.Runtime.InteropServices.DllImport("kernel32.dll", CharSet = System.Runtime.InteropServices.CharSet.Unicode, SetLastError = true)]
|
|
91
|
+
public static extern bool SetDllDirectory(string path);
|
|
92
|
+
'@ | Out-Null
|
|
93
|
+
[Dsv.Native]::SetDllDirectory($loaderDir) | Out-Null
|
|
94
|
+
} catch {
|
|
95
|
+
$env:PATH = $loaderDir + ';' + $env:PATH
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
try { [System.Reflection.Assembly]::LoadFrom($corePath) | Out-Null }
|
|
99
|
+
catch { Exit-Fail ('could not load Microsoft.Web.WebView2.Core.dll: ' + $_.Exception.Message) 4 }
|
|
100
|
+
try { [System.Reflection.Assembly]::LoadFrom($winFormsPath) | Out-Null }
|
|
101
|
+
catch { Exit-Fail ('could not load Microsoft.Web.WebView2.WinForms.dll: ' + $_.Exception.Message) 4 }
|
|
102
|
+
|
|
103
|
+
# The Evergreen Runtime is installed by Edge on Windows 10/11. Missing
|
|
104
|
+
# runtime is a common, actionable failure: report it with its own code so
|
|
105
|
+
# the client can explain what to install instead of a generic error.
|
|
106
|
+
try {
|
|
107
|
+
$null = [Microsoft.Web.WebView2.Core.CoreWebView2Environment]::GetAvailableBrowserVersionString()
|
|
108
|
+
} catch {
|
|
109
|
+
Exit-Fail 'Microsoft Edge WebView2 Runtime is not installed' 3
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
# ---- window ----------------------------------------------------------
|
|
113
|
+
# Force-killed helpers (Host close, DSH quit) cannot delete their profile:
|
|
114
|
+
# sweep anything older than a day so profiles never pile up.
|
|
115
|
+
try {
|
|
116
|
+
Get-ChildItem -LiteralPath ([System.IO.Path]::GetTempPath()) -Directory -Filter 'dsh-split-workspace-system-window-*' -ErrorAction SilentlyContinue |
|
|
117
|
+
Where-Object { $_.LastWriteTime -lt (Get-Date).AddDays(-1) } |
|
|
118
|
+
Remove-Item -Recurse -Force -ErrorAction SilentlyContinue
|
|
119
|
+
} catch { }
|
|
120
|
+
|
|
121
|
+
$script:dataDir = Join-Path ([System.IO.Path]::GetTempPath()) ('dsh-split-workspace-system-window-' + [Guid]::NewGuid().ToString('N'))
|
|
122
|
+
New-Item -ItemType Directory -Path $script:dataDir -Force | Out-Null
|
|
123
|
+
# One browser profile per window: several system windows may be open at
|
|
124
|
+
# once and WebView2 allows only one browser process per data folder.
|
|
125
|
+
$env:WEBVIEW2_USER_DATA_FOLDER = $script:dataDir
|
|
126
|
+
|
|
127
|
+
[System.Windows.Forms.Application]::EnableVisualStyles()
|
|
128
|
+
[System.Windows.Forms.Application]::SetCompatibleTextRenderingDefault($false)
|
|
129
|
+
|
|
130
|
+
$area = [System.Windows.Forms.Screen]::PrimaryScreen.WorkingArea
|
|
131
|
+
$width = [Math]::Min(1320, [Math]::Max(900, [int]($area.Width * 0.78)))
|
|
132
|
+
$height = [Math]::Min(920, [Math]::Max(640, [int]($area.Height * 0.86)))
|
|
133
|
+
|
|
134
|
+
$form = New-Object System.Windows.Forms.Form
|
|
135
|
+
$form.Text = 'DeepSeek Harness'
|
|
136
|
+
$form.StartPosition = [System.Windows.Forms.FormStartPosition]::CenterScreen
|
|
137
|
+
$form.MinimumSize = New-Object System.Drawing.Size(720, 520)
|
|
138
|
+
$form.ClientSize = New-Object System.Drawing.Size($width, $height)
|
|
139
|
+
$form.BackColor = [System.Drawing.Color]::FromArgb(15, 17, 21)
|
|
140
|
+
$script:form = $form
|
|
141
|
+
|
|
142
|
+
$web = New-Object Microsoft.Web.WebView2.WinForms.WebView2
|
|
143
|
+
$web.Dock = [System.Windows.Forms.DockStyle]::Fill
|
|
144
|
+
$script:web = $web
|
|
145
|
+
$form.Controls.Add($web)
|
|
146
|
+
|
|
147
|
+
$web.add_CoreWebView2InitializationCompleted({
|
|
148
|
+
param($sender, $eventArgs)
|
|
149
|
+
$failed = $true
|
|
150
|
+
if ($eventArgs -ne $null) { $failed = -not $eventArgs.IsSuccess }
|
|
151
|
+
if ($failed) {
|
|
152
|
+
$reason = 'unknown error'
|
|
153
|
+
if ($eventArgs -ne $null -and $eventArgs.InitializationException -ne $null) {
|
|
154
|
+
$reason = $eventArgs.InitializationException.Message
|
|
155
|
+
}
|
|
156
|
+
Write-DsvError ('WebView2 initialization failed: ' + $reason)
|
|
157
|
+
try {
|
|
158
|
+
[System.Windows.Forms.MessageBox]::Show(
|
|
159
|
+
'The system window could not start WebView2.' + [Environment]::NewLine + [Environment]::NewLine + $reason,
|
|
160
|
+
'DeepSeek Harness',
|
|
161
|
+
[System.Windows.Forms.MessageBoxButtons]::OK,
|
|
162
|
+
[System.Windows.Forms.MessageBoxIcon]::Error) | Out-Null
|
|
163
|
+
} catch { }
|
|
164
|
+
# Exit non-zero so the Host can report "could not open" instead of
|
|
165
|
+
# leaving the menu in the entered state.
|
|
166
|
+
[Environment]::Exit(5)
|
|
167
|
+
return
|
|
168
|
+
}
|
|
169
|
+
try {
|
|
170
|
+
$core = $sender.CoreWebView2
|
|
171
|
+
# Links that ask for a new window behave like the main DSH window:
|
|
172
|
+
# the request is denied and the URL goes to the default browser.
|
|
173
|
+
$core.add_NewWindowRequested({
|
|
174
|
+
param($s, $e)
|
|
175
|
+
try {
|
|
176
|
+
$e.Handled = $true
|
|
177
|
+
$uri = [string]$e.Uri
|
|
178
|
+
if (-not [string]::IsNullOrWhiteSpace($uri)) { Start-Process -FilePath $uri | Out-Null }
|
|
179
|
+
} catch { }
|
|
180
|
+
})
|
|
181
|
+
$core.add_DocumentTitleChanged({
|
|
182
|
+
param($s, $e)
|
|
183
|
+
try {
|
|
184
|
+
$title = $s.DocumentTitle
|
|
185
|
+
if (-not [string]::IsNullOrWhiteSpace($title)) { $script:form.Text = $title }
|
|
186
|
+
} catch { }
|
|
187
|
+
})
|
|
188
|
+
try { $core.Controller.DefaultBackgroundColor = [System.Drawing.Color]::FromArgb(15, 17, 21) } catch { }
|
|
189
|
+
$core.Navigate($target)
|
|
190
|
+
} catch {
|
|
191
|
+
Write-DsvError ('WebView2 navigation failed: ' + $_.Exception.Message)
|
|
192
|
+
try { $script:form.Close() } catch { }
|
|
193
|
+
}
|
|
194
|
+
})
|
|
195
|
+
|
|
196
|
+
$form.Add_Shown({
|
|
197
|
+
try { $script:form.Activate() } catch { }
|
|
198
|
+
try { $script:web.Focus() | Out-Null } catch { }
|
|
199
|
+
# The WebView2 control needs the form's window handle: initialize it
|
|
200
|
+
# after the window is shown, while the message loop is running.
|
|
201
|
+
try {
|
|
202
|
+
$null = $script:web.EnsureCoreWebView2Async()
|
|
203
|
+
} catch {
|
|
204
|
+
Write-DsvError ('could not create the WebView2 environment: ' + $_.Exception.Message)
|
|
205
|
+
try {
|
|
206
|
+
[System.Windows.Forms.MessageBox]::Show(
|
|
207
|
+
'The system window could not create the WebView2 environment.' + [Environment]::NewLine + [Environment]::NewLine + $_.Exception.Message,
|
|
208
|
+
'DeepSeek Harness',
|
|
209
|
+
[System.Windows.Forms.MessageBoxButtons]::OK,
|
|
210
|
+
[System.Windows.Forms.MessageBoxIcon]::Error) | Out-Null
|
|
211
|
+
} catch { }
|
|
212
|
+
[Environment]::Exit(5)
|
|
213
|
+
}
|
|
214
|
+
})
|
|
215
|
+
|
|
216
|
+
$form.Add_FormClosed({
|
|
217
|
+
try { if ($script:web -ne $null) { $script:web.Dispose() } } catch { }
|
|
218
|
+
try {
|
|
219
|
+
if (-not [string]::IsNullOrWhiteSpace($script:dataDir) -and (Test-Path -LiteralPath $script:dataDir)) {
|
|
220
|
+
Remove-Item -LiteralPath $script:dataDir -Recurse -Force -ErrorAction SilentlyContinue
|
|
221
|
+
}
|
|
222
|
+
} catch { }
|
|
223
|
+
[System.Windows.Forms.Application]::Exit()
|
|
224
|
+
})
|
|
225
|
+
|
|
226
|
+
[System.Windows.Forms.Application]::Run($form)
|
|
227
|
+
exit 0
|
|
228
|
+
} catch {
|
|
229
|
+
Exit-Fail ('system window failed: ' + $_.Exception.Message) 1
|
|
230
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
Copyright (C) Microsoft Corporation. All rights reserved.
|
|
2
|
+
|
|
3
|
+
Redistribution and use in source and binary forms, with or without
|
|
4
|
+
modification, are permitted provided that the following conditions are
|
|
5
|
+
met:
|
|
6
|
+
|
|
7
|
+
* Redistributions of source code must retain the above copyright
|
|
8
|
+
notice, this list of conditions and the following disclaimer.
|
|
9
|
+
* Redistributions in binary form must reproduce the above
|
|
10
|
+
copyright notice, this list of conditions and the following disclaimer
|
|
11
|
+
in the documentation and/or other materials provided with the
|
|
12
|
+
distribution.
|
|
13
|
+
* The name of Microsoft Corporation, or the names of its contributors
|
|
14
|
+
may not be used to endorse or promote products derived from this
|
|
15
|
+
software without specific prior written permission.
|
|
16
|
+
|
|
17
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
18
|
+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
19
|
+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
20
|
+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
21
|
+
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
22
|
+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
23
|
+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
24
|
+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
25
|
+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
26
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
27
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
NOTICES AND INFORMATION
|
|
2
|
+
Do Not Translate or Localize
|
|
3
|
+
|
|
4
|
+
This software incorporates material from third parties. Microsoft makes certain
|
|
5
|
+
open source code available at https://3rdpartysource.microsoft.com, or you may
|
|
6
|
+
send a check or money order for US $5.00, including the product name, the open
|
|
7
|
+
source component name, and version number, to:
|
|
8
|
+
|
|
9
|
+
Source Code Compliance Team
|
|
10
|
+
Microsoft Corporation
|
|
11
|
+
One Microsoft Way
|
|
12
|
+
Redmond, WA 98052
|
|
13
|
+
USA
|
|
14
|
+
|
|
15
|
+
Notwithstanding any other terms, you may reverse engineer this software to the
|
|
16
|
+
extent required to debug changes to any libraries licensed under the GNU Lesser
|
|
17
|
+
General Public License.
|
|
18
|
+
|
|
19
|
+
----------------------------------------------------------------
|
|
20
|
+
|
|
21
|
+
Antlr3.Runtime 3.5.2-rc1 - BSD 3-Clause
|
|
22
|
+
|
|
23
|
+
[The "BSD license"]
|
|
24
|
+
Copyright (c) 2011 The ANTLR Project
|
|
25
|
+
All rights reserved.
|
|
26
|
+
|
|
27
|
+
Redistribution and use in source and binary forms, with or without
|
|
28
|
+
modification, are permitted provided that the following conditions
|
|
29
|
+
are met:
|
|
30
|
+
|
|
31
|
+
1. Redistributions of source code must retain the above copyright
|
|
32
|
+
notice, this list of conditions and the following disclaimer.
|
|
33
|
+
2. Redistributions in binary form must reproduce the above copyright
|
|
34
|
+
notice, this list of conditions and the following disclaimer in the
|
|
35
|
+
documentation and/or other materials provided with the distribution.
|
|
36
|
+
3. Neither the name of the copyright holder nor the names of its
|
|
37
|
+
contributors may be used to endorse or promote products derived from
|
|
38
|
+
this software without specific prior written permission.
|
|
39
|
+
|
|
40
|
+
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|
41
|
+
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
42
|
+
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
43
|
+
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
44
|
+
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
45
|
+
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
46
|
+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
47
|
+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
48
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
49
|
+
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
50
|
+
|
|
51
|
+
---------------------------------------------------------
|
|
52
|
+
|
|
53
|
+
---------------------------------------------------------
|
|
54
|
+
|
|
55
|
+
StringTemplate4 4.0.9-rc1 - BSD 3-Clause
|
|
56
|
+
|
|
57
|
+
[The "BSD license"]
|
|
58
|
+
Copyright (c) 2011 The ANTLR Project
|
|
59
|
+
All rights reserved.
|
|
60
|
+
|
|
61
|
+
Redistribution and use in source and binary forms, with or without
|
|
62
|
+
modification, are permitted provided that the following conditions
|
|
63
|
+
are met:
|
|
64
|
+
|
|
65
|
+
1. Redistributions of source code must retain the above copyright
|
|
66
|
+
notice, this list of conditions and the following disclaimer.
|
|
67
|
+
2. Redistributions in binary form must reproduce the above copyright
|
|
68
|
+
notice, this list of conditions and the following disclaimer in the
|
|
69
|
+
documentation and/or other materials provided with the distribution.
|
|
70
|
+
3. Neither the name of the copyright holder nor the names of its
|
|
71
|
+
contributors may be used to endorse or promote products derived from
|
|
72
|
+
this software without specific prior written permission.
|
|
73
|
+
|
|
74
|
+
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|
75
|
+
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
76
|
+
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
77
|
+
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
78
|
+
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
79
|
+
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
80
|
+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
81
|
+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
82
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
83
|
+
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
84
|
+
|
|
85
|
+
---------------------------------------------------------
|
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-split-workspace",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.0",
|
|
4
4
|
"type": "module",
|
|
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, in-app independent windows, a native OS system window (macOS), a Settings page, and a performance mode for slow machines.",
|
|
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, in-app independent windows, a native OS system window (macOS AppKit, Windows WebView2), a Settings page, and a performance mode for slow machines.",
|
|
6
6
|
"icon": "./icon.svg",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"author": "mhlywxl",
|
|
@@ -35,6 +35,8 @@
|
|
|
35
35
|
"docs/screenshots/*.gif",
|
|
36
36
|
"CHANGELOG.md",
|
|
37
37
|
"native/system-window.jxa",
|
|
38
|
+
"native/system-window.ps1",
|
|
39
|
+
"native/webview2/**",
|
|
38
40
|
"README.md",
|
|
39
41
|
"LICENSE",
|
|
40
42
|
"THIRD-PARTY-NOTICES.md"
|
|
@@ -101,6 +103,7 @@
|
|
|
101
103
|
"build:check": "node scripts/build-client.mjs --check",
|
|
102
104
|
"test": "node scripts/build-client.mjs --check && node test.mjs",
|
|
103
105
|
"check": "node scripts/build-client.mjs --check && node --check lib/client.js && node test.mjs",
|
|
106
|
+
"check:anchor": "node scripts/check-wkwebview-anchor.mjs",
|
|
104
107
|
"pack:check": "npm pack --dry-run"
|
|
105
108
|
}
|
|
106
109
|
}
|