@zero-transfer/sftp 0.1.6 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import { EventEmitter } from 'node:events';
2
2
  import { SecureVersion, PeerCertificate } from 'node:tls';
3
3
  import { Readable } from 'node:stream';
4
- import { BaseAgent, Algorithms, ConnectConfig, Client, SFTPWrapper } from 'ssh2';
5
4
  import { Buffer } from 'node:buffer';
5
+ import { Socket } from 'node:net';
6
6
 
7
7
  /**
8
8
  * Structured logging contracts and helpers for ZeroTransfer.
@@ -306,10 +306,25 @@ interface RemoteStat extends RemoteEntry {
306
306
  type TlsSecretSource = SecretSource | SecretSource[];
307
307
  /** Known-hosts material source accepted by SSH connection profiles. */
308
308
  type SshKnownHostsSource = SecretSource | SecretSource[];
309
+ /** Minimal SSH agent contract used by profile validation and SSH adapters. */
310
+ interface SshAgentLike {
311
+ /** Returns public identities exposed by the agent implementation. */
312
+ getIdentities: (...args: any[]) => unknown;
313
+ /** Signs payloads using a selected identity. */
314
+ sign: (...args: any[]) => unknown;
315
+ }
316
+ /** Ordered algorithm list mutation operations used by SSH adapters. */
317
+ interface SshAlgorithmMutations {
318
+ append?: string | readonly string[];
319
+ prepend?: string | readonly string[];
320
+ remove?: string | readonly string[];
321
+ }
322
+ /** Single SSH algorithm override value accepted by connection profiles. */
323
+ type SshAlgorithmOverride = readonly string[] | SshAlgorithmMutations;
309
324
  /** SSH agent source accepted by SFTP providers. */
310
- type SshAgentSource = string | BaseAgent;
325
+ type SshAgentSource = string | SshAgentLike;
311
326
  /** SSH transport algorithm overrides accepted by SFTP providers. */
312
- type SshAlgorithms = Algorithms;
327
+ type SshAlgorithms = Record<string, SshAlgorithmOverride | undefined>;
313
328
  /** Context passed to SSH socket factories before opening an SSH session. */
314
329
  interface SshSocketFactoryContext {
315
330
  /** Target SSH host from the resolved connection profile. */
@@ -327,7 +342,7 @@ interface SshSocketFactoryContext {
327
342
  * Use this hook for HTTP CONNECT, SOCKS, bastion, or custom tunnel integrations.
328
343
  *
329
344
  * @param context - Resolved SSH target information for the socket being opened.
330
- * @returns Preconnected readable stream, or a promise for one, passed to ssh2's `sock` option.
345
+ * @returns Preconnected readable stream, or a promise for one, passed to the SSH adapter socket option.
331
346
  */
332
347
  type SshSocketFactory = (context: SshSocketFactoryContext) => Readable | Promise<Readable>;
333
348
  /** Prompt metadata supplied by an SSH keyboard-interactive server challenge. */
@@ -1629,6 +1644,65 @@ interface RunConnectionDiagnosticsOptions {
1629
1644
  */
1630
1645
  declare function runConnectionDiagnostics(options: RunConnectionDiagnosticsOptions): Promise<ConnectionDiagnosticsResult>;
1631
1646
 
1647
+ /** Options for {@link createPooledTransferClient}. */
1648
+ interface ConnectionPoolOptions {
1649
+ /**
1650
+ * Maximum number of *idle* sessions retained per pool key.
1651
+ *
1652
+ * Active leases are not counted against this limit — the cap only applies
1653
+ * to sessions waiting in the pool. When more than `maxIdlePerKey` sessions
1654
+ * become idle simultaneously, the oldest ones are disconnected. Defaults
1655
+ * to `4`.
1656
+ */
1657
+ maxIdlePerKey?: number;
1658
+ /**
1659
+ * How long an idle session may sit unused before it is automatically
1660
+ * disconnected. Defaults to `60_000` ms. Set to `0` to disable the timer
1661
+ * (idle sessions persist until `drainPool()` is called).
1662
+ */
1663
+ idleTimeoutMs?: number;
1664
+ /**
1665
+ * Custom pool key derivation. Receives the resolved
1666
+ * {@link ConnectionProfile} (after TransferClient validation) and must
1667
+ * return a string. Sessions with matching keys are pooled together; never
1668
+ * include secrets in the key.
1669
+ *
1670
+ * The default derives the key from `provider`, `host`, `port`, and
1671
+ * `username`.
1672
+ */
1673
+ keyOf?: (profile: ConnectionProfile) => string;
1674
+ }
1675
+ /**
1676
+ * Pool-aware {@link TransferClient} returned by
1677
+ * {@link createPooledTransferClient}.
1678
+ */
1679
+ interface PooledTransferClient {
1680
+ /** Opens (or leases) a pooled provider session. */
1681
+ connect(profile: ConnectionProfile): Promise<TransferSession>;
1682
+ /** Inspects the registered providers (delegated to the underlying client). */
1683
+ hasProvider(providerId: ProviderId): boolean;
1684
+ /** Returns the registered capability snapshots (delegated). */
1685
+ getCapabilities(): CapabilitySet[];
1686
+ /** Returns a specific capability snapshot (delegated). */
1687
+ getCapabilities(providerId: ProviderId): CapabilitySet;
1688
+ /**
1689
+ * Disconnects every idle session and prevents further pooling. After
1690
+ * `drainPool()` resolves, subsequent `connect()` calls still work but
1691
+ * always create fresh sessions (and never return them to the pool).
1692
+ */
1693
+ drainPool(): Promise<void>;
1694
+ /** Returns the number of idle sessions currently held in the pool. */
1695
+ poolSize(): number;
1696
+ }
1697
+ /**
1698
+ * Wraps a {@link TransferClient} with connection pooling.
1699
+ *
1700
+ * @param inner - Underlying client used to create real provider sessions.
1701
+ * @param options - Pool sizing, eviction, and key-derivation overrides.
1702
+ * @returns A {@link PooledTransferClient} that reuses idle sessions.
1703
+ */
1704
+ declare function createPooledTransferClient(inner: TransferClient, options?: ConnectionPoolOptions): PooledTransferClient;
1705
+
1632
1706
  /** Options used to create a local file-system provider factory. */
1633
1707
  interface LocalProviderOptions {
1634
1708
  /** Root directory exposed as `/`. When omitted, `profile.host` is treated as the root path. */
@@ -3152,70 +3226,550 @@ declare function joinRemotePath(...segments: string[]): string;
3152
3226
  */
3153
3227
  declare function basenameRemotePath(input: string): string;
3154
3228
 
3155
- /** Options used to create an SFTP provider factory. */
3156
- interface SftpProviderOptions {
3157
- /** Hash algorithm used before calling ssh2's host verifier, such as `sha256`. */
3158
- hostHash?: ConnectConfig["hostHash"];
3159
- /** Host-key verifier passed directly to ssh2 for advanced callers. */
3160
- hostVerifier?: ConnectConfig["hostVerifier"];
3161
- /** Default SSH handshake timeout in milliseconds when the profile does not provide `timeoutMs`. */
3162
- readyTimeoutMs?: number;
3229
+ /** Algorithm lists exchanged during SSH KEXINIT negotiation. */
3230
+ interface SshAlgorithmPreferences {
3231
+ compressionClientToServer: readonly string[];
3232
+ compressionServerToClient: readonly string[];
3233
+ encryptionClientToServer: readonly string[];
3234
+ encryptionServerToClient: readonly string[];
3235
+ kexAlgorithms: readonly string[];
3236
+ languagesClientToServer: readonly string[];
3237
+ languagesServerToClient: readonly string[];
3238
+ macClientToServer: readonly string[];
3239
+ macServerToClient: readonly string[];
3240
+ serverHostKeyAlgorithms: readonly string[];
3241
+ }
3242
+ /** Selected algorithms after intersecting client preferences with server capabilities. */
3243
+ interface NegotiatedSshAlgorithms {
3244
+ compressionClientToServer: string;
3245
+ compressionServerToClient: string;
3246
+ encryptionClientToServer: string;
3247
+ encryptionServerToClient: string;
3248
+ kexAlgorithm: string;
3249
+ languageClientToServer?: string;
3250
+ languageServerToClient?: string;
3251
+ macClientToServer: string;
3252
+ macServerToClient: string;
3253
+ serverHostKeyAlgorithm: string;
3254
+ }
3255
+
3256
+ /** Parsed SSH identification components from the RFC 4253 banner line. */
3257
+ interface SshIdentification {
3258
+ protocolVersion: string;
3259
+ softwareVersion: string;
3260
+ comments?: string;
3261
+ raw: string;
3163
3262
  }
3164
- /** Raw SFTP session handles exposed for advanced diagnostics. */
3165
- interface SftpRawSession {
3166
- /** Underlying ssh2 client connection. */
3167
- client: Client;
3168
- /** Underlying ssh2 SFTP wrapper. */
3169
- sftp: SFTPWrapper;
3263
+
3264
+ /** Parsed SSH_MSG_KEXINIT payload. */
3265
+ interface SshKexInitMessage extends SshAlgorithmPreferences {
3266
+ cookie: Buffer;
3267
+ firstKexPacketFollows: boolean;
3268
+ messageType: number;
3269
+ reserved: number;
3270
+ }
3271
+
3272
+ /** Directional key material used after SSH NEWKEYS. */
3273
+ interface SshTransportDirectionKeys {
3274
+ encryptionKey: Buffer;
3275
+ iv: Buffer;
3276
+ macKey: Buffer;
3277
+ }
3278
+ /** Session key bundle derived from K, H, and session id. */
3279
+ interface SshDerivedSessionKeys {
3280
+ clientToServer: SshTransportDirectionKeys;
3281
+ exchangeHash: Buffer;
3282
+ serverToClient: SshTransportDirectionKeys;
3283
+ sessionId: Buffer;
3284
+ }
3285
+
3286
+ /** Initial client-side handshake state before key exchange math starts. */
3287
+ interface SshTransportHandshakeResult {
3288
+ keyExchange: {
3289
+ algorithm: string;
3290
+ clientKexInitPayload: Buffer;
3291
+ clientPublicKey: Buffer;
3292
+ exchangeHash: Buffer;
3293
+ serverHostKey: Buffer;
3294
+ serverKexInitPayload: Buffer;
3295
+ serverPublicKey: Buffer;
3296
+ serverSignature: Buffer;
3297
+ sessionId: Buffer;
3298
+ sharedSecret: Buffer;
3299
+ transportKeys: {
3300
+ clientToServer: SshDerivedSessionKeys["clientToServer"];
3301
+ serverToClient: SshDerivedSessionKeys["serverToClient"];
3302
+ };
3303
+ };
3304
+ negotiatedAlgorithms: NegotiatedSshAlgorithms;
3305
+ serverIdentification: SshIdentification;
3306
+ serverKexInit: SshKexInitMessage;
3307
+ /**
3308
+ * Number of unencrypted packets the client sent during the handshake (KEXINIT,
3309
+ * KEX_ECDH_INIT, NEWKEYS). Per RFC 4253 §6.4, packet sequence numbers are never
3310
+ * reset across NEWKEYS, so this value seeds the outbound protector.
3311
+ */
3312
+ outboundPacketCount: number;
3313
+ /**
3314
+ * Number of unencrypted packets the client received from the server during the
3315
+ * handshake (server KEXINIT, KEX_ECDH_REPLY, NEWKEYS). Seeds the inbound unprotector.
3316
+ */
3317
+ inboundPacketCount: number;
3318
+ }
3319
+
3320
+ /** Standard SSH disconnect reason codes (RFC 4253 §11.1). */
3321
+ declare const SshDisconnectReason: {
3322
+ readonly HOST_NOT_ALLOWED_TO_CONNECT: 1;
3323
+ readonly PROTOCOL_ERROR: 2;
3324
+ readonly KEY_EXCHANGE_FAILED: 3;
3325
+ readonly MAC_ERROR: 5;
3326
+ readonly COMPRESSION_ERROR: 6;
3327
+ readonly SERVICE_NOT_AVAILABLE: 7;
3328
+ readonly PROTOCOL_VERSION_NOT_SUPPORTED: 8;
3329
+ readonly HOST_KEY_NOT_VERIFIABLE: 9;
3330
+ readonly CONNECTION_LOST: 10;
3331
+ readonly BY_APPLICATION: 11;
3332
+ readonly TOO_MANY_CONNECTIONS: 12;
3333
+ readonly AUTH_CANCELLED_BY_USER: 13;
3334
+ readonly NO_MORE_AUTH_METHODS: 14;
3335
+ readonly ILLEGAL_USER_NAME: 15;
3336
+ };
3337
+ type SshDisconnectReason = (typeof SshDisconnectReason)[keyof typeof SshDisconnectReason];
3338
+ interface SshTransportConnectionOptions {
3339
+ /** AbortSignal that cancels the in-flight `connect()` call and tears down the socket. */
3340
+ abortSignal?: AbortSignal;
3341
+ /** Algorithm preference overrides. Defaults to the library defaults. */
3342
+ algorithms?: SshAlgorithmPreferences;
3343
+ /** SSH software version string embedded in the identification line. */
3344
+ clientSoftwareVersion?: string;
3345
+ /**
3346
+ * Hard cap (milliseconds) on the SSH identification + key exchange + first
3347
+ * NEWKEYS handshake. If exceeded the socket is destroyed and `connect()`
3348
+ * rejects with a `TimeoutError`. Has no effect once `connect()` resolves.
3349
+ */
3350
+ handshakeTimeoutMs?: number;
3351
+ /**
3352
+ * If set, sends a `SSH_MSG_IGNORE` packet every `keepaliveIntervalMs`
3353
+ * milliseconds while the transport is connected and idle. This prevents
3354
+ * stateful NAT / firewall devices from dropping long-lived idle sessions
3355
+ * (e.g. between batches in a transfer queue). The timer is reset on every
3356
+ * outbound payload, so active transfers do not generate extra traffic.
3357
+ */
3358
+ keepaliveIntervalMs?: number;
3359
+ /**
3360
+ * Synchronous host-key policy hook invoked after the signature on the SSH
3361
+ * exchange hash is verified. Throw to reject the server's identity.
3362
+ */
3363
+ verifyHostKey?: (input: {
3364
+ hostKeyBlob: Buffer;
3365
+ hostKeySha256: Buffer;
3366
+ algorithmName: string;
3367
+ }) => void;
3170
3368
  }
3171
3369
  /**
3172
- * Creates an SFTP provider factory backed by the mature `ssh2` implementation.
3370
+ * Live SSH transport connection over a TCP socket.
3173
3371
  *
3174
- * @param options - Optional ssh2 host-key verifier and timeout defaults.
3175
- * @returns Provider factory suitable for `createTransferClient({ providers: [...] })`.
3372
+ * Runs the SSH identification exchange and key exchange handshake on the supplied socket,
3373
+ * then provides an encrypted packet send/receive interface for higher-level SSH layers
3374
+ * (authentication, connection, SFTP subsystem).
3176
3375
  *
3177
- * @example Register and use
3376
+ * Usage:
3178
3377
  * ```ts
3179
- * import { createSftpProviderFactory, createTransferClient } from "@zero-transfer/sdk";
3378
+ * const conn = new SshTransportConnection();
3379
+ * const result = await conn.connect(socket); // runs handshake
3380
+ * conn.sendPayload(payload); // post-NEWKEYS send
3381
+ * for await (const payload of conn.receivePayloads()) { ... }
3382
+ * conn.disconnect();
3383
+ * ```
3384
+ */
3385
+ declare class SshTransportConnection {
3386
+ private readonly options;
3387
+ private connected;
3388
+ private disposed;
3389
+ private protector;
3390
+ private unprotector;
3391
+ private socket;
3392
+ private keepaliveTimer;
3393
+ private readonly inboundQueue;
3394
+ /**
3395
+ * FIFO of waiters when the queue is empty. Multiple iterators may suspend on
3396
+ * the same transport (auth session, channel setup, connection-manager pump);
3397
+ * each receives exactly one entry in arrival order. A single-slot field would
3398
+ * lose wakeups when a second consumer suspends before the first is resolved.
3399
+ */
3400
+ private readonly waitingConsumers;
3401
+ constructor(options?: SshTransportConnectionOptions);
3402
+ /**
3403
+ * Runs the SSH handshake on a TCP-connected socket.
3404
+ * Resolves when NEWKEYS completes and the transport is ready for encrypted messages.
3405
+ * Rejects on socket error, abort, or protocol failure.
3406
+ */
3407
+ connect(socket: Socket): Promise<SshTransportHandshakeResult>;
3408
+ /**
3409
+ * Sends an SSH payload over the encrypted transport.
3410
+ * The payload must start with the SSH message type byte.
3411
+ */
3412
+ sendPayload(payload: Buffer | Uint8Array): void;
3413
+ /**
3414
+ * Async generator that yields inbound SSH payloads (post-NEWKEYS).
3415
+ *
3416
+ * Transparent handling:
3417
+ * - SSH_MSG_IGNORE (2) and SSH_MSG_DEBUG (4) are silently dropped.
3418
+ * - SSH_MSG_DISCONNECT (1) from the server throws a `ConnectionError`.
3419
+ * - Socket error or close terminates the generator.
3420
+ */
3421
+ receivePayloads(): AsyncGenerator<Buffer>;
3422
+ /**
3423
+ * Sends SSH_MSG_DISCONNECT and ends the socket.
3424
+ * Safe to call multiple times; subsequent calls are no-ops.
3425
+ */
3426
+ disconnect(reason?: SshDisconnectReason, description?: string): void;
3427
+ isConnected(): boolean;
3428
+ private onEncryptedData;
3429
+ private onSocketError;
3430
+ private onSocketClose;
3431
+ private enqueueEntry;
3432
+ private dequeuePayload;
3433
+ private assertConnected;
3434
+ private startKeepalive;
3435
+ private stopKeepalive;
3436
+ private resetKeepaliveTimer;
3437
+ private sendKeepalivePing;
3438
+ }
3439
+
3440
+ /**
3441
+ * SSH session channel (RFC 4254 §6).
3180
3442
  *
3181
- * const client = createTransferClient({ providers: [createSftpProviderFactory()] });
3443
+ * Manages a single "session" channel from the client side:
3444
+ * CHANNEL_OPEN → OPEN_CONFIRMATION → CHANNEL_REQUEST (subsystem/exec) →
3445
+ * bidirectional CHANNEL_DATA with window management → CHANNEL_EOF/CLOSE.
3182
3446
  *
3447
+ * Window management strategy:
3448
+ * - Local window starts at INITIAL_WINDOW_SIZE.
3449
+ * - When consumed bytes exceed WINDOW_REFILL_THRESHOLD, a WINDOW_ADJUST is sent.
3450
+ * - Outbound data respects the remote window; excess is queued and flushed
3451
+ * as the remote issues WINDOW_ADJUST messages.
3452
+ */
3453
+
3454
+ interface SshSessionChannelOptions {
3455
+ /**
3456
+ * Local channel id allocated by the caller.
3457
+ * If omitted, defaults to 0 (single-channel use case).
3458
+ */
3459
+ localChannelId?: number;
3460
+ }
3461
+ /**
3462
+ * A single SSH session channel.
3463
+ * Not safe to share across concurrent callers; each SftpSession should own one.
3464
+ */
3465
+ declare class SshSessionChannel {
3466
+ private readonly transport;
3467
+ private phase;
3468
+ /** Remote channel id assigned by the server in OPEN_CONFIRMATION. */
3469
+ private remoteChannelId;
3470
+ /** Bytes the remote side can still receive before we must stop sending. */
3471
+ private remoteWindowRemaining;
3472
+ /** Maximum packet data size the remote accepts. */
3473
+ private remoteMaxPacketSize;
3474
+ /** Local window: bytes we can still accept from remote. */
3475
+ private localWindowConsumed;
3476
+ private localWindowSize;
3477
+ /** Queue of inbound data for the `receiveData()` generator. */
3478
+ private readonly inboundQueue;
3479
+ private waitingConsumer;
3480
+ /** Queue of outbound data waiting for remote window space. */
3481
+ private readonly outboundQueue;
3482
+ /**
3483
+ * FIFO of waiters blocked on remote window credit. Each WINDOW_ADJUST wakes
3484
+ * exactly one waiter; concurrent senders must not lose wakeups.
3485
+ */
3486
+ private readonly outboundDrainedWaiters;
3487
+ /** Serializes sendData() calls so byte order on the wire matches call order. */
3488
+ private sendChain;
3489
+ private readonly localChannelId;
3490
+ constructor(transport: SshTransportConnection, options?: SshSessionChannelOptions);
3491
+ /**
3492
+ * Opens the channel and requests a subsystem.
3493
+ * Resolves once the server confirms both CHANNEL_OPEN and the subsystem request.
3494
+ */
3495
+ openSubsystem(subsystemName: string): Promise<void>;
3496
+ /**
3497
+ * Opens the channel and executes a command.
3498
+ */
3499
+ openExec(command: string): Promise<void>;
3500
+ private openChannel;
3501
+ private requestSubsystem;
3502
+ private requestExec;
3503
+ private awaitChannelRequestReply;
3504
+ /**
3505
+ * Sends data on the channel. Respects the remote window; if there is no space,
3506
+ * splits the data and queues the remainder for when WINDOW_ADJUST arrives.
3507
+ *
3508
+ * Concurrent calls are serialized so wire byte order matches call order.
3509
+ */
3510
+ sendData(data: Uint8Array): Promise<void>;
3511
+ private sendDataLocked;
3512
+ /**
3513
+ * Async generator that yields raw data buffers from the channel.
3514
+ * Returns (done) when the channel receives EOF or CLOSE.
3515
+ */
3516
+ receiveData(): AsyncGenerator<Buffer, void, undefined>;
3517
+ /**
3518
+ * Sends EOF and CLOSE. Should be called when the client is done sending.
3519
+ */
3520
+ close(): void;
3521
+ /**
3522
+ * Feed an inbound transport payload to this channel.
3523
+ * Called by the channel multiplexer (`SshConnectionManager`).
3524
+ */
3525
+ dispatch(payload: Buffer): void;
3526
+ dispatchError(error: Error): void;
3527
+ private consumeLocalWindow;
3528
+ private enqueueInbound;
3529
+ private dequeueInbound;
3530
+ /** Pull the next payload from the transport (used during channel setup only). */
3531
+ private nextPayload;
3532
+ }
3533
+
3534
+ /**
3535
+ * SFTP v3 file attribute encoding and decoding (draft-ietf-secsh-filexfer-02 §5).
3536
+ *
3537
+ * ATTRS flags:
3538
+ * SSH_FILEXFER_ATTR_SIZE 0x00000001
3539
+ * SSH_FILEXFER_ATTR_UIDGID 0x00000002
3540
+ * SSH_FILEXFER_ATTR_PERMISSIONS 0x00000004
3541
+ * SSH_FILEXFER_ATTR_ACMODTIME 0x00000008
3542
+ * SSH_FILEXFER_ATTR_EXTENDED 0x80000000
3543
+ */
3544
+
3545
+ interface SftpFileAttributes {
3546
+ /** File size in bytes. Present when SFTP_ATTR_FLAG.SIZE is set. */
3547
+ size?: bigint;
3548
+ /** User id. Present when SFTP_ATTR_FLAG.UIDGID is set. */
3549
+ uid?: number;
3550
+ /** Group id. Present when SFTP_ATTR_FLAG.UIDGID is set. */
3551
+ gid?: number;
3552
+ /** POSIX file permissions (octal mode). Present when SFTP_ATTR_FLAG.PERMISSIONS is set. */
3553
+ permissions?: number;
3554
+ /** Access time (seconds since Unix epoch). Present when SFTP_ATTR_FLAG.ACMODTIME is set. */
3555
+ atime?: number;
3556
+ /** Modification time (seconds since Unix epoch). Present when SFTP_ATTR_FLAG.ACMODTIME is set. */
3557
+ mtime?: number;
3558
+ /**
3559
+ * Extended attributes as key-value pairs.
3560
+ * Present when SFTP_ATTR_FLAG.EXTENDED is set.
3561
+ */
3562
+ extended?: Array<{
3563
+ type: string;
3564
+ data: Buffer;
3565
+ }>;
3566
+ }
3567
+
3568
+ /**
3569
+ * SFTP v3 request and response message codecs (draft-ietf-secsh-filexfer-02).
3570
+ *
3571
+ * Each encode function produces the payload bytes that go inside an
3572
+ * SSH_FXP_* packet (the type byte and length prefix are added by the framer).
3573
+ *
3574
+ * Each decode function accepts the full framed packet payload (starting at the
3575
+ * byte immediately after the type byte, i.e. at request-id).
3576
+ */
3577
+
3578
+ interface SftpVersionResponse {
3579
+ version: number;
3580
+ extensions: Array<{
3581
+ name: string;
3582
+ data: string;
3583
+ }>;
3584
+ }
3585
+ /** A single entry returned by SSH_FXP_NAME. */
3586
+ interface SftpNameEntry {
3587
+ filename: string;
3588
+ longname: string;
3589
+ attrs: SftpFileAttributes;
3590
+ }
3591
+
3592
+ /**
3593
+ * SFTP v3 client session (draft-ietf-secsh-filexfer-02).
3594
+ *
3595
+ * Provides a fully concurrent, typed API over an open SSH session channel.
3596
+ * Multiple requests can be in flight simultaneously; each is tracked by its
3597
+ * SFTP request id. Responses are dispatched to the correct awaiter.
3598
+ *
3599
+ * Lifecycle:
3600
+ * const channel = await connectionManager.openSubsystemChannel("sftp");
3601
+ * const sftp = new SftpSession(channel);
3602
+ * await sftp.init();
3603
+ * const handle = await sftp.open("/path/to/file", SFTP_OPEN_FLAG.READ, {});
3604
+ * const data = await sftp.read(handle, 0n, 4096);
3605
+ * await sftp.close(handle);
3606
+ */
3607
+
3608
+ declare class SftpSession {
3609
+ private readonly channel;
3610
+ private nextRequestId;
3611
+ private readonly pending;
3612
+ private readonly framer;
3613
+ /** Resolves on the first packet (VERSION) during init(). */
3614
+ private versionWaiter;
3615
+ private serverVersion;
3616
+ constructor(channel: SshSessionChannel);
3617
+ /**
3618
+ * Sends SSH_FXP_INIT and awaits SSH_FXP_VERSION.
3619
+ * Must be called once before any other operation.
3620
+ */
3621
+ init(): Promise<SftpVersionResponse>;
3622
+ get negotiatedVersion(): number;
3623
+ /**
3624
+ * Opens a remote file. Returns an opaque handle buffer.
3625
+ */
3626
+ open(path: string, pflags: number, attrs?: SftpFileAttributes): Promise<Buffer>;
3627
+ /**
3628
+ * Closes a file or directory handle.
3629
+ */
3630
+ close(handle: Uint8Array): Promise<void>;
3631
+ /**
3632
+ * Reads up to `length` bytes from `handle` at `offset`.
3633
+ * Returns `null` on EOF.
3634
+ */
3635
+ read(handle: Uint8Array, offset: bigint, length: number): Promise<Buffer | null>;
3636
+ /**
3637
+ * Writes `data` to `handle` at `offset`.
3638
+ */
3639
+ write(handle: Uint8Array, offset: bigint, data: Uint8Array): Promise<void>;
3640
+ stat(path: string): Promise<SftpFileAttributes>;
3641
+ lstat(path: string): Promise<SftpFileAttributes>;
3642
+ fstat(handle: Uint8Array): Promise<SftpFileAttributes>;
3643
+ setstat(path: string, attrs: SftpFileAttributes): Promise<void>;
3644
+ fsetstat(handle: Uint8Array, attrs: SftpFileAttributes): Promise<void>;
3645
+ opendir(path: string): Promise<Buffer>;
3646
+ /**
3647
+ * Reads one batch of directory entries.
3648
+ * Returns an empty array when the server sends SSH_FX_EOF.
3649
+ */
3650
+ readdir(handle: Uint8Array): Promise<SftpNameEntry[]>;
3651
+ /**
3652
+ * Convenience: opens a directory, reads all entries, and closes the handle.
3653
+ */
3654
+ readdirAll(path: string): Promise<SftpNameEntry[]>;
3655
+ remove(path: string): Promise<void>;
3656
+ mkdir(path: string, attrs?: SftpFileAttributes): Promise<void>;
3657
+ rmdir(path: string): Promise<void>;
3658
+ realpath(path: string): Promise<string>;
3659
+ rename(oldPath: string, newPath: string): Promise<void>;
3660
+ readlink(path: string): Promise<string>;
3661
+ symlink(linkPath: string, targetPath: string): Promise<void>;
3662
+ private allocRequestId;
3663
+ /**
3664
+ * Sends raw SFTP message bytes over the channel.
3665
+ * The message encoders embed the type byte at position 0, followed by the body.
3666
+ * We prefix with a uint32 length so the remote SFTP framer can parse the frame.
3667
+ *
3668
+ * Send is asynchronous because the underlying SSH channel may apply
3669
+ * backpressure when the remote window is exhausted; the channel itself
3670
+ * serializes concurrent calls so byte ordering is preserved.
3671
+ */
3672
+ private sendRaw;
3673
+ private pump;
3674
+ private dispatchPacket;
3675
+ private awaitResponse;
3676
+ }
3677
+
3678
+ /**
3679
+ * Options for {@link createNativeSftpProviderFactory}.
3680
+ *
3681
+ * The native provider is a zero-dependency replacement for the legacy
3682
+ * `ssh2`-backed provider. It implements RFC 4253 SSH transport, RFC 4252 user
3683
+ * authentication (`password`, `keyboard-interactive`, `publickey` with
3684
+ * Ed25519/RSA), RFC 5656 ECDSA host keys (`nistp256/384/521`), and the
3685
+ * SFTP v3 client protocol multiplexed over a single channel.
3686
+ */
3687
+ interface NativeSftpProviderOptions {
3688
+ /**
3689
+ * Default connection timeout in milliseconds when the profile omits
3690
+ * `timeoutMs`. Bounds both the TCP connect *and* the SSH identification +
3691
+ * key-exchange handshake, so a hung server cannot stall `connect()`
3692
+ * indefinitely after the socket is accepted.
3693
+ */
3694
+ readyTimeoutMs?: number;
3695
+ /**
3696
+ * Default interval (milliseconds) between SSH-level keepalive pings sent
3697
+ * once the transport is connected and idle. Prevents stateful firewalls /
3698
+ * NAT devices from dropping long-lived sessions. The timer is reset on
3699
+ * every outbound payload so active transfers do not generate extra
3700
+ * traffic. Disabled when omitted or `0`.
3701
+ */
3702
+ keepaliveIntervalMs?: number;
3703
+ /**
3704
+ * Maximum concurrent file-transfer operations the engine should schedule
3705
+ * against a single SFTP session. Each in-flight read/write occupies an
3706
+ * outstanding SFTP request slot multiplexed over the same SSH channel; the
3707
+ * default of `8` keeps memory bounded on commodity servers, but high-RTT
3708
+ * links and modern OpenSSH builds can comfortably handle 16\u201364. Must be
3709
+ * a positive integer.
3710
+ */
3711
+ maxConcurrency?: number;
3712
+ }
3713
+ /**
3714
+ * Low-level handles exposed by a native SFTP session for diagnostics and
3715
+ * advanced extension. Most applications should use the
3716
+ * {@link TransferSession} returned from `client.connect()` instead.
3717
+ */
3718
+ interface NativeSftpRawSession {
3719
+ /** SFTP v3 client multiplexed over the SSH session channel. */
3720
+ sftp: SftpSession;
3721
+ /** Underlying SSH transport (key exchange, packet protection, channel mux). */
3722
+ transport: SshTransportConnection;
3723
+ }
3724
+ /**
3725
+ * Creates a {@link ProviderFactory} backed by the native SSH/SFTP protocol
3726
+ * stack — no `ssh2` dependency required.
3727
+ *
3728
+ * **Supported algorithms**
3729
+ * - Key exchange: `curve25519-sha256`, `curve25519-sha256@libssh.org`
3730
+ * - Host keys: `ssh-ed25519`, `ecdsa-sha2-nistp256/384/521`, `rsa-sha2-256`,
3731
+ * `rsa-sha2-512` (legacy SHA-1 `ssh-rsa` is rejected)
3732
+ * - Ciphers: `aes128-ctr`, `aes256-ctr`
3733
+ * - MACs: `hmac-sha2-256`, `hmac-sha2-512`
3734
+ *
3735
+ * **Authentication**
3736
+ * - `password`
3737
+ * - `keyboard-interactive` (RFC 4256)
3738
+ * - `publickey` for Ed25519 and RSA private keys (`rsa-sha2-512` preferred,
3739
+ * `rsa-sha2-256` fallback). Encrypted keys are unlocked via
3740
+ * `profile.ssh.passphrase`.
3741
+ *
3742
+ * **Host-key verification**
3743
+ * - The server's signature over the exchange hash is always verified.
3744
+ * - Optional pinning via `profile.ssh.pinnedHostKeySha256` (`SHA256:...`,
3745
+ * raw base64, or hex).
3746
+ * - Optional `profile.ssh.knownHosts` (OpenSSH format, hashed and plain
3747
+ * patterns, `[host]:port`, negation, and `@revoked` markers).
3748
+ *
3749
+ * **Resilience**
3750
+ * - `readyTimeoutMs` bounds TCP connect + SSH handshake.
3751
+ * - `keepaliveIntervalMs` keeps idle sessions alive through stateful
3752
+ * firewalls / NAT.
3753
+ *
3754
+ * @example
3755
+ * ```ts
3756
+ * const client = createTransferClient({
3757
+ * providers: [createNativeSftpProviderFactory({
3758
+ * readyTimeoutMs: 10_000,
3759
+ * keepaliveIntervalMs: 30_000,
3760
+ * })],
3761
+ * });
3183
3762
  * const session = await client.connect({
3184
- * host: "sftp.example.com",
3185
3763
  * provider: "sftp",
3764
+ * host: "sftp.example.com",
3186
3765
  * username: "deploy",
3187
3766
  * ssh: {
3188
- * privateKey: { path: "./keys/id_ed25519" },
3189
- * // Optional but recommended for production:
3190
- * pinnedHostKeySha256: "SHA256:abc123basesixfourpinFromKnownHosts=",
3767
+ * privateKey: { kind: "literal", value: process.env.DEPLOY_KEY! },
3768
+ * pinnedHostKeySha256: "SHA256:abc...",
3191
3769
  * },
3192
3770
  * });
3193
3771
  * ```
3194
- *
3195
- * Host-key verification (`ssh.knownHosts` and/or `ssh.pinnedHostKeySha256`) is
3196
- * optional; without either, the client trusts whatever host key the server
3197
- * presents. Use one for any non-lab deployment.
3198
- */
3199
- declare function createSftpProviderFactory(options?: SftpProviderOptions): ProviderFactory;
3200
-
3201
- /** Options for {@link createSftpJumpHostSocketFactory}. */
3202
- interface SftpJumpHostOptions {
3203
- /** Static ssh2 connect configuration for the bastion. Mutually exclusive with {@link buildBastion}. */
3204
- bastion?: ConnectConfig;
3205
- /** Per-connection builder used to refresh credentials before each tunnel attempt. */
3206
- buildBastion?: (context: SshSocketFactoryContext) => ConnectConfig | Promise<ConnectConfig>;
3207
- /** Optional logger used for tunnel diagnostics. */
3208
- logger?: ZeroTransferLogger;
3209
- /** Optional ssh2 client factory override used in tests. */
3210
- createClient?: () => Client;
3211
- }
3212
- /**
3213
- * Builds an {@link SshSocketFactory} that tunnels SFTP connections through a bastion host.
3214
- *
3215
- * @param options - Bastion configuration and overrides.
3216
- * @returns Factory that returns a forwarded ssh2 channel stream when invoked.
3217
- * @throws {@link ConfigurationError} When neither {@link SftpJumpHostOptions.bastion} nor {@link SftpJumpHostOptions.buildBastion} is supplied.
3218
3772
  */
3219
- declare function createSftpJumpHostSocketFactory(options: SftpJumpHostOptions): SshSocketFactory;
3773
+ declare function createNativeSftpProviderFactory(options?: NativeSftpProviderOptions): ProviderFactory;
3220
3774
 
3221
- export { AbortError, type AtomicDeployActivateOperation, type AtomicDeployActivateStep, type AtomicDeployPlan, type AtomicDeployPruneStep, type AtomicDeployStrategy, type AuthenticationCapability, AuthenticationError, AuthorizationError, type BandwidthSleep, type BandwidthThrottle, type BandwidthThrottleOptions, type Base64EnvSecretSource, type BuiltInProviderId, CLASSIC_PROVIDER_IDS, type CapabilitySet, type ChecksumCapability, type ClassicProviderId, type ClientDiagnostics, type CompareRemoteManifestsOptions, ConfigurationError, type ConnectionDiagnosticTimings, type ConnectionDiagnosticsResult, ConnectionError, type ConnectionProfile, type CopyBetweenOptions, type CreateAtomicDeployPlanOptions, type CreateRemoteBrowserOptions, type CreateRemoteManifestOptions, type CreateSyncPlanOptions, type DiffRemoteTreesOptions, type DownloadFileOptions, type EnvSecretSource, type FileSecretSource, type FileZillaSite, type FriendlyTransferOptions, type FtpReplyErrorInput, type ImportFileZillaSitesResult, type ImportOpenSshConfigOptions, type ImportOpenSshConfigResult, type ImportWinScpSessionsResult, type KnownHostsEntry, type KnownHostsMarker, type ListOptions, type LocalProviderOptions, type LogLevel, type LogRecord, type LogRecordInput, type LoggerMethod, type MemoryProviderEntry, type MemoryProviderOptions, type MetadataCapability, type MkdirOptions, type OAuthAccessToken, type OAuthRefreshCallback, type OAuthTokenSecretSourceOptions, type OpenSshConfigEntry, ParseError, PathAlreadyExistsError, PathNotFoundError, PermissionDeniedError, type ProgressEventInput, ProtocolError, type AuthenticationCapability as ProviderAuthenticationCapability, type CapabilitySet as ProviderCapabilities, type ChecksumCapability as ProviderChecksumCapability, type ProviderFactory, type ProviderId, type MetadataCapability as ProviderMetadataCapability, ProviderRegistry, type ProviderSelection, type ProviderTransferEndpointRole, type ProviderTransferExecutorOptions, type ProviderTransferOperations, type ProviderTransferReadRequest, type ProviderTransferReadResult, type ProviderTransferRequest, type ProviderTransferSessionResolver, type ProviderTransferSessionResolverInput, type ProviderTransferWriteRequest, type ProviderTransferWriteResult, REDACTED, REMOTE_MANIFEST_FORMAT_VERSION, type RemoteBreadcrumb, type RemoteBrowser, type RemoteBrowserFilter, type RemoteBrowserSnapshot, type RemoteEntry, type RemoteEntrySortKey, type RemoteEntrySortOrder, type RemoteEntryType, type RemoteFileAdapter, type RemoteFileEndpoint, type RemoteFileSystem, type RemoteManifest, type RemoteManifestEntry, type RemotePermissions, type RemoteProtocol, type RemoteStat, type RemoteTreeDiff, type RemoteTreeDiffEntry, type RemoteTreeDiffReason, type RemoteTreeDiffStatus, type RemoteTreeDiffSummary, type RemoteTreeEntry, type RemoteTreeFilter, type RemoveOptions, type RenameOptions, type ResolveSecretOptions, type ResolvedConnectionProfile, type ResolvedOpenSshHost, type ResolvedSshProfile, type ResolvedTlsProfile, type RmdirOptions, type RunConnectionDiagnosticsOptions, type SecretProvider, type SecretSource, type SecretValue, type SftpJumpHostOptions, type SftpProviderOptions, type SftpRawSession, type SpecializedErrorDetails, type SshAgentSource, type SshAlgorithms, type SshKeyboardInteractiveChallenge, type SshKeyboardInteractiveHandler, type SshKeyboardInteractivePrompt, type SshKnownHostsSource, type SshProfile, type SshSocketFactory, type SshSocketFactoryContext, type StatOptions, type SyncConflictPolicy, type SyncDeletePolicy, type SyncDirection, type SyncEndpointInput, TimeoutError, type TlsProfile, type TlsSecretSource, type TransferAttempt, type TransferAttemptError, type TransferBandwidthLimit, type TransferByteRange, TransferClient, type TransferClientOptions, type TransferDataChunk, type TransferDataSource, type TransferEndpoint, TransferEngine, type TransferEngineExecuteOptions, type TransferEngineOptions, TransferError, type TransferExecutionContext, type TransferExecutionResult, type TransferExecutor, type TransferJob, type TransferOperation, type TransferPlan, type TransferPlanAction, type TransferPlanInput, type TransferPlanStep, type TransferPlanSummary, type TransferProgressEvent, type TransferProvider, TransferQueue, type TransferQueueExecutorResolver, type TransferQueueItem, type TransferQueueItemStatus, type TransferQueueOptions, type TransferQueueRunOptions, type TransferQueueSummary, type TransferReceipt, type TransferResult, type TransferResultInput, type TransferRetryDecisionInput, type TransferRetryPolicy, type TransferSession, type TransferTimeoutPolicy, type TransferVerificationResult, UnsupportedFeatureError, type UploadFileOptions, type ValueSecretSource, VerificationError, type WalkRemoteTreeOptions, type WinScpSession, ZeroTransfer, type ZeroTransferCapabilities, ZeroTransferError, type ZeroTransferErrorDetails, type ZeroTransferLogger, type ZeroTransferOptions, assertSafeFtpArgument, basenameRemotePath, buildRemoteBreadcrumbs, compareRemoteManifests, copyBetween, createAtomicDeployPlan, createBandwidthThrottle, createLocalProviderFactory, createMemoryProviderFactory, createOAuthTokenSecretSource, createProgressEvent, createProviderTransferExecutor, createRemoteBrowser, createRemoteManifest, createSftpJumpHostSocketFactory, createSftpProviderFactory, createSyncPlan, createTransferClient, createTransferJobsFromPlan, createTransferPlan, createTransferResult, diffRemoteTrees, downloadFile, emitLog, errorFromFtpReply, filterRemoteEntries, importFileZillaSites, importOpenSshConfig, importWinScpSessions, isClassicProviderId, isSensitiveKey, joinRemotePath, matchKnownHosts, matchKnownHostsEntry, noopLogger, normalizeRemotePath, parentRemotePath, parseKnownHosts, parseOpenSshConfig, parseRemoteManifest, redactCommand, redactConnectionProfile, redactObject, redactSecretSource, redactValue, resolveConnectionProfileSecrets, resolveOpenSshHost, resolveProviderId, resolveSecret, runConnectionDiagnostics, serializeRemoteManifest, sortRemoteEntries, summarizeClientDiagnostics, summarizeTransferPlan, throttleByteIterable, uploadFile, validateConnectionProfile, walkRemoteTree };
3775
+ export { AbortError, type AtomicDeployActivateOperation, type AtomicDeployActivateStep, type AtomicDeployPlan, type AtomicDeployPruneStep, type AtomicDeployStrategy, type AuthenticationCapability, AuthenticationError, AuthorizationError, type BandwidthSleep, type BandwidthThrottle, type BandwidthThrottleOptions, type Base64EnvSecretSource, type BuiltInProviderId, CLASSIC_PROVIDER_IDS, type CapabilitySet, type ChecksumCapability, type ClassicProviderId, type ClientDiagnostics, type CompareRemoteManifestsOptions, ConfigurationError, type ConnectionDiagnosticTimings, type ConnectionDiagnosticsResult, ConnectionError, type ConnectionPoolOptions, type ConnectionProfile, type CopyBetweenOptions, type CreateAtomicDeployPlanOptions, type CreateRemoteBrowserOptions, type CreateRemoteManifestOptions, type CreateSyncPlanOptions, type DiffRemoteTreesOptions, type DownloadFileOptions, type EnvSecretSource, type FileSecretSource, type FileZillaSite, type FriendlyTransferOptions, type FtpReplyErrorInput, type ImportFileZillaSitesResult, type ImportOpenSshConfigOptions, type ImportOpenSshConfigResult, type ImportWinScpSessionsResult, type KnownHostsEntry, type KnownHostsMarker, type ListOptions, type LocalProviderOptions, type LogLevel, type LogRecord, type LogRecordInput, type LoggerMethod, type MemoryProviderEntry, type MemoryProviderOptions, type MetadataCapability, type MkdirOptions, type NativeSftpProviderOptions, type NativeSftpRawSession, type OAuthAccessToken, type OAuthRefreshCallback, type OAuthTokenSecretSourceOptions, type OpenSshConfigEntry, ParseError, PathAlreadyExistsError, PathNotFoundError, PermissionDeniedError, type PooledTransferClient, type ProgressEventInput, ProtocolError, type AuthenticationCapability as ProviderAuthenticationCapability, type CapabilitySet as ProviderCapabilities, type ChecksumCapability as ProviderChecksumCapability, type ProviderFactory, type ProviderId, type MetadataCapability as ProviderMetadataCapability, ProviderRegistry, type ProviderSelection, type ProviderTransferEndpointRole, type ProviderTransferExecutorOptions, type ProviderTransferOperations, type ProviderTransferReadRequest, type ProviderTransferReadResult, type ProviderTransferRequest, type ProviderTransferSessionResolver, type ProviderTransferSessionResolverInput, type ProviderTransferWriteRequest, type ProviderTransferWriteResult, REDACTED, REMOTE_MANIFEST_FORMAT_VERSION, type RemoteBreadcrumb, type RemoteBrowser, type RemoteBrowserFilter, type RemoteBrowserSnapshot, type RemoteEntry, type RemoteEntrySortKey, type RemoteEntrySortOrder, type RemoteEntryType, type RemoteFileAdapter, type RemoteFileEndpoint, type RemoteFileSystem, type RemoteManifest, type RemoteManifestEntry, type RemotePermissions, type RemoteProtocol, type RemoteStat, type RemoteTreeDiff, type RemoteTreeDiffEntry, type RemoteTreeDiffReason, type RemoteTreeDiffStatus, type RemoteTreeDiffSummary, type RemoteTreeEntry, type RemoteTreeFilter, type RemoveOptions, type RenameOptions, type ResolveSecretOptions, type ResolvedConnectionProfile, type ResolvedOpenSshHost, type ResolvedSshProfile, type ResolvedTlsProfile, type RmdirOptions, type RunConnectionDiagnosticsOptions, type SecretProvider, type SecretSource, type SecretValue, type NativeSftpProviderOptions as SftpProviderOptions, type NativeSftpRawSession as SftpRawSession, type SpecializedErrorDetails, type SshAgentSource, type SshAlgorithms, type SshKeyboardInteractiveChallenge, type SshKeyboardInteractiveHandler, type SshKeyboardInteractivePrompt, type SshKnownHostsSource, type SshProfile, type SshSocketFactory, type SshSocketFactoryContext, type StatOptions, type SyncConflictPolicy, type SyncDeletePolicy, type SyncDirection, type SyncEndpointInput, TimeoutError, type TlsProfile, type TlsSecretSource, type TransferAttempt, type TransferAttemptError, type TransferBandwidthLimit, type TransferByteRange, TransferClient, type TransferClientOptions, type TransferDataChunk, type TransferDataSource, type TransferEndpoint, TransferEngine, type TransferEngineExecuteOptions, type TransferEngineOptions, TransferError, type TransferExecutionContext, type TransferExecutionResult, type TransferExecutor, type TransferJob, type TransferOperation, type TransferPlan, type TransferPlanAction, type TransferPlanInput, type TransferPlanStep, type TransferPlanSummary, type TransferProgressEvent, type TransferProvider, TransferQueue, type TransferQueueExecutorResolver, type TransferQueueItem, type TransferQueueItemStatus, type TransferQueueOptions, type TransferQueueRunOptions, type TransferQueueSummary, type TransferReceipt, type TransferResult, type TransferResultInput, type TransferRetryDecisionInput, type TransferRetryPolicy, type TransferSession, type TransferTimeoutPolicy, type TransferVerificationResult, UnsupportedFeatureError, type UploadFileOptions, type ValueSecretSource, VerificationError, type WalkRemoteTreeOptions, type WinScpSession, ZeroTransfer, type ZeroTransferCapabilities, ZeroTransferError, type ZeroTransferErrorDetails, type ZeroTransferLogger, type ZeroTransferOptions, assertSafeFtpArgument, basenameRemotePath, buildRemoteBreadcrumbs, compareRemoteManifests, copyBetween, createAtomicDeployPlan, createBandwidthThrottle, createLocalProviderFactory, createMemoryProviderFactory, createNativeSftpProviderFactory, createOAuthTokenSecretSource, createPooledTransferClient, createProgressEvent, createProviderTransferExecutor, createRemoteBrowser, createRemoteManifest, createNativeSftpProviderFactory as createSftpProviderFactory, createSyncPlan, createTransferClient, createTransferJobsFromPlan, createTransferPlan, createTransferResult, diffRemoteTrees, downloadFile, emitLog, errorFromFtpReply, filterRemoteEntries, importFileZillaSites, importOpenSshConfig, importWinScpSessions, isClassicProviderId, isSensitiveKey, joinRemotePath, matchKnownHosts, matchKnownHostsEntry, noopLogger, normalizeRemotePath, parentRemotePath, parseKnownHosts, parseOpenSshConfig, parseRemoteManifest, redactCommand, redactConnectionProfile, redactObject, redactSecretSource, redactValue, resolveConnectionProfileSecrets, resolveOpenSshHost, resolveProviderId, resolveSecret, runConnectionDiagnostics, serializeRemoteManifest, sortRemoteEntries, summarizeClientDiagnostics, summarizeTransferPlan, throttleByteIterable, uploadFile, validateConnectionProfile, walkRemoteTree };