dsh-browser-cdp 0.18.19 → 1.1.5
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/README.md +29 -0
- package/THIRD_PARTY_NOTICES.md +13 -0
- package/bin/cdp-cast-worker.mjs +93 -11
- package/dsh-plugin.json +148 -148
- package/lib/client.js +296 -25
- package/lib/index.js +542 -61
- package/lib/{launcher-DBaxfIsF.js → launcher-BadIUjAx.js} +160 -28
- package/lib/launcher-h0Ca5NV1.js +3 -0
- package/package.json +27 -15
- package/lib/launcher-CQyI8-By.js +0 -3
package/lib/client.js
CHANGED
|
@@ -31,6 +31,8 @@ var module = { exports: {} }; var exports = module.exports;
|
|
|
31
31
|
const MAX_LINKS = 32;
|
|
32
32
|
/** Local ego CLI singleton default label — mirrors host `EGO_CLI_LABEL`. */
|
|
33
33
|
const EGO_CLI_LABEL = "本机 ego CLI";
|
|
34
|
+
/** Lightpanda managed-serve singleton default label — mirrors host `LP_LABEL`. */
|
|
35
|
+
const LP_LABEL = "Lightpanda(受管)";
|
|
34
36
|
/** Fresh id, same shape as the host `newTargetId()` (uuid, `t-` fallback). */
|
|
35
37
|
function newLinkId() {
|
|
36
38
|
const cryptoObj = globalThis.crypto;
|
|
@@ -86,12 +88,35 @@ function buildCliRow(input) {
|
|
|
86
88
|
probeAt: 0
|
|
87
89
|
};
|
|
88
90
|
}
|
|
91
|
+
/** Full-field lightpanda row (`servePath` '' = host auto-resolve chain). */
|
|
92
|
+
function buildLpRow(input) {
|
|
93
|
+
const servePath = trimmed(input.servePath);
|
|
94
|
+
return {
|
|
95
|
+
kind: "lightpanda",
|
|
96
|
+
id: newLinkId(),
|
|
97
|
+
label: trimmed(input.label) || LP_LABEL,
|
|
98
|
+
servePath,
|
|
99
|
+
enabled: true,
|
|
100
|
+
note: "",
|
|
101
|
+
probeStatus: "unknown",
|
|
102
|
+
probeLatencyMs: 0,
|
|
103
|
+
probeError: "",
|
|
104
|
+
probeCode: "",
|
|
105
|
+
probeAt: 0
|
|
106
|
+
};
|
|
107
|
+
}
|
|
89
108
|
/** Second ego-cli anywhere in the array would be silently dropped on read. */
|
|
90
109
|
function hasCliLink(links) {
|
|
91
110
|
return links.some(function(row) {
|
|
92
111
|
return row.kind === "ego-cli";
|
|
93
112
|
});
|
|
94
113
|
}
|
|
114
|
+
/** Second lightpanda anywhere in the array would be silently dropped on read. */
|
|
115
|
+
function hasLpLink(links) {
|
|
116
|
+
return links.some(function(row) {
|
|
117
|
+
return row.kind === "lightpanda";
|
|
118
|
+
});
|
|
119
|
+
}
|
|
95
120
|
function isFull(links) {
|
|
96
121
|
return links.length >= MAX_LINKS;
|
|
97
122
|
}
|
|
@@ -105,6 +130,10 @@ function addRow(links, row) {
|
|
|
105
130
|
links,
|
|
106
131
|
code: "ego-cli-already-exists"
|
|
107
132
|
};
|
|
133
|
+
if (row.kind === "lightpanda" && hasLpLink(links)) return {
|
|
134
|
+
links,
|
|
135
|
+
code: "lightpanda-already-exists"
|
|
136
|
+
};
|
|
108
137
|
if (links.length >= MAX_LINKS) return {
|
|
109
138
|
links,
|
|
110
139
|
code: "link-limit-reached"
|
|
@@ -162,14 +191,46 @@ function applyProbe(links, id, outcome, at) {
|
|
|
162
191
|
probeLatencyMs: typeof outcome.latencyMs === "number" ? outcome.latencyMs : 0,
|
|
163
192
|
probeError: outcome.ok ? "" : outcome.message || "",
|
|
164
193
|
probeCode: outcome.ok ? "" : outcome.code || "",
|
|
165
|
-
probeAt: at
|
|
194
|
+
probeAt: at,
|
|
195
|
+
...outcome.engine === void 0 ? {} : { probeEngine: outcome.engine }
|
|
166
196
|
});
|
|
167
197
|
}
|
|
168
198
|
|
|
169
199
|
//#endregion
|
|
170
200
|
//#region src/client/index.ts
|
|
171
201
|
var React = require("react");
|
|
172
|
-
var
|
|
202
|
+
var runtimeClient = null;
|
|
203
|
+
var createSnapshotStore = null;
|
|
204
|
+
function ensureSnapshotStoreCreator() {
|
|
205
|
+
if (createSnapshotStore !== null) return createSnapshotStore;
|
|
206
|
+
try {
|
|
207
|
+
runtimeClient = require("@deepseek-ai/dsh-client-store");
|
|
208
|
+
createSnapshotStore = runtimeClient.createSnapshotStore;
|
|
209
|
+
} catch (e) {
|
|
210
|
+
createSnapshotStore = function(initial) {
|
|
211
|
+
var value = initial;
|
|
212
|
+
var listeners = [];
|
|
213
|
+
return {
|
|
214
|
+
subscribe: function(fn) {
|
|
215
|
+
listeners.push(fn);
|
|
216
|
+
return function() {
|
|
217
|
+
listeners = listeners.filter(function(l) {
|
|
218
|
+
return l !== fn;
|
|
219
|
+
});
|
|
220
|
+
};
|
|
221
|
+
},
|
|
222
|
+
getSnapshot: function() {
|
|
223
|
+
return value;
|
|
224
|
+
},
|
|
225
|
+
update: function(fn) {
|
|
226
|
+
value = fn(value);
|
|
227
|
+
for (var i = 0; i < listeners.length; i++) listeners[i]();
|
|
228
|
+
}
|
|
229
|
+
};
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
return createSnapshotStore;
|
|
233
|
+
}
|
|
173
234
|
var useSyncExternalStore = React.useSyncExternalStore;
|
|
174
235
|
var useRef = React.useRef;
|
|
175
236
|
function bindSnapshotSelector(source) {
|
|
@@ -211,6 +272,8 @@ var watchEn = {
|
|
|
211
272
|
pinned: "Pinned",
|
|
212
273
|
realtime: "Live",
|
|
213
274
|
noScreenshot: "(no screenshot — about:blank or browser not rendering)",
|
|
275
|
+
engineUnsupportedBanner: "(live view unsupported on this engine — Lightpanda renders text; use bcdp_snapshot / bcdp_screenshot instead)",
|
|
276
|
+
engineUnsupportedPick: "picking is unsupported on this engine (no Overlay / no live view) — use bcdp_snapshot to locate elements",
|
|
214
277
|
noActivePages: "No active browser pages",
|
|
215
278
|
noActiveHint: "Pages will appear here as the agent browses with bcdp_*",
|
|
216
279
|
openExternal: "Open real page",
|
|
@@ -265,6 +328,11 @@ var watchEn = {
|
|
|
265
328
|
linksActive: "active",
|
|
266
329
|
linksAddCdp: "Add CDP endpoint",
|
|
267
330
|
linksAddCli: "Add local ego CLI",
|
|
331
|
+
linksAddLp: "Add Lightpanda (managed)",
|
|
332
|
+
linksAddLpExists: "The Lightpanda link already exists — local-only, one per machine",
|
|
333
|
+
linksLpPathHint: "Empty = auto (PATH → ~/.local/bin; Windows runs it inside WSL2)",
|
|
334
|
+
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.",
|
|
335
|
+
linksLpRemoteWarn: "Activating a Lightpanda link under cdpMode=remote fails with mode-kind-mismatch",
|
|
268
336
|
linksAddCliExists: "The local ego CLI link already exists — local-only, one per machine",
|
|
269
337
|
linksEndpoint: "Endpoint",
|
|
270
338
|
linksEndpointHint: "http(s)://host:port or ws(s)://…",
|
|
@@ -300,6 +368,8 @@ var watchDict = {
|
|
|
300
368
|
pinned: "已固定查看",
|
|
301
369
|
realtime: "正在实时浏览",
|
|
302
370
|
noScreenshot: "(暂无截图 — about:blank 或浏览器未渲染)",
|
|
371
|
+
engineUnsupportedBanner: "(当前引擎不支持实时画面 — Lightpanda 为文本渲染,可用 bcdp_snapshot / bcdp_screenshot 查看)",
|
|
372
|
+
engineUnsupportedPick: "当前引擎不支持面板点选(无 Overlay/无实时画面)— 请用 bcdp_snapshot 定位元素",
|
|
303
373
|
noActivePages: "暂无活跃浏览器页",
|
|
304
374
|
noActiveHint: "当 agent 开始用 bcdp_* 操作网页时,这里会实时显示",
|
|
305
375
|
openExternal: "⧉ 打开真实页",
|
|
@@ -354,6 +424,11 @@ var watchDict = {
|
|
|
354
424
|
linksActive: "已激活",
|
|
355
425
|
linksAddCdp: "添加 CDP 端点",
|
|
356
426
|
linksAddCli: "添加本机 ego CLI",
|
|
427
|
+
linksAddLp: "添加 Lightpanda(受管)",
|
|
428
|
+
linksAddLpExists: "Lightpanda 连接已存在——仅限本机,一台机器只允许一条",
|
|
429
|
+
linksLpPathHint: "留空 = 自动检测(PATH → ~/.local/bin;Windows 经 WSL2)",
|
|
430
|
+
linksLpHeadlessHint: "无头快速试验引擎:无法人工兜底(登录/验证码)。排前面 = 快速场景优先用它;排在有头类型(CDP/本机 Chrome/ego CLI)后 = 兜底优先。",
|
|
431
|
+
linksLpRemoteWarn: "cdpMode=remote 时激活 Lightpanda 行会报 mode-kind-mismatch",
|
|
357
432
|
linksAddCliExists: "本机 ego CLI 连接已存在——仅限本机,一台机器只允许一条",
|
|
358
433
|
linksEndpoint: "端点",
|
|
359
434
|
linksEndpointHint: "http(s)://主机:端口 或 ws(s)://…",
|
|
@@ -903,10 +978,136 @@ const ICON_REFRESH = `<svg width="15" height="15" viewBox="0 0 24 24" fill="none
|
|
|
903
978
|
const ICON_CLOCK = `<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round"><circle cx="12" cy="12" r="9"/><path d="M12 7.5V12l3 2"/></svg>`;
|
|
904
979
|
const ICON_CLOSE = `<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round"><path d="M6 6l12 12M18 6L6 18"/></svg>`;
|
|
905
980
|
const ICON_GRIP = `<svg width="14" height="14" viewBox="0 0 24 24" fill="currentColor"><circle cx="8" cy="6" r="1.8"/><circle cx="16" cy="6" r="1.8"/><circle cx="8" cy="12" r="1.8"/><circle cx="16" cy="12" r="1.8"/><circle cx="8" cy="18" r="1.8"/><circle cx="16" cy="18" r="1.8"/></svg>`;
|
|
981
|
+
var BRIDGE_ROUTES = {
|
|
982
|
+
describe: "/api/dsh-browser-cdp/settings/describe",
|
|
983
|
+
mutate: "/api/dsh-browser-cdp/settings/mutate"
|
|
984
|
+
};
|
|
985
|
+
function bridgeDescriptorPlainValue(d) {
|
|
986
|
+
var v = d && d.value;
|
|
987
|
+
if (v !== null && typeof v === "object" && !Array.isArray(v)) {
|
|
988
|
+
var values = Object.keys(v);
|
|
989
|
+
if (values.length > 0 && values.every(function(k) {
|
|
990
|
+
var x = v[k];
|
|
991
|
+
return x !== null && typeof x === "object" && !Array.isArray(x) && Object.keys(x).length === 0;
|
|
992
|
+
})) {
|
|
993
|
+
var merged = {};
|
|
994
|
+
var pull = function(layer) {
|
|
995
|
+
if (layer !== null && typeof layer === "object" && !Array.isArray(layer)) for (var k in layer) merged[k] = layer[k];
|
|
996
|
+
};
|
|
997
|
+
pull(d.base);
|
|
998
|
+
pull(d.user);
|
|
999
|
+
return merged;
|
|
1000
|
+
}
|
|
1001
|
+
}
|
|
1002
|
+
return v;
|
|
1003
|
+
}
|
|
1004
|
+
function makeBridgeScope() {
|
|
1005
|
+
var listeners = [];
|
|
1006
|
+
var snapshot = {
|
|
1007
|
+
status: "loading",
|
|
1008
|
+
value: void 0,
|
|
1009
|
+
writable: true,
|
|
1010
|
+
mode: "bridge"
|
|
1011
|
+
};
|
|
1012
|
+
var revision = void 0;
|
|
1013
|
+
var retriesLeft = 4;
|
|
1014
|
+
var inflight = void 0;
|
|
1015
|
+
function notify() {
|
|
1016
|
+
for (var i = 0; i < listeners.length; i++) listeners[i]();
|
|
1017
|
+
}
|
|
1018
|
+
function applyDescriptor(d, writable) {
|
|
1019
|
+
revision = typeof d.revision === "number" ? d.revision : void 0;
|
|
1020
|
+
snapshot = {
|
|
1021
|
+
status: "ready",
|
|
1022
|
+
value: bridgeDescriptorPlainValue(d),
|
|
1023
|
+
writable,
|
|
1024
|
+
mode: "bridge"
|
|
1025
|
+
};
|
|
1026
|
+
}
|
|
1027
|
+
function request(path, body) {
|
|
1028
|
+
return fetch(path, {
|
|
1029
|
+
method: "POST",
|
|
1030
|
+
headers: { "content-type": "application/json" },
|
|
1031
|
+
body: JSON.stringify(body ?? {})
|
|
1032
|
+
}).then(function(r) {
|
|
1033
|
+
if (!r.ok) throw new Error("bridge " + path + " HTTP " + r.status);
|
|
1034
|
+
return r.json();
|
|
1035
|
+
});
|
|
1036
|
+
}
|
|
1037
|
+
function retryOrFail() {
|
|
1038
|
+
if (retriesLeft > 0) {
|
|
1039
|
+
retriesLeft -= 1;
|
|
1040
|
+
inflight = void 0;
|
|
1041
|
+
setTimeout(function() {
|
|
1042
|
+
refresh();
|
|
1043
|
+
}, 1500);
|
|
1044
|
+
return true;
|
|
1045
|
+
}
|
|
1046
|
+
snapshot = {
|
|
1047
|
+
status: "unavailable",
|
|
1048
|
+
value: void 0,
|
|
1049
|
+
writable: false,
|
|
1050
|
+
mode: "bridge"
|
|
1051
|
+
};
|
|
1052
|
+
return false;
|
|
1053
|
+
}
|
|
1054
|
+
function refresh() {
|
|
1055
|
+
if (inflight !== void 0) return inflight;
|
|
1056
|
+
inflight = request(BRIDGE_ROUTES.describe, {}).then(function(body) {
|
|
1057
|
+
if (body && body.ok && body.value && body.value.descriptor !== void 0) {
|
|
1058
|
+
retriesLeft = 4;
|
|
1059
|
+
applyDescriptor(body.value.descriptor, body.value.writable !== false);
|
|
1060
|
+
} else if (!(body && body.code && (body.code === "settings-unavailable" || body.code === "ns-not-registered") && retryOrFail())) snapshot = {
|
|
1061
|
+
status: "unavailable",
|
|
1062
|
+
value: void 0,
|
|
1063
|
+
writable: false,
|
|
1064
|
+
mode: "bridge"
|
|
1065
|
+
};
|
|
1066
|
+
inflight = void 0;
|
|
1067
|
+
notify();
|
|
1068
|
+
}, function() {
|
|
1069
|
+
retryOrFail();
|
|
1070
|
+
inflight = void 0;
|
|
1071
|
+
notify();
|
|
1072
|
+
});
|
|
1073
|
+
return inflight;
|
|
1074
|
+
}
|
|
1075
|
+
refresh();
|
|
1076
|
+
return {
|
|
1077
|
+
subscribe: function(listener) {
|
|
1078
|
+
listeners.push(listener);
|
|
1079
|
+
return function() {
|
|
1080
|
+
var i = listeners.indexOf(listener);
|
|
1081
|
+
if (i >= 0) listeners.splice(i, 1);
|
|
1082
|
+
};
|
|
1083
|
+
},
|
|
1084
|
+
getSnapshot: function() {
|
|
1085
|
+
return snapshot;
|
|
1086
|
+
},
|
|
1087
|
+
set: function(field, value) {
|
|
1088
|
+
return request(BRIDGE_ROUTES.mutate, {
|
|
1089
|
+
ops: [{
|
|
1090
|
+
op: "set",
|
|
1091
|
+
path: [field],
|
|
1092
|
+
value
|
|
1093
|
+
}],
|
|
1094
|
+
expectedRevision: revision
|
|
1095
|
+
}).then(function(body) {
|
|
1096
|
+
if (body && body.ok && body.value && body.value.descriptor !== void 0) {
|
|
1097
|
+
applyDescriptor(body.value.descriptor, snapshot.writable);
|
|
1098
|
+
notify();
|
|
1099
|
+
return true;
|
|
1100
|
+
}
|
|
1101
|
+
if (body && body.code === "settings-conflict") refresh();
|
|
1102
|
+
return false;
|
|
1103
|
+
});
|
|
1104
|
+
}
|
|
1105
|
+
};
|
|
1106
|
+
}
|
|
906
1107
|
function mountFamilySettingsCard(ctx) {
|
|
907
1108
|
var forms = typeof ctx.get === "function" ? ctx.get("configForms") : void 0;
|
|
908
|
-
|
|
909
|
-
|
|
1109
|
+
var scope = forms && typeof forms.get === "function" ? forms.get("dsh-browser-cdp") : void 0;
|
|
1110
|
+
if (!scope) scope = makeBridgeScope();
|
|
910
1111
|
ctx.slots.inject("dsh-family.tab", function() {
|
|
911
1112
|
return ctx.slots.register({
|
|
912
1113
|
name: "dsh-family.tab",
|
|
@@ -923,8 +1124,8 @@ function mountFamilySettingsCard(ctx) {
|
|
|
923
1124
|
}
|
|
924
1125
|
function mountPluginsPageCard(ctx) {
|
|
925
1126
|
var forms = typeof ctx.get === "function" ? ctx.get("configForms") : void 0;
|
|
926
|
-
|
|
927
|
-
|
|
1127
|
+
var scope = forms && typeof forms.get === "function" ? forms.get("dsh-browser-cdp") : void 0;
|
|
1128
|
+
if (!scope) scope = makeBridgeScope();
|
|
928
1129
|
ctx.slots.inject("plugins.bundle.config", function() {
|
|
929
1130
|
return ctx.slots.register({
|
|
930
1131
|
name: "plugins.bundle.config",
|
|
@@ -1504,6 +1705,8 @@ function FamLinks(props) {
|
|
|
1504
1705
|
var addEndpoint = addEndpointState[0], setAddEndpoint = addEndpointState[1];
|
|
1505
1706
|
var addCliPathState = React.useState("");
|
|
1506
1707
|
var addCliPath = addCliPathState[0], setAddCliPath = addCliPathState[1];
|
|
1708
|
+
var addLpPathState = React.useState("");
|
|
1709
|
+
var addLpPath = addLpPathState[0], setAddLpPath = addLpPathState[1];
|
|
1507
1710
|
var btnStyle = {
|
|
1508
1711
|
font: "inherit",
|
|
1509
1712
|
fontSize: "12px",
|
|
@@ -1578,6 +1781,20 @@ function FamLinks(props) {
|
|
|
1578
1781
|
setAddCliPath("");
|
|
1579
1782
|
setErrText("");
|
|
1580
1783
|
}
|
|
1784
|
+
function addLp() {
|
|
1785
|
+
var res = addRow(links, buildLpRow({
|
|
1786
|
+
label: "",
|
|
1787
|
+
servePath: addLpPath
|
|
1788
|
+
}));
|
|
1789
|
+
if (res.code) {
|
|
1790
|
+
setErrText(res.code === "link-limit-reached" ? limitText() : wt("linksAddLpExists"));
|
|
1791
|
+
return;
|
|
1792
|
+
}
|
|
1793
|
+
writeLinks(res.links);
|
|
1794
|
+
if (activeId === "") scope.set("activeTargetId", res.links[res.links.length - 1].id);
|
|
1795
|
+
setAddLpPath("");
|
|
1796
|
+
setErrText("");
|
|
1797
|
+
}
|
|
1581
1798
|
function removeOne(row) {
|
|
1582
1799
|
var res = removeRow(links, row.id);
|
|
1583
1800
|
writeLinks(res.links);
|
|
@@ -1593,6 +1810,7 @@ function FamLinks(props) {
|
|
|
1593
1810
|
code: "probe-failed",
|
|
1594
1811
|
message: "no outcome"
|
|
1595
1812
|
};
|
|
1813
|
+
if (outcome && outcome.engine === void 0 && outcome.ok === true) outcome.engine = "chrome";
|
|
1596
1814
|
writeLinks(applyProbe(links, row.id, outcome, Date.now()));
|
|
1597
1815
|
}).catch(function(error) {
|
|
1598
1816
|
writeLinks(applyProbe(links, row.id, {
|
|
@@ -1661,6 +1879,7 @@ function FamLinks(props) {
|
|
|
1661
1879
|
padding: "2px 0"
|
|
1662
1880
|
} }, wt("linksEmpty")) : links.map(function(row, idx) {
|
|
1663
1881
|
var isCli = row.kind === "ego-cli";
|
|
1882
|
+
var isLp = row.kind === "lightpanda";
|
|
1664
1883
|
var isActive = row.id !== void 0 && row.id === activeId;
|
|
1665
1884
|
var probeBadge = null;
|
|
1666
1885
|
if (row.probeStatus === "ok" || row.probeStatus === "error") probeBadge = h("span", {
|
|
@@ -1692,7 +1911,7 @@ function FamLinks(props) {
|
|
|
1692
1911
|
onChange: function(e) {
|
|
1693
1912
|
writeLinks(updateRow(links, row.id, { enabled: e.target.checked }));
|
|
1694
1913
|
}
|
|
1695
|
-
}), h("span", { style: badgeStyle }, isCli ? "CLI" : "CDP"), h(FamRowInput, {
|
|
1914
|
+
}), h("span", { style: badgeStyle }, isCli ? "CLI" : isLp ? "LP·无头" : "CDP"), h(FamRowInput, {
|
|
1696
1915
|
v: row.label || "",
|
|
1697
1916
|
writable,
|
|
1698
1917
|
placeholder: wt("linksLabel"),
|
|
@@ -1718,14 +1937,18 @@ function FamLinks(props) {
|
|
|
1718
1937
|
gap: "8px",
|
|
1719
1938
|
flexWrap: "wrap"
|
|
1720
1939
|
} }, h(FamRowInput, {
|
|
1721
|
-
v: (isCli ? row.cliPath : row.endpoint) || "",
|
|
1940
|
+
v: (isCli ? row.cliPath : isLp ? row.servePath : row.endpoint) || "",
|
|
1722
1941
|
writable,
|
|
1723
|
-
placeholder: isCli ? wt("linksCliPathHint") : wt("linksEndpointHint"),
|
|
1942
|
+
placeholder: isCli ? wt("linksCliPathHint") : isLp ? wt("linksLpPathHint") : wt("linksEndpointHint"),
|
|
1724
1943
|
onCommit: function(v) {
|
|
1725
1944
|
if (isCli) {
|
|
1726
1945
|
writeLinks(updateRow(links, row.id, { cliPath: v }));
|
|
1727
1946
|
return;
|
|
1728
1947
|
}
|
|
1948
|
+
if (isLp) {
|
|
1949
|
+
writeLinks(updateRow(links, row.id, { servePath: v }));
|
|
1950
|
+
return;
|
|
1951
|
+
}
|
|
1729
1952
|
if (!isValidEndpoint(v)) {
|
|
1730
1953
|
setErrText(wt("linksEndpointInvalid"));
|
|
1731
1954
|
return;
|
|
@@ -1747,7 +1970,7 @@ function FamLinks(props) {
|
|
|
1747
1970
|
onChange: function(e) {
|
|
1748
1971
|
writeLinks(updateRow(links, row.id, { useSdkPath: e.target.checked }));
|
|
1749
1972
|
}
|
|
1750
|
-
}), wt("linksCliSdk")) : null, !isCli ? h("button", {
|
|
1973
|
+
}), wt("linksCliSdk")) : null, !isCli && !isLp ? h("button", {
|
|
1751
1974
|
type: "button",
|
|
1752
1975
|
disabled: !writable || probingId === row.id,
|
|
1753
1976
|
style: btnStyle,
|
|
@@ -1778,11 +2001,15 @@ function FamLinks(props) {
|
|
|
1778
2001
|
onClick: function() {
|
|
1779
2002
|
removeOne(row);
|
|
1780
2003
|
}
|
|
1781
|
-
}, "✕"), isCli && cdpMode === "remote" ? h("span", { style: {
|
|
2004
|
+
}, "✕"), (isCli || isLp) && cdpMode === "remote" ? h("span", { style: {
|
|
1782
2005
|
fontSize: "11px",
|
|
1783
2006
|
color: "#ff9f0a",
|
|
1784
2007
|
flex: "1 1 100%"
|
|
1785
|
-
} }, wt("linksCliRemoteWarn")) : null
|
|
2008
|
+
} }, wt(isCli ? "linksCliRemoteWarn" : "linksLpRemoteWarn")) : null, isLp ? h("span", { style: {
|
|
2009
|
+
fontSize: "11px",
|
|
2010
|
+
color: "var(--dsw-alias-label-tertiary, rgba(127,127,127,.7))",
|
|
2011
|
+
flex: "1 1 100%"
|
|
2012
|
+
} }, wt("linksLpHeadlessHint")) : null));
|
|
1786
2013
|
}), localRow, h("div", { style: {
|
|
1787
2014
|
display: "grid",
|
|
1788
2015
|
gap: "6px",
|
|
@@ -1848,16 +2075,49 @@ function FamLinks(props) {
|
|
|
1848
2075
|
title: hasCliLink(links) ? wt("linksAddCliExists") : isFull(links) ? limitText() : void 0,
|
|
1849
2076
|
style: btnStyle,
|
|
1850
2077
|
onClick: addCli
|
|
1851
|
-
}, wt("linksAddCli"))),
|
|
2078
|
+
}, wt("linksAddCli"))), h("div", { style: {
|
|
2079
|
+
display: "flex",
|
|
2080
|
+
gap: "8px",
|
|
2081
|
+
alignItems: "center",
|
|
2082
|
+
flexWrap: "wrap"
|
|
2083
|
+
} }, h("input", {
|
|
2084
|
+
type: "text",
|
|
2085
|
+
value: addLpPath,
|
|
2086
|
+
disabled: !writable || isFull(links) || hasLpLink(links),
|
|
2087
|
+
placeholder: wt("linksLpPathHint"),
|
|
2088
|
+
style: Object.assign({
|
|
2089
|
+
flex: "1 1 160px",
|
|
2090
|
+
minWidth: 0
|
|
2091
|
+
}, inputStyle),
|
|
2092
|
+
onChange: function(e) {
|
|
2093
|
+
setAddLpPath(e.target.value);
|
|
2094
|
+
},
|
|
2095
|
+
onKeyDown: function(e) {
|
|
2096
|
+
if (e.key === "Enter") addLp();
|
|
2097
|
+
}
|
|
2098
|
+
}), h("button", {
|
|
2099
|
+
type: "button",
|
|
2100
|
+
disabled: !writable || isFull(links) || hasLpLink(links),
|
|
2101
|
+
title: hasLpLink(links) ? wt("linksAddLpExists") : isFull(links) ? limitText() : void 0,
|
|
2102
|
+
style: btnStyle,
|
|
2103
|
+
onClick: addLp
|
|
2104
|
+
}, wt("linksAddLp"))), errText ? h("div", { style: {
|
|
1852
2105
|
fontSize: "11px",
|
|
1853
2106
|
color: "#ff453a"
|
|
1854
2107
|
} }, errText) : null));
|
|
1855
2108
|
}
|
|
1856
2109
|
function apply(ctx) {
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
2110
|
+
var mounts = [
|
|
2111
|
+
["family settings tab", mountFamilySettingsCard],
|
|
2112
|
+
["plugins-page config card", mountPluginsPageCard],
|
|
2113
|
+
["picks dock", mountPicksDockCard],
|
|
2114
|
+
["picks badge", mountPicksBadge]
|
|
2115
|
+
];
|
|
2116
|
+
for (var mi = 0; mi < mounts.length; mi++) try {
|
|
2117
|
+
mounts[mi][1](ctx);
|
|
2118
|
+
} catch (e) {
|
|
2119
|
+
console.warn("[dsh-browser-cdp] mount failed:", mounts[mi][0], e && e.message ? e.message : String(e));
|
|
2120
|
+
}
|
|
1861
2121
|
var betterSidebarService;
|
|
1862
2122
|
try {
|
|
1863
2123
|
betterSidebarService = typeof ctx.get === "function" ? ctx.get("betterSidebar") : void 0;
|
|
@@ -2036,6 +2296,7 @@ function mountFloatingWatch(ctx) {
|
|
|
2036
2296
|
const pageMeta = /* @__PURE__ */ new Map();
|
|
2037
2297
|
const watchClientId = "floating-" + Math.random().toString(36).slice(2);
|
|
2038
2298
|
let watchStarted = false, watchTargetId = null, watchRenewTimer = null, watchStopTimer = null, watchRequest = null, captureBackend = "cdp", streamGeneration = 0, streamState = "idle", streamMime = "video/mp4; codecs=\"avc1.42E01E\"", videoCleanup = null;
|
|
2299
|
+
let streamEngineUnsupported = false;
|
|
2039
2300
|
const effectiveVisible = () => !panel.hidden;
|
|
2040
2301
|
const stopVideo = () => {
|
|
2041
2302
|
if (videoCleanup) try {
|
|
@@ -2051,12 +2312,14 @@ function mountFloatingWatch(ctx) {
|
|
|
2051
2312
|
const nextGeneration = status.generation ?? streamGeneration;
|
|
2052
2313
|
const nextState = status.state || streamState;
|
|
2053
2314
|
const nextMime = status.mime || streamMime;
|
|
2054
|
-
const
|
|
2315
|
+
const nextUnsupported = status.engineUnsupported === true;
|
|
2316
|
+
const changed = captureBackend !== nextBackend || streamGeneration !== nextGeneration || streamState !== nextState || streamMime !== nextMime || streamEngineUnsupported !== nextUnsupported;
|
|
2055
2317
|
captureBackend = nextBackend;
|
|
2056
2318
|
streamGeneration = nextGeneration;
|
|
2057
2319
|
streamState = nextState;
|
|
2058
2320
|
status.message || status.code;
|
|
2059
2321
|
streamMime = nextMime;
|
|
2322
|
+
streamEngineUnsupported = nextUnsupported;
|
|
2060
2323
|
if (changed) {
|
|
2061
2324
|
stopVideo();
|
|
2062
2325
|
const current = lastList.find((s) => s.targetId === (selectedTabId || currentActiveId));
|
|
@@ -2449,7 +2712,7 @@ function mountFloatingWatch(ctx) {
|
|
|
2449
2712
|
} else {
|
|
2450
2713
|
const n = document.createElement("div");
|
|
2451
2714
|
n.className = "dsh-ego-liveurl";
|
|
2452
|
-
n.textContent = wt("noScreenshot");
|
|
2715
|
+
n.textContent = streamEngineUnsupported ? wt("engineUnsupportedBanner") : wt("noScreenshot");
|
|
2453
2716
|
view.appendChild(n);
|
|
2454
2717
|
}
|
|
2455
2718
|
view.appendChild(t);
|
|
@@ -2576,7 +2839,7 @@ function mountFloatingWatch(ctx) {
|
|
|
2576
2839
|
} else {
|
|
2577
2840
|
const n = document.createElement("div");
|
|
2578
2841
|
n.className = "dsh-ego-liveurl";
|
|
2579
|
-
n.textContent = wt("noScreenshot");
|
|
2842
|
+
n.textContent = streamEngineUnsupported ? wt("engineUnsupportedBanner") : wt("noScreenshot");
|
|
2580
2843
|
view.appendChild(n);
|
|
2581
2844
|
}
|
|
2582
2845
|
view.appendChild(t);
|
|
@@ -2683,7 +2946,7 @@ function mountFloatingWatch(ctx) {
|
|
|
2683
2946
|
vh: m.vh
|
|
2684
2947
|
});
|
|
2685
2948
|
}
|
|
2686
|
-
applyFrame(m.targetId, `data:image
|
|
2949
|
+
applyFrame(m.targetId, `data:image/${m.fmt === "png" ? "png" : "jpeg"};base64,${m.data}`, m.vw, m.vh);
|
|
2687
2950
|
} catch {}
|
|
2688
2951
|
});
|
|
2689
2952
|
sse.addEventListener("spaces", (ev) => {
|
|
@@ -3627,6 +3890,10 @@ function createPickControl(onState, deliver) {
|
|
|
3627
3890
|
post(true, targetId).then(function(res) {
|
|
3628
3891
|
var state = res && res.ok !== false ? res.state : null;
|
|
3629
3892
|
if (!state || state.enabled !== true) {
|
|
3893
|
+
if (res && res.code === "engine-unsupported") {
|
|
3894
|
+
emit("failed", wt("engineUnsupportedPick"));
|
|
3895
|
+
return;
|
|
3896
|
+
}
|
|
3630
3897
|
emit("failed", state && state.message || res && res.error || wt("pickFailed"));
|
|
3631
3898
|
return;
|
|
3632
3899
|
}
|
|
@@ -3677,7 +3944,7 @@ function createPickControl(onState, deliver) {
|
|
|
3677
3944
|
}
|
|
3678
3945
|
function LivePreviewController(ctx) {
|
|
3679
3946
|
this.ctx = ctx;
|
|
3680
|
-
this.store =
|
|
3947
|
+
this.store = ensureSnapshotStoreCreator()(this._initialState());
|
|
3681
3948
|
this.frameCache = /* @__PURE__ */ new Map();
|
|
3682
3949
|
this.pageMeta = /* @__PURE__ */ new Map();
|
|
3683
3950
|
this.lastList = [];
|
|
@@ -3703,6 +3970,7 @@ function LivePreviewController(ctx) {
|
|
|
3703
3970
|
this.streamGeneration = 0;
|
|
3704
3971
|
this.streamState = "idle";
|
|
3705
3972
|
this.streamMessage = "";
|
|
3973
|
+
this.engineUnsupported = false;
|
|
3706
3974
|
this.streamMime = "video/mp4; codecs=\"avc1.42E01E\"";
|
|
3707
3975
|
this.liveVideo = null;
|
|
3708
3976
|
this.videoCleanup = null;
|
|
@@ -3760,6 +4028,7 @@ LivePreviewController.prototype._initialState = function() {
|
|
|
3760
4028
|
streamMessage: "",
|
|
3761
4029
|
streamGeneration: 0,
|
|
3762
4030
|
streamMime: "video/mp4; codecs=\"avc1.42E01E\"",
|
|
4031
|
+
engineUnsupported: false,
|
|
3763
4032
|
pick: "off",
|
|
3764
4033
|
pickMessage: ""
|
|
3765
4034
|
};
|
|
@@ -3840,6 +4109,7 @@ LivePreviewController.prototype._recompute = function() {
|
|
|
3840
4109
|
s.streamMessage = self.streamMessage;
|
|
3841
4110
|
s.streamGeneration = self.streamGeneration;
|
|
3842
4111
|
s.streamMime = self.streamMime;
|
|
4112
|
+
s.engineUnsupported = self.engineUnsupported;
|
|
3843
4113
|
s.pick = self._pick;
|
|
3844
4114
|
s.pickMessage = self._pickMessage;
|
|
3845
4115
|
});
|
|
@@ -3924,6 +4194,7 @@ LivePreviewController.prototype._applyCaptureStatus = function(status) {
|
|
|
3924
4194
|
this.streamMessage = status.message || status.code || "";
|
|
3925
4195
|
this.streamGeneration = nextGeneration;
|
|
3926
4196
|
this.streamMime = status.mime || this.streamMime;
|
|
4197
|
+
this.engineUnsupported = status.engineUnsupported === true;
|
|
3927
4198
|
if (generationChanged || this.backend !== "ffmpeg") this._destroyVideo();
|
|
3928
4199
|
this._recompute();
|
|
3929
4200
|
};
|
|
@@ -4105,7 +4376,7 @@ LivePreviewController.prototype.openStream = function() {
|
|
|
4105
4376
|
vh: m.vh
|
|
4106
4377
|
}));
|
|
4107
4378
|
}
|
|
4108
|
-
self.applyFrame(m.targetId, "data:image/jpeg;base64," + m.data, m.vw, m.vh);
|
|
4379
|
+
self.applyFrame(m.targetId, "data:image/" + (m.fmt === "png" ? "png" : "jpeg") + ";base64," + m.data, m.vw, m.vh);
|
|
4109
4380
|
} catch (e) {}
|
|
4110
4381
|
});
|
|
4111
4382
|
this.sse.addEventListener("spaces", function(ev) {
|
|
@@ -4613,8 +4884,8 @@ function EgoBrowserTab(props) {
|
|
|
4613
4884
|
onDoubleClick: function(e) {
|
|
4614
4885
|
controller.handleDoubleClick(e);
|
|
4615
4886
|
}
|
|
4616
|
-
}) : h("div", { className: "dsh-ego-side-liveurl" }, state.streamMessage || wt("noScreenshot"));
|
|
4617
|
-
body = h("div", { className: "dsh-ego-side-body" }, h("div", { className: "dsh-ego-side-liveview" }, h("div", { className: "dsh-ego-side-livebadge" }, h("span", { className: "dsh-ego-side-state-dot" + (state.pinned ? " pin" : state.busy ? " busy" : "") }), h("span", { style: { flex: 1 } }, (state.backend === "ffmpeg" ? "FFmpeg · H.264" : "CDP") + " · " + (state.streamState === "failed" ? state.streamMessage || wt("failed") : state.streamState) + (state.currentTargetId ? state.wiringStale ? " · " + wt("stale") : " · " + wt("captured") : "")), state.pinned ? h("button", {
|
|
4887
|
+
}) : h("div", { className: "dsh-ego-side-liveurl" }, state.engineUnsupported ? wt("engineUnsupportedBanner") : state.streamMessage || wt("noScreenshot"));
|
|
4888
|
+
body = h("div", { className: "dsh-ego-side-body" }, h("div", { className: "dsh-ego-side-liveview" }, h("div", { className: "dsh-ego-side-livebadge" }, h("span", { className: "dsh-ego-side-state-dot" + (state.pinned ? " pin" : state.busy ? " busy" : "") }), h("span", { style: { flex: 1 } }, (state.backend === "ffmpeg" ? "FFmpeg · H.264" : "CDP") + " · " + (state.streamState === "failed" ? state.streamMessage || wt("failed") : state.streamState === "unsupported" ? wt("engineUnsupportedBanner") : state.streamState) + (state.currentTargetId ? state.wiringStale ? " · " + wt("stale") : " · " + wt("captured") : "")), state.pinned ? h("button", {
|
|
4618
4889
|
className: "dsh-ego-side-back",
|
|
4619
4890
|
type: "button",
|
|
4620
4891
|
onClick: function() {
|