dsh-browser-cdp 0.18.11 → 0.18.12

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 CHANGED
@@ -2,7 +2,7 @@
2
2
  "$schema": "https://dsh.community/schemas/dsh-plugin-0.15.json",
3
3
  "id": "dsh-browser-cdp",
4
4
  "name": "dsh-browser-cdp",
5
- "version": "0.18.11",
5
+ "version": "0.18.12",
6
6
  "manifestVersion": "0.15",
7
7
  "facets": {
8
8
  "host": {
package/lib/client.js CHANGED
@@ -3117,8 +3117,7 @@ function CdpPicksDockCard(props) {
3117
3117
  window.clearInterval(timer);
3118
3118
  };
3119
3119
  }, []);
3120
- var snap = input && input.state && input.state.getSnapshot ? input.state.getSnapshot() : null;
3121
- var draft = snap && typeof snap.draft === "string" ? snap.draft : "";
3120
+ var draft = readDraftText(input);
3122
3121
  var re = /\[(?:🌐 )?CDP-PICKS\s+page="([^"]*)"\s+targetId="([^"]*)"\s+endpoint="([^"]*)"\]\n([\s\S]*?)\n\[\/CDP-PICKS\]/g;
3123
3122
  var found = [], mm;
3124
3123
  while ((mm = re.exec(draft)) !== null) {
@@ -3143,9 +3142,10 @@ function CdpPicksDockCard(props) {
3143
3142
  } catch (e) {}
3144
3143
  function removeBlock(block) {
3145
3144
  if (!input || typeof input.setDraft !== "function") return;
3146
- var idx = draft.indexOf(block);
3145
+ var cur = readDraftText(input);
3146
+ var idx = cur.indexOf(block);
3147
3147
  if (idx < 0) return;
3148
- var next = draft.slice(0, idx) + draft.slice(idx + block.length);
3148
+ var next = cur.slice(0, idx) + cur.slice(idx + block.length);
3149
3149
  next = next.replace(/^\s*\n+/, "").replace(/\n+\s*$/, "");
3150
3150
  input.setDraft(next);
3151
3151
  }
@@ -3266,6 +3266,17 @@ function mountPicksDockCard(ctx) {
3266
3266
  }, CdpPicksDockCard);
3267
3267
  }, "dsh-browser-cdp: picks dock card");
3268
3268
  }
3269
+ function readDraftText(input) {
3270
+ if (!input) return "";
3271
+ try {
3272
+ if (typeof input.draft === "string") return input.draft;
3273
+ } catch (e) {}
3274
+ try {
3275
+ var snap = input.state && input.state.getSnapshot ? input.state.getSnapshot() : null;
3276
+ if (snap && typeof snap.draft === "string") return snap.draft;
3277
+ } catch (e) {}
3278
+ return "";
3279
+ }
3269
3280
  function currentSessionId(list) {
3270
3281
  if (!list || typeof list !== "object") return "";
3271
3282
  if (typeof list.current === "string") return list.current;
@@ -3309,8 +3320,7 @@ function deliverPickToConversation(ctx, element, action) {
3309
3320
  ok: false,
3310
3321
  code: "no-input-facade"
3311
3322
  };
3312
- var snap = input.state && input.state.getSnapshot ? input.state.getSnapshot() : null;
3313
- var draft = snap && typeof snap.draft === "string" ? snap.draft : "";
3323
+ var draft = readDraftText(input);
3314
3324
  var src = element.source || {
3315
3325
  endpoint: "",
3316
3326
  targetId: "",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-browser-cdp",
3
- "version": "0.18.11",
3
+ "version": "0.18.12",
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",