dsh-browser-cdp 0.17.7 → 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/dsh-plugin.json +1 -1
- package/lib/client.js +14 -2
- package/package.json +1 -1
package/dsh-plugin.json
CHANGED
package/lib/client.js
CHANGED
|
@@ -4281,6 +4281,18 @@ var TAB_CSS = `
|
|
|
4281
4281
|
* {"cdpEndpoint":..., "targetId":..., "pageUrl":..., "elements":[{n,backendNodeId,tag,id,name,focusable,describe}]}
|
|
4282
4282
|
* [/CDP-PICKS]
|
|
4283
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
|
+
}
|
|
4284
4296
|
function deliverPickToConversation(ctx, element, action) {
|
|
4285
4297
|
try {
|
|
4286
4298
|
var describe = element && typeof element.describe === "string" ? element.describe : "";
|
|
@@ -4292,7 +4304,7 @@ function deliverPickToConversation(ctx, element, action) {
|
|
|
4292
4304
|
ok: false,
|
|
4293
4305
|
code: "bad-action"
|
|
4294
4306
|
};
|
|
4295
|
-
var sessionId = ctx.sessions.list.getSnapshot()
|
|
4307
|
+
var sessionId = currentSessionId(ctx.sessions.list.getSnapshot());
|
|
4296
4308
|
if (!sessionId) return {
|
|
4297
4309
|
ok: false,
|
|
4298
4310
|
code: "no-active-session"
|
|
@@ -4355,7 +4367,7 @@ function deliverPickToConversation(ctx, element, action) {
|
|
|
4355
4367
|
draft = draft.slice(0, found.index) + draft.slice(found.index + found[0].length);
|
|
4356
4368
|
} catch (e) {}
|
|
4357
4369
|
if (!page.elements) page.elements = elements;
|
|
4358
|
-
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]";
|
|
4359
4371
|
draft = draft ? draft + (draft.charAt(draft.length - 1) === "\n" ? "" : "\n") + block : block;
|
|
4360
4372
|
input.setDraft(draft);
|
|
4361
4373
|
return {
|
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",
|