dsh-browser-cdp 0.17.20 → 0.17.21
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 +15 -3
- package/package.json +1 -1
package/dsh-plugin.json
CHANGED
package/lib/client.js
CHANGED
|
@@ -4583,6 +4583,16 @@ function latchPickInputActions(sessionId, actions) {
|
|
|
4583
4583
|
actions
|
|
4584
4584
|
};
|
|
4585
4585
|
}
|
|
4586
|
+
function pickSlugOf(entry) {
|
|
4587
|
+
var raw = String(entry && entry.describe || entry && entry.name || entry && entry.tag || "");
|
|
4588
|
+
raw = raw.replace(/["'`]/g, "").trim();
|
|
4589
|
+
return raw.replace(/[^A-Za-z0-9._-]+/g, "-").replace(/^-+/, "").slice(0, 24).replace(/-+$/, "");
|
|
4590
|
+
}
|
|
4591
|
+
function pickArchiveFileName(entry) {
|
|
4592
|
+
var slug = pickSlugOf(entry);
|
|
4593
|
+
var tail = Date.now().toString(36).slice(-5);
|
|
4594
|
+
return slug ? "picks-" + slug + "-" + tail + ".json" : "picks-" + tail + ".json";
|
|
4595
|
+
}
|
|
4586
4596
|
function needsBoundarySpace() {
|
|
4587
4597
|
var root = document.querySelector("[data-input-scroll] [contenteditable=\"true\"]");
|
|
4588
4598
|
var selection = window.getSelection();
|
|
@@ -4596,7 +4606,7 @@ function needsBoundarySpace() {
|
|
|
4596
4606
|
if (text === "") return false;
|
|
4597
4607
|
return !/\s/u.test(text.slice(-1));
|
|
4598
4608
|
}
|
|
4599
|
-
async function tryInsertPickChip(ctx, sessionId, actx, input, token) {
|
|
4609
|
+
async function tryInsertPickChip(ctx, sessionId, actx, input, token, label) {
|
|
4600
4610
|
try {
|
|
4601
4611
|
var latch = pickInputActionsLatch;
|
|
4602
4612
|
if (!latch.actions || latch.sessionId !== String(sessionId)) return false;
|
|
@@ -4608,7 +4618,7 @@ async function tryInsertPickChip(ctx, sessionId, actx, input, token) {
|
|
|
4608
4618
|
return input.insertReference({
|
|
4609
4619
|
source: "reference",
|
|
4610
4620
|
ref: token,
|
|
4611
|
-
label: "🌐 " + token.slice(1, -1),
|
|
4621
|
+
label: label || "🌐 " + token.slice(1, -1),
|
|
4612
4622
|
appearance: "file",
|
|
4613
4623
|
clipboardText: token
|
|
4614
4624
|
}, span) === true;
|
|
@@ -4711,13 +4721,15 @@ function deliverPickToConversation(ctx, element, action) {
|
|
|
4711
4721
|
pageTitle: src.pageTitle,
|
|
4712
4722
|
elements: [Object.assign({ n: 1 }, entry)]
|
|
4713
4723
|
};
|
|
4724
|
+
var newFile = pickArchiveFileName(entry);
|
|
4714
4725
|
var sres = await postJson("/bcdp/api/picks-save", {
|
|
4715
4726
|
block: JSON.stringify(pageNew, null, 2),
|
|
4727
|
+
file: newFile,
|
|
4716
4728
|
session: sessionId
|
|
4717
4729
|
});
|
|
4718
4730
|
if (!sres || sres.ok === false || !sres.value) return;
|
|
4719
4731
|
var token = "@\"picks/" + sres.value.file + "\"";
|
|
4720
|
-
if (!await tryInsertPickChip(ctx, sessionId, actx, input, token)) {
|
|
4732
|
+
if (!await tryInsertPickChip(ctx, sessionId, actx, input, token, "🌐 " + (pickSlugOf(entry) || sres.value.file.replace(/\.json$/, "")))) {
|
|
4721
4733
|
var cur = readDraftText(input);
|
|
4722
4734
|
cur = cur ? cur + (cur.charAt(cur.length - 1) === "\n" ? "" : "\n") + token : token;
|
|
4723
4735
|
input.setDraft(cur);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-browser-cdp",
|
|
3
|
-
"version": "0.17.
|
|
3
|
+
"version": "0.17.21",
|
|
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",
|