dsh-browser-cdp 0.17.6 → 0.17.8
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 +1 -1
- package/dsh-plugin.json +1 -1
- package/lib/client.js +16 -3
- package/lib/index.js +3 -3
- package/package.json +1 -1
package/bin/cdp-cast-worker.mjs
CHANGED
|
@@ -6213,7 +6213,7 @@ const IS_WIN = platform() === "win32";
|
|
|
6213
6213
|
const STATE_HOME = IS_WIN ? process.env.LOCALAPPDATA || join(HOME, "AppData", "Local") : process.env.XDG_STATE_HOME || join(HOME, ".local", "state");
|
|
6214
6214
|
const STATE_DIR = process.env.EGO_LINUX_STATE_DIR || join(STATE_HOME, "ego-lite-linux");
|
|
6215
6215
|
const BROWSER_STATE_FILE = join(STATE_DIR, "browser.json");
|
|
6216
|
-
const CAST_STATE_FILE = join(STATE_DIR, "
|
|
6216
|
+
const CAST_STATE_FILE = join(STATE_DIR, "dsh-browser-cdp.cast.json");
|
|
6217
6217
|
let castConfig = {
|
|
6218
6218
|
captureBackend: "auto",
|
|
6219
6219
|
streamProfile: "balanced",
|
package/dsh-plugin.json
CHANGED
package/lib/client.js
CHANGED
|
@@ -3201,6 +3201,7 @@ function mountFloatingWatch(ctx) {
|
|
|
3201
3201
|
if (pickBtnEl) {
|
|
3202
3202
|
pickBtnEl.textContent = pick === "failed" ? wt("pickFailed") : pick === "on" ? wt("picking") : wt("pickMode");
|
|
3203
3203
|
pickBtnEl.classList.toggle("dsh-ego-pick-on", pick === "on");
|
|
3204
|
+
pickBtnEl.title = pick === "failed" ? message || "" : "";
|
|
3204
3205
|
}
|
|
3205
3206
|
}, function(el, a) {
|
|
3206
3207
|
return deliverPickToConversation(ctx, el, a);
|
|
@@ -4280,6 +4281,18 @@ var TAB_CSS = `
|
|
|
4280
4281
|
* {"cdpEndpoint":..., "targetId":..., "pageUrl":..., "elements":[{n,backendNodeId,tag,id,name,focusable,describe}]}
|
|
4281
4282
|
* [/CDP-PICKS]
|
|
4282
4283
|
*/
|
|
4284
|
+
function currentSessionId(list) {
|
|
4285
|
+
if (!list || typeof list !== "object") return "";
|
|
4286
|
+
if (typeof list.current === "string") return list.current;
|
|
4287
|
+
var byId = list.byId;
|
|
4288
|
+
if (!byId || typeof byId !== "object") return "";
|
|
4289
|
+
var ids = Object.keys(byId);
|
|
4290
|
+
for (var i = 0; i < ids.length; i++) {
|
|
4291
|
+
var row = byId[ids[i]];
|
|
4292
|
+
if (row && row.retainedBy && (row.retainedBy.mainView ?? 0) > 0) return ids[i];
|
|
4293
|
+
}
|
|
4294
|
+
return "";
|
|
4295
|
+
}
|
|
4283
4296
|
function deliverPickToConversation(ctx, element, action) {
|
|
4284
4297
|
try {
|
|
4285
4298
|
var describe = element && typeof element.describe === "string" ? element.describe : "";
|
|
@@ -4291,7 +4304,7 @@ function deliverPickToConversation(ctx, element, action) {
|
|
|
4291
4304
|
ok: false,
|
|
4292
4305
|
code: "bad-action"
|
|
4293
4306
|
};
|
|
4294
|
-
var sessionId = ctx.sessions.list.getSnapshot()
|
|
4307
|
+
var sessionId = currentSessionId(ctx.sessions.list.getSnapshot());
|
|
4295
4308
|
if (!sessionId) return {
|
|
4296
4309
|
ok: false,
|
|
4297
4310
|
code: "no-active-session"
|
|
@@ -4354,7 +4367,7 @@ function deliverPickToConversation(ctx, element, action) {
|
|
|
4354
4367
|
draft = draft.slice(0, found.index) + draft.slice(found.index + found[0].length);
|
|
4355
4368
|
} catch (e) {}
|
|
4356
4369
|
if (!page.elements) page.elements = elements;
|
|
4357
|
-
var block = "[CDP-PICKS page=\"" + String(src.pageTitle || src.pageUrl || "").replace(/"/g, "'") + "\" targetId=\"" + src.targetId + "\" endpoint=\"" + src.endpoint + "\"]\n" + JSON.stringify(page, null, 2) + "\n[/CDP-PICKS]";
|
|
4370
|
+
var block = "[🌐 CDP-PICKS page=\"" + String(src.pageTitle || src.pageUrl || "").replace(/"/g, "'") + "\" targetId=\"" + src.targetId + "\" endpoint=\"" + src.endpoint + "\"]\n" + JSON.stringify(page, null, 2) + "\n[/CDP-PICKS]";
|
|
4358
4371
|
draft = draft ? draft + (draft.charAt(draft.length - 1) === "\n" ? "" : "\n") + block : block;
|
|
4359
4372
|
input.setDraft(draft);
|
|
4360
4373
|
return {
|
|
@@ -5448,7 +5461,7 @@ function EgoBrowserTab(props) {
|
|
|
5448
5461
|
}, wt("backToLive")) : null, h("button", {
|
|
5449
5462
|
className: "dsh-ego-side-back" + (state.pick === "on" ? " dsh-ego-pick-on" : ""),
|
|
5450
5463
|
type: "button",
|
|
5451
|
-
title: wt("pickModeHint"),
|
|
5464
|
+
title: state.pick === "failed" ? state.message || wt("pickFailed") : wt("pickModeHint"),
|
|
5452
5465
|
onClick: function() {
|
|
5453
5466
|
controller.togglePick();
|
|
5454
5467
|
}
|
package/lib/index.js
CHANGED
|
@@ -1566,7 +1566,7 @@ function getAttachEndpoint() {
|
|
|
1566
1566
|
/**
|
|
1567
1567
|
* Stop a running worker so the next request respawns it with the new argv
|
|
1568
1568
|
* seed (T2.4: an activation change must take effect on a live panel, not only
|
|
1569
|
-
* after a host restart). Kills only the pid WE spawned (per
|
|
1569
|
+
* after a host restart). Kills only the pid WE spawned (per our namespaced state file) —
|
|
1570
1570
|
* never a name-matched sweep, which previously took out the DSH subprocess
|
|
1571
1571
|
* runner along with our own tree (issues #34 defect 2 / #40).
|
|
1572
1572
|
*/
|
|
@@ -1627,7 +1627,7 @@ function castStatePath() {
|
|
|
1627
1627
|
const isWin = process.platform === "win32";
|
|
1628
1628
|
const home = e.HOME || e.USERPROFILE || (isWin ? e.LOCALAPPDATA || "" : "/root");
|
|
1629
1629
|
const stateHome = e.EGO_LINUX_STATE_DIR || (isWin ? e.LOCALAPPDATA || `${home}\\AppData\\Local` : e.XDG_STATE_HOME || `${home}/.local/state`);
|
|
1630
|
-
return stateHome.endsWith("ego-lite-linux") ? `${stateHome}/
|
|
1630
|
+
return stateHome.endsWith("ego-lite-linux") ? `${stateHome}/dsh-browser-cdp.cast.json` : `${stateHome}/ego-lite-linux/dsh-browser-cdp.cast.json`;
|
|
1631
1631
|
}
|
|
1632
1632
|
function sendJson(res, status, body) {
|
|
1633
1633
|
const payload = JSON.stringify(body);
|
|
@@ -7224,7 +7224,7 @@ function registerAuthFlush(ctx, cfg, reg) {
|
|
|
7224
7224
|
const stateDir = e.EGO_LINUX_STATE_DIR || (isWin ? (e.LOCALAPPDATA || `${home}\\AppData\\Local`) + "\\ego-lite-linux" : `${e.XDG_STATE_HOME || `${home}/.local/state`}/ego-lite-linux`);
|
|
7225
7225
|
let port = null;
|
|
7226
7226
|
try {
|
|
7227
|
-
const state = JSON.parse(await readFile$1(`${stateDir}/
|
|
7227
|
+
const state = JSON.parse(await readFile$1(`${stateDir}/dsh-browser-cdp.cast.json`, "utf8"));
|
|
7228
7228
|
port = typeof state.port === "number" ? state.port : null;
|
|
7229
7229
|
} catch {
|
|
7230
7230
|
port = null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-browser-cdp",
|
|
3
|
-
"version": "0.17.
|
|
3
|
+
"version": "0.17.8",
|
|
4
4
|
"description": "dsh-browser-cdp: DSH browser plugin — attach to a running Chrome/Edge over CDP (no bundled browser needed); structured browser-automation tools (30+ bcdp_*) that drive the vendored ego runtime through ctx.subprocess, plus a realtime watch panel (live SSE screencast + direct mouse interaction + download capture + human-verification notice). Web shell: floating watch panel without dsh-better-sidebar, sidebar tab with it. Headless/TUI hosts: tools-only. [DSH 0.1.7+ line: declarative settings via Config .volatile() fields; for DSH 0.1.2-rc.1 ~ 0.1.6 use the 0.16.x line]",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./lib/index.js",
|