Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.
Go
feat(web): /download page + desktop promotion across landing, login, onboarding (#1500)
Naiyuan Qing5335edd50d23
diff --git a/apps/web/app/(auth)/login/page.tsx b/apps/web/app/(auth)/login/page.tsxindex 05608b218e..e274a9e043 100644--- a/apps/web/app/(auth)/login/page.tsx+++ b/apps/web/app/(auth)/login/page.tsx@@ -22,7 +22,9 @@ import {} from "@multica/ui/components/ui/card";import { Button } from "@multica/ui/components/ui/button";import { Loader2 } from "lucide-react";+import { captureDownloadIntent } from "@multica/core/analytics";import { setLoggedInCookie } from "@/features/auth/auth-cookie";+import Link from "next/link";import { LoginPage, validateCliCallback } from "@multica/views/auth";function LoginPageContent() {@@ -172,6 +174,22 @@ function LoginPageContent() {: undefined}onTokenObtained={setLoggedInCookie}+ extra={+ // Web-only nudge toward the desktop app. Copy is hardcoded EN+ // for now because the login route sits outside the landing+ // group's LocaleProvider — if this page ever becomes+ // locale-aware, the strings live in positioning doc §3.3.+ <span className="text-xs text-muted-foreground">+ Prefer the desktop app?{" "}+ <Link+ href="/download"+ onClick={() => captureDownloadIntent("login")}+ className="font-medium text-foreground underline decoration-foreground/30 underline-offset-4 hover:decoration-foreground/70"+ >+ Download+ </Link>+ </span>+ }/>);}diff --git a/apps/web/app/(landing)/download/download-client.tsx b/apps/web/app/(landing)/download/download-client.tsxnew file mode 100644index 0000000000..1c6d6d2801--- /dev/null+++ b/apps/web/app/(landing)/download/download-client.tsx@@ -0,0 +1,140 @@+"use client";++import { useEffect, useState } from "react";+import Link from "next/link";+import { LandingHeader } from "@/features/landing/components/landing-header";+import { LandingFooter } from "@/features/landing/components/landing-footer";+import { DownloadHero } from "@/features/landing/components/download/hero";+import { AllPlatforms } from "@/features/landing/components/download/all-platforms";+import { CliSection } from "@/features/landing/components/download/cli-section";+import { CloudSection } from "@/features/landing/components/download/cloud-section";+import { useLocale } from "@/features/landing/i18n";+import {+ detectOS,+ type DetectResult,+} from "@/features/landing/utils/os-detect";+import type { LatestRelease } from "@/features/landing/utils/github-release";+import { captureDownloadPageViewed } from "@multica/core/analytics";++const ALL_RELEASES_URL =+ "https://github.com/multica-ai/multica/releases";++export function DownloadClient({ release }: { release: LatestRelease }) {+ const [detected, setDetected] = useState<DetectResult | null>(null);+ const versionUnavailable = release.version === null;++ useEffect(() => {+ let cancelled = false;+ detectOS().then((result) => {+ if (cancelled) return;+ setDetected(result);+ // Fires once per page mount after detect resolves. Carries the+ // detect outcome + version-unavailable flag so PostHog can split+ // Safari-mac-arm64 fallback rate, Intel-Mac dead-end rate, and+ // rate-limit degraded sessions. `first_detected_os/arch` is+ // $set_once'd on the person so every downstream event gains a+ // platform dimension (useful for "Android visitors who later+ // downloaded Windows" style cross-device queries once we land+ // the desktop install closure).+ captureDownloadPageViewed({+ detected_os: result.os,+ detected_arch: result.arch,+ detect_confident: result.archConfident,+ version_available: !versionUnavailable,+ });+ });+ return () => {+ cancelled = true;+ };+ }, [versionUnavailable]);++ const releaseHtmlUrl = release.htmlUrl ?? ALL_RELEASES_URL;++ return (+ <>+ {/* Positioning context for the dark-variant LandingHeader —+ mirrors multica-landing.tsx. The header is `absolute top-0+ inset-x-0`, so it anchors to this `relative` wrapper and+ scrolls off together with the dark hero below. Without the+ wrapper, `absolute` would escape to the initial containing+ block and read as fixed. */}+ <div className="relative">+ <LandingHeader variant="dark" />+ <DownloadHero+ detected={detected}+ assets={release.assets}+ versionUnavailable={versionUnavailable}+ version={release.version}+ />+ </div>++ <AllPlatforms+ assets={release.assets}+ fallbackHref={ALL_RELEASES_URL}+ version={release.version}+ detected={detected}+ />+ <CliSection />+ <CloudSection />+ <VersionInfoFooter+ version={release.version}+ releaseHtmlUrl={releaseHtmlUrl}+ />+ <LandingFooter />+ </>+ );+}++function VersionInfoFooter({+ version,+ releaseHtmlUrl,+}: {+ version: string | null;+ releaseHtmlUrl: string;+}) {+ const { t } = useLocale();+ const d = t.download.footer;++ return (+ <section className="bg-white pb-16 text-[#0a0d12] sm:pb-20">+ <div className="mx-auto flex max-w-[920px] flex-wrap items-center gap-x-6 gap-y-2 border-t border-[#0a0d12]/8 px-4 pt-8 text-[13px] text-[#0a0d12]/60 sm:px-6 lg:px-8">+ {version ? (+ <>+ <span>+ {d.currentVersion.replace("{version}", version)}+ </span>+ <span aria-hidden className="text-[#0a0d12]/25">+ ·+ </span>+ <Link+ href={releaseHtmlUrl}+ className="underline decoration-[#0a0d12]/30 underline-offset-4 hover:text-[#0a0d12] hover:decoration-[#0a0d12]/70"+ target="_blank"+ rel="noreferrer"+ >+ {d.releaseNotes.replace("{version}", version)}+ </Link>+ <span aria-hidden className="text-[#0a0d12]/25">+ ·+ </span>+ </>+ ) : (+ <>+ <span>{d.versionUnavailable}</span>+ <span aria-hidden className="text-[#0a0d12]/25">+ ·+ </span>+ </>+ )}+ <Link+ href={ALL_RELEASES_URL}+ className="underline decoration-[#0a0d12]/30 underline-offset-4 hover:text-[#0a0d12] hover:decoration-[#0a0d12]/70"+ target="_blank"+ rel="noreferrer"+ >+ {d.allReleases}+ </Link>+ </div>+ </section>+ );+}diff --git a/apps/web/app/(landing)/download/page.tsx b/apps/web/app/(landing)/download/page.tsxnew file mode 100644index 0000000000..fb353c4135--- /dev/null+++ b/apps/web/app/(landing)/download/page.tsx@@ -0,0 +1,29 @@+import type { Metadata } from "next";+import { fetchLatestRelease } from "@/features/landing/utils/github-release";+import { DownloadClient } from "./download-client";++// Vercel ISR: the server fetch inside fetchLatestRelease carries+// `next: { revalidate: 300 }`, which makes GitHub API cost at most+// one request per region per 5 minutes. Page-level revalidate mirrors+// that window so the first paint also refreshes every 5 minutes.+export const revalidate = 300;++export const metadata: Metadata = {+ title: "Download Multica",+ description:+ "Download Multica for macOS, Windows, or Linux — or install the CLI for servers and remote dev boxes.",+ openGraph: {+ title: "Download Multica",+ description:+ "Get the Multica desktop app with a bundled daemon, or install the CLI for servers and remote dev boxes.",+ url: "/download",+ },+ alternates: {+ canonical: "/download",+ },+};++export default async function DownloadPage() {+ const release = await fetchLatestRelease();+ return <DownloadClient release={release} />;+}diff --git a/apps/web/features/landing/components/download/all-platforms.tsx b/apps/web/features/landing/components/download/all-platforms.tsxnew file mode 100644index 0000000000..275285d6b8--- /dev/null+++ b/apps/web/features/landing/components/download/all-platforms.tsx@@ -0,0 +1,239 @@+import Link from "next/link";+import {+ captureDownloadInitiated,+ type DownloadInitiatedPayload,+} from "@multica/core/analytics";+import { useLocale } from "../../i18n";+import type { DetectResult } from "../../utils/os-detect";+import type { DownloadAssets } from "../../utils/parse-release-assets";+import { AppleIcon, LinuxIcon, WindowsIcon } from "./os-icons";++type Platform = DownloadInitiatedPayload["platform"];+type Arch = DownloadInitiatedPayload["arch"];+type Format = DownloadInitiatedPayload["format"];++interface Props {+ assets: DownloadAssets;+ /** Link to GitHub releases page, used when individual asset URLs+ * couldn't be resolved (API down / parse failure). */+ fallbackHref: string;+ /** Release tag (e.g. "v0.2.13"); null on fetch failure. */+ version: string | null;+ /** Current OS/arch guess. Used only to compute `matched_detect` on+ * the download_initiated event — the row UI itself is static. */+ detected: DetectResult | null;+}++/**+ * Full matrix of platform + arch + format links. Always visible+ * regardless of which platform the Hero resolved to — lets power+ * users grab any build directly.+ */+export function AllPlatforms({+ assets,+ fallbackHref,+ version,+ detected,+}: Props) {+ const { t } = useLocale();+ const d = t.download.allPlatforms;++ const trackClick = (platform: Platform, arch: Arch, format: Format) => {+ if (!version) return;+ captureDownloadInitiated({+ platform,+ arch,+ format,+ version,+ // Manual pick from the matrix — Hero is the primary CTA.+ primary_cta: false,+ // True only when the row matches what we guessed client-side.+ // Lets us measure detect accuracy from the miss rate on this+ // event alone (no need to cross-join to download_page_viewed).+ matched_detect:+ !!detected &&+ detected.os === platform &&+ detected.arch === arch,+ });+ };++ return (+ <section+ id="all-platforms"+ className="bg-white py-20 text-[#0a0d12] sm:py-24"+ >+ <div className="mx-auto max-w-[920px] px-4 sm:px-6 lg:px-8">+ <h2 className="font-[family-name:var(--font-serif)] text-[2.2rem] leading-[1.1] tracking-[-0.03em] sm:text-[2.6rem]">+ {d.title}+ </h2>++ <div className="mt-10 overflow-hidden rounded-2xl border border-[#0a0d12]/10">+ <Row+ icon={<AppleIcon className="text-[#0a0d12]" />}+ label={d.macLabel}+ formats={[+ {+ label: d.formatDmg,+ href: assets.macArm64Dmg,+ onClick: () => trackClick("mac", "arm64", "dmg"),+ },+ {+ label: d.formatZip,+ href: assets.macArm64Zip,+ onClick: () => trackClick("mac", "arm64", "zip"),+ },+ ]}+ unavailable={d.unavailable}+ />+ <Row+ icon={<WindowsIcon className="text-[#0a0d12]" />}+ label={d.winX64Label}+ formats={[+ {+ label: d.formatExe,+ href: assets.winX64Exe,+ onClick: () => trackClick("windows", "x64", "exe"),+ },+ ]}+ unavailable={d.unavailable}+ />+ <Row+ icon={<WindowsIcon className="text-[#0a0d12]" />}+ label={d.winArm64Label}+ formats={[+ {+ label: d.formatExe,+ href: assets.winArm64Exe,+ onClick: () => trackClick("windows", "arm64", "exe"),+ },+ ]}+ unavailable={d.unavailable}+ />+ <Row+ icon={<LinuxIcon className="text-[#0a0d12]" />}+ label={d.linuxX64Label}+ formats={[+ {+ label: d.formatAppImage,+ href: assets.linuxAmd64AppImage,+ onClick: () => trackClick("linux", "x64", "appimage"),+ },+ {+ label: d.formatDeb,+ href: assets.linuxAmd64Deb,+ onClick: () => trackClick("linux", "x64", "deb"),+ },+ {+ label: d.formatRpm,+ href: assets.linuxAmd64Rpm,+ onClick: () => trackClick("linux", "x64", "rpm"),+ },+ ]}+ unavailable={d.unavailable}+ />+ <Row+ icon={<LinuxIcon className="text-[#0a0d12]" />}+ label={d.linuxArm64Label}+ formats={[+ {+ label: d.formatAppImage,+ href: assets.linuxArm64AppImage,+ onClick: () => trackClick("linux", "arm64", "appimage"),+ },+ {+ label: d.formatDeb,+ href: assets.linuxArm64Deb,+ onClick: () => trackClick("linux", "arm64", "deb"),+ },+ {+ label: d.formatRpm,+ href: assets.linuxArm64Rpm,+ onClick: () => trackClick("linux", "arm64", "rpm"),+ },+ ]}+ unavailable={d.unavailable}+ isLast+ />+ </div>++ <p className="mt-6 text-[13px] text-[#0a0d12]/60">{d.intelNote}</p>++ {isFallbackNeeded(assets) ? (+ <p className="mt-2 text-[13px] text-[#0a0d12]/60">+ <Link+ href={fallbackHref}+ className="underline decoration-[#0a0d12]/30 underline-offset-4 hover:text-[#0a0d12] hover:decoration-[#0a0d12]/70"+ target="_blank"+ rel="noreferrer"+ >+ {t.download.footer.allReleases}+ </Link>+ </p>+ ) : null}+ </div>+ </section>+ );+}++// ------------------------------------------------------------+// Row+// ------------------------------------------------------------++interface RowProps {+ icon: React.ReactNode;+ label: string;+ formats: {+ label: string;+ href: string | undefined;+ onClick: () => void;+ }[];+ unavailable: string;+ isLast?: boolean;+}++function Row({ icon, label, formats, unavailable, isLast }: RowProps) {+ return (+ <div+ className={`flex flex-wrap items-center gap-x-6 gap-y-3 px-6 py-5 ${isLast ? "" : "border-b border-[#0a0d12]/8"}`}+ >+ <div className="flex min-w-[220px] items-center gap-3">+ <span className="flex h-8 w-8 items-center justify-center rounded-lg bg-[#0a0d12]/5">+ {icon}+ </span>+ <span className="text-[14.5px] font-medium">{label}</span>+ </div>+ <div className="flex flex-wrap items-center gap-2">+ {formats.map((f) =>+ f.href ? (+ <a+ key={f.label}+ href={f.href}+ onClick={f.onClick}+ className="inline-flex items-center gap-1.5 rounded-lg border border-[#0a0d12]/12 bg-white px-3 py-1.5 text-[13px] font-medium transition-colors hover:border-[#0a0d12]/30 hover:bg-[#0a0d12]/5"+ >+ {f.label}+ </a>+ ) : (+ <span+ key={f.label}+ aria-disabled="true"+ className="inline-flex cursor-not-allowed items-center gap-1.5 rounded-lg border border-[#0a0d12]/8 bg-[#0a0d12]/5 px-3 py-1.5 text-[13px] text-[#0a0d12]/40"+ title={unavailable}+ >+ {f.label}+ </span>+ ),+ )}+ </div>+ </div>+ );+}++// Ten desktop artifacts are expected per release (two Mac,+// two Windows, six Linux). If any are missing, surface the GitHub+// fallback link so users on an orphaned row have a way out.+const EXPECTED_ASSET_COUNT = 10;++function isFallbackNeeded(assets: DownloadAssets): boolean {+ return Object.values(assets).filter(Boolean).length < EXPECTED_ASSET_COUNT;+}diff --git a/apps/web/features/landing/components/download/cli-section.tsx b/apps/web/features/landing/components/download/cli-section.tsxnew file mode 100644index 0000000000..6ca10f8c26--- /dev/null+++ b/apps/web/features/landing/components/download/cli-section.tsx@@ -0,0 +1,108 @@+"use client";++import { useState } from "react";+import { Check, Copy, Terminal } from "lucide-react";+import { useLocale } from "../../i18n";++const INSTALL_CMD =+ "curl -fsSL https://raw.githubusercontent.com/multica-ai/multica/main/scripts/install.sh | bash";+const SETUP_CMD = "multica setup";++/**+ * Scenario-first CLI section. Copy leans into servers / remote dev+ * boxes / headless setups rather than positioning CLI as a+ * lightweight Desktop. Two copy-and-paste command blocks.+ */+export function CliSection() {+ const { t } = useLocale();+ const d = t.download.cli;++ return (+ <section id="cli" className="bg-[#f7f7f5] py-20 text-[#0a0d12] sm:py-24">+ <div className="mx-auto max-w-[820px] px-4 sm:px-6 lg:px-8">+ <h2 className="font-[family-name:var(--font-serif)] text-[2.2rem] leading-[1.1] tracking-[-0.03em] sm:text-[2.6rem]">+ {d.title}+ </h2>+ <p className="mt-4 max-w-[620px] text-[15px] leading-7 text-[#0a0d12]/72">+ {d.sub}+ </p>++ <div className="mt-10 flex flex-col gap-5">+ <CommandBlock+ label={d.installLabel}+ cmd={INSTALL_CMD}+ copyLabel={d.copyLabel}+ copiedLabel={d.copiedLabel}+ />+ <CommandBlock+ label={d.startLabel}+ cmd={SETUP_CMD}+ copyLabel={d.copyLabel}+ copiedLabel={d.copiedLabel}+ />+ </div>++ <p className="mt-6 text-[13px] text-[#0a0d12]/60">{d.sshNote}</p>+ </div>+ </section>+ );+}++function CommandBlock({+ label,+ cmd,+ copyLabel,+ copiedLabel,+}: {+ label: string;+ cmd: string;+ copyLabel: string;+ copiedLabel: string;+}) {+ const [copied, setCopied] = useState(false);++ const onCopy = async () => {+ try {+ await navigator.clipboard.writeText(cmd);+ setCopied(true);+ setTimeout(() => setCopied(false), 1800);+ } catch {+ // clipboard may be unavailable (insecure context) — silent no-op+ }+ };++ return (+ <div>+ <p className="mb-2 text-[12px] font-medium uppercase tracking-[0.08em] text-[#0a0d12]/55">+ {label}+ </p>+ <div className="flex items-start gap-3 rounded-xl border border-[#0a0d12]/10 bg-white px-4 py-3 font-mono text-[13.5px]">+ <Terminal+ className="mt-0.5 size-4 shrink-0 text-[#0a0d12]/55"+ aria-hidden+ />+ <code className="min-w-0 flex-1 whitespace-pre-wrap break-all">+ {cmd}+ </code>+ <button+ type="button"+ onClick={onCopy}+ aria-label={copied ? copiedLabel : copyLabel}+ className="inline-flex shrink-0 items-center gap-1.5 rounded-md px-2 py-1 text-[12px] font-medium text-[#0a0d12]/70 transition-colors hover:bg-[#0a0d12]/5 hover:text-[#0a0d12]"+ >+ {copied ? (+ <>+ <Check className="size-3.5" />+ {copiedLabel}+ </>+ ) : (+ <>+ <Copy className="size-3.5" />+ {copyLabel}+ </>+ )}+ </button>+ </div>+ </div>+ );+}diff --git a/apps/web/features/landing/components/download/cloud-section.tsx b/apps/web/features/landing/components/download/cloud-section.tsxnew file mode 100644index 0000000000..10a90e8bbf--- /dev/null+++ b/apps/web/features/landing/components/download/cloud-section.tsx@@ -0,0 +1,38 @@+"use client";++import { useState } from "react";+import { CloudWaitlistExpand } from "@multica/views/onboarding";+import { useLocale } from "../../i18n";++/**+ * Cloud runtime waitlist — thin wrapper around the shared+ * CloudWaitlistExpand form with a download-page-appropriate title+ * and subtitle. Submission persists via `joinCloudWaitlist` inside+ * the child; the submitted flag here only prevents double-submits+ * for the lifetime of the page.+ */+export function CloudSection() {+ const { t } = useLocale();+ const d = t.download.cloud;+ const [submitted, setSubmitted] = useState(false);++ return (+ <section className="bg-white py-20 text-[#0a0d12] sm:py-24">+ <div className="mx-auto max-w-[720px] px-4 sm:px-6 lg:px-8">+ <h2 className="font-[family-name:var(--font-serif)] text-[2.2rem] leading-[1.1] tracking-[-0.03em] sm:text-[2.6rem]">+ {d.title}+ </h2>+ <p className="mt-4 max-w-[560px] text-[15px] leading-7 text-[#0a0d12]/72">+ {d.sub}+ </p>++ <div className="mt-10">+ <CloudWaitlistExpand+ submitted={submitted}+ onSubmitted={() => setSubmitted(true)}+ />+ </div>+ </div>+ </section>+ );+}diff --git a/apps/web/features/landing/components/download/hero.tsx b/apps/web/features/landing/components/download/hero.tsxnew file mode 100644index 0000000000..602b0e2a50--- /dev/null+++ b/apps/web/features/landing/components/download/hero.tsx@@ -0,0 +1,285 @@+import Link from "next/link";+import { ArrowRight, Download } from "lucide-react";+import {+ captureDownloadInitiated,+ type DownloadInitiatedPayload,+} from "@multica/core/analytics";+import { useLocale } from "../../i18n";+import type { DetectResult } from "../../utils/os-detect";+import type { DownloadAssets } from "../../utils/parse-release-assets";+import { heroButtonClassName } from "../shared";++interface Props {+ detected: DetectResult | null;+ assets: DownloadAssets;+ /** True when the GitHub API fetch failed; disables all CTAs and+ * surfaces a "version unavailable" line. */+ versionUnavailable: boolean;+ /** Release tag (e.g. "v0.2.13"). Null when version lookup failed —+ * in that case CTAs are already disabled, no tracking fires. */+ version: string | null;+}++/**+ * Top CTA section. Server-renders a generic "Choose your platform"+ * placeholder (SEO + flash-before-hydration), then swaps to a+ * platform-specific CTA once the client detection resolves.+ */+export function DownloadHero({+ detected,+ assets,+ versionUnavailable,+ version,+}: Props) {+ const { t } = useLocale();+ const d = t.download.hero;++ const content = resolveContent(detected, assets, versionUnavailable, d);++ // Fires download_initiated on primary CTA click. `primary_cta: true`+ // identifies the hero-recommended path; `matched_detect: true` is+ // always true here by construction (the primary is computed from+ // the detect result). All Platforms rows below emit with+ // matched_detect=false when the user overrides.+ const onPrimaryClick = (tracking: HeroTracking | undefined) => {+ if (!tracking || !version) return;+ captureDownloadInitiated({+ ...tracking,+ version,+ primary_cta: true,+ matched_detect: true,+ });+ };++ return (+ <section className="relative overflow-hidden bg-[#05070b] text-white">+ <BackdropGradient />+ <div className="relative z-10 mx-auto max-w-[1120px] px-4 pb-24 pt-32 text-center sm:px-6 sm:pt-40 lg:px-8 lg:pb-28">+ <h1 className="mx-auto max-w-[880px] font-[family-name:var(--font-serif)] text-[3rem] leading-[1.02] tracking-[-0.035em] drop-shadow-[0_10px_34px_rgba(0,0,0,0.32)] sm:text-[4rem] lg:text-[5rem]">+ {content.title}+ </h1>+ <p className="mx-auto mt-6 max-w-[620px] text-[15px] leading-7 text-white/84 sm:text-[17px]">+ {content.sub}+ </p>++ <div className="mt-10 flex flex-wrap items-center justify-center gap-3">+ {content.primary ? (+ <PrimaryCta+ href={content.primary.href}+ disabled={content.primary.disabled}+ onClick={() => onPrimaryClick(content.primary?.tracking)}+ >+ <Download className="size-4" aria-hidden />+ {content.primary.label}+ {!content.primary.disabled && (+ <ArrowRight className="size-4" aria-hidden />+ )}+ </PrimaryCta>+ ) : null}+ {content.alt ? (+ <Link+ href={content.alt.href}+ className={heroButtonClassName("ghost")}+ onClick={() => onPrimaryClick(content.alt?.tracking)}+ >+ {content.alt.label}+ </Link>+ ) : null}+ </div>++ {content.hint ? (+ <p className="mx-auto mt-5 max-w-[520px] text-[13px] text-white/64">+ {content.hint}+ </p>+ ) : null}++ {versionUnavailable ? (+ <p className="mx-auto mt-6 max-w-[520px] text-[12px] uppercase tracking-[0.14em] text-white/50">+ {t.download.footer.versionUnavailable}+ </p>+ ) : null}+ </div>+ </section>+ );+}++// ------------------------------------------------------------+// Content resolver — maps (detect, assets) → CTA props+// ------------------------------------------------------------++type HeroTracking = Pick<+ DownloadInitiatedPayload,+ "platform" | "arch" | "format"+>;++interface HeroContent {+ title: string;+ sub: string;+ primary?: {+ href: string;+ label: string;+ disabled: boolean;+ tracking?: HeroTracking;+ };+ alt?: { href: string; label: string; tracking?: HeroTracking };+ hint?: string;+}++type HeroDict = ReturnType<typeof useLocale>["t"]["download"]["hero"];++function resolveContent(+ detected: DetectResult | null,+ assets: DownloadAssets,+ versionUnavailable: boolean,+ d: HeroDict,+): HeroContent {+ // Before hydration resolves, render a neutral prompt. Same copy+ // also catches `os === "unknown"`.+ if (!detected || detected.os === "unknown") {+ return { title: d.unknown.title, sub: d.unknown.sub };+ }++ if (detected.os === "mac") {+ // Only Chromium high-entropy returns arch confidently. Safari+ // always reports Intel even on Apple Silicon, so we treat+ // "non-confident" as arm64 + add a small Intel disclaimer.+ if (detected.arch === "x64" && detected.archConfident) {+ return {+ title: d.macIntel.title,+ sub: d.macIntel.sub,+ primary: {+ href: "#cli",+ label: d.macIntel.disabledCta,+ disabled: true,+ },+ hint: d.macIntel.intelHint,+ };+ }+ const dmg = assets.macArm64Dmg;+ const zip = assets.macArm64Zip;+ return {+ title: d.macArm64.title,+ sub: d.macArm64.sub,+ primary: dmg+ ? {+ href: dmg,+ label: d.macArm64.primary,+ disabled: false,+ tracking: { platform: "mac", arch: "arm64", format: "dmg" },+ }+ : versionUnavailable+ ? { href: "#", label: d.macArm64.primary, disabled: true }+ : undefined,+ alt: zip+ ? {+ href: zip,+ label: d.macArm64.altZip,+ tracking: { platform: "mac", arch: "arm64", format: "zip" },+ }+ : undefined,+ hint: detected.archConfident ? undefined : d.safariMacHint,+ };+ }++ if (detected.os === "windows") {+ // Trust arch whenever the UA hints at it (even non-confident);+ // Windows-on-ARM can still run x64 via emulation so this is low+ // risk either way. Surface the arch-fallback hint when we're+ // guessing so users on uncommon setups know to scroll down.+ const isArm = detected.arch === "arm64";+ const copy = isArm ? d.winArm64 : d.winX64;+ const url = isArm ? assets.winArm64Exe : assets.winX64Exe;+ return {+ title: copy.title,+ sub: copy.sub,+ primary: url+ ? {+ href: url,+ label: copy.primary,+ disabled: false,+ tracking: {+ platform: "windows",+ arch: isArm ? "arm64" : "x64",+ format: "exe",+ },+ }+ : versionUnavailable+ ? { href: "#", label: copy.primary, disabled: true }+ : undefined,+ hint: detected.archConfident ? undefined : d.archFallbackHint,+ };+ }++ // Linux — same principle: trust the arm64 signal, surface a hint+ // when we're not confident. Linux ARM has no binary emulation so+ // the hint matters more here than on Windows.+ const isArmLinux = detected.arch === "arm64";+ const primaryUrl = isArmLinux+ ? assets.linuxArm64AppImage+ : assets.linuxAmd64AppImage;+ return {+ title: d.linux.title,+ sub: d.linux.sub,+ primary: primaryUrl+ ? {+ href: primaryUrl,+ label: d.linux.primary,+ disabled: false,+ tracking: {+ platform: "linux",+ arch: isArmLinux ? "arm64" : "x64",+ format: "appimage",+ },+ }+ : versionUnavailable+ ? { href: "#", label: d.linux.primary, disabled: true }+ : undefined,+ alt: { href: "#all-platforms", label: d.linux.altFormats },+ hint: detected.archConfident ? undefined : d.archFallbackHint,+ };+}++// ------------------------------------------------------------+// Pieces+// ------------------------------------------------------------++function PrimaryCta({+ href,+ disabled,+ onClick,+ children,+}: {+ href: string;+ disabled: boolean;+ onClick?: () => void;+ children: React.ReactNode;+}) {+ if (disabled) {+ return (+ <span+ aria-disabled="true"+ className="inline-flex cursor-not-allowed items-center justify-center gap-2 rounded-[12px] border border-white/15 bg-white/8 px-5 py-3 text-[14px] font-semibold text-white/60"+ >+ {children}+ </span>+ );+ }+ return (+ <a href={href} onClick={onClick} className={heroButtonClassName("solid")}>+ {children}+ </a>+ );+}++function BackdropGradient() {+ return (+ <div+ aria-hidden+ className="pointer-events-none absolute inset-0"+ style={{+ background:+ "radial-gradient(ellipse 70% 50% at 50% 0%, rgba(80,120,255,0.18), transparent 60%), radial-gradient(ellipse 50% 40% at 50% 80%, rgba(255,90,90,0.08), transparent 60%)",+ }}+ />+ );+}diff --git a/apps/web/features/landing/components/download/os-icons.tsx b/apps/web/features/landing/components/download/os-icons.tsxnew file mode 100644index 0000000000..0f02e00a7a--- /dev/null+++ b/apps/web/features/landing/components/download/os-icons.tsx@@ -0,0 +1,54 @@+/**+ * Inline SVG marks for macOS / Windows / Linux.+ * Lucide lacks real Apple / Tux marks, and the download page needs+ * the recognizable brand glyphs next to platform rows. Kept as+ * minimal monochrome outlines so they inherit currentColor.+ */++type IconProps = React.SVGProps<SVGSVGElement> & { size?: number };++export function AppleIcon({ size = 18, ...props }: IconProps) {+ return (+ <svg+ viewBox="0 0 24 24"+ width={size}+ height={size}+ fill="currentColor"+ aria-hidden+ {...props}+ >+ <path d="M16.37 12.8c.02-1.9 1.56-2.83 1.63-2.87-.89-1.3-2.28-1.48-2.77-1.5-1.18-.12-2.3.69-2.9.69-.6 0-1.52-.68-2.5-.66-1.28.02-2.47.74-3.13 1.88-1.33 2.3-.34 5.7.96 7.57.63.92 1.38 1.94 2.36 1.9.95-.04 1.31-.61 2.45-.61 1.14 0 1.47.61 2.47.59 1.02-.02 1.66-.93 2.29-1.84.72-1.06 1.02-2.1 1.04-2.15-.02-.01-2-.77-2.02-3.05-.02-1.9 1.55-2.81 1.63-2.87zm-2.05-5.24c.52-.63.88-1.52.78-2.4-.75.03-1.66.5-2.2 1.12-.48.55-.9 1.44-.79 2.32.84.06 1.69-.42 2.21-1.04z" />+ </svg>+ );+}++export function WindowsIcon({ size = 18, ...props }: IconProps) {+ return (+ <svg+ viewBox="0 0 24 24"+ width={size}+ height={size}+ fill="currentColor"+ aria-hidden+ {...props}+ >+ <path d="M3 5.5 10.5 4.5v6.75H3V5.5Zm0 7.25h7.5v6.75L3 18.5v-5.75Zm8.75-8.4L21 3v9H11.75V4.35ZM11.75 12h9.25v9L11.75 19.65V12Z" />+ </svg>+ );+}++export function LinuxIcon({ size = 18, ...props }: IconProps) {+ // Simplified Tux silhouette — round head + body.+ return (+ <svg+ viewBox="0 0 24 24"+ width={size}+ height={size}+ fill="currentColor"+ aria-hidden+ {...props}+ >+ <path d="M12 2c-2.4 0-4 1.9-4 4.6 0 1.2.3 2.3.8 3.2-.7.7-1.3 1.8-1.6 3-.4 1.4-.7 3.3-1.8 4.4-.6.6-1 .9-1 1.6 0 .9.8 1.3 2 1.6 1.5.3 2.6.1 3.6-.3.6-.2 1.3-.4 2-.4s1.4.2 2 .4c1 .4 2.1.6 3.6.3 1.2-.3 2-.7 2-1.6 0-.7-.4-1-1-1.6-1.1-1.1-1.4-3-1.8-4.4-.3-1.2-.9-2.3-1.6-3 .5-.9.8-2 .8-3.2 0-2.7-1.6-4.6-4-4.6Zm-1.5 5.2c.3 0 .5.3.5.8s-.2.8-.5.8-.5-.3-.5-.8.2-.8.5-.8Zm3 0c.3 0 .5.3.5.8s-.2.8-.5.8-.5-.3-.5-.8.2-.8.5-.8Zm-3 2.6c.7.5 1.5.8 1.5.8s.8-.3 1.5-.8c0 .6-.7 1-1.5 1s-1.5-.4-1.5-1Z" />+ </svg>+ );+}diff --git a/apps/web/features/landing/components/landing-footer.tsx b/apps/web/features/landing/components/landing-footer.tsxindex 003c1d7cd7..eb18d2476a 100644--- a/apps/web/features/landing/components/landing-footer.tsx+++ b/apps/web/features/landing/components/landing-footer.tsx@@ -4,6 +4,7 @@ import Link from "next/link";import { MulticaIcon } from "@multica/ui/components/common/multica-icon";import { cn } from "@multica/ui/lib/utils";import { useAuthStore } from "@multica/core/auth";+import { captureDownloadIntent } from "@multica/core/analytics";import { XMark, GitHubMark, githubUrl, twitterUrl } from "./shared";import { useLocale, locales, localeLabels } from "../i18n";@@ -71,6 +72,11 @@ export function LandingFooter() {{...(link.href.startsWith("http")? { target: "_blank", rel: "noreferrer" }: {})}+ onClick={+ link.href === "/download"+ ? () => captureDownloadIntent("landing_footer")+ : undefined+ }className="text-[14px] text-white/50 transition-colors hover:text-white">{link.label}diff --git a/apps/web/features/landing/components/landing-hero.tsx b/apps/web/features/landing/components/landing-hero.tsxindex 70d83e2574..03447bf81a 100644--- a/apps/web/features/landing/components/landing-hero.tsx+++ b/apps/web/features/landing/components/landing-hero.tsx@@ -2,7 +2,9 @@import Image from "next/image";import Link from "next/link";+import { Download } from "lucide-react";import { useAuthStore } from "@multica/core/auth";+import { captureDownloadIntent } from "@multica/core/analytics";import { useLocale } from "../i18n";import {ClaudeCodeLogo,@@ -42,25 +44,11 @@ export function LandingHero() {{user ? t.header.dashboard : t.hero.cta}</Link><Link- href="https://github.com/multica-ai/multica/releases/latest"- target="_blank"- rel="noreferrer"+ href="/download"className={heroButtonClassName("ghost")}+ onClick={() => captureDownloadIntent("landing_hero")}>- <svg- viewBox="0 0 24 24"- fill="none"- stroke="currentColor"- strokeWidth="2"- strokeLinecap="round"- strokeLinejoin="round"- className="size-4"- aria-hidden="true"- >- <rect x="2" y="3" width="20" height="14" rx="2" ry="2" />- <line x1="8" y1="21" x2="16" y2="21" />- <line x1="12" y1="17" x2="12" y2="21" />- </svg>+ <Download className="size-4" aria-hidden />{t.hero.downloadDesktop}</Link></div>diff --git a/apps/web/features/landing/i18n/en.ts b/apps/web/features/landing/i18n/en.tsindex 878516c40a..56880eb133 100644--- a/apps/web/features/landing/i18n/en.ts+++ b/apps/web/features/landing/i18n/en.ts@@ -226,7 +226,7 @@ export function createEnDict(allowSignup: boolean): LandingDict {{ label: "Features", href: "#features" },{ label: "How it Works", href: "#how-it-works" },{ label: "Changelog", href: "/changelog" },- { label: "Desktop", href: "https://github.com/multica-ai/multica/releases/latest" },+ { label: "Download", href: "/download" },],},resources: {@@ -725,5 +725,80 @@ export function createEnDict(allowSignup: boolean): LandingDict {},],},+ download: {+ hero: {+ macArm64: {+ title: "Multica for macOS",+ sub: "Apple Silicon · bundled daemon, zero setup",+ primary: "Download (.dmg)",+ altZip: "or download .zip",+ },+ macIntel: {+ title: "Multica for macOS",+ sub: "Apple Silicon required — Intel Macs not yet supported.",+ disabledCta: "Apple Silicon required",+ intelHint:+ "On an Intel Mac? Use the CLI below — it runs the same daemon.",+ },+ winX64: {+ title: "Multica for Windows",+ sub: "Bundled daemon, zero setup",+ primary: "Download (.exe)",+ },+ winArm64: {+ title: "Multica for Windows",+ sub: "ARM · bundled daemon, zero setup",+ primary: "Download (.exe)",+ },+ linux: {+ title: "Multica for Linux",+ sub: "Bundled daemon, zero setup",+ primary: "Download AppImage",+ altFormats: "or .deb / .rpm",+ },+ unknown: {+ title: "Choose your platform",+ sub: "All installers are listed below.",+ },+ safariMacHint: "On an Intel Mac? Use the CLI below.",+ archFallbackHint: "Wrong architecture? See all formats below.",+ },+ allPlatforms: {+ title: "All platforms",+ macLabel: "macOS · Apple Silicon",+ winX64Label: "Windows · x64",+ winArm64Label: "Windows · ARM64",+ linuxX64Label: "Linux · x64",+ linuxArm64Label: "Linux · ARM64",+ formatDmg: ".dmg",+ formatZip: ".zip",+ formatExe: ".exe",+ formatAppImage: ".AppImage",+ formatDeb: ".deb",+ formatRpm: ".rpm",+ intelNote:+ "Apple Silicon only — Intel Macs not supported in this release.",+ unavailable: "Not available",+ },+ cli: {+ title: "Prefer the CLI?",+ sub: "For servers, remote dev boxes, and headless setups. Same daemon as Desktop, installed via terminal.",+ installLabel: "Install",+ startLabel: "Start daemon",+ sshNote: "Already on a server? Same commands work over SSH.",+ copyLabel: "Copy",+ copiedLabel: "Copied",+ },+ cloud: {+ title: "Cloud runtime (waitlist)",+ sub: "We’ll host the runtime for you. Not live yet — leave your email to be notified.",+ },+ footer: {+ releaseNotes: "What’s new in {version}",+ allReleases: "View all releases",+ currentVersion: "Current version: {version}",+ versionUnavailable: "Version unavailable — check GitHub",+ },+ },};}diff --git a/apps/web/features/landing/i18n/types.ts b/apps/web/features/landing/i18n/types.tsindex 424e193cd8..3619278982 100644--- a/apps/web/features/landing/i18n/types.ts+++ b/apps/web/features/landing/i18n/types.ts@@ -101,4 +101,63 @@ export type LandingDict = {fixes?: string[];}[];};+ download: {+ hero: {+ macArm64: {+ title: string;+ sub: string;+ primary: string;+ altZip: string;+ };+ macIntel: {+ title: string;+ sub: string;+ disabledCta: string;+ intelHint: string;+ };+ winX64: { title: string; sub: string; primary: string };+ winArm64: { title: string; sub: string; primary: string };+ linux: {+ title: string;+ sub: string;+ primary: string;+ altFormats: string;+ };+ unknown: { title: string; sub: string };+ safariMacHint: string;+ archFallbackHint: string;+ };+ allPlatforms: {+ title: string;+ macLabel: string;+ winX64Label: string;+ winArm64Label: string;+ linuxX64Label: string;+ linuxArm64Label: string;+ formatDmg: string;+ formatZip: string;+ formatExe: string;+ formatAppImage: string;+ formatDeb: string;+ formatRpm: string;+ intelNote: string;+ unavailable: string;+ };+ cli: {+ title: string;+ sub: string;+ installLabel: string;+ startLabel: string;+ sshNote: string;+ copyLabel: string;+ copiedLabel: string;+ };+ cloud: { title: string; sub: string };+ footer: {+ releaseNotes: string;+ allReleases: string;+ currentVersion: string;+ versionUnavailable: string;+ };+ };};diff --git a/apps/web/features/landing/i18n/zh.ts b/apps/web/features/landing/i18n/zh.tsindex c1c25065df..2b5dd7e4cb 100644--- a/apps/web/features/landing/i18n/zh.ts+++ b/apps/web/features/landing/i18n/zh.ts@@ -226,7 +226,7 @@ export function createZhDict(allowSignup: boolean): LandingDict {{ label: "\u529f\u80fd\u7279\u6027", href: "#features" },{ label: "\u5982\u4f55\u5de5\u4f5c", href: "#how-it-works" },{ label: "更新日志", href: "/changelog" },- { label: "桌面端", href: "https://github.com/multica-ai/multica/releases/latest" },+ { label: "下载", href: "/download" },],},resources: {@@ -725,5 +725,78 @@ export function createZhDict(allowSignup: boolean): LandingDict {},],},+ download: {+ hero: {+ macArm64: {+ title: "Multica for macOS",+ sub: "Apple Silicon · 内置 daemon,无需配置",+ primary: "下载 (.dmg)",+ altZip: "或下载 .zip",+ },+ macIntel: {+ title: "Multica for macOS",+ sub: "需要 Apple Silicon——暂不支持 Intel Mac。",+ disabledCta: "需要 Apple Silicon",+ intelHint: "在 Intel Mac 上?请使用下方 CLI——底层跑的是同一个 daemon。",+ },+ winX64: {+ title: "Multica for Windows",+ sub: "内置 daemon,无需配置",+ primary: "下载 (.exe)",+ },+ winArm64: {+ title: "Multica for Windows",+ sub: "ARM · 内置 daemon,无需配置",+ primary: "下载 (.exe)",+ },+ linux: {+ title: "Multica for Linux",+ sub: "内置 daemon,无需配置",+ primary: "下载 AppImage",+ altFormats: "或 .deb / .rpm",+ },+ unknown: {+ title: "选择你的平台",+ sub: "下方是所有支持的安装包。",+ },+ safariMacHint: "在 Intel Mac 上?请使用下方 CLI。",+ archFallbackHint: "架构不对?下方是所有可选格式。",+ },+ allPlatforms: {+ title: "所有平台",+ macLabel: "macOS · Apple Silicon",+ winX64Label: "Windows · x64",+ winArm64Label: "Windows · ARM64",+ linuxX64Label: "Linux · x64",+ linuxArm64Label: "Linux · ARM64",+ formatDmg: ".dmg",+ formatZip: ".zip",+ formatExe: ".exe",+ formatAppImage: ".AppImage",+ formatDeb: ".deb",+ formatRpm: ".rpm",+ intelNote: "仅支持 Apple Silicon——Intel Mac 目前暂不支持。",+ unavailable: "暂不可用",+ },+ cli: {+ title: "想用 CLI?",+ sub: "适合服务器、远程开发机、无图形界面环境。底层 daemon 与 Desktop 相同,通过终端安装。",+ installLabel: "安装",+ startLabel: "启动 daemon",+ sshNote: "已经在服务器上?通过 SSH 执行同样的命令即可。",+ copyLabel: "复制",+ copiedLabel: "已复制",+ },+ cloud: {+ title: "Cloud runtime(等待名单)",+ sub: "我们将为你托管 runtime,目前尚未上线——留下邮箱,上线后通知你。",+ },+ footer: {+ releaseNotes: "v{version} 更新内容",+ allReleases: "查看所有版本",+ currentVersion: "当前版本:{version}",+ versionUnavailable: "版本获取失败——请前往 GitHub 查看",+ },+ },};}diff --git a/apps/web/features/landing/utils/github-release.ts b/apps/web/features/landing/utils/github-release.tsnew file mode 100644index 0000000000..d225e12a2b--- /dev/null+++ b/apps/web/features/landing/utils/github-release.ts@@ -0,0 +1,76 @@+import {+ parseReleaseAssets,+ type DownloadAssets,+} from "./parse-release-assets";++/**+ * Server-side fetcher for the latest Multica release, designed to+ * run inside a Next.js server component. Response is cached by the+ * Next.js fetch cache for 5 minutes (Vercel ISR) so hitting /download+ * costs at most one GitHub API call per region per 5 minutes.+ *+ * On any failure (network, rate limit, malformed payload) returns a+ * `null`-shaped result and logs — the page degrades to a "version+ * unavailable" view rather than 500ing.+ */++export interface LatestRelease {+ version: string | null;+ publishedAt: string | null;+ htmlUrl: string | null;+ assets: DownloadAssets;+}++const GITHUB_LATEST_URL =+ "https://api.github.com/repos/multica-ai/multica/releases/latest";++const REVALIDATE_SECONDS = 300;++interface GitHubReleasePayload {+ tag_name?: string;+ published_at?: string;+ html_url?: string;+ assets?: Array<{ name: string; browser_download_url: string }>;+}++export async function fetchLatestRelease(): Promise<LatestRelease> {+ const headers: Record<string, string> = {+ Accept: "application/vnd.github+json",+ "X-GitHub-Api-Version": "2022-11-28",+ };+ // Optional PAT for local development and self-hosted deploys where+ // the shared outbound IP keeps hitting the 60-requests/hour+ // unauthenticated limit. Vercel's fetch cache is shared across all+ // regions so production rarely needs this — but the env var lets+ // anyone running the site locally avoid the rate-limit dance. Never+ // prefix this with `NEXT_PUBLIC_`; the token must stay server-side.+ const token = process.env.GITHUB_TOKEN;+ if (token) {+ headers.Authorization = `Bearer ${token}`;+ }++ try {+ const res = await fetch(GITHUB_LATEST_URL, {+ next: { revalidate: REVALIDATE_SECONDS },+ headers,+ });+ if (!res.ok) {+ throw new Error(`GitHub API responded ${res.status}`);+ }+ const data = (await res.json()) as GitHubReleasePayload;+ return {+ version: data.tag_name ?? null,+ publishedAt: data.published_at ?? null,+ htmlUrl: data.html_url ?? null,+ assets: parseReleaseAssets(data.assets ?? []),+ };+ } catch (err) {+ console.warn("[download] fetchLatestRelease failed:", err);+ return {+ version: null,+ publishedAt: null,+ htmlUrl: null,+ assets: {},+ };+ }+}diff --git a/apps/web/features/landing/utils/os-detect.ts b/apps/web/features/landing/utils/os-detect.tsnew file mode 100644index 0000000000..4d7e35679b--- /dev/null+++ b/apps/web/features/landing/utils/os-detect.ts@@ -0,0 +1,97 @@+/**+ * Client-side OS + architecture detection for the /download page.+ *+ * Prefers the modern `navigator.userAgentData.getHighEntropyValues`+ * API (Chromium), falling back to the UA string.+ *+ * Known limitation: Safari on macOS always reports `Intel Mac OS X`+ * in the UA string even on Apple Silicon, and Safari does not+ * implement userAgentData. This function therefore returns `arm64`+ * as the best default for any Mac — UI surfaces a small "On Intel+ * Mac? Use CLI." hint to cover the Intel minority.+ */++export type OSName = "mac" | "windows" | "linux" | "unknown";+export type Arch = "arm64" | "x64" | "unknown";++export interface DetectResult {+ os: OSName;+ arch: Arch;+ /** True when arch came from userAgentData high-entropy values+ * (i.e. we can trust the Intel vs arm distinction). False when+ * we defaulted — UI should show the Intel Mac disclaimer. */+ archConfident: boolean;+}++interface UADataRecord {+ platform: string;+ architecture: string;+}++interface UserAgentDataLike {+ getHighEntropyValues?: (hints: string[]) => Promise<UADataRecord>;+}++function normalizePlatform(raw: string): OSName {+ const p = raw.toLowerCase();+ if (p.includes("mac") || p === "darwin") return "mac";+ if (p.includes("win")) return "windows";+ if (p.includes("linux")) return "linux";+ return "unknown";+}++function normalizeArch(raw: string): Arch {+ const a = raw.toLowerCase();+ if (a === "arm" || a === "arm64" || a === "aarch64") return "arm64";+ if (a === "x86" || a === "x86_64" || a === "amd64" || a === "x64") return "x64";+ return "unknown";+}++export async function detectOS(): Promise<DetectResult> {+ if (typeof navigator === "undefined") {+ return { os: "unknown", arch: "unknown", archConfident: false };+ }++ // Modern Chromium: userAgentData with high-entropy values gives+ // both the platform name and CPU architecture unambiguously.+ const uaData = (navigator as unknown as { userAgentData?: UserAgentDataLike })+ .userAgentData;+ if (uaData?.getHighEntropyValues) {+ try {+ const data = await uaData.getHighEntropyValues([+ "platform",+ "architecture",+ ]);+ const os = normalizePlatform(data.platform);+ const arch = normalizeArch(data.architecture);+ return { os, arch, archConfident: arch !== "unknown" };+ } catch {+ // Some browsers expose the API but reject high-entropy requests.+ }+ }++ // Fallback: UA + navigator.platform. Safari on Mac lands here and+ // cannot distinguish Apple Silicon from Intel.+ const ua = navigator.userAgent;+ const platform = navigator.platform || "";++ const os: OSName = /Mac|iPhone|iPad|iPod/i.test(platform) || /Mac OS X/i.test(ua)+ ? "mac"+ : /Win/i.test(platform) || /Windows/i.test(ua)+ ? "windows"+ : /Linux/i.test(platform) || /Linux/i.test(ua)+ ? "linux"+ : "unknown";++ let arch: Arch = "unknown";+ if (os === "mac") {+ // Best default. Real Intel Mac users will see the disclaimer.+ arch = "arm64";+ } else if (/arm|aarch/i.test(ua)) {+ arch = "arm64";+ } else if (os !== "unknown") {+ arch = "x64";+ }++ return { os, arch, archConfident: false };+}diff --git a/apps/web/features/landing/utils/parse-release-assets.ts b/apps/web/features/landing/utils/parse-release-assets.tsnew file mode 100644index 0000000000..8579e2f04b--- /dev/null+++ b/apps/web/features/landing/utils/parse-release-assets.ts@@ -0,0 +1,94 @@+/**+ * Parses the GitHub Releases API asset array into a structured+ * download asset map. Skips auxiliary files (blockmaps, update+ * manifests, checksums) and the CLI tarballs — only desktop+ * installer artifacts are relevant on the /download page.+ *+ * Desktop artifact naming (see apps/desktop/electron-builder.yml):+ * multica-desktop-{version}-mac-{arch}.{dmg|zip}+ * multica-desktop-{version}-windows-{arch}.exe+ * multica-desktop-{version}-linux-{arch}.{AppImage|deb|rpm}+ *+ * Linux arch appears as amd64 / x86_64 / arm64 / aarch64 depending+ * on the format; we normalize to amd64 and arm64.+ */++export interface GitHubAsset {+ name: string;+ browser_download_url: string;+}++export interface DownloadAssets {+ macArm64Dmg?: string;+ macArm64Zip?: string;+ winX64Exe?: string;+ winArm64Exe?: string;+ linuxAmd64AppImage?: string;+ linuxAmd64Deb?: string;+ linuxAmd64Rpm?: string;+ linuxArm64AppImage?: string;+ linuxArm64Deb?: string;+ linuxArm64Rpm?: string;+}++const DESKTOP_ARTIFACT_RE =+ /^multica-desktop-[^-]+-(mac|windows|linux)-([a-z0-9_]+)\.(dmg|zip|exe|AppImage|deb|rpm)$/i;++function normalizeLinuxArch(arch: string): "amd64" | "arm64" | null {+ const a = arch.toLowerCase();+ if (a === "amd64" || a === "x86_64") return "amd64";+ if (a === "arm64" || a === "aarch64") return "arm64";+ return null;+}++export function parseReleaseAssets(raw: GitHubAsset[]): DownloadAssets {+ const out: DownloadAssets = {};+ for (const asset of raw) {+ const name = asset.name;+ // Skip auxiliary files that share the release (update manifests,+ // blockmaps, checksums). CLI tarballs and other non-desktop+ // artifacts are excluded automatically because they don't match+ // DESKTOP_ARTIFACT_RE below.+ if (name.endsWith(".blockmap") || name.endsWith(".yml")) continue;+ if (name.startsWith("checksums")) continue;++ const match = DESKTOP_ARTIFACT_RE.exec(name);+ if (!match) continue;+ const platform = match[1];+ const arch = match[2];+ const ext = match[3];+ if (!platform || !arch || !ext) continue;+ const archLower = arch.toLowerCase();+ const extLower = ext.toLowerCase();+ const url = asset.browser_download_url;++ if (platform === "mac") {+ if (archLower !== "arm64") continue; // we only ship arm64 today+ if (extLower === "dmg") out.macArm64Dmg = url;+ else if (extLower === "zip") out.macArm64Zip = url;+ } else if (platform === "windows") {+ if (extLower !== "exe") continue;+ if (archLower === "x64") out.winX64Exe = url;+ else if (archLower === "arm64") out.winArm64Exe = url;+ } else if (platform === "linux") {+ const normalized = normalizeLinuxArch(arch);+ if (!normalized) continue;+ const e = extLower;+ if (normalized === "amd64") {+ if (e === "appimage") out.linuxAmd64AppImage = url;+ else if (e === "deb") out.linuxAmd64Deb = url;+ else if (e === "rpm") out.linuxAmd64Rpm = url;+ } else {+ if (e === "appimage") out.linuxArm64AppImage = url;+ else if (e === "deb") out.linuxArm64Deb = url;+ else if (e === "rpm") out.linuxArm64Rpm = url;+ }+ }+ }+ return out;+}++/** Whether any desktop asset was parsed out. Used for UI degradation. */+export function hasAnyAsset(assets: DownloadAssets): boolean {+ return Object.values(assets).some((v) => typeof v === "string");+}diff --git a/apps/web/next-env.d.ts b/apps/web/next-env.d.tsindex c4b7818fbb..9edff1c7ca 100644--- a/apps/web/next-env.d.ts+++ b/apps/web/next-env.d.ts@@ -1,6 +1,6 @@/// <reference types="next" />/// <reference types="next/image-types/global" />-import "./.next/dev/types/routes.d.ts";+import "./.next/types/routes.d.ts";// NOTE: This file should not be edited// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.diff --git a/docs/analytics.md b/docs/analytics.mdindex 99cc19d33f..c49ff09296 100644--- a/docs/analytics.md+++ b/docs/analytics.md@@ -296,10 +296,53 @@ request payload.`packages/views/onboarding/steps/step-platform-fork.tsx` when the webuser clicks one of the three Step 3 fork cards (before any servercall happens, so it's frontend-only). Properties: `path`- (`download_desktop` / `cli` / `cloud_waitlist`), `is_mac`. Also- writes `platform_preference` (`web` / `desktop`) to person properties- so every subsequent event on the user can be broken down by chosen- platform.+ (`download_desktop` / `cli` / `cloud_waitlist`), `source` (`step3`;+ literal today but reserved for future surfaces reusing this event),+ `is_mac`. Also writes `platform_preference` (`web` / `desktop`) to+ person properties so every subsequent event on the user can be+ broken down by chosen platform. **Note**: semantic "download+ intent" is now better served by `download_intent_expressed` below —+ `path: "download_desktop"` signals Step 3 path choice specifically,+ not actual download start.++- `download_intent_expressed` — fired whenever a user clicks a CTA+ that points at the `/download` page. Surfaces five sources across+ the funnel, letting the top-of-funnel entry be split cleanly.+ Wrapper lives in `packages/core/analytics/download.ts`+ (`captureDownloadIntent`). Properties:+ - `source`: `landing_hero` / `landing_footer` / `login` / `welcome`+ / `step3`+ Also writes `platform_preference: "desktop"` to person properties.++- `download_page_viewed` — fired once per `/download` mount after OS+ detect resolves (`apps/web/app/(landing)/download/download-client.tsx`).+ Properties:+ - `detected_os`: `mac` / `windows` / `linux` / `unknown`+ - `detected_arch`: `arm64` / `x64` / `unknown`+ - `detect_confident`: `true` when detect used+ `userAgentData.getHighEntropyValues` (Chromium); `false` when it+ fell back to the UA string (Safari on Mac always lands here —+ lets us isolate the arm64-default-for-Intel risk cohort).+ - `version_available`: `false` when the GitHub API fetch failed+ and the page is in the "Version unavailable" degraded state.+ Also writes `first_detected_os` / `first_detected_arch` via+ `$set_once` so every downstream event gains a platform dimension+ without re-emitting.++- `download_initiated` — fired when the user clicks a specific+ installer link on `/download`. Both the hero CTA and the All+ Platforms matrix rows emit this; split by `primary_cta`.+ Properties:+ - `platform`: `mac` / `windows` / `linux`+ - `arch`: `arm64` / `x64`+ - `format`: `dmg` / `zip` / `exe` / `appimage` / `deb` / `rpm`+ - `version`: release tag (e.g. `v0.2.13`) — correlates adoption+ with release cadence.+ - `primary_cta`: `true` for the hero-recommended installer, `false`+ for a manual pick from the All Platforms matrix.+ - `matched_detect`: `true` when the chosen platform+arch matches+ what the page detected. `false` lets us quantify detect misses+ from the single event (no cross-join needed).- Attribution is NOT a separate event; UTM + referrer origin are writtento the `multica_signup_source` cookie on the first anonymous pageviewand read by the backend's `signup` emission. The cookie carries a JSONdiff --git a/docs/download-positioning.md b/docs/download-positioning.mdnew file mode 100644index 0000000000..c188b52d06--- /dev/null+++ b/docs/download-positioning.md@@ -0,0 +1,509 @@+# Desktop 下载体系 — 文案定位(Step 1 产出)++**目的**:为 `/download` 页面、onboarding、login、landing 所有 Desktop/CLI/Cloud 相关触点提供**唯一文案真相源**。后续 Step 2/3/4 实现时,UI 层只从这里拿文案,不临时发明。++**双语策略**:遵循当前项目 i18n 现状——+- **Landing / `/download` / Web Login**:i18n 双语(en + zh),接入 `apps/web/features/landing/i18n/`+- **Onboarding(共享 views 包)**:保持英文单语(当前现状,i18n 基建本次不引入)++---++## 一、三个 surface 的核心定位句++写 UI 时所有文案都派生自这三句。每一句都**以场景开头**,不以能力比较开头。++| Surface | EN | ZH |+|---|---|---|+| **Desktop** | Install the app. Agents run on your machine. | 下载桌面应用,agent 在你的电脑上运行。 |+| **CLI** | For servers, remote dev boxes, and automation. | 适合服务器、远程开发机、自动化场景。 |+| **Cloud** | We host the runtime. No local install. | 我们为你托管 runtime,无需本地安装。 |++### 一句话决策树(用户视角)++- "我就是想在自己电脑上用" → Desktop+- "我想让 agent 跑在我的服务器 / 远程机器上" → CLI+- "我一点都不想装东西" → Cloud(目前是 waitlist)++---++## 二、文案设计原则++| 原则 | 理由 | 例子 |+|---|---|---|+| 场景先于能力 | Desktop 和 CLI 运行后能力等价,差异在 setup moment 和使用场景 | ✅ "For servers and remote boxes" / ❌ "Lighter-weight Desktop" |+| 避免"easy / simple / just" | 这些是 claim,用户不信;且会和现实冲突(CLI 的 `multica setup` 实际 10-30s) | ✅ "Terminal setup" / ❌ "Just one command" |+| 诚实时间估计 | Welcome 当前 "Takes about 3 minutes" 对 web 用户是谎 | ✅ 差异化文案或去掉时间 |+| 第二人称 + 直接语气 | 和 Linear / Cursor 一致 | ✅ "Agents run on your Mac." / ❌ "Our runtime operates locally." |+| 不夸"强大"/"智能" | 现代用户免疫 marketing 形容词 | ✅ "Agents pick up tasks." / ❌ "Powerful AI agents tackle your work." |++---++## 三、触点文案对照表++### 3.1 Landing Hero(web only)++**位置**:`apps/web/features/landing/components/landing-hero.tsx:44-65` + `landing/i18n/en.ts:19` + `zh.ts:19`++**当前**:+- EN: `"Download Desktop"` (ghost 按钮)+- ZH: `"下载桌面端"` (ghost 按钮)+- href: `https://github.com/multica-ai/multica/releases/latest`++**新**:+- EN: `"Download Desktop"` ← 文案不变,**视觉升级为 primary/solid** + **href 改为 `/download`**+- ZH: `"下载桌面端"` ← 同上+- i18n key:复用现有 `hero.downloadDesktop`,**不新增 key**++**理由**:+- 文案已经合适+- 改动只在视觉权重(ghost → solid)和链接目标(GitHub releases → `/download`)+- href 变更落在 `landing-hero.tsx:45` 的 hardcoded URL——改成相对路径 `/download`++---++### 3.2 Landing Nav / Footer(web only)++**位置**:`landing/i18n/en.ts:230` + `zh.ts:230`++**当前**:+```ts+{ label: "Desktop" / "桌面端", href: "https://github.com/multica-ai/multica/releases/latest" }+```++**新**:+```ts+{ label: "Download" / "下载", href: "/download" }+```++**理由**:+- 把"Desktop"改成"Download"——`/download` 页面本身就是三个选项的聚合(Desktop/CLI/Cloud),不只是 desktop+- href 统一到 `/download`++---++### 3.3 Web Login Page — 新增 Desktop CTA++**位置**:`apps/web/app/(auth)/login/page.tsx` 调用 `LoginPage`(`packages/views/auth/login-page.tsx`)时注入新 prop `extra`++**当前**:无此 UI++**新**(Google 按钮下方低调一行):+- EN: `"Prefer the desktop app? Download →"`+- ZH: `"想用桌面应用?下载 →"`++**i18n**:新增 key+```ts+auth: {+ login: {+ extraDownloadPrompt: "Prefer the desktop app?" / "想用桌面应用?",+ extraDownloadCta: "Download" / "下载",+ }+}+```++**理由**:+- 登录页是**最轻投入时刻**,推 Desktop 最便宜+- 不强推,低调一行,不影响 Google OAuth 主流+- Desktop app 的 Login Page(`apps/desktop/src/renderer/src/pages/login.tsx`)**不传** `extra` → 不显示。这条 CTA 只在 web 出现。++---++### 3.4 Welcome 屏 — web 分支新增 Desktop 引导++**位置**:`packages/views/onboarding/steps/step-welcome.tsx`(单语英文)++**当前**(所有平台):+```+Takes about 3 minutes. You'll end with a real agent+replying to a real issue.+```+按钮:`Start exploring` + (optional) `I've done this before`++**新**(web 分支,`isWeb=true`):+- 上方文字保留 `"Your AI teammates, in one workspace."` 标题+- 副文案改为:`"About 3 minutes on desktop. A bit more on web — you'll need a local runtime."`+- 按钮区追加第三个按钮(视觉权重:primary > secondary ghost):+ - Primary: `"Start exploring"` (保留,引导继续 web 流程)+ - **新增 secondary**: `"Download Desktop — faster setup"`(指向 `/download`,新窗口打开)+ - Ghost: `"I've done this before"` (保留条件)++**新**(desktop 分支,`isWeb=false`):+- 文案完全保持:`"Takes about 3 minutes. You'll end with a real agent replying to a real issue."`+- 按钮不变++**理由**:+- 首次向 web 用户承认"desktop 更顺"——早于任何投入+- Primary CTA 仍是"Start exploring"——不强推 desktop,只是让它可见+- 3 minutes 文案按平台差异化——对 desktop 用户诚实,对 web 用户不再骗++---++### 3.5 Step 3 Platform Fork — Desktop 卡++**位置**:`packages/views/onboarding/steps/step-platform-fork.tsx:232-299`(`ForkPrimary` 组件)++**当前(Mac detect 命中)**:+- 标题:`"Download the desktop app"`+- 副文案:`"macOS · runtime bundled — detects your tools automatically, nothing to install."`++**当前(非 Mac)**:+- 标题:`"Desktop app — macOS only for now"` (disabled card)+- 副文案:`"Windows and Linux builds are on the way. In the meantime, install the CLI below — it takes about two minutes."`++**新(所有平台,按 detect 结果适配)**:+- 标题:`"Download the desktop app"`+- 副文案(按 detect 分支):+ - macOS arm64: `"macOS (Apple Silicon) · bundled daemon, zero setup."`+ - macOS Intel/unknown: `"macOS · bundled daemon, zero setup."` + 小字 `"Apple Silicon only — on Intel? Use CLI."`+ - Windows: `"Windows · bundled daemon, zero setup."`+ - Linux: `"Linux · bundled daemon, zero setup."`+ - 非 Mac 检测不到: `"Bundled daemon, zero setup."`+- 按钮 pill:`"Download"`(不变)++**理由**:+- 拆掉 `isMac` 门——Windows/Linux 包已经齐+- 副文案主打**"zero setup"**——这才是和 CLI 的真差异+- Intel Mac 诚实提示,不骗他们点 arm64 包++---++### 3.6 Step 3 Platform Fork — CLI 卡++**位置**:同上,`ForkAlt` 调用++**当前**:+- 标题:`"Install the CLI"`+- 副文案:`"Run the Multica daemon yourself — a couple of terminal commands."`+- 按钮:`"Show steps"`++**新**:+- 标题:`"Install the CLI"` (不变)+- 副文案:`"For servers, remote dev boxes, and headless setups. Terminal required."`+- 按钮:`"Show steps"` (不变)++**理由**:+- 副文案从"自己跑 daemon"改为"服务器 / 远程 / headless"——让 CLI 归位到它真正的场景+- 加 "Terminal required" 给用户明确预期,不伪装成轻量路径++---++### 3.7 Step 3 Platform Fork — Cloud 卡++**位置**:同上,`ForkAlt` 调用++**当前**:+- 标题:`"Cloud runtime"`+- 副文案:`"We host it for you. Not live yet — leave your email and we'll let you know."`+- 按钮:`"Join waitlist"` / `"On the list"`++**新**:+- 标题:`"Cloud runtime"` (不变)+- 副文案:`"We host the runtime. Not live yet — join the waitlist."`+- 按钮不变++**理由**:+- 微调,对齐定位句+- 不再把 "we'll let you know" 说得像客户支持++---++### 3.8 Step 3 Footer Hint++**位置**:`step-platform-fork.tsx:101-112`++**当前 non-Mac**:`"Install the CLI to connect a runtime, or skip for now."`++**新(去掉 non-Mac 分支,因为 Desktop 对所有平台 active)**:+```ts+if (waitlistSubmitted) return "You're on the waitlist — pick Skip to keep exploring.";+if (downloaded) return "Downloading… finish setup in the desktop app, or pick another path.";+return "Pick a path above — or skip and configure a runtime later.";+```++**理由**:删掉 non-Mac 专属分支,现在所有平台 Desktop 都可用。++---++### 3.9 CLI Install Dialog — Title + Description++**位置**:`step-platform-fork.tsx:378-384`++**当前**:+```+Title: "Install the CLI"+Description: "Runs the same daemon the desktop app bundles — you install it yourself."+```++**新**:+```+Title: "Install the CLI"+Description: "Same daemon, installed on your terminal. Use it when Desktop doesn't fit — servers, remote dev boxes, or headless setups."+```++**理由**:+- 明确 CLI 和 Desktop 是**同一个 daemon**——消除"CLI 是否弱化版 Desktop"的误解+- 直接说 CLI 的正当场景——当 Desktop 不适合时++---++### 3.10 CliInstallInstructions — 头部提示++**位置**:`packages/views/onboarding/steps/cli-install-instructions.tsx:65-68`++**当前**:+```+You'll need a local AI coding tool (Claude Code, Codex,+Cursor, …) installed for the runtime to do real work.+```++**新**:+```+You'll need an AI coding tool on this machine (Claude Code,+Codex, Cursor, …) for the daemon to do real work. Also works+on servers and remote dev boxes.+```++**理由**:+- 最后一句点出 CLI 的远程场景——和 Step 3 CLI 卡的副文案呼应++---++### 3.11 CLI Dialog Waiting — "Stalled" 文案++**位置**:`step-platform-fork.tsx:552-561`++**当前**:+```+Nothing coming through yet. Close this dialog and try another+path on the previous screen — Skip for now (in the footer)+enters your workspace in read-only mode, or the Cloud runtime+card lets you join the waitlist.+```++**新**:+```+Nothing coming through yet. If you're not comfortable with the+terminal, Desktop is the smoother path — it bundles the daemon.+Close this dialog and pick Desktop, or hit Skip to continue.+```++**理由**:+- 在 stall 发生时主动把 Desktop 作为退路——这是用户最需要听到的+- 原文案把 Cloud waitlist 作为退路不合理(那是 soft exit,不解决问题)++---++### 3.12 `/download` 页面(全新,i18n 双语)++**位置**:`apps/web/app/(landing)/download/page.tsx`(新建)++**页面结构 + 文案**:++#### Hero 区(顶部主 CTA,按 detect 结果拼出)++**检测到 macOS arm64**:+- EN:+ - H1: `"Multica for macOS"`+ - Sub: `"Apple Silicon · bundled daemon, zero setup"`+ - Primary button: `"Download (.dmg)"` → macArm64Dmg+ - Alt link: `"or download .zip"` → macArm64Zip+- ZH:+ - H1: `"Multica for macOS"`+ - Sub: `"Apple Silicon · 内置 daemon,无需额外配置"`+ - Primary: `"下载 (.dmg)"`+ - Alt: `"或下载 .zip"`++**检测到 macOS Intel(Chromium)**:+- EN:+ - H1: `"Multica for macOS"`+ - Sub: `"Apple Silicon required — Intel Macs not yet supported."`+ - Primary button 样式: **muted + disabled**,文案 `"Apple Silicon required"`+ - 次要段落:`"On an Intel Mac? Use the CLI below — it runs the same daemon."`+- ZH:对应翻译++**检测到 Windows x64**:+- EN:+ - H1: `"Multica for Windows"`+ - Sub: `"Bundled daemon, zero setup"`+ - Primary: `"Download (.exe)"` → winX64Exe+- ZH: `"Multica for Windows"` / `"内置 daemon,无需额外配置"` / `"下载 (.exe)"`++**检测到 Linux**:+- EN:+ - H1: `"Multica for Linux"`+ - Primary: `"Download AppImage"` → linuxAmd64AppImage+ - Alt links: `"or .deb / .rpm"`+- ZH: 对应翻译++**未检测 / SSR 初始状态**:+- 默认渲染 macOS arm64 作为 H1(占位);JS hydration 后按 detect 替换++#### All Platforms 区(永远可见,在 Hero 下方)++**标题**:+- EN: `"All platforms"`+- ZH: `"所有平台"`++**内容**:表格或卡片,每行一个包:+```+macOS · Apple Silicon (.dmg / .zip)+Windows · x64 (.exe) · ARM64 (.exe)+Linux · x64 (.AppImage / .deb / .rpm) · ARM64 (.AppImage / .deb / .rpm)+```++**Intel Mac 说明**:+- EN: `"Apple Silicon only — Intel Macs not supported in this release."`+- ZH: `"仅支持 Apple Silicon——Intel Mac 目前暂不支持。"`++#### CLI 区(二级标题,独立 section)++**标题**:+- EN: `"Prefer the CLI?"`+- ZH: `"想用 CLI?"`++**副文案**:+- EN: `"For servers, remote dev boxes, and headless setups. Same daemon as Desktop, installed via terminal."`+- ZH: `"适合服务器、远程开发机、无图形界面环境。底层 daemon 和 Desktop 相同,通过终端安装。"`++**命令块**(复用 `CliInstallInstructions` 的样式):+```bash+# Install+curl -fsSL https://raw.githubusercontent.com/multica-ai/multica/main/scripts/install.sh | bash++# Start daemon+multica setup+```++**底部说明**:+- EN: `"Already on a server? Same commands work over SSH."`+- ZH: `"已经在服务器上?通过 SSH 执行同样的命令即可。"`++#### Cloud 区(最小、置底)++**标题**:+- EN: `"Cloud runtime (waitlist)"`+- ZH: `"Cloud runtime(等待名单)"`++**副文案**:+- EN: `"We'll host the runtime for you. Not live yet — leave your email to be notified."`+- ZH: `"我们将为你托管 runtime,目前尚未上线——留下邮箱,上线后通知你。"`++**表单**:复用 `CloudWaitlistExpand`(`packages/views/onboarding/components/cloud-waitlist-expand.tsx`)++#### Footer 区++- Release notes 链接:`"What's new in {version}"` → GitHub release tag URL+- All releases:`"View all releases →"` → `https://github.com/multica-ai/multica/releases`+- 版本号小字:`"Current version: v0.2.13"`(来自 `/api/latest-version`)++---++## 四、i18n Keys 规划++### 4.1 现有 key 复用++- `hero.downloadDesktop` — 保持,landing hero 按钮文案+- `nav.desktop` → **重命名为 `nav.download`**(需同步改 landing-nav 组件读的 key)++### 4.2 新增 key 命名空间++```ts+// apps/web/features/landing/i18n/en.ts + zh.ts+{+ // ... 现有 key ...++ download: {+ hero: {+ macArm64: {+ title: "Multica for macOS",+ sub: "Apple Silicon · bundled daemon, zero setup",+ primary: "Download (.dmg)",+ altZip: "or download .zip",+ },+ macIntel: {+ title: "Multica for macOS",+ sub: "Apple Silicon required — Intel Macs not yet supported.",+ disabledCta: "Apple Silicon required",+ intelHint: "On an Intel Mac? Use the CLI below — it runs the same daemon.",+ },+ winX64: {+ title: "Multica for Windows",+ sub: "Bundled daemon, zero setup",+ primary: "Download (.exe)",+ },+ winArm64: {+ title: "Multica for Windows",+ sub: "ARM · bundled daemon, zero setup",+ primary: "Download (.exe)",+ },+ linux: {+ title: "Multica for Linux",+ sub: "Bundled daemon, zero setup",+ primary: "Download AppImage",+ altFormats: "or .deb / .rpm",+ },+ },+ allPlatforms: {+ title: "All platforms",+ macLabel: "macOS · Apple Silicon",+ winX64Label: "Windows · x64",+ winArm64Label: "Windows · ARM64",+ linuxX64Label: "Linux · x64",+ linuxArm64Label: "Linux · ARM64",+ intelNote: "Apple Silicon only — Intel Macs not supported in this release.",+ },+ cli: {+ title: "Prefer the CLI?",+ sub: "For servers, remote dev boxes, and headless setups. Same daemon as Desktop, installed via terminal.",+ installLabel: "Install",+ startLabel: "Start daemon",+ sshNote: "Already on a server? Same commands work over SSH.",+ },+ cloud: {+ title: "Cloud runtime (waitlist)",+ sub: "We'll host the runtime for you. Not live yet — leave your email to be notified.",+ },+ footer: {+ releaseNotes: "What's new in {version}",+ allReleases: "View all releases",+ currentVersion: "Current version: {version}",+ },+ },++ auth: {+ login: {+ extraDownloadPrompt: "Prefer the desktop app?",+ extraDownloadCta: "Download",+ },+ },+}+```++中文翻译按 ZH 对照表同步填入 `zh.ts`。++### 4.3 Onboarding 触点(单语英文)++所有 `step-welcome.tsx` / `step-platform-fork.tsx` / `cli-install-instructions.tsx` 的新文案**直接硬编码到 TSX**,不进 i18n——保持和当前 onboarding 代码风格一致。++---++## 五、文案审校清单++Step 2/3/4 实施时,逐条检查:++- [ ] 每个触点的文案都在本文档有定义(不临时发明)+- [ ] Landing / `/download` / Login extra 走 i18n,双语齐备+- [ ] Onboarding 触点英文硬编码,与现有代码风格一致+- [ ] "3 minutes" 时间声明仅出现在 desktop 分支+- [ ] 没有 "easy / simple / just" 出现在 Desktop 或 CLI 文案里+- [ ] 所有 Download CTA 指向 `/download`,不再有直接指向 GitHub releases 的链接(landing nav、landing hero、step 3 Desktop 卡点击、登录页 extra)+- [ ] CLI 文案强调 server/remote/headless 场景,不再暗示"Desktop 的轻量版"+- [ ] Intel Mac 处处诚实标注,不欺骗++---++## 六、开放事项++- `/download` 页面的视觉风格是否跟 landing 一致(serif 标题 / 背景色)?→ **建议跟 landing 一致**,但本文档不锁死,Step 2 UI 实现时决定+- 是否加"系统最低要求"区块?→ **不做**(Cursor 有,但我们产品期不引入这种 clutter)+- 是否在 `/download` 置顶放一个 `<video>` 或产品截图?→ **不做**(保持克制;landing 已承担营销角色)diff --git a/docs/download-redesign.md b/docs/download-redesign.mdnew file mode 100644index 0000000000..ce1ab8e65a--- /dev/null+++ b/docs/download-redesign.md@@ -0,0 +1,356 @@+# Desktop 下载体系重设计 — 执行计划++**日期**:2026-04-22+**作者**:Naiyuan+**状态**:方案定稿,分步执行中++---++## 一、为什么要做++### 1.1 现状的核心矛盾++Multica 本质是"**本地 runtime + 云端协作**"的产品。Desktop app 内置 bundled daemon,登录即用;web 是预览/入口,不是等价平台。但**当前代码和文案把 Desktop 和 Web 当作等价路径**,结果:++1. **登录到 Step 3 之间,零 Desktop 推广**。用户建完 workspace 才被告知"其实你得装 app",此时沉没成本已高+2. **Step 3 分流屏三张卡(Desktop / CLI / Cloud)视觉和文案伪对称**,用户感知不到 Desktop 是正解+3. **`isMac` 过时门**:Windows/Linux 桌面包已齐(v0.2.13),代码却把非 Mac 用户推去 CLI+4. **所有 Download 入口(landing / Step 3 / footer)都指向 GitHub releases 页面**——30+ assets 的列表,对非技术用户是灾难+5. **Welcome 屏 "Takes about 3 minutes" 对 web 用户是谎**——不含下载/安装/换端时间++### 1.2 Cursor 对标带来的确认++Cursor 的 `/download` 页面(<https://cursor.com/cn/download>)模式:+- **Client-side auto-detect**:用 `navigator.userAgentData.getHighEntropyValues(['architecture'])`,精确到 arch;fallback 到 UA 字符串+- **SSR 发全量 HTML**(所有 OS 内容都在),hydration 后 JS 挑对应平台作主 CTA+- **三个并列 surface**:Desktop / Terminal / Web——不是"三选一",是**三个场景**+- 有 `useDownloadTracking` hook,埋点下载事件++这验证了"桌面主推 + 其他平台可见 + CLI 作为独立场景"的正确性。++---++## 二、核心洞察(从代码扒出来的)++### 2.1 两端用户是两种心态,不是两种路径++| 维度 | Desktop 用户 | Web 用户 |+|---|---|---|+| 入口 | 主动下 .app,越过安装门槛 | 浏览器打开,零投入 |+| 心态 | **投入者**:"我认真对待 Multica" | **探索者**:"先试试" |+| 对本地安装的态度 | 已接受 | **主动拒绝过**(选 web 就是为了不装) |+| Step 3 的本质 | 确认屏(daemon 已在跑) | 决策屏(产品真相首次披露) |++这解释了为什么 Step 3 在 web 上是漏斗流失点——**那是"你以为是 web 产品 / 实际是本地产品"的期望违约时刻**。++### 2.2 CLI 不是 Desktop 的低配版,是另一个场景++Desktop 和 CLI 跑的是**同一个 Go 二进制**(`daemon-manager.ts` spawn 的 bundled CLI)。区别仅在 **setup moment**:++| 维度 | Desktop | CLI |+|---|---|---|+| 安装 | 双击 .dmg | `curl \| bash` |+| 启动 | `daemonAPI.autoStart()` 登录后自动 | `multica setup` 手动 |+| 运行后能力 | 完全等价 | 完全等价 |+| **真正适合的场景** | 个人机器、交互使用 | **服务器、远程 dev box、on-prem、自动化、CI** |++CLI 的合法性不来自"Desktop 不可得时的替代",来自它**真的有 Desktop 永远覆盖不了的场景**:++- Self-host / on-prem:daemon 跑在自有服务器+- 远程 dev box:SSH 到 Linux 机器,在那里跑 daemon+- CI/CD:headless 环境里调度 agent+- 多机部署:一个人,多台 runtime++**文案必须攻击 setup moment 不对称,而不是比较能力**——因为能力是一样的。++### 2.3 当前代码和资产状态++**已有的完整跨平台包(v0.2.13)**:++| 平台 | 包 | 大小 |+|---|---|---|+| macOS arm64 | `.dmg` / `.zip` | 184MB |+| macOS Intel (x64) | ❌ 无(`electron-builder.yml` 只 target arm64) | — |+| Windows x64 | `.exe` (NSIS) | 140MB |+| Windows arm64 | `.exe` | 430MB |+| Linux | `.AppImage` / `.deb` / `.rpm`(amd64 + arm64) | 113–189MB |++**代码当前状态**:++- Desktop 端 Step 3 里根本没有 CLI 这张卡(`StepRuntimeConnect.EmptyView` 只有 Skip + Cloud waitlist)——产品团队自己的立场是"bundled daemon 是 Multica 的本分"+- Web 端 Step 3(`StepPlatformFork`)把 CLI 作为一等平级卡,`isMac` 门 disabled 非 Mac 的 Desktop CTA+- 所有 Download 链指向 `https://github.com/multica-ai/multica/releases/latest`++---++## 三、定位策略(文案骨架)++每个 surface 用同一套"场景导向"句子,不比较能力:++| 形态 | 一句话定位 | 适合谁 |+|---|---|---|+| **Desktop** | "Your personal machine. Double-click, agents run locally." | 95% 新用户 |+| **CLI** | "Servers, remote boxes, on-prem, automation. No GUI required." | 开发者 / 运维 / 自建 |+| **Cloud**(waitlist) | "No local install — we host the runtime for you." | 评估 / 不想本地跑 |++**Welcome 屏在 web 分支追加一条引导**:诚实告诉用户"Better on desktop",给一个 Download 按钮 + "Continue on web" 次选。++---++## 四、已做的决定++| 决策 | 选择 | 理由 |+|---|---|---|+| 语言 | **中英双语**,跟 landing 的 `en.ts` / `zh.ts` 一致 | 保持全站 i18n 体系 |+| Intel Mac | **暂不支持**,`/download` 页诚实标注 | 2026 年 Intel Mac 已是 4+ 年前老机器;包体积翻倍影响所有人;CLI 对 Intel 用户是合理路径 |+| 版本号获取 | **Next.js API route 代理 GitHub API**(`/api/latest-version`),Vercel ISR 5 分钟 cache | `latest.yml` 无 CORS;build-time 注入需每次重部署;GitHub API 未认证 60/hr 对 5min cache 绰绰有余 |+| 部署 | Vercel(已确认) | ISR 原生支持,`export const revalidate = 300` 一行解决 |+| Desktop 链接 URL | 客户端按 detect 结果拼 GitHub asset 直链 | 无需后端端点;带版本号的 URL 从 `/api/latest-version` 返回的 assets 里取 |+| Auto-detect 方式 | `navigator.userAgentData.getHighEntropyValues(['platform','architecture'])` + UA 字符串 fallback | 抄 Cursor 模式;Safari 无此 API,macOS 下无法区分 Intel/arm——默认推 arm64 + 诚实文案 |+| CLI 在 onboarding 的定位 | 保留 Step 3 第二张卡,但**文案重写为服务器/远程场景**,不再假装是 Desktop 的轻量版 | CLI 场景真实存在,但大多数 onboarding 用户不在这个场景里 |+| 开发顺序 | **Step 1 文案 → Step 2 `/download` → Step 3 Onboarding → Step 4 Login + Landing** | Step 1 确立真相源,后续 UI 改动有唯一文案来源,可并行 |++---++## 五、执行步骤++### Step 1 · 文案与定位对齐(不写代码)++**做什么**:++- 建 `docs/download-positioning.md`(本文档的姊妹文档,专门放文案)+- 三个 surface 的定位句(中英)+- 盘点所有触点的**当前文案 vs 新文案**:+ - Landing hero(`landing-hero.tsx`)+ - Landing nav + footer 链接(`landing/i18n/en.ts`、`zh.ts`)+ - Login page(`packages/views/auth/login-page.tsx`)——新增 Desktop CTA+ - Welcome step(`step-welcome.tsx`)——web 分支新增 Desktop CTA+ - Step 3 三张卡(`step-platform-fork.tsx`)+ - `/download` 页面(全新)+ - `CliInstallInstructions`(`cli-install-instructions.tsx`)+- 每条文案带中英双语对照++**目标**:后续所有 UI 改动有唯一文案真相源,不临时发明++**产出**:1 个 markdown doc+**工期**:0.5 天+**产物文件**:`docs/download-positioning.md`++### Step 2 · `/download` 页面++**做什么**:++- **路由**:`apps/web/app/(landing)/download/page.tsx`(放 landing group 共享 layout)+- **SSR**:全量渲染 Desktop / CLI / Cloud 三块,所有平台包都在 HTML 里+- **API route**:`apps/web/app/api/latest-version/route.ts`+ - 调 `https://api.github.com/repos/multica-ai/multica/releases/latest`+ - 解析 assets,按文件名模式抽出每个平台的 URL+ - 返回 `{ version, assets: { macArm64, winX64, winArm64, linuxDeb, linuxRpm, linuxAppImage, ... } }`+ - Vercel ISR:`export const revalidate = 300`+- **Client detect**:`packages/views/utils/os-detect.ts`(新建)+ - 优先用 `navigator.userAgentData.getHighEntropyValues(['platform','architecture'])`+ - Fallback 到 `navigator.userAgent` + `navigator.platform`+ - 返回 `{ os: 'mac'|'windows'|'linux'|'unknown', arch: 'arm64'|'x64'|'unknown' }`+- **UI 行为**:+ - 顶部大 CTA:按 detect 结果拼好的 Desktop 下载按钮(macOS arm64 / Windows x64 / Linux AppImage 作主推)+ - 检测到 Intel Mac(Chromium)→ 主 CTA 变成"Apple Silicon required — use CLI",CLI 区块置顶+ - 检测到 Safari on macOS → 默认推 arm64 + 小字提示"On Intel Mac? Use CLI"+ - 全平台直链列表(arch 清晰标注)+ - CLI 区块:`curl | bash` + 场景说明+ - Cloud 区块:复用 `CloudWaitlistExpand`+- **i18n**:`apps/web/features/landing/i18n/en.ts` / `zh.ts` 新增 `download` 命名空间++**目标**:全站下载总入口,版本自动更新,用户下到对的包++**工期**:1-2 天+**产物文件**:+- `apps/web/app/(landing)/download/page.tsx`+- `apps/web/app/api/latest-version/route.ts`+- `packages/views/utils/os-detect.ts`(或 `packages/core/platform/os-detect.ts`)+- `apps/web/features/landing/i18n/en.ts` + `zh.ts` 新增 keys+- `apps/web/features/landing/components/download-page.tsx`(主组件,landing 风格)++### Step 3 · Onboarding 修缮++**做什么**:++- **Welcome 屏 web 分支**:+ - `OnboardingFlow` 里派生 `isWeb = !!runtimeInstructions`,传给 `StepWelcome`+ - `StepWelcome` 在 `isWeb` 时,CTA 区域追加一行 "Better on desktop — bundled daemon, zero setup" + **Download 按钮**(指 `/download`)+ "Continue on web" 次选+ - "Takes about 3 minutes" 文案按平台差异化+- **Step 3 分流屏**:+ - 拆掉 `isMac` 门(`step-platform-fork.tsx:244-268`)+ - Desktop 卡对所有平台 active,按 detect 显示对应平台文案+ - Non-Mac 兜底卡改成 Cloud waitlist 强化,不再假装推 CLI+ - 三张卡的文案按 Step 1 确定的定位句重写+- **CLI dialog**:+ - `CliInstallInstructions` 加一行场景说明:"Also great for servers and remote dev boxes."+ - `multica setup` 命令旁边保留现状+- **"Downloading"后态**:+ - Desktop 卡点击后的 downloaded 态文案改得更明确("Check your Downloads folder. Open the .dmg to install.")++**目标**:Welcome 不再骗 web 用户;Step 3 三张卡场景清晰;Windows/Linux 用户不再被推 CLI++**工期**:0.5 天+**产物文件**:+- `packages/views/onboarding/onboarding-flow.tsx`+- `packages/views/onboarding/steps/step-welcome.tsx`+- `packages/views/onboarding/steps/step-platform-fork.tsx`+- `packages/views/onboarding/steps/cli-install-instructions.tsx`++### Step 4 · 上游漏斗(Login + Landing)++**做什么**:++- **Login page**:+ - `packages/views/auth/login-page.tsx` 的 `LoginPageProps` 加 `extra?: ReactNode` prop+ - Google 按钮下方低调一行 "Prefer the desktop app? **Download →**"+ - Desktop 调用方(`apps/desktop/src/renderer/src/pages/login.tsx`)**不传** extra → 不显示+ - Web 调用方(`apps/web/app/(auth)/login/page.tsx`)**传** extra → 显示+- **Landing hero**:+ - `landing-hero.tsx:44-65` 的 Download 按钮从 `heroButtonClassName("ghost")` 升级为 `heroButtonClassName("solid")`(或至少主次分明的 outline)+ - href 从 `https://github.com/multica-ai/multica/releases/latest` 改为 `/download`+- **Landing nav + footer**:+ - `landing/i18n/en.ts:230` / `zh.ts:230` 的 Desktop 链接统一改为 `/download`++**目标**:用户最轻投入时刻就看到 Desktop;Step 3 之前已有两次 Desktop touch++**工期**:2 小时+**产物文件**:+- `packages/views/auth/login-page.tsx`+- `apps/web/app/(auth)/login/page.tsx`+- `apps/desktop/src/renderer/src/pages/login.tsx`(确认不传 extra 即可)+- `apps/web/features/landing/components/landing-hero.tsx`+- `apps/web/features/landing/i18n/en.ts` + `zh.ts`++---++## 六、不做的事(明确范围)++- **后端 `/api/download?os=X&arch=Y` 302 端点**:方案 A 已够用,后端不动+- **下载埋点/数据分析**:本次不做,Cursor 有但我们暂缓+- **下载后 "waiting on desktop" 屏**:让 handoff 更丝滑的想法,留到数据出现再决定+- **Intel Mac universal build**:暂不补,`/download` 诚实标注"暂不支持"+- **CLI 文档页 / 自托管文档**:Step 3 CLI 卡副文案引向 docs,docs 本身不在本次范围+- **/download 页的 "system requirements" 区块**:不做详细 minimum specs,保持简洁++---++## 七、技术细节速查++### 7.1 OS + Arch Detection++```typescript+// 推荐实现骨架+export async function detectOS(): Promise<{ os: OSName; arch: Arch }> {+ // 优先用 userAgentData(Chromium)+ if (navigator.userAgentData?.getHighEntropyValues) {+ try {+ const data = await navigator.userAgentData.getHighEntropyValues([+ "platform",+ "architecture",+ ]);+ // data.platform: "macOS" | "Windows" | "Linux"+ // data.architecture: "x86" | "arm"+ return normalizePlatform(data);+ } catch {+ // fall through+ }+ }+ // Fallback: UA 字符串 + navigator.platform+ const ua = navigator.userAgent;+ const platform = navigator.platform || "";+ // ... 按 "Mac" / "Windows" / "Linux" 分支+}+```++**已知限制**:Safari on macOS 无法区分 Intel/arm64(Apple 故意不暴露)。默认推 arm64 + 诚实文案。++### 7.2 `/api/latest-version` Response Shape++```typescript+{+ version: "v0.2.13",+ publishedAt: "2026-04-21T13:13:52Z",+ assets: {+ macArm64Dmg: "https://github.com/.../multica-desktop-0.2.13-mac-arm64.dmg",+ macArm64Zip: "https://github.com/.../multica-desktop-0.2.13-mac-arm64.zip",+ winX64Exe: "https://github.com/.../multica-desktop-0.2.13-windows-x64.exe",+ winArm64Exe: "https://github.com/.../multica-desktop-0.2.13-windows-arm64.exe",+ linuxAmd64AppImage: "https://github.com/.../multica-desktop-0.2.13-linux-x86_64.AppImage",+ linuxAmd64Deb: "https://github.com/.../multica-desktop-0.2.13-linux-amd64.deb",+ linuxAmd64Rpm: "https://github.com/.../multica-desktop-0.2.13-linux-x86_64.rpm",+ linuxArm64AppImage: "...",+ linuxArm64Deb: "...",+ linuxArm64Rpm: "...",+ }+}+```++Asset 文件名模式由 `electron-builder.yml` 定义:`multica-desktop-${version}-${platform}-${arch}.${ext}`。解析靠正则匹配。++### 7.3 Vercel ISR 配置++```typescript+// apps/web/app/api/latest-version/route.ts+export const revalidate = 300; // 5 min++export async function GET() {+ const res = await fetch(+ "https://api.github.com/repos/multica-ai/multica/releases/latest",+ { next: { revalidate: 300 } }+ );+ if (!res.ok) {+ return Response.json({ error: "upstream" }, { status: 502 });+ }+ const data = await res.json();+ return Response.json({+ version: data.tag_name,+ publishedAt: data.published_at,+ assets: parseAssets(data.assets),+ });+}+```++### 7.4 Welcome 屏 `isWeb` 派生++```typescript+// onboarding-flow.tsx+const isWeb = !!runtimeInstructions;++// 传给 StepWelcome+<StepWelcome+ onNext={handleWelcomeNext}+ onSkip={canSkipWelcome ? handleWelcomeSkip : undefined}+ isWeb={isWeb}+/>+```++---++## 八、执行追踪++- [x] Step 1 · 文案 doc → `docs/download-positioning.md`+- [x] Step 2 · `/download` 页面(分支 `NevilleQingNY/download-redesign`)+- [ ] Step 3 · Onboarding 修缮+- [ ] Step 4 · 上游漏斗++### Step 2 产出++- 新文件:`apps/web/app/(landing)/download/page.tsx` + `download-client.tsx`+- 新组件:`apps/web/features/landing/components/download/{hero,all-platforms,cli-section,cloud-section,os-icons}.tsx`+- 新 utils:`apps/web/features/landing/utils/{os-detect,parse-release-assets,github-release}.ts`+- 扩展 i18n:`types.ts` 加 `download` + `auth.login.extra*`;`en.ts` + `zh.ts` 填双语+- Nav 更新:landing footer 的 "Desktop" / "桌面端" 链接 → "Download" / "下载"(指 `/download`)+- `@multica/views/onboarding` 新 export:`CloudWaitlistExpand`(`/download` 的 Cloud 区块复用)++### 本地开发注意++GitHub Releases API 未认证限流是 **60 req/hr per IP**。Vercel 生产环境的 fetch cache 跨所有 region 共享,每 5 分钟(`revalidate: 300`)全局最多 1 次调用,远低于限流。但**本地开发** + 共享办公室 IP 容易打爆限流,命中后页面降级到"Version unavailable"。++本地跑 `/download` 如遇到版本信息缺失:+1. 设置 `GITHUB_TOKEN` 环境变量(Personal Access Token,公共仓库不需要 scope)+2. `fetchLatestRelease` 会自动带 `Authorization: Bearer <token>` header,限流提到 5000 req/hr+3. Token 只在 server-side 用,不会泄漏到客户端++每完成一步,勾掉 checkbox 并在对应 section 底部补一行实际 commit hash。diff --git a/packages/core/analytics/download.ts b/packages/core/analytics/download.tsnew file mode 100644index 0000000000..b45d37bcf5--- /dev/null+++ b/packages/core/analytics/download.ts@@ -0,0 +1,113 @@+/**+ * Download funnel instrumentation.+ *+ * Complements the onboarding events added in PR #1489 by covering+ * every surface that advertises the desktop app — landing hero,+ * landing footer, login, Welcome (web branch), Step 3 — and the+ * /download page itself. Without this layer we can see Step 3+ * path selection but not the touchpoint that got the user there,+ * nor the /download → installer conversion.+ *+ * Event names and property shapes are governed by docs/analytics.md;+ * keep the two in sync when adding a new source or field.+ */++import posthog from "posthog-js";++import { captureEvent, setPersonProperties } from "./index";++/**+ * Where the user clicked a CTA that points at `/download`. Typed union+ * prevents drift across the five touchpoints and lets PostHog funnels+ * split cleanly by top-of-funnel entry.+ */+export type DownloadIntentSource =+ | "landing_hero"+ | "landing_footer"+ | "login"+ | "welcome"+ | "step3";++/**+ * OS + arch detect result for the /download page. Mirrors the shape of+ * `@/features/landing/utils/os-detect.ts` without importing it (that+ * module lives in the web app; core packages can't depend on it). Keep+ * these enums in lockstep.+ */+export interface DownloadDetectPayload {+ detected_os: "mac" | "windows" | "linux" | "unknown";+ detected_arch: "arm64" | "x64" | "unknown";+ detect_confident: boolean;+ version_available: boolean;+}++/**+ * Specific installer the user chose on /download. Version is the GitHub+ * tag name (e.g. "v0.2.13") so we can correlate adoption-by-release.+ */+export interface DownloadInitiatedPayload {+ platform: "mac" | "windows" | "linux";+ arch: "arm64" | "x64";+ format: "dmg" | "zip" | "exe" | "appimage" | "deb" | "rpm";+ version: string;+ primary_cta: boolean;+ matched_detect: boolean;+}++/**+ * Fires when a user clicks any CTA that navigates to `/download`. We+ * also write `platform_preference` to person properties so the backend+ * can segment subsequent events — same convention the Step 3 handler+ * already uses (see `step-platform-fork.tsx`).+ */+export function captureDownloadIntent(source: DownloadIntentSource): void {+ captureEvent("download_intent_expressed", {+ source,+ });+ setPersonProperties({ platform_preference: "desktop" });+}++/**+ * Fires once on /download page mount, after OS detection resolves. The+ * first detection for a given person is mirrored into person properties+ * via `$set_once` so every downstream event gains a platform dimension+ * without re-emitting.+ */+export function captureDownloadPageViewed(+ payload: DownloadDetectPayload,+): void {+ captureEvent("download_page_viewed", {+ detected_os: payload.detected_os,+ detected_arch: payload.detected_arch,+ detect_confident: payload.detect_confident,+ version_available: payload.version_available,+ });+ setPersonPropertiesOnce({+ first_detected_os: payload.detected_os,+ first_detected_arch: payload.detected_arch,+ });+}++/**+ * Fires when the user clicks a concrete installer link on `/download`.+ * `primary_cta` marks the hero-level recommendation versus a manual+ * pick from the All Platforms matrix; `matched_detect` captures+ * whether the click matched what we detected (miss = detect got it+ * wrong / user overrode).+ */+export function captureDownloadInitiated(+ payload: DownloadInitiatedPayload,+): void {+ captureEvent("download_initiated", { ...payload });+}++/**+ * $set_once wire form. Mirrors the backend's `Event.SetOnce` path —+ * first write wins, subsequent ones are no-ops on PostHog's side.+ * Wrapping it here keeps call sites free of the no-op `$set_once`+ * envelope quirk.+ */+function setPersonPropertiesOnce(props: Record<string, unknown>): void {+ if (typeof window === "undefined") return;+ posthog.capture("$set", { $set_once: props });+}diff --git a/packages/core/analytics/index.ts b/packages/core/analytics/index.tsindex 2039af5c37..d512c350a4 100644--- a/packages/core/analytics/index.ts+++ b/packages/core/analytics/index.ts@@ -54,6 +54,15 @@ const pendingOps: PendingOp[] = [];// event until a full reload.let superProperties: Record<string, unknown> = {};+export {+ captureDownloadIntent,+ captureDownloadPageViewed,+ captureDownloadInitiated,+ type DownloadIntentSource,+ type DownloadDetectPayload,+ type DownloadInitiatedPayload,+} from "./download";+export interface AnalyticsConfig {key: string;host: string;diff --git a/packages/views/auth/login-page.tsx b/packages/views/auth/login-page.tsxindex d7d8540b97..2808a10502 100644--- a/packages/views/auth/login-page.tsx+++ b/packages/views/auth/login-page.tsx@@ -55,6 +55,11 @@ interface LoginPageProps {onTokenObtained?: () => void;/** Override Google login handler (e.g. desktop opens browser externally). When provided, renders the Google button even if `google` config is omitted. */onGoogleLogin?: () => void;+ /** Slot rendered at the bottom of the sign-in card, below the+ * Google button. The web shell uses it for a "Prefer the desktop+ * app?" prompt; desktop omits it (a download prompt inside the app+ * would be absurd). */+ extra?: ReactNode;}// ---------------------------------------------------------------------------@@ -98,6 +103,7 @@ export function LoginPage({cliCallback,onTokenObtained,onGoogleLogin,+ extra,}: LoginPageProps) {const qc = useQueryClient();const [step, setStep] = useState<"email" | "code" | "cli_confirm">("email");@@ -471,6 +477,7 @@ export function LoginPage({</Button></>)}+ {extra && <div className="w-full pt-1 text-center">{extra}</div>}</CardFooter></Card></div>diff --git a/packages/views/onboarding/index.ts b/packages/views/onboarding/index.tsindex 1dc95a2b6f..c8611c7a65 100644--- a/packages/views/onboarding/index.ts+++ b/packages/views/onboarding/index.ts@@ -1,3 +1,4 @@export { OnboardingFlow, type OnboardingStep } from "./onboarding-flow";export { CliInstallInstructions } from "./steps/cli-install-instructions";export { StarterContentPrompt } from "./components/starter-content-prompt";+export { CloudWaitlistExpand } from "./components/cloud-waitlist-expand";diff --git a/packages/views/onboarding/onboarding-flow.tsx b/packages/views/onboarding/onboarding-flow.tsxindex 400dbec43b..857a84590c 100644--- a/packages/views/onboarding/onboarding-flow.tsx+++ b/packages/views/onboarding/onboarding-flow.tsx@@ -90,6 +90,12 @@ export function OnboardingFlow({const existingWorkspace = workspace ?? workspaces[0] ?? null;const canSkipWelcome = workspacesFetched && workspaces.length > 0;+ // The `runtimeInstructions` slot is only plumbed by the web shell+ // (desktop bundles a daemon, so a CLI install card would be noise+ // there). We reuse its presence as the web signal rather than+ // introducing a redundant prop.+ const isWeb = !!runtimeInstructions;+const handleWelcomeNext = useCallback(() => {setStep("questionnaire");}, []);@@ -164,6 +170,7 @@ export function OnboardingFlow({<StepWelcomeonNext={handleWelcomeNext}onSkip={canSkipWelcome ? handleWelcomeSkip : undefined}+ isWeb={isWeb}/>);}diff --git a/packages/views/onboarding/steps/cli-install-instructions.tsx b/packages/views/onboarding/steps/cli-install-instructions.tsxindex 01a7b56a28..7bbcd4da58 100644--- a/packages/views/onboarding/steps/cli-install-instructions.tsx+++ b/packages/views/onboarding/steps/cli-install-instructions.tsx@@ -63,8 +63,9 @@ export function CliInstallInstructions() {<Card className="w-full"><CardContent className="space-y-4 pt-4"><p className="text-xs leading-[1.55] text-muted-foreground">- You'll need a local AI coding tool (Claude Code, Codex,- Cursor, …) installed for the runtime to do real work.+ You'll need an AI coding tool on this machine (Claude+ Code, Codex, Cursor, …) for the daemon to do real work. Also+ works on servers and remote dev boxes.</p><Step n={1} label="Install the Multica CLI" cmd={INSTALL_CMD} /><Step n={2} label="Start the daemon" cmd={SETUP_CMD} />diff --git a/packages/views/onboarding/steps/step-platform-fork.test.tsx b/packages/views/onboarding/steps/step-platform-fork.test.tsxindex d117fdead0..37ecf0789b 100644--- a/packages/views/onboarding/steps/step-platform-fork.test.tsx+++ b/packages/views/onboarding/steps/step-platform-fork.test.tsx@@ -82,14 +82,6 @@ describe("StepPlatformFork", () => {mocks.joinCloudWaitlist.mockReset();resetPicker();vi.restoreAllMocks();- // Stub navigator so the component's post-hydration isMac check- // lands on the macOS branch by default. One test below overrides- // this to cover the non-Mac variant.- Object.defineProperty(window.navigator, "userAgent", {- value:- "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36",- configurable: true,- });});it("renders the three fork options at rest", () => {@@ -125,19 +117,23 @@ describe("StepPlatformFork", () => {expect(onNext).toHaveBeenCalledWith(null);});- it("opens the download URL and flips the card to a post-click state", async () => {+ it("opens the download page and flips the card to a post-click state", async () => {const openSpy = vi.spyOn(window, "open").mockReturnValue(null);const user = userEvent.setup();renderFork();await user.click(screen.getByText(/download the desktop app/i));+ // Routes to the new /download page (not GitHub releases) so the+ // user lands on the OS auto-detect surface.expect(openSpy).toHaveBeenCalledWith(- "https://github.com/multica-ai/multica/releases/latest",+ "/download","_blank","noopener,noreferrer",);- expect(screen.getByText(/downloading multica/i)).toBeInTheDocument();+ expect(+ screen.getByText(/continuing on the download page/i),+ ).toBeInTheDocument();});it("CLI dialog: opens with instructions + 'waiting' and a disabled Connect button", async () => {diff --git a/packages/views/onboarding/steps/step-platform-fork.tsx b/packages/views/onboarding/steps/step-platform-fork.tsxindex c4cbd17f16..29feb28ded 100644--- a/packages/views/onboarding/steps/step-platform-fork.tsx+++ b/packages/views/onboarding/steps/step-platform-fork.tsx@@ -2,7 +2,11 @@import { useEffect, useRef, useState, type ReactNode } from "react";import { ArrowLeft, ArrowRight, Download } from "lucide-react";-import { captureEvent, setPersonProperties } from "@multica/core/analytics";+import {+ captureDownloadIntent,+ captureEvent,+ setPersonProperties,+} from "@multica/core/analytics";import { Button } from "@multica/ui/components/ui/button";import {Dialog,@@ -47,13 +51,11 @@ import { CloudWaitlistExpand } from "../components/cloud-waitlist-expand";type DialogState = "cli" | "cloud" | null;-// Kept in sync with the Landing page's "Download Desktop" CTA-// (apps/web/features/landing/components/landing-hero.tsx). Both point-// at the GitHub Releases latest page, which redirects to the current-// tag and lists the platform-specific .dmg / .zip assets. There is no-// multica.ai-hosted download page — do not invent one here.-const DESKTOP_DOWNLOAD_URL =- "https://github.com/multica-ai/multica/releases/latest";+// Single canonical download destination — the /download page owns+// OS + arch detection, the All-Platforms matrix, release-note links,+// and the CLI / Cloud alternates. Kept in sync with landing-hero.tsx+// and landing footer nav, both of which target the same path.+const DOWNLOAD_PAGE_URL = "/download";export function StepPlatformFork({wsId,@@ -79,34 +81,40 @@ export function StepPlatformFork({const [downloaded, setDownloaded] = useState(false);const [waitlistSubmitted, setWaitlistSubmitted] = useState(false);- // Desktop app currently ships macOS binaries only (see electron-builder- // config + release workflow). On non-mac platforms we keep the card- // visible but muted, and redirect users to the CLI path.- // Default true to match SSR; useEffect corrects post-hydration.- const [isMac, setIsMac] = useState(true);- useEffect(() => {- if (typeof navigator === "undefined") return;- const p = navigator.platform || "";- const ua = navigator.userAgent || "";- setIsMac(/Mac|iPhone|iPad|iPod/i.test(p) || /Mac OS X/i.test(ua));- }, []);+ // Platform signal retained purely for PostHog dimensions — the UI+ // no longer branches on it (Windows / Linux desktop installers now+ // ship, so all three platforms get the same card). Computed+ // lazily; SSR-safe because handlers only run client-side.+ const isMac =+ typeof navigator !== "undefined" &&+ (/Mac|iPhone|iPad|iPod/i.test(navigator.platform || "") ||+ /Mac OS X/i.test(navigator.userAgent || ""));const picker = useRuntimePicker(wsId);const pickDesktop = () => {- window.open(DESKTOP_DOWNLOAD_URL, "_blank", "noopener,noreferrer");+ window.open(DOWNLOAD_PAGE_URL, "_blank", "noopener,noreferrer");setDownloaded(true);+ // Step-3-scoped path selection event (kept for existing funnels);+ // `source: "step3"` future-proofs if the event is reused from+ // another surface later.captureEvent("onboarding_runtime_path_selected", {path: "download_desktop",+ source: "step3",is_mac: isMac,});- setPersonProperties({ platform_preference: "desktop" });+ // Cross-surface Desktop intent event — also fires from landing+ // hero / footer / login / Welcome. Enables the top-of-funnel+ // split without retrofitting `onboarding_runtime_path_selected`+ // to non-onboarding contexts.+ captureDownloadIntent("step3");};const handleOpenCli = () => {setDialog("cli");captureEvent("onboarding_runtime_path_selected", {path: "cli",+ source: "step3",is_mac: isMac,});setPersonProperties({ platform_preference: "web" });@@ -116,6 +124,7 @@ export function StepPlatformFork({setDialog("cloud");captureEvent("onboarding_runtime_path_selected", {path: "cloud_waitlist",+ source: "step3",is_mac: isMac,});};@@ -131,10 +140,7 @@ export function StepPlatformFork({return "You're on the waitlist — pick Skip to keep exploring.";}if (downloaded) {- return "Downloading… finish setup in the desktop app, or pick another path.";- }- if (!isMac) {- return "Install the CLI to connect a runtime, or skip for now.";+ return "Finish setup on the download page, then come back to this tab.";}return "Pick a path above — or skip and configure a runtime later.";})();@@ -181,22 +187,18 @@ export function StepPlatformFork({</p><div className="mt-10 flex max-w-[560px] flex-col gap-3.5">- <ForkPrimary- onClick={pickDesktop}- downloaded={downloaded}- isMac={isMac}- />+ <ForkPrimary onClick={pickDesktop} downloaded={downloaded} /><ForkAlttitle="Install the CLI"- subtitle="Run the Multica daemon yourself — a couple of terminal commands."+ subtitle="For servers, remote dev boxes, and headless setups. Terminal required."actionLabel="Show steps"onAction={handleOpenCli}/><ForkAlttitle="Cloud runtime"- subtitle="We host it for you. Not live yet — leave your email and we'll let you know."+ subtitle="We host the runtime. Not live yet — join the waitlist."actionLabel={waitlistSubmitted ? "On the list" : "Join waitlist"}@@ -263,41 +265,10 @@ export function StepPlatformFork({function ForkPrimary({onClick,downloaded,- isMac,}: {onClick: () => void;downloaded: boolean;- isMac: boolean;}) {- // On non-mac platforms we can't deliver a binary yet. The card stays- // visible so users understand the desktop app exists, but it's muted- // and steers them down to the CLI path.- if (!isMac) {- return (- <div- aria-disabled="true"- className="flex cursor-not-allowed items-center justify-between gap-4 rounded-xl border bg-muted/40 px-6 py-5 text-left"- >- <div className="min-w-0">- <div className="flex items-center gap-2 text-[17px] font-medium tracking-tight text-muted-foreground">- <Download className="h-4 w-4" aria-hidden />- Desktop app — macOS only for now- </div>- <div className="mt-1 text-[13px] text-muted-foreground/80">- Windows and Linux builds are on the way. In the meantime,- install the CLI below — it takes about two minutes.- </div>- </div>- <span- aria-hidden- className="flex h-9 w-9 shrink-0 items-center justify-center rounded-full bg-muted text-muted-foreground"- >- <ArrowRight className="h-4 w-4" />- </span>- </div>- );- }-return (<buttontype="button"@@ -310,12 +281,12 @@ function ForkPrimary({<div className="min-w-0"><div className="flex items-center gap-2 text-[17px] font-medium tracking-tight"><Download className="h-4 w-4" aria-hidden />- {downloaded ? "Downloading Multica…" : "Download the desktop app"}+ {downloaded ? "Continuing on the download page…" : "Download the desktop app"}</div><div className="mt-1 text-[13px] text-background/60">{downloaded- ? "Opened in a new tab. Finish setup inside the desktop app."- : "macOS · runtime bundled — detects your tools automatically, nothing to install."}+ ? "Opened in a new tab. Pick your installer there, then finish setup on desktop."+ : "Bundled daemon, zero setup. Pick your platform on the next page."}</div></div><span@@ -409,8 +380,9 @@ function CliInstallDialog({<DialogHeader><DialogTitle>Install the CLI</DialogTitle><DialogDescription>- Runs the same daemon the desktop app bundles — you install- it yourself.+ Same daemon as Desktop, installed via terminal. Use it when+ Desktop doesn't fit — servers, remote dev boxes, or+ headless setups.</DialogDescription></DialogHeader>@@ -582,12 +554,11 @@ function CliWaitingStatus({ dialogOpen }: { dialogOpen: boolean }) {)}{stage === "stalled" && (<>- Nothing coming through yet. Close this dialog and try another- path on the previous screen —{" "}- <span className="font-medium text-foreground">Skip for now</span>{" "}- (in the footer) enters your workspace in read-only mode, or- the <span className="font-medium text-foreground">Cloud runtime</span>{" "}- card lets you join the waitlist.+ Nothing coming through yet. If you're not comfortable+ with the terminal,{" "}+ <span className="font-medium text-foreground">Desktop</span>{" "}+ is the smoother path — it bundles the daemon. Close this+ dialog and pick Desktop, or hit Skip to continue.</>)}</p>diff --git a/packages/views/onboarding/steps/step-welcome.tsx b/packages/views/onboarding/steps/step-welcome.tsxindex e93458c50c..6df3dd1020 100644--- a/packages/views/onboarding/steps/step-welcome.tsx+++ b/packages/views/onboarding/steps/step-welcome.tsx@@ -1,9 +1,10 @@"use client";import { useState } from "react";-import { ArrowRight, Loader2 } from "lucide-react";-import { Button } from "@multica/ui/components/ui/button";+import { ArrowRight, Download, Loader2 } from "lucide-react";+import { Button, buttonVariants } from "@multica/ui/components/ui/button";import { MulticaIcon } from "@multica/ui/components/common/multica-icon";+import { captureDownloadIntent } from "@multica/core/analytics";import { cn } from "@multica/ui/lib/utils";import { DragStrip } from "@multica/views/platform";import { STATUS_CONFIG } from "@multica/core/issues/config";@@ -28,13 +29,21 @@ import { ProviderLogo } from "../../runtimes/components/provider-logo";* onboarding complete server-side and sends the user straight to* their existing workspace. OnboardingFlow only passes it when the* user has ≥ 1 workspace — without that, skipping lands in limbo.+ *+ * `isWeb` flips two things when true: the subheading acknowledges+ * that web users have an extra runtime step (so "3 minutes" stops+ * being a lie), and a "Download Desktop" secondary CTA surfaces+ * before the user has invested in questionnaire / workspace. Desktop+ * bundles a daemon, so the same prompt would be noise there.*/export function StepWelcome({onNext,onSkip,+ isWeb = false,}: {onNext: () => void | Promise<void>;onSkip?: () => void | Promise<void>;+ isWeb?: boolean;}) {// Tracks which button is mid-flight so we can show a per-button// spinner and disable both while one is in progress.@@ -86,23 +95,63 @@ export function StepWelcome({pick it up, update status, and comment when done.</p><p className="text-sm leading-relaxed text-muted-foreground">- Takes about 3 minutes. You'll end with a real agent- replying to a real issue.+ {isWeb ? (+ <>+ Desktop bundles the runtime — nothing to install.+ Continue on web to connect your own CLI.+ </>+ ) : (+ "By the end, a real agent will be replying to your first issue."+ )}</p></div><div className="flex flex-wrap items-center gap-3">- <Button- size="lg"- onClick={handleNext}- disabled={pending !== null}- >- {pending === "next" && (- <Loader2 className="h-4 w-4 animate-spin" />- )}- Start exploring- <ArrowRight className="h-4 w-4" />- </Button>+ {isWeb ? (+ <>+ {/* `<a>` rather than `<Button onClick={window.open}>`+ so middle-click / cmd-click / "Copy link" all+ behave and screen readers announce it as a link+ (it navigates; `Continue on web` is the button+ that mutates flow state). New tab preserves this+ onboarding tab in case the desktop install+ stalls and the user falls back here. */}+ <a+ href="/download"+ target="_blank"+ rel="noopener noreferrer"+ onClick={() => captureDownloadIntent("welcome")}+ className={buttonVariants({ size: "lg" })}+ >+ <Download className="h-4 w-4" />+ Download Desktop+ </a>+ <Button+ size="lg"+ variant="outline"+ onClick={handleNext}+ disabled={pending !== null}+ >+ {pending === "next" && (+ <Loader2 className="h-4 w-4 animate-spin" />+ )}+ Continue on web+ <ArrowRight className="h-4 w-4" />+ </Button>+ </>+ ) : (+ <Button+ size="lg"+ onClick={handleNext}+ disabled={pending !== null}+ >+ {pending === "next" && (+ <Loader2 className="h-4 w-4 animate-spin" />+ )}+ Start exploring+ <ArrowRight className="h-4 w-4" />+ </Button>+ )}{onSkip && (<Buttonsize="lg"