dsh-split-workspace 0.11.1 → 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 +98 -0
- package/README.md +157 -26
- package/THIRD-PARTY-NOTICES.md +17 -0
- package/lib/client.js +1220 -82
- package/lib/index.js +118 -20
- package/locale/en.json +1 -1
- package/locale/zh.json +1 -1
- 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/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
|
}
|
package/locale/en.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"meta": {
|
|
3
3
|
"title": "Split Workspace",
|
|
4
|
-
"description": "Unlimited split workspace for DeepSeek Harness: native in-process panes, a shared sidebar, automatic columns/L/2×2/grid layouts, and drag-to-rearrange. Works in the Desktop app."
|
|
4
|
+
"description": "Unlimited split workspace for DeepSeek Harness: a Split view sidebar panel, native in-process panes, a shared sidebar, automatic columns/L/2×2/grid layouts, and drag-to-rearrange. Works in the Desktop app."
|
|
5
5
|
}
|
|
6
6
|
}
|
package/locale/zh.json
CHANGED
|
@@ -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
|
}
|