| 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 | pinned?: boolean; |
| 69 | } |
| 70 | |
| 71 | export type RemoteTabStateValue = "connecting" | "ready" | "reconnecting" | "serve_down" | "error" | "disconnected"; |
| 72 | |
| 73 | export interface RemoteTabState { |
| 74 | state: RemoteTabStateValue; |
| 75 | error?: string; |
| 76 | } |
| 77 | |
| 78 | export interface RemoteTabOpenOptions { |
| 79 | newSession?: boolean; |
| 80 | sessionName?: string; |
| 81 | sessionPath?: string; |
| 82 | sessionId?: string; |
| 83 | sessionTitle?: string; |
| 84 | } |
| 85 | |
| 86 | export interface RemoteTabSnapshot { |
| 87 | history: unknown[]; |
| 88 | context?: unknown; |
| 89 | todos?: unknown[]; |
| 90 | checkpoints?: unknown[]; |
| 91 | models?: string[]; |
| 92 | commands?: unknown[]; |
| 93 | status?: unknown; |
| 94 | pendingEvents?: unknown[]; |
| 95 | } |
| 96 | |
| 97 | export interface RemoteAskAnswer { |
| 98 | QuestionID: string; |
| 99 | Selected: string[]; |
| 100 | } |
| 101 | |
| 102 | export interface RemoteHostView { |
| 103 | id: string; |
| 104 | label: string; |
| 105 | host: string; |
| 106 | port: number; |
| 107 | user: string; |
| 108 | identityFile: string; |
| 109 | proxyJump: string; |
| 110 | defaultWorkspace: string; |
| 111 | serveInstall: string; |
| 112 | credentialMode: string; |
| 113 | useSSHConfig: boolean; |
| 114 | passwordSet?: boolean; |
| 115 | keyPassphraseSet?: boolean; |
| 116 | } |
| 117 | |
| 118 | export interface RemoteHostInput { |
| 119 | label: string; |
| 120 | host: string; |
| 121 | port: number; |
| 122 | user: string; |
| 123 | identityFile: string; |
| 124 | proxyJump: string; |
| 125 | defaultWorkspace: string; |
| 126 | serveInstall: string; |
| 127 | credentialMode: string; |
| 128 | useSSHConfig: boolean; |
| 129 | password?: string; |
| 130 | keyPassphrase?: string; |
| 131 | clearPassword?: boolean; |
| 132 | clearPassphrase?: boolean; |
| 133 | preserveExistingSettings?: boolean; |
| 134 | } |
| 135 | |
| 136 | export interface RemoteFingerprintView { |
| 137 | hostId: string; |
| 138 | address: string; |
| 139 | keyType: string; |
| 140 | sha256: string; |
| 141 | } |
| 142 | |
| 143 | export interface RemoteSecretPromptView { |
| 144 | promptId: string; |
| 145 | hostId: string; |
| 146 | host: string; |
| 147 | kind: "password" | "passphrase"; |
| 148 | identity?: string; |
| 149 | } |
| 150 | |
| 151 | export interface RemoteKnownHostLocation { |
| 152 | path: string; |
| 153 | line: number; |
| 154 | } |
| 155 | |
| 156 | export interface RemoteConnectionErrorDetails { |
| 157 | code: "connection_failed" | "auth_failed" | "host_key_rejected" | "host_key_mismatch"; |
| 158 | presentedSha256?: string; |
| 159 | knownHostRecords?: RemoteKnownHostLocation[]; |
| 160 | } |
| 161 | |
| 162 | export interface RemoteConnectionStatus { |
| 163 | hostId: string; |
| 164 | state: RemoteConnState; |
| 165 | error?: string; |
| 166 | errorDetails?: RemoteConnectionErrorDetails; |
| 167 | fingerprint?: RemoteFingerprintView; |
| 168 | secretPrompt?: RemoteSecretPromptView; |
| 169 | attempt?: number; |
| 170 | } |
| 171 | |
| 172 | export interface RemoteDirEntry { |
| 173 | name: string; |
| 174 | path: string; |
| 175 | isDir: boolean; |
| 176 | size: number; |
| 177 | mtimeUnix: number; |
| 178 | symlink: boolean; |
| 179 | } |
| 180 | |
| 181 | export interface RemoteFilePreview { |
| 182 | path: string; |
| 183 | body: string; |
| 184 | size: number; |
| 185 | mtimeUnix: number; |
| 186 | truncated: boolean; |
| 187 | binary: boolean; |
| 188 | err?: string; |
| 189 | } |
| 190 | |
| 191 | export interface RemoteWriteResult { |
| 192 | ok: boolean; |
| 193 | conflict: boolean; |
| 194 | newMtimeUnix: number; |
| 195 | } |
| 196 | |
| 197 | export interface RemoteForwardInput { |
| 198 | localPort: number; |
| 199 | remoteHost: string; |
| 200 | remotePort: number; |
| 201 | label: string; |
| 202 | } |
| 203 | |
| 204 | export interface RemoteForwardView { |
| 205 | id: string; |
| 206 | hostId: string; |
| 207 | localPort: number; |
| 208 | remoteHost: string; |
| 209 | remotePort: number; |
| 210 | label: string; |
| 211 | state: string; |
| 212 | error?: string; |
| 213 | } |
| 214 | |
| 215 | export interface RemoteServerView { |
| 216 | hostId: string; |
| 217 | workspace: string; |
| 218 | state: RemoteServerState; |
| 219 | message?: string; |
| 220 | localUrl?: string; |
| 221 | error?: string; |
| 222 | } |
| 223 | |
| 224 | /** Path-free summary of files left behind by the removed Remote Workbench. */ |
| 225 | export interface RemoteLegacyWorkbenchData { |
| 226 | mirrorCount: number; |
| 227 | mirrorBytes: number; |
| 228 | trustFile: boolean; |
| 229 | } |
| 230 | |
| 231 | export interface RemoteForwardsEvent { |
| 232 | hostId: string; |
| 233 | forwards: RemoteForwardView[]; |
| 234 | } |
| 235 |