@shgroup/dsh-serenity-hooks 1.59.3 → 1.59.5
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 +75 -3
- package/lib/seams/guards.d.ts +19 -0
- 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.59.
|
|
3
|
+
"version": "1.59.5",
|
|
4
4
|
"main": "lib/index.js",
|
|
5
5
|
"description": "宁静号 ACC harness(Native Cordis 插件):给 DSH 装一个「AI 工作区」——14 个工具(container_fs/container_trajectory/dashboard/container_git/msm/praxis/ontology/serenity-skill-creator/cheap-worker/localstore/container_admin;另三个 im-bridge/acc-diag/diagram 按配置条件出现)+ 机械约束(安全模式/工作区围墙/密钥守卫)+ 轨迹日志与原地重建 + 网页登录入口/微信桥/子角色/对外问答页/trajectory 唤醒注册表。适配 DSH 0.1.7-rc.1 与 0.2.0-rc.1(双档,deepseek-ai/deepseek-harness)。",
|
|
6
6
|
"engines": {
|
package/lib/index.js
CHANGED
|
@@ -9196,7 +9196,7 @@ function parseForegroundJobs(raw) {
|
|
|
9196
9196
|
function resolveSubagentStarter(subagents) {
|
|
9197
9197
|
if (typeof subagents.startActivation === "function") {
|
|
9198
9198
|
const fn = subagents.startActivation;
|
|
9199
|
-
return (req) => fn({
|
|
9199
|
+
return (req) => fn.call(subagents, {
|
|
9200
9200
|
provider: "spawn",
|
|
9201
9201
|
label: req.label,
|
|
9202
9202
|
request: {
|
|
@@ -9388,7 +9388,7 @@ function createCheapWorkerTool(ctx) {
|
|
|
9388
9388
|
done,
|
|
9389
9389
|
jobs: results,
|
|
9390
9390
|
usage: {
|
|
9391
|
-
how: `foreground parallel mode starts ${results.length} child agents at once through the host delegation service (ctx.subagents.start "spawn"), awaits all of them, and returns each child's final text. No loop, no completion-code validation, no progress file. Cap = ${FOREGROUND_MAX_PARALLEL}.`,
|
|
9391
|
+
how: `foreground parallel mode starts ${results.length} child agents at once through the host delegation service (ctx.subagents.startActivation on 0.2.1-rc.*+, falling back to ctx.subagents.start "spawn" on older hosts), awaits all of them, and returns each child's final text. No loop, no completion-code validation, no progress file. Cap = ${FOREGROUND_MAX_PARALLEL}.`,
|
|
9392
9392
|
model: "NOT selectable per call — resolved from the CCC config cheap-worker.models (cheap-worker.defaultModel, else models[0])",
|
|
9393
9393
|
next: done ? "All children completed; use each job's output directly (results are in the same order as the jobs you passed)" : "Some children did not complete — inspect each job's diagnostic/output (results keep the order you passed)"
|
|
9394
9394
|
}
|
|
@@ -9406,7 +9406,7 @@ function createCheapWorkerTool(ctx) {
|
|
|
9406
9406
|
return {
|
|
9407
9407
|
...res,
|
|
9408
9408
|
usage: {
|
|
9409
|
-
how: "foreground mode starts ONE serial child agent through the host delegation service (ctx.subagents.start \"spawn\") with the CCC-configured model; it awaits the run and returns the child's final text. No loop, no completion-code validation, no progress file.",
|
|
9409
|
+
how: "foreground mode starts ONE serial child agent through the host delegation service (ctx.subagents.startActivation on 0.2.1-rc.*+, falling back to ctx.subagents.start \"spawn\" on older hosts) with the CCC-configured model; it awaits the run and returns the child's final text. No loop, no completion-code validation, no progress file.",
|
|
9410
9410
|
model: "NOT selectable per call — resolved from the CCC config cheap-worker.models (cheap-worker.defaultModel, else models[0])",
|
|
9411
9411
|
next: res.done ? "Child completed; use its output directly" : `Child did not complete (stopReason=${res.stopReason}); inspect diagnostic/output and decide whether to retry`
|
|
9412
9412
|
}
|
|
@@ -13773,6 +13773,69 @@ function forgetImBridgeVisibility(sessionId) {
|
|
|
13773
13773
|
imBridgeRestrictions.delete(sessionId);
|
|
13774
13774
|
}
|
|
13775
13775
|
/**
|
|
13776
|
+
* 宿主 `dsh-tool-schedule` 注册的 4 个模型可见工具名(**逐字**,来自该包 `lib/index.js` 的
|
|
13777
|
+
* `defineTool({ name: … })`:`schedule_create` / `schedule_list` / `schedule_update` / `schedule_delete`)。
|
|
13778
|
+
*
|
|
13779
|
+
* 🔴 **为什么要在 CCC 内屏蔽(owner 原话:「这和 CRO 冲突,要求在宁静号激活情况下屏蔽掉」)**:
|
|
13780
|
+
* 宿主从 `0.2.1-rc.2` 起自带一套**模型可见的定时器工具**(`ctx.schedule` 服务 + 这 4 个工具)。
|
|
13781
|
+
* 而宁静号的唤醒/巡航走的是**另一套**机制:`container_trajectory send-later` → 落 CCC 的
|
|
13782
|
+
* `AGENT_SESSIONS/wake-registry.json` → 由**中心调度器 5min tick 统一投递**(D58)。
|
|
13783
|
+
* 两套并存会产生**三个具体问题**(不是"重复功能"这种审美问题):
|
|
13784
|
+
* ① **两处真相源**:宿主的 schedule 状态在宿主域、我们的在 CCC 文件里,**谁在跑说不清**;
|
|
13785
|
+
* ② **CRO 判据失真**:CRO 程序读的是 `wake-registry.json`,宿主定时器触发的唤起**它看不见**
|
|
13786
|
+
* ⇒ 巡检/记账全部遗漏(本轨已有同族教训:「CRO 只在 `wake===true` 时算」那条被推翻);
|
|
13787
|
+
* ③ **安静失败**:模型可能顺手用 `schedule_create` 排一个唤醒,**它不在任何人的账本里**。
|
|
13788
|
+
* ⇒ 故**在 CCC 内隐藏**(从模型清单移除),非 CCC 会话**不受影响**(那是宿主的正常能力)。
|
|
13789
|
+
*
|
|
13790
|
+
* ⚠️ **一处必须防的坑**(与 `hideAllFor` 同族):宿主 `restrict` 对**未注册的名字**会让**整次调用失败**
|
|
13791
|
+
* (`dsh-tools` 契约逐字:"Empty filters, unknown names … fail")。
|
|
13792
|
+
* 这 4 个名字是否在册取决于**宿主是否装了该 tool 包**(不同宿主版本/裁剪可能没有)
|
|
13793
|
+
* ⇒ 所以**逐个名字单独发 restrict**,某个失败就跳过那个,**绝不整批发**
|
|
13794
|
+
* (整批发一旦撞到缺名的宿主 ⇒ 一个都不隐藏 + 只有一行 log ⇒ 缺陷静默)。
|
|
13795
|
+
*/
|
|
13796
|
+
const HOST_SCHEDULE_TOOL_NAMES = [
|
|
13797
|
+
"schedule_create",
|
|
13798
|
+
"schedule_list",
|
|
13799
|
+
"schedule_update",
|
|
13800
|
+
"schedule_delete"
|
|
13801
|
+
];
|
|
13802
|
+
/** `${sessionId}::${toolName}` → restrict disposer(逐工具,便于某个名字不成立时单独跳过) */
|
|
13803
|
+
const hostScheduleRestrictions = /* @__PURE__ */ new Map();
|
|
13804
|
+
/**
|
|
13805
|
+
* 在 **CCC 内**屏蔽宿主自带的定时器工具(v1.59.5)。
|
|
13806
|
+
*
|
|
13807
|
+
* 判据 = **会话是否落在某个 CCC 内**(`root !== null`)——与 `syncCccToolVisibility` 互补:
|
|
13808
|
+
* 那个管"不在 CCC ⇒ 隐藏**我们自己的**全部工具",本函数管"**在** CCC ⇒ 隐藏**宿主的**定时器工具"。
|
|
13809
|
+
*
|
|
13810
|
+
* 幂等;失败不阻断 step(最坏 = 那一个工具仍可见,但那只是"宿主的正常能力没被藏起来",
|
|
13811
|
+
* 不会让会话坏掉)。逐个名字独立发 restrict ⇒ 任何一个名字不在册都不会连累其余三个。
|
|
13812
|
+
*
|
|
13813
|
+
* @param agent 目标会话
|
|
13814
|
+
* @param root 该会话的 CCC 根;`null` ⇒ 非 CCC ⇒ **不动**(宿主的定时器在别处是正常能力)
|
|
13815
|
+
*/
|
|
13816
|
+
function syncHostScheduleToolHiding(agent, root) {
|
|
13817
|
+
if (root === null) return;
|
|
13818
|
+
const sessionId = agent.session.id ?? "global";
|
|
13819
|
+
for (const tool of HOST_SCHEDULE_TOOL_NAMES) {
|
|
13820
|
+
const key = `${sessionId}::${tool}`;
|
|
13821
|
+
if (hostScheduleRestrictions.has(key)) continue;
|
|
13822
|
+
try {
|
|
13823
|
+
hostScheduleRestrictions.set(key, agent.ctx.tools.restrict({ deny: [tool] }));
|
|
13824
|
+
} catch {}
|
|
13825
|
+
}
|
|
13826
|
+
}
|
|
13827
|
+
/** 会话销毁清理(lifecycle 调用;按 `${sessionId}::` 前缀回收) */
|
|
13828
|
+
function forgetHostScheduleToolHiding(sessionId) {
|
|
13829
|
+
const prefix = `${sessionId}::`;
|
|
13830
|
+
for (const [key, dispose] of [...hostScheduleRestrictions]) {
|
|
13831
|
+
if (!key.startsWith(prefix)) continue;
|
|
13832
|
+
try {
|
|
13833
|
+
dispose();
|
|
13834
|
+
} catch {}
|
|
13835
|
+
hostScheduleRestrictions.delete(key);
|
|
13836
|
+
}
|
|
13837
|
+
}
|
|
13838
|
+
/**
|
|
13776
13839
|
* ACC 注册但**默认对所有 CCC 隐藏**的专属工具清单。
|
|
13777
13840
|
*
|
|
13778
13841
|
* 语义(通用机制,不绑定任何具体 CCC):只有在 CCC 的 `.opencode/serenity.json`
|
|
@@ -14877,6 +14940,9 @@ function registerContext(ctx, opts = {}) {
|
|
|
14877
14940
|
try {
|
|
14878
14941
|
syncExclusiveToolsVisibility(agent, root);
|
|
14879
14942
|
} catch {}
|
|
14943
|
+
try {
|
|
14944
|
+
syncHostScheduleToolHiding(agent, root);
|
|
14945
|
+
} catch {}
|
|
14880
14946
|
};
|
|
14881
14947
|
if (opts.seedOnStart ?? true) ctx.on("agent/created", async (payload) => {
|
|
14882
14948
|
try {
|
|
@@ -14903,6 +14969,9 @@ function registerContext(ctx, opts = {}) {
|
|
|
14903
14969
|
try {
|
|
14904
14970
|
syncExclusiveToolsVisibility(agent, root);
|
|
14905
14971
|
} catch {}
|
|
14972
|
+
try {
|
|
14973
|
+
syncHostScheduleToolHiding(agent, root);
|
|
14974
|
+
} catch {}
|
|
14906
14975
|
registerEntrySkillSection(agent, root);
|
|
14907
14976
|
registerTrajectorySkillSection(agent, root);
|
|
14908
14977
|
}
|
|
@@ -23125,6 +23194,9 @@ function cleanupSessionState(sessionId) {
|
|
|
23125
23194
|
try {
|
|
23126
23195
|
forgetNonCccToolVisibility(sessionId);
|
|
23127
23196
|
} catch {}
|
|
23197
|
+
try {
|
|
23198
|
+
forgetHostScheduleToolHiding(sessionId);
|
|
23199
|
+
} catch {}
|
|
23128
23200
|
try {
|
|
23129
23201
|
forgetLogbookCompactionState(sessionId);
|
|
23130
23202
|
} catch {}
|
package/lib/seams/guards.d.ts
CHANGED
|
@@ -72,6 +72,25 @@ export declare function getImBridgeVisibilityDiagnostics(): {
|
|
|
72
72
|
export declare function syncImBridgeVisibility(agent: Agent, root: string): void;
|
|
73
73
|
/** 会话销毁清理(lifecycle 调用;防 per-会话 Map 无界增长——review F-08 同族) */
|
|
74
74
|
export declare function forgetImBridgeVisibility(sessionId: string): void;
|
|
75
|
+
/** 诊断面:本会话已屏蔽的宿主定时器工具(排查"工具为什么不见了") */
|
|
76
|
+
export declare function getHostScheduleHiddenDiagnostics(): {
|
|
77
|
+
hidden: string[];
|
|
78
|
+
};
|
|
79
|
+
/**
|
|
80
|
+
* 在 **CCC 内**屏蔽宿主自带的定时器工具(v1.59.5)。
|
|
81
|
+
*
|
|
82
|
+
* 判据 = **会话是否落在某个 CCC 内**(`root !== null`)——与 `syncCccToolVisibility` 互补:
|
|
83
|
+
* 那个管"不在 CCC ⇒ 隐藏**我们自己的**全部工具",本函数管"**在** CCC ⇒ 隐藏**宿主的**定时器工具"。
|
|
84
|
+
*
|
|
85
|
+
* 幂等;失败不阻断 step(最坏 = 那一个工具仍可见,但那只是"宿主的正常能力没被藏起来",
|
|
86
|
+
* 不会让会话坏掉)。逐个名字独立发 restrict ⇒ 任何一个名字不在册都不会连累其余三个。
|
|
87
|
+
*
|
|
88
|
+
* @param agent 目标会话
|
|
89
|
+
* @param root 该会话的 CCC 根;`null` ⇒ 非 CCC ⇒ **不动**(宿主的定时器在别处是正常能力)
|
|
90
|
+
*/
|
|
91
|
+
export declare function syncHostScheduleToolHiding(agent: Agent, root: string | null): void;
|
|
92
|
+
/** 会话销毁清理(lifecycle 调用;按 `${sessionId}::` 前缀回收) */
|
|
93
|
+
export declare function forgetHostScheduleToolHiding(sessionId: string): void;
|
|
75
94
|
/** 专属工具隐藏诊断(排查"工具为什么不在清单里") */
|
|
76
95
|
export declare function getExclusiveToolsDiagnostics(): {
|
|
77
96
|
hidden: string[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shgroup/dsh-serenity-hooks",
|
|
3
|
-
"version": "1.59.
|
|
3
|
+
"version": "1.59.5",
|
|
4
4
|
"description": "宁静号 ACC harness(Native Cordis 插件)——给 DeepSeek Harness 装一个「AI 工作区」:14 个工具(container_fs/container_trajectory/dashboard/container_git/msm/praxis/ontology/serenity-skill-creator/cheap-worker/localstore/container_admin;另三个 im-bridge/acc-diag/diagram 按配置条件出现)+ 机械约束(安全模式/工作区围墙/密钥守卫/对外输出守卫)+ 工作日志与原地重建 + 网页登录入口/微信桥/子角色/对外问答页/trajectory 唤醒注册表。适配 DSH 0.1.7-rc.1 与 0.2.0-rc.1(双档)。",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|