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.
TypeScript 3d-modelingagent-frameworkagent-harnessai-agentscadclaude-codecodexcoding-agentsdeveloper-toolsesp32game-developmentmcp-servermulti-agentopen-hardwareopencodeopenharnesspcbroboticsterminaltmux
web: harness.autonomous.ai opens the web app again; the Hub stays at /hub (#1712)
Jacob Phamecad97507e8f
diff --git a/desktop/README.md b/desktop/README.mdindex 5d0c78f90..7013793cb 100644--- a/desktop/README.md+++ b/desktop/README.md@@ -13,8 +13,8 @@ the browser renders managed viewers on their connected machine.`hn view` can open a viewer companion at `/?viewer=1&machine=<id>&agent=<id>`.This owner-only destination uses normal sign-in and machine linking. It does not restore orsave the workspace, join the shared desk, or attach a terminal. OAuth returns to the same-viewer after sign-in. The website root serves it while `machine` is in the query; any other-visit to `/` redirects to the Hub, and the hosted workspace is at `/web`, where sign-in returns.+viewer after sign-in. The website root serves it while `machine` is in the query; otherwise+the root is the hosted workspace, where sign-in returns (`/web` redirects there).Publish the browser build before the corresponding native hn release so the entry pointrecognizes the viewer destination.diff --git a/desktop/lib/viewer/browser_login.dart b/desktop/lib/viewer/browser_login.dartindex 52de0c575..8dd5326f0 100644--- a/desktop/lib/viewer/browser_login.dart+++ b/desktop/lib/viewer/browser_login.dart@@ -49,11 +49,6 @@ class BrowserLogin implements SignInClient, PhoneSignInClient {static String _callbackPath(Uri location) =>_isLoopback(location) ? '/callback' : '/auth/callback';- // The hosted workspace lives at /web (its origin's / opens the Hub, owner 2026-10-13); a local- // build serves the app at its root.- static String _workspacePath(Uri location) =>- _isLoopback(location) ? '/' : '/web';-@overrideFuture<CliAuthStatus> checkStatus() =>_checking ??= _checkStatus().whenComplete(() {@@ -66,8 +61,9 @@ class BrowserLogin implements SignInClient, PhoneSignInClient {if (uri.path == _callbackPath(uri)) {final raw = browser.transaction;browser.transaction = null;- // Remove the one-use code before any API call or application telemetry.- browser.replaceLocation(_workspacePath(uri));+ // Remove the one-use code before any API call or application telemetry. The workspace is the+ // origin's front door, hosted or local (owner, 2026-10-26).+ browser.replaceLocation('/');try {final saved = raw == null ? null : jsonDecode(raw);final now = _clock().millisecondsSinceEpoch;diff --git a/desktop/test/browser_login_test.dart b/desktop/test/browser_login_test.dartindex 6c927a38f..3c055c6a3 100644--- a/desktop/test/browser_login_test.dart+++ b/desktop/test/browser_login_test.dart@@ -303,18 +303,19 @@ void main() {expect(browser.transaction, isNull);});- for (final (origin, path, workspace) in [- ('https://harness.example', '/auth/callback', '/web'),- ('http://127.0.0.1:54732', '/callback', '/'),+ // The workspace is its origin's front door, hosted or local.+ for (final (origin, path) in [+ ('https://harness.example', '/auth/callback'),+ ('http://127.0.0.1:54732', '/callback'),]) {test(- 'callback on $origin cleans the URL to the workspace ($workspace), exchanges once, and persists the session',+ 'callback on $origin cleans the URL to the workspace at /, exchanges once, and persists the session',() async {callback(origin: origin, path: path);final first = login.checkStatus();final second = login.checkStatus();expect(identical(first, second), isTrue);- expect(browser.uri.toString(), '$origin$workspace');+ expect(browser.uri.toString(), '$origin/');expect(browser.transaction, isNull);expect(api.requests.single, (code: 'one-use',diff --git a/website/README.md b/website/README.mdindex 860bd0d4e..7ed484cad 100644--- a/website/README.md+++ b/website/README.md@@ -10,8 +10,8 @@ retired; only the host routes below were kept.| Route | What ||---|---|-| `/` | Redirects (307) to `/hub`, the front door (owner, 2026-10-13). An `hn view` link (`/?machine=…&agent=…`) still opens the Flutter viewer here |-| `/web`, `/s/:id`, `/auth/callback`, `/callback` | The Flutter app (`public/harness-web/index.html`, via `rewrites()` in `next.config.js`); `/web` is the workspace, where sign-in returns (`src/lib/webApp.ts`) |+| `/`, `/s/:id`, `/auth/callback`, `/callback` | The Flutter app (`public/harness-web/index.html`, via `rewrites()` in `next.config.js`); `/` is the workspace and the front door (owner, 2026-10-26), where sign-in returns (`src/lib/webApp.ts`), and an `hn view` link (`/?machine=…&agent=…`) opens its viewer |+| `/web` | Redirects (307) to `/`, keeping the query: the workspace's address from 2026-10-13 to 2026-10-26, when the Hub was the front door || `/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 |diff --git a/website/next.config.js b/website/next.config.jsindex 78b7b2451..65eeb9ece 100644--- a/website/next.config.js+++ b/website/next.config.js@@ -31,9 +31,9 @@ module.exports = {destination: 'https://harness.autonomous.ai/:path*',permanent: true,})),- // The front door is the Hub (owner, 2026-10-13); the workspace moved to /web. Temporary, so a- // browser does not cache it. `hn view` links (/?machine=…&agent=…) still open the viewer here.- { source: '/', missing: [{ type: 'query', key: 'machine' }], destination: '/hub', permanent: false },+ // The front door is the web app again (owner, 2026-10-26; from 2026-10-13 it was the Hub and the+ // app lived at /web). Old /web links land on it, query and all; temporary, so no browser keeps it.+ { source: '/web', destination: '/', permanent: false },{ source: '/install', destination: '/download', permanent: true },{ source: '/explore', destination: '/hub', permanent: true },{ source: '/explore/:id', destination: '/hub/:id', permanent: true },@@ -68,9 +68,7 @@ module.exports = {// Older desktop builds consume snapshots without following redirects.{ source: '/explore/:id/snapshot', destination: '/hub/:id/snapshot' },{ source: '/explore/:id/download', destination: '/hub/:id/download' },- // `/` reaches here only as an `hn view` link; everything else there redirects to the Hub.{ source: '/', destination: '/harness-web/index.html' },- { source: '/web', destination: '/harness-web/index.html' },{ source: '/s/:id', destination: '/harness-web/index.html' },{ source: '/auth/callback', destination: '/harness-web/index.html' },// Local website previews use the SSO service's native loopback callback.@@ -141,7 +139,7 @@ module.exports = {{ key: 'Cache-Control', value: 'public, max-age=31536000, immutable' },],},- ...['/', '/web', '/s/:id', '/auth/callback', '/callback', '/harness-web', '/harness-web/index.html', '/harness-web/release.json'].map((source) => ({+ ...['/', '/s/:id', '/auth/callback', '/callback', '/harness-web', '/harness-web/index.html', '/harness-web/release.json'].map((source) => ({source,headers: [{ key: 'Cache-Control', value: 'no-store' },diff --git a/website/scripts/check-harness-web.mjs b/website/scripts/check-harness-web.mjsindex 139aeb7b0..057fdff63 100644--- a/website/scripts/check-harness-web.mjs+++ b/website/scripts/check-harness-web.mjs@@ -5,11 +5,11 @@ import { releaseAssetBase } from './harness-web-assets.mjs';const base = new URL(process.argv[2] || 'http://127.0.0.1:3000');const release = JSON.parse(await readFile(new URL('../harness-web-release.json', import.meta.url), 'utf8'));const assetBase = releaseAssetBase(release);-// The front door is the Hub: `/` redirects there, temporarily, unless it is an `hn view` link.-const front = await fetch(new URL('/', base), { redirect: 'manual' });-assert.equal(front.status, 307, '/ must redirect to the Hub');-assert.equal(new URL(front.headers.get('location'), base).pathname, '/hub');-for (const route of ['/web', '/?viewer=1&machine=fixture-machine&agent=fixture-agent', '/s/11111111-1111-4111-8111-111111111111', '/auth/callback?code=fixture-code&state=fixture-state', '/callback', '/harness-web']) {+// The front door is the web app; its old address `/web` sends there, temporarily, query and all.+const old = await fetch(new URL('/web?machine=fixture-machine&agent=fixture-agent', base), { redirect: 'manual' });+assert.equal(old.status, 307, '/web must redirect to the web app at /');+assert.equal(new URL(old.headers.get('location'), base).href, new URL('/?machine=fixture-machine&agent=fixture-agent', base).href);+for (const route of ['/', '/?viewer=1&machine=fixture-machine&agent=fixture-agent', '/s/11111111-1111-4111-8111-111111111111', '/auth/callback?code=fixture-code&state=fixture-state', '/callback', '/harness-web']) {const response = await fetch(new URL(route, base));assert.equal(response.status, 200, route);assert.match(response.headers.get('content-type'), /text\/html/);diff --git a/website/scripts/fetch-harness-web.mjs b/website/scripts/fetch-harness-web.mjsindex 69e26526a..27c0b17d9 100644--- a/website/scripts/fetch-harness-web.mjs+++ b/website/scripts/fetch-harness-web.mjs@@ -1,10 +1,11 @@import { createHash } from 'node:crypto';import { execFileSync } from 'node:child_process';-import { cp, mkdtemp, mkdir, readFile, rename, rm, writeFile } from 'node:fs/promises';+import { cp, mkdtemp, mkdir, readFile, rm, writeFile } from 'node:fs/promises';import { tmpdir } from 'node:os';import path from 'node:path';import { fileURLToPath } from 'node:url';import { configureReleaseAssets, releaseAssetBase } from './harness-web-assets.mjs';+import { moveDirectory } from './move-directory.mjs';// This package hosts the compiled app; its only source is desktop/ in the same repository.// Release builds pass the bundle CI just built via HARNESS_WEB_ARCHIVE (see Dockerfile.k8s and@@ -53,13 +54,13 @@ try {await cp(extracted, versioned, { recursive: true });const versionedDestination = path.join(extracted, releaseAssetBase(release).slice('/harness-web/'.length));await mkdir(path.dirname(versionedDestination), { recursive: true });- await rename(versioned, versionedDestination);+ await moveDirectory(versioned, versionedDestination);// Retain legacy paths for tabs opened before this deployment. New entries// load JavaScript, fonts and CanvasKit exclusively from the archive namespace.await writeFile(path.join(extracted, 'index.html'), entry);const destination = path.join(root, 'public/harness-web');await rm(destination, { recursive: true, force: true });- await rename(extracted, destination);+ await moveDirectory(extracted, destination);console.log(`Prepared Harness Web ${release.version} (${release.sourceCommit.slice(0, 12)})`);} finally {await rm(temporary, { recursive: true, force: true });diff --git a/website/scripts/move-directory.mjs b/website/scripts/move-directory.mjsnew file mode 100644index 000000000..27eb22a3a--- /dev/null+++ b/website/scripts/move-directory.mjs@@ -0,0 +1,25 @@+import { cp as copyTree, mkdtemp, rename as renameEntry, rm } from 'node:fs/promises';+import path from 'node:path';++/**+ * Moves a directory to `to`. A rename cannot cross filesystems (EXDEV: a CI runner's /tmp may sit on+ * another disk than the checkout), so there it copies the tree into a folder beside `to`, renames that+ * into place and removes the source: a copy that fails partway never leaves a half-written `to`.+ */+export async function moveDirectory(from, to, { rename = renameEntry, cp = copyTree } = {}) {+ try {+ await rename(from, to);+ return;+ } catch (error) {+ if (error?.code !== 'EXDEV') throw error;+ }+ const staging = await mkdtemp(path.join(path.dirname(to), `.${path.basename(to)}-`));+ try {+ await cp(from, staging, { recursive: true });+ await rename(staging, to);+ } catch (error) {+ await rm(staging, { recursive: true, force: true });+ throw error;+ }+ await rm(from, { recursive: true, force: true });+}diff --git a/website/scripts/move-directory.test.mjs b/website/scripts/move-directory.test.mjsnew file mode 100644index 000000000..f9b192d39--- /dev/null+++ b/website/scripts/move-directory.test.mjs@@ -0,0 +1,56 @@+import { cp, mkdtemp, mkdir, readdir, readFile, rename, rm, stat, writeFile } from 'node:fs/promises';+import { tmpdir } from 'node:os';+import path from 'node:path';+import { afterEach, beforeEach, describe, expect, it } from 'vitest';+import { moveDirectory } from './move-directory.mjs';++// The source is on another disk (a runner's /tmp); renames beside the destination still work.+const crossDevice = async (source, target) => {+ if (source !== from) return rename(source, target);+ throw Object.assign(new Error('EXDEV: cross-device link not permitted'), { code: 'EXDEV' });+};+let scratch, from, to;++beforeEach(async () => {+ scratch = await mkdtemp(path.join(tmpdir(), 'move-directory-'));+ from = path.join(scratch, 'extracted');+ to = path.join(scratch, 'public', 'harness-web');+ await mkdir(path.join(from, 'assets'), { recursive: true });+ await writeFile(path.join(from, 'index.html'), '<base href="/harness-web/">');+ await writeFile(path.join(from, 'assets', 'FontManifest.json'), '[]');+ await mkdir(path.dirname(to));+});+afterEach(() => rm(scratch, { recursive: true, force: true }));++async function expectMoved() {+ expect(await readFile(path.join(to, 'index.html'), 'utf8')).toBe('<base href="/harness-web/">');+ expect(await readFile(path.join(to, 'assets', 'FontManifest.json'), 'utf8')).toBe('[]');+ await expect(stat(from)).rejects.toMatchObject({ code: 'ENOENT' });+}++describe('moveDirectory', () => {+ it('renames within one filesystem', async () => {+ await moveDirectory(from, to);+ await expectMoved();+ });+ it('copies, then removes the source, when the rename crosses filesystems (a runner whose /tmp is another disk)', async () => {+ await moveDirectory(from, to, { rename: crossDevice });+ await expectMoved();+ });+ it('leaves no half-written destination when the copy fails partway', async () => {+ const copyThenFail = async (source, target, options) => {+ await cp(path.join(source, 'index.html'), path.join(target, 'index.html'), options);+ throw Object.assign(new Error('ENOSPC: no space left on device'), { code: 'ENOSPC' });+ };+ await expect(moveDirectory(from, to, { rename: crossDevice, cp: copyThenFail })).rejects.toMatchObject({ code: 'ENOSPC' });+ await expect(stat(to)).rejects.toMatchObject({ code: 'ENOENT' });+ expect(await readdir(path.dirname(to))).toEqual([]);+ expect(await readFile(path.join(from, 'index.html'), 'utf8')).toBe('<base href="/harness-web/">');+ });+ it('does not hide any other rename failure', async () => {+ const denied = async () => { throw Object.assign(new Error('EACCES'), { code: 'EACCES' }); };+ await expect(moveDirectory(from, to, { rename: denied })).rejects.toMatchObject({ code: 'EACCES' });+ expect(await readFile(path.join(from, 'index.html'), 'utf8')).toBe('<base href="/harness-web/">');+ await expect(stat(to)).rejects.toMatchObject({ code: 'ENOENT' });+ });+});diff --git a/website/src/app/download/page.spec.tsx b/website/src/app/download/page.spec.tsxindex 9693b4d0f..2ddd018a2 100644--- a/website/src/app/download/page.spec.tsx+++ b/website/src/app/download/page.spec.tsx@@ -19,8 +19,10 @@ describe("/download", () => {render(<Page />);expect(screen.getByRole("heading", { name: "Download Harness" })).toBeInTheDocument();- // Downloads stay public; entering the separate Flutter workspace is an ordinary link.- expect(screen.getByRole("link", { name: "[ Open web app ]" })).toHaveAttribute("href", "/web");+ // Downloads stay public; entering the separate Flutter workspace, the site's front door, is an+ // ordinary link.+ expect(screen.getByRole("link", { name: "[ Open web app ]" })).toHaveAttribute("href", "/");+ expect(screen.getByRole("link", { name: "Harness" })).toHaveAttribute("href", "/");expect(screen.queryByRole("link", { name: /sign in/i })).not.toBeInTheDocument();});diff --git a/website/src/app/download/page.tsx b/website/src/app/download/page.tsxindex bbdef1379..da95e9c4a 100644--- a/website/src/app/download/page.tsx+++ b/website/src/app/download/page.tsx@@ -1,8 +1,7 @@"use client";-// The web app at /web is a separate Flutter app; workspace links need a full document navigation.+// The web app at the root is a separate Flutter app; workspace links need a full document navigation.-import Link from "next/link";import { useEffect, useRef, useState } from "react";import styles from "./page.module.css";import { buildsFor } from "@/lib/desktopPlatform";@@ -18,7 +17,7 @@ const commands = [type CommandId = (typeof commands)[number]["id"];-/** Public /download page. The web app (the shared Flutter workspace) is at /web; the root opens the Hub. */+/** 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);@@ -47,7 +46,7 @@ export default function Page() {<div className={styles.page}><header className={styles.bar}><nav className={styles.navigation} aria-label="Harness">- <Link className={styles.brand} href="/hub">Harness</Link>+ <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>diff --git a/website/src/app/hub/components/community.spec.tsx b/website/src/app/hub/components/community.spec.tsxindex 361a09caf..054bfae41 100644--- a/website/src/app/hub/components/community.spec.tsx+++ b/website/src/app/hub/components/community.spec.tsx@@ -203,7 +203,7 @@ describe('community navigation', () => {request.mockResolvedValueOnce({ harness: { ...sample, id: sample.id }, social: { ...emptySocial, signedIn: false } });render(<Detail id={sample.id} initial={null} />);expect(await screen.findByText(/Your sign-in has expired/)).toBeInTheDocument();- expect(screen.getByRole('link', { name: 'Sign in again' })).toHaveAttribute('href', '/web');+ expect(screen.getByRole('link', { name: 'Sign in again' })).toHaveAttribute('href', '/');localStorage.clear();});it('reads a publication once, then refreshes only its social state', async () => {@@ -454,6 +454,20 @@ describe('community navigation', () => {expect(await screen.findByText(/Restored/)).toBeInTheDocument();expect(request).toHaveBeenCalledWith('reports/review', { method: 'POST', body: { targetType: 'harness', targetId: 'h1', decision: 'restore' } });});+ it('signs a visitor in at the web app and brings them back to the Hub page they were on', async () => {+ window.history.replaceState(null, '', '/hub/following');+ try {+ render(<Header />);+ const signIn = await screen.findByRole('link', { name: 'Sign in' });+ expect(signIn).toHaveAttribute('href', '/');+ signIn.addEventListener('click', event => event.preventDefault());+ fireEvent.click(signIn);+ expect(sessionStorage.getItem('harness.hub.returnTo')).toBe('/hub/following');+ } finally {+ sessionStorage.clear();+ window.history.replaceState(null, '', '/');+ }+ });it('rings the bell with the unread count only for someone signed in', async () => {const { unmount } = render(<Header />);await act(async () => {});diff --git a/website/src/lib/webApp.ts b/website/src/lib/webApp.tsindex e64bd31ea..59f029b59 100644--- a/website/src/lib/webApp.ts+++ b/website/src/lib/webApp.ts@@ -1,2 +1,2 @@-/** Where the Harness web app (the Flutter workspace) lives: `/` opens the Hub (owner, 2026-10-13). */-export const webAppPath = '/web';+/** Where the Harness web app (the Flutter workspace) lives: the site's front door (owner, 2026-10-26). */+export const webAppPath = '/';