@shgroup/dsh-serenity-hooks 1.115.0 → 1.116.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/dsh.plugin.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "id": "dsh-serenity-hooks",
3
- "version": "1.115.0",
3
+ "version": "1.116.0",
4
4
  "main": "lib/index.js",
5
5
  "description": "宁静号 ACC harness(Native Cordis 插件):给 DSH 装一个「AI 工作区」——12 个工具(container_fs/cognitive_trajectory/dashboard/container_git/msm/praxis/ontology/serenity-skill-creator/localstore/container_admin;另两个 im-bridge/diagram 按配置条件出现)+ 机械约束(安全模式/工作区围墙/密钥守卫)+ 认知轨迹日志与原地重建 + 网页登录入口/IM 桥/认知轨迹唤醒注册表。轨迹声明 = 轨迹目录下的 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(三档,deepseek-ai/deepseek-harness)。",
6
6
  "engines": {
@@ -35,37 +35,6 @@ function weixinSendEndpoint() {
35
35
  //#endregion
36
36
  //#region src/tools/config-docs.ts
37
37
  /**
38
- * 渲染**目录**(第一层)。
39
- *
40
- * 🔴 只调 `summary`,**绝不调 `render`** —— 目录若触发正文,就退化成"整份长文"。
41
- * 这条不是性能优化,是**判据**:它保证 `docs` 的输出大小与章数成正比,与正文长度无关。
42
- */
43
- function renderDocsIndex(chapters) {
44
- const lines = [
45
- "═══ CCC 配置说明 · 目录 ═══",
46
- "",
47
- "说明类内容已超过单次返回的合适篇幅 ⇒ 先读目录,再按章取详情。",
48
- "",
49
- "用法:container_admin config docs <章节>",
50
- ""
51
- ];
52
- for (const ch of chapters) lines.push(` ${ch.id.padEnd(14)}${ch.summary}`);
53
- lines.push("");
54
- lines.push("旧入口(msm catalog / msm ccc-config / config guide)**降为指针**,只指路、不再返回正文。");
55
- return lines.join("\n");
56
- }
57
- /**
58
- * 解析一个章节参数(第二层)。
59
- *
60
- * 不存在 ⇒ 返回 `null`,由调用方给出**带候选清单**的拒绝 ——
61
- * "不知道这个章节" 与 "这一章是空的" 必须可区分(否则用户以为功能没有)。
62
- */
63
- function findDocsChapter(chapters, id) {
64
- const want = id.trim().toLowerCase();
65
- if (want === "") return null;
66
- return chapters.find((c) => c.id.toLowerCase() === want) ?? null;
67
- }
68
- /**
69
38
  * **指针文案**(v1.75.0,owner 裁 Q3「指针」)——被降级的旧入口共用这一份。
70
39
  *
71
40
  * ## 为什么要有"指针"这个形态(而不是直接删掉旧入口)
@@ -2247,4 +2216,4 @@ function summarizeHostContract(report) {
2247
2216
  return `${required.length > 0 ? `host contract BROKEN (${required.length} required)` : `host contract degraded (${optional.length} optional)`}: ${report.issues.map((i) => i.detail).join("; ")}`;
2248
2217
  }
2249
2218
  //#endregion
2250
- export { docsPointer as C, setWeixinSendEndpoint as E, runMsmAsync as S, renderDocsIndex as T, CCC_CONFIG_REFERENCE as _, setSafeMode as a, loadMsmEntries as b, forgetExclusiveToolsVisibility as c, forgetNonCccToolVisibility as d, forgetTrajectoryConstraintToolVisibility as f, ACC_CATALOG as g, forgetToolVisibility as h, readDshVersion as i, forgetHostScheduleToolHiding as l, syncToolVisibility as m, summarizeHostContract as n, listOpencodeSkillDirs as o, registerGuards as p, getStatus as r, loadOpencodeSkill as s, hostContractReport as t, forgetImBridgeVisibility as u, checkRegistryQuality as v, findDocsChapter as w, runMsm as x, findEntry as y };
2219
+ export { docsPointer as C, runMsmAsync as S, CCC_CONFIG_REFERENCE as _, setSafeMode as a, loadMsmEntries as b, forgetExclusiveToolsVisibility as c, forgetNonCccToolVisibility as d, forgetTrajectoryConstraintToolVisibility as f, ACC_CATALOG as g, forgetToolVisibility as h, readDshVersion as i, forgetHostScheduleToolHiding as l, syncToolVisibility as m, summarizeHostContract as n, listOpencodeSkillDirs as o, registerGuards as p, getStatus as r, loadOpencodeSkill as s, hostContractReport as t, forgetImBridgeVisibility as u, checkRegistryQuality as v, setWeixinSendEndpoint as w, runMsm as x, findEntry as y };
package/lib/index.js CHANGED
@@ -4,7 +4,7 @@ import { _ as resolveInside, a as findSerenityRoot$1, d as readCccName, h as rea
4
4
  import { A as useSession, C as resolveSessionByTitle, D as showSession, E as setActiveSessionInfo, F as isoLocal, I as localFileStamp, M as TRAJECTORY_LEGACY_FILENAMES, O as summarize, S as readTrajectoryUid, T as sessionsRoot, _ as listSessions, b as parseTrajectoryCode, c as UID_FILENAME, d as createSession, f as extractSessionMdPathFromText, j as TRAJECTORY_FILENAME, k as trajectoryDescOf, l as archiveSession, m as getActiveSessionInfo, o as COGNITIVE_TRAJECTORY_ACTIONS, p as findSession, u as clearActiveSessionInfo, v as namingTitleFor, w as sessionEvents, y as parseSessionContextFromEvents } from "./bind-file-B0TuOP89.js";
5
5
  import { n as checkLocalstoreGitCompliance, o as readStore, s as runLocalStore, t as LOCALSTORE_SCOPES } from "./service-Dv-8E2bI.js";
6
6
  import { d as findPackageRoot, i as constraintSystemPromptSource, l as resolveConstraintSystemPrompt, r as constraintCognitiveTrajectory, t as TRAJECTORY_CONSTRAINT_HINT, u as ACC_VERSION } from "./rules-DKlpuFN_.js";
7
- import { C as docsPointer, E as setWeixinSendEndpoint, S as runMsmAsync, T as renderDocsIndex, _ as CCC_CONFIG_REFERENCE, a as setSafeMode, b as loadMsmEntries, d as forgetNonCccToolVisibility, g as ACC_CATALOG, h as forgetToolVisibility, i as readDshVersion, m as syncToolVisibility, n as summarizeHostContract, o as listOpencodeSkillDirs, p as registerGuards, r as getStatus, s as loadOpencodeSkill, t as hostContractReport, w as findDocsChapter, x as runMsm, y as findEntry } from "./contract-BAFxLPWs.js";
7
+ import { C as docsPointer, S as runMsmAsync, _ as CCC_CONFIG_REFERENCE, a as setSafeMode, b as loadMsmEntries, d as forgetNonCccToolVisibility, g as ACC_CATALOG, h as forgetToolVisibility, i as readDshVersion, m as syncToolVisibility, n as summarizeHostContract, o as listOpencodeSkillDirs, p as registerGuards, r as getStatus, s as loadOpencodeSkill, t as hostContractReport, w as setWeixinSendEndpoint, x as runMsm, y as findEntry } from "./contract-qqnsi8tc.js";
8
8
  import { c as replacesDefaultIdentity, i as listTrajectoryConstraints, l as trajectoryCodeForSession, n as findDirNameByCode, o as readTrajectoryConstraintAt, r as isTrajectoryConstrained, s as readTrajectoryConstraintByCode, t as TRAJECTORY_CONSTRAINT_FILENAME } from "./profile-Djqz4Noy.js";
9
9
  import { A as truncateContent, C as verifyTotpCode, D as buildResourceIndex, E as SKILL_ONTOLOGY_FILE, M as hasTrajectoryPrompt, O as buildResourceNameSuffix, S as MECHANISM_PORTS, T as REFERENCE_DIR, _ as projectKnownWorkspaces, a as trajectoryConstraintFor, b as verifyPassword, c as trajectoryWorkspaceMdPath, d as splitModel, f as registerCognitiveTrajectorySkillSection, g as migrateLegacyLocalstore, h as applyWirePatch, i as getTrajectoryAgent, j as TRAJECTORY_PROMPT_FILENAME, k as isSafeSkillName, l as unregisterTrajectorySession, m as registerEntrySkillSectionGlobal, n as deliverToTrajectory, o as trajectoryConstraintMsmGate, p as registerEntrySkillSection, r as ensureWorkspacePromptSection, s as trajectoryConstraintParticipates, t as createTrajectoryAgent, u as workspaceCognitiveTrajectoryLine, v as readAdvancedSettings, w as recordToolUsage, x as FACE_PORTS, y as toWire } from "./session-BVBI5jch.js";
10
10
  import { a as ACC_MESSAGE_KIND, d as readLastBound, f as resolveSessionCognitiveTrajectoryLabel, i as toMessage, l as findTrajectoryOfSession, n as deliver, o as PLUGIN_SOURCE, r as makeInjection, s as appendBound } from "./injection-B5jZxemg.js";
@@ -515,7 +515,7 @@ const KIT_ACTIONS = [
515
515
  async function runKit(root, args, hostCtx) {
516
516
  switch (args.action) {
517
517
  case "health": {
518
- const { containerStatus } = await import("./observation-9KTP3S_h.js");
518
+ const { containerStatus } = await import("./observation-BFDDUisK.js");
519
519
  const s = containerStatus({
520
520
  root,
521
521
  hostCtx
@@ -561,7 +561,7 @@ async function runKit(root, args, hostCtx) {
561
561
  }
562
562
  case "diag": {
563
563
  if (hostCtx === void 0) throw new Error("diag requires the plugin context (live session data unavailable without it)");
564
- const { runDiag, renderDiag } = await import("./service-CS0Bslfx.js");
564
+ const { runDiag, renderDiag } = await import("./service-DGNxpE87.js");
565
565
  return renderDiag(await runDiag(hostCtx, root ?? ""));
566
566
  }
567
567
  default: throw new Error(`Unknown action: ${args.action}`);
@@ -7516,6 +7516,197 @@ AGENT_SESSIONS/_im-logs/<channel>/<YYYY-MM-DD>.jsonl
7516
7516
  - ⛔ 判断"对方读没读"——记录只证明**已发出**
7517
7517
  `;
7518
7518
  //#endregion
7519
+ //#region src/tools/manuals.ts
7520
+ /**
7521
+ * tools/manuals.ts — **面向 CCC 的统一手册体系**(2026-11-04,owner 令)
7522
+ *
7523
+ * ## owner 原话(本文件存在的全部理由,逐字)
7524
+ *
7525
+ * > 「我们 ACC 提供给 CCC 的手册好久没更新了,手册架构也不好,导致你老是忘更新,
7526
+ * > 本次也强化一下吧,建立统一的面向 CCC 的手册体系」
7527
+ *
7528
+ * ## 诊断(这就是"老是忘"的结构性成因,⛔ 不是记性问题)
7529
+ *
7530
+ * 改造前实测:容器里共有 **8 份手册正文**,而总索引 `config docs` 只覆盖 **5 份**。
7531
+ * 另外 3 份(MSM 开发手册 / CRO 编写指南 / skill 编写方法)**各自住在自己工具的
7532
+ * 某个 action 后面**,从总索引完全看不见。任何一个 agent 想问"这容器有哪些手册",
7533
+ * 没有任何一个地方能回答。
7534
+ *
7535
+ * 更贵的是**加一章的成本**:写 const → 加 import → 改 `DOCS_CHAPTERS` 手写表
7536
+ * → 改测试里 `toEqual([...])` 的精确断言,**四处,且没有一处会提醒你漏了哪一处**。
7537
+ * ⇒ 手册与代码的分叉不是"忘了",是**架构让它容易忘**。
7538
+ *
7539
+ * ## 改法:目录由**登记**生成,⛔ 不是手写表
7540
+ *
7541
+ * 本文件是**全部手册的唯一登记处**。加一份手册 = **在这里加一项**(一处),
7542
+ * 索引与"列出全部章节"都由它自动派生。
7543
+ *
7544
+ * ## 🔴 两种手册形态必须分开表达(这是本设计的核心判据)
7545
+ *
7546
+ * | 形态 | 含义 | `render()` 返回什么 |
7547
+ * |---|---|---|
7548
+ * | **local** | 正文就住在 ACC 里(我们自己的常量) | **正文本身** |
7549
+ * | **native** | 正文住在**另一个工具的入口后面**(不是 `config docs` 能给的) | **指针**(告诉你去哪取) |
7550
+ *
7551
+ * 为什么不能让 native 那三份也 `render()` 返回正文:v1.75.0 已裁「**一个内容一个正文入口**」,
7552
+ * 而 `MSM_GUIDE` 的正文入口是 `container_admin msm guide` —— 若 `config docs msm` 也返回
7553
+ * 同一份常量,就等于又造了第二个正文入口(正是那次裁决要消灭的形态)。
7554
+ * ⇒ **native 形态的章返回指针,⛔ 不复制正文。**
7555
+ *
7556
+ * ⚠️ 这与「发现」不冲突:目录里**仍然列着**它(读者知道有这么一份手册、写给谁、何时该读),
7557
+ * 只是取正文时多一跳。**可发现 ≠ 可复制。**
7558
+ */
7559
+ /**
7560
+ * **全部手册的登记表**(唯一真相处)。
7561
+ *
7562
+ * 🔴 加手册 = 加一项。⛔ 不要再改动别处来让它出现(那正是改造前的老毛病)。
7563
+ * 🔴 章节顺序 = 下面的书写顺序(**刻意按"新读者最可能先需要哪个"排**,不是字母序)。
7564
+ */
7565
+ const MANUALS = [
7566
+ {
7567
+ id: "catalog",
7568
+ title: "ACC 能力总目录",
7569
+ audience: "任何刚进入本容器、想知道\"这里能做什么\"的 agent",
7570
+ when: "不知道某个能力有没有、该去哪个工具时;或要判断\"这件事 ACC 支不支持\"时",
7571
+ summary: "7 个能力分区,每区一句话 + 去哪个子命令看详情",
7572
+ carrier: {
7573
+ kind: "local",
7574
+ render: () => ACC_CATALOG
7575
+ }
7576
+ },
7577
+ {
7578
+ id: "config",
7579
+ title: "CCC 配置全表",
7580
+ audience: "要改 `.opencode/serenity.json` 的 agent/人",
7581
+ when: "要新增或调整某个配置段、或某配置\"填了没生效\"想确认它到底该填什么时",
7582
+ summary: "10 段各是什么、怎么填、填错会怎样",
7583
+ carrier: {
7584
+ kind: "local",
7585
+ render: () => CCC_CONFIG_REFERENCE
7586
+ }
7587
+ },
7588
+ {
7589
+ id: "trajectory-self",
7590
+ title: "一条轨迹怎么描述自己",
7591
+ audience: "要写自己的 PROMPT.md / 声明常驻 / 给自己设限制的轨迹",
7592
+ when: "新建一条轨迹、要改自己的章程与常驻声明、或要给自己设工具/模型白名时",
7593
+ summary: "章程 PROMPT.md / 常驻声明(resident.serves)/ 三个载体的分工 + 写完怎么验",
7594
+ carrier: {
7595
+ kind: "local",
7596
+ render: () => TRAJECTORY_SELF_GUIDE
7597
+ }
7598
+ },
7599
+ {
7600
+ id: "trajectory-constraint",
7601
+ title: "轨迹约束(只讲限制面)",
7602
+ audience: "要限制某条轨迹能做什么的管理者/轨迹本身",
7603
+ when: "要给某条轨迹设工具白名单、限模型、或配 IM 路由时",
7604
+ summary: "trajectory.json 的双白名单 / 模型 / 纪律参与项 / IM 路由",
7605
+ carrier: {
7606
+ kind: "local",
7607
+ render: () => TRAJECTORY_CONSTRAINT_GUIDE
7608
+ }
7609
+ },
7610
+ {
7611
+ id: "im-bridge",
7612
+ title: "IM 桥:怎么用、怎么配路由",
7613
+ audience: "要让某条轨迹收发微信/飞书消息的 agent",
7614
+ when: "要给某个家庭成员接一条消息路由、或消息\"发不出去/收不到\"要排查时",
7615
+ summary: "send/send-file/users/status/contacts 五个动作 + 路由三步法(contacts → 写 → status 自检)",
7616
+ carrier: {
7617
+ kind: "local",
7618
+ render: () => IM_BRIDGE_GUIDE
7619
+ }
7620
+ },
7621
+ {
7622
+ id: "msm",
7623
+ title: "MSM 开发手册",
7624
+ audience: "要写一个新 MSM(Mech / Semi-Mech)或维护既有 MSM 的人",
7625
+ when: "要新增一个 MSM 脚本、或某个 MSM 的行为/参数/退出码该怎么定的时候",
7626
+ summary: "Mech 与 Semi-Mech 的分层 / 注册与写保护 / 参数与退出码约定 / 什么时候不该做成 MSM",
7627
+ carrier: {
7628
+ kind: "native",
7629
+ entry: "container_admin msm guide"
7630
+ }
7631
+ },
7632
+ {
7633
+ id: "cro",
7634
+ title: "CRO 编写指南",
7635
+ audience: "要给自己写 CRO 程序(决定什么时候该被唤醒)的轨迹",
7636
+ when: "要让某条轨迹定时自查、或要改已存在的 `continuous-re-occurrence.ts` 时",
7637
+ summary: "CRO 程序的结构 / 快照里给了什么 / 什么算\"该唤起\" / 写好怎么验",
7638
+ carrier: {
7639
+ kind: "native",
7640
+ entry: "cognitive_trajectory cro-guide"
7641
+ }
7642
+ },
7643
+ {
7644
+ id: "skill-authoring",
7645
+ title: "serenity-skill 编写与优化方法",
7646
+ audience: "要新建或重构一个 skill 的 agent",
7647
+ when: "要写 skill、或某个 skill「看着乱/模型老不用它」要重构时",
7648
+ summary: "skill 目录结构 / ontology 建模 / 分层与质量门 / 优化回路",
7649
+ carrier: {
7650
+ kind: "native",
7651
+ entry: "serenity-skill-creator guide"
7652
+ }
7653
+ }
7654
+ ];
7655
+ /** 按 id 查找(大小写不敏感;不存在返回 null,由调用方给带候选的拒绝) */
7656
+ function findManual(id) {
7657
+ const want = id.trim().toLowerCase();
7658
+ if (want === "") return null;
7659
+ return MANUALS.find((m) => m.id.toLowerCase() === want) ?? null;
7660
+ }
7661
+ /** 取一份手册的正文或指针(native 形态返回指针,⛔ 不返回被复制过来的正文) */
7662
+ function renderManual(m) {
7663
+ if (m.carrier.kind === "local") return m.carrier.render();
7664
+ return [
7665
+ `═══ ${m.title} — 正文不在本节 ═══`,
7666
+ "",
7667
+ `这份手册的正文入口是:**${m.carrier.entry}**`,
7668
+ "",
7669
+ "为什么这样分(v1.75.0 owner 裁「一个内容一个正文入口」):",
7670
+ "它原本就住在那个工具里,如果这里也返回一份正文,同一份内容就会有两个真相源,",
7671
+ "必然各自漂移。⇒ **本节只负责让你找到它**(谁该读、什么时候读),正文仍只有一份。",
7672
+ "",
7673
+ `摘要:${m.summary}`,
7674
+ "",
7675
+ "还想知道容器里有哪些别的说明:container_admin config docs"
7676
+ ].join("\n");
7677
+ }
7678
+ /**
7679
+ * 渲染**目录**(第一层)。
7680
+ *
7681
+ * 🔴 **只读元数据,绝不调 `render()`** —— 目录若触发正文,两层菜单就退化成一坨长文。
7682
+ * 这条不是性能优化,是判据:**目录大小与章数成正比,与正文长度无关**。
7683
+ *
7684
+ * 🔴 每章给三件(旧的只给两件):**它是谁(title)/写给谁(audience)/何时读(when)**。
7685
+ * 旧目录只给 id + summary ⇒ 读者得先通读简介才知道跟自己有没有关系,
7686
+ * 而"我现在该不该读这一章"正是**手册能不能被用起来**的那一格(owner 说"老是忘更新",
7687
+ * 根因与此同族:**没人按需想起它**)。
7688
+ */
7689
+ function renderManualsIndex(entries = MANUALS) {
7690
+ const lines = [
7691
+ "═══ CCC 手册目录 · 全部说明的唯一入口 ═══",
7692
+ "",
7693
+ "说明类内容已超过单次返回的合适篇幅 ⇒ 先读目录,再按章取详情。",
7694
+ "",
7695
+ "用法:container_admin config docs <章节id>",
7696
+ ""
7697
+ ];
7698
+ for (const m of entries) {
7699
+ const mark = m.carrier.kind === "native" ? "↗" : " ";
7700
+ lines.push(`${mark} ${m.id.padEnd(21)}${m.title}`);
7701
+ lines.push(` ${"".padEnd(21)}写给:${m.audience}`);
7702
+ lines.push(` ${"".padEnd(21)}何时读:${m.when}`);
7703
+ lines.push(` ${"".padEnd(21)}${m.summary}`);
7704
+ lines.push("");
7705
+ }
7706
+ lines.push("↗ = 正文住在别的工具入口后(本节给指针,不复制正文)。");
7707
+ return lines.join("\n");
7708
+ }
7709
+ //#endregion
7519
7710
  //#region src/tools/container-admin.ts
7520
7711
  /**
7521
7712
  * container-admin.ts — container_admin(v1.30:机务舱——容器管理面统一入口)
@@ -7625,54 +7816,21 @@ const DOMAIN_NAMES = Object.keys({
7625
7816
  ]
7626
7817
  });
7627
7818
  /**
7628
- * 说明目录的章节(**说明类内容的唯一注册处**)。
7629
- *
7630
- * 🔴 两条纪律:
7631
- * ① **加一章 = 在这里加一项**(`render` 惰性求值)——说明类内容增长时**不新增工具/子命令**。
7632
- * ② **正文不复制**:每章的真相源就在它自己的函数里(`CCC_CONFIG_REFERENCE` /
7633
- * `TRAJECTORY_CONSTRAINT_GUIDE` / `ACC_CATALOG`)——本表只做**切分与路由**。
7819
+ * 🔴🔴 **2026-11-04(owner 令):章节表已迁出本文件 ⇒ `tools/manuals.ts`**
7634
7820
  *
7635
- * ## 🔴 2026-10-19 v1.75.0:说明面统一(owner 裁 Q3 = 指针)
7821
+ * 这里原本是 `DOCS_CHAPTERS` 手写表。它有三个结构性缺陷(实测,⛔ 不是印象):
7822
+ * ① **只覆盖 5 章**,而容器里实际有 8 份手册 —— `MSM_GUIDE` / `CRO_GUIDE` /
7823
+ * `SKILL_CREATOR_GUIDE` 各自住在自己工具的 action 后面,从总索引完全看不见;
7824
+ * ② **加一章要改四处**(写 const → 加 import → 改这张表 → 改测试里的精确断言),
7825
+ * **没有一处会提醒你漏了哪一处** ⇒ 手册与代码分叉不是"忘了",是架构让它容易忘;
7826
+ * ③ 目录只给"这章讲什么",**没给"写给谁 / 何时该读"** ⇒ 读者得先通读才知道跟自己有没有关系。
7636
7827
  *
7637
- * 统一前有 **5 个并列入口**,其中两组返回**同一份正文**:
7638
- * `docs config` ≡ `msm ccc-config`|`docs trajectory-constraint` ≡ `config guide`|
7639
- * `msm catalog`(域挂错了:它描述整个 ACC,却挂在 MSM 注册表下)。
7640
- *
7641
- * ⇒ 统一后的分工(**一个内容一个正文入口**):
7642
- * - **`config docs <chapter>`** = 唯一正文入口
7643
- * - `msm ccc-config` / `config guide` = **指针**(指向对应 chapter,不再返回正文)
7644
- * - `msm catalog` = **指针**(指向 `catalog` 章)
7645
- *
7646
- * 判据依据:`praxis` 已经做对了这件事 —— `praxis eap` 返回正文、`praxis` 无参返回目录,
7647
- * **没有第二个入口读同一份 EAP**。本表把同一形态搬到 config 域。
7828
+ * ⇒ 现在唯一登记处 = `manuals.ts` 的 `MANUALS`。**加一份手册 = 在那里加一项**。
7829
+ * ⚠️ v1.75.0 的判据「一个内容一个正文入口」**仍然成立且被强化**:`manuals.ts` 用
7830
+ * `carrier.kind` 把「正文在 ACC 里」(local) 与「正文在别的工具入口后」(native) 分开表达,
7831
+ * native 那三份**只返回指针、⛔ 不复制正文**。
7648
7832
  */
7649
- const DOCS_CHAPTERS = [
7650
- {
7651
- id: "catalog",
7652
- summary: "ACC 能力总目录——7 个能力分区,每区一句话 + 去哪个子命令看详情",
7653
- render: () => ACC_CATALOG
7654
- },
7655
- {
7656
- id: "config",
7657
- summary: "CCC 配置全表——10 段各是什么、怎么填、填错会怎样(.opencode/serenity.json)",
7658
- render: () => CCC_CONFIG_REFERENCE
7659
- },
7660
- {
7661
- id: "trajectory-self",
7662
- summary: "一条轨迹怎么描述自己——章程 PROMPT.md / 常驻声明(resident.serves)/ 三个载体的分工 + 写完怎么验",
7663
- render: () => TRAJECTORY_SELF_GUIDE
7664
- },
7665
- {
7666
- id: "trajectory-constraint",
7667
- summary: "轨迹约束(只讲限制面):trajectory.json 的双白名单 / 模型 / 纪律参与项 / IM 路由",
7668
- render: () => TRAJECTORY_CONSTRAINT_GUIDE
7669
- },
7670
- {
7671
- id: "im-bridge",
7672
- summary: "IM 桥怎么用、怎么配路由、怎么查对方 id —— send/send-file/users/status/contacts 五个动作 + 路由三步法(contacts → 写 → status 自检)",
7673
- render: () => IM_BRIDGE_GUIDE
7674
- }
7675
- ];
7833
+ const DOCS_CHAPTERS = MANUALS;
7676
7834
  /**
7677
7835
  * 指针与章目的关系(v1.75.0):
7678
7836
  * 被降级的旧入口(`msm catalog` / `msm ccc-config` / `config guide`)统一走
@@ -7747,14 +7905,14 @@ function createContainerAdminTool(ctx) {
7747
7905
  case "docs": {
7748
7906
  const chapter = args.chapter?.trim() ?? "";
7749
7907
  if (chapter === "") return {
7750
- docs: renderDocsIndex(DOCS_CHAPTERS),
7908
+ docs: renderManualsIndex(DOCS_CHAPTERS),
7751
7909
  chapters: DOCS_CHAPTERS.map((c) => c.id)
7752
7910
  };
7753
- const found = findDocsChapter(DOCS_CHAPTERS, chapter);
7911
+ const found = findManual(chapter);
7754
7912
  if (found === null) throw new Error(`container_admin config docs: unknown chapter "${chapter}". Available: ${DOCS_CHAPTERS.map((c) => c.id).join(" | ")} (omit the chapter for the index)`);
7755
7913
  return {
7756
7914
  chapter: found.id,
7757
- docs: found.render()
7915
+ docs: renderManual(found)
7758
7916
  };
7759
7917
  }
7760
7918
  case "view":
@@ -1,6 +1,6 @@
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-BAFxLPWs.js";
3
+ import { i as readDshVersion, t as hostContractReport, v as checkRegistryQuality } from "./contract-qqnsi8tc.js";
4
4
  import { i as wakeSchedulerState, v as listWakes } from "./scheduler-DoyulpUI.js";
5
5
  import { resolve } from "node:path";
6
6
  import { existsSync, readFileSync, statSync } from "node:fs";
@@ -4,7 +4,7 @@ import { F as isoLocal, w as sessionEvents } from "./bind-file-B0TuOP89.js";
4
4
  import { g as WAKE_CATCH_UP_MS, m as listCroCognitiveTrajectories } from "./scheduler-DoyulpUI.js";
5
5
  import { n as readSimpleSettings } from "./settings-DibHCfEU.js";
6
6
  import { i as subscriptionStats, r as subscriptionEval } from "./subscriptions-CUD0d_Sg.js";
7
- import { containerClocks, containerWakes } from "./observation-9KTP3S_h.js";
7
+ import { containerClocks, containerWakes } from "./observation-BFDDUisK.js";
8
8
  //#region src/trajectory/live.ts
9
9
  /**
10
10
  * trajectory/live.ts — 进程内 live 会话取数 + 精简诊断
@@ -0,0 +1,97 @@
1
+ /**
2
+ * tools/manuals.ts — **面向 CCC 的统一手册体系**(2026-11-04,owner 令)
3
+ *
4
+ * ## owner 原话(本文件存在的全部理由,逐字)
5
+ *
6
+ * > 「我们 ACC 提供给 CCC 的手册好久没更新了,手册架构也不好,导致你老是忘更新,
7
+ * > 本次也强化一下吧,建立统一的面向 CCC 的手册体系」
8
+ *
9
+ * ## 诊断(这就是"老是忘"的结构性成因,⛔ 不是记性问题)
10
+ *
11
+ * 改造前实测:容器里共有 **8 份手册正文**,而总索引 `config docs` 只覆盖 **5 份**。
12
+ * 另外 3 份(MSM 开发手册 / CRO 编写指南 / skill 编写方法)**各自住在自己工具的
13
+ * 某个 action 后面**,从总索引完全看不见。任何一个 agent 想问"这容器有哪些手册",
14
+ * 没有任何一个地方能回答。
15
+ *
16
+ * 更贵的是**加一章的成本**:写 const → 加 import → 改 `DOCS_CHAPTERS` 手写表
17
+ * → 改测试里 `toEqual([...])` 的精确断言,**四处,且没有一处会提醒你漏了哪一处**。
18
+ * ⇒ 手册与代码的分叉不是"忘了",是**架构让它容易忘**。
19
+ *
20
+ * ## 改法:目录由**登记**生成,⛔ 不是手写表
21
+ *
22
+ * 本文件是**全部手册的唯一登记处**。加一份手册 = **在这里加一项**(一处),
23
+ * 索引与"列出全部章节"都由它自动派生。
24
+ *
25
+ * ## 🔴 两种手册形态必须分开表达(这是本设计的核心判据)
26
+ *
27
+ * | 形态 | 含义 | `render()` 返回什么 |
28
+ * |---|---|---|
29
+ * | **local** | 正文就住在 ACC 里(我们自己的常量) | **正文本身** |
30
+ * | **native** | 正文住在**另一个工具的入口后面**(不是 `config docs` 能给的) | **指针**(告诉你去哪取) |
31
+ *
32
+ * 为什么不能让 native 那三份也 `render()` 返回正文:v1.75.0 已裁「**一个内容一个正文入口**」,
33
+ * 而 `MSM_GUIDE` 的正文入口是 `container_admin msm guide` —— 若 `config docs msm` 也返回
34
+ * 同一份常量,就等于又造了第二个正文入口(正是那次裁决要消灭的形态)。
35
+ * ⇒ **native 形态的章返回指针,⛔ 不复制正文。**
36
+ *
37
+ * ⚠️ 这与「发现」不冲突:目录里**仍然列着**它(读者知道有这么一份手册、写给谁、何时该读),
38
+ * 只是取正文时多一跳。**可发现 ≠ 可复制。**
39
+ */
40
+ /** 手册正文的存放形态(见文件头 §两种形态) */
41
+ export type ManualCarrier =
42
+ /** 正文住在 ACC 里 —— `render()` 直接给全文 */
43
+ {
44
+ kind: 'local';
45
+ render: () => string;
46
+ }
47
+ /** 正文住在别的工具入口后 —— `render()` 只给指针,⛔ 不复制 */
48
+ | {
49
+ kind: 'native';
50
+ entry: string;
51
+ render?: never;
52
+ };
53
+ /** 一份手册 = 目录里的一行 + 可选的正文 */
54
+ export interface ManualEntry {
55
+ /** 稳定 id(`config docs <id>`;英文短名,便于逐字敲) */
56
+ id: string;
57
+ /** 人读的标题(目录里显示;比 id 更可读,且允许中文) */
58
+ title: string;
59
+ /**
60
+ * **读者是谁** —— 面向 CCC 的关键字段。
61
+ * 旧目录只有"这一章讲什么",读者得先通读才知道跟自己有没有关系。
62
+ */
63
+ audience: string;
64
+ /**
65
+ * 🔴 **什么时候该读它** —— 本体系最重要的一栏。
66
+ *
67
+ * 判据:手册的价值不在"存在",在**在需要它的那一刻能被想起来**。
68
+ * 只写"这是什么"(summary)回答不了"我现在该不该读"。
69
+ */
70
+ when: string;
71
+ /** 一句话摘要(目录行的主体;⛔ 不要在这里写正文) */
72
+ summary: string;
73
+ carrier: ManualCarrier;
74
+ }
75
+ /**
76
+ * **全部手册的登记表**(唯一真相处)。
77
+ *
78
+ * 🔴 加手册 = 加一项。⛔ 不要再改动别处来让它出现(那正是改造前的老毛病)。
79
+ * 🔴 章节顺序 = 下面的书写顺序(**刻意按"新读者最可能先需要哪个"排**,不是字母序)。
80
+ */
81
+ export declare const MANUALS: readonly ManualEntry[];
82
+ /** 按 id 查找(大小写不敏感;不存在返回 null,由调用方给带候选的拒绝) */
83
+ export declare function findManual(id: string): ManualEntry | null;
84
+ /** 取一份手册的正文或指针(native 形态返回指针,⛔ 不返回被复制过来的正文) */
85
+ export declare function renderManual(m: ManualEntry): string;
86
+ /**
87
+ * 渲染**目录**(第一层)。
88
+ *
89
+ * 🔴 **只读元数据,绝不调 `render()`** —— 目录若触发正文,两层菜单就退化成一坨长文。
90
+ * 这条不是性能优化,是判据:**目录大小与章数成正比,与正文长度无关**。
91
+ *
92
+ * 🔴 每章给三件(旧的只给两件):**它是谁(title)/写给谁(audience)/何时读(when)**。
93
+ * 旧目录只给 id + summary ⇒ 读者得先通读简介才知道跟自己有没有关系,
94
+ * 而"我现在该不该读这一章"正是**手册能不能被用起来**的那一格(owner 说"老是忘更新",
95
+ * 根因与此同族:**没人按需想起它**)。
96
+ */
97
+ export declare function renderManualsIndex(entries?: readonly ManualEntry[]): string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shgroup/dsh-serenity-hooks",
3
- "version": "1.115.0",
3
+ "version": "1.116.0",
4
4
  "description": "宁静号 ACC harness(Native Cordis 插件)——给 DeepSeek Harness 装一个「AI 工作区」:12 个工具(container_fs/cognitive_trajectory/dashboard/container_git/msm/praxis/ontology/serenity-skill-creator/localstore/container_admin;另两个 im-bridge/diagram 按配置条件出现)+ 机械约束(安全模式/工作区围墙/密钥守卫/对外输出守卫)+ 认知轨迹日志与原地重建 + 网页登录入口/IM 桥/认知轨迹唤醒注册表。轨迹声明 = 轨迹目录下的 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": {