Files
orca/src/preload/api/ssh-api.ts
T
ed18c2c580 fix(ssh): Cancel on an SSH password prompt no longer brings it straight back (#28402)
* fix(ssh): a cancelled sign-in stays cancelled until the user reconnects

Co-Authored-By: Claude <noreply@anthropic.com>

* test(ssh): drive the credential cancel through the IPC harness

Co-Authored-By: Claude <noreply@anthropic.com>

* fix(ssh): an explicit server connect lifts the cancelled sign-in of its SSH host

Co-Authored-By: Claude <noreply@anthropic.com>

* fix(ssh): the cancelled attempt may still offer a password; a successful sign-in lifts the decline

Co-Authored-By: Claude <noreply@anthropic.com>

* test(ssh): build the managed-server link without the newer kind field

Co-Authored-By: Claude <noreply@anthropic.com>

---------

Co-authored-by: m4air <m4air@Mac.localdomain>
Co-authored-by: Claude <noreply@anthropic.com>
2026-10-13 16:52:37 -07:00

78 lines
3.1 KiB
TypeScript

import type {
EnrichedDetectedPort,
PortForwardEntry,
SshConfigHostListArgs,
SshConfigHostListResult,
SshConfigHostResolution,
SshConfigImportResult,
SshConnectionState,
SshTarget,
SshTargetAddResult,
SshTargetCreateInput,
SshTargetUpdateInput
} from '../../shared/ssh-types'
import type { FilesystemPathFlavor } from '../../shared/filesystem-entry-types'
export type SshApi = {
listTargets: () => Promise<SshTarget[]>
// Removed-target id → last known label, for a friendly host name on workspaces still pinned to a removed target.
listRemovedTargetLabels: () => Promise<Record<string, string>>
addTarget: (args: { target: SshTargetCreateInput }) => Promise<SshTargetAddResult>
updateTarget: (args: { id: string; updates: SshTargetUpdateInput }) => Promise<SshTarget>
removeTarget: (args: { id: string }) => Promise<void>
importConfig: (args?: { reAdopt?: boolean }) => Promise<SshConfigImportResult>
listConfigHosts: (args?: SshConfigHostListArgs) => Promise<SshConfigHostListResult>
resolveConfigHost: (args: { alias: string }) => Promise<SshConfigHostResolution | null>
/** `automatic`: a connect no user asked for; it never lifts a cancelled sign-in. */
connect: (args: { targetId: string; automatic?: boolean }) => Promise<SshConnectionState | null>
disconnect: (args: { targetId: string }) => Promise<void>
getState: (args: { targetId: string }) => Promise<SshConnectionState | null>
needsPassphrasePrompt: (args: { targetId: string }) => Promise<boolean>
testConnection: (args: {
targetId: string
}) => Promise<{ success: boolean; error?: string; state?: SshConnectionState }>
onStateChanged: (
callback: (data: { targetId: string; state: SshConnectionState }) => void
) => () => void
addPortForward: (args: {
targetId: string
localPort: number
remoteHost: string
remotePort: number
label?: string
}) => Promise<PortForwardEntry>
updatePortForward: (args: {
id: string
targetId: string
localPort: number
remoteHost: string
remotePort: number
label?: string
}) => Promise<PortForwardEntry>
removePortForward: (args: { id: string }) => Promise<PortForwardEntry | null>
listPortForwards: (args?: { targetId?: string }) => Promise<PortForwardEntry[]>
listDetectedPorts: (args: { targetId: string }) => Promise<EnrichedDetectedPort[]>
onPortForwardsChanged: (
callback: (data: { targetId: string; forwards: PortForwardEntry[] }) => void
) => () => void
onDetectedPortsChanged: (
callback: (data: { targetId: string; ports: EnrichedDetectedPort[] }) => void
) => () => void
browseDir: (args: { targetId: string; dirPath: string }) => Promise<{
entries: { name: string; isDirectory: boolean }[]
resolvedPath: string
pathFlavor: FilesystemPathFlavor
}>
onCredentialRequest: (
callback: (data: {
requestId: string
targetId: string
kind: 'passphrase' | 'password' | 'keyboard-interactive'
detail: string
echo?: boolean
}) => void
) => () => void
onCredentialResolved: (callback: (data: { requestId: string }) => void) => () => void
submitCredential: (args: { requestId: string; value: string | null }) => Promise<void>
}