@shgroup/dsh-serenity-hooks 1.137.14 → 1.137.16
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.137.
|
|
3
|
+
"version": "1.137.16",
|
|
4
4
|
"main": "lib/index.js",
|
|
5
5
|
"description": "宁静号 ACC harness(Native Cordis 插件):给 DSH 装一个「AI 工作区」——13 个工具(container_fs/cognitive_trajectory/dashboard/container_git/msm/praxis/ontology/serenity-skill-creator/localstore/container_admin/browser_slot;另两个 im-bridge/diagram 按条件出现)+ 机械约束(安全模式/工作区围墙/密钥守卫)+ 认知轨迹日志与原地重建 + 网页登录入口/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
|
@@ -12,7 +12,7 @@ import { c as buildCroSnapshot, d as WAKE_CATCH_UP_MS, f as addWake, i as sendTo
|
|
|
12
12
|
import { i as hostAliveProbe, n as readSimpleSettings, r as registerSettingsSection } from "./settings-YC-csZus.js";
|
|
13
13
|
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";
|
|
14
14
|
import { i as runImBridge, n as isImWiredTrajectory, r as registerImChannel, t as imChannelIds } from "./channels-Covd8vLQ.js";
|
|
15
|
-
import { a as ACK_PREFIX, c as eventToken, i as resolveSessionMdPath, l as DEFAULT_FAKE_INITIAL_MESSAGES, o as ASSISTANT_PREFIX, r as registerRebuildTurnHook, s as LOG_FILE_REL, t as buildRebuildAnchor, u as registerBootstrap } from "./rebuild-
|
|
15
|
+
import { a as ACK_PREFIX, c as eventToken, i as resolveSessionMdPath, l as DEFAULT_FAKE_INITIAL_MESSAGES, o as ASSISTANT_PREFIX, r as registerRebuildTurnHook, s as LOG_FILE_REL, t as buildRebuildAnchor, u as registerBootstrap } from "./rebuild-DVVb82zf.js";
|
|
16
16
|
import { i as subscriptionStats, n as registerTrajectorySubscriptions, r as subscriptionEval, t as defaultSubscriptionDeps } from "./subscriptions-DBoO0GSO.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";
|
|
@@ -6700,7 +6700,7 @@ function createCognitiveTrajectoryTool(ctx) {
|
|
|
6700
6700
|
} catch {}
|
|
6701
6701
|
}
|
|
6702
6702
|
}
|
|
6703
|
-
const { queueRebuild } = await import("./rebuild-
|
|
6703
|
+
const { queueRebuild } = await import("./rebuild-DVVb82zf.js").then((n) => n.n);
|
|
6704
6704
|
const result = await queueRebuild(ctx, {
|
|
6705
6705
|
root,
|
|
6706
6706
|
note: args.note,
|
|
@@ -617,9 +617,11 @@ function extractAllHandoverNotes(text) {
|
|
|
617
617
|
continue;
|
|
618
618
|
}
|
|
619
619
|
const head = i;
|
|
620
|
+
const inFence = fencedLineMask(lines, head);
|
|
620
621
|
let end = lines.length;
|
|
621
622
|
for (let j = head + 1; j < lines.length; j++) {
|
|
622
623
|
const t = lines[j].trim();
|
|
624
|
+
if (inFence[j] === true) continue;
|
|
623
625
|
if (t.startsWith("## ") || t.startsWith("# ")) {
|
|
624
626
|
end = j;
|
|
625
627
|
break;
|
|
@@ -627,12 +629,74 @@ function extractAllHandoverNotes(text) {
|
|
|
627
629
|
}
|
|
628
630
|
const section = lines.slice(head, end);
|
|
629
631
|
while (section.length > 0 && section[section.length - 1].trim() === "") section.pop();
|
|
630
|
-
out.push(section.join("\n"));
|
|
632
|
+
out.push(capNoteSection(section).join("\n"));
|
|
631
633
|
i = end;
|
|
632
634
|
}
|
|
633
635
|
return out;
|
|
634
636
|
}
|
|
635
637
|
/**
|
|
638
|
+
* 代码围栏标记识别:``` 或 ```` (含前后空白、含 info string 如 ```ts)。
|
|
639
|
+
*
|
|
640
|
+
* @returns 围栏"种类"(反引号个数),非围栏行 ⇒ `null`。
|
|
641
|
+
* ⚠️ 用**长度**当种类:``` 与 ```` 是两种不同围栏,混用时不互相闭合(CommonMark 语义)。
|
|
642
|
+
*/
|
|
643
|
+
function fenceMarkerOf(trimmedLine) {
|
|
644
|
+
const m = /^(`{3,})/.exec(trimmedLine);
|
|
645
|
+
return m ? m[1] : null;
|
|
646
|
+
}
|
|
647
|
+
/**
|
|
648
|
+
* 标出「哪些行在代码围栏内」(`mask[行号] === true` 表示该行属于围栏内容)。
|
|
649
|
+
*
|
|
650
|
+
* ## 🔴 未闭合围栏的处置(这条是判据,⛔ 不是实现细节)
|
|
651
|
+
*
|
|
652
|
+
* 围栏开着却一直没闭合(写到一半被中断、或围栏标记只是长得像),**怎么办**:
|
|
653
|
+
*
|
|
654
|
+
* | 选法 | 后果 |
|
|
655
|
+
* |---|---|
|
|
656
|
+
* | 认为"后面全在围栏内" | **整个文件剩余部分都会被吞进便签节** ⇒ 新代 = 旧代,轮转被架空 |
|
|
657
|
+
* | ✅ **只有真正闭合的围栏才算围栏** | 未闭合处标题照常当边界 ⇒ **宁可少搬,不可错搬大段** |
|
|
658
|
+
*
|
|
659
|
+
* ⇒ 取后者。判据与本仓反复出现的那条同向:**残缺的长文档比短的完整文档危险得多**;
|
|
660
|
+
* 而这里更严重 —— 吞掉的是别人的正文,且没有任何读数会说出来。
|
|
661
|
+
*
|
|
662
|
+
* ⚠️ 实现要点:**两遍**。第一遍只认**已闭合**的围栏(配对成功才标记);
|
|
663
|
+
* 到文件尾仍未闭合的开围栏,**整段不标记** ⇒ 其中的标题照常当边界。
|
|
664
|
+
*/
|
|
665
|
+
function fencedLineMask(lines, scanFrom) {
|
|
666
|
+
const mask = new Array(lines.length).fill(false);
|
|
667
|
+
let fence = null;
|
|
668
|
+
let fenceStart = -1;
|
|
669
|
+
for (let j = scanFrom + 1; j < lines.length; j++) {
|
|
670
|
+
const mark = fenceMarkerOf(lines[j].trim());
|
|
671
|
+
if (mark === null) continue;
|
|
672
|
+
if (fence === null) {
|
|
673
|
+
fence = mark;
|
|
674
|
+
fenceStart = j;
|
|
675
|
+
} else if (mark === fence) {
|
|
676
|
+
for (let k = fenceStart; k <= j; k++) mask[k] = true;
|
|
677
|
+
fence = null;
|
|
678
|
+
fenceStart = -1;
|
|
679
|
+
}
|
|
680
|
+
}
|
|
681
|
+
return mask;
|
|
682
|
+
}
|
|
683
|
+
/**
|
|
684
|
+
* 超上限时截断,并**留下可见记号** —— ⛔ 绝不静默截断。
|
|
685
|
+
*
|
|
686
|
+
* 判据:**残缺的长文档比短的完整文档危险得多,它不报错**(v1.137.13 立的同一条)。
|
|
687
|
+
* ⇒ 记号必须写清:被截了多少行、全文在哪一代冻结件里。
|
|
688
|
+
*/
|
|
689
|
+
function capNoteSection(section) {
|
|
690
|
+
if (section.length <= 300) return section;
|
|
691
|
+
const kept = section.slice(0, 300);
|
|
692
|
+
const omitted = section.length - 300;
|
|
693
|
+
return [
|
|
694
|
+
...kept,
|
|
695
|
+
"",
|
|
696
|
+
`> ⚠️ **交接节已截断(truncated)**:本代便签原有 ${section.length} 行,超过 ACC 上限 300 行 ⇒ 只搬前 300 行,省略 ${omitted} 行。**完整内容在上一代冻结件里**(\`LOG/LOG-*.md\`),要找回请读那里。⛔ 不要把超长内容写进便签 —— 它每轮都会被整节搬运。`
|
|
697
|
+
];
|
|
698
|
+
}
|
|
699
|
+
/**
|
|
636
700
|
* 生成新一代 `LOG.md` 的出生头。
|
|
637
701
|
*
|
|
638
702
|
* ⚠️ **措辞归 CCC**:这里只给一个**可替换的默认模板**,各轨迹可以在自己的 PROMPT.md 里
|
|
@@ -103,6 +103,14 @@ export declare function extractHandoverNote(text: string): string | null;
|
|
|
103
103
|
* (人可能续写、模板可能先占位),所以正确做法是**全搬**,不是"规定只能有一个"。
|
|
104
104
|
*/
|
|
105
105
|
export declare function extractAllHandoverNotes(text: string): string[];
|
|
106
|
+
/**
|
|
107
|
+
* 便签节的**体量上限**(行数,`AC` 兜底,⛔ 不指望每条轨迹都把便签写短)。
|
|
108
|
+
*
|
|
109
|
+
* 🔴 **为什么需要**:真机上出现过 `1,488` 行的便签节 ⇒ 新代 = 5 行出生头 + 1,488 行 = **1,494 行**,
|
|
110
|
+
* 而冻结件是 `1,805` 行 ⇒ **轮转等于没轮转**("新代"几乎和旧代一样大)。
|
|
111
|
+
* 上限是**兜底**,不是常态:正常便签只有几十行。
|
|
112
|
+
*/
|
|
113
|
+
export declare const MAX_HANDOVER_NOTE_LINES = 300;
|
|
106
114
|
/** 读一个轨迹目录的日志状态(只读,不改任何东西)。 */
|
|
107
115
|
export declare function readCarrierLogState(trajectoryDir: string): CarrierLogState;
|
|
108
116
|
/** 轮转结果(**回执只说明"我做了什么",不说明"效果达成了"**)。 */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shgroup/dsh-serenity-hooks",
|
|
3
|
-
"version": "1.137.
|
|
3
|
+
"version": "1.137.16",
|
|
4
4
|
"description": "宁静号 ACC harness(Native Cordis 插件)——给 DeepSeek Harness 装一个「AI 工作区」:13 个工具(container_fs/cognitive_trajectory/dashboard/container_git/msm/praxis/ontology/serenity-skill-creator/localstore/container_admin/browser_slot;另两个 im-bridge/diagram 按条件出现)+ 机械约束(安全模式/工作区围墙/密钥守卫/对外输出守卫)+ 认知轨迹日志与原地重建 + 网页登录入口/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": {
|