dsh-browser-cdp 0.18.2 → 0.18.4
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
|
@@ -6218,7 +6218,7 @@ const IS_WIN = platform() === "win32";
|
|
|
6218
6218
|
const STATE_HOME = IS_WIN ? process.env.LOCALAPPDATA || join(HOME, "AppData", "Local") : process.env.XDG_STATE_HOME || join(HOME, ".local", "state");
|
|
6219
6219
|
const STATE_DIR = process.env.EGO_LINUX_STATE_DIR || join(STATE_HOME, "ego-lite-linux");
|
|
6220
6220
|
const BROWSER_STATE_FILE = join(STATE_DIR, "browser.json");
|
|
6221
|
-
const CAST_STATE_FILE = join(STATE_DIR, "
|
|
6221
|
+
const CAST_STATE_FILE = join(STATE_DIR, "dsh-browser-cdp.cast.json");
|
|
6222
6222
|
let castConfig = {
|
|
6223
6223
|
captureBackend: "auto",
|
|
6224
6224
|
streamProfile: "balanced",
|
package/dsh-plugin.json
CHANGED
package/lib/client.js
CHANGED
|
@@ -2014,6 +2014,7 @@ function mountFloatingWatch(ctx) {
|
|
|
2014
2014
|
if (pickBtnEl) {
|
|
2015
2015
|
pickBtnEl.textContent = pick === "failed" ? wt("pickFailed") : pick === "on" ? wt("picking") : wt("pickMode");
|
|
2016
2016
|
pickBtnEl.classList.toggle("dsh-ego-pick-on", pick === "on");
|
|
2017
|
+
pickBtnEl.title = pick === "failed" ? message || "" : "";
|
|
2017
2018
|
}
|
|
2018
2019
|
}, function(el, a) {
|
|
2019
2020
|
return deliverPickToConversation(ctx, el, a);
|
|
@@ -3093,6 +3094,18 @@ var TAB_CSS = `
|
|
|
3093
3094
|
* {"cdpEndpoint":..., "targetId":..., "pageUrl":..., "elements":[{n,backendNodeId,tag,id,name,focusable,describe}]}
|
|
3094
3095
|
* [/CDP-PICKS]
|
|
3095
3096
|
*/
|
|
3097
|
+
function currentSessionId(list) {
|
|
3098
|
+
if (!list || typeof list !== "object") return "";
|
|
3099
|
+
if (typeof list.current === "string") return list.current;
|
|
3100
|
+
var byId = list.byId;
|
|
3101
|
+
if (!byId || typeof byId !== "object") return "";
|
|
3102
|
+
var ids = Object.keys(byId);
|
|
3103
|
+
for (var i = 0; i < ids.length; i++) {
|
|
3104
|
+
var row = byId[ids[i]];
|
|
3105
|
+
if (row && row.retainedBy && (row.retainedBy.mainView ?? 0) > 0) return ids[i];
|
|
3106
|
+
}
|
|
3107
|
+
return "";
|
|
3108
|
+
}
|
|
3096
3109
|
function deliverPickToConversation(ctx, element, action) {
|
|
3097
3110
|
try {
|
|
3098
3111
|
var describe = element && typeof element.describe === "string" ? element.describe : "";
|
|
@@ -3104,7 +3117,7 @@ function deliverPickToConversation(ctx, element, action) {
|
|
|
3104
3117
|
ok: false,
|
|
3105
3118
|
code: "bad-action"
|
|
3106
3119
|
};
|
|
3107
|
-
var sessionId = ctx.sessions.list.getSnapshot()
|
|
3120
|
+
var sessionId = currentSessionId(ctx.sessions.list.getSnapshot());
|
|
3108
3121
|
if (!sessionId) return {
|
|
3109
3122
|
ok: false,
|
|
3110
3123
|
code: "no-active-session"
|
|
@@ -3167,7 +3180,7 @@ function deliverPickToConversation(ctx, element, action) {
|
|
|
3167
3180
|
draft = draft.slice(0, found.index) + draft.slice(found.index + found[0].length);
|
|
3168
3181
|
} catch (e) {}
|
|
3169
3182
|
if (!page.elements) page.elements = elements;
|
|
3170
|
-
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]";
|
|
3183
|
+
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]";
|
|
3171
3184
|
draft = draft ? draft + (draft.charAt(draft.length - 1) === "\n" ? "" : "\n") + block : block;
|
|
3172
3185
|
input.setDraft(draft);
|
|
3173
3186
|
return {
|
|
@@ -4261,7 +4274,7 @@ function EgoBrowserTab(props) {
|
|
|
4261
4274
|
}, wt("backToLive")) : null, h("button", {
|
|
4262
4275
|
className: "dsh-ego-side-back" + (state.pick === "on" ? " dsh-ego-pick-on" : ""),
|
|
4263
4276
|
type: "button",
|
|
4264
|
-
title: wt("pickModeHint"),
|
|
4277
|
+
title: state.pick === "failed" ? state.message || wt("pickFailed") : wt("pickModeHint"),
|
|
4265
4278
|
onClick: function() {
|
|
4266
4279
|
controller.togglePick();
|
|
4267
4280
|
}
|
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.18.
|
|
3
|
+
"version": "0.18.4",
|
|
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.2.0-rc.1+ line: declarative settings via Config .volatile() fields; for DSH 0.1.2-rc.1 ~ 0.1.7 use the 0.17.x line]",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./lib/index.js",
|