dsh-remote-vs 0.28.0 → 0.29.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/src/protocol.ts CHANGED
@@ -32,6 +32,8 @@ 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',
35
37
  /** Current working directory of one live session (click resolution helper). */
36
38
  sessionCwd: '/api/dsh-remote/session-cwd',
37
39
  /** What one live session changed on its remote host (the review panel). */
@@ -61,6 +63,75 @@ export function selectionDownloadName(count: number): string {
61
63
  /** Authentication flavors a host entry may carry (P0: direct only, no jump/agent). */
62
64
  export type RemoteAuthKind = 'key' | 'password'
63
65
 
66
+ /**
67
+ * How one host reaches the network.
68
+ *
69
+ * Two levels exist on purpose: a profile-wide default (`RemoteProxySettingsView`)
70
+ * and a per-host override. `inherit` is the default state of every existing
71
+ * host, and the default default is `direct`, so an upgrade changes nothing.
72
+ */
73
+ export type RemoteProxyMode = 'inherit' | 'direct' | 'proxy' | 'jump'
74
+
75
+ /** One stored proxy endpoint (secrets included: host-side only). */
76
+ export interface RemoteProxySetting {
77
+ kind: 'http' | 'socks5'
78
+ /** Proxy hostname or IP. */
79
+ host: string
80
+ /** Proxy port. */
81
+ port: number
82
+ /** Basic auth (http) / user+password (socks5). */
83
+ username?: string
84
+ password?: string
85
+ }
86
+
87
+ /** A host's proxy decision, as stored. */
88
+ export interface RemoteHostProxySetting {
89
+ mode: RemoteProxyMode
90
+ /** The endpoint for `mode: 'proxy'`. */
91
+ proxy?: RemoteProxySetting
92
+ /** The jump host for `mode: 'jump'` — an alias of another stored host. */
93
+ jump?: { viaAlias: string }
94
+ }
95
+
96
+ /** Secret-free proxy endpoint for the browser. */
97
+ export interface RemoteProxyTargetView {
98
+ kind: 'http' | 'socks5'
99
+ host: string
100
+ port: number
101
+ username?: string
102
+ /** True when a password is stored (never echoed back). */
103
+ hasPassword: boolean
104
+ }
105
+
106
+ /** Secret-free proxy decision of one host. */
107
+ export interface RemoteHostProxyView {
108
+ mode: RemoteProxyMode
109
+ target?: RemoteProxyTargetView
110
+ /** Alias of the jump host, for `mode: 'jump'`. */
111
+ jumpVia?: string
112
+ /**
113
+ * Why this setting cannot be used, when it cannot.
114
+ *
115
+ * A jump host that names itself, a chain longer than one hop, or a jump host
116
+ * that is itself reached through a jump is refused at dial time; saying so in
117
+ * the host's own row beats a generic "connection failed".
118
+ */
119
+ problem?: string
120
+ }
121
+
122
+ /** Profile-wide proxy default (the "upper" of the two levels). */
123
+ export interface RemoteProxySettingsView {
124
+ defaultMode: 'direct' | 'proxy'
125
+ target?: RemoteProxyTargetView
126
+ }
127
+
128
+ /** Patch shape for the profile-wide proxy default. */
129
+ export interface RemoteProxySettingsPatch {
130
+ defaultMode?: 'direct' | 'proxy'
131
+ /** `null` clears the stored endpoint; omitted keeps it. */
132
+ target?: RemoteProxySetting | null
133
+ }
134
+
64
135
  /** One stored host entry (the $DSH_HOME/dsh-remote.json store shape). */
65
136
  export interface RemoteHostEntry {
66
137
  /** Stable, user-chosen identifier used by every operation. */
@@ -85,6 +156,8 @@ export interface RemoteHostEntry {
85
156
  description?: string
86
157
  /** Free-form tags. */
87
158
  tags: string[]
159
+ /** How this host is reached (absent = `inherit`). */
160
+ proxy?: RemoteHostProxySetting
88
161
  /** Last deploy pipeline outcome for this host. */
89
162
  deploy?: RemoteDeployState | undefined
90
163
  createdAt: number
@@ -104,6 +177,8 @@ export interface RemoteHostSummary {
104
177
  managedKey: boolean
105
178
  description?: string
106
179
  tags: string[]
180
+ /** Secret-free proxy decision; always present (mode `inherit` when unset). */
181
+ proxy: RemoteHostProxyView
107
182
  deploy?: RemoteDeployState | undefined
108
183
  createdAt: number
109
184
  updatedAt: number
@@ -195,6 +270,37 @@ export interface RemoteTimeouts {
195
270
  readMs: number
196
271
  }
197
272
 
273
+ /**
274
+ * Where one SSH connection ACTUALLY left this machine.
275
+ *
276
+ * The user's question ("did this really go through the jump host?") cannot be
277
+ * answered by the stored configuration: a host can be configured for a jump host
278
+ * while a connection established BEFORE that edit is still serving. So the pool
279
+ * reports the route of the connection it is holding, and the browser shows it on
280
+ * the connection chip.
281
+ *
282
+ * `detail` is the hop itself (the target `host:port`, the proxy `host:port`, or
283
+ * the jump host alias) and NOT a formatted sentence: the wording is UI copy and
284
+ * therefore belongs to the localized client.
285
+ */
286
+ export interface EgressInfo {
287
+ kind: 'direct' | 'proxy' | 'jump'
288
+ /** The hop: the target endpoint, the proxy endpoint, or the jump host alias. */
289
+ detail: string
290
+ /** Jump route only: the alias of the host whose connection carries the tunnel. */
291
+ viaAlias?: string
292
+ /** Proxy route only: whether this host or the profile default chose the proxy. */
293
+ source?: 'host' | 'default'
294
+ /** Proxy route only: the protocol, so the UI can name it (HTTP / SOCKS5). */
295
+ proxyKind?: 'http' | 'socks5'
296
+ /**
297
+ * Set only on a CONFIGURED route whose resolution failed (a jump host that is
298
+ * gone, a self-jump, a half-configured proxy): the reason, so the chip can say
299
+ * why the route cannot work instead of silently reading as healthy.
300
+ */
301
+ problem?: string
302
+ }
303
+
198
304
  /**
199
305
  * Connection health for one host alias, as the Host's pool sees it.
200
306
  *
@@ -215,6 +321,18 @@ export interface RemoteConnectionStatus {
215
321
  errorAt?: number
216
322
  /** Human-readable failure the client can show in the status chip. */
217
323
  error?: string
324
+ /**
325
+ * The route the connection this pool HOLDS was actually opened through.
326
+ * Present only while such a connection exists: it is evidence about a live
327
+ * link, not about the current configuration.
328
+ */
329
+ egress?: EgressInfo
330
+ /**
331
+ * The route the stored configuration resolves to, for an alias with no live
332
+ * connection (what the NEXT connection would use, and the honest answer while
333
+ * nothing is dialed). Carries `problem` when the configuration is unusable.
334
+ */
335
+ configured?: EgressInfo
218
336
  }
219
337
 
220
338
  /** Remote OS probe outcome. */
@@ -791,6 +909,16 @@ export interface RemoteForwardState {
791
909
  bytesOut: number
792
910
  /** Last connect/bind failure, human-readable. */
793
911
  lastError?: string
912
+ /**
913
+ * Which SSH connection the last successful channel used.
914
+ *
915
+ * `dedicated` = the host's own port-forward connection (the normal case);
916
+ * `shared` = the server refused the extra connection, so the channel rode the
917
+ * shared one (the forward still works, only the isolation is lost). Absent
918
+ * until a connection has succeeded at least once — older hosts omit it too, so
919
+ * a client must treat it as optional.
920
+ */
921
+ transport?: 'dedicated' | 'shared'
794
922
  startedAt: number
795
923
  }
796
924