dsh-remote-vs 0.11.1 → 0.12.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.
- package/README.en.md +1 -1
- package/README.md +1 -1
- package/lib/client.js +626 -117
- package/lib/index.js +252 -2
- package/lib/p2-router-fs.js +1 -1
- package/lib/types/archive.d.ts +30 -0
- package/lib/types/client/DownloadDock.d.ts +15 -0
- package/lib/types/client/download.d.ts +69 -0
- package/lib/types/client/downloads.d.ts +63 -0
- package/lib/types/client/i18n.d.ts +1 -1
- package/lib/types/protocol.d.ts +14 -0
- package/lib/types/sftp.d.ts +38 -0
- package/lib/{worlds-a8nqW9mi.js → worlds-oj65Hic-.js} +171 -1
- package/package.json +1 -1
- package/src/archive.ts +60 -0
- package/src/client/DownloadDock.tsx +89 -0
- package/src/client/RemoteExplorer.tsx +31 -1
- package/src/client/RemoteRoot.tsx +2 -0
- package/src/client/SearchView.tsx +8 -0
- package/src/client/download.ts +212 -0
- package/src/client/downloads.ts +175 -0
- package/src/client/i18n.ts +23 -0
- package/src/client/vsc/vsc.css +124 -0
- package/src/protocol.ts +492 -474
- package/src/routes.ts +221 -2
- package/src/sftp.ts +213 -0
package/src/protocol.ts
CHANGED
|
@@ -1,474 +1,492 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Wire contract between the host half (routes.ts) and the browser half
|
|
3
|
-
* (client/api.ts). Pure types + path constants only — imported by both
|
|
4
|
-
* halves, bundled into each, no runtime identity to share.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
/** API route table (all loopback-only). */
|
|
8
|
-
export const REMOTE_API = {
|
|
9
|
-
hosts: '/api/dsh-remote/hosts',
|
|
10
|
-
test: '/api/dsh-remote/test',
|
|
11
|
-
keygen: '/api/dsh-remote/keygen',
|
|
12
|
-
exec: '/api/dsh-remote/exec',
|
|
13
|
-
/** Streaming exec (server-sent events) for the long network verbs. */
|
|
14
|
-
execStream: '/api/dsh-remote/exec-stream',
|
|
15
|
-
files: '/api/dsh-remote/files',
|
|
16
|
-
/** Streaming binary upload: raw request body, host and path in the query. */
|
|
17
|
-
upload: '/api/dsh-remote/upload',
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
deploy?: RemoteDeployState | undefined
|
|
78
|
-
createdAt: number
|
|
79
|
-
updatedAt: number
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
export interface
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
/**
|
|
118
|
-
|
|
119
|
-
/**
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
/**
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
/**
|
|
138
|
-
|
|
139
|
-
/**
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
/**
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
/**
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
/**
|
|
216
|
-
|
|
217
|
-
/**
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
/**
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
/**
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
export
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
/**
|
|
252
|
-
export
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
/**
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
/**
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
/**
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
/**
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
/**
|
|
366
|
-
|
|
367
|
-
/**
|
|
368
|
-
|
|
369
|
-
/**
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
/**
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
/**
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
/**
|
|
423
|
-
|
|
424
|
-
/**
|
|
425
|
-
truncated?: true
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
/**
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* Wire contract between the host half (routes.ts) and the browser half
|
|
3
|
+
* (client/api.ts). Pure types + path constants only — imported by both
|
|
4
|
+
* halves, bundled into each, no runtime identity to share.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/** API route table (all loopback-only). */
|
|
8
|
+
export const REMOTE_API = {
|
|
9
|
+
hosts: '/api/dsh-remote/hosts',
|
|
10
|
+
test: '/api/dsh-remote/test',
|
|
11
|
+
keygen: '/api/dsh-remote/keygen',
|
|
12
|
+
exec: '/api/dsh-remote/exec',
|
|
13
|
+
/** Streaming exec (server-sent events) for the long network verbs. */
|
|
14
|
+
execStream: '/api/dsh-remote/exec-stream',
|
|
15
|
+
files: '/api/dsh-remote/files',
|
|
16
|
+
/** Streaming binary upload: raw request body, host and path in the query. */
|
|
17
|
+
upload: '/api/dsh-remote/upload',
|
|
18
|
+
/** Streaming binary download: raw response body, host and path in the query. */
|
|
19
|
+
download: '/api/dsh-remote/download',
|
|
20
|
+
/** Streaming directory download: a remote `tar -czf -` of the directory. */
|
|
21
|
+
downloadDir: '/api/dsh-remote/download-dir',
|
|
22
|
+
/** Streaming multi-selection download: one remote tar of repeated `path` params. */
|
|
23
|
+
downloadMany: '/api/dsh-remote/download-many',
|
|
24
|
+
workspaces: '/api/dsh-remote/workspaces',
|
|
25
|
+
deploy: '/api/dsh-remote/deploy',
|
|
26
|
+
importSshConfig: '/api/dsh-remote/import-ssh-config',
|
|
27
|
+
importDshSsh: '/api/dsh-remote/import-dsh-ssh',
|
|
28
|
+
terminal: '/api/dsh-remote/terminal',
|
|
29
|
+
terminalClose: '/api/dsh-remote/terminal-close',
|
|
30
|
+
routing: '/api/dsh-remote/routing',
|
|
31
|
+
/** Current working directory of one live session (click resolution helper). */
|
|
32
|
+
sessionCwd: '/api/dsh-remote/session-cwd',
|
|
33
|
+
/** What one live session changed on its remote host (the review panel). */
|
|
34
|
+
changes: '/api/dsh-remote/changes',
|
|
35
|
+
} as const
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Most entries one multi-selection download may archive. The selection rides in
|
|
39
|
+
* the request URL (one `path` param per entry), so this bounds both the archive
|
|
40
|
+
* and the request line; a larger selection should download its folder instead.
|
|
41
|
+
*/
|
|
42
|
+
export const MAX_SELECTION_DOWNLOAD = 100
|
|
43
|
+
|
|
44
|
+
/** Suggested/attachment file name for one multi-selection archive. */
|
|
45
|
+
export function selectionDownloadName(count: number): string {
|
|
46
|
+
return `selection-${count}.tar.gz`
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/** Authentication flavors a host entry may carry (P0: direct only, no jump/agent). */
|
|
50
|
+
export type RemoteAuthKind = 'key' | 'password'
|
|
51
|
+
|
|
52
|
+
/** One stored host entry (the $DSH_HOME/dsh-remote.json store shape). */
|
|
53
|
+
export interface RemoteHostEntry {
|
|
54
|
+
/** Stable, user-chosen identifier used by every operation. */
|
|
55
|
+
alias: string
|
|
56
|
+
/** Hostname or IP of the target. */
|
|
57
|
+
host: string
|
|
58
|
+
/** SSH port (default 22). */
|
|
59
|
+
port: number
|
|
60
|
+
/** Login user. */
|
|
61
|
+
user: string
|
|
62
|
+
/** Authentication. */
|
|
63
|
+
auth: {
|
|
64
|
+
kind: RemoteAuthKind
|
|
65
|
+
/** Absolute path to the private key for 'key' auth. */
|
|
66
|
+
keyPath?: string
|
|
67
|
+
/** Passphrase for an encrypted key. */
|
|
68
|
+
passphrase?: string
|
|
69
|
+
/** Password for 'password' auth. */
|
|
70
|
+
password?: string
|
|
71
|
+
}
|
|
72
|
+
/** Free-form note. */
|
|
73
|
+
description?: string
|
|
74
|
+
/** Free-form tags. */
|
|
75
|
+
tags: string[]
|
|
76
|
+
/** Last deploy pipeline outcome for this host. */
|
|
77
|
+
deploy?: RemoteDeployState | undefined
|
|
78
|
+
createdAt: number
|
|
79
|
+
updatedAt: number
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/** Public (secret-free) projection of an entry, safe for the browser/agent. */
|
|
83
|
+
export interface RemoteHostSummary {
|
|
84
|
+
alias: string
|
|
85
|
+
host: string
|
|
86
|
+
port: number
|
|
87
|
+
user: string
|
|
88
|
+
auth: RemoteAuthKind
|
|
89
|
+
/** Whether the key path exists on this machine (key auth only). */
|
|
90
|
+
keyReady: boolean
|
|
91
|
+
/** True when the entry was bootstrapped by this plugin (managed keypair). */
|
|
92
|
+
managedKey: boolean
|
|
93
|
+
description?: string
|
|
94
|
+
tags: string[]
|
|
95
|
+
deploy?: RemoteDeployState | undefined
|
|
96
|
+
createdAt: number
|
|
97
|
+
updatedAt: number
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/** One remote workspace binding: a host plus a remote directory. */
|
|
101
|
+
export interface RemoteWorkspaceBinding {
|
|
102
|
+
/** Stable id ( cuid-ish ). */
|
|
103
|
+
id: string
|
|
104
|
+
/** Display name. */
|
|
105
|
+
name: string
|
|
106
|
+
/** Host alias this workspace lives on. */
|
|
107
|
+
alias: string
|
|
108
|
+
/** Absolute POSIX path on the remote host. */
|
|
109
|
+
remotePath: string
|
|
110
|
+
createdAt: number
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/** P2 routing status (Phase 4 workspaces GET extension). */
|
|
114
|
+
export interface RemoteRoutingStatus {
|
|
115
|
+
/** Live kill-switch position. */
|
|
116
|
+
mode: 'off' | 'shadow' | 'enforce'
|
|
117
|
+
/** Binding id -> materialized local alias dir. */
|
|
118
|
+
aliasPaths: Record<string, string>
|
|
119
|
+
/** Removed alias dirs that fail closed (history kept). */
|
|
120
|
+
tombstones: string[]
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/** Plugin identity (workspaces GET extension for the Settings display). */
|
|
124
|
+
export interface RemotePluginMeta {
|
|
125
|
+
/** Version from the shipped package.json ('unknown' when unreadable). */
|
|
126
|
+
version: string
|
|
127
|
+
/**
|
|
128
|
+
* Effective per-operation timeouts, in milliseconds. Served so the browser
|
|
129
|
+
* can apply the same numbers the Host enforces; an older Host omits it and
|
|
130
|
+
* the client keeps its own (identical) defaults.
|
|
131
|
+
*/
|
|
132
|
+
timeouts?: RemoteTimeouts
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/** One timeout per kind of remote round trip. */
|
|
136
|
+
export interface RemoteTimeouts {
|
|
137
|
+
/** One git command (status/log/branches/diff over the exec route). */
|
|
138
|
+
gitMs: number
|
|
139
|
+
/** One SFTP file read (editor, diff sides, document preview). */
|
|
140
|
+
readMs: number
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/** Remote OS probe outcome. */
|
|
144
|
+
export interface RemoteProbe {
|
|
145
|
+
alias: string
|
|
146
|
+
ok: boolean
|
|
147
|
+
/** Raw `uname -m` (x86_64 / aarch64 / ...). */
|
|
148
|
+
arch: string
|
|
149
|
+
/** Mapped helper platform (linux-x64 / linux-arm64 / macos-x64 / macos-arm64 / unknown). */
|
|
150
|
+
platform: string
|
|
151
|
+
/** `uname -s`. */
|
|
152
|
+
os: string
|
|
153
|
+
/** glibc version when detectable (linux). */
|
|
154
|
+
libc?: string | undefined
|
|
155
|
+
/** Remote node version when installed (`node --version`), else undefined. */
|
|
156
|
+
node?: string | undefined
|
|
157
|
+
/** Remote home directory. */
|
|
158
|
+
home?: string | undefined
|
|
159
|
+
durationMs: number
|
|
160
|
+
error?: string | undefined
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/** Helper provider kinds the deploy pipeline knows. */
|
|
164
|
+
export type HelperKind = 'executable' | 'node-script'
|
|
165
|
+
|
|
166
|
+
/** Availability of one helper provider. */
|
|
167
|
+
export interface HelperAvailability {
|
|
168
|
+
kind: HelperKind
|
|
169
|
+
available: boolean
|
|
170
|
+
reason: string
|
|
171
|
+
/** Locally cached builds (executable only). */
|
|
172
|
+
cached?: { version: string; platform: string }[]
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
/** Last deploy pipeline outcome stored per host. */
|
|
176
|
+
export interface RemoteDeployState {
|
|
177
|
+
status: 'ok' | 'skipped-same' | 'failed' | 'not-deployed'
|
|
178
|
+
/** What was pushed (P0: probe-bundle marker; P1: helper kind+version). */
|
|
179
|
+
artifact: string
|
|
180
|
+
/** sha256 of the installed artifact manifest. */
|
|
181
|
+
manifestHash?: string | undefined
|
|
182
|
+
detail?: string | undefined
|
|
183
|
+
/** Remote $HOME observed at push time (locates the install without re-probing). */
|
|
184
|
+
home?: string | undefined
|
|
185
|
+
/** Installed helper identity (P1+ artifacts). */
|
|
186
|
+
helper?: { kind: HelperKind; version: string; sha256: string; platform?: string } | undefined
|
|
187
|
+
at: number
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
/** Remote manifest installed at ~/.dsh-helpers/manifest.json. */
|
|
191
|
+
export interface RemoteManifest {
|
|
192
|
+
version: 1
|
|
193
|
+
artifact: string
|
|
194
|
+
manifestHash: string
|
|
195
|
+
helper?: { kind: HelperKind; version: string; sha256: string; platform?: string } | undefined
|
|
196
|
+
installedAt: number
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
/** One remote directory row (SFTP). */
|
|
200
|
+
export interface RemoteFileEntry {
|
|
201
|
+
name: string
|
|
202
|
+
/** Absolute POSIX path. */
|
|
203
|
+
path: string
|
|
204
|
+
isDir: boolean
|
|
205
|
+
size: number
|
|
206
|
+
/** mtime in ms. */
|
|
207
|
+
mtime: number
|
|
208
|
+
/** POSIX mode bits. */
|
|
209
|
+
mode: number
|
|
210
|
+
isSymlink: boolean
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
/** Result of one remote file read (SFTP window). */
|
|
214
|
+
export interface RemoteRead {
|
|
215
|
+
/** File size in bytes. */
|
|
216
|
+
size: number
|
|
217
|
+
/** True when the content is not UTF-8 text (base64 holds the bytes). */
|
|
218
|
+
binary: boolean
|
|
219
|
+
text?: string | undefined
|
|
220
|
+
base64?: string | undefined
|
|
221
|
+
/** True when size exceeded READ_CAP (content holds the first window). */
|
|
222
|
+
truncated: boolean
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
/** Result of one non-interactive command execution. */
|
|
226
|
+
export interface RemoteExecResult {
|
|
227
|
+
success: boolean
|
|
228
|
+
/** Remote exit code, or null when the channel died without one. */
|
|
229
|
+
exitCode: number | null
|
|
230
|
+
timedOut: boolean
|
|
231
|
+
stdout: string
|
|
232
|
+
stderr: string
|
|
233
|
+
/** Wall-clock duration of the round trip in ms. */
|
|
234
|
+
durationMs: number
|
|
235
|
+
/** Connection error message when the command never ran. */
|
|
236
|
+
error?: string | undefined
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* One server-sent event of the streaming exec route.
|
|
241
|
+
*
|
|
242
|
+
* Used by the long network verbs (fetch / pull / push / sync) so the live git
|
|
243
|
+
* output can be shown while the command is still running; the unary exec route
|
|
244
|
+
* keeps serving everything that only needs the result.
|
|
245
|
+
*/
|
|
246
|
+
export type ExecStreamEvent =
|
|
247
|
+
| { t: 'out'; d: string }
|
|
248
|
+
| { t: 'err'; d: string }
|
|
249
|
+
| { t: 'exit'; success: boolean; exitCode: number | null; timedOut: boolean; durationMs: number; error?: string }
|
|
250
|
+
|
|
251
|
+
/** Client -> server terminal frames (JSON text). */
|
|
252
|
+
export type TerminalClientFrame =
|
|
253
|
+
| { t: 'in'; d: string }
|
|
254
|
+
| { t: 'resize'; cols: number; rows: number }
|
|
255
|
+
|
|
256
|
+
/** Server -> client terminal frames (JSON text). */
|
|
257
|
+
export type TerminalServerFrame =
|
|
258
|
+
| { t: 'ready'; id: string }
|
|
259
|
+
| { t: 'out'; d: string }
|
|
260
|
+
| { t: 'exit'; code: number | null }
|
|
261
|
+
| { t: 'error'; message: string }
|
|
262
|
+
|
|
263
|
+
/** Import outcome (ssh_config / dsh-ssh.json). */
|
|
264
|
+
export interface ImportReport {
|
|
265
|
+
imported: string[]
|
|
266
|
+
skipped: { alias: string; reason: string }[]
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
/** One parsed commit for the git graph. */
|
|
270
|
+
export interface GitCommit {
|
|
271
|
+
hash: string
|
|
272
|
+
parents: string[]
|
|
273
|
+
author: string
|
|
274
|
+
email: string
|
|
275
|
+
/** Author date, unix seconds. */
|
|
276
|
+
date: number
|
|
277
|
+
/** Raw ref list, e.g. ["HEAD -> main", "origin/main", "tag: v1.2"]. */
|
|
278
|
+
refs: string[]
|
|
279
|
+
subject: string
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
/** One changed file in git status. */
|
|
283
|
+
export interface GitStatusFile {
|
|
284
|
+
path: string
|
|
285
|
+
/** Staged (index) status char. */
|
|
286
|
+
staged: string
|
|
287
|
+
/** Unstaged (worktree) status char. */
|
|
288
|
+
unstaged: string
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
/** Parsed git status. */
|
|
292
|
+
export interface GitStatus {
|
|
293
|
+
branch: string
|
|
294
|
+
detached: boolean
|
|
295
|
+
ahead: number
|
|
296
|
+
behind: number
|
|
297
|
+
staged: GitStatusFile[]
|
|
298
|
+
unstaged: GitStatusFile[]
|
|
299
|
+
untracked: string[]
|
|
300
|
+
truncated: boolean
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
/** One local branch. */
|
|
304
|
+
export interface GitBranch {
|
|
305
|
+
name: string
|
|
306
|
+
short: string
|
|
307
|
+
upstream: string
|
|
308
|
+
/** True when this is the current HEAD. */
|
|
309
|
+
head: boolean
|
|
310
|
+
/** True for a remote-tracking branch (`refs/remotes/...`). */
|
|
311
|
+
remote?: boolean
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
/** One path row of the detailed (NUL-separated) porcelain status. */
|
|
315
|
+
export interface GitPathStatus {
|
|
316
|
+
/** Repo-relative path (the destination for renames). */
|
|
317
|
+
path: string
|
|
318
|
+
/** Staged (index) status column. */
|
|
319
|
+
x: string
|
|
320
|
+
/** Unstaged (worktree) status column. */
|
|
321
|
+
y: string
|
|
322
|
+
/** Rename/copy source. */
|
|
323
|
+
origPath?: string
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
/** Detailed status: every entry plus the ignored half (drives tree greying). */
|
|
327
|
+
export interface GitStatusDetail {
|
|
328
|
+
entries: GitPathStatus[]
|
|
329
|
+
/** Ignored paths, as `git status --ignored=matching` reports them. */
|
|
330
|
+
ignored: string[]
|
|
331
|
+
/** True when the byte cap cut the listing short. */
|
|
332
|
+
truncated: boolean
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
/** One configured remote URL. */
|
|
336
|
+
export interface GitRemote {
|
|
337
|
+
name: string
|
|
338
|
+
url: string
|
|
339
|
+
kind: 'fetch' | 'push'
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
/** One stash entry. */
|
|
343
|
+
export interface GitStash {
|
|
344
|
+
/** `stash@{0}`. */
|
|
345
|
+
ref: string
|
|
346
|
+
message: string
|
|
347
|
+
/** Unix seconds. */
|
|
348
|
+
date: number
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
/** One file row of a commit (`--name-status`). */
|
|
352
|
+
export interface GitCommitFile {
|
|
353
|
+
/** Single letter (`R`/`C` for renames/copies); the similarity score is dropped. */
|
|
354
|
+
status: string
|
|
355
|
+
path: string
|
|
356
|
+
origPath?: string
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
/** One hunk of a unified diff, with a ready-to-apply patch body. */
|
|
360
|
+
export interface UnifiedHunk {
|
|
361
|
+
oldStart: number
|
|
362
|
+
oldCount: number
|
|
363
|
+
newStart: number
|
|
364
|
+
newCount: number
|
|
365
|
+
/** Text after the `@@` marker. */
|
|
366
|
+
heading: string
|
|
367
|
+
/** Raw hunk lines (leading ' ', '-', '+', '\'). */
|
|
368
|
+
lines: string[]
|
|
369
|
+
/** File header + hunk header + lines: exactly what `git apply` needs. */
|
|
370
|
+
patch: string
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
/** One file block of a unified diff. */
|
|
374
|
+
export interface UnifiedDiffFile {
|
|
375
|
+
/** Destination path (source path for deletions). */
|
|
376
|
+
path: string
|
|
377
|
+
oldPath: string
|
|
378
|
+
status: 'M' | 'A' | 'D' | 'R' | 'C' | 'U'
|
|
379
|
+
binary: boolean
|
|
380
|
+
hunks: UnifiedHunk[]
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
/** One file the session changed, as the review panel lists it. */
|
|
384
|
+
export interface RemoteChangedFile {
|
|
385
|
+
/** Remote absolute POSIX path — the editor opens exactly this. */
|
|
386
|
+
path: string
|
|
387
|
+
/** Path relative to the session root (what the row shows), '' for an external file. */
|
|
388
|
+
display: string
|
|
389
|
+
added: number
|
|
390
|
+
deleted: number
|
|
391
|
+
/** Git reported the pair as binary (`-` in --numstat). */
|
|
392
|
+
binary?: true
|
|
393
|
+
/**
|
|
394
|
+
* Too large to compare line by line, so the counts are unknown (0/0).
|
|
395
|
+
*
|
|
396
|
+
* The row still earns its place: time and size proved it moved since the
|
|
397
|
+
* session baseline. Clicking it opens the file, but no hunks can be painted.
|
|
398
|
+
*/
|
|
399
|
+
oversized?: true
|
|
400
|
+
/** Change kind from --name-status; undefined when git gave none. */
|
|
401
|
+
status?: 'A' | 'M' | 'D' | 'R' | 'C' | 'T' | 'U'
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
/**
|
|
405
|
+
* What one session changed on its remote host since the session's baseline.
|
|
406
|
+
*
|
|
407
|
+
* The baseline is the content of every file git already reported as dirty when
|
|
408
|
+
* the ledger first looked, so the list answers "what did this session touch"
|
|
409
|
+
* rather than "what is uncommitted" — the difference matters when the working
|
|
410
|
+
* tree already carried user edits before the session started.
|
|
411
|
+
*/
|
|
412
|
+
export interface RemoteChangesSummary {
|
|
413
|
+
/** Remote host alias the session is routed to. */
|
|
414
|
+
alias: string
|
|
415
|
+
/** Remote absolute root the `display` paths are relative to. */
|
|
416
|
+
root: string
|
|
417
|
+
/** Highest turn recorded (0 while only the baseline exists). */
|
|
418
|
+
turn: number
|
|
419
|
+
files: RemoteChangedFile[]
|
|
420
|
+
added: number
|
|
421
|
+
deleted: number
|
|
422
|
+
/** Wall-clock ms when this summary was last recomputed. */
|
|
423
|
+
at: number
|
|
424
|
+
/** More files than the cap: `files` is truncated but the totals are whole. */
|
|
425
|
+
truncated?: true
|
|
426
|
+
/** A scan is running right now (the slow one counts); the list will refresh. */
|
|
427
|
+
pending: boolean
|
|
428
|
+
/** Why this session has no ledger (local session, no git, timeout, …). */
|
|
429
|
+
unavailable?: string
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
/** One file's whole-session comparison, ready for editor decorations. */
|
|
433
|
+
export interface RemoteChangesDiff {
|
|
434
|
+
kind: 'text' | 'binary' | 'missing'
|
|
435
|
+
/** Remote absolute POSIX path. */
|
|
436
|
+
path: string
|
|
437
|
+
display: string
|
|
438
|
+
/** Text hunks (empty for binary/missing). */
|
|
439
|
+
hunks: UnifiedHunk[]
|
|
440
|
+
/** File status at turn end (A/M/D/…), when git reported one. */
|
|
441
|
+
status?: 'A' | 'M' | 'D' | 'R' | 'C' | 'T' | 'U'
|
|
442
|
+
/** The diff was cut at the byte cap: `hunks` is a prefix. */
|
|
443
|
+
truncated?: true
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
/** One row of the side-by-side diff projection. */
|
|
447
|
+
export interface DiffRow {
|
|
448
|
+
id: number
|
|
449
|
+
/** Left (before) text; '' when the row has no left counterpart. */
|
|
450
|
+
old: string
|
|
451
|
+
/** Right (after) text; '' when the row has no right counterpart. */
|
|
452
|
+
new: string
|
|
453
|
+
oldNum: number | null
|
|
454
|
+
newNum: number | null
|
|
455
|
+
/** False when the row does not exist on the right side at all. */
|
|
456
|
+
inNew: boolean
|
|
457
|
+
oldDel: boolean
|
|
458
|
+
newAdd: boolean
|
|
459
|
+
/** Index into the model's hunk list, or -1 outside every hunk. */
|
|
460
|
+
hunk: number
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
/** One hunk as the view needs it (numbers + the patch to stage/revert). */
|
|
464
|
+
export interface DiffHunkView {
|
|
465
|
+
index: number
|
|
466
|
+
oldStart: number
|
|
467
|
+
newStart: number
|
|
468
|
+
oldCount: number
|
|
469
|
+
newCount: number
|
|
470
|
+
heading: string
|
|
471
|
+
/** Row index of the hunk's first changed line. */
|
|
472
|
+
startRow: number
|
|
473
|
+
patch: string
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
/** The full side-by-side model for one file. */
|
|
477
|
+
export interface DiffModel {
|
|
478
|
+
rows: DiffRow[]
|
|
479
|
+
hunks: DiffHunkView[]
|
|
480
|
+
/** True when git reported a binary diff (no rows). */
|
|
481
|
+
binary: boolean
|
|
482
|
+
/** True when the two sides are byte-identical. */
|
|
483
|
+
empty: boolean
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
/** Commit detail. */
|
|
487
|
+
export interface GitShow {
|
|
488
|
+
hash: string
|
|
489
|
+
subject: string
|
|
490
|
+
body: string
|
|
491
|
+
stat: string
|
|
492
|
+
}
|