dsh-remote 0.7.0 → 0.7.1

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 +43 -1
  2. package/package.json +1 -1
package/lib/client.js CHANGED
@@ -516,7 +516,18 @@ window.__ModuleLoader__.load({
516
516
  const refreshStatus = () => {
517
517
  fetchRemoteStatus().then((s) => {
518
518
  setStatus(s)
519
- if (s && s.workspace) setLevels((prev) => (prev.length ? prev : [{ path: s.workspace, items: null }]))
519
+ if (s && s.workspace) {
520
+ setLevels((prev) => {
521
+ // First open with a workspace: seed the root level AND load it,
522
+ // so the tree shows the remote listing immediately instead of
523
+ // an empty "(空目录)" until the user hits ↻.
524
+ if (!prev.length) {
525
+ loadDir(s.workspace, 0)
526
+ return [{ path: s.workspace, items: null }]
527
+ }
528
+ return prev
529
+ })
530
+ }
520
531
  })
521
532
  }
522
533
  React.useEffect(() => { refreshStatus() }, [])
@@ -684,6 +695,37 @@ window.__ModuleLoader__.load({
684
695
  disposers.forEach((d) => { try { d() } catch {} })
685
696
  return
686
697
  }
698
+ // When a remote workspace is already configured, auto-open the remote
699
+ // explorer tab so the sidebar shows REMOTE files (not the local mirror
700
+ // tree the built-in Files tab lists). openTab with a path seed expands
701
+ // the panel and lands the tab in the active pane (the right panel);
702
+ // on the single:true explorer descriptor a repeat open focuses it.
703
+ //
704
+ // Timing: at plugin apply there is usually no active session yet, so
705
+ // openTab would be a no-op (store.reduce without a session). Subscribe
706
+ // to the sidebar snapshot and open the FIRST time a session appears;
707
+ // the subscription is also the cleanup channel for the auto-open fiber.
708
+ let autoOpened = false
709
+ let disposeAuto = null
710
+ const tryAutoOpen = () => {
711
+ if (autoOpened || typeof bs.subscribeState !== 'function') return
712
+ const snap = bs.getSnapshot && bs.getSnapshot()
713
+ if (!snap || !snap.sessionId) return
714
+ fetchRemoteStatus().then((s) => {
715
+ if (!s || !s.workspace || autoOpened) return
716
+ autoOpened = true
717
+ try {
718
+ bs.openTab({ type: SIDEBAR_EXPLORER_ID, title: '远程文件', path: s.workspace })
719
+ } catch (e2) {
720
+ console.warn('[dsh-remote] better-sidebar auto-open skipped:', e2)
721
+ }
722
+ })
723
+ }
724
+ tryAutoOpen()
725
+ if (typeof bs.subscribeState === 'function') {
726
+ disposeAuto = bs.subscribeState(tryAutoOpen)
727
+ disposers.push(disposeAuto)
728
+ }
687
729
  return () => disposers.forEach((d) => { try { d() } catch {} })
688
730
  }
689
731
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-remote",
3
- "version": "0.7.0",
3
+ "version": "0.7.1",
4
4
  "description": "Remote-work assistant for DeepSeek Harness: connect SSH (password or key), pick a remote workspace, operate on it with rw_pick_workspace / rw_list_dir / rw_read_file / rw_exec / rw_sync tools, and mirror it to a real local directory (SFTP) so the DSH native workspace can adopt it.",
5
5
  "license": "MIT",
6
6
  "author": "flymysql <flyphp@outlook.com>",