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.

5.3 KB
Raw Blame
"use client";

// The web app at the root is a separate Flutter app; workspace links need a full document navigation.

import { useEffect, useRef, useState } from "react";
import styles from "./page.module.css";
import { buildsFor } from "@/lib/desktopPlatform";
import { INSTALL_COMMAND } from "@/lib/installCommand";
import { useVisitorPlatform } from "@/lib/useVisitorPlatform";
import { webAppPath } from "@/lib/webApp";

const commands = [
  { id: "install", label: "1. Install", value: INSTALL_COMMAND },
  { id: "login", label: "2. Sign in", value: "harness login" },
  { id: "start", label: "3. Start", value: "harness start" },
] as const;

type CommandId = (typeof commands)[number]["id"];

/** Public /download page. The root serves the web app (the shared Flutter workspace). */
export default function Page() {
  const [copied, setCopied] = useState<CommandId | null>(null);
  const [copyError, setCopyError] = useState(false);
  const reset = useRef<ReturnType<typeof setTimeout> | null>(null);
  const platform = useVisitorPlatform();

  useEffect(() => () => {
    if (reset.current) clearTimeout(reset.current);
  }, []);

  const copy = async (id: CommandId, command: string) => {
    if (reset.current) clearTimeout(reset.current);
    setCopied(null);
    setCopyError(false);
    try {
      if (!navigator.clipboard) throw new Error("Clipboard unavailable");
      await navigator.clipboard.writeText(command);
      setCopied(id);
      reset.current = setTimeout(() => setCopied(null), 2000);
    } catch {
      setCopyError(true);
    }
  };

  return (
    <div className={styles.page}>
      <header className={styles.bar}>
        <nav className={styles.navigation} aria-label="Harness">
          <a className={styles.brand} href={webAppPath}>Harness</a>
          <span className={styles.activeTab} aria-current="page">Downloads</span>
        </nav>
        <a className={styles.textAction} href={webAppPath}>[ Open web app ]</a>
      </header>

      <main className={styles.main}>
        <div className={styles.intro}>
          <h1>Download Harness</h1>
          <p>Your agents, wherever you work.</p>
        </div>

        <div className={styles.workspace}>
          <section className={styles.section} aria-labelledby="desktop-heading">
            <header className={styles.sectionHeader}>
              <span className={styles.sectionNumber} aria-hidden="true">01</span>
              <h2 id="desktop-heading">Download the desktop app</h2>
            </header>
            <div className={styles.sectionBody}>
              <p className={styles.description}>One workspace for all your agents and machines.</p>
              <div className={styles.downloads}>
                {buildsFor(platform).map(({ id, name, detail, href }) => {
                  // Any Mac marks macOS (both builds run on either CPU); a Linux CPU nobody named marks neither.
                  const suggested = id === platform;
                  return (
                    <a className={suggested ? `${styles.download} ${styles.suggested}` : styles.download} href={href} key={href}>
                      <span className={styles.platform}>{name}</span>
                      <span className={styles.platformDetail}>{suggested ? `${detail} · this computer` : detail}</span>
                      <span className={styles.downloadAction}>[ Download ]</span>
                    </a>
                  );
                })}
              </div>
              <p className={styles.note}>
                Signed and notarized on macOS.<br />
                The app keeps itself up to date.
              </p>
            </div>
          </section>

          <section className={styles.section} aria-labelledby="cli-heading">
            <header className={styles.sectionHeader}>
              <span className={styles.sectionNumber} aria-hidden="true">02</span>
              <h2 id="cli-heading">Install the CLI</h2>
            </header>
            <div className={styles.sectionBody}>
              <p className={styles.description}>For your terminal. macOS and Linux.</p>
              <ol className={styles.commands}>
                {commands.map(({ id, label, value }) => (
                  <li className={styles.command} key={id}>
                    <div className={styles.commandHeader}>
                      <span>{label}</span>
                      <button
                        type="button"
                        className={styles.copy}
                        aria-label={`Copy ${label.toLowerCase()}`}
                        onClick={() => void copy(id, value)}
                      >
                        {copied === id ? "[ Copied ]" : "[ Copy ]"}
                      </button>
                    </div>
                    <code className={styles.commandValue} title={value}>{value}</code>
                  </li>
                ))}
              </ol>
              <p className={styles.note} role="status" aria-live="polite">
                {copyError
                  ? "Couldn't copy. Select the command and copy it manually."
                  : copied
                    ? "Command copied. Paste it into your terminal."
                    : "Sign-in opens your browser."}
              </p>
            </div>
          </section>
        </div>

        <footer className={styles.footer}>
          Same agents. Same workspace. Desktop, terminal, or web.
        </footer>
      </main>
    </div>
  );
}