Skip to content

The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.

feat(website): pick the desktop download for the visitor's OS and CPU

tony174524188d5e
diff --git a/website/README.md b/website/README.md
index bd0ada7ea..3678d1f29 100644
--- a/website/README.md
+++ b/website/README.md
@@ -15,7 +15,7 @@ retired; only the host routes below were kept.
| `/pair` | Phone setup guidance — the mobile app and the desktop "add phone" dialog link here |
| `/os` | The Harness operating system landing page: plain HTML/CSS, local fonts and screenshots in `public/os/` |
| `/os/latest` | Redirect to the newest complete published OS release; OS tags only, stable preferred, five-minute server lookup cache |
-| `/desktop` | Desktop download page |
+| `/desktop` | Desktop download page; offers the build for the visitor's OS and CPU (`src/lib/desktopPlatform.ts`), with links to every other build and the CLI command |
| `/hub`, `/hub/following`, `/hub/yours` | Public three-column gallery, followed creators, and your publications; `?q=`, `?category=` and `?sort=popular` narrow and order them |
| `/hub/:id` | Full-page output viewer (full screen) beside the published conversation, comments or source files, with likes, a copyable link and the harness's public forks |
| `/hub/:id/fork`, `/hub/:id/download` | Desktop handoff fallback and an optional project ZIP |
@@ -23,7 +23,7 @@ retired; only the host routes below were kept.
| `/hub/import` | One-use desktop handoff into a private browser draft |
| `/hub/publish` | Review and explicitly publish one portable session snapshot |
| `/api/community/*` | Same-origin proxy for the backend's community API |
-| `/desktop/download-macos`, `/desktop/download/linux-{x64,arm64}` | Redirect to the latest build in the desktop manifest |
+| `/desktop/download-macos`, `/desktop/download/{macos-arm64,linux-x64,linux-arm64}` | Redirect to the latest build in the desktop manifest (`download-macos` is the Intel build, which every Mac runs; `macos-arm64` the Apple silicon one) |
| `/flash-circle.sh` | The dial firmware flasher script |
| `/install.sh`, `/cli/install.sh`, `/desktop/install.sh` | Redirect to the installers on `cdn.autonomous.ai` |
| `ac.autonomous.ai`, `fleet.autonomous.ai` | Redirect to `harness.autonomous.ai` |
diff --git a/website/src/app/desktop/DesktopDownload.tsx b/website/src/app/desktop/DesktopDownload.tsx
new file mode 100644
index 000000000..fa3d059c2
--- /dev/null
+++ b/website/src/app/desktop/DesktopDownload.tsx
@@ -0,0 +1,120 @@
+"use client";
+
+import { Fragment } from "react";
+import { Download } from "lucide-react";
+import styles from "./page.module.css";
+import { DESKTOP_BUILD, DESKTOP_BUILDS, type DesktopBuild, type VisitorPlatform } from "@/lib/desktopPlatform";
+import { useVisitorPlatform } from "@/lib/useVisitorPlatform";
+
+type Offer = {
+ /** The download buttons: this computer's build, both Linux builds when the CPU is unknown, or none. */
+ primary: readonly DesktopBuild[];
+ /** Links to the builds that are not buttons, so a wrong (or missing) guess is never a dead end. */
+ others: readonly DesktopBuild[];
+ /** Lead-in for `others`. */
+ othersLabel: string;
+ description: string;
+ note?: string;
+};
+
+/** Every listed build except `primary`. */
+function othersThan(primary: readonly DesktopBuild[]): readonly DesktopBuild[] {
+ return DESKTOP_BUILDS.filter((build) => !primary.some((offered) => offered.id === build.id));
+}
+
+const MAC_DESCRIPTION = "Download the app for macOS, then drag Harness into your Applications folder.";
+const MAC_TRUST = "Signed and notarized by Apple, so it opens without a security warning. Requires macOS 12 or later.";
+const LINUX_DESCRIPTION = "Download the AppImage, make it executable (chmod +x), then open it.";
+const LINUX_NOTE = "Built for Ubuntu 22.04 or later.";
+
+const MAC_OFFER: Offer = {
+ primary: [DESKTOP_BUILD.macos],
+ others: othersThan([DESKTOP_BUILD.macos]),
+ othersLabel: "Other downloads:",
+ description: MAC_DESCRIPTION,
+ note: `One download for Apple silicon and Intel Macs. ${MAC_TRUST}`,
+};
+
+function offerFor(platform: VisitorPlatform | null): Offer {
+ switch (platform) {
+ case "macos-arm64":
+ return {
+ primary: [DESKTOP_BUILD["macos-arm64"]],
+ // The universal build is still the Intel one, whatever else it runs on.
+ others: [{ ...DESKTOP_BUILD.macos, name: "macOS (Intel)" }, ...othersThan([DESKTOP_BUILD.macos])],
+ othersLabel: "Other downloads:",
+ description: MAC_DESCRIPTION,
+ note: `Built for Apple silicon Macs. ${MAC_TRUST}`,
+ };
+ case "linux-x64":
+ case "linux-arm64":
+ return {
+ primary: [DESKTOP_BUILD[platform]],
+ others: othersThan([DESKTOP_BUILD[platform]]),
+ othersLabel: "Other downloads:",
+ description: LINUX_DESCRIPTION,
+ note: LINUX_NOTE,
+ };
+ case "linux": {
+ const primary = [DESKTOP_BUILD["linux-x64"], DESKTOP_BUILD["linux-arm64"]];
+ return {
+ primary,
+ others: othersThan(primary),
+ othersLabel: "Other downloads:",
+ description: LINUX_DESCRIPTION,
+ note: `Not sure which? Run uname -m in a terminal: x86_64 is x64, aarch64 is ARM64. ${LINUX_NOTE}`,
+ };
+ }
+ case "windows":
+ return {
+ primary: [],
+ others: DESKTOP_BUILDS,
+ othersLabel: "Downloading for another computer?",
+ description: "The Harness desktop app runs on macOS and Linux. There is no Windows version yet.",
+ };
+ case "mobile":
+ return {
+ primary: [],
+ others: DESKTOP_BUILDS,
+ othersLabel: "Downloading for another computer?",
+ description:
+ "The Harness desktop app runs on a Mac or a Linux computer. Open this page on that computer to download it.",
+ };
+ default:
+ // Not answered yet, a Mac of unknown CPU, or nothing recognizable: exactly what the server rendered.
+ return MAC_OFFER;
+ }
+}
+
+/** The platform-specific half of `/desktop`: a button for the build that suits this computer, links to the rest. */
+export function DesktopDownload() {
+ const offer = offerFor(useVisitorPlatform());
+
+ return (
+ <>
+ <p className={styles.description}>{offer.description}</p>
+ {offer.primary.length > 0 && (
+ <div className={styles.downloads}>
+ {offer.primary.map((build) => (
+ <a className={styles.download} href={build.href} key={build.id}>
+ <Download size={18} aria-hidden="true" />
+ {`Download for ${build.name}`}
+ </a>
+ ))}
+ </div>
+ )}
+ {offer.note && <p className={styles.note}>{offer.note}</p>}
+ <p className={styles.others}>
+ {offer.othersLabel}{" "}
+ {offer.others.map((build, index) => (
+ <Fragment key={build.id}>
+ {index > 0 && " · "}
+ <a className={styles.link} href={build.href}>
+ {build.name}
+ </a>
+ </Fragment>
+ ))}
+ </p>
+ </>
+ );
+}
diff --git a/website/src/app/desktop/download/macos-arm64/route.ts b/website/src/app/desktop/download/macos-arm64/route.ts
new file mode 100644
index 000000000..137f961f4
--- /dev/null
+++ b/website/src/app/desktop/download/macos-arm64/route.ts
@@ -0,0 +1,15 @@
+/**
+ * `GET /desktop/download/macos-arm64` — hand an Apple silicon visitor the current signed `.dmg` of the
+ * Apple silicon build (Impeller), the `desktop-macos-arm64-dmg` key. `/desktop` links here only when
+ * the browser reports an ARM Mac; every other Mac gets `/desktop/download-macos`, the Intel (Skia)
+ * build, which is universal too. See desktop/RELEASE.md "Two macOS builds" for why there are two, and
+ * `lib/desktopManifest.ts` for the shared manifest-resolution/redirect logic.
+ */
+
+import { resolveDesktopDownload } from "@/lib/desktopManifest";
+
+export const dynamic = "force-dynamic";
+
+export async function GET(): Promise<Response> {
+ return resolveDesktopDownload("desktop-macos-arm64-dmg", ".dmg");
+}
diff --git a/website/src/app/desktop/page.module.css b/website/src/app/desktop/page.module.css
index d996877c6..5d18b4912 100644
--- a/website/src/app/desktop/page.module.css
+++ b/website/src/app/desktop/page.module.css
@@ -76,6 +76,31 @@
color: var(--text-muted);
}
+.note code {
+ font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
+ color: var(--text-secondary);
+}
+
+.divider {
+ width: 100%;
+ margin: 8px 0;
+ border: 0;
+ border-top: 1px solid var(--border-default);
+}
+
+.downloads {
+ display: flex;
+ flex-wrap: wrap;
+ gap: 12px;
+}
+
+.others {
+ margin: 0;
+ color: var(--text-muted);
+ font-size: 14px;
+ line-height: 1.6;
+}
+
.download {
display: inline-flex;
align-items: center;
diff --git a/website/src/app/desktop/page.tsx b/website/src/app/desktop/page.tsx
index 91a7f5c64..2a28d4942 100644
--- a/website/src/app/desktop/page.tsx
+++ b/website/src/app/desktop/page.tsx
@@ -1,6 +1,7 @@
import { Download, Terminal } from "lucide-react";
import styles from "./page.module.css";
-import { DESKTOP_DOWNLOAD_URL, DESKTOP_INSTALL_COMMAND } from "@/lib/installCommand";
+import { DesktopDownload } from "./DesktopDownload";
+import { DESKTOP_INSTALL_COMMAND, INSTALL_COMMAND } from "@/lib/installCommand";
export default function DesktopPage() {
return (
@@ -11,18 +12,9 @@ export default function DesktopPage() {
</div>
<p className={styles.eyebrow}>Harness for macOS and Linux</p>
<h1 className={styles.title}>Install the Harness desktop app</h1>
+ <DesktopDownload />
<p className={styles.description}>
- Download the app for macOS, then drag Harness into your Applications folder.
- </p>
- <a className={styles.download} href={DESKTOP_DOWNLOAD_URL}>
- <Download size={18} aria-hidden="true" />
- Download for macOS
- </a>
- <p className={styles.note}>
- Signed and notarized by Apple, so it opens without a security warning. Requires macOS 12 or later.
- </p>
- <p className={styles.description}>
- On Linux, or installing from a terminal? Run this instead — it reads the same release manifest, verifies the download, installs it, and opens Harness.
+ Installing from a terminal? Run this instead — it downloads the latest release for this computer, verifies it, installs it, and opens Harness.
</p>
<div className={styles.command}>
<Terminal size={18} aria-hidden="true" />
@@ -36,6 +28,18 @@ export default function DesktopPage() {
<a className={styles.link} href="/desktop/install.sh">
View installer script
</a>
+ {/* The phone's "Send to my computer" lands here for every computer, a server with no desktop included. */}
+ <hr className={styles.divider} />
+ <p className={styles.description}>
+ Only need the command line, on a server or a computer with no desktop? Install Harness for your terminal:
+ </p>
+ <div className={styles.command}>
+ <Terminal size={18} aria-hidden="true" />
+ <code>{INSTALL_COMMAND}</code>
+ </div>
+ <p className={styles.note}>
+ macOS and Linux. Then sign in with <code>harness login</code> and start it with <code>harness start</code>.
+ </p>
</section>
</main>
);
diff --git a/website/src/app/download/page.module.css b/website/src/app/download/page.module.css
index 760329243..d32089544 100644
--- a/website/src/app/download/page.module.css
+++ b/website/src/app/download/page.module.css
@@ -85,6 +85,7 @@
.download:focus-visible .platform,
.download:focus-visible .downloadAction { font-weight: 700; }
.platformDetail { color: var(--download-muted); font-size: 12px; }
+.suggested .platformDetail { color: var(--download-foreground); }
.downloadAction { text-align: right; white-space: nowrap; }
.commands { list-style: none; display: grid; gap: 1lh; margin-bottom: 1lh; }
diff --git a/website/src/app/download/page.tsx b/website/src/app/download/page.tsx
index 10ab1b9cc..077cdfbd3 100644
--- a/website/src/app/download/page.tsx
+++ b/website/src/app/download/page.tsx
@@ -4,12 +4,9 @@
import { useEffect, useRef, useState } from "react";
import styles from "./page.module.css";
-import {
- DESKTOP_DOWNLOAD_LINUX_ARM64_URL,
- DESKTOP_DOWNLOAD_LINUX_X64_URL,
- DESKTOP_DOWNLOAD_URL,
- INSTALL_COMMAND,
-} from "@/lib/installCommand";
+import { buildsFor } from "@/lib/desktopPlatform";
+import { INSTALL_COMMAND } from "@/lib/installCommand";
+import { useVisitorPlatform } from "@/lib/useVisitorPlatform";
const commands = [
{ id: "install", label: "1. Install", value: INSTALL_COMMAND },
@@ -17,12 +14,6 @@ const commands = [
{ id: "start", label: "3. Start", value: "harness start" },
] as const;
-const downloads = [
- { name: "macOS", detail: "Apple silicon + Intel", href: DESKTOP_DOWNLOAD_URL },
- { name: "Linux (x64)", detail: "AppImage", href: DESKTOP_DOWNLOAD_LINUX_X64_URL },
- { name: "Linux (ARM64)", detail: "AppImage", href: DESKTOP_DOWNLOAD_LINUX_ARM64_URL },
-];
-
type CommandId = (typeof commands)[number]["id"];
/** Public /download page. The root route serves the shared Flutter workspace. */
@@ -30,6 +21,7 @@ export default function Page() {
const [copied, setCopied] = useState<CommandId | null>(null);
const [copyError, setCopyError] = useState(false);
const reset = useRef<ReturnType<typeof setTimeout> | null>(null);
+ const platform = useVisitorPlatform();
useEffect(() => () => {
if (reset.current) clearTimeout(reset.current);
@@ -74,13 +66,17 @@ export default function Page() {
<div className={styles.sectionBody}>
<p className={styles.description}>One workspace for all your agents and machines.</p>
<div className={styles.downloads}>
- {downloads.map(({ name, detail, href }) => (
- <a className={styles.download} href={href} key={href}>
- <span className={styles.platform}>{name}</span>
- <span className={styles.platformDetail}>{detail}</span>
- <span className={styles.downloadAction}>[ Download ]</span>
- </a>
- ))}
+ {buildsFor(platform).map(({ id, name, detail, href }) => {
+ // Any Mac marks macOS (both builds run on either CPU); a Linux CPU nobody named marks neither.
+ const suggested = id === platform;
+ return (
+ <a className={suggested ? `${styles.download} ${styles.suggested}` : styles.download} href={href} key={href}>
+ <span className={styles.platform}>{name}</span>
+ <span className={styles.platformDetail}>{suggested ? `${detail} · this computer` : detail}</span>
+ <span className={styles.downloadAction}>[ Download ]</span>
+ </a>
+ );
+ })}
</div>
<p className={styles.note}>
Signed and notarized on macOS.<br />
diff --git a/website/src/lib/desktopPlatform.ts b/website/src/lib/desktopPlatform.ts
new file mode 100644
index 000000000..bcdd125c8
--- /dev/null
+++ b/website/src/lib/desktopPlatform.ts
@@ -0,0 +1,175 @@
+/**
+ * Which desktop build suits the browser asking: the answer behind the download buttons on
+ * `/desktop` and `/download`.
+ *
+ * It reads `navigator`, so it only ever runs in the browser. A page therefore renders its
+ * no-detection state on the server and on first paint, then refines it once this answers. That state
+ * has to stand on its own with every build reachable, because a browser that blocks scripts, or one
+ * this cannot place, never leaves it.
+ *
+ * macOS ships two builds of one universal app (desktop/RELEASE.md "Two macOS builds"): the Intel one
+ * on Skia, and the Apple silicon one on Impeller. Both launch on either CPU, so a wrong guess costs a
+ * renderer, never a working app. A Mac whose browser reports an ARM CPU gets the Apple silicon build;
+ * every other Mac gets the Intel one, which is what the website always served. Only Chromium can say:
+ * Safari and Firefox report "Intel" on every Mac.
+ *
+ * Linux is where the CPU decides whether the app runs at all: x64 and ARM64 are separate AppImages.
+ * Chromium freezes its user-agent string at "Linux x86_64" whatever the CPU, so on Chromium the
+ * architecture comes from User-Agent Client Hints; Firefox still writes the real one (`aarch64`) into
+ * its user agent. When neither says, the answer is "Linux, architecture unknown" and the page offers
+ * both builds instead of guessing.
+ */
+
+import {
+ DESKTOP_DOWNLOAD_LINUX_ARM64_URL,
+ DESKTOP_DOWNLOAD_LINUX_X64_URL,
+ DESKTOP_DOWNLOAD_MACOS_ARM64_URL,
+ DESKTOP_DOWNLOAD_URL,
+} from "@/lib/installCommand";
+
+export type DesktopBuildId = "macos" | "macos-arm64" | "linux-x64" | "linux-arm64";
+
+export type DesktopBuild = {
+ id: DesktopBuildId;
+ name: string;
+ detail: string;
+ href: string;
+};
+
+export const DESKTOP_BUILD = {
+ macos: { id: "macos", name: "macOS", detail: "Apple silicon + Intel", href: DESKTOP_DOWNLOAD_URL },
+ "macos-arm64": {
+ id: "macos-arm64",
+ name: "macOS (Apple silicon)",
+ detail: "Built for Apple silicon",
+ href: DESKTOP_DOWNLOAD_MACOS_ARM64_URL,
+ },
+ "linux-x64": { id: "linux-x64", name: "Linux (x64)", detail: "AppImage", href: DESKTOP_DOWNLOAD_LINUX_X64_URL },
+ "linux-arm64": { id: "linux-arm64", name: "Linux (ARM64)", detail: "AppImage", href: DESKTOP_DOWNLOAD_LINUX_ARM64_URL },
+} as const satisfies Record<DesktopBuildId, DesktopBuild>;
+
+/**
+ * The builds the pages list for everyone, in order. The Apple silicon build is not among them: it is
+ * offered in place of `macos`, and only to a Mac known to be Apple silicon (`buildsFor`).
+ */
+export const DESKTOP_BUILDS: readonly DesktopBuild[] = [
+ DESKTOP_BUILD.macos,
+ DESKTOP_BUILD["linux-x64"],
+ DESKTOP_BUILD["linux-arm64"],
+];
+
+/**
+ * What the visitor is on, as far as the desktop download cares:
+ * - a `DesktopBuildId`: that build suits this computer (`macos` also covers a Mac of unknown CPU);
+ * - `linux`: Linux, but the browser did not say which CPU (or it is one with no build);
+ * - `windows`, `mobile`: no desktop build runs here (`mobile` covers phones and tablets, iPad included);
+ * - `unknown`: anything else, ChromeOS included. Pages treat it like no detection at all.
+ */
+export type VisitorPlatform = DesktopBuildId | "linux" | "windows" | "mobile" | "unknown";
+
+/**
+ * `DESKTOP_BUILDS` as this visitor should see them: on an ARM Mac, macOS's row (still named "macOS")
+ * links the Apple silicon build instead.
+ */
+export function buildsFor(platform: VisitorPlatform | null): readonly DesktopBuild[] {
+ if (platform !== "macos-arm64") return DESKTOP_BUILDS;
+ return DESKTOP_BUILDS.map((build) =>
+ build.id === "macos" ? { ...DESKTOP_BUILD["macos-arm64"], name: build.name } : build,
+ );
+}
+
+/** The few `navigator` fields this reads, so a caller (or a non-browser runtime) can supply them. */
+export type NavigatorSnapshot = {
+ userAgent?: string;
+ platform?: string;
+ maxTouchPoints?: number;
+ userAgentData?: UserAgentData;
+};
+
+/** User-Agent Client Hints (Chromium only, secure contexts only); not in TypeScript's DOM lib yet. */
+type UserAgentData = {
+ platform?: string;
+ mobile?: boolean;
+ getHighEntropyValues?: (hints: string[]) => Promise<{ architecture?: string; bitness?: string }>;
+};
+
+/** The Linux build named by an architecture string such as `navigator.platform`'s "Linux aarch64". */
+function linuxBuild(text: string): VisitorPlatform {
+ // `armv8l` is deliberately not here: it is a 32-bit userland, which the ARM64 AppImage cannot serve.
+ if (/\b(aarch64|arm64)\b/.test(text)) return "linux-arm64";
+ if (/\b(x86_64|x86-64|amd64)\b/.test(text)) return "linux-x64";
+ return "linux";
+}
+
+/** Classify from the user-agent string and `navigator.platform` alone: the path every browser has. */
+export function platformFromUserAgent({ userAgent = "", platform = "", maxTouchPoints = 0 }: NavigatorSnapshot): VisitorPlatform {
+ const agent = userAgent.toLowerCase();
+ const os = platform.toLowerCase();
+
+ // Android's user agent also says "Linux", and iOS browsers' say "like Mac OS X", so phones go first.
+ if (/android|iphone|ipad|ipod/.test(agent) || /^(iphone|ipad|ipod)/.test(os)) return "mobile";
+ // iPadOS Safari asks for desktop sites by default and reports itself as a Mac; only the touchscreen
+ // tells it apart, since no Mac has one. Every Mac browser says "Intel" here, so the CPU stays unknown.
+ if (/macintosh|mac os x/.test(agent) || os.startsWith("mac")) return maxTouchPoints > 1 ? "mobile" : "macos";
+ if (agent.includes("windows") || os.startsWith("win")) return "windows";
+ if (agent.includes("cros")) return "unknown";
+ if (agent.includes("linux") || os.startsWith("linux")) {
+ // Chromium's user agent says x86_64 on every Linux machine, so only `navigator.platform` can be
+ // trusted there; other browsers still report the real architecture in both.
+ const chromium = /\b(chrome|chromium)\//.test(agent);
+ return linuxBuild(chromium ? os : `${os} ${agent}`);
+ }
+ return "unknown";
+}
+
+/**
+ * The CPU from Client Hints: `undefined` when the browser would not say (a permissions policy, a
+ * privacy setting), `other` when it named one nothing is published for (32-bit, RISC-V...).
+ */
+async function cpuFromClientHints(data: UserAgentData): Promise<"x64" | "arm64" | "other" | undefined> {
+ try {
+ const hints = await data.getHighEntropyValues?.(["architecture", "bitness"]);
+ const architecture = hints?.architecture ?? "";
+ const bitness = hints?.bitness ?? "";
+ if (bitness === "64" && architecture === "x86") return "x64";
+ if (bitness === "64" && architecture === "arm") return "arm64";
+ if (architecture && bitness) return "other";
+ } catch {
+ // Refused: fall through to "would not say".
+ }
+ return undefined;
+}
+
+/**
+ * The visitor's platform, from Client Hints where the browser offers them and the user agent where it
+ * does not. Never rejects: anything unreadable resolves to `unknown`.
+ */
+export async function detectVisitorPlatform(snapshot: NavigatorSnapshot): Promise<VisitorPlatform> {
+ try {
+ const data = snapshot.userAgentData;
+ if (!data?.platform) return platformFromUserAgent(snapshot);
+ if (data.mobile) return "mobile";
+ switch (data.platform) {
+ case "macOS":
+ // Anything short of a definite ARM answer keeps the build every Mac can run as before.
+ return (await cpuFromClientHints(data)) === "arm64" ? "macos-arm64" : "macos";
+ case "Windows":
+ return "windows";
+ case "Android":
+ case "iOS":
+ return "mobile";
+ case "Linux": {
+ const cpu = await cpuFromClientHints(data);
+ if (cpu === "x64") return "linux-x64";
+ if (cpu === "arm64") return "linux-arm64";
+ if (cpu === "other") return "linux";
+ return platformFromUserAgent(snapshot);
+ }
+ default:
+ // "Chrome OS", "Chromium OS", "Unknown" and the like: let the user agent have its say.
+ return platformFromUserAgent(snapshot);
+ }
+ } catch {
+ return "unknown";
+ }
+}
diff --git a/website/src/lib/installCommand.ts b/website/src/lib/installCommand.ts
index 7c5472886..860bfcb95 100644
--- a/website/src/lib/installCommand.ts
+++ b/website/src/lib/installCommand.ts
@@ -46,3 +46,9 @@ export const DESKTOP_DOWNLOAD_URL = "/desktop/download-macos";
*/
export const DESKTOP_DOWNLOAD_LINUX_X64_URL = "/desktop/download/linux-x64";
export const DESKTOP_DOWNLOAD_LINUX_ARM64_URL = "/desktop/download/linux-arm64";
+
+/**
+ * The Apple silicon (Impeller) `.dmg` — `src/app/desktop/download/macos-arm64/`. Offered only to a Mac
+ * whose browser reports an ARM CPU; `DESKTOP_DOWNLOAD_URL` stays the one every other Mac gets.
+ */
+export const DESKTOP_DOWNLOAD_MACOS_ARM64_URL = "/desktop/download/macos-arm64";
diff --git a/website/src/lib/useVisitorPlatform.ts b/website/src/lib/useVisitorPlatform.ts
new file mode 100644
index 000000000..6cbf157c5
--- /dev/null
+++ b/website/src/lib/useVisitorPlatform.ts
@@ -0,0 +1,22 @@
+"use client";
+
+import { useEffect, useState } from "react";
+import { detectVisitorPlatform, type VisitorPlatform } from "@/lib/desktopPlatform";
+
+/**
+ * The visitor's platform for the desktop download: null until the browser has answered, which is also
+ * what the server renders, so the first client render always matches it.
+ */
+export function useVisitorPlatform(): VisitorPlatform | null {
+ const [platform, setPlatform] = useState<VisitorPlatform | null>(null);
+ useEffect(() => {
+ let live = true;
+ void detectVisitorPlatform(navigator).then((detected) => {
+ if (live) setPlatform(detected);
+ });
+ return () => {
+ live = false;
+ };
+ }, []);
+ return platform;
+}