@shgroup/dsh-serenity-hooks 1.18.5 → 1.18.7

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/dsh.plugin.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "id": "dsh-serenity-hooks",
3
- "version": "1.18.5",
3
+ "version": "1.18.7",
4
4
  "main": "lib/index.js",
5
5
  "description": "宁静号 ACC harness(Native Cordis 插件):真实 DSH 工具 cc_fs/session/acc_msm/eap/neat/cce/loop + 拦截缝机械约束(safe-mode/路径守卫/会话落盘)。适配 DSH 公开版(0.1.0-rc,deepseek-ai/deepseek-harness)。私有(dsh-external 组织)。",
6
6
  "engines": {
package/lib/index.js CHANGED
@@ -3684,6 +3684,8 @@ function readBootstrapConfig(agent) {
3684
3684
  function registerBootstrap(ctx) {
3685
3685
  const settingsByRoot = /* @__PURE__ */ new Map();
3686
3686
  const trackers = /* @__PURE__ */ new Map();
3687
+ /** 已锚定会话(进程内防重:子 agent 每会话只锚定一次) */
3688
+ const anchoredSessions = /* @__PURE__ */ new Set();
3687
3689
  const trackerFor = (root, settings) => {
3688
3690
  let t = trackers.get(root);
3689
3691
  if (!t) {
@@ -3709,8 +3711,11 @@ function registerBootstrap(ctx) {
3709
3711
  if (!root) return;
3710
3712
  const settings = settingsByRoot.get(root) ?? readBootstrapConfig(agent);
3711
3713
  const session = agent.session;
3712
- if ((session?.header?.delegationDepth ?? 0) > 0) return;
3713
- if (session?.events?.some((event) => event.type === "user/message")) return;
3714
+ const depth = session?.header?.delegationDepth ?? 0;
3715
+ const sid = typeof session?.id === "string" ? session.id : void 0;
3716
+ if (depth === 0) {
3717
+ if (session?.events?.some((event) => event.type === "user/message")) return;
3718
+ } else if (sid !== void 0 && anchoredSessions.has(sid)) return;
3714
3719
  if (message?.source?.kind === "plugin") return;
3715
3720
  const inbox = agent.inbox;
3716
3721
  if (!inbox?.prepend) return;
@@ -3728,6 +3733,7 @@ function registerBootstrap(ctx) {
3728
3733
  summary: "bootstrap anchor turn"
3729
3734
  }
3730
3735
  });
3736
+ if (sid !== void 0) anchoredSessions.add(sid);
3731
3737
  warnOnce(`anchor turns injected: ${settings.anchorMessages.length} 条(${settings.anchorMessages[0].slice(0, 40)}…)`);
3732
3738
  } catch {}
3733
3739
  });
@@ -3872,7 +3878,7 @@ var KeeperTracker = class {
3872
3878
  }
3873
3879
  };
3874
3880
  function reminderText(code, score) {
3875
- return `[SESSION-KEEPER] 积分已达阈值 (${score})。请回应 [SESSION-KEEPER-recorded-${code}] 确认本轮进度已沉淀到工作会话(acc-session show),随后我清零积分。`;
3881
+ return `[SESSION-KEEPER] Score threshold reached (${score}). Please acknowledge with [SESSION-KEEPER-recorded-${code}] once progress is synced to the working session (acc-session show). No need to interrupt your work — just acknowledge inline and keep going.`;
3876
3882
  }
3877
3883
  const PLUGIN_SOURCE$1 = {
3878
3884
  kind: "plugin",
@@ -4252,9 +4258,14 @@ function codeModeAdaptationLine(ctx, scope) {
4252
4258
  ""
4253
4259
  ].join("\n");
4254
4260
  }
4255
- /** 从 assembly context 解析 agent cwd(subagent/后台 agent 同样带 agent) */
4261
+ /** 从 assembly context 解析 agent cwd(subagent/后台 agent 同样带 agent);
4262
+ * 无 agent → undefined(不注入);有 agent 但无 header.cwd(workflow subagent 等)
4263
+ * 回退 process.cwd()——对齐 context.ts,否则这些 agent 系统提示词注入为空
4264
+ * (v1.18.6:workflow subagent 无宁静号上下文 bug) */
4256
4265
  function agentCwd(context) {
4257
- return (context.agent?.session)?.header?.cwd;
4266
+ const agent = context.agent;
4267
+ if (!agent) return void 0;
4268
+ return agent.session?.header?.cwd ?? process.cwd();
4258
4269
  }
4259
4270
  /** 从 assembly context 解析 dsh 会话 id(Session 块按会话隔离的 scope) */
4260
4271
  function agentScope$1(context) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shgroup/dsh-serenity-hooks",
3
- "version": "1.18.5",
3
+ "version": "1.18.7",
4
4
  "description": "宁静号 ACC harness — Native Cordis 插件(DeepSeek Harness 运行时)。真实 DSH 工具注册(cc_fs/session/acc_msm 等 9 工具)+ 拦截缝机械约束(safe-mode/路径守卫/会话落盘)+ 系统提示词注入(ACC/CCE/Constraints/SKILL/Session 五块)。适配 DSH 公开版(deepseek-ai/deepseek-harness 0.1.0-rc)。",
5
5
  "license": "MIT",
6
6
  "repository": {