import type { Client, ClientChannel, SFTPWrapper } from 'ssh2';
export interface SSHConnectionConfig {
host: string;
port?: number;
username: string;
password?: string;
privateKey?: string;
privateKeyPath?: string;
passphrase?: string;
}
export interface SSHSession {
id: string;
config: SSHConnectionConfig;
client: Client;
connected: boolean;
createdAt: Date;
lastUsedAt: Date;
shells: Map<string, ShellSession>;
}
export interface ShellSession {
id: string;
channel: ClientChannel;
outputBuffer: string;
active: boolean;
}
export interface CommandResult {
stdout: string;
stderr: string;
exitCode: number;
}
export interface SFTPFileInfo {
filename: string;
longname: string;
size: number;
modifyTime: Date;
accessTime: Date;
isDirectory: boolean;
isFile: boolean;
isSymbolicLink: boolean;
permissions: number;
owner: number;
group: number;
}
export interface SFTPTransferProgress {
bytesTransferred: number;
totalBytes: number;
percentage: number;
}
export interface ToolResponse {
success: boolean;
data?: unknown;
error?: string;
}
export interface ConnectParams {
host: string;
port?: number;
username: string;
password?: string;
privateKey?: string;
privateKeyPath?: string;
passphrase?: string;
}
export interface ExecParams {
sessionId: string;
command: string;
cwd?: string;
env?: Record<string, string>;
pty?: boolean;
}
export interface DisconnectParams {
sessionId: string;
}
export interface SFTPUploadParams {
sessionId: string;
localPath: string;
remotePath: string;
}
export interface SFTPDownloadParams {
sessionId: string;
remotePath: string;
localPath: string;
}
export interface SFTPListParams {
sessionId: string;
remotePath: string;
}
export interface ShellStartParams {
sessionId: string;
cols?: number;
rows?: number;
}
export interface ShellSendParams {
sessionId: string;
shellId: string;
input: string;
}
export interface ShellReadParams {
sessionId: string;
shellId: string;
clear?: boolean;
}
export interface ShellCloseParams {
sessionId: string;
shellId: string;
}