@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.
@@ -1565,201 +1565,6 @@ function registerGuards(ctx, opts = {}) {
1565
1565
  });
1566
1566
  }
1567
1567
  //#endregion
1568
- //#region src/skills/opencode-scan.ts
1569
- /**
1570
- * opencode-scan.ts — opencode skill 标准扫描(纯逻辑,零 DSH 依赖)
1571
- *
1572
- * 兼容 opencode 的 skill 标准:`.opencode/skills/<name>/SKILL.md`
1573
- * (frontmatter: name/description/whenToUse;结构含 references/、scripts/)。
1574
- */
1575
- /** 解析 --- 分隔的 YAML frontmatter(只需 name/description/whenToUse) */
1576
- function parseFrontmatter(raw) {
1577
- const text = raw.replace(/^\uFEFF/, "");
1578
- const m = /^---\s*\n([\s\S]*?)\n---\s*\n?/.exec(text);
1579
- if (!m) return {
1580
- meta: {
1581
- name: "",
1582
- description: ""
1583
- },
1584
- content: text
1585
- };
1586
- const fm = m[1];
1587
- const body = text.slice(m[0].length);
1588
- const grab = (key) => {
1589
- const line = fm.split("\n").find((l) => l.startsWith(`${key}:`));
1590
- if (!line) return void 0;
1591
- return line.slice(key.length + 1).trim().replace(/^['"]|['"]$/g, "");
1592
- };
1593
- const meta = {
1594
- name: grab("name") ?? "",
1595
- description: grab("description") ?? ""
1596
- };
1597
- const whenToUse = grab("whenToUse");
1598
- if (whenToUse) meta.whenToUse = whenToUse;
1599
- return {
1600
- meta,
1601
- content: body
1602
- };
1603
- }
1604
- /** 扫描 CCC 的 .opencode/skills(一级目录 + SKILL.md 存在性) */
1605
- function listOpencodeSkillDirs(root) {
1606
- const dir = join(root, ".opencode", "skills");
1607
- if (!existsSync(dir)) return [];
1608
- return readdirSync(dir, { withFileTypes: true }).filter((e) => e.isDirectory()).map((e) => join(dir, e.name)).filter((d) => existsSync(join(d, "SKILL.md")));
1609
- }
1610
- /** 加载一个 opencode skill(frontmatter 解析 + 正文);读失败(EPERM/占用等)返回 null,单目录容错 */
1611
- function loadOpencodeSkill(skillDir) {
1612
- let raw;
1613
- try {
1614
- raw = readFileSync(join(skillDir, "SKILL.md"), "utf-8");
1615
- } catch {
1616
- return null;
1617
- }
1618
- const { meta, content } = parseFrontmatter(raw);
1619
- return {
1620
- name: meta.name,
1621
- dir: skillDir,
1622
- meta,
1623
- content,
1624
- path: join(skillDir, "SKILL.md")
1625
- };
1626
- }
1627
- //#endregion
1628
- //#region src/surface/status.ts
1629
- /**
1630
- * surface/status.ts — 状态与安全模式操作(纯逻辑,零 DSH 依赖,可独立单测)
1631
- *
1632
- * WebUI 停靠栏的数据源:ACC 版本 / CCC 根 / safe-mode 状态 / 黑名单 / keeper 阈值。
1633
- * setSafeMode 直接读写 .serenity-safe-on 标记(守卫实时读取,写即生效)。
1634
- */
1635
- /** 宿主包名 —— 从运行入口反推包根时的**身份核对**用(见 {@link dshVersionFromEntry}) */
1636
- const HOST_PACKAGE_NAME = "@deepseek-ai/dsh";
1637
- /** 上溯层数上限:入口脚本在包内的深度是 `lib/`(1 层)或 `lib/x/y/`(≤3 层)⇒ 6 层足够,且**保证有界** */
1638
- const MAX_ENTRY_ASCENT = 6;
1639
- /**
1640
- * 🔴 **布局无关档**:从**正在跑的那个入口脚本**反推宿主包根,读它的 `version`。
1641
- *
1642
- * 为什么必须补这一档(R↓:一处**静默失效**的实际缺陷;2026-09-28 docker bench 实测):
1643
- * 下面那条静态候选链({@link readDshVersion} 的 ②)是**猜安装位置**——`npm_config_prefix` /
1644
- * `APPDATA\npm` / `~/.npm-global`。一旦宿主装在**别处**(典型 = 容器镜像里的
1645
- * `/usr/local/lib/node_modules/@deepseek-ai/dsh`),**三个候选全不中** ⇒ 返回 `null`
1646
- * ⇒ `checkHostVersion(null)` 只给一条 **`required: false`** 的 issue ⇒ 报告 `ok` 仍为 `true`
1647
- * ⇒ **版本门完全静默**(bench 逐字:`host contract degraded (1 optional): host version unknown`)。
1648
- * ⚠️ 这类坏法**比"偶尔报警"更危险**:一条**永远为假**的判据看起来像"没报警 = 没问题"。
1649
- *
1650
- * 而"我们正跑在哪个宿主里"**本来就有直接证据**:`process.argv[1]`(= 启动本进程的那个脚本)。
1651
- * 三条判据要点(每条都对应一个实测过的坑):
1652
- * ① **先 `realpath`** —— 全局安装的 `dsh` 是**符号链接**(`/usr/local/bin/dsh` → `…/@deepseek-ai/dsh/lib/bin.js`),
1653
- * 而 Node 的 `argv[1]` **保留调用路径、不解析符号链接** ⇒ 不 realpath 就永远上溯不到包根。
1654
- * ② **核对包名**(`name === '@deepseek-ai/dsh'`)—— 否则在 vitest / npx 等入口下会误取**别人的**
1655
- * `package.json`(这是本档**唯一**的假阳性来源)。
1656
- * ③ **上溯有界**({@link MAX_ENTRY_ASCENT})—— 不设界的话,一个不在任何 dsh 包内的入口会一路爬到文件系统根。
1657
- *
1658
- * @param entry `process.argv[1]`(单测直接注入,无需替身)
1659
- */
1660
- function dshVersionFromEntry(entry) {
1661
- if (typeof entry !== "string" || entry === "") return null;
1662
- let dir;
1663
- try {
1664
- const real = realpathSync(entry);
1665
- dir = statSync(real).isDirectory() ? real : dirname(real);
1666
- } catch {
1667
- return null;
1668
- }
1669
- for (let i = 0; i < MAX_ENTRY_ASCENT; i++) {
1670
- try {
1671
- const pkg = JSON.parse(readFileSync(join(dir, "package.json"), "utf-8"));
1672
- if (pkg.name === HOST_PACKAGE_NAME && typeof pkg.version === "string") return pkg.version;
1673
- } catch {}
1674
- const parent = dirname(dir);
1675
- if (parent === dir) break;
1676
- dir = parent;
1677
- }
1678
- return null;
1679
- }
1680
- /**
1681
- * 读取已安装 DSH CLI 版本;读不到返回 null。
1682
- *
1683
- * **两档,顺序有理由**:
1684
- * ① 🔴 **布局无关档**({@link dshVersionFromEntry})= **正在跑的就是它** —— 直接证据优先于"猜安装位置"。
1685
- * ② **静态候选链**(跨平台历史档,保留):`npm_config_prefix` / `APPDATA\npm` / `~/.npm-global`
1686
- * (Windows npm 全局装在 `%APPDATA%\npm`,见审计问题 13)。
1687
- * ⚠️ 保留它是因为**本进程不一定是 dsh CLI**(单测、嵌入式、将来别的宿主进程)——
1688
- * 那时"本机装了哪个版本"仍需一个答案,只是证据等级更低。
1689
- */
1690
- function readDshVersion() {
1691
- const fromEntry = dshVersionFromEntry(process.argv[1]);
1692
- if (fromEntry !== null) return fromEntry;
1693
- const candidates = [];
1694
- if (process.env.npm_config_prefix) candidates.push(join(process.env.npm_config_prefix, "lib", "node_modules", "@deepseek-ai", "dsh"));
1695
- if (process.env.APPDATA) candidates.push(join(process.env.APPDATA, "npm", "node_modules", "@deepseek-ai", "dsh"));
1696
- candidates.push(join(homedir(), ".npm-global", "lib", "node_modules", "@deepseek-ai", "dsh"));
1697
- for (const p of candidates) try {
1698
- const pkg = JSON.parse(readFileSync(join(p, "package.json"), "utf-8"));
1699
- if (typeof pkg.version === "string") return pkg.version;
1700
- } catch {}
1701
- return null;
1702
- }
1703
- function getStatus(cwd, configPaths = DEFAULT_SERENITY_CONFIG_PATHS) {
1704
- const root = cccRootForCwd(cwd);
1705
- const restrict = getRestrictDiagnostics();
1706
- const common = {
1707
- accVersion: ACC_VERSION,
1708
- dshVersion: readDshVersion(),
1709
- nodeVersion: process.version
1710
- };
1711
- if (!root) return {
1712
- root: null,
1713
- ...common,
1714
- safeModeOn: false,
1715
- blacklist: [],
1716
- threshold: null,
1717
- trajectories: [],
1718
- skills: [],
1719
- restrict
1720
- };
1721
- const cfg = loadSerenityConfig(root, configPaths);
1722
- return {
1723
- root,
1724
- ...common,
1725
- safeModeOn: isSafeModeOn(root),
1726
- blacklist: readBlacklist(root, configPaths),
1727
- threshold: cfg.sessionKeeper?.threshold ?? null,
1728
- trajectories: listActiveTrajectories(root),
1729
- skills: listSkillSummaries(root),
1730
- restrict
1731
- };
1732
- }
1733
- /**
1734
- * 技能清单(面板用;owner 2026-10-18 要求 skills 单独占一个 panel)。
1735
- *
1736
- * 只取**两个可文件系统验证的事实**:名字(目录名)+ 是否已建模(`skill.ttl` 存在)。
1737
- * 为什么"是否建模"值得进面板:它是 skill 形态的**唯一二值区别**(有 `skill.ttl` = 增强型,
1738
- * 无 = 普通 skill),而后者**完全正常** —— 所以面板把它呈现为**信息**,不是缺陷标记。
1739
- *
1740
- * ⚠️ 单目录读失败**不抛**(`loadOpencodeSkill` 返回 null 时照旧收入名字):
1741
- * 面板是只读状态面,一个坏目录不该让整块面板消失。
1742
- */
1743
- function listSkillSummaries(root) {
1744
- const out = [];
1745
- for (const dir of listOpencodeSkillDirs(root)) {
1746
- const name = basename(dir);
1747
- out.push({
1748
- name,
1749
- modeled: existsSync(join(dir, "skill.ttl"))
1750
- });
1751
- }
1752
- return out.sort((a, b) => a.name.localeCompare(b.name));
1753
- }
1754
- /** 切换安全模式(写/删标记文件);返回实际生效状态 */
1755
- function setSafeMode(root, on) {
1756
- const marker = resolve(root, SAFE_MODE_MARKER);
1757
- if (on) {
1758
- if (!existsSync(marker)) writeFileSync(marker, isoLocal() + "\n", "utf-8");
1759
- } else rmSync(marker, { force: true });
1760
- return { on: isSafeModeOn(root) };
1761
- }
1762
- //#endregion
1763
1568
  //#region src/host/contract.ts
1764
1569
  /** dsp 依赖的宿主服务与成员(对照 `_tmp/host-0.1.5-rc.1/`(`dsh-develop host-fetch` 产物)逐一核对) */
1765
1570
  const HOST_SERVICES = [
@@ -2229,4 +2034,199 @@ function summarizeHostContract(report) {
2229
2034
  return `${required.length > 0 ? `host contract BROKEN (${required.length} required)` : `host contract degraded (${optional.length} optional)`}: ${report.issues.map((i) => i.detail).join("; ")}`;
2230
2035
  }
2231
2036
  //#endregion
2232
- 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 };
2037
+ //#region src/skills/opencode-scan.ts
2038
+ /**
2039
+ * opencode-scan.ts — opencode skill 标准扫描(纯逻辑,零 DSH 依赖)
2040
+ *
2041
+ * 兼容 opencode 的 skill 标准:`.opencode/skills/<name>/SKILL.md`
2042
+ * (frontmatter: name/description/whenToUse;结构含 references/、scripts/)。
2043
+ */
2044
+ /** 解析 --- 分隔的 YAML frontmatter(只需 name/description/whenToUse) */
2045
+ function parseFrontmatter(raw) {
2046
+ const text = raw.replace(/^\uFEFF/, "");
2047
+ const m = /^---\s*\n([\s\S]*?)\n---\s*\n?/.exec(text);
2048
+ if (!m) return {
2049
+ meta: {
2050
+ name: "",
2051
+ description: ""
2052
+ },
2053
+ content: text
2054
+ };
2055
+ const fm = m[1];
2056
+ const body = text.slice(m[0].length);
2057
+ const grab = (key) => {
2058
+ const line = fm.split("\n").find((l) => l.startsWith(`${key}:`));
2059
+ if (!line) return void 0;
2060
+ return line.slice(key.length + 1).trim().replace(/^['"]|['"]$/g, "");
2061
+ };
2062
+ const meta = {
2063
+ name: grab("name") ?? "",
2064
+ description: grab("description") ?? ""
2065
+ };
2066
+ const whenToUse = grab("whenToUse");
2067
+ if (whenToUse) meta.whenToUse = whenToUse;
2068
+ return {
2069
+ meta,
2070
+ content: body
2071
+ };
2072
+ }
2073
+ /** 扫描 CCC 的 .opencode/skills(一级目录 + SKILL.md 存在性) */
2074
+ function listOpencodeSkillDirs(root) {
2075
+ const dir = join(root, ".opencode", "skills");
2076
+ if (!existsSync(dir)) return [];
2077
+ return readdirSync(dir, { withFileTypes: true }).filter((e) => e.isDirectory()).map((e) => join(dir, e.name)).filter((d) => existsSync(join(d, "SKILL.md")));
2078
+ }
2079
+ /** 加载一个 opencode skill(frontmatter 解析 + 正文);读失败(EPERM/占用等)返回 null,单目录容错 */
2080
+ function loadOpencodeSkill(skillDir) {
2081
+ let raw;
2082
+ try {
2083
+ raw = readFileSync(join(skillDir, "SKILL.md"), "utf-8");
2084
+ } catch {
2085
+ return null;
2086
+ }
2087
+ const { meta, content } = parseFrontmatter(raw);
2088
+ return {
2089
+ name: meta.name,
2090
+ dir: skillDir,
2091
+ meta,
2092
+ content,
2093
+ path: join(skillDir, "SKILL.md")
2094
+ };
2095
+ }
2096
+ //#endregion
2097
+ //#region src/surface/status.ts
2098
+ /**
2099
+ * surface/status.ts — 状态与安全模式操作(纯逻辑,零 DSH 依赖,可独立单测)
2100
+ *
2101
+ * WebUI 停靠栏的数据源:ACC 版本 / CCC 根 / safe-mode 状态 / 黑名单 / keeper 阈值。
2102
+ * setSafeMode 直接读写 .serenity-safe-on 标记(守卫实时读取,写即生效)。
2103
+ */
2104
+ /** 宿主包名 —— 从运行入口反推包根时的**身份核对**用(见 {@link dshVersionFromEntry}) */
2105
+ const HOST_PACKAGE_NAME = "@deepseek-ai/dsh";
2106
+ /** 上溯层数上限:入口脚本在包内的深度是 `lib/`(1 层)或 `lib/x/y/`(≤3 层)⇒ 6 层足够,且**保证有界** */
2107
+ const MAX_ENTRY_ASCENT = 6;
2108
+ /**
2109
+ * 🔴 **布局无关档**:从**正在跑的那个入口脚本**反推宿主包根,读它的 `version`。
2110
+ *
2111
+ * 为什么必须补这一档(R↓:一处**静默失效**的实际缺陷;2026-09-28 docker bench 实测):
2112
+ * 下面那条静态候选链({@link readDshVersion} 的 ②)是**猜安装位置**——`npm_config_prefix` /
2113
+ * `APPDATA\npm` / `~/.npm-global`。一旦宿主装在**别处**(典型 = 容器镜像里的
2114
+ * `/usr/local/lib/node_modules/@deepseek-ai/dsh`),**三个候选全不中** ⇒ 返回 `null`
2115
+ * ⇒ `checkHostVersion(null)` 只给一条 **`required: false`** 的 issue ⇒ 报告 `ok` 仍为 `true`
2116
+ * ⇒ **版本门完全静默**(bench 逐字:`host contract degraded (1 optional): host version unknown`)。
2117
+ * ⚠️ 这类坏法**比"偶尔报警"更危险**:一条**永远为假**的判据看起来像"没报警 = 没问题"。
2118
+ *
2119
+ * 而"我们正跑在哪个宿主里"**本来就有直接证据**:`process.argv[1]`(= 启动本进程的那个脚本)。
2120
+ * 三条判据要点(每条都对应一个实测过的坑):
2121
+ * ① **先 `realpath`** —— 全局安装的 `dsh` 是**符号链接**(`/usr/local/bin/dsh` → `…/@deepseek-ai/dsh/lib/bin.js`),
2122
+ * 而 Node 的 `argv[1]` **保留调用路径、不解析符号链接** ⇒ 不 realpath 就永远上溯不到包根。
2123
+ * ② **核对包名**(`name === '@deepseek-ai/dsh'`)—— 否则在 vitest / npx 等入口下会误取**别人的**
2124
+ * `package.json`(这是本档**唯一**的假阳性来源)。
2125
+ * ③ **上溯有界**({@link MAX_ENTRY_ASCENT})—— 不设界的话,一个不在任何 dsh 包内的入口会一路爬到文件系统根。
2126
+ *
2127
+ * @param entry `process.argv[1]`(单测直接注入,无需替身)
2128
+ */
2129
+ function dshVersionFromEntry(entry) {
2130
+ if (typeof entry !== "string" || entry === "") return null;
2131
+ let dir;
2132
+ try {
2133
+ const real = realpathSync(entry);
2134
+ dir = statSync(real).isDirectory() ? real : dirname(real);
2135
+ } catch {
2136
+ return null;
2137
+ }
2138
+ for (let i = 0; i < MAX_ENTRY_ASCENT; i++) {
2139
+ try {
2140
+ const pkg = JSON.parse(readFileSync(join(dir, "package.json"), "utf-8"));
2141
+ if (pkg.name === HOST_PACKAGE_NAME && typeof pkg.version === "string") return pkg.version;
2142
+ } catch {}
2143
+ const parent = dirname(dir);
2144
+ if (parent === dir) break;
2145
+ dir = parent;
2146
+ }
2147
+ return null;
2148
+ }
2149
+ /**
2150
+ * 读取已安装 DSH CLI 版本;读不到返回 null。
2151
+ *
2152
+ * **两档,顺序有理由**:
2153
+ * ① 🔴 **布局无关档**({@link dshVersionFromEntry})= **正在跑的就是它** —— 直接证据优先于"猜安装位置"。
2154
+ * ② **静态候选链**(跨平台历史档,保留):`npm_config_prefix` / `APPDATA\npm` / `~/.npm-global`
2155
+ * (Windows npm 全局装在 `%APPDATA%\npm`,见审计问题 13)。
2156
+ * ⚠️ 保留它是因为**本进程不一定是 dsh CLI**(单测、嵌入式、将来别的宿主进程)——
2157
+ * 那时"本机装了哪个版本"仍需一个答案,只是证据等级更低。
2158
+ */
2159
+ function readDshVersion() {
2160
+ const fromEntry = dshVersionFromEntry(process.argv[1]);
2161
+ if (fromEntry !== null) return fromEntry;
2162
+ const candidates = [];
2163
+ if (process.env.npm_config_prefix) candidates.push(join(process.env.npm_config_prefix, "lib", "node_modules", "@deepseek-ai", "dsh"));
2164
+ if (process.env.APPDATA) candidates.push(join(process.env.APPDATA, "npm", "node_modules", "@deepseek-ai", "dsh"));
2165
+ candidates.push(join(homedir(), ".npm-global", "lib", "node_modules", "@deepseek-ai", "dsh"));
2166
+ for (const p of candidates) try {
2167
+ const pkg = JSON.parse(readFileSync(join(p, "package.json"), "utf-8"));
2168
+ if (typeof pkg.version === "string") return pkg.version;
2169
+ } catch {}
2170
+ return null;
2171
+ }
2172
+ function getStatus(cwd, configPaths = DEFAULT_SERENITY_CONFIG_PATHS) {
2173
+ const root = cccRootForCwd(cwd);
2174
+ const restrict = getRestrictDiagnostics();
2175
+ const common = {
2176
+ accVersion: ACC_VERSION,
2177
+ dshVersion: readDshVersion(),
2178
+ nodeVersion: process.version
2179
+ };
2180
+ if (!root) return {
2181
+ root: null,
2182
+ ...common,
2183
+ safeModeOn: false,
2184
+ blacklist: [],
2185
+ threshold: null,
2186
+ trajectories: [],
2187
+ skills: [],
2188
+ restrict
2189
+ };
2190
+ const cfg = loadSerenityConfig(root, configPaths);
2191
+ return {
2192
+ root,
2193
+ ...common,
2194
+ safeModeOn: isSafeModeOn(root),
2195
+ blacklist: readBlacklist(root, configPaths),
2196
+ threshold: cfg.sessionKeeper?.threshold ?? null,
2197
+ trajectories: listActiveTrajectories(root),
2198
+ skills: listSkillSummaries(root),
2199
+ restrict
2200
+ };
2201
+ }
2202
+ /**
2203
+ * 技能清单(面板用;owner 2026-10-18 要求 skills 单独占一个 panel)。
2204
+ *
2205
+ * 只取**两个可文件系统验证的事实**:名字(目录名)+ 是否已建模(`skill.ttl` 存在)。
2206
+ * 为什么"是否建模"值得进面板:它是 skill 形态的**唯一二值区别**(有 `skill.ttl` = 增强型,
2207
+ * 无 = 普通 skill),而后者**完全正常** —— 所以面板把它呈现为**信息**,不是缺陷标记。
2208
+ *
2209
+ * ⚠️ 单目录读失败**不抛**(`loadOpencodeSkill` 返回 null 时照旧收入名字):
2210
+ * 面板是只读状态面,一个坏目录不该让整块面板消失。
2211
+ */
2212
+ function listSkillSummaries(root) {
2213
+ const out = [];
2214
+ for (const dir of listOpencodeSkillDirs(root)) {
2215
+ const name = basename(dir);
2216
+ out.push({
2217
+ name,
2218
+ modeled: existsSync(join(dir, "skill.ttl"))
2219
+ });
2220
+ }
2221
+ return out.sort((a, b) => a.name.localeCompare(b.name));
2222
+ }
2223
+ /** 切换安全模式(写/删标记文件);返回实际生效状态 */
2224
+ function setSafeMode(root, on) {
2225
+ const marker = resolve(root, SAFE_MODE_MARKER);
2226
+ if (on) {
2227
+ if (!existsSync(marker)) writeFileSync(marker, isoLocal() + "\n", "utf-8");
2228
+ } else rmSync(marker, { force: true });
2229
+ return { on: isSafeModeOn(root) };
2230
+ }
2231
+ //#endregion
2232
+ export { runMsmAsync as C, runMsm as S, setWeixinSendEndpoint as T, ACC_CATALOG as _, loadOpencodeSkill as a, findEntry as b, summarizeHostContract as c, forgetImBridgeVisibility as d, forgetNonCccToolVisibility as f, forgetToolVisibility as g, syncToolVisibility as h, listOpencodeSkillDirs as i, forgetExclusiveToolsVisibility as l, registerGuards as m, readDshVersion as n, compareSemver as o, forgetTrajectoryConstraintToolVisibility as p, setSafeMode as r, hostContractReport as s, getStatus as t, forgetHostScheduleToolHiding as u, CCC_CONFIG_REFERENCE as v, docsPointer as w, loadMsmEntries as x, checkRegistryQuality as y };
@@ -1,7 +1,7 @@
1
1
  import { r as cccRootForCwd } from "./ccc-roots-CsSSQjSS.js";
2
2
  import { m as readTrajectorySubscriptions } from "./ccc-x94FCzOv.js";
3
3
  import { L as localHuman, n as findTrajectoryHolding } from "./bind-file-B0TuOP89.js";
4
- import { f as registerDisposer } from "./scheduler-CUPz7geH.js";
4
+ import { p as registerDisposer } from "./scheduler-CA-7xvTS.js";
5
5
  //#region src/trajectory/subscriptions.ts
6
6
  /**
7
7
  * trajectory/subscriptions.ts — 轨迹消息订阅(v1.107.0,owner 2026-11-01 令)
@@ -306,7 +306,7 @@ function defaultSubscriptionDeps(ctx) {
306
306
  readSubs: (root) => readTrajectorySubscriptions(root),
307
307
  dirForSession: (root, sessionId) => findTrajectoryHolding(`${root}/AGENT_SESSIONS`, sessionId),
308
308
  deliver: async (root, target, message) => {
309
- const { sendToCognitiveTrajectory } = await import("./scheduler-CUPz7geH.js").then((n) => n.n);
309
+ const { sendToCognitiveTrajectory } = await import("./scheduler-CA-7xvTS.js").then((n) => n.r);
310
310
  const res = await sendToCognitiveTrajectory(ctx, root, target, message, "trajectory-subscription");
311
311
  return {
312
312
  ok: res.ok,
@@ -0,0 +1,31 @@
1
+ /**
2
+ * tools/reconstruct.ts — `reconstruct` 工具面(owner 2026-11-06 令)
3
+ *
4
+ * 只有一个动作、两个参数(与 `rebuild` 同形),因为它的语义就是"rebuild 的换代版":
5
+ *
6
+ * | 参数 | 必需 | 说明 |
7
+ * |---|---|---|
8
+ * | `summary` | ✅ | 内容概括 ≤20 字(新载体的会话标题用它,与 rebuild 同一个服务端清洗/截断) |
9
+ * | `note` | — | 任务焦点 ≤200 字(注入新载体锚点的 `- Task focus:` 行) |
10
+ *
11
+ * ## 🔴 本工具**平时不可见**,由 `register(def, { when })` 控制
12
+ *
13
+ * 判据在 `trajectory/reconstruct.ts` 的 {@link makeReconstructWhen}:累计 token ≥ 阈值才放出。
14
+ * ⇒ **工具面的注册点在 `index.ts`**,本文件只给 `def`(不为可见性负责)。
15
+ *
16
+ * ## 为什么文案要写"它和 rebuild 有什么不同"
17
+ *
18
+ * 模型同时看到 `rebuild` / `reconstruct` 时会**默认选更熟的那个**(rebuild),
19
+ * 而两者治的**不是同一个病**(rebuild 治上下文、reconstruct 治日志体积)。
20
+ * ⇒ 描述里必须一句话说清"什么时候该用我",否则这个工具等于不存在
21
+ * (它只在阈值后才出现,那时模型更没机会摸索)。
22
+ */
23
+ import { agentCwdFor } from '../kernel/ccc-roots.js';
24
+ /**
25
+ * 造 `reconstruct` 工具定义(**不带任何可见性判定**)。
26
+ *
27
+ * @param ctx 插件上下文(排队时需要 `ctx.sessions.get` 定位会话;闭包捕获)
28
+ */
29
+ export declare function createReconstructTool(ctx: unknown): import("@deepseek-ai/dsh-tools").ToolDefinition;
30
+ /** 供 `when` 判据复用的 cwd 读取(同一处来源,⛔ 不各写一份) */
31
+ export { agentCwdFor };