@shgroup/dsh-serenity-hooks 1.18.7 → 1.19.0
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 +2 -2
- package/lib/index.js +1 -28
- package/package.json +1 -1
package/dsh.plugin.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"id": "dsh-serenity-hooks",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.19.0",
|
|
4
4
|
"main": "lib/index.js",
|
|
5
|
-
"description": "宁静号 ACC harness(Native Cordis 插件):真实 DSH 工具 cc_fs/session/acc_msm/eap/neat/cce/loop + 拦截缝机械约束(safe-mode
|
|
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": {
|
|
7
7
|
"dsh": ">=0.1.0-rc.5"
|
|
8
8
|
},
|
package/lib/index.js
CHANGED
|
@@ -1684,15 +1684,6 @@ function qaCheck(root, key) {
|
|
|
1684
1684
|
if (verified) lines.push(" • Session looks clean — no issues detected");
|
|
1685
1685
|
return lines.join("\n");
|
|
1686
1686
|
}
|
|
1687
|
-
/** 追加会话心跳(turn-stopping 机械落盘用) */
|
|
1688
|
-
function appendHeartbeat(sessionMd) {
|
|
1689
|
-
try {
|
|
1690
|
-
appendFileSync(sessionMd, `- ${(/* @__PURE__ */ new Date()).toISOString()} — [auto] turn heartbeat (dsh-serenity-hooks)\n`, "utf-8");
|
|
1691
|
-
return true;
|
|
1692
|
-
} catch {
|
|
1693
|
-
return false;
|
|
1694
|
-
}
|
|
1695
|
-
}
|
|
1696
1687
|
//#endregion
|
|
1697
1688
|
//#region src/tools/session.ts
|
|
1698
1689
|
/**
|
|
@@ -2627,8 +2618,8 @@ function runGit(root, args) {
|
|
|
2627
2618
|
"origin",
|
|
2628
2619
|
branch
|
|
2629
2620
|
]);
|
|
2630
|
-
if (!stderr || stderr.includes("->") || stderr === "") return stdout || `Pushed to origin/${branch}`;
|
|
2631
2621
|
if (stderr.includes("non-fast-forward") || stderr.includes("rejected") || stderr.includes("[rejected]")) return `[REJECTED] Push to origin/${branch} was rejected (non-fast-forward).\n\n远程有新的提交,本地落后。操作建议:\n 1. 先用 bash: git fetch origin ${branch}\n 2. 查看远程变更: git log HEAD..origin/${branch}\n 3. 合并或变基: git merge origin/${branch} 或 git rebase origin/${branch}\n 4. 有冲突则手动解决后: git add ... && git commit\n 5. 再次推送: cc_git push`;
|
|
2622
|
+
if (!stderr || stderr.includes("->") || stderr === "") return stdout || `Pushed to origin/${branch}`;
|
|
2632
2623
|
throw new Error(`cc_git push failed:\n${stderr}`);
|
|
2633
2624
|
}
|
|
2634
2625
|
case "pull": {
|
|
@@ -3816,22 +3807,6 @@ function registerBootstrap(ctx) {
|
|
|
3816
3807
|
}, { prepend: true });
|
|
3817
3808
|
}
|
|
3818
3809
|
//#endregion
|
|
3819
|
-
//#region src/seams/loop.ts
|
|
3820
|
-
/** 解析当前 dsh 会话 scope 的活跃会话 SESSION.md 绝对路径;无标记/越界返回 null */
|
|
3821
|
-
function resolveActiveSession(root, scope = DEFAULT_SESSION_SCOPE) {
|
|
3822
|
-
return readActiveSessionMd(root, scope);
|
|
3823
|
-
}
|
|
3824
|
-
/** 注册 agent/turn-stopping:CCC 内活动会话自动心跳落盘(按 dsh 会话隔离) */
|
|
3825
|
-
function registerTurnFlush(ctx) {
|
|
3826
|
-
ctx.on("agent/turn-stopping", async (payload) => {
|
|
3827
|
-
const agent = payload.agent;
|
|
3828
|
-
const root = findSerenityRoot(agent.session?.header?.cwd ?? process.cwd());
|
|
3829
|
-
if (!root) return;
|
|
3830
|
-
const sessionMd = resolveActiveSession(root, agent.session?.id ?? "default");
|
|
3831
|
-
if (sessionMd) appendHeartbeat(sessionMd);
|
|
3832
|
-
});
|
|
3833
|
-
}
|
|
3834
|
-
//#endregion
|
|
3835
3810
|
//#region src/seams/keeper.ts
|
|
3836
3811
|
const SCORES = {
|
|
3837
3812
|
write: 3,
|
|
@@ -4744,7 +4719,6 @@ const Config = z.object({
|
|
|
4744
4719
|
serenityConfigPaths: z.array(z.string()).default([...DEFAULT_SERENITY_CONFIG_PATHS]),
|
|
4745
4720
|
tools: z.boolean().default(true),
|
|
4746
4721
|
guards: z.boolean().default(true),
|
|
4747
|
-
turnFlush: z.boolean().default(true),
|
|
4748
4722
|
keeper: z.boolean().default(true),
|
|
4749
4723
|
keeperThreshold: z.number().default(150),
|
|
4750
4724
|
context: z.boolean().default(true),
|
|
@@ -4768,7 +4742,6 @@ function apply(ctx, config) {
|
|
|
4768
4742
|
ctx.tools.register(localstoreTool);
|
|
4769
4743
|
}
|
|
4770
4744
|
if (config.guards) registerGuards(ctx, { configPaths: config.serenityConfigPaths });
|
|
4771
|
-
if (config.turnFlush) registerTurnFlush(ctx);
|
|
4772
4745
|
if (config.keeper) registerKeeper(ctx, {
|
|
4773
4746
|
configPaths: config.serenityConfigPaths,
|
|
4774
4747
|
defaultThreshold: config.keeperThreshold
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shgroup/dsh-serenity-hooks",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.19.0",
|
|
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": {
|