dsh-remote 0.4.0 → 0.4.2

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 +19 -7
  2. package/package.json +1 -1
package/lib/client.js CHANGED
@@ -66,6 +66,7 @@ window.__ModuleLoader__.load({
66
66
  }).then((r) => { refresh(); setForm({ name: '', host: '', port: '22', username: 'root', password: '', privateKeyPath: '', id: '' }); setMsg(form.id ? '已保存更新' : '已添加 — 可设为当前') }).catch((e) => setErr(String((e && e.message) || e))).finally(() => setBusy(false))
67
67
  }
68
68
  const useNow = (id) => { setBusy(true); api('POST', '/dsh-remote/current', { id }).then((r) => { setCurrentId(r.currentId); setMsg('已切换为当前远程机') }).catch((e) => setErr(String((e && e.message) || e))).finally(() => setBusy(false)) }
69
+ const del = (id) => { if (window.confirm('确定删除这台机器?')) { api('POST', '/dsh-remote/machines', { action: 'delete', id }).then(refresh).then(() => setMsg('已删除')).catch((e) => setErr(String((e && e.message) || e))) } }
69
70
 
70
71
  const row = (label, ctrl, k) => React.createElement('div', { key: k, style: { display: 'flex', gap: 6, alignItems: 'center' } },
71
72
  React.createElement('label', { style: { width: 76, fontSize: 12, opacity: 0.8 } }, label), ctrl)
@@ -84,6 +85,7 @@ window.__ModuleLoader__.load({
84
85
  m.passwordSet ? ' 🔒' : '',
85
86
  m.id === currentId ? React.createElement('span', { style: { color: T.ok, fontSize: 12 } }, ' · 当前') : null),
86
87
  React.createElement('button', { style: buttonS, onClick: () => startEdit(m) }, '编辑'),
88
+ React.createElement('button', { style: buttonS, onClick: () => del(m.id) }, '删除'),
87
89
  React.createElement('button', { style: buttonS, onClick: () => useNow(m.id), disabled: m.id === currentId }, '设为当前')))
88
90
  : React.createElement('div', { style: { opacity: 0.6, fontSize: 12 } }, '还没有机器。在下方添加。'),
89
91
  ),
@@ -110,11 +112,16 @@ window.__ModuleLoader__.load({
110
112
  function parseLs(text) {
111
113
  const out = []
112
114
  for (const ln of String(text || '').split('\n')) {
113
- const m = ln.match(/^(d[-r][rwx-]{9})\s+[^ ]+\s+[^ ]+\s+[^ ]+\s+[^ ]+\s+\d{4}-\d{2}-\d{2}([T ]+\S+)?\s+(.+)$/)
114
- if (!m) continue
115
- out.push((m[1].charAt(0) === 'd' ? '📁' : '📄') + m[3])
115
+ const t = ln.trim()
116
+ if (!t || !t.length || /^total\b/i.test(t)) continue
117
+ const parts = t.split(/\s+/).filter(Boolean)
118
+ if (parts.length < 2) continue
119
+ const mode = parts[0]
120
+ const name = parts[parts.length - 1]
121
+ if (name === '.' || name === '..') continue
122
+ const isDirL = mode.charAt(0) === 'd'
123
+ out.push((isDirL ? '📁' : '📄') + name)
116
124
  }
117
- if (!out.length && String(text || '').trim()) out.push(...String(text).trim().split('\n').slice(1).map((l) => '📄 ' + l.trim()).filter(Boolean))
118
125
  return out
119
126
  }
120
127
 
@@ -175,8 +182,13 @@ window.__ModuleLoader__.load({
175
182
  ),
176
183
  tab === 'local'
177
184
  ? React.createElement('div', { style: { display: 'flex', flexDirection: 'column', gap: 8 } },
178
- React.createElement('div', { style: { fontSize: 12, opacity: 0.8 } }, '点击按钮打开系统文件夹选择器,选中本地目录即作为本地工作区。'),
179
- React.createElement('button', { style: buttonS, onClick: chooseLocal, disabled: loading }, '打开系统文件夹选择器'),
185
+ React.createElement('div', { style: { fontSize: 12, opacity: 0.8 } }, '系统选择器优先;不可用时直接输入本机目录。'),
186
+ React.createElement('div', { style: { display: 'flex', gap: 6 } },
187
+ React.createElement('input', { value: path, onChange: (e) => setPath(e.target.value), placeholder: '本机目录,如 C:\\Users\\you\\project', style: inputS }),
188
+ React.createElement('button', { style: buttonS, onClick: () => (path.trim() ? onPicked(path) : undefined), disabled: !path.trim() }, '选用此本地路径'),
189
+ ),
190
+ React.createElement('button', { style: { ...buttonS, alignSelf: 'flex-start' }, onClick: chooseLocal, disabled: loading }, loading ? '打开中…' : '打开系统文件夹选择器'),
191
+ err ? React.createElement('div', { style: { color: T.danger, fontSize: 12 } }, err) : null,
180
192
  )
181
193
  : React.createElement('div', { style: { display: 'flex', flexDirection: 'column', gap: 8 } },
182
194
  React.createElement('div', { style: { display: 'flex', gap: 6, alignItems: 'center' } },
@@ -208,7 +220,7 @@ window.__ModuleLoader__.load({
208
220
  function apply(ctx) {
209
221
  const slots = ctx.get('slots')
210
222
  if (slots === undefined) return
211
- WORKSPACES = (ctx && ctx.get && ctx.get('workspaces')) || null
223
+ WORKSPACES = (ctx && ((ctx.get && ctx.get('workspaces')) || ctx.workspaces)) || null
212
224
  slots.inject('settings.section', () =>
213
225
  slots.register({ name: 'settings.section', id: 'dsh-remote', priority: 40, label: () => '远程工作区' }, () => React.createElement(RemoteWorkspacePage, null)),
214
226
  )
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-remote",
3
- "version": "0.4.0",
3
+ "version": "0.4.2",
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",