dsh-remote-vs 0.24.0 → 0.26.0

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 (125) hide show
  1. package/README.en.md +50 -16
  2. package/README.md +40 -15
  3. package/THIRD-PARTY-NOTICES.md +188 -0
  4. package/lib/client.js +6512 -77887
  5. package/lib/index.js +1461 -1024
  6. package/lib/p2-router-fs.js +1 -1
  7. package/lib/types/client/CodeEditor.d.ts +25 -0
  8. package/lib/types/client/EditorPane.d.ts +16 -5
  9. package/lib/types/client/FloatingPlaceholder.d.ts +16 -5
  10. package/lib/types/client/RemoteEditorView.d.ts +13 -10
  11. package/lib/types/client/RemoteExplorer.d.ts +53 -0
  12. package/lib/types/client/RemoteRoot.d.ts +5 -5
  13. package/lib/types/client/TerminalSnippets.d.ts +36 -0
  14. package/lib/types/client/TerminalView.d.ts +1 -1
  15. package/lib/types/client/XTerm.d.ts +33 -0
  16. package/lib/types/client/api.d.ts +37 -2
  17. package/lib/types/client/changes/review-state.d.ts +19 -0
  18. package/lib/types/client/connection.d.ts +16 -0
  19. package/lib/types/client/editor-capability.d.ts +27 -0
  20. package/lib/types/client/i18n.d.ts +1 -1
  21. package/lib/types/client/request-gate.d.ts +110 -0
  22. package/lib/types/client/scm/DiffView.d.ts +45 -7
  23. package/lib/types/client/scm/actions.d.ts +31 -3
  24. package/lib/types/client/store.d.ts +112 -4
  25. package/lib/types/client/terminal-input.d.ts +23 -0
  26. package/lib/types/client/terminal-snippets.d.ts +86 -0
  27. package/lib/types/client/vsc/FindWidget.d.ts +6 -0
  28. package/lib/types/client/vsc/breadcrumb.d.ts +30 -0
  29. package/lib/types/client/vsc/change-marks.d.ts +16 -6
  30. package/lib/types/client/vsc/editor-caret.d.ts +32 -0
  31. package/lib/types/client/vsc/editor-keymap.d.ts +35 -1
  32. package/lib/types/client/vsc/editor-langs.d.ts +9 -0
  33. package/lib/types/client/vsc/editor-settings.d.ts +55 -0
  34. package/lib/types/client/vsc/image-preview.d.ts +36 -0
  35. package/lib/types/client/vsc/kit.d.ts +13 -0
  36. package/lib/types/client/vsc/save-shortcut.d.ts +21 -0
  37. package/lib/types/client/vsc/terminal-clipboard.d.ts +15 -0
  38. package/lib/types/client/vsc/terminal-line.d.ts +25 -0
  39. package/lib/types/client/vsc/terminal-links.d.ts +62 -0
  40. package/lib/types/client/vsc/terminal-theme.d.ts +48 -0
  41. package/lib/types/client/vsc/terminal-writer.d.ts +52 -0
  42. package/lib/types/forward.d.ts +12 -0
  43. package/lib/types/fs-ops.d.ts +42 -0
  44. package/lib/types/http.d.ts +2 -0
  45. package/lib/types/keygen.d.ts +9 -0
  46. package/lib/types/monitor.d.ts +8 -0
  47. package/lib/types/notices.d.ts +16 -1
  48. package/lib/types/p2/helper-rpc.d.ts +45 -0
  49. package/lib/types/pool.d.ts +25 -0
  50. package/lib/types/routes.d.ts +2 -0
  51. package/lib/types/store.d.ts +7 -0
  52. package/lib/types/terminal.d.ts +33 -1
  53. package/lib/types/view-settings.d.ts +5 -0
  54. package/lib/{worlds-B7gEDBzC.js → worlds-RG8K5eom.js} +113 -15
  55. package/package.json +2 -1
  56. package/src/client/CodeEditor.tsx +205 -10
  57. package/src/client/DirectoryFlow.tsx +16 -0
  58. package/src/client/DoctorPanel.tsx +70 -7
  59. package/src/client/EditorPane.tsx +545 -118
  60. package/src/client/FloatingPlaceholder.tsx +34 -5
  61. package/src/client/HostsView.tsx +12 -3
  62. package/src/client/RemoteDirectoryPicker.tsx +12 -0
  63. package/src/client/RemoteEditorView.tsx +14 -11
  64. package/src/client/RemoteExplorer.tsx +929 -40
  65. package/src/client/RemoteRoot.tsx +167 -147
  66. package/src/client/SearchView.tsx +8 -0
  67. package/src/client/TerminalSnippets.tsx +432 -0
  68. package/src/client/TerminalView.tsx +50 -1
  69. package/src/client/XTerm.tsx +228 -58
  70. package/src/client/api.ts +106 -13
  71. package/src/client/auto-open-remote.ts +11 -9
  72. package/src/client/changes/ChangesDock.tsx +188 -6
  73. package/src/client/changes/changes.css +10 -3
  74. package/src/client/changes/review-state.ts +34 -0
  75. package/src/client/connection.ts +29 -0
  76. package/src/client/downloads.ts +49 -4
  77. package/src/client/editor-capability.ts +42 -0
  78. package/src/client/i18n.ts +228 -12
  79. package/src/client/index.tsx +22 -6
  80. package/src/client/request-gate.ts +221 -0
  81. package/src/client/scm/CommitPane.tsx +20 -2
  82. package/src/client/scm/DiffView.tsx +343 -117
  83. package/src/client/scm/HistoryPanel.tsx +23 -2
  84. package/src/client/scm/RepoPicker.tsx +1 -1
  85. package/src/client/scm/ScmPanel.tsx +391 -87
  86. package/src/client/scm/actions.ts +95 -12
  87. package/src/client/store.tsx +537 -22
  88. package/src/client/terminal-input.ts +44 -0
  89. package/src/client/terminal-snippets.ts +216 -0
  90. package/src/client/ui.tsx +4 -0
  91. package/src/client/vsc/FindWidget.tsx +24 -9
  92. package/src/client/vsc/breadcrumb.tsx +339 -0
  93. package/src/client/vsc/change-marks.ts +93 -44
  94. package/src/client/vsc/editor-caret.ts +30 -0
  95. package/src/client/vsc/editor-keymap.ts +59 -1
  96. package/src/client/vsc/editor-langs.ts +20 -0
  97. package/src/client/vsc/editor-settings.ts +146 -0
  98. package/src/client/vsc/editor-theme.ts +4 -5
  99. package/src/client/vsc/file-icons.tsx +17 -3
  100. package/src/client/vsc/image-preview.tsx +110 -0
  101. package/src/client/vsc/kit.tsx +46 -10
  102. package/src/client/vsc/save-shortcut.ts +47 -1
  103. package/src/client/vsc/terminal-clipboard.ts +19 -0
  104. package/src/client/vsc/terminal-line.ts +101 -0
  105. package/src/client/vsc/terminal-links.ts +166 -0
  106. package/src/client/vsc/terminal-theme.ts +97 -0
  107. package/src/client/vsc/terminal-writer.ts +112 -0
  108. package/src/client/vsc/vsc.css +1078 -181
  109. package/src/forward.ts +47 -9
  110. package/src/fs-ops.ts +124 -4
  111. package/src/git-ops.ts +20 -3
  112. package/src/http.ts +35 -4
  113. package/src/keygen.ts +55 -4
  114. package/src/monitor.ts +13 -0
  115. package/src/notices.ts +23 -1
  116. package/src/p2/helper-rpc.ts +113 -7
  117. package/src/p2/worlds.ts +14 -1
  118. package/src/pool.ts +99 -27
  119. package/src/routes.ts +212 -43
  120. package/src/sftp.ts +51 -14
  121. package/src/store.ts +10 -0
  122. package/src/terminal.ts +225 -24
  123. package/src/view-settings.ts +50 -10
  124. package/lib/types/client/Dialog.d.ts +0 -14
  125. package/src/client/Dialog.tsx +0 -76
@@ -1,17 +1,46 @@
1
1
  /**
2
2
  * What the centre conversation view and the sidebar fallback show while the
3
- * editor is popped out: the editor itself is a single instance and lives in the
4
- * floating window, so these surfaces must not mount a second one (that would
5
- * be two live CodeMirror buffers for one tab — the exact defect `EditorPane`'s
6
- * header warns about). A dock button keeps the surface from looking broken.
3
+ * editor lives somewhere else: the editor itself is a single instance, so these
4
+ * surfaces must not mount a second one (that would be two live CodeMirror
5
+ * buffers for one tab — the exact defect `EditorPane`'s header warns about).
6
+ *
7
+ * Three such places exist now that the DOCKED sidebar pane is the default seat:
8
+ * - `float`: the editor is popped out into the frame-wide window;
9
+ * - `sidebar`: the editor is docked in the sidebar column, and the
10
+ * conversation-view tab is only its optional full-width seat;
11
+ * - `center`: the reverse — the conversation tab owns the editor, and the
12
+ * sidebar's editor page explains how to bring it back.
13
+ * A button per mode keeps the surface from looking broken.
7
14
  */
8
15
  import type { ReactNode } from 'react'
9
16
  import { useExplorer } from './store.tsx'
10
17
  import { Btn } from './ui.tsx'
11
18
 
12
- export function FloatingEditorPlaceholder(): ReactNode {
19
+ /** Which seat currently owns the editor. */
20
+ export type PlaceholderMode = 'float' | 'sidebar' | 'center'
21
+
22
+ export function FloatingEditorPlaceholder(props: { mode?: PlaceholderMode }): ReactNode {
13
23
  const store = useExplorer()
14
24
  const t = store.t
25
+ const mode = props.mode ?? 'float'
26
+ if (mode === 'center') {
27
+ return (
28
+ <div className="rvs-float-placeholder">
29
+ <div className="rvs-float-placeholder-title">{t('float.centerElsewhere')}</div>
30
+ <div className="rvs-float-placeholder-text">{t('float.centerElsewhereHint')}</div>
31
+ <Btn kind="primary" onClick={() => { store.dockEditorSidebar() }}>{t('editor.dockToSidebar')}</Btn>
32
+ </div>
33
+ )
34
+ }
35
+ if (mode === 'sidebar') {
36
+ return (
37
+ <div className="rvs-float-placeholder">
38
+ <div className="rvs-float-placeholder-title">{t('float.dockedElsewhere')}</div>
39
+ <div className="rvs-float-placeholder-text">{t('float.dockedElsewhereHint')}</div>
40
+ <Btn kind="primary" onClick={() => { store.openEditorInCenter() }}>{t('float.openHere')}</Btn>
41
+ </div>
42
+ )
43
+ }
15
44
  return (
16
45
  <div className="rvs-float-placeholder">
17
46
  <div className="rvs-float-placeholder-title">{t('float.placeholder')}</div>
@@ -6,6 +6,7 @@ import type { RemoteDeployState, RemoteHostSummary } from '../protocol.ts'
6
6
  import { RemoteApiError, api, type HostForm } from './api.ts'
7
7
  import { DoctorPanel } from './DoctorPanel.tsx'
8
8
  import { Btn, Field, Notice, Row, hairline, inputStyle } from './ui.tsx'
9
+ import { confirmDialog } from './vsc/kit.tsx'
9
10
 
10
11
  function err(e: unknown): string {
11
12
  return e instanceof RemoteApiError ? e.message : String(e)
@@ -204,8 +205,16 @@ export function HostsView(props: {
204
205
  )
205
206
  }
206
207
 
207
- const runDelete = (alias: string): void => {
208
- if (!window.confirm(t('hosts.confirmDelete'))) return
208
+ const runDelete = async (alias: string): Promise<void> => {
209
+ // Themed confirm instead of `window.confirm`: the native one ignores the
210
+ // plugin theme, is not keyboard-trapped with the rest of the UI and cannot
211
+ // mark the action as destructive.
212
+ const ok = await confirmDialog({
213
+ title: t('hosts.confirmDelete'),
214
+ danger: true,
215
+ okText: t('hosts.delete'),
216
+ })
217
+ if (!ok) return
209
218
  setBusy(`del:${alias}`)
210
219
  api.deleteHost(alias).then(
211
220
  () => { setBusy(undefined); say(t('hosts.deleted').replace('{alias}', alias)); props.onChanged() },
@@ -303,7 +312,7 @@ export function HostsView(props: {
303
312
  <Btn onClick={() => { setEditing(editing === h.alias ? null : h.alias); setNotice(undefined); setError(undefined) }} disabled={disabled}>
304
313
  {t('hosts.edit')}
305
314
  </Btn>
306
- <Btn kind="danger" onClick={() => runDelete(h.alias)} disabled={disabled}>{t('hosts.delete')}</Btn>
315
+ <Btn kind="danger" onClick={() => { void runDelete(h.alias) }} disabled={disabled}>{t('hosts.delete')}</Btn>
307
316
  </Row>
308
317
  {editing === h.alias && (
309
318
  <HostFormView t={t} initial={h} busy={disabled} onSave={saveForm} onCancel={() => setEditing(null)} />
@@ -157,6 +157,8 @@ export function RemoteDirectoryPicker(props: {
157
157
  value={draft}
158
158
  onChange={(e) => setDraft(e.target.value)}
159
159
  onKeyDown={(e) => {
160
+ // IME candidate Enter must not navigate to a half-composed path.
161
+ if (e.nativeEvent.isComposing === true || e.keyCode === 229) return
160
162
  if (e.key === 'Enter') go()
161
163
  }}
162
164
  placeholder="/home/user/project"
@@ -174,7 +176,17 @@ export function RemoteDirectoryPicker(props: {
174
176
  {entries.map((entry) => (
175
177
  <div
176
178
  key={entry.path}
179
+ // A directory row was pointer-only: keyboard users could not enter
180
+ // it at all (audit I-10). Role + tabIndex + Enter/Space make it a
181
+ // real button without changing how it looks.
182
+ role="button"
183
+ tabIndex={0}
177
184
  onClick={() => void browse(entry.path)}
185
+ onKeyDown={(e) => {
186
+ if (e.key !== 'Enter' && e.key !== ' ') return
187
+ e.preventDefault()
188
+ void browse(entry.path)
189
+ }}
178
190
  title={entry.path}
179
191
  style={{ display: 'flex', gap: 6, alignItems: 'center', padding: '3px 8px', borderRadius: 4, cursor: 'pointer', fontSize: 13 }}
180
192
  onMouseEnter={(e) => {
@@ -1,11 +1,12 @@
1
1
  /**
2
- * The conversation-view tab: the same editor tab strip, previews and diff as
3
- * the sidebar, mounted next to 对话 / 轨迹 at full width.
2
+ * The conversation-view tab: the same editor (tab strip, previews, diff, status
3
+ * bar) mounted next to 对话 / 轨迹 at full width.
4
4
  *
5
- * Registered into the `conversation.view` slot when that slot exists; the
6
- * sidebar then keeps the whole column for the explorer. Both surfaces read
7
- * the same module-level store, so a diff opened from source control appears
8
- * here, and a save here repaints the sidebar's change list.
5
+ * This is the OPTIONAL seat now: the docked sidebar pane is the default one, so
6
+ * a file click lands there and this tab shows a "docked in the sidebar"
7
+ * placeholder until the editor's own surface button moves it here. Both seats
8
+ * read the same module-level store, so a diff opened from source control
9
+ * appears here too and a save here repaints the sidebar's change list.
9
10
  *
10
11
  * While the editor floats (`editorSurface === 'float'`) this tab is NOT the
11
12
  * editor's mount any more, so it renders a placeholder instead: mounting a
@@ -19,10 +20,12 @@ import { useBootstrap, useExplorer } from './store.tsx'
19
20
  import { DialogHost } from './vsc/kit.tsx'
20
21
 
21
22
  /**
22
- * The conversation-view body. The editor surface flag is owned by the client
23
- * entry (registration success decides it), NOT by this component: the view
24
- * may be unmounted while another conversation tab is selected, and flipping
25
- * the flag here would make the sidebar's rail flicker on every tab switch.
23
+ * The conversation-view body. The editor surface flag is the STORE's (the
24
+ * docked pane is the default; this view renders only while the user has moved
25
+ * the editor here), and deliberately not derived from this component's own
26
+ * mount: the view is unmounted while another conversation tab is selected, so
27
+ * inferring the surface from mount/unmount would flip the sidebar's rail — and
28
+ * its editor — on every host tab switch.
26
29
  */
27
30
  export function RemoteEditorView(props: { ctx: Context }): ReactNode {
28
31
  useBootstrap(props.ctx)
@@ -51,7 +54,7 @@ export function RemoteEditorView(props: { ctx: Context }): ReactNode {
51
54
  </span>
52
55
  )}
53
56
  </div>
54
- {store.editorSurface === 'center' ? <EditorPane visible /> : <FloatingEditorPlaceholder />}
57
+ {store.editorSurface === 'center' ? <EditorPane visible /> : <FloatingEditorPlaceholder mode={store.floatOpen ? 'float' : 'sidebar'} />}
55
58
  </div>
56
59
  </div>
57
60
  </>