import type { EnrichedDetectedPort, PortForwardEntry, SshConfigHostListArgs, SshConfigHostListResult, SshConfigHostResolution, SshConfigImportResult, SshConnectionState, SshTarget, SshTargetAddResult } from '../../shared/ssh-types' import type { FilesystemPathFlavor } from '../../shared/types' export type SshApi = { listTargets: () => Promise // Removed-target id → last known label, for a friendly host name on workspaces still pinned to a removed target. listRemovedTargetLabels: () => Promise> addTarget: (args: { target: Omit }) => Promise updateTarget: (args: { id: string updates: Partial> }) => Promise removeTarget: (args: { id: string }) => Promise importConfig: (args?: { reAdopt?: boolean }) => Promise listConfigHosts: (args?: SshConfigHostListArgs) => Promise resolveConfigHost: (args: { alias: string }) => Promise connect: (args: { targetId: string }) => Promise disconnect: (args: { targetId: string }) => Promise terminateSessions: (args: { targetId: string }) => Promise resetRelay: (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 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 listDetectedPorts: (args: { targetId: string }) => Promise 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' detail: string }) => void ) => () => void onCredentialResolved: (callback: (data: { requestId: string }) => void) => () => void submitCredential: (args: { requestId: string; value: string | null }) => Promise }