@shgroup/dsh-serenity-hooks 1.130.1 → 1.130.2
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/cdp.d.ts +4 -1
- package/lib/browser/service.d.ts +2 -0
- package/lib/index.js +54 -15
- 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.130.
|
|
3
|
+
"version": "1.130.2",
|
|
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/browser/cdp.d.ts
CHANGED
|
@@ -134,7 +134,10 @@ export declare function insertText(slot: number, targetId: string, text: string)
|
|
|
134
134
|
* 前者会触发懒加载/无限滚动/吸顶 header 的监听;后者只移动视口 ⇒ 页面上的虚拟列表**不加载新行**,
|
|
135
135
|
* 而读数看起来「滚动成功」(scrollY 变了)。
|
|
136
136
|
*/
|
|
137
|
-
export declare function scrollAt(slot: number, targetId: string, x: number, y: number, deltaX: number, deltaY: number): Promise<
|
|
137
|
+
export declare function scrollAt(slot: number, targetId: string, x: number, y: number, deltaX: number, deltaY: number): Promise<{
|
|
138
|
+
via: 'wheel' | 'js-fallback';
|
|
139
|
+
why?: string;
|
|
140
|
+
}>;
|
|
138
141
|
/**
|
|
139
142
|
* 拖拽(`mousePressed` → 多次 `mouseMoved` → `mouseReleased`)。
|
|
140
143
|
*
|
package/lib/browser/service.d.ts
CHANGED
|
@@ -239,6 +239,8 @@ export declare function slotScroll(root: string, slot: number, sessionId: string
|
|
|
239
239
|
deltaY?: number;
|
|
240
240
|
}): Promise<{
|
|
241
241
|
scrolledY: number;
|
|
242
|
+
via: 'wheel' | 'js-fallback';
|
|
243
|
+
why?: string;
|
|
242
244
|
}>;
|
|
243
245
|
/** 等待条件成立(条件由 `wait-spec.ts` 解析) */
|
|
244
246
|
export declare function slotWait(root: string, slot: number, sessionId: string, targetId: string, raw: string, timeoutMs: number): Promise<{
|
package/lib/index.js
CHANGED
|
@@ -20374,16 +20374,52 @@ async function insertText(slot, targetId, text) {
|
|
|
20374
20374
|
* 而读数看起来「滚动成功」(scrollY 变了)。
|
|
20375
20375
|
*/
|
|
20376
20376
|
async function scrollAt(slot, targetId, x, y, deltaX, deltaY) {
|
|
20377
|
-
|
|
20378
|
-
|
|
20379
|
-
|
|
20380
|
-
|
|
20381
|
-
|
|
20382
|
-
|
|
20383
|
-
|
|
20384
|
-
|
|
20377
|
+
/**
|
|
20378
|
+
* 🔴🔴 **真机实测(2026-11-11):Wayland headed Chrome 上 `mouseWheel` 会永久挂住。**
|
|
20379
|
+
*
|
|
20380
|
+
* 同一台机器、同一个 Chrome 版本,对照实验三档:
|
|
20381
|
+
* · `mouseMoved/mousePressed/mouseReleased` ⇒ **立刻返回**
|
|
20382
|
+
* · `Input.dispatchMouseEvent{type:'mouseWheel'}` ⇒ **30s 超时**
|
|
20383
|
+
* · `Input.synthesizeScrollGesture` ⇒ **同样超时**
|
|
20384
|
+
* 而**另起一个 `--headless=new` 实例**发同一个 wheel ⇒ **立刻返回**。
|
|
20385
|
+
* ⇒ 根因在「headed + Wayland」这一档:窗口被节流/遮挡时合成器不确认输入,
|
|
20386
|
+
* 而 CDP 的 wheel 是**等确认**的(不像 mouseMoved 那样 fire-and-forget)。
|
|
20387
|
+
* ⚠️ 我们**刻意**没有加 `--disable-renderer-backgrounding` 那组 flag(2026-11-09 耗电事故的教训),
|
|
20388
|
+
* 所以这个节流是预期行为 ⇒ 不该为了让 wheel 好用去关它。
|
|
20389
|
+
*
|
|
20390
|
+
* ⇒ 判据:**一种能力在有副作用的动作上不能"挂住"**。等 30s 再失败,等于把一个
|
|
20391
|
+
* 「滚不动」变成「卡死 30 秒」,而调用方无从区分。
|
|
20392
|
+
* ⇒ wheel 给**短超时**,超时后回落 JS 滚动,**并在回执里写明走的是哪条路**。
|
|
20393
|
+
* 🔴 回落不是等价物:JS 滚动**不产生 wheel 事件**,只靠 wheel 的懒加载不会触发。
|
|
20394
|
+
* 所以它必须**可见**(`via: 'js-fallback'`),⛔ 不静默替代。
|
|
20395
|
+
*/
|
|
20396
|
+
const wheel = {
|
|
20397
|
+
type: "mouseWheel",
|
|
20398
|
+
x,
|
|
20399
|
+
y,
|
|
20400
|
+
deltaX,
|
|
20401
|
+
deltaY,
|
|
20402
|
+
pointerType: "mouse"
|
|
20403
|
+
};
|
|
20404
|
+
try {
|
|
20405
|
+
await withPage(slot, targetId, async (send) => {
|
|
20406
|
+
await send("Input.dispatchMouseEvent", wheel, 4e3);
|
|
20385
20407
|
});
|
|
20386
|
-
|
|
20408
|
+
return { via: "wheel" };
|
|
20409
|
+
} catch (e) {
|
|
20410
|
+
const msg = String(e?.message ?? e);
|
|
20411
|
+
if (!/超时|timeout/i.test(msg)) throw e;
|
|
20412
|
+
await withPage(slot, targetId, async (send) => {
|
|
20413
|
+
await send("Runtime.evaluate", {
|
|
20414
|
+
expression: `window.scrollBy(${Math.round(deltaX)}, ${Math.round(deltaY)})`,
|
|
20415
|
+
returnByValue: true
|
|
20416
|
+
}, 8e3);
|
|
20417
|
+
});
|
|
20418
|
+
return {
|
|
20419
|
+
via: "js-fallback",
|
|
20420
|
+
why: "mouseWheel 在本机 headed/Wayland 档会挂住(见 scrollAt 判据),已回落 JS 滚动"
|
|
20421
|
+
};
|
|
20422
|
+
}
|
|
20387
20423
|
}
|
|
20388
20424
|
/**
|
|
20389
20425
|
* 拖拽(`mousePressed` → 多次 `mouseMoved` → `mouseReleased`)。
|
|
@@ -22163,13 +22199,15 @@ async function slotScroll(root, slot, sessionId, targetId, opts) {
|
|
|
22163
22199
|
};
|
|
22164
22200
|
}
|
|
22165
22201
|
const before = Number(await evalInPage(slot, targetId, "String(window.scrollY || 0)"));
|
|
22166
|
-
|
|
22167
|
-
else if (opts.to === "bottom") await scrollAt(slot, targetId, at.x, at.y, 0, 1e5);
|
|
22168
|
-
else await scrollAt(slot, targetId, at.x, at.y, 0, opts.deltaY ?? 600);
|
|
22202
|
+
const r = opts.to === "top" ? await scrollAt(slot, targetId, at.x, at.y, 0, -1e5) : opts.to === "bottom" ? await scrollAt(slot, targetId, at.x, at.y, 0, 1e5) : await scrollAt(slot, targetId, at.x, at.y, 0, opts.deltaY ?? 600);
|
|
22169
22203
|
await new Promise((r) => setTimeout(r, 250));
|
|
22170
22204
|
const after = Number(await evalInPage(slot, targetId, "String(window.scrollY || 0)"));
|
|
22171
22205
|
pageTouched(root, slot);
|
|
22172
|
-
return {
|
|
22206
|
+
return {
|
|
22207
|
+
scrolledY: Number.isFinite(after - before) ? after - before : 0,
|
|
22208
|
+
via: r.via,
|
|
22209
|
+
...r.why ? { why: r.why } : {}
|
|
22210
|
+
};
|
|
22173
22211
|
}
|
|
22174
22212
|
/** 等待条件成立(条件由 `wait-spec.ts` 解析) */
|
|
22175
22213
|
async function slotWait(root, slot, sessionId, targetId, raw, timeoutMs) {
|
|
@@ -22543,13 +22581,14 @@ async function run(ctx, root, sessionId, trajectory, action, args) {
|
|
|
22543
22581
|
const toRaw = str(args.to);
|
|
22544
22582
|
const to = toRaw === "top" || toRaw === "bottom" ? toRaw : void 0;
|
|
22545
22583
|
if (!refStr && !xy && !to) return "⛔ 需要 --ref=<eNNN> / --xy=<x,y> / --to=<top|bottom> 之一";
|
|
22546
|
-
const { scrolledY } = await slotScroll(root, n, sessionId, target, {
|
|
22584
|
+
const { scrolledY, via, why } = await slotScroll(root, n, sessionId, target, {
|
|
22547
22585
|
ref: refStr ? needBackendId(args) : void 0,
|
|
22548
22586
|
xy,
|
|
22549
22587
|
to,
|
|
22550
22588
|
deltaY: num(args.delta)
|
|
22551
22589
|
});
|
|
22552
|
-
|
|
22590
|
+
const viaLine = via === "wheel" ? "(真实 wheel 事件)" : `(⚠️ 回落 JS 滚动 —— ${why ?? ""};本次**没有产生 wheel 事件**,靠 wheel 触发的懒加载不会启动)`;
|
|
22591
|
+
return `[browser_slot] scroll → scrollY 变化 ${scrolledY > 0 ? "+" : ""}${scrolledY}px ${viaLine}`;
|
|
22553
22592
|
}
|
|
22554
22593
|
case "wait": {
|
|
22555
22594
|
const n = needSlot(args);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shgroup/dsh-serenity-hooks",
|
|
3
|
-
"version": "1.130.
|
|
3
|
+
"version": "1.130.2",
|
|
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": {
|