dsh-remote-vs 0.28.0 → 0.30.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 +63 -7
- package/README.md +51 -7
- package/lib/client.js +393 -112
- package/lib/index.js +2271 -160
- package/lib/p2-router-fs.js +1 -1
- package/lib/types/changes/recorder.d.ts +65 -10
- package/lib/types/changes/status.d.ts +48 -3
- package/lib/types/client/ConnectionsSection.d.ts +73 -0
- package/lib/types/client/HostsView.d.ts +139 -2
- package/lib/types/client/api.d.ts +65 -2
- package/lib/types/client/connection.d.ts +28 -1
- package/lib/types/client/scm/actions.d.ts +25 -1
- package/lib/types/forward.d.ts +11 -1
- package/lib/types/p2/helper-rpc.d.ts +48 -0
- package/lib/types/p2/worlds.d.ts +28 -0
- package/lib/types/pool.d.ts +337 -8
- package/lib/types/protocol.d.ts +218 -0
- package/lib/types/proxy.d.ts +136 -0
- package/lib/types/store.d.ts +81 -1
- package/lib/types/tools.d.ts +3 -0
- package/lib/{worlds-RG8K5eom.js → worlds-CRRZMZhg.js} +85 -6
- package/package.json +1 -1
- package/src/changes/recorder.ts +151 -15
- package/src/changes/status.ts +59 -4
- package/src/client/ConnectionStatus.tsx +19 -5
- package/src/client/ConnectionsSection.tsx +359 -0
- package/src/client/HostsView.tsx +552 -11
- package/src/client/MonitorView.tsx +14 -0
- package/src/client/PortsView.tsx +16 -0
- package/src/client/SettingsHosts.tsx +132 -6
- package/src/client/api.ts +102 -4
- package/src/client/connection.ts +76 -2
- package/src/client/i18n.ts +152 -2
- package/src/client/scm/actions.ts +63 -12
- package/src/client/vsc/vsc.css +281 -0
- package/src/forward.ts +38 -2
- package/src/importers.ts +125 -13
- package/src/keygen.ts +8 -1
- package/src/p2/helper-rpc.ts +73 -5
- package/src/p2/worlds.ts +48 -0
- package/src/pool.ts +1120 -100
- package/src/protocol.ts +228 -0
- package/src/proxy.ts +673 -0
- package/src/routes.ts +139 -5
- package/src/store.ts +335 -0
- package/src/tools.ts +47 -2
package/src/protocol.ts
CHANGED
|
@@ -32,6 +32,10 @@ export const REMOTE_API = {
|
|
|
32
32
|
routing: '/api/dsh-remote/routing',
|
|
33
33
|
/** Client view preferences (auto-open the remote page + its width share). */
|
|
34
34
|
viewSettings: '/api/dsh-remote/view-settings',
|
|
35
|
+
/** Profile-wide proxy default (per-host overrides live on the host rows). */
|
|
36
|
+
proxySettings: '/api/dsh-remote/proxy-settings',
|
|
37
|
+
/** Live SSH pool shape per host: connections, channels, slot occupancy. */
|
|
38
|
+
connections: '/api/dsh-remote/connections',
|
|
35
39
|
/** Current working directory of one live session (click resolution helper). */
|
|
36
40
|
sessionCwd: '/api/dsh-remote/session-cwd',
|
|
37
41
|
/** What one live session changed on its remote host (the review panel). */
|
|
@@ -61,6 +65,75 @@ export function selectionDownloadName(count: number): string {
|
|
|
61
65
|
/** Authentication flavors a host entry may carry (P0: direct only, no jump/agent). */
|
|
62
66
|
export type RemoteAuthKind = 'key' | 'password'
|
|
63
67
|
|
|
68
|
+
/**
|
|
69
|
+
* How one host reaches the network.
|
|
70
|
+
*
|
|
71
|
+
* Two levels exist on purpose: a profile-wide default (`RemoteProxySettingsView`)
|
|
72
|
+
* and a per-host override. `inherit` is the default state of every existing
|
|
73
|
+
* host, and the default default is `direct`, so an upgrade changes nothing.
|
|
74
|
+
*/
|
|
75
|
+
export type RemoteProxyMode = 'inherit' | 'direct' | 'proxy' | 'jump'
|
|
76
|
+
|
|
77
|
+
/** One stored proxy endpoint (secrets included: host-side only). */
|
|
78
|
+
export interface RemoteProxySetting {
|
|
79
|
+
kind: 'http' | 'socks5'
|
|
80
|
+
/** Proxy hostname or IP. */
|
|
81
|
+
host: string
|
|
82
|
+
/** Proxy port. */
|
|
83
|
+
port: number
|
|
84
|
+
/** Basic auth (http) / user+password (socks5). */
|
|
85
|
+
username?: string
|
|
86
|
+
password?: string
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/** A host's proxy decision, as stored. */
|
|
90
|
+
export interface RemoteHostProxySetting {
|
|
91
|
+
mode: RemoteProxyMode
|
|
92
|
+
/** The endpoint for `mode: 'proxy'`. */
|
|
93
|
+
proxy?: RemoteProxySetting
|
|
94
|
+
/** The jump host for `mode: 'jump'` — an alias of another stored host. */
|
|
95
|
+
jump?: { viaAlias: string }
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/** Secret-free proxy endpoint for the browser. */
|
|
99
|
+
export interface RemoteProxyTargetView {
|
|
100
|
+
kind: 'http' | 'socks5'
|
|
101
|
+
host: string
|
|
102
|
+
port: number
|
|
103
|
+
username?: string
|
|
104
|
+
/** True when a password is stored (never echoed back). */
|
|
105
|
+
hasPassword: boolean
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/** Secret-free proxy decision of one host. */
|
|
109
|
+
export interface RemoteHostProxyView {
|
|
110
|
+
mode: RemoteProxyMode
|
|
111
|
+
target?: RemoteProxyTargetView
|
|
112
|
+
/** Alias of the jump host, for `mode: 'jump'`. */
|
|
113
|
+
jumpVia?: string
|
|
114
|
+
/**
|
|
115
|
+
* Why this setting cannot be used, when it cannot.
|
|
116
|
+
*
|
|
117
|
+
* A jump host that names itself, a chain longer than one hop, or a jump host
|
|
118
|
+
* that is itself reached through a jump is refused at dial time; saying so in
|
|
119
|
+
* the host's own row beats a generic "connection failed".
|
|
120
|
+
*/
|
|
121
|
+
problem?: string
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/** Profile-wide proxy default (the "upper" of the two levels). */
|
|
125
|
+
export interface RemoteProxySettingsView {
|
|
126
|
+
defaultMode: 'direct' | 'proxy'
|
|
127
|
+
target?: RemoteProxyTargetView
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/** Patch shape for the profile-wide proxy default. */
|
|
131
|
+
export interface RemoteProxySettingsPatch {
|
|
132
|
+
defaultMode?: 'direct' | 'proxy'
|
|
133
|
+
/** `null` clears the stored endpoint; omitted keeps it. */
|
|
134
|
+
target?: RemoteProxySetting | null
|
|
135
|
+
}
|
|
136
|
+
|
|
64
137
|
/** One stored host entry (the $DSH_HOME/dsh-remote.json store shape). */
|
|
65
138
|
export interface RemoteHostEntry {
|
|
66
139
|
/** Stable, user-chosen identifier used by every operation. */
|
|
@@ -85,6 +158,8 @@ export interface RemoteHostEntry {
|
|
|
85
158
|
description?: string
|
|
86
159
|
/** Free-form tags. */
|
|
87
160
|
tags: string[]
|
|
161
|
+
/** How this host is reached (absent = `inherit`). */
|
|
162
|
+
proxy?: RemoteHostProxySetting
|
|
88
163
|
/** Last deploy pipeline outcome for this host. */
|
|
89
164
|
deploy?: RemoteDeployState | undefined
|
|
90
165
|
createdAt: number
|
|
@@ -104,6 +179,8 @@ export interface RemoteHostSummary {
|
|
|
104
179
|
managedKey: boolean
|
|
105
180
|
description?: string
|
|
106
181
|
tags: string[]
|
|
182
|
+
/** Secret-free proxy decision; always present (mode `inherit` when unset). */
|
|
183
|
+
proxy: RemoteHostProxyView
|
|
107
184
|
deploy?: RemoteDeployState | undefined
|
|
108
185
|
createdAt: number
|
|
109
186
|
updatedAt: number
|
|
@@ -195,6 +272,37 @@ export interface RemoteTimeouts {
|
|
|
195
272
|
readMs: number
|
|
196
273
|
}
|
|
197
274
|
|
|
275
|
+
/**
|
|
276
|
+
* Where one SSH connection ACTUALLY left this machine.
|
|
277
|
+
*
|
|
278
|
+
* The user's question ("did this really go through the jump host?") cannot be
|
|
279
|
+
* answered by the stored configuration: a host can be configured for a jump host
|
|
280
|
+
* while a connection established BEFORE that edit is still serving. So the pool
|
|
281
|
+
* reports the route of the connection it is holding, and the browser shows it on
|
|
282
|
+
* the connection chip.
|
|
283
|
+
*
|
|
284
|
+
* `detail` is the hop itself (the target `host:port`, the proxy `host:port`, or
|
|
285
|
+
* the jump host alias) and NOT a formatted sentence: the wording is UI copy and
|
|
286
|
+
* therefore belongs to the localized client.
|
|
287
|
+
*/
|
|
288
|
+
export interface EgressInfo {
|
|
289
|
+
kind: 'direct' | 'proxy' | 'jump'
|
|
290
|
+
/** The hop: the target endpoint, the proxy endpoint, or the jump host alias. */
|
|
291
|
+
detail: string
|
|
292
|
+
/** Jump route only: the alias of the host whose connection carries the tunnel. */
|
|
293
|
+
viaAlias?: string
|
|
294
|
+
/** Proxy route only: whether this host or the profile default chose the proxy. */
|
|
295
|
+
source?: 'host' | 'default'
|
|
296
|
+
/** Proxy route only: the protocol, so the UI can name it (HTTP / SOCKS5). */
|
|
297
|
+
proxyKind?: 'http' | 'socks5'
|
|
298
|
+
/**
|
|
299
|
+
* Set only on a CONFIGURED route whose resolution failed (a jump host that is
|
|
300
|
+
* gone, a self-jump, a half-configured proxy): the reason, so the chip can say
|
|
301
|
+
* why the route cannot work instead of silently reading as healthy.
|
|
302
|
+
*/
|
|
303
|
+
problem?: string
|
|
304
|
+
}
|
|
305
|
+
|
|
198
306
|
/**
|
|
199
307
|
* Connection health for one host alias, as the Host's pool sees it.
|
|
200
308
|
*
|
|
@@ -215,6 +323,116 @@ export interface RemoteConnectionStatus {
|
|
|
215
323
|
errorAt?: number
|
|
216
324
|
/** Human-readable failure the client can show in the status chip. */
|
|
217
325
|
error?: string
|
|
326
|
+
/**
|
|
327
|
+
* The route the connection this pool HOLDS was actually opened through.
|
|
328
|
+
* Present only while such a connection exists: it is evidence about a live
|
|
329
|
+
* link, not about the current configuration.
|
|
330
|
+
*/
|
|
331
|
+
egress?: EgressInfo
|
|
332
|
+
/**
|
|
333
|
+
* The route the stored configuration resolves to, for an alias with no live
|
|
334
|
+
* connection (what the NEXT connection would use, and the honest answer while
|
|
335
|
+
* nothing is dialed). Carries `problem` when the configuration is unusable.
|
|
336
|
+
*/
|
|
337
|
+
configured?: EgressInfo
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
/** One pool connection kind: whether it is dialed, and how many channels ride it. */
|
|
341
|
+
export interface RemotePoolLane {
|
|
342
|
+
/**
|
|
343
|
+
* The connection is fully dialed. A dial still in flight is NOT open (the pool
|
|
344
|
+
* creates its bookkeeping entry before the Client exists), and every lane is
|
|
345
|
+
* always present: a kind that is not dialed reports `false` here with zero
|
|
346
|
+
* channels and zero rounds, so "not in use" is a value, not a missing field.
|
|
347
|
+
*/
|
|
348
|
+
open: boolean
|
|
349
|
+
/** Channels currently open on this connection (exec sessions, SFTP sessions, PTY, tunnels). */
|
|
350
|
+
channels: number
|
|
351
|
+
/** Rounds currently pinned to it (an operation in flight keeps the connection alive). */
|
|
352
|
+
held: number
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
/** Channel-slot occupancy of one budget: what is running and what is waiting behind it. */
|
|
356
|
+
export interface RemotePoolSlots {
|
|
357
|
+
/** Operations holding a channel right now. */
|
|
358
|
+
active: number
|
|
359
|
+
/** Operations queued for one (they fail after a bounded wait). */
|
|
360
|
+
queued: number
|
|
361
|
+
/** How many may run at once. */
|
|
362
|
+
limit: number
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
/**
|
|
366
|
+
* Live SSH pool shape of one host.
|
|
367
|
+
*
|
|
368
|
+
* Read-only diagnostics for the monitor page: "why is this slow" is usually one
|
|
369
|
+
* of three answers — too few connections (everything shares one TCP), the channel
|
|
370
|
+
* budget is full, or a queue has built up behind a stalled operation. Each is a
|
|
371
|
+
* number here, so the page can show the answer instead of a hunch.
|
|
372
|
+
*/
|
|
373
|
+
export interface RemoteHostPoolStats {
|
|
374
|
+
alias: string
|
|
375
|
+
/** The four connection classes the pool can hold for one host. */
|
|
376
|
+
connections: {
|
|
377
|
+
/** Everything that is not isolated: exec, git, monitor, helper, agent tools. */
|
|
378
|
+
shared: RemotePoolLane
|
|
379
|
+
/** Interactive terminals (their own connection). */
|
|
380
|
+
pty: RemotePoolLane
|
|
381
|
+
/** Local port forwards (their own connection). */
|
|
382
|
+
forward: RemotePoolLane
|
|
383
|
+
/** File operations: browse, read, write, upload, download (their own connection). */
|
|
384
|
+
sftp: RemotePoolLane
|
|
385
|
+
/**
|
|
386
|
+
* The SSH helper (p2 transport: the file/Git fast path).
|
|
387
|
+
*
|
|
388
|
+
* Optional because the helper dials from `p2/worlds.ts`, not from the pool: a
|
|
389
|
+
* Host that cannot report it (or has no helper deployed) omits the key rather
|
|
390
|
+
* than claiming "closed". When present, `channels` is the helper's own session
|
|
391
|
+
* and `held` counts the RPC calls in flight — a helper that is saturated shows
|
|
392
|
+
* up here instead of looking like an idle connection.
|
|
393
|
+
*/
|
|
394
|
+
helper?: RemotePoolLane
|
|
395
|
+
}
|
|
396
|
+
/** Channel budget of the shared connection (exec sessions, plus SFTP that fell back). */
|
|
397
|
+
slots: RemotePoolSlots
|
|
398
|
+
/** Channel budget of the dedicated SFTP connection (absent while it is not used). */
|
|
399
|
+
sftpSlots?: RemotePoolSlots
|
|
400
|
+
/**
|
|
401
|
+
* Channel budget of the NETWORK-verb lane (git fetch/pull/push/sync).
|
|
402
|
+
*
|
|
403
|
+
* These verbs can hold a channel for the whole network timeout (20 minutes by
|
|
404
|
+
* default), so they get their own small budget instead of eating the shared
|
|
405
|
+
* exec slots. Absent while no network verb is running and none is queued.
|
|
406
|
+
*/
|
|
407
|
+
netSlots?: RemotePoolSlots
|
|
408
|
+
/**
|
|
409
|
+
* Channel budget of the GIT-COMMAND lane (git status / diff / log, the session
|
|
410
|
+
* ledger's own scans, and the SCM panel's local writes such as commit / stage).
|
|
411
|
+
*
|
|
412
|
+
* A repository-wide `git status` is the longest single command the plugin runs
|
|
413
|
+
* outside the network verbs (300 s by default, 30 min at the ceiling) and it
|
|
414
|
+
* shares the connection with monitoring, the process panel and agent tools. Its
|
|
415
|
+
* own budget keeps a slow command from spending the exec slots those poll on.
|
|
416
|
+
* Absent while no git command is running and none is queued.
|
|
417
|
+
*/
|
|
418
|
+
gitSlots?: RemotePoolSlots
|
|
419
|
+
/** Route the shared connection was opened through, when it is open. */
|
|
420
|
+
egress?: EgressInfo
|
|
421
|
+
/**
|
|
422
|
+
* File operations are riding the SHARED connection right now, because the host
|
|
423
|
+
* refused one of its own.
|
|
424
|
+
*
|
|
425
|
+
* Sticky until a dedicated connection succeeds again or the host is edited. It
|
|
426
|
+
* is diagnostic, not an error: the files still work, they just lost the
|
|
427
|
+
* isolation (and a browse refresh can queue behind exec again), which is
|
|
428
|
+
* exactly the thing a user staring at the monitor page cannot see otherwise.
|
|
429
|
+
*/
|
|
430
|
+
sftpFallback?: boolean
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
/** Response of {@link REMOTE_API.connections}. */
|
|
434
|
+
export interface RemotePoolStatsResult {
|
|
435
|
+
hosts: RemoteHostPoolStats[]
|
|
218
436
|
}
|
|
219
437
|
|
|
220
438
|
/** Remote OS probe outcome. */
|
|
@@ -791,6 +1009,16 @@ export interface RemoteForwardState {
|
|
|
791
1009
|
bytesOut: number
|
|
792
1010
|
/** Last connect/bind failure, human-readable. */
|
|
793
1011
|
lastError?: string
|
|
1012
|
+
/**
|
|
1013
|
+
* Which SSH connection the last successful channel used.
|
|
1014
|
+
*
|
|
1015
|
+
* `dedicated` = the host's own port-forward connection (the normal case);
|
|
1016
|
+
* `shared` = the server refused the extra connection, so the channel rode the
|
|
1017
|
+
* shared one (the forward still works, only the isolation is lost). Absent
|
|
1018
|
+
* until a connection has succeeded at least once — older hosts omit it too, so
|
|
1019
|
+
* a client must treat it as optional.
|
|
1020
|
+
*/
|
|
1021
|
+
transport?: 'dedicated' | 'shared'
|
|
794
1022
|
startedAt: number
|
|
795
1023
|
}
|
|
796
1024
|
|