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.
Files changed (46) hide show
  1. package/README.en.md +63 -7
  2. package/README.md +51 -7
  3. package/lib/client.js +393 -112
  4. package/lib/index.js +2271 -160
  5. package/lib/p2-router-fs.js +1 -1
  6. package/lib/types/changes/recorder.d.ts +65 -10
  7. package/lib/types/changes/status.d.ts +48 -3
  8. package/lib/types/client/ConnectionsSection.d.ts +73 -0
  9. package/lib/types/client/HostsView.d.ts +139 -2
  10. package/lib/types/client/api.d.ts +65 -2
  11. package/lib/types/client/connection.d.ts +28 -1
  12. package/lib/types/client/scm/actions.d.ts +25 -1
  13. package/lib/types/forward.d.ts +11 -1
  14. package/lib/types/p2/helper-rpc.d.ts +48 -0
  15. package/lib/types/p2/worlds.d.ts +28 -0
  16. package/lib/types/pool.d.ts +337 -8
  17. package/lib/types/protocol.d.ts +218 -0
  18. package/lib/types/proxy.d.ts +136 -0
  19. package/lib/types/store.d.ts +81 -1
  20. package/lib/types/tools.d.ts +3 -0
  21. package/lib/{worlds-RG8K5eom.js → worlds-CRRZMZhg.js} +85 -6
  22. package/package.json +1 -1
  23. package/src/changes/recorder.ts +151 -15
  24. package/src/changes/status.ts +59 -4
  25. package/src/client/ConnectionStatus.tsx +19 -5
  26. package/src/client/ConnectionsSection.tsx +359 -0
  27. package/src/client/HostsView.tsx +552 -11
  28. package/src/client/MonitorView.tsx +14 -0
  29. package/src/client/PortsView.tsx +16 -0
  30. package/src/client/SettingsHosts.tsx +132 -6
  31. package/src/client/api.ts +102 -4
  32. package/src/client/connection.ts +76 -2
  33. package/src/client/i18n.ts +152 -2
  34. package/src/client/scm/actions.ts +63 -12
  35. package/src/client/vsc/vsc.css +281 -0
  36. package/src/forward.ts +38 -2
  37. package/src/importers.ts +125 -13
  38. package/src/keygen.ts +8 -1
  39. package/src/p2/helper-rpc.ts +73 -5
  40. package/src/p2/worlds.ts +48 -0
  41. package/src/pool.ts +1120 -100
  42. package/src/protocol.ts +228 -0
  43. package/src/proxy.ts +673 -0
  44. package/src/routes.ts +139 -5
  45. package/src/store.ts +335 -0
  46. package/src/tools.ts +47 -2
@@ -31,6 +31,10 @@ export declare const REMOTE_API: {
31
31
  readonly routing: "/api/dsh-remote/routing";
32
32
  /** Client view preferences (auto-open the remote page + its width share). */
33
33
  readonly viewSettings: "/api/dsh-remote/view-settings";
34
+ /** Profile-wide proxy default (per-host overrides live on the host rows). */
35
+ readonly proxySettings: "/api/dsh-remote/proxy-settings";
36
+ /** Live SSH pool shape per host: connections, channels, slot occupancy. */
37
+ readonly connections: "/api/dsh-remote/connections";
34
38
  /** Current working directory of one live session (click resolution helper). */
35
39
  readonly sessionCwd: "/api/dsh-remote/session-cwd";
36
40
  /** What one live session changed on its remote host (the review panel). */
@@ -54,6 +58,70 @@ export declare const MAX_SELECTION_DOWNLOAD = 100;
54
58
  export declare function selectionDownloadName(count: number): string;
55
59
  /** Authentication flavors a host entry may carry (P0: direct only, no jump/agent). */
56
60
  export type RemoteAuthKind = 'key' | 'password';
61
+ /**
62
+ * How one host reaches the network.
63
+ *
64
+ * Two levels exist on purpose: a profile-wide default (`RemoteProxySettingsView`)
65
+ * and a per-host override. `inherit` is the default state of every existing
66
+ * host, and the default default is `direct`, so an upgrade changes nothing.
67
+ */
68
+ export type RemoteProxyMode = 'inherit' | 'direct' | 'proxy' | 'jump';
69
+ /** One stored proxy endpoint (secrets included: host-side only). */
70
+ export interface RemoteProxySetting {
71
+ kind: 'http' | 'socks5';
72
+ /** Proxy hostname or IP. */
73
+ host: string;
74
+ /** Proxy port. */
75
+ port: number;
76
+ /** Basic auth (http) / user+password (socks5). */
77
+ username?: string;
78
+ password?: string;
79
+ }
80
+ /** A host's proxy decision, as stored. */
81
+ export interface RemoteHostProxySetting {
82
+ mode: RemoteProxyMode;
83
+ /** The endpoint for `mode: 'proxy'`. */
84
+ proxy?: RemoteProxySetting;
85
+ /** The jump host for `mode: 'jump'` — an alias of another stored host. */
86
+ jump?: {
87
+ viaAlias: string;
88
+ };
89
+ }
90
+ /** Secret-free proxy endpoint for the browser. */
91
+ export interface RemoteProxyTargetView {
92
+ kind: 'http' | 'socks5';
93
+ host: string;
94
+ port: number;
95
+ username?: string;
96
+ /** True when a password is stored (never echoed back). */
97
+ hasPassword: boolean;
98
+ }
99
+ /** Secret-free proxy decision of one host. */
100
+ export interface RemoteHostProxyView {
101
+ mode: RemoteProxyMode;
102
+ target?: RemoteProxyTargetView;
103
+ /** Alias of the jump host, for `mode: 'jump'`. */
104
+ jumpVia?: string;
105
+ /**
106
+ * Why this setting cannot be used, when it cannot.
107
+ *
108
+ * A jump host that names itself, a chain longer than one hop, or a jump host
109
+ * that is itself reached through a jump is refused at dial time; saying so in
110
+ * the host's own row beats a generic "connection failed".
111
+ */
112
+ problem?: string;
113
+ }
114
+ /** Profile-wide proxy default (the "upper" of the two levels). */
115
+ export interface RemoteProxySettingsView {
116
+ defaultMode: 'direct' | 'proxy';
117
+ target?: RemoteProxyTargetView;
118
+ }
119
+ /** Patch shape for the profile-wide proxy default. */
120
+ export interface RemoteProxySettingsPatch {
121
+ defaultMode?: 'direct' | 'proxy';
122
+ /** `null` clears the stored endpoint; omitted keeps it. */
123
+ target?: RemoteProxySetting | null;
124
+ }
57
125
  /** One stored host entry (the $DSH_HOME/dsh-remote.json store shape). */
58
126
  export interface RemoteHostEntry {
59
127
  /** Stable, user-chosen identifier used by every operation. */
@@ -78,6 +146,8 @@ export interface RemoteHostEntry {
78
146
  description?: string;
79
147
  /** Free-form tags. */
80
148
  tags: string[];
149
+ /** How this host is reached (absent = `inherit`). */
150
+ proxy?: RemoteHostProxySetting;
81
151
  /** Last deploy pipeline outcome for this host. */
82
152
  deploy?: RemoteDeployState | undefined;
83
153
  createdAt: number;
@@ -96,6 +166,8 @@ export interface RemoteHostSummary {
96
166
  managedKey: boolean;
97
167
  description?: string;
98
168
  tags: string[];
169
+ /** Secret-free proxy decision; always present (mode `inherit` when unset). */
170
+ proxy: RemoteHostProxyView;
99
171
  deploy?: RemoteDeployState | undefined;
100
172
  createdAt: number;
101
173
  updatedAt: number;
@@ -172,6 +244,36 @@ export interface RemoteTimeouts {
172
244
  /** One SFTP file read (editor, diff sides, document preview). */
173
245
  readMs: number;
174
246
  }
247
+ /**
248
+ * Where one SSH connection ACTUALLY left this machine.
249
+ *
250
+ * The user's question ("did this really go through the jump host?") cannot be
251
+ * answered by the stored configuration: a host can be configured for a jump host
252
+ * while a connection established BEFORE that edit is still serving. So the pool
253
+ * reports the route of the connection it is holding, and the browser shows it on
254
+ * the connection chip.
255
+ *
256
+ * `detail` is the hop itself (the target `host:port`, the proxy `host:port`, or
257
+ * the jump host alias) and NOT a formatted sentence: the wording is UI copy and
258
+ * therefore belongs to the localized client.
259
+ */
260
+ export interface EgressInfo {
261
+ kind: 'direct' | 'proxy' | 'jump';
262
+ /** The hop: the target endpoint, the proxy endpoint, or the jump host alias. */
263
+ detail: string;
264
+ /** Jump route only: the alias of the host whose connection carries the tunnel. */
265
+ viaAlias?: string;
266
+ /** Proxy route only: whether this host or the profile default chose the proxy. */
267
+ source?: 'host' | 'default';
268
+ /** Proxy route only: the protocol, so the UI can name it (HTTP / SOCKS5). */
269
+ proxyKind?: 'http' | 'socks5';
270
+ /**
271
+ * Set only on a CONFIGURED route whose resolution failed (a jump host that is
272
+ * gone, a self-jump, a half-configured proxy): the reason, so the chip can say
273
+ * why the route cannot work instead of silently reading as healthy.
274
+ */
275
+ problem?: string;
276
+ }
175
277
  /**
176
278
  * Connection health for one host alias, as the Host's pool sees it.
177
279
  *
@@ -192,6 +294,112 @@ export interface RemoteConnectionStatus {
192
294
  errorAt?: number;
193
295
  /** Human-readable failure the client can show in the status chip. */
194
296
  error?: string;
297
+ /**
298
+ * The route the connection this pool HOLDS was actually opened through.
299
+ * Present only while such a connection exists: it is evidence about a live
300
+ * link, not about the current configuration.
301
+ */
302
+ egress?: EgressInfo;
303
+ /**
304
+ * The route the stored configuration resolves to, for an alias with no live
305
+ * connection (what the NEXT connection would use, and the honest answer while
306
+ * nothing is dialed). Carries `problem` when the configuration is unusable.
307
+ */
308
+ configured?: EgressInfo;
309
+ }
310
+ /** One pool connection kind: whether it is dialed, and how many channels ride it. */
311
+ export interface RemotePoolLane {
312
+ /**
313
+ * The connection is fully dialed. A dial still in flight is NOT open (the pool
314
+ * creates its bookkeeping entry before the Client exists), and every lane is
315
+ * always present: a kind that is not dialed reports `false` here with zero
316
+ * channels and zero rounds, so "not in use" is a value, not a missing field.
317
+ */
318
+ open: boolean;
319
+ /** Channels currently open on this connection (exec sessions, SFTP sessions, PTY, tunnels). */
320
+ channels: number;
321
+ /** Rounds currently pinned to it (an operation in flight keeps the connection alive). */
322
+ held: number;
323
+ }
324
+ /** Channel-slot occupancy of one budget: what is running and what is waiting behind it. */
325
+ export interface RemotePoolSlots {
326
+ /** Operations holding a channel right now. */
327
+ active: number;
328
+ /** Operations queued for one (they fail after a bounded wait). */
329
+ queued: number;
330
+ /** How many may run at once. */
331
+ limit: number;
332
+ }
333
+ /**
334
+ * Live SSH pool shape of one host.
335
+ *
336
+ * Read-only diagnostics for the monitor page: "why is this slow" is usually one
337
+ * of three answers — too few connections (everything shares one TCP), the channel
338
+ * budget is full, or a queue has built up behind a stalled operation. Each is a
339
+ * number here, so the page can show the answer instead of a hunch.
340
+ */
341
+ export interface RemoteHostPoolStats {
342
+ alias: string;
343
+ /** The four connection classes the pool can hold for one host. */
344
+ connections: {
345
+ /** Everything that is not isolated: exec, git, monitor, helper, agent tools. */
346
+ shared: RemotePoolLane;
347
+ /** Interactive terminals (their own connection). */
348
+ pty: RemotePoolLane;
349
+ /** Local port forwards (their own connection). */
350
+ forward: RemotePoolLane;
351
+ /** File operations: browse, read, write, upload, download (their own connection). */
352
+ sftp: RemotePoolLane;
353
+ /**
354
+ * The SSH helper (p2 transport: the file/Git fast path).
355
+ *
356
+ * Optional because the helper dials from `p2/worlds.ts`, not from the pool: a
357
+ * Host that cannot report it (or has no helper deployed) omits the key rather
358
+ * than claiming "closed". When present, `channels` is the helper's own session
359
+ * and `held` counts the RPC calls in flight — a helper that is saturated shows
360
+ * up here instead of looking like an idle connection.
361
+ */
362
+ helper?: RemotePoolLane;
363
+ };
364
+ /** Channel budget of the shared connection (exec sessions, plus SFTP that fell back). */
365
+ slots: RemotePoolSlots;
366
+ /** Channel budget of the dedicated SFTP connection (absent while it is not used). */
367
+ sftpSlots?: RemotePoolSlots;
368
+ /**
369
+ * Channel budget of the NETWORK-verb lane (git fetch/pull/push/sync).
370
+ *
371
+ * These verbs can hold a channel for the whole network timeout (20 minutes by
372
+ * default), so they get their own small budget instead of eating the shared
373
+ * exec slots. Absent while no network verb is running and none is queued.
374
+ */
375
+ netSlots?: RemotePoolSlots;
376
+ /**
377
+ * Channel budget of the GIT-COMMAND lane (git status / diff / log, the session
378
+ * ledger's own scans, and the SCM panel's local writes such as commit / stage).
379
+ *
380
+ * A repository-wide `git status` is the longest single command the plugin runs
381
+ * outside the network verbs (300 s by default, 30 min at the ceiling) and it
382
+ * shares the connection with monitoring, the process panel and agent tools. Its
383
+ * own budget keeps a slow command from spending the exec slots those poll on.
384
+ * Absent while no git command is running and none is queued.
385
+ */
386
+ gitSlots?: RemotePoolSlots;
387
+ /** Route the shared connection was opened through, when it is open. */
388
+ egress?: EgressInfo;
389
+ /**
390
+ * File operations are riding the SHARED connection right now, because the host
391
+ * refused one of its own.
392
+ *
393
+ * Sticky until a dedicated connection succeeds again or the host is edited. It
394
+ * is diagnostic, not an error: the files still work, they just lost the
395
+ * isolation (and a browse refresh can queue behind exec again), which is
396
+ * exactly the thing a user staring at the monitor page cannot see otherwise.
397
+ */
398
+ sftpFallback?: boolean;
399
+ }
400
+ /** Response of {@link REMOTE_API.connections}. */
401
+ export interface RemotePoolStatsResult {
402
+ hosts: RemoteHostPoolStats[];
195
403
  }
196
404
  /** Remote OS probe outcome. */
197
405
  export interface RemoteProbe {
@@ -771,6 +979,16 @@ export interface RemoteForwardState {
771
979
  bytesOut: number;
772
980
  /** Last connect/bind failure, human-readable. */
773
981
  lastError?: string;
982
+ /**
983
+ * Which SSH connection the last successful channel used.
984
+ *
985
+ * `dedicated` = the host's own port-forward connection (the normal case);
986
+ * `shared` = the server refused the extra connection, so the channel rode the
987
+ * shared one (the forward still works, only the isolation is lost). Absent
988
+ * until a connection has succeeded at least once — older hosts omit it too, so
989
+ * a client must treat it as optional.
990
+ */
991
+ transport?: 'dedicated' | 'shared';
774
992
  startedAt: number;
775
993
  }
776
994
  /** One listening TCP socket on the remote host. */
@@ -0,0 +1,136 @@
1
+ /**
2
+ * Outbound proxy support for SSH dials.
3
+ *
4
+ * Why this is not just `HTTP_PROXY`: ssh2 dials a raw TCP socket, and the
5
+ * harness's proxy plumbing (`@deepseek-ai/dsh-http-proxy`) only wraps `fetch`,
6
+ * so a host that can only be reached through a proxy needs the tunnel built
7
+ * here. Three flavours, in the order a user meets them:
8
+ *
9
+ * - `http` — `CONNECT host:port`, optional `Proxy-Authorization: Basic …`;
10
+ * - `socks5` — greeting / optional user+password sub-negotiation / CONNECT;
11
+ * - jump (`ProxyJump` / `ProxyCommand ssh -W`) — NOT dialled here: the pool
12
+ * opens a `direct-tcpip` channel on ANOTHER pooled connection and hands it
13
+ * to ssh2 as its socket. This module only parses those specs into a target.
14
+ *
15
+ * **Error taxonomy is the point.** "The proxy refused the tunnel" and "the
16
+ * target closed the port" and "your password is wrong" all fail the dial, and
17
+ * the user debugs the wrong thing if they all read "connection failed". Each
18
+ * failure therefore leaves as a `ProxyError` with a stable `reason` and one
19
+ * actionable sentence.
20
+ *
21
+ * **Bytes are never lost.** A proxy may send tunnel bytes in the same packet as
22
+ * its handshake reply; everything read past the handshake is pushed back onto
23
+ * the socket before it is handed to ssh2, or the SSH banner would be swallowed
24
+ * and the handshake would stall.
25
+ *
26
+ * @module
27
+ */
28
+ import { type Socket } from 'node:net';
29
+ /** Proxy flavours this plugin dials itself. A jump host is not one of them. */
30
+ export type ProxyKind = 'http' | 'socks5';
31
+ /** One validated proxy endpoint (secrets included: host-side only). */
32
+ export interface ProxyConfig {
33
+ kind: ProxyKind;
34
+ /** Proxy hostname / IPv4 / IPv6 literal. */
35
+ host: string;
36
+ port: number;
37
+ /** Basic auth (http) or user/password sub-negotiation (socks5). */
38
+ username?: string;
39
+ password?: string;
40
+ }
41
+ /** A `ProxyJump` / `ProxyCommand ssh -W` hop, parsed but not yet resolved. */
42
+ export interface JumpTarget {
43
+ /** Login user named in the spec, when it had one. */
44
+ user?: string;
45
+ host: string;
46
+ port: number;
47
+ }
48
+ /** Every way a proxy dial can fail, as a stable value (not a message). */
49
+ export type ProxyFailure =
50
+ /** The proxy itself could not be reached (TCP refused/unreachable). */
51
+ 'unreachable'
52
+ /** The proxy accepted TCP but never finished talking to us. */
53
+ | 'timeout'
54
+ /** The proxy demanded credentials we do not have, or rejected ours. */
55
+ | 'auth'
56
+ /** The proxy answered, and refused the tunnel (bad status / SOCKS reply). */
57
+ | 'refused'
58
+ /** The proxy answered with something that is not the protocol we speak. */
59
+ | 'protocol'
60
+ /** The destination is not a legal target (bad port, empty host). */
61
+ | 'target';
62
+ /** A proxy dial failure that knows which layer broke. */
63
+ export declare class ProxyError extends Error {
64
+ readonly reason: ProxyFailure;
65
+ /** Which proxy kind was attempted (absent for target validation). */
66
+ readonly kind?: ProxyKind | undefined;
67
+ constructor(reason: ProxyFailure, message: string,
68
+ /** Which proxy kind was attempted (absent for target validation). */
69
+ kind?: ProxyKind | undefined);
70
+ }
71
+ /**
72
+ * Validate one proxy endpoint.
73
+ *
74
+ * @param input - value as it arrived from the browser / store file.
75
+ * @returns the normalized config (empty credentials dropped).
76
+ * @throws {ProxyError} `target` when a field is unusable, with the field named.
77
+ */
78
+ export declare function normalizeProxy(input: unknown): ProxyConfig;
79
+ /** True when a value looks like a proxy config at all (shape, not validity). */
80
+ export declare function looksLikeProxy(value: unknown): boolean;
81
+ /**
82
+ * Parse an OpenSSH `ProxyJump` value (`jump`, `user@jump:2222`, `a,b`).
83
+ *
84
+ * Only a single hop is supported: the pool builds the tunnel on one existing
85
+ * pooled connection, and a chain would need nested channels whose failure modes
86
+ * we cannot explain to the user yet. Multi-hop is therefore a named refusal
87
+ * rather than a silent half-feature.
88
+ */
89
+ export declare function parseProxyJump(value: string): {
90
+ ok: true;
91
+ target: JumpTarget;
92
+ } | {
93
+ ok: false;
94
+ reason: string;
95
+ };
96
+ /** What a `ProxyCommand` line means to this plugin. */
97
+ export type ProxyCommandPlan = {
98
+ kind: 'proxy';
99
+ proxy: Omit<ProxyConfig, 'username' | 'password'>;
100
+ } | {
101
+ kind: 'jump';
102
+ target: JumpTarget;
103
+ } | {
104
+ kind: 'unsupported';
105
+ reason: string;
106
+ };
107
+ /**
108
+ * Map the ProxyCommand forms users actually write onto a tunnel we can build.
109
+ *
110
+ * Recognised: `ssh … -W %h:%p [user@]host`, `nc -X connect -x host:port %h %p`
111
+ * (http), `nc -x host:port %h %p` (socks5), `ncat --proxy … --proxy-type …`.
112
+ * Everything else is refused by name — a ProxyCommand is a shell command, and
113
+ * running one from a browser-supplied config is not a feature this plugin
114
+ * offers.
115
+ */
116
+ export declare function parseProxyCommand(command: string): ProxyCommandPlan;
117
+ /** How this module reaches a TCP socket (a seam for the gates). */
118
+ export type SocketFactory = (host: string, port: number) => Socket;
119
+ /** One tunnel request. */
120
+ export interface OpenProxyOptions {
121
+ /** Total budget for connect + handshake (default 8000 ms). */
122
+ timeoutMs?: number;
123
+ /** Test seam: replaces `net.createConnection`. */
124
+ connect?: SocketFactory;
125
+ }
126
+ /** Default budget: a proxy that cannot answer in this long is not worth waiting for. */
127
+ export declare const PROXY_TIMEOUT_MS = 8000;
128
+ /**
129
+ * Dial `host:port` through `proxy` and hand back the tunnelled socket.
130
+ *
131
+ * The caller owns the socket (ssh2 takes it as its transport). Everything read
132
+ * past the handshake is pushed back, so the SSH banner is not swallowed.
133
+ *
134
+ * @throws {ProxyError} when the proxy layer — not SSH — is what failed.
135
+ */
136
+ export declare function openProxySocket(proxy: ProxyConfig, host: string, port: number, options?: OpenProxyOptions): Promise<Socket>;
@@ -1,4 +1,5 @@
1
- import type { RemoteDeployState, RemoteHostEntry, RemoteHostSummary, RemoteWorkspaceBinding } from './protocol.ts';
1
+ import { type ProxyConfig } from './proxy.ts';
2
+ import type { RemoteDeployState, RemoteHostEntry, RemoteHostProxySetting, RemoteProxySettingsPatch, RemoteProxySettingsView, RemoteHostSummary, RemoteWorkspaceBinding } from './protocol.ts';
2
3
  /** Payload accepted by create/update (secrets included, host-side only). */
3
4
  export interface HostPayload {
4
5
  alias: string;
@@ -11,6 +12,8 @@ export interface HostPayload {
11
12
  passphrase?: string;
12
13
  password?: string;
13
14
  };
15
+ /** How this host reaches the network; omitted = `inherit` (back-compat). */
16
+ proxy?: RemoteHostProxySetting;
14
17
  description?: string;
15
18
  tags?: string[];
16
19
  }
@@ -19,6 +22,22 @@ export interface WorkspacePayload {
19
22
  alias: string;
20
23
  remotePath: string;
21
24
  }
25
+ /**
26
+ * The effective network route one dial must take (see `resolveProxy`).
27
+ *
28
+ * `source` is kept because "the profile default sent me through a proxy" and "this
29
+ * host says so" are different answers to the same question in `remote_hosts`.
30
+ */
31
+ export type ResolvedProxy = {
32
+ kind: 'direct';
33
+ } | {
34
+ kind: 'proxy';
35
+ proxy: ProxyConfig;
36
+ source: 'host' | 'default';
37
+ } | {
38
+ kind: 'jump';
39
+ viaAlias: string;
40
+ };
22
41
  export declare class RemoteStore {
23
42
  private readonly file;
24
43
  private doc;
@@ -87,8 +106,69 @@ export declare class RemoteStore {
87
106
  */
88
107
  remove(alias: string): boolean;
89
108
  private normalize;
109
+ /**
110
+ * Validate one host's stored proxy decision.
111
+ *
112
+ * The rules are the ones the two-level model needs to stay explainable:
113
+ * - the mode is one of the four declared values;
114
+ * - `proxy` needs an endpoint, `jump` needs another EXISTING alias (a host
115
+ * cannot jump through itself, and a chain is impossible to resolve with one
116
+ * pooled hop);
117
+ * - fields that the chosen mode does not use are DROPPED rather than stored, so
118
+ * switching modes cannot leave a stale endpoint behind that a later reader
119
+ * would take for the active one.
120
+ *
121
+ * @returns the normalized setting, or undefined for `inherit` (stored as the
122
+ * field's absence, which is what older files have).
123
+ */
124
+ private validateHostProxy;
125
+ /**
126
+ * Why a host's proxy decision cannot be used, when it cannot.
127
+ *
128
+ * Reads NEVER throw for this: a host that points at a deleted jump host must
129
+ * still be listed (with the reason on its row) instead of making the whole host
130
+ * list fail. The dial path asks {@link resolveProxy}, which does fail closed.
131
+ */
132
+ private proxyProblem;
133
+ /** Secret-free view of one stored proxy endpoint. */
134
+ private targetView;
135
+ /** Secret-free view of one host's proxy decision (always present). */
136
+ private proxyView;
90
137
  /** Secret-free projection for browser/agent surfaces. */
91
138
  summarize(entry: RemoteHostEntry): RemoteHostSummary;
139
+ /** Secret-free view of the profile-wide proxy default (read-only). */
140
+ getDefaultProxy(): RemoteProxySettingsView;
141
+ /** View of the in-memory document (no reload: callers already reloaded). */
142
+ private defaultProxyView;
143
+ /**
144
+ * Patch the profile-wide proxy default.
145
+ *
146
+ * `target` semantics follow the host form: omitted keeps the stored endpoint,
147
+ * `null` clears it, an object replaces it — and an EMPTY PASSWORD keeps the
148
+ * stored one, because the browser never receives secrets back.
149
+ */
150
+ patchDefaultProxy(patch: RemoteProxySettingsPatch): RemoteProxySettingsView;
151
+ /**
152
+ * Normalize a patched endpoint, keeping the stored password on an empty one.
153
+ *
154
+ * "Empty means keep" is only sound for the SAME endpoint: the browser never
155
+ * receives the secret back, so every PATCH of a proxied host arrives without
156
+ * one — but when kind/host/port/username changed, the stored password is a
157
+ * credential for a DIFFERENT server, and carrying it over would send the old
158
+ * secret to a new address (a 407 at best, a leaked credential at worst). A
159
+ * changed endpoint therefore drops it and the user re-enters it.
160
+ */
161
+ private mergeProxyTarget;
162
+ /**
163
+ * Resolve one host's EFFECTIVE route, in the precedence the UI describes:
164
+ * the host's own decision, else the profile default, else direct.
165
+ *
166
+ * Unlike {@link summarize}, this FAILS CLOSED for an unusable jump: dialing
167
+ * through a deleted host (or a second jump) cannot work, and the caller must say
168
+ * why instead of silently connecting some other way.
169
+ */
170
+ resolveProxy(alias: string): ResolvedProxy;
171
+ private requireStoredProxy;
92
172
  setDeploy(alias: string, state: RemoteDeployState): void;
93
173
  listWorkspaces(): RemoteWorkspaceBinding[];
94
174
  createWorkspace(payload: WorkspacePayload): RemoteWorkspaceBinding;
@@ -6,6 +6,7 @@
6
6
  import { defineTool } from '@deepseek-ai/dsh-tools';
7
7
  import type { RemotePool } from './pool.ts';
8
8
  import type { RemoteStore } from './store.ts';
9
+ import type { RemoteHostProxyView } from './protocol.ts';
9
10
  /** Agent-facing host row (schema-strict projection of RemoteHostSummary). */
10
11
  export interface AgentHostRow {
11
12
  alias: string;
@@ -17,6 +18,8 @@ export interface AgentHostRow {
17
18
  managedKey: boolean;
18
19
  description?: string;
19
20
  tags: string[];
21
+ /** Effective network route (secret-free), as the host list reports it. */
22
+ proxy: RemoteHostProxyView;
20
23
  createdAt: number;
21
24
  updatedAt: number;
22
25
  }