dsh-browser-cdp 1.10.0 → 1.11.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/CHANGELOG.md +7 -0
- package/dsh-plugin.json +1 -1
- package/lib/client.js +39 -231
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
## 1.11.0
|
|
2
|
+
|
|
3
|
+
**设置入口改为独立顶层分节 + 齿轮挂载崩溃修复。**
|
|
4
|
+
|
|
5
|
+
- **独立设置分节**:从家族 tab 迁出,新增 `mountOwnSettingsSection`(`settings.section`)与 `mountSettingsSectionIcon`(图标),低版本回退齿轮浮窗。
|
|
6
|
+
- **gen-1 齿轮崩溃修复**:`mountGen1SettingsGear` 裸 `ctx.get('remote')` 与 `remote.settings` 属性访问在 strict-resolver 宿主上抛 `cannot get property "remote.settings" without inject`,导致整个 mount 崩溃;改为将 `openSettingsDocument` 探测整体置于 try/catch,不可达时降级为 `hasOpenDoc=false`,由可达的 `configForms` 决定门控(0.1.7+/0.2.x 仍正确隐藏齿轮)。
|
|
7
|
+
|
|
1
8
|
## 1.10.0 (2026-11-14)
|
|
2
9
|
|
|
3
10
|
**入口从 `bcdp_status` 换成 `bcdp_help`,流程说明搬进随包 skill `bcdp-browser`。**
|
package/dsh-plugin.json
CHANGED
package/lib/client.js
CHANGED
|
@@ -1,30 +1,5 @@
|
|
|
1
1
|
window.__ModuleLoader__.load({ id: "dsh-browser-cdp", factory: (require) => {
|
|
2
2
|
var module = { exports: {} }; var exports = module.exports;
|
|
3
|
-
//#region rolldown:runtime
|
|
4
|
-
var __create = Object.create;
|
|
5
|
-
var __defProp = Object.defineProperty;
|
|
6
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
7
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
8
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
9
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
12
|
-
key = keys[i];
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
14
|
-
get: ((k) => from[k]).bind(null, key),
|
|
15
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
21
|
-
value: mod,
|
|
22
|
-
enumerable: true
|
|
23
|
-
}) : target, mod));
|
|
24
|
-
|
|
25
|
-
//#endregion
|
|
26
|
-
let react = require("react");
|
|
27
|
-
react = __toESM(react);
|
|
28
3
|
|
|
29
4
|
//#region src/client/fam-links.ts
|
|
30
5
|
/**
|
|
@@ -250,157 +225,6 @@ function applyProbe(links, id, outcome, at) {
|
|
|
250
225
|
});
|
|
251
226
|
}
|
|
252
227
|
|
|
253
|
-
//#endregion
|
|
254
|
-
//#region src/client/family-host.ts
|
|
255
|
-
/** 家族节固定 id 与子席位 key(与 thinking-levels 的声明严格一致)。 */
|
|
256
|
-
const FAMILY_SECTION_ID = "dsh-family";
|
|
257
|
-
const FAMILY_CHILD_KEY = "dsh-family.tab";
|
|
258
|
-
/**
|
|
259
|
-
* 接管分级——唯一真源是 `mine-dsh-plugins/_tools/family-rank.mjs`(离线实测 GitHub
|
|
260
|
-
* star + npm 周下载量加权)。延迟 = BASE + RANK * STEP;rank 越大越靠后兜底。
|
|
261
|
-
*/
|
|
262
|
-
const FAMILY_CLAIM_RANK = 5;
|
|
263
|
-
const FAMILY_CLAIM_BASE_MS = 200;
|
|
264
|
-
const FAMILY_CLAIM_STEP_MS = 900;
|
|
265
|
-
/** 派生而非硬编码:改 rank 表就自动改时刻。 */
|
|
266
|
-
const FAMILY_CLAIM_DELAY_MS = FAMILY_CLAIM_BASE_MS + FAMILY_CLAIM_RANK * FAMILY_CLAIM_STEP_MS;
|
|
267
|
-
/** 接管行的遮蔽优先级:必须大于任何正牌 owner(TL 无=0、guard=10),
|
|
268
|
-
* 这样 owner 一旦上位就自然遮蔽本兜底行(宿主规则:同 cell 最低者渲染)。 */
|
|
269
|
-
const FAMILY_HOST_PRIORITY = 50;
|
|
270
|
-
const NO_TABS = [];
|
|
271
|
-
/**
|
|
272
|
-
* uSES 浅比较(issue #2 的 C 案加固):引用不同但行内容一致时视为未变。
|
|
273
|
-
* 主修法是按 getVersion 缓存快照(引用稳定),这里只兑底宿主绑定语义再变的情形。
|
|
274
|
-
*/
|
|
275
|
-
function eqRows(a, b) {
|
|
276
|
-
if (a === b) return true;
|
|
277
|
-
if (a.length !== b.length) return false;
|
|
278
|
-
return a.every((row, i) => {
|
|
279
|
-
const other = b[i];
|
|
280
|
-
return other !== void 0 && row.id === other.id && row.order === other.order && row.label === other.label;
|
|
281
|
-
});
|
|
282
|
-
}
|
|
283
|
-
/** 通用容器渲染:按 order 依次画出账本里每张贡献卡,不含任何"本插件特例"。 */
|
|
284
|
-
function FamilyHostSection(props) {
|
|
285
|
-
const raw = props.hooks?.tabs;
|
|
286
|
-
const [polled, setPolled] = (0, react.useState)(() => raw?.getSnapshot() ?? NO_TABS);
|
|
287
|
-
(0, react.useEffect)(() => {
|
|
288
|
-
if (props.useTabs !== void 0 || raw === void 0) return;
|
|
289
|
-
return raw.subscribe(() => setPolled(raw.getSnapshot()));
|
|
290
|
-
});
|
|
291
|
-
const tabs = props.useTabs !== void 0 ? props.useTabs((value) => value, eqRows) : polled;
|
|
292
|
-
const ownId = props.ownId ?? "__own__";
|
|
293
|
-
return (0, react.createElement)("div", { style: {
|
|
294
|
-
display: "grid",
|
|
295
|
-
gap: "12px"
|
|
296
|
-
} }, (props.renderOwn ? [{
|
|
297
|
-
id: ownId,
|
|
298
|
-
order: Number.NEGATIVE_INFINITY,
|
|
299
|
-
label: ownId
|
|
300
|
-
}, ...tabs.filter((tab) => tab.id !== ownId)] : tabs).map((row) => (0, react.createElement)("div", { key: row.id }, props.renderOwn && row.id === ownId ? props.renderOwn() : props.renderSlot ? props.renderSlot(FAMILY_CHILD_KEY, {}, {
|
|
301
|
-
only: row.id,
|
|
302
|
-
fallback: null
|
|
303
|
-
}) : props.renderContributor?.(row.id) ?? null)));
|
|
304
|
-
}
|
|
305
|
-
/** 取条目上的具名面(宿主条目是结构化对象,这里只做安全读取)。 */
|
|
306
|
-
function face(entry, key) {
|
|
307
|
-
if (entry === null || typeof entry !== "object") return void 0;
|
|
308
|
-
return entry[key];
|
|
309
|
-
}
|
|
310
|
-
/** 条目的 options 收窄(宿主侧是结构化对象,缺失时当空对象读)。 */
|
|
311
|
-
function optionsOf(entry) {
|
|
312
|
-
const raw = face(entry, "options");
|
|
313
|
-
return raw !== null && typeof raw === "object" ? raw : {};
|
|
314
|
-
}
|
|
315
|
-
/** 把账本条目投影成标题行:label 可能是函数,抛错退化成 id,绝不带崩整节。 */
|
|
316
|
-
function projectLedger(slots) {
|
|
317
|
-
return slots.entries(FAMILY_CHILD_KEY).map((rawEntry) => {
|
|
318
|
-
const options = rawEntry.options ?? {};
|
|
319
|
-
const id = String(options["id"] ?? "");
|
|
320
|
-
const rawLabel = options["label"];
|
|
321
|
-
let label = id;
|
|
322
|
-
if (typeof rawLabel === "function") try {
|
|
323
|
-
label = String(rawLabel() ?? id);
|
|
324
|
-
} catch {
|
|
325
|
-
label = id;
|
|
326
|
-
}
|
|
327
|
-
else if (typeof rawLabel === "string") label = rawLabel;
|
|
328
|
-
return {
|
|
329
|
-
id,
|
|
330
|
-
order: Number(options["order"] ?? 0),
|
|
331
|
-
label
|
|
332
|
-
};
|
|
333
|
-
}).sort((a, b) => a.order - b.order);
|
|
334
|
-
}
|
|
335
|
-
/**
|
|
336
|
-
* 若到点仍无人声明子席位,则自己接管容器。
|
|
337
|
-
* @param slots - 客户端槽门面。
|
|
338
|
-
* @param isHeld - 探针:本插件的 tab 工厂是否已被执行(= 有人声明了子席位)。
|
|
339
|
-
* @param label - 导航标题;家族共享节的标题,不是本插件名。
|
|
340
|
-
* @param log - console 前缀(带插件名)。
|
|
341
|
-
* @returns 取消定时器与撤销接管注册的 disposer。
|
|
342
|
-
*/
|
|
343
|
-
function claimFamilyHostIfOrphaned(slots, isHeld, label, log, ownTab) {
|
|
344
|
-
let disposeClaim;
|
|
345
|
-
let claimed = false;
|
|
346
|
-
const timer = setTimeout(() => {
|
|
347
|
-
if (isHeld()) return;
|
|
348
|
-
let cachedVersion = -1;
|
|
349
|
-
let cachedRows = NO_TABS;
|
|
350
|
-
const ledger = {
|
|
351
|
-
getSnapshot: () => {
|
|
352
|
-
const v = typeof slots.getVersion === "function" ? slots.getVersion(FAMILY_CHILD_KEY) : NaN;
|
|
353
|
-
if (v !== cachedVersion || Number.isNaN(v)) {
|
|
354
|
-
cachedRows = projectLedger(slots);
|
|
355
|
-
cachedVersion = v;
|
|
356
|
-
}
|
|
357
|
-
return cachedRows;
|
|
358
|
-
},
|
|
359
|
-
subscribe: (listener) => slots.subscribe ? slots.subscribe(FAMILY_CHILD_KEY, listener) : () => void 0
|
|
360
|
-
};
|
|
361
|
-
/** ≤0.1.5 壳没有 renderSlot:从账本条目现挂组件,失败一律 null。 */
|
|
362
|
-
const renderContributor = (id) => {
|
|
363
|
-
try {
|
|
364
|
-
const entry = slots.entries(FAMILY_CHILD_KEY).find((candidate) => String(optionsOf(candidate)["id"] ?? "") === id);
|
|
365
|
-
const component = entry ? face(entry, "component") : void 0;
|
|
366
|
-
const inject$1 = entry ? face(entry, "inject") : void 0;
|
|
367
|
-
if (typeof component !== "function") return null;
|
|
368
|
-
return (0, react.createElement)(component, (typeof inject$1 === "function" ? inject$1() : {}) ?? {});
|
|
369
|
-
} catch {
|
|
370
|
-
return null;
|
|
371
|
-
}
|
|
372
|
-
};
|
|
373
|
-
try {
|
|
374
|
-
const dispose = slots.register({
|
|
375
|
-
name: "settings.section",
|
|
376
|
-
id: FAMILY_SECTION_ID,
|
|
377
|
-
order: 40,
|
|
378
|
-
priority: FAMILY_HOST_PRIORITY,
|
|
379
|
-
label,
|
|
380
|
-
inject: () => ({
|
|
381
|
-
hooks: { tabs: ledger },
|
|
382
|
-
renderContributor,
|
|
383
|
-
ownId: ownTab?.id,
|
|
384
|
-
renderOwn: ownTab === void 0 ? void 0 : () => (0, react.createElement)(ownTab.component, ownTab.inject ? ownTab.inject() : {})
|
|
385
|
-
}),
|
|
386
|
-
children: { [FAMILY_CHILD_KEY]: {
|
|
387
|
-
kind: "list",
|
|
388
|
-
scope: "root"
|
|
389
|
-
} }
|
|
390
|
-
}, FamilyHostSection);
|
|
391
|
-
if (typeof dispose === "function") disposeClaim = dispose;
|
|
392
|
-
claimed = true;
|
|
393
|
-
console.warn(`${log} family container unclaimed — took it over (children declared)`);
|
|
394
|
-
} catch (error) {
|
|
395
|
-
console.warn(`${log} family claim lost — withdrawing (${error instanceof Error ? error.message : String(error)})`);
|
|
396
|
-
}
|
|
397
|
-
}, FAMILY_CLAIM_DELAY_MS);
|
|
398
|
-
return () => {
|
|
399
|
-
clearTimeout(timer);
|
|
400
|
-
if (claimed) disposeClaim?.();
|
|
401
|
-
};
|
|
402
|
-
}
|
|
403
|
-
|
|
404
228
|
//#endregion
|
|
405
229
|
//#region src/client/fab-pos.ts
|
|
406
230
|
const clamp01 = (v) => Math.max(0, Math.min(1, v));
|
|
@@ -1585,15 +1409,17 @@ function makeBridgeScope() {
|
|
|
1585
1409
|
}
|
|
1586
1410
|
};
|
|
1587
1411
|
}
|
|
1588
|
-
function
|
|
1412
|
+
function ownSettingsScope(ctx) {
|
|
1589
1413
|
var forms = typeof ctx.get === "function" ? ctx.get("configForms") : void 0;
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1414
|
+
return (forms && typeof forms.get === "function" ? forms.get("dsh-browser-cdp") : void 0) || makeBridgeScope();
|
|
1415
|
+
}
|
|
1416
|
+
function mountOwnSettingsSection(ctx) {
|
|
1417
|
+
var scope = ownSettingsScope(ctx);
|
|
1418
|
+
ctx.slots.inject("settings.section", function() {
|
|
1593
1419
|
return ctx.slots.register({
|
|
1594
|
-
name: "
|
|
1420
|
+
name: "settings.section",
|
|
1595
1421
|
id: "dsh-browser-cdp",
|
|
1596
|
-
order:
|
|
1422
|
+
order: 210,
|
|
1597
1423
|
label: function() {
|
|
1598
1424
|
return wt("famTitle");
|
|
1599
1425
|
},
|
|
@@ -1601,61 +1427,44 @@ function mountFamilySettingsCard(ctx) {
|
|
|
1601
1427
|
return { scope };
|
|
1602
1428
|
}
|
|
1603
1429
|
}, FamilySettingsCard);
|
|
1604
|
-
}, "dsh-browser-cdp:
|
|
1605
|
-
var claim = claimFamilyHostIfOrphaned(ctx.slots, function() {
|
|
1606
|
-
try {
|
|
1607
|
-
return ctx.slots.entries("settings.section").some(function(e) {
|
|
1608
|
-
return String(e && e.options && e.options.id || "") === "dsh-family";
|
|
1609
|
-
});
|
|
1610
|
-
} catch {
|
|
1611
|
-
return false;
|
|
1612
|
-
}
|
|
1613
|
-
}, function() {
|
|
1614
|
-
return "起子插件设置";
|
|
1615
|
-
}, "[dsh-browser-cdp]", {
|
|
1616
|
-
id: "dsh-browser-cdp",
|
|
1617
|
-
component: FamilySettingsCard,
|
|
1618
|
-
inject: function() {
|
|
1619
|
-
return { scope };
|
|
1620
|
-
}
|
|
1621
|
-
});
|
|
1622
|
-
if (typeof ctx.effect === "function") ctx.effect(function() {
|
|
1623
|
-
return claim;
|
|
1624
|
-
}, "dsh-browser-cdp: family host backstop");
|
|
1430
|
+
}, "dsh-browser-cdp: own settings section");
|
|
1625
1431
|
}
|
|
1626
|
-
function
|
|
1627
|
-
|
|
1628
|
-
var scope = forms && typeof forms.get === "function" ? forms.get("dsh-browser-cdp") : void 0;
|
|
1629
|
-
if (!scope) scope = makeBridgeScope();
|
|
1630
|
-
ctx.slots.inject("plugins.bundle.config", function() {
|
|
1432
|
+
function mountSettingsSectionIcon(ctx) {
|
|
1433
|
+
ctx.slots.inject("settings.section.icon", function() {
|
|
1631
1434
|
return ctx.slots.register({
|
|
1632
|
-
name: "
|
|
1633
|
-
|
|
1435
|
+
name: "settings.section.icon",
|
|
1436
|
+
id: "dsh-browser-cdp",
|
|
1437
|
+
order: 210,
|
|
1634
1438
|
inject: function() {
|
|
1635
|
-
return {
|
|
1439
|
+
return {};
|
|
1636
1440
|
}
|
|
1637
|
-
},
|
|
1638
|
-
}, "dsh-browser-cdp:
|
|
1441
|
+
}, SettingsSectionIcon);
|
|
1442
|
+
}, "dsh-browser-cdp: settings section icon");
|
|
1639
1443
|
}
|
|
1640
|
-
function
|
|
1641
|
-
var
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
}, "dsh-browser-cdp: legacy gen-2 settings card");
|
|
1444
|
+
function SettingsSectionIcon(props) {
|
|
1445
|
+
var size = typeof props.size === "number" && props.size > 0 ? props.size : 16;
|
|
1446
|
+
return React.createElement("span", {
|
|
1447
|
+
style: {
|
|
1448
|
+
display: "inline-flex",
|
|
1449
|
+
width: size + "px",
|
|
1450
|
+
height: size + "px",
|
|
1451
|
+
alignItems: "center",
|
|
1452
|
+
justifyContent: "center"
|
|
1453
|
+
},
|
|
1454
|
+
dangerouslySetInnerHTML: { __html: ICON_GLOBE }
|
|
1455
|
+
});
|
|
1653
1456
|
}
|
|
1654
1457
|
function mountGen1SettingsGear(ctx) {
|
|
1655
1458
|
var forms = typeof ctx.get === "function" ? ctx.get("configForms") : void 0;
|
|
1656
1459
|
var hasConfigForms = !!(forms && typeof forms.get === "function");
|
|
1657
|
-
var
|
|
1658
|
-
|
|
1460
|
+
var hasOpenDoc = false;
|
|
1461
|
+
try {
|
|
1462
|
+
var remote = (typeof ctx.get === "function" ? ctx.get("remote") : void 0) || ctx.remote;
|
|
1463
|
+
hasOpenDoc = !!(remote && remote.settings && typeof remote.settings.openSettingsDocument === "function");
|
|
1464
|
+
} catch (e) {
|
|
1465
|
+
hasOpenDoc = false;
|
|
1466
|
+
}
|
|
1467
|
+
if (!shouldShowGen1SettingsGear(hasConfigForms, hasOpenDoc)) return;
|
|
1659
1468
|
var scope = makeBridgeScope();
|
|
1660
1469
|
ctx.slots.inject("shell.overlay", function() {
|
|
1661
1470
|
return ctx.slots.register({
|
|
@@ -2922,9 +2731,8 @@ function FamLinks(props) {
|
|
|
2922
2731
|
}
|
|
2923
2732
|
function apply(ctx) {
|
|
2924
2733
|
var mounts = [
|
|
2925
|
-
["
|
|
2926
|
-
["
|
|
2927
|
-
["legacy gen-2 settings card", mountLegacySettingsCard],
|
|
2734
|
+
["own settings section", mountOwnSettingsSection],
|
|
2735
|
+
["settings section icon", mountSettingsSectionIcon],
|
|
2928
2736
|
["gen-1 settings gear", mountGen1SettingsGear],
|
|
2929
2737
|
["picks dock", mountPicksDockCard],
|
|
2930
2738
|
["picks badge", mountPicksBadge]
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-browser-cdp",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.11.0",
|
|
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",
|