@shgroup/dsh-serenity-hooks 1.135.0 → 1.136.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/README.md CHANGED
@@ -1,6 +1,6 @@
1
- # 宁静号 ACC —— 给 DeepSeek Harness 装一个「AI 工作区」
1
+ # 宁静号 ACC —— 给 DeepSeek Harness 装一个「认知容器」
2
2
 
3
- > **一句话**:本插件把一个普通目录变成 AI 的**工作区**。进去之后,它自带**记忆、纪律、工具和边界**——
3
+ > **一句话**:本插件把一个普通目录变成 AI 的**认知容器**。进去之后,它自带**记忆、纪律、工具和边界**——
4
4
  > 中途换模型、重启机器、次日再来,都从上次停下的地方接着干。
5
5
 
6
6
  ## 1 它是什么 / 不是什么
@@ -12,11 +12,21 @@
12
12
  | **不是** | Agent 框架。不定义 agent loop、不选模型、不做 prompt 编排 —— 那是宿主的事 |
13
13
  | **不是** | DSH 的替代或分支。**本插件从不修改宿主本体** |
14
14
  | **不是** | 模型路由 / 网关。不代理模型请求,也不替你决定用哪个模型 |
15
- | **不是** | 某个工作区的私有产物。换一个符合标准的实现,同一个工作区照常工作 |
15
+ | **不是** | 某个容器的私有产物。换一个符合标准的实现,同一个容器照常工作 |
16
16
 
17
- **支持的宿主档位** = 包内 `package.json` 的 `peerDependencies`(现为 `^0.1.7-rc.1 || ^0.2.0-rc.1 || ^0.2.1-rc.1` 三档并行;加档减档以该文件为准)。
17
+ **支持的宿主档位** = 包内 `package.json` 的 `peerDependencies`。
18
18
  **当前版本 / 工具数 / 测试规模**:本文一律不写死 —— 版本看 [CHANGELOG.md](https://github.com/tellmewhattodo/dsh-serenity-plugin/blob/master/CHANGELOG.md),运行态看 `dashboard health`。
19
19
 
20
+ ### 三个概念(后面所有内容都建在这上面)
21
+
22
+ | 概念 | 是什么 | 住在哪 |
23
+ |---|---|---|
24
+ | **CCC**(Concrete Cognitive Container) | 一个目录 + 一个 `.serenity` 标记。**没有标记,插件完全不介入** | 就是那个目录 |
25
+ | **认知轨迹**(cognitive trajectory) | 一段**长期工程**,不是一次性对话。它没有生命周期:不完成、不关闭、永存 | `AGENT_SESSIONS/<日期>--<编码>--<名字>/SESSION.md` |
26
+ | **会话**(session) | 轨迹的**可重建载体**。模型会换、上下文会满、进程会重启 —— 换掉载体,轨迹不动 | 宿主侧的会话日志 |
27
+
28
+ > 一句话读法:**身份属于轨迹,不属于任何一次会话。** 这条区分了整个插件的行为。
29
+
20
30
  ## 2 快速开始(2 分钟)
21
31
 
22
32
  需要 Node ≥ 20(或 bun),以及一条受支持的 DSH 发布线。
@@ -46,11 +56,11 @@ dsh plugin --profile web add link:$(pwd)/hooks/dsh-serenity-hooks
46
56
 
47
57
  ⚠️ 不要用 `dsh plugin add github:…`:那个地址指向**仓库根**而不是插件包,装了不生效。
48
58
 
49
- **工作区 = 一个目录 + 一个标记文件**:
59
+ **容器就是一个目录 + 一个标记文件**:
50
60
 
51
61
  ```
52
- my-workspace/
53
- ├── .serenity ← 标记:这个目录是一个工作区(没有它,插件完全不介入)
62
+ my-container/
63
+ ├── .serenity ← 标记:这个目录是一个容器(没有它,插件完全不介入)
54
64
  ├── .opencode/skills/ ← 领域技能:一个领域一份知识,可自带小工具
55
65
  ├── AGENT_SESSIONS/ ← 库房:每条认知轨迹一个目录,SESSION.md 是它的身体
56
66
  └── _tmp/ ← 粘进对话的图片与文件落在这里
@@ -63,28 +73,32 @@ my-workspace/
63
73
  ### 3.1 十四个工具(其中三个按条件出现)
64
74
 
65
75
  > 这份清单**只在这里**(用户视角:能做什么)。**契约语义**(每个动作必须怎样)在标准的 §4,本文不复制。
76
+ > 增减以 `src/kernel/invariant.ts` 的 `REGISTERED_TOOLS` 为准 —— 那份常量由 `tests/compliance.test.ts` 与装配文本对读。
66
77
 
67
78
  | 工具 | 能做什么 |
68
79
  |---|---|
69
- | `container_fs` | 工作区内的文件操作:列目录 / 树 / 查找 / 复制 / 移动 / 新建 / 追加 / 在文件管理器中打开。往工作区外一步都出不去 |
80
+ | `container_fs` | 容器内的文件操作:列目录 / 树 / 查找 / 复制 / 移动 / 新建 / 在文件管理器中打开。往容器外一步都出不去 |
70
81
  | `cognitive_trajectory` | **一条认知轨迹**:它的身体(SESSION.md)+ 时间轴。建 / 看 / 切换 / 原地重建,以及**未来某刻唤醒**(`send-later`)与**即时递话**(`send-now`) |
71
- | `dashboard` | 常开仪表:`health`(三项自检)/ `time` / `wait` |
82
+ | `dashboard` | 常开仪表:`health`(三项自检)/ `time` / `diag`(运行态诊断) |
72
83
  | `container_git` | git:status / commit / push / log / pull / diff。**绝不自动强推** |
73
84
  | `msm` | 小工具单入口:`msm("名字", ["参数"])`;记不全给候选;`inspect=true` 看用法 |
74
85
  | `praxis` | 按需注入四套方法:`eap`(把话说清)/ `neat`(先对齐再动手)/ `cce`(连续性)/ `ontology`(把领域结构显式化) |
75
86
  | `ontology` | 本体工程**引擎**:读 `.ttl`,做结构校验与语义审查、写模板。与 `praxis ontology` 一个说、一个跑 |
76
87
  | `serenity-skill-creator` | 增强型技能的创建器:`guide` / `create` / `check` / `review` / `index` / `status` |
77
- | `localstore` | 凭据与本地偏好:工作区根的 `localstore.json`,默认拒绝入库 |
88
+ | `localstore` | 凭据与本地偏好:容器根的 `localstore.json`,默认拒绝入库 |
78
89
  | `container_admin` | 机务舱:`config`(说明目录 / 轨迹约束 / 当前配置)+ `msm`(注册表管理) |
90
+ | `browser_slot` | **浏览器槽位管理器**(最多 20 个独立 Chrome):`acquire` / `list` / `release` + 19 个页面动作(`ax` / `click` / `fill` / `wait` / `upload` / `dialog` …)。槽位有归属、有状态;忘了归还时**看守会反过来提醒占用它的会话** |
79
91
  | `im-bridge` ● | 给联系人发消息(微信 / 飞书):文本、文件、联系人、通道状态 |
80
92
  | `diagram` ● | 标签源码 → 图,**进程内**光栅化并贴进对话(不起浏览器、不落文件) |
81
93
  | `reconstruct` ● | **载体换代**:累计用量过大的会话换一条新会话并归档旧的(与 `rebuild` 并存:一个治日志体积,一个治上下文) |
82
94
 
83
- ● = **按条件出现**。条件不满足时**根本注册都不给它**(AI 连看都看不到,也不占上下文):`im-bridge` 要有已启用的 IM 通道;`diagram` 是实验性功能,**默认关**,开关在设置面板「工具」组;`reconstruct` 只在**本会话累计 token 超过阈值**时才对模型可见(四个用量桶全加,阈值 10 亿 —— 宿主自己的界面 pill 是同一口径)。
95
+ ● = **按条件出现**。条件不满足时**根本注册都不给它**(AI 连看都看不到,也不占上下文):`im-bridge` 要有已启用的 IM 通道;`diagram` 是实验性功能,**默认关**,开关在设置面板「工具」组;`reconstruct` 只在**本会话累计 token 超过阈值**时才对模型可见。
96
+
97
+ > **运行态诊断**:`dashboard diag`(常驻可见,无需任何声明)—— live 会话 / 唤醒时钟 / CRO 已启用轨迹 / 唤醒注册表(未来与已过期分列)。
84
98
 
85
- > **运行态诊断**(v1.106.0 起):原独立工具 `acc-diag` 已并入 **`dashboard` 的 `diag` 动作**(常驻可见,无需任何声明)——live 会话 / 唤醒时钟 / CRO 已启用轨迹 / 唤醒注册表(未来与已过期分列)。`exclusiveTools` 机制同批删除。
99
+ > **改名一律硬切、无兼容别名**:`cc_fs` → `container_fs`、`logbook` / `trajectory` → **`cognitive_trajectory`**、`eap` / `neat` / `cce` → `praxis`、`acc-diag` → **`dashboard diag`**。读到旧名时按此表换算。
86
100
 
87
- > **改名一律硬切、无兼容别名**:`cc_fs` → `container_fs`、`logbook` / `trajectory` → **`cognitive_trajectory`**、`eap` / `neat` / `cce` → `praxis`。读到旧名时按此表换算。
101
+ > 🔴 **已退役的动作与键**(读到它们是**上游资料陈旧**,不是你配错了):`container_fs` 的 `append`(v1.101.0 砍)/`dashboard` 的 `wait`(砍)/`exclusiveTools` 机制(砍)/`weixin.autoReplyWithLastMessage` 与 `weixin.fallbackOnNoSend`(D238 砍)。
88
102
 
89
103
  ### 3.2 机械约束(AI 绕不过去)
90
104
 
@@ -92,14 +106,17 @@ my-workspace/
92
106
 
93
107
  | 约束 | 你会看到什么 |
94
108
  |---|---|
95
- | **工作区围墙** | 墙内可用,墙外一律拒绝 —— 路径连解析都不做 |
109
+ | **容器围墙** | 墙内可用,墙外一律拒绝 —— 路径连解析都不做 |
96
110
  | **安全模式** | `bash` 从工具清单里消失(每一步都同步一次);即使强行调用也被兜底拒绝 |
97
111
  | **治理文件与黑名单** | `.serenity` 等治理文件禁止 AI 写入;其余路径黑名单可配置 |
98
112
  | **凭据守卫** | `localstore.json` 对**所有**工具拒绝(含 read / grep / glob)⇒ 密钥值在结构上出不去 |
99
- | **对外输出守卫** | 对外向的会话(受限轨迹 / 重建会话)若答出敏感词 ⇒ **打回重答**,并告知命中的词与修改方向 |
113
+ | **对外输出守卫** | 对外向的会话若答出敏感词 ⇒ **打回重答**,并告知命中的词与修改方向 |
100
114
  | **进度提醒** | 做久了提醒 AI「把进度写回工作日志」,并要求它回一个确认码 —— 提醒是机制,不依赖自觉 |
101
115
  | **日志体积治理** | `SESSION.md` 超过阈值 ⇒ 提醒重写(保留骨架 / 细节外移 / 可并则并)。阈值 `sessionKeeper.sessionMdMaxKB`,0 = 关 |
102
- | **重建前交接** | 重建上下文前,先把「做到哪 / 差什么 / 下一步」写进轨迹目录的 `REBUILD-TODO.md`;重建后的自己先读它 |
116
+ | **日志自动轮转** | 重建上下文时,把细粒度日志 `LOG/LOG.md` **整份冻结**成 `LOG-<时间戳>.md` 并开新代。**重名自动避让、永不覆盖**、冻结后回读校验字节数 |
117
+
118
+ > **为什么最后一条值得单列**:它原本是「提醒 AI 记得轮转」的一条纪律 —— 而纪律的失效形态是
119
+ > **AI 忘了、没有任何信号、日志无限长**。移到重建路径上之后,忘不忘都一样。
103
120
 
104
121
  ## 4 对外入口(可选)
105
122
 
@@ -107,7 +124,7 @@ my-workspace/
107
124
  |---|---|---|
108
125
  | DSH 主界面 | 3080 | 本机自用。**插件不碰这个端口**,也不起这个监听器 |
109
126
  | 网页登录入口 | 3081(**默认关**) | 手机 / 外网访问完整界面:密码或 6 位动态验证码二选一,按账号失败锁定,登录后反代到 3080 |
110
- | 微信主动发送口 | 3082(只绑 `127.0.0.1`) | 工作区**外**的脚本用它发微信;工作区内的 AI 不用它,直接用 `im-bridge` |
127
+ | 微信主动发送口 | 3082(只绑 `127.0.0.1`) | 容器**外**的脚本用它发微信;容器内的 AI 不用它,直接用 `im-bridge` |
111
128
  | 微信桥 | 无端口(出站长轮询) | 家人在微信里直接跟 AI 说话:扫码绑定,收文字 / 语音 / 图片 / 文件 |
112
129
 
113
130
  - **会话挂在轨迹上**:同一条轨迹固定同一个会话,重启后历史还在(身份在人这一层之外)。
@@ -118,7 +135,7 @@ my-workspace/
118
135
  ## 5 常见问题
119
136
 
120
137
  **装完没反应?**
121
- 先确认你进的是带 `.serenity` 的目录 —— 不是工作区,插件完全不介入。进去后输入 `dashboard health` 看三项自检。
138
+ 先确认你进的是带 `.serenity` 的目录 —— 不是容器,插件完全不介入。进去后输入 `dashboard health` 看三项自检。
122
139
 
123
140
  **`bash` 怎么不见了?**
124
141
  安全模式开着。这是设计,不是故障:关掉胶囊里的 SAFE 滑块就回来。
@@ -136,10 +153,10 @@ my-workspace/
136
153
  不用。插件只补 `x-opencode-session` 这一族**缺的**头,**你写过的值一律不动**;环境里有 `OPENCODE_API_KEY` 而一个 opencode 路由都没有时会自动建一条。不需要就关 `opencodeProvider.autoConfigure`。
137
154
 
138
155
  **微信里 AI 的回复是怎么发出去的?**
139
- 默认由插件把它最后一段话转给用户;配 `autoReplyWithLastMessage: false` 后改由 AI 自己发(`im-bridge`),该发没发会被打回提醒(最多 2 次),再开 `fallbackOnNoSend` 可让插件兜底转达。
156
+ 由 **AI 自己发**(`im-bridge`)—— 这是现在**唯一**路径。桥只在两个方向上做事:把入站消息变成一轮对话,以及**当 AI 该发却没发时打回提醒**(最多 2 次)。它不替 AI 说话,也没有兜底转发开关(两个旧开关已退役,见 §3.1)。
140
157
 
141
158
  **主动发的消息会被记录吗?**
142
- 会,跟回复走同一条记录通道,事件里用 `source` 区分 `reply` / `proactive` / `reply-fallback`。
159
+ 会,跟回复走同一条记录通道,事件里用 `source` 区分。
143
160
 
144
161
  **轨迹声明、定时唤醒、CRO 怎么配?**
145
162
  本文不展开,各归其位:**声明面**(`trajectory.json` 能写什么、缺省是什么)在标准 §3.0.1;**工具自带手册**是 `container_admin config docs trajectory-self`(描述自己)与 `config docs trajectory-constraint`(限制自己);**CRO 编写指南**是 `cognitive_trajectory cro-guide`。
package/dsh.plugin.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "id": "dsh-serenity-hooks",
3
- "version": "1.135.0",
3
+ "version": "1.136.0",
4
4
  "main": "lib/index.js",
5
5
  "description": "宁静号 ACC harness(Native Cordis 插件):给 DSH 装一个「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(三档,deepseek-ai/deepseek-harness)。",
6
6
  "engines": {
@@ -1,4 +1,4 @@
1
- import { c as readWeixinSettings, o as readImSettings } from "./route-C2rARdoU.js";
1
+ import { c as readWeixinSettings, o as readImSettings } from "./route-DcUo9alz.js";
2
2
  import { isAbsolute, join, relative, resolve } from "node:path";
3
3
  import { existsSync, readFileSync, readdirSync, statSync } from "node:fs";
4
4
  //#region src/im/log-scan.ts
@@ -10,13 +10,13 @@
10
10
  * **本地维护会话(普通 dsh 会话)不检测**——维护会话必然提及机制词
11
11
  * (dsh-serenity-hooks/cognitive_trajectory rebuild/mech-registry),打回会瘫痪自身工作。
12
12
  *
13
- * 🔴 **2026-10-15 补注(面 E 退役)**:`acp-` 前缀分支**已成孤儿,但本批不动**。
13
+ * 🔴 **2026-11-15(owner 令「ACP 已经下架了,所有的代码清除」):`acp-` 前缀分支已删除。**
14
14
  * 判据(两条,实测):① **该前缀从来没有生产者** —— 历史 `acp-core.ts` 建会话走的是
15
15
  * `createTrajectoryAgent`,其 id = `` `轨迹约束-${role}-${uuid}` ``(`trajectory/session.ts`)⇒ `acp-` **从不出现**;
16
- * ② 面 E 退役后连"本可能产生它的模块"也不在了。⇒ 该分支是**恒 false 的死判据**。
17
- * ⚠️ **仍不擅自删**:这是**运行时字符串比较**,删它属**行为变更**(不是纯清理),
18
- * 依本轨既有先例(`cheap-worker-` 前缀孤儿 —— 生产者文件已于 2026-10-28 整条删除,
19
- * 但四处判断保留作兼容,同族、同判据)⇒ **登记待裁**(见 S142 §当前状态「观察」)。
16
+ * ② 面 E 退役后连"本可能产生它的模块"也不在了。⇒ 该分支此前是**恒 false 的死判据**。
17
+ * ⚠️ 此前一轮我登记「不擅自删(删它属行为变更)」;**本次 owner 明令清除所有 ACP 代码** ⇒ 删。
18
+ * 反向钉:`tests/output-guard.test.ts` 有一条钉「`acp-` 前缀**不再**被特殊对待」——
19
+ * 万一将来有人复活该前缀,那条会红(而不是静默恢复旧行为)。
20
20
  */
21
21
  import type { Context } from 'cordis';
22
22
  import type { Agent } from '@deepseek-ai/dsh-agent';
package/lib/index.js CHANGED
@@ -4,15 +4,15 @@ import { a as findSerenityRoot$1, d as readCccName, g as resolveInside, l as pat
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-BRUHmVFn.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-BYeykzys.js";
7
- import { C as runMsmAsync, S as runMsm, T as setWeixinSendEndpoint, _ as ACC_CATALOG, a as loadOpencodeSkill, b as findEntry, c as summarizeHostContract, f as forgetNonCccToolVisibility, g as forgetToolVisibility, h as syncToolVisibility, i as listOpencodeSkillDirs, m as registerGuards, n as readDshVersion, o as compareSemver, r as setSafeMode, s as hostContractReport, t as getStatus, v as CCC_CONFIG_REFERENCE, w as docsPointer, x as loadMsmEntries } from "./status-thzfjL_4.js";
7
+ import { C as runMsmAsync, S as runMsm, T as setWeixinSendEndpoint, _ as ACC_CATALOG, a as loadOpencodeSkill, b as findEntry, c as summarizeHostContract, f as forgetNonCccToolVisibility, g as forgetToolVisibility, h as syncToolVisibility, i as listOpencodeSkillDirs, m as registerGuards, n as readDshVersion, o as compareSemver, r as setSafeMode, s as hostContractReport, t as getStatus, v as CCC_CONFIG_REFERENCE, w as docsPointer, x as loadMsmEntries } from "./status-Bn4hLNOX.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-DpxC9HtB.js";
9
- import { A as TRAJECTORY_PROMPT_FILENAME, C as recordToolUsage, D as buildResourceNameSuffix, E as buildResourceIndex, O as isSafeSkillName, S as verifyTotpCode, T as SKILL_ONTOLOGY_FILE, _ as projectKnownWorkspaces, a as trajectoryConstraintFor, b as FACE_PORTS, c as trajectoryWorkspaceMdPath, d as splitModel, f as registerCognitiveTrajectorySkillSection, g as migrateLegacyLocalstore, h as applyWirePatch, i as getTrajectoryAgent, j as hasTrajectoryPrompt, k as truncateContent, 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 REFERENCE_DIR, x as MECHANISM_PORTS, y as toWire } from "./session-_8f00rIA.js";
9
+ import { A as TRAJECTORY_PROMPT_FILENAME, C as recordToolUsage, D as buildResourceNameSuffix, E as buildResourceIndex, O as isSafeSkillName, S as verifyTotpCode, T as SKILL_ONTOLOGY_FILE, _ as projectKnownWorkspaces, a as trajectoryConstraintFor, b as FACE_PORTS, c as trajectoryWorkspaceMdPath, d as splitModel, f as registerCognitiveTrajectorySkillSection, g as migrateLegacyLocalstore, h as applyWirePatch, i as getTrajectoryAgent, j as hasTrajectoryPrompt, k as truncateContent, 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 REFERENCE_DIR, x as MECHANISM_PORTS, y as toWire } from "./session-DOLQCYo5.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, u as listBoundSessionIds } from "./injection-CKx49Mlf.js";
11
11
  import { _ as WAKE_CATCH_UP_MS, c as formatPendingTools, d as listRunningSessionIds, f as registerCroTurnTracking, g as CARRIER_OPENING_MARK, i as sendToCognitiveTrajectory, l as projectDirNameForCwd, m as buildCroSnapshot, n as registerWakeScheduler, o as DEFAULT_LOOKBACK_MS, p as registerDisposer, s as createResumeOne, t as createAndBindTarget, u as scanInterruptedSessions, v as addWake } from "./scheduler-Cbz5ou-X.js";
12
12
  import { i as sessionsRootDir } from "./cleanup-CPl1SSaK.js";
13
13
  import { i as hostAliveProbe, n as readSimpleSettings, r as registerSettingsSection } from "./settings-CUabGkal.js";
14
- import { a as readFeishuCredential, c as readWeixinSettings, d as weixinInboundDir, f as weixinSessionIdForTrajectory, i as matchWeixinRoute, n as extractWeixinText, r as hasVoiceItem, s as readWeixinCredential, t as extractWeixinMedia, u as sanitizeFileName$1 } from "./route-C2rARdoU.js";
15
- import { i as runImBridge, n as isImWiredTrajectory, r as registerImChannel, t as imChannelIds } from "./channels-w8H6l04X.js";
14
+ import { a as readFeishuCredential, c as readWeixinSettings, d as weixinInboundDir, f as weixinSessionIdForTrajectory, i as matchWeixinRoute, n as extractWeixinText, r as hasVoiceItem, s as readWeixinCredential, t as extractWeixinMedia, u as sanitizeFileName$1 } from "./route-DcUo9alz.js";
15
+ import { i as runImBridge, n as isImWiredTrajectory, r as registerImChannel, t as imChannelIds } from "./channels-Covd8vLQ.js";
16
16
  import { i as subscriptionStats, n as registerTrajectorySubscriptions, r as subscriptionEval, t as defaultSubscriptionDeps } from "./subscriptions-CMhWkapn.js";
17
17
  import { c as sendTextMessage, i as getUpdates, l as sendTyping, n as downloadMedia, o as markdownToPlainText, r as getConfig, s as sendFileMessage, t as TypingStatus, u as sniffImageExt } from "./ilink-CsZ-f64q.js";
18
18
  import { a as registerImAccountImpl, i as normalizeAccountChannel, n as getImAccountImpl, r as imAccountChannels } from "./accounts-BHQbakUh.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-VUiQdjqd.js");
518
+ const { containerStatus } = await import("./observation-79bQvQrW.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-B92214NE.js");
564
+ const { runDiag, renderDiag } = await import("./service-qCHG2KLS.js");
565
565
  return renderDiag(await runDiag(hostCtx, root ?? ""));
566
566
  }
567
567
  default: throw new Error(`Unknown action: ${args.action}`);
@@ -918,7 +918,7 @@ function renderText$10(value) {
918
918
  }
919
919
  const gitTool = defineTool({
920
920
  name: "container_git",
921
- description: "CCC git operations (cc-git semantics, aligned with osp). status/commit/push/log/pull/diff. commit 默认**随后自动 push**(noPush 可关);commit 传 paths ⇒ 只提交这些路径(不传=整仓 add -A,回执会显式告知)。push 成功判据 = --porcelain 的 ref 行(**超时/未确认一律不报成功**,回执给 `git ls-remote` 核验指令);非快进 push/pull 输出 [REJECTED] + 建议(never auto-force)。merge/rebase/conflict resolution go through bash.",
921
+ description: "CCC git operations (cc-git semantics, aligned with osp). status/commit/push/log/pull/diff. commit pushes right after committing by default (pass noPush to skip); commit with paths ⇒ only those paths (omitting paths = whole-repo `add -A`, and the receipt says so explicitly). push success criterion = the ref line of `--porcelain` (a timeout or an unconfirmed result is NEVER reported as success; the receipt hands you a `git ls-remote` verification command). A non-fast-forward push/pull prints [REJECTED] plus advice (never auto-force). merge/rebase/conflict resolution go through bash.",
922
922
  parameters: {
923
923
  action: {
924
924
  type: "string",
@@ -933,11 +933,11 @@ const gitTool = defineTool({
933
933
  paths: {
934
934
  type: "array",
935
935
  items: { type: "string" },
936
- description: "commit: 只提交这些路径(如 [\"docs/a.md\",\"src/b.ts\"])。不传 = 整仓 `git add -A`(会吸走其它轨迹的在途文件,回执会显式提示)"
936
+ description: "commit: submit only these paths (e.g. [\"docs/a.md\",\"src/b.ts\"]). Omitting it = whole-repo `git add -A`, which also sweeps up other trajectories' in-flight files — the receipt warns about this explicitly"
937
937
  },
938
938
  noPush: {
939
939
  type: "boolean",
940
- description: "commit: 只提交到本地,不随后推送(默认提交后自动推送)"
940
+ description: "commit: commit locally only, without pushing afterwards (default: push automatically)"
941
941
  },
942
942
  count: {
943
943
  type: "integer",
@@ -7785,7 +7785,7 @@ function viewConfigSummary(root) {
7785
7785
  cccRoot: root,
7786
7786
  sections: Object.keys(cfg),
7787
7787
  values: toJson(cfg),
7788
- note: "这是**现值摘要**(只报有值的键、超长已截断)。每段怎么填、填错会怎样 ⇒ container_admin config docs config"
7788
+ note: "This is a **current-value summary** (only keys with values are shown; long values truncated). How to fill each section, and what a wrong value does ⇒ container_admin config docs config"
7789
7789
  };
7790
7790
  }
7791
7791
  function renderText$3(value) {
@@ -7839,13 +7839,13 @@ const DOCS_CHAPTERS = MANUALS;
7839
7839
  function createContainerAdminTool(ctx) {
7840
7840
  return defineTool({
7841
7841
  name: "container_admin",
7842
- description: "Container administration (the ship's maintenance bay — one entry for managing the CCC): config — CCC configuration: docs (usage-manual index) / docs <chapter> (one chapter in full) / view (current values) + 轨迹约束 (guide/validate/apply/list); msm — MSM registry management (register/deregister/check quality DC-M1~M4) + manuals (guide dev manual / catalog ACC capability directory / ccc-config CCC configuration reference). TRAJECTORY SELF-DOCS: a cognitive trajectory describing ITSELF — charter (PROMPT.md) / resident declaration / self-restriction (whitelists) ⇒ config docs trajectory-self; the restriction side only ⇒ config docs trajectory-constraint. IM BRIDGE: how to send / configure routes / look up the other party's channel user id — send / send-file / users / status / contacts + the three-step route recipe ⇒ config docs im-bridge. Execution of registered MSMs belongs to the msm tool; this tool manages the container.",
7842
+ description: "Container administration (the ship's maintenance bay — one entry for managing the CCC): config — CCC configuration: docs (usage-manual index) / docs <chapter> (one chapter in full) / view (current values) + trajectory constraint (guide/validate/apply/list); msm — MSM registry management (register/deregister/check quality DC-M1~M4) + manuals (guide dev manual / catalog ACC capability directory / ccc-config CCC configuration reference). TRAJECTORY SELF-DOCS: a cognitive trajectory describing ITSELF — charter (PROMPT.md) / resident declaration / self-restriction (whitelists) ⇒ config docs trajectory-self; the restriction side only ⇒ config docs trajectory-constraint. IM BRIDGE: how to send / configure routes / look up the other party's channel user id — send / send-file / users / status / contacts + the three-step route recipe ⇒ config docs im-bridge. Execution of registered MSMs belongs to the msm tool; this tool manages the container.",
7843
7843
  parameters: {
7844
7844
  domain: {
7845
7845
  type: "string",
7846
7846
  enum: DOMAIN_NAMES,
7847
7847
  required: true,
7848
- description: "Management domain: config (CCC configuration + 轨迹约束) / msm (MSM registry + manuals)"
7848
+ description: "Management domain: config (CCC configuration + trajectory constraint) / msm (MSM registry + manuals)"
7849
7849
  },
7850
7850
  action: {
7851
7851
  type: "string",
@@ -7918,9 +7918,9 @@ function createContainerAdminTool(ctx) {
7918
7918
  case "view":
7919
7919
  case "": return {
7920
7920
  config: viewConfigSummary(root),
7921
- docs: "完整配置说明(每段怎么填、填错会怎样)→ container_admin config docs config"
7921
+ docs: "Full configuration reference (how to fill each section, what a wrong value does) → container_admin config docs config"
7922
7922
  };
7923
- case "guide": return { guide: docsPointer("trajectory-constraint", "轨迹约束教程") };
7923
+ case "guide": return { guide: docsPointer("trajectory-constraint", "trajectory constraint guide") };
7924
7924
  case "validate": return validateTrajectoryConstraint(root);
7925
7925
  case "apply": return applyTrajectoryConstraint(root);
7926
7926
  case "list": return listTrajectoryConstraintSummary(root);
@@ -8491,6 +8491,117 @@ const ACK_PREFIX = `${ASSISTANT_PREFIX}-recorded`;
8491
8491
  * 🔴 **不得改名**(owner 已具名)。形态 = **固定文件名**(人读友好;比照旧 IN_FLIGHT_HEADING 的取舍)。
8492
8492
  */
8493
8493
  const REBUILD_TODO_FILENAME = "REBUILD-TODO.md";
8494
+ /** 当前代的固定文件名。**名字即指针** —— 改成 A/B 双槽会引入"谁是当前"这个外部事实。 */
8495
+ const LOG_FILE = "LOG.md";
8496
+ /** 冻结日志的命名:`LOG-<YYYY-MM-DDTHHmm>.md`(**本地时区,分钟级**)。 */
8497
+ function frozenLogName(now) {
8498
+ const p = (n) => String(n).padStart(2, "0");
8499
+ return `LOG-${now.getFullYear()}-${p(now.getMonth() + 1)}-${p(now.getDate())}T${p(now.getHours())}${p(now.getMinutes())}.md`;
8500
+ }
8501
+ /**
8502
+ * 判断一份日志内容是否"实质上为空"。
8503
+ *
8504
+ * 判据:去掉空行与**标题行**(`# …`)与引用块(`> …`)之后,还剩不剩字符。
8505
+ * 🔴 为什么剔除标题与引用:出生头本身就是"标题 + 两行引用说明",
8506
+ * 若按裸字节判非空,**刚开的新代立刻会被判为"有内容可冻结"** ⇒ 产生一堆只有出生头的垃圾归档。
8507
+ */
8508
+ function isEffectivelyEmpty(text) {
8509
+ for (const line of text.split("\n")) {
8510
+ const t = line.trim();
8511
+ if (t === "") continue;
8512
+ if (t.startsWith("#")) continue;
8513
+ if (t.startsWith(">")) continue;
8514
+ return false;
8515
+ }
8516
+ return true;
8517
+ }
8518
+ /** 列出已冻结的日志文件名(`LOG-*.md`),按名字升序(= 时间升序)。 */
8519
+ function listFrozen(dir) {
8520
+ if (!existsSync(dir)) return [];
8521
+ let names;
8522
+ try {
8523
+ names = readdirSync(dir);
8524
+ } catch {
8525
+ return [];
8526
+ }
8527
+ return names.filter((n) => n.startsWith("LOG-") && n.endsWith(".md")).sort();
8528
+ }
8529
+ /**
8530
+ * 生成新一代 `LOG.md` 的出生头。
8531
+ *
8532
+ * ⚠️ **措辞归 CCC**:这里只给一个**可替换的默认模板**,各轨迹可以在自己的 PROMPT.md 里
8533
+ * 声明别的写法(ACC 不解析它,只保证"新代存在且非空")。
8534
+ *
8535
+ * @param generation 代数(1 起)
8536
+ * @param now 出生时刻
8537
+ * @param previousFrozen 上一代冻结文件名(无则 null)
8538
+ */
8539
+ function birthHeader(generation, now, previousFrozen) {
8540
+ const p = (n) => String(n).padStart(2, "0");
8541
+ return [
8542
+ `# LOG — generation ${generation} (born ${`${now.getFullYear()}-${p(now.getMonth() + 1)}-${p(now.getDate())}T${p(now.getHours())}:${p(now.getMinutes())}`})`,
8543
+ "",
8544
+ previousFrozen === null ? "> First generation for this trajectory." : `> Previous generation frozen as: \`LOG/${previousFrozen}\``,
8545
+ "> This file holds fine-grained process (how we tried, what broke, what we read).",
8546
+ "> High-level abstraction lives in SESSION.md. The boundary is declared in PROMPT.md.",
8547
+ ""
8548
+ ].join("\n");
8549
+ }
8550
+ /**
8551
+ * 轮转当前代 → 冻结,并开新代。
8552
+ *
8553
+ * 🔴 **顺序不可换**(每一步都防一个具体的静默失败):
8554
+ * ① 判空:实质为空 ⇒ 不轮转(否则产生垃圾归档,代数不可信)
8555
+ * ② 定名:目标已存在 ⇒ 加 `-2`/`-3`…(⛔ 覆盖 = 静默丢一代)
8556
+ * ③ rename **之后**回读校验:字节数必须与轮转前相同
8557
+ * ④ 开新代:新建空文件 → 写出生头
8558
+ *
8559
+ * @returns 轮转回执。**调用方必须检查 `verified`** —— rename 成功不等于目标对。
8560
+ */
8561
+ function rotateCarrierLog(trajectoryDir, now = /* @__PURE__ */ new Date()) {
8562
+ const dir = join(trajectoryDir, "LOG");
8563
+ const live = join(dir, LOG_FILE);
8564
+ const skipped = {
8565
+ rotated: false,
8566
+ frozenAs: null,
8567
+ bytesBefore: 0,
8568
+ verified: false,
8569
+ renamedFrom: null
8570
+ };
8571
+ if (!existsSync(live)) {
8572
+ mkdirSync(dir, { recursive: true });
8573
+ if (!existsSync(live)) writeFileSync(live, birthHeader(1, now, null), "utf-8");
8574
+ return skipped;
8575
+ }
8576
+ const text = readFileSync(live, "utf-8");
8577
+ if (isEffectivelyEmpty(text)) return skipped;
8578
+ mkdirSync(dir, { recursive: true });
8579
+ const bytesBefore = Buffer.byteLength(text, "utf-8");
8580
+ const base = frozenLogName(now).replace(/\.md$/, "");
8581
+ let target = `${base}.md`;
8582
+ let renamedFrom = null;
8583
+ if (existsSync(join(dir, target))) {
8584
+ renamedFrom = target;
8585
+ let n = 2;
8586
+ while (existsSync(join(dir, `${base}-${n}.md`))) n++;
8587
+ target = `${base}-${n}.md`;
8588
+ }
8589
+ const dst = join(dir, target);
8590
+ if (existsSync(dst)) return skipped;
8591
+ renameSync(live, dst);
8592
+ const verified = existsSync(dst) && statSync(dst).size === bytesBefore;
8593
+ if (!existsSync(live)) {
8594
+ const frozen = listFrozen(dir);
8595
+ writeFileSync(live, birthHeader(frozen.length + 1, now, target), "utf-8");
8596
+ }
8597
+ return {
8598
+ rotated: true,
8599
+ frozenAs: target,
8600
+ bytesBefore,
8601
+ verified,
8602
+ renamedFrom
8603
+ };
8604
+ }
8494
8605
  //#endregion
8495
8606
  //#region src/trajectory/rebuild.ts
8496
8607
  var rebuild_exports = /* @__PURE__ */ __exportAll({
@@ -8656,6 +8767,15 @@ async function queueRebuild(ctx, opts) {
8656
8767
  note: "rebuild queued"
8657
8768
  };
8658
8769
  appendBound(session, "rebuild", boundRec);
8770
+ try {
8771
+ const rot = rotateCarrierLog(dirname(mdPath));
8772
+ if (rot.rotated) {
8773
+ if (!rot.verified) console.warn(`[serenity-hooks] ⚠️ LOG 轮转回读校验失败:${rot.frozenAs} 的字节数不等于轮转前的 ${rot.bytesBefore} B。 rebuild 照常进行;请人工核对 LOG/ 目录。`);
8774
+ else console.log(`[serenity-hooks] ✓ LOG 轮转:${rot.bytesBefore} B → LOG/${rot.frozenAs}(回读校验通过)` + (rot.renamedFrom !== null ? `;原定名 ${rot.renamedFrom} 已存在 ⇒ 改名避让(⛔ 未覆盖)` : ""));
8775
+ }
8776
+ } catch (e) {
8777
+ console.warn(`[serenity-hooks] ⚠️ LOG 轮转未执行(${e.message})—— rebuild 不受影响`);
8778
+ }
8659
8779
  pendingRebuilds.set(dshSessionId, {
8660
8780
  anchor,
8661
8781
  summary,
@@ -10706,11 +10826,11 @@ function registerStatusApi(ctx, opts = {}) {
10706
10826
  sendJson$2(res, 400, { error: chk.error });
10707
10827
  return;
10708
10828
  }
10709
- const { readWeixinSettings } = await import("./route-C2rARdoU.js").then((n) => n.l);
10829
+ const { readWeixinSettings } = await import("./route-DcUo9alz.js").then((n) => n.l);
10710
10830
  const { weixinBridgeStatus } = await Promise.resolve().then(() => bridge_exports);
10711
10831
  const settings = readWeixinSettings(chk.root);
10712
10832
  const bridge = weixinBridgeStatus().find((b) => b.ccc === chk.root);
10713
- const { imCredentialBound } = await import("./route-C2rARdoU.js").then((n) => n.l);
10833
+ const { imCredentialBound } = await import("./route-DcUo9alz.js").then((n) => n.l);
10714
10834
  const { normalizeAccountChannel } = await import("./accounts-BHQbakUh.js").then((n) => n.t);
10715
10835
  const accounts = (settings.accounts ?? []).map((a) => {
10716
10836
  const channel = normalizeAccountChannel(a.channel);
@@ -10747,7 +10867,7 @@ function registerStatusApi(ctx, opts = {}) {
10747
10867
  const { fetchQRCode } = await import("./ilink-CsZ-f64q.js").then((n) => n.a);
10748
10868
  const { randomUUID } = await import("node:crypto");
10749
10869
  for (const [key, v] of weixinLogins) if (Date.now() - v.startedAt > WEIXIN_LOGIN_TTL_MS) weixinLogins.delete(key);
10750
- const { readWeixinSettings } = await import("./route-C2rARdoU.js").then((n) => n.l);
10870
+ const { readWeixinSettings } = await import("./route-DcUo9alz.js").then((n) => n.l);
10751
10871
  const qr = await fetchQRCode({ botType: readWeixinSettings(root).botType ?? void 0 });
10752
10872
  const loginKey = randomUUID();
10753
10873
  weixinLogins.set(loginKey, {
@@ -10768,7 +10888,7 @@ function registerStatusApi(ctx, opts = {}) {
10768
10888
  sendJson$2(res, 400, { error: "missing accountId" });
10769
10889
  return;
10770
10890
  }
10771
- const { removeWeixinAccount } = await import("./route-C2rARdoU.js").then((n) => n.l);
10891
+ const { removeWeixinAccount } = await import("./route-DcUo9alz.js").then((n) => n.l);
10772
10892
  const { syncCccBridge } = await Promise.resolve().then(() => bridge_exports);
10773
10893
  removeWeixinAccount(root, body.accountId);
10774
10894
  syncCccBridge(ctx, root);
@@ -10794,7 +10914,7 @@ function registerStatusApi(ctx, opts = {}) {
10794
10914
  trajectory: code
10795
10915
  });
10796
10916
  }
10797
- const { saveWeixinRoutes } = await import("./route-C2rARdoU.js").then((n) => n.l);
10917
+ const { saveWeixinRoutes } = await import("./route-DcUo9alz.js").then((n) => n.l);
10798
10918
  const { findDirNameByCode } = await import("./profile-DpxC9HtB.js").then((n) => n.a);
10799
10919
  for (const r of routes) if (findDirNameByCode(root, r.trajectory) === null) {
10800
10920
  sendJson$2(res, 400, { error: `unknown trajectory: ${r.trajectory} (no such trajectory code in ${root})` });
@@ -10806,7 +10926,7 @@ function registerStatusApi(ctx, opts = {}) {
10806
10926
  }
10807
10927
  if (body.action === "set-enabled") {
10808
10928
  const enabled = body.enabled === true;
10809
- const { readWeixinSettings, setWeixinEnabled } = await import("./route-C2rARdoU.js").then((n) => n.l);
10929
+ const { readWeixinSettings, setWeixinEnabled } = await import("./route-DcUo9alz.js").then((n) => n.l);
10810
10930
  const { syncCccBridge } = await Promise.resolve().then(() => bridge_exports);
10811
10931
  const settings = readWeixinSettings(root);
10812
10932
  if (enabled && (settings.accounts ?? []).length === 0) {
@@ -10829,7 +10949,7 @@ function registerStatusApi(ctx, opts = {}) {
10829
10949
  sendJson$2(res, 400, { error: "appId 与 appSecret 都必须填(只填一个等于没绑)" });
10830
10950
  return;
10831
10951
  }
10832
- const { readWeixinSettings, upsertWeixinAccount, writeFeishuCredential, nextFeishuAccountId } = await import("./route-C2rARdoU.js").then((n) => n.l);
10952
+ const { readWeixinSettings, upsertWeixinAccount, writeFeishuCredential, nextFeishuAccountId } = await import("./route-DcUo9alz.js").then((n) => n.l);
10833
10953
  const { syncCccBridge } = await Promise.resolve().then(() => bridge_exports);
10834
10954
  const before = readWeixinSettings(root);
10835
10955
  const accountId = (body.accountId ?? "").trim() !== "" ? body.accountId.trim() : nextFeishuAccountId(before);
@@ -10879,7 +10999,7 @@ function registerStatusApi(ctx, opts = {}) {
10879
10999
  return;
10880
11000
  }
10881
11001
  const { pollQRStatus } = await import("./ilink-CsZ-f64q.js").then((n) => n.a);
10882
- const { readWeixinSettings } = await import("./route-C2rARdoU.js").then((n) => n.l);
11002
+ const { readWeixinSettings } = await import("./route-DcUo9alz.js").then((n) => n.l);
10883
11003
  const settings = readWeixinSettings(login.root);
10884
11004
  const status = await pollQRStatus({
10885
11005
  baseUrl: void 0,
@@ -10894,7 +11014,7 @@ function registerStatusApi(ctx, opts = {}) {
10894
11014
  });
10895
11015
  return;
10896
11016
  }
10897
- const { upsertWeixinAccount, writeWeixinCredential, nextWeixinAccountId } = await import("./route-C2rARdoU.js").then((n) => n.l);
11017
+ const { upsertWeixinAccount, writeWeixinCredential, nextWeixinAccountId } = await import("./route-DcUo9alz.js").then((n) => n.l);
10898
11018
  const { syncCccBridge } = await Promise.resolve().then(() => bridge_exports);
10899
11019
  const accountId = nextWeixinAccountId(settings);
10900
11020
  upsertWeixinAccount(login.root, {
@@ -14374,7 +14494,6 @@ const MECHANISM_WORDS = [
14374
14494
  "fake-initial-turns",
14375
14495
  "拦截缝",
14376
14496
  "装配层",
14377
- "acp-core",
14378
14497
  "trajectory-session",
14379
14498
  "trajectory-window",
14380
14499
  "trajectory-constraint",
@@ -14482,13 +14601,12 @@ const rebukeStates = /* @__PURE__ */ new Map();
14482
14601
  * **错的**——轨迹约束的身份是轨迹,不再由 id 前缀表达;继续用前缀会漏掉所有
14483
14602
  * "挂在 轨迹约束轨迹上、但 id 不带前缀"的会话(典型 = 微信桥按轨迹派生的会话 id)。
14484
14603
  *
14485
- * ⚠️ `rebuild-` 前缀保留(那是另一件事:重建会话同属对外面,与 轨迹约束 无关);
14486
- * `acp-` 分支保留但**已是死判据**(无生产者;面 E 已于 2026-10-15 退役)——
14487
- * 理由与"为何不擅自删"见文件头注释。
14604
+ * ⚠️ `rebuild-` 前缀保留(那是另一件事:重建会话同属对外面,与 轨迹约束 无关)。
14605
+ * `acp-` 分支已于 2026-11-15 删除(owner 令清除所有 ACP 代码,见文件头注释)。
14488
14606
  */
14489
14607
  function isExternalFaceSession(sessionId, root) {
14490
14608
  if (!sessionId) return false;
14491
- return isTrajectoryConstrained(root, sessionId) || sessionId.startsWith("acp-") || sessionId.startsWith("rebuild-");
14609
+ return isTrajectoryConstrained(root, sessionId) || sessionId.startsWith("rebuild-");
14492
14610
  }
14493
14611
  /** 读会话最后一个 assistant/message 文本(trajectory-session 同款)
14494
14612
  * **v1.63.3 起唯一的导出理由消失**:原导出是给 `unattended-seam.ts` 复用的(D77),
@@ -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-DSMqTrRU.js";
2
2
  import { u as ACC_VERSION } from "./rules-BYeykzys.js";
3
- import { n as readDshVersion, s as hostContractReport, y as checkRegistryQuality } from "./status-thzfjL_4.js";
3
+ import { n as readDshVersion, s as hostContractReport, y as checkRegistryQuality } from "./status-Bn4hLNOX.js";
4
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";
@@ -132,9 +132,18 @@ function readImSettings(root, paths = DEFAULT_SERENITY_CONFIG_PATHS) {
132
132
  /**
133
133
  * 判别一个 `im` 段是不是**新的统一形态**。
134
134
  *
135
- * 判据 = `accounts` 是数组 **且** 每行(若有)不带退役 ACP 的 `accountId` 之外的 ACP 形状;
136
- * 退役 ACP 形态的特征是顶层有 `channel:"acp"` 或 `acp` 对象。
135
+ * 判据 = `accounts` 是数组 **且** 不带已退役 ACP 的形状;
136
+ * 已退役 ACP 形态的特征是顶层有 `channel:"acp"` 或 `acp` 对象。
137
137
  * ⇒ 两者**任一命中**即判为"退役残留",不认。
138
+ *
139
+ * 🔴 **2026-11-15(owner 令清除所有 ACP 代码)—— 本条**刻意保留**,理由要写清**:
140
+ * ACP 的**实现**已全部删除(`acp-core` / `acp-http` / 端口 / 配置校验 / 会话前缀分支)。
141
+ * 但**别的 CCC 的配置文件里可能还留着** `im: {channel:"acp", acp:{…}}` ——
142
+ * 删掉这条判别 ⇒ 那些残留会被当成新配置读进来 ⇒ 得到一个没有 `accounts` 数组的对象
143
+ * ⇒ 表现为**"配置没生效"且不报错**(静默失效,本轨最贵的一类)。
144
+ * ⇒ 本函数是**防误读的护栏**,不是"ACP 功能的一部分"。**清功能 ≠ 拆护栏。**
145
+ * ⚠️ 本仓自己的 `.opencode/serenity.json` 已无该段(2026-11-15 同批删除),
146
+ * 所以这条现在**没有已知的存量消费者** —— 它守的是别的容器与将来可能出现的旧配置。
138
147
  */
139
148
  function isUnifiedImSection(v) {
140
149
  if (!v || typeof v !== "object" || Array.isArray(v)) return false;
@@ -4,7 +4,7 @@ import { F as isoLocal, w as sessionEvents } from "./bind-file-B0TuOP89.js";
4
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
6
  import { i as subscriptionStats, r as subscriptionEval } from "./subscriptions-CMhWkapn.js";
7
- import { containerClocks, containerWakes } from "./observation-VUiQdjqd.js";
7
+ import { containerClocks, containerWakes } from "./observation-79bQvQrW.js";
8
8
  //#region src/trajectory/live.ts
9
9
  /**
10
10
  * trajectory/live.ts — 进程内 live 会话取数 + 精简诊断
@@ -438,7 +438,7 @@ function hydrate(entry) {
438
438
  rel: entry.rel,
439
439
  kind: "dir",
440
440
  bytes,
441
- excerpt: `子目录 · ${capped ? `≥${groupThousands(files)}` : groupThousands(files)} 个文件`,
441
+ excerpt: `subdirectory · ${capped ? `≥${groupThousands(files)}` : groupThousands(files)} file(s)`,
442
442
  ontology: false,
443
443
  key: entry.key
444
444
  };
@@ -483,18 +483,18 @@ function buildResourceIndex(skillDir, options = {}) {
483
483
  const modeled = items.some((i) => i.ontology);
484
484
  const shown = items.slice(0, maxItems);
485
485
  const hidden = items.length - shown.length;
486
- const lines = ["### 本 skill 的参考件(第二层 · 按需读取)", "> 这里只有**清单**,没有正文:需要时用 `read` 打开下列路径(相对本 skill 目录)。"];
487
- if (modeled) lines.push("> 🧬 **本 skill 已建模**:文字内容以 `skill.ttl` 为总约束。");
488
- lines.push("", "| 文件 | 摘要 | 字节 |", "|---|---|---|");
486
+ const lines = ["### Reference files for this skill (second layer — read on demand)", "> Listing only, no bodies: `read` a path below (relative to this skill directory) when you need it."];
487
+ if (modeled) lines.push("> 🧬 **This skill is modeled**: the wording is governed by `skill.ttl`.");
488
+ lines.push("", "| File | Summary | Bytes |", "|---|---|---|");
489
489
  for (const item of shown) {
490
490
  const label = item.kind === "dir" ? `${item.rel}/` : item.rel;
491
- const excerpt = item.ontology ? "🧬 本 skill 的本体约束(已建模)" : item.excerpt;
491
+ const excerpt = item.ontology ? "🧬 This skill's ontology constraints (modeled)" : item.excerpt;
492
492
  lines.push(`| ${label} | ${excerpt} | ${groupThousands(item.bytes)} |`);
493
493
  }
494
- if (hidden > 0) lines.push("", `…**还有 ${hidden} 项未列出**(本层单次上限 ${maxItems} 项)。`);
494
+ if (hidden > 0) lines.push("", `…**${hidden} more item(s) not listed** (this layer's per-call cap is ${maxItems}).`);
495
495
  const body = lines.join("\n");
496
496
  if (body.length <= maxChars) return body;
497
- return `${body.slice(0, maxChars)}\n…(第二层索引已按 ${groupThousands(maxChars)} 字符上限截断,原文 ${groupThousands(body.length)} 字符)`;
497
+ return `${body.slice(0, maxChars)}\n…(second-layer index truncated at the ${groupThousands(maxChars)}-character cap; full text is ${groupThousands(body.length)} characters)`;
498
498
  }
499
499
  /**
500
500
  * 收集**只有名字**的第二层清单(目录面专用)。
@@ -3,7 +3,7 @@ import { c as matchBlacklist, d as readCccName$1, l as pathInside, n as SAFE_MOD
3
3
  import { F as isoLocal, g as listActiveTrajectories } from "./bind-file-B0TuOP89.js";
4
4
  import { c as profileWriteWhitelist, s as profileToolWhitelist, u as ACC_VERSION } from "./rules-BYeykzys.js";
5
5
  import { l as trajectoryCodeForSession, u as trajectoryConstraintForSession } from "./profile-DpxC9HtB.js";
6
- import { n as isImWiredTrajectory } from "./channels-w8H6l04X.js";
6
+ import { n as isImWiredTrajectory } from "./channels-Covd8vLQ.js";
7
7
  import { REGISTERED_TOOLS } from "./invariant.js";
8
8
  import { basename, dirname, join, relative, resolve } from "node:path";
9
9
  import { existsSync, mkdirSync, readFileSync, readdirSync, realpathSync, rmSync, statSync, writeFileSync } from "node:fs";
@@ -158,8 +158,8 @@ Directory of ACC capabilities — each area lists where to go for details (guide
158
158
  acc_msm 已并入 msm(执行+发现)与 container_admin(管理)——msm("<name>", ["<args>"]);inspect=true 查用法
159
159
  (v1.106.0 已删 exclusiveTools 机制:原专属工具 acc-diag **已并入 dashboard diag**)
160
160
  ④ 轨迹约束与对外面 → container_admin config(轨迹约束四动作 guide/validate/apply/list——**原 role 域已并入 config**,旧名作过渡别名仍可用;说明类配置走**两层菜单** config docs 目录 / config docs <章节> 详情)
161
- 外部程序化接入用官方 dsh --profile acp
162
- + 现成 ACP 客户端;本插件不提供 ACP 面
161
+ (2026-11-15 owner 令:**ACP 面已整条下架** —— 代码 / 端口 / 配置校验 / 会话前缀全部清除。
162
+ 本插件**不提供**任何 ACP 接入面;外部程序化接入口径由宿主侧自行决定,与本插件无关。)
163
163
  ⑤ 自主与接入 → cognitive_trajectory send-now(跨轨迹的**即时**递送,**不排队**:live 目标在跑就当场注入当前轮、空闲则立即起轮;非 live 冷载入——等效于直接 wake;**有同步回执**)
164
164
  cognitive_trajectory send-later(跨轨迹的"未来时刻 + 一条 message";fire-and-forget,无回执无回收)
165
165
  weixin 微信桥(配置/扫码/路由/消息 hook——CCC 侧 weixin-doctor MSM:msm("weixin-doctor", ["guide"]))
@@ -17,7 +17,7 @@ export declare const MSM_ACTIONS: readonly MsmAction[];
17
17
  * `msm catalog` 动作**降为指针**(只指路,不再返回本常量)—— 否则同一份正文会有两个入口,
18
18
  * 而"两个入口返回同一份内容"正是本目录自己反对的形态。
19
19
  */
20
- export declare const ACC_CATALOG = "\u2550\u2550\u2550 ACC Usage Catalog \u2550\u2550\u2550\nDirectory of ACC capabilities \u2014 each area lists where to go for details (guides live with their feature; this catalog only points).\n\n \u2460 \u8F68\u8FF9\u672C\u4F53 \u2192 cognitive_trajectory\uFF08list/show/create/use + rebuild \u8D85\u9650\u91CD\u5EFA + send-now \u5373\u65F6\u6295\u9012 + send-later \u672A\u6765\u4E00\u6B21\u6027\u5524\u9192\n + cro-guide CRO \u7F16\u5199\u6307\u5357\uFF09\n \u539F logbook \u5DF2\u5E76\u5165\uFF08v1.33 \u7528\u6237\u88C1\u51B3\uFF1A\u5E9F\u9664 logbook \u8BCD\uFF09\uFF1Bclose/archive \u5220\uFF08\u5F52\u6863\u8D70 container_fs mv\uFF09\uFF0C\n health/qa/summary \u5206\u522B\u5E76\u5165 use / list\uFF0Chook-develop-guide \u5E76\u8FDB container_admin msm guide\n \u2461 \u8BA4\u77E5\u8D28\u91CF\u6846\u67B6 \u2192 praxis\uFF08eap/neat/cce/ontology \u56DB\u5408\u4E00\u2014\u2014\u53EF\u5B9E\u8DF5\u7406\u8BBA\u6CE8\u5165\uFF0Csection \u6E10\u8FDB\u62AB\u9732\uFF0C\u65E0\u53C2\u5373\u76EE\u5F55\uFF09\n ontology\uFF08v1.52 D121\uFF1A\u672C\u4F53\u5DE5\u7A0B**\u5F15\u64CE**\u2014\u2014init/check/explain/verify/review/compliance\uFF1B\n \u4E0E praxis ontology \u7684\u5206\u5DE5 = \u90A3\u4E2A\u662F**\u65B9\u6CD5\u6587\u672C**\u3001\u8FD9\u4E2A\u662F**\u80FD\u8DD1\u7684\u90A3\u4E2A**\uFF09\n \u2462 \u5DE5\u5177\u4E0E\u6267\u884C \u2192 container_fs\uFF08\u5BB9\u5668\u6587\u4EF6\u7CFB\u7EDF 15 \u5B50\u547D\u4EE4\uFF09/ container_git\uFF08git\uFF09/ dashboard\uFF08health \u542B\u6CE8\u518C\u8868\u68C0\u67E5/time/diag\uFF09\n acc_msm \u5DF2\u5E76\u5165 msm\uFF08\u6267\u884C+\u53D1\u73B0\uFF09\u4E0E container_admin\uFF08\u7BA1\u7406\uFF09\u2014\u2014msm(\"<name>\", [\"<args>\"])\uFF1Binspect=true \u67E5\u7528\u6CD5\n \uFF08v1.106.0 \u5DF2\u5220 exclusiveTools \u673A\u5236\uFF1A\u539F\u4E13\u5C5E\u5DE5\u5177 acc-diag **\u5DF2\u5E76\u5165 dashboard diag**\uFF09\n \u2463 \u8F68\u8FF9\u7EA6\u675F\u4E0E\u5BF9\u5916\u9762 \u2192 container_admin config\uFF08\u8F68\u8FF9\u7EA6\u675F\u56DB\u52A8\u4F5C guide/validate/apply/list\u2014\u2014**\u539F role \u57DF\u5DF2\u5E76\u5165 config**\uFF0C\u65E7\u540D\u4F5C\u8FC7\u6E21\u522B\u540D\u4ECD\u53EF\u7528\uFF1B\u8BF4\u660E\u7C7B\u914D\u7F6E\u8D70**\u4E24\u5C42\u83DC\u5355** config docs \u76EE\u5F55 \uFF0F config docs <\u7AE0\u8282> \u8BE6\u60C5\uFF09\n \u5916\u90E8\u7A0B\u5E8F\u5316\u63A5\u5165\u7528\u5B98\u65B9 dsh --profile acp\n \uFF0B \u73B0\u6210 ACP \u5BA2\u6237\u7AEF\uFF1B\u672C\u63D2\u4EF6\u4E0D\u63D0\u4F9B ACP \u9762\n \u2464 \u81EA\u4E3B\u4E0E\u63A5\u5165 \u2192 cognitive_trajectory send-now\uFF08\u8DE8\u8F68\u8FF9\u7684**\u5373\u65F6**\u9012\u9001\uFF0C**\u4E0D\u6392\u961F**\uFF1Alive \u76EE\u6807\u5728\u8DD1\u5C31\u5F53\u573A\u6CE8\u5165\u5F53\u524D\u8F6E\u3001\u7A7A\u95F2\u5219\u7ACB\u5373\u8D77\u8F6E\uFF1B\u975E live \u51B7\u8F7D\u5165\u2014\u2014\u7B49\u6548\u4E8E\u76F4\u63A5 wake\uFF1B**\u6709\u540C\u6B65\u56DE\u6267**\uFF09\n cognitive_trajectory send-later\uFF08\u8DE8\u8F68\u8FF9\u7684\"\u672A\u6765\u65F6\u523B + \u4E00\u6761 message\"\uFF1Bfire-and-forget\uFF0C\u65E0\u56DE\u6267\u65E0\u56DE\u6536\uFF09\n weixin \u5FAE\u4FE1\u6865\uFF08\u914D\u7F6E/\u626B\u7801/\u8DEF\u7531/\u6D88\u606F hook\u2014\u2014CCC \u4FA7 weixin-doctor MSM\uFF1Amsm(\"weixin-doctor\", [\"guide\"])\uFF09\n \u2465 CCC \u914D\u7F6E\u603B\u89C8 \u2192 container_admin config docs config\uFF08\u6309\u7AE0\u8BE6\u60C5\u2014\u20148 \u6BB5\u5168\u8868\uFF09\n \u6216 container_admin msm ccc-config\uFF08\u540C\u4E00\u4EFD\u6B63\u6587\u7684\u65E7\u5165\u53E3\uFF0C\u4FDD\u7559\uFF09\n \u2466 \u6CE8\u518C\u8868\u4E0E\u5B89\u5168 \u2192 mech-registry.json \u7531 container_admin msm register/deregister \u7BA1\u7406\uFF08\u5199\u4FDD\u62A4\u2014\u2014\u4E0D\u53EF\u76F4\u63A5\u7F16\u8F91\uFF09\n dashboard health \u8F93\u51FA registry \u5B8C\u6574\u6027\u68C0\u67E5\uFF1B\u635F\u574F\u6062\u590D\u6307\u5F15\u89C1 health registry.issues\n CCC \u7EA7\u5F00\u5173\uFF1AsafeMode.blacklist\uFF08\u5199\u8DEF\u5F84\u9ED1\u540D\u5355\uFF09\n / safeMode.hiddenTools\uFF08**\u5DF2\u9000\u5F79**\uFF0Cv1.123.0\uFF1A\u5B89\u5168\u6A21\u5F0F\u53EA\u85CF bash\uFF1B\u300CCCC \u5185\u4E00\u5F8B\u5173\u300D\u90A3\u6279\u7531 ACC \u7684 ALWAYS_DENY_TOOLS \u6052\u9690\uFF0C\u4E0D\u518D\u968F\u5F00\u5173\u53D8\u5316\uFF09\n CCC \u7EA7 skill \u4F9B\u7ED9\uFF1AcognitiveTrajectory.skills\uFF08v1.44.0\u2014\u2014**\u672C CCC \u6BCF\u6761\u8F68\u8FF9\u90FD\u5E26**\uFF0C\u542B \u8F68\u8FF9\u7EA6\u675F\u4F1A\u8BDD\uFF1B\u4E0E\u8F68\u8FF9\u81EA\u5DF1\u7684 frontmatter \u58F0\u660E\u53D6\u5E76\u96C6\uFF09\n\n\u6BCF\u533A\uFF1A\u4E00\u53E5\u8BDD\u5B9A\u4F4D + \u8BE6\u7EC6\u5165\u53E3\uFF08\u5DE5\u5177\u540D / guide \u5B50\u547D\u4EE4\uFF09\u3002\u8BE6\u60C5\u6C38\u8FDC\u4EE5\u5BF9\u5E94\u5DE5\u5177\u7684 guide/ccc-config \u4E3A\u5355\u4E00\u771F\u76F8\u6E90\u3002\n";
20
+ export declare const ACC_CATALOG = "\u2550\u2550\u2550 ACC Usage Catalog \u2550\u2550\u2550\nDirectory of ACC capabilities \u2014 each area lists where to go for details (guides live with their feature; this catalog only points).\n\n \u2460 \u8F68\u8FF9\u672C\u4F53 \u2192 cognitive_trajectory\uFF08list/show/create/use + rebuild \u8D85\u9650\u91CD\u5EFA + send-now \u5373\u65F6\u6295\u9012 + send-later \u672A\u6765\u4E00\u6B21\u6027\u5524\u9192\n + cro-guide CRO \u7F16\u5199\u6307\u5357\uFF09\n \u539F logbook \u5DF2\u5E76\u5165\uFF08v1.33 \u7528\u6237\u88C1\u51B3\uFF1A\u5E9F\u9664 logbook \u8BCD\uFF09\uFF1Bclose/archive \u5220\uFF08\u5F52\u6863\u8D70 container_fs mv\uFF09\uFF0C\n health/qa/summary \u5206\u522B\u5E76\u5165 use / list\uFF0Chook-develop-guide \u5E76\u8FDB container_admin msm guide\n \u2461 \u8BA4\u77E5\u8D28\u91CF\u6846\u67B6 \u2192 praxis\uFF08eap/neat/cce/ontology \u56DB\u5408\u4E00\u2014\u2014\u53EF\u5B9E\u8DF5\u7406\u8BBA\u6CE8\u5165\uFF0Csection \u6E10\u8FDB\u62AB\u9732\uFF0C\u65E0\u53C2\u5373\u76EE\u5F55\uFF09\n ontology\uFF08v1.52 D121\uFF1A\u672C\u4F53\u5DE5\u7A0B**\u5F15\u64CE**\u2014\u2014init/check/explain/verify/review/compliance\uFF1B\n \u4E0E praxis ontology \u7684\u5206\u5DE5 = \u90A3\u4E2A\u662F**\u65B9\u6CD5\u6587\u672C**\u3001\u8FD9\u4E2A\u662F**\u80FD\u8DD1\u7684\u90A3\u4E2A**\uFF09\n \u2462 \u5DE5\u5177\u4E0E\u6267\u884C \u2192 container_fs\uFF08\u5BB9\u5668\u6587\u4EF6\u7CFB\u7EDF 15 \u5B50\u547D\u4EE4\uFF09/ container_git\uFF08git\uFF09/ dashboard\uFF08health \u542B\u6CE8\u518C\u8868\u68C0\u67E5/time/diag\uFF09\n acc_msm \u5DF2\u5E76\u5165 msm\uFF08\u6267\u884C+\u53D1\u73B0\uFF09\u4E0E container_admin\uFF08\u7BA1\u7406\uFF09\u2014\u2014msm(\"<name>\", [\"<args>\"])\uFF1Binspect=true \u67E5\u7528\u6CD5\n \uFF08v1.106.0 \u5DF2\u5220 exclusiveTools \u673A\u5236\uFF1A\u539F\u4E13\u5C5E\u5DE5\u5177 acc-diag **\u5DF2\u5E76\u5165 dashboard diag**\uFF09\n \u2463 \u8F68\u8FF9\u7EA6\u675F\u4E0E\u5BF9\u5916\u9762 \u2192 container_admin config\uFF08\u8F68\u8FF9\u7EA6\u675F\u56DB\u52A8\u4F5C guide/validate/apply/list\u2014\u2014**\u539F role \u57DF\u5DF2\u5E76\u5165 config**\uFF0C\u65E7\u540D\u4F5C\u8FC7\u6E21\u522B\u540D\u4ECD\u53EF\u7528\uFF1B\u8BF4\u660E\u7C7B\u914D\u7F6E\u8D70**\u4E24\u5C42\u83DC\u5355** config docs \u76EE\u5F55 \uFF0F config docs <\u7AE0\u8282> \u8BE6\u60C5\uFF09\n \uFF082026-11-15 owner \u4EE4\uFF1A**ACP \u9762\u5DF2\u6574\u6761\u4E0B\u67B6** \u2014\u2014 \u4EE3\u7801 / \u7AEF\u53E3 / \u914D\u7F6E\u6821\u9A8C / \u4F1A\u8BDD\u524D\u7F00\u5168\u90E8\u6E05\u9664\u3002\n \u672C\u63D2\u4EF6**\u4E0D\u63D0\u4F9B**\u4EFB\u4F55 ACP \u63A5\u5165\u9762\uFF1B\u5916\u90E8\u7A0B\u5E8F\u5316\u63A5\u5165\u53E3\u5F84\u7531\u5BBF\u4E3B\u4FA7\u81EA\u884C\u51B3\u5B9A\uFF0C\u4E0E\u672C\u63D2\u4EF6\u65E0\u5173\u3002\uFF09\n \u2464 \u81EA\u4E3B\u4E0E\u63A5\u5165 \u2192 cognitive_trajectory send-now\uFF08\u8DE8\u8F68\u8FF9\u7684**\u5373\u65F6**\u9012\u9001\uFF0C**\u4E0D\u6392\u961F**\uFF1Alive \u76EE\u6807\u5728\u8DD1\u5C31\u5F53\u573A\u6CE8\u5165\u5F53\u524D\u8F6E\u3001\u7A7A\u95F2\u5219\u7ACB\u5373\u8D77\u8F6E\uFF1B\u975E live \u51B7\u8F7D\u5165\u2014\u2014\u7B49\u6548\u4E8E\u76F4\u63A5 wake\uFF1B**\u6709\u540C\u6B65\u56DE\u6267**\uFF09\n cognitive_trajectory send-later\uFF08\u8DE8\u8F68\u8FF9\u7684\"\u672A\u6765\u65F6\u523B + \u4E00\u6761 message\"\uFF1Bfire-and-forget\uFF0C\u65E0\u56DE\u6267\u65E0\u56DE\u6536\uFF09\n weixin \u5FAE\u4FE1\u6865\uFF08\u914D\u7F6E/\u626B\u7801/\u8DEF\u7531/\u6D88\u606F hook\u2014\u2014CCC \u4FA7 weixin-doctor MSM\uFF1Amsm(\"weixin-doctor\", [\"guide\"])\uFF09\n \u2465 CCC \u914D\u7F6E\u603B\u89C8 \u2192 container_admin config docs config\uFF08\u6309\u7AE0\u8BE6\u60C5\u2014\u20148 \u6BB5\u5168\u8868\uFF09\n \u6216 container_admin msm ccc-config\uFF08\u540C\u4E00\u4EFD\u6B63\u6587\u7684\u65E7\u5165\u53E3\uFF0C\u4FDD\u7559\uFF09\n \u2466 \u6CE8\u518C\u8868\u4E0E\u5B89\u5168 \u2192 mech-registry.json \u7531 container_admin msm register/deregister \u7BA1\u7406\uFF08\u5199\u4FDD\u62A4\u2014\u2014\u4E0D\u53EF\u76F4\u63A5\u7F16\u8F91\uFF09\n dashboard health \u8F93\u51FA registry \u5B8C\u6574\u6027\u68C0\u67E5\uFF1B\u635F\u574F\u6062\u590D\u6307\u5F15\u89C1 health registry.issues\n CCC \u7EA7\u5F00\u5173\uFF1AsafeMode.blacklist\uFF08\u5199\u8DEF\u5F84\u9ED1\u540D\u5355\uFF09\n / safeMode.hiddenTools\uFF08**\u5DF2\u9000\u5F79**\uFF0Cv1.123.0\uFF1A\u5B89\u5168\u6A21\u5F0F\u53EA\u85CF bash\uFF1B\u300CCCC \u5185\u4E00\u5F8B\u5173\u300D\u90A3\u6279\u7531 ACC \u7684 ALWAYS_DENY_TOOLS \u6052\u9690\uFF0C\u4E0D\u518D\u968F\u5F00\u5173\u53D8\u5316\uFF09\n CCC \u7EA7 skill \u4F9B\u7ED9\uFF1AcognitiveTrajectory.skills\uFF08v1.44.0\u2014\u2014**\u672C CCC \u6BCF\u6761\u8F68\u8FF9\u90FD\u5E26**\uFF0C\u542B \u8F68\u8FF9\u7EA6\u675F\u4F1A\u8BDD\uFF1B\u4E0E\u8F68\u8FF9\u81EA\u5DF1\u7684 frontmatter \u58F0\u660E\u53D6\u5E76\u96C6\uFF09\n\n\u6BCF\u533A\uFF1A\u4E00\u53E5\u8BDD\u5B9A\u4F4D + \u8BE6\u7EC6\u5165\u53E3\uFF08\u5DE5\u5177\u540D / guide \u5B50\u547D\u4EE4\uFF09\u3002\u8BE6\u60C5\u6C38\u8FDC\u4EE5\u5BF9\u5E94\u5DE5\u5177\u7684 guide/ccc-config \u4E3A\u5355\u4E00\u771F\u76F8\u6E90\u3002\n";
21
21
  export declare const MSM_GUIDE = "MSM Development Manual (Mech & Semi-Mech framework)\n\n## What it is\nMSM = the executable-unit layer. Mech is pure TS with zero LLM reasoning; Semi-Mech is a TS framework + LLM decision points.\nMSM is ACC's deterministic executable-unit layer \u2014 all shell/exec operations go through MSM and cannot be bypassed.\n\n## Registering a new MSM (container_admin msm register)\n1. Write the script under <skill>/scripts/ (runnable via tsx; must include a main() CLI guard with an import.meta.url check)\n2. container_admin msm register --domain msm --action register <name> --skill <s> --path <script path relative to root> --category <mech|semi-mech> --description <desc>\n3. Auto-writes mech-registry.json (preserving the original format) + git commit (commits only the registry file)\n4. Validation: path must be inside root, script must exist, name must be globally unique\n\n## flag schema (v1)\nflags is a new-style object array for parameter validation and path-escape guarding:\n [{\"name\":\"output\",\"type\":\"string\",\"description\":\"output path\"},\n {\"name\":\"target\",\"type\":\"path\",\"description\":\"operation target (type:path enables in-root validation + symlink defense)\"},\n {\"name\":\"force\",\"type\":\"boolean\",\"description\":\"force mode\",\"default\":false}]\n- {name, type} format \u2014 new style, type:\"path\" enables the path-escape guard\n- {flag, description} format \u2014 old style, CLI flag description string\n- On registration, flags are passed via container_admin msm register --flags '<json>'\n\n## Script conventions\n- Top-of-file documentation: purpose / usage / exit codes\n- Exit codes: 0 success / 1 user / 2 system / 3 operator (per ACC protocol classification)\n- main() CLI guard (DC-M2): the script must start with\n if (import.meta.url === `file://${process.argv[1]}`) { main() }\n or an equivalent isMain / require.main === check \u2014 so vitest imports never trigger top-level code\n- A paired .test.ts or .spec.ts (DC-M1, vitest)\n- Business subprocess environment: SERENITY_ROOT / SERENITY_CCC / SERENITY_VERSION injected\n\n## Interaction & confirmation conventions (no blocking confirmation)\n- MSMs run in **user-less subprocesses** (spawn/execFile, 600s timeout) \u2014 **never** use\n readline / prompt / process.stdin etc. to block waiting for user input (it would hang until killed by the timeout)\n- When a second confirmation is needed: **directly return the confirmation request** (list the operation to perform and its impact + how to retry with the confirmation flag),\n returning a non-zero exit code (or an explicit hint)\n- After the agent confirms, **re-invoke the MSM with the confirmation flag** (e.g. --confirm / --yes / --force) to retry\n- Standard mode (two-phase):\n 1. First call: destructive/confirmation-requiring operation detected and no confirmation flag present \u2192 output the confirmation request (list operation/impact/rollback),\n exit non-zero (e.g. 1 user), **perform no changes**\n 2. After the agent evaluates, re-invoke: with the confirmation flag \u2192 execute and output the result\n- Applies to: delete/overwrite/push/batch operations and other irreversible or wide-impact operations\n- Anti-example (forbidden): readline waiting for user input, process.stdin.on('data') blocking waits\n (MSMs have no stdin interaction channel \u2014 they hang until the 600s timeout)\n\n## Quality checks (container_admin msm check, DC-M1~M4)\nDC-M1 has .test.ts/.spec.ts; DC-M2 has a main() guard (function main( / isMain / require.main === / import.meta.url);\nDC-M3 bidirectional: scripts unregistered + registry references missing scripts; DC-M4 path-type flags marked type:\"path\"\n\n## Self-description (protocol flags, first argument only)\nmsm(\"<name>\", [\"--list\"]) \u2014 list all MSMs\nmsm(\"<name>\", [\"--schema\", \"<n>\"]) \u2014 view a specific MSM's parameter schema\nmsm(\"<name>\", [\"--format=json\"]) \u2014 JSON output mode (remaining args passed through losslessly)\n";
22
22
  /**
23
23
  * CCC 配置参考(对齐 osp ccc-config action)。
@@ -0,0 +1,116 @@
1
+ /**
2
+ * trajectory/carrier-log.ts — **LOG 式交接记忆的机械轮转**(v1.136.0,owner 2026-11-15 令)
3
+ *
4
+ * ## owner 令(逐字)
5
+ *
6
+ * > 「LOG 式的轨迹交接记忆设定 在我们轨迹验证了效果不错,需要升级到 ACC 层 代替老方案」
7
+ *
8
+ * ## 它替代的是哪一个"老方案"(必须写清,否则下一个人不知道删什么)
9
+ *
10
+ * 老方案 = **SESSION.md 单文件承担两种颗粒度** ⇒ 它必然膨胀 ⇒ 必须不断"压缩"
11
+ * (逐字搬 → 守恒核验 → 切正文 → 换索引 → 量字节,五步)。压缩是本载体维护中最贵的动作,
12
+ * 而它之所以存在,**只是因为高低两层颗粒度挤在同一个文件里**。
13
+ *
14
+ * 新方案 = **两层分离**:
15
+ * · `SESSION.md` —— 高策展(身份/决策/里程碑一行+证据指针/当前状态/待裁)
16
+ * · `LOG/LOG.md` —— 低策展(怎么试、错了什么、读了什么;**可丢**)
17
+ * ⇒ 收益不是"文件变小",是**「压缩」这个动作不再需要被做**:出槽那一代整份 `mv` 走,零内容风险。
18
+ *
19
+ * ## 🔴 这一版与原型(S142 轨迹自测)的差别 = 谁来轮转
20
+ *
21
+ * S142 的设计件 §5.2 明写:原型用「PROMPT.md 纪律」(soft),
22
+ * 而「把它升级成 A(ACC 机制)是另一个裁决」(要 owner 定,并需处理 D23 边界)。
23
+ * **owner 2026-11-15 给了这个裁决** ⇒ 本文件就是那个 A。
24
+ *
25
+ * 🔴 **原型的失效形态正因为是 soft 才发生**:忘了轮转 ⇒ LOG 无限长、代数不增、**且无信号**。
26
+ * 本文件把它变成 rebuild 路径上的**机械动作** ⇒ agent 忘不忘都不影响。
27
+ *
28
+ * ## D23 边界(ACC 管机制 / CCC 管措辞)—— 判据
29
+ *
30
+ * 本文件**只做机械动作**:判空/定时/定名/rename/回读校验/写出生头。
31
+ * ⛔ 它**不规定** SESSION.md 写什么、不规定 LOG 里写什么、不定义章节名 —— 那些是 CCC 的措辞,
32
+ * 由各轨迹自己的 PROMPT.md 声明。⇒ 不越界。
33
+ *
34
+ * ## 🔴🔴 铁律:轮转**永不覆盖**(两个入口,不是一个)
35
+ *
36
+ * `renameSync(src, dst)` 在 POSIX 上**目标存在就静默覆盖**。若两次 rebuild 落在同一分钟
37
+ * (崩溃重启循环 / 连点重建 / 时钟回拨),上一代日志无声消失。
38
+ * 2026-11-04 实测踩过**第二个入口**:对非空 `LOG.md` 直接 `write` ≡ 销毁这一代,**同样不报错**。
39
+ * ⇒ 三条硬判据(顺序不可换):
40
+ * ① 目标名已存在 ⇒ 换名(`-2`、`-3`…),⛔ 不覆盖;
41
+ * ② 只有**确认目标不存在**才 rename;
42
+ * ③ 轮转后**回读校验**:目标存在 且 字节数 == 源文件轮转前字节数。
43
+ *
44
+ * ## 空/缺失的处置(垃圾归档会让"代数"不可信)
45
+ *
46
+ * | 情形 | 动作 |
47
+ * |---|---|
48
+ * | 目录里没有 `LOG.md` | **不轮转**,直接开新代(这一代还没开始,没有可冻结的) |
49
+ * | `LOG.md` 存在但**只有出生头/空** | **不轮转**,原地重用(⛔ 不产生空归档) |
50
+ * | 轮转后 | 新建 `LOG.md` 并写出生头 |
51
+ */
52
+ /** 日志目录名(相对轨迹目录)。owner 2026-11-04 令:日志家族住 `LOG/`,⛔ 不与 `references/` 混放。 */
53
+ export declare const LOG_DIR = "LOG";
54
+ /** 当前代的固定文件名。**名字即指针** —— 改成 A/B 双槽会引入"谁是当前"这个外部事实。 */
55
+ export declare const LOG_FILE = "LOG.md";
56
+ /** 一句话概括一个轨迹目录的日志状态(诊断用,不参与判定)。 */
57
+ export interface CarrierLogState {
58
+ /** `LOG/` 绝对路径 */
59
+ dir: string;
60
+ /** 当前代是否存在且非空 */
61
+ hasLive: boolean;
62
+ /** 当前代字节数(不存在 = 0) */
63
+ liveBytes: number;
64
+ /** 已冻结代数(`LOG-*.md` 个数) */
65
+ frozenCount: number;
66
+ /** 最新一代冻结文件名(按名字字典序取最大;无则 null) */
67
+ newestFrozen: string | null;
68
+ }
69
+ /** 冻结日志的命名:`LOG-<YYYY-MM-DDTHHmm>.md`(**本地时区,分钟级**)。 */
70
+ export declare function frozenLogName(now: Date): string;
71
+ /**
72
+ * 判断一份日志内容是否"实质上为空"。
73
+ *
74
+ * 判据:去掉空行与**标题行**(`# …`)与引用块(`> …`)之后,还剩不剩字符。
75
+ * 🔴 为什么剔除标题与引用:出生头本身就是"标题 + 两行引用说明",
76
+ * 若按裸字节判非空,**刚开的新代立刻会被判为"有内容可冻结"** ⇒ 产生一堆只有出生头的垃圾归档。
77
+ */
78
+ export declare function isEffectivelyEmpty(text: string): boolean;
79
+ /** 读一个轨迹目录的日志状态(只读,不改任何东西)。 */
80
+ export declare function readCarrierLogState(trajectoryDir: string): CarrierLogState;
81
+ /** 轮转结果(**回执只说明"我做了什么",不说明"效果达成了"**)。 */
82
+ export interface RotateResult {
83
+ /** 是否真的轮转了(false = 判空跳过) */
84
+ rotated: boolean;
85
+ /** 冻结成的文件名(未轮转 = null) */
86
+ frozenAs: string | null;
87
+ /** 轮转前当前代的字节数(未轮转 = 0) */
88
+ bytesBefore: number;
89
+ /** 回读校验是否通过(**只有 rotated=true 时才有意义**) */
90
+ verified: boolean;
91
+ /** 若因目标重名而改名,这里是原定的名字 */
92
+ renamedFrom: string | null;
93
+ }
94
+ /**
95
+ * 生成新一代 `LOG.md` 的出生头。
96
+ *
97
+ * ⚠️ **措辞归 CCC**:这里只给一个**可替换的默认模板**,各轨迹可以在自己的 PROMPT.md 里
98
+ * 声明别的写法(ACC 不解析它,只保证"新代存在且非空")。
99
+ *
100
+ * @param generation 代数(1 起)
101
+ * @param now 出生时刻
102
+ * @param previousFrozen 上一代冻结文件名(无则 null)
103
+ */
104
+ export declare function birthHeader(generation: number, now: Date, previousFrozen: string | null): string;
105
+ /**
106
+ * 轮转当前代 → 冻结,并开新代。
107
+ *
108
+ * 🔴 **顺序不可换**(每一步都防一个具体的静默失败):
109
+ * ① 判空:实质为空 ⇒ 不轮转(否则产生垃圾归档,代数不可信)
110
+ * ② 定名:目标已存在 ⇒ 加 `-2`/`-3`…(⛔ 覆盖 = 静默丢一代)
111
+ * ③ rename **之后**回读校验:字节数必须与轮转前相同
112
+ * ④ 开新代:新建空文件 → 写出生头
113
+ *
114
+ * @returns 轮转回执。**调用方必须检查 `verified`** —— rename 成功不等于目标对。
115
+ */
116
+ export declare function rotateCarrierLog(trajectoryDir: string, now?: Date): RotateResult;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shgroup/dsh-serenity-hooks",
3
- "version": "1.135.0",
3
+ "version": "1.136.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": {