dsh-recency-guard 0.17.0 → 0.18.0

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
@@ -1,13 +1,13 @@
1
1
  # dsh-recency-guard
2
2
 
3
- **v0.17.0** · [GitHub](https://github.com/xuanyuanchumo/dsh-recency-guard) · [问题反馈](https://github.com/xuanyuanchumo/dsh-recency-guard/issues) · MIT
3
+ **v0.18.0** · [GitHub](https://github.com/xuanyuanchumo/dsh-recency-guard) · [问题反馈](https://github.com/xuanyuanchumo/dsh-recency-guard/issues) · MIT
4
4
 
5
5
  > DeepSeek Harness 的**插件崩溃恢复守护**:记录第三方 / 实验性插件的安装与更新时序并备份配置;
6
6
  > 崩溃后的**下一次启动之前**,把最近更新的嫌疑插件挡在门外;稳定启动后,再把非首要嫌疑放回来。
7
7
  >
8
- > 版本基线(2026-11-11,北京时间):**0.17.0**。版本四锚点(`package.json` / 本 README /
8
+ > 版本基线(2026-11-13,北京时间):**0.18.0**。版本四锚点(`package.json` / 本 README /
9
9
  > `docs/agents/` / [`dsh-plugin.json`](dsh-plugin.json))一致。
10
- > 测试分四层,当前 **84/84 全绿**(Core 42 / Host 10 / Client 24 / Contract 8)。
10
+ > 测试分四层,当前 **87/87 全绿**(Core 43 / Host 10 / Client 25 / Contract 9)。
11
11
 
12
12
  ---
13
13
 
@@ -51,19 +51,19 @@ dsh plugin --profile <profile名> add dsh-recency-guard
51
51
  锁定版本:
52
52
 
53
53
  ```bash
54
- dsh plugin --profile <profile名> add dsh-recency-guard@0.17.0
54
+ dsh plugin --profile <profile名> add dsh-recency-guard@0.18.0
55
55
  ```
56
56
 
57
- > 版本对应:本 README 描述本仓库 **0.17.0** 源码。npm 上实际可安装的版本以
58
- > `npm view dsh-recency-guard version` 为准;若 `latest` 落后于本文版本,请按下面的源码方式安装,
59
- > 或等待对应版本发布。发布顺序见 [`docs/agents/conventions.md`](docs/agents/conventions.md) §6。
57
+ > 版本对应:本 README 描述 **0.18.0**;npm `latest` 已发布为 **0.18.0**
58
+ > (2026-11-11,shasum `b667bd20b6ea82d294dbc28e4eab1290b07dd963`),可直接安装。
59
+ > 版本纪律见 [`docs/agents/conventions.md`](docs/agents/conventions.md) §6。
60
60
 
61
61
  ### 插件市场
62
62
 
63
63
  投稿材料已按 [awesome-dsh-plugin contributing.md](https://github.com/awesome-dsh-plugin/awesome-dsh-plugin/blob/main/contributing.md)
64
64
  备好([`docs/market-submission.md`](docs/market-submission.md)):一个条目文件、`category: security`。
65
- 上架后可在 dsh 的 **Plugins → Discover** 或 dsh-market 中搜索 `recency-guard` 安装。
66
- **当前状态:材料已备、PR 未提交** —— 本文不声称已在市场中可搜到。
65
+ **当前状态:条目已收录(PR #14245);0.17.0 描述更新已推到同一 PR 分支(v0.18.0 将随合并后下一 PR 更新)(HEAD `94ade1e`),
66
+ 等待复核/合并。** 收录后可在 dsh 的 **Plugins → Discover** 或 dsh-market 中搜索 `recency-guard` 安装。
67
67
 
68
68
  ### 手动 / 本地源码(开发)
69
69
 
@@ -405,7 +405,8 @@ npm run extract-runtime # Host 层测试前置(runtime/ 缺失时先解出)
405
405
 
406
406
  | 版本 | 一句话 |
407
407
  | --- | --- |
408
- | **0.17.0**(2026-11-11) | 技术栈清理与研究闭环:预防性预警(RQ3)接入生产且**只预警不行动**、面板自适应刷新、状态文件 schema 版本(未知版本保留现场)、变异 72 突变体 / 0 未归因 + 无直接测试 14→2 + rescue/宿主宽度跨实现对拍;技术债状态见 [`docs/agents/tech-debt.md`](docs/agents/tech-debt.md) |
408
+ | **0.18.0**(2026-11-13) | 研究落地补完与崩溃循环兜底:配置未知键 fail-loud(学习 dsh-ops)、journal 裁剪改**轮转**(读改写窗口结构性消灭 + 零依赖对拍)、路径指纹 64 位 + 双读迁移(TD-7 根治)、生存分析/失配检测/恢复残余上屏(三个观测孤岛接入消费)、图谱**影响面**接入详情侧栏(impactedBy/reachableFrom 首个 UI 消费者);**级联刹车**:崩溃循环升级到顶后自动回滚到崩溃前启动状态(仅保留头号嫌疑),不再「越关越空」;技术债状态见 [`docs/agents/tech-debt.md`](docs/agents/tech-debt.md) |
409
+ | **0.17.0**(2026-11-11) | 技术栈清理与研究闭环:预防性预警(RQ3)接入生产且**只预警不行动**、面板自适应刷新、状态文件 schema 版本(未知版本保留现场)、路径逃逸修复(`pathSafeName` 单一实现 + 指纹)、变异 72 突变体 / 0 未归因 + 无直接测试 14→2 + rescue/宿主宽度跨实现对拍;技术债状态见 [`docs/agents/tech-debt.md`](docs/agents/tech-debt.md) |
409
410
  | **0.16.0**(2026-11-11) | 确定性冲突证据(4 类 finding + 出处)、贪心最小隔离与依赖联动、可写两阶段 rescue、常态路径锁卫生、PanelSnapshotView 可空契约;新增社区 manifest [`dsh-plugin.json`](dsh-plugin.json),README 面向用户重构,版本四锚点统一 |
410
411
  | 0.15.0 | 架构重构:`host/` + `client/` + `shared/` 分层,client→host 越界与值依赖环写成契约测试 |
411
412
  | 0.14.0 | 误伤反馈闭环、贝叶斯风险并行读数、预防性健康指标(EWMA / CUSUM)、自动化变异测试 |
package/bin/rescue.mjs CHANGED
@@ -145,11 +145,40 @@ function readJsonSafe(file) {
145
145
  }
146
146
  }
147
147
 
148
- /** journal 读取(容忍崩溃截断的尾行,与 store.ts 同一容错语义)。 */
148
+ /** journal 读取(容忍崩溃截断的尾行,与 store.ts 同一容错语义)。
149
+ *
150
+ * v0.18 TD-5:journal 超限会轮转成 journal.<epoch>.jsonl(epoch 升序),
151
+ * 完整时间线 = 轮转文件(旧→新)+ 活动文件。rescue 是零依赖脚本,
152
+ * 不能 import 宿主模块 —— 这份合并逻辑与 journal-io.ts 的
153
+ * readMergedJournalSync 是「有意保留的双实现」,由 width-parity 同款
154
+ * 纪律的 journal 合并对拍测试防漂移。
155
+ */
149
156
  function readJournal(partitionDir, limit) {
150
- const file = join(partitionDir, 'journal.jsonl')
151
- if (!existsSync(file)) return []
152
- const lines = readFileSync(file, 'utf8').split('\n').filter(Boolean)
157
+ let names = []
158
+ try {
159
+ names = readdirSync(partitionDir)
160
+ } catch {
161
+ return []
162
+ }
163
+ const rotated = names
164
+ .filter((n) => /^journal\.\d+\.jsonl$/.test(n))
165
+ .sort((a, b) => {
166
+ const ea = Number(a.slice('journal.'.length, -'.jsonl'.length))
167
+ const eb = Number(b.slice('journal.'.length, -'.jsonl'.length))
168
+ return ea - eb
169
+ })
170
+ .map((n) => join(partitionDir, n))
171
+ const active = join(partitionDir, 'journal.jsonl')
172
+ const files = [...rotated, ...(existsSync(active) ? [active] : [])]
173
+ if (files.length === 0) return []
174
+ const lines = []
175
+ for (const file of files) {
176
+ try {
177
+ lines.push(...readFileSync(file, 'utf8').split('\n').filter(Boolean))
178
+ } catch {
179
+ /* 一段缺失好过全空 */
180
+ }
181
+ }
153
182
  const take = Math.max(0, Math.min(limit, lines.length))
154
183
  const out = []
155
184
  for (const line of lines.slice(lines.length - take)) {
@@ -202,6 +231,11 @@ function isZeroWidth(codePoint) {
202
231
  )
203
232
  }
204
233
 
234
+ /** 导出仅供**对拍测试**使用(tests/contract/journal-merge-parity.test.ts):
235
+ * 零依赖纪律要求 rescue 自带合并实现,对拍是防漂移的唯一手段。
236
+ * CLI 自身不经过这些导出。 */
237
+ export { readJournal as rescueReadJournalForParity }
238
+
205
239
  export function codePointWidth(cp) {
206
240
  if (isZeroWidth(cp)) return 0
207
241
  const wide =