@shgroup/dsh-serenity-hooks 1.16.12 → 1.16.13

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.16.12",
3
+ "version": "1.16.13",
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
@@ -3095,6 +3095,16 @@ function shouldAutoRestore(agent) {
3095
3095
  if (session.id?.startsWith("loop-")) return false;
3096
3096
  return true;
3097
3097
  }
3098
+ /**
3099
+ * 恢复触发判定(S134 泄漏修复 v1.16.13):根会话 **且已有对话历史**(续跑/恢复的会话)
3100
+ * 才自动恢复上次激活的宁静号会话——全新会话(新任务,如 apaas-26116)无历史 → 不恢复,
3101
+ * 避免把过去的 SESSION 上下文注入新任务(跨任务污染)。
3102
+ */
3103
+ function shouldRestoreActive(agent) {
3104
+ if (!shouldAutoRestore(agent)) return false;
3105
+ const events = agent.session?.events;
3106
+ return Array.isArray(events) && events.length > 0;
3107
+ }
3098
3108
  function registerContext(ctx, opts = {}) {
3099
3109
  const configPaths = opts.configPaths ?? DEFAULT_SERENITY_CONFIG_PATHS;
3100
3110
  const entrySkillMaxChars = opts.entrySkillMaxChars ?? 3e4;
@@ -3103,7 +3113,7 @@ function registerContext(ctx, opts = {}) {
3103
3113
  if (!root) return;
3104
3114
  const key = agentKey(agent);
3105
3115
  registerEntrySkillSection(agent, root);
3106
- if (shouldAutoRestore(agent)) try {
3116
+ if (shouldRestoreActive(agent)) try {
3107
3117
  if (loadSerenityConfig(root, configPaths).hooks?.autoRestoreSession ?? true) {
3108
3118
  const restored = restoreActiveSession(root, agentScope(agent));
3109
3119
  if (restored) console.log(`[serenity-hooks] ↻ 自动恢复激活会话: ${restored.dir}(from scope ${restored.from})`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shgroup/dsh-serenity-hooks",
3
- "version": "1.16.12",
3
+ "version": "1.16.13",
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": {