dsh-browser-cdp 0.17.14 → 0.17.15
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 +28 -7
- package/package.json +1 -1
package/dsh-plugin.json
CHANGED
package/lib/client.js
CHANGED
|
@@ -4325,9 +4325,8 @@ function CdpPicksDockCard(props) {
|
|
|
4325
4325
|
window.clearInterval(timer);
|
|
4326
4326
|
};
|
|
4327
4327
|
}, []);
|
|
4328
|
-
var
|
|
4329
|
-
var
|
|
4330
|
-
var re = /\[(?:🌐 )?CDP-PICKS page="([^"]*)" targetId="([^"]*)" endpoint="([^"]*)"\]\n([\s\S]*?)\n\[\/CDP-PICKS\]/g;
|
|
4328
|
+
var draft = readDraftText(input);
|
|
4329
|
+
var re = /\[(?:🌐 )?CDP-PICKS\s+page="([^"]*)"\s+targetId="([^"]*)"\s+endpoint="([^"]*)"\]\n([\s\S]*?)\n\[\/CDP-PICKS\]/g;
|
|
4331
4330
|
var found = [], mm;
|
|
4332
4331
|
while ((mm = re.exec(draft)) !== null) {
|
|
4333
4332
|
var elements = [];
|
|
@@ -4351,9 +4350,10 @@ function CdpPicksDockCard(props) {
|
|
|
4351
4350
|
} catch (e) {}
|
|
4352
4351
|
function removeBlock(block) {
|
|
4353
4352
|
if (!input || typeof input.setDraft !== "function") return;
|
|
4354
|
-
var
|
|
4353
|
+
var cur = readDraftText(input);
|
|
4354
|
+
var idx = cur.indexOf(block);
|
|
4355
4355
|
if (idx < 0) return;
|
|
4356
|
-
var next =
|
|
4356
|
+
var next = cur.slice(0, idx) + cur.slice(idx + block.length);
|
|
4357
4357
|
next = next.replace(/^\s*\n+/, "").replace(/\n+\s*$/, "");
|
|
4358
4358
|
input.setDraft(next);
|
|
4359
4359
|
}
|
|
@@ -4445,10 +4445,14 @@ function CdpPicksDockCard(props) {
|
|
|
4445
4445
|
}));
|
|
4446
4446
|
}
|
|
4447
4447
|
function mountPicksDockCard(ctx) {
|
|
4448
|
+
try {
|
|
4449
|
+
window.__dshBrowserCdpDeco = Object.assign({}, window.__dshBrowserCdpDeco, { stage: "registered" });
|
|
4450
|
+
} catch (e) {}
|
|
4448
4451
|
ctx.slots.inject("conversation.input.dock", function() {
|
|
4449
4452
|
return ctx.slots.register({
|
|
4450
4453
|
name: "conversation.input.dock",
|
|
4451
4454
|
id: "dsh-browser-cdp.picks",
|
|
4455
|
+
locale: "dsh-browser-cdp",
|
|
4452
4456
|
order: 0,
|
|
4453
4457
|
inject: function(sessionId) {
|
|
4454
4458
|
var input = null;
|
|
@@ -4457,12 +4461,30 @@ function mountPicksDockCard(ctx) {
|
|
|
4457
4461
|
input = actx.get("conversation").input.for(actx);
|
|
4458
4462
|
} catch (e) {
|
|
4459
4463
|
input = null;
|
|
4464
|
+
try {
|
|
4465
|
+
window.__dshBrowserCdpDeco = Object.assign({}, window.__dshBrowserCdpDeco, {
|
|
4466
|
+
stage: "inject-failed",
|
|
4467
|
+
error: String(e && e.message || e),
|
|
4468
|
+
sessionId: String(sessionId)
|
|
4469
|
+
});
|
|
4470
|
+
} catch (e2) {}
|
|
4460
4471
|
}
|
|
4461
4472
|
return { input };
|
|
4462
4473
|
}
|
|
4463
4474
|
}, CdpPicksDockCard);
|
|
4464
4475
|
}, "dsh-browser-cdp: picks dock card");
|
|
4465
4476
|
}
|
|
4477
|
+
function readDraftText(input) {
|
|
4478
|
+
if (!input) return "";
|
|
4479
|
+
try {
|
|
4480
|
+
if (typeof input.draft === "string") return input.draft;
|
|
4481
|
+
} catch (e) {}
|
|
4482
|
+
try {
|
|
4483
|
+
var snap = input.state && input.state.getSnapshot ? input.state.getSnapshot() : null;
|
|
4484
|
+
if (snap && typeof snap.draft === "string") return snap.draft;
|
|
4485
|
+
} catch (e) {}
|
|
4486
|
+
return "";
|
|
4487
|
+
}
|
|
4466
4488
|
function currentSessionId(list) {
|
|
4467
4489
|
if (!list || typeof list !== "object") return "";
|
|
4468
4490
|
if (typeof list.current === "string") return list.current;
|
|
@@ -4506,8 +4528,7 @@ function deliverPickToConversation(ctx, element, action) {
|
|
|
4506
4528
|
ok: false,
|
|
4507
4529
|
code: "no-input-facade"
|
|
4508
4530
|
};
|
|
4509
|
-
var
|
|
4510
|
-
var draft = snap && typeof snap.draft === "string" ? snap.draft : "";
|
|
4531
|
+
var draft = readDraftText(input);
|
|
4511
4532
|
var src = element.source || {
|
|
4512
4533
|
endpoint: "",
|
|
4513
4534
|
targetId: "",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-browser-cdp",
|
|
3
|
-
"version": "0.17.
|
|
3
|
+
"version": "0.17.15",
|
|
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",
|