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.
@@ -12,24 +12,36 @@
12
12
  * the two surfaces list the same hosts/bindings, and a workspace created here
13
13
  * used to stay invisible in the Remote tab until the whole page reloaded.
14
14
  */
15
- import { useCallback, useEffect, useState, type ReactNode } from 'react'
15
+ import { useCallback, useEffect, useId, useState, type ReactNode } from 'react'
16
16
  import type { SettingsSectionOwnerProps } from '@deepseek-ai/dsh-client-ui-settings/client'
17
17
  import {
18
18
  REMOTE_VIEW_SETTINGS_DEFAULTS,
19
19
  REMOTE_VIEW_WIDTH_MAX,
20
20
  REMOTE_VIEW_WIDTH_MIN,
21
21
  type RemoteHostSummary,
22
+ type RemoteProxySettingsPatch,
23
+ type RemoteProxySettingsView,
22
24
  type RemoteRoutingStatus,
23
25
  type RemoteViewSettings,
24
26
  type RemoteWorkspaceBinding,
25
27
  } from '../protocol.ts'
26
28
  import { RemoteApiError, api } from './api.ts'
27
- import { HostsView } from './HostsView.tsx'
29
+ import {
30
+ HostsView,
31
+ ProxyFields,
32
+ ProxySectionHeader,
33
+ defaultProxyStateOf,
34
+ proxyFormProblem,
35
+ proxySummary,
36
+ proxyTargetOf,
37
+ type ProxyChipModel,
38
+ type ProxyFormState,
39
+ } from './HostsView.tsx'
28
40
  import { refreshAll as refreshSidebarStore } from './store.tsx'
29
41
  import { loadViewSettings, saveViewSettings } from './view-settings.ts'
30
42
  import { WorkspacesView } from './WorkspacesView.tsx'
31
43
  import { detectLang, makeT } from './i18n.ts'
32
- import { Notice, Row, hairline, optionStyle, selectStyle } from './ui.tsx'
44
+ import { Btn, Notice, Row, hairline, optionStyle, selectStyle } from './ui.tsx'
33
45
 
34
46
  export function SettingsHostsSection(_props: SettingsSectionOwnerProps): ReactNode {
35
47
  const [t] = useState(() => makeT(detectLang()))
@@ -44,11 +56,23 @@ export function SettingsHostsSection(_props: SettingsSectionOwnerProps): ReactNo
44
56
  /** The width slider's live value while dragging; persisted on release. */
45
57
  const [ratio, setRatio] = useState(REMOTE_VIEW_SETTINGS_DEFAULTS.remoteWorkspaceWidthRatio)
46
58
  const [viewSaving, setViewSaving] = useState(false)
59
+ /** Profile-wide egress default (the card above the view preferences). */
60
+ const [proxySettings, setProxySettings] = useState<RemoteProxySettingsView | undefined>(undefined)
61
+ const [proxyDraft, setProxyDraft] = useState<ProxyFormState>(() => defaultProxyStateOf(undefined))
62
+ const [proxyOpen, setProxyOpen] = useState(false)
63
+ const [proxySaving, setProxySaving] = useState(false)
64
+ const [proxyError, setProxyError] = useState<string | undefined>(undefined)
65
+ const proxyPanelId = useId()
66
+ const proxyGroupName = useId()
47
67
 
48
68
  const refresh = useCallback(() => {
49
69
  setError(undefined)
50
- Promise.all([api.getHosts(), api.getWorkspaces(), loadViewSettings()]).then(
51
- ([rows, w, settings]) => {
70
+ // The proxy route is asked SEPARATELY and may fail on its own: an older Host
71
+ // answers 404 there, and that must not blank out the host list or the view
72
+ // preferences of an otherwise working page.
73
+ const loadProxy = api.getProxySettings().then(settings => settings, () => undefined)
74
+ Promise.all([api.getHosts(), api.getWorkspaces(), loadViewSettings(), loadProxy]).then(
75
+ ([rows, w, settings, proxy]) => {
52
76
  setHosts(rows)
53
77
  setMode(w.mode)
54
78
  setVersion(w.version)
@@ -56,6 +80,10 @@ export function SettingsHostsSection(_props: SettingsSectionOwnerProps): ReactNo
56
80
  setView(settings)
57
81
  setRatio(settings.remoteWorkspaceWidthRatio)
58
82
  }
83
+ if (proxy !== undefined) {
84
+ setProxySettings(proxy)
85
+ setProxyDraft(defaultProxyStateOf(proxy))
86
+ }
59
87
  },
60
88
  (e: unknown) => setError(e instanceof RemoteApiError ? e.message : String(e)),
61
89
  )
@@ -113,6 +141,47 @@ export function SettingsHostsSection(_props: SettingsSectionOwnerProps): ReactNo
113
141
  saveView({ remoteWorkspaceWidthRatio: ratio })
114
142
  }
115
143
 
144
+ /**
145
+ * Persist the profile-wide egress default.
146
+ *
147
+ * Only `target` is sent while the mode is `proxy` — switching to `direct`
148
+ * omits it so the stored endpoint (and its password) survives a flip back, and
149
+ * an empty password box omits the secret rather than clearing it.
150
+ */
151
+ const saveProxyDefault = (): void => {
152
+ const problem = proxyFormProblem(proxyDraft)
153
+ if (problem !== undefined) {
154
+ setProxyError(problem === 'target' ? t('proxy.invalidTarget') : t('proxy.invalidJump'))
155
+ return
156
+ }
157
+ setProxySaving(true)
158
+ setProxyError(undefined)
159
+ const patch: RemoteProxySettingsPatch = proxyDraft.mode === 'proxy'
160
+ ? { defaultMode: 'proxy', target: proxyTargetOf(proxyDraft) }
161
+ : { defaultMode: 'direct' }
162
+ api.patchProxySettings(patch).then(
163
+ (next) => {
164
+ setProxySettings(next)
165
+ setProxyDraft(defaultProxyStateOf(next))
166
+ },
167
+ (e: unknown) => setProxyError(
168
+ t('proxy.saveFailed').replace('{message}', e instanceof RemoteApiError ? e.message : String(e)),
169
+ ),
170
+ ).finally(() => setProxySaving(false))
171
+ }
172
+
173
+ // The collapsed chip reuses the form's own sentence, so the two surfaces can
174
+ // never disagree about how the route is WORDED — but it reads the STORED answer,
175
+ // not the draft: a chip that followed unsaved radio clicks would claim a route
176
+ // that is not in effect (the panel is where the pending edit belongs).
177
+ const proxyDefaultSummary = proxySummary(t, defaultProxyStateOf(proxySettings), undefined)
178
+ const proxyChip: ProxyChipModel = {
179
+ mode: proxyDraft.mode,
180
+ label: proxyDefaultSummary,
181
+ title: t('proxy.chipTitle').replace('{summary}', proxyDefaultSummary),
182
+ problem: false,
183
+ }
184
+
116
185
  return (
117
186
  <div style={{ padding: '4px 2px', fontSize: 13, lineHeight: 1.5 }}>
118
187
  <div style={{ ...hairline, borderTop: 'none', borderBottom: '1px solid rgba(127,127,127,.25)', marginBottom: 10, paddingBottom: 8 }}>
@@ -138,7 +207,64 @@ export function SettingsHostsSection(_props: SettingsSectionOwnerProps): ReactNo
138
207
  <div style={{ fontSize: 11, opacity: 0.6, marginTop: 4 }}>{t('route.hint')}</div>
139
208
  </div>
140
209
  {error !== undefined && <Notice kind="error">{error}</Notice>}
141
- <HostsView t={t} hosts={hosts} onChanged={reload} />
210
+ <HostsView t={t} hosts={hosts} proxyDefault={proxySettings} onChanged={reload} />
211
+ <div style={{ ...hairline, marginTop: 12, paddingTop: 10 }}>
212
+ <ProxySectionHeader
213
+ open={proxyOpen}
214
+ label={t('proxy.default.title')}
215
+ expandLabel={t('proxy.expand')}
216
+ collapseLabel={t('proxy.collapse')}
217
+ chip={proxyChip}
218
+ controls={proxyPanelId}
219
+ onToggle={() => setProxyOpen(!proxyOpen)}
220
+ />
221
+ <div id={proxyPanelId} hidden={!proxyOpen} className="rvs-proxy-panel">
222
+ <Row>
223
+ <label style={{ marginRight: 10, opacity: proxySaving ? 0.5 : 1 }}>
224
+ <input
225
+ type="radio"
226
+ name={proxyGroupName}
227
+ checked={proxyDraft.mode === 'direct'}
228
+ disabled={proxySaving}
229
+ onChange={() => { setProxyDraft({ ...proxyDraft, mode: 'direct' }); setProxyError(undefined) }}
230
+ />{' '}{t('proxy.mode.direct')}
231
+ </label>
232
+ <label style={{ opacity: proxySaving ? 0.5 : 1 }}>
233
+ <input
234
+ type="radio"
235
+ name={proxyGroupName}
236
+ checked={proxyDraft.mode === 'proxy'}
237
+ disabled={proxySaving}
238
+ onChange={() => { setProxyDraft({ ...proxyDraft, mode: 'proxy' }); setProxyError(undefined) }}
239
+ />{' '}{t('proxy.mode.proxy')}
240
+ </label>
241
+ </Row>
242
+ {proxyDraft.mode === 'proxy' && (
243
+ <ProxyFields
244
+ t={t}
245
+ state={proxyDraft}
246
+ onChange={(next) => { setProxyDraft(next); setProxyError(undefined) }}
247
+ /**
248
+ * Same rule as the host form: "leave it empty to keep it" only
249
+ * holds while the endpoint still matches the stored one.
250
+ */
251
+ storedPassword={proxySettings?.target?.hasPassword === true
252
+ && proxyDraft.kind === proxySettings.target.kind
253
+ && proxyDraft.host.trim() === proxySettings.target.host
254
+ && proxyDraft.port.trim() === String(proxySettings.target.port)
255
+ && proxyDraft.username.trim() === (proxySettings.target.username ?? '')}
256
+ disabled={proxySaving}
257
+ />
258
+ )}
259
+ <div style={{ fontSize: 11, opacity: 0.6, marginBottom: 8 }}>{t('proxy.default.hint')}</div>
260
+ <Row>
261
+ <Btn kind="primary" onClick={saveProxyDefault} disabled={proxySaving}>
262
+ {proxySaving ? t('proxy.saving') : t('proxy.save')}
263
+ </Btn>
264
+ </Row>
265
+ {proxyError !== undefined && <Notice kind="error">{proxyError}</Notice>}
266
+ </div>
267
+ </div>
142
268
  <div style={{ ...hairline, marginTop: 12, paddingTop: 10 }}>
143
269
  <div style={{ fontSize: 12, opacity: 0.75, marginBottom: 6 }}>{t('viewSettings.title')}</div>
144
270
  <Row>
package/src/client/api.ts CHANGED
@@ -19,6 +19,7 @@ import {
19
19
  type RemoteFileEntry,
20
20
  type RemoteForwardRequest,
21
21
  type RemoteForwardState,
22
+ type RemoteHostProxySetting,
22
23
  type RemoteHostSummary,
23
24
  type RemoteListenPortsResult,
24
25
  type RemoteMetricsResult,
@@ -26,6 +27,8 @@ import {
26
27
  type RemoteProcessesResult,
27
28
  type RemotePluginMeta,
28
29
  type RemoteProbe,
30
+ type RemoteProxySettingsPatch,
31
+ type RemoteProxySettingsView,
29
32
  type RemoteRead,
30
33
  type RemoteRoutingStatus,
31
34
  type RemoteTimeouts,
@@ -402,6 +405,14 @@ export interface HostForm {
402
405
  auth: { kind: 'key' | 'password'; keyPath?: string; passphrase?: string; password?: string }
403
406
  description?: string
404
407
  tags?: string[]
408
+ /**
409
+ * How this host reaches the network (see `RemoteHostProxySetting`).
410
+ *
411
+ * Absent means "no opinion": a create then keeps the profile default, and an
412
+ * update keeps whatever the host already had — which is what makes the field
413
+ * backward compatible with a Host that never heard of it.
414
+ */
415
+ proxy?: RemoteHostProxySetting
405
416
  }
406
417
 
407
418
  export interface PushReportView {
@@ -693,6 +704,25 @@ export const api = {
693
704
  /** Flat patch: unknown keys are ignored, unusable values keep the stored one. */
694
705
  setViewSettings: (patch: Partial<RemoteViewSettings>) =>
695
706
  post<{ settings: RemoteViewSettings }>(REMOTE_API.viewSettings, patch).then((r) => r.settings),
707
+ // -- profile-wide egress default (per-host overrides live on the host rows)
708
+ /**
709
+ * The default egress every `mode: 'inherit'` host follows.
710
+ *
711
+ * Answers the DEFAULTS on a fresh profile (`direct`), and a Host too old to
712
+ * know the route answers 404 — callers treat that as "direct" and keep the
713
+ * per-host form working (see `proxySummary`).
714
+ */
715
+ getProxySettings: () =>
716
+ call<{ settings: RemoteProxySettingsView }>(REMOTE_API.proxySettings).then((r) => r.settings),
717
+ /**
718
+ * Patch the default egress.
719
+ *
720
+ * `target: null` clears the stored endpoint; omitting it keeps the stored one
721
+ * (so flipping to `direct` and back does not lose the address), and an empty
722
+ * password keeps the stored secret — the browser never sees it.
723
+ */
724
+ patchProxySettings: (patch: RemoteProxySettingsPatch) =>
725
+ post<{ settings: RemoteProxySettingsView }>(REMOTE_API.proxySettings, patch).then((r) => r.settings),
696
726
  // -- deploy
697
727
  deployStatus: (alias: string) =>
698
728
  call<{ deploy: RemoteDeployState; helpers: HelperAvailability[] }>(
@@ -14,7 +14,7 @@
14
14
  * idle minutes, and the next operation dials again.
15
15
  */
16
16
  import { useSyncExternalStore } from 'react'
17
- import type { RemoteConnectionStatus } from '../protocol.ts'
17
+ import type { EgressInfo, RemoteConnectionStatus } from '../protocol.ts'
18
18
 
19
19
  export type ConnectionState = 'ok' | 'error' | 'idle'
20
20
 
@@ -59,6 +59,51 @@ export function connectionLabelKey(state: ConnectionState): string {
59
59
  return 'connection.idle'
60
60
  }
61
61
 
62
+ /**
63
+ * One route, as the localized sentence fragment the chip prints.
64
+ *
65
+ * Pure and exported so the jsdom gate can pin the copy without a browser and the
66
+ * three route kinds cannot drift into three different wordings. The Host sends
67
+ * the hop (`host:port` / the jump alias), never a sentence: the wording is UI
68
+ * copy and has to exist in both languages.
69
+ */
70
+ export function describeEgress(egress: EgressInfo, t: (key: string) => string): string {
71
+ if (egress.kind === 'jump') return t('connection.egressJump').replace('{jump}', egress.viaAlias ?? egress.detail)
72
+ if (egress.kind === 'proxy') {
73
+ const template = egress.proxyKind === 'socks5' ? t('connection.egressSocks5') : t('connection.egressHttp')
74
+ return template.replace('{proxy}', egress.detail)
75
+ }
76
+ return t('connection.egressDirect').replace('{target}', egress.detail)
77
+ }
78
+
79
+ /**
80
+ * The tooltip line that answers "did this really go through the jump host?".
81
+ *
82
+ * The ACTUAL egress of the live connection wins. With nothing dialed the
83
+ * CONFIGURED route is shown and LABELLED as such, so a configuration can never
84
+ * be read as evidence about a connection — that distinction is the whole point
85
+ * (a host edited to use a jump host keeps serving on its old direct link until
86
+ * the old connection is dropped). A configured route that cannot be used says
87
+ * why instead of reading healthy.
88
+ */
89
+ export function egressTitleLine(
90
+ connection: Pick<ConnectionView, 'egress' | 'configured'>,
91
+ t: (key: string) => string,
92
+ ): string | undefined {
93
+ if (connection.egress !== undefined) {
94
+ return t('connection.egress').replace('{egress}', describeEgress(connection.egress, t))
95
+ }
96
+ const configured = connection.configured
97
+ if (configured === undefined) return undefined
98
+ const line = t('connection.egressConfigured').replace('{egress}', describeEgress(configured, t))
99
+ return configured.problem === undefined
100
+ ? line
101
+ : // No separator space here: the two copies carry their own (zh uses a
102
+ // full-width bracket, en a leading space), so the punctuation stays right
103
+ // in both languages.
104
+ `${line}${t('connection.egressProblem').replace('{problem}', configured.problem)}`
105
+ }
106
+
62
107
  /** What the UI renders for one alias. */
63
108
  export interface ConnectionView {
64
109
  alias: string
@@ -71,6 +116,13 @@ export interface ConnectionView {
71
116
  okAt?: number
72
117
  /** A pooled SSH connection is open right now (diagnostic detail only). */
73
118
  open: boolean
119
+ /**
120
+ * The route the LIVE connection was opened through. Evidence, not intention:
121
+ * it is what the Host's pool reports for the connection it is holding.
122
+ */
123
+ egress?: EgressInfo
124
+ /** The route the stored configuration resolves to (no live connection). */
125
+ configured?: EgressInfo
74
126
  /**
75
127
  * Client time of the last locally noted failure. A poll that still reports
76
128
  * the older success must not clear an error the page just saw.
@@ -125,12 +177,28 @@ function refreshSnapshot(): void {
125
177
  || (next !== undefined && snapshot !== undefined
126
178
  && next.alias === snapshot.alias && next.state === snapshot.state
127
179
  && next.error === snapshot.error && next.errorAt === snapshot.errorAt
128
- && next.okAt === snapshot.okAt && next.open === snapshot.open && next.notedAt === snapshot.notedAt)
180
+ && next.okAt === snapshot.okAt && next.open === snapshot.open && next.notedAt === snapshot.notedAt
181
+ && sameEgress(next.egress, snapshot.egress) && sameEgress(next.configured, snapshot.configured))
129
182
  if (same) return
130
183
  snapshot = next
131
184
  notify()
132
185
  }
133
186
 
187
+ /**
188
+ * Field-wise equality for one reported route.
189
+ *
190
+ * The Host re-sends the object on every poll and this module rebuilds the view,
191
+ * so identity says nothing: a fresh-but-equal egress must not wake subscribers
192
+ * (that would repaint the whole surface every 5 s), while a real change — the
193
+ * route the connection took — must.
194
+ */
195
+ function sameEgress(a: EgressInfo | undefined, b: EgressInfo | undefined): boolean {
196
+ if (a === b) return true
197
+ if (a === undefined || b === undefined) return false
198
+ return a.kind === b.kind && a.detail === b.detail && a.viaAlias === b.viaAlias
199
+ && a.source === b.source && a.proxyKind === b.proxyKind && a.problem === b.problem
200
+ }
201
+
134
202
  /** Point the view at the workspace the user is looking at. */
135
203
  export function setActiveConnectionAlias(alias: string): void {
136
204
  if (alias === activeAlias) return
@@ -166,6 +234,8 @@ export function applyConnectionStatuses(list: readonly RemoteConnectionStatus[])
166
234
  ...(item.errorAt === undefined ? {} : { errorAt: item.errorAt }),
167
235
  ...(item.okAt === undefined ? {} : { okAt: item.okAt }),
168
236
  open: item.open,
237
+ ...(item.egress === undefined ? {} : { egress: item.egress }),
238
+ ...(item.configured === undefined ? {} : { configured: item.configured }),
169
239
  })
170
240
  }
171
241
  refreshSnapshot()
@@ -186,6 +256,10 @@ export function noteConnectionFailure(alias: string, error: unknown): void {
186
256
  errorAt: Date.now(),
187
257
  ...(prev?.okAt === undefined ? {} : { okAt: prev.okAt }),
188
258
  open: prev?.open ?? false,
259
+ // The route the DEAD connection used is not carried over (it is evidence
260
+ // about a link that just failed); the configured route still describes what
261
+ // the next attempt will take, so it stays until the Host answers.
262
+ ...(prev?.configured === undefined ? {} : { configured: prev.configured }),
189
263
  notedAt: Date.now(),
190
264
  })
191
265
  refreshSnapshot()
@@ -174,6 +174,46 @@ const zh: Record<string, string> = {
174
174
  'form.passphrase': '私钥口令(可选)',
175
175
  'form.password': '密码',
176
176
  'form.description': '备注(可选)',
177
+ // -- 网络出口(主机级覆盖 + profile 级默认)
178
+ 'proxy.title': '网络出口',
179
+ 'proxy.expand': '展开网络出口',
180
+ 'proxy.collapse': '收起网络出口',
181
+ 'proxy.mode': '出网方式',
182
+ 'proxy.mode.inherit': '跟随默认',
183
+ 'proxy.mode.direct': '直连',
184
+ 'proxy.mode.proxy': '代理',
185
+ 'proxy.mode.jump': '跳板',
186
+ 'proxy.kind': '代理类型',
187
+ 'proxy.typeHttp': 'HTTP CONNECT',
188
+ 'proxy.typeSocks5': 'SOCKS5',
189
+ 'proxy.shortHttp': 'HTTP',
190
+ 'proxy.shortSocks5': 'SOCKS5',
191
+ 'proxy.host': '代理主机',
192
+ 'proxy.port': '端口',
193
+ 'proxy.username': '用户名(可选)',
194
+ 'proxy.password': '密码(可选)',
195
+ 'proxy.passwordKeep': '已设置,留空则不修改',
196
+ 'proxy.jumpVia': '跳板主机',
197
+ 'proxy.jumpMissing': '{alias}(主机不存在)',
198
+ 'proxy.jumpNone': '没有其他主机可作跳板',
199
+ 'proxy.jumpHint': '经这台主机的 SSH 连接转发到目标;跳板本身必须能直连或经默认代理。',
200
+ 'proxy.chipInherit': '跟随默认',
201
+ 'proxy.chipProxy': '代理',
202
+ 'proxy.chipJump': '跳板 {alias}',
203
+ 'proxy.chipTitle': '网络出口:{summary}',
204
+ 'proxy.summaryDirect': '直连',
205
+ 'proxy.summaryProxy': '经 {kind} 代理 {host}:{port}',
206
+ 'proxy.summaryInheritDirect': '跟随默认(直连)',
207
+ 'proxy.summaryInheritProxy': '跟随默认(经 {kind} 代理 {host}:{port})',
208
+ 'proxy.summaryJump': '经跳板 {alias}',
209
+ 'proxy.default.title': '默认网络出口',
210
+ 'proxy.default.hint': '设为「跟随默认」的主机走这里;单台主机可以在「远程主机」表单里覆盖。',
211
+ 'proxy.invalidTarget': '代理需要主机名与 1–65535 的端口',
212
+ 'proxy.invalidJump': '请选择跳板主机',
213
+ 'proxy.jumpGone': '跳板主机「{alias}」已不存在,请重新选择',
214
+ 'proxy.save': '保存',
215
+ 'proxy.saving': '保存中…',
216
+ 'proxy.saveFailed': '保存失败:{message}',
177
217
  'deploy.notDeployed': '未推送',
178
218
  'deploy.ok': '已推送',
179
219
  'deploy.skipped': '已是最新(跳过)',
@@ -885,6 +925,13 @@ const zh: Record<string, string> = {
885
925
  'connection.errorAt': '上次失败',
886
926
  'connection.detail': '诊断',
887
927
  'connection.actionFailed': '连接已断开,操作未发送;恢复后请重试。',
928
+ 'connection.egress': '出口:{egress}',
929
+ 'connection.egressConfigured': '出口(按配置):{egress}',
930
+ 'connection.egressDirect': '直连 {target}',
931
+ 'connection.egressJump': '经跳板 {jump}',
932
+ 'connection.egressHttp': '经 HTTP 代理 {proxy}',
933
+ 'connection.egressSocks5': '经 SOCKS5 代理 {proxy}',
934
+ 'connection.egressProblem': '(配置有误:{problem})',
888
935
  'files.offline': '连接已断开,且此目录没有缓存',
889
936
  // -- Ctrl+P quick open(远端文件索引 + 模糊匹配)
890
937
  'quickopen.title': '快速打开',
@@ -919,6 +966,10 @@ const zh: Record<string, string> = {
919
966
  'ports.stateListening': '监听中',
920
967
  'ports.stateError': '连接失败',
921
968
  'ports.connections': '{count} 个连接',
969
+ 'ports.transportDedicated': '独立连接',
970
+ 'ports.transportShared': '共享连接',
971
+ 'ports.transportDedicatedHint': '这条转发走该主机自己的 SSH 连接,不与浏览/命令流量挤在一条通道上。',
972
+ 'ports.transportSharedHint': '服务器拒绝了额外的 SSH 连接,这条转发回落到共享连接:仍然可用,只是不再独占通道。',
922
973
  'ports.emptyListen': '远端没有列出监听端口。',
923
974
  'ports.listenUnavailable': '无法枚举远端端口:远端既没有 ss 也没有 netstat。',
924
975
  'ports.listenUnknown': '无法枚举远端端口:探测没有返回结果。',
@@ -1042,6 +1093,46 @@ const en: Record<string, string> = {
1042
1093
  'form.passphrase': 'Key passphrase (optional)',
1043
1094
  'form.password': 'Password',
1044
1095
  'form.description': 'Note (optional)',
1096
+ // -- egress: per-host override + the profile-wide default
1097
+ 'proxy.title': 'Network egress',
1098
+ 'proxy.expand': 'Expand network egress',
1099
+ 'proxy.collapse': 'Collapse network egress',
1100
+ 'proxy.mode': 'Egress',
1101
+ 'proxy.mode.inherit': 'Follow default',
1102
+ 'proxy.mode.direct': 'Direct',
1103
+ 'proxy.mode.proxy': 'Proxy',
1104
+ 'proxy.mode.jump': 'Jump host',
1105
+ 'proxy.kind': 'Proxy type',
1106
+ 'proxy.typeHttp': 'HTTP CONNECT',
1107
+ 'proxy.typeSocks5': 'SOCKS5',
1108
+ 'proxy.shortHttp': 'HTTP',
1109
+ 'proxy.shortSocks5': 'SOCKS5',
1110
+ 'proxy.host': 'Proxy host',
1111
+ 'proxy.port': 'Port',
1112
+ 'proxy.username': 'Username (optional)',
1113
+ 'proxy.password': 'Password (optional)',
1114
+ 'proxy.passwordKeep': 'stored — leave empty to keep',
1115
+ 'proxy.jumpVia': 'Jump host',
1116
+ 'proxy.jumpMissing': '{alias} (host is gone)',
1117
+ 'proxy.jumpNone': 'No other host to use as a jump host',
1118
+ 'proxy.jumpHint': 'The SSH connection is forwarded through this host; the jump host itself must be reachable directly or through the default proxy.',
1119
+ 'proxy.chipInherit': 'Follow default',
1120
+ 'proxy.chipProxy': 'Proxy',
1121
+ 'proxy.chipJump': 'Jump {alias}',
1122
+ 'proxy.chipTitle': 'Egress: {summary}',
1123
+ 'proxy.summaryDirect': 'direct',
1124
+ 'proxy.summaryProxy': 'via {kind} proxy {host}:{port}',
1125
+ 'proxy.summaryInheritDirect': 'follow default (direct)',
1126
+ 'proxy.summaryInheritProxy': 'follow default (via {kind} proxy {host}:{port})',
1127
+ 'proxy.summaryJump': 'via jump host {alias}',
1128
+ 'proxy.default.title': 'Default network egress',
1129
+ 'proxy.default.hint': 'Hosts set to "Follow default" use this; a single host can override it in the Remote hosts form.',
1130
+ 'proxy.invalidTarget': 'A proxy needs a host name and a port between 1 and 65535',
1131
+ 'proxy.invalidJump': 'Choose a jump host',
1132
+ 'proxy.jumpGone': 'Jump host "{alias}" no longer exists — pick another',
1133
+ 'proxy.save': 'Save',
1134
+ 'proxy.saving': 'Saving…',
1135
+ 'proxy.saveFailed': 'Save failed: {message}',
1045
1136
  'deploy.notDeployed': 'not pushed',
1046
1137
  'deploy.ok': 'pushed',
1047
1138
  'deploy.skipped': 'up to date (skipped)',
@@ -1753,6 +1844,13 @@ const en: Record<string, string> = {
1753
1844
  'connection.errorAt': 'Last failure',
1754
1845
  'connection.detail': 'Diagnostics',
1755
1846
  'connection.actionFailed': 'The connection is down, so the action was not sent; try again after it recovers.',
1847
+ 'connection.egress': 'Egress: {egress}',
1848
+ 'connection.egressConfigured': 'Egress (configured): {egress}',
1849
+ 'connection.egressDirect': 'direct to {target}',
1850
+ 'connection.egressJump': 'via jump host {jump}',
1851
+ 'connection.egressHttp': 'via HTTP proxy {proxy}',
1852
+ 'connection.egressSocks5': 'via SOCKS5 proxy {proxy}',
1853
+ 'connection.egressProblem': ' (misconfigured: {problem})',
1756
1854
  'files.offline': 'Connection lost, and this folder has no cached listing',
1757
1855
  // -- Ctrl+P quick open (remote file index + fuzzy matching)
1758
1856
  'quickopen.title': 'Quick open',
@@ -1787,6 +1885,10 @@ const en: Record<string, string> = {
1787
1885
  'ports.stateListening': 'Listening',
1788
1886
  'ports.stateError': 'Connection failed',
1789
1887
  'ports.connections': 'Connections: {count}',
1888
+ 'ports.transportDedicated': 'Dedicated',
1889
+ 'ports.transportShared': 'Shared',
1890
+ 'ports.transportDedicatedHint': 'This forward uses the host\'s own SSH connection, so its traffic never queues behind browse/exec channels.',
1891
+ 'ports.transportSharedHint': 'The server refused an extra SSH connection, so this forward fell back to the shared one: it still works, only without its own channel.',
1790
1892
  'ports.emptyListen': 'The remote host listed no listening ports.',
1791
1893
  'ports.listenUnavailable': 'Cannot enumerate remote ports: neither ss nor netstat is available on the host.',
1792
1894
  'ports.listenUnknown': 'Cannot enumerate remote ports: the probe did not answer.',
@@ -5192,6 +5192,23 @@ body[data-ds-dark-theme] .rvs-doctor {
5192
5192
  white-space: nowrap;
5193
5193
  }
5194
5194
 
5195
+ /*
5196
+ * 转发通道的来源标签(独立 / 共享)。
5197
+ * 它说的是"这条规则现在走哪条 SSH 连接",不是健康状态,所以用次级文字加描边,
5198
+ * 不与状态点的绿/红混在一起;10px / 14px 高,只做提示,不参与排版的伸缩。
5199
+ */
5200
+ .rvs-ports-transport {
5201
+ flex: none;
5202
+ padding: 0 4px;
5203
+ border: 1px solid var(--rvs-border);
5204
+ border-radius: 4px;
5205
+ color: var(--rvs-fg3);
5206
+ font-size: 10px;
5207
+ line-height: 14px;
5208
+ white-space: nowrap;
5209
+ cursor: help;
5210
+ }
5211
+
5195
5212
  .rvs-ports-err {
5196
5213
  color: var(--rvs-danger-text);
5197
5214
  font-size: 11px;
@@ -6640,3 +6657,91 @@ body:not([data-ds-dark-theme]) .rvs-qo-mask {
6640
6657
  .rvs-qo-note.warn {
6641
6658
  color: var(--rvs-git-m);
6642
6659
  }
6660
+
6661
+ /* ------------------------------------------------------- egress (proxy/jump) */
6662
+ /**
6663
+ * Host egress chrome: the read-only route chip and the collapsible section
6664
+ * header of the host form / Settings → Remote hosts ("网络出口").
6665
+ *
6666
+ * Deliberately NOT scoped under `.rvs-root`, unlike the rest of this sheet: the
6667
+ * SAME chip renders inside the DSH Settings dialog, which mounts outside the
6668
+ * plugin's own root and therefore never inherits `--rvs-*`. The neutral
6669
+ * translucent border + inherited text colour read correctly in both schemes,
6670
+ * and the error state keys off the shell's global dark marker instead of the
6671
+ * scoped token (a bare `--rvs-danger-text` would be undefined there and fall
6672
+ * back to the light red on a dark plate).
6673
+ */
6674
+ .rvs-proxy-chip {
6675
+ flex: none;
6676
+ display: inline-flex;
6677
+ align-items: center;
6678
+ max-width: 46ch;
6679
+ overflow: hidden;
6680
+ padding: 0 6px;
6681
+ border: 1px solid var(--rvs-border2, rgba(127, 127, 127, .38));
6682
+ border-radius: 999px;
6683
+ color: inherit;
6684
+ font-size: 11px;
6685
+ line-height: 16px;
6686
+ text-overflow: ellipsis;
6687
+ white-space: nowrap;
6688
+ opacity: .82;
6689
+ }
6690
+
6691
+ .rvs-proxy-chip.is-error {
6692
+ border-color: currentColor;
6693
+ color: #a52a2a;
6694
+ opacity: 1;
6695
+ }
6696
+
6697
+ body[data-ds-dark-theme] .rvs-proxy-chip.is-error {
6698
+ color: #ff8b8b;
6699
+ }
6700
+
6701
+ /* A real <button> (Enter/Space for free); the caret carries the open state. */
6702
+ .rvs-proxy-toggle {
6703
+ display: inline-flex;
6704
+ align-items: center;
6705
+ gap: 5px;
6706
+ margin: 0;
6707
+ padding: 2px 4px;
6708
+ border: 1px solid transparent;
6709
+ border-radius: 5px;
6710
+ background: none;
6711
+ color: inherit;
6712
+ font: inherit;
6713
+ text-align: left;
6714
+ cursor: pointer;
6715
+ }
6716
+
6717
+ .rvs-proxy-toggle:hover {
6718
+ background: var(--rvs-hover, rgba(127, 127, 127, .14));
6719
+ }
6720
+
6721
+ .rvs-proxy-toggle:focus-visible {
6722
+ border-color: var(--rvs-border2, rgba(127, 127, 127, .38));
6723
+ outline: 2px solid var(--rvs-brand, #4d6bfe);
6724
+ outline-offset: 1px;
6725
+ }
6726
+
6727
+ .rvs-proxy-caret {
6728
+ display: inline-block;
6729
+ width: 10px;
6730
+ font-size: 10px;
6731
+ line-height: 12px;
6732
+ color: var(--rvs-fg3, inherit);
6733
+ transition: transform .12s ease;
6734
+ }
6735
+
6736
+ .rvs-proxy-toggle[aria-expanded="true"] .rvs-proxy-caret {
6737
+ transform: rotate(90deg);
6738
+ }
6739
+
6740
+ /* The fields sit under the label, indented to the caret's column. */
6741
+ .rvs-proxy-panel {
6742
+ padding-left: 18px;
6743
+ }
6744
+
6745
+ .rvs-proxy-panel[hidden] {
6746
+ display: none;
6747
+ }