dsh-config-sync-plugin 0.3.63 → 0.3.65
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.en.md +29 -1
- package/README.md +29 -1
- package/client.js +34 -12
- package/index.js +4 -4
- package/package.json +1 -1
- package/runtime/apply.ps1 +14 -1
- package/runtime/post-exit.ps1 +36 -12
- package/runtime/restore.ps1 +19 -4
package/README.en.md
CHANGED
|
@@ -19,7 +19,7 @@ The package name is **`dsh-config-sync-plugin`** (the `dsh-config-sync` name on
|
|
|
19
19
|
|
|
20
20
|
| Way | Command / entry | Notes |
|
|
21
21
|
|---|---|---|
|
|
22
|
-
| npm | `npm i dsh-config-sync-plugin` | Use it as a dependency, or add `"dsh-config-sync-plugin": "^0.3.
|
|
22
|
+
| npm | `npm i dsh-config-sync-plugin` | Use it as a dependency, or add `"dsh-config-sync-plugin": "^0.3.65"` to the profile's `package.json` and run `pnpm i`. The name matches the `cordis.patch.yml` insert name and the install folder `dsh-config-sync-plugin-<ver>` |
|
|
23
23
|
| Marketplace | client → Plugins → Discover → “Config Sync” | Installs from the git commit registered in `market-index.json` |
|
|
24
24
|
| Offline tgz | `releases\dsh-config-sync-plugin-<ver>.tgz` | GitHub Release asset for air-gapped machines; the panel's Update button downloads the same file |
|
|
25
25
|
|
|
@@ -589,6 +589,34 @@ The log shows which path ran: `文件比较(快筛):比对 N 个,深哈
|
|
|
589
589
|
|
|
590
590
|
## Test log (2026-11-11, isolated environment)
|
|
591
591
|
|
|
592
|
+
### 2026-11-18: isolated B-machine fresh-pull regression (workspaces / session membership / context overflow)
|
|
593
|
+
|
|
594
|
+
A clean isolated B machine (approot / dshome / wshome + bundled node runner) simulated a "fresh machine first pull": `sessions`, `storages/workspace.json` and `session_projcache` were wiped first, then the config repo's latest `apply.ps1` ran a full restore. Every check passed:
|
|
595
|
+
|
|
596
|
+
| Check | Result |
|
|
597
|
+
|---|---|
|
|
598
|
+
| apply run | `EXIT=0`, 73 s (pull speedup active; was 340 s) |
|
|
599
|
+
| Workspace mount | all 5 workspaces restored, paths all point at this machine's `_iso_b\approot\*`, registry merged by ID ✅ |
|
|
600
|
+
| Session membership | workspace registry holds 71 sessionIds; sessions directories yield 73 — only 2 missing (ghost workspace + forward-confirm special session, expected exceptions) ✅ |
|
|
601
|
+
| projcache | absent on B (**FILES=0**) — the repo does carry the over-window sessions' projcache, but it is not synced ✅ |
|
|
602
|
+
| Session cwd | 64 sessions, 63 first-frame cwd correct; the single exception is the forward-confirm passthrough session ✅ |
|
|
603
|
+
| bundle | all 24 entries resolve; the 3 link plugins report "already present locally" and are not re-extracted ✅ |
|
|
604
|
+
|
|
605
|
+
**Context-overflow loop closed**: the three sessions that used to blow the window with A-machine token metering are now correctly filed — `session-58db748a` (1,553,981 tokens) -> DSH破甲, `session-bbf3e5c9` (1,080,398) -> SquadLink, `session-a1061521` (1,001,058) -> dsh-config-sync. With no projcache on B, DSH rebuilds token metering from the session logs using B's actual model config on startup and triggers compaction, instead of pushing A's stale over-window cache straight to the provider.
|
|
606
|
+
|
|
607
|
+
Benign warnings (confirmed in the log): `--D-DeepSeekHarness-comfyUI--` / `--dsh-im-forward-confirm--` map to no workspace (special session dirs); `-SkipInstall` skipped 21 registry plugins (isolated offline run — without the flag on a networked machine they install); `dsh-config-sync-0.1.0` / `extra/manifest.json` have no archive/definition and are skipped; the `dsh-config-sync` slot has extra local leftovers (removed only with `-PruneWorkspace`).
|
|
608
|
+
|
|
609
|
+
### 2026-11-18: release 0.3.65 (refresh button feedback)
|
|
610
|
+
- **Top "Re-check"**: now always shows a clear toast after a click, whether or not data changed - success shows "Re-checked, data is up to date (time)", failure shows the reason, reusing the 5-second auto-dismiss notice. Previously, when the state was already current the page looked unchanged and users thought the click did nothing.
|
|
611
|
+
- **Card "Refresh" buttons**: the five refresh buttons (sync conflicts, plugin data, sync content, feedback, settings summary row) now switch their label to "Refreshing..." and disable while running, then return to "Refresh". Three of them (sync conflicts / sync content / feedback) had `load()` functions that never drove `busy` (label never changed) - fixed by adding `setBusy`; the top bar's "Checking..." and the local-path "Reading..." stay as they were.
|
|
612
|
+
- `node --check` and the client self-check all pass; front-end interaction only, no behaviour or data changes.
|
|
613
|
+
### 2026-11-18: release 0.3.64 (backup restore fix + failure summary + auto-close)
|
|
614
|
+
|
|
615
|
+
- **Backup restore bug fixed**: `apply.ps1` backed up plugin settings by filename only (e.g. `workspace.json`), and `restore.ps1` dumped them all into `~\.dsh` root, so `storages\workspace.json`, `our-free-model\settings.json`, `redteam\preset-declare.json` never returned to their original directories. Backup now writes `__backup_manifest.json` mapping backup filename -> original path relative to DshHome, and restore writes each file back in place; old snapshots without the manifest fall back to root with a clear warning. Isolated regression: 5 profile files + 3 settings restored in place, zero stray root files, point-in-time rollback moved new files and wrote its manifest — all pass.
|
|
616
|
+
- **Failure summary**: on push/pull failure, `post-exit.ps1` now adds `Show-FailureSummary`, extracting `[X]` error lines with detail and recent `[!]` warnings from the run log and printing them together at the end — no more digging through logs.
|
|
617
|
+
- **Auto-close**: after push/pull/update/restore, the window closes automatically 6 minutes after showing results; no more "press any key" (which hangs under remote desktop / unfocused windows). You can also click the × button to close early.
|
|
618
|
+
- **Boundary**: workspace/conversations/skills/presets/plugin-data backed up before apply are data directories, not part of "config restore" rollback (they have their own sync/session paths; folding them in would add path mapping and heavy directory walking).
|
|
619
|
+
|
|
592
620
|
### 2026-11-18: push speed release 0.3.63 (Get-RelPath ~10x faster)
|
|
593
621
|
|
|
594
622
|
The shared `Get-RelPath` used by push and pull ran two `-split` + `Where-Object` per file; on a 49k-file workspace push comparison alone cost 11.7s. Now a `StartsWith` + `Substring` fast path, falling back to the original segment-count logic when case or 8.3 short paths disagree. 49,138 files compared with 0 output differences; microbench 5.08s -> 0.51s (~9.9x). All three `dsh-sync-common.ps1` copies (source / config repo / plugin runtime) updated.
|
package/README.md
CHANGED
|
@@ -15,7 +15,7 @@ DSH 插件:左侧栏多一行「配置同步」,点开是整页体检面板
|
|
|
15
15
|
|
|
16
16
|
| 方式 | 命令 / 入口 | 说明 |
|
|
17
17
|
|---|---|---|
|
|
18
|
-
| npm | `npm i dsh-config-sync-plugin` | 适合把它当依赖管理,或在 profile 的 `package.json` 里写 `"dsh-config-sync-plugin": "^0.3.
|
|
18
|
+
| npm | `npm i dsh-config-sync-plugin` | 适合把它当依赖管理,或在 profile 的 `package.json` 里写 `"dsh-config-sync-plugin": "^0.3.65"` 后 `pnpm i`;包名与 `cordis.patch.yml` 里注册的名字、插件目录 `dsh-config-sync-plugin-<ver>` 一致 |
|
|
19
19
|
| 插件市场 | 客户端「插件市场 → 发现」搜「配置同步」 | 走 `market-index.json` 登记的 git 提交,版本与 README 对齐 |
|
|
20
20
|
| 离线 tgz | `releases\dsh-config-sync-plugin-<ver>.tgz` | GitHub Release 附件,适合内网机器;面板「更新」按钮下载的也是它 |
|
|
21
21
|
|
|
@@ -565,6 +565,34 @@ pwsh -File sync.ps1 push -ScanHistory
|
|
|
565
565
|
|
|
566
566
|
## 实测记录
|
|
567
567
|
|
|
568
|
+
### 2026-11-18:隔离环境 B 机全新拉取回归(工作区 / 会话归属 / 上下文超长)
|
|
569
|
+
|
|
570
|
+
用干净的隔离 B 机(approot / dshome / wshome + 内置 node 执行器)模拟「全新机器首次拉取」:先清掉 `sessions`、`storages/workspace.json`、`session_projcache`,再用配置仓库最新 `apply.ps1` 跑完整还原。结果逐项核对通过:
|
|
571
|
+
|
|
572
|
+
| 验证项 | 结果 |
|
|
573
|
+
|---|---|
|
|
574
|
+
| apply 执行 | `EXIT=0`,73 秒(拉取提速生效,之前 340s) |
|
|
575
|
+
| 工作区挂载 | 5 个工作区全部还原,path 均指向本机 `_iso_b\approot\*`,登记表按 ID 合并 ✅ |
|
|
576
|
+
| 会话归属 | 工作区登记表 sessionIds 共 71 个;sessions 目录反推 73 个,只差 2 个(幽灵工作区 + forward-confirm 特殊会话,正常例外)✅ |
|
|
577
|
+
| projcache | B 机 **不存在**(FILES=0)——仓库里明明有超窗会话的 projcache,但未同步过来 ✅ |
|
|
578
|
+
| 会话 cwd | 64 个会话,63 个首帧 cwd 正确;唯一 1 个是 forward-confirm passthrough(正常例外)✅ |
|
|
579
|
+
| bundle | 24 项全部可解析;3 个 link 插件显示「本地插件已存在」,不再反复解压 ✅ |
|
|
580
|
+
|
|
581
|
+
**上下文超长闭环**:之前因 A 机 token 计量缓存超窗的 3 个会话,现在都正确归到对应工作区——`session-58db748a`(1,553,981 tokens)→ DSH破甲、`session-bbf3e5c9`(1,080,398)→ SquadLink、`session-a1061521`(1,001,058)→ dsh-config-sync。同时 B 机 projcache 为空,DSH 启动时会从会话日志按 B 机实际模型配置重建 token 计量并触发 compaction,不会再把 A 机超窗缓存直接怼给 provider。
|
|
582
|
+
|
|
583
|
+
非故障警告(日志已确认无害):`--D-DeepSeekHarness-comfyUI--` / `--dsh-im-forward-confirm--` 找不到对应工作区(特殊会话目录);`-SkipInstall` 跳过 21 个 registry 插件(隔离环境离线,真机有网时不加即补齐);`dsh-config-sync-0.1.0` / `extra/manifest.json` 无归档正常跳过;`dsh-config-sync` 槽位有本机多出的残留文件(加 `-PruneWorkspace` 才删)。
|
|
584
|
+
|
|
585
|
+
### 2026-11-18:发版 0.3.65(刷新按钮反馈)
|
|
586
|
+
- **顶部「重新检测」**:点击后无论数据是否变化都给明确 toast 反馈——成功显示「已重新检测,数据已是最新(时间)」,失败显示具体原因,复用 5 秒自动消失的提示条。此前状态本就是最新时页面看起来毫无变化,用户会以为没点上。
|
|
587
|
+
- **卡片「刷新」按钮**:同步冲突、插件数据、同步内容、问题反馈、设置摘要行五处刷新按钮,点击后文字变「刷新中…」并禁用,结束恢复「刷新」。其中同步冲突 / 同步内容 / 问题反馈三处原来的 `load()` 根本没驱动 `busy`(按钮文字永远不变),本次补齐 `setBusy`;顶部与本机路径的「检测中…/读取中…」保持不变。
|
|
588
|
+
- `node --check` 与客户端半身自检全过,纯前端交互修复,行为与数据不变。
|
|
589
|
+
### 2026-11-18:发版 0.3.64(还原备份修复 + 失败原因集中展示 + 自动关窗)
|
|
590
|
+
|
|
591
|
+
- **还原备份 bug 修复**:`apply.ps1` 备份插件设置时只留文件名(如 `workspace.json`),`restore.ps1` 还原时全堆到 `~\.dsh` 根目录,`storages\workspace.json`、`our-free-model\settings.json`、`redteam\preset-declare.json` 等回不到原位。现在备份时写一份 `__backup_manifest.json` 记录「备份文件名 → 相对 DshHome 的原路径」,还原按清单写回原位;无清单的老快照退化为写回根目录并明确告警。隔离回归:profile 5 文件 + settings 3 文件原位还原、根目录零残留、时点回退移走新增文件并写 rollback 清单,全部通过。
|
|
592
|
+
- **失败原因集中展示**:推送/拉取失败时,`post-exit.ps1` 收尾新增 `Show-FailureSummary`,从执行日志抽取 `[X]` 错误行及后续详情、最近的 `[!]` 警告,红/黄集中打印在末尾,不用再翻日志找原因。
|
|
593
|
+
- **自动关窗**:推送/拉取/更新/还原脚本结束后,展示结果 6 分钟后自动退出关窗,不再要求「按任意键」(远程桌面/无焦点时 `ReadKey` 会一直卡住);也可直接点右上角 × 提前关闭。
|
|
594
|
+
- **边界说明**:`apply` 拉取前备份的 workspace/conversations/skills/presets/plugin-data 属数据目录,不纳入「配置还原」回退范围(有各自的同步/会话路径,强塞会引入路径映射与大目录遍历开销)。
|
|
595
|
+
|
|
568
596
|
### 2026-11-18:推送提速发版 0.3.63(Get-RelPath 快 10 倍)
|
|
569
597
|
|
|
570
598
|
推送/拉取共用的 `Get-RelPath` 原来对每个文件做两次 `-split` + `Where-Object`;5 万文件工作区下,推送比对单独占 11.7s。改为 `StartsWith` + `Substring` 快路径,大小写或 8.3 短路径不一致时回退原段数比对逻辑。49138 文件全量比对与老版输出 0 差异,微基准 5.08s → 0.51s(约 9.9 倍)。三处 `dsh-sync-common.ps1`(源码 / 配置仓库 / 插件副本)同步。
|
package/client.js
CHANGED
|
@@ -499,10 +499,18 @@ window.__ModuleLoader__.load({
|
|
|
499
499
|
const [busy, setBusy] = react.useState(false)
|
|
500
500
|
const [made, setMade] = react.useState(null)
|
|
501
501
|
|
|
502
|
-
const refresh = react.useCallback(async () => {
|
|
502
|
+
const refresh = react.useCallback(async (done) => {
|
|
503
503
|
setBusy(true)
|
|
504
504
|
setErr('')
|
|
505
|
-
try {
|
|
505
|
+
try {
|
|
506
|
+
const d = await callStatus()
|
|
507
|
+
setData(d)
|
|
508
|
+
if (typeof done === 'function') done(null, d)
|
|
509
|
+
} catch (e) {
|
|
510
|
+
const msg = String((e && e.message) || e)
|
|
511
|
+
setErr(msg)
|
|
512
|
+
if (typeof done === 'function') done(msg, null)
|
|
513
|
+
} finally { setBusy(false) }
|
|
506
514
|
}, [])
|
|
507
515
|
|
|
508
516
|
react.useEffect(() => {
|
|
@@ -921,7 +929,7 @@ window.__ModuleLoader__.load({
|
|
|
921
929
|
}
|
|
922
930
|
// 「手动还原」指引里的目标位置:认不出类型时按内容猜不到,索性把三类常见落点都摆出来
|
|
923
931
|
const manualTargets = () => [
|
|
924
|
-
M('插件本体 → 插件安装目录(如 D:\\DeepSeekHarness\\dsh-config-sync-plugin-0.3.
|
|
932
|
+
M('插件本体 → 插件安装目录(如 D:\\DeepSeekHarness\\dsh-config-sync-plugin-0.3.65)', 'Plugin files → the plugin install folder (e.g. D:\\DeepSeekHarness\\dsh-config-sync-plugin-0.3.65)'),
|
|
925
933
|
M('会话目录(--xxx--)→ ~\\.dsh\\sessions', 'Session folders (--xxx--) → ~\\.dsh\\sessions'),
|
|
926
934
|
M('配置五件套(package.json / pnpm-lock.yaml / cordis.yml…)→ ~\\.dsh\\profiles\\desktop', 'Config files (package.json / pnpm-lock.yaml / cordis.yml…) → ~\\.dsh\\profiles\\desktop'),
|
|
927
935
|
]
|
|
@@ -1185,7 +1193,8 @@ window.__ModuleLoader__.load({
|
|
|
1185
1193
|
const [msg, setMsg] = react.useState('')
|
|
1186
1194
|
|
|
1187
1195
|
const load = async () => {
|
|
1188
|
-
|
|
1196
|
+
setBusy(true); setErr('')
|
|
1197
|
+
try { setState(await callConflict()) } catch (e) { setErr(String((e && e.message) || e)) } finally { setBusy(false) }
|
|
1189
1198
|
}
|
|
1190
1199
|
react.useEffect(() => { load() }, [])
|
|
1191
1200
|
|
|
@@ -1334,7 +1343,7 @@ window.__ModuleLoader__.load({
|
|
|
1334
1343
|
h('span', { style: { ...S.footnote } },
|
|
1335
1344
|
M(`${items.length} 个文件挡住拉取`, `${items.length} file(s) blocking the pull`)),
|
|
1336
1345
|
h('div', { style: { flex: 1 } }, null),
|
|
1337
|
-
h('button', { type: 'button', style: S.btn, disabled: busy, onClick: load }, M('刷新', 'Refresh')),
|
|
1346
|
+
h('button', { type: 'button', style: S.btn, disabled: busy, onClick: load }, busy ? M('刷新中…', 'Refreshing…') : M('刷新', 'Refresh')),
|
|
1338
1347
|
),
|
|
1339
1348
|
h('div', { style: S.hint },
|
|
1340
1349
|
M(
|
|
@@ -1485,7 +1494,7 @@ window.__ModuleLoader__.load({
|
|
|
1485
1494
|
]
|
|
1486
1495
|
: [
|
|
1487
1496
|
h('button', { key: 'edit', type: 'button', style: S.btn, disabled: busy, onClick: () => { setEditing(true); setMsg(''); setErr('') } }, M('修改', 'Edit')),
|
|
1488
|
-
h('button', { key: 'reload', type: 'button', style: S.btn, disabled: busy, onClick: load }, M('刷新', 'Refresh')),
|
|
1497
|
+
h('button', { key: 'reload', type: 'button', style: S.btn, disabled: busy, onClick: load }, busy ? M('刷新中…', 'Refreshing…') : M('刷新', 'Refresh')),
|
|
1489
1498
|
],
|
|
1490
1499
|
),
|
|
1491
1500
|
h('div', { style: S.footnote },
|
|
@@ -1570,13 +1579,14 @@ window.__ModuleLoader__.load({
|
|
|
1570
1579
|
const [err, setErr] = react.useState('')
|
|
1571
1580
|
|
|
1572
1581
|
const load = async () => {
|
|
1582
|
+
setBusy(true)
|
|
1573
1583
|
try {
|
|
1574
1584
|
const r = await callScope()
|
|
1575
1585
|
setState({ deleteCloud: r.deleteCloud === true, path: r.path || '', groups: r.groups || [] })
|
|
1576
1586
|
setErr('')
|
|
1577
1587
|
} catch (e) {
|
|
1578
1588
|
setErr(String((e && e.message) || e))
|
|
1579
|
-
}
|
|
1589
|
+
} finally { setBusy(false) }
|
|
1580
1590
|
}
|
|
1581
1591
|
react.useEffect(() => { load() }, [])
|
|
1582
1592
|
|
|
@@ -1652,7 +1662,7 @@ window.__ModuleLoader__.load({
|
|
|
1652
1662
|
editing
|
|
1653
1663
|
? null
|
|
1654
1664
|
: h('button', { type: 'button', style: S.btn, disabled: busy, onClick: () => { setMsg(''); setErr(''); setEditing(true) } }, M('修改', 'Edit')),
|
|
1655
|
-
h('button', { type: 'button', style: S.btn, disabled: busy, onClick: load }, M('刷新', 'Refresh')),
|
|
1665
|
+
h('button', { type: 'button', style: S.btn, disabled: busy, onClick: load }, busy ? M('刷新中…', 'Refreshing…') : M('刷新', 'Refresh')),
|
|
1656
1666
|
),
|
|
1657
1667
|
h('label', { style: { display: 'flex', gap: '8px', alignItems: 'flex-start', cursor: editing ? 'pointer' : 'default' } },
|
|
1658
1668
|
h('input', {
|
|
@@ -2015,6 +2025,17 @@ window.__ModuleLoader__.load({
|
|
|
2015
2025
|
toastTimer.current = setTimeout(() => setToast(''), 5000)
|
|
2016
2026
|
}
|
|
2017
2027
|
|
|
2028
|
+
// 「重新检测」按钮:必须给明确反馈。状态本就是最新时数据不会变,按钮只是闪一下
|
|
2029
|
+
// 「检测中…」就恢复,用户会以为点了没反应;这里成功/失败都弹一条 toast。
|
|
2030
|
+
const doRefresh = () => refresh((failure) => {
|
|
2031
|
+
if (failure) {
|
|
2032
|
+
showToast(M(`重新检测失败:${failure}`, `Re-check failed: ${failure}`))
|
|
2033
|
+
} else {
|
|
2034
|
+
const t = new Date().toLocaleTimeString()
|
|
2035
|
+
showToast(M(`已重新检测,数据已是最新(${t})`, `Re-checked, data is up to date (${t})`))
|
|
2036
|
+
}
|
|
2037
|
+
})
|
|
2038
|
+
|
|
2018
2039
|
// 「下载更新」= 只下载,不动插件目录(宿主 action: prepare):
|
|
2019
2040
|
// 下到 <DshHome>\update-staging\ 并校验 sha256。插件文件一个字节都没改,
|
|
2020
2041
|
// 所以宿主不会重建插件树,当前这个页面不会跳走。
|
|
@@ -2487,7 +2508,7 @@ window.__ModuleLoader__.load({
|
|
|
2487
2508
|
: (lpAlert > 0
|
|
2488
2509
|
? M(`本机路径 · ${lpAlert} 项告警`, `Local paths · ${lpAlert} alert(s)`)
|
|
2489
2510
|
: M('本机路径', 'Local paths'))),
|
|
2490
|
-
h('button', { type: 'button', style: S.btn, disabled: busy, onClick:
|
|
2511
|
+
h('button', { type: 'button', style: S.btn, disabled: busy, onClick: doRefresh },
|
|
2491
2512
|
busy ? M('检测中…', 'Checking…') : M('重新检测', 'Re-check')),
|
|
2492
2513
|
),
|
|
2493
2514
|
),
|
|
@@ -2819,13 +2840,14 @@ window.__ModuleLoader__.load({
|
|
|
2819
2840
|
const [kw, setKw] = react.useState('')
|
|
2820
2841
|
|
|
2821
2842
|
const load = async () => {
|
|
2843
|
+
setBusy(true)
|
|
2822
2844
|
try {
|
|
2823
2845
|
const r = await callFeedback(null)
|
|
2824
2846
|
setSt({ ...empty, ...r })
|
|
2825
2847
|
setErr(String(r.error || ''))
|
|
2826
2848
|
} catch (e) {
|
|
2827
2849
|
setErr(String((e && e.message) || e))
|
|
2828
|
-
}
|
|
2850
|
+
} finally { setBusy(false) }
|
|
2829
2851
|
}
|
|
2830
2852
|
react.useEffect(() => { load() }, [])
|
|
2831
2853
|
|
|
@@ -2920,7 +2942,7 @@ window.__ModuleLoader__.load({
|
|
|
2920
2942
|
h('div', { style: S.cardTitle }, M('问题反馈', 'Feedback')),
|
|
2921
2943
|
h('div', { style: { flex: 1 } }, null),
|
|
2922
2944
|
h('span', { style: S.chip }, M(`${open} 待处理 / 共 ${total}`, `${open} open / ${total} total`)),
|
|
2923
|
-
h('button', { type: 'button', style: S.btn, disabled: busy, onClick: load }, M('刷新', 'Refresh')),
|
|
2945
|
+
h('button', { type: 'button', style: S.btn, disabled: busy, onClick: load }, busy ? M('刷新中…', 'Refreshing…') : M('刷新', 'Refresh')),
|
|
2924
2946
|
),
|
|
2925
2947
|
h('div', { style: S.kvRow },
|
|
2926
2948
|
h('div', { style: S.kvKey }, M('连接', 'Connect')),
|
|
@@ -3058,7 +3080,7 @@ window.__ModuleLoader__.load({
|
|
|
3058
3080
|
h('div', { style: { display: 'flex', gap: '8px', alignItems: 'center', flexShrink: 0 } },
|
|
3059
3081
|
h('span', { style: chipStyle(summary.kind) }, chipLabel(summary.kind)),
|
|
3060
3082
|
h('button', { type: 'button', style: S.btn, onClick: () => setOpen((v) => !v) }, open ? M('收起', 'Collapse') : M('查看', 'View')),
|
|
3061
|
-
h('button', { type: 'button', style: S.btn, disabled: busy, onClick: refresh }, M('刷新', 'Refresh')),
|
|
3083
|
+
h('button', { type: 'button', style: S.btn, disabled: busy, onClick: refresh }, busy ? M('刷新中…', 'Refreshing…') : M('刷新', 'Refresh')),
|
|
3062
3084
|
),
|
|
3063
3085
|
)
|
|
3064
3086
|
|
package/index.js
CHANGED
|
@@ -976,9 +976,9 @@ async function inspect(config) {
|
|
|
976
976
|
const remoteFiles = remoteProbe ? remoteProbe.files : null
|
|
977
977
|
if (!appRoot) {
|
|
978
978
|
advice.push(t(
|
|
979
|
-
'定位不到客户端根目录:插件不在 <客户端根> 下(如 D:\\DeepSeekHarness\\dsh-config-sync-plugin-0.3.
|
|
979
|
+
'定位不到客户端根目录:插件不在 <客户端根> 下(如 D:\\DeepSeekHarness\\dsh-config-sync-plugin-0.3.65),'
|
|
980
980
|
+ '或客户端是打包版(resources\\app.asar)而这里没认出来 —— 三份同步脚本会因此生成不了',
|
|
981
|
-
'Cannot locate the client root: the plugin is not under <client root> (e.g. D:\\DeepSeekHarness\\dsh-config-sync-plugin-0.3.
|
|
981
|
+
'Cannot locate the client root: the plugin is not under <client root> (e.g. D:\\DeepSeekHarness\\dsh-config-sync-plugin-0.3.65), '
|
|
982
982
|
+ 'or this is a packaged build (resources\\app.asar) that was not recognized — the three sync scripts cannot be generated.',
|
|
983
983
|
))
|
|
984
984
|
}
|
|
@@ -3477,9 +3477,9 @@ async function handlePrepare(req, res, config) {
|
|
|
3477
3477
|
if (!appRoot) {
|
|
3478
3478
|
throw new Error(t(
|
|
3479
3479
|
'定位不到客户端根目录(要能找到 resources\\app\\package.json 或 resources\\app.asar):'
|
|
3480
|
-
+ '请确认插件装在 <客户端根> 下(例如 D:\\DeepSeekHarness\\dsh-config-sync-plugin-0.3.
|
|
3480
|
+
+ '请确认插件装在 <客户端根> 下(例如 D:\\DeepSeekHarness\\dsh-config-sync-plugin-0.3.65),或在设置里填客户端根 appRoot',
|
|
3481
3481
|
'Cannot locate the client root (needs resources\\app\\package.json or resources\\app.asar): '
|
|
3482
|
-
+ 'make sure the plugin is installed under <client root> (e.g. D:\\DeepSeekHarness\\dsh-config-sync-plugin-0.3.
|
|
3482
|
+
+ 'make sure the plugin is installed under <client root> (e.g. D:\\DeepSeekHarness\\dsh-config-sync-plugin-0.3.65), or set appRoot in the settings',
|
|
3483
3483
|
))
|
|
3484
3484
|
}
|
|
3485
3485
|
const state = {...await repoState(repo), message}
|
package/package.json
CHANGED
package/runtime/apply.ps1
CHANGED
|
@@ -744,14 +744,25 @@ foreach ($f in @('AGENTS.md', 'prompt-inject.md')) {
|
|
|
744
744
|
$src = Join-Path $DshHome $f
|
|
745
745
|
if (Test-Path -LiteralPath $src) { Copy-Item -LiteralPath $src -Destination (Join-Path $BackupDir $f) -Force; $backedUp++ }
|
|
746
746
|
}
|
|
747
|
+
$settingsBackupManifest = [ordered]@{}
|
|
747
748
|
foreach ($m in $settingsMap) {
|
|
748
749
|
if (Test-Path -LiteralPath $m.Src) {
|
|
749
750
|
$bc = Join-Path $BackupDir 'settings'
|
|
750
751
|
if (-not (Test-Path -LiteralPath $bc)) { New-Item -ItemType Directory -Path $bc -Force | Out-Null }
|
|
751
|
-
|
|
752
|
+
$leaf = Split-Path -Leaf $m.Src
|
|
753
|
+
Copy-Item -LiteralPath $m.Src -Destination (Join-Path $bc $leaf) -Force
|
|
754
|
+
# 记下「备份文件名 → 相对 DshHome 的原路径」。旧版只留文件名,还原时全堆到 DshHome 根
|
|
755
|
+
# (storages\workspace.json 变根 workspace.json),这里把原位记进清单,还原按它写回。
|
|
756
|
+
$settingsBackupManifest[$leaf] = $m.Src.Substring($DshHome.Length).TrimStart([char]92, [char]47)
|
|
752
757
|
$backedUp++
|
|
753
758
|
}
|
|
754
759
|
}
|
|
760
|
+
if ($settingsBackupManifest.Count -gt 0) {
|
|
761
|
+
try {
|
|
762
|
+
$mfPath = Join-Path (Join-Path $BackupDir 'settings') '__backup_manifest.json'
|
|
763
|
+
[IO.File]::WriteAllText($mfPath, ($settingsBackupManifest | ConvertTo-Json -Depth 3), (New-Object Text.UTF8Encoding($false)))
|
|
764
|
+
} catch { Warn ('写 settings 备份清单失败(还原时只能按旧规则写回根):' + $_.Exception.Message) }
|
|
765
|
+
}
|
|
755
766
|
if ($backedUp -gt 0) {
|
|
756
767
|
Ok "已备份 $backedUp 个文件到 $BackupDir"
|
|
757
768
|
} else {
|
|
@@ -845,6 +856,8 @@ if ($dropped.Count -gt 0) { Ok "已剔除 $($dropped.Count) 个实验性 bundle
|
|
|
845
856
|
$localPluginMap = [ordered]@{
|
|
846
857
|
'dsh-our-free-model-2.8.0' = 'dsh-our-free-model'
|
|
847
858
|
'dsh-purge-1.4.0' = 'dsh-purge'
|
|
859
|
+
'dsh-config-sync-plugin-0.3.65' = 'dsh-config-sync-plugin'
|
|
860
|
+
'dsh-config-sync-plugin-0.3.64' = 'dsh-config-sync-plugin'
|
|
848
861
|
'dsh-config-sync-plugin-0.3.63' = 'dsh-config-sync-plugin'
|
|
849
862
|
'dsh-config-sync-plugin-0.3.62' = 'dsh-config-sync-plugin'
|
|
850
863
|
'dsh-config-sync-plugin-0.3.61' = 'dsh-config-sync-plugin'
|
package/runtime/post-exit.ps1
CHANGED
|
@@ -193,6 +193,35 @@ function Show-NoticesSummary {
|
|
|
193
193
|
Write-Host '--------------------------------------------------------' -ForegroundColor Yellow
|
|
194
194
|
}
|
|
195
195
|
|
|
196
|
+
# 失败原因集中展示:从本次日志里挑出 Die 的红字 [X] 行(含紧随的多行详情)+ 相关警告,
|
|
197
|
+
# 统一打在窗口末尾,用户不必再从几十行进度里翻失败点。只在失败时调用。
|
|
198
|
+
function Show-FailureSummary {
|
|
199
|
+
if (-not (Test-Path -LiteralPath $LogFile)) { return }
|
|
200
|
+
$lines = @()
|
|
201
|
+
try { $lines = @(Get-Content -LiteralPath $LogFile -Encoding utf8) } catch { return }
|
|
202
|
+
if ($lines.Count -eq 0) { return }
|
|
203
|
+
$errIdx = @()
|
|
204
|
+
for ($i = 0; $i -lt $lines.Count; $i++) {
|
|
205
|
+
if ($lines[$i] -match '\[X\]' -or $lines[$i] -match '执行体调用异常|ParserError|终止错误|fatal:|NativeCommandError|未正常结束|没正常跑完|badTimezone') { $errIdx += $i }
|
|
206
|
+
}
|
|
207
|
+
$warns = @($lines | Where-Object { $_ -match '\[!\]' })
|
|
208
|
+
if ($errIdx.Count -eq 0 -and $warns.Count -eq 0) { return }
|
|
209
|
+
Write-Host ''
|
|
210
|
+
Write-Host '================ 失败原因集中展示 ================' -ForegroundColor Red
|
|
211
|
+
$printed = New-Object 'System.Collections.Generic.HashSet[int]'
|
|
212
|
+
foreach ($i in ($errIdx | Select-Object -First 6)) {
|
|
213
|
+
for ($j = $i; $j -lt [Math]::Min($i + 6, $lines.Count); $j++) {
|
|
214
|
+
if ($printed.Add($j)) { Write-Host (' ' + $lines[$j].TrimEnd()) -ForegroundColor Red }
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
if ($warns.Count -gt 0) {
|
|
218
|
+
Write-Host (' --- 相关警告(前 8 条)---') -ForegroundColor Yellow
|
|
219
|
+
foreach ($w in ($warns | Select-Object -First 8)) { Write-Host (' ' + $w.TrimEnd()) -ForegroundColor Yellow }
|
|
220
|
+
}
|
|
221
|
+
Write-Host (' 完整日志:{0}' -f $LogFile)
|
|
222
|
+
Write-Host '==================================================' -ForegroundColor Red
|
|
223
|
+
}
|
|
224
|
+
|
|
196
225
|
function Finish([int]$code, [string]$note) {
|
|
197
226
|
Log ("结束:{0}(退出码 {1})" -f $note, $code)
|
|
198
227
|
Log ("日志:{0}" -f $LogFile)
|
|
@@ -205,26 +234,21 @@ function Finish([int]$code, [string]$note) {
|
|
|
205
234
|
}
|
|
206
235
|
} catch { }
|
|
207
236
|
|
|
208
|
-
#
|
|
209
|
-
#
|
|
210
|
-
# 所以窗口留多久、还是被点 × 直接结束,都不会把客户端带走。
|
|
211
|
-
# 只有 relaunch(纯重启,窗口里没有可看的结果)仍旧停 3 秒自动关。
|
|
237
|
+
# 结果展示后窗口随进程自动关闭:不再要求「按任意键」(远程桌面/无焦点时 ReadKey 会一直卡住)。
|
|
238
|
+
# 用户可直接点右上角 × 提前关闭;客户端由 explorer 代启,与本窗口无父子关系,关窗不会带走它。
|
|
212
239
|
if ($Mode -eq 'pull' -or $Mode -eq 'push' -or $Mode -eq 'update' -or $Mode -eq 'restore') {
|
|
213
240
|
$title = if ($Mode -eq 'update') { '插件更新已完成' } elseif ($Mode -eq 'restore') { '还原已完成' } else { '同步已完成' }
|
|
214
241
|
try {
|
|
215
242
|
Show-NoticesSummary
|
|
243
|
+
if ($code -ne 0) { Show-FailureSummary }
|
|
216
244
|
Write-Host ''
|
|
217
245
|
Write-Host ("================ {0} ================" -f $title)
|
|
218
|
-
Write-Host '
|
|
219
|
-
Write-Host '
|
|
246
|
+
Write-Host ' 窗口将在 6 分钟后自动关闭;也可直接点右上角 × 关闭(客户端在后台运行,不受影响)。'
|
|
247
|
+
if ($code -ne 0) { Write-Host ' 失败原因已集中在上面「失败原因集中展示」一段,不必再翻日志。' -ForegroundColor Red }
|
|
220
248
|
Write-Host '==========================================='
|
|
221
|
-
|
|
222
|
-
} catch {
|
|
223
|
-
# 不是真控制台(被重定向/无窗口)时 ReadKey 会抛,退化成长时间挂起而不是立刻消失
|
|
224
|
-
try { Start-Sleep -Seconds 3600 } catch { }
|
|
225
|
-
}
|
|
249
|
+
} catch { }
|
|
250
|
+
try { Start-Sleep -Seconds 360 } catch { }
|
|
226
251
|
} else {
|
|
227
|
-
# 窗口跟着进程一起关,停 3 秒让用户看清成功/失败与日志路径
|
|
228
252
|
try { Start-Sleep -Seconds 3 } catch { }
|
|
229
253
|
}
|
|
230
254
|
exit $code
|
package/runtime/restore.ps1
CHANGED
|
@@ -300,14 +300,29 @@ if ($mode -eq 'git') {
|
|
|
300
300
|
|
|
301
301
|
$bkSettings = Join-Path $BackupDir 'settings'
|
|
302
302
|
if (Test-Path -LiteralPath $bkSettings) {
|
|
303
|
-
|
|
303
|
+
# 0.3.64 修复:apply 备份时把「备份文件名 → 相对 DshHome 的原路径」写进了清单。
|
|
304
|
+
# 旧版只留文件名、还原全堆到 DshHome 根(storages\workspace.json 变根 workspace.json),
|
|
305
|
+
# 现按清单写回原目录;没有清单的老快照退化为写回根(至少文件还在),并明确告警。
|
|
306
|
+
$bkManifest = $null
|
|
307
|
+
$mfPath = Join-Path $bkSettings '__backup_manifest.json'
|
|
308
|
+
if (Test-Path -LiteralPath $mfPath) {
|
|
309
|
+
try { $bkManifest = Get-Content -LiteralPath $mfPath -Raw -Encoding utf8 | ConvertFrom-Json } catch { $bkManifest = $null }
|
|
310
|
+
} else {
|
|
311
|
+
Warn "这份快照没有 settings 备份清单(老版本备份):设置文件只能写回 $DshHome 根目录,可能要手动挪回原位"
|
|
312
|
+
}
|
|
313
|
+
if ($DryRun) { Say " 将写回 settings\ 下的插件设置文件到各自原位" }
|
|
304
314
|
else {
|
|
305
315
|
$cnt = 0
|
|
306
|
-
Get-ChildItem -LiteralPath $bkSettings -File -Force | ForEach-Object {
|
|
307
|
-
|
|
316
|
+
Get-ChildItem -LiteralPath $bkSettings -File -Force | Where-Object { $_.Name -ne '__backup_manifest.json' } | ForEach-Object {
|
|
317
|
+
$prop = if ($bkManifest) { $bkManifest.PSObject.Properties[$_.Name] } else { $null }
|
|
318
|
+
$rel = if ($prop) { [string]$prop.Value } else { $_.Name }
|
|
319
|
+
$dest = Join-Path $DshHome $rel
|
|
320
|
+
$destDir = Split-Path -Parent $dest
|
|
321
|
+
if ($destDir -and -not (Test-Path -LiteralPath $destDir)) { New-Item -ItemType Directory -Path $destDir -Force | Out-Null }
|
|
322
|
+
Copy-Item -LiteralPath $_.FullName -Destination $dest -Force
|
|
308
323
|
$cnt++
|
|
309
324
|
}
|
|
310
|
-
Ok "已写回 settings 下 $cnt
|
|
325
|
+
Ok "已写回 settings 下 $cnt 个插件设置文件到各自原位"
|
|
311
326
|
}
|
|
312
327
|
}
|
|
313
328
|
}
|