dsh-config-sync-plugin 0.3.69 → 0.3.71

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
@@ -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.69"` 后 `pnpm i`;包名与 `cordis.patch.yml` 里注册的名字、插件目录 `dsh-config-sync-plugin-<ver>` 一致 |
18
+ | npm | `npm i dsh-config-sync-plugin` | 适合把它当依赖管理,或在 profile 的 `package.json` 里写 `"dsh-config-sync-plugin": "^0.3.71"` 后 `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
 
@@ -111,16 +111,7 @@ pwsh -File runtime\sync.ps1 pull `
111
111
 
112
112
  ---
113
113
 
114
- ## 安装
115
-
116
- ```sh
117
- # 版本号换成 Releases 页里最新的那个
118
- dsh plugin add https://raw.githubusercontent.com/QcWyGm/dsh-config-sync-plugin/main/releases/dsh-config-sync-plugin-<版本>.tgz
119
- ```
120
114
 
121
- 或在 DSH「插件 → 发现 → 索引源」里添加本仓库索引(见「作为插件市场的索引源」)。第三方市场 **dshmarket 不读这份索引**,原因见同一节。
122
-
123
- `apply.ps1` 落地时做三件事:`local-plugins\dsh-config-sync-plugin-<版本>.tgz` 解压到 `<AppRoot>\dsh-config-sync-plugin-0.1.0`;`package.json` 加一条 `link:` 依赖与一条 `dsh.profile.bundles`;`cordis.patch.yml` 加 `config-sync` 行。
124
115
 
125
116
  ## 包含什么
126
117
 
@@ -143,16 +134,16 @@ dsh plugin add https://raw.githubusercontent.com/QcWyGm/dsh-config-sync-plugin/m
143
134
 
144
135
  ## 面板显示什么
145
136
 
146
- 布局是「一行状态 + 一行指标 + 分区卡片」,从上往下读:
137
+ 从上往下:
147
138
 
148
139
  - **标题行**:`配置同步 本机 [一致/待推送/待拉取/有问题] 云端 [一致/不一致/待拉取]`。本机徽标看配置齐不齐、依赖缺不缺、有无未提交/未推送;云端**全自动**(打开面板查一次、之后每 2 分钟复查),没有手动按钮。右上角「重新检测」与「本机路径」按钮。
149
140
  - **元信息行**:`app 版本 / Electron 版本 · 分支 @ 短 HEAD`。
150
141
  - **指标条**:`本机 / 契约`、`bundle`、`依赖`、`备份快照`、`上次同步`(后面 `(+N)` 表示之后又写入了几个文件)。有事才在下面出现「待办」。
151
142
  - **分区**:概览 → 本机路径(**默认整块不显示**,点标题行「本机路径」按钮展开,有待处理项时按钮变橙带数量)→ 同步冲突(真有冲突时才出现)→ 同步目标 → 自动化与插件更新 → 退出后执行 → 还原备份 → 同步内容 → 问题反馈。
152
143
 
153
- **统一交互**:「本机路径 / 本机仓库 / 云端仓库 / 自动同步 / 插件更新 / 同步内容」都是**先只读、点「修改」才解锁**,改完「保存」,「取消」丢弃本次改动。只有"没配过"的卡(没设仓库、没设远端)强制停在编辑态且不给「取消」。
144
+ **统一交互**:所有卡片**先只读,点「修改」才解锁**,改完「保存」生效,「取消」丢弃。没配过的卡强制停在编辑态。
154
145
 
155
- **「待推送」不只看 git**:`git status` 干净时新会话/新资料可能还躺在 `~\.dsh` 里没 capture。`sync.ps1` push/pull 成功后会写 `~\.dsh\config-sync-state.json`(`lastSyncAt`/`mode`/`head`);`status` 的 `local` 段 stat `sessions`、`skills`、`.agent-presets`、`mnemon`、profile 五文件、登记的工作区目录,mtime 晚于 `lastSyncAt` 的计入 `local.pending`,徽标转橙。只看 mtime、不读内容;上限 20000 文件 / 1.5 秒。
146
+ **「待推送」不只看 git**:`git status` 干净时新会话/新资料可能还在 `~\.dsh` 里没 capture。`status` 按 mtime 比对 `sessions`、`skills`、`.agent-presets`、`mnemon`、profile 文件、工作区目录,晚于上次同步的计入待推送。只看 mtime,上限 20000 文件 / 1.5 秒。
156
147
 
157
148
  **「待拉取」= 本机仓库还是空目录**(不报异常,橙色徽标 + 「执行拉取会从云端拉到这里」)。
158
149
 
@@ -519,7 +510,7 @@ node ~\.dsh\.dsh-plugin-market\market-core.mjs catalog --profile desktop
519
510
 
520
511
  ## 生成器里已经堵掉的坑
521
512
 
522
- 都是**在新机器上真跑一遍**才暴露的:
513
+ 新机器真跑一遍才暴露的坑:
523
514
 
524
515
  | 坑 | 处理 |
525
516
  |---|---|
@@ -565,199 +556,18 @@ pwsh -File sync.ps1 push -ScanHistory
565
556
 
566
557
  ## 实测记录
567
558
 
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-19:发版 0.3.69(跨机搬运 billion-context 压缩状态 + 同步清单两类新提示)
586
-
587
- **问题**:长会话在 A 机能接着聊,拉取到 B 机后一发消息就报上下文超长。
588
-
589
- 原因是压缩分两层:A 机的 DSH 原生 compaction 已被 billion-context **禁用**(`billion-context/dist/agent/dsh-compaction-gate.js` 在 `__BILI_DSH_COMPACTION_VERDICT__ === "active"` 时把 `@deepseek-ai/dsh-compaction-basic`、`@deepseek-ai/dsh-command-compact` 全部改成 `disabled:true`),真正的压缩是 bili 在**出口侧**做的——它把 2.3 M 的 surface 压成 160 K 再发给 provider。而 bili 的压缩记录不在 `.dsh` 里,在独立的 SQLite:`%LOCALAPPDATA%\billion-context\sessions\index.db`(表 `sessions` / `blocks` / `content` / `refs` / `messages` / `checkpoints` …)。
590
-
591
- 同步过去只有 `sessions` / `attachments` / `vision_router_session_policy` 三块,**bili 的 index.db 完全没跟着走**。于是 B 机:①没有 DSH 原生压缩(被 bili 禁了)②没有 bili 的压缩记录(bili 认为这是新会话,`max compressible` 不足,阈值不到不压)③把全量 surface 直接发给 provider → `CONTEXT_WINDOW_EXCEEDED`。
592
-
593
- **修复**:新增 `tools/bili-state.mjs`,按会话搬运压缩状态,四步都不碰别人的会话。
594
-
595
- | 子命令 | 作用 |
596
- |---|---|
597
- | `probe` | 列本机 bili 库概况(表、行数、`user_version`) |
598
- | `export <sessionId> <outFile>` | 导出单会话状态(`sessions` 行 + active `blocks` 行 + 这些 block 的 summary `content`) |
599
- | `import <inFile> [--dry-run]` | 回灌;按主键跳过已存在的行,可重复执行 |
600
- | `sync <specJson> <outJson>` | 批量,供 `capture.ps1` / `apply.ps1` 调用(结果写文件,不依赖 stdout) |
601
-
602
- 体积控制是硬要求,默认导出**刻意不带**三样东西:
603
-
604
- - `sessions.metadata_json`(2.4 MB 级缓存;且该列 `NOT NULL`,导出要 `delete row.metadata_json` 让它落 DEFAULT,否则 `NOT NULL constraint failed`)
605
- - `checkpoints.state_hash` 指向的快照(单条可达 21.89 MB)
606
- - `messages` / `message_media` 正文(bili 会从 DSH 会话日志自己 ingest)
607
-
608
- 结果:一条长会话约 **5 MB**(34~35 个 active block、约 7000 条 refs、34 条 summary),落在仓库 `conversations/billion_context/<sessionId>.json`。带 `--all-blocks` / `--full` 才导出全部 block 与 checkpoint 快照。
609
-
610
- 接入点:`capture.ps1` 在会话块之后对本次变动的 sessionId 调 `-Mode 'export'`;`apply.ps1` 在会话还原之后对 `conversations/billion_context` 调 `-Mode 'import'`。**B 机没装 billion-context 时静默跳过**,打印「本机没有 billion-context,压缩状态跳过(DSH 自带压缩会接管)」,不做任何写入。
611
-
612
- **同步清单的两类新提示**(这一版同时解决「B 机没装插件没人告诉你」):
613
-
614
- | kind | 什么时候出现 | 面板怎么说 |
559
+ | 日期 | 版本 | 要点 |
615
560
  |---|---|---|
616
- | `plugin-missing` | `dependencies` 里的插件没装到本机、bundle 无法解析、仓库里没有该 link 插件的归档 | 「插件没装:拉取只还原配置,不替你装依赖。先在本机 profile 目录执行 pnpm install(或去掉 `-SkipInstall` 重跑 apply.ps1),装好后重新拉取一次。」 |
617
- | `context-state` | bili 压缩状态没同步过来 / 导入失败 / 本机没有 bili | 「会话缺压缩状态:这些会话在本机可能报上下文超长。在主力机重新推送一次,或在本机设 `BILLION_CONTEXT_PLUGIN=0` 让 DSH 原生压缩兜底。」 |
618
-
619
- 清单落 `~/.dsh/sync-notices.json`,面板常驻显示直到下次同步清掉;`post-exit.ps1` 的结束摘要也按类分组打印。标题按实际类别说人话——纯文件类说「N 项没处理完」,插件/压缩状态类说「N 项需要处理」,不再把插件问题写成「文件没同步」。
620
-
621
- **手动兜底**:`node tools/bili-state.mjs probe` 看本机 bili 库;`node tools/bili-state.mjs export <sessionId> <out.json>` 单独导一条;`import --dry-run` 先看会写什么。
622
-
623
- ### 2026-11-19:发版 0.3.68(会话投影缓存守卫,治 agent-busy 建会话失败)
624
-
625
- **问题**:DSH 的「新建会话」并不每次都真建——客户端会先在工作区里找一条**空白会话**复用(`client-ui-workspace/createInWorkspace()` → `sessions.ids.find(summary.blank && …)` → `createNamed({ sessionId: blank })`)。而 `summary.blank` 来自投影缓存 `session_projcache\sessions\<id>.json` 里的 `record.rows.sessionListMetadata.val.blank`。
626
-
627
- 缓存是「写一半就停」的产物:某次建会话时写出了 `blank:true / seq:-1`,之后日志继续追加(有了 `turn/start`、`user/message`),缓存却没跟着推进。于是列表仍把这条会话当空白,UI 挑它复用,宿主抛:
628
-
629
- ```
630
- session/agent-busy: session "<id>" is owned by subagent routing
631
- ```
632
-
633
- 新建会话直接失败,且刷不回来(缓存一直被复用)。跨机同步会放大这个问题——A 机的陈旧缓存被 pull 到 B 机,B 机同样中招。
634
-
635
- **修复**:三层,都不碰日志、不碰工作区登记,只做缓存文件操作。
636
-
637
- | 层 | 触发 | 动作 |
638
- |---|---|---|
639
- | 客户端 | `sessions.create` 撞上 `agent-busy` | 包一层 `sessions.create`:捞出撞车的 `sessionId` 报给宿主,去掉旧 `sessionId` 后**重试一次**。正常路径零开销 |
640
- | 宿主 | 收到客户端上报 | 把 `<DshHome>/storages/session_projcache/sessions/<id>.json` **挪到** `<DshHome>/logs/session-cache-guard-backup/`(只挪不删),DSH 下次读列表时按完整日志重建缓存,`blank` 自然变 `false` |
641
- | 定时 | 每 3 分钟 | 主动扫同类陈旧缓存,条件四重全中才算(宁可漏判不可误删):①缓存能解析且 `blank===true` ②能找到对应 `session.v*.jsonl.zstd` ③日志里确有 `turn/start` 或 `user/message` ④日志末事件 `seq` > 缓存记录的最大 `seq` |
642
-
643
- 新增路由 `/config-sync/cache-guard`:`GET` 只读扫描;`POST` 支持 `scan` / `sweep` / `clear` / `busy`。设置里新增 `cacheGuard` 开关,**默认开**;关掉后既不定时扫描,也不理会客户端的 `agent-busy` 上报。
644
-
645
- 实现:`runtime/tools/session-cache-guard.mjs`(`scanSessionCaches` / `clearSessionCaches` / `runGuard` / `indexSessionLogs`),客户端半身在 `client.js` 的 `0.3.68:会话缓存守卫` 段。
646
-
647
- **手动兜底**:面板「会话缓存守卫」卡可以直接扫一遍、看到候选与判定依据,再决定清哪几条;缓存永远只备份不删除,清错了从 `<DshHome>/logs/session-cache-guard-backup/` 拷回去就行。
648
-
649
-
650
- ### 2026-11-19:发版 0.3.67(会话日志 seq 对账护栏)
651
-
652
- **问题**:两台机器各自往同一个会话写事件时,同步是「整文件覆盖」。谁后 push 谁的内容顶掉对方的后半段,事件流出现 `seq` 跳号,DSH 启动直接报 `stored session ... is corrupt: corrupt session log: invalid committed event at line N: released v2 row N has seq gap (expected X, got Y)`,该会话再也打不开。
653
-
654
- **修复**:`capture.ps1`(推送侧)与 `apply.ps1`(拉取侧)遇到 `session*.jsonl.zstd` 不再 `Copy-Item -Force`,改为交给新加的 seq 护栏:
655
-
656
- | 情形 | 处理 |
657
- |---|---|
658
- | 目标更全 / 完全相同 | 保留目标,什么都不写 |
659
- | 源是目标的严格超集 | 用源覆盖目标 |
660
- | 两边各有独占事件 | 按 `seq` 求并集写入,两边事件全保住 |
661
- | 目标自身断档、源能补齐 | 先补齐再写(`merge`,可救回已被覆盖坏的会话) |
662
- | 洞补不回来(事件确实丢了) | **保持原样不覆盖**,记 `sync-notices.json` 的 `failed` 并提示需人工处理 |
663
-
664
- 护栏实现:`tools/session-log-lib.mjs`(多帧 zstd 逐帧解、字节前缀比较、按 seq 合并)+ `tools/session-log-guard.mjs`(`check` / `decide` / `merge` / `batch` CLI,批量模式给 ps1 调用,结果走临时 JSON 文件而不是 stdout——Electron 是 GUI 子系统)。11MB 会话全量解析 ~0.6s,可进同步热路径。
665
-
666
- **顺带两处**:
667
- - `.gitattributes` 补 `conversations/sessions/**/*.zstd binary` 与 `workspace/** -text`,避免 Windows `core.autocrlf` 或 git 的行尾归一再次写坏二进制日志;
668
- - `capture.ps1` 把「大目录文件比较」几个辅助函数上移到脚本前部——它们原先定义在调用点之后,`-WorkspaceOnly` 跑到会话镜像循环会报 `Test-TreeFileChanged is not recognized`。
669
-
670
- 诊断工具:`node tools/check-session-log.mjs <日志>` 或 `<日志A> <日志B>`,输出自洽性(行数/seq 范围/gaps)与两份的关系(`identical` / `prefix` / `superset` / `fork`)。
671
-
672
- ### 2026-11-19:发版 0.3.66(.gitattributes 消除 LF/CRLF 警告)
673
- - **跨平台行尾噪音**:Windows 上 `core.autocrlf=true` 会把仓库里 LF 写入的 `session_projcache/*.json` 自动转成 CRLF,推送时 Git 报 "LF will be replaced by CRLF" 警告。新增 `.gitattributes` 将该目录标记为二进制(`binary`),其余文本文件统一 `eol=lf`,彻底消除该类警告。
674
- - 纯配置项改动,不改变任何同步逻辑、行为与数据。
675
- ### 2026-11-18:发版 0.3.65(刷新按钮反馈)
676
- - **顶部「重新检测」**:点击后无论数据是否变化都给明确 toast 反馈——成功显示「已重新检测,数据已是最新(时间)」,失败显示具体原因,复用 5 秒自动消失的提示条。此前状态本就是最新时页面看起来毫无变化,用户会以为没点上。
677
- - **卡片「刷新」按钮**:同步冲突、插件数据、同步内容、问题反馈、设置摘要行五处刷新按钮,点击后文字变「刷新中…」并禁用,结束恢复「刷新」。其中同步冲突 / 同步内容 / 问题反馈三处原来的 `load()` 根本没驱动 `busy`(按钮文字永远不变),本次补齐 `setBusy`;顶部与本机路径的「检测中…/读取中…」保持不变。
678
- - `node --check` 与客户端半身自检全过,纯前端交互修复,行为与数据不变。
679
- ### 2026-11-18:发版 0.3.64(还原备份修复 + 失败原因集中展示 + 自动关窗)
680
-
681
- - **还原备份 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 清单,全部通过。
682
- - **失败原因集中展示**:推送/拉取失败时,`post-exit.ps1` 收尾新增 `Show-FailureSummary`,从执行日志抽取 `[X]` 错误行及后续详情、最近的 `[!]` 警告,红/黄集中打印在末尾,不用再翻日志找原因。
683
- - **自动关窗**:推送/拉取/更新/还原脚本结束后,展示结果 6 分钟后自动退出关窗,不再要求「按任意键」(远程桌面/无焦点时 `ReadKey` 会一直卡住);也可直接点右上角 × 提前关闭。
684
- - **边界说明**:`apply` 拉取前备份的 workspace/conversations/skills/presets/plugin-data 属数据目录,不纳入「配置还原」回退范围(有各自的同步/会话路径,强塞会引入路径映射与大目录遍历开销)。
685
-
686
- ### 2026-11-18:推送提速发版 0.3.63(Get-RelPath 快 10 倍)
687
-
688
- 推送/拉取共用的 `Get-RelPath` 原来对每个文件做两次 `-split` + `Where-Object`;5 万文件工作区下,推送比对单独占 11.7s。改为 `StartsWith` + `Substring` 快路径,大小写或 8.3 短路径不一致时回退原段数比对逻辑。49138 文件全量比对与老版输出 0 差异,微基准 5.08s → 0.51s(约 9.9 倍)。三处 `dsh-sync-common.ps1`(源码 / 配置仓库 / 插件副本)同步。
689
-
690
- ### 2026-11-18:拉取提速发版 0.3.62(341s → 109s,约 3.1×)
691
-
692
- 一台机器上工作区有 49110 个文件、另一个工作区槽位堆积了 101097 个孤儿文件,点「拉取」时卡在「已还原工作区」好几分钟。逐段打点后定位到 4 个浪费点,全部在 `runtime\apply.ps1`,行为不变(落到仓库的文件、提交内容、配置结果逐字节一致),只改「怎么算」:
693
-
694
- | 环节 | 结果 |
695
- |---|---|
696
- | 端到端总耗时 | 340.9s → 108.5s(同环境同输入,约 3.1×);功能断言全过:5 工作区还原、写入/更新 0、备份 0、会话 cwd 修正 56、bundle 24 项可解析、`EXIT=0` |
697
- | ① 无条件全量备份 | 原来每个工作区还原前把整个工作区备份一遍(49110 文件 × 1.99ms ≈ 98s),而二次拉取时源与目标内容全一致、实际需备份 0 个。改为「确认某个文件即将被覆盖时才备份这一个」→ 备份 49110 → 0 |
698
- | ② 哈希 API | `Get-FileHash` 实测 0.957ms/文件,.NET `SHA256.ComputeHash` 流式 0.16ms/文件(约 6×);会话首帧与工作区比对的哈希统一换成流式 SHA256 |
699
- | ③ zip 版本正则 | 归档内 `package.json` 路径在 `Compress-Archive` 打出的 zip 里是反斜杠,而版本正则只认 `/` → 读不到归档版本、`git fetch` 刷新 mtime 后每轮误判「本地插件有新版本」,反复重解压 3 个 link 插件。改成 `[\\/]` 兼容两种分隔符后,三插件稳定显示「本地插件已存在」 |
700
- | ④ **真凶:O(n²) 数组追加** | extra 扫描里 `$extra = @()` + `$extra += $lf.FullName`,101097 个孤儿文件约 51 亿次数组拷贝,单独占 264s(dsh-config-sync 槽位仅 16 个同步文件却耗时 264s)。换成 `[System.Collections.Generic.List[string]]::new()` + `$extra.Add(...)` → O(n) |
701
- | 剩余 108s | DSH破甲 49110 文件的哈希 + 复制 71s 是实打实的磁盘 I/O;再压需要方案③「git HEAD 增量短路」,风险高、默认未做 |
702
- | 顺手修 | 历史遗留的 `market-index.json` 结构损坏(0.3.61 发版时把 `plugins` 数组写成了对象/数组混合)与该条目 commit 的 `TODO_COMMIT_0361` 占位符,本次一并修正;0.3.61 的「跳过 projcache 同步」(上下文超长修复)保持不变 |
703
- | 教训 | PowerShell 管道 `ForEach-Object` 打时间戳会被输出缓冲吞掉,实时打点要写 stderr(`[Console]::Error.WriteLine`);带 BOM 的 UTF-8 脚本全程只能用 UTF8 读写,用 ISO-8859-1 读写会把中文 `.NET` 强制 UTF8 解码后再写回全变 `?` 并丢 BOM |
704
-
705
- ### 2026-11-15:性能发版 0.3.54(三处提速,行为不变)
706
-
707
- | 环节 | 结果 |
708
- |---|---|
709
- | 规模基线 | 配置仓库 50817 文件 / 398.7MB(workspace 50377 / 358.4MB,`.git` 315 / 223.3MB,16 个提交);`.dsh` 48168 文件;最大单文件 `workspace\SquadLink\reversing\scripts\pe-analyst\out\insns.tsv` 44.7MB |
710
- | 同规模假仓库 | 50889 文件 / 416.4MB(生成 136s);`git add -A` 首跑 92.0s、空跑 0.30s;`status --porcelain` 0.31s、`ls-files --stage` 0.14–0.40s |
711
- | 推送侧最大浪费 | `git ls-tree -r -l HEAD` = 19.98 / 21.4 / 23.16s;替代测速:`rev-list --objects` 0.15s、`cat-file --batch-all-objects --batch-check` 0.21s、`diff-tree -r -l HEAD~1 HEAD` 0.12s(都不等价于「全量历史体积」判定,所以最终选缓存而非替换命令) |
712
- | 哈希成本 | `Get-FileHash` 单文件 1.20ms(600 文件 0.72s);.NET 流式 SHA256 1.05ms,只快 1.1×——瓶颈是每文件 open/read 与随机小文件,换 API 没用 |
713
- | 快筛写法对比 | cmdlet 式(逐文件 `Test-Path` + `Get-Item`)**37.78s**;两次 `Get-ChildItem` + 内存字典 **3.91s**;后者只对 size/mtime 不一致者算哈希,实测 0 个需算(0.09s) |
714
- | 网络往返 | 真实 Gitee `git ls-remote --heads origin` 三次 0.90 / 0.97 / 0.96s → 拉取省掉一次 fetch 约省 1s |
715
- | 只读遍历 | `.dsh` 48168 文件枚举 6.85s;仓库 workspace 50377 文件枚举 2.17s;单文件 stat 0.73ms |
716
- | 隔离端到端 | 假 `.dsh` + 假客户端根 + 本地 bare 远端、300 文件工作区:push#1 退出 0(全量扫、`oversized: 0`)、push#2 **3.23s**(跳过扫描)、push#3 `-DeepVerify` 退出 0 且「深哈希 300」、pull 退出 0 且 `Fast-forward`、远端新增文件到位 |
717
- | 顺手修掉 | `Get-OversizedHistory` 空结果写成 `return ,$res`,调用方 `@()` 之后 Count 变 1 → 空仓库误报「历史里有 1 个超限文件(0.0 MB)」且路径为空。改成 `return $res`,复测缓存 `oversized: 0` |
718
- | 测试教训 | 端到端必须造假 AppRoot(`Resolve-DshAppRoot` 认 `resources\app\package.json` 或 `resources\app.asar`);把真实 `D:\DeepSeekHarness` 传进去会被 `apply` 覆盖真实 mnemon,只能靠它的自动备份还原 |
719
-
720
- ### 2026-11-14(二):会话日志首帧 4 字节残留,新建会话 500
721
-
722
- 同步过一次之后,客户端点「新会话」直接弹 `新建会话失败:gateway/internal: failed to create session: SessionQueryError: stored session "…" is corrupt … invalid frame magic at byte 186`——一个历史会话的日志坏了,整个会话库的校验跟着失败,所以连新会话都建不出来。
723
-
724
- | 环节 | 结果 |
725
- |---|---|
726
- | 现场 | `~\.dsh\sessions\--D-DeepSeekHarness-DSH~7834~7532--\session-58db748a…\session.v4.jsonl.zstd`,423 字节,mtime 是 11-13 那次同步,不是当天 |
727
- | 字节解剖 | zstd 帧头 `28 b5 2f fd` 出现在 0 / 190 / 343;DSH 认为首帧止于 **186**,186..189 是 4 字节垃圾,真正的第 2 帧起点在 190 |
728
- | 根因 | 首帧解压是 210 字节(header 行 + 结尾换行),二分得到的「最小可解前缀」= 186,而帧尾实际是 190:DSH 首帧带 4 字节 content checksum,解压器对缺这 4 字节的前缀同样返回成功。`rest = buf.subarray(186)` 于是把旧 checksum 当正文,写回后 186..189 永久残留 |
729
- | 影响面 | 扫 `~\.dsh\sessions` 下 17 个 `session.v4.jsonl.zstd`:真正的坏文件 1 个(带空洞);另 1 个被判误报,复核是**带 checksum 的正常 5 帧文件**(帧头 0/197/380/479/559),已按备份原样还原 |
730
- | 数据修复 | 备份到 `~\.dsh\backups\session-corrupt-<stamp>` → 删掉 4 字节空洞(423 → 419)→ 复扫 bad=0;首帧 cwd 保留、第 2 帧(269 字节)可解 |
731
- | 代码修复 | `firstFrameEnd` 按 FHD bit2 补 4 字节并以「下一帧帧头」校正;首帧改为**整段解压文本替换 cwd 后重压**(原来只重压 header 一行,首帧有追加行会丢);**先自检后落盘**;遇到历史残留尾巴自动丢掉 |
732
- | 隔离验证 | 用真实 checksum 多帧样本改 cwd:帧结构完整(0/169/352/451/531 全可解);幂等复跑 `alreadyOk=1`;喂入带空洞的坏文件一次修好(402 字节,帧头 0/169/322) |
733
- | 结论 | 会话日志只会「缺内容」不会「内容错」,所以删空洞比重新压缩安全;helper 现在宁可跳过报错也不写坏后续帧 |
734
-
735
- ### 2026-11-14:两台机器从零跑通(隔离环境)
736
-
737
- 假云端裸仓库(`git init --bare -b main`)+ 两套假客户端根(`A\app`、`B\app`)+ 各自独立 `.dsh`。全程不碰主力机目录,可反复重跑。
738
-
739
- | 步骤 | 结果 |
740
- |---|---|
741
- | A 机首次推送 | 自动写 6 个执行体 + `tools\fix-session-cwd.mjs` + 版本契约;capture 抓到 8 处变更;提交 15 文件、推到 bare 的 `main`(`push_rc=0`) |
742
- | 仓库侧占位符化 | `workspace\workspace-registry.json` 的 path 写成 `{{APP_ROOT}}/workspace/SquadLink` |
743
- | B 机首次拉取(未装客户端) | `[X] 目标 profile 不存在` 退出(`pull_rc=1`)——**新机器必须先装并启动一次客户端** |
744
- | B 机补 profile 后拉取 | `pull_rc=0`:工作区还原到 `B\app\workspace\SquadLink`(字节保真)、登记表合并成 B 的 `storages\workspace.json`(path 是 B 路径)、bundle 1 项可解析 |
745
- | 无 Node 执行器时 | 日志 `本机没有可用的内置运行时`,会话 cwd 不改写(会话列表会是空的);补一个可用 `node.exe` 后修复生效 |
746
- | settings 语义 | `~\.dsh\settings.json` 里的自定义键**不同步**(白名单制,只搬那 13 个文件) |
747
- | **顺手抓到两个 bug** | ①`fix-session-cwd.mjs` 用 `next.length === text.length` 判"内容没变"——两台机器路径等长时(`D:\...` ↔ `E:\...`)必然误判,表里返回 `projAlreadyOk=1` 而文件里 cwd 仍指源机;改成 `next === text`。②`apply.ps1` 第 4 步只按 `$cwdMap` 判断,仓库里只有 projcache、没有 sessions 时整段跳过,projcache 修复永远不执行;改成 `$cwdMap.Count -gt 0 -or $projMap.Count -gt 0`。两处修完:`projFixed=1`、拉取后 cwd 正确指向本机 |
748
-
749
- ### 2026-11-11:单机隔离环境(装插件 → 拉取 → 推送 → 还原)
750
-
751
- | 步骤 | 结果 |
752
- |---|---|
753
- | 装插件、开面板 | 三道路由都注册;未配置时 `repo.path` 为空不静默回退,推送被 400 拦 |
754
- | 配仓库 / 云端 | 200,路径落进本机 `.dsh\dsh-config-sync.json`;无 origin → `git remote add` |
755
- | 生成三份脚本 | 落在仓库根,`-AppRoot` 指向该机客户端根,带 `--yes` 与 `y/N` 守卫 |
756
- | 首次拉取 | 首次补 upstream → `Already up to date` → 备份 11 文件、铺 436 个 → `pnpm install` 21 个插件 → 25 个 bundle 全部可解析 |
757
- | 工作区 / 会话 | 资料落在假客户端根;登记表路径展开成本机路径;空工作区补建成空目录;会话目录名按本机路径重算的编码逐字一致 |
758
- | 推送 / 还原 | 推到假云端;还原先 `-DryRun` 出计划,`--yes` 后自保 `manual-<时间戳>` 再写回 |
759
- | 退出后同步 | `post-exit.ps1` 五个退出码(0/2/3/4/5)全部复现 |
760
- | 空目录语义 | `repoPhase` 八种形态判定全对(含 8.3 短名路径);空目录跑 `push` 被拦(退出码 1、未生成 `.git`),跑 `pull` 自动 `init → fetch → checkout main` |
761
-
762
- 真机部分另记两条:`{"action":"pull-now"}` 时 `DSH 7→0` 用 5 秒、+10 秒出现可见窗口、拉完自动 `0→4→7`;开 `autoPush` 后点关闭,7 个进程 `hwnd=0` 不退,16 秒后强制收尾并推送成功。
763
-
561
+ | 2026-11-19 | 0.3.69 | 跨机搬运 billion-context 压缩状态(bili-state.mjs);同步清单新增 plugin-missing / context-state 两类提示 |
562
+ | 2026-11-19 | 0.3.68 | 会话投影缓存守卫,治 agent-busy 建会话失败 |
563
+ | 2026-11-19 | 0.3.67 | 会话日志 seq 对账护栏(跨机写同一会话按 seq 求并集,不再整文件覆盖);.gitattributes 钉 binary;capture hoist |
564
+ | 2026-11-19 | 0.3.66 | .gitattributes 消除 LF/CRLF 警告 |
565
+ | 2026-11-18 | 0.3.65 | 刷新按钮反馈(文字变「刷新中…」) |
566
+ | 2026-11-18 | 0.3.64 | 还原备份修复(写回原位)+ 失败原因集中展示 + 6 分钟自动关窗 |
567
+ | 2026-11-18 | 0.3.63 | 推送提速:Get-RelPath 快 10 倍 |
568
+ | 2026-11-18 | 0.3.62 | 拉取提速:341s → 109s(3.1×) |
569
+ | 2026-11-15 | 0.3.54 | 三处提速(快筛/历史缓存/单次 fetch),行为不变 |
570
+ | 2026-11-14 | — | 两台机器从零跑通(隔离环境);会话日志首帧 4 字节残留修复 |
571
+ | 2026-11-11 | — | 单机隔离环境全链路验证(装插件 → 拉取 → 推送 → 还原) |
572
+
573
+ 详细测试数据见对应版本的 Release Notes。
package/client.js CHANGED
@@ -929,7 +929,7 @@ window.__ModuleLoader__.load({
929
929
  }
930
930
  // 「手动还原」指引里的目标位置:认不出类型时按内容猜不到,索性把三类常见落点都摆出来
931
931
  const manualTargets = () => [
932
- M('插件本体 → 插件安装目录(如 D:\\DeepSeekHarness\\dsh-config-sync-plugin-0.3.67)', 'Plugin files → the plugin install folder (e.g. D:\\DeepSeekHarness\\dsh-config-sync-plugin-0.3.67)'),
932
+ M('插件本体 → 插件安装目录(如 D:\\DeepSeekHarness\\dsh-config-sync-plugin-<ver>)', 'Plugin files → the plugin install folder (e.g. D:\\DeepSeekHarness\\dsh-config-sync-plugin-<ver>)'),
933
933
  M('会话目录(--xxx--)→ ~\\.dsh\\sessions', 'Session folders (--xxx--) → ~\\.dsh\\sessions'),
934
934
  M('配置五件套(package.json / pnpm-lock.yaml / cordis.yml…)→ ~\\.dsh\\profiles\\desktop', 'Config files (package.json / pnpm-lock.yaml / cordis.yml…) → ~\\.dsh\\profiles\\desktop'),
935
935
  ]
@@ -966,7 +966,7 @@ window.__ModuleLoader__.load({
966
966
  )),
967
967
  )))
968
968
  : h('div', { style: S.hint }, backup.exists
969
- ? M('这个备份目录下还没有快照(apply.ps1 每次拉取/落地之前都会打一份)', 'No snapshots in this backup folder yet (apply.ps1 makes one before every pull/apply)')
969
+ ? M('这个目录下还没有快照(每次拉取/落地前会自动打一份)', 'No snapshots in this backup folder yet (apply.ps1 makes one before every pull/apply)')
970
970
  : M(`备份目录不存在:${backup.root || defaultRoot}`, `Backup folder does not exist: ${backup.root || defaultRoot}`))
971
971
 
972
972
  /**
@@ -1460,7 +1460,7 @@ window.__ModuleLoader__.load({
1460
1460
  const p = newPath.trim()
1461
1461
  if (!p || !draft || !editing) return
1462
1462
  if (!/^([A-Za-z]:[\\/]|\\\\)/.test(p)) {
1463
- setErr(M('要填绝对路径,比如 C:\\Users\\你\\某个目录(相对路径换台机器对不上)', 'Use an absolute path such as C:\\Users\\you\\some-folder'))
1463
+ setErr(M('要填绝对路径,如 C:\\Users\\你\\某个目录(相对路径换机后对不上)', 'Use an absolute path such as C:\\Users\\you\\some-folder'))
1464
1464
  return
1465
1465
  }
1466
1466
  const label = newLabel.trim() || p.replace(/[\\/]+$/, '').split(/[\\/]/).pop() || 'extra'
@@ -1499,7 +1499,7 @@ window.__ModuleLoader__.load({
1499
1499
  ),
1500
1500
  h('div', { style: S.footnote },
1501
1501
  editing
1502
- ? M('改完点「保存」写进 config-sync-extra.json;点「取消」丢弃改动', 'Click Save to write config-sync-extra.json; Cancel drops the change')
1502
+ ? M('点「保存」写进 config-sync-extra.json,「取消」丢弃改动', 'Click Save to write config-sync-extra.json; Cancel drops the change')
1503
1503
  : M('只读:点右上「修改」才能改规则、加路径', 'Read-only: click Edit to change rules or add paths')),
1504
1504
  msg ? h('div', { style: { ...S.hint, color: 'var(--dsw-alias-state-success-primary, #1a7f37)' } }, msg) : null,
1505
1505
  err ? h('div', { style: { ...S.hint, color: 'var(--dsw-alias-state-error-primary)' } }, err) : null,
@@ -1851,7 +1851,7 @@ window.__ModuleLoader__.load({
1851
1851
  h('div', { style: { ...S.footnote, flex: 1 } }, M('默认关闭;不开就是纯手动', 'Off by default — leaving them off keeps it manual')),
1852
1852
  ),
1853
1853
  sw('autoPull', 'pull', M('启动时自动拉取', 'Pull on startup'),
1854
- M('云端有新提交 → 弹确认 → 退出后拉取,失败自动还原上次配置',
1854
+ M('云端有新提交 → 弹确认 → 退出后拉取,失败自动还原',
1855
1855
  'New commits upstream → confirm → pull after exit; failures roll back to the previous config')),
1856
1856
  sw('autoPush', 'push', M('退出时自动推送', 'Push on exit'),
1857
1857
  M('有改动 / 新资料 / 未推送提交 → 每 2 分钟复查,退出后推送',
@@ -1869,7 +1869,7 @@ window.__ModuleLoader__.load({
1869
1869
  : null,
1870
1870
  !auto.script
1871
1871
  ? h('div', { style: { ...S.hint, color: 'var(--dsw-alias-state-warn-primary)' } },
1872
- M('插件与仓库里都找不到 post-exit.ps1:自动同步排不了队,重装一次插件即可(新包自带 runtime)',
1872
+ M('找不到 post-exit.ps1:自动同步排不了队,重装插件即可',
1873
1873
  'post-exit.ps1 is missing from both the plugin and the repo, so auto sync cannot queue — reinstall the plugin (the current package ships runtime/)'))
1874
1874
  : null,
1875
1875
  h('div', { style: S.actions },
@@ -1946,8 +1946,8 @@ window.__ModuleLoader__.load({
1946
1946
  if (notices.byKind['too-large']) parts.push(M(`${notices.byKind['too-large']} 个超过单文件上限`, `${notices.byKind['too-large']} over the size cap`))
1947
1947
  if (notices.byKind.history) parts.push(M(`${notices.byKind.history} 个在历史提交里`, `${notices.byKind.history} already in history`))
1948
1948
  if (notices.byKind.failed) parts.push(M(`${notices.byKind.failed} 个失败`, `${notices.byKind.failed} failed`))
1949
- if (notices.byKind.skipped) parts.push(M(`${notices.byKind.skipped} 个被跳过`, `${notices.byKind.skipped} skipped`))
1950
- if (notices.byKind['plugin-missing']) parts.push(M(`${notices.byKind['plugin-missing']} 个插件没装`, `${notices.byKind['plugin-missing']} plugin(s) missing`))
1949
+ if (notices.byKind.skipped) parts.push(M(`${notices.byKind.skipped} 个被跳过`, `${notices.byKind.skipped} skipped`))
1950
+ if (notices.byKind['plugin-missing']) parts.push(M(`${notices.byKind['plugin-missing']} 个插件没装`, `${notices.byKind['plugin-missing']} plugin(s) missing`))
1951
1951
  if (notices.byKind['context-state']) parts.push(M(`${notices.byKind['context-state']} 个会话缺压缩状态`, `${notices.byKind['context-state']} session(s) without compaction state`))
1952
1952
  }
1953
1953
  return h('div', {
@@ -1973,16 +1973,16 @@ window.__ModuleLoader__.load({
1973
1973
  return h('div', { style: { fontSize: '12px', fontWeight: 600, color: 'var(--dsw-alias-state-warn-primary)' } }, headline)
1974
1974
  })(),
1975
1975
  h('div', { style: { ...S.footnote, marginTop: '3px' } },
1976
- M('文件类的仍在本机磁盘上,只是没进仓库;下次同步会自动复查。插件类要先在本机装好,再拉一次。',
1976
+ M('文件类的仍在本机磁盘上,只是没进仓库;插件类要先装好再拉一次。',
1977
1977
  'File items are still on this machine, just not in the repo; the next sync re-checks them. Plugin items need an install here first, then pull again.')),
1978
1978
  (notices.byKind && notices.byKind['plugin-missing'])
1979
1979
  ? h('div', { style: { ...S.footnote, marginTop: '3px', color: 'var(--dsw-alias-state-warn-primary)' } },
1980
- M('插件没装:拉取只还原配置,不替你装依赖。先在本机 profile 目录执行 pnpm install(或去掉 -SkipInstall 重跑 apply.ps1),装好后重新拉取一次。',
1980
+ M('插件没装:拉取不装依赖。先在 profile 目录执行 pnpm install(或去掉 -SkipInstall 重跑 apply.ps1),装好后再拉一次。',
1981
1981
  'Missing plugins: pulling only restores config, it does not install dependencies. Run pnpm install in the profile dir first (or re-run apply.ps1 without -SkipInstall), then pull again.'))
1982
1982
  : null,
1983
1983
  (notices.byKind && notices.byKind['context-state'])
1984
1984
  ? h('div', { style: { ...S.footnote, marginTop: '3px', color: 'var(--dsw-alias-state-warn-primary)' } },
1985
- M('会话缺压缩状态:billion-context 的压缩记录没同步过来,这些会话在本机可能报上下文超长。在主力机重新推送一次(capture 会带上压缩状态),或在本机设置 BILLION_CONTEXT_PLUGIN=0 让 DSH 原生压缩兜底。',
1985
+ M('会话缺压缩状态:这些会话在本机可能报上下文超长。在主力机重新推送一次(会带上压缩状态),或设 BILLION_CONTEXT_PLUGIN=0 让原生压缩兜底。',
1986
1986
  'Missing compaction state: billion-context blocks were not synced, so those sessions may hit a context-overflow error here. Push again from the main machine, or set BILLION_CONTEXT_PLUGIN=0 here to fall back to DSH native compaction.'))
1987
1987
  : null,
1988
1988
  h('div', { style: { marginTop: '4px' } }, rows),
@@ -1993,7 +1993,7 @@ window.__ModuleLoader__.load({
1993
1993
  : null,
1994
1994
  notices.byKind && notices.byKind.history
1995
1995
  ? h('div', { style: { ...S.footnote, marginTop: '4px', color: 'var(--dsw-alias-state-warn-primary)' } },
1996
- M('历史提交里的超限文件会让整次推送被远端拒收:换一份新的空仓库(本卡「初始化推送」),或用 git filter-repo 清史。',
1996
+ M('历史里的超限文件会让整次推送被拒收:换一份新仓库(本卡「初始化推送」),或用 git filter-repo 清史。',
1997
1997
  'Oversized files already in history make the whole push get rejected: point at a fresh empty repo (Initialize push here), or rewrite history with git filter-repo.'))
1998
1998
  : null,
1999
1999
  )
@@ -2419,7 +2419,7 @@ window.__ModuleLoader__.load({
2419
2419
  type: 'text',
2420
2420
  style: S.input,
2421
2421
  value: note,
2422
- placeholder: M('可选:这次改了什么(生成推送脚本时写进提交信息,时间会自动附上)', 'Optional: what changed (written into the push commit message; the timestamp is added automatically)'),
2422
+ placeholder: M('可选:这次改了什么(写进提交信息,时间自动附上)', 'Optional: what changed (written into the push commit message; the timestamp is added automatically)'),
2423
2423
  spellCheck: false,
2424
2424
  onChange: (e) => setNote(e.target.value),
2425
2425
  }),
@@ -2430,23 +2430,23 @@ window.__ModuleLoader__.load({
2430
2430
  `还原快照:${data.backup.latest}(${data.backup.count} 份中的最新)`,
2431
2431
  `Restore snapshot: ${data.backup.latest} (newest of ${data.backup.count})`,
2432
2432
  )
2433
- : M('还原快照:还没有任何备份快照(还原将无从下手,需拉取或指定 -FromCommit)', 'Restore snapshot: no backups yet (restore has nothing to fall back to — pull first, or pass -FromCommit)')),
2433
+ : M('还原快照:还没有备份快照(需先拉取,或指定 -FromCommit)', 'Restore snapshot: no backups yet (restore has nothing to fall back to — pull first, or pass -FromCommit)')),
2434
2434
  data && data.repo && !data.repo.exists && !data.repo.empty
2435
2435
  ? h('div', { style: { ...S.footnote, color: 'var(--dsw-alias-state-error-primary)' } },
2436
- M('仓库路径还没配置:先在「本机仓库」卡里设好,否则脚本生成不出来。',
2436
+ M('仓库路径未配置:先在本机仓库卡里设好',
2437
2437
  'Repo path is not set: configure it in the Local repo card, otherwise scripts cannot be generated.'))
2438
2438
  : null,
2439
2439
  data && data.repo && (data.repo.phase === 'empty' || data.repo.phase === 'missing')
2440
2440
  ? h('div', { style: { ...S.footnote, color: 'var(--dsw-alias-state-warn-primary)' } },
2441
2441
  data.repo.mode === 'await-init'
2442
- ? M('本机与云端都还没有内容:现在只生成「推送」(推送时自动初始化仓库并写骨架),拉取没有东西可拉。',
2442
+ ? M('本机与云端都空:只生成「推送」(会初始化仓库),没有东西可拉',
2443
2443
  'Both the local repo and the cloud are empty: only Push can be generated (push initializes the repo and writes the skeleton); there is nothing to pull.')
2444
- : M('本机仓库还没有内容:现在只生成「拉取」(顺带可生成还原)。拉取会把云端仓库整个拉到这个路径,之后推送按钮才会放开。',
2444
+ : M('本机仓库是空的:只生成「拉取」,拉完才能推送',
2445
2445
  'The local repo has no content yet: only Pull (plus Restore) can be generated now. Pull brings the whole cloud repo into this path; push unlocks after that.'))
2446
2446
  : null,
2447
2447
  data && data.remote && !data.remote.configured
2448
2448
  ? h('div', { style: { ...S.footnote, color: 'var(--dsw-alias-state-error-primary)' } },
2449
- M('云端仓库地址未配置:推送 / 拉取不可用(还原照常可生成)。',
2449
+ M('远端地址未配置:只能生成还原',
2450
2450
  'Cloud remote not set: push/pull unavailable (restore still works).'))
2451
2451
  : null,
2452
2452
  data && data.repo && data.repo.ahead > 0
@@ -2515,8 +2515,8 @@ window.__ModuleLoader__.load({
2515
2515
  ] : h('span', null, summary.text),
2516
2516
  ),
2517
2517
  h('div', { style: S.pageLead },
2518
- M('配置在本机、仓库、云端三处流转:改完立即生效;写入与还原的脚本统一在退出客户端后执行。',
2519
- 'Configs flow between this machine, the repo and the cloud. Changes take effect at once; write and restore scripts run after the client quits.')),
2518
+ M('配置在本机、仓库、云端之间流转。改完立即生效;写回与还原在退出客户端后执行。',
2519
+ 'Configs flow between this machine, the repo and the cloud. Edits apply at once; write-back and restore run after the client quits.')),
2520
2520
  ),
2521
2521
  h('div', { style: S.headerActions },
2522
2522
  // 「本机路径」区唯一的入口:平时普通按钮,只有根外路径/被覆盖这两类告警才变橙并带数字
@@ -2526,7 +2526,7 @@ window.__ModuleLoader__.load({
2526
2526
  ? { ...S.btn, color: 'var(--dsw-alias-state-warn-primary)', borderColor: 'var(--dsw-alias-state-warn-primary)' }
2527
2527
  : S.btn,
2528
2528
  title: (!showRoots && lpAlert > 0)
2529
- ? M('本机路径有需要处理的告警(根外路径 / 被覆盖的配置),点开查看', 'Local paths need attention (outside-root paths / overwritten configs) - click to open')
2529
+ ? M('本机路径有告警(根外路径 / 被覆盖的配置)', 'Local paths need attention (outside-root paths / overwritten configs)')
2530
2530
  : M('查看本机路径与占位符的对照', 'Show local paths and their placeholders'),
2531
2531
  onClick: () => setShowRoots((v) => !v),
2532
2532
  },
@@ -2558,17 +2558,17 @@ window.__ModuleLoader__.load({
2558
2558
  conflictCard
2559
2559
  ? Section(M('同步冲突', 'Sync conflicts'), M('这些文件挡住了拉取:逐项选完保存,再点「立即拉取」', 'These files block the pull: pick per file, save, then pull'), [conflictCard])
2560
2560
  : null,
2561
- Section(M('本机路径', 'Local paths'), M('每台机器只确认一次:仓库里的配置用占位符,落地时按这里的路径展开', 'Confirm once per machine: repo configs use placeholders, expanded with these paths'), [rootsCard]),
2562
- Section(M('同步目标', 'Sync targets'), M('仓库与远端都是本机配置,改完立即生效', 'Repo and remote are local settings, applied at once'), [repoCard, remoteCard].filter(Boolean)),
2561
+ Section(M('本机路径', 'Local paths'), M('每台机器确认一次即可:仓库里用占位符,落地时按这里展开', 'Confirm once per machine: the repo stores placeholders, expanded with these paths'), [rootsCard]),
2562
+ Section(M('同步目标', 'Sync targets'), M('仓库与远端都是本机设置,改完即生效', 'Repo and remote are local settings, applied at once'), [repoCard, remoteCard].filter(Boolean)),
2563
2563
  Section(M('自动化与插件更新', 'Automation & plugin update'), M('退出后自动做什么、插件自己怎么升级', 'What runs automatically after exit, and how the plugin upgrades'), [autoCard, updCard].filter(Boolean)),
2564
- Section(M('退出后执行', 'After exit'), M('生成脚本 → 退出客户端后跑一遍;写回、推送、重开窗口都在这一步', 'Generate the script → it runs once the client quits; writing back, pushing and reopening live here'), [actionCard]),
2564
+ Section(M('退出后执行', 'After exit'), M('生成脚本 → 退出客户端后跑一遍', 'Generate the script → it runs after the client quits'), [actionCard]),
2565
2565
  // 「还原备份」跟在动作卡之后:先看怎么生成脚本,再挑具体退回到哪份快照
2566
2566
  Section(M('还原备份', 'Restore backup'), M('点快照 → 确认差异 → 排队还原(退出客户端后执行)', 'Pick a snapshot → confirm the diff → queued restore (runs after the client quits)'), [restoreCard].filter(Boolean)),
2567
2567
  // 「同步内容」放在整页最下面:它是"细项配置",看清前面的状态与动作后才会来调整
2568
2568
  Section(M('同步内容', 'Sync content'), M('十二组内容,默认全勾;必需组锁定', 'Twelve groups, all checked; required groups are locked'), [scopeCard]),
2569
- Section(M('插件数据与额外路径', 'Plugin data & extra paths'), M('新插件自己的配置与数据怎么跟着走:默认自动收,排除名单与单文件上限可改', 'How new plugins\' own config and data travel: collected automatically, with editable exclusions and a size cap'), [extraCard]),
2569
+ Section(M('插件数据与额外路径', 'Plugin data & extra paths'), M('插件自己的配置与数据:默认自动收,可改排除名单与体积上限', 'A plugin\'s own config and data: collected automatically, with editable exclusions and a size cap'), [extraCard]),
2570
2570
  // 反馈放在最后一区:查完状态、调完配置,才轮到「有问题要报」
2571
- Section(M('问题反馈', 'Feedback'), M('提交即建 GitHub Issue(label feedback),跨机器共用同一份;离线先进本机队列', 'Each report becomes a GitHub Issue (label feedback), shared across machines; offline ones queue locally first'), [feedbackCard]),
2571
+ Section(M('问题反馈', 'Feedback'), M('提交即建 GitHub Issue,跨机器共用;离线先排队', 'Each report becomes a GitHub Issue, shared across machines; offline reports queue locally'), [feedbackCard]),
2572
2572
  ),
2573
2573
  )
2574
2574
  }
@@ -2803,7 +2803,7 @@ window.__ModuleLoader__.load({
2803
2803
  it.adopted
2804
2804
  ? h('span', { style: { ...S.chip, color: 'var(--dsw-alias-state-success-primary, #2e7d32)' } }, M('已采纳', 'Accepted'))
2805
2805
  : h('button', { type: 'button', style: S.btn, disabled: busy, onClick: () => adoptAbsolute(it) }, M('采纳', 'Accept')))
2806
- : h('div', { style: S.hint }, M('本机没有等价目录:这条可以不管,或者自己改掉文件里的路径', 'No equivalent folder on this machine: skip it, or edit that path by hand')))
2806
+ : h('div', { style: S.hint }, M('本机没有等价目录:可忽略,或自己改文件里的路径', 'No equivalent folder on this machine: skip it, or edit that path by hand')))
2807
2807
  return h('div', { style: { ...S.panel, gap: '6px' } },
2808
2808
  h('div', { style: { ...S.hint, color: 'var(--dsw-alias-state-warn-primary)' } },
2809
2809
  M(`这份配置是 ${data.absolutePaths.machine || '另一台机器'} 推送的:其中有 ${data.absolutePaths.total} 处绝对路径不属于本机任何已确认根。箭头右边是按本机情况推出来的目录,点「采纳」就记进本机自选目录——下次推送起它们变成占位符,哪台机器拉取都换回自己的路径。`,
@@ -2817,7 +2817,7 @@ window.__ModuleLoader__.load({
2817
2817
  : null,
2818
2818
  dataItems.length
2819
2819
  ? h('div', { style: S.footnote },
2820
- M('这些决定工作区开在哪个目录、历史会话回到哪个目录。拉取时已经按工作区在本机的落点自动对齐;下面列的是仓库里还指着对方机器的那几条,要一起补成自选目录就点「采纳」。',
2820
+ M('决定工作区与历史会话落在哪个目录。已是本机路径的会自动对齐;下面这些还指着对方机器,点「采纳」补成自选目录。',
2821
2821
  'These decide which folder a workspace opens in and which folder a session returns to. The pull already aligns them with this machine\'s workspace locations; listed below are the records still pointing at the other machine - Accept adds them as custom roots too.'))
2822
2822
  : null,
2823
2823
  dataItems.map(rowOf),
@@ -2994,7 +2994,7 @@ window.__ModuleLoader__.load({
2994
2994
  h('div', { style: { ...S.kvVal, display: 'flex', gap: '8px' } },
2995
2995
  h('input', {
2996
2996
  type: 'password', style: S.input, value: token, spellCheck: false, autoComplete: 'off',
2997
- placeholder: M('粘贴 GitHub 令牌(只需一次;留空则自动读本机 git 凭据)', 'Paste a GitHub token (once); leave empty to reuse the local git credential'),
2997
+ placeholder: M('粘贴 GitHub 令牌(一次即可;留空则读本机 git 凭据)', 'Paste a GitHub token (once); leave empty to reuse the local git credential'),
2998
2998
  onChange: (e) => setToken(e.target.value),
2999
2999
  }),
3000
3000
  h('button', { type: 'button', style: S.btnPrimary, disabled: busy || !token.trim(), onClick: saveToken }, M('保存', 'Save')),
@@ -3072,7 +3072,7 @@ window.__ModuleLoader__.load({
3072
3072
  )
3073
3073
  : h('div', { style: S.footnote }, M('还没有反馈记录。', 'No feedback yet.')),
3074
3074
  h('div', { style: S.footnote },
3075
- M('读列表不需要令牌(公开仓库,匿名 60 次/小时);提交和关单要令牌,且只有仓库所有者能关单。没有令牌时提交会打开浏览器里预填好的新建 issue 页面。',
3075
+ M('读列表不用令牌;提交和关单要令牌,且只有仓库所有者能关单。没令牌时提交会打开浏览器里预填好的页面。',
3076
3076
  'Reading needs no token (public repo, 60 anonymous requests/hour); submitting and closing do, and only the repo owner can close. Without a token, submitting opens a prefilled new-issue page in the browser.')),
3077
3077
  )
3078
3078
  }
@@ -3212,7 +3212,7 @@ window.__ModuleLoader__.load({
3212
3212
  } catch { /* 插件路由还没起好就静默跳过,面板里仍会显示同一结果 */ }
3213
3213
  }
3214
3214
 
3215
- // ==================== 0.3.69:会话缓存守卫(客户端半身) ====================
3215
+ // ==================== 0.3.71:会话缓存守卫(客户端半身) ====================
3216
3216
  // 宿主侧没法拦 agent-busy(它是 sessionController 内部抛的 RemoteError),
3217
3217
  // 所以在这里包一层 sessions.create:撞上就上报、清缓存、去掉旧 sessionId 重试一次。
3218
3218
  const BUSY_RE = /session\/agent-busy|is owned by subagent routing/i
@@ -3309,7 +3309,7 @@ window.__ModuleLoader__.load({
3309
3309
  // 界面还没完全起来时 fetch 可能扑空,所以稍等一会儿再查;只查一次,不轮询。
3310
3310
  try { setTimeout(announceLastResult, 1500) } catch { }
3311
3311
 
3312
- // 0.3.69:给客户端的 sessions 服务套上 agent-busy 自愈钩子。
3312
+ // 0.3.71:给客户端的 sessions 服务套上 agent-busy 自愈钩子。
3313
3313
  // 拿不到 sessions(老版本宿主 / 服务还没起来)就静默跳过,面板功能不受影响。
3314
3314
  try {
3315
3315
  if (typeof ctx.get === 'function') {
package/index.js CHANGED
@@ -24,7 +24,7 @@ import { closeSync, existsSync, mkdirSync, mkdtempSync, openSync, readdirSync, r
24
24
  import { homedir, hostname, tmpdir } from 'node:os'
25
25
  import { basename, dirname, isAbsolute, join, relative } from 'node:path'
26
26
  import { fileURLToPath } from 'node:url'
27
- // 0.3.69:会话投影缓存守卫(agent-busy 自动清缓存,让缓存按日志重建)
27
+ // 0.3.71:会话投影缓存守卫(agent-busy 自动清缓存,让缓存按日志重建)
28
28
  import { runGuard, clearSessionCaches, appendGuardLog } from './runtime/tools/session-cache-guard.mjs'
29
29
 
30
30
  const pluginRequire = createRequire(import.meta.url)
@@ -39,7 +39,7 @@ const ROUTE_CONFLICT = '/config-sync/conflict'
39
39
  // 0.3.30:跨机路径确认(每台机器把自己的根目录报给插件一次)与问题反馈(落仓库 feedback\ 再推 GitHub)
40
40
  const ROUTE_ROOTS = '/config-sync/roots'
41
41
  const ROUTE_FEEDBACK = '/config-sync/feedback'
42
- // 0.3.69:会话投影缓存守卫(GET 只读扫描 / POST scan|sweep|clear|busy)
42
+ // 0.3.71:会话投影缓存守卫(GET 只读扫描 / POST scan|sweep|clear|busy)
43
43
  const ROUTE_CACHE_GUARD = '/config-sync/cache-guard'
44
44
  const SETTINGS_NAME = 'dsh-config-sync.json'
45
45
  /** 本插件自己的安装目录(插件根,含 runtime\ 与 index.js)—— 插件备份还原时的目标。 */
@@ -237,7 +237,7 @@ function readSettings(dshHome) {
237
237
  // 同步完成重启前把 DSH 的「默认工作区」校正到谁:
238
238
  // 留空 = 自动找名字/路径是 default-workspace 的工作区;可填工作区路径或 ID;填 off 关闭。
239
239
  defaultWorkspace: typeof raw.defaultWorkspace === 'string' ? raw.defaultWorkspace : '',
240
- // 0.3.69:会话投影缓存守卫,默认开。关掉后既不定时扫描,也不理会客户端的 agent-busy 上报。
240
+ // 0.3.71:会话投影缓存守卫,默认开。关掉后既不定时扫描,也不理会客户端的 agent-busy 上报。
241
241
  cacheGuard: raw.cacheGuard !== false,
242
242
  }
243
243
  }
@@ -1180,7 +1180,7 @@ async function inspect(config) {
1180
1180
  const pending = c.items.filter((it) => !it.choice).length
1181
1181
  return { exists: true, total: c.items.length, pending, at: c.at || '', backupDir: c.backupDir || '' }
1182
1182
  })(),
1183
- // 0.3.69:会话投影缓存守卫状态(面板「会话缓存守卫」卡用)
1183
+ // 0.3.71:会话投影缓存守卫状态(面板「会话缓存守卫」卡用)
1184
1184
  cacheGuard: cacheGuardSnapshot(config),
1185
1185
  }
1186
1186
  }
@@ -1962,7 +1962,7 @@ async function handleSettings(req, res, config) {
1962
1962
  const autoPull = has('autoPull') ? body.autoPull === true : before.autoPull
1963
1963
  const autoPush = has('autoPush') ? body.autoPush === true : before.autoPush
1964
1964
  const autoRestart = has('autoRestart') ? body.autoRestart !== false : before.autoRestart
1965
- // 0.3.69:会话投影缓存守卫开关,字段没给就沿用原值
1965
+ // 0.3.71:会话投影缓存守卫开关,字段没给就沿用原值
1966
1966
  const cacheGuard = has('cacheGuard') ? body.cacheGuard !== false : before.cacheGuard
1967
1967
 
1968
1968
  if (!has('repoPath') && !has('remoteUrl') && !has('sshKey') &&
@@ -4022,7 +4022,7 @@ function newIssueUrl(repo, title, text, config) {
4022
4022
  return `https://github.com/${repo}/issues/new?${q}`
4023
4023
  }
4024
4024
 
4025
- // ============================ 0.3.69:会话投影缓存守卫 ============================
4025
+ // ============================ 0.3.71:会话投影缓存守卫 ============================
4026
4026
  // 背景:UI 点「新建会话」时会挑一条 summary.blank===true 的会话复用,挑中了 origin=subagent
4027
4027
  // 的子会话就会被宿主拒绝(session/agent-busy:is owned by subagent routing)。
4028
4028
  // 起因是投影缓存停在 session/created 那一刻(blank=true、seq=-1),而会话日志早就推进过,
@@ -4430,7 +4430,7 @@ export function apply(ctx, config) {
4430
4430
  path: ROUTE_FEEDBACK,
4431
4431
  handler: withLang(handleFeedback),
4432
4432
  }))
4433
- // 0.3.69:会话投影缓存守卫(GET 只读扫描 / POST scan|sweep|clear|busy)
4433
+ // 0.3.71:会话投影缓存守卫(GET 只读扫描 / POST scan|sweep|clear|busy)
4434
4434
  scoped.effect(() => scoped.webServer.register({
4435
4435
  kind: 'exact',
4436
4436
  path: ROUTE_CACHE_GUARD,
@@ -4443,7 +4443,7 @@ export function apply(ctx, config) {
4443
4443
  // status 不用再为首屏那 2.5 秒的 ls-remote 埋单。
4444
4444
  typeof setTimeout === 'function' ? setTimeout(() => { try { warmRemoteProbe(config) } catch { } }, 300) : null
4445
4445
  installQuitWhenAllWindowsClosed(ctx)
4446
- // 0.3.69:会话投影缓存守卫的定时扫描(默认开,设置里可关)
4446
+ // 0.3.71:会话投影缓存守卫的定时扫描(默认开,设置里可关)
4447
4447
  scheduleCacheGuard(config)
4448
4448
  } catch (error) {
4449
4449
  // 不抛:缺 webServer 的 profile 里这个插件静默不激活即可
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-config-sync-plugin",
3
- "version": "0.3.69",
3
+ "version": "0.3.71",
4
4
  "type": "module",
5
5
  "description": "在 DSH 设置里查看 dsh-config 仓库与本机的同步状态,并生成退出后执行的 push/pull 脚本。同步动作本身不在应用内执行。面板与文案跟随客户端语言(中文/English)。",
6
6
  "main": "./index.js",