dsh-browser-cdp 1.12.1 → 1.12.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/CHANGELOG.md +10 -0
- package/dsh-plugin.json +1 -1
- package/lib/client.js +1 -1
- package/lib/index.js +38 -6
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
## 1.12.2 (2026-11-15)
|
|
2
|
+
|
|
3
|
+
**修掉「关了但面板不刷新」。**
|
|
4
|
+
|
|
5
|
+
- **现象**:ego-cli 通道上点 × 关新浪,浏览器里确实没了(`browser.listTabs()` 5 → 4),但面板标签条还挂着那一行。
|
|
6
|
+
- **根因**:面板标签条只认 `spaces` SSE 事件;在 CLI 通道上这个事件是**搭帧广播的车**发的(`writeCliImages` 里 `includeSpaces`),而帧广播在**没有图**时直接 early-return。关闭是结构性变更,不该等下一次成功截图——面板空闲时就是永远等不到。
|
|
7
|
+
- **修法**:`closeCliTab` 的 ego 分支在关闭成功后主动拉一次真实清单并 `broadcastCliSpaces`,用 `void (async …)()` 发射,**不阻塞**给用户的响应(点击不该等第二次 CLI 往返)。新增 `buildEgoListTabsScript`(`src/cast/panel-actions.ts`)与 `PanelActionRunner.listTabs`,走同一套 `taskSpaces.useOrCreate` + `browser.listTabs` + sentinel 协议。
|
|
8
|
+
- 拉清单失败时静默降级——下一次轮询 tick 会自己追上,不因此让关闭报错。
|
|
9
|
+
- 新增 6 条契约测试(`ego-close-contract` 3 条 + 新增 `ego-list-tabs-contract` 3 条):关闭分支必须在返回 `closed` 前广播、清单走 facade、发射不阻塞。
|
|
10
|
+
|
|
1
11
|
## 1.12.1 (2026-11-15)
|
|
2
12
|
|
|
3
13
|
**修掉面板 × 在 ego-cli 通道上点了没反应。**
|
package/dsh-plugin.json
CHANGED
package/lib/client.js
CHANGED
|
@@ -326,7 +326,7 @@ function shouldShowGen1SettingsGear(hasConfigForms, hasOpenSettingsDocument) {
|
|
|
326
326
|
*
|
|
327
327
|
* Keep in sync with package.json — `node scripts/bump.mjs <version>` writes both.
|
|
328
328
|
*/
|
|
329
|
-
const CLIENT_BUILD = "1.12.
|
|
329
|
+
const CLIENT_BUILD = "1.12.2";
|
|
330
330
|
|
|
331
331
|
//#endregion
|
|
332
332
|
//#region src/client/index.ts
|
package/lib/index.js
CHANGED
|
@@ -2169,7 +2169,7 @@ function focusIdFrom(value) {
|
|
|
2169
2169
|
*
|
|
2170
2170
|
* Keep in sync with package.json — `node scripts/bump.mjs <version>` writes both.
|
|
2171
2171
|
*/
|
|
2172
|
-
const CLIENT_BUILD = "1.12.
|
|
2172
|
+
const CLIENT_BUILD = "1.12.2";
|
|
2173
2173
|
|
|
2174
2174
|
//#endregion
|
|
2175
2175
|
//#region src/cast-server.ts
|
|
@@ -3938,6 +3938,16 @@ function buildEgoSwitchTabScript(spaceJson, body) {
|
|
|
3938
3938
|
return `const __bcdpTarget = ${js$1(pickTargetId(body))}\ntry {\n if (__bcdpTarget === '') throw new Error('targetId required')\n await taskSpaces.useOrCreate(${spaceJson})\n const __tabs = await browser.listTabs()\n const __hit = __tabs.find((t) => t.targetId === __bcdpTarget)\n if (!__hit) throw new Error('tab not found: ' + __bcdpTarget)\n if (__hit.active !== true) await browser.switchTab({ targetId: __bcdpTarget })\n console.log(${js$1(PANEL_SENTINEL)} + JSON.stringify({ ok: true, targetId: __bcdpTarget, url: __hit.url || '', title: __hit.title || '' }))\n} catch (__bcdpErr) {\n console.log(${js$1(PANEL_SENTINEL)} + JSON.stringify({ ok: false, error: String((__bcdpErr && __bcdpErr.message) || __bcdpErr) }))\n}\n`;
|
|
3939
3939
|
}
|
|
3940
3940
|
/**
|
|
3941
|
+
* tab-inventory heredoc — the panel's tab strip, read from the browser.
|
|
3942
|
+
*
|
|
3943
|
+
* Used after a structural change (a close) so the strip updates NOW instead of
|
|
3944
|
+
* waiting for the next successful frame capture. Prints the raw rows as JSON
|
|
3945
|
+
* behind the sentinel; the host maps them onto its CliSpaceRow contract.
|
|
3946
|
+
*/
|
|
3947
|
+
function buildEgoListTabsScript(spaceJson) {
|
|
3948
|
+
return `try {\n await taskSpaces.useOrCreate(${spaceJson})\n const __tabs = await browser.listTabs()\n const __rows = __tabs.map((t) => ({ targetId: String(t.targetId || ''), url: String(t.url || ''), title: String(t.title || ''), active: t.active === true }))\n console.log(${js$1(PANEL_SENTINEL)} + JSON.stringify({ ok: true, tabs: __rows }))\n} catch (__bcdpErr) {\n console.log(${js$1(PANEL_SENTINEL)} + JSON.stringify({ ok: false, error: String((__bcdpErr && __bcdpErr.message) || __bcdpErr) }))\n}\n`;
|
|
3949
|
+
}
|
|
3950
|
+
/**
|
|
3941
3951
|
* close-tab heredoc — the user clicked × in the panel.
|
|
3942
3952
|
*
|
|
3943
3953
|
* An `ego-cli` link injects no CDP websocket, so `/api/bcdp/close` used to
|
|
@@ -11530,7 +11540,21 @@ function makePanelActions(ctx, cfg) {
|
|
|
11530
11540
|
windowSize: (body) => run((spaceJson) => buildEgoWindowSizeScript(spaceJson, body)),
|
|
11531
11541
|
navigate: (body) => run((spaceJson) => buildEgoNavigateScript(spaceJson, body)),
|
|
11532
11542
|
switchTab: (body) => run((spaceJson) => buildEgoSwitchTabScript(spaceJson, body)),
|
|
11533
|
-
closeTab: (body) => run((spaceJson) => buildEgoCloseTabScript(spaceJson, body))
|
|
11543
|
+
closeTab: (body) => run((spaceJson) => buildEgoCloseTabScript(spaceJson, body)),
|
|
11544
|
+
listTabs: async () => {
|
|
11545
|
+
if (resolveCliPanelSpace(cfg) === null) return [];
|
|
11546
|
+
const parsed = await run((spaceJson) => buildEgoListTabsScript(spaceJson));
|
|
11547
|
+
const raw = parsed.tabs;
|
|
11548
|
+
if (parsed.ok !== true || !Array.isArray(raw)) return [];
|
|
11549
|
+
const now = Date.now();
|
|
11550
|
+
return raw.filter((t) => typeof t.targetId === "string" && t.targetId !== "").map((t) => ({
|
|
11551
|
+
targetId: String(t.targetId),
|
|
11552
|
+
url: String(t.url ?? ""),
|
|
11553
|
+
title: String(t.title ?? ""),
|
|
11554
|
+
active: t.active === true,
|
|
11555
|
+
lastActive: now
|
|
11556
|
+
}));
|
|
11557
|
+
}
|
|
11534
11558
|
};
|
|
11535
11559
|
}
|
|
11536
11560
|
/**
|
|
@@ -13451,10 +13475,18 @@ function apply(ctx, config = {}) {
|
|
|
13451
13475
|
if (__ch?.tabbitInventory !== true) {
|
|
13452
13476
|
if (__ch?.egoRuntime === true) {
|
|
13453
13477
|
const out = await panelActions.closeTab({ targetId });
|
|
13454
|
-
if (out.ok === true)
|
|
13455
|
-
|
|
13456
|
-
|
|
13457
|
-
|
|
13478
|
+
if (out.ok === true) {
|
|
13479
|
+
(async () => {
|
|
13480
|
+
try {
|
|
13481
|
+
const tabs = await panelActions.listTabs();
|
|
13482
|
+
if (tabs.length > 0) broadcastCliSpaces(tabs);
|
|
13483
|
+
} catch {}
|
|
13484
|
+
})();
|
|
13485
|
+
return {
|
|
13486
|
+
ok: true,
|
|
13487
|
+
reason: "closed"
|
|
13488
|
+
};
|
|
13489
|
+
}
|
|
13458
13490
|
return {
|
|
13459
13491
|
ok: false,
|
|
13460
13492
|
reason: typeof out.reason === "string" && out.reason !== "" ? out.reason : "close-failed"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-browser-cdp",
|
|
3
|
-
"version": "1.12.
|
|
3
|
+
"version": "1.12.2",
|
|
4
4
|
"description": "dsh-browser-cdp: visible agent browser for DSH — drives the vendored ego-compatible Chromium over CDP, and can also attach to a running Chrome/Edge/Brave or route through egolite, Tabbit and Lightpanda backends. 35 structured bcdp_* tools; only bcdp_status stays resident by default (lazy injection, −91.9% schema per turn for non-browser sessions). Realtime watch panel with direct click/scroll/IME input, element picks quoted into the composer, human-verification notices; non-CDP channels sync frames by 3s polling. Web shell: floating watch ball without dsh-better-sidebar, sidebar tab with it. Headless/TUI hosts: tools-only. [DSH 0.1.0-rc.2 ~ 0.2.2-rc.1: declarative settings via Config .volatile() fields on 0.1.7+; imperative installSection / module-level registration + describe/mutate bridge on 0.1.0 ~ 0.1.5 (experimental, pending farm). Client peers stay optional so gen-1 hosts without dsh-client-store still load; for a production install on the current line use the 0.17.x line]",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./lib/index.js",
|