dsh-browser-cdp 0.18.17 → 0.18.18
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
|
@@ -3379,6 +3379,16 @@ function latchPickInputActions(sessionId, actions) {
|
|
|
3379
3379
|
actions
|
|
3380
3380
|
};
|
|
3381
3381
|
}
|
|
3382
|
+
function pickSlugOf(entry) {
|
|
3383
|
+
var raw = String(entry && entry.describe || entry && entry.name || entry && entry.tag || "");
|
|
3384
|
+
raw = raw.replace(/["'`]/g, "").trim();
|
|
3385
|
+
return raw.replace(/[^A-Za-z0-9._-]+/g, "-").replace(/^-+/, "").slice(0, 12).replace(/-+$/, "");
|
|
3386
|
+
}
|
|
3387
|
+
function pickArchiveFileName(entry) {
|
|
3388
|
+
var slug = pickSlugOf(entry);
|
|
3389
|
+
var tail = Date.now().toString(36).slice(-5);
|
|
3390
|
+
return slug ? "picks-" + slug + "-" + tail + ".json" : "picks-" + tail + ".json";
|
|
3391
|
+
}
|
|
3382
3392
|
function needsBoundarySpace() {
|
|
3383
3393
|
var root = document.querySelector("[data-input-scroll] [contenteditable=\"true\"]");
|
|
3384
3394
|
var selection = window.getSelection();
|
|
@@ -3392,7 +3402,7 @@ function needsBoundarySpace() {
|
|
|
3392
3402
|
if (text === "") return false;
|
|
3393
3403
|
return !/\s/u.test(text.slice(-1));
|
|
3394
3404
|
}
|
|
3395
|
-
async function tryInsertPickChip(ctx, sessionId, actx, input, token) {
|
|
3405
|
+
async function tryInsertPickChip(ctx, sessionId, actx, input, token, label) {
|
|
3396
3406
|
try {
|
|
3397
3407
|
var latch = pickInputActionsLatch;
|
|
3398
3408
|
if (!latch.actions || latch.sessionId !== String(sessionId)) return false;
|
|
@@ -3404,7 +3414,7 @@ async function tryInsertPickChip(ctx, sessionId, actx, input, token) {
|
|
|
3404
3414
|
return input.insertReference({
|
|
3405
3415
|
source: "reference",
|
|
3406
3416
|
ref: token,
|
|
3407
|
-
label: "🌐 " + token.slice(1, -1),
|
|
3417
|
+
label: label || "🌐 " + token.slice(1, -1),
|
|
3408
3418
|
appearance: "file",
|
|
3409
3419
|
clipboardText: token
|
|
3410
3420
|
}, span) === true;
|
|
@@ -3507,13 +3517,15 @@ function deliverPickToConversation(ctx, element, action) {
|
|
|
3507
3517
|
pageTitle: src.pageTitle,
|
|
3508
3518
|
elements: [Object.assign({ n: 1 }, entry)]
|
|
3509
3519
|
};
|
|
3520
|
+
var newFile = pickArchiveFileName(entry);
|
|
3510
3521
|
var sres = await postJson("/bcdp/api/picks-save", {
|
|
3511
3522
|
block: JSON.stringify(pageNew, null, 2),
|
|
3523
|
+
file: newFile,
|
|
3512
3524
|
session: sessionId
|
|
3513
3525
|
});
|
|
3514
3526
|
if (!sres || sres.ok === false || !sres.value) return;
|
|
3515
3527
|
var token = "@\"picks/" + sres.value.file + "\"";
|
|
3516
|
-
if (!await tryInsertPickChip(ctx, sessionId, actx, input, token)) {
|
|
3528
|
+
if (!await tryInsertPickChip(ctx, sessionId, actx, input, token, "🌐 " + (pickSlugOf(entry) || sres.value.file.replace(/\.json$/, "")))) {
|
|
3517
3529
|
var cur = readDraftText(input);
|
|
3518
3530
|
cur = cur ? cur + (cur.charAt(cur.length - 1) === "\n" ? "" : "\n") + token : token;
|
|
3519
3531
|
input.setDraft(cur);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-browser-cdp",
|
|
3
|
-
"version": "0.18.
|
|
3
|
+
"version": "0.18.18",
|
|
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",
|