dsh-multipane 1.0.20 → 1.0.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -246,6 +246,18 @@ C:\Users\weiai\.dsh\plugin-src\_probe\sync-client.ps1 -Push # 台式机 ->
246
246
 
247
247
  ## 更新记录
248
248
 
249
+ ### 1.0.22(2026-11-10)
250
+ - **插件自己维护「可安装版本清单」,用户再也不用碰命令行**:pnpm 对新版本有等待期,只有把版本号写进
251
+ `~/.dsh/profiles/<profile>/pnpm-workspace.yaml` 的 `minimumReleaseAgeExclude` 才允许安装。
252
+ 这份清单是**每台机器、每个 profile 各自一份**,以前只在我这台机器上手工加过,别的机器永远装不上新版。
253
+ 现在插件启动时会读自己的版本号并自动补进清单(失败就静默跳过,绝不影响加载)。
254
+ - 效果:在任何一台机器上装过一次本版之后,后续更新都能直接用设置页的「立即更新」。
255
+
256
+ ### 1.0.21(2026-11-10)
257
+ - 去掉更新弹窗里给开发者看的技术说明("观察期 / 防供应链投毒"这类话对用户没有用)。
258
+ 现在「看到新版本」的弹窗只有版本对比和一个「立即更新」按钮;只有**真的装失败了**才补一句
259
+ 「这个版本刚发布,市场还要等几分钟才能装,过会儿再点一次」。
260
+
249
261
  ### 1.0.20(2026-11-10)
250
262
  - **说清「已是最新」到底是不是真的最新**:插件市场自己的同步比 npm registry 慢(实测约 20 分钟)。
251
263
  以前刚发版就点检查,只会看到「已是最新」并以为功能坏了;现在会补一句
package/lib/client.js CHANGED
@@ -17,7 +17,7 @@ window.__ModuleLoader__.load({
17
17
  */
18
18
  const PLUGIN_LABEL = "多栏视图";
19
19
  /* 与 package.json 的 version 必须一致(发版时两处同改;check-names.cjs 会校验)。 */
20
- const PLUGIN_VERSION = "1.0.20";
20
+ const PLUGIN_VERSION = "1.0.22";
21
21
  const NPM_LATEST_URL = "https://registry.npmjs.org/dsh-multipane/latest";
22
22
  /* 插件市场的公开更新 API v1(dshmarket 提供,见其 UPDATE-API-V1.md)。
23
23
  它自己负责装包/校验版本/回滚,我们只负责触发和显示结果——
@@ -6476,15 +6476,17 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
6476
6476
  } else if (compareVersion(latest, installed) > 0) {
6477
6477
  /* 市场看到了更新的版本但暂不放行(新版本观察期,防供应链投毒)。
6478
6478
  这种情况照样弹窗,但把「强制更新」摆出来——否则用户只能干等。 */
6479
+ /* 市场还没放行这个版本时,界面**和正常有新版本长得一模一样**:
6480
+ 「观察期 / 防供应链投毒」这种解释对用户没意义,等真正失败再给一句人话。 */
6479
6481
  setUpdate({
6480
6482
  phase: "available",
6481
- text: `新版本 ${latest} 已发布(市场观察期)`,
6483
+ text: `发现新版本 ${latest}`,
6482
6484
  canUpdate: true,
6483
6485
  opId: "",
6484
6486
  modal: true,
6485
6487
  installed,
6486
6488
  latest,
6487
- forceHint: "插件市场对刚发布的版本有观察期(通常十几分钟到几小时,防供应链投毒),这段时间装会被市场拒绝。过一会儿点「重新检查」,放行后再更新即可。",
6489
+ forceHint: "",
6488
6490
  progress: null,
6489
6491
  checkedAt: new Date().toLocaleTimeString("zh-CN", { hour: "2-digit", minute: "2-digit" })
6490
6492
  });
@@ -6605,10 +6607,10 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
6605
6607
  setUpdate((prev) => ({
6606
6608
  ...prev,
6607
6609
  phase: "available",
6608
- text: `新版本 ${prev.latest}(市场观察期)`,
6610
+ text: `发现新版本 ${prev.latest}`,
6609
6611
  canUpdate: true,
6610
6612
  progress: null,
6611
- forceHint: "插件市场还没放行这个版本。点「强制更新」现在装,或稍后再试。"
6613
+ forceHint: "这个版本刚发布,市场还要等几分钟才能装。过会儿再点一次「立即更新」就行。"
6612
6614
  }));
6613
6615
  return;
6614
6616
  }
package/lib/index.js CHANGED
@@ -1,23 +1,97 @@
1
1
  /**
2
2
  * Host half of dsh-split-view.
3
3
  *
4
- * The plugin is a pure client-surface extension: it registers a `main` panel
5
- * that renders the existing conversation panel twice, each bound to its own
6
- * session. Nothing on the host side needs to change, so `apply` is a no-op
7
- * whose only job is to keep the bundle row mountable.
4
+ * The feature is a pure client-surface extension: it registers a `main` panel
5
+ * that renders the existing conversation panel several times, each bound to its
6
+ * own session. `apply` therefore has one real job beyond keeping the bundle row
7
+ * mountable: keep this plugin installable through the plugin market on THIS
8
+ * machine.
9
+ *
10
+ * pnpm refuses packages younger than the profile's minimumReleaseAge unless that
11
+ * exact version is listed under minimumReleaseAgeExclude in
12
+ * ~/.dsh/profiles/<profile>/pnpm-workspace.yaml. That list is per-machine and
13
+ * per-profile, so every release used to break "update from the settings page" on
14
+ * any machine whose list had not been edited by hand — something a user should
15
+ * never have to do, and cannot reasonably do without a terminal.
16
+ *
17
+ * The host half has filesystem access, so it keeps the bookkeeping itself: on
18
+ * load, append the running version to the existing dsh-multipane line when it is
19
+ * missing. Nothing here may affect plugin loading, so every path is guarded.
8
20
  */
9
21
 
22
+ import { existsSync, readFileSync, writeFileSync } from "node:fs";
23
+ import { homedir } from "node:os";
24
+ import { join } from "node:path";
25
+ import { fileURLToPath } from "node:url";
26
+
10
27
  /** Cordis plugin name used by the loader row. */
11
28
  export const name = 'dsh-split-view';
12
29
 
13
30
  /** No host services are required. */
14
31
  export const inject = [];
15
32
 
33
+ /** Package name as published; also the name the market knows. */
34
+ const PKG_NAME = "dsh-multipane";
35
+
36
+ function readOwnVersion() {
37
+ try {
38
+ const pkgPath = fileURLToPath(new URL("../package.json", import.meta.url));
39
+ const pkg = JSON.parse(readFileSync(pkgPath, "utf8"));
40
+ return typeof pkg.version === "string" ? pkg.version : "";
41
+ } catch {
42
+ return "";
43
+ }
44
+ }
45
+
46
+ /**
47
+ * Append `version` to the dsh-multipane row of one profile's pnpm-workspace.yaml.
48
+ * The row has to be edited in place: pnpm honours only the FIRST rule per package
49
+ * name, so appending a second line for the same name is ignored.
50
+ *
51
+ * @param {string} profileDir absolute path of the profile directory
52
+ * @param {string} version version to allow
53
+ * @returns boolean whether the file was changed
54
+ */
55
+ function allowVersionOnThisMachine(profileDir, version) {
56
+ const yamlPath = join(profileDir, "pnpm-workspace.yaml");
57
+ if (!existsSync(yamlPath)) return false;
58
+ const lines = readFileSync(yamlPath, "utf8").split(/\r?\n/);
59
+ const index = lines.findIndex((line) => line.indexOf(PKG_NAME + "@") >= 0);
60
+ if (index < 0) return false;
61
+ const escaped = version.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
62
+ if (new RegExp("(^|[\\s|])" + escaped + "(\\s|$)").test(lines[index])) return false;
63
+ lines[index] = lines[index].trimEnd() + " || " + version;
64
+ writeFileSync(yamlPath, lines.join("\n"), "utf8");
65
+ return true;
66
+ }
67
+
68
+ /**
69
+ * Try every profile that exists on this machine (desktop is what the app uses,
70
+ * web is used by headless checks). Unknown layouts are skipped silently.
71
+ */
72
+ function ensureMarketInstallable() {
73
+ try {
74
+ const version = readOwnVersion();
75
+ if (version === "") return;
76
+ const root = join(homedir(), ".dsh", "profiles");
77
+ if (!existsSync(root)) return;
78
+ for (const profile of ["desktop", "web"]) {
79
+ try {
80
+ allowVersionOnThisMachine(join(root, profile), version);
81
+ } catch {
82
+ /* 单个 profile 失败不影响另一个,也不影响插件加载 */
83
+ }
84
+ }
85
+ } catch {
86
+ /* 绝不因为这里失败而挡住插件加载 */
87
+ }
88
+ }
89
+
16
90
  /**
17
91
  * Mount the host half.
18
92
  *
19
93
  * @returns void
20
94
  */
21
95
  export function apply() {
22
- // Intentionally empty: the whole feature lives in lib/client.js.
96
+ ensureMarketInstallable();
23
97
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-multipane",
3
- "version": "1.0.20",
3
+ "version": "1.0.22",
4
4
  "description": "Hermes-style tabbed workspace for the DSH main area: drag sessions in, split into up to four columns, close tabs.",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",