dsh-browser-cdp 0.18.3 → 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/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
|
@@ -3094,6 +3094,18 @@ var TAB_CSS = `
|
|
|
3094
3094
|
* {"cdpEndpoint":..., "targetId":..., "pageUrl":..., "elements":[{n,backendNodeId,tag,id,name,focusable,describe}]}
|
|
3095
3095
|
* [/CDP-PICKS]
|
|
3096
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
|
+
}
|
|
3097
3109
|
function deliverPickToConversation(ctx, element, action) {
|
|
3098
3110
|
try {
|
|
3099
3111
|
var describe = element && typeof element.describe === "string" ? element.describe : "";
|
|
@@ -3105,7 +3117,7 @@ function deliverPickToConversation(ctx, element, action) {
|
|
|
3105
3117
|
ok: false,
|
|
3106
3118
|
code: "bad-action"
|
|
3107
3119
|
};
|
|
3108
|
-
var sessionId = ctx.sessions.list.getSnapshot()
|
|
3120
|
+
var sessionId = currentSessionId(ctx.sessions.list.getSnapshot());
|
|
3109
3121
|
if (!sessionId) return {
|
|
3110
3122
|
ok: false,
|
|
3111
3123
|
code: "no-active-session"
|
|
@@ -3168,7 +3180,7 @@ function deliverPickToConversation(ctx, element, action) {
|
|
|
3168
3180
|
draft = draft.slice(0, found.index) + draft.slice(found.index + found[0].length);
|
|
3169
3181
|
} catch (e) {}
|
|
3170
3182
|
if (!page.elements) page.elements = elements;
|
|
3171
|
-
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]";
|
|
3172
3184
|
draft = draft ? draft + (draft.charAt(draft.length - 1) === "\n" ? "" : "\n") + block : block;
|
|
3173
3185
|
input.setDraft(draft);
|
|
3174
3186
|
return {
|
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",
|