@shgroup/dsh-serenity-hooks 1.31.8 → 1.31.10

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
@@ -317,12 +317,14 @@ AI 一次能"记住"的内容有上限。满了不用你手动开新会话:
317
317
 
318
318
  ```bash
319
319
  pnpm typecheck # 类型检查(node + 浏览器端两套)
320
- pnpm test # 全量测试(当前 78 个文件 / 1169 个用例)
320
+ pnpm test # 全量测试(当前 80 个文件 / 1176 个用例)
321
321
  pnpm build # 打包(lib/index.js + client.js)
322
322
  ```
323
323
 
324
- - **开发用小工具**:`scripts/dsh-develop.ts`——typecheck / test / build / status / commit / push / version / bump / deploy / restart-web / publish / pack-check / github-push 一条龙。
325
- `pack-check` 会在发布前核对打包产物是否完整(曾经踩过"发到 npm 少了文件"的坑);`scripts/dsh-crash-investigate.ts` 用来查崩溃(只读)
324
+ - **开发用小工具**:`scripts/dsh-develop.ts`——typecheck / test / build / status / commit / push / version / bump / deploy / **lockfile** / restart-web / publish / pack-check / github-push 一条龙。
325
+ `lockfile` = 重生成锁文件 + 用 `--frozen-lockfile` 自检(CI 的 `Install (hooks)` 同款判定);
326
+ `pack-check` 会在发布前核对打包产物是否完整(曾经踩过"发到 npm 少了文件"的坑);`scripts/dsh-crash-investigate.ts` 用来查崩溃(只读)。
327
+ ⚠️ **改完 `package.json` 依赖后必须跑 `lockfile` 并提交锁文件** —— v1.31.6 漏了这一步,CI 从此一直红(红在"测试根本没跑",见 CHANGELOG v1.31.10)
326
328
  - **架构**:Cordis 原生插件,用 DSH 的正式接口注册工具和拦截点——**从不修改 DSH 本体**
327
329
  - **代码地图**:[docs/codebase-overview-v1.22.md](https://github.com/tellmewhattodo/dsh-serenity-plugin/blob/master/docs/codebase-overview-v1.22.md)
328
330
  - **设计决策**:见 [CHANGELOG.md](https://github.com/tellmewhattodo/dsh-serenity-plugin/blob/master/CHANGELOG.md) 和维护技能 `dsh-serenity-plugin-development`
@@ -381,4 +383,4 @@ pnpm build # 打包(lib/index.js + client.js)
381
383
 
382
384
  MIT(见 [LICENSE](https://github.com/tellmewhattodo/dsh-serenity-plugin/blob/master/LICENSE))
383
385
 
384
- > **版本**:v1.31.7 | **前置**:DSH 0.1.5-rc.1+ / Node ≥ 20 或 bun | **测试**:78 个文件 / 1169 个用例
386
+ > **版本**:v1.31.10 | **前置**:DSH 0.1.5-rc.1+ / Node ≥ 20 或 bun | **测试**:80 个文件 / 1176 个用例
package/dsh.plugin.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "id": "dsh-serenity-hooks",
3
- "version": "1.31.8",
3
+ "version": "1.31.10",
4
4
  "main": "lib/index.js",
5
5
  "description": "宁静号 ACC harness(Native Cordis 插件):给 DSH 装一个「AI 工作区」——11 个工具(container_fs/logbook/dashboard/container_git/msm/praxis/handyman/localstore/container_admin/autopilot-trajectory/im-bridge)+ 机械约束(安全模式/工作区围墙/密钥守卫)+ 工作日志与原地重建 + 网页登录入口/微信桥/子角色/对外问答页/自主巡航。适配 DSH 0.1.5-rc.1(deepseek-ai/deepseek-harness)。",
6
6
  "engines": {
package/lib/index.js CHANGED
@@ -8623,10 +8623,22 @@ async function queueRebuild(ctx, opts) {
8623
8623
  function performRebuild(session, pending, meter) {
8624
8624
  const nodes = [...session.surface.nodes];
8625
8625
  if (nodes.length === 0) return false;
8626
+ /**
8627
+ * v1.31.8 二次修正(0.1.5-rc.1 实证,diag 原文):
8628
+ * `surface replace: node 0 holds the system prompt and may be rewritten only by a
8629
+ * system/message over exactly that node`(宿主 `dsh-session/lib/types/surface.js`
8630
+ * `assertSystemHeadRewrite`)。
8631
+ *
8632
+ * → **surface node 0 是系统提示节点且被宿主保护**;而重建的语义恰恰是"保留系统提示、
8633
+ * 只清对话历史",故替换范围必须从 **node 1** 起。(旧实现整体替换 `nodes[0..last]`,
8634
+ * 在 0.1.5 上必被拒——这是 §14 之后的第二条 rebuild 阻断规则。)
8635
+ */
8636
+ const targets = nodes.slice(1);
8637
+ if (targets.length === 0) return false;
8626
8638
  if (meter) {
8627
8639
  let shadowedTokenCount = 0;
8628
8640
  const events = sessionEvents(session);
8629
- for (const seq of nodes) {
8641
+ for (const seq of targets) {
8630
8642
  const event = events[seq];
8631
8643
  if (!event) continue;
8632
8644
  const message = deriveEventMessage(event);
@@ -8634,10 +8646,10 @@ function performRebuild(session, pending, meter) {
8634
8646
  }
8635
8647
  session.append("compaction/prune", {
8636
8648
  shadowedRange: {
8637
- start: nodes[0],
8638
- end: nodes[nodes.length - 1]
8649
+ start: targets[0],
8650
+ end: targets[targets.length - 1]
8639
8651
  },
8640
- shadowedSeqs: nodes,
8652
+ shadowedSeqs: targets,
8641
8653
  shadowedTokenCount
8642
8654
  });
8643
8655
  }
@@ -8650,10 +8662,10 @@ function performRebuild(session, pending, meter) {
8650
8662
  }, {
8651
8663
  surfaceOp: {
8652
8664
  op: "replace",
8653
- startSeq: nodes[0],
8654
- endSeq: nodes[nodes.length - 1]
8665
+ startSeq: targets[0],
8666
+ endSeq: targets[targets.length - 1]
8655
8667
  },
8656
- sourceEventSeqs: nodes
8668
+ sourceEventSeqs: targets
8657
8669
  });
8658
8670
  return true;
8659
8671
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shgroup/dsh-serenity-hooks",
3
- "version": "1.31.8",
3
+ "version": "1.31.10",
4
4
  "description": "宁静号 ACC harness(Native Cordis 插件)——给 DeepSeek Harness 装一个「AI 工作区」:11 个工具(container_fs/logbook/dashboard/container_git/msm/praxis/handyman/localstore/container_admin/autopilot-trajectory/im-bridge)+ 机械约束(安全模式/工作区围墙/密钥守卫/对外输出守卫)+ 工作日志与原地重建 + 网页登录入口/微信桥/子角色/对外问答页/自主巡航。适配 DSH 0.1.5-rc.1。",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -68,7 +68,7 @@
68
68
  "@deepseek-ai/dsh-web": "^0.1.5-rc.1",
69
69
  "@deepseek-ai/dsh-web-fetch-http": "^0.1.5-rc.1",
70
70
  "@deepseek-ai/schemastery": "^3.18.2",
71
- "cordis": "^4.0.2",
71
+ "cordis": "^4.0.0-rc.7",
72
72
  "@deepseek-ai/cordis": "^4.0.2"
73
73
  },
74
74
  "peerDependenciesMeta": {