dsh-browser-cdp 1.14.9 → 1.14.11
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/CHANGELOG.md +39 -0
- package/bin/cdp-cast-worker.mjs +88 -18
- package/dsh-plugin.json +1 -1
- package/lib/client.js +965 -151
- package/lib/index.js +205 -65
- package/lib/{launcher-DfE6ivh_.js → launcher-BnxRC9AU.js} +59 -11
- package/lib/launcher-y5sx1g6M.js +3 -0
- package/package.json +1 -1
- package/skills/bcdp-browser/SKILL.md +105 -68
- package/lib/launcher-YRO_KCPS.js +0 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,42 @@
|
|
|
1
|
+
## 1.14.11 (2026-11-24)
|
|
2
|
+
|
|
3
|
+
**三件事同版出厂:① 页面动作药丸(页面与面板说同一句话)② 首次使用引导(设置分节三步教学)③ 侧栏元数据面(8 项:这页什么状态、谁在驱动)。**
|
|
4
|
+
|
|
5
|
+
### 一、页面动作药丸
|
|
6
|
+
|
|
7
|
+
每个 `bcdp_*` 调用前 4s,页面内角标与侧栏/浮窗药丸显示同一句话「DSH · 正在点击」,先把动作说清楚,模型只需补 WHY。
|
|
8
|
+
|
|
9
|
+
- **host 侧单一真源**:`TOOL_ACTION_LABELS`(18 个碰页面的工具)+ `markEgoToolCall(sessionId, toolName)` 把 `{zh,en}` 随 `tool-call` SSE 下发;客户端只选词、不自带第二份表;`bcdp_status`/`bcdp_help` 这类元工具不给动作词("正在读取页面"对它们是假话)。
|
|
10
|
+
- **`withPageOverlay`**:除 `bcdp_wait`(本身就在等人)外的页面工具先打一次页面角标;`bcdp_status` 返回体新增 `overlay` 指引(一条英文说明模型该在批次前后各说一句,不做常驻噪声)。
|
|
11
|
+
- **契约测试**:`action-label-contract`(词表覆盖/长度/双语成对)、`page-overlay`(覆盖层表达式)、`locale-guard` 三档棘轮(C-ui/A-pair/B-log,基线 148/82)。
|
|
12
|
+
|
|
13
|
+
### 二、首次使用引导
|
|
14
|
+
|
|
15
|
+
沿 guide-kit 统一契约(与 session-guard / thinking-levels 同形):`guide.tsx` 是 kit 生成副本(会被 sync 覆盖),本插件专属文案只放 `guide-steps.ts`。三步:先连一个浏览器 → 工具是懒注入的(默认只常驻 `bcdp_status`)→ agent 动页面时你能看见。本地标记 `dsh.guide.browser-cdp.skipped` 持久化:跳过/看完都不再自动弹,分节底部恒定留「重新查看引导」。零外部依赖、全程 try/catch,不参与设置数据臂。
|
|
16
|
+
|
|
17
|
+
### 三、侧栏元数据面(8 项)
|
|
18
|
+
|
|
19
|
+
- **M1–M3/M8(免费项)**:`viewportW/H`、`capturing`、`lastActive` 早已在 spaces 行里推送却无人消费。状态行现在串出 `1200×800 · 3s 前 · agent · 会话 a1b2`;`capturing===false` 追加「未截流」(`true`/未知是常态,不占位);tab 条尾部补 `N 页`。`lastActive<=0` 一律**不显示**——0 是「worker 没采到帧」,不是 1970。
|
|
20
|
+
- **M4**:某 tab 命中人机验证时该行加 `⚠` 角标(title 用既有 captcha 文案),Tab 与浮窗两处都加。
|
|
21
|
+
- **M5/M6(宿主 1 处签名)**:ownership 与「哪个会话在驱动」都走**已有的** `focus` 事件——`TargetFocus` 补 `sessionId?`,`pushFocus(targetId, source, sessionId?)` 第三参可选,`noteToolFocus` 把已握在手里的 `sid` 传下去。客户端首次监听 `event: focus`,维护 `targetId→{source,sessionId}`,同值不触发重渲染,随 spaces 的 live ids 剪枝(不落 localStorage:targetId 是运行时句柄)。
|
|
22
|
+
- **M7(worker 采集)**:`HUMAN_PROBE_JS` 的返回体扩为 `{detected,kind,readyState,dpr}`(同一次 `Runtime.evaluate`,零额外调用);活动 tab 额外一次 `Page.getLayoutMetrics`,用 `layoutViewport.clientWidth / cssLayoutViewport.clientWidth` 推页面 zoom(`outerWidth/innerWidth` 在嵌入/远程场景不准,不采用)。`getLayoutMetrics` 缺席时 try/catch 后 zoom 置 null,spaces 行照旧完整。zoom=100% 与 DPR=1 不显示。
|
|
23
|
+
- **通道治理(只治元数据,帧缓存不动)**:`lastActive` 进渲染前截断到秒;两处 `spaces` SSE 监听包 300ms **尾部合并**(连推 5 条 → 1 次 `store.update`);`frame` 事件仍是零元数据。
|
|
24
|
+
- **实现注记**:格式化抽 `src/client/space-meta.ts`(零中文纯函数,Tab 与浮窗共用同一份字符串),词条放 `src/client/locales.ts` 后 `Object.assign` 进 `watchEn`/`watchZh`——直接写进 `index.ts` 的中文字面量会撞 locale 守卫的硬编码棘轮(基线 148/82 不动)。
|
|
25
|
+
|
|
26
|
+
门禁:`npm run typecheck` 双 project 干净;`npm test` **1398 passed / 13 skipped**(+27:`space-meta` 单测覆盖 `lastActive=0`、四档距今、`capturing` 三态、zoom=100/80/null、readyState 三态、owner 四种组合、合并器与词条成对;另含 action-label-contract / page-overlay / locale-guard);`npm run build` 后 `lib/client.js` 含 `formatSpaceMeta`/`createSpacesCoalescer`/`truncateLastActive`/`GuidePanel` 与新增文案,`bin/cdp-cast-worker.mjs` 含 `devicePixelRatio`/`Page.getLayoutMetrics`/`cssLayoutViewport`。
|
|
27
|
+
|
|
28
|
+
## 1.14.10 (2026-11-22)
|
|
29
|
+
|
|
30
|
+
**插件卫生审计三模式加强:P1 双清单漂移收尾(#19 家族第二轮)× P2 面板散文本地化(search-index#5 家族)× P3 stale build 重建。**
|
|
31
|
+
|
|
32
|
+
- **P1**:darwin/posix 的浏览器发现清单与 win32 同病——launcher 只认 `/Applications/Google Chrome.app` 与 4 条固定 /usr/bin 路径,doctor 却探 Chromium/Edge/Brave bundle、`~/Applications`、PATH 裸名与 /opt;只装 Edge 的 macOS、chromium 在 /usr/local/bin 的 linux,会复刻 #19 的「doctor 说装了、launcher 找不到」。canonical 清单下沉 launcher(`DARWIN_CHROME_BUNDLES`/`darwinChromeCandidates`/`POSIX_CHROME_BINS`/`posixChromeCandidates`,PATH 展开保持 doctor 原有 name-major 语义),doctor 的 `darwinChromeCandidates()`/posix 分支改为委托,`discoverChromeBinary` 三平台全部吃 canonical 表;`PLATFORM_CANDIDATES` 双清单删除。
|
|
33
|
+
- **P2**:面板/页面 UI 的 9 处硬编码中文散文收进 locale 面。client 面板 7 处入 watchDict(en/zh 双语补全):MSE 视频错误 3 处、链接行 `LP·无头` 徽标、live 图缩放 tooltip、tab 关闭失败前缀、空态标题。pick 覆盖层 2 处(引用按钮 + 确认条)改为面板经 pick 请求透传 `labels`——cast-server 原样代理 body,worker 校验后进 PickChannel,注入表达式 `data.ui.quote || 兜底`;en 用户不再看到中文按钮,老调用方不传 labels 时 zh 兜底逐字节不变。
|
|
34
|
+
- **P3**:1.14.9 提交未重建 lib(lib 停在 1.14.8 构建)——本版 `npm run build` 重建,#19 的 launcher 修复随 lib 真正出厂;prepack 门禁在位(`prepack: npm run build`)。
|
|
35
|
+
|
|
36
|
+
门禁:`npm run typecheck` 干净;`npm test` **1355 passed / 13 skipped**(+8:launcher darwin/posix 5 例 + pick labels 3 例;`tabbit-backend-dispatch` 1 例为 HEAD 预存失败,与本版无关);`npm run build` 后 lib/ 与 src/ 同步。
|
|
37
|
+
|
|
38
|
+
Known edge(观察项,未修):EGO_CLI_LABEL 等 3 个默认标签 host/client 镜像重复(双 bundle 结构所限、已注释互指,漂移为外观级);TUI(`tui-command.ts`)与 agent 面(`help.ts`/`errors.ts`)的中文散文为既定设计,不属 #5 泄漏面。
|
|
39
|
+
|
|
1
40
|
## 1.14.8 (2026-11-22)
|
|
2
41
|
|
|
3
42
|
**面板路由 base 化(上游 #100 同构,修法沿用):反向代理子路径部署下 `/api/bcdp/*` 不再打到代理根。**
|
package/bin/cdp-cast-worker.mjs
CHANGED
|
@@ -5925,16 +5925,23 @@ async function evaluate(call, sessionId, expression) {
|
|
|
5925
5925
|
};
|
|
5926
5926
|
}
|
|
5927
5927
|
}
|
|
5928
|
+
/** zh fallbacks — the panel normally supplies localized PickUiLabels. */
|
|
5929
|
+
const FALLBACK_QUOTE = "引用到对话 Ctrl+J";
|
|
5930
|
+
const FALLBACK_QUOTED = "✓ 已引用到输入框";
|
|
5928
5931
|
/**
|
|
5929
5932
|
* The page-side program. Kept as one string so it survives `Runtime.evaluate`
|
|
5930
5933
|
* with no bundler involved. Idempotent: re-running replaces the previous UI.
|
|
5931
5934
|
*/
|
|
5932
|
-
function uiExpression(element) {
|
|
5935
|
+
function uiExpression(element, labels) {
|
|
5933
5936
|
return `(() => {
|
|
5934
5937
|
const data = ${JSON.stringify({
|
|
5935
5938
|
rect: element.rect,
|
|
5936
5939
|
describe: element.describe,
|
|
5937
|
-
binding: PICK_BINDING
|
|
5940
|
+
binding: PICK_BINDING,
|
|
5941
|
+
ui: {
|
|
5942
|
+
quote: labels?.quote ?? "",
|
|
5943
|
+
quoted: labels?.quoted ?? ""
|
|
5944
|
+
}
|
|
5938
5945
|
})};
|
|
5939
5946
|
const ID_BOX = '__dsh-pick-box';
|
|
5940
5947
|
const ID_BAR = '__dsh-pick-bar';
|
|
@@ -5974,7 +5981,7 @@ const desc = document.createElement('span');
|
|
|
5974
5981
|
desc.className = 'dsh-pick-desc';
|
|
5975
5982
|
desc.textContent = data.describe;
|
|
5976
5983
|
const btnComment = document.createElement('button');
|
|
5977
|
-
btnComment.textContent =
|
|
5984
|
+
btnComment.textContent = data.ui.quote || ${JSON.stringify(FALLBACK_QUOTE)};
|
|
5978
5985
|
bar.appendChild(desc); bar.appendChild(btnComment);
|
|
5979
5986
|
const below = rect.y + rect.height + 10;
|
|
5980
5987
|
const barH = 36;
|
|
@@ -5996,12 +6003,12 @@ window.addEventListener('keydown', function onKey(ev) {
|
|
|
5996
6003
|
window.__dshPickUiDone = () => done;
|
|
5997
6004
|
})()`;
|
|
5998
6005
|
}
|
|
5999
|
-
/** T5.11's
|
|
6000
|
-
function confirmExpression() {
|
|
6006
|
+
/** T5.11's quoted-state confirm, collapsed in place after 2.5s. */
|
|
6007
|
+
function confirmExpression(labels) {
|
|
6001
6008
|
return `(() => {
|
|
6002
6009
|
const bar = document.getElementById('__dsh-pick-bar');
|
|
6003
6010
|
if (bar) {
|
|
6004
|
-
bar.textContent =
|
|
6011
|
+
bar.textContent = ${JSON.stringify(labels?.quoted || FALLBACK_QUOTED)};
|
|
6005
6012
|
setTimeout(() => { bar.remove(); }, 2500);
|
|
6006
6013
|
}
|
|
6007
6014
|
const box = document.getElementById('__dsh-pick-box');
|
|
@@ -6016,14 +6023,14 @@ for (const id of ['__dsh-pick-box', '__dsh-pick-bar', '__dsh-pick-style']) {
|
|
|
6016
6023
|
})()`;
|
|
6017
6024
|
}
|
|
6018
6025
|
/** Draw the frame + bar and arm the binding that reports the chosen action. */
|
|
6019
|
-
async function showPickUi(call, sessionId, element) {
|
|
6026
|
+
async function showPickUi(call, sessionId, element, labels) {
|
|
6020
6027
|
const arm = await armBinding(call, sessionId);
|
|
6021
6028
|
if (!arm.ok) return arm;
|
|
6022
|
-
return evaluate(call, sessionId, uiExpression(element));
|
|
6029
|
+
return evaluate(call, sessionId, uiExpression(element, labels));
|
|
6023
6030
|
}
|
|
6024
6031
|
/** Swap the bar to the quoted state; the page collapses it after 2.5s. */
|
|
6025
|
-
async function confirmPickUi(call, sessionId) {
|
|
6026
|
-
return evaluate(call, sessionId, confirmExpression());
|
|
6032
|
+
async function confirmPickUi(call, sessionId, labels) {
|
|
6033
|
+
return evaluate(call, sessionId, confirmExpression(labels));
|
|
6027
6034
|
}
|
|
6028
6035
|
/** Remove every trace of the picker UI (panel unmount / tab switch / disable). */
|
|
6029
6036
|
async function removePickUi(call, sessionId) {
|
|
@@ -6101,6 +6108,8 @@ var PickChannel = class {
|
|
|
6101
6108
|
};
|
|
6102
6109
|
#detachPick = null;
|
|
6103
6110
|
#detachAction = null;
|
|
6111
|
+
/** Bar labels for the injected UI, supplied by the panel at enable time. */
|
|
6112
|
+
#uiLabels;
|
|
6104
6113
|
constructor(options) {
|
|
6105
6114
|
this.#cdp = options.cdp;
|
|
6106
6115
|
this.#sessions = options.sessions;
|
|
@@ -6122,9 +6131,10 @@ var PickChannel = class {
|
|
|
6122
6131
|
* this connection, and only then enters inspect mode — so a failure at any
|
|
6123
6132
|
* step leaves `enabled: false` with the reason, never a half-armed picker.
|
|
6124
6133
|
*/
|
|
6125
|
-
async setEnabled(enabled, targetId) {
|
|
6134
|
+
async setEnabled(enabled, targetId, uiLabels) {
|
|
6126
6135
|
if (!enabled) return this.#disable(targetId);
|
|
6127
6136
|
if (targetId === "") return this.#fail("target-required", "a targetId is required to start picking");
|
|
6137
|
+
this.#uiLabels = uiLabels;
|
|
6128
6138
|
const session = await this.#sessions.ensure(targetId);
|
|
6129
6139
|
const call = (method, params, options) => this.#sessions.call(targetId, method, params, options?.timeoutMs ?? 6e3);
|
|
6130
6140
|
const enabledDomains = await enableDomains(call, session.sessionId, ["Overlay", "DOM"], this.#affinity, targetId, CONNECTION_ID);
|
|
@@ -6269,7 +6279,7 @@ var PickChannel = class {
|
|
|
6269
6279
|
picks: this.#state.picks + 1
|
|
6270
6280
|
};
|
|
6271
6281
|
this.#onPick?.(element);
|
|
6272
|
-
const ui = await showPickUi(call, sessionId, element);
|
|
6282
|
+
const ui = await showPickUi(call, sessionId, element, this.#uiLabels);
|
|
6273
6283
|
if (!ui.ok) this.#onError?.(ui.code, ui.message);
|
|
6274
6284
|
this.#subscribeAction(sessionId);
|
|
6275
6285
|
}
|
|
@@ -6317,7 +6327,7 @@ var PickChannel = class {
|
|
|
6317
6327
|
this.#detachAction = null;
|
|
6318
6328
|
const targetId = this.#state.targetId;
|
|
6319
6329
|
const call = (method, params, options) => this.#sessions.call(targetId, method, params, options?.timeoutMs ?? 6e3);
|
|
6320
|
-
const confirm = await confirmPickUi(call, sessionId);
|
|
6330
|
+
const confirm = await confirmPickUi(call, sessionId, this.#uiLabels);
|
|
6321
6331
|
if (!confirm.ok) this.#onError?.(confirm.code, confirm.message);
|
|
6322
6332
|
this.#state = {
|
|
6323
6333
|
...this.#state,
|
|
@@ -6650,15 +6660,29 @@ try {
|
|
|
6650
6660
|
...JSON.parse(process.argv[2] || "{}")
|
|
6651
6661
|
};
|
|
6652
6662
|
} catch {}
|
|
6663
|
+
/**
|
|
6664
|
+
* One Runtime.evaluate answers three questions the panel used to guess at:
|
|
6665
|
+
* `humanCheck` (unchanged), `readyState` (a page still loading looks dead in a
|
|
6666
|
+
* screenshot) and `dpr` (a 1.25 phone-preview layout explains "why is the text
|
|
6667
|
+
* smaller"). All three ride the SAME 5s-throttled probe — no extra CDP call.
|
|
6668
|
+
*/
|
|
6653
6669
|
const HUMAN_PROBE_JS = `(() => {
|
|
6670
|
+
const readyState=document.readyState,dpr=(window.devicePixelRatio||1);
|
|
6654
6671
|
const el=document.querySelector('iframe[src*="recaptcha"],.g-recaptcha,.h-captcha,iframe[src*="hcaptcha"],.cf-turnstile,iframe[src*="turnstile"],iframe[src*="cloudflare"],#challenge-form,.challenge-form,#captcha,.captcha');
|
|
6655
|
-
if(el)return{detected:true,kind:/recaptcha/i.test(el.outerHTML)?'recaptcha':/hcaptcha/i.test(el.outerHTML)?'hcaptcha':/turnstile/i.test(el.outerHTML)?'turnstile':'captcha'};
|
|
6672
|
+
if(el)return{detected:true,kind:/recaptcha/i.test(el.outerHTML)?'recaptcha':/hcaptcha/i.test(el.outerHTML)?'hcaptcha':/turnstile/i.test(el.outerHTML)?'turnstile':'captcha',readyState:readyState,dpr:dpr};
|
|
6656
6673
|
const t=((document.body&&document.body.innerText)||'').slice(0,120000).toLowerCase();
|
|
6657
|
-
return /verify you are human|your activity looks unusual|captcha|i.?m not a robot|人机验证|安全验证|我是人类|验证码|滑块验证/.test(t)?{detected:true,kind:'captcha'}:{detected:false,kind:null};
|
|
6674
|
+
return /verify you are human|your activity looks unusual|captcha|i.?m not a robot|人机验证|安全验证|我是人类|验证码|滑块验证/.test(t)?{detected:true,kind:'captcha',readyState:readyState,dpr:dpr}:{detected:false,kind:null,readyState:readyState,dpr:dpr};
|
|
6658
6675
|
})()`;
|
|
6659
6676
|
const sseClients = /* @__PURE__ */ new Set();
|
|
6660
6677
|
const videoClients = /* @__PURE__ */ new Set();
|
|
6661
6678
|
const probeCache = /* @__PURE__ */ new Map();
|
|
6679
|
+
/**
|
|
6680
|
+
* Page zoom per target, kept apart from `probeCache` on purpose: the two are
|
|
6681
|
+
* written by different round-trips and must not overwrite each other.
|
|
6682
|
+
* `zoom: null` = "asked and could not know" (a backend without
|
|
6683
|
+
* Page.getLayoutMetrics) — the panel then shows nothing rather than a guess.
|
|
6684
|
+
*/
|
|
6685
|
+
const zoomCache = /* @__PURE__ */ new Map();
|
|
6662
6686
|
const frameCache = /* @__PURE__ */ new Map();
|
|
6663
6687
|
const winCache = /* @__PURE__ */ new Map();
|
|
6664
6688
|
const chromeFrameCache = /* @__PURE__ */ new Map();
|
|
@@ -7044,6 +7068,36 @@ async function activeTargetInfo(known, sessionId) {
|
|
|
7044
7068
|
async function activeTargetId(sessionId) {
|
|
7045
7069
|
return (await activeTargetInfo(void 0, sessionId)).id;
|
|
7046
7070
|
}
|
|
7071
|
+
/**
|
|
7072
|
+
* Page zoom for one target, on the same 5s cadence as the probe.
|
|
7073
|
+
*
|
|
7074
|
+
* Why the ratio of two viewports: `layoutViewport.clientWidth` is in CSS pixels
|
|
7075
|
+
* BEFORE zoom and `cssLayoutViewport.clientWidth` is the visual width, so their
|
|
7076
|
+
* ratio IS the zoom factor (1 = 100%). `outerWidth/innerWidth` was rejected — it
|
|
7077
|
+
* reports the browser chrome and is wrong for embedded/remote targets.
|
|
7078
|
+
*
|
|
7079
|
+
* Never throws into the caller: `Page.getLayoutMetrics` is absent on some CDP
|
|
7080
|
+
* variants, and a metadata probe must not cost a spaces row.
|
|
7081
|
+
*/
|
|
7082
|
+
function probeZoom(browser, targetId, now) {
|
|
7083
|
+
const cached = zoomCache.get(targetId);
|
|
7084
|
+
if (cached !== void 0 && now - cached.at <= 5e3) return;
|
|
7085
|
+
browser.sessions.call(targetId, "Page.getLayoutMetrics", {}, 3e3).then((raw) => {
|
|
7086
|
+
const metrics = raw || {};
|
|
7087
|
+
const layoutW = Number(metrics.layoutViewport?.clientWidth);
|
|
7088
|
+
const cssW = Number(metrics.cssLayoutViewport?.clientWidth);
|
|
7089
|
+
const pct = Number.isFinite(layoutW) && Number.isFinite(cssW) && cssW > 0 ? Math.round(layoutW / cssW * 100) : 0;
|
|
7090
|
+
zoomCache.set(targetId, {
|
|
7091
|
+
at: Date.now(),
|
|
7092
|
+
zoom: pct > 0 ? pct : null
|
|
7093
|
+
});
|
|
7094
|
+
}).catch(() => {
|
|
7095
|
+
zoomCache.set(targetId, {
|
|
7096
|
+
at: Date.now(),
|
|
7097
|
+
zoom: null
|
|
7098
|
+
});
|
|
7099
|
+
});
|
|
7100
|
+
}
|
|
7047
7101
|
async function snapshotSpaces(sessionId) {
|
|
7048
7102
|
const browser = active;
|
|
7049
7103
|
if (browser === null) return [];
|
|
@@ -7052,11 +7106,12 @@ async function snapshotSpaces(sessionId) {
|
|
|
7052
7106
|
const activeId = activeInfo.id;
|
|
7053
7107
|
const capturingIds = new Set(currentStatus.targetIds ?? (currentStatus.targetId ? [currentStatus.targetId] : []));
|
|
7054
7108
|
const spaces = [];
|
|
7109
|
+
const now = Date.now();
|
|
7055
7110
|
for (const target of targets.slice(0, 30)) {
|
|
7056
7111
|
const frame = frameCache.get(target.targetId);
|
|
7057
7112
|
const session = browser.sessions.get(target.targetId);
|
|
7058
7113
|
const cached = probeCache.get(target.targetId);
|
|
7059
|
-
if (!cached ||
|
|
7114
|
+
if (!cached || now - cached.at > 5e3) browser.sessions.call(target.targetId, "Runtime.evaluate", {
|
|
7060
7115
|
expression: HUMAN_PROBE_JS,
|
|
7061
7116
|
returnByValue: true,
|
|
7062
7117
|
awaitPromise: false
|
|
@@ -7067,6 +7122,8 @@ async function snapshotSpaces(sessionId) {
|
|
|
7067
7122
|
human: r.result?.value || null
|
|
7068
7123
|
});
|
|
7069
7124
|
}).catch(() => {});
|
|
7125
|
+
if (target.targetId === activeId) probeZoom(browser, target.targetId, now);
|
|
7126
|
+
const probe = cached?.human ?? null;
|
|
7070
7127
|
spaces.push({
|
|
7071
7128
|
targetId: target.targetId,
|
|
7072
7129
|
url: target.url,
|
|
@@ -7077,9 +7134,17 @@ async function snapshotSpaces(sessionId) {
|
|
|
7077
7134
|
lastActive: frame?.lastActive || 0,
|
|
7078
7135
|
viewportW: frame?.viewportW || session?.viewportW,
|
|
7079
7136
|
viewportH: frame?.viewportH || session?.viewportH,
|
|
7080
|
-
humanCheck:
|
|
7137
|
+
humanCheck: probe === null ? null : {
|
|
7138
|
+
detected: probe.detected === true,
|
|
7139
|
+
kind: probe.kind ?? null
|
|
7140
|
+
},
|
|
7141
|
+
readyState: probe?.readyState,
|
|
7142
|
+
dpr: probe?.dpr,
|
|
7143
|
+
zoom: zoomCache.get(target.targetId)?.zoom ?? null
|
|
7081
7144
|
});
|
|
7082
7145
|
}
|
|
7146
|
+
const liveIds = new Set(targets.map((target) => target.targetId));
|
|
7147
|
+
for (const id of [...zoomCache.keys()]) if (!liveIds.has(id)) zoomCache.delete(id);
|
|
7083
7148
|
spaces.sort((a, b) => Number(b.active) - Number(a.active) || b.lastActive - a.lastActive);
|
|
7084
7149
|
return spaces;
|
|
7085
7150
|
}
|
|
@@ -7298,10 +7363,15 @@ async function main() {
|
|
|
7298
7363
|
error: "no live browser"
|
|
7299
7364
|
});
|
|
7300
7365
|
const targetId = typeof body.targetId === "string" ? body.targetId : "";
|
|
7366
|
+
const rawLabels = body.labels;
|
|
7367
|
+
const uiLabels = rawLabels !== null && typeof rawLabels === "object" ? {
|
|
7368
|
+
quote: typeof rawLabels.quote === "string" ? rawLabels.quote : void 0,
|
|
7369
|
+
quoted: typeof rawLabels.quoted === "string" ? rawLabels.quoted : void 0
|
|
7370
|
+
} : void 0;
|
|
7301
7371
|
try {
|
|
7302
7372
|
return sendJson(res, 200, {
|
|
7303
7373
|
ok: true,
|
|
7304
|
-
state: await channel.setEnabled(body.enabled === true, targetId)
|
|
7374
|
+
state: await channel.setEnabled(body.enabled === true, targetId, uiLabels)
|
|
7305
7375
|
});
|
|
7306
7376
|
} catch (error) {
|
|
7307
7377
|
return sendJson(res, 503, {
|