dsh-multipane 1.0.22 → 1.0.24
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 +10 -0
- package/lib/client.js +103 -17
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -246,6 +246,16 @@ C:\Users\weiai\.dsh\plugin-src\_probe\sync-client.ps1 -Push # 台式机 ->
|
|
|
246
246
|
|
|
247
247
|
## 更新记录
|
|
248
248
|
|
|
249
|
+
### 1.0.24(2026-11-10)
|
|
250
|
+
- **市场缓存旧时自动重查一次**:市场对同一 URL 有服务端缓存,刚到新版本时第一次查可能还是旧值。
|
|
251
|
+
现在发现 npm 上更新且市场说「已最新」时,会当场换时间戳重查一次——拿到就直接弹更新框,
|
|
252
|
+
不用再让用户手动点第二次。仍然拿不到才显示「市场还没放行,稍后再点一次」。
|
|
253
|
+
|
|
254
|
+
### 1.0.23(2026-11-10)
|
|
255
|
+
- **接上市场「有会话在跑」的确认口子**:市场在检测到 agent 正在运行时会拒绝替换插件文件(保护那个会话),
|
|
256
|
+
但它同时留了 `confirmAgentsRunning` 这个「用户明确同意就放行」的开关。以前我们没带这个参数,
|
|
257
|
+
所以永远被挡。现在第一次会被拦,弹窗说明「有 N 个会话在跑,可能中途出错」,再点一次「仍然更新」就带同意标记重发。
|
|
258
|
+
|
|
249
259
|
### 1.0.22(2026-11-10)
|
|
250
260
|
- **插件自己维护「可安装版本清单」,用户再也不用碰命令行**:pnpm 对新版本有等待期,只有把版本号写进
|
|
251
261
|
`~/.dsh/profiles/<profile>/pnpm-workspace.yaml` 的 `minimumReleaseAgeExclude` 才允许安装。
|
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.24";
|
|
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 }));
|
|
@@ -6491,25 +6494,70 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
|
|
|
6491
6494
|
checkedAt: new Date().toLocaleTimeString("zh-CN", { hour: "2-digit", minute: "2-digit" })
|
|
6492
6495
|
});
|
|
6493
6496
|
} else {
|
|
6494
|
-
/*
|
|
6495
|
-
|
|
6496
|
-
|
|
6497
|
-
|
|
6497
|
+
/* 市场说「已最新」不代表真的没新版:它自己的同步比 npm registry 慢,
|
|
6498
|
+
而且对同一 URL 有服务端缓存。这里先问 registry,如果那边确实更新,
|
|
6499
|
+
**当场再查一次市场**(换时间戳绕过缓存)—— 拿到了就直接弹更新框,
|
|
6500
|
+
省掉「用户点两次」;拿不到才提示「市场还没同步」。 */
|
|
6501
|
+
const stamp = () => new Date().toLocaleTimeString("zh-CN", { hour: "2-digit", minute: "2-digit" });
|
|
6502
|
+
let regLatest = "";
|
|
6498
6503
|
try {
|
|
6499
6504
|
const regRes = await fetch(`${NPM_LATEST_URL}?t=${Date.now()}`, { cache: "no-store" });
|
|
6500
6505
|
if (regRes.ok === true) {
|
|
6501
6506
|
const regData = await regRes.json();
|
|
6502
|
-
|
|
6503
|
-
if (regLatest !== "" && compareVersion(regLatest, installed) > 0) {
|
|
6504
|
-
lagNote = `;npm 上已有 ${regLatest},插件市场还没同步(通常要 20 分钟左右),稍后再点一次`;
|
|
6505
|
-
}
|
|
6507
|
+
regLatest = String((regData && regData.version) || "");
|
|
6506
6508
|
}
|
|
6507
6509
|
} catch {
|
|
6508
6510
|
/* 忽略:查不到 registry 就只报市场的结果 */
|
|
6509
6511
|
}
|
|
6512
|
+
if (regLatest !== "" && compareVersion(regLatest, installed) > 0) {
|
|
6513
|
+
let retryInfo = null;
|
|
6514
|
+
try {
|
|
6515
|
+
const retry = await fetch(
|
|
6516
|
+
`${MARKET_UPDATES_URL}?name=${PKG_NAME}&force=1&t=${Date.now()}-retry`,
|
|
6517
|
+
{ cache: "no-store" }
|
|
6518
|
+
);
|
|
6519
|
+
if (retry.ok === true) {
|
|
6520
|
+
const retryData = await retry.json();
|
|
6521
|
+
retryInfo = retryData === null || retryData === void 0 ? null : retryData.package;
|
|
6522
|
+
}
|
|
6523
|
+
} catch {
|
|
6524
|
+
/* 忽略 */
|
|
6525
|
+
}
|
|
6526
|
+
if (retryInfo !== null && retryInfo.updateAvailable === true) {
|
|
6527
|
+
/* 第二次查到了:直接给可更新状态(不用用户再点一遍) */
|
|
6528
|
+
const retryLatest = String(retryInfo.latestVersion ?? regLatest);
|
|
6529
|
+
setUpdate({
|
|
6530
|
+
phase: "available",
|
|
6531
|
+
text: `发现新版本 ${retryLatest}`,
|
|
6532
|
+
canUpdate: true,
|
|
6533
|
+
opId: "",
|
|
6534
|
+
modal: true,
|
|
6535
|
+
installed,
|
|
6536
|
+
latest: retryLatest,
|
|
6537
|
+
forceHint: "",
|
|
6538
|
+
progress: null,
|
|
6539
|
+
agentsBusy: false,
|
|
6540
|
+
busyAgents: [],
|
|
6541
|
+
checkedAt: stamp()
|
|
6542
|
+
});
|
|
6543
|
+
return;
|
|
6544
|
+
}
|
|
6545
|
+
setUpdate({
|
|
6546
|
+
phase: "latest",
|
|
6547
|
+
text: `已是最新版本(${installed},${stamp()} 检查);npm 上已有 ${regLatest},插件市场还没放行,稍后再点一次`,
|
|
6548
|
+
canUpdate: false,
|
|
6549
|
+
opId: "",
|
|
6550
|
+
modal: false,
|
|
6551
|
+
installed,
|
|
6552
|
+
latest,
|
|
6553
|
+
forceHint: "",
|
|
6554
|
+
progress: null
|
|
6555
|
+
});
|
|
6556
|
+
return;
|
|
6557
|
+
}
|
|
6510
6558
|
setUpdate({
|
|
6511
6559
|
phase: "latest",
|
|
6512
|
-
text: `已是最新版本(${installed},${
|
|
6560
|
+
text: `已是最新版本(${installed},${stamp()} 检查)`,
|
|
6513
6561
|
canUpdate: false,
|
|
6514
6562
|
opId: "",
|
|
6515
6563
|
modal: false,
|
|
@@ -6550,18 +6598,47 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
|
|
|
6550
6598
|
autoChecked.current = true;
|
|
6551
6599
|
checkUpdate(true);
|
|
6552
6600
|
}, []);
|
|
6553
|
-
const runUpdate = async (force) => {
|
|
6554
|
-
setUpdate((prev) => ({ ...prev, phase: "updating", text: "正在更新…", canUpdate: false, progress: 0 }));
|
|
6601
|
+
const runUpdate = async (force, confirmAgents) => {
|
|
6602
|
+
setUpdate((prev) => ({ ...prev, phase: "updating", text: "正在更新…", canUpdate: false, progress: 0, agentsBusy: false }));
|
|
6555
6603
|
try {
|
|
6604
|
+
const payload = { packageName: PKG_NAME };
|
|
6605
|
+
if (force === true) payload.force = true;
|
|
6606
|
+
if (confirmAgents === true) payload.confirmAgentsRunning = true;
|
|
6556
6607
|
const res = await fetch(MARKET_UPDATES_URL, {
|
|
6557
6608
|
method: "POST",
|
|
6558
6609
|
headers: { "Content-Type": "application/json" },
|
|
6559
|
-
body: JSON.stringify(
|
|
6610
|
+
body: JSON.stringify(payload)
|
|
6560
6611
|
});
|
|
6612
|
+
if (res.status === 409) {
|
|
6613
|
+
/* 市场自己的规矩:有会话在跑时改插件文件会让那个会话中途出错。
|
|
6614
|
+
它留了「明确同意就放行」的口子(confirmAgentsRunning),
|
|
6615
|
+
所以这里不是死路——转成待确认,用户再点一次就带同意标记重发。 */
|
|
6616
|
+
let busy = null;
|
|
6617
|
+
try {
|
|
6618
|
+
busy = await res.json();
|
|
6619
|
+
} catch {
|
|
6620
|
+
/* 忽略 */
|
|
6621
|
+
}
|
|
6622
|
+
if (busy !== null && busy !== void 0 && busy.agentsBusy === true) {
|
|
6623
|
+
const list = Array.isArray(busy.runningAgents) ? busy.runningAgents : [];
|
|
6624
|
+
setUpdate((prev) => ({
|
|
6625
|
+
...prev,
|
|
6626
|
+
phase: "available",
|
|
6627
|
+
canUpdate: true,
|
|
6628
|
+
progress: null,
|
|
6629
|
+
agentsBusy: true,
|
|
6630
|
+
busyAgents: list,
|
|
6631
|
+
forceHint: `现在有 ${list.length || 1} 个会话正在运行。更新会替换插件文件,那个会话可能在半路读到新旧混着的代码而报错。确定要继续,就再点一次「仍然更新」。`
|
|
6632
|
+
}));
|
|
6633
|
+
return;
|
|
6634
|
+
}
|
|
6635
|
+
throw new Error("HTTP 409");
|
|
6636
|
+
}
|
|
6561
6637
|
if (res.status !== 202) {
|
|
6562
6638
|
let detail = "";
|
|
6563
6639
|
try {
|
|
6564
|
-
|
|
6640
|
+
const body = await res.json();
|
|
6641
|
+
detail = String(body.message ?? body.error ?? "");
|
|
6565
6642
|
} catch {
|
|
6566
6643
|
/* 忽略 */
|
|
6567
6644
|
}
|
|
@@ -6982,9 +7059,18 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
|
|
|
6982
7059
|
type: "button",
|
|
6983
7060
|
"data-primary": "1",
|
|
6984
7061
|
disabled: update.phase === "updating",
|
|
6985
|
-
onClick: () =>
|
|
7062
|
+
onClick: () =>
|
|
7063
|
+
update.canUpdate === true
|
|
7064
|
+
? runUpdate(false, update.agentsBusy === true)
|
|
7065
|
+
: checkUpdate()
|
|
6986
7066
|
},
|
|
6987
|
-
update.phase === "updating"
|
|
7067
|
+
update.phase === "updating"
|
|
7068
|
+
? "更新中…"
|
|
7069
|
+
: update.agentsBusy === true
|
|
7070
|
+
? "仍然更新"
|
|
7071
|
+
: update.canUpdate === true
|
|
7072
|
+
? "立即更新"
|
|
7073
|
+
: "重新检查"
|
|
6988
7074
|
)
|
|
6989
7075
|
]
|
|
6990
7076
|
)
|
package/package.json
CHANGED