dsh-remote 0.4.2 → 0.4.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.
package/lib/client.js CHANGED
@@ -138,14 +138,15 @@ window.__ModuleLoader__.load({
138
138
  React.useEffect(() => { if (open) { api('GET', '/dsh-remote/machines').then((r) => { setMachines(r.machines || []); setMachineId(r.currentId || (r.machines && r.machines[0] && r.machines[0].id) || '') }) } }, [open])
139
139
 
140
140
  const chooseLocal = () => {
141
- const w = WORKSPACES || {}
142
- const pick = w.pickDirectory || w.openDirectory || w.pickPath
143
- if (typeof pick === 'function') {
144
- setLoading(true); setErr('')
145
- Promise.resolve(pick()).then((p) => { if (p) onPicked(String(p)); }).catch((e) => setErr(String((e && e.message) || e))).finally(() => setLoading(false))
146
- } else {
147
- setErr('本机系统选择器不可用,请在对话框中输入本机路径或使用远程tab')
148
- }
141
+ setLoading(true); setErr('')
142
+ api('POST', '/dsh-remote/local-pick')
143
+ .then((r) => {
144
+ if (r && r.path) onPicked(String(r.path))
145
+ else if (r && r.cancelled) setErr('已取消选择')
146
+ else setErr((r && r.error) || '无法打开系统文件夹选择器,可直接在输入框填本地路径')
147
+ })
148
+ .catch((e) => setErr(String((e && e.message) || e) + ' — 可直接在输入框填本地路径'))
149
+ .finally(() => setLoading(false))
149
150
  }
150
151
 
151
152
  const switchTab = (t) => { setTab(t); setErr(''); if (t === 'remote' && machineId) loadRemote(machineId, '') }
package/lib/index.js CHANGED
@@ -824,6 +824,22 @@ export async function apply(ctx, config) {
824
824
  }
825
825
  },
826
826
  },
827
+ {
828
+ kind: 'exact',
829
+ path: '/dsh-remote/local-pick',
830
+ handler: async (req, res) => {
831
+ if (req.method !== 'POST') return sendJson(res, 405, { ok: false, error: 'method not allowed' })
832
+ try {
833
+ const dp = (ctx && ctx.get && ctx.get('directoryPicker')) || (ctx && ctx.directoryPicker) || null
834
+ if (!dp || typeof dp.pick !== 'function') return sendJson(res, 400, { ok: false, error: '本地目录选择器不可用(本机需 DSH 原生 directory-picker backend)' })
835
+ const picked = await Promise.resolve(dp.pick())
836
+ if (!picked || typeof picked !== 'string') return sendJson(res, 200, { ok: true, cancelled: true })
837
+ return sendJson(res, 200, { ok: true, path: picked })
838
+ } catch (err) {
839
+ return sendJson(res, 500, { ok: false, error: String((err && err.message) || err) })
840
+ }
841
+ },
842
+ },
827
843
  {
828
844
  kind: 'exact',
829
845
  path: '/dsh-remote/machines',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-remote",
3
- "version": "0.4.2",
3
+ "version": "0.4.3",
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
  "keywords": [
6
6
  "deepseek-harness",