import { runSshCommand, summarizeSshCommand, } from "./sshRemoteExecutor.js";
export async function checkSshHealth(profile, policy) {
    const output = await runSshCommand(profile, "printf deepseekcode-ssh-ok", {
        ...policy,
        timeoutMs: Math.min(policy.timeoutMs ?? 10_000, 30_000),
        maxOutputChars: Math.min(policy.maxOutputChars ?? 4_000, 8_000),
    });
    const ok = output.exitCode === 0 && !output.timedOut;
    return {
        status: ok ? "ok" : "failed",
        profileName: profile.name,
        target: output.target,
        message: summarizeSshCommand(output),
        output,
    };
}
