dsh-browser-cdp 1.11.0 → 1.12.1
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 +19 -0
- package/dsh-plugin.json +1 -1
- package/lib/client.js +82 -13
- package/lib/index.js +102 -32
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,22 @@
|
|
|
1
|
+
## 1.12.1 (2026-11-15)
|
|
2
|
+
|
|
3
|
+
**修掉面板 × 在 ego-cli 通道上点了没反应。**
|
|
4
|
+
|
|
5
|
+
- **根因不是权限,是硬闸**:`/api/bcdp/close` 的 CLI 分支调 `closeCliTab`,而它第一行是 `if (channel.tabbitInventory !== true) return 'channel-cannot-close'`——ego-cli 通道恒被拒(实测 409)。但运行时**确实提供** `browser.closeTab(targetId)`(实测 5 个标签 → 3 个,新标签页与百度都真关掉了),所以错的是这道闸,不是通道能力。
|
|
6
|
+
- **ego-cli 走 panel-action heredoc 关闭**:新增 `buildEgoCloseTabScript`(`src/cast/panel-actions.ts`),与 size/navigate/switch 同一套 `taskSpaces.useOrCreate` + `browser.*` + sentinel 协议;`PanelActionRunner` 增加 `closeTab`,`closeCliTab` 在 `egoRuntime === true` 时先试它,只有两者都不具备的通道才答 `channel-cannot-close`。
|
|
7
|
+
- **共用同一个 runner 实例**:把 `makePanelActions(ctx, cfg)` 提到 `initCastServer` 之前存成局部变量,关闭与尺寸/导航/切页串行在**同一把 ego 锁**上,不再各建一个。
|
|
8
|
+
- **两道守卫**:`last-tab`(只剩一个标签时拒绝,避免把面板吊死在空清单)、`tab-not-found`(陈旧行不抛异常,让客户端能安静丢行)。关闭后**回读 inventory 验证**,真没了才答 `closed`。
|
|
9
|
+
- 新增 10 条契约测试(`tests/ego-close-contract.test.ts`):走 facade 不走裸 CDP、拒绝最后标签、陈旧行降级、sentinel 分支齐全、ego 分支先于拒绝分支、runner 唯一构造点。
|
|
10
|
+
|
|
11
|
+
## 1.12.0 (2026-11-15)
|
|
12
|
+
|
|
13
|
+
**设置分节排版:连接目标置顶,评审(JEV / Laya)组可抽屉折叠。**
|
|
14
|
+
|
|
15
|
+
- **连接目标置顶**:`FamilySettingsCard` 把 `FamLinks` 移到 `FAM_FIELD_GROUPS` 之前并传 `first: true`——顺序即优先级,它决定每一次 `bcdp_*` 打谁,是分节的第一性配置;置顶后块顶分隔线按 `first` 条件去掉,分节最上方不再出现无意义横线。
|
|
16
|
+
- **评审组抽屉折叠**:`gJudge` 组加 `foldable: true`,组标题改为 `<button aria-expanded>` + `▸/▾`,收起时标题右侧显示实际字段数「14 项」;收起态字段行**整段不渲染**(不是 CSS 隐藏,避免隐藏输入框仍可 Tab 聚焦)。
|
|
17
|
+
- **折叠态只存 localStorage**(`bcdp.settings.fold.<gk>`,读写全程 try/catch):折叠是纯 UI 偏好,**绝不写宿主配置**——每次配置写都是一次 patch 落盘。契约测试强制断言 `FamGroup` 内无 `commitField` / `scope.set`。
|
|
18
|
+
- 新增 3 条契约用例(`tests/fam-links.contract.test.ts`):连接目标必须先于所有分组、首个块不带顶部分隔线、只有评审组可折叠且折叠不落配置。
|
|
19
|
+
|
|
1
20
|
## 1.11.0
|
|
2
21
|
|
|
3
22
|
**设置入口改为独立顶层分节 + 齿轮挂载崩溃修复。**
|
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.
|
|
329
|
+
const CLIENT_BUILD = "1.12.1";
|
|
330
330
|
|
|
331
331
|
//#endregion
|
|
332
332
|
//#region src/client/index.ts
|
|
@@ -1569,9 +1569,25 @@ function SettingsGearOverlay(props) {
|
|
|
1569
1569
|
}
|
|
1570
1570
|
}, "×")), h(FamilySettingsCard, { scope }))) : null);
|
|
1571
1571
|
}
|
|
1572
|
+
function foldKey(gk) {
|
|
1573
|
+
return "bcdp.settings.fold." + gk;
|
|
1574
|
+
}
|
|
1575
|
+
function readFold(gk) {
|
|
1576
|
+
try {
|
|
1577
|
+
return window.localStorage.getItem(foldKey(gk)) === "1";
|
|
1578
|
+
} catch (e) {
|
|
1579
|
+
return false;
|
|
1580
|
+
}
|
|
1581
|
+
}
|
|
1582
|
+
function writeFold(gk, open) {
|
|
1583
|
+
try {
|
|
1584
|
+
window.localStorage.setItem(foldKey(gk), open ? "1" : "0");
|
|
1585
|
+
} catch (e) {}
|
|
1586
|
+
}
|
|
1572
1587
|
var FAM_FIELD_GROUPS = [
|
|
1573
1588
|
{
|
|
1574
1589
|
gk: "gTools",
|
|
1590
|
+
foldable: true,
|
|
1575
1591
|
en: "Tool sealing",
|
|
1576
1592
|
zh: "工具封印",
|
|
1577
1593
|
fields: [
|
|
@@ -1616,6 +1632,7 @@ var FAM_FIELD_GROUPS = [
|
|
|
1616
1632
|
},
|
|
1617
1633
|
{
|
|
1618
1634
|
gk: "gBasic",
|
|
1635
|
+
foldable: true,
|
|
1619
1636
|
en: "Basics",
|
|
1620
1637
|
zh: "基础",
|
|
1621
1638
|
fields: [
|
|
@@ -1691,6 +1708,7 @@ var FAM_FIELD_GROUPS = [
|
|
|
1691
1708
|
},
|
|
1692
1709
|
{
|
|
1693
1710
|
gk: "gCapture",
|
|
1711
|
+
foldable: true,
|
|
1694
1712
|
en: "Capture & streaming",
|
|
1695
1713
|
zh: "截图与推流",
|
|
1696
1714
|
fields: [
|
|
@@ -1848,6 +1866,7 @@ var FAM_FIELD_GROUPS = [
|
|
|
1848
1866
|
},
|
|
1849
1867
|
{
|
|
1850
1868
|
gk: "gJudge",
|
|
1869
|
+
foldable: true,
|
|
1851
1870
|
en: "Judgement (JEV / Laya)",
|
|
1852
1871
|
zh: "评审(JEV / Laya)",
|
|
1853
1872
|
fields: [
|
|
@@ -1970,7 +1989,13 @@ function FamilySettingsCard(props) {
|
|
|
1970
1989
|
return h("div", { style: {
|
|
1971
1990
|
display: "grid",
|
|
1972
1991
|
gap: "8px"
|
|
1973
|
-
} },
|
|
1992
|
+
} }, h(FamLinks, {
|
|
1993
|
+
key: "links",
|
|
1994
|
+
first: true,
|
|
1995
|
+
value,
|
|
1996
|
+
writable,
|
|
1997
|
+
scope
|
|
1998
|
+
}), FAM_FIELD_GROUPS.map(function(group) {
|
|
1974
1999
|
return h(FamGroup, {
|
|
1975
2000
|
key: group.gk,
|
|
1976
2001
|
group,
|
|
@@ -1978,25 +2003,65 @@ function FamilySettingsCard(props) {
|
|
|
1978
2003
|
writable,
|
|
1979
2004
|
scope
|
|
1980
2005
|
});
|
|
1981
|
-
}), h(FamLinks, {
|
|
1982
|
-
key: "links",
|
|
1983
|
-
value,
|
|
1984
|
-
writable,
|
|
1985
|
-
scope
|
|
1986
2006
|
}));
|
|
1987
2007
|
}
|
|
1988
2008
|
function FamGroup(props) {
|
|
1989
2009
|
var group = props.group;
|
|
1990
2010
|
var h = React.createElement;
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
2011
|
+
var title = _egoLocale === "zh" ? group.zh : group.en;
|
|
2012
|
+
var foldable = group.foldable === true;
|
|
2013
|
+
var foldState = React.useState(function() {
|
|
2014
|
+
return foldable ? readFold(group.gk) : true;
|
|
2015
|
+
});
|
|
2016
|
+
var open = foldState[0], setOpen = foldState[1];
|
|
2017
|
+
var headStyle = {
|
|
1995
2018
|
fontSize: "12px",
|
|
1996
2019
|
fontWeight: 600,
|
|
1997
2020
|
color: "var(--dsw-alias-label-secondary, rgba(127,127,127,.9))",
|
|
1998
2021
|
padding: "2px 0 4px"
|
|
1999
|
-
}
|
|
2022
|
+
};
|
|
2023
|
+
var chevronStyle = {
|
|
2024
|
+
fontSize: "10px",
|
|
2025
|
+
lineHeight: "16px",
|
|
2026
|
+
flex: "0 0 auto",
|
|
2027
|
+
color: "var(--dsw-alias-label-tertiary, rgba(127,127,127,.8))"
|
|
2028
|
+
};
|
|
2029
|
+
function toggle() {
|
|
2030
|
+
var next = !open;
|
|
2031
|
+
setOpen(next);
|
|
2032
|
+
writeFold(group.gk, next);
|
|
2033
|
+
}
|
|
2034
|
+
return h("div", { style: {
|
|
2035
|
+
borderTop: "1px solid var(--dsw-alias-border-l2, rgba(127,127,127,.25))",
|
|
2036
|
+
paddingTop: "6px"
|
|
2037
|
+
} }, foldable ? h("button", {
|
|
2038
|
+
type: "button",
|
|
2039
|
+
onClick: toggle,
|
|
2040
|
+
"aria-expanded": open,
|
|
2041
|
+
"aria-label": title,
|
|
2042
|
+
style: {
|
|
2043
|
+
display: "flex",
|
|
2044
|
+
alignItems: "center",
|
|
2045
|
+
gap: "6px",
|
|
2046
|
+
width: "100%",
|
|
2047
|
+
background: "none",
|
|
2048
|
+
border: "none",
|
|
2049
|
+
padding: 0,
|
|
2050
|
+
margin: 0,
|
|
2051
|
+
cursor: "pointer",
|
|
2052
|
+
font: "inherit",
|
|
2053
|
+
textAlign: "left",
|
|
2054
|
+
color: "inherit"
|
|
2055
|
+
}
|
|
2056
|
+
}, h("span", { style: chevronStyle }, open ? "▾" : "▸"), h("span", { style: {
|
|
2057
|
+
...headStyle,
|
|
2058
|
+
flex: "1 1 auto",
|
|
2059
|
+
minWidth: 0
|
|
2060
|
+
} }, title), h("span", { style: {
|
|
2061
|
+
fontSize: "10px",
|
|
2062
|
+
flex: "0 0 auto",
|
|
2063
|
+
color: "var(--dsw-alias-label-tertiary, rgba(127,127,127,.7))"
|
|
2064
|
+
} }, open ? "" : String(group.fields.length) + (_egoLocale === "zh" ? " 项" : " items"))) : h("div", { style: headStyle }, title), foldable && !open ? null : group.fields.map(function(f) {
|
|
2000
2065
|
return h(FamField, {
|
|
2001
2066
|
key: f.k,
|
|
2002
2067
|
f,
|
|
@@ -2475,7 +2540,11 @@ function FamLinks(props) {
|
|
|
2475
2540
|
commitField(scope, "cdpMode", "local");
|
|
2476
2541
|
}
|
|
2477
2542
|
}, wt("linksActivate"))));
|
|
2478
|
-
return h("div", { style: {
|
|
2543
|
+
return h("div", { style: props.first === true ? {
|
|
2544
|
+
paddingTop: "0",
|
|
2545
|
+
display: "grid",
|
|
2546
|
+
gap: "4px"
|
|
2547
|
+
} : {
|
|
2479
2548
|
borderTop: "1px solid var(--dsw-alias-border-l2, rgba(127,127,127,.25))",
|
|
2480
2549
|
paddingTop: "6px",
|
|
2481
2550
|
display: "grid",
|
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.
|
|
2172
|
+
const CLIENT_BUILD = "1.12.1";
|
|
2173
2173
|
|
|
2174
2174
|
//#endregion
|
|
2175
2175
|
//#region src/cast-server.ts
|
|
@@ -3938,6 +3938,26 @@ 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
|
+
* close-tab heredoc — the user clicked × in the panel.
|
|
3942
|
+
*
|
|
3943
|
+
* An `ego-cli` link injects no CDP websocket, so `/api/bcdp/close` used to
|
|
3944
|
+
* answer 409 `channel-cannot-close` for it: the × looked dead. The runtime does
|
|
3945
|
+
* expose `browser.closeTab(targetId)` (measured: two tabs closed, inventory went
|
|
3946
|
+
* 5 → 3), so the same operation runs here as a heredoc on the channel real tools
|
|
3947
|
+
* use.
|
|
3948
|
+
*
|
|
3949
|
+
* Two guards, both learned the hard way:
|
|
3950
|
+
* - **Last tab is refused.** Closing the only page leaves the space with nothing
|
|
3951
|
+
* to show, and the panel renders a strip no tool can recover from without
|
|
3952
|
+
* opening a new tab first.
|
|
3953
|
+
* - **Only close what is really there.** A stale panel row (tab already gone from
|
|
3954
|
+
* another window) answers `tab-not-found` instead of throwing, so the client can
|
|
3955
|
+
* drop the row rather than retry forever.
|
|
3956
|
+
*/
|
|
3957
|
+
function buildEgoCloseTabScript(spaceJson, body) {
|
|
3958
|
+
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) {\n console.log(${js$1(PANEL_SENTINEL)} + JSON.stringify({ ok: false, reason: 'tab-not-found', targetId: __bcdpTarget }))\n } else if (__tabs.length <= 1) {\n console.log(${js$1(PANEL_SENTINEL)} + JSON.stringify({ ok: false, reason: 'last-tab', targetId: __bcdpTarget }))\n } else {\n await browser.closeTab(__bcdpTarget)\n const __left = await browser.listTabs()\n const __gone = !__left.some((t) => t.targetId === __bcdpTarget)\n console.log(${js$1(PANEL_SENTINEL)} + JSON.stringify({ ok: __gone, closed: __gone, reason: __gone ? '' : 'still-open', targetId: __bcdpTarget, remaining: __left.length }))\n }\n} catch (__bcdpErr) {\n console.log(${js$1(PANEL_SENTINEL)} + JSON.stringify({ ok: false, error: String((__bcdpErr && __bcdpErr.message) || __bcdpErr) }))\n}\n`;
|
|
3959
|
+
}
|
|
3960
|
+
/**
|
|
3941
3961
|
* navigate heredoc — panel refresh / manual URL. Uses the runtime facades
|
|
3942
3962
|
* (`page.reload` / `page.goto`) rather than raw CDP so the CLI keeps its own
|
|
3943
3963
|
* load-state semantics and navigation guards.
|
|
@@ -8014,6 +8034,14 @@ async function runRefreshSync(plan, deps) {
|
|
|
8014
8034
|
//#endregion
|
|
8015
8035
|
//#region src/runtime/close-plan.ts
|
|
8016
8036
|
const CLOSE_SCRATCH_TASK = "dsh-panel-shot";
|
|
8037
|
+
function planCloseTasks(tasks, tabId, lastTaskName) {
|
|
8038
|
+
const ordered = [
|
|
8039
|
+
tasks.find((task) => task.ownedTabIds.includes(tabId))?.taskName ?? "",
|
|
8040
|
+
lastTaskName,
|
|
8041
|
+
CLOSE_SCRATCH_TASK
|
|
8042
|
+
].map((name$1) => name$1.trim()).filter((name$1) => name$1 !== "");
|
|
8043
|
+
return [...new Set(ordered)];
|
|
8044
|
+
}
|
|
8017
8045
|
|
|
8018
8046
|
//#endregion
|
|
8019
8047
|
//#region src/cast/run-queue.ts
|
|
@@ -11501,7 +11529,8 @@ function makePanelActions(ctx, cfg) {
|
|
|
11501
11529
|
return {
|
|
11502
11530
|
windowSize: (body) => run((spaceJson) => buildEgoWindowSizeScript(spaceJson, body)),
|
|
11503
11531
|
navigate: (body) => run((spaceJson) => buildEgoNavigateScript(spaceJson, body)),
|
|
11504
|
-
switchTab: (body) => run((spaceJson) => buildEgoSwitchTabScript(spaceJson, body))
|
|
11532
|
+
switchTab: (body) => run((spaceJson) => buildEgoSwitchTabScript(spaceJson, body)),
|
|
11533
|
+
closeTab: (body) => run((spaceJson) => buildEgoCloseTabScript(spaceJson, body))
|
|
11505
11534
|
};
|
|
11506
11535
|
}
|
|
11507
11536
|
/**
|
|
@@ -11792,6 +11821,10 @@ let _tabbitWindowId = 0;
|
|
|
11792
11821
|
const TABBIT_PANEL_TASK = "dsh-panel";
|
|
11793
11822
|
/** Upper bound on pages one task may own; each extra page slows every call. */
|
|
11794
11823
|
const TABBIT_MAX_OWNED_PAGES = 2;
|
|
11824
|
+
/** How long the close guard may stay armed. A tabbit snippet that never resolves
|
|
11825
|
+
* must not stall the frame poller forever; 15 s is comfortably past the measured
|
|
11826
|
+
* fast path (~560 ms) and the claim-release path (~47 ms + close). */
|
|
11827
|
+
const CLOSE_INFLIGHT_MAX_MS = 15e3;
|
|
11795
11828
|
/** Last close attempt, echoed in the stats snapshot: the panel's × is verified by
|
|
11796
11829
|
* INVENTORY, not by the receipt status (page.close() kills the receipt). */
|
|
11797
11830
|
let lastClose = null;
|
|
@@ -13411,12 +13444,27 @@ function apply(ctx, config = {}) {
|
|
|
13411
13444
|
});
|
|
13412
13445
|
ctx.inject?.(["webServer"], (wctx) => {
|
|
13413
13446
|
try {
|
|
13414
|
-
|
|
13447
|
+
const panelActions = makePanelActions(ctx, cfg);
|
|
13448
|
+
initCastServer(wctx, cfg, bridge, ffmpegManager, () => openAgentWindow(ctx, cfg), (opts) => importLoginCookies(opts, { subprocess: ctx.subprocess }), cliPoller, panelActions, () => tabbitSpaceRows(), async (targetId) => {
|
|
13415
13449
|
const eff = resolveEffectiveLink(cfg.links, cfg.activeTargetId);
|
|
13416
|
-
|
|
13417
|
-
|
|
13418
|
-
|
|
13419
|
-
|
|
13450
|
+
const __ch = runtimeOfLink(eff?.link)?.channel;
|
|
13451
|
+
if (__ch?.tabbitInventory !== true) {
|
|
13452
|
+
if (__ch?.egoRuntime === true) {
|
|
13453
|
+
const out = await panelActions.closeTab({ targetId });
|
|
13454
|
+
if (out.ok === true) return {
|
|
13455
|
+
ok: true,
|
|
13456
|
+
reason: "closed"
|
|
13457
|
+
};
|
|
13458
|
+
return {
|
|
13459
|
+
ok: false,
|
|
13460
|
+
reason: typeof out.reason === "string" && out.reason !== "" ? out.reason : "close-failed"
|
|
13461
|
+
};
|
|
13462
|
+
}
|
|
13463
|
+
return {
|
|
13464
|
+
ok: false,
|
|
13465
|
+
reason: "channel-cannot-close"
|
|
13466
|
+
};
|
|
13467
|
+
}
|
|
13420
13468
|
const cli = resolveTabbitCli((eff?.link)?.cliPath);
|
|
13421
13469
|
if (!cli.found) return {
|
|
13422
13470
|
ok: false,
|
|
@@ -13427,33 +13475,51 @@ function apply(ctx, config = {}) {
|
|
|
13427
13475
|
ok: false,
|
|
13428
13476
|
reason: "bad-target"
|
|
13429
13477
|
};
|
|
13478
|
+
const invNow = tabbitSpaceRows();
|
|
13479
|
+
if (invNow.tabs.length <= 1 && invNow.complete) return {
|
|
13480
|
+
ok: false,
|
|
13481
|
+
reason: "last-tab"
|
|
13482
|
+
};
|
|
13430
13483
|
const startedAt = Date.now();
|
|
13431
13484
|
const withDeadline = async (work, ms, fallback) => {
|
|
13432
13485
|
return Promise.race([work, new Promise((resolve$1) => setTimeout(() => resolve$1(fallback), ms))]);
|
|
13433
13486
|
};
|
|
13434
13487
|
_closeInFlight = true;
|
|
13488
|
+
let released = false;
|
|
13489
|
+
const release = () => {
|
|
13490
|
+
if (released) return;
|
|
13491
|
+
released = true;
|
|
13492
|
+
_closeInFlight = false;
|
|
13493
|
+
};
|
|
13494
|
+
const watchdog = setTimeout(release, CLOSE_INFLIGHT_MAX_MS);
|
|
13435
13495
|
let state$1 = "";
|
|
13436
13496
|
let closer = CLOSE_SCRATCH_TASK;
|
|
13497
|
+
let owner = "";
|
|
13437
13498
|
try {
|
|
13438
13499
|
const inv = await withDeadline(tabbitListTabs(ctx.subprocess, cli.cliPath, TABBIT_PANEL_TASK), 3e3, null);
|
|
13439
13500
|
state$1 = String(inv?.tabs.find((t) => t.tabId === tabId)?.state ?? "");
|
|
13440
|
-
if (state$1 === "owned") {
|
|
13441
|
-
|
|
13442
|
-
|
|
13443
|
-
|
|
13444
|
-
|
|
13445
|
-
|
|
13446
|
-
} else if (state$1 === "claimed") {
|
|
13447
|
-
let owner = _tabbitOwnerCache.owners.get(tabId);
|
|
13448
|
-
if (owner === void 0) {
|
|
13501
|
+
if (state$1 === "owned" || state$1 === "claimed") {
|
|
13502
|
+
let tasks = _tabbitOwnerCache.at !== 0 && _tabbitOwnerCache.owners.has(tabId) ? [{
|
|
13503
|
+
taskName: String(_tabbitOwnerCache.owners.get(tabId) ?? ""),
|
|
13504
|
+
ownedTabIds: [tabId]
|
|
13505
|
+
}] : [];
|
|
13506
|
+
if (tasks.length === 0) {
|
|
13449
13507
|
const diag = await withDeadline(tabbitDiagnose(ctx.subprocess, cli.cliPath), 3e3, null);
|
|
13450
|
-
if (diag)
|
|
13508
|
+
if (diag) tasks = parseTabbitTasks(diag.raw);
|
|
13509
|
+
}
|
|
13510
|
+
owner = planCloseTasks(tasks, tabId, _tabbitLastTaskName)[0] ?? "";
|
|
13511
|
+
if (state$1 === "owned" && owner !== "") {
|
|
13512
|
+
await withDeadline(tabbitFinishTask(ctx.subprocess, cli.cliPath, owner, false), 3e3, void 0);
|
|
13513
|
+
forgetTabbitTaskState();
|
|
13514
|
+
if (_tabbitLastTaskName === owner) _tabbitLastTaskName = "";
|
|
13515
|
+
_tabbitOwnerCache = {
|
|
13516
|
+
at: 0,
|
|
13517
|
+
owners: /* @__PURE__ */ new Map()
|
|
13518
|
+
};
|
|
13451
13519
|
}
|
|
13452
|
-
if (owner !==
|
|
13520
|
+
if (owner !== "") closer = owner;
|
|
13453
13521
|
}
|
|
13454
|
-
}
|
|
13455
|
-
_closeInFlight = false;
|
|
13456
|
-
}
|
|
13522
|
+
} catch {}
|
|
13457
13523
|
runTabbitSnippet$1(ctx.subprocess, "await page.close().catch(() => {}); return { closed: page.isClosed() };", {
|
|
13458
13524
|
cliPath: cli.cliPath,
|
|
13459
13525
|
taskName: closer,
|
|
@@ -13480,17 +13546,21 @@ function apply(ctx, config = {}) {
|
|
|
13480
13546
|
_tabbitTabCache.total = _tabbitTabCache.tabs.length;
|
|
13481
13547
|
broadcastCliSpaces(tabbitSpaceRows().tabs);
|
|
13482
13548
|
} else ctx.logger?.info?.(`dsh-browser-cdp: close tab ${tabId} via ${closer} did not close (${fired.receipt.status})`);
|
|
13483
|
-
}).catch(() =>
|
|
13484
|
-
|
|
13485
|
-
|
|
13486
|
-
|
|
13487
|
-
|
|
13488
|
-
|
|
13489
|
-
|
|
13490
|
-
|
|
13491
|
-
|
|
13492
|
-
|
|
13493
|
-
|
|
13549
|
+
}).catch(() => {
|
|
13550
|
+
lastClose = {
|
|
13551
|
+
tabId,
|
|
13552
|
+
task: closer,
|
|
13553
|
+
state: state$1 || "unknown",
|
|
13554
|
+
status: "error",
|
|
13555
|
+
closedByReceipt: false,
|
|
13556
|
+
stillThere: true,
|
|
13557
|
+
ms: Date.now() - startedAt,
|
|
13558
|
+
at: Date.now()
|
|
13559
|
+
};
|
|
13560
|
+
}).finally(() => {
|
|
13561
|
+
clearTimeout(watchdog);
|
|
13562
|
+
release();
|
|
13563
|
+
});
|
|
13494
13564
|
return {
|
|
13495
13565
|
ok: true,
|
|
13496
13566
|
reason: "dispatched"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-browser-cdp",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.12.1",
|
|
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",
|
|
@@ -124,7 +124,7 @@
|
|
|
124
124
|
"@deepseek-ai/dsh-session": "^0.2.1-rc.3",
|
|
125
125
|
"@deepseek-ai/dsh-skill": "^0.2.1-rc.3",
|
|
126
126
|
"@deepseek-ai/dsh-system-prompt": "^0.2.1-rc.3",
|
|
127
|
-
"@deepseek-ai/dsh-tools": ">=0.1
|
|
127
|
+
"@deepseek-ai/dsh-tools": ">=0.2.1-rc.1 <=0.2.2-rc.3",
|
|
128
128
|
"@deepseek-ai/dsh-user-approval": "^0.2.1-rc.3",
|
|
129
129
|
"@deepseek-ai/dsh-working-directory": "^0.2.1-rc.3",
|
|
130
130
|
"@types/node": "^22.20.1",
|