import type { EnrichedDetectedPort, PortForwardEntry, UnrestoredPortForward, SshConfigHostListArgs, SshConfigHostListResult, SshConfigHostResolution, SshConfigImportResult, SshConnectionState, SshTarget, SshTargetAddResult, SshTargetCreateInput, SshTargetUpdateInput } from '../../shared/ssh-types' import type { FilesystemPathFlavor } from '../../shared/file-access/filesystem-path-flavor' export type SshApi = { listTargets: () => Promise // Last known labels keyed by removed target ID, for workspaces still pinned to them. listRemovedTargetLabels: () => Promise> addTarget: (args: { target: SshTargetCreateInput }) => Promise updateTarget: (args: { id: string; updates: SshTargetUpdateInput }) => Promise removeTarget: (args: { id: string }) => Promise importConfig: (args?: { reAdopt?: boolean }) => Promise listConfigHosts: (args?: SshConfigHostListArgs) => Promise resolveConfigHost: (args: { alias: string }) => Promise /** `automatic`: a connect no user asked for; it never lifts a cancelled sign-in. */ connect: (args: { targetId: string; automatic?: boolean }) => Promise disconnect: (args: { targetId: string }) => Promise getState: (args: { targetId: string }) => Promise needsPassphrasePrompt: (args: { targetId: string }) => Promise testConnection: (args: { targetId: string }) => Promise<{ success: boolean; error?: string; state?: SshConnectionState }> onStateChanged: ( callback: (data: { targetId: string; state: SshConnectionState }) => void ) => () => void onTargetRemoved: (callback: (data: { targetId: string }) => void) => () => void addPortForward: (args: { targetId: string localPort: number remoteHost: string remotePort: number label?: string }) => Promise updatePortForward: (args: { id: string targetId: string localPort: number remoteHost: string remotePort: number label?: string }) => Promise removePortForward: (args: { id: string }) => Promise listPortForwards: (args?: { targetId?: string }) => Promise listUnrestoredPortForwards: (args: { targetId: string }) => Promise removeSavedPortForward: (args: { targetId: string localPort: number remoteHost: string remotePort: number }) => Promise listDetectedPorts: (args: { targetId: string }) => Promise onPortForwardsChanged: ( callback: (data: { targetId: string forwards: PortForwardEntry[] unrestored?: UnrestoredPortForward[] }) => 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 }