@shgroup/dsh-serenity-hooks 1.18.5 → 1.18.6
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 +1 -1
- package/lib/index.js +15 -4
- package/package.json +1 -1
package/dsh.plugin.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"id": "dsh-serenity-hooks",
|
|
3
|
-
"version": "1.18.
|
|
3
|
+
"version": "1.18.6",
|
|
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
|
-
|
|
3713
|
-
|
|
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
|
});
|
|
@@ -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
|
-
|
|
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.
|
|
3
|
+
"version": "1.18.6",
|
|
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": {
|