@shgroup/dsh-serenity-hooks 1.132.0 → 1.133.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.
- package/dsh.plugin.json +1 -1
- package/lib/browser/cdp.d.ts +14 -0
- package/lib/browser/hit-test.d.ts +78 -0
- package/lib/browser/service.d.ts +4 -0
- package/lib/index.js +136 -6
- 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.
|
|
3
|
+
"version": "1.133.0",
|
|
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
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
* 那些行为有真实使用与踩坑记录(4 条轨迹的手册在用)。搬的时候**不为好看改语义**。
|
|
25
25
|
*/
|
|
26
26
|
import type { KeyStroke } from './keys.js';
|
|
27
|
+
import type { HitProbe } from './hit-test.js';
|
|
27
28
|
import type { AxNode } from './ax.js';
|
|
28
29
|
/** 一条 CDP 连接上的相关器:发出去的 id → 待兑现的 promise */
|
|
29
30
|
interface CdpConn {
|
|
@@ -231,6 +232,19 @@ export declare function boxCenterByBackendId(slot: number, targetId: string, bac
|
|
|
231
232
|
h: number;
|
|
232
233
|
inViewport: boolean;
|
|
233
234
|
}>;
|
|
235
|
+
/**
|
|
236
|
+
* 命中测试:**这个点上到底是谁**(`DOM.getNodeForLocation`)。
|
|
237
|
+
*
|
|
238
|
+
* 🔴 为什么是它而不是页面里的 `document.elementFromPoint`:
|
|
239
|
+
* 前者问的是**合成器/真实点击用的那套命中逻辑**,后者是 DOM 侧的另一份实现。
|
|
240
|
+
* 「点下去发生了什么」要用**与点击同一套**的答案来回答(同族判据:有宿主自带实现就别复刻语义)。
|
|
241
|
+
*
|
|
242
|
+
* ⚠️ 三条 CDP 行为必须知道(否则读数会被读反):
|
|
243
|
+
* ① **坐标越界不报错** —— 只回 `nodeId: 0`。所以**视口判定必须自己算**,不能靠"回了空"。
|
|
244
|
+
* ② `DOM.enable` 与 `Overlay.enable` 都可省;但 `DOM.enable` 之后要销毁连接,本函数走 withPage 高层封装。
|
|
245
|
+
* ③ 解析节点用 `DOM.describeNode`(拿 nodeName / id),⛔ 不用 `DOM.getOuterHTML`(会把整段 HTML 拉回上下文)。
|
|
246
|
+
*/
|
|
247
|
+
export declare function hitTestAt(slot: number, targetId: string, x: number, y: number): Promise<HitProbe>;
|
|
234
248
|
/**
|
|
235
249
|
* 上传文件:`DOM.setFileInputFiles`。
|
|
236
250
|
*
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* hit-test.ts — 「这一下**到底会点到谁**」的**纯判定**(取数在 cdp.ts,执行在 cdp.ts)。
|
|
3
|
+
*
|
|
4
|
+
* 🔴🔴 为什么这一格必须存在(2026-11-13,owner 令做的 B 项,属 `browser-cdp-landscape` §5 最贵的那个缺口):
|
|
5
|
+
*
|
|
6
|
+
* 直到现在,`click --xy` 的回执说的是「**我点了哪里**」,不是「**我点到了什么**」。
|
|
7
|
+
* 而下面这三种情况,**CDP 一行都不报**,回执照样写着 `clicked @x,y`:
|
|
8
|
+
*
|
|
9
|
+
* ① **坐标在视口外** —— 事件发出去了,但视口里没有这个点 ⇒ 什么也没发生
|
|
10
|
+
* ② **被别的元素盖住** —— 点到了盖在上面的那个(弹层 / 固定头 / 遮罩 / 兄弟浮层)
|
|
11
|
+
* ③ **点在了空白处** —— 那里根本没有元素
|
|
12
|
+
*
|
|
13
|
+
* ⇒ 判据:**「发了鼠标事件」与「点到了目标」是两件事**(D311 的坐标版)。
|
|
14
|
+
* 回执必须回答后者,且**答案要能在下一步被验证**(所以回执里带"实际命中是谁")。
|
|
15
|
+
*
|
|
16
|
+
* ## 取数为什么用 `DOM.getNodeForLocation` 而不用自己的 `elementFromPoint`
|
|
17
|
+
*
|
|
18
|
+
* 它问的是**合成器的真实命中测试**(与真实点击走同一套命中逻辑),而 `elementFromPoint`
|
|
19
|
+
* 是 DOM 侧的另一份实现(同族判据:**有宿主自带实现时,直接调用它,不要复刻语义**)。
|
|
20
|
+
*
|
|
21
|
+
* ## 三条输出语义(`hit-test` 的返回值名就是这三条)
|
|
22
|
+
*
|
|
23
|
+
* `ok` —— 点下去会落在**你指定的那个元素**上
|
|
24
|
+
* `blocked` —— 落在**别的元素**上(回执说清是谁;这是最常见的真故障)
|
|
25
|
+
* `blank` —— 那里没有元素(页面确实留白)
|
|
26
|
+
* `offscreen` —— 点的位置不在视口内(**先 scroll**,⛔ 不要"点一下试试")
|
|
27
|
+
*/
|
|
28
|
+
/** 一次命中测试的读数(由 `cdp.ts` 的 `hitTestAt` 采集,形状与 CDP 一一对应) */
|
|
29
|
+
export interface HitProbe {
|
|
30
|
+
/** 该点是否落在视口内(CDP 对越界坐标**不报错**,只回空) */
|
|
31
|
+
inViewport: boolean;
|
|
32
|
+
/** 视口尺寸(用于回执里说清"这个点在哪之外") */
|
|
33
|
+
viewport?: {
|
|
34
|
+
w: number;
|
|
35
|
+
h: number;
|
|
36
|
+
};
|
|
37
|
+
/** `DOM.getNodeForLocation` 反解出的那个节点;空 = 那里没节点 */
|
|
38
|
+
node?: {
|
|
39
|
+
backendNodeId: number;
|
|
40
|
+
nodeName: string;
|
|
41
|
+
id?: string;
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
/** 判定结果(`kind` 就是上面那四条之一) */
|
|
45
|
+
export type HitVerdict = {
|
|
46
|
+
kind: 'ok';
|
|
47
|
+
node?: {
|
|
48
|
+
backendNodeId: number;
|
|
49
|
+
nodeName: string;
|
|
50
|
+
id?: string;
|
|
51
|
+
};
|
|
52
|
+
} | {
|
|
53
|
+
kind: 'blocked';
|
|
54
|
+
hit: {
|
|
55
|
+
backendNodeId: number;
|
|
56
|
+
nodeName: string;
|
|
57
|
+
id?: string;
|
|
58
|
+
};
|
|
59
|
+
why: string;
|
|
60
|
+
} | {
|
|
61
|
+
kind: 'blank';
|
|
62
|
+
} | {
|
|
63
|
+
kind: 'offscreen';
|
|
64
|
+
why: string;
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
67
|
+
* 判「这一下会点到谁」。
|
|
68
|
+
*
|
|
69
|
+
* @param probe 命中测试读数
|
|
70
|
+
* @param expect 期望命中的节点(`--ref` 时**有**这个值;纯 `--xy` 时**没有**)。
|
|
71
|
+
* ⚠️ 没有 `expect` 时**永远不判 `blocked`**:调用方没说要打谁,就没有"打错了"这回事 ——
|
|
72
|
+
* 只能报告"打到了谁"。⛔ 不替调用方猜目标。
|
|
73
|
+
*/
|
|
74
|
+
export declare function judgeHit(probe: HitProbe, expect?: {
|
|
75
|
+
backendNodeId: number;
|
|
76
|
+
}): HitVerdict;
|
|
77
|
+
/** 把判定渲染成一句**能被下一步验证**的回执(⛔ 不写"点击成功"这种无法证伪的话) */
|
|
78
|
+
export declare function renderHit(v: HitVerdict): string;
|
package/lib/browser/service.d.ts
CHANGED
|
@@ -17,6 +17,7 @@ import { type Clickable } from './click-target.js';
|
|
|
17
17
|
import { type KeyStroke } from './keys.js';
|
|
18
18
|
import { type AxLine } from './ax.js';
|
|
19
19
|
import { type WaitSpec } from './wait-spec.js';
|
|
20
|
+
import { type HitVerdict } from './hit-test.js';
|
|
20
21
|
/**
|
|
21
22
|
* 动作枚举(对外暴露的唯一清单)
|
|
22
23
|
*
|
|
@@ -167,6 +168,7 @@ export declare function slotClick(root: string, slot: number, sessionId: string,
|
|
|
167
168
|
x: number;
|
|
168
169
|
y: number;
|
|
169
170
|
};
|
|
171
|
+
ref?: number;
|
|
170
172
|
}): Promise<{
|
|
171
173
|
picked: Clickable;
|
|
172
174
|
total: number;
|
|
@@ -175,6 +177,8 @@ export declare function slotClick(root: string, slot: number, sessionId: string,
|
|
|
175
177
|
message: string;
|
|
176
178
|
accepted: boolean;
|
|
177
179
|
}>;
|
|
180
|
+
/** 「这一下**会点到谁**」的判定(B 项,D328)。⛔ 回执不说"点成功",只说它落在哪 */
|
|
181
|
+
hit: HitVerdict;
|
|
178
182
|
}>;
|
|
179
183
|
/** 列当前槽位上的 targets */
|
|
180
184
|
export declare function slotTargets(root: string, slot: number, sessionId: string): Promise<CdpTarget[]>;
|
package/lib/index.js
CHANGED
|
@@ -20687,6 +20687,82 @@ async function boxCenterByBackendId(slot, targetId, backendNodeId) {
|
|
|
20687
20687
|
});
|
|
20688
20688
|
}
|
|
20689
20689
|
/**
|
|
20690
|
+
* 命中测试:**这个点上到底是谁**(`DOM.getNodeForLocation`)。
|
|
20691
|
+
*
|
|
20692
|
+
* 🔴 为什么是它而不是页面里的 `document.elementFromPoint`:
|
|
20693
|
+
* 前者问的是**合成器/真实点击用的那套命中逻辑**,后者是 DOM 侧的另一份实现。
|
|
20694
|
+
* 「点下去发生了什么」要用**与点击同一套**的答案来回答(同族判据:有宿主自带实现就别复刻语义)。
|
|
20695
|
+
*
|
|
20696
|
+
* ⚠️ 三条 CDP 行为必须知道(否则读数会被读反):
|
|
20697
|
+
* ① **坐标越界不报错** —— 只回 `nodeId: 0`。所以**视口判定必须自己算**,不能靠"回了空"。
|
|
20698
|
+
* ② `DOM.enable` 与 `Overlay.enable` 都可省;但 `DOM.enable` 之后要销毁连接,本函数走 withPage 高层封装。
|
|
20699
|
+
* ③ 解析节点用 `DOM.describeNode`(拿 nodeName / id),⛔ 不用 `DOM.getOuterHTML`(会把整段 HTML 拉回上下文)。
|
|
20700
|
+
*/
|
|
20701
|
+
async function hitTestAt(slot, targetId, x, y) {
|
|
20702
|
+
return await withPage(slot, targetId, async (send) => {
|
|
20703
|
+
const vp = await send("Runtime.evaluate", {
|
|
20704
|
+
expression: "JSON.stringify({w:innerWidth,h:innerHeight})",
|
|
20705
|
+
returnByValue: true
|
|
20706
|
+
});
|
|
20707
|
+
let vw = 0;
|
|
20708
|
+
let vh = 0;
|
|
20709
|
+
try {
|
|
20710
|
+
const o = JSON.parse(String(vp.result?.value ?? "{}"));
|
|
20711
|
+
vw = Number(o.w ?? 0);
|
|
20712
|
+
vh = Number(o.h ?? 0);
|
|
20713
|
+
} catch {}
|
|
20714
|
+
const inViewport = vw > 0 && vh > 0 && x >= 0 && y >= 0 && x <= vw && y <= vh;
|
|
20715
|
+
if (!inViewport) return {
|
|
20716
|
+
inViewport,
|
|
20717
|
+
viewport: vw > 0 && vh > 0 ? {
|
|
20718
|
+
w: vw,
|
|
20719
|
+
h: vh
|
|
20720
|
+
} : void 0
|
|
20721
|
+
};
|
|
20722
|
+
await send("DOM.enable");
|
|
20723
|
+
const found = await send("DOM.getNodeForLocation", {
|
|
20724
|
+
x: Math.round(x),
|
|
20725
|
+
y: Math.round(y),
|
|
20726
|
+
includeUserAgentShadowDOM: false,
|
|
20727
|
+
ignorePointerEventsNone: false
|
|
20728
|
+
});
|
|
20729
|
+
const backend = Number(found.backendNodeId ?? 0);
|
|
20730
|
+
if (!Number.isFinite(backend) || backend <= 0) return {
|
|
20731
|
+
inViewport,
|
|
20732
|
+
viewport: {
|
|
20733
|
+
w: vw,
|
|
20734
|
+
h: vh
|
|
20735
|
+
}
|
|
20736
|
+
};
|
|
20737
|
+
let nodeName = "";
|
|
20738
|
+
let id = "";
|
|
20739
|
+
try {
|
|
20740
|
+
const desc = await send("DOM.describeNode", {
|
|
20741
|
+
backendNodeId: backend,
|
|
20742
|
+
depth: 0
|
|
20743
|
+
});
|
|
20744
|
+
nodeName = String(desc.node?.nodeName ?? "");
|
|
20745
|
+
const attrs = desc.node?.attributes ?? [];
|
|
20746
|
+
for (let i = 0; i + 1 < attrs.length; i += 2) if (attrs[i] === "id") {
|
|
20747
|
+
id = String(attrs[i + 1] ?? "");
|
|
20748
|
+
break;
|
|
20749
|
+
}
|
|
20750
|
+
} catch {}
|
|
20751
|
+
return {
|
|
20752
|
+
inViewport,
|
|
20753
|
+
viewport: {
|
|
20754
|
+
w: vw,
|
|
20755
|
+
h: vh
|
|
20756
|
+
},
|
|
20757
|
+
node: {
|
|
20758
|
+
backendNodeId: backend,
|
|
20759
|
+
nodeName: nodeName || "?",
|
|
20760
|
+
...id ? { id } : {}
|
|
20761
|
+
}
|
|
20762
|
+
};
|
|
20763
|
+
});
|
|
20764
|
+
}
|
|
20765
|
+
/**
|
|
20690
20766
|
* 上传文件:`DOM.setFileInputFiles`。
|
|
20691
20767
|
*
|
|
20692
20768
|
* 🔴🔴 **这是本轮唯一一个能把本地文件送进网页的动作**,所以守卫写在这里而不是工具层:
|
|
@@ -21560,6 +21636,49 @@ function explainWaitTimeout(spec, waitedMs, last) {
|
|
|
21560
21636
|
return "⛔ 等待超时(" + String(Math.round(waitedMs / 100) / 10) + "s)—— 等的是:" + what + "\n 最后一次读数:" + lastText + "\n ⇒ 若最后一次读数是 null/false,多半是条件写错了(形态:" + spec.kind + ");若是别的值,说明条件在往别的方向走 —— 用 eval 看一眼实际状态再重试。";
|
|
21561
21637
|
}
|
|
21562
21638
|
//#endregion
|
|
21639
|
+
//#region src/browser/hit-test.ts
|
|
21640
|
+
/**
|
|
21641
|
+
* 判「这一下会点到谁」。
|
|
21642
|
+
*
|
|
21643
|
+
* @param probe 命中测试读数
|
|
21644
|
+
* @param expect 期望命中的节点(`--ref` 时**有**这个值;纯 `--xy` 时**没有**)。
|
|
21645
|
+
* ⚠️ 没有 `expect` 时**永远不判 `blocked`**:调用方没说要打谁,就没有"打错了"这回事 ——
|
|
21646
|
+
* 只能报告"打到了谁"。⛔ 不替调用方猜目标。
|
|
21647
|
+
*/
|
|
21648
|
+
function judgeHit(probe, expect) {
|
|
21649
|
+
if (!probe.inViewport) {
|
|
21650
|
+
const vp = probe.viewport;
|
|
21651
|
+
return {
|
|
21652
|
+
kind: "offscreen",
|
|
21653
|
+
why: vp ? `不在视口内(视口 ${vp.w}×${vp.h})` : "不在视口内(视口尺寸未取到)"
|
|
21654
|
+
};
|
|
21655
|
+
}
|
|
21656
|
+
if (!probe.node || probe.node.backendNodeId <= 0) return { kind: "blank" };
|
|
21657
|
+
if (!expect) return {
|
|
21658
|
+
kind: "ok",
|
|
21659
|
+
node: probe.node
|
|
21660
|
+
};
|
|
21661
|
+
if (probe.node.backendNodeId === expect.backendNodeId) return {
|
|
21662
|
+
kind: "ok",
|
|
21663
|
+
node: probe.node
|
|
21664
|
+
};
|
|
21665
|
+
const who = `<${probe.node.nodeName.toLowerCase()}${probe.node.id ? ` id="${probe.node.id}"` : ""}>`;
|
|
21666
|
+
return {
|
|
21667
|
+
kind: "blocked",
|
|
21668
|
+
hit: probe.node,
|
|
21669
|
+
why: `落点被 ${who} 接住了(它的 backendNodeId=${probe.node.backendNodeId},期望的是 ${expect.backendNodeId})`
|
|
21670
|
+
};
|
|
21671
|
+
}
|
|
21672
|
+
/** 把判定渲染成一句**能被下一步验证**的回执(⛔ 不写"点击成功"这种无法证伪的话) */
|
|
21673
|
+
function renderHit(v) {
|
|
21674
|
+
switch (v.kind) {
|
|
21675
|
+
case "ok": return v.node ? `命中 <${v.node.nodeName.toLowerCase()}${v.node.id ? ` id="${v.node.id}"` : ""}>` : "命中(未取反查节点)";
|
|
21676
|
+
case "blocked": return `🔴 实际命中的不是你指定的元素:${v.why}`;
|
|
21677
|
+
case "blank": return "🔴 这个点上没有元素(页面留白/坐标算错了)";
|
|
21678
|
+
case "offscreen": return `🔴 ${v.why} ⇒ 先 scroll 再点,⛔ 别"点一下试试"`;
|
|
21679
|
+
}
|
|
21680
|
+
}
|
|
21681
|
+
//#endregion
|
|
21563
21682
|
//#region src/browser/service.ts
|
|
21564
21683
|
/**
|
|
21565
21684
|
* browser/service.ts — 槽位管理器的动作实现(ACC 级)
|
|
@@ -22089,8 +22208,11 @@ async function resolveTarget(root, slot, sessionId, opts) {
|
|
|
22089
22208
|
*/
|
|
22090
22209
|
async function slotClick(root, slot, sessionId, targetId, opts) {
|
|
22091
22210
|
assertSlotOwned(root, slot, sessionId);
|
|
22092
|
-
if (!opts.text && !opts.xy) throw new Error("⛔ 需要 --text=<按钮可见文字>
|
|
22211
|
+
if (!opts.text && !opts.xy) throw new Error("⛔ 需要 --text=<按钮可见文字> 或坐标(先 targets 拿 targetId)");
|
|
22093
22212
|
if (opts.xy) {
|
|
22213
|
+
const hit = judgeHit(await hitTestAt(slot, targetId, opts.xy.x, opts.xy.y), opts.ref !== void 0 ? { backendNodeId: opts.ref } : void 0);
|
|
22214
|
+
if (hit.kind === "offscreen" || hit.kind === "blank") throw new Error(`⛔ 不点:${renderHit(hit)}\n ⇒ 坐标 ${opts.xy.x},${opts.xy.y}。先用 \`ax\` 拿 ref(更稳)或 \`scroll\` 把目标滚进视口。`);
|
|
22215
|
+
if (hit.kind === "blocked") throw new Error(`⛔ 不点:${renderHit(hit)}\n ⇒ 被挡住时点下去会**执行另一个元素**的处理逻辑(而回执若是"clicked"就无从发现)。\n ⇒ 出路:先用 \`ax\` 看那一层是什么(弹层/固定头/遮罩),关掉它;或改用 \`--ref\` 点名目标。`);
|
|
22094
22216
|
const r = await clickAt(slot, targetId, opts.xy.x, opts.xy.y);
|
|
22095
22217
|
pageTouched(root, slot);
|
|
22096
22218
|
return {
|
|
@@ -22107,7 +22229,8 @@ async function slotClick(root, slot, sessionId, targetId, opts) {
|
|
|
22107
22229
|
download: false
|
|
22108
22230
|
},
|
|
22109
22231
|
total: 0,
|
|
22110
|
-
dialogs: r.dialogs
|
|
22232
|
+
dialogs: r.dialogs,
|
|
22233
|
+
hit
|
|
22111
22234
|
};
|
|
22112
22235
|
}
|
|
22113
22236
|
const raw = await evalInPage(slot, targetId, COLLECT_CLICKABLE, 15e3);
|
|
@@ -22119,12 +22242,15 @@ async function slotClick(root, slot, sessionId, targetId, opts) {
|
|
|
22119
22242
|
if (res.reason === "not-clickable") throw new Error(`⛔ 「${opts.text}」找到了,但${res.why}。\n ⇒ 这不是"尽力点一下"的场合:点了没反应与没点,在读数上一样。\n${renderClickables(res.hits)}`);
|
|
22120
22243
|
throw new Error(`⛔ 页面上没有可点元素匹配「${opts.text}」(匹配渲染后的可见文本,含 value/aria-label/title)。\n ⇒ 当前 ${visible.length} 个可见可点元素:\n${renderClickables(visible)}`);
|
|
22121
22244
|
}
|
|
22245
|
+
const hit = judgeHit(await hitTestAt(slot, targetId, res.el.x, res.el.y));
|
|
22246
|
+
if (hit.kind === "offscreen" || hit.kind === "blank") throw new Error(`⛔ 不点「${opts.text}」:${renderHit(hit)}\n ⇒ 「找得到」与「点得到」是两件事:元素在 DOM 里可见、可点,不代表这一下会落在它上面。`);
|
|
22122
22247
|
const clicked = await clickAt(slot, targetId, res.el.x, res.el.y);
|
|
22123
22248
|
pageTouched(root, slot);
|
|
22124
22249
|
return {
|
|
22125
22250
|
picked: res.el,
|
|
22126
22251
|
total: list.length,
|
|
22127
|
-
dialogs: clicked.dialogs
|
|
22252
|
+
dialogs: clicked.dialogs,
|
|
22253
|
+
hit
|
|
22128
22254
|
};
|
|
22129
22255
|
}
|
|
22130
22256
|
/** 列当前槽位上的 targets */
|
|
@@ -22634,11 +22760,15 @@ async function run(ctx, root, sessionId, trajectory, action, args) {
|
|
|
22634
22760
|
const text = str(args.text);
|
|
22635
22761
|
const xy = parseXY(args.xy);
|
|
22636
22762
|
if (!text && !xy) return `⛔ 需要 --text=<按钮可见文字> 或坐标(坐标三种写法都收):\n${xyFormHint("xy")}\n 例如:--text=登录`;
|
|
22637
|
-
const
|
|
22763
|
+
const refRaw = str(args.ref);
|
|
22764
|
+
const refId = refRaw === void 0 ? void 0 : refToBackendId(refRaw) ?? void 0;
|
|
22765
|
+
if (refRaw !== void 0 && refId === void 0) return `⛔ --ref 格式不对:${JSON.stringify(refRaw)}(要 \`ax\` 给出的 eNNN)`;
|
|
22766
|
+
const { picked, dialogs, hit } = await slotClick(root, n, sessionId, target, {
|
|
22638
22767
|
text,
|
|
22639
|
-
xy
|
|
22768
|
+
xy,
|
|
22769
|
+
ref: refId
|
|
22640
22770
|
});
|
|
22641
|
-
const base =
|
|
22771
|
+
const base = `[browser_slot] clicked ${xy ? `@${xy.x},${xy.y}` : `<${picked.tag}> "${picked.text.slice(0, 60)}" @${picked.x},${picked.y}`}|命中:${renderHit(hit)}`;
|
|
22642
22772
|
if (dialogs.length === 0) return base;
|
|
22643
22773
|
return `${base}\n${dialogs.map((d) => ` ⚠️ 自动处理弹窗 ${d.type || "(未知类型)"}:${JSON.stringify(d.message.slice(0, 100))} ⇒ ${d.accepted ? "已确定" : "已取消"}`).join("\n")}\n (默认取消;要「确定」请单独用 dialog --accept —— OK 常意味着删除/支付/发布)`;
|
|
22644
22774
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shgroup/dsh-serenity-hooks",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.133.0",
|
|
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": {
|