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
Publish the Harness operating system page at /os (#685)
Dee21ba561d7701
diff --git a/.github/workflows/release-web.yml b/.github/workflows/release-web.ymlindex 15e88bc91..49fdf8350 100644--- a/.github/workflows/release-web.yml+++ b/.github/workflows/release-web.yml@@ -3,6 +3,8 @@ name: Release web# Builds the Flutter web bundle from desktop/, bakes it into website/Dockerfile.k8s, and pushes the# result to gcr.io/autonomous-ecm/autonomous-code-website, on a pushed `v*_web` tag. ArgoCD deploys# that image to harness.autonomous.ai.+# A tag annotated `Website-Only: true` keeps the pinned, already deployed Flutter+# bundle. The release helper verifies that pin before creating such a tag.## ONE REPO, ONE COMMIT. The site used to be a React app in the private autonomous-ai/autonomous-code# repo (apps/web) that hosted this bundle, and a web release was a relay: this repo published the bundle as a GitHub Release, a PR@@ -60,6 +62,8 @@ jobs:HAS_WIF: ${{ secrets.GCP_WORKLOAD_IDENTITY_PROVIDER != '' }}steps:- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4+ with:+ fetch-depth: 0# Tag-only trigger, so GITHUB_REF_NAME is already the bare tag (e.g. v1.3.1_web) and that is# the image tag ArgoCD deploys by. The X.Y.Z inside it is also the bundle's version.@@ -72,9 +76,19 @@ jobs:echo "::error::Tag $GITHUB_REF_NAME is not vX.Y.Z_web"exit 1}+ website_only=false+ archive_path="$BUNDLE_IN_CONTEXT"+ if git for-each-ref --format='%(contents)' "$GITHUB_REF" | grep -qx 'Website-Only: true'; then+ website_only=true+ archive_path=''+ # Check again at publication time in case another app release landed.+ python3 desktop/scripts/verify-website-only-release.py "$GITHUB_SHA" live+ fi{echo "IMAGE_TAG=${GITHUB_REF_NAME}"echo "WEB_VERSION=${version}"+ echo "WEBSITE_ONLY=${website_only}"+ echo "ARCHIVE_PATH=${archive_path}"} >> "$GITHUB_ENV"- name: Fail early if no GCP credential was supplied@@ -85,12 +99,14 @@ jobs:exit 1- uses: subosito/flutter-action@v2+ if: env.WEBSITE_ONLY != 'true'with:flutter-version: ${{ env.FLUTTER_VERSION }}channel: stablecache: true- name: Build the Flutter web bundle+ if: env.WEBSITE_ONLY != 'true'working-directory: desktoprun: bash scripts/build-web-release.sh "$WEB_VERSION"@@ -99,6 +115,7 @@ jobs:# the committed manifest — which pins an older release for local development — is replaced# with this build's own.- name: Stage the bundle in the image build context+ if: env.WEBSITE_ONLY != 'true'run: |set -euo pipefailcp "desktop/build/web-dist/harness-web-${WEB_VERSION}.tar.gz" "${BUILD_CONTEXT}/${BUNDLE_IN_CONTEXT}"@@ -143,7 +160,7 @@ jobs:cache-from: type=gha# Build args are PUBLIC to anyone who can pull the image. Only non-sensitive values here.build-args: |- HARNESS_WEB_ARCHIVE=${{ env.BUNDLE_IN_CONTEXT }}+ HARNESS_WEB_ARCHIVE=${{ env.ARCHIVE_PATH }}# Last, so a failed image build can be re-run without tripping over a release it already made.- name: Publish the bundle as a GitHub Release@@ -151,6 +168,16 @@ jobs:GH_TOKEN: ${{ github.token }}run: |set -euo pipefail+ if [ "$WEBSITE_ONLY" = true ]; then+ printf '%s\n' \+ 'Website-only update. The existing Flutter app bundle is preserved.' \+ "Served by harness.autonomous.ai from image ${IMAGE_NAME}:${IMAGE_TAG}." \+ > "$RUNNER_TEMP/web-release-notes.md"+ gh release create "$IMAGE_TAG" website/harness-web-release.json \+ --verify-tag --latest=false --title "Harness Website $WEB_VERSION" \+ --notes-file "$RUNNER_TEMP/web-release-notes.md"+ exit 0+ fiprintf '%s\n' \'Browser build of the shared desktop Flutter app.' \"Served by harness.autonomous.ai from image ${IMAGE_NAME}:${IMAGE_TAG}." \diff --git a/.github/workflows/website-checks.yml b/.github/workflows/website-checks.ymlindex aaf5e9e93..ab74e9a96 100644--- a/.github/workflows/website-checks.yml+++ b/.github/workflows/website-checks.yml@@ -54,3 +54,21 @@ jobs:- name: Production build (standalone, with the pinned Flutter bundle)run: npm run build++ - name: Verify production routes and static OS page+ run: |+ set -euo pipefail+ PORT=3000 HOSTNAME=127.0.0.1 node .next/standalone/server.js > /tmp/website-server.log 2>&1 &+ server_pid=$!+ trap 'kill "$server_pid" 2>/dev/null || true' EXIT+ ready=false+ for attempt in $(seq 1 30); do+ if curl --fail --silent http://127.0.0.1:3000/os > /dev/null; then+ ready=true+ break+ fi+ sleep 1+ done+ if [ "$ready" != true ]; then cat /tmp/website-server.log; exit 1; fi+ node scripts/check-os-site.mjs+ node scripts/check-harness-web.mjsdiff --git a/desktop/scripts/release-web.sh b/desktop/scripts/release-web.shindex b5feab350..a05fa5cee 100755--- a/desktop/scripts/release-web.sh+++ b/desktop/scripts/release-web.sh@@ -14,6 +14,7 @@# bash desktop/scripts/release-web.sh # bump the patch of the last v*_web tag and ship# bash desktop/scripts/release-web.sh --dry-run # print the plan, tag/push nothing# bash desktop/scripts/release-web.sh --minor # bump the MINOR version+# bash desktop/scripts/release-web.sh --website-only # preserve the deployed Flutter bundle# bash desktop/scripts/release-web.sh 1.3.0 # an explicit version## RESUMING: after a failure, re-run with the SAME explicit version — an existing tag is reused rather@@ -39,11 +40,13 @@ RUN_APPEAR_TIMEOUT="${RUN_APPEAR_TIMEOUT:-180}" # seconds for the tag's workflDRY_RUN=0DO_MINOR=0+WEBSITE_ONLY=0NEW_VER=""for arg in "$@"; docase "$arg" in--dry-run) DRY_RUN=1 ;;--minor) DO_MINOR=1 ;;+ --website-only) WEBSITE_ONLY=1 ;;-h|--help) sed -n '2,30p' "${BASH_SOURCE[0]}" | sed 's/^# \{0,1\}//'; exit 0 ;;-*) echo "ERROR unknown flag: $arg" >&2; exit 1 ;;*) NEW_VER="${arg#v}" ;;@@ -90,6 +93,12 @@ TAG="v${VER}_web"if git rev-parse -q --verify "refs/tags/$TAG" >/dev/null; thenTAG_EXISTS=1SHA="$(git rev-list -n1 "$TAG")"+ # A resume follows the immutable tag's mode, not new command-line flags.+ if git for-each-ref --format='%(contents)' "refs/tags/$TAG" | grep -qx 'Website-Only: true'; then+ WEBSITE_ONLY=1+ else+ [ "$WEBSITE_ONLY" -eq 0 ] || die "$TAG is a full web release; it cannot become website-only"+ fielseTAG_EXISTS=0[ -z "$(git status --porcelain)" ] || { git status --short >&2; die "working tree is dirty — the tag must capture the tested source exactly"; }@@ -100,11 +109,18 @@ else|| die "$VER is not higher than the last web release $LAST_VER"fi+EXPECTED_BUNDLE_VERSION="$VER"+if [ "$WEBSITE_ONLY" -eq 1 ]; then+ command -v python3 >/dev/null 2>&1 || die "python3 is required for website-only release verification"+ EXPECTED_BUNDLE_VERSION="$(python3 desktop/scripts/verify-website-only-release.py "$SHA" "$([ "$TAG_EXISTS" -eq 0 ] && echo live || echo manifest)")"+fi+WORK="$(mktemp -d)"trap 'rm -rf "$WORK"' EXITsay "release : $TAG @ ${SHA:0:8} $(git log -1 --format=%s "$SHA" | cut -c1-60)$([ "$TAG_EXISTS" -eq 1 ] && echo ' (tag exists — resuming)')"say "image : gcr.io/autonomous-ecm/autonomous-code-website:$TAG (+ :latest)"+[ "$WEBSITE_ONLY" -eq 0 ] || say "bundle : retain verified Harness Web $EXPECTED_BUNDLE_VERSION"if [ "$DRY_RUN" -eq 1 ]; thensay "DRY RUN — nothing tagged or pushed."@@ -113,7 +129,11 @@ fi# --- 1. the tag ---if [ "$TAG_EXISTS" -eq 0 ]; then- git tag -a "$TAG" -m "Harness web $VER" "$SHA"+ if [ "$WEBSITE_ONLY" -eq 1 ]; then+ git tag -a "$TAG" -m "Harness website $VER" -m 'Website-Only: true' "$SHA"+ else+ git tag -a "$TAG" -m "Harness web $VER" "$SHA"+ figit push origin "$TAG"say "pushed $TAG"fi@@ -133,8 +153,8 @@ if ! gh release view "$TAG" --json assets -q '.assets[].name' 2>/dev/null | grep|| die "build failed — fix it and cut the next version: gh run view $RUN_ID --log-failed"figh release download "$TAG" -p harness-web-release.json -D "$WORK" --clobber-grep -q "\"version\": \"$VER\"" "$WORK/harness-web-release.json" \- || die "the release's manifest is not for $VER"+grep -q "\"version\": \"$EXPECTED_BUNDLE_VERSION\"" "$WORK/harness-web-release.json" \+ || die "the release's manifest is not for $EXPECTED_BUNDLE_VERSION"say "image pushed, bundle published: https://github.com/$REPO/releases/tag/$TAG"-say "done — once ArgoCD rolls $TAG out, https://harness.autonomous.ai/harness-web/release.json reports $VER"+say "done — once ArgoCD rolls $TAG out, verify the changed routes; the web bundle reports $EXPECTED_BUNDLE_VERSION"diff --git a/desktop/scripts/verify-website-only-release.py b/desktop/scripts/verify-website-only-release.pynew file mode 100644index 000000000..dbeffe5ca--- /dev/null+++ b/desktop/scripts/verify-website-only-release.py@@ -0,0 +1,42 @@+#!/usr/bin/env python3+"""Reject a website-only tag that would change the deployed Flutter bundle."""+import json+import re+import subprocess+import sys+++def verify(manifest, published):+ version = manifest.get("version", "")+ if (not re.fullmatch(r"\d+\.\d+\.\d+", version)+ or not re.fullmatch(r"[a-f0-9]{40}", manifest.get("sourceCommit", ""))+ or not re.fullmatch(r"[a-f0-9]{64}", manifest.get("sha256", ""))+ or manifest.get("baseHref") != "/harness-web/"+ or manifest.get("archiveUrl") != (+ f"https://github.com/autonomous-ai/openharness/releases/download/"+ f"v{version}_web/harness-web-{version}.tar.gz")):+ raise ValueError("Invalid pinned web release manifest")+ for field in ("version", "sourceCommit", "baseHref", "apiUrl"):+ if manifest.get(field) != published.get(field):+ raise ValueError(f"Pinned web {field} differs from production; pin the deployed release first")+ return version+++def main():+ if len(sys.argv) != 3 or sys.argv[2] not in ("live", "manifest"):+ raise SystemExit("usage: verify-website-only-release.py COMMIT live|manifest")+ manifest = json.loads(subprocess.check_output(+ ["git", "show", f"{sys.argv[1]}:website/harness-web-release.json"], timeout=15))+ published = manifest+ if sys.argv[2] == "live":+ # Use the same HTTP client as the other release scripts. The production+ # edge rejects urllib's default user agent even for this public manifest.+ published = json.loads(subprocess.check_output([+ "curl", "--fail", "--silent", "--show-error", "--max-time", "20",+ "--header", "Cache-Control: no-cache",+ "https://harness.autonomous.ai/harness-web/release.json"], timeout=25))+ print(verify(manifest, published))+++if __name__ == "__main__":+ main()diff --git a/os/README.md b/os/README.mdindex 54e82dd9d..3ede5d878 100644--- a/os/README.md+++ b/os/README.md@@ -19,7 +19,7 @@ Both the live and installed system use `me@harness`.[Download preview 4](https://github.com/autonomous-ai/openharness/releases/tag/os-v0.1.0-preview.4)· [Mac → USB → ThinkPad installation guide](INSTALL.md)-· [Standalone HTML/CSS landing page](site/README.md)+· [Standalone HTML/CSS landing page](../website/public/os/README.md)· [Development feedback loop and Mac support targets](DEVELOPMENT.md)The exact image passed BIOS/plain and UEFI/encrypted USB installation, boot,diff --git a/os/site b/os/sitenew file mode 120000index 000000000..2d9c14ac5--- /dev/null+++ b/os/site@@ -0,0 +1 @@+../website/public/os\ No newline at end of filediff --git a/scripts/tests/test_website_only_release.py b/scripts/tests/test_website_only_release.pynew file mode 100644index 000000000..21c9d1b84--- /dev/null+++ b/scripts/tests/test_website_only_release.py@@ -0,0 +1,40 @@+import importlib.util+from pathlib import Path+import unittest+++spec = importlib.util.spec_from_file_location(+ "website_release", Path(__file__).resolve().parents[2]+ / "desktop/scripts/verify-website-only-release.py")+release = importlib.util.module_from_spec(spec)+spec.loader.exec_module(release)+++class WebsiteOnlyReleaseTests(unittest.TestCase):+ def setUp(self):+ self.manifest = dict(version="1.3.25", sourceCommit="a" * 40,+ sha256="b" * 64, baseHref="/harness-web/",+ apiUrl="https://harness-api.autonomous.ai",+ archiveUrl="https://github.com/autonomous-ai/openharness/"+ "releases/download/v1.3.25_web/harness-web-1.3.25.tar.gz")+ self.published = {key: self.manifest[key] for key in+ ("version", "sourceCommit", "baseHref", "apiUrl")}++ def test_accepts_deployed_bundle(self):+ self.assertEqual(release.verify(self.manifest, self.published), "1.3.25")++ def test_rejects_downgrade_changed_source_and_configuration(self):+ for field, value in (("version", "1.3.26"), ("sourceCommit", "c" * 40),+ ("baseHref", "/app/"), ("apiUrl", "https://other.example")):+ with self.subTest(field=field), self.assertRaisesRegex(ValueError, "differs from production"):+ release.verify(self.manifest, {**self.published, field: value})++ def test_rejects_wrong_artifact_and_missing_hash(self):+ for field, value in (("archiveUrl", "https://other.example/archive.tar.gz"),+ ("sha256", ""), ("sourceCommit", "main"), ("version", "latest")):+ with self.subTest(field=field), self.assertRaisesRegex(ValueError, "Invalid pinned"):+ release.verify({**self.manifest, field: value}, self.published)+++if __name__ == "__main__":+ unittest.main()diff --git a/website/README.md b/website/README.mdindex 98f7f0bfc..0793dc73a 100644--- a/website/README.md+++ b/website/README.md@@ -13,6 +13,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 || `/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/` || `/desktop` | Desktop download page || `/desktop/download-macos`, `/desktop/download/linux-{x64,arm64}` | Redirect to the latest build in the desktop manifest || `/flash-circle.sh` | The dial firmware flasher script |@@ -31,6 +32,13 @@ Push a `vX.Y.Z_web` tag — `make release-web` from the repo root cuts the next`https://harness.autonomous.ai/harness-web/release.json` afterward. Rollback is the previous imagetag, which carries its own bundle. The bundle is also published as a GitHub Release.+For a website-only change, first pin `harness-web-release.json` to the currently+deployed web release, then use `make release-web ARGS="--website-only"`. The helper+checks that pin against production before creating the tag. Its `Website-Only: true`+annotation tells CI to reuse that checksum-verified bundle instead of rebuilding+Flutter. The new image gets its own version; `/harness-web/release.json` continues+to identify the preserved app bundle. Verify the changed route after rollout.+## Local development```bashdiff --git a/website/harness-web-release.json b/website/harness-web-release.jsonindex abe45060c..7c637de16 100644--- a/website/harness-web-release.json+++ b/website/harness-web-release.json@@ -1,8 +1,8 @@{- "version": "1.3.1",- "sourceCommit": "c4216fbfcd22bc2ba6d814d54108d72ba84b0721",+ "version": "1.3.25",+ "sourceCommit": "125afc179ae9e6ca3b04efe98a2aa4d13a328c93","baseHref": "/harness-web/","apiUrl": "https://harness-api.autonomous.ai",- "archiveUrl": "https://github.com/autonomous-ai/openharness/releases/download/v1.3.1_web/harness-web-1.3.1.tar.gz",- "sha256": "6cf28ace33e898d28dfd4cec0d69b4795e8d28c70057cb2747a2d515faf9475f"+ "archiveUrl": "https://github.com/autonomous-ai/openharness/releases/download/v1.3.25_web/harness-web-1.3.25.tar.gz",+ "sha256": "a3a847b03b306a905d6fd4084208902ed5894f5178c837e4827778b19cfa5e21"}diff --git a/website/next.config.js b/website/next.config.jsindex 4f036ab47..ef3c083ea 100644--- a/website/next.config.js+++ b/website/next.config.js@@ -60,6 +60,8 @@ module.exports = {// Local website previews use the SSO service's native loopback callback.{ source: '/callback', destination: '/harness-web/index.html' },{ source: '/harness-web', destination: '/harness-web/index.html' },+ // Plain HTML/CSS; served as a file without a React or Flutter runtime.+ { source: '/os', destination: '/os/index.html' },],}},@@ -71,6 +73,17 @@ module.exports = {{ key: 'Referrer-Policy', value: 'origin' },],},+ {+ source: '/os/:path*',+ headers: [+ { key: 'Cache-Control', value: 'public, max-age=0, must-revalidate' },+ { key: 'X-Content-Type-Options', value: 'nosniff' },+ ],+ },+ ...['/os', '/os/index.html'].map((source) => ({+ source,+ headers: [{ key: 'Cache-Control', value: 'no-store' }],+ })),{source: '/harness-web/:path*',headers: [diff --git a/os/site/README.md b/website/public/os/README.mdsimilarity index 76%rename from os/site/README.mdrename to website/public/os/README.mdindex 685162165..1d3fbfa06 100644--- a/os/site/README.md+++ b/website/public/os/README.md@@ -1,23 +1,26 @@# Harness landing pageA standalone page: HTML, CSS, local fonts, and four real screenshots. No JavaScript,-framework, package installation, analytics, or build step. This directory is not-part of the OS image.+framework, package installation, analytics, or page build step. It is served at+<https://harness.autonomous.ai/os> by the existing website host, separately from+the OS image. `os/site` is a compatibility symlink to this directory.From the repository root:```sh-python3 -m http.server 18092 --bind 127.0.0.1 --directory os/site+python3 -m http.server 18092 --bind 127.0.0.1 --directory website/public```-Open `http://127.0.0.1:18092/`. Deploy the contents of this directory unchanged to-any static host. Asset paths are relative so a subdirectory works too.+Open `http://127.0.0.1:18092/os/`. The HTML base is `/os/`, so assets and in-page+links resolve under the same path with or without a trailing slash. The website's+`/os` rewrite serves this file directly without adding JavaScript. Release through+the [website pipeline](../../README.md#releasing).## Content and assets- The central narrative is **“Agents are the new apps.”** Conversation directs thework; terminal output, diffs, tests, and an optional browser make it inspectable.- Follow the [Naming System](../../docs/naming-system.md): Harness is the product,+ Follow the [Naming System](../../../docs/naming-system.md): Harness is the product,programmers are the first audience, and owning Autonomous hardware is optional.- The page walks through installation, encrypted boot, and working with agents.Keep shipped behavior and future hardware support distinct. Ordinary Harness@@ -56,7 +59,7 @@ use the keyboard to reach every link and toggle the disclosures. Confirm thatno content overflows at 320 px, 390 px, 768 px, and desktop widths.The updated page passed HTML5/CSS parsing, asset, font, image-dimension, local-anchor, and current release-download-name checks on October 3. The user approved visual review, but-Chrome still rejected the exact local URL on October 3 because of a saved site-permission. Visual layout and interactive browser checks remain unverified until-that review succeeds. Do not replace it with an alternate browser or control path.+anchor, and current release-download-name checks on October 3. The user visually+reviewed the page and approved deployment on October 3. Automated browser review+was blocked by the saved local site permission; responsive widths and keyboard+interaction have not been independently checked in this revision.diff --git a/os/site/assets/OFL.txt b/website/public/os/assets/OFL.txtsimilarity index 100%rename from os/site/assets/OFL.txtrename to website/public/os/assets/OFL.txtdiff --git a/os/site/assets/geist-mono.woff b/website/public/os/assets/geist-mono.woffsimilarity index 100%rename from os/site/assets/geist-mono.woffrename to website/public/os/assets/geist-mono.woffdiff --git a/os/site/assets/geist-regular.woff b/website/public/os/assets/geist-regular.woffsimilarity index 100%rename from os/site/assets/geist-regular.woffrename to website/public/os/assets/geist-regular.woffdiff --git a/os/site/assets/geist-semibold.woff b/website/public/os/assets/geist-semibold.woffsimilarity index 100%rename from os/site/assets/geist-semibold.woffrename to website/public/os/assets/geist-semibold.woffdiff --git a/os/site/assets/hn.png b/website/public/os/assets/hn.pngsimilarity index 100%rename from os/site/assets/hn.pngrename to website/public/os/assets/hn.pngdiff --git a/os/site/assets/install.png b/website/public/os/assets/install.pngsimilarity index 100%rename from os/site/assets/install.pngrename to website/public/os/assets/install.pngdiff --git a/os/site/assets/mark.svg b/website/public/os/assets/mark.svgsimilarity index 100%rename from os/site/assets/mark.svgrename to website/public/os/assets/mark.svgdiff --git a/os/site/assets/signal-run.png b/website/public/os/assets/signal-run.pngsimilarity index 100%rename from os/site/assets/signal-run.pngrename to website/public/os/assets/signal-run.pngdiff --git a/os/site/assets/unlock.png b/website/public/os/assets/unlock.pngsimilarity index 100%rename from os/site/assets/unlock.pngrename to website/public/os/assets/unlock.pngdiff --git a/os/site/index.html b/website/public/os/index.htmlsimilarity index 99%rename from os/site/index.htmlrename to website/public/os/index.htmlindex e1966259f..7f9c0a216 100644--- a/os/site/index.html+++ b/website/public/os/index.html@@ -3,11 +3,14 @@<head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1">+ <base href="/os/">+ <link rel="canonical" href="https://harness.autonomous.ai/os"><meta name="theme-color" content="#f7f7f2"><meta name="description" content="Agents are the new apps. Harness is an operating system built around agents: chat in the terminal, review the work, open a browser when you need it. Built for programmers first."><meta property="og:title" content="Harness — Agents are the new apps."><meta property="og:description" content="An operating system built around agents. Your terminal. Your agents. A browser when you need it. Built for programmers first."><meta property="og:type" content="website">+ <meta property="og:url" content="https://harness.autonomous.ai/os"><title>Harness — Agents are the new apps.</title><link rel="icon" href="assets/mark.svg" type="image/svg+xml"><link rel="preload" href="assets/geist-semibold.woff" as="font" type="font/woff" crossorigin>diff --git a/os/site/style.css b/website/public/os/style.csssimilarity index 100%rename from os/site/style.cssrename to website/public/os/style.cssdiff --git a/website/scripts/check-os-site.mjs b/website/scripts/check-os-site.mjsnew file mode 100644index 000000000..481f24829--- /dev/null+++ b/website/scripts/check-os-site.mjs@@ -0,0 +1,44 @@+import assert from 'node:assert/strict';+import { readFile, readdir } from 'node:fs/promises';+import { fileURLToPath } from 'node:url';++const base = new URL(process.argv[2] || 'http://127.0.0.1:3000');+const root = new URL('../public/os/', import.meta.url);+const expected = await readFile(new URL('index.html', root), 'utf8');+const requests = { signal: AbortSignal.timeout(20_000) };+for (const route of ['/os', '/os/', '/os/index.html']) {+ const response = await fetch(new URL(route, base), requests);+ assert.equal(response.status, 200, route);+ assert.match(response.headers.get('content-type'), /text\/html/);+ assert.match(response.headers.get('cache-control'), /no-store/);+ const html = await response.text();+ assert.equal(html, expected, 'Serve the approved HTML unchanged');+ assert.doesNotMatch(html, /<script\b/i, 'The OS page must not load an app runtime');+ assert.match(html, /<base href="\/os\/">/);+}++const names = await readdir(root, { recursive: true });+let verified = 0;+for (const name of names) {+ if (name === 'assets' || name === 'index.html' || name.endsWith('.md')) continue;+ const local = await readFile(new URL(name, root));+ const response = await fetch(new URL(`/os/${name}`, base), requests);+ assert.equal(response.status, 200, name);+ assert.equal(response.headers.get('x-content-type-options'), 'nosniff');+ assert.deepEqual(Buffer.from(await response.arrayBuffer()), local, `${name} bytes differ`);+ const types = { css: /text\/css/, svg: /image\/svg\+xml/, png: /image\/png/, woff: /font\/woff|application\/font-woff/ };+ const type = types[name.split('.').at(-1)];+ if (type) assert.match(response.headers.get('content-type'), type, name);+ verified++;+}+// All relative HTML URLs stay under /os/ even when the entry URL has no slash.+const documentBase = new URL('/os/', base);+for (const [, value] of expected.matchAll(/(?:href|src)="([^"]+)"/g)) {+ if (/^(?:https?:|#)/.test(value)) continue;+ const url = new URL(value, documentBase);+ assert.equal(url.origin, base.origin);+ assert.ok(url.pathname.startsWith('/os/'), value);+ if (value === '/os/') continue;+ await readFile(fileURLToPath(new URL(value, root)));+}+console.log(`Harness /os: three entry paths and ${verified} assets match the approved static source.`);