Skip to content

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

feat(website): /app sends a phone to the Harness app in its store (#1248)

Jacob Pham488da2442758
diff --git a/website/README.md b/website/README.md
index 53b17e6be..6442d3218 100644
--- a/website/README.md
+++ b/website/README.md
@@ -12,6 +12,7 @@ retired; only the host routes below were kept.
|---|---|
| `/`, `/s/:id`, `/auth/callback`, `/callback` | The Flutter app (`public/harness-web/index.html`, via `rewrites()` in `next.config.js`) |
| `/download` (and `/install` → it) | Install page: CLI command and desktop downloads |
+| `/app` | The phone app's download code: an iPhone or iPad is redirected to the App Store and an Android device to Google Play, by user agent (`src/lib/phoneApp.ts`); anything else gets both stores |
| `/pair` | Phone setup guidance — the mobile app and the desktop "add phone" dialog link here |
| `/os` | The Harness operating system landing page: plain HTML/CSS, local fonts and screenshots in `public/os/` |
| `/agents` | Harness for agents: install, the agent commands with examples and exit codes, the plugin and skill. One plain HTML file, `public/agents/index.html`, with no script |
diff --git a/website/src/app/app/page.spec.tsx b/website/src/app/app/page.spec.tsx
new file mode 100644
index 000000000..dbfac61be
--- /dev/null
+++ b/website/src/app/app/page.spec.tsx
@@ -0,0 +1,29 @@
+import { render, screen } from "@testing-library/react";
+import { beforeEach, describe, expect, it, vi } from "vitest";
+import { APP_STORE_URL, GOOGLE_PLAY_URL } from "@/lib/phoneApp";
+
+const mocks = vi.hoisted(() => ({ userAgent: "", redirect: vi.fn((url: string) => { throw new Error(`redirect ${url}`); }) }));
+vi.mock("next/headers", () => ({ headers: async () => new Headers({ "user-agent": mocks.userAgent }) }));
+vi.mock("next/navigation", () => ({ redirect: mocks.redirect }));
+
+import AppPage from "./page";
+
+beforeEach(() => { mocks.redirect.mockClear(); });
+
+describe("/app — the phone app's download code", () => {
+ it("sends an iPhone to the App Store and an Android phone to Google Play", async () => {
+ mocks.userAgent = "Mozilla/5.0 (iPhone; CPU iPhone OS 18_0 like Mac OS X)";
+ await expect(AppPage()).rejects.toThrow(`redirect ${APP_STORE_URL}`);
+ mocks.userAgent = "Mozilla/5.0 (Linux; Android 14; Pixel 8) Chrome/130.0 Mobile";
+ await expect(AppPage()).rejects.toThrow(`redirect ${GOOGLE_PLAY_URL}`);
+ });
+
+ it("offers a computer both stores instead of a dead end", async () => {
+ mocks.userAgent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7)";
+ render(await AppPage());
+ expect(mocks.redirect).not.toHaveBeenCalled();
+ expect(screen.getByRole("heading", { name: "Get Harness on your phone" })).toBeInTheDocument();
+ expect(screen.getByRole("link", { name: "App Store" })).toHaveAttribute("href", APP_STORE_URL);
+ expect(screen.getByRole("link", { name: "Google Play" })).toHaveAttribute("href", GOOGLE_PLAY_URL);
+ });
+});
diff --git a/website/src/app/app/page.tsx b/website/src/app/app/page.tsx
new file mode 100644
index 000000000..2e56643a4
--- /dev/null
+++ b/website/src/app/app/page.tsx
@@ -0,0 +1,36 @@
+import { Smartphone } from "lucide-react";
+import { headers } from "next/headers";
+import { redirect } from "next/navigation";
+import { APP_STORE_URL, GOOGLE_PLAY_URL, phoneStoreUrl } from "@/lib/phoneApp";
+import cardStyles from "../pair/page.module.css";
+import buttonStyles from "../desktop/page.module.css";
+
+export const dynamic = "force-dynamic";
+
+/**
+ * `harness.autonomous.ai/app` — the download code for the phone app. A phone's camera opens it, and
+ * the server sends it straight to its store by user agent: an iPhone to the App Store, an Android
+ * phone to Google Play, each of which opens in the store app. Anything else — a computer, or an iPad
+ * asking for the desktop site — gets both stores to choose from rather than a dead end.
+ */
+export default async function AppPage() {
+ const store = phoneStoreUrl((await headers()).get("user-agent"));
+ if (store) redirect(store);
+ return (
+ <main className={cardStyles.wrap}>
+ <section className={cardStyles.card}>
+ <div className={cardStyles.badge}>
+ <Smartphone size={20} strokeWidth={2} />
+ </div>
+ <h1 className={cardStyles.title}>Get Harness on your phone</h1>
+ <p className={cardStyles.sub}>
+ Open <strong>harness.autonomous.ai/app</strong> on your iPhone or Android phone, or choose its store here.
+ </p>
+ <div className={buttonStyles.downloads}>
+ <a className={buttonStyles.download} href={APP_STORE_URL}>App Store</a>
+ <a className={buttonStyles.download} href={GOOGLE_PLAY_URL}>Google Play</a>
+ </div>
+ </section>
+ </main>
+ );
+}
diff --git a/website/src/lib/phoneApp.spec.ts b/website/src/lib/phoneApp.spec.ts
new file mode 100644
index 000000000..ff002c5df
--- /dev/null
+++ b/website/src/lib/phoneApp.spec.ts
@@ -0,0 +1,35 @@
+// @vitest-environment node
+import { readFileSync } from "node:fs";
+import { describe, expect, it } from "vitest";
+import { APP_STORE_URL, GOOGLE_PLAY_URL, phoneStoreUrl } from "./phoneApp";
+
+const iphone = "Mozilla/5.0 (iPhone; CPU iPhone OS 18_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.0 Mobile/15E148 Safari/604.1";
+const android = "Mozilla/5.0 (Linux; Android 14; Pixel 8) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Mobile Safari/537.36";
+const mac = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.0 Safari/605.1.15";
+
+describe("phoneStoreUrl", () => {
+ it("sends an iPhone, iPad or iPod to the App Store", () => {
+ expect(phoneStoreUrl(iphone)).toBe(APP_STORE_URL);
+ expect(phoneStoreUrl("Mozilla/5.0 (iPad; CPU OS 17_0 like Mac OS X)")).toBe(APP_STORE_URL);
+ // Chrome and Firefox on iOS name the iPhone too.
+ expect(phoneStoreUrl(`${iphone} CriOS/130.0`)).toBe(APP_STORE_URL);
+ });
+
+ it("sends an Android phone or tablet to Google Play", () => {
+ expect(phoneStoreUrl(android)).toBe(GOOGLE_PLAY_URL);
+ expect(phoneStoreUrl("Mozilla/5.0 (Linux; Android 13; SM-X700) AppleWebKit/537.36 Chrome/130.0 Safari/537.36")).toBe(GOOGLE_PLAY_URL);
+ });
+
+ it("leaves computers, an iPad asking for the desktop site, and no user agent to the page", () => {
+ expect(phoneStoreUrl(mac)).toBeNull();
+ expect(phoneStoreUrl("Mozilla/5.0 (Windows NT 10.0; Win64; x64)")).toBeNull();
+ expect(phoneStoreUrl("Mozilla/5.0 (X11; Linux x86_64) Chrome/130.0")).toBeNull();
+ expect(phoneStoreUrl(null)).toBeNull();
+ });
+
+ it("names the same store listings as the desktop app", () => {
+ const dart = readFileSync(new URL("../../../desktop/lib/core/phone_app_links.dart", import.meta.url), "utf8");
+ expect(dart).toContain(`'${APP_STORE_URL}'`);
+ expect(dart).toContain(`'${GOOGLE_PLAY_URL}'`);
+ });
+});
diff --git a/website/src/lib/phoneApp.ts b/website/src/lib/phoneApp.ts
new file mode 100644
index 000000000..be06ceb67
--- /dev/null
+++ b/website/src/lib/phoneApp.ts
@@ -0,0 +1,20 @@
+/**
+ * The Harness phone app in its stores, and which store a phone's browser belongs to: what `/app`
+ * redirects to. The same listings as the desktop app's `desktop/lib/core/phone_app_links.dart`
+ * (`phoneApp.spec.ts` checks), so a listing that moves moves everywhere.
+ */
+
+export const APP_STORE_URL = "https://apps.apple.com/us/app/harness-like-a-boss/id6812264068";
+export const GOOGLE_PLAY_URL = "https://play.google.com/store/apps/details?id=ai.autonomous.harness.android";
+
+/**
+ * The store for this user agent, or null for anything that is not a phone or tablet it can name.
+ * iPadOS Safari asks for desktop sites by default and reports itself as a Mac, which a server cannot
+ * tell apart from one: it gets the page with both stores, like a computer.
+ */
+export function phoneStoreUrl(userAgent: string | null): string | null {
+ const agent = (userAgent ?? "").toLowerCase();
+ if (/iphone|ipad|ipod/.test(agent)) return APP_STORE_URL;
+ if (agent.includes("android")) return GOOGLE_PLAY_URL;
+ return null;
+}