import type { PublicReleaseRingId } from '@happier-dev/release-runtime/releaseRings';
import type { RelayRuntimeStatusSnapshot, RelayRuntimeTaskParams, SystemTaskSshConnectionConfig } from '../systemTasks/kinds/relayRuntimeKinds.js';
export type RelayHostRemoteCommandResult = Readonly<{
    status: number;
    stdout: string;
    stderr: string;
}>;
type RemoteReleaseTarget = Readonly<{
    os: 'linux' | 'darwin';
    arch: 'x64' | 'arm64';
}>;
type RemoteDeps = Readonly<{
    resolveRemoteReleaseTarget: (params: Readonly<{
        ssh: SystemTaskSshConnectionConfig;
        knownHostsMode?: 'app' | 'system';
    }>) => Promise<RemoteReleaseTarget>;
    runRemoteText: (params: Readonly<{
        ssh: SystemTaskSshConnectionConfig;
        remoteCommand: string;
        knownHostsMode?: 'app' | 'system';
    }>) => Promise<RelayHostRemoteCommandResult>;
    copyLocalDirectoryToRemote: (params: Readonly<{
        ssh: SystemTaskSshConnectionConfig;
        localPath: string;
        remotePath: string;
        knownHostsMode?: 'app' | 'system';
    }>) => Promise<void>;
}>;
type RemoteInstaller = (params: Readonly<{
    componentId: 'happier-cli' | 'happier-server';
    channel?: string;
    ssh: SystemTaskSshConnectionConfig;
    knownHostsMode?: 'app' | 'system';
    installerBinaryPath?: string;
    remoteHomeDir?: string;
}>) => Promise<Readonly<{
    binaryPath: string;
    versionId: string;
}>>;
export type RelayHostEngineDeps = Readonly<{
    installRemoteComponent: RemoteInstaller;
    localInstallPolicy?: Readonly<{
        runServiceCommands?: boolean;
        skipHealthCheck?: boolean;
    }>;
    resolveLocalInstallVersion?: (params: Readonly<{
        channel: PublicReleaseRingId;
        mode: 'user' | 'system';
        serverBinaryPath: string;
    }>) => Promise<string | null>;
    now?: () => number;
} & RemoteDeps>;
export type RelayHostEngine = Readonly<{
    readStatus: (params: RelayRuntimeTaskParams) => Promise<RelayRuntimeStatusSnapshot>;
    installOrUpdate: (params: RelayRuntimeTaskParams) => Promise<Readonly<{
        relayUrl: string;
        mode: 'user' | 'system';
    }>>;
    control: (params: RelayRuntimeTaskParams & Readonly<{
        action: 'start' | 'stop' | 'restart';
    }>) => Promise<void>;
}>;
export declare function createRelayHostEngine(deps: RelayHostEngineDeps): RelayHostEngine;
export {};
//# sourceMappingURL=relayHostEngine.d.ts.map