dsh-browser-cdp 0.18.1 → 0.18.3

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.
@@ -6218,7 +6218,7 @@ const IS_WIN = platform() === "win32";
6218
6218
  const STATE_HOME = IS_WIN ? process.env.LOCALAPPDATA || join(HOME, "AppData", "Local") : process.env.XDG_STATE_HOME || join(HOME, ".local", "state");
6219
6219
  const STATE_DIR = process.env.EGO_LINUX_STATE_DIR || join(STATE_HOME, "ego-lite-linux");
6220
6220
  const BROWSER_STATE_FILE = join(STATE_DIR, "browser.json");
6221
- const CAST_STATE_FILE = join(STATE_DIR, "ego-cast.json");
6221
+ const CAST_STATE_FILE = join(STATE_DIR, "dsh-browser-cdp.cast.json");
6222
6222
  let castConfig = {
6223
6223
  captureBackend: "auto",
6224
6224
  streamProfile: "balanced",
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.1",
5
+ "version": "0.18.3",
6
6
  "manifestVersion": "0.15",
7
7
  "facets": {
8
8
  "host": {
package/lib/client.js CHANGED
@@ -281,7 +281,10 @@ var watchEn = {
281
281
  linksWriteFailed: "Save failed — the settings layer rejected this write",
282
282
  linksCliRemoteWarn: "Activating an ego CLI link under cdpMode=remote fails with mode-kind-mismatch",
283
283
  linksCliSdk: "Use bundled harness",
284
- linksDisabledHint: "Disabled — enable it before activating"
284
+ linksDisabledHint: "Disabled — enable it before activating",
285
+ linksActivate: "activate",
286
+ linksLocalRow: "Local Chrome (managed)",
287
+ linksLocalEnableHint: "Checked = auto mode may fall back to the managed local browser when the activated target is unreachable"
285
288
  };
286
289
  var watchDict = {
287
290
  en: watchEn,
@@ -364,7 +367,10 @@ var watchDict = {
364
367
  linksWriteFailed: "保存失败——设置层拒绝了这次写入",
365
368
  linksCliRemoteWarn: "cdpMode=remote 时激活 ego CLI 会报 mode-kind-mismatch",
366
369
  linksCliSdk: "使用内置 harness",
367
- linksDisabledHint: "已停用——先勾选启用才能激活"
370
+ linksDisabledHint: "已停用——先勾选启用才能激活",
371
+ linksActivate: "激活",
372
+ linksLocalRow: "本机 Chrome(受管启动)",
373
+ linksLocalEnableHint: "勾选 = 允许 auto 模式在激活目标不可达时回落本机启动"
368
374
  }
369
375
  };
370
376
  function wt(key, params = void 0) {
@@ -1545,6 +1551,7 @@ function FamLinks(props) {
1545
1551
  return;
1546
1552
  }
1547
1553
  writeLinks(res.links);
1554
+ if (activeId === "") scope.set("activeTargetId", res.links[res.links.length - 1].id);
1548
1555
  setAddLabel("");
1549
1556
  setAddEndpoint("");
1550
1557
  setErrText("");
@@ -1559,6 +1566,7 @@ function FamLinks(props) {
1559
1566
  return;
1560
1567
  }
1561
1568
  writeLinks(res.links);
1569
+ if (activeId === "") scope.set("activeTargetId", res.links[res.links.length - 1].id);
1562
1570
  setAddCliPath("");
1563
1571
  setErrText("");
1564
1572
  }
@@ -1588,6 +1596,47 @@ function FamLinks(props) {
1588
1596
  setProbingId("");
1589
1597
  });
1590
1598
  }
1599
+ var localActive = cdpMode === "local";
1600
+ var localRow = h("div", {
1601
+ key: "fam-links-local",
1602
+ style: {
1603
+ borderTop: "1px dashed var(--dsw-alias-border-l2, rgba(127,127,127,.18))",
1604
+ padding: "6px 0",
1605
+ display: "grid",
1606
+ gap: "4px"
1607
+ }
1608
+ }, h("div", { style: {
1609
+ display: "flex",
1610
+ alignItems: "center",
1611
+ gap: "8px",
1612
+ flexWrap: "wrap"
1613
+ } }, h("input", {
1614
+ type: "checkbox",
1615
+ checked: value.allowLocalFallback === true,
1616
+ disabled: !writable,
1617
+ title: wt("linksLocalEnableHint"),
1618
+ onChange: function(e) {
1619
+ scope.set("allowLocalFallback", e.target.checked);
1620
+ }
1621
+ }), h("span", { style: badgeStyle }, "LOCAL"), h("span", { style: {
1622
+ fontSize: "13px",
1623
+ color: "var(--dsw-alias-label-primary, inherit)",
1624
+ flex: "1 1 120px",
1625
+ overflow: "hidden",
1626
+ textOverflow: "ellipsis",
1627
+ whiteSpace: "nowrap"
1628
+ } }, wt("linksLocalRow")), localActive ? h("span", { style: {
1629
+ fontSize: "11px",
1630
+ color: "#30d158",
1631
+ flex: "0 0 auto"
1632
+ } }, wt("linksActive")) : h("button", {
1633
+ type: "button",
1634
+ disabled: !writable,
1635
+ style: btnStyle,
1636
+ onClick: function() {
1637
+ scope.set("cdpMode", "local");
1638
+ }
1639
+ }, wt("linksActivate"))));
1591
1640
  return h("div", { style: {
1592
1641
  borderTop: "1px solid var(--dsw-alias-border-l2, rgba(127,127,127,.25))",
1593
1642
  paddingTop: "6px",
@@ -1653,6 +1702,7 @@ function FamLinks(props) {
1653
1702
  style: btnStyle,
1654
1703
  onClick: function() {
1655
1704
  scope.set("activeTargetId", row.id);
1705
+ if (cdpMode === "local") scope.set("cdpMode", "auto");
1656
1706
  }
1657
1707
  }, wt("linksActivate"))), h("div", { style: {
1658
1708
  display: "flex",
@@ -1725,7 +1775,7 @@ function FamLinks(props) {
1725
1775
  color: "#ff9f0a",
1726
1776
  flex: "1 1 100%"
1727
1777
  } }, wt("linksCliRemoteWarn")) : null));
1728
- }), h("div", { style: {
1778
+ }), localRow, h("div", { style: {
1729
1779
  display: "grid",
1730
1780
  gap: "6px",
1731
1781
  paddingTop: "4px"
@@ -1964,6 +2014,7 @@ function mountFloatingWatch(ctx) {
1964
2014
  if (pickBtnEl) {
1965
2015
  pickBtnEl.textContent = pick === "failed" ? wt("pickFailed") : pick === "on" ? wt("picking") : wt("pickMode");
1966
2016
  pickBtnEl.classList.toggle("dsh-ego-pick-on", pick === "on");
2017
+ pickBtnEl.title = pick === "failed" ? message || "" : "";
1967
2018
  }
1968
2019
  }, function(el, a) {
1969
2020
  return deliverPickToConversation(ctx, el, a);
@@ -4211,7 +4262,7 @@ function EgoBrowserTab(props) {
4211
4262
  }, wt("backToLive")) : null, h("button", {
4212
4263
  className: "dsh-ego-side-back" + (state.pick === "on" ? " dsh-ego-pick-on" : ""),
4213
4264
  type: "button",
4214
- title: wt("pickModeHint"),
4265
+ title: state.pick === "failed" ? state.message || wt("pickFailed") : wt("pickModeHint"),
4215
4266
  onClick: function() {
4216
4267
  controller.togglePick();
4217
4268
  }
package/lib/index.js CHANGED
@@ -1566,7 +1566,7 @@ function getAttachEndpoint() {
1566
1566
  /**
1567
1567
  * Stop a running worker so the next request respawns it with the new argv
1568
1568
  * seed (T2.4: an activation change must take effect on a live panel, not only
1569
- * after a host restart). Kills only the pid WE spawned (per ego-cast.json) —
1569
+ * after a host restart). Kills only the pid WE spawned (per our namespaced state file) —
1570
1570
  * never a name-matched sweep, which previously took out the DSH subprocess
1571
1571
  * runner along with our own tree (issues #34 defect 2 / #40).
1572
1572
  */
@@ -1627,7 +1627,7 @@ function castStatePath() {
1627
1627
  const isWin = process.platform === "win32";
1628
1628
  const home = e.HOME || e.USERPROFILE || (isWin ? e.LOCALAPPDATA || "" : "/root");
1629
1629
  const stateHome = e.EGO_LINUX_STATE_DIR || (isWin ? e.LOCALAPPDATA || `${home}\\AppData\\Local` : e.XDG_STATE_HOME || `${home}/.local/state`);
1630
- return stateHome.endsWith("ego-lite-linux") ? `${stateHome}/ego-cast.json` : `${stateHome}/ego-lite-linux/ego-cast.json`;
1630
+ return stateHome.endsWith("ego-lite-linux") ? `${stateHome}/dsh-browser-cdp.cast.json` : `${stateHome}/ego-lite-linux/dsh-browser-cdp.cast.json`;
1631
1631
  }
1632
1632
  function sendJson(res, status, body) {
1633
1633
  const payload = JSON.stringify(body);
@@ -2437,7 +2437,7 @@ const Config$1 = z.object({
2437
2437
  cdpProbeTimeoutMs: z.number().min(200).max(3e4).step(100).description("Timeout for one CDP endpoint probe (http endpoints answer /json/version)."),
2438
2438
  cursorHud: z.boolean().description("Draw the agent cursor HUD into screenshots."),
2439
2439
  cursorName: z.string().description("Name label shown in the cursor HUD."),
2440
- allowLocalFallback: z.boolean().description("auto mode may fall back to launching a local browser when the activated target is unreachable. Off by default: the fallback must be explicit."),
2440
+ allowLocalFallback: z.boolean().description("auto mode may fall back to launching a local browser when the activated target is unreachable. Off by default: the fallback must be explicit.").volatile(),
2441
2441
  legacyEgoToolNames: z.boolean().description("ALSO register the tools under their old ego_* names for scripts written before the bcdp_* rename. Off by default; mutually exclusive with installing the upstream ego-browser plugin (same tool names)."),
2442
2442
  localHeadless: z.boolean().description("Run the locally launched browser headless."),
2443
2443
  remoteEnabled: z.boolean().description("Master switch for REMOTE attach. Off = the configured target sequence is preserved but inert (nothing probes or connects remotely); flip back on any time. Does not affect cdpMode=local.").volatile(),
@@ -7224,7 +7224,7 @@ function registerAuthFlush(ctx, cfg, reg) {
7224
7224
  const stateDir = e.EGO_LINUX_STATE_DIR || (isWin ? (e.LOCALAPPDATA || `${home}\\AppData\\Local`) + "\\ego-lite-linux" : `${e.XDG_STATE_HOME || `${home}/.local/state`}/ego-lite-linux`);
7225
7225
  let port = null;
7226
7226
  try {
7227
- const state = JSON.parse(await readFile$1(`${stateDir}/ego-cast.json`, "utf8"));
7227
+ const state = JSON.parse(await readFile$1(`${stateDir}/dsh-browser-cdp.cast.json`, "utf8"));
7228
7228
  port = typeof state.port === "number" ? state.port : null;
7229
7229
  } catch {
7230
7230
  port = null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-browser-cdp",
3
- "version": "0.18.1",
3
+ "version": "0.18.3",
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",