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
@@ -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': '已是最新(跳过)',
@@ -806,7 +846,7 @@ const zh: Record<string, string> = {
806
846
  'changes.statusDeleted': '删除',
807
847
  'changes.statusModified': '修改',
808
848
  'changes.statusRenamed': '重命名',
809
- 'changes.truncated': '文件过多,只列出前 500 个(统计数字也只算这 500 个)。',
849
+ 'changes.truncated': '改动列表不完整:文件过多、或未跟踪目录展开受限,部分文件未列出(统计数字也只算列出的部分)。',
810
850
  'changes.excluded': '未统计构建产物目录:{dirs}',
811
851
  'changes.markReviewed': '标记为已审阅',
812
852
  'changes.unmarkReviewed': '取消审阅标记',
@@ -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': '无法枚举远端端口:探测没有返回结果。',
@@ -996,6 +1047,31 @@ const zh: Record<string, string> = {
996
1047
  'proc.expand': '展开进程分区',
997
1048
  'proc.collapse': '收起进程分区',
998
1049
  'proc.collapsedHint': '展开以查看远端的进程快照(按 CPU 排序)。',
1050
+ // SSH 连接池分区(监控页):四类连接、通道数与槽位/排队。
1051
+ // 出口文案复用 connection.egress*(describeEgress/egressTitleLine),这里不另造。
1052
+ 'pool.title': 'SSH 连接',
1053
+ 'pool.expand': '展开连接分区',
1054
+ 'pool.collapse': '收起连接分区',
1055
+ 'pool.collapsedHint': '展开以查看每台主机的连接池:共享 / 终端 / 端口转发 / 文件传输四类连接、通道数与排队。',
1056
+ 'pool.summary': '{hosts} 台 · {connections} 条连接 · 排队 {queued}',
1057
+ 'pool.shared': '共享',
1058
+ 'pool.pty': '终端',
1059
+ 'pool.forward': '端口转发',
1060
+ 'pool.sftp': '文件传输',
1061
+ 'pool.helper': 'helper 工具',
1062
+ 'pool.helperInFlight': '{count} 个调用进行中',
1063
+ 'pool.laneOpen': '开着',
1064
+ 'pool.laneClosed': '未开',
1065
+ 'pool.channels': '{channels} 通道',
1066
+ 'pool.slots': '共享通道 {active}/{limit} · 排队 {queued}',
1067
+ 'pool.sftpSlots': '文件传输通道 {active}/{limit} · 排队 {queued}',
1068
+ 'pool.netSlots': '网络命令通道 {active}/{limit} · 排队 {queued}',
1069
+ 'pool.gitSlots': 'git 命令通道 {active}/{limit} · 排队 {queued}',
1070
+ 'pool.queued': '排队 {queued}',
1071
+ 'pool.sftpFallback': '文件操作正共用共享连接(该主机拒绝了专用 SFTP 连接)',
1072
+ 'pool.unsupported': '当前 Host 版本不提供连接池统计:升级 dsh-remote-vs 后刷新即可看到。',
1073
+ 'pool.loading': '正在读取连接池…',
1074
+ 'pool.empty': '还没有主机建立连接。',
999
1075
  }
1000
1076
 
1001
1077
  const en: Record<string, string> = {
@@ -1042,6 +1118,46 @@ const en: Record<string, string> = {
1042
1118
  'form.passphrase': 'Key passphrase (optional)',
1043
1119
  'form.password': 'Password',
1044
1120
  'form.description': 'Note (optional)',
1121
+ // -- egress: per-host override + the profile-wide default
1122
+ 'proxy.title': 'Network egress',
1123
+ 'proxy.expand': 'Expand network egress',
1124
+ 'proxy.collapse': 'Collapse network egress',
1125
+ 'proxy.mode': 'Egress',
1126
+ 'proxy.mode.inherit': 'Follow default',
1127
+ 'proxy.mode.direct': 'Direct',
1128
+ 'proxy.mode.proxy': 'Proxy',
1129
+ 'proxy.mode.jump': 'Jump host',
1130
+ 'proxy.kind': 'Proxy type',
1131
+ 'proxy.typeHttp': 'HTTP CONNECT',
1132
+ 'proxy.typeSocks5': 'SOCKS5',
1133
+ 'proxy.shortHttp': 'HTTP',
1134
+ 'proxy.shortSocks5': 'SOCKS5',
1135
+ 'proxy.host': 'Proxy host',
1136
+ 'proxy.port': 'Port',
1137
+ 'proxy.username': 'Username (optional)',
1138
+ 'proxy.password': 'Password (optional)',
1139
+ 'proxy.passwordKeep': 'stored — leave empty to keep',
1140
+ 'proxy.jumpVia': 'Jump host',
1141
+ 'proxy.jumpMissing': '{alias} (host is gone)',
1142
+ 'proxy.jumpNone': 'No other host to use as a jump host',
1143
+ 'proxy.jumpHint': 'The SSH connection is forwarded through this host; the jump host itself must be reachable directly or through the default proxy.',
1144
+ 'proxy.chipInherit': 'Follow default',
1145
+ 'proxy.chipProxy': 'Proxy',
1146
+ 'proxy.chipJump': 'Jump {alias}',
1147
+ 'proxy.chipTitle': 'Egress: {summary}',
1148
+ 'proxy.summaryDirect': 'direct',
1149
+ 'proxy.summaryProxy': 'via {kind} proxy {host}:{port}',
1150
+ 'proxy.summaryInheritDirect': 'follow default (direct)',
1151
+ 'proxy.summaryInheritProxy': 'follow default (via {kind} proxy {host}:{port})',
1152
+ 'proxy.summaryJump': 'via jump host {alias}',
1153
+ 'proxy.default.title': 'Default network egress',
1154
+ 'proxy.default.hint': 'Hosts set to "Follow default" use this; a single host can override it in the Remote hosts form.',
1155
+ 'proxy.invalidTarget': 'A proxy needs a host name and a port between 1 and 65535',
1156
+ 'proxy.invalidJump': 'Choose a jump host',
1157
+ 'proxy.jumpGone': 'Jump host "{alias}" no longer exists — pick another',
1158
+ 'proxy.save': 'Save',
1159
+ 'proxy.saving': 'Saving…',
1160
+ 'proxy.saveFailed': 'Save failed: {message}',
1045
1161
  'deploy.notDeployed': 'not pushed',
1046
1162
  'deploy.ok': 'pushed',
1047
1163
  'deploy.skipped': 'up to date (skipped)',
@@ -1674,7 +1790,7 @@ const en: Record<string, string> = {
1674
1790
  'changes.statusDeleted': 'deleted',
1675
1791
  'changes.statusModified': 'modified',
1676
1792
  'changes.statusRenamed': 'renamed',
1677
- 'changes.truncated': 'Too many files: the first 500 are listed (the counts cover only those).',
1793
+ 'changes.truncated': 'This list is incomplete: too many files, or the untracked-directory expansion hit its limit, so some files are missing (the counts cover only what is listed).',
1678
1794
  'changes.excluded': 'Build output directories not counted: {dirs}',
1679
1795
  'changes.markReviewed': 'Mark as reviewed',
1680
1796
  'changes.unmarkReviewed': 'Clear the review mark',
@@ -1753,6 +1869,13 @@ const en: Record<string, string> = {
1753
1869
  'connection.errorAt': 'Last failure',
1754
1870
  'connection.detail': 'Diagnostics',
1755
1871
  'connection.actionFailed': 'The connection is down, so the action was not sent; try again after it recovers.',
1872
+ 'connection.egress': 'Egress: {egress}',
1873
+ 'connection.egressConfigured': 'Egress (configured): {egress}',
1874
+ 'connection.egressDirect': 'direct to {target}',
1875
+ 'connection.egressJump': 'via jump host {jump}',
1876
+ 'connection.egressHttp': 'via HTTP proxy {proxy}',
1877
+ 'connection.egressSocks5': 'via SOCKS5 proxy {proxy}',
1878
+ 'connection.egressProblem': ' (misconfigured: {problem})',
1756
1879
  'files.offline': 'Connection lost, and this folder has no cached listing',
1757
1880
  // -- Ctrl+P quick open (remote file index + fuzzy matching)
1758
1881
  'quickopen.title': 'Quick open',
@@ -1787,6 +1910,10 @@ const en: Record<string, string> = {
1787
1910
  'ports.stateListening': 'Listening',
1788
1911
  'ports.stateError': 'Connection failed',
1789
1912
  'ports.connections': 'Connections: {count}',
1913
+ 'ports.transportDedicated': 'Dedicated',
1914
+ 'ports.transportShared': 'Shared',
1915
+ 'ports.transportDedicatedHint': 'This forward uses the host\'s own SSH connection, so its traffic never queues behind browse/exec channels.',
1916
+ '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
1917
  'ports.emptyListen': 'The remote host listed no listening ports.',
1791
1918
  'ports.listenUnavailable': 'Cannot enumerate remote ports: neither ss nor netstat is available on the host.',
1792
1919
  'ports.listenUnknown': 'Cannot enumerate remote ports: the probe did not answer.',
@@ -1864,6 +1991,29 @@ const en: Record<string, string> = {
1864
1991
  'proc.expand': 'Expand processes',
1865
1992
  'proc.collapse': 'Collapse processes',
1866
1993
  'proc.collapsedHint': 'Expand for the remote process snapshot (sorted by CPU).',
1994
+ 'pool.title': 'SSH connections',
1995
+ 'pool.expand': 'Expand the connection section',
1996
+ 'pool.collapse': 'Collapse the connection section',
1997
+ 'pool.collapsedHint': 'Expand for the per-host pool: shared / terminals / port forwards / file transfer, channel counts and queues.',
1998
+ 'pool.summary': '{hosts} hosts · {connections} connections · {queued} queued',
1999
+ 'pool.shared': 'Shared',
2000
+ 'pool.pty': 'Terminals',
2001
+ 'pool.forward': 'Port forwards',
2002
+ 'pool.sftp': 'File transfer',
2003
+ 'pool.helper': 'Helper',
2004
+ 'pool.helperInFlight': '{count} calls in flight',
2005
+ 'pool.laneOpen': 'open',
2006
+ 'pool.laneClosed': 'closed',
2007
+ 'pool.channels': '{channels} ch',
2008
+ 'pool.slots': 'Shared channels {active}/{limit} · {queued} queued',
2009
+ 'pool.sftpSlots': 'File-transfer channels {active}/{limit} · {queued} queued',
2010
+ 'pool.netSlots': 'Network-verb channels {active}/{limit} · {queued} queued',
2011
+ 'pool.gitSlots': 'Git-command channels {active}/{limit} · {queued} queued',
2012
+ 'pool.queued': '{queued} queued',
2013
+ 'pool.sftpFallback': 'File operations share the main connection (this host refused its own SFTP one)',
2014
+ 'pool.unsupported': 'This Host version does not report pool statistics: upgrade dsh-remote-vs and refresh.',
2015
+ 'pool.loading': 'Reading the connection pool…',
2016
+ 'pool.empty': 'No host has opened a connection yet.',
1867
2017
  }
1868
2018
 
1869
2019
  export type Lang = 'zh' | 'en'
@@ -66,7 +66,7 @@ import {
66
66
  unstageCommand,
67
67
  } from '../../git-ops.ts'
68
68
  import { parseBlamePorcelain, parseFileHistory, type BlameLine, type FileHistoryCommit } from '../blame-model.ts'
69
- import { api, gitTimeoutMs, type RequestOptions } from '../api.ts'
69
+ import { api, gitTimeoutMs, type ExecLane, type RequestOptions } from '../api.ts'
70
70
  import { isRequestAbort } from '../request-gate.ts'
71
71
  import { appendExecOutput, networkBudgetMs, networkCommands, type PushTarget } from '../exec-output.ts'
72
72
  import { timeoutSeconds } from '../../timeouts.ts'
@@ -125,6 +125,23 @@ function failureOf(result: RemoteExecResult, timeoutMs: number): GitOpError {
125
125
  export interface RunOptions {
126
126
  background?: boolean
127
127
  signal?: AbortSignal
128
+ /**
129
+ * Which HOST channel budget this command spends.
130
+ *
131
+ * The default for everything in this file is `'git'` — the git-command budget,
132
+ * where a big tree's `git status` is allowed 300 s and a git command used to
133
+ * park one of the shared exec slots for that whole time. It covers the local
134
+ * writes too (`commit`, `stage`, `discard`, branch verbs): they are git commands
135
+ * with a git timeout, and they must not compete with the monitor and the agent
136
+ * tools for the exec slots either. `'network'` is for the fetch/pull/push family,
137
+ * whose budget is even longer (20 minutes). Omitted means "the default above",
138
+ * and only a command that is NOT a git command may ask for `'exec'` — there is
139
+ * none in this module today.
140
+ *
141
+ * Deliberately NOT part of {@link RequestOptions}: that bag drives the local
142
+ * request gate and the fetch, while this is a body field the host's pool reads.
143
+ */
144
+ lane?: ExecLane
128
145
  }
129
146
 
130
147
  /** Map {@link RunOptions} onto the HTTP layer's {@link RequestOptions}. */
@@ -135,6 +152,20 @@ function requestOptionsOf(options: RunOptions): RequestOptions {
135
152
  }
136
153
  }
137
154
 
155
+ /**
156
+ * The channel lane a command spends.
157
+ *
158
+ * Every command that flows through `run`/`tryRun` is a git command (a read or a
159
+ * local write), so the default is the git-command budget (`'git'`); the network
160
+ * verbs override it with `'network'`. Marking a local write as a network verb
161
+ * would move a fast command onto the two-slot network lane, and leaving it on the
162
+ * exec budget is exactly the bug this budget exists to fix — so the default is the
163
+ * git lane and overrides are explicit at the call site.
164
+ */
165
+ function laneOf(options: RunOptions): ExecLane {
166
+ return options.lane ?? 'git'
167
+ }
168
+
138
169
  /** Run one command, raising a readable error on a non-zero exit. */
139
170
  async function run(
140
171
  alias: string,
@@ -142,7 +173,7 @@ async function run(
142
173
  timeoutMs = normalTimeoutMs(),
143
174
  options: RunOptions = {},
144
175
  ): Promise<RemoteExecResult> {
145
- const result = await api.exec(alias, command, timeoutMs, requestOptionsOf(options))
176
+ const result = await api.exec(alias, command, timeoutMs, requestOptionsOf(options), laneOf(options))
146
177
  if (result.success) return result
147
178
  throw failureOf(result, timeoutMs)
148
179
  }
@@ -155,7 +186,7 @@ async function tryRun(
155
186
  options: RunOptions = {},
156
187
  ): Promise<string> {
157
188
  try {
158
- const result = await api.exec(alias, command, timeoutMs, requestOptionsOf(options))
189
+ const result = await api.exec(alias, command, timeoutMs, requestOptionsOf(options), laneOf(options))
159
190
  return result.success ? result.stdout : ''
160
191
  } catch (error) {
161
192
  // A cancelled command is not "no answer": swallowing it would let the
@@ -207,7 +238,10 @@ export async function probeRepoRoot(
207
238
  // to the listing the user is waiting on.
208
239
  background: true,
209
240
  ...(signal === undefined ? {} : { signal }),
210
- })
241
+ // A repository READ (unlike the verbs that go through `run`, this one calls
242
+ // the API directly, so it has to name its lane): the host's repository-read
243
+ // budget, not the six exec slots the monitor and the agent tools poll on.
244
+ }, 'git')
211
245
  } catch (error) {
212
246
  if (isRequestAbort(error)) throw error
213
247
  // The transport/route failed before any git exit code existed.
@@ -570,13 +604,20 @@ export async function lastCommitMessage(alias: string, root: string): Promise<st
570
604
  return (await tryRun(alias, headMessageCommand(root), 30_000)).trim()
571
605
  }
572
606
 
573
- /** fetch / pull / push / sync. */
607
+ /**
608
+ * fetch / pull / push / sync.
609
+ *
610
+ * Every branch here is a NETWORK verb (`{ lane: 'network' }`): each one can hold a
611
+ * channel for `networkBudgetMs`, so it spends the host's small network budget
612
+ * rather than the repository-read one the rest of this module uses.
613
+ */
574
614
  export async function syncRepo(alias: string, root: string, kind: 'fetch' | 'pull' | 'push' | 'sync'): Promise<string> {
575
- if (kind === 'fetch') return (await run(alias, fetchCommand(root), longTimeoutMs())).stdout
576
- if (kind === 'pull') return (await run(alias, pullCommand(root), longTimeoutMs())).stdout
577
- if (kind === 'push') return (await run(alias, pushCommand(root), longTimeoutMs())).stdout
578
- const pulled = (await run(alias, pullCommand(root), longTimeoutMs())).stdout
579
- const pushed = (await run(alias, pushCommand(root), longTimeoutMs())).stdout
615
+ const network = { lane: 'network' } as const
616
+ if (kind === 'fetch') return (await run(alias, fetchCommand(root), longTimeoutMs(), network)).stdout
617
+ if (kind === 'pull') return (await run(alias, pullCommand(root), longTimeoutMs(), network)).stdout
618
+ if (kind === 'push') return (await run(alias, pushCommand(root), longTimeoutMs(), network)).stdout
619
+ const pulled = (await run(alias, pullCommand(root), longTimeoutMs(), network)).stdout
620
+ const pushed = (await run(alias, pushCommand(root), longTimeoutMs(), network)).stdout
580
621
  return `${pulled}\n${pushed}`.trim()
581
622
  }
582
623
 
@@ -585,7 +626,9 @@ export async function syncRepo(alias: string, root: string, kind: 'fetch' | 'pul
585
626
  * `HEAD:refs/for/<branch>`). Same timeout budget as the other network verbs.
586
627
  */
587
628
  export async function pushWithRefspec(alias: string, root: string, remote: string, refspec: string): Promise<string> {
588
- const out = await run(alias, pushRefspecCommand(root, remote, refspec), longTimeoutMs())
629
+ // A refspec push is the review-upload path (Gerrit): same network verb, same
630
+ // 20-minute budget, so it must not sit in an exec slot either.
631
+ const out = await run(alias, pushRefspecCommand(root, remote, refspec), longTimeoutMs(), { lane: 'network' })
589
632
  return `${out.stdout}\n${out.stderr}`.trim()
590
633
  }
591
634
 
@@ -613,6 +656,10 @@ export async function streamNetworkVerb(
613
656
  let result: RemoteExecResult | undefined
614
657
  for (const command of networkCommands(root, kind, push)) {
615
658
  result = await api.execStream(alias, command, timeoutMs, {
659
+ // A network verb for the HOST as well: its channel comes from the small
660
+ // network budget, so a push that hangs for its whole 20-minute budget
661
+ // cannot starve status refreshes / the monitor / the agent tools.
662
+ lane: 'network',
616
663
  ...(handlers.signal === undefined ? {} : { signal: handlers.signal }),
617
664
  onData: (stream, text) => {
618
665
  output = appendExecOutput(output, text)
@@ -642,7 +689,11 @@ export async function branchOp(
642
689
  case 'delete': return (await run(alias, deleteBranchCommand(root, op.name, op.force), 60_000)).stdout
643
690
  case 'rename': return (await run(alias, renameBranchCommand(root, op.from, op.to), 60_000)).stdout
644
691
  case 'merge': return (await run(alias, mergeCommand(root, op.ref), longTimeoutMs())).stdout
645
- case 'publish': return (await run(alias, publishBranchCommand(root, op.name, op.remote), longTimeoutMs())).stdout
692
+ // `publish` is `git push --set-upstream`: a network verb, so it spends the
693
+ // network budget instead of an exec slot (the other branch verbs are local).
694
+ case 'publish': {
695
+ return (await run(alias, publishBranchCommand(root, op.name, op.remote), longTimeoutMs(), { lane: 'network' })).stdout
696
+ }
646
697
  default: return ''
647
698
  }
648
699
  }
@@ -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;
@@ -5254,6 +5271,12 @@ body[data-ds-dark-theme] .rvs-doctor {
5254
5271
  flex: 0 1 auto;
5255
5272
  }
5256
5273
 
5274
+ /* Same rule for the connection-pool section: whichever collapsible section is
5275
+ open gets the room, the metric cards keep their natural height. */
5276
+ .rvs-monitor-body:has(.rvs-pool.expanded) .rvs-monitor-content {
5277
+ flex: 0 1 auto;
5278
+ }
5279
+
5257
5280
  /* The rail title and the scope picker both wanted flex:1; the title yields so
5258
5281
  the picker keeps enough width for its own label at 230px. */
5259
5282
  .rvs-monitor-header .rvs-title {
@@ -6469,6 +6492,176 @@ body[data-ds-dark-theme] .rvs-doctor {
6469
6492
  }
6470
6493
  }
6471
6494
 
6495
+ /* === SSH connection-pool section (monitor page) =========================== */
6496
+
6497
+ /* Collapsed it is a single header row under the process section; expanded it
6498
+ takes the leftover height (basis:0, so the list scrolls instead of pushing
6499
+ the metric cards off the pane). Same shape as `.rvs-proc`. */
6500
+ .rvs-pool {
6501
+ flex: 0 0 auto;
6502
+ border-top: 1px solid var(--rvs-editor-chrome-border, var(--rvs-border));
6503
+ background: var(--rvs-layer3);
6504
+ }
6505
+
6506
+ .rvs-pool.expanded {
6507
+ display: flex;
6508
+ flex: 1 1 0;
6509
+ flex-direction: column;
6510
+ min-height: 120px;
6511
+ }
6512
+
6513
+ .rvs-pool-head {
6514
+ display: flex;
6515
+ align-items: center;
6516
+ gap: 4px;
6517
+ padding: 4px 8px;
6518
+ min-height: 26px;
6519
+ }
6520
+
6521
+ .rvs-pool-toggle {
6522
+ display: inline-flex;
6523
+ align-items: center;
6524
+ justify-content: center;
6525
+ width: 18px;
6526
+ height: 18px;
6527
+ padding: 0;
6528
+ border: 0;
6529
+ background: transparent;
6530
+ color: var(--rvs-fg2);
6531
+ cursor: pointer;
6532
+ }
6533
+
6534
+ .rvs-pool-title {
6535
+ flex: 0 0 auto;
6536
+ font-weight: 600;
6537
+ font-size: 11px;
6538
+ }
6539
+
6540
+ /* 台/条/排队 counts: tabular-nums keeps the header from twitching when a
6541
+ channel count changes on its own poll. */
6542
+ .rvs-pool-summary {
6543
+ flex: 1 1 auto;
6544
+ min-width: 0;
6545
+ overflow: hidden;
6546
+ text-overflow: ellipsis;
6547
+ white-space: nowrap;
6548
+ color: var(--rvs-fg3);
6549
+ font-size: 10px;
6550
+ font-variant-numeric: tabular-nums;
6551
+ }
6552
+
6553
+ .rvs-pool-collapsed {
6554
+ padding: 0 8px 5px;
6555
+ color: var(--rvs-fg3);
6556
+ font-size: 10px;
6557
+ }
6558
+
6559
+ /* The one-line degrade/loading/empty copy. Muted on purpose: "this Host does
6560
+ not report pool statistics" is information, not a failure of the link the
6561
+ metric cards above are already reporting on. */
6562
+ .rvs-pool-note {
6563
+ display: flex;
6564
+ align-items: center;
6565
+ gap: 4px;
6566
+ padding: 0 8px 5px;
6567
+ color: var(--rvs-fg3);
6568
+ font-size: 10px;
6569
+ }
6570
+
6571
+ /* A real request failure is the exception: it keeps the readable server text
6572
+ but colours it, because something IS wrong. */
6573
+ .rvs-pool-note.error {
6574
+ color: var(--rvs-danger-text);
6575
+ }
6576
+
6577
+ .rvs-pool-list {
6578
+ flex: 1 1 auto;
6579
+ min-height: 0;
6580
+ overflow: auto;
6581
+ scrollbar-width: thin;
6582
+ }
6583
+
6584
+ .rvs-pool-host {
6585
+ padding: 4px 8px 6px;
6586
+ border-bottom: 1px solid var(--rvs-border);
6587
+ }
6588
+
6589
+ .rvs-pool-host:last-child {
6590
+ border-bottom: 0;
6591
+ }
6592
+
6593
+ .rvs-pool-host-head {
6594
+ display: flex;
6595
+ align-items: center;
6596
+ gap: 6px;
6597
+ }
6598
+
6599
+ .rvs-pool-host-alias {
6600
+ flex: 1 1 auto;
6601
+ min-width: 0;
6602
+ overflow: hidden;
6603
+ text-overflow: ellipsis;
6604
+ white-space: nowrap;
6605
+ font-weight: 600;
6606
+ font-size: 11px;
6607
+ }
6608
+
6609
+ /* "排队 N" badge: the same signal the ordering uses, so the first row is the
6610
+ one with a queue and it is obvious WHY it is first. */
6611
+ .rvs-pool-queue {
6612
+ flex: none;
6613
+ padding: 0 4px;
6614
+ border: 1px solid var(--rvs-danger-text);
6615
+ border-radius: 3px;
6616
+ color: var(--rvs-danger-text);
6617
+ font-size: 9px;
6618
+ font-variant-numeric: tabular-nums;
6619
+ }
6620
+
6621
+ /* Name | state column, with the egress line spanning the second column under
6622
+ the shared lane it belongs to. */
6623
+ .rvs-pool-lane {
6624
+ display: grid;
6625
+ grid-template-columns: 56px minmax(0, 1fr);
6626
+ column-gap: 6px;
6627
+ align-items: baseline;
6628
+ font-size: 10px;
6629
+ }
6630
+
6631
+ .rvs-pool-lane-name {
6632
+ color: var(--rvs-fg3);
6633
+ }
6634
+
6635
+ .rvs-pool-lane-state {
6636
+ color: var(--rvs-fg2);
6637
+ font-variant-numeric: tabular-nums;
6638
+ }
6639
+
6640
+ /* A dialled lane is the fact the user came for; an idle one stays dim. */
6641
+ .rvs-pool-lane-state.open {
6642
+ color: var(--rvs-fg);
6643
+ }
6644
+
6645
+ /* Both the shared connection's route and the "files fell back to it" marker sit
6646
+ under the lane they belong to, in the second grid column. */
6647
+ .rvs-pool-egress,
6648
+ .rvs-pool-fallback {
6649
+ grid-column: 2;
6650
+ overflow: hidden;
6651
+ text-overflow: ellipsis;
6652
+ white-space: nowrap;
6653
+ color: var(--rvs-fg3);
6654
+ }
6655
+
6656
+ .rvs-pool-slots {
6657
+ display: flex;
6658
+ flex-wrap: wrap;
6659
+ gap: 0 10px;
6660
+ color: var(--rvs-fg3);
6661
+ font-size: 10px;
6662
+ font-variant-numeric: tabular-nums;
6663
+ }
6664
+
6472
6665
  /* ------------------------------------------------------ Ctrl+P quick open */
6473
6666
 
6474
6667
  .rvs-qo-mask {
@@ -6640,3 +6833,91 @@ body:not([data-ds-dark-theme]) .rvs-qo-mask {
6640
6833
  .rvs-qo-note.warn {
6641
6834
  color: var(--rvs-git-m);
6642
6835
  }
6836
+
6837
+ /* ------------------------------------------------------- egress (proxy/jump) */
6838
+ /**
6839
+ * Host egress chrome: the read-only route chip and the collapsible section
6840
+ * header of the host form / Settings → Remote hosts ("网络出口").
6841
+ *
6842
+ * Deliberately NOT scoped under `.rvs-root`, unlike the rest of this sheet: the
6843
+ * SAME chip renders inside the DSH Settings dialog, which mounts outside the
6844
+ * plugin's own root and therefore never inherits `--rvs-*`. The neutral
6845
+ * translucent border + inherited text colour read correctly in both schemes,
6846
+ * and the error state keys off the shell's global dark marker instead of the
6847
+ * scoped token (a bare `--rvs-danger-text` would be undefined there and fall
6848
+ * back to the light red on a dark plate).
6849
+ */
6850
+ .rvs-proxy-chip {
6851
+ flex: none;
6852
+ display: inline-flex;
6853
+ align-items: center;
6854
+ max-width: 46ch;
6855
+ overflow: hidden;
6856
+ padding: 0 6px;
6857
+ border: 1px solid var(--rvs-border2, rgba(127, 127, 127, .38));
6858
+ border-radius: 999px;
6859
+ color: inherit;
6860
+ font-size: 11px;
6861
+ line-height: 16px;
6862
+ text-overflow: ellipsis;
6863
+ white-space: nowrap;
6864
+ opacity: .82;
6865
+ }
6866
+
6867
+ .rvs-proxy-chip.is-error {
6868
+ border-color: currentColor;
6869
+ color: #a52a2a;
6870
+ opacity: 1;
6871
+ }
6872
+
6873
+ body[data-ds-dark-theme] .rvs-proxy-chip.is-error {
6874
+ color: #ff8b8b;
6875
+ }
6876
+
6877
+ /* A real <button> (Enter/Space for free); the caret carries the open state. */
6878
+ .rvs-proxy-toggle {
6879
+ display: inline-flex;
6880
+ align-items: center;
6881
+ gap: 5px;
6882
+ margin: 0;
6883
+ padding: 2px 4px;
6884
+ border: 1px solid transparent;
6885
+ border-radius: 5px;
6886
+ background: none;
6887
+ color: inherit;
6888
+ font: inherit;
6889
+ text-align: left;
6890
+ cursor: pointer;
6891
+ }
6892
+
6893
+ .rvs-proxy-toggle:hover {
6894
+ background: var(--rvs-hover, rgba(127, 127, 127, .14));
6895
+ }
6896
+
6897
+ .rvs-proxy-toggle:focus-visible {
6898
+ border-color: var(--rvs-border2, rgba(127, 127, 127, .38));
6899
+ outline: 2px solid var(--rvs-brand, #4d6bfe);
6900
+ outline-offset: 1px;
6901
+ }
6902
+
6903
+ .rvs-proxy-caret {
6904
+ display: inline-block;
6905
+ width: 10px;
6906
+ font-size: 10px;
6907
+ line-height: 12px;
6908
+ color: var(--rvs-fg3, inherit);
6909
+ transition: transform .12s ease;
6910
+ }
6911
+
6912
+ .rvs-proxy-toggle[aria-expanded="true"] .rvs-proxy-caret {
6913
+ transform: rotate(90deg);
6914
+ }
6915
+
6916
+ /* The fields sit under the label, indented to the caret's column. */
6917
+ .rvs-proxy-panel {
6918
+ padding-left: 18px;
6919
+ }
6920
+
6921
+ .rvs-proxy-panel[hidden] {
6922
+ display: none;
6923
+ }