dsh-multipane 1.0.21 → 1.0.23
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 +12 -0
- package/lib/client.js +49 -8
- package/lib/index.js +79 -5
- package/package.json +1 -1
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.23(2026-11-10)
|
|
250
|
+
- **接上市场「有会话在跑」的确认口子**:市场在检测到 agent 正在运行时会拒绝替换插件文件(保护那个会话),
|
|
251
|
+
但它同时留了 `confirmAgentsRunning` 这个「用户明确同意就放行」的开关。以前我们没带这个参数,
|
|
252
|
+
所以永远被挡。现在第一次会被拦,弹窗说明「有 N 个会话在跑,可能中途出错」,再点一次「仍然更新」就带同意标记重发。
|
|
253
|
+
|
|
254
|
+
### 1.0.22(2026-11-10)
|
|
255
|
+
- **插件自己维护「可安装版本清单」,用户再也不用碰命令行**:pnpm 对新版本有等待期,只有把版本号写进
|
|
256
|
+
`~/.dsh/profiles/<profile>/pnpm-workspace.yaml` 的 `minimumReleaseAgeExclude` 才允许安装。
|
|
257
|
+
这份清单是**每台机器、每个 profile 各自一份**,以前只在我这台机器上手工加过,别的机器永远装不上新版。
|
|
258
|
+
现在插件启动时会读自己的版本号并自动补进清单(失败就静默跳过,绝不影响加载)。
|
|
259
|
+
- 效果:在任何一台机器上装过一次本版之后,后续更新都能直接用设置页的「立即更新」。
|
|
260
|
+
|
|
249
261
|
### 1.0.21(2026-11-10)
|
|
250
262
|
- 去掉更新弹窗里给开发者看的技术说明("观察期 / 防供应链投毒"这类话对用户没有用)。
|
|
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
|
+
const PLUGIN_VERSION = "1.0.23";
|
|
21
21
|
const NPM_LATEST_URL = "https://registry.npmjs.org/dsh-multipane/latest";
|
|
22
22
|
/* 插件市场的公开更新 API v1(dshmarket 提供,见其 UPDATE-API-V1.md)。
|
|
23
23
|
它自己负责装包/校验版本/回滚,我们只负责触发和显示结果——
|
|
@@ -6429,7 +6429,10 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
|
|
|
6429
6429
|
latest: "",
|
|
6430
6430
|
forceHint: "",
|
|
6431
6431
|
progress: null,
|
|
6432
|
-
/*
|
|
6432
|
+
/* 市场因「有会话正在运行」拒绝时,进入待确认:用户再点一次即带 confirmAgentsRunning 强制继续 */
|
|
6433
|
+
agentsBusy: false,
|
|
6434
|
+
busyAgents: [],
|
|
6435
|
+
/* 上次检查的时刻:市场对新版本有缓存,显示出来用户才知道是查过旧的 */
|
|
6433
6436
|
checkedAt: ""
|
|
6434
6437
|
});
|
|
6435
6438
|
const closeModal = () => setUpdate((prev) => ({ ...prev, modal: false }));
|
|
@@ -6550,18 +6553,47 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
|
|
|
6550
6553
|
autoChecked.current = true;
|
|
6551
6554
|
checkUpdate(true);
|
|
6552
6555
|
}, []);
|
|
6553
|
-
const runUpdate = async (force) => {
|
|
6554
|
-
setUpdate((prev) => ({ ...prev, phase: "updating", text: "正在更新…", canUpdate: false, progress: 0 }));
|
|
6556
|
+
const runUpdate = async (force, confirmAgents) => {
|
|
6557
|
+
setUpdate((prev) => ({ ...prev, phase: "updating", text: "正在更新…", canUpdate: false, progress: 0, agentsBusy: false }));
|
|
6555
6558
|
try {
|
|
6559
|
+
const payload = { packageName: PKG_NAME };
|
|
6560
|
+
if (force === true) payload.force = true;
|
|
6561
|
+
if (confirmAgents === true) payload.confirmAgentsRunning = true;
|
|
6556
6562
|
const res = await fetch(MARKET_UPDATES_URL, {
|
|
6557
6563
|
method: "POST",
|
|
6558
6564
|
headers: { "Content-Type": "application/json" },
|
|
6559
|
-
body: JSON.stringify(
|
|
6565
|
+
body: JSON.stringify(payload)
|
|
6560
6566
|
});
|
|
6567
|
+
if (res.status === 409) {
|
|
6568
|
+
/* 市场自己的规矩:有会话在跑时改插件文件会让那个会话中途出错。
|
|
6569
|
+
它留了「明确同意就放行」的口子(confirmAgentsRunning),
|
|
6570
|
+
所以这里不是死路——转成待确认,用户再点一次就带同意标记重发。 */
|
|
6571
|
+
let busy = null;
|
|
6572
|
+
try {
|
|
6573
|
+
busy = await res.json();
|
|
6574
|
+
} catch {
|
|
6575
|
+
/* 忽略 */
|
|
6576
|
+
}
|
|
6577
|
+
if (busy !== null && busy !== void 0 && busy.agentsBusy === true) {
|
|
6578
|
+
const list = Array.isArray(busy.runningAgents) ? busy.runningAgents : [];
|
|
6579
|
+
setUpdate((prev) => ({
|
|
6580
|
+
...prev,
|
|
6581
|
+
phase: "available",
|
|
6582
|
+
canUpdate: true,
|
|
6583
|
+
progress: null,
|
|
6584
|
+
agentsBusy: true,
|
|
6585
|
+
busyAgents: list,
|
|
6586
|
+
forceHint: `现在有 ${list.length || 1} 个会话正在运行。更新会替换插件文件,那个会话可能在半路读到新旧混着的代码而报错。确定要继续,就再点一次「仍然更新」。`
|
|
6587
|
+
}));
|
|
6588
|
+
return;
|
|
6589
|
+
}
|
|
6590
|
+
throw new Error("HTTP 409");
|
|
6591
|
+
}
|
|
6561
6592
|
if (res.status !== 202) {
|
|
6562
6593
|
let detail = "";
|
|
6563
6594
|
try {
|
|
6564
|
-
|
|
6595
|
+
const body = await res.json();
|
|
6596
|
+
detail = String(body.message ?? body.error ?? "");
|
|
6565
6597
|
} catch {
|
|
6566
6598
|
/* 忽略 */
|
|
6567
6599
|
}
|
|
@@ -6982,9 +7014,18 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
|
|
|
6982
7014
|
type: "button",
|
|
6983
7015
|
"data-primary": "1",
|
|
6984
7016
|
disabled: update.phase === "updating",
|
|
6985
|
-
onClick: () =>
|
|
7017
|
+
onClick: () =>
|
|
7018
|
+
update.canUpdate === true
|
|
7019
|
+
? runUpdate(false, update.agentsBusy === true)
|
|
7020
|
+
: checkUpdate()
|
|
6986
7021
|
},
|
|
6987
|
-
update.phase === "updating"
|
|
7022
|
+
update.phase === "updating"
|
|
7023
|
+
? "更新中…"
|
|
7024
|
+
: update.agentsBusy === true
|
|
7025
|
+
? "仍然更新"
|
|
7026
|
+
: update.canUpdate === true
|
|
7027
|
+
? "立即更新"
|
|
7028
|
+
: "重新检查"
|
|
6988
7029
|
)
|
|
6989
7030
|
]
|
|
6990
7031
|
)
|
package/lib/index.js
CHANGED
|
@@ -1,23 +1,97 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Host half of dsh-split-view.
|
|
3
3
|
*
|
|
4
|
-
* The
|
|
5
|
-
* that renders the existing conversation panel
|
|
6
|
-
* session.
|
|
7
|
-
*
|
|
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
|
-
|
|
96
|
+
ensureMarketInstallable();
|
|
23
97
|
}
|
package/package.json
CHANGED