dsh-browser-cdp 0.17.1 → 0.17.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.
Files changed (2) hide show
  1. package/lib/client.js +93 -2
  2. package/package.json +4 -4
package/lib/client.js CHANGED
@@ -85,7 +85,12 @@ var watchEn = {
85
85
  captured: "Captured",
86
86
  fabTitle: "Agent Browser live view",
87
87
  settingsTitle: "Show settings",
88
- settingsHide: "Hide settings"
88
+ settingsHide: "Hide settings",
89
+ famTitle: "CDP Browser",
90
+ famIsolate: "Space isolation",
91
+ famIsolateDesc: "Off = persistent profile (logins survive restarts); on = isolated sandbox",
92
+ famIdle: "Auto-stop idle browser (minutes, 0 = off)",
93
+ famIdleDesc: "Stops the backing browser after N minutes without a bcdp_* call; relaunches on demand"
89
94
  };
90
95
  var watchDict = {
91
96
  en: watchEn,
@@ -138,7 +143,12 @@ var watchDict = {
138
143
  captured: "已接管",
139
144
  fabTitle: "CDP 浏览器实时视图",
140
145
  settingsTitle: "展开设置",
141
- settingsHide: "收起设置"
146
+ settingsHide: "收起设置",
147
+ famTitle: "CDP 浏览器",
148
+ famIsolate: "空间隔离",
149
+ famIsolateDesc: "关 = 持久化配置(重启保留登录态);开 = 每次隔离沙箱",
150
+ famIdle: "空闲自动停止(分钟,0 = 不停)",
151
+ famIdleDesc: "超过 N 分钟没有 bcdp_* 调用即停止后台浏览器,下次调用按需重启"
142
152
  }
143
153
  };
144
154
  function wt(key, params = void 0) {
@@ -663,7 +673,88 @@ const ICON_REFRESH = `<svg width="15" height="15" viewBox="0 0 24 24" fill="none
663
673
  const ICON_CLOCK = `<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round"><circle cx="12" cy="12" r="9"/><path d="M12 7.5V12l3 2"/></svg>`;
664
674
  const ICON_CLOSE = `<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round"><path d="M6 6l12 12M18 6L6 18"/></svg>`;
665
675
  const ICON_GRIP = `<svg width="14" height="14" viewBox="0 0 24 24" fill="currentColor"><circle cx="8" cy="6" r="1.8"/><circle cx="16" cy="6" r="1.8"/><circle cx="8" cy="12" r="1.8"/><circle cx="16" cy="12" r="1.8"/><circle cx="8" cy="18" r="1.8"/><circle cx="16" cy="18" r="1.8"/></svg>`;
676
+ function mountFamilySettingsCard(ctx) {
677
+ var forms = typeof ctx.get === "function" ? ctx.get("configForms") : void 0;
678
+ if (!forms || typeof forms.get !== "function") return;
679
+ var scope = forms.get("dsh-browser-cdp");
680
+ ctx.slots.inject("dsh-family.tab", function() {
681
+ return ctx.slots.register({
682
+ name: "dsh-family.tab",
683
+ id: "dsh-browser-cdp",
684
+ order: 35,
685
+ label: function() {
686
+ return wt("famTitle");
687
+ },
688
+ inject: function() {
689
+ return { scope };
690
+ }
691
+ }, FamilySettingsCard);
692
+ }, "dsh-browser-cdp: family settings tab");
693
+ }
694
+ function FamilySettingsCard(props) {
695
+ var scope = props.scope;
696
+ var snapshot = React.useSyncExternalStore(function(listener) {
697
+ return scope.subscribe(listener);
698
+ }, function() {
699
+ return scope.getSnapshot();
700
+ });
701
+ var value = snapshot.value || {};
702
+ var writable = snapshot.writable === true;
703
+ var h = React.createElement;
704
+ var rowStyle = {
705
+ display: "flex",
706
+ alignItems: "center",
707
+ justifyContent: "space-between",
708
+ gap: "12px",
709
+ padding: "8px 0"
710
+ };
711
+ var textCol = {
712
+ display: "flex",
713
+ flexDirection: "column",
714
+ gap: "2px"
715
+ };
716
+ var titleStyle = {
717
+ fontSize: "13px",
718
+ color: "var(--dsw-alias-label-primary, inherit)"
719
+ };
720
+ var descStyle = {
721
+ fontSize: "12px",
722
+ color: "var(--dsw-alias-label-tertiary, rgba(127,127,127,.8))",
723
+ lineHeight: 1.5
724
+ };
725
+ var idleDraft = React.useState(typeof value.idleTimeoutMin === "number" ? value.idleTimeoutMin : 0);
726
+ var idle = idleDraft[0], setIdle = idleDraft[1];
727
+ React.useEffect(function() {
728
+ setIdle(typeof value.idleTimeoutMin === "number" ? value.idleTimeoutMin : 0);
729
+ }, [value.idleTimeoutMin]);
730
+ return h("div", { style: {
731
+ display: "grid",
732
+ gap: "4px"
733
+ } }, h("div", { style: rowStyle }, h("div", { style: textCol }, h("span", { style: titleStyle }, wt("famIsolate")), h("span", { style: descStyle }, wt("famIsolateDesc"))), h("input", {
734
+ type: "checkbox",
735
+ checked: value.isolateSpaces === true,
736
+ disabled: !writable,
737
+ onChange: function(e) {
738
+ scope.set("isolateSpaces", e.target.checked);
739
+ }
740
+ })), h("div", { style: rowStyle }, h("div", { style: textCol }, h("span", { style: titleStyle }, wt("famIdle")), h("span", { style: descStyle }, wt("famIdleDesc"))), h("input", {
741
+ type: "number",
742
+ min: 0,
743
+ max: 1440,
744
+ value: idle,
745
+ disabled: !writable,
746
+ style: { width: "72px" },
747
+ onChange: function(e) {
748
+ setIdle(e.target.value === "" ? 0 : Number(e.target.value));
749
+ },
750
+ onBlur: function(e) {
751
+ var n = Math.max(0, Math.min(1440, Math.round(Number(e.target.value) || 0)));
752
+ scope.set("idleTimeoutMin", n);
753
+ }
754
+ })));
755
+ }
666
756
  function apply(ctx) {
757
+ mountFamilySettingsCard(ctx);
667
758
  var betterSidebarService;
668
759
  try {
669
760
  betterSidebarService = typeof ctx.get === "function" ? ctx.get("betterSidebar") : void 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-browser-cdp",
3
- "version": "0.17.1",
3
+ "version": "0.17.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.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",
@@ -21,7 +21,7 @@
21
21
  ],
22
22
  "dsh": {
23
23
  "engines": {
24
- "dsh": ">=0.1.7-rc.1 <0.2.0-0"
24
+ "dsh": ">=0.1.7-rc.1 <0.1.8-0"
25
25
  },
26
26
  "bundle": {
27
27
  "patch": "./cordis.patch.yml"
@@ -45,7 +45,7 @@
45
45
  "@deepseek-ai/dsh-client-ui-settings-plugins": ">=0.1.7-rc.1 <0.1.8-0",
46
46
  "@deepseek-ai/dsh-client-ui-slots": ">=0.1.7-rc.1 <0.1.8-0",
47
47
  "@deepseek-ai/dsh-settings": ">=0.1.7-rc.1 <0.1.8-0",
48
- "@deepseek-ai/dsh-tools": ">=0.1.7-rc.1 <0.2.0-0",
48
+ "@deepseek-ai/dsh-tools": ">=0.1.7-rc.1 <0.1.8-0",
49
49
  "react": "^18.2.0"
50
50
  },
51
51
  "peerDependenciesMeta": {
@@ -73,7 +73,7 @@
73
73
  },
74
74
  "devDependencies": {
75
75
  "@deepseek-ai/cosmokit": "^1.8.5",
76
- "@deepseek-ai/dsh-tools": ">=0.1.7-rc.1 <0.2.0-0",
76
+ "@deepseek-ai/dsh-tools": ">=0.1.7-rc.1 <0.1.8-0",
77
77
  "@types/node": "^22.20.1",
78
78
  "@types/react": "~18.3.31",
79
79
  "@types/ws": "^8.5.10",