返回 DeepSeek-Reasonix
remoteTypes.ts
根目录 / desktop / frontend / src / lib / remoteTypes.ts
1 // ── Remote SSH module (mirrors desktop/remote_app.go view structs) ──
2
3 export type RemoteConnState =
4 | "connecting"
5 | "connected"
6 | "reconnecting"
7 | "degraded"
8 | "pending_hostkey"
9 | "pending_secret"
10 | "stopped";
11
12 export type RemoteServerState =
13 | "starting"
14 | "detect"
15 | "install"
16 | "waiting_lock"
17 | "launch"
18 | "health_check"
19 | "ready"
20 | "error"
21 | "stopped"
22 | "reuse";
23
24 // ── Remote projects ──
25 export interface RemoteTabRefView {
26 hostId: string;
27 workspace: string;
28 /** Stable identity of the active remote session, when known. */
29 sessionId?: string;
30 }
31
32 export interface RemoteTabMetaFields {
33 remote?: RemoteTabRefView;
34 remoteState?: RemoteTabStateValue;
35 /** Host-emitted: this tab's serve advertised session-fork-targets-v1. */
36 forkTargetsSupported?: boolean;
37 interactionTargetSupported?: boolean;
38 extensionFormInstanceSupported?: boolean;
39 }
40
41 export interface RemoteProjectNodeFields {
42 remote?: RemoteTabRefView;
43 remoteSession?: { hostId: string; workspace: string; name: string; path?: string; sessionId?: string; title?: string; current?: boolean };
44 }
45
46 export interface RemoteSessionMetaFields {
47 remote?: RemoteTabRefView;
48 }
49
50 export interface RemoteProjectView {
51 hostId: string;
52 workspace: string;
53 title?: string;
54 color?: string;
55 merged?: boolean;
56 }
57
58 export interface RemoteSessionView {
59 hostId?: string;
60 sessionId?: string;
61 name: string;
62 path?: string;
63 title: string;
64 turns: number;
65 current?: boolean;
66 running?: boolean;
67 lastActivityAt?: number;
68 resultSequence?: number;
69 metadataReady?: boolean;
70 pinned?: boolean;
71 }
72
73 export type RemoteTabStateValue = "connecting" | "ready" | "reconnecting" | "serve_down" | "error" | "disconnected";
74
75 export interface RemoteTabState {
76 state: RemoteTabStateValue;
77 error?: string;
78 hydrationRevision?: number;
79 }
80
81 export interface RemoteTabOpenOptions {
82 newSession?: boolean;
83 sessionName?: string;
84 sessionPath?: string;
85 sessionId?: string;
86 sessionTitle?: string;
87 }
88
89 export interface RemoteTabSnapshot {
90 history: unknown[];
91 context?: unknown;
92 todos?: unknown[];
93 checkpoints?: unknown[];
94 models?: string[];
95 commands?: unknown[];
96 status?: unknown;
97 pendingEvents?: unknown[];
98 }
99
100 export interface RemoteAskAnswer {
101 QuestionID: string;
102 Selected: string[];
103 }
104
105 export interface RemoteHostView {
106 id: string;
107 label: string;
108 host: string;
109 port: number;
110 user: string;
111 identityFile: string;
112 proxyJump: string;
113 defaultWorkspace: string;
114 serveInstall: string;
115 credentialMode: string;
116 useSSHConfig: boolean;
117 passwordSet?: boolean;
118 keyPassphraseSet?: boolean;
119 }
120
121 export interface RemoteHostInput {
122 label: string;
123 host: string;
124 port: number;
125 user: string;
126 identityFile: string;
127 proxyJump: string;
128 defaultWorkspace: string;
129 serveInstall: string;
130 credentialMode: string;
131 useSSHConfig: boolean;
132 password?: string;
133 keyPassphrase?: string;
134 clearPassword?: boolean;
135 clearPassphrase?: boolean;
136 preserveExistingSettings?: boolean;
137 }
138
139 export interface RemoteFingerprintView {
140 hostId: string;
141 address: string;
142 keyType: string;
143 sha256: string;
144 }
145
146 export interface RemoteSecretPromptView {
147 promptId: string;
148 hostId: string;
149 host: string;
150 kind: "password" | "passphrase";
151 identity?: string;
152 }
153
154 export interface RemoteKnownHostLocation {
155 path: string;
156 line: number;
157 }
158
159 export interface RemoteConnectionErrorDetails {
160 code: "connection_failed" | "auth_failed" | "host_key_rejected" | "host_key_mismatch";
161 presentedSha256?: string;
162 knownHostRecords?: RemoteKnownHostLocation[];
163 }
164
165 export interface RemoteConnectionStatus {
166 hostId: string;
167 state: RemoteConnState;
168 error?: string;
169 errorDetails?: RemoteConnectionErrorDetails;
170 fingerprint?: RemoteFingerprintView;
171 secretPrompt?: RemoteSecretPromptView;
172 attempt?: number;
173 }
174
175 export interface RemoteDirEntry {
176 name: string;
177 path: string;
178 isDir: boolean;
179 size: number;
180 mtimeUnix: number;
181 symlink: boolean;
182 }
183
184 export interface RemoteFilePreview {
185 path: string;
186 body: string;
187 size: number;
188 mtimeUnix: number;
189 truncated: boolean;
190 binary: boolean;
191 err?: string;
192 }
193
194 export interface RemoteWriteResult {
195 ok: boolean;
196 conflict: boolean;
197 newMtimeUnix: number;
198 }
199
200 export interface RemoteForwardInput {
201 localPort: number;
202 remoteHost: string;
203 remotePort: number;
204 label: string;
205 }
206
207 export interface RemoteForwardView {
208 id: string;
209 hostId: string;
210 localPort: number;
211 remoteHost: string;
212 remotePort: number;
213 label: string;
214 state: string;
215 error?: string;
216 }
217
218 export interface RemoteServerView {
219 hostId: string;
220 workspace: string;
221 state: RemoteServerState;
222 message?: string;
223 localUrl?: string;
224 error?: string;
225 }
226
227 /** Path-free summary of files left behind by the removed Remote Workbench. */
228 export interface RemoteLegacyWorkbenchData {
229 mirrorCount: number;
230 mirrorBytes: number;
231 trustFile: boolean;
232 }
233
234 export interface RemoteForwardsEvent {
235 hostId: string;
236 forwards: RemoteForwardView[];
237 }
238
238 lines TYPESCRIPT