@shgroup/dsh-serenity-hooks 1.137.8 → 1.137.9
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 +1 -1
- package/lib/browser/platform.d.ts +13 -0
- package/lib/browser/process.d.ts +11 -2
- package/lib/index.js +48 -2
- package/package.json +1 -1
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.9",
|
|
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": {
|
|
@@ -109,6 +109,19 @@ export declare function parsePsTime(s: string): number | null;
|
|
|
109
109
|
* 本仓事故里它给出 35.2%,而实际累计 12 小时 57 分 —— 判据量错了东西)。
|
|
110
110
|
*/
|
|
111
111
|
export declare function macSample(pids: number[], prev: MacProcSample | null, now?: number): MacProcSample;
|
|
112
|
+
/**
|
|
113
|
+
* 某 pid 的**命令行是否属于**这个 profile(macOS 版 `pidClaimsProfile` 的判据来源)。
|
|
114
|
+
*
|
|
115
|
+
* 🔴 为什么要单独有它(2026-11-18 自查补漏):`process.ts` 的 `pidClaimsProfile` 原实现在
|
|
116
|
+
* **没有 `/proc` 时直接 `catch → false`** ⇒ macOS 上**每一个 pid 都"不属于"本槽位**。
|
|
117
|
+
* 而 `destroySlot` 用它的返回值决定"台账那条 pid 是不是陈旧/被污染":
|
|
118
|
+
* `false` ⇒ 会印出「**台账那条记录是陈旧的或被污染**」—— 一句**在 mac 上恒假的话**。
|
|
119
|
+
* ⇒ 判据:**失败方向正确 ≠ 每条路径都正确**。`findPidsByProfile` 回空是安全的(不杀),
|
|
120
|
+
* 但**归因文案**会替一个不存在的成因作证(D253「恒空读数器」同族)。
|
|
121
|
+
*
|
|
122
|
+
* ⚠️ `ps` 查不到该 pid ⇒ **false**(与 Linux 侧"读不到 = 不属于"同向,保守:不杀)。
|
|
123
|
+
*/
|
|
124
|
+
export declare function macPidClaimsProfile(pid: number, profileDir: string): boolean;
|
|
112
125
|
/**
|
|
113
126
|
* 该 pid 是否活着(`kill(pid, 0)` 语义)。
|
|
114
127
|
*
|
package/lib/browser/process.d.ts
CHANGED
|
@@ -317,12 +317,21 @@ export declare function destroySlot(n: number, pidHint?: number): {
|
|
|
317
317
|
detail: string;
|
|
318
318
|
};
|
|
319
319
|
/**
|
|
320
|
-
* 某 pid 是否**真的**属于这个 profile
|
|
320
|
+
* 某 pid 是否**真的**属于这个 profile(Linux:读 `/proc/<pid>/cmdline`;macOS:`ps`)。
|
|
321
321
|
*
|
|
322
322
|
* 判据与 `findPidsByProfile` 同源:命令行里必须出现本槽位专属的 `--user-data-dir`。
|
|
323
323
|
* ⚠️ 单独包一个函数是为了让「pid 归属校验」这件事有一个**可被点名测试**的落点。
|
|
324
|
+
*
|
|
325
|
+
* 🔴 **2026-11-18(自查补漏,v1.137.9)**:原实现**没有 mac 分支** ⇒ macOS 上恒 `false`。
|
|
326
|
+
* 而 `destroySlot` 用这个返回值决定"台账那条 pid 是不是陈旧/被污染" ⇒
|
|
327
|
+
* 会印出「**台账那条记录是陈旧的或被污染**」——**一句在 mac 上恒假的话**。
|
|
328
|
+
* ⇒ 判据:**失败方向正确 ≠ 每条路径都正确**;回空集合是安全的(不杀),
|
|
329
|
+
* 但**归因文案**会替一个不存在的成因作证(D253 同族)。
|
|
330
|
+
*
|
|
331
|
+
* 🔴 `platform` 与 `macClaim` 都是**可注入参数**(与 {@link chromeCandidatesFor} 同一理由):
|
|
332
|
+
* 否则"分派真的发生了"这件事在 Linux 上**永远读不出对错** —— 删掉 darwin 分支测试也不会红。
|
|
324
333
|
*/
|
|
325
|
-
export declare function pidClaimsProfile(pid: number, profileDir: string): boolean;
|
|
334
|
+
export declare function pidClaimsProfile(pid: number, profileDir: string, platform?: string, macClaim?: (pid: number, profileDir: string) => boolean): boolean;
|
|
326
335
|
/** CDP 就绪探测(`/json/version` 能返回 JSON 即就绪) */
|
|
327
336
|
export declare function probeCdp(n: number, timeoutMs?: number): Promise<boolean>;
|
|
328
337
|
/**
|
package/lib/index.js
CHANGED
|
@@ -18538,6 +18538,42 @@ function macSample(pids, prev, now = Date.now()) {
|
|
|
18538
18538
|
};
|
|
18539
18539
|
}
|
|
18540
18540
|
/**
|
|
18541
|
+
* 某 pid 的**命令行是否属于**这个 profile(macOS 版 `pidClaimsProfile` 的判据来源)。
|
|
18542
|
+
*
|
|
18543
|
+
* 🔴 为什么要单独有它(2026-11-18 自查补漏):`process.ts` 的 `pidClaimsProfile` 原实现在
|
|
18544
|
+
* **没有 `/proc` 时直接 `catch → false`** ⇒ macOS 上**每一个 pid 都"不属于"本槽位**。
|
|
18545
|
+
* 而 `destroySlot` 用它的返回值决定"台账那条 pid 是不是陈旧/被污染":
|
|
18546
|
+
* `false` ⇒ 会印出「**台账那条记录是陈旧的或被污染**」—— 一句**在 mac 上恒假的话**。
|
|
18547
|
+
* ⇒ 判据:**失败方向正确 ≠ 每条路径都正确**。`findPidsByProfile` 回空是安全的(不杀),
|
|
18548
|
+
* 但**归因文案**会替一个不存在的成因作证(D253「恒空读数器」同族)。
|
|
18549
|
+
*
|
|
18550
|
+
* ⚠️ `ps` 查不到该 pid ⇒ **false**(与 Linux 侧"读不到 = 不属于"同向,保守:不杀)。
|
|
18551
|
+
*/
|
|
18552
|
+
function macPidClaimsProfile(pid, profileDir) {
|
|
18553
|
+
if (!Number.isInteger(pid) || pid <= 1 || profileDir === "") return false;
|
|
18554
|
+
let out;
|
|
18555
|
+
try {
|
|
18556
|
+
out = execFileSync("ps", [
|
|
18557
|
+
"-ww",
|
|
18558
|
+
"-p",
|
|
18559
|
+
String(pid),
|
|
18560
|
+
"-o",
|
|
18561
|
+
"command="
|
|
18562
|
+
], {
|
|
18563
|
+
encoding: "utf8",
|
|
18564
|
+
stdio: [
|
|
18565
|
+
"ignore",
|
|
18566
|
+
"pipe",
|
|
18567
|
+
"ignore"
|
|
18568
|
+
],
|
|
18569
|
+
timeout: 3e3
|
|
18570
|
+
});
|
|
18571
|
+
} catch {
|
|
18572
|
+
return false;
|
|
18573
|
+
}
|
|
18574
|
+
return out.includes(profileDir);
|
|
18575
|
+
}
|
|
18576
|
+
/**
|
|
18541
18577
|
* 该 pid 是否活着(`kill(pid, 0)` 语义)。
|
|
18542
18578
|
*
|
|
18543
18579
|
* 🔴 **不是"进程名存在"、也不是"目录存在"**(Linux 侧为此付过代价:僵尸进程会让
|
|
@@ -19071,13 +19107,23 @@ function destroySlot(n, pidHint = 0) {
|
|
|
19071
19107
|
};
|
|
19072
19108
|
}
|
|
19073
19109
|
/**
|
|
19074
|
-
* 某 pid 是否**真的**属于这个 profile
|
|
19110
|
+
* 某 pid 是否**真的**属于这个 profile(Linux:读 `/proc/<pid>/cmdline`;macOS:`ps`)。
|
|
19075
19111
|
*
|
|
19076
19112
|
* 判据与 `findPidsByProfile` 同源:命令行里必须出现本槽位专属的 `--user-data-dir`。
|
|
19077
19113
|
* ⚠️ 单独包一个函数是为了让「pid 归属校验」这件事有一个**可被点名测试**的落点。
|
|
19114
|
+
*
|
|
19115
|
+
* 🔴 **2026-11-18(自查补漏,v1.137.9)**:原实现**没有 mac 分支** ⇒ macOS 上恒 `false`。
|
|
19116
|
+
* 而 `destroySlot` 用这个返回值决定"台账那条 pid 是不是陈旧/被污染" ⇒
|
|
19117
|
+
* 会印出「**台账那条记录是陈旧的或被污染**」——**一句在 mac 上恒假的话**。
|
|
19118
|
+
* ⇒ 判据:**失败方向正确 ≠ 每条路径都正确**;回空集合是安全的(不杀),
|
|
19119
|
+
* 但**归因文案**会替一个不存在的成因作证(D253 同族)。
|
|
19120
|
+
*
|
|
19121
|
+
* 🔴 `platform` 与 `macClaim` 都是**可注入参数**(与 {@link chromeCandidatesFor} 同一理由):
|
|
19122
|
+
* 否则"分派真的发生了"这件事在 Linux 上**永远读不出对错** —— 删掉 darwin 分支测试也不会红。
|
|
19078
19123
|
*/
|
|
19079
|
-
function pidClaimsProfile(pid, profileDir) {
|
|
19124
|
+
function pidClaimsProfile(pid, profileDir, platform = process.platform, macClaim = macPidClaimsProfile) {
|
|
19080
19125
|
if (!Number.isInteger(pid) || pid <= 1) return false;
|
|
19126
|
+
if (platform === "darwin") return macClaim(pid, profileDir);
|
|
19081
19127
|
try {
|
|
19082
19128
|
return readFileSync(`/proc/${pid}/cmdline`, "utf8").includes(profileDir);
|
|
19083
19129
|
} catch {
|
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.9",
|
|
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": {
|