dsh-browser-cdp 1.7.6 → 1.7.10
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/bin/cdp-cast-worker.mjs
CHANGED
|
@@ -6300,7 +6300,9 @@ const FULL = {
|
|
|
6300
6300
|
/**
|
|
6301
6301
|
* The capability projection per engine. `chrome` / `unknown` → full
|
|
6302
6302
|
* capabilities (bit-for-bit today's behavior); `lightpanda` → the analysis
|
|
6303
|
-
* (docs/plans/2026-10-04-lightpanda-backend-analysis.md §7) projection
|
|
6303
|
+
* (docs/plans/2026-10-04-lightpanda-backend-analysis.md §7) projection;
|
|
6304
|
+
* `tabbit` → CLI-protocol limitations (no download events, no overlay pick,
|
|
6305
|
+
* no raw CDP screencast through the plugin's usual path).
|
|
6304
6306
|
*/
|
|
6305
6307
|
function capabilitiesFor(engine) {
|
|
6306
6308
|
if (engine === "lightpanda") return {
|
|
@@ -6313,6 +6315,16 @@ function capabilitiesFor(engine) {
|
|
|
6313
6315
|
downloadEvents: false,
|
|
6314
6316
|
browserClose: false
|
|
6315
6317
|
};
|
|
6318
|
+
if (engine === "tabbit") return {
|
|
6319
|
+
engine: "tabbit",
|
|
6320
|
+
screencast: true,
|
|
6321
|
+
overlay: false,
|
|
6322
|
+
bindingCalled: false,
|
|
6323
|
+
imageFormat: "jpeg",
|
|
6324
|
+
loadEvent: true,
|
|
6325
|
+
downloadEvents: false,
|
|
6326
|
+
browserClose: false
|
|
6327
|
+
};
|
|
6316
6328
|
return {
|
|
6317
6329
|
...FULL,
|
|
6318
6330
|
engine
|
|
@@ -6331,7 +6343,10 @@ const BCDP_CDP_ENGINE = "BCDP_CDP_ENGINE";
|
|
|
6331
6343
|
* conservatively break a Chrome endpoint.
|
|
6332
6344
|
*/
|
|
6333
6345
|
function capabilitiesFromEnvValue(value) {
|
|
6334
|
-
|
|
6346
|
+
const v = (value ?? "").trim();
|
|
6347
|
+
if (v === "lightpanda") return capabilitiesFor("lightpanda");
|
|
6348
|
+
if (v === "tabbit") return capabilitiesFor("tabbit");
|
|
6349
|
+
return capabilitiesFor("unknown");
|
|
6335
6350
|
}
|
|
6336
6351
|
|
|
6337
6352
|
//#endregion
|
package/dsh-plugin.json
CHANGED
package/lib/client.js
CHANGED
|
@@ -58,6 +58,8 @@ const MAX_LINKS = 32;
|
|
|
58
58
|
const EGO_CLI_LABEL = "本机 ego CLI";
|
|
59
59
|
/** Lightpanda managed-serve singleton default label — mirrors host `LP_LABEL`. */
|
|
60
60
|
const LP_LABEL = "Lightpanda(受管)";
|
|
61
|
+
/** Tabbit CLI singleton default label — mirrors host `TABBIT_CLI_LABEL`. */
|
|
62
|
+
const TABBIT_CLI_LABEL = "Tabbit 浏览器";
|
|
61
63
|
/** Fresh id, same shape as the host `newTargetId()` (uuid, `t-` fallback). */
|
|
62
64
|
function newLinkId() {
|
|
63
65
|
const cryptoObj = globalThis.crypto;
|
|
@@ -142,6 +144,29 @@ function hasLpLink(links) {
|
|
|
142
144
|
return row.kind === "lightpanda";
|
|
143
145
|
});
|
|
144
146
|
}
|
|
147
|
+
/** Second tabbit-cli anywhere in the array would be silently dropped on read. */
|
|
148
|
+
function hasTabbitLink(links) {
|
|
149
|
+
return links.some(function(row) {
|
|
150
|
+
return row.kind === "tabbit-cli";
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
/** Full-field tabbit-cli row (`cliPath` '' = host auto-resolve chain). */
|
|
154
|
+
function buildTabbitRow(input) {
|
|
155
|
+
const cliPath = trimmed(input.cliPath);
|
|
156
|
+
return {
|
|
157
|
+
kind: "tabbit-cli",
|
|
158
|
+
id: newLinkId(),
|
|
159
|
+
label: trimmed(input.label) || cliPath || TABBIT_CLI_LABEL,
|
|
160
|
+
cliPath,
|
|
161
|
+
enabled: true,
|
|
162
|
+
note: "",
|
|
163
|
+
probeStatus: "unknown",
|
|
164
|
+
probeLatencyMs: 0,
|
|
165
|
+
probeError: "",
|
|
166
|
+
probeCode: "",
|
|
167
|
+
probeAt: 0
|
|
168
|
+
};
|
|
169
|
+
}
|
|
145
170
|
function isFull(links) {
|
|
146
171
|
return links.length >= MAX_LINKS;
|
|
147
172
|
}
|
|
@@ -159,6 +184,10 @@ function addRow(links, row) {
|
|
|
159
184
|
links,
|
|
160
185
|
code: "lightpanda-already-exists"
|
|
161
186
|
};
|
|
187
|
+
if (row.kind === "tabbit-cli" && hasTabbitLink(links)) return {
|
|
188
|
+
links,
|
|
189
|
+
code: "tabbit-cli-already-exists"
|
|
190
|
+
};
|
|
162
191
|
if (links.length >= MAX_LINKS) return {
|
|
163
192
|
links,
|
|
164
193
|
code: "link-limit-reached"
|
|
@@ -584,6 +613,9 @@ var watchEn = {
|
|
|
584
613
|
linksAddCli: "Add local ego CLI",
|
|
585
614
|
linksAddLp: "Add Lightpanda (managed)",
|
|
586
615
|
linksAddLpExists: "The Lightpanda link already exists — local-only, one per machine",
|
|
616
|
+
linksAddTabbit: "Add Tabbit CLI",
|
|
617
|
+
linksAddTabbitExists: "The Tabbit link already exists — local-only, one per machine",
|
|
618
|
+
linksTabbitPathHint: "Empty = auto-detect (%LOCALAPPDATA%\\Tabbit\\LocalAgent\\bin)",
|
|
587
619
|
linksLpPathHint: "Empty = auto (PATH → ~/.local/bin; Windows runs it inside WSL2)",
|
|
588
620
|
linksLpHeadlessHint: "Headless quick-trial engine — no manual fallback (login/captcha). Early in the order = quick trials use it; after the headed kinds (CDP / local Chrome / ego CLI) = backstop first.",
|
|
589
621
|
linksLpRemoteWarn: "Activating a Lightpanda link under cdpMode=remote fails with mode-kind-mismatch",
|
|
@@ -680,6 +712,9 @@ var watchDict = {
|
|
|
680
712
|
linksAddCli: "添加本机 ego CLI",
|
|
681
713
|
linksAddLp: "添加 Lightpanda(受管)",
|
|
682
714
|
linksAddLpExists: "Lightpanda 连接已存在——仅限本机,一台机器只允许一条",
|
|
715
|
+
linksAddTabbit: "添加 Tabbit CLI",
|
|
716
|
+
linksAddTabbitExists: "Tabbit 连接已存在——仅限本机,一台机器只允许一条",
|
|
717
|
+
linksTabbitPathHint: "留空 = 自动检测 (%LOCALAPPDATA%\\Tabbit\\LocalAgent\\bin)",
|
|
683
718
|
linksLpPathHint: "留空 = 自动检测(PATH → ~/.local/bin;Windows 经 WSL2)",
|
|
684
719
|
linksLpHeadlessHint: "无头快速试验引擎:无法人工兜底(登录/验证码)。排前面 = 快速场景优先用它;排在有头类型(CDP/本机 Chrome/ego CLI)后 = 兜底优先。",
|
|
685
720
|
linksLpRemoteWarn: "cdpMode=remote 时激活 Lightpanda 行会报 mode-kind-mismatch",
|
|
@@ -722,6 +757,8 @@ const WATCH_SWITCH_ROUTE = "/api/bcdp/watch/switch";
|
|
|
722
757
|
const WATCH_STOP_ROUTE = "/api/bcdp/watch/stop";
|
|
723
758
|
const WATCH_STATUS_ROUTE = "/api/bcdp/watch/status";
|
|
724
759
|
const VIDEO_ROUTE = "/api/bcdp/video";
|
|
760
|
+
const CLI_FRAME_ROUTE = "/api/bcdp/cli-frame";
|
|
761
|
+
const CLI_FRAME_TARGET_ID = "__cli_frame__";
|
|
725
762
|
function postJson(path, body) {
|
|
726
763
|
return fetch(path, {
|
|
727
764
|
method: "POST",
|
|
@@ -1680,6 +1717,12 @@ var FAM_FIELD_GROUPS = [
|
|
|
1680
1717
|
kind: "str",
|
|
1681
1718
|
en: ["Extra Chrome args", "Appended to the Chrome launch argv; next cold start"],
|
|
1682
1719
|
zh: ["Chrome 附加启动参数", "追加到 Chrome 启动 argv;下次冷启动生效"]
|
|
1720
|
+
},
|
|
1721
|
+
{
|
|
1722
|
+
k: "cliFramePollEnabled",
|
|
1723
|
+
kind: "bool",
|
|
1724
|
+
en: ["ego-cli fallback frames (5s)", "With no CDP screencast (local ego-cli link active), capture one screenshot every 5s through the CLI so the watch panel still fills. Off = panel shows a placeholder and no screenshot subprocess is spawned"],
|
|
1725
|
+
zh: ["ego-cli 降级帧(5s 一刷)", "无 CDP screencast(本机 ego-cli 激活)时,每 5s 走一次 CLI 截图填充观察窗画面区。关 = 面板显示占位提示、不拉截图子进程"]
|
|
1683
1726
|
}
|
|
1684
1727
|
]
|
|
1685
1728
|
},
|
|
@@ -2141,6 +2184,8 @@ function FamLinks(props) {
|
|
|
2141
2184
|
var addCliPath = addCliPathState[0], setAddCliPath = addCliPathState[1];
|
|
2142
2185
|
var addLpPathState = React.useState("");
|
|
2143
2186
|
var addLpPath = addLpPathState[0], setAddLpPath = addLpPathState[1];
|
|
2187
|
+
var addTabbitPathState = React.useState("");
|
|
2188
|
+
var addTabbitPath = addTabbitPathState[0], setAddTabbitPath = addTabbitPathState[1];
|
|
2144
2189
|
var btnStyle = {
|
|
2145
2190
|
font: "inherit",
|
|
2146
2191
|
fontSize: "12px",
|
|
@@ -2229,6 +2274,20 @@ function FamLinks(props) {
|
|
|
2229
2274
|
setAddLpPath("");
|
|
2230
2275
|
setErrText("");
|
|
2231
2276
|
}
|
|
2277
|
+
function addTabbit() {
|
|
2278
|
+
var res = addRow(links, buildTabbitRow({
|
|
2279
|
+
label: "",
|
|
2280
|
+
cliPath: addTabbitPath
|
|
2281
|
+
}));
|
|
2282
|
+
if (res.code) {
|
|
2283
|
+
setErrText(res.code === "link-limit-reached" ? limitText() : wt("linksAddTabbitExists"));
|
|
2284
|
+
return;
|
|
2285
|
+
}
|
|
2286
|
+
writeLinks(res.links);
|
|
2287
|
+
if (activeId === "") commitField(scope, "activeTargetId", res.links[res.links.length - 1].id);
|
|
2288
|
+
setAddTabbitPath("");
|
|
2289
|
+
setErrText("");
|
|
2290
|
+
}
|
|
2232
2291
|
function removeOne(row) {
|
|
2233
2292
|
var res = removeRow(links, row.id);
|
|
2234
2293
|
writeLinks(res.links);
|
|
@@ -2313,6 +2372,7 @@ function FamLinks(props) {
|
|
|
2313
2372
|
} }, wt("linksEmpty")) : links.map(function(row, idx) {
|
|
2314
2373
|
var isCli = row.kind === "ego-cli";
|
|
2315
2374
|
var isLp = row.kind === "lightpanda";
|
|
2375
|
+
var isTabbit = row.kind === "tabbit-cli";
|
|
2316
2376
|
var isActive = row.id !== void 0 && row.id === activeId;
|
|
2317
2377
|
var probeBadge = null;
|
|
2318
2378
|
if (row.probeStatus === "ok" || row.probeStatus === "error") probeBadge = h("span", {
|
|
@@ -2343,7 +2403,7 @@ function FamLinks(props) {
|
|
|
2343
2403
|
onToggle: function(next) {
|
|
2344
2404
|
writeLinks(updateRow(links, row.id, { enabled: next }));
|
|
2345
2405
|
}
|
|
2346
|
-
}), h("span", { style: badgeStyle }, isCli ? "CLI" : isLp ? "LP·无头" : "CDP"), h(FamRowInput, {
|
|
2406
|
+
}), h("span", { style: badgeStyle }, isCli ? "CLI" : isLp ? "LP·无头" : isTabbit ? "TABBIT" : "CDP"), h(FamRowInput, {
|
|
2347
2407
|
v: row.label || "",
|
|
2348
2408
|
writable,
|
|
2349
2409
|
placeholder: wt("linksLabel"),
|
|
@@ -2369,11 +2429,11 @@ function FamLinks(props) {
|
|
|
2369
2429
|
gap: "8px",
|
|
2370
2430
|
flexWrap: "wrap"
|
|
2371
2431
|
} }, h(FamRowInput, {
|
|
2372
|
-
v: (isCli ? row.cliPath : isLp ? row.servePath : row.endpoint) || "",
|
|
2432
|
+
v: (isCli || isTabbit ? row.cliPath : isLp ? row.servePath : row.endpoint) || "",
|
|
2373
2433
|
writable,
|
|
2374
|
-
placeholder: isCli ? wt("linksCliPathHint") : isLp ? wt("linksLpPathHint") : wt("linksEndpointHint"),
|
|
2434
|
+
placeholder: isCli ? wt("linksCliPathHint") : isTabbit ? wt("linksTabbitPathHint") : isLp ? wt("linksLpPathHint") : wt("linksEndpointHint"),
|
|
2375
2435
|
onCommit: function(v) {
|
|
2376
|
-
if (isCli) {
|
|
2436
|
+
if (isCli || isTabbit) {
|
|
2377
2437
|
writeLinks(updateRow(links, row.id, { cliPath: v }));
|
|
2378
2438
|
return;
|
|
2379
2439
|
}
|
|
@@ -2387,7 +2447,7 @@ function FamLinks(props) {
|
|
|
2387
2447
|
}
|
|
2388
2448
|
writeLinks(updateRow(links, row.id, { endpoint: v }));
|
|
2389
2449
|
}
|
|
2390
|
-
}), !isCli && !isLp ? h("button", {
|
|
2450
|
+
}), !isCli && !isLp && !isTabbit ? h("button", {
|
|
2391
2451
|
type: "button",
|
|
2392
2452
|
disabled: !writable || probingId === row.id,
|
|
2393
2453
|
style: btnStyle,
|
|
@@ -2418,11 +2478,11 @@ function FamLinks(props) {
|
|
|
2418
2478
|
onClick: function() {
|
|
2419
2479
|
removeOne(row);
|
|
2420
2480
|
}
|
|
2421
|
-
}, "✕"), (isCli || isLp) && cdpMode === "remote" ? h("span", { style: {
|
|
2481
|
+
}, "✕"), (isCli || isLp || isTabbit) && cdpMode === "remote" ? h("span", { style: {
|
|
2422
2482
|
fontSize: "11px",
|
|
2423
2483
|
color: "#ff9f0a",
|
|
2424
2484
|
flex: "1 1 100%"
|
|
2425
|
-
} }, wt(isCli ? "linksCliRemoteWarn" : "linksLpRemoteWarn")) : null, isLp ? h("span", { style: {
|
|
2485
|
+
} }, wt(isCli || isTabbit ? "linksCliRemoteWarn" : "linksLpRemoteWarn")) : null, isLp ? h("span", { style: {
|
|
2426
2486
|
fontSize: "11px",
|
|
2427
2487
|
color: "var(--dsw-alias-label-tertiary, rgba(127,127,127,.7))",
|
|
2428
2488
|
flex: "1 1 100%"
|
|
@@ -2518,7 +2578,33 @@ function FamLinks(props) {
|
|
|
2518
2578
|
title: hasLpLink(links) ? wt("linksAddLpExists") : isFull(links) ? limitText() : void 0,
|
|
2519
2579
|
style: btnStyle,
|
|
2520
2580
|
onClick: addLp
|
|
2521
|
-
}, wt("linksAddLp"))),
|
|
2581
|
+
}, wt("linksAddLp"))), h("div", { style: {
|
|
2582
|
+
display: "flex",
|
|
2583
|
+
gap: "8px",
|
|
2584
|
+
alignItems: "center",
|
|
2585
|
+
flexWrap: "wrap"
|
|
2586
|
+
} }, h("input", {
|
|
2587
|
+
type: "text",
|
|
2588
|
+
value: addTabbitPath,
|
|
2589
|
+
disabled: !writable || isFull(links) || hasTabbitLink(links),
|
|
2590
|
+
placeholder: wt("linksTabbitPathHint"),
|
|
2591
|
+
style: Object.assign({
|
|
2592
|
+
flex: "1 1 160px",
|
|
2593
|
+
minWidth: 0
|
|
2594
|
+
}, inputStyle),
|
|
2595
|
+
onChange: function(e) {
|
|
2596
|
+
setAddTabbitPath(e.target.value);
|
|
2597
|
+
},
|
|
2598
|
+
onKeyDown: function(e) {
|
|
2599
|
+
if (e.key === "Enter") addTabbit();
|
|
2600
|
+
}
|
|
2601
|
+
}), h("button", {
|
|
2602
|
+
type: "button",
|
|
2603
|
+
disabled: !writable || isFull(links) || hasTabbitLink(links),
|
|
2604
|
+
title: hasTabbitLink(links) ? wt("linksAddTabbitExists") : isFull(links) ? limitText() : void 0,
|
|
2605
|
+
style: btnStyle,
|
|
2606
|
+
onClick: addTabbit
|
|
2607
|
+
}, wt("linksAddTabbit"))), errText ? h("div", { style: {
|
|
2522
2608
|
fontSize: "11px",
|
|
2523
2609
|
color: "#ff453a"
|
|
2524
2610
|
} }, errText) : null));
|
|
@@ -3278,6 +3364,12 @@ function mountFloatingWatch(ctx) {
|
|
|
3278
3364
|
return;
|
|
3279
3365
|
}
|
|
3280
3366
|
applyCaptureStatus(data.capture);
|
|
3367
|
+
if (data.cliFrameMode === true && Array.isArray(data.spaces)) {
|
|
3368
|
+
const cli = data.spaces.find((s) => s && s.targetId === CLI_FRAME_TARGET_ID);
|
|
3369
|
+
if (cli) frameCache.set(CLI_FRAME_TARGET_ID, `${CLI_FRAME_ROUTE}?t=${cli.lastActive || Date.now()}`);
|
|
3370
|
+
renderSpaces(data.spaces);
|
|
3371
|
+
return;
|
|
3372
|
+
}
|
|
3281
3373
|
renderSpaces(data.spaces);
|
|
3282
3374
|
} catch {
|
|
3283
3375
|
renderEmpty();
|
|
@@ -4750,6 +4842,14 @@ LivePreviewController.prototype.refresh = function() {
|
|
|
4750
4842
|
return;
|
|
4751
4843
|
}
|
|
4752
4844
|
self._applyCaptureStatus(data.capture);
|
|
4845
|
+
if (data.cliFrameMode === true && Array.isArray(data.spaces)) {
|
|
4846
|
+
var cli = data.spaces.find(function(s) {
|
|
4847
|
+
return s && s.targetId === CLI_FRAME_TARGET_ID;
|
|
4848
|
+
});
|
|
4849
|
+
if (cli) self.frameCache.set(CLI_FRAME_TARGET_ID, CLI_FRAME_ROUTE + "?t=" + (cli.lastActive || Date.now()));
|
|
4850
|
+
self._processSpaces(data.spaces);
|
|
4851
|
+
return;
|
|
4852
|
+
}
|
|
4753
4853
|
self._processSpaces(data.spaces);
|
|
4754
4854
|
} catch (e) {
|
|
4755
4855
|
self._renderEmpty();
|