dsh-split-workspace 0.11.0 → 0.11.1

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 CHANGED
@@ -4,6 +4,17 @@
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.11.1] - 2026-11-18
8
+
9
+ ### Fixed
10
+
11
+ - **修复重建后的客户端 bundle 无法热替换、必须刷新页面或重启 DSH 才能恢复菜单的问题。** 插件在浏览器端的工厂每次执行都会把只读诊断接口 `__test` 定义到 `window.__dshSplitWorkspace` 上(`configurable: false`)。DSH 在打开的页面里热替换重建后的客户端 bundle 时会再次执行同一个工厂,第二次定义抛出 `TypeError: Cannot redefine property: __test`,整个工厂就此中断:**左下角分屏按钮、会话右键「分屏插件」菜单和「设置 → 分屏工作区」同时消失**,DSH 把该插件记为“本页面的插件未能完成同步”,只能刷新页面或重启才能恢复。此前为了让改动生效而反复重启 DSH,原因就是这个异常,而不是 DSH 的热加载不生效。
12
+ - 现在每次 bundle 执行都创建一个**新的** `window.__dshSplitWorkspace` 对象,`__test` / `__svc` 等诊断成员改为通过带保护的安装函数定义:任何诊断接口都不能再让插件加载失败,被替换的 bundle 也不会再把上一次加载的闭包(`health()`、`retry()`、`__test` 里的各个函数)继续暴露出去。
13
+ - 覆盖的路径:热替换重建后的客户端 bundle、在设置 → 插件里禁用后再启用、以及从 0.11.0 热升级到 0.11.1——三种情况都在同一个页面内就地生效,不需要刷新或重启。
14
+ - 新增离线断言,防止重新引入“在继承的旧全局对象上重复定义成员”的写法。
15
+
16
+ **English summary:** Fixed the client bundle failing to hot-swap after a rebuild: the factory re-defined the read-only `__test` diagnostics seam on the inherited `window.__dshSplitWorkspace` object and threw `Cannot redefine property: __test`, which aborted the whole factory and left the footer button, session menus and Settings page missing until the page reloaded. Each bundle execution now publishes a fresh API object, and `__test` / `__svc` are installed through a guarded helper, so bundle replacement, disable→enable and the 0.11.0→0.11.1 hot upgrade all apply in place.
17
+
7
18
  ## [0.11.0] - 2026-11-18
8
19
 
9
20
  ### Added
package/README.md CHANGED
@@ -161,6 +161,8 @@ DSH 0.2.x(含 Desktop 0.2.2-rc.3)带 HMR:新安装的插件会被热加载
161
161
  - 插件管理器明确提示 `restart-required`(Host 半边、被链接包的宿主模块发生变化,或包目录被移动);
162
162
  - 安装后侧边栏底部几秒内没有出现分屏图标(少数没有 HMR 的旧版 DSH)。
163
163
 
164
+ **0.11.1 修复:重建客户端 bundle 后不再需要重启。** 之前每次重建 `lib/client.js` 后分屏按钮、右键菜单和「设置 → 分屏工作区」都会消失,必须刷新页面或重启 DSH 才回来——原因是插件工厂重复定义只读诊断接口 `__test` 时抛出 `Cannot redefine property`,整次加载被中断(DSH 会把它记为“本页面的插件未能完成同步”)。现在每次 bundle 执行都会创建一个新的公开对象,所以**热替换重建后的 bundle、在设置 → 插件里禁用后再启用、以及从 0.11.0 热升级到 0.11.1,都在同一个页面内就地生效**,不需要刷新或重启。
165
+
164
166
  DSH **生产版没有内置的“重启”菜单项**(开发版才有 `Restart App and Host`)。从本插件的 0.9.0 起:
165
167
 
166
168
  - 侧边栏底部 **分屏菜单 → 重启 DSH**:先确认(运行中的任务会中断),再由 Host 半调用系统级“退出并重新打开”(macOS 通过 AppleScript 正常退出,Windows 关闭窗口后终止进程并重启)。
@@ -538,6 +540,16 @@ installs/updates therefore need **no restart**. A restart is only needed when:
538
540
  - the footer split icon still has not appeared a few seconds after install (some
539
541
  older DSH builds without HMR).
540
542
 
543
+ **Fixed in 0.11.1: rebuilding the client bundle no longer needs a restart.** A
544
+ rebuild of `lib/client.js` used to make the footer button, the session menus and
545
+ **Settings → Split workspace** disappear until the page was reloaded, because the
546
+ plugin factory re-defined the read-only `__test` seam on the inherited
547
+ `window.__dshSplitWorkspace` object and threw `Cannot redefine property` — DSH
548
+ reported the entry as a failed page synchronization. Each bundle execution now
549
+ publishes a fresh public object, so **a rebuilt bundle hot-swaps, a disable →
550
+ enable cycle and the 0.11.0 → 0.11.1 hot upgrade all apply in place** without a
551
+ reload or restart.
552
+
541
553
  Production DSH has **no built-in Restart menu item** (development builds do).
542
554
  Since dsh-split-workspace 0.9.0:
543
555
 
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.11.0";
78
+ const PLUGIN_VERSION = "0.11.1";
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";
@@ -2352,6 +2352,57 @@ window.__ModuleLoader__.load({
2352
2352
  try { window.localStorage.removeItem(key); return true; } catch { return false; }
2353
2353
  }
2354
2354
 
2355
+ // ---------------------------------------------------------------------
2356
+ // public diagnostics global (one fresh object per bundle execution)
2357
+ //
2358
+ // `window.__dshSplitWorkspace` outlives the bundle that created it: DSH
2359
+ // swaps a rebuilt client bundle into the running page (client HMR `rebuilt`
2360
+ // frame) and a disable / enable cycle re-creates the entry without reloading
2361
+ // the page. The next factory execution therefore used to inherit the
2362
+ // previous one's descriptors — and the read-only `__test` seam is
2363
+ // non-configurable, so re-defining it on the inherited object threw
2364
+ // `TypeError: Cannot redefine property: __test`. That exception aborted the
2365
+ // whole factory: the footer button, the session menus and the Settings page
2366
+ // stayed missing (DSH listed the entry as a failed page synchronization)
2367
+ // until the user reloaded the page or restarted DSH. A fresh object per
2368
+ // execution makes every definition legal again and also stops a replacement
2369
+ // from publishing closures that belong to the previous bundle (health(),
2370
+ // retry(), __test helpers, …). Nothing inside the plugin reads the global,
2371
+ // so swapping the identity is safe.
2372
+ // ---------------------------------------------------------------------
2373
+
2374
+ /** The API object of THIS bundle execution. */
2375
+ let publicApiGlobal = null;
2376
+
2377
+ function pluginPublicApi() {
2378
+ if (publicApiGlobal === null) {
2379
+ publicApiGlobal = {};
2380
+ window.__dshSplitWorkspace = publicApiGlobal;
2381
+ }
2382
+ return publicApiGlobal;
2383
+ }
2384
+
2385
+ /** Define one member of the public global; a diagnostics seam must never
2386
+ take the plugin down, so a refused definition is only a warning. */
2387
+ function definePublicMember(key, descriptor) {
2388
+ const target = pluginPublicApi();
2389
+ if (Object.prototype.hasOwnProperty.call(target, key)) return false;
2390
+ try {
2391
+ Object.defineProperty(target, key, Object.assign({
2392
+ configurable: false,
2393
+ enumerable: false,
2394
+ writable: false,
2395
+ }, descriptor));
2396
+ return true;
2397
+ } catch (error) {
2398
+ try {
2399
+ const message = error !== null && error !== undefined && error.message !== undefined ? error.message : error;
2400
+ console.warn(LOG_PREFIX + " diagnostics seam '" + key + "' kept from the previous bundle: " + String(message));
2401
+ } catch {}
2402
+ return false;
2403
+ }
2404
+ }
2405
+
2355
2406
  /** Host release from the boot graph the web frontend injects:
2356
2407
  window.__DSH_BOOT__ = { release: { version, commit }, … }. */
2357
2408
  function readHostRelease() {
@@ -5438,7 +5489,7 @@ window.__ModuleLoader__.load({
5438
5489
  elected, or an entry elected without a store face. Diagnostics only —
5439
5490
  nothing in the render path reads it. */
5440
5491
  const composerChainDebug = { last: null, slots: null };
5441
- window.__dshSplitWorkspace = Object.assign(window.__dshSplitWorkspace || {}, { composerChain: composerChainDebug });
5492
+ Object.assign(pluginPublicApi(), { composerChain: composerChainDebug });
5442
5493
 
5443
5494
  /** Probe both slot-ledger surfaces for the keys this plugin consumes.
5444
5495
  `entries()` is the raw registration view (chain keys consume every
@@ -10628,7 +10679,7 @@ window.__ModuleLoader__.load({
10628
10679
  session-hotkeys side hides the whole workspace shell (persisted, with a
10629
10680
  restore affordance) and the tree comes back intact on restore.
10630
10681
  Returns null when there is no pane to close. */
10631
- window.__dshSplitWorkspace = Object.assign(window.__dshSplitWorkspace || {}, {
10682
+ Object.assign(pluginPublicApi(), {
10632
10683
  split(sessionId) {
10633
10684
  return safeCall("split()", () => {
10634
10685
  if (typeof sessionId !== "string" || sessionId === "") return null;
@@ -10813,7 +10864,7 @@ window.__ModuleLoader__.load({
10813
10864
  });
10814
10865
  // Live service seam (diagnostics only): lets the maintainer inspect the
10815
10866
  // right-sidebar controller and the shell layout while split view runs.
10816
- Object.defineProperty(window.__dshSplitWorkspace, "__svc", {
10867
+ definePublicMember("__svc", {
10817
10868
  value: Object.freeze({
10818
10869
  ctxAlive: () => pluginCtx !== null && pluginCtx !== undefined,
10819
10870
  names() {
@@ -10829,8 +10880,11 @@ window.__ModuleLoader__.load({
10829
10880
  configurable: true,
10830
10881
  });
10831
10882
  // Read-only test seam: production calls the very same functions, so the
10832
- // logic under test is the logic that runs on the user's host.
10833
- Object.defineProperty(window.__dshSplitWorkspace, "__test", {
10883
+ // logic under test is the logic that runs on the user's host. It is
10884
+ // deliberately non-configurable; the fresh per-execution API object (see
10885
+ // pluginPublicApi) is what keeps a live bundle replacement from throwing
10886
+ // `Cannot redefine property`.
10887
+ definePublicMember("__test", {
10834
10888
  value: Object.freeze({
10835
10889
  frameColumns,
10836
10890
  selectFrameColumns,
@@ -10858,8 +10912,6 @@ window.__ModuleLoader__.load({
10858
10912
  COLUMN_MIN_HEIGHT,
10859
10913
  TESTED_RELEASES: TESTED_RELEASES.slice(),
10860
10914
  }),
10861
- enumerable: false,
10862
- writable: false,
10863
10915
  configurable: false,
10864
10916
  });
10865
10917
 
@@ -14352,6 +14404,25 @@ window.__ModuleLoader__.load({
14352
14404
  const slots = ctx.get("slots");
14353
14405
  if (slots === undefined) return;
14354
14406
  appliedOnce = true;
14407
+ try {
14408
+ install(ctx, slots);
14409
+ } catch (error) {
14410
+ // DSH retries a failed client entry by re-running apply() on the SAME
14411
+ // module exports (the fiber restart does not re-materialize the
14412
+ // bundle), so keeping the once-guard set here would turn a single setup
14413
+ // throw into a plugin that never mounts again — no footer button, no
14414
+ // session menus, no Settings section, until the page is reloaded. That
14415
+ // is the "restart DSH to get the menus back" symptom. Clearing the flag
14416
+ // lets the next retry rebuild everything; whatever this attempt already
14417
+ // registered is disposed with the failed fiber.
14418
+ appliedOnce = false;
14419
+ throw error;
14420
+ }
14421
+ }
14422
+
14423
+ /** Everything one successful apply() installs. Kept separate from the
14424
+ once-guard so a failed setup can clear it before DSH retries. */
14425
+ function install(ctx, slots) {
14355
14426
  const locale = ctx.get("locale");
14356
14427
  pluginCtx = ctx;
14357
14428
  sessionsService = ctx.get("sessions");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-split-workspace",
3
- "version": "0.11.0",
3
+ "version": "0.11.1",
4
4
  "type": "module",
5
5
  "description": "Split-screen workspace for DeepSeek Harness (DSH) Desktop: unlimited native panes, side-by-side, stacked and 2×2 grid layouts, drag to rearrange, movable floating windows, in-app independent windows, a native OS system window (macOS), a Settings page, and a performance mode for slow machines.",
6
6
  "icon": "./icon.svg",