dsh-browser-cdp 0.18.10 → 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.10",
5
+ "version": "0.18.12",
6
6
  "manifestVersion": "0.15",
7
7
  "facets": {
8
8
  "host": {
package/lib/client.js CHANGED
@@ -3117,9 +3117,8 @@ 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 : "";
3122
- var re = /\[(?:🌐 )?CDP-PICKS page="([^"]*)" targetId="([^"]*)" endpoint="([^"]*)"\]\n([\s\S]*?)\n\[\/CDP-PICKS\]/g;
3120
+ var draft = readDraftText(input);
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) {
3125
3124
  var elements = [];
@@ -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
  }
@@ -3237,10 +3237,14 @@ function CdpPicksDockCard(props) {
3237
3237
  }));
3238
3238
  }
3239
3239
  function mountPicksDockCard(ctx) {
3240
+ try {
3241
+ window.__dshBrowserCdpDeco = Object.assign({}, window.__dshBrowserCdpDeco, { stage: "registered" });
3242
+ } catch (e) {}
3240
3243
  ctx.slots.inject("conversation.input.dock", function() {
3241
3244
  return ctx.slots.register({
3242
3245
  name: "conversation.input.dock",
3243
3246
  id: "dsh-browser-cdp.picks",
3247
+ locale: "dsh-browser-cdp",
3244
3248
  order: 0,
3245
3249
  inject: function(sessionId) {
3246
3250
  var input = null;
@@ -3249,12 +3253,30 @@ function mountPicksDockCard(ctx) {
3249
3253
  input = actx.get("conversation").input.for(actx);
3250
3254
  } catch (e) {
3251
3255
  input = null;
3256
+ try {
3257
+ window.__dshBrowserCdpDeco = Object.assign({}, window.__dshBrowserCdpDeco, {
3258
+ stage: "inject-failed",
3259
+ error: String(e && e.message || e),
3260
+ sessionId: String(sessionId)
3261
+ });
3262
+ } catch (e2) {}
3252
3263
  }
3253
3264
  return { input };
3254
3265
  }
3255
3266
  }, CdpPicksDockCard);
3256
3267
  }, "dsh-browser-cdp: picks dock card");
3257
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
+ }
3258
3280
  function currentSessionId(list) {
3259
3281
  if (!list || typeof list !== "object") return "";
3260
3282
  if (typeof list.current === "string") return list.current;
@@ -3298,8 +3320,7 @@ function deliverPickToConversation(ctx, element, action) {
3298
3320
  ok: false,
3299
3321
  code: "no-input-facade"
3300
3322
  };
3301
- var snap = input.state && input.state.getSnapshot ? input.state.getSnapshot() : null;
3302
- var draft = snap && typeof snap.draft === "string" ? snap.draft : "";
3323
+ var draft = readDraftText(input);
3303
3324
  var src = element.source || {
3304
3325
  endpoint: "",
3305
3326
  targetId: "",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-browser-cdp",
3
- "version": "0.18.10",
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",