import { hostname, platform, release, userInfo } from "node:os";
/**
 * Get a human-readable OS version string.
 */
function getOsVersion() {
    const p = platform();
    const r = release();
    switch (p) {
        case "darwin": {
            // Darwin kernel versions map to macOS versions (e.g., 23.x → macOS 14)
            const major = parseInt(r.split(".")[0], 10);
            if (!isNaN(major) && major >= 20) {
                const macMajor = major - 9; // Darwin 20 = macOS 11
                return `macOS ${macMajor}`;
            }
            return `macOS (${r})`;
        }
        case "linux":
            return `Linux ${r}`;
        case "win32":
            return `Windows ${r}`;
        default:
            return `${p} ${r}`;
    }
}
/**
 * Collect machine metadata for daemon registration.
 */
export function getMachineMetadata(label = null) {
    return {
        os: platform(),
        osVersion: getOsVersion(),
        hostname: hostname(),
        username: userInfo().username,
        label,
    };
}
//# sourceMappingURL=machine-info.js.map