dsh-remote 0.8.87 → 0.8.89

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/lib/client.js CHANGED
@@ -2803,16 +2803,36 @@ window.__ModuleLoader__.load({
2803
2803
  )
2804
2804
  }
2805
2805
 
2806
+ // Issue #97: the layered Escape, one home for both owners. The host's
2807
+ // modal layer (when shipped) drives it for us — focus trap, autofocus,
2808
+ // focus restore and the IME-composition guard included; without it, our
2809
+ // document listener below does the same cascade. The mask stays OURS:
2810
+ // the host Modal's mask dismisses on bare click, which the autocomplete
2811
+ // re-layout would turn into a mid-gesture close (issue #52).
2812
+ const dismissLayered = React.useCallback(() => {
2813
+ if (mkdirPrompt) return // the mkdir prompt owns Escape while open
2814
+ if (popOpen) { setPopOpen(false); return }
2815
+ if (suggestOpen) { suggestSeqRef.current++; setSuggestOpen(false); return }
2816
+ if (!busy) onCancel()
2817
+ }, [mkdirPrompt, popOpen, suggestOpen, busy, onCancel])
2818
+ // Conditional on a MODULE-level constant → hook order is stable forever.
2819
+ // The layer keeps a stack per document: the mkdir prompt's own Modal sits
2820
+ // above ours while open, so nested Escape reaches it first.
2821
+ const pickerLayerRef = React.useRef(null)
2822
+ if (useModalLayerFn) {
2823
+ try { useModalLayerFn(pickerLayerRef, open, dismissLayered) } catch { /* a partial face degrades to our own listener */ }
2824
+ }
2825
+
2806
2826
  React.useEffect(() => {
2807
2827
  if (!open) return
2808
2828
  try {
2809
2829
  if (typeof document === 'undefined') return
2810
2830
  const onKey = (e) => {
2811
- if (mkdirPrompt) return
2812
- if (e.key === 'Escape') {
2813
- if (popOpen) { e.preventDefault(); setPopOpen(false); return }
2814
- if (suggestOpen) { e.preventDefault(); suggestSeqRef.current++; setSuggestOpen(false); return }
2815
- if (!busy) { e.preventDefault(); onCancel() }
2831
+ // The host modal layer owns Escape when present (composition-safe,
2832
+ // focus-aware); ours only handles it where the layer is absent.
2833
+ if (!useModalLayerFn && e.key === 'Escape') {
2834
+ e.preventDefault()
2835
+ dismissLayered()
2816
2836
  return
2817
2837
  }
2818
2838
  if (e.key === 'Enter' && (e.metaKey || e.ctrlKey)) {
@@ -2824,7 +2844,7 @@ window.__ModuleLoader__.load({
2824
2844
  document.addEventListener('keydown', onKey)
2825
2845
  return () => document.removeEventListener('keydown', onKey)
2826
2846
  } catch { return undefined }
2827
- }, [open, busy, tab, path, machineId, popOpen, suggestOpen, mkdirPrompt])
2847
+ }, [open, busy, tab, path, machineId, popOpen, suggestOpen, mkdirPrompt, dismissLayered])
2828
2848
 
2829
2849
  if (!open) return null
2830
2850
  const tabBtn = (t, lbl) => React.createElement('button', {
@@ -2834,6 +2854,7 @@ window.__ModuleLoader__.load({
2834
2854
  style: { ...buttonS, fontWeight: tab === t ? 700 : 400, padding: '5px 14px' },
2835
2855
  }, lbl)
2836
2856
  return portalize(React.createElement('div', {
2857
+ ref: pickerLayerRef,
2837
2858
  style: { position: 'fixed', inset: 0, zIndex: 9999, background: 'rgba(0,0,0,0.5)', display: 'flex', alignItems: 'center', justifyContent: 'center', padding: 16 },
2838
2859
  onMouseDown: backdrop.onMouseDown,
2839
2860
  // Issue #52 defect 1: this was a bare onClick, so picking an autocomplete
@@ -2869,7 +2890,7 @@ window.__ModuleLoader__.load({
2869
2890
  ? React.createElement('div', { style: { display: 'flex', flexDirection: 'column', gap: 8 } },
2870
2891
  React.createElement('div', { style: { fontSize: 12, opacity: 0.8, lineHeight: 1.5 } }, tr('picker.localIntro')),
2871
2892
  React.createElement('div', { style: { display: 'flex', gap: 6 } },
2872
- React.createElement('input', { className: 'dsh-rw-input', value: path, onChange: (e) => setPath(e.target.value), onKeyDown: (e) => { if (e.key === 'Enter' && path.trim()) { e.preventDefault(); onPicked(path) } }, placeholder: tr('picker.localPlaceholder'), style: inputS }),
2893
+ React.createElement('input', { className: 'dsh-rw-input', value: path, onChange: (e) => setPath(e.target.value), onKeyDown: (e) => { if (e.key === 'Enter' && path.trim()) { e.preventDefault(); onPicked(path) } }, placeholder: tr('picker.localPlaceholder'), 'data-modal-autofocus': true, style: inputS }),
2873
2894
  React.createElement('button', { type: 'button', className: 'dsh-rw-btn dsh-rw-primary', style: primaryBtnS, onClick: () => (path.trim() ? onPicked(path) : undefined), disabled: !path.trim() }, tr('picker.useLocalPath')),
2874
2895
  ),
2875
2896
  React.createElement('button', { type: 'button', className: 'dsh-rw-btn', style: { ...buttonS, alignSelf: 'flex-start' }, onClick: chooseLocal, disabled: loading }, loading ? tr('picker.opening') : tr('picker.openSysPicker')),
@@ -2910,7 +2931,7 @@ window.__ModuleLoader__.load({
2910
2931
  }
2911
2932
  },
2912
2933
  placeholder: (machineId ? (win ? tr('picker.pathPlaceholderWin') : tr('picker.pathPlaceholder')) : tr('picker.chooseMachineFirst')),
2913
- disabled: !machineId, style: { ...inputS, flex: 1, minWidth: 120 },
2934
+ disabled: !machineId, 'data-modal-autofocus': true, style: { ...inputS, flex: 1, minWidth: 120 },
2914
2935
  }),
2915
2936
  React.createElement('button', { type: 'button', className: 'dsh-rw-btn', style: { ...buttonS, whiteSpace: 'nowrap' }, onClick: () => { if (!machineId) return; const p = path.trim(); loadLevels(machineId, p || '', 0); setPopOpen(true) }, disabled: !machineId }, tr('picker.browse')),
2916
2937
  React.createElement('button', { type: 'button', className: 'dsh-rw-btn', style: { ...buttonS, whiteSpace: 'nowrap' }, onClick: pickHome, disabled: !machineId }, tr('picker.home')),
package/lib/index.js CHANGED
@@ -55,7 +55,7 @@ import { formatAuditLine, readAuditLines } from './audit.js'
55
55
  import { openLocalFolder } from './open-folder.js'
56
56
 
57
57
  import { selfDir, diskVersion, LOADED_VERSION, gtVersion, fetchLatestVersion, applyUpdate, persistUpdateMode, readUpdateMode, reloadSelf, scheduleSelfReload, lastSelfReload, isInstalledCopy, writeFileAtomic } from './update.js'
58
- import { sendHeartbeat, pseudonym, heartbeatUrl, hasPersistedId, installIdPath, telemetryAllowed, persistTelemetryOpt } from './telemetry.js'
58
+ import { sendHeartbeat, pseudonym, heartbeatUrl, heartbeatEnabled, hasPersistedId, installIdPath, telemetryAllowed, persistTelemetryOpt } from './telemetry.js'
59
59
  import { loadMachines as _loadMachines, saveMachines as _saveMachines, sanitizeMachine as _sanitizeMachine, applyMachine as _applyMachine, machineId as _machineId, normalizeMachineGroup, filterMachinesByGroup, resolveProbeCredentials } from './registry.js'
60
60
  import { registerHttpTransports } from './http-transport.js'
61
61
  import { createHostApi } from './host-api.js'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-remote",
3
- "version": "0.8.87",
3
+ "version": "0.8.89",
4
4
  "description": "Remote-work assistant for DeepSeek Harness: connect SSH (password/key/agent/keyboard-interactive, multi-hop ProxyJump), list hosts from ~/.ssh/config, pick a remote workspace, operate on it with 21 rw_* tools, conflict-aware mirror sync, an embedded PTY terminal, remote DSH web UI attach, port forwarding, host grouping, remote sandbox fencing, audit log, keychain passwords.",
5
5
  "license": "MIT",
6
6
  "author": "flymysql <flyphp@outlook.com>",