From 8a096434605f970654e2984b2fac98ce5b376a82 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 4 Nov 2026 21:10:14 +0000 Subject: [PATCH] Declare the site's live preview (saas-parallel-baselining PB4) orun.work's Preview tab shows a coding session's dev server, live from its box: `orun preview` (orun v2.96.0) runs what a repository declares, and the session keeps it running while it works. - apps/web-site/component.yaml: spec.preview. It installs this app's packages only (--filter "@site/web-site..."), then runs `next dev` alone on 127.0.0.1:3000, with a 1 GiB heap cap; the tab opens /. site-api and mail-worker do not run; the islands that call site-api degrade to their static messages. Next 15.0.3 has no allowedDevOrigins (15.2+) and does not check the hot reload's origin. - intent.yaml: preview: {component: web-site}. - apps/web-site/next.config.mjs: experimental.serverActions.allowedOrigins for the same hosts, in development only (NODE_ENV=development), so a Server Action is not refused behind the preview; `next build` keeps Next's same-origin check. - baseline.yml: orun v2.76.0 -> v2.96.0, the first release that reads spec.preview, so the placement's `orun validate` checks it. ci.yml (the product's own lane pin) is unchanged. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_019PcpNV6SjymJBPv3nNkC4z --- .github/workflows/baseline.yml | 10 ++++++---- apps/web-site/component.yaml | 21 +++++++++++++++++++++ apps/web-site/next.config.mjs | 10 ++++++++++ intent.yaml | 7 +++++++ 4 files changed, 44 insertions(+), 4 deletions(-) diff --git a/.github/workflows/baseline.yml b/.github/workflows/baseline.yml index b654f51..6eb44ba 100644 --- a/.github/workflows/baseline.yml +++ b/.github/workflows/baseline.yml @@ -68,9 +68,11 @@ jobs: # ✕ action orun.pr/land@v1 has no parameter "repo" # ✕ input "domain" has unknown type "bool" # - # — with every gate green, because none of them asked orun. This job pins the - # bootstrap FLOOR (BOOTSTRAP.md: v2.60, where the run-level - # `hooks.preInstantiate` list arrives) and makes orun place the whole tree, + # — with every gate green, because none of them asked orun. This job pins + # v2.96.0: at or above the bootstrap FLOOR (BOOTSTRAP.md: v2.60, where the + # run-level `hooks.preInstantiate` list arrives), and the first orun that + # reads a component's `spec.preview`, so the placement's `orun validate` + # checks the site's live preview too. It makes orun place the whole tree, # hooks off: offline, no credential, about ten seconds. blueprint-runs: runs-on: ubuntu-latest @@ -78,7 +80,7 @@ jobs: - uses: actions/checkout@v6 - uses: sourceplane/orun-action@v1.2.0 with: - version: v2.76.0 + version: v2.96.0 - uses: actions/setup-node@v5 with: node-version: 22 diff --git a/apps/web-site/component.yaml b/apps/web-site/component.yaml index b002795..6bfd513 100644 --- a/apps/web-site/component.yaml +++ b/apps/web-site/component.yaml @@ -28,6 +28,27 @@ spec: - profile: deploy when: triggerRef: github-push-main + # How the site runs itself for orun.work's live Preview tab + # (saas-parallel-baselining PB4): `orun preview` starts this, and a coding + # session keeps it running while it works, so the person watches it change + # as it is built. The dev server binds the box's loopback only, on a fixed + # port, and installs first, so a checkout the session has not installed yet + # still comes up. + # It installs only this app's packages and runs the site alone, with its + # heap capped: the box is shared with the agent. site-api and mail-worker do + # not run; the islands that call site-api from the browser (views, upvotes, + # the subscribe and contact forms) degrade to their static messages, as they + # do whenever it is unreachable. + preview: + run: + - sh + - -c + - pnpm install --frozen-lockfile --prefer-offline --filter "@site/web-site..." && exec node_modules/.bin/next dev -H 127.0.0.1 -p 3000 + port: 3000 + path: / + env: + NODE_OPTIONS: --max-old-space-size=1024 + NEXT_TELEMETRY_DISABLED: "1" parameters: nodeVersion: "22" pnpmVersion: "10.12.1" diff --git a/apps/web-site/next.config.mjs b/apps/web-site/next.config.mjs index fd5c7ae..180ad72 100644 --- a/apps/web-site/next.config.mjs +++ b/apps/web-site/next.config.mjs @@ -22,6 +22,16 @@ const nextConfig = { outputFileTracingRoot: path.join(__dirname, "../.."), typescript: { ignoreBuildErrors: false }, eslint: { ignoreDuringBuilds: true }, + experimental: { + // Dev server only: behind orun.work's live Preview the browser's Origin + // is the preview's host while `next dev` sees a local Host, and Next.js + // refuses a Server Action from an origin it is not told about. `next + // build` runs with NODE_ENV=production, so production keeps its + // same-origin check. + ...(process.env.NODE_ENV === "development" + ? { serverActions: { allowedOrigins: ["*.orun-preview.app", "preview-gateway-stage.oruncloud.workers.dev"] } } + : {}), + }, env: { NEXT_PUBLIC_DEPLOY_ENV: process.env.NEXT_PUBLIC_DEPLOY_ENV ?? "", NEXT_PUBLIC_SITE_API_URL: process.env.NEXT_PUBLIC_SITE_API_URL ?? "", diff --git a/intent.yaml b/intent.yaml index 305db82..339fa96 100644 --- a/intent.yaml +++ b/intent.yaml @@ -55,6 +55,13 @@ compositions: cloudflare-domain: stack-tectonic db-migrate: stack-tectonic +# The live preview (saas-parallel-baselining PB4): the component orun.work's +# Preview tab shows while a coding session works on the site. Its own +# `spec.preview` (apps/web-site/component.yaml) says how it runs; `orun preview` +# runs it. +preview: + component: web-site + discovery: roots: - apps/