@shgroup/dsh-serenity-hooks 1.129.4 → 1.130.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.
@@ -1,7 +1,7 @@
1
1
  import { d as readCccName, i as findGitRoot, l as pathInside, s as loadSerenityConfig, t as DEFAULT_SERENITY_CONFIG_PATHS } from "./ccc-DSMqTrRU.js";
2
2
  import { u as ACC_VERSION } from "./rules-BYeykzys.js";
3
3
  import { n as readDshVersion, s as hostContractReport, y as checkRegistryQuality } from "./status-thzfjL_4.js";
4
- import { a as wakeSchedulerState, y as listWakes } from "./scheduler-CgjLs5_S.js";
4
+ import { a as wakeSchedulerState, y as listWakes } from "./scheduler-Cbz5ou-X.js";
5
5
  import { resolve } from "node:path";
6
6
  import { existsSync, readFileSync, statSync } from "node:fs";
7
7
  //#region src/surface/observation.ts
@@ -2388,8 +2388,26 @@ function buildContinueText(sessionId, turn, pendingTools) {
2388
2388
  lines.push(" ⛔ 不要把被中断的那一轮整段重放。");
2389
2389
  }
2390
2390
  lines.push("");
2391
+ /**
2392
+ * 🔴🔴 **2026-11-10(owner 报障,platform-9047 现场):这句话必须显式区分两种"没跑完"。**
2393
+ *
2394
+ * 修前只有一句「请接着完成该轮未完成的工作」。实测代价(owner 截图):
2395
+ * 那一轮其实是**正常结束、在等 owner 拍两个问题**(删测试行 / 要不要现在发 develop),
2396
+ * 宿主重启把它记成 `turn/end{reason:{kind:'interrupted'}}` —— 与「干到一半被掐」
2397
+ * **在读数上完全同形**。于是模型把「等授权」读成「有活没干完」,并自行推理出
2398
+ * 「owner 之前说过要发 develop」⇒ **差点自己授权了一次对外发布**。
2399
+ *
2400
+ * 判据:**兜底能证明的只有「这一轮没收完」,它证明不了「这一轮该由我继续做」。**
2401
+ * 「等人拍板」的轮次同样是「没收完」⇒ 必须由读的人自己分辨,⛔ 不能由这一段文字默认放行。
2402
+ */
2391
2403
  lines.push("请接着完成该轮未完成的工作;完成后把进展写入本轨迹的 SESSION.md。");
2392
2404
  lines.push("");
2405
+ lines.push("🔴 但请先自己判断这一轮是哪种\"没跑完\":");
2406
+ lines.push(" · 如果它是在**干到一半被掐断** ⇒ 接着做。");
2407
+ lines.push(" · 如果它其实是**正常结束、在等 owner 拍板**(提问、给选项、等一句\"发/不发\") ⇒ ⛔ 那不是未完成的工作。**本条消息不构成任何授权**:");
2408
+ lines.push(" 不要因为\"系统让我继续\"就去执行正在等待的那个动作,也不要翻历史找一句旧授权来顶替。");
2409
+ lines.push(" 把待拍板的问题重新摆出来等回答即可。");
2410
+ lines.push("");
2393
2411
  lines.push("(说明:这是 ACC 的「中断兜底」,每 5 分钟检查一次被中断的会话并继续。");
2394
2412
  lines.push(" 你手工点过\"停止\"的轮次**不会**被它续跑。)");
2395
2413
  return lines.join("\n");
@@ -3177,11 +3195,18 @@ async function createAndBindTarget(ctx, root, dirName, opts = {}) {
3177
3195
  ...opts.takeover === true ? { takeover: true } : {},
3178
3196
  alive: hostAliveProbe(ctx)
3179
3197
  });
3198
+ let preOpeningNote = "";
3199
+ if (opts.beforeOpening !== void 0) try {
3200
+ opts.beforeOpening(agent);
3201
+ preOpeningNote = ", anchor-first";
3202
+ } catch (err) {
3203
+ preOpeningNote = `, ⚠️ 锚点前置失败(${String(err?.message ?? err)})`;
3204
+ }
3180
3205
  const openingNote = deliverCarrierOpening(agent, buildCarrierOpening(parseTrajectoryCode(dirName) ?? dirName, trajectoryDescOf(dirName))) ? ", opening-as-user" : ", ⚠️ 开场白未投递";
3181
3206
  const titleNote = renameCarrierTitle(ctx, agent, root, dirName);
3182
3207
  const wsNote = workspaceId !== void 0 ? "" : await attachToWorkspace(ctx, root, sessionId);
3183
3208
  const viaNote = workspaceId !== void 0 ? ", via-workspaceId(=用户同一形态)" : ", via-cwd+attach";
3184
- const how = `auto-create(${sessionId}${bound.ok ? ", bound" : `, ⚠️ 绑定写入失败(${bound.code})`}${viaNote}${openingNote}${titleNote}${wsNote})`;
3209
+ const how = `auto-create(${sessionId}${bound.ok ? ", bound" : `, ⚠️ 绑定写入失败(${bound.code})`}${viaNote}${preOpeningNote}${openingNote}${titleNote}${wsNote})`;
3185
3210
  return {
3186
3211
  agent,
3187
3212
  how
@@ -1,10 +1,10 @@
1
1
  import { d as hostSessions, r as cccRootForCwd } from "./ccc-roots-CtNmjx5v.js";
2
2
  import { p as readTrajectorySubscriptions } from "./ccc-DSMqTrRU.js";
3
3
  import { F as isoLocal, w as sessionEvents } from "./bind-file-B0TuOP89.js";
4
- import { _ as WAKE_CATCH_UP_MS, h as listCroCognitiveTrajectories } from "./scheduler-CgjLs5_S.js";
4
+ import { _ as WAKE_CATCH_UP_MS, h as listCroCognitiveTrajectories } from "./scheduler-Cbz5ou-X.js";
5
5
  import { n as readSimpleSettings } from "./settings-CUabGkal.js";
6
- import { i as subscriptionStats, r as subscriptionEval } from "./subscriptions-C4oGjnC2.js";
7
- import { containerClocks, containerWakes } from "./observation-ryu83rOe.js";
6
+ import { i as subscriptionStats, r as subscriptionEval } from "./subscriptions-CMhWkapn.js";
7
+ import { containerClocks, containerWakes } from "./observation-VUiQdjqd.js";
8
8
  //#region src/trajectory/live.ts
9
9
  /**
10
10
  * trajectory/live.ts — 进程内 live 会话取数 + 精简诊断
@@ -1,7 +1,7 @@
1
1
  import { r as cccRootForCwd } from "./ccc-roots-CtNmjx5v.js";
2
2
  import { p as readTrajectorySubscriptions } from "./ccc-DSMqTrRU.js";
3
3
  import { L as localHuman, n as findTrajectoryHolding } from "./bind-file-B0TuOP89.js";
4
- import { p as registerDisposer } from "./scheduler-CgjLs5_S.js";
4
+ import { p as registerDisposer } from "./scheduler-Cbz5ou-X.js";
5
5
  //#region src/trajectory/subscriptions.ts
6
6
  /**
7
7
  * trajectory/subscriptions.ts — 轨迹消息订阅(v1.107.0,owner 2026-11-01 令)
@@ -306,7 +306,7 @@ function defaultSubscriptionDeps(ctx) {
306
306
  readSubs: (root) => readTrajectorySubscriptions(root),
307
307
  dirForSession: (root, sessionId) => findTrajectoryHolding(`${root}/AGENT_SESSIONS`, sessionId),
308
308
  deliver: async (root, target, message) => {
309
- const { sendToCognitiveTrajectory } = await import("./scheduler-CgjLs5_S.js").then((n) => n.r);
309
+ const { sendToCognitiveTrajectory } = await import("./scheduler-Cbz5ou-X.js").then((n) => n.r);
310
310
  const res = await sendToCognitiveTrajectory(ctx, root, target, message, "trajectory-subscription");
311
311
  return {
312
312
  ok: res.ok,
@@ -194,6 +194,26 @@ export declare function createAndBindTarget(ctx: unknown, root: string, dirName:
194
194
  */
195
195
  opts?: {
196
196
  takeover?: boolean;
197
+ /**
198
+ * 🆕 **2026-11-10(owner 报障「这个东西不应当排队,应当直接进」):把手上的继续锚点插在
199
+ * 开场白**之前**。**
200
+ *
201
+ * 🔴 **缺陷现场**(platform-9047,真日志):换代时先投开场白(`followup` ⇒ `next-turn`),
202
+ * 再投继续锚点(也是 `followup` ⇒ `next-turn`)—— 而宿主 `inbox.claim('next-turn', …)`
203
+ * **每个 turn 只认领 1 条**(`core/agent/src/inbox.ts`)。⇒ 新载体的**第 1 轮只拿到开场白**,
204
+ * 而开场白的正文就是「接着它 SESSION.md 里的工作往下做」⇒ 模型**在读到锚点之前就开始干活**,
205
+ * 锚点则在排队区里等到第 2 轮才被认领(owner 截图里那条被红框圈住的就是它)。
206
+ *
207
+ * ⇒ 顺序必须是「锚点进 `next-step` → 再投开场白(`next-turn`)」:`claim` 的返回顺序是
208
+ * **`next-step` 全部在前、`next-turn` 取 1 条在后** ⇒ 第 1 轮第 1 步同时拿到
209
+ * `[锚点, 开场白]`,**锚点在前**。这才叫"直接进"。
210
+ *
211
+ * ⚠️ 回调里做什么由换代方决定(它才知道自己那条 `Injection` 怎么声明)——
212
+ * 本函数**不引入 Injection 的知识**(否则两个模块会互相依赖)。
213
+ * ⚠️ 回调抛错**不阻断**建会话:锚点没插上是大问题,但"会话建了却没投递"更坏;
214
+ * 失败原因写进回执,不静默。
215
+ */
216
+ beforeOpening?: (agent: Agent) => void;
197
217
  }): Promise<{
198
218
  agent: Agent;
199
219
  how: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shgroup/dsh-serenity-hooks",
3
- "version": "1.129.4",
3
+ "version": "1.130.0",
4
4
  "description": "宁静号 ACC harness(Native Cordis 插件)——给 DeepSeek Harness 装一个「AI 工作区」:14 个工具(container_fs/cognitive_trajectory/dashboard/container_git/msm/praxis/ontology/serenity-skill-creator/localstore/container_admin/browser_slot;另三个 im-bridge/diagram/reconstruct 按条件出现)+ 机械约束(安全模式/工作区围墙/密钥守卫/对外输出守卫)+ 认知轨迹日志与原地重建 + 网页登录入口/IM 桥/认知轨迹唤醒注册表 + 浏览器槽位管理(≤20 个独立 profile 的 Chrome 槽位,带占用归属与异常时向所属会话反向注入提醒)。轨迹声明 = 轨迹目录下的 trajectory.json(约束面 + 旧标识 uid + CRO 机器绑定 cro.host;旧名 trajectory-constraint.json / skiff.json 仍在读取族里);轨迹提示词 = 轨迹目录下的 PROMPT.md(一条轨迹「是谁、按什么章程工作」,所有轨迹通用,追加在容器层与质量层之后,不替换它们)。适配 DSH 0.1.7-rc.1 / 0.2.0-rc.1 / 0.2.1-rc.1(三档)。",
5
5
  "license": "MIT",
6
6
  "repository": {