@shgroup/dsh-serenity-hooks 1.120.0 → 1.122.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/lib/invariant.js CHANGED
@@ -82,6 +82,33 @@ function assertManifestProse(manifestPath, readmePaths) {
82
82
  const absent = tools.filter((t) => !s.text.includes(t));
83
83
  if (absent.length) issues.push(`${s.where} 的名单缺 ${absent.length} 项:${absent.join(", ")}(防"数对了、名单漏了")`);
84
84
  }
85
+ const countCn = cnNumberOf(n);
86
+ const condCn = cnNumberOf(3);
87
+ for (const p of readmePaths) {
88
+ if (!existsSync(p)) {
89
+ issues.push(`README 不存在:${p}`);
90
+ continue;
91
+ }
92
+ const m = readFileSync(p, "utf-8").match(/^###\s*3\.1\s*(\S+?)个工具(?:(其中(\S+?)个按条件出现))?/m);
93
+ if (!m) {
94
+ issues.push(`${p} 里找不到 §3.1 的「…个工具」标题(形态已变 ⇒ 钉子也要跟着改)`);
95
+ continue;
96
+ }
97
+ if (m[1] !== countCn) issues.push(`${p} 的 §3.1 标题写「${m[1]}个工具」,应为「${countCn}个工具」(工具数已 ${n})`);
98
+ if (m[2] !== void 0 && m[2] !== condCn) issues.push(`${p} 的 §3.1 标题写「其中${m[2]}个按条件出现」,应为「其中${condCn}个按条件出现」(条件工具数已 3)`);
99
+ }
100
+ return issues;
101
+ }
102
+ /**
103
+ * 阿拉伯数字 → 中文数字(README §3.1 标题用;只覆盖到 29,够 README 用)。
104
+ *
105
+ * 🔴 抽成函数是**必须**的,不是洁癖:`CONDITIONAL_TOOL_COUNT` 是**字面量类型**,
106
+ * 就地写三元时 TS 会在第一个分支之后把类型缩窄成 `never` ⇒ `=== 20` 处报
107
+ * "types '3' and '20' have no overlap"(TS2367)。那**不是逻辑错**,是窄化造成的假报,
108
+ * 而"给假报让路"最简单的做法就是放宽类型 —— ⛔ 那会连带丢掉真正的越界保护。
109
+ * 走函数调用 ⇒ 入参类型是 `number`,窄化不发生,判据与顺序都不变。
110
+ */
111
+ function cnNumberOf(n) {
85
112
  const cn = [
86
113
  "零",
87
114
  "一",
@@ -95,20 +122,9 @@ function assertManifestProse(manifestPath, readmePaths) {
95
122
  "九",
96
123
  "十"
97
124
  ];
98
- const countCn = n <= 10 ? cn[n] : n < 20 ? `十${cn[n - 10]}` : `二十${n === 20 ? "" : cn[n - 20]}`;
99
- for (const p of readmePaths) {
100
- if (!existsSync(p)) {
101
- issues.push(`README 不存在:${p}`);
102
- continue;
103
- }
104
- const m = readFileSync(p, "utf-8").match(/^###\s*3\.1\s*(\S+?)个工具/m);
105
- if (!m) {
106
- issues.push(`${p} 里找不到 §3.1 的「…个工具」标题(形态已变 ⇒ 钉子也要跟着改)`);
107
- continue;
108
- }
109
- if (m[1] !== countCn) issues.push(`${p} 的 §3.1 标题写「${m[1]}个工具」,应为「${countCn}个工具」(工具数已 ${n})`);
110
- }
111
- return issues;
125
+ if (n <= 10) return cn[n] ?? String(n);
126
+ if (n < 20) return `十${cn[n - 10] ?? ""}`;
127
+ return `二十${n === 20 ? "" : cn[n - 20] ?? ""}`;
112
128
  }
113
129
  /**
114
130
  * 包级不变量:本插件注册的工具集合(与 dsh.plugin.json contributes.tools 一致)。
@@ -147,9 +163,10 @@ const REGISTERED_TOOLS = [
147
163
  "localstore",
148
164
  "container_admin",
149
165
  "im-bridge",
150
- "diagram"
166
+ "diagram",
167
+ "reconstruct"
151
168
  ];
152
169
  /** 条件出现的工具数(`REGISTERED_TOOLS` 的**末段**;`assertManifestProse` 用) */
153
- const CONDITIONAL_TOOL_COUNT = 2;
170
+ const CONDITIONAL_TOOL_COUNT = 3;
154
171
  //#endregion
155
172
  export { CONDITIONAL_TOOL_COUNT, REGISTERED_TOOLS, assertManifestProse, verifyToolConsistency };
@@ -58,6 +58,6 @@ export declare function assertManifestProse(manifestPath: string, readmePaths: r
58
58
  * `review`(C 档,调引擎 `compliance`)/`index`(调 P1 的生成器)/`status` ⇒ **14**。
59
59
  * 同规格:**条件可见与否不影响这里列它**(本常量 = "插件**具备**的工具面")。
60
60
  */
61
- export declare const REGISTERED_TOOLS: readonly ["container_fs", "cognitive_trajectory", "dashboard", "container_git", "msm", "praxis", "ontology", "serenity-skill-creator", "localstore", "container_admin", "im-bridge", "diagram"];
61
+ export declare const REGISTERED_TOOLS: readonly ["container_fs", "cognitive_trajectory", "dashboard", "container_git", "msm", "praxis", "ontology", "serenity-skill-creator", "localstore", "container_admin", "im-bridge", "diagram", "reconstruct"];
62
62
  /** 条件出现的工具数(`REGISTERED_TOOLS` 的**末段**;`assertManifestProse` 用) */
63
- export declare const CONDITIONAL_TOOL_COUNT = 2;
63
+ export declare const CONDITIONAL_TOOL_COUNT = 3;
@@ -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-x94FCzOv.js";
2
2
  import { u as ACC_VERSION } from "./rules-DKlpuFN_.js";
3
- import { i as readDshVersion, t as hostContractReport, v as checkRegistryQuality } from "./contract-C-UR4xdI.js";
4
- import { i as wakeSchedulerState, v as listWakes } from "./scheduler-CUPz7geH.js";
3
+ import { n as readDshVersion, s as hostContractReport, y as checkRegistryQuality } from "./status-DU4k3Wqe.js";
4
+ import { a as wakeSchedulerState, y as listWakes } from "./scheduler-CA-7xvTS.js";
5
5
  import { resolve } from "node:path";
6
6
  import { existsSync, readFileSync, statSync } from "node:fs";
7
7
  //#region src/surface/observation.ts
@@ -3,8 +3,8 @@ import { c as hostAgents, o as listCccs, u as hostService } from "./ccc-roots-Cs
3
3
  import { _ as resolveInside } from "./ccc-x94FCzOv.js";
4
4
  import { F as isoLocal, L as localHuman, P as readTrajectoryFile, R as localIdStamp, T as sessionsRoot, b as parseTrajectoryCode, j as TRAJECTORY_FILENAME, k as trajectoryDescOf, p as findSession, v as namingTitleFor } from "./bind-file-B0TuOP89.js";
5
5
  import { c as carrierState, i as toMessage, n as deliver, r as makeInjection, s as appendBound, t as assertInjection, u as listBoundSessionIds } from "./injection-B5jZxemg.js";
6
- import { i as sessionsRootDir, n as findSessionLog, r as hasSessionLogById } from "./cleanup-CPl1SSaK.js";
7
- import { n as readSimpleSettings } from "./settings-DibHCfEU.js";
6
+ import { i as sessionsRootDir, n as findSessionLog } from "./cleanup-CPl1SSaK.js";
7
+ import { i as hostAliveProbe, n as readSimpleSettings } from "./settings-B_FAdsxN.js";
8
8
  import { basename, dirname, join } from "node:path";
9
9
  import { closeSync, existsSync, mkdirSync, openSync, readFileSync, readSync, readdirSync, realpathSync, renameSync, statSync, writeFileSync } from "node:fs";
10
10
  import { spawn } from "node:child_process";
@@ -499,102 +499,6 @@ function deliverCarrierOpening(agent, text) {
499
499
  }
500
500
  }
501
501
  //#endregion
502
- //#region src/trajectory/alive.ts
503
- /**
504
- * trajectory/alive.ts — **"这个 dsh 会话还活着吗"的唯一判据**(owner 2026-10-20 裁决)
505
- *
506
- * ## owner 的原话(本模块的全部设计依据)
507
- *
508
- * > 「死应该包含归档判断;只有 ① 或者 ②且不在归档集 才算活」
509
- * > 「use 只要被调用了,可以无条件覆盖绑定到当前会话(这说明当前会话肯定活着啊)」
510
- *
511
- * ## 为什么必须收成一个判据(在此之前有三个互不一致的判据)
512
- *
513
- * | # | 判据 | 旧实现位置 | 单独使用时的漏洞 |
514
- * |---|---|---|---|
515
- * | ① | 进程内 loaded agent | `hostAgents(ctx).get(id)` | 冷会话全判死 |
516
- * | ② | 磁盘上有会话日志 | `hasSessionLogById()` | **归档后日志逐字节不动** ⇒ 归档会话判活 |
517
- * | ③ | 宿主归档集 | `workspaceRegistry.archivedSessionIds` | 旧 dsp **零引用**(整个仓库 0 处) |
518
- *
519
- * 宿主的归档语义是**只往集合里加一个 id、不动日志**(`dsh-workspace` 的
520
- * `archiveSession` 注释:「Archiving never touches workspace accounting」)。
521
- * ⇒ 只问 ② 的实现在归档上**必然判错**,而那个错误没有任何机械信号。
522
- *
523
- * ## 判据(owner 给定,逐字实现)
524
- *
525
- * ```text
526
- * 活 ⟺ ① (进程内 loaded ⇒ 一定在)
527
- * ∨ (② ∧ 不在归档集) (日志在、且没人把它归档掉)
528
- * ```
529
- *
530
- * 🔴 **一处对原话的收紧(必须说出来,不许默默改)**:owner 的 ① 未附加"不在归档集",
531
- * 而本模块把**归档判定排在最前** —— 即 `归档 ∧ live ⇒ 判死`。理由:归档是**人对这条会话
532
- * 的处置声明**(宿主会把它从所有分组面隐藏),若仍被当成载体,唤醒调度器会去驱动一条
533
- * **使用者以为已经收起来**的会话。⚠️ 与字面规则的差异仅此一格;`use` 不受影响
534
- * (见下方 §use 逃生门),因此真需要复活一条已归档会话时**仍然有受支持的路**。
535
- *
536
- * ## 🔴 `use` 的逃生门(owner 第二条,写在调用点)
537
- *
538
- * **`use` 不查存活**:它被调用这件事本身证明**当前会话活着**(本模块的被测对象是
539
- * "别人写的那个 id",而 `use` 手里拿的是**自己**)。⇒ `use` 走无条件覆盖
540
- * (`claimBinding` 的 `takeover`),因此**判据再严也不会把一条轨迹锁死**。
541
- * 这条逃生门是判据可以取严的前提,两者必须一起存在。
542
- *
543
- * ## 依赖纪律
544
- *
545
- * 纯判据 `isSessionAlive` 零依赖、可单测;宿主面只在 `hostAliveProbe` 里,
546
- * 且**不抛错**(服务缺失 ⇒ 该维度作废,而不是让 ACC 工具整块失败)。
547
- */
548
- /** 宿主侧的归档集读取(不可用 ⇒ 空集 = 该维度作废,**不是**把所有会话判死) */
549
- function archivedIdsOf(ctx) {
550
- try {
551
- const ids = hostService(ctx, "workspaceRegistry")?.archivedSessionIds;
552
- return new Set(Array.isArray(ids) ? ids : []);
553
- } catch {
554
- return /* @__PURE__ */ new Set();
555
- }
556
- }
557
- /**
558
- * **宿主面的判活探针**(`(sessionId) => boolean`)——所有需要"这条会话还活着吗"的
559
- * 生产代码都应当用这一个,不要自己拼 `agents.get` + `hasSessionLogById`。
560
- *
561
- * 语义 = {@link isSessionAlive},其中:
562
- * · `liveIds` 因为宿主只给 `get(id)` 而**按 id 逐次问**(不是集合);
563
- * · `archivedIds` 在**首次调用时**取一次快照并在闭包内复用(每 tick 一个探针,
564
- * 归档集在一个 tick 内不变)—— 避免为每条轨迹重复读存储域。
565
- *
566
- * ⚠️ **快照的代价**:同一探针内若有人中途归档了某会话,本探针直到下次新建才看见。
567
- * 调度器是每 tick 新建一个探针(见 `wake/scheduler.ts`),故实际窗口 ≤1 tick。
568
- *
569
- * @param ctx 插件上下文(取 `agents` 与 `workspaceRegistry`)
570
- * @returns 探针;**永不抛**
571
- */
572
- function hostAliveProbe(ctx) {
573
- let archived;
574
- const archivedOnce = () => archived ??= archivedIdsOf(ctx);
575
- return (sessionId) => {
576
- if (typeof sessionId !== "string" || sessionId === "") return false;
577
- if (archivedOnce().has(sessionId)) return false;
578
- try {
579
- if (hostAgents(ctx)?.get?.(sessionId)) return true;
580
- } catch {}
581
- try {
582
- return hasSessionLogById(sessionsRootDir(), sessionId);
583
- } catch {
584
- return true;
585
- }
586
- };
587
- }
588
- /**
589
- * 判据只有**两个**出口,别再开第三个:
590
- * · {@link isSessionAlive} —— 纯判据(给定事实),单测的靶子;
591
- * · {@link hostAliveProbe} —— 生产入口(自己去宿主与磁盘取事实)。
592
- *
593
- * ⚠️ 曾有一个 `aliveFactsFor`(把探针摊平成 `SessionAliveFacts`),**全仓零调用点**,
594
- * 已删除 —— 留一个"看起来有用、实际无人调用"的导出,会让下一个人以为存在第二条判活路径
595
- * (本仓同族教训:`cheapWorkerPresetInheritance` 全仓零调用点 ⇒ 接线断了却看不出来)。
596
- */
597
- //#endregion
598
502
  //#region src/cro/core.ts
599
503
  /**
600
504
  * cro/core.ts — CRO(Continuous Re-Occurrence · 持续再发生)机制层(S142 §7.8,2026-09-19)
@@ -2871,6 +2775,7 @@ var scheduler_exports = /* @__PURE__ */ __exportAll({
2871
2775
  buildCroWakeText: () => buildCroWakeText,
2872
2776
  buildSendText: () => buildSendText,
2873
2777
  buildWakeText: () => buildWakeText,
2778
+ createAndBindTarget: () => createAndBindTarget,
2874
2779
  deliverWake: () => deliverWake,
2875
2780
  registerWakeScheduler: () => registerWakeScheduler,
2876
2781
  resolveWakeTarget: () => resolveWakeTarget,
@@ -3231,7 +3136,7 @@ async function sendToCognitiveTrajectory(ctx, root, target, message, sender) {
3231
3136
  *
3232
3137
  * @returns 命中返回 agent 与取得方式;任一步失败返回**带原因**的 error(不静默、不误报成功)
3233
3138
  */
3234
- async function createAndBindTarget(ctx, root, dirName) {
3139
+ async function createAndBindTarget(ctx, root, dirName, opts = {}) {
3235
3140
  const sc = hostService(ctx, "sessionController");
3236
3141
  const create = sc?.create;
3237
3142
  if (typeof create !== "function") return {
@@ -3268,7 +3173,9 @@ async function createAndBindTarget(ctx, root, dirName) {
3268
3173
  dirName,
3269
3174
  mdPath: join(root, "AGENT_SESSIONS", dirName, "SESSION.md"),
3270
3175
  note: "auto-created by send-now",
3271
- createdAsUser: true
3176
+ createdAsUser: true,
3177
+ ...opts.takeover === true ? { takeover: true } : {},
3178
+ alive: hostAliveProbe(ctx)
3272
3179
  });
3273
3180
  const openingNote = deliverCarrierOpening(agent, buildCarrierOpening(parseTrajectoryCode(dirName) ?? dirName, trajectoryDescOf(dirName))) ? ", opening-as-user" : ", ⚠️ 开场白未投递";
3274
3181
  const titleNote = renameCarrierTitle(ctx, agent, root, dirName);
@@ -3857,4 +3764,4 @@ function registerWakeScheduler(ctx) {
3857
3764
  registerDisposer(ctx, "认知轨迹唤醒调度器", () => clock.dispose());
3858
3765
  }
3859
3766
  //#endregion
3860
- export { addWake as _, DEFAULT_LOOKBACK_MS as a, projectDirNameForCwd as c, registerCroTurnTracking as d, registerDisposer as f, WAKE_CATCH_UP_MS as g, CARRIER_OPENING_MARK as h, wakeSchedulerState as i, scanInterruptedSessions as l, listCroCognitiveTrajectories as m, scheduler_exports as n, createResumeOne as o, buildCroSnapshot as p, sendToCognitiveTrajectory as r, formatPendingTools as s, registerWakeScheduler as t, listRunningSessionIds as u, listWakes as v };
3767
+ export { WAKE_CATCH_UP_MS as _, wakeSchedulerState as a, formatPendingTools as c, listRunningSessionIds as d, registerCroTurnTracking as f, CARRIER_OPENING_MARK as g, listCroCognitiveTrajectories as h, sendToCognitiveTrajectory as i, projectDirNameForCwd as l, buildCroSnapshot as m, registerWakeScheduler as n, DEFAULT_LOOKBACK_MS as o, registerDisposer as p, scheduler_exports as r, createResumeOne as s, createAndBindTarget as t, scanInterruptedSessions as u, addWake as v, listWakes as y };
@@ -1,10 +1,10 @@
1
1
  import { d as hostSessions, r as cccRootForCwd } from "./ccc-roots-CsSSQjSS.js";
2
2
  import { m as readTrajectorySubscriptions } from "./ccc-x94FCzOv.js";
3
3
  import { F as isoLocal, w as sessionEvents } from "./bind-file-B0TuOP89.js";
4
- import { g as WAKE_CATCH_UP_MS, m as listCroCognitiveTrajectories } from "./scheduler-CUPz7geH.js";
5
- import { n as readSimpleSettings } from "./settings-DibHCfEU.js";
6
- import { i as subscriptionStats, r as subscriptionEval } from "./subscriptions-CGpxv6Z6.js";
7
- import { containerClocks, containerWakes } from "./observation-BfGhRr78.js";
4
+ import { _ as WAKE_CATCH_UP_MS, h as listCroCognitiveTrajectories } from "./scheduler-CA-7xvTS.js";
5
+ import { n as readSimpleSettings } from "./settings-B_FAdsxN.js";
6
+ import { i as subscriptionStats, r as subscriptionEval } from "./subscriptions-I9PUzgcB.js";
7
+ import { containerClocks, containerWakes } from "./observation-CVpwAke1.js";
8
8
  //#region src/trajectory/live.ts
9
9
  /**
10
10
  * trajectory/live.ts — 进程内 live 会话取数 + 精简诊断
@@ -1,4 +1,101 @@
1
- import { f as hostSettings } from "./ccc-roots-CsSSQjSS.js";
1
+ import { c as hostAgents, f as hostSettings, u as hostService } from "./ccc-roots-CsSSQjSS.js";
2
+ import { i as sessionsRootDir, r as hasSessionLogById } from "./cleanup-CPl1SSaK.js";
3
+ //#region src/trajectory/alive.ts
4
+ /**
5
+ * trajectory/alive.ts — **"这个 dsh 会话还活着吗"的唯一判据**(owner 2026-10-20 裁决)
6
+ *
7
+ * ## owner 的原话(本模块的全部设计依据)
8
+ *
9
+ * > 「死应该包含归档判断;只有 ① 或者 ②且不在归档集 才算活」
10
+ * > 「use 只要被调用了,可以无条件覆盖绑定到当前会话(这说明当前会话肯定活着啊)」
11
+ *
12
+ * ## 为什么必须收成一个判据(在此之前有三个互不一致的判据)
13
+ *
14
+ * | # | 判据 | 旧实现位置 | 单独使用时的漏洞 |
15
+ * |---|---|---|---|
16
+ * | ① | 进程内 loaded agent | `hostAgents(ctx).get(id)` | 冷会话全判死 |
17
+ * | ② | 磁盘上有会话日志 | `hasSessionLogById()` | **归档后日志逐字节不动** ⇒ 归档会话判活 |
18
+ * | ③ | 宿主归档集 | `workspaceRegistry.archivedSessionIds` | 旧 dsp **零引用**(整个仓库 0 处) |
19
+ *
20
+ * 宿主的归档语义是**只往集合里加一个 id、不动日志**(`dsh-workspace` 的
21
+ * `archiveSession` 注释:「Archiving never touches workspace accounting」)。
22
+ * ⇒ 只问 ② 的实现在归档上**必然判错**,而那个错误没有任何机械信号。
23
+ *
24
+ * ## 判据(owner 给定,逐字实现)
25
+ *
26
+ * ```text
27
+ * 活 ⟺ ① (进程内 loaded ⇒ 一定在)
28
+ * ∨ (② ∧ 不在归档集) (日志在、且没人把它归档掉)
29
+ * ```
30
+ *
31
+ * 🔴 **一处对原话的收紧(必须说出来,不许默默改)**:owner 的 ① 未附加"不在归档集",
32
+ * 而本模块把**归档判定排在最前** —— 即 `归档 ∧ live ⇒ 判死`。理由:归档是**人对这条会话
33
+ * 的处置声明**(宿主会把它从所有分组面隐藏),若仍被当成载体,唤醒调度器会去驱动一条
34
+ * **使用者以为已经收起来**的会话。⚠️ 与字面规则的差异仅此一格;`use` 不受影响
35
+ * (见下方 §use 逃生门),因此真需要复活一条已归档会话时**仍然有受支持的路**。
36
+ *
37
+ * ## 🔴 `use` 的逃生门(owner 第二条,写在调用点)
38
+ *
39
+ * **`use` 不查存活**:它被调用这件事本身证明**当前会话活着**(本模块的被测对象是
40
+ * "别人写的那个 id",而 `use` 手里拿的是**自己**)。⇒ `use` 走无条件覆盖
41
+ * (`claimBinding` 的 `takeover`),因此**判据再严也不会把一条轨迹锁死**。
42
+ * 这条逃生门是判据可以取严的前提,两者必须一起存在。
43
+ *
44
+ * ## 依赖纪律
45
+ *
46
+ * 纯判据 `isSessionAlive` 零依赖、可单测;宿主面只在 `hostAliveProbe` 里,
47
+ * 且**不抛错**(服务缺失 ⇒ 该维度作废,而不是让 ACC 工具整块失败)。
48
+ */
49
+ /** 宿主侧的归档集读取(不可用 ⇒ 空集 = 该维度作废,**不是**把所有会话判死) */
50
+ function archivedIdsOf(ctx) {
51
+ try {
52
+ const ids = hostService(ctx, "workspaceRegistry")?.archivedSessionIds;
53
+ return new Set(Array.isArray(ids) ? ids : []);
54
+ } catch {
55
+ return /* @__PURE__ */ new Set();
56
+ }
57
+ }
58
+ /**
59
+ * **宿主面的判活探针**(`(sessionId) => boolean`)——所有需要"这条会话还活着吗"的
60
+ * 生产代码都应当用这一个,不要自己拼 `agents.get` + `hasSessionLogById`。
61
+ *
62
+ * 语义 = {@link isSessionAlive},其中:
63
+ * · `liveIds` 因为宿主只给 `get(id)` 而**按 id 逐次问**(不是集合);
64
+ * · `archivedIds` 在**首次调用时**取一次快照并在闭包内复用(每 tick 一个探针,
65
+ * 归档集在一个 tick 内不变)—— 避免为每条轨迹重复读存储域。
66
+ *
67
+ * ⚠️ **快照的代价**:同一探针内若有人中途归档了某会话,本探针直到下次新建才看见。
68
+ * 调度器是每 tick 新建一个探针(见 `wake/scheduler.ts`),故实际窗口 ≤1 tick。
69
+ *
70
+ * @param ctx 插件上下文(取 `agents` 与 `workspaceRegistry`)
71
+ * @returns 探针;**永不抛**
72
+ */
73
+ function hostAliveProbe(ctx) {
74
+ let archived;
75
+ const archivedOnce = () => archived ??= archivedIdsOf(ctx);
76
+ return (sessionId) => {
77
+ if (typeof sessionId !== "string" || sessionId === "") return false;
78
+ if (archivedOnce().has(sessionId)) return false;
79
+ try {
80
+ if (hostAgents(ctx)?.get?.(sessionId)) return true;
81
+ } catch {}
82
+ try {
83
+ return hasSessionLogById(sessionsRootDir(), sessionId);
84
+ } catch {
85
+ return true;
86
+ }
87
+ };
88
+ }
89
+ /**
90
+ * 判据只有**两个**出口,别再开第三个:
91
+ * · {@link isSessionAlive} —— 纯判据(给定事实),单测的靶子;
92
+ * · {@link hostAliveProbe} —— 生产入口(自己去宿主与磁盘取事实)。
93
+ *
94
+ * ⚠️ 曾有一个 `aliveFactsFor`(把探针摊平成 `SessionAliveFacts`),**全仓零调用点**,
95
+ * 已删除 —— 留一个"看起来有用、实际无人调用"的导出,会让下一个人以为存在第二条判活路径
96
+ * (本仓同族教训:`cheapWorkerPresetInheritance` 全仓零调用点 ⇒ 接线断了却看不出来)。
97
+ */
98
+ //#endregion
2
99
  //#region src/surface/settings.ts
3
100
  /**
4
101
  * 设置面板命名空间 = **profile 条目 id**(v0.1.7 起;与旧 `settings.yaml` 段名逐字相同)。
@@ -142,4 +239,4 @@ function registerSettingsSection(ctx, config) {
142
239
  } catch {}
143
240
  }
144
241
  //#endregion
145
- export { readSimpleSettings as n, registerSettingsSection as r, SERENITY_SETTINGS_NS as t };
242
+ export { hostAliveProbe as i, readSimpleSettings as n, registerSettingsSection as r, SERENITY_SETTINGS_NS as t };