@shgroup/dsh-serenity-hooks 1.31.8 → 1.31.9

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,7 +317,7 @@ 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
 
@@ -381,4 +381,4 @@ pnpm build # 打包(lib/index.js + client.js)
381
381
 
382
382
  MIT(见 [LICENSE](https://github.com/tellmewhattodo/dsh-serenity-plugin/blob/master/LICENSE))
383
383
 
384
- > **版本**:v1.31.7 | **前置**:DSH 0.1.5-rc.1+ / Node ≥ 20 或 bun | **测试**:78 个文件 / 1169 个用例
384
+ > **版本**:v1.31.9 | **前置**: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.9",
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.9",
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": {