@shgroup/dsh-serenity-hooks 1.59.2 → 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/host/access.d.ts +15 -2
- package/lib/host/contract.d.ts +8 -0
- package/lib/index.js +158 -15
- package/lib/seams/guards.d.ts +19 -0
- package/package.json +17 -17
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/host/access.d.ts
CHANGED
|
@@ -86,14 +86,27 @@ export declare function hostWeb(ctx: unknown): HostWeb | undefined;
|
|
|
86
86
|
/**
|
|
87
87
|
* `ctx.subagents`(lazy;v1.31.3:cheap-worker foreground 模式的委派正门)。
|
|
88
88
|
*
|
|
89
|
-
*
|
|
90
|
-
*
|
|
89
|
+
* 🔴 **形状对照宿主 `0.2.1-rc.1`(v1.59.3 适配)**:旧成员 `start(name, request)` **已消失**,
|
|
90
|
+
* 改由 `startActivation(spec)` 承担(实名由 `spec.provider` 指定,我们仍传 `'spawn'`)。
|
|
91
|
+
* - 旧:`start(name: string, request: SubagentStartRequest): Promise<SubagentRun>`
|
|
92
|
+
* - 新:`startActivation(spec: SubagentActivationSpec): Promise<SubagentActivation>`(两个重载)
|
|
93
|
+
* 实测依据(**类型面与运行时都核过**,不是只看一边):
|
|
94
|
+
* `_tmp/host-0.2.1-rc.1/…/dsh-subagent/lib/types/index.d.ts:135,145` +
|
|
95
|
+
* 同包 `lib/index.js` 里**只有** `async startActivation(spec)`。
|
|
96
|
+
* ⚠️ **两个方法都保留为可选**:本仓仍声明支持 `0.1.7-rc.1` 双档(`VERIFIED_HOST_BANDS`),
|
|
97
|
+
* 而 0.1.7 那代同样只有 `start` —— **删掉 `start` 会让旧档在类型面说谎**。
|
|
98
|
+
* 调用方按"先新后旧"选用,见 `cheap-worker.ts` 的 `resolveSubagentStarter()`。
|
|
99
|
+
*
|
|
100
|
+
* 本模块只做形状收口;语义与错误处理归调用方。
|
|
91
101
|
*
|
|
92
102
|
* 注(v1.31.4):本服务**不在** dsp 的 `inject` 列表内,因此走 `hostInjected` 的
|
|
93
103
|
* 回落分支(`ctx.get`)——见 `hostInjected` 的 v1.31.4 说明与真实 cordis 用例。
|
|
94
104
|
*/
|
|
95
105
|
interface HostSubagents {
|
|
106
|
+
/** 宿主 `0.1.7-rc.*` / `0.2.0-rc.*`(旧形态;0.2.1-rc.1 起已移除) */
|
|
96
107
|
start?: (name: string, request: unknown) => Promise<unknown>;
|
|
108
|
+
/** 宿主 `0.2.1-rc.1+`(新形态;`spec.provider` 即旧 `name`) */
|
|
109
|
+
startActivation?: (spec: unknown) => Promise<unknown>;
|
|
97
110
|
}
|
|
98
111
|
export declare function hostSubagents(ctx: unknown): HostSubagents | undefined;
|
|
99
112
|
/**
|
package/lib/host/contract.d.ts
CHANGED
|
@@ -82,6 +82,14 @@ export declare const HOST_EVENTS: readonly HostEventContract[];
|
|
|
82
82
|
* - ⇒ 双档是**唯一不把本机宿主堵死的写法**(两档在真 semver 下均 PASS)。
|
|
83
83
|
* 档上界取 `<0.2.0` / `<0.3.0`(即 `^0.2.0-rc.1` 的 caret 上界):第二档同时覆盖
|
|
84
84
|
* `0.2.0` 正式版与后续 `0.2.0-rc.N`。
|
|
85
|
+
*
|
|
86
|
+
* 🆕 **第三档 `^0.2.1-rc.1`(v1.59.3 适配,2026-10-17)** —— 为什么非加不可:
|
|
87
|
+
* - npm 的 `^0.2.0-rc.1` 对**预发布**只放行**同一 `major.minor.patch`** 的 prerelease
|
|
88
|
+
* ⇒ **`0.2.1-rc.1` 不满足它**(patch 位不同)⇒ 宿主门会**整包拒绝安装**(D98 同族)。
|
|
89
|
+
* - 而第二档的 `ceiling: '0.3.0'` 本来就"包含" 0.2.1 —— 那是**我们自己的手写比较器**的语义;
|
|
90
|
+
* 两个判据(真 semver 门 vs 手写区间)在这里**给出相反答案**,故必须把第三档显式写出来,
|
|
91
|
+
* 让**派生串**({@link REQUIRED_HOST_RANGE})里真的出现 `^0.2.1-rc.1`。
|
|
92
|
+
* ⚠️ **加档不是收窄**:前两档原样保留(0.1.7 / 0.2.0 两代仍被声明支持)。
|
|
85
93
|
*/
|
|
86
94
|
export declare const VERIFIED_HOST_BANDS: readonly {
|
|
87
95
|
floor: string;
|
package/lib/index.js
CHANGED
|
@@ -9178,12 +9178,68 @@ function parseForegroundJobs(raw) {
|
|
|
9178
9178
|
}
|
|
9179
9179
|
return jobs;
|
|
9180
9180
|
}
|
|
9181
|
+
/**
|
|
9182
|
+
* 选出一个可用的"启动子 agent"函数(**先新后旧**)。
|
|
9183
|
+
*
|
|
9184
|
+
* 🔴 **为什么需要这一层**(v1.59.3 适配,2026-10-17):
|
|
9185
|
+
* 宿主 `0.2.1-rc.1` **移除了** `SubagentRuntime.start(name, request)`,改由
|
|
9186
|
+
* `startActivation(spec)` 承担;而 `0.1.7-rc.*` / `0.2.0-rc.*` **只有** `start`。
|
|
9187
|
+
* 本仓仍声明支持双档(`VERIFIED_HOST_BANDS`)⇒ **不能只留一边**。
|
|
9188
|
+
*
|
|
9189
|
+
* 形状差异(逐字取自两端 `.d.ts`):
|
|
9190
|
+
* · 旧:`start('spawn', {label?, prompt, parent, signal, agentOptions, toolFilter})`
|
|
9191
|
+
* · 新:`startActivation({provider:'spawn', label, request:{prompt, parent, agentOptions}, signal, delivery})`
|
|
9192
|
+
* —— 注意 `label` 在新 spec 里是**必填**(`readonly label: string`),故这里补默认值。
|
|
9193
|
+
*
|
|
9194
|
+
* @returns 一个统一签名的启动器;两者都不存在 ⇒ `undefined`(由调用方报**可诊断**的错)
|
|
9195
|
+
*/
|
|
9196
|
+
function resolveSubagentStarter(subagents) {
|
|
9197
|
+
if (typeof subagents.startActivation === "function") {
|
|
9198
|
+
const fn = subagents.startActivation;
|
|
9199
|
+
return (req) => fn.call(subagents, {
|
|
9200
|
+
provider: "spawn",
|
|
9201
|
+
label: req.label,
|
|
9202
|
+
request: {
|
|
9203
|
+
prompt: req.prompt,
|
|
9204
|
+
parent: req.parent,
|
|
9205
|
+
agentOptions: req.agentOptions,
|
|
9206
|
+
...req.cwd === void 0 ? {} : { cwd: req.cwd }
|
|
9207
|
+
},
|
|
9208
|
+
signal: req.signal,
|
|
9209
|
+
delivery: "caller"
|
|
9210
|
+
});
|
|
9211
|
+
}
|
|
9212
|
+
if (typeof subagents.start === "function") {
|
|
9213
|
+
const fn = subagents.start;
|
|
9214
|
+
return (req) => fn("spawn", {
|
|
9215
|
+
label: req.label,
|
|
9216
|
+
prompt: req.prompt,
|
|
9217
|
+
parent: req.parent,
|
|
9218
|
+
signal: req.signal,
|
|
9219
|
+
agentOptions: req.agentOptions,
|
|
9220
|
+
toolFilter: { deny: ["cheap-worker"] },
|
|
9221
|
+
...req.cwd === void 0 ? {} : { cwd: req.cwd }
|
|
9222
|
+
});
|
|
9223
|
+
}
|
|
9224
|
+
}
|
|
9181
9225
|
/** 拼接 SubagentResult.output(ContentBlock[])中的文本块 */
|
|
9182
9226
|
function subagentOutputText(output) {
|
|
9183
9227
|
if (!Array.isArray(output)) return "";
|
|
9184
9228
|
return output.filter((b) => typeof b === "object" && b !== null).filter((b) => b.type === "text" && typeof b.text === "string").map((b) => b.text).join("");
|
|
9185
9229
|
}
|
|
9186
9230
|
/**
|
|
9231
|
+
* 任务首行 → 子会话 label(截断)。
|
|
9232
|
+
*
|
|
9233
|
+
* 🔴 为什么必须有一个:新宿主 `SubagentActivationSpec.label` 是**必填**(`readonly label: string`),
|
|
9234
|
+
* 而我们对外把 `label` 当可选参数 ⇒ 缺省时必须自己造一个,否则 spec 不合法。
|
|
9235
|
+
* 取任务首行而不是空串:子会话在列表里要能被人认出来(空串等于没有标识)。
|
|
9236
|
+
*/
|
|
9237
|
+
function firstLineLabel(task) {
|
|
9238
|
+
const line = task.split(/\r?\n/)[0]?.trim() ?? "";
|
|
9239
|
+
const clipped = line.length > 60 ? `${line.slice(0, 60)}…` : line;
|
|
9240
|
+
return clipped === "" ? "task" : clipped;
|
|
9241
|
+
}
|
|
9242
|
+
/**
|
|
9187
9243
|
* providerPreflight — 在**创建任何 worker 之前**判定「本机有没有该 provider 的 adapter」。
|
|
9188
9244
|
*
|
|
9189
9245
|
* 返回**可执行**的错误文本;`null` = 可用,**或无法取证**(服务缺失 / 形状不符 / 读取抛错
|
|
@@ -9231,7 +9287,8 @@ async function runForegroundJob(ctx, opts) {
|
|
|
9231
9287
|
const { task, label, model, models, parent, signal } = opts;
|
|
9232
9288
|
requireWhitelistedModel(model, models);
|
|
9233
9289
|
const subagents = hostSubagents(ctx);
|
|
9234
|
-
|
|
9290
|
+
const starter = subagents === void 0 ? void 0 : resolveSubagentStarter(subagents);
|
|
9291
|
+
if (starter === void 0) throw new Error("cheap-worker: host subagents service unavailable — neither ctx.subagents.startActivation (0.2.1-rc.1+) nor ctx.subagents.start (0.1.7-rc.* / 0.2.0-rc.*) yielded a starter function. Check `dashboard health` (host-contract section, service \"subagents\").");
|
|
9235
9292
|
const preflight = providerPreflight(ctx, model);
|
|
9236
9293
|
if (preflight !== null) return {
|
|
9237
9294
|
mode: "foreground",
|
|
@@ -9242,8 +9299,8 @@ async function runForegroundJob(ctx, opts) {
|
|
|
9242
9299
|
diagnostic: preflight
|
|
9243
9300
|
};
|
|
9244
9301
|
const { provider, model: modelName } = splitModel(model);
|
|
9245
|
-
const run = await
|
|
9246
|
-
|
|
9302
|
+
const run = await starter({
|
|
9303
|
+
label: label ?? firstLineLabel(task),
|
|
9247
9304
|
prompt: [{
|
|
9248
9305
|
type: "text",
|
|
9249
9306
|
text: task
|
|
@@ -9253,8 +9310,7 @@ async function runForegroundJob(ctx, opts) {
|
|
|
9253
9310
|
agentOptions: {
|
|
9254
9311
|
...provider === void 0 ? {} : { provider },
|
|
9255
9312
|
model: modelName
|
|
9256
|
-
}
|
|
9257
|
-
toolFilter: { deny: ["cheap-worker"] }
|
|
9313
|
+
}
|
|
9258
9314
|
});
|
|
9259
9315
|
try {
|
|
9260
9316
|
const result = run.result === void 0 ? {} : await run.result;
|
|
@@ -9265,7 +9321,7 @@ async function runForegroundJob(ctx, opts) {
|
|
|
9265
9321
|
model,
|
|
9266
9322
|
stopReason,
|
|
9267
9323
|
output: subagentOutputText(result.output),
|
|
9268
|
-
...typeof run.id === "string" ? { childId: run.id } : {},
|
|
9324
|
+
...typeof (run.childId ?? run.id) === "string" ? { childId: run.childId ?? run.id } : {},
|
|
9269
9325
|
...typeof result.diagnostic === "string" && result.diagnostic !== "" ? { diagnostic: result.diagnostic } : {}
|
|
9270
9326
|
};
|
|
9271
9327
|
} finally {
|
|
@@ -9332,7 +9388,7 @@ function createCheapWorkerTool(ctx) {
|
|
|
9332
9388
|
done,
|
|
9333
9389
|
jobs: results,
|
|
9334
9390
|
usage: {
|
|
9335
|
-
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}.`,
|
|
9336
9392
|
model: "NOT selectable per call — resolved from the CCC config cheap-worker.models (cheap-worker.defaultModel, else models[0])",
|
|
9337
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)"
|
|
9338
9394
|
}
|
|
@@ -9350,7 +9406,7 @@ function createCheapWorkerTool(ctx) {
|
|
|
9350
9406
|
return {
|
|
9351
9407
|
...res,
|
|
9352
9408
|
usage: {
|
|
9353
|
-
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.",
|
|
9354
9410
|
model: "NOT selectable per call — resolved from the CCC config cheap-worker.models (cheap-worker.defaultModel, else models[0])",
|
|
9355
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`
|
|
9356
9412
|
}
|
|
@@ -13717,6 +13773,69 @@ function forgetImBridgeVisibility(sessionId) {
|
|
|
13717
13773
|
imBridgeRestrictions.delete(sessionId);
|
|
13718
13774
|
}
|
|
13719
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
|
+
/**
|
|
13720
13839
|
* ACC 注册但**默认对所有 CCC 隐藏**的专属工具清单。
|
|
13721
13840
|
*
|
|
13722
13841
|
* 语义(通用机制,不绑定任何具体 CCC):只有在 CCC 的 `.opencode/serenity.json`
|
|
@@ -14821,6 +14940,9 @@ function registerContext(ctx, opts = {}) {
|
|
|
14821
14940
|
try {
|
|
14822
14941
|
syncExclusiveToolsVisibility(agent, root);
|
|
14823
14942
|
} catch {}
|
|
14943
|
+
try {
|
|
14944
|
+
syncHostScheduleToolHiding(agent, root);
|
|
14945
|
+
} catch {}
|
|
14824
14946
|
};
|
|
14825
14947
|
if (opts.seedOnStart ?? true) ctx.on("agent/created", async (payload) => {
|
|
14826
14948
|
try {
|
|
@@ -14847,6 +14969,9 @@ function registerContext(ctx, opts = {}) {
|
|
|
14847
14969
|
try {
|
|
14848
14970
|
syncExclusiveToolsVisibility(agent, root);
|
|
14849
14971
|
} catch {}
|
|
14972
|
+
try {
|
|
14973
|
+
syncHostScheduleToolHiding(agent, root);
|
|
14974
|
+
} catch {}
|
|
14850
14975
|
registerEntrySkillSection(agent, root);
|
|
14851
14976
|
registerTrajectorySkillSection(agent, root);
|
|
14852
14977
|
}
|
|
@@ -16124,14 +16249,29 @@ const HOST_SERVICES = [
|
|
|
16124
16249
|
* - ⇒ 双档是**唯一不把本机宿主堵死的写法**(两档在真 semver 下均 PASS)。
|
|
16125
16250
|
* 档上界取 `<0.2.0` / `<0.3.0`(即 `^0.2.0-rc.1` 的 caret 上界):第二档同时覆盖
|
|
16126
16251
|
* `0.2.0` 正式版与后续 `0.2.0-rc.N`。
|
|
16252
|
+
*
|
|
16253
|
+
* 🆕 **第三档 `^0.2.1-rc.1`(v1.59.3 适配,2026-10-17)** —— 为什么非加不可:
|
|
16254
|
+
* - npm 的 `^0.2.0-rc.1` 对**预发布**只放行**同一 `major.minor.patch`** 的 prerelease
|
|
16255
|
+
* ⇒ **`0.2.1-rc.1` 不满足它**(patch 位不同)⇒ 宿主门会**整包拒绝安装**(D98 同族)。
|
|
16256
|
+
* - 而第二档的 `ceiling: '0.3.0'` 本来就"包含" 0.2.1 —— 那是**我们自己的手写比较器**的语义;
|
|
16257
|
+
* 两个判据(真 semver 门 vs 手写区间)在这里**给出相反答案**,故必须把第三档显式写出来,
|
|
16258
|
+
* 让**派生串**({@link REQUIRED_HOST_RANGE})里真的出现 `^0.2.1-rc.1`。
|
|
16259
|
+
* ⚠️ **加档不是收窄**:前两档原样保留(0.1.7 / 0.2.0 两代仍被声明支持)。
|
|
16127
16260
|
*/
|
|
16128
|
-
const VERIFIED_HOST_BANDS = [
|
|
16129
|
-
|
|
16130
|
-
|
|
16131
|
-
|
|
16132
|
-
|
|
16133
|
-
|
|
16134
|
-
|
|
16261
|
+
const VERIFIED_HOST_BANDS = [
|
|
16262
|
+
{
|
|
16263
|
+
floor: "0.1.7-rc.1",
|
|
16264
|
+
ceiling: "0.2.0"
|
|
16265
|
+
},
|
|
16266
|
+
{
|
|
16267
|
+
floor: "0.2.0-rc.1",
|
|
16268
|
+
ceiling: "0.3.0"
|
|
16269
|
+
},
|
|
16270
|
+
{
|
|
16271
|
+
floor: "0.2.1-rc.1",
|
|
16272
|
+
ceiling: "0.3.0"
|
|
16273
|
+
}
|
|
16274
|
+
];
|
|
16135
16275
|
/**
|
|
16136
16276
|
* 与 `package.json` 的 `peerDependencies` **逐字同串**的宿主版本范围(由 {@link VERIFIED_HOST_BANDS} 派生)。
|
|
16137
16277
|
*
|
|
@@ -23054,6 +23194,9 @@ function cleanupSessionState(sessionId) {
|
|
|
23054
23194
|
try {
|
|
23055
23195
|
forgetNonCccToolVisibility(sessionId);
|
|
23056
23196
|
} catch {}
|
|
23197
|
+
try {
|
|
23198
|
+
forgetHostScheduleToolHiding(sessionId);
|
|
23199
|
+
} catch {}
|
|
23057
23200
|
try {
|
|
23058
23201
|
forgetLogbookCompactionState(sessionId);
|
|
23059
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": {
|
|
@@ -67,22 +67,22 @@
|
|
|
67
67
|
},
|
|
68
68
|
"peerDependencies": {
|
|
69
69
|
"@deepseek-ai/cordis": "^4.0.4",
|
|
70
|
-
"@deepseek-ai/dsh-acp": "^0.1.7-rc.1 || ^0.2.0-rc.1",
|
|
71
|
-
"@deepseek-ai/dsh-agent": "^0.1.7-rc.1 || ^0.2.0-rc.1",
|
|
72
|
-
"@deepseek-ai/dsh-agent-loop": "^0.1.7-rc.1 || ^0.2.0-rc.1",
|
|
73
|
-
"@deepseek-ai/dsh-agent-preset-registry": "^0.1.7-rc.1 || ^0.2.0-rc.1",
|
|
74
|
-
"@deepseek-ai/dsh-compaction": "^0.1.7-rc.1 || ^0.2.0-rc.1",
|
|
75
|
-
"@deepseek-ai/dsh-host-webserver": "^0.1.7-rc.1 || ^0.2.0-rc.1",
|
|
76
|
-
"@deepseek-ai/dsh-llm": "^0.1.7-rc.1 || ^0.2.0-rc.1",
|
|
77
|
-
"@deepseek-ai/dsh-session": "^0.1.7-rc.1 || ^0.2.0-rc.1",
|
|
78
|
-
"@deepseek-ai/dsh-session-title": "^0.1.7-rc.1 || ^0.2.0-rc.1",
|
|
79
|
-
"@deepseek-ai/dsh-shell": "^0.1.7-rc.1 || ^0.2.0-rc.1",
|
|
80
|
-
"@deepseek-ai/dsh-shell-env": "^0.1.7-rc.1 || ^0.2.0-rc.1",
|
|
81
|
-
"@deepseek-ai/dsh-skill": "^0.1.7-rc.1 || ^0.2.0-rc.1",
|
|
82
|
-
"@deepseek-ai/dsh-system-prompt": "^0.1.7-rc.1 || ^0.2.0-rc.1",
|
|
83
|
-
"@deepseek-ai/dsh-tools": "^0.1.7-rc.1 || ^0.2.0-rc.1",
|
|
84
|
-
"@deepseek-ai/dsh-web": "^0.1.7-rc.1 || ^0.2.0-rc.1",
|
|
85
|
-
"@deepseek-ai/dsh-web-fetch-http": "^0.1.7-rc.1 || ^0.2.0-rc.1",
|
|
70
|
+
"@deepseek-ai/dsh-acp": "^0.1.7-rc.1 || ^0.2.0-rc.1 || ^0.2.1-rc.1",
|
|
71
|
+
"@deepseek-ai/dsh-agent": "^0.1.7-rc.1 || ^0.2.0-rc.1 || ^0.2.1-rc.1",
|
|
72
|
+
"@deepseek-ai/dsh-agent-loop": "^0.1.7-rc.1 || ^0.2.0-rc.1 || ^0.2.1-rc.1",
|
|
73
|
+
"@deepseek-ai/dsh-agent-preset-registry": "^0.1.7-rc.1 || ^0.2.0-rc.1 || ^0.2.1-rc.1",
|
|
74
|
+
"@deepseek-ai/dsh-compaction": "^0.1.7-rc.1 || ^0.2.0-rc.1 || ^0.2.1-rc.1",
|
|
75
|
+
"@deepseek-ai/dsh-host-webserver": "^0.1.7-rc.1 || ^0.2.0-rc.1 || ^0.2.1-rc.1",
|
|
76
|
+
"@deepseek-ai/dsh-llm": "^0.1.7-rc.1 || ^0.2.0-rc.1 || ^0.2.1-rc.1",
|
|
77
|
+
"@deepseek-ai/dsh-session": "^0.1.7-rc.1 || ^0.2.0-rc.1 || ^0.2.1-rc.1",
|
|
78
|
+
"@deepseek-ai/dsh-session-title": "^0.1.7-rc.1 || ^0.2.0-rc.1 || ^0.2.1-rc.1",
|
|
79
|
+
"@deepseek-ai/dsh-shell": "^0.1.7-rc.1 || ^0.2.0-rc.1 || ^0.2.1-rc.1",
|
|
80
|
+
"@deepseek-ai/dsh-shell-env": "^0.1.7-rc.1 || ^0.2.0-rc.1 || ^0.2.1-rc.1",
|
|
81
|
+
"@deepseek-ai/dsh-skill": "^0.1.7-rc.1 || ^0.2.0-rc.1 || ^0.2.1-rc.1",
|
|
82
|
+
"@deepseek-ai/dsh-system-prompt": "^0.1.7-rc.1 || ^0.2.0-rc.1 || ^0.2.1-rc.1",
|
|
83
|
+
"@deepseek-ai/dsh-tools": "^0.1.7-rc.1 || ^0.2.0-rc.1 || ^0.2.1-rc.1",
|
|
84
|
+
"@deepseek-ai/dsh-web": "^0.1.7-rc.1 || ^0.2.0-rc.1 || ^0.2.1-rc.1",
|
|
85
|
+
"@deepseek-ai/dsh-web-fetch-http": "^0.1.7-rc.1 || ^0.2.0-rc.1 || ^0.2.1-rc.1",
|
|
86
86
|
"@deepseek-ai/schemastery": "^3.18.4",
|
|
87
87
|
"cordis": "^4.0.0-rc.7"
|
|
88
88
|
},
|