dsh-config-sync-plugin 0.3.67 → 0.3.69

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 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.67"` 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>` |
22
+ | npm | `npm i dsh-config-sync-plugin` | Use it as a dependency, or add `"dsh-config-sync-plugin": "^0.3.69"` 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
 
@@ -606,6 +606,71 @@ A clean isolated B machine (approot / dshome / wshome + bundled node runner) sim
606
606
 
607
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
608
 
609
+ ### 2026-11-19: release 0.3.69 (carry billion-context compaction state across machines + two new notice kinds)
610
+
611
+ **Problem**: a long session keeps working on machine A, but after pulling to machine B the very next message fails with a context-overflow error.
612
+
613
+ Compaction happens on two layers. On A, DSH's own compaction is already **disabled** by billion-context (`billion-context/dist/agent/dsh-compaction-gate.js` flips `@deepseek-ai/dsh-compaction-basic` and `@deepseek-ai/dsh-command-compact` to `disabled:true` while `__BILI_DSH_COMPACTION_VERDICT__ === "active"`); the real compaction is done by bili **on the outgoing side** — it shrinks a 2.3 M surface down to ~160 K before the request reaches the provider. And bili's records do not live in `.dsh`: they are in a separate SQLite database, `%LOCALAPPDATA%\billion-context\sessions\index.db` (tables `sessions` / `blocks` / `content` / `refs` / `messages` / `checkpoints` …).
614
+
615
+ A pull only restores `sessions` / `attachments` / `vision_router_session_policy`, so **bili's index.db never travels**. Machine B therefore has: (1) no DSH native compaction (bili disabled it), (2) no bili compaction records (bili treats the session as new — `max compressible` is below the threshold, so it does not compact), (3) the whole surface sent straight to the provider → `CONTEXT_WINDOW_EXCEEDED`.
616
+
617
+ **Fix**: new `tools/bili-state.mjs` that moves compaction state per session.
618
+
619
+ | Subcommand | What it does |
620
+ |---|---|
621
+ | `probe` | Print the local bili database overview (tables, row counts, `user_version`) |
622
+ | `export <sessionId> <outFile>` | Dump one session's state (`sessions` row + active `blocks` rows + the summary `content` those blocks reference) |
623
+ | `import <inFile> [--dry-run]` | Write it back; existing primary keys are skipped, so it is repeatable |
624
+ | `sync <specJson> <outJson>` | Batch mode used by `capture.ps1` / `apply.ps1` (results go to a file, never stdout) |
625
+
626
+ Size control is a hard requirement — the default export deliberately leaves out three things:
627
+
628
+ - `sessions.metadata_json` (a 2.4 MB scale cache; the column is also `NOT NULL`, so export must `delete row.metadata_json` and let it fall back to DEFAULT, otherwise `NOT NULL constraint failed`)
629
+ - the snapshot behind `checkpoints.state_hash` (a single row can reach 21.89 MB)
630
+ - `messages` / `message_media` bodies (bili re-ingests them from the DSH session log)
631
+
632
+ Net result: about **5 MB per long session** (34–35 active blocks, ~7000 refs, 34 summaries), stored at `conversations/billion_context/<sessionId>.json`. `--all-blocks` / `--full` are needed only for the full block set and checkpoint snapshots.
633
+
634
+ Wiring: `capture.ps1` calls `-Mode 'export'` for the session ids it just touched; `apply.ps1` calls `-Mode 'import'` against `conversations/billion_context` after restoring sessions. When billion-context is **not installed** on the target machine the whole step is skipped silently and prints “本机没有 billion-context,压缩状态跳过(DSH 自带压缩会接管)” — nothing is written.
635
+
636
+ **Two new notice kinds** (this release also answers “nobody told me a plugin is missing on B”):
637
+
638
+ | kind | When it appears | What the panel says |
639
+ |---|---|---|
640
+ | `plugin-missing` | A `dependencies` plugin is not installed locally, a bundle cannot be resolved, or the repo has no archive for a link plugin | “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.” |
641
+ | `context-state` | bili compaction state was not synced, import failed, or billion-context is absent | “Missing compaction state: 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.” |
642
+
643
+ Notices land in `~/.dsh/sync-notices.json`, stay on the panel until the next sync clears them, and the exit summary in `post-exit.ps1` prints them grouped by kind. The headline now reflects the actual category — pure file items say “N item(s) unresolved”, plugin / compaction-state items say “N item(s) need attention”, so plugin problems are no longer described as “files not synced”.
644
+
645
+ **Manual fallback**: `node tools/bili-state.mjs probe` to inspect the local database; `node tools/bili-state.mjs export <sessionId> <out.json>` to export one session; `import --dry-run` to preview a write.
646
+
647
+ ### 2026-11-19: release 0.3.68 (session projection-cache guard, fixes agent-busy session creation)
648
+
649
+ **Problem**: DSH's "new session" does not always create one. The client first looks for a **blank session** in the workspace to reuse (`client-ui-workspace/createInWorkspace()` → `sessions.ids.find(summary.blank && …)` → `createNamed({ sessionId: blank })`), and `summary.blank` comes from `record.rows.sessionListMetadata.val.blank` in the projection cache `session_projcache\sessions\<id>.json`.
650
+
651
+ That cache can be a half-written artifact: a session creation once wrote `blank:true / seq:-1`, the log afterwards kept appending (`turn/start`, `user/message`), but the cache never advanced. The list therefore still treats the session as blank, the UI picks it for reuse, and the host throws:
652
+
653
+ ```
654
+ session/agent-busy: session "<id>" is owned by subagent routing
655
+ ```
656
+
657
+ Session creation fails outright and refreshing does not help (the same cache keeps being reused). Cross-machine sync amplifies it: machine A's stale cache is pulled into machine B, which then hits the same wall.
658
+
659
+ **Fix**: three layers, none of which touch the log or the workspace registry — pure cache-file operations.
660
+
661
+ | Layer | Trigger | Action |
662
+ |---|---|---|
663
+ | Client | `sessions.create` hits `agent-busy` | Wraps `sessions.create`: extracts the colliding `sessionId`, reports it to the host, drops the stale `sessionId` and **retries once**. Zero overhead on the normal path |
664
+ | Host | Receives the client report | **Moves** `<DshHome>/storages/session_projcache/sessions/<id>.json` to `<DshHome>/logs/session-cache-guard-backup/` (move only, never delete) so DSH rebuilds the cache from the full log and `blank` becomes `false` |
665
+ | Timer | Every 3 minutes | Proactively sweeps the same class of stale cache. All four conditions must hold (miss rather than mis-delete): (1) cache parses and `blank===true`; (2) a matching `session.v*.jsonl.zstd` exists; (3) the log really has `turn/start` or `user/message`; (4) the log's last event `seq` > the cache's max recorded `seq` |
666
+
667
+ New route `/config-sync/cache-guard`: `GET` is a read-only scan; `POST` accepts `scan` / `sweep` / `clear` / `busy`. A `cacheGuard` switch was added to settings, **on by default**; when off, neither the timer nor the client `agent-busy` report does anything.
668
+
669
+ Implementation: `runtime/tools/session-cache-guard.mjs` (`scanSessionCaches` / `clearSessionCaches` / `runGuard` / `indexSessionLogs`); the client half lives in the `0.3.69:会话缓存守卫` block of `client.js`.
670
+
671
+ **Manual fallback**: the "Session cache guard" card in the panel scans on demand, shows each candidate with its evidence, and lets you pick what to clear. Cache files are only ever backed up, never deleted — a wrong clear is reversible from `<DshHome>/logs/session-cache-guard-backup/`.
672
+
673
+
609
674
  ### 2026-11-19: release 0.3.67 (seq reconciliation guard for session logs)
610
675
 
611
676
  **Problem**: when two machines each append to the same session, sync used a whole-file copy. Whichever side pushed last overwrote the other side's tail, the event stream developed a `seq` jump, and DSH refused to open the session: `stored session ... is corrupt: corrupt session log: invalid committed event at line N: released v2 row N has seq gap (expected X, got Y)`.
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.67"` 后 `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.69"` 后 `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
 
@@ -582,6 +582,71 @@ pwsh -File sync.ps1 push -ScanHistory
582
582
 
583
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
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 | 什么时候出现 | 面板怎么说 |
615
+ |---|---|---|
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
+
585
650
  ### 2026-11-19:发版 0.3.67(会话日志 seq 对账护栏)
586
651
 
587
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)`,该会话再也打不开。
package/client.js CHANGED
@@ -1926,6 +1926,8 @@ window.__ModuleLoader__.load({
1926
1926
  function noticesBlock(notices) {
1927
1927
  if (!notices || !notices.total) return null
1928
1928
  const kindLabel = (k) => ({
1929
+ 'plugin-missing': M('插件没装', 'Plugin missing'),
1930
+ 'context-state': M('缺压缩状态', 'No compaction state'),
1929
1931
  'too-large': M('超过单文件上限', 'Over size cap'),
1930
1932
  history: M('历史里的超限文件', 'Oversized in history'),
1931
1933
  failed: M('失败', 'Failed'),
@@ -1944,7 +1946,9 @@ window.__ModuleLoader__.load({
1944
1946
  if (notices.byKind['too-large']) parts.push(M(`${notices.byKind['too-large']} 个超过单文件上限`, `${notices.byKind['too-large']} over the size cap`))
1945
1947
  if (notices.byKind.history) parts.push(M(`${notices.byKind.history} 个在历史提交里`, `${notices.byKind.history} already in history`))
1946
1948
  if (notices.byKind.failed) parts.push(M(`${notices.byKind.failed} 个失败`, `${notices.byKind.failed} failed`))
1947
- if (notices.byKind.skipped) parts.push(M(`${notices.byKind.skipped} 个被跳过`, `${notices.byKind.skipped} skipped`))
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
+ if (notices.byKind['context-state']) parts.push(M(`${notices.byKind['context-state']} 个会话缺压缩状态`, `${notices.byKind['context-state']} session(s) without compaction state`))
1948
1952
  }
1949
1953
  return h('div', {
1950
1954
  style: {
@@ -1953,11 +1957,34 @@ window.__ModuleLoader__.load({
1953
1957
  background: 'color-mix(in srgb, var(--dsw-alias-state-warn-primary) 8%, transparent)',
1954
1958
  },
1955
1959
  },
1956
- h('div', { style: { fontSize: '12px', fontWeight: 600, color: 'var(--dsw-alias-state-warn-primary)' } },
1957
- M(`上次同步有 ${notices.total} 个文件没同步${parts.length ? `(${parts.join('、')})` : ''}`, `Last sync left ${notices.total} file(s) unsynced${parts.length ? ` (${parts.join(', ')})` : ''}`)),
1960
+ // 标题按「实际是哪类问题」说人话:插件没装/缺压缩状态不是「文件没同步」,
1961
+ // 混在一起会让人以为磁盘上少了东西。
1962
+ (() => {
1963
+ const fileish = (notices.byKind && (notices.byKind['too-large'] || notices.byKind.history || notices.byKind.failed || notices.byKind.skipped)) || 0
1964
+ const pluginN = (notices.byKind && notices.byKind['plugin-missing']) || 0
1965
+ const stateN = (notices.byKind && notices.byKind['context-state']) || 0
1966
+ const headline = fileish
1967
+ ? M(`上次同步有 ${notices.total} 项没处理完${parts.length ? `(${parts.join('、')})` : ''}`,
1968
+ `Last sync left ${notices.total} item(s) unresolved${parts.length ? ` (${parts.join(', ')})` : ''}`)
1969
+ : (pluginN || stateN)
1970
+ ? M(`上次同步后有 ${notices.total} 项需要处理${parts.length ? `(${parts.join('、')})` : ''}`,
1971
+ `After the last sync ${notices.total} item(s) need attention${parts.length ? ` (${parts.join(', ')})` : ''}`)
1972
+ : M(`上次同步有 ${notices.total} 项没处理完`, `Last sync left ${notices.total} item(s) unresolved`)
1973
+ return h('div', { style: { fontSize: '12px', fontWeight: 600, color: 'var(--dsw-alias-state-warn-primary)' } }, headline)
1974
+ })(),
1958
1975
  h('div', { style: { ...S.footnote, marginTop: '3px' } },
1959
- M('这些文件仍在本机磁盘上,只是没进仓库;下次同步会自动复查。',
1960
- 'They are still on this machine, just not in the repo; the next sync re-checks them.')),
1976
+ M('文件类的仍在本机磁盘上,只是没进仓库;下次同步会自动复查。插件类要先在本机装好,再拉一次。',
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
+ (notices.byKind && notices.byKind['plugin-missing'])
1979
+ ? h('div', { style: { ...S.footnote, marginTop: '3px', color: 'var(--dsw-alias-state-warn-primary)' } },
1980
+ M('插件没装:拉取只还原配置,不替你装依赖。先在本机 profile 目录执行 pnpm install(或去掉 -SkipInstall 重跑 apply.ps1),装好后重新拉取一次。',
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
+ : null,
1983
+ (notices.byKind && notices.byKind['context-state'])
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 原生压缩兜底。',
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
+ : null,
1961
1988
  h('div', { style: { marginTop: '4px' } }, rows),
1962
1989
  notices.truncated
1963
1990
  ? h('div', { style: { ...S.footnote, marginTop: '3px' } },
@@ -3185,6 +3212,67 @@ window.__ModuleLoader__.load({
3185
3212
  } catch { /* 插件路由还没起好就静默跳过,面板里仍会显示同一结果 */ }
3186
3213
  }
3187
3214
 
3215
+ // ==================== 0.3.69:会话缓存守卫(客户端半身) ====================
3216
+ // 宿主侧没法拦 agent-busy(它是 sessionController 内部抛的 RemoteError),
3217
+ // 所以在这里包一层 sessions.create:撞上就上报、清缓存、去掉旧 sessionId 重试一次。
3218
+ const BUSY_RE = /session\/agent-busy|is owned by subagent routing/i
3219
+
3220
+ /** 从错误里抠出撞车的 sessionId;不是 agent-busy 就返回空串。 */
3221
+ function busySessionId(error) {
3222
+ const text = String((error && (error.message || error)) || '')
3223
+ if (!BUSY_RE.test(text)) return ''
3224
+ const quoted = text.match(/session\s+"([^"]+)"/i) || text.match(/session\s+'([^']+)'/i)
3225
+ return quoted ? String(quoted[1] || '') : ''
3226
+ }
3227
+
3228
+ /** 告诉宿主半身「这条会话撞了 agent-busy」,让它清缓存。失败也不影响新建会话。 */
3229
+ async function reportAgentBusy(sessionId) {
3230
+ try {
3231
+ const res = await fetch('/config-sync/cache-guard', {
3232
+ method: 'POST',
3233
+ cache: 'no-store',
3234
+ credentials: 'same-origin',
3235
+ headers: jsonHeaders,
3236
+ body: JSON.stringify({ action: 'busy', sessionId: sessionId || '' }),
3237
+ })
3238
+ if (!res.ok) return false
3239
+ const body = await res.json()
3240
+ return Boolean(body && body.ok)
3241
+ } catch { return false }
3242
+ }
3243
+
3244
+ /**
3245
+ * 包一层 sessions.create:
3246
+ * 正常路径零开销;只有抛 agent-busy 时才清缓存、把可复用的旧 sessionId 去掉重试一次。
3247
+ * 返回还原函数,插件卸载时把 create 换回去(宿主热重载不残留)。
3248
+ */
3249
+ function guardSessionCreate(sessions) {
3250
+ if (!sessions || typeof sessions.create !== 'function') return () => { }
3251
+ const original = sessions.create
3252
+ let installed = true
3253
+ sessions.create = async function patchedCreate(opts) {
3254
+ try {
3255
+ return await original.call(this, opts)
3256
+ } catch (error) {
3257
+ const sessionId = busySessionId(error)
3258
+ if (sessionId === '') throw error
3259
+ try { console.warn('[dsh-config-sync] new session hit agent-busy:', sessionId, '→ 清投影缓存后重试') } catch { }
3260
+ const reported = await reportAgentBusy(sessionId)
3261
+ // 只有宿主确实动了缓存才重试,否则原错误照抛,免得反复撞同一堵墙。
3262
+ if (!reported) throw error
3263
+ const retry = { ...(opts || {}) }
3264
+ delete retry.sessionId
3265
+ return await original.call(this, retry)
3266
+ }
3267
+ }
3268
+ return () => {
3269
+ try {
3270
+ if (installed) sessions.create = original
3271
+ } catch { }
3272
+ installed = false
3273
+ }
3274
+ }
3275
+
3188
3276
  function apply(ctx) {
3189
3277
  // 侧栏行 + 配对面板:两个 slot 必须各自 inject(嵌套),再在作用域里成对 register。
3190
3278
  // 只 inject('main') 就向 sidebar.panellist 注册是无效的——区域还没被注入,注册落不下去。
@@ -3220,6 +3308,25 @@ window.__ModuleLoader__.load({
3220
3308
 
3221
3309
  // 界面还没完全起来时 fetch 可能扑空,所以稍等一会儿再查;只查一次,不轮询。
3222
3310
  try { setTimeout(announceLastResult, 1500) } catch { }
3311
+
3312
+ // 0.3.69:给客户端的 sessions 服务套上 agent-busy 自愈钩子。
3313
+ // 拿不到 sessions(老版本宿主 / 服务还没起来)就静默跳过,面板功能不受影响。
3314
+ try {
3315
+ if (typeof ctx.get === 'function') {
3316
+ const sessions = ctx.get('sessions')
3317
+ if (sessions) {
3318
+ const off = guardSessionCreate(sessions)
3319
+ if (typeof ctx.effect === 'function') ctx.effect(() => () => { try { off() } catch { } })
3320
+ }
3321
+ } else if (typeof ctx.inject === 'function') {
3322
+ ctx.inject(['sessions'], (scoped) => {
3323
+ const off = guardSessionCreate(scoped.sessions || scoped.get('sessions'))
3324
+ return () => { try { off() } catch { } }
3325
+ })
3326
+ }
3327
+ } catch (error) {
3328
+ try { console.warn('[dsh-config-sync] session cache guard install failed:', error) } catch { }
3329
+ }
3223
3330
  }
3224
3331
 
3225
3332
  exports.name = name
package/index.js CHANGED
@@ -24,6 +24,8 @@ 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 自动清缓存,让缓存按日志重建)
28
+ import { runGuard, clearSessionCaches, appendGuardLog } from './runtime/tools/session-cache-guard.mjs'
27
29
 
28
30
  const pluginRequire = createRequire(import.meta.url)
29
31
 
@@ -37,6 +39,8 @@ const ROUTE_CONFLICT = '/config-sync/conflict'
37
39
  // 0.3.30:跨机路径确认(每台机器把自己的根目录报给插件一次)与问题反馈(落仓库 feedback\ 再推 GitHub)
38
40
  const ROUTE_ROOTS = '/config-sync/roots'
39
41
  const ROUTE_FEEDBACK = '/config-sync/feedback'
42
+ // 0.3.69:会话投影缓存守卫(GET 只读扫描 / POST scan|sweep|clear|busy)
43
+ const ROUTE_CACHE_GUARD = '/config-sync/cache-guard'
40
44
  const SETTINGS_NAME = 'dsh-config-sync.json'
41
45
  /** 本插件自己的安装目录(插件根,含 runtime\ 与 index.js)—— 插件备份还原时的目标。 */
42
46
  const PLUGIN_ROOT = fileURLToPath(new URL('.', import.meta.url)).replace(/[\\/]+$/, '')
@@ -233,6 +237,8 @@ function readSettings(dshHome) {
233
237
  // 同步完成重启前把 DSH 的「默认工作区」校正到谁:
234
238
  // 留空 = 自动找名字/路径是 default-workspace 的工作区;可填工作区路径或 ID;填 off 关闭。
235
239
  defaultWorkspace: typeof raw.defaultWorkspace === 'string' ? raw.defaultWorkspace : '',
240
+ // 0.3.69:会话投影缓存守卫,默认开。关掉后既不定时扫描,也不理会客户端的 agent-busy 上报。
241
+ cacheGuard: raw.cacheGuard !== false,
236
242
  }
237
243
  }
238
244
 
@@ -254,6 +260,7 @@ function writeSettings(dshHome, s) {
254
260
  updateToken: s.updateToken || '',
255
261
  backupRoot: s.backupRoot || '',
256
262
  defaultWorkspace: s.defaultWorkspace || '',
263
+ cacheGuard: s.cacheGuard !== false,
257
264
  }, null, 2) + '\n'
258
265
  writeFileSync(settingsPath(dshHome), payload, 'utf8')
259
266
  }
@@ -1173,6 +1180,8 @@ async function inspect(config) {
1173
1180
  const pending = c.items.filter((it) => !it.choice).length
1174
1181
  return { exists: true, total: c.items.length, pending, at: c.at || '', backupDir: c.backupDir || '' }
1175
1182
  })(),
1183
+ // 0.3.69:会话投影缓存守卫状态(面板「会话缓存守卫」卡用)
1184
+ cacheGuard: cacheGuardSnapshot(config),
1176
1185
  }
1177
1186
  }
1178
1187
 
@@ -1490,7 +1499,7 @@ function readAutoResult(dshHome) {
1490
1499
  * 就回落到 ~/.dsh/sync-notices.json。两种情况都做裁剪,避免一个几万文件的仓库把 /status 撑爆。
1491
1500
  */
1492
1501
  function readNoticeList(dshHome, fromResult) {
1493
- const KINDS = ['history', 'too-large', 'failed', 'skipped']
1502
+ const KINDS = ['plugin-missing', 'context-state', 'history', 'too-large', 'failed', 'skipped']
1494
1503
  let raw = fromResult
1495
1504
  if (!raw || !Array.isArray(raw.items)) {
1496
1505
  try {
@@ -1953,20 +1962,22 @@ async function handleSettings(req, res, config) {
1953
1962
  const autoPull = has('autoPull') ? body.autoPull === true : before.autoPull
1954
1963
  const autoPush = has('autoPush') ? body.autoPush === true : before.autoPush
1955
1964
  const autoRestart = has('autoRestart') ? body.autoRestart !== false : before.autoRestart
1965
+ // 0.3.69:会话投影缓存守卫开关,字段没给就沿用原值
1966
+ const cacheGuard = has('cacheGuard') ? body.cacheGuard !== false : before.cacheGuard
1956
1967
 
1957
1968
  if (!has('repoPath') && !has('remoteUrl') && !has('sshKey') &&
1958
1969
  !has('autoPull') && !has('autoPush') && !has('autoRestart') &&
1959
- !has('backupRoot') && !has('defaultWorkspace') &&
1970
+ !has('backupRoot') && !has('defaultWorkspace') && !has('cacheGuard') &&
1960
1971
  !has('updateToken') && !has('updateManifestUrl') && body.clearUpdateToken !== true && body.clearUpdateManifestUrl !== true && body.clearBackupRoot !== true && body.clearDefaultWorkspace !== true) {
1961
1972
  throw new Error(t(
1962
- '没有要保存的字段(repoPath / remoteUrl / sshKey / autoPull / autoPush / autoRestart / backupRoot / defaultWorkspace / updateToken / updateManifestUrl 至少给一个)',
1963
- 'Nothing to save (provide at least one of repoPath / remoteUrl / sshKey / autoPull / autoPush / autoRestart / backupRoot / defaultWorkspace / updateToken / updateManifestUrl)',
1973
+ '没有要保存的字段(repoPath / remoteUrl / sshKey / autoPull / autoPush / autoRestart / backupRoot / defaultWorkspace / cacheGuard / updateToken / updateManifestUrl 至少给一个)',
1974
+ 'Nothing to save (provide at least one of repoPath / remoteUrl / sshKey / autoPull / autoPush / autoRestart / backupRoot / defaultWorkspace / cacheGuard / updateToken / updateManifestUrl)',
1964
1975
  ))
1965
1976
  }
1966
1977
 
1967
1978
  // 新仓库路径一落盘,后面的 git remote 要对它做,别用改之前解析出来的旧仓库。
1968
1979
  const repo = repoPath || (resolveRepo(config?.repoPath, dshHome).repo || '')
1969
- writeSettings(dshHome, { repoPath, remoteUrl, sshKey, autoPull, autoPush, autoRestart, updateToken, updateManifestUrl, backupRoot, defaultWorkspace })
1980
+ writeSettings(dshHome, { repoPath, remoteUrl, sshKey, autoPull, autoPush, autoRestart, updateToken, updateManifestUrl, backupRoot, defaultWorkspace, cacheGuard })
1970
1981
 
1971
1982
  const changed = {
1972
1983
  repoPath: before.repoPath !== repoPath,
@@ -1976,6 +1987,7 @@ async function handleSettings(req, res, config) {
1976
1987
  autoPush: before.autoPush !== autoPush,
1977
1988
  backupRoot: before.backupRoot !== backupRoot,
1978
1989
  defaultWorkspace: before.defaultWorkspace !== defaultWorkspace,
1990
+ cacheGuard: before.cacheGuard !== cacheGuard,
1979
1991
  }
1980
1992
  let gitSet = null
1981
1993
  if (repo && isDir(join(repo, '.git')) && remoteUrl) {
@@ -4010,6 +4022,192 @@ function newIssueUrl(repo, title, text, config) {
4010
4022
  return `https://github.com/${repo}/issues/new?${q}`
4011
4023
  }
4012
4024
 
4025
+ // ============================ 0.3.69:会话投影缓存守卫 ============================
4026
+ // 背景:UI 点「新建会话」时会挑一条 summary.blank===true 的会话复用,挑中了 origin=subagent
4027
+ // 的子会话就会被宿主拒绝(session/agent-busy:is owned by subagent routing)。
4028
+ // 起因是投影缓存停在 session/created 那一刻(blank=true、seq=-1),而会话日志早就推进过,
4029
+ // 两边不一致。这里的处理:发现这种「缓存说空、日志有货」的陈旧缓存就把它挪走,让宿主按日志重建。
4030
+ let loggerRef = null
4031
+ function ctxLoggerInfo(text) {
4032
+ try { loggerRef?.info?.(text) } catch { /* 没有 logger 就算了 */ }
4033
+ }
4034
+
4035
+ const cacheGuardState = {
4036
+ timer: null,
4037
+ interval: null,
4038
+ scans: 0,
4039
+ lastScanAt: 0,
4040
+ lastApplyAt: 0,
4041
+ lastStale: 0,
4042
+ lastRemoved: [],
4043
+ lastError: '',
4044
+ lastTrigger: '',
4045
+ busyHits: [],
4046
+ }
4047
+
4048
+ function dshHomeOf(config) {
4049
+ return config?.dshHome || process.env.DSH_HOME || join(homedir(), '.dsh')
4050
+ }
4051
+
4052
+ /** 跑一次扫描。apply=false 只报告不动手;apply=true 会把陈旧缓存挪到备份目录。 */
4053
+ function cacheGuardRun(config, opts = {}) {
4054
+ const apply = opts.apply === true
4055
+ const dshHome = dshHomeOf(config)
4056
+ try {
4057
+ const report = runGuard(dshHome, {
4058
+ apply,
4059
+ source: opts.source || '',
4060
+ ids: Array.isArray(opts.ids) && opts.ids.length > 0 ? opts.ids : undefined,
4061
+ deep: true,
4062
+ })
4063
+ cacheGuardState.scans += 1
4064
+ cacheGuardState.lastScanAt = Date.now()
4065
+ cacheGuardState.lastTrigger = opts.source || ''
4066
+ cacheGuardState.lastStale = report.staleCount || 0
4067
+ cacheGuardState.lastError = (report.errors || []).join('; ')
4068
+ if (apply) {
4069
+ cacheGuardState.lastApplyAt = Date.now()
4070
+ cacheGuardState.lastRemoved = (report.removed || []).map((x) => ({ id: x.id, to: x.to }))
4071
+ if (cacheGuardState.lastRemoved.length > 0) {
4072
+ ctxLoggerInfo(`[dsh-config-sync-plugin] 已清理 ${cacheGuardState.lastRemoved.length} 条陈旧会话投影缓存:${cacheGuardState.lastRemoved.map((x) => x.id).join(', ')}`)
4073
+ }
4074
+ }
4075
+ return report
4076
+ } catch (error) {
4077
+ const message = String((error && error.message) || error)
4078
+ cacheGuardState.scans += 1
4079
+ cacheGuardState.lastScanAt = Date.now()
4080
+ cacheGuardState.lastTrigger = opts.source || ''
4081
+ cacheGuardState.lastError = message
4082
+ return { ok: false, scanned: 0, blank: 0, staleCount: 0, stale: [], removed: [], errors: [message] }
4083
+ }
4084
+ }
4085
+
4086
+ /** 客户端报某条会话撞了 agent-busy:先把它的缓存定点点掉,再全盘扫一遍同类陈旧项。 */
4087
+ function cacheGuardOnBusy(config, sessionId) {
4088
+ const dshHome = dshHomeOf(config)
4089
+ const id = String(sessionId || '').trim()
4090
+ const out = { ok: true, sessionId: id, cleared: false, report: null }
4091
+ if (id) {
4092
+ try {
4093
+ const res = clearSessionCaches(dshHome, [id], { reason: 'agent-busy' })
4094
+ out.cleared = Array.isArray(res.removed) && res.removed.length > 0
4095
+ if (out.cleared) {
4096
+ appendGuardLog(dshHome, `[agent-busy] 客户端报 session/agent-busy,已清掉 ${id} 的投影缓存`)
4097
+ ctxLoggerInfo(`[dsh-config-sync-plugin] agent-busy:已清掉 ${id} 的投影缓存,下次新建会话会按日志重建`)
4098
+ }
4099
+ } catch (error) {
4100
+ out.ok = false
4101
+ out.error = String((error && error.message) || error)
4102
+ }
4103
+ }
4104
+ out.report = cacheGuardRun(config, { apply: true, source: 'agent-busy' })
4105
+ cacheGuardState.busyHits.unshift({ at: Date.now(), sessionId: id, cleared: out.cleared })
4106
+ if (cacheGuardState.busyHits.length > 20) cacheGuardState.busyHits.length = 20
4107
+ return out
4108
+ }
4109
+
4110
+ /** 启动后 12 秒首扫一次,之后每 3 分钟一次;设置里关掉就完全不启动。 */
4111
+ function scheduleCacheGuard(config) {
4112
+ try {
4113
+ if (cacheGuardState.timer) return
4114
+ if (readSettings(dshHomeOf(config)).cacheGuard === false) return
4115
+ const run = () => {
4116
+ try { cacheGuardRun(config, { apply: true, source: 'timer' }) } catch { /* 定时任务不抛 */ }
4117
+ }
4118
+ cacheGuardState.timer = setTimeout(run, 12 * 1000)
4119
+ try { cacheGuardState.timer.unref?.() } catch { }
4120
+ cacheGuardState.interval = setInterval(run, 3 * 60 * 1000)
4121
+ try { cacheGuardState.interval.unref?.() } catch { }
4122
+ } catch { /* 定时器起不来不影响插件其它功能 */ }
4123
+ }
4124
+
4125
+ function cacheGuardSnapshot(config) {
4126
+ const dshHome = dshHomeOf(config)
4127
+ const settings = readSettings(dshHome)
4128
+ return {
4129
+ enabled: settings.cacheGuard !== false,
4130
+ scans: cacheGuardState.scans,
4131
+ lastScanAt: cacheGuardState.lastScanAt,
4132
+ lastApplyAt: cacheGuardState.lastApplyAt,
4133
+ lastStale: cacheGuardState.lastStale,
4134
+ lastRemoved: cacheGuardState.lastRemoved,
4135
+ lastError: cacheGuardState.lastError,
4136
+ lastTrigger: cacheGuardState.lastTrigger,
4137
+ busyHits: cacheGuardState.busyHits.slice(0, 5),
4138
+ backupDir: join(dshHome, 'logs', 'session-cache-guard-backup'),
4139
+ logPath: join(dshHome, 'logs', 'session-cache-guard.log'),
4140
+ }
4141
+ }
4142
+
4143
+ async function handleCacheGuard(req, res, config) {
4144
+ if (req.method === 'GET') {
4145
+ const report = cacheGuardRun(config, { apply: false, source: 'panel' })
4146
+ sendJson(res, 200, {
4147
+ ok: true,
4148
+ applied: false,
4149
+ state: cacheGuardSnapshot(config),
4150
+ scanned: report.scanned,
4151
+ blank: report.blank,
4152
+ staleCount: report.staleCount,
4153
+ stale: report.stale || [],
4154
+ removed: [],
4155
+ errors: report.errors || [],
4156
+ })
4157
+ return
4158
+ }
4159
+ if (req.method !== 'POST') { sendJson(res, 405, { ok: false, error: 'GET/POST only' }); return }
4160
+ if (!originAllowed(req)) { sendJson(res, 403, { ok: false, error: 'cross-origin request rejected' }); return }
4161
+ try {
4162
+ const raw = await readBody(req)
4163
+ const body = raw.trim() ? JSON.parse(raw) : {}
4164
+ const action = String(body.action || 'scan')
4165
+ if (action === 'scan') {
4166
+ const report = cacheGuardRun(config, { apply: false, source: 'panel' })
4167
+ sendJson(res, 200, {
4168
+ ok: true,
4169
+ applied: false,
4170
+ state: cacheGuardSnapshot(config),
4171
+ scanned: report.scanned,
4172
+ blank: report.blank,
4173
+ staleCount: report.staleCount,
4174
+ stale: report.stale || [],
4175
+ errors: report.errors || [],
4176
+ })
4177
+ return
4178
+ }
4179
+ if (action === 'sweep') {
4180
+ const report = cacheGuardRun(config, { apply: true, source: 'panel' })
4181
+ sendJson(res, 200, {
4182
+ ok: true,
4183
+ applied: true,
4184
+ state: cacheGuardSnapshot(config),
4185
+ scanned: report.scanned,
4186
+ blank: report.blank,
4187
+ staleCount: report.staleCount,
4188
+ stale: report.stale || [],
4189
+ removed: report.removed || [],
4190
+ errors: report.errors || [],
4191
+ })
4192
+ return
4193
+ }
4194
+ if (action === 'clear') {
4195
+ const ids = Array.isArray(body.ids) ? body.ids.map((x) => String(x || '').trim()).filter(Boolean) : []
4196
+ if (ids.length === 0) throw new Error(t('ids 不能为空', 'ids must not be empty'))
4197
+ const out = clearSessionCaches(dshHomeOf(config), ids, { reason: 'panel' })
4198
+ sendJson(res, 200, { ok: true, applied: true, removed: out.removed || [], errors: out.errors || [], state: cacheGuardSnapshot(config) })
4199
+ return
4200
+ }
4201
+ if (action === 'busy') {
4202
+ const out = cacheGuardOnBusy(config, body.sessionId)
4203
+ sendJson(res, 200, out)
4204
+ return
4205
+ }
4206
+ throw new Error(t('action 只能是 scan / sweep / clear / busy', 'action must be one of scan / sweep / clear / busy'))
4207
+ } catch (error) {
4208
+ sendJson(res, 400, { ok: false, error: String((error && error.message) || error) })
4209
+ }
4210
+ }
4013
4211
 
4014
4212
  async function handleFeedback(req, res, config) {
4015
4213
  const dshHome = config?.dshHome || process.env.DSH_HOME || join(homedir(), '.dsh')
@@ -4177,6 +4375,7 @@ async function handleFeedback(req, res, config) {
4177
4375
 
4178
4376
  export function apply(ctx, config) {
4179
4377
  try {
4378
+ try { loggerRef = ctx?.logger || null } catch { }
4180
4379
  ctx.inject(['webServer'], (scoped) => {
4181
4380
  // 每个请求按 accept-language 决定返回中文还是英文:AsyncLocalStorage 让 t() 在
4182
4381
  // 任何异步后续里都能读到本次请求的语言,不用把语言参数一层层往下传。
@@ -4231,6 +4430,12 @@ export function apply(ctx, config) {
4231
4430
  path: ROUTE_FEEDBACK,
4232
4431
  handler: withLang(handleFeedback),
4233
4432
  }))
4433
+ // 0.3.69:会话投影缓存守卫(GET 只读扫描 / POST scan|sweep|clear|busy)
4434
+ scoped.effect(() => scoped.webServer.register({
4435
+ kind: 'exact',
4436
+ path: ROUTE_CACHE_GUARD,
4437
+ handler: withLang(handleCacheGuard),
4438
+ }))
4234
4439
  })
4235
4440
  // 开关打开才排一次启动检查(默认关 = 什么都不做)
4236
4441
  scheduleAutoStart(config)
@@ -4238,6 +4443,8 @@ export function apply(ctx, config) {
4238
4443
  // status 不用再为首屏那 2.5 秒的 ls-remote 埋单。
4239
4444
  typeof setTimeout === 'function' ? setTimeout(() => { try { warmRemoteProbe(config) } catch { } }, 300) : null
4240
4445
  installQuitWhenAllWindowsClosed(ctx)
4446
+ // 0.3.69:会话投影缓存守卫的定时扫描(默认开,设置里可关)
4447
+ scheduleCacheGuard(config)
4241
4448
  } catch (error) {
4242
4449
  // 不抛:缺 webServer 的 profile 里这个插件静默不激活即可
4243
4450
  try { ctx.logger?.warn?.(`[${PACKAGE_ID}] webServer 不可用,设置页面板不会出现:${error}`) } catch { }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-config-sync-plugin",
3
- "version": "0.3.67",
3
+ "version": "0.3.69",
4
4
  "type": "module",
5
5
  "description": "在 DSH 设置里查看 dsh-config 仓库与本机的同步状态,并生成退出后执行的 push/pull 脚本。同步动作本身不在应用内执行。面板与文案跟随客户端语言(中文/English)。",
6
6
  "main": "./index.js",