dsh-remote-vs 0.29.0 → 0.31.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 (58) hide show
  1. package/README.en.md +53 -20
  2. package/README.md +41 -19
  3. package/THIRD-PARTY-NOTICES.md +6 -6
  4. package/cordis.patch.yml +31 -76
  5. package/lib/client.js +319 -91
  6. package/lib/index.js +845 -129
  7. package/lib/p2-router-fs.js +15 -1
  8. package/lib/types/changes/recorder.d.ts +65 -10
  9. package/lib/types/changes/status.d.ts +48 -3
  10. package/lib/types/client/ConnectionsSection.d.ts +73 -0
  11. package/lib/types/client/WorkspacesView.d.ts +2 -0
  12. package/lib/types/client/api.d.ts +41 -2
  13. package/lib/types/client/composer.d.ts +8 -1
  14. package/lib/types/client/scm/actions.d.ts +25 -1
  15. package/lib/types/client/selection-popup.d.ts +1 -1
  16. package/lib/types/client/ui.d.ts +7 -4
  17. package/lib/types/p2/helper-rpc.d.ts +48 -0
  18. package/lib/types/p2/router-fs.d.ts +9 -1
  19. package/lib/types/p2/worlds.d.ts +51 -0
  20. package/lib/types/pool.d.ts +245 -10
  21. package/lib/types/protocol.d.ts +96 -0
  22. package/lib/{worlds-RG8K5eom.js → worlds-BdxLeKul.js} +134 -7
  23. package/package.json +46 -46
  24. package/src/changes/recorder.ts +151 -15
  25. package/src/changes/status.ts +59 -4
  26. package/src/client/ConnectionsSection.tsx +359 -0
  27. package/src/client/DirectoryFlow.tsx +8 -0
  28. package/src/client/EditorPane.tsx +5 -1
  29. package/src/client/HostsView.tsx +2 -0
  30. package/src/client/MonitorView.tsx +14 -0
  31. package/src/client/RemoteExplorer.tsx +11 -2
  32. package/src/client/RemoteRoot.tsx +1 -0
  33. package/src/client/SettingsHosts.tsx +1 -0
  34. package/src/client/WorkspaceWizard.tsx +1 -0
  35. package/src/client/WorkspacesView.tsx +21 -1
  36. package/src/client/api.ts +72 -4
  37. package/src/client/composer.ts +8 -1
  38. package/src/client/i18n.ts +50 -2
  39. package/src/client/scm/DiffView.tsx +5 -2
  40. package/src/client/scm/actions.ts +63 -12
  41. package/src/client/selection-popup.ts +1 -1
  42. package/src/client/ui.tsx +9 -7
  43. package/src/client/vsc/vsc.css +231 -3
  44. package/src/index.ts +31 -0
  45. package/src/p2/helper-rpc.ts +73 -5
  46. package/src/p2/router-fs.ts +29 -1
  47. package/src/p2/worlds.ts +116 -1
  48. package/src/pool.ts +736 -111
  49. package/src/protocol.ts +100 -0
  50. package/src/routes.ts +85 -13
  51. package/vendor/dsh-remote-helpers/dsh-ssh-helper-0.2.3-alpha.3-linux-x64.helper.json +20 -0
  52. package/vendor/dsh-remote-helpers/dsh-ssh-helper-0.2.3-alpha.3-linux-x64.tar.gz +4 -0
  53. package/vendor/dsh-remote-helpers/dsh-ssh-helper-0.2.3-alpha.3-linux-x64.tar.gz.sha256 +1 -0
  54. package/vendor/dsh-remote-helpers/pkg-sea-bare-import.patch +30 -0
  55. package/vendor/dsh-remote-helpers/ssh-helper-runtime-deps.patch +4 -3
  56. package/vendor/dsh-remote-helpers/dsh-ssh-helper-0.2.2-rc.4-linux-x64.helper.json +0 -19
  57. package/vendor/dsh-remote-helpers/dsh-ssh-helper-0.2.2-rc.4-linux-x64.tar.gz +0 -4
  58. package/vendor/dsh-remote-helpers/dsh-ssh-helper-0.2.2-rc.4-linux-x64.tar.gz.sha256 +0 -1
package/src/client/api.ts CHANGED
@@ -26,6 +26,7 @@ import {
26
26
  type RemoteProcessKillResult,
27
27
  type RemoteProcessesResult,
28
28
  type RemotePluginMeta,
29
+ type RemotePoolStatsResult,
29
30
  type RemoteProbe,
30
31
  type RemoteProxySettingsPatch,
31
32
  type RemoteProxySettingsView,
@@ -501,6 +502,19 @@ function afterRemoteWrite<T>(value: T): T {
501
502
  return value
502
503
  }
503
504
 
505
+ /**
506
+ * Which HOST channel budget a command spends (see `api.exec`).
507
+ *
508
+ * The host keeps three budgets on the shared connection: the default exec one,
509
+ * `network` for `git fetch/pull/push/sync` (they can hold a channel for the whole
510
+ * 20-minute network timeout) and `git` for git commands — the reads
511
+ * (`git status/diff/log` and the ledger's scans, 300 s by default) and the local
512
+ * writes (commit / stage / discard / branch verbs). Both of those used to park an
513
+ * exec slot for minutes, which is what starved the monitor, the process panel and
514
+ * the agent tools.
515
+ */
516
+ export type ExecLane = 'exec' | 'network' | 'git'
517
+
504
518
  export const api = {
505
519
  // -- hosts
506
520
  getHosts: () => call<{ hosts: RemoteHostSummary[] }>(REMOTE_API.hosts).then(r => r.hosts),
@@ -554,9 +568,27 @@ export const api = {
554
568
  * One remote command (`/exec`), foreground unless `opts.background` asks for
555
569
  * the git channel. Reads the SCM panel builds stay foreground; the
556
570
  * repository-wide walks pass `{ background: true }` (see `scm/actions.ts`).
571
+ *
572
+ * `lane` picks the HOST's channel budget, and it is a separate argument on
573
+ * purpose: `opts` is scheduling (request gate, abort) and never reaches the
574
+ * body, while this one is a body field the pool reads. `'network'` is for
575
+ * `git fetch/pull/push/sync` only — those can hold a channel for 20 minutes and
576
+ * must not spend the slots every other command waits on. Omitted means the
577
+ * shared exec budget, i.e. what all existing callers get.
557
578
  */
558
- exec: (alias: string, command: string, timeoutMs?: number, opts?: RequestOptions) =>
559
- post<RemoteExecResult>(REMOTE_API.exec, timeoutMs === undefined ? { alias, command } : { alias, command, timeoutMs }, opts)
579
+ exec: (alias: string, command: string, timeoutMs?: number, opts?: RequestOptions, lane?: ExecLane) =>
580
+ post<RemoteExecResult>(
581
+ REMOTE_API.exec,
582
+ {
583
+ alias,
584
+ command,
585
+ ...(timeoutMs === undefined ? {} : { timeoutMs }),
586
+ // `'exec'` is the host's default, so it is not sent: an older host that
587
+ // knows no `lane` field keeps its pre-existing behaviour either way.
588
+ ...(lane === undefined || lane === 'exec' ? {} : { lane }),
589
+ },
590
+ opts,
591
+ )
560
592
  .then((result) => {
561
593
  // A worktree-changing git verb (discard / checkout / stash apply …) runs
562
594
  // through here rather than `fileOp`, so it is the one place an index
@@ -571,13 +603,27 @@ export const api = {
571
603
  * command runs, and the promise settles on the `exit` frame. An aborted
572
604
  * `signal` cancels the remote process group on the host side (the route acts
573
605
  * on the closed response), so a cancel button can actually stop a push.
606
+ *
607
+ * `lane` marks the HOST budget exactly like `api.exec`'s fifth argument
608
+ * (`'network'` for fetch/pull/push, `'git'` for git commands). It is a body
609
+ * field, kept in this handlers bag because that bag IS the options object this
610
+ * call already has (a fifth positional would read as `timeoutMs`). The older
611
+ * `network: true` spelling is still accepted and means `lane: 'network'`, so a
612
+ * caller written before the third budget keeps working.
574
613
  */
575
614
  execStream: async (
576
615
  alias: string,
577
616
  command: string,
578
617
  timeoutMs: number,
579
- handlers: { onData?: (stream: 'out' | 'err', text: string) => void; signal?: AbortSignal },
618
+ handlers: {
619
+ onData?: (stream: 'out' | 'err', text: string) => void
620
+ signal?: AbortSignal
621
+ lane?: ExecLane
622
+ /** @deprecated use `lane: 'network'` */
623
+ network?: boolean
624
+ },
580
625
  ): Promise<RemoteExecResult> => {
626
+ const lane = handlers.lane ?? (handlers.network === true ? 'network' : undefined)
581
627
  // A USER-initiated verb (fetch/pull/push, its own live panel), so it is
582
628
  // foreground — but only the RESPONSE ESTABLISHMENT is claimed: the SSE body
583
629
  // streams for minutes, and holding the foreground counter for that long
@@ -586,7 +632,12 @@ export const api = {
586
632
  const response = await requestGate.runForeground(() => fetch(REMOTE_API.execStream, {
587
633
  method: 'POST',
588
634
  headers: { 'content-type': 'application/json' },
589
- body: JSON.stringify({ alias, command, timeoutMs }),
635
+ body: JSON.stringify({
636
+ alias,
637
+ command,
638
+ timeoutMs,
639
+ ...(lane === undefined || lane === 'exec' ? {} : { lane }),
640
+ }),
590
641
  ...(handlers.signal === undefined ? {} : { signal: handlers.signal }),
591
642
  }))
592
643
  if (!response.ok || response.body === null) {
@@ -792,6 +843,23 @@ export const api = {
792
843
  if (metrics === undefined) throw new RemoteApiError(502, `no metrics for ${alias}`)
793
844
  return metrics
794
845
  }),
846
+ /**
847
+ * Live SSH pool shape of every host (connections, channels, slot occupancy).
848
+ *
849
+ * A purely LOCAL read of the Host's own pool — no remote command rides it, so
850
+ * the monitor page can poll it while a section is open without spending a
851
+ * channel. `undefined` means the Host does not know the route (404, an older
852
+ * plugin): the caller degrades quietly instead of painting an error, the same
853
+ * rule `proc.hostTooOld` follows for the process panel.
854
+ */
855
+ getPoolStats: async (): Promise<RemotePoolStatsResult | undefined> => {
856
+ try {
857
+ return await call<RemotePoolStatsResult>(REMOTE_API.connections)
858
+ } catch (caught) {
859
+ if (caught instanceof RemoteApiError && caught.status === 404) return undefined
860
+ throw caught
861
+ }
862
+ },
795
863
  // -- git (over the exec route; parsed in the browser, no host changes)
796
864
  // Timeouts come from the effective setting: status/log on a huge cold tree
797
865
  // routinely exceed the old fixed 120 s, and the client deadline used to cut
@@ -37,10 +37,17 @@
37
37
  * - `remoteRelativePath`: POSIX-only prefix strip against `remoteRoot`
38
38
  * (case-sensitive; outside/traversal refuses with `undefined`, never an
39
39
  * absolute mention — the local `workspaceRelativePath` policy).
40
+ * **`remoteRoot` is always the BINDING's workspace root, never the SCM
41
+ * repo root.** The model resolves mentions against the session workspace
42
+ * root, so rooting them at a selected repository would both drop every file
43
+ * outside that repository and shift every file inside it by the repository
44
+ * prefix (the repository may be a subdirectory of the workspace, or enclose
45
+ * it).
40
46
  * - `insertRemoteReference`: the caller passes `remoteRoot` directly; there is
41
47
  * no workspaces-membership lookup here because the binding gate lives in
42
48
  * `use-remote-chat-target.ts` (current session must belong to the viewed
43
- * binding, else the button is disabled).
49
+ * binding, else the button is disabled). Callers must pass the workspace
50
+ * root — `store.root`/the explorer's `root` — not `repoRoot`.
44
51
  * - `sameLocalDir`: Windows-tolerant alias-dir comparison for that gate.
45
52
  *
46
53
  * No ctx reads at module scope (explicit `ctx` params only) so every function
@@ -846,7 +846,7 @@ const zh: Record<string, string> = {
846
846
  'changes.statusDeleted': '删除',
847
847
  'changes.statusModified': '修改',
848
848
  'changes.statusRenamed': '重命名',
849
- 'changes.truncated': '文件过多,只列出前 500 个(统计数字也只算这 500 个)。',
849
+ 'changes.truncated': '改动列表不完整:文件过多、或未跟踪目录展开受限,部分文件未列出(统计数字也只算列出的部分)。',
850
850
  'changes.excluded': '未统计构建产物目录:{dirs}',
851
851
  'changes.markReviewed': '标记为已审阅',
852
852
  'changes.unmarkReviewed': '取消审阅标记',
@@ -1047,6 +1047,31 @@ const zh: Record<string, string> = {
1047
1047
  'proc.expand': '展开进程分区',
1048
1048
  'proc.collapse': '收起进程分区',
1049
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': '还没有主机建立连接。',
1050
1075
  }
1051
1076
 
1052
1077
  const en: Record<string, string> = {
@@ -1765,7 +1790,7 @@ const en: Record<string, string> = {
1765
1790
  'changes.statusDeleted': 'deleted',
1766
1791
  'changes.statusModified': 'modified',
1767
1792
  'changes.statusRenamed': 'renamed',
1768
- '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).',
1769
1794
  'changes.excluded': 'Build output directories not counted: {dirs}',
1770
1795
  'changes.markReviewed': 'Mark as reviewed',
1771
1796
  'changes.unmarkReviewed': 'Clear the review mark',
@@ -1966,6 +1991,29 @@ const en: Record<string, string> = {
1966
1991
  'proc.expand': 'Expand processes',
1967
1992
  'proc.collapse': 'Collapse processes',
1968
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.',
1969
2017
  }
1970
2018
 
1971
2019
  export type Lang = 'zh' | 'en'
@@ -419,7 +419,7 @@ function createSideTokens(text: string, lang: LangId | undefined): SideTokens {
419
419
  * a `thin`, low-contrast thumb it read as "there is no horizontal scrollbar".
420
420
  */
421
421
  function HScrollBar(props: {
422
- barRef: React.RefObject<HTMLDivElement>
422
+ barRef: React.RefObject<HTMLDivElement | null>
423
423
  width: number
424
424
  hint: string
425
425
  onScroll: (left: number) => void
@@ -1063,7 +1063,10 @@ export function DiffView(props: { tab: EditorTab; visible: boolean; offline?: bo
1063
1063
  tabId={tab.id}
1064
1064
  ctx={store.ctx}
1065
1065
  sessionId={chat.sessionId}
1066
- remoteRoot={store.repoRoot ?? store.root}
1066
+ // Workspace-rooted, not `repoRoot`: a mention is resolved by the
1067
+ // model against the session workspace root, while the selected
1068
+ // repository may be a workspace subdirectory.
1069
+ remoteRoot={store.root}
1067
1070
  chatEnabled={chatEnabled}
1068
1071
  addLabel={t('files.addToConversation')}
1069
1072
  onSave={() => { void saveAfter() }}
@@ -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
  }
@@ -53,7 +53,7 @@ export interface SelectionPopupControls<T> {
53
53
  /** The current popup (null = hidden). */
54
54
  popup: SelectionPopup<T> | null
55
55
  /** Attach to the portaled button element. */
56
- buttonRef: RefObject<HTMLButtonElement>
56
+ buttonRef: RefObject<HTMLButtonElement | null>
57
57
  /** Anchor the popup above a selection (viewport-clamped). */
58
58
  show(insert: T, left: number, top: number): void
59
59
  /** Hide the popup (idempotent). */
package/src/client/ui.tsx CHANGED
@@ -22,9 +22,12 @@ export const inputStyle: CSSProperties = {
22
22
 
23
23
  /**
24
24
  * Native dropdown that follows the DSH theme in BOTH states: the closed box
25
- * uses the translucent surface, while the open option popup (which Chrome
26
- * renders from `color-scheme`, ignoring translucent backgrounds) gets
27
- * explicit Canvas colors + a declared scheme so dark theme stays readable.
25
+ * uses the translucent surface, while the open option popup is painted by the
26
+ * browser from each option's own colors. Themed through the `.rvs-dropdown`
27
+ * class (vsc.css) — `Canvas`/`CanvasText` used to resolve against the page
28
+ * scheme, which DSH never switches, so the dark theme kept a white list.
29
+ * `color-scheme` is deliberately NOT set here: an inline `light dark` would
30
+ * override the class's per-theme value.
28
31
  */
29
32
  export const selectStyle: CSSProperties = {
30
33
  background: 'rgba(127,127,127,.12)',
@@ -35,13 +38,12 @@ export const selectStyle: CSSProperties = {
35
38
  fontSize: 12,
36
39
  fontFamily: 'inherit',
37
40
  outline: 'none',
38
- colorScheme: 'light dark',
39
41
  }
40
42
 
41
- /** Option rows of the open popup: explicit theme-following colors. */
43
+ /** Option rows of the open popup: opaque, theme-following, measured ≥7:1. */
42
44
  export const optionStyle: CSSProperties = {
43
- backgroundColor: 'Canvas',
44
- color: 'CanvasText',
45
+ backgroundColor: 'var(--rvs-option-bg, Canvas)',
46
+ color: 'var(--rvs-option-fg, CanvasText)',
45
47
  }
46
48
 
47
49
  export const btnStyle: CSSProperties = {