@shgroup/dsh-serenity-hooks 1.19.2 → 1.19.4
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 +27 -13
- 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.19.
|
|
3
|
+
"version": "1.19.4",
|
|
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
|
@@ -3567,9 +3567,18 @@ const DEFAULT_ANCHOR_MESSAGE = "You are a helpful software engineer assistant.Th
|
|
|
3567
3567
|
* requiredSignals:晋升所需信号数(boundary 后累计;默认 1)。
|
|
3568
3568
|
* 多轮锚定(v4):两轮递进锚定时 requiredSignals = 锚定轮数——
|
|
3569
3569
|
* 每条锚定回复(assistant/message)计一次,最后一条回复后晋升。
|
|
3570
|
+
*
|
|
3571
|
+
* maxRoundsFallback:**轮次兜底**(v1.19.3 修复 responses API 兼容)。
|
|
3572
|
+
* 某些模型/协议(如 opencode-go-responses)的会话可能不产生标准
|
|
3573
|
+
* `assistant/message` 晋升信号 → 永不晋升 → bootstrap 阶段工具被裁空
|
|
3574
|
+
* (zeroTools 首请求 0 工具,ACC 工具不可见)。兜底:无论晋升信号是否
|
|
3575
|
+
* 到达,观察到的模型 step 数(`step/start` 事件计数,平台稳定事件,
|
|
3576
|
+
* responses/completions 都触发,独立于 promoteEvents)达到 maxRoundsFallback
|
|
3577
|
+
* 即强制 promoted(开放完整工具)。正常模型锚定轮数(requiredSignals)
|
|
3578
|
+
* 通常 ≤ 2 < 默认兜底 3,不受影响。
|
|
3570
3579
|
*/
|
|
3571
|
-
function createEpochPromotion(promoteEvents, requiredSignals = 1) {
|
|
3572
|
-
/** sessionId -> { boundary, signalCount }(
|
|
3580
|
+
function createEpochPromotion(promoteEvents, requiredSignals = 1, maxRoundsFallback = 3) {
|
|
3581
|
+
/** sessionId -> { boundary, signalCount, rounds }(rounds = 兜底用回复轮计数) */
|
|
3573
3582
|
const state = /* @__PURE__ */ new Map();
|
|
3574
3583
|
const sessionIdOf = (session) => {
|
|
3575
3584
|
if (session && typeof session === "object") {
|
|
@@ -3577,9 +3586,11 @@ function createEpochPromotion(promoteEvents, requiredSignals = 1) {
|
|
|
3577
3586
|
if (typeof id === "string") return id;
|
|
3578
3587
|
}
|
|
3579
3588
|
};
|
|
3589
|
+
const promotedBy = (entry) => entry.signalCount >= requiredSignals || entry.rounds >= maxRoundsFallback;
|
|
3580
3590
|
const scan = (session) => {
|
|
3581
3591
|
let boundary = -1;
|
|
3582
3592
|
let signalCount = 0;
|
|
3593
|
+
let rounds = 0;
|
|
3583
3594
|
const events = session?.events;
|
|
3584
3595
|
if (Array.isArray(events)) for (const event of events) {
|
|
3585
3596
|
const e = event;
|
|
@@ -3587,20 +3598,23 @@ function createEpochPromotion(promoteEvents, requiredSignals = 1) {
|
|
|
3587
3598
|
if (e.type === "compaction/end") {
|
|
3588
3599
|
boundary = seq;
|
|
3589
3600
|
signalCount = 0;
|
|
3601
|
+
rounds = 0;
|
|
3590
3602
|
continue;
|
|
3591
3603
|
}
|
|
3592
3604
|
if (promoteEvents.has(e.type) && seq > boundary) signalCount++;
|
|
3605
|
+
if (e.type === "step/start" && seq > boundary) rounds++;
|
|
3593
3606
|
}
|
|
3594
3607
|
const entry = {
|
|
3595
3608
|
boundary,
|
|
3596
|
-
|
|
3609
|
+
signalCount,
|
|
3610
|
+
rounds
|
|
3597
3611
|
};
|
|
3598
3612
|
const sid = sessionIdOf(session);
|
|
3599
|
-
if (sid) state.set(sid,
|
|
3613
|
+
if (sid) state.set(sid, entry);
|
|
3614
|
+
return {
|
|
3600
3615
|
boundary,
|
|
3601
|
-
|
|
3602
|
-
}
|
|
3603
|
-
return entry;
|
|
3616
|
+
promoted: promotedBy(entry)
|
|
3617
|
+
};
|
|
3604
3618
|
};
|
|
3605
3619
|
return {
|
|
3606
3620
|
status(agent) {
|
|
@@ -3630,7 +3644,7 @@ function createEpochPromotion(promoteEvents, requiredSignals = 1) {
|
|
|
3630
3644
|
const s = state.get(sid);
|
|
3631
3645
|
if (s) return {
|
|
3632
3646
|
boundary: s.boundary,
|
|
3633
|
-
promoted: s
|
|
3647
|
+
promoted: promotedBy(s)
|
|
3634
3648
|
};
|
|
3635
3649
|
return scan(session);
|
|
3636
3650
|
},
|
|
@@ -3644,14 +3658,14 @@ function createEpochPromotion(promoteEvents, requiredSignals = 1) {
|
|
|
3644
3658
|
if (e.type === "compaction/end") {
|
|
3645
3659
|
state.set(sid, {
|
|
3646
3660
|
boundary: seq,
|
|
3647
|
-
signalCount: 0
|
|
3661
|
+
signalCount: 0,
|
|
3662
|
+
rounds: 0
|
|
3648
3663
|
});
|
|
3649
3664
|
return;
|
|
3650
3665
|
}
|
|
3651
|
-
if (promoteEvents.has(e.type) && seq > entry.boundary)
|
|
3652
|
-
|
|
3653
|
-
|
|
3654
|
-
});
|
|
3666
|
+
if (promoteEvents.has(e.type) && seq > entry.boundary) entry.signalCount++;
|
|
3667
|
+
if (e.type === "step/start" && seq > entry.boundary) entry.rounds++;
|
|
3668
|
+
state.set(sid, entry);
|
|
3655
3669
|
}
|
|
3656
3670
|
};
|
|
3657
3671
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shgroup/dsh-serenity-hooks",
|
|
3
|
-
"version": "1.19.
|
|
3
|
+
"version": "1.19.4",
|
|
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": {
|