dsh-remote-vs 0.27.0 → 0.29.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.en.md +159 -23
- package/README.md +123 -23
- package/lib/client.js +6906 -6619
- package/lib/index.js +2014 -67
- package/lib/types/changes/recorder.d.ts +119 -2
- package/lib/types/client/CodeEditor.d.ts +15 -0
- package/lib/types/client/HostsView.d.ts +139 -2
- package/lib/types/client/api.d.ts +42 -2
- package/lib/types/client/changes/apply-failure.d.ts +41 -0
- package/lib/types/client/changes/block-confirm.d.ts +97 -0
- package/lib/types/client/changes/diff-outcome.d.ts +56 -0
- package/lib/types/client/changes/freshness.d.ts +51 -0
- package/lib/types/client/changes/model.d.ts +19 -1
- package/lib/types/client/changes/session-diff.d.ts +100 -0
- package/lib/types/client/changes/staleness.d.ts +98 -0
- package/lib/types/client/changes/turn-reverted.d.ts +82 -0
- package/lib/types/client/changes/turn-view.d.ts +131 -0
- package/lib/types/client/changes/undo-affordance.d.ts +44 -10
- package/lib/types/client/changes/undo-target.d.ts +12 -0
- package/lib/types/client/connection.d.ts +28 -1
- package/lib/types/client/i18n.d.ts +1 -1
- package/lib/types/client/store.d.ts +91 -1
- package/lib/types/client/vsc/change-marks.d.ts +21 -0
- package/lib/types/forward.d.ts +11 -1
- package/lib/types/pool.d.ts +95 -1
- package/lib/types/protocol.d.ts +221 -1
- package/lib/types/proxy.d.ts +136 -0
- package/lib/types/store.d.ts +81 -1
- package/lib/types/tools.d.ts +3 -0
- package/package.json +1 -1
- package/src/changes/recorder.ts +851 -8
- package/src/client/CodeEditor.tsx +43 -3
- package/src/client/ConnectionStatus.tsx +19 -5
- package/src/client/EditorPane.tsx +64 -7
- package/src/client/HostsView.tsx +552 -11
- package/src/client/PortsView.tsx +16 -0
- package/src/client/SettingsHosts.tsx +132 -6
- package/src/client/api.ts +60 -3
- package/src/client/changes/ChangesDock.tsx +539 -54
- package/src/client/changes/apply-failure.ts +73 -0
- package/src/client/changes/block-confirm.ts +180 -0
- package/src/client/changes/changes.css +45 -0
- package/src/client/changes/diff-outcome.ts +97 -0
- package/src/client/changes/freshness.ts +68 -0
- package/src/client/changes/model.ts +56 -1
- package/src/client/changes/session-diff.ts +187 -0
- package/src/client/changes/staleness.ts +148 -0
- package/src/client/changes/turn-reverted.ts +254 -0
- package/src/client/changes/turn-view.ts +195 -0
- package/src/client/changes/undo-affordance.ts +295 -63
- package/src/client/changes/undo-target.ts +12 -0
- package/src/client/connection.ts +76 -2
- package/src/client/i18n.ts +204 -4
- package/src/client/scm/DiffView.tsx +32 -13
- package/src/client/store.tsx +392 -16
- package/src/client/vsc/change-marks.ts +21 -0
- package/src/client/vsc/preview-document.tsx +4 -1
- package/src/client/vsc/vsc.css +6747 -6509
- package/src/forward.ts +38 -2
- package/src/importers.ts +125 -13
- package/src/keygen.ts +8 -1
- package/src/pool.ts +422 -27
- package/src/protocol.ts +229 -1
- package/src/proxy.ts +673 -0
- package/src/routes.ts +93 -14
- package/src/store.ts +335 -0
- package/src/tools.ts +47 -2
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Context } from '@deepseek-ai/cordis';
|
|
2
|
-
import type { DiffModel, GitStatusDetail, RemoteHostSummary, RemoteRoutingStatus, RemoteWorkspaceBinding } from '../protocol.ts';
|
|
2
|
+
import type { DiffModel, GitStatusDetail, RemoteChangedFile, RemoteChangesTurnView, RemoteHostSummary, RemoteRoutingStatus, RemoteWorkspaceBinding } from '../protocol.ts';
|
|
3
3
|
import type { ChangeMark, ChangeSet } from './vsc/change-marks.ts';
|
|
4
|
+
import { type DiffNotice } from './changes/diff-outcome.ts';
|
|
4
5
|
import { type StatusBuckets, type TreeMarks } from './scm/status-map.ts';
|
|
5
6
|
import { type DiffPayload } from './scm/actions.ts';
|
|
6
7
|
import { type DirExpansions } from './scm/untracked-dirs.ts';
|
|
@@ -94,10 +95,32 @@ export interface EditorTab {
|
|
|
94
95
|
activeHunk?: number;
|
|
95
96
|
/** 编辑器报告文档已与 `changeSet` 脱钩(用户敲过字),上层该重新拉数据。 */
|
|
96
97
|
changeStale?: boolean;
|
|
98
|
+
/**
|
|
99
|
+
* 这批改动标记的建立时刻(`Date.now()`,`applyChangeSet` 写入)。
|
|
100
|
+
*
|
|
101
|
+
* 面板的轮询用它和 `RemoteChangesSummary.at` 比先后:标记比列表新时(保存/撤销
|
|
102
|
+
* 刚重读过),那份更早的列表不能证明标记过期(见 `changes/staleness.ts`)。
|
|
103
|
+
*/
|
|
104
|
+
changeSetAt?: number;
|
|
97
105
|
/** 改动点跳转目标行(1-based)。与 `line` 分开,两条跳转链路互不干扰。 */
|
|
98
106
|
revealHunkLine?: number;
|
|
99
107
|
/** 改动点跳转的 nonce,语义同 `lineNonce`。 */
|
|
100
108
|
revealHunkNonce?: number;
|
|
109
|
+
/**
|
|
110
|
+
* 「会话改动」面板那一行的只读 diff(不是 git 工作区 diff)。
|
|
111
|
+
*
|
|
112
|
+
* 有它 = 这一页是账本轮次的比较:两栏都只读(改前是还原出来的基线、改后是远端
|
|
113
|
+
* 当前内容),没有 hunk 暂存/撤销,重新载入走账本而不是 `git diff`。`reloadTab`
|
|
114
|
+
* 与 `saveTargetOf` 都按它分流。
|
|
115
|
+
*/
|
|
116
|
+
sessionDiff?: {
|
|
117
|
+
sessionId: string;
|
|
118
|
+
alias: string;
|
|
119
|
+
/** 会话账本的仓库根(`git apply -R` 的目标目录,也是仓库目录的答案)。 */
|
|
120
|
+
root: string;
|
|
121
|
+
/** 面板显示路径(标签条与 diff 头用它,不参与任何写操作)。 */
|
|
122
|
+
display: string;
|
|
123
|
+
};
|
|
101
124
|
/**
|
|
102
125
|
* 重读(`reloadTab`)成功后递增的 nonce。
|
|
103
126
|
*
|
|
@@ -896,6 +919,54 @@ export declare function gotoChange(tabId: string, dir: 1 | -1): number | undefin
|
|
|
896
919
|
* 重新拉数据是上层的事,仓库在这一层不发起任何请求。
|
|
897
920
|
*/
|
|
898
921
|
export declare function markChangeStale(tabId: string): void;
|
|
922
|
+
/**
|
|
923
|
+
* 面板拿到新统计后,指出哪些已开标签页的改动标记已经过期。
|
|
924
|
+
*
|
|
925
|
+
* 标记的失效原来只由"本地输入"触发(`markChangeStale` 由编辑器报告),所以远端或
|
|
926
|
+
* 会话继续改同一个文件时,屏幕上那份行号与补丁会一直画着、看起来仍然准确。面板每
|
|
927
|
+
* 3 秒重读一次账本,那份列表就是"这批标记还算不算数"的唯一证据 —— 这里把它翻成
|
|
928
|
+
* 既有那张「位置已过期」标记。
|
|
929
|
+
*
|
|
930
|
+
* 判据是纯函数(`changes/staleness.ts`),这里只负责选出**属于这个会话**的标签页:
|
|
931
|
+
* 换会话后屏幕上可能还留着上一个会话的标记,拿本会话的列表去比对只会误报。
|
|
932
|
+
* **不发起任何远端读**:重新计算是用户点该行时的事。
|
|
933
|
+
*
|
|
934
|
+
* @param sessionId - 面板当前会话。
|
|
935
|
+
* @param files - 这一轮列表的行。
|
|
936
|
+
* @param truncated - 列表自己被文件上限截断("找不到"不再算证据)。
|
|
937
|
+
* @param listedAt - 这份列表的重算时刻(`RemoteChangesSummary.at`)。
|
|
938
|
+
* @param turnView - 本轮视图;带本轮来源的标记要用它那一份行来判(见实现)。
|
|
939
|
+
*/
|
|
940
|
+
export declare function syncChangeSetStaleness(sessionId: string, files: readonly RemoteChangedFile[], truncated?: boolean, listedAt?: number, turnView?: RemoteChangesTurnView): void;
|
|
941
|
+
/**
|
|
942
|
+
* 「会话改动」面板那一行的 → 只读并排 diff(见 `changes/session-diff.ts`)。
|
|
943
|
+
*
|
|
944
|
+
* 与 `openFile`/`openDiff` 的区别是数据来源:这里读的是会话账本(会话起点为基线),
|
|
945
|
+
* 而 `openDiff` 读的是 git 工作区(索引/HEAD 为基线)。两件事不能互相顶替 ——
|
|
946
|
+
* 工作区里可能有会话开始之前就存在的未提交改动。
|
|
947
|
+
*
|
|
948
|
+
* 结果里的 `notice` 就是面板要显示的那句话(截断 / 二进制 / 读不到 / 已无差异),
|
|
949
|
+
* 打开成功时为 `undefined`。调用方负责把它渲染出来,不要吞掉。
|
|
950
|
+
*/
|
|
951
|
+
export interface ChangeDiffTarget {
|
|
952
|
+
sessionId: string;
|
|
953
|
+
alias: string;
|
|
954
|
+
/** 会话账本的仓库根(与 `revertFileChanges` 的 `root` 同源)。 */
|
|
955
|
+
root: string;
|
|
956
|
+
/** 远端绝对路径。 */
|
|
957
|
+
path: string;
|
|
958
|
+
/** 面板显示路径(标签条用)。 */
|
|
959
|
+
display: string;
|
|
960
|
+
/** 面板选定的仓库子目录(透传给账本的 `repoSubdir`,可省略)。 */
|
|
961
|
+
repoSubdir?: string;
|
|
962
|
+
}
|
|
963
|
+
export interface ChangeDiffResult {
|
|
964
|
+
opened: boolean;
|
|
965
|
+
/** 必须显示给用户的结论;`undefined` = 打开成功且没有任何要说明的。 */
|
|
966
|
+
notice?: DiffNotice;
|
|
967
|
+
}
|
|
968
|
+
/** 打开(或聚焦)一行的会话只读 diff。 */
|
|
969
|
+
export declare function openChangeDiff(target: ChangeDiffTarget): Promise<ChangeDiffResult>;
|
|
899
970
|
export declare function undoChange(tabId: string, mark: ChangeMark): Promise<void>;
|
|
900
971
|
/**
|
|
901
972
|
* Coordinates for "undo everything this session did to this file".
|
|
@@ -913,6 +984,25 @@ export interface RevertFileTarget {
|
|
|
913
984
|
path: string;
|
|
914
985
|
display: string;
|
|
915
986
|
mode: 'patch' | 'delete';
|
|
987
|
+
/**
|
|
988
|
+
* Which comparison the patch must come from.
|
|
989
|
+
*
|
|
990
|
+
* `turn` = "undo what THIS turn did to this file" (restore the previous turn's
|
|
991
|
+
* close); absent = the session baseline (unchanged default). The patch is
|
|
992
|
+
* re-fetched from the host rather than taken from the panel's poll, so the
|
|
993
|
+
* same argument decides WHICH host read to make.
|
|
994
|
+
*/
|
|
995
|
+
scope?: 'session' | 'turn';
|
|
996
|
+
/**
|
|
997
|
+
* For `scope: 'turn'`: which turn the row came from.
|
|
998
|
+
*
|
|
999
|
+
* Used after a successful revert to hide that row from the turn list (the host's
|
|
1000
|
+
* frozen delta keeps listing it, by design). **Fail-closed**: when it is omitted
|
|
1001
|
+
* the row is NOT hidden — hiding is a claim about one specific turn, and guessing
|
|
1002
|
+
* it (e.g. from "the latest turn seen") could hide a row in a turn the user never
|
|
1003
|
+
* reverted. The only caller (the dock) always knows it.
|
|
1004
|
+
*/
|
|
1005
|
+
turn?: number;
|
|
916
1006
|
}
|
|
917
1007
|
/**
|
|
918
1008
|
* Revert one file's WHOLE session change set (the panel row's action).
|
|
@@ -119,6 +119,27 @@ export interface ChangeSet {
|
|
|
119
119
|
* (新建 / 二进制 / 字节被上限扣下)。
|
|
120
120
|
*/
|
|
121
121
|
filePatch?: string;
|
|
122
|
+
/**
|
|
123
|
+
* 这批 hunk 对应的增删行数(`--numstat` 语义:`+` / `-` 行的条数)。
|
|
124
|
+
*
|
|
125
|
+
* 面板每 3 秒重新统计一次,而屏幕上这批标记只会在这几行真的变了之后才作废;
|
|
126
|
+
* 把"这批标记当初代表多少行"记在数据里,才能拿它和新的统计行比对(见
|
|
127
|
+
* `changes/staleness.ts`)。省略 = 无可比数字:二进制 / 过大的行不做行级比较、
|
|
128
|
+
* 被字节上限扣下的 diff 也不会走到建标记这一步(`changes/diff-outcome.ts`),
|
|
129
|
+
* 所以它们都没有这两个字段,而不是"带一个前缀数字"。
|
|
130
|
+
*/
|
|
131
|
+
added?: number;
|
|
132
|
+
deleted?: number;
|
|
133
|
+
/** 建立这批标记时列表行给出的状态(A/M/D/R/…);省略 = 未知,不参与比对。 */
|
|
134
|
+
status?: string;
|
|
135
|
+
/**
|
|
136
|
+
* 每个 hunk 的一枚稳定块标识(与 `patches` 同序,见 `changes/block-confirm.ts`)。
|
|
137
|
+
*
|
|
138
|
+
* 编辑器里的「确认保留」是**块级**本地记账,块必须有一个跨刷新稳定的名字;
|
|
139
|
+
* 行号会随远端变化,hunk 头里的四个数字 + 文件的远端绝对路径才代表"同一处改动"。
|
|
140
|
+
* 省略 = 调用方没有给出文件路径,编辑器的块笔记不启用。
|
|
141
|
+
*/
|
|
142
|
+
blocks?: string[];
|
|
122
143
|
}
|
|
123
144
|
/** 换一份改动标记;`null` = 清空(有改动数据,但没有任何要画的东西)。 */
|
|
124
145
|
export declare const setChangeSet: import("@codemirror/state").StateEffectType<ChangeSet | null>;
|
package/lib/types/forward.d.ts
CHANGED
|
@@ -11,7 +11,17 @@ export declare const FORWARD_MAX_CONNECTIONS = 32;
|
|
|
11
11
|
* the manager never reaches into the pool beyond one call.
|
|
12
12
|
*/
|
|
13
13
|
export interface ForwardPoolLike {
|
|
14
|
-
|
|
14
|
+
/**
|
|
15
|
+
* Open one direct-tcpip channel. `opts.dedicated` asks for the host's dedicated
|
|
16
|
+
* forward connection; the answer carries which connection was actually used, so
|
|
17
|
+
* the rule can SAY "shared" after a fallback instead of pretending.
|
|
18
|
+
*/
|
|
19
|
+
forwardOut(alias: string, dstHost: string, dstPort: number, srcPort?: number, opts?: {
|
|
20
|
+
dedicated?: boolean;
|
|
21
|
+
}): Promise<{
|
|
22
|
+
channel: ClientChannel;
|
|
23
|
+
dedicated: boolean;
|
|
24
|
+
}>;
|
|
15
25
|
}
|
|
16
26
|
export interface ForwardManagerDeps {
|
|
17
27
|
pool: ForwardPoolLike;
|
package/lib/types/pool.d.ts
CHANGED
|
@@ -63,6 +63,29 @@ export declare class RemotePool {
|
|
|
63
63
|
* that refuses extra connections still gets a working terminal.
|
|
64
64
|
*/
|
|
65
65
|
private readonly shellConns;
|
|
66
|
+
/**
|
|
67
|
+
* Dedicated connections for `ssh -L` port forwards (one per alias).
|
|
68
|
+
*
|
|
69
|
+
* The other half of the same argument: a forwarded channel carries arbitrary
|
|
70
|
+
* TCP (a database, an SSH tunnel, a whole browser page), so it is long-lived
|
|
71
|
+
* and can move a lot of data. Multiplexed onto the shared connection it would
|
|
72
|
+
* queue ahead of exec/SFTP channels (SSH has no per-channel priority), and a
|
|
73
|
+
* remote service that stalls would hold the window `git status` needs. A
|
|
74
|
+
* terminal already gets its own connection (`shellConns`); forward traffic gets
|
|
75
|
+
* its own for exactly the same reason.
|
|
76
|
+
*
|
|
77
|
+
* Cost: one extra handshake per alias that actually receives a forwarded
|
|
78
|
+
* connection, plus one held TCP connection while any of its forward channels is
|
|
79
|
+
* open (the 30-minute idle eviction applies once the last one closes).
|
|
80
|
+
* `forwardOut` falls back to the shared connection when this one cannot be
|
|
81
|
+
* established (e.g. the server refuses extra connections), so a forward never
|
|
82
|
+
* stops working because of it — it only loses the isolation.
|
|
83
|
+
*/
|
|
84
|
+
private readonly forwardConns;
|
|
85
|
+
/** Aliases whose dedicated-forward downgrade was already logged (once per alias). */
|
|
86
|
+
private readonly forwardFallbackNoted;
|
|
87
|
+
/** alias -> timestamp until which the dedicated forward connection is skipped. */
|
|
88
|
+
private readonly forwardBlocked;
|
|
66
89
|
/** TOFU fingerprints observed this process (alias -> sha256). */
|
|
67
90
|
private readonly hostKeys;
|
|
68
91
|
/** Per-alias `setsid --wait` capability, probed once (see supportsSetsid). */
|
|
@@ -94,6 +117,22 @@ export declare class RemotePool {
|
|
|
94
117
|
* indicator's poll never creates a connection as a side effect.
|
|
95
118
|
*/
|
|
96
119
|
status(): RemoteConnectionStatus[];
|
|
120
|
+
/**
|
|
121
|
+
* The egress of the alias' LIVE connection, whichever class owns it.
|
|
122
|
+
*
|
|
123
|
+
* All three classes open through the same resolved route, so the first one
|
|
124
|
+
* that is up answers for the alias; the shared connection is preferred because
|
|
125
|
+
* it is the one exec/browse (the surface the chip describes) rides.
|
|
126
|
+
*/
|
|
127
|
+
private liveEgress;
|
|
128
|
+
/**
|
|
129
|
+
* The route the stored configuration resolves to, for an alias with NO live
|
|
130
|
+
* connection. Pure observation, and absorbed: a dangling jump chain or a
|
|
131
|
+
* half-configured proxy makes `resolveProxy` throw, and a status poll must
|
|
132
|
+
* answer "the stored route is broken, here is why" instead of failing — the
|
|
133
|
+
* chip still has to render, and a 500 would hide the reason it exists to show.
|
|
134
|
+
*/
|
|
135
|
+
private configuredEgress;
|
|
97
136
|
/** Record a successful dial or transport-level operation. */
|
|
98
137
|
private markOk;
|
|
99
138
|
/** Record a connection-level failure the status chip should show. */
|
|
@@ -164,7 +203,22 @@ export declare class RemotePool {
|
|
|
164
203
|
* debug their network. Real transport failures still arrive through the
|
|
165
204
|
* pooled connection's own close/error events.
|
|
166
205
|
*/
|
|
167
|
-
forwardOut(alias: string, dstHost: string, dstPort: number, srcPort?: number
|
|
206
|
+
forwardOut(alias: string, dstHost: string, dstPort: number, srcPort?: number, opts?: {
|
|
207
|
+
dedicated?: boolean;
|
|
208
|
+
}): Promise<{
|
|
209
|
+
channel: ClientChannel;
|
|
210
|
+
dedicated: boolean;
|
|
211
|
+
}>;
|
|
212
|
+
/**
|
|
213
|
+
* Is this alias's dedicated forward connection in its short cooldown?
|
|
214
|
+
*
|
|
215
|
+
* Expired entries are dropped eagerly so the map cannot grow per alias forever.
|
|
216
|
+
*/
|
|
217
|
+
private forwardCoolingDown;
|
|
218
|
+
/** Park the dedicated connection for one alias and log the downgrade, once. */
|
|
219
|
+
private blockForward;
|
|
220
|
+
/** Log one alias's forward downgrade to the shared connection, once. */
|
|
221
|
+
private noteForwardFallback;
|
|
168
222
|
/** Run one callback with a fresh SFTP session (closed afterwards). */
|
|
169
223
|
withSftp<T>(alias: string, fn: (sftp: SFTPWrapper) => Promise<T>, opts?: SftpOptions): Promise<T>;
|
|
170
224
|
/**
|
|
@@ -309,6 +363,23 @@ export declare class RemotePool {
|
|
|
309
363
|
private acquire;
|
|
310
364
|
/** `acquire` for the dedicated PTY connection map. */
|
|
311
365
|
private acquireShell;
|
|
366
|
+
/**
|
|
367
|
+
* `acquire` for the dedicated port-forward connection map.
|
|
368
|
+
*
|
|
369
|
+
* `quiet`: a dedicated forward connection is an OPTIMIZATION. If the server
|
|
370
|
+
* refuses it (MaxStartups, `MaxSessions`, a per-source limit) the forward still
|
|
371
|
+
* works over the shared connection, so the shared link is healthy — painting
|
|
372
|
+
* the connection chip red here would send the user to debug a network that is
|
|
373
|
+
* fine (and `forwardOut` reports the rule's own error separately).
|
|
374
|
+
*
|
|
375
|
+
* The dial also gets its OWN short budget ({@link FORWARD_DEDICATED_BUDGET_MS}):
|
|
376
|
+
* a server that silently drops the extra connection would otherwise make every
|
|
377
|
+
* forward channel wait the full connect watchdog before falling back. The
|
|
378
|
+
* abandoned dial keeps running — if it eventually succeeds the connection is
|
|
379
|
+
* pooled and the next channel uses it; its failure is already handled inside
|
|
380
|
+
* `acquireIn`.
|
|
381
|
+
*/
|
|
382
|
+
private acquireForward;
|
|
312
383
|
private acquireIn;
|
|
313
384
|
/** Evict ONE alias from ONE map (host removal drops both maps explicitly). */
|
|
314
385
|
private evictFrom;
|
|
@@ -321,5 +392,28 @@ export declare class RemotePool {
|
|
|
321
392
|
* overrides it.
|
|
322
393
|
*/
|
|
323
394
|
private makeClient;
|
|
395
|
+
/**
|
|
396
|
+
* Open one SSH connection, through whatever route the store resolves.
|
|
397
|
+
*
|
|
398
|
+
* Three routes, and only the first is the pre-proxy code path:
|
|
399
|
+
* - `direct`: unchanged (`host` / `port` in the connect config);
|
|
400
|
+
* - `proxy`: the proxy module builds the tunnel and ssh2 rides the returned
|
|
401
|
+
* socket (`sock`), so `host`/`port` are deliberately omitted (ssh2 ignores
|
|
402
|
+
* them when `sock` is present);
|
|
403
|
+
* - `jump`: the tunnel is a `direct-tcpip` channel on the JUMP host's pooled
|
|
404
|
+
* connection, held for as long as the client lives. Its close/error handlers
|
|
405
|
+
* close that channel and give the hold back — a leak here would pin the jump
|
|
406
|
+
* host's connection forever.
|
|
407
|
+
*
|
|
408
|
+
* Every failure is a DIAL failure, so it keeps the existing `markError`
|
|
409
|
+
* semantics; only the message is layered, so the user can tell which hop broke:
|
|
410
|
+
* `proxy auth failed: …`, `proxy refused: …`, `jump host "x" failed: …`.
|
|
411
|
+
*
|
|
412
|
+
* `report` receives the route this dial ACTUALLY settled on, once and only on
|
|
413
|
+
* success — a caller that asked "did this go through the jump host?" must not
|
|
414
|
+
* be answered from a configuration that may have changed since. It is a
|
|
415
|
+
* callback rather than a wider return type so the seam keeps returning the
|
|
416
|
+
* `Client` the existing callers (and gates) hand around.
|
|
417
|
+
*/
|
|
324
418
|
private dial;
|
|
325
419
|
}
|
package/lib/types/protocol.d.ts
CHANGED
|
@@ -31,6 +31,8 @@ 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";
|
|
34
36
|
/** Current working directory of one live session (click resolution helper). */
|
|
35
37
|
readonly sessionCwd: "/api/dsh-remote/session-cwd";
|
|
36
38
|
/** What one live session changed on its remote host (the review panel). */
|
|
@@ -54,6 +56,70 @@ export declare const MAX_SELECTION_DOWNLOAD = 100;
|
|
|
54
56
|
export declare function selectionDownloadName(count: number): string;
|
|
55
57
|
/** Authentication flavors a host entry may carry (P0: direct only, no jump/agent). */
|
|
56
58
|
export type RemoteAuthKind = 'key' | 'password';
|
|
59
|
+
/**
|
|
60
|
+
* How one host reaches the network.
|
|
61
|
+
*
|
|
62
|
+
* Two levels exist on purpose: a profile-wide default (`RemoteProxySettingsView`)
|
|
63
|
+
* and a per-host override. `inherit` is the default state of every existing
|
|
64
|
+
* host, and the default default is `direct`, so an upgrade changes nothing.
|
|
65
|
+
*/
|
|
66
|
+
export type RemoteProxyMode = 'inherit' | 'direct' | 'proxy' | 'jump';
|
|
67
|
+
/** One stored proxy endpoint (secrets included: host-side only). */
|
|
68
|
+
export interface RemoteProxySetting {
|
|
69
|
+
kind: 'http' | 'socks5';
|
|
70
|
+
/** Proxy hostname or IP. */
|
|
71
|
+
host: string;
|
|
72
|
+
/** Proxy port. */
|
|
73
|
+
port: number;
|
|
74
|
+
/** Basic auth (http) / user+password (socks5). */
|
|
75
|
+
username?: string;
|
|
76
|
+
password?: string;
|
|
77
|
+
}
|
|
78
|
+
/** A host's proxy decision, as stored. */
|
|
79
|
+
export interface RemoteHostProxySetting {
|
|
80
|
+
mode: RemoteProxyMode;
|
|
81
|
+
/** The endpoint for `mode: 'proxy'`. */
|
|
82
|
+
proxy?: RemoteProxySetting;
|
|
83
|
+
/** The jump host for `mode: 'jump'` — an alias of another stored host. */
|
|
84
|
+
jump?: {
|
|
85
|
+
viaAlias: string;
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
/** Secret-free proxy endpoint for the browser. */
|
|
89
|
+
export interface RemoteProxyTargetView {
|
|
90
|
+
kind: 'http' | 'socks5';
|
|
91
|
+
host: string;
|
|
92
|
+
port: number;
|
|
93
|
+
username?: string;
|
|
94
|
+
/** True when a password is stored (never echoed back). */
|
|
95
|
+
hasPassword: boolean;
|
|
96
|
+
}
|
|
97
|
+
/** Secret-free proxy decision of one host. */
|
|
98
|
+
export interface RemoteHostProxyView {
|
|
99
|
+
mode: RemoteProxyMode;
|
|
100
|
+
target?: RemoteProxyTargetView;
|
|
101
|
+
/** Alias of the jump host, for `mode: 'jump'`. */
|
|
102
|
+
jumpVia?: string;
|
|
103
|
+
/**
|
|
104
|
+
* Why this setting cannot be used, when it cannot.
|
|
105
|
+
*
|
|
106
|
+
* A jump host that names itself, a chain longer than one hop, or a jump host
|
|
107
|
+
* that is itself reached through a jump is refused at dial time; saying so in
|
|
108
|
+
* the host's own row beats a generic "connection failed".
|
|
109
|
+
*/
|
|
110
|
+
problem?: string;
|
|
111
|
+
}
|
|
112
|
+
/** Profile-wide proxy default (the "upper" of the two levels). */
|
|
113
|
+
export interface RemoteProxySettingsView {
|
|
114
|
+
defaultMode: 'direct' | 'proxy';
|
|
115
|
+
target?: RemoteProxyTargetView;
|
|
116
|
+
}
|
|
117
|
+
/** Patch shape for the profile-wide proxy default. */
|
|
118
|
+
export interface RemoteProxySettingsPatch {
|
|
119
|
+
defaultMode?: 'direct' | 'proxy';
|
|
120
|
+
/** `null` clears the stored endpoint; omitted keeps it. */
|
|
121
|
+
target?: RemoteProxySetting | null;
|
|
122
|
+
}
|
|
57
123
|
/** One stored host entry (the $DSH_HOME/dsh-remote.json store shape). */
|
|
58
124
|
export interface RemoteHostEntry {
|
|
59
125
|
/** Stable, user-chosen identifier used by every operation. */
|
|
@@ -78,6 +144,8 @@ export interface RemoteHostEntry {
|
|
|
78
144
|
description?: string;
|
|
79
145
|
/** Free-form tags. */
|
|
80
146
|
tags: string[];
|
|
147
|
+
/** How this host is reached (absent = `inherit`). */
|
|
148
|
+
proxy?: RemoteHostProxySetting;
|
|
81
149
|
/** Last deploy pipeline outcome for this host. */
|
|
82
150
|
deploy?: RemoteDeployState | undefined;
|
|
83
151
|
createdAt: number;
|
|
@@ -96,6 +164,8 @@ export interface RemoteHostSummary {
|
|
|
96
164
|
managedKey: boolean;
|
|
97
165
|
description?: string;
|
|
98
166
|
tags: string[];
|
|
167
|
+
/** Secret-free proxy decision; always present (mode `inherit` when unset). */
|
|
168
|
+
proxy: RemoteHostProxyView;
|
|
99
169
|
deploy?: RemoteDeployState | undefined;
|
|
100
170
|
createdAt: number;
|
|
101
171
|
updatedAt: number;
|
|
@@ -172,6 +242,36 @@ export interface RemoteTimeouts {
|
|
|
172
242
|
/** One SFTP file read (editor, diff sides, document preview). */
|
|
173
243
|
readMs: number;
|
|
174
244
|
}
|
|
245
|
+
/**
|
|
246
|
+
* Where one SSH connection ACTUALLY left this machine.
|
|
247
|
+
*
|
|
248
|
+
* The user's question ("did this really go through the jump host?") cannot be
|
|
249
|
+
* answered by the stored configuration: a host can be configured for a jump host
|
|
250
|
+
* while a connection established BEFORE that edit is still serving. So the pool
|
|
251
|
+
* reports the route of the connection it is holding, and the browser shows it on
|
|
252
|
+
* the connection chip.
|
|
253
|
+
*
|
|
254
|
+
* `detail` is the hop itself (the target `host:port`, the proxy `host:port`, or
|
|
255
|
+
* the jump host alias) and NOT a formatted sentence: the wording is UI copy and
|
|
256
|
+
* therefore belongs to the localized client.
|
|
257
|
+
*/
|
|
258
|
+
export interface EgressInfo {
|
|
259
|
+
kind: 'direct' | 'proxy' | 'jump';
|
|
260
|
+
/** The hop: the target endpoint, the proxy endpoint, or the jump host alias. */
|
|
261
|
+
detail: string;
|
|
262
|
+
/** Jump route only: the alias of the host whose connection carries the tunnel. */
|
|
263
|
+
viaAlias?: string;
|
|
264
|
+
/** Proxy route only: whether this host or the profile default chose the proxy. */
|
|
265
|
+
source?: 'host' | 'default';
|
|
266
|
+
/** Proxy route only: the protocol, so the UI can name it (HTTP / SOCKS5). */
|
|
267
|
+
proxyKind?: 'http' | 'socks5';
|
|
268
|
+
/**
|
|
269
|
+
* Set only on a CONFIGURED route whose resolution failed (a jump host that is
|
|
270
|
+
* gone, a self-jump, a half-configured proxy): the reason, so the chip can say
|
|
271
|
+
* why the route cannot work instead of silently reading as healthy.
|
|
272
|
+
*/
|
|
273
|
+
problem?: string;
|
|
274
|
+
}
|
|
175
275
|
/**
|
|
176
276
|
* Connection health for one host alias, as the Host's pool sees it.
|
|
177
277
|
*
|
|
@@ -192,6 +292,18 @@ export interface RemoteConnectionStatus {
|
|
|
192
292
|
errorAt?: number;
|
|
193
293
|
/** Human-readable failure the client can show in the status chip. */
|
|
194
294
|
error?: string;
|
|
295
|
+
/**
|
|
296
|
+
* The route the connection this pool HOLDS was actually opened through.
|
|
297
|
+
* Present only while such a connection exists: it is evidence about a live
|
|
298
|
+
* link, not about the current configuration.
|
|
299
|
+
*/
|
|
300
|
+
egress?: EgressInfo;
|
|
301
|
+
/**
|
|
302
|
+
* The route the stored configuration resolves to, for an alias with no live
|
|
303
|
+
* connection (what the NEXT connection would use, and the honest answer while
|
|
304
|
+
* nothing is dialed). Carries `problem` when the configuration is unusable.
|
|
305
|
+
*/
|
|
306
|
+
configured?: EgressInfo;
|
|
195
307
|
}
|
|
196
308
|
/** Remote OS probe outcome. */
|
|
197
309
|
export interface RemoteProbe {
|
|
@@ -521,6 +633,82 @@ export interface RemoteChangedFile {
|
|
|
521
633
|
*/
|
|
522
634
|
revert?: 'patch' | 'delete';
|
|
523
635
|
}
|
|
636
|
+
/**
|
|
637
|
+
* The most recent COMPLETED turn, as the review panel switches to it.
|
|
638
|
+
*
|
|
639
|
+
* "This turn" is answered from the ledger's own turn boundaries: the host keeps
|
|
640
|
+
* every listed path's text at each turn close and compares the next close
|
|
641
|
+
* against it. Deliberately ONE turn deep — a per-turn history would need the
|
|
642
|
+
* full text of every file at every boundary, and the panel's job is "what did
|
|
643
|
+
* the turn I just ran change", not a time machine.
|
|
644
|
+
*/
|
|
645
|
+
export interface RemoteChangesTurnView {
|
|
646
|
+
/** Turn number the delta describes (0 = no turn has closed yet). */
|
|
647
|
+
turn: number;
|
|
648
|
+
/** Files this turn changed, with THIS TURN's counts (not the session total). */
|
|
649
|
+
files: RemoteChangedFile[];
|
|
650
|
+
added: number;
|
|
651
|
+
deleted: number;
|
|
652
|
+
/** Wall-clock ms when the delta was computed. */
|
|
653
|
+
at: number;
|
|
654
|
+
/**
|
|
655
|
+
* Whether the per-file hunks behind `turnDiff` are cached.
|
|
656
|
+
*
|
|
657
|
+
* `false` = the turn's contents were too large for the memory budget (or the
|
|
658
|
+
* file cap made attribution unreliable): the counts above are still real, but
|
|
659
|
+
* clicking a row cannot paint hunks or revert. Honest degradation — the
|
|
660
|
+
* alternative would be comparing the next turn against a half-updated
|
|
661
|
+
* snapshot and attributing old changes to it.
|
|
662
|
+
*/
|
|
663
|
+
cached: boolean;
|
|
664
|
+
/** Why `cached` is false (shown to the user, never swallowed). */
|
|
665
|
+
reason?: string;
|
|
666
|
+
/**
|
|
667
|
+
* This view is INCOMPLETE — and it is not "a prefix of a longer list".
|
|
668
|
+
*
|
|
669
|
+
* Three ways rows go missing:
|
|
670
|
+
* - the file cap cut the list (`files` is the first N of the scanned paths);
|
|
671
|
+
* - the previous turn's snapshot was cut by that cap, or a previous side was
|
|
672
|
+
* withheld (binary / over the read cap), so a path that cannot be compared is
|
|
673
|
+
* DROPPED instead of being guessed as a whole-file creation;
|
|
674
|
+
* - the previous turn's slow scan never landed before this turn closed, so a
|
|
675
|
+
* file missing from that snapshot cannot be proven new either.
|
|
676
|
+
*
|
|
677
|
+
* A partial view must say so: "these rows are what this turn provably changed",
|
|
678
|
+
* not "this is everything the turn changed".
|
|
679
|
+
*/
|
|
680
|
+
truncated?: true;
|
|
681
|
+
/**
|
|
682
|
+
* The turn's slow scan (`git ls-files --others`) has not landed yet.
|
|
683
|
+
*
|
|
684
|
+
* The same turn is REBUILT when it does (`correctTurn`), so this list may still
|
|
685
|
+
* grow — it is never relabelled as the next turn. When a newer turn closes
|
|
686
|
+
* first, the view stops waiting and `truncated` records that it never caught
|
|
687
|
+
* up.
|
|
688
|
+
*/
|
|
689
|
+
pending?: true;
|
|
690
|
+
}
|
|
691
|
+
/**
|
|
692
|
+
* Body of `op: 'list'` on the changes route (the request half of
|
|
693
|
+
* {@link RemoteChangesSummary}).
|
|
694
|
+
*
|
|
695
|
+
* The two refresh intents are separated because they cost very different things
|
|
696
|
+
* on the remote:
|
|
697
|
+
* - {@link RemoteChangesListRequest.force} (`⟳`) — tracked scan NOW and re-arm the
|
|
698
|
+
* slow `git ls-files --others` walk (clears its write-off). Deliberate click.
|
|
699
|
+
* - {@link RemoteChangesListRequest.trackedOnly} — "the user came back to the
|
|
700
|
+
* page": tracked files now, but the slow walk keeps its cadence and its
|
|
701
|
+
* written-off verdict. Focus events repeat every few seconds; re-arming an 11s
|
|
702
|
+
* (cold: minutes) walk on each one would multiply the remote load.
|
|
703
|
+
*/
|
|
704
|
+
export interface RemoteChangesListRequest {
|
|
705
|
+
op: 'list';
|
|
706
|
+
sessionId: string;
|
|
707
|
+
force?: true;
|
|
708
|
+
trackedOnly?: true;
|
|
709
|
+
/** Repository directory from the Source Control panel ('' = the session root). */
|
|
710
|
+
repoSubdir?: string;
|
|
711
|
+
}
|
|
524
712
|
/**
|
|
525
713
|
* What one session changed on its remote host since the session's baseline.
|
|
526
714
|
*
|
|
@@ -562,10 +750,30 @@ export interface RemoteChangesSummary {
|
|
|
562
750
|
pending: boolean;
|
|
563
751
|
/** Why this session has no ledger (local session, no git, timeout, …). */
|
|
564
752
|
unavailable?: string;
|
|
753
|
+
/**
|
|
754
|
+
* The last completed turn's delta, when the host computed one.
|
|
755
|
+
*
|
|
756
|
+
* Optional on purpose: an older host (or a session with no closed turn yet)
|
|
757
|
+
* omits it and the panel stays on the session-cumulative view it has always
|
|
758
|
+
* shown. A client that does not know the field ignores it.
|
|
759
|
+
*/
|
|
760
|
+
turnView?: RemoteChangesTurnView;
|
|
565
761
|
}
|
|
566
762
|
/** One file's whole-session comparison, ready for editor decorations. */
|
|
567
763
|
export interface RemoteChangesDiff {
|
|
568
|
-
|
|
764
|
+
/**
|
|
765
|
+
* `unavailable` / `stale` belong to the per-turn comparison only.
|
|
766
|
+
*
|
|
767
|
+
* - `unavailable`: the host has no cached per-turn hunks for this session
|
|
768
|
+
* (memory budget, file cap, or no completed turn) — `reason` says which;
|
|
769
|
+
* - `stale`: the file changed after the turn closed, so the cached comparison
|
|
770
|
+
* no longer describes what is on disk; the client falls back to the
|
|
771
|
+
* session-cumulative view instead of painting wrong lines.
|
|
772
|
+
*
|
|
773
|
+
* The whole-session `diff` never returns them, so a client that switches on
|
|
774
|
+
* the old three kinds keeps working unchanged.
|
|
775
|
+
*/
|
|
776
|
+
kind: 'text' | 'binary' | 'missing' | 'unavailable' | 'stale';
|
|
569
777
|
/** Remote absolute POSIX path. */
|
|
570
778
|
path: string;
|
|
571
779
|
display: string;
|
|
@@ -584,6 +792,8 @@ export interface RemoteChangesDiff {
|
|
|
584
792
|
status?: 'A' | 'M' | 'D' | 'R' | 'C' | 'T' | 'U';
|
|
585
793
|
/** The diff was cut at the byte cap: `hunks` is a prefix. */
|
|
586
794
|
truncated?: true;
|
|
795
|
+
/** For `unavailable` / `stale`: what happened, in words the panel can show. */
|
|
796
|
+
reason?: string;
|
|
587
797
|
}
|
|
588
798
|
/** One row of the side-by-side diff projection. */
|
|
589
799
|
export interface DiffRow {
|
|
@@ -673,6 +883,16 @@ export interface RemoteForwardState {
|
|
|
673
883
|
bytesOut: number;
|
|
674
884
|
/** Last connect/bind failure, human-readable. */
|
|
675
885
|
lastError?: string;
|
|
886
|
+
/**
|
|
887
|
+
* Which SSH connection the last successful channel used.
|
|
888
|
+
*
|
|
889
|
+
* `dedicated` = the host's own port-forward connection (the normal case);
|
|
890
|
+
* `shared` = the server refused the extra connection, so the channel rode the
|
|
891
|
+
* shared one (the forward still works, only the isolation is lost). Absent
|
|
892
|
+
* until a connection has succeeded at least once — older hosts omit it too, so
|
|
893
|
+
* a client must treat it as optional.
|
|
894
|
+
*/
|
|
895
|
+
transport?: 'dedicated' | 'shared';
|
|
676
896
|
startedAt: number;
|
|
677
897
|
}
|
|
678
898
|
/** One listening TCP socket on the remote host. */
|