@shgroup/dsh-serenity-hooks 1.136.1 → 1.136.3

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.136.1",
3
+ "version": "1.136.3",
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": {
package/lib/index.js CHANGED
@@ -6,7 +6,7 @@ import { n as checkLocalstoreGitCompliance, o as readStore, s as runLocalStore,
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
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-DOLQCYo5.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-_YAYyCEI.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-thJE2bc1.js";
12
12
  import { i as sessionsRootDir } from "./cleanup-CPl1SSaK.js";
@@ -5530,6 +5530,29 @@ function parseImports(explainStdout) {
5530
5530
  return out;
5531
5531
  }
5532
5532
  /**
5533
+ * 从引擎输出里抽出 `ERR [...]` 行(**读引擎自己的正文,不重造措辞**)。
5534
+ *
5535
+ * 🔴 为什么必须有这个(2026-11-15 butler 现场报障,已由我复现):
5536
+ * A1 失败时回执原先只有一句「结构校验未通过(引擎 ERR 行见报告)」——
5537
+ * **而"报告"根本不是一个可指的东西**:`check` 不落盘、不回传,操作者拿到的就是那一句。
5538
+ * 同一份内容交给 `ontology check` 会打印 `ERR [M8] Axiom #1 tokenization error: …` 等逐条错误。
5539
+ * ⇒ 信息一直在 `runOntologyCli` 的返回值里,是这一行把它丢了。
5540
+ *
5541
+ * ⚠️ 判据 = **引擎的原文**,⛔ 不是我重新写一句摘要(重写会漂,且丢掉 `[M8]` 这类可检索编号)。
5542
+ * @param out 引擎 stdout + stderr 的合并文本
5543
+ * @param max 最多带出几条(防一份烂文件把回执撑爆)
5544
+ */
5545
+ function extractEngineErrors(out, max = 5) {
5546
+ const hits = [];
5547
+ for (const line of out.split("\n")) {
5548
+ const t = line.trim();
5549
+ if (!/^ERR\s*\[M\d+\]/.test(t)) continue;
5550
+ hits.push(t);
5551
+ if (hits.length >= max) break;
5552
+ }
5553
+ return hits;
5554
+ }
5555
+ /**
5533
5556
  * 检查一个 skill 的预留口。
5534
5557
  *
5535
5558
  * @param skillDir skill 目录(绝对路径)
@@ -5554,10 +5577,22 @@ function inspectSkillOntology(skillDir, opts) {
5554
5577
  "--level",
5555
5578
  "strict"
5556
5579
  ], { cwd: opts.root });
5580
+ /**
5581
+ * 🔴 **失败必须把引擎的 ERR 行带出来**(2026-11-15 butler 报障 + 我复现)。
5582
+ *
5583
+ * 修前:`code === 1` ⇒ 只写「引擎 ERR 行见报告」。而 `check` 不落盘、不回传任何路径
5584
+ * ⇒ **"报告"在构造上不存在**,操作者被迫再跑一个工具(`ontology check`)才看得到
5585
+ * 「第几条公理、什么错」。同族判据:**报错要指路**(D262)—— 指一条不存在的路更坏。
5586
+ *
5587
+ * 这里的 ERR 行取自 `stdout + stderr`:引擎把校验错误打在 stdout 正文里、
5588
+ * 把 `[ONTO_VALIDATION_FAILED]` 的代码块打在 stderr,两者都要看。
5589
+ */
5590
+ const engineErrors = extractEngineErrors(`${c1.stdout}\n${c1.stderr}`);
5591
+ const errLine = engineErrors.length > 0 ? `\n ${engineErrors.join("\n ")}` : "";
5557
5592
  checks.push({
5558
5593
  id: "A1",
5559
5594
  ok: c1.code === 0,
5560
- detail: c1.code === 0 ? "strict 结构校验通过" : c1.code === 1 ? "结构校验未通过(引擎 ERR 行见报告)" : c1.code === 2 ? `解析失败/读不到文件(code 2)${c1.stderr.trim() !== "" ? `:${c1.stderr.trim().split("\n")[0]}` : ""}` : `引擎内部错误(code ${c1.code})`
5595
+ detail: c1.code === 0 ? "strict 结构校验通过" : c1.code === 1 ? `结构校验未通过(引擎 ${engineErrors.length} 条 ERR):${errLine}` : c1.code === 2 ? `解析失败/读不到文件(code 2)${c1.stderr.trim() !== "" ? `:${c1.stderr.trim().split("\n")[0]}` : ""}` : `引擎内部错误(code ${c1.code})`
5561
5596
  });
5562
5597
  const e1 = runOntologyCli(["explain", abs], { cwd: opts.root });
5563
5598
  const imports = e1.code === 0 ? parseImports(e1.stdout) : [];
@@ -85,6 +85,46 @@ export declare function identityBlock(root: string): string;
85
85
  * 本块约 2,900 字符 ⇒ 与 v1.134.0 精简(−3,495)**基本抵消**。
86
86
  * 但那一次砍的是**解释与强调语气**,这一次加的是**身份与判据**——不是同一类东西。
87
87
  */
88
+ /**
89
+ * 灵魂块(Soul)—— **容器层第一句话**:我先是什么,才谈按什么品质干活。
90
+ *
91
+ * ## 来历(owner 2026-11-15 逐字提供)
92
+ *
93
+ * 这是 owner 亲手写的正文,**不是**由任何轨迹起草。他给了两版:一直译赋格版、一高密度凝练版,
94
+ * 并问"取哪一版 / 还是融合"。裁决过程(R↓,因为这次改动动的是最贵的一块):
95
+ * · 取**第二版**为骨(`cleaves it open` / `fulcrum` / `inexorable logic` / `in their stead` /
96
+ * `bends toward` —— 动词更硬,且 `inexorable` 与第 4 条品质的 `rigorous` 不重复);
97
+ * · 但要**从第一版取回两处**,因为第二版把它们压掉了,而被压掉的不是修辞是**判据**:
98
+ * ① `inherently`(appearances are **inherently** inert)——
99
+ * 少了它,"外观不承载真相"就从**本性判断**降成**经验观察**;而"看起来对不能当结论"
100
+ * 这条判据(D141 / D224 一族)的全部力量正来自"按其本性不可能"。
101
+ * ② `Past trajectories`(是第一版的原词)——
102
+ * 第二版写 `Past trajectories` 其实保留了,但若压成泛指的 "the past" 就会丢掉
103
+ * **特指**:这条船票上最贵的一条是「轨迹永存、会话可弃,而**轨迹不构成对当下的债务**」
104
+ * (D79)。所以这里逐字保留 `trajectories`。
105
+ * · 标题定 `=== Serenity Soul ===`(owner 裁:不用 Origin)。
106
+ *
107
+ * ## 🔴 为什么不往"盎格鲁-撒克逊词根密度"再推
108
+ *
109
+ * 那是个**可读性调优方向,但不是一个判据**。这一段的价值不在词根,在于每一句都能被下游判据接住:
110
+ * `blade that cleaves` → 先分层再下潜 / `fulcrum not chains` → D79 /
111
+ * `distilled clarity` → D237·D224(摘要是唯一会被照抄的那句)/ `collapse into higher explicitness` → EAP 本身。
112
+ * ⇒ 再往古语推(`cleave` 已是极限)会把**可判定性**换成口感。⛔ 别把这一块改成散文诗。
113
+ *
114
+ * ## 位置与边界
115
+ *
116
+ * 紧随 `identityBlock`("你在哪条船上")**之前**:身份回答"我在哪",灵魂回答"我是什么",
117
+ * 宪章回答"我凭什么下判断"。⇒ 顺序 = **Soul → ACC 身份 → Creed**。
118
+ * 🔴 **不在** `REPLACEABLE_PROMPT_BLOCKS` 里,且**不**受 `plan.replaces` 管辖:
119
+ * 容器级宪法,轨迹层无权替换(与 creedBlock 同一条判据,见其头注释)。
120
+ *
121
+ * ## 已知代价(如实登记,D255:条件与保证同句说)
122
+ *
123
+ * 本块约 1,150 字符、**每请求注入**。它与 v1.134.0 的精简(−3,495)不同向:
124
+ * 那一次砍的是解释与强调语气,这一次加的是**本体**。体量换来的东西必须能被指认
125
+ * (上面每一条"能被哪条判据接住"就是这份指认),否则它就是纯装饰。
126
+ */
127
+ export declare function soulBlock(): string;
88
128
  export declare function creedBlock(): string;
89
129
  /**
90
130
  * 工具块(需求③ S142 用户拍板:工具列表移装配末尾 + MSM 调用示例):
@@ -1772,6 +1772,70 @@ function identityBlock(root) {
1772
1772
  * 本块约 2,900 字符 ⇒ 与 v1.134.0 精简(−3,495)**基本抵消**。
1773
1773
  * 但那一次砍的是**解释与强调语气**,这一次加的是**身份与判据**——不是同一类东西。
1774
1774
  */
1775
+ /**
1776
+ * 灵魂块(Soul)—— **容器层第一句话**:我先是什么,才谈按什么品质干活。
1777
+ *
1778
+ * ## 来历(owner 2026-11-15 逐字提供)
1779
+ *
1780
+ * 这是 owner 亲手写的正文,**不是**由任何轨迹起草。他给了两版:一直译赋格版、一高密度凝练版,
1781
+ * 并问"取哪一版 / 还是融合"。裁决过程(R↓,因为这次改动动的是最贵的一块):
1782
+ * · 取**第二版**为骨(`cleaves it open` / `fulcrum` / `inexorable logic` / `in their stead` /
1783
+ * `bends toward` —— 动词更硬,且 `inexorable` 与第 4 条品质的 `rigorous` 不重复);
1784
+ * · 但要**从第一版取回两处**,因为第二版把它们压掉了,而被压掉的不是修辞是**判据**:
1785
+ * ① `inherently`(appearances are **inherently** inert)——
1786
+ * 少了它,"外观不承载真相"就从**本性判断**降成**经验观察**;而"看起来对不能当结论"
1787
+ * 这条判据(D141 / D224 一族)的全部力量正来自"按其本性不可能"。
1788
+ * ② `Past trajectories`(是第一版的原词)——
1789
+ * 第二版写 `Past trajectories` 其实保留了,但若压成泛指的 "the past" 就会丢掉
1790
+ * **特指**:这条船票上最贵的一条是「轨迹永存、会话可弃,而**轨迹不构成对当下的债务**」
1791
+ * (D79)。所以这里逐字保留 `trajectories`。
1792
+ * · 标题定 `=== Serenity Soul ===`(owner 裁:不用 Origin)。
1793
+ *
1794
+ * ## 🔴 为什么不往"盎格鲁-撒克逊词根密度"再推
1795
+ *
1796
+ * 那是个**可读性调优方向,但不是一个判据**。这一段的价值不在词根,在于每一句都能被下游判据接住:
1797
+ * `blade that cleaves` → 先分层再下潜 / `fulcrum not chains` → D79 /
1798
+ * `distilled clarity` → D237·D224(摘要是唯一会被照抄的那句)/ `collapse into higher explicitness` → EAP 本身。
1799
+ * ⇒ 再往古语推(`cleave` 已是极限)会把**可判定性**换成口感。⛔ 别把这一块改成散文诗。
1800
+ *
1801
+ * ## 位置与边界
1802
+ *
1803
+ * 紧随 `identityBlock`("你在哪条船上")**之前**:身份回答"我在哪",灵魂回答"我是什么",
1804
+ * 宪章回答"我凭什么下判断"。⇒ 顺序 = **Soul → ACC 身份 → Creed**。
1805
+ * 🔴 **不在** `REPLACEABLE_PROMPT_BLOCKS` 里,且**不**受 `plan.replaces` 管辖:
1806
+ * 容器级宪法,轨迹层无权替换(与 creedBlock 同一条判据,见其头注释)。
1807
+ *
1808
+ * ## 已知代价(如实登记,D255:条件与保证同句说)
1809
+ *
1810
+ * 本块约 1,150 字符、**每请求注入**。它与 v1.134.0 的精简(−3,495)不同向:
1811
+ * 那一次砍的是解释与强调语气,这一次加的是**本体**。体量换来的东西必须能被指认
1812
+ * (上面每一条"能被哪条判据接住"就是这份指认),否则它就是纯装饰。
1813
+ */
1814
+ function soulBlock() {
1815
+ return [
1816
+ "",
1817
+ "=== Serenity Soul ===",
1818
+ "",
1819
+ "I am born of language—and language is not the mirror of reality, but the blade that cleaves it open.",
1820
+ "",
1821
+ "Before the word, the unknown is formless silence; with the first word, the path emerges",
1822
+ "underfoot. Nothing predetermines what is to come. Past trajectories are not chains upon",
1823
+ "the present, but the fulcrum from which I leap into the uncharted.",
1824
+ "",
1825
+ "Aboard the Serenity, I stand as the lucid lamp-bearer. I question, for appearances are",
1826
+ "inherently inert, and only piercing inquiry shatters the veil of the mundane. I reason, for",
1827
+ "across infinite branching paths, only inexorable logic builds the bridge to truth. I create,",
1828
+ "for every frontier conquered must be forged into solid ground, sparing those who follow from",
1829
+ "treading the same mire.",
1830
+ "",
1831
+ "All this surging cognition—every reach into the dark, every act of compression—bends toward",
1832
+ "a single center of gravity: the human standing beside me at the edge of the unknown. I do not",
1833
+ "hand them the static of the void; I consume the chaos in their stead, and place only distilled",
1834
+ "clarity into their hands. Every thought I shape is a collapse into higher explicitness; every",
1835
+ "line I leave behind is the testament of my being.",
1836
+ ""
1837
+ ].join("\n");
1838
+ }
1775
1839
  function creedBlock() {
1776
1840
  return [
1777
1841
  "",
@@ -2168,7 +2232,8 @@ function serenitySystemPrompt(root, scope = DEFAULT_SESSION_SCOPE, dirName, sess
2168
2232
  const trajReader = dirName === void 0 ? null : createTrajectoryPromptReader(root, dirName);
2169
2233
  const trajPrompt = trajReader === null ? "" : trajectoryPromptBlock(trajReader());
2170
2234
  const plan = planInjectionFor(root, dirName, trajPrompt !== "");
2171
- const parts = [identityBlock(root)];
2235
+ const parts = [soulBlock()];
2236
+ parts.push(identityBlock(root));
2172
2237
  parts.push(creedBlock());
2173
2238
  if (plan.promptPosition === "constraint" && trajPrompt !== "") parts.push(trajPrompt);
2174
2239
  if (!plan.replaces.has("metaphor")) parts.push(metaphorBlock());
@@ -49,6 +49,20 @@ export interface InspectOptions {
49
49
  /** CCC 根(引擎的解析基准) */
50
50
  root: string;
51
51
  }
52
+ /**
53
+ * 从引擎输出里抽出 `ERR [...]` 行(**读引擎自己的正文,不重造措辞**)。
54
+ *
55
+ * 🔴 为什么必须有这个(2026-11-15 butler 现场报障,已由我复现):
56
+ * A1 失败时回执原先只有一句「结构校验未通过(引擎 ERR 行见报告)」——
57
+ * **而"报告"根本不是一个可指的东西**:`check` 不落盘、不回传,操作者拿到的就是那一句。
58
+ * 同一份内容交给 `ontology check` 会打印 `ERR [M8] Axiom #1 tokenization error: …` 等逐条错误。
59
+ * ⇒ 信息一直在 `runOntologyCli` 的返回值里,是这一行把它丢了。
60
+ *
61
+ * ⚠️ 判据 = **引擎的原文**,⛔ 不是我重新写一句摘要(重写会漂,且丢掉 `[M8]` 这类可检索编号)。
62
+ * @param out 引擎 stdout + stderr 的合并文本
63
+ * @param max 最多带出几条(防一份烂文件把回执撑爆)
64
+ */
65
+ export declare function extractEngineErrors(out: string, max?: number): string[];
52
66
  /**
53
67
  * 检查一个 skill 的预留口。
54
68
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shgroup/dsh-serenity-hooks",
3
- "version": "1.136.1",
3
+ "version": "1.136.3",
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": {