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
ci: build and publish the managed grid runtime — Linux wraps grid's release, macOS builds it
Kelvincdc88da0c5aa
diff --git a/.github/workflows/release-grid-runtime.yml b/.github/workflows/release-grid-runtime.ymlnew file mode 100644index 000000000..3a757986f--- /dev/null+++ b/.github/workflows/release-grid-runtime.yml@@ -0,0 +1,151 @@+name: Release grid runtime++# Build and publish the managed grid — the grid CLI as a runtime under ~/.harness/runtime, the way+# Node and tmux already are, so a machine that installs the harness has the `grid` its daemon and+# its agents run without a second installer. Linux archives WRAP autonomous-grid's own release+# binaries (verified against the release's SHA256SUMS); macOS archives are BUILT with Nuitka from a+# checkout of the release tag, because grid publishes no macOS binary. Recipe and reasoning:+# cli/scripts/build-managed-grid.sh. Publishing: desktop/scripts/publish-managed-grid-runtime.sh,+# writing harness/runtime/grid/metadata.json — whose version is the PIN every daemon follows on its+# next start (ensureManagedGrid, cli/src/lib/runtimeInstall.ts).+#+# gh workflow run release-grid-runtime.yml -f grid_version=0.3.47 # build all four, publish+# gh workflow run release-grid-runtime.yml -f grid_version=0.3.47 -f publish=false # build only, inspect the artifacts+# gh workflow run release-grid-runtime.yml -f grid_version=0.3.47 -f platforms=darwin-arm64,linux-x64,linux-arm64+#+# Nuitka cannot cross-compile, so darwin-x64 needs an Intel runner (macos-15-intel). Drop it from+# `platforms` if that label is unavailable: a platform absent from the manifest is not an error on+# a machine — install.sh says so and goes on, and the daemon falls back to a `grid` on PATH.++on:+ workflow_dispatch:+ inputs:+ grid_version:+ description: 'grid release to package (its tag without the v, e.g. 0.3.47); must be ≥ GRID_VERSION_FLOOR'+ required: true+ platforms:+ description: 'Comma-separated platforms to build and publish'+ required: true+ default: 'darwin-arm64,darwin-x64,linux-x64,linux-arm64'+ publish:+ description: 'Upload the archives and rewrite harness/runtime/grid/metadata.json'+ type: boolean+ default: true++permissions:+ contents: read++env:+ GCS_BUCKET: s3-autonomous-upgrade-3++jobs:+ # Proving the credential first: the builds take minutes, a bad secret costs seconds.+ preflight:+ if: ${{ inputs.publish }}+ runs-on: ubuntu-latest+ steps:+ - uses: google-github-actions/auth@v2+ with:+ credentials_json: ${{ secrets.GCP_SA_KEY }}+ - uses: google-github-actions/setup-gcloud@v2+ - name: Verify GCS write access+ run: |+ set -euo pipefail+ probe="gs://${GCS_BUCKET}/harness/runtime/grid/.ci-preflight/${GITHUB_RUN_ID}"+ echo "$GITHUB_RUN_ID" | gsutil cp - "$probe"+ gsutil rm "$probe"++ # The platforms input, as a matrix: one runner per platform, because each builds (or at least+ # smoke-tests) its own.+ plan:+ runs-on: ubuntu-latest+ outputs:+ matrix: ${{ steps.matrix.outputs.matrix }}+ platforms: ${{ steps.matrix.outputs.platforms }}+ steps:+ - id: matrix+ # Inputs reach the shell through the environment, never by interpolation into the script:+ # a dispatch input is a maintainer's, but a quoted string is not a place to trust one.+ env:+ PLATFORMS: ${{ inputs.platforms }}+ run: |+ set -euo pipefail+ declare -A runner=(+ [darwin-arm64]=macos-15+ [darwin-x64]=macos-15-intel+ [linux-x64]=ubuntu-latest+ [linux-arm64]=ubuntu-24.04-arm+ )+ entries=()+ spaced=""+ IFS=',' read -ra wanted <<< "$PLATFORMS"+ for platform in "${wanted[@]}"; do+ platform="${platform// /}"+ [[ -n "${runner[$platform]:-}" ]] || { echo "unknown platform: $platform" >&2; exit 1; }+ entries+=("{\"platform\":\"$platform\",\"runner\":\"${runner[$platform]}\"}")+ spaced="${spaced:+$spaced }$platform"+ done+ echo "matrix={\"include\":[$(IFS=,; echo "${entries[*]}")]}" >> "$GITHUB_OUTPUT"+ echo "platforms=$spaced" >> "$GITHUB_OUTPUT"++ build:+ needs: plan+ runs-on: ${{ matrix.runner }}+ strategy:+ fail-fast: true+ matrix: ${{ fromJSON(needs.plan.outputs.matrix) }}+ steps:+ - uses: actions/checkout@v7+ # The macOS build is grid's own packaging/build_binary.sh, which wants a Homebrew or PATH+ # Python 3.11–3.13 and installs Nuitka into its own venv.+ - if: ${{ startsWith(matrix.platform, 'darwin') }}+ uses: actions/setup-python@v5+ with:+ python-version: '3.13'+ - name: Build grid ${{ inputs.grid_version }} for ${{ matrix.platform }}+ env:+ GRID_VERSION: ${{ inputs.grid_version }}+ PLATFORM: ${{ matrix.platform }}+ run: |+ set -euo pipefail+ bash cli/scripts/build-managed-grid.sh "$PLATFORM" "$GRID_VERSION" "$RUNNER_TEMP/dist"+ archive="$RUNNER_TEMP/dist/grid-${GRID_VERSION}-${PLATFORM}.tar.gz"+ {+ echo "### grid ${GRID_VERSION} · ${PLATFORM}"+ echo '```'+ echo "size $(wc -c < "$archive" | tr -d ' ') bytes"+ echo "sha256 $(shasum -a 256 "$archive" | awk '{print $1}')"+ tar -tzf "$archive"+ echo '```'+ } >> "$GITHUB_STEP_SUMMARY"+ - uses: actions/upload-artifact@v4+ with:+ name: grid-${{ inputs.grid_version }}-${{ matrix.platform }}+ path: ${{ runner.temp }}/dist/grid-${{ inputs.grid_version }}-${{ matrix.platform }}.tar.gz+ if-no-files-found: error+ retention-days: 14++ publish:+ if: ${{ inputs.publish }}+ needs: [preflight, plan, build]+ runs-on: ubuntu-latest+ steps:+ - uses: actions/checkout@v7+ - uses: actions/download-artifact@v4+ with:+ pattern: grid-${{ inputs.grid_version }}-*+ path: dist+ merge-multiple: true+ - uses: google-github-actions/auth@v2+ with:+ credentials_json: ${{ secrets.GCP_SA_KEY }}+ - uses: google-github-actions/setup-gcloud@v2+ - name: Publish archives and manifest+ env:+ GRID_VERSION: ${{ inputs.grid_version }}+ GRID_PLATFORMS: ${{ needs.plan.outputs.platforms }}+ run: |+ set -euo pipefail+ ls -la dist+ bash desktop/scripts/publish-managed-grid-runtime.sh "$GRID_VERSION" dist+ echo "Published grid **${GRID_VERSION}** (${GRID_PLATFORMS}) → \`https://storage.googleapis.com/${GCS_BUCKET}/harness/runtime/grid/metadata.json\`" >> "$GITHUB_STEP_SUMMARY"diff --git a/cli/scripts/build-managed-grid.sh b/cli/scripts/build-managed-grid.shnew file mode 100755index 000000000..86f509f63--- /dev/null+++ b/cli/scripts/build-managed-grid.sh@@ -0,0 +1,128 @@+#!/usr/bin/env bash+# Build the managed grid — the grid CLI as a runtime under ~/.harness/runtime, in the shape Node and+# tmux already take: one archive per platform, grid-<ver>-<platform>/bin/grid inside, its sha256 in+# our own manifest (desktop/scripts/publish-managed-grid-runtime.sh). install.sh lays it down once;+# the daemon keeps it at the pin (ensureManagedGrid, cli/src/lib/runtimeInstall.ts).+#+# bash cli/scripts/build-managed-grid.sh linux-x64 0.3.47 [out-dir] # wraps grid's own release binary+# bash cli/scripts/build-managed-grid.sh linux-arm64 0.3.47 [out-dir]+# bash cli/scripts/build-managed-grid.sh darwin-arm64 0.3.47 [out-dir] # builds it — grid ships no macOS binary+# bash cli/scripts/build-managed-grid.sh darwin-x64 0.3.47 [out-dir] # on an Intel Mac; Nuitka cannot cross-compile+#+# Linux is a DOWNLOAD. autonomous-grid's release already ships a self-contained Nuitka onefile per+# arch with a SHA256SUMS beside it; that checksum is verified HERE, once, and the archive is re-hosted+# under our manifest with our own sha256 — so the installer never fetches a checksum file at install+# time (the rule publish-managed-tmux-runtime.sh states).+#+# macOS is a BUILD. grid publishes no macOS binary: its packaging/README.md blames ad-hoc signing,+# but the review in docs/plans/2026-09-14-004-harness-grid-plan.md found the SIGKILL is Gatekeeper on+# a QUARANTINED download — which a curl-fetched runtime never is, and why the ad-hoc managed tmux+# runs on every Mac today. So the source is checked out at the release tag and packaging/build_binary.sh+# runs exactly as grid runs it, Nuitka's own ad-hoc signature and all. Nothing is notarized.+set -euo pipefail++usage() {+ echo "usage: $0 linux-x64|linux-arm64|darwin-arm64|darwin-x64 <grid version, e.g. 0.3.47> [out-dir]" >&2+ exit 2+}++PLATFORM="${1:-}"+VERSION="${2:-}"+OUT_DIR="${3:-$PWD/dist/grid}"+ASSET=""+BUILD_ARCH=""+case "$PLATFORM" in+ linux-x64) ASSET=grid-linux-x86_64 ;;+ linux-arm64) ASSET=grid-linux-arm64 ;;+ darwin-arm64) BUILD_ARCH=arm64 ;;+ darwin-x64) BUILD_ARCH=x86_64 ;;+ *) usage ;;+esac+# A release tag without its `v`: what the manifest's `version` carries, and what `grid --version` prints.+[[ "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] || usage++GRID_REPO="${GRID_REPO:-https://github.com/autonomous-ai/autonomous-grid}"+GRID_RELEASE_BASE="${GRID_RELEASE_BASE:-$GRID_REPO/releases/download/v$VERSION}"+GRID_RAW_BASE="${GRID_RAW_BASE:-https://raw.githubusercontent.com/autonomous-ai/autonomous-grid/v$VERSION}"++for command in curl tar; do+ command -v "$command" >/dev/null 2>&1 || { echo "error: $command is required" >&2; exit 1; }+done++sha256_of() {+ if command -v shasum >/dev/null 2>&1; then shasum -a 256 "$1" | awk '{print $1}'+ elif command -v sha256sum >/dev/null 2>&1; then sha256sum "$1" | awk '{print $1}'+ else echo "error: need shasum or sha256sum" >&2; exit 1+ fi+}++host_platform() {+ local os arch+ case "$(uname -s)" in Darwin) os=darwin ;; Linux) os=linux ;; *) os=other ;; esac+ case "$(uname -m)" in arm64|aarch64) arch=arm64 ;; x86_64|amd64) arch=x64 ;; *) arch=other ;; esac+ printf '%s-%s\n' "$os" "$arch"+}++ROOT="grid-$VERSION-$PLATFORM"+WORK="$(mktemp -d)"+# KEEP_WORK=1 leaves the work tree behind for a post-mortem.+[ "${KEEP_WORK:-0}" = 1 ] || trap 'rm -rf "$WORK"' EXIT+STAGE="$WORK/stage/$ROOT"+mkdir -p "$STAGE/bin"++fetch() { # <url> <file>+ curl -fsSL --proto '=https' "$1" -o "$2" || { echo "error: could not download $1" >&2; exit 1; }+}++case "$PLATFORM" in+ linux-*)+ echo ">> fetching $ASSET from $GRID_RELEASE_BASE"+ fetch "$GRID_RELEASE_BASE/$ASSET" "$WORK/$ASSET"+ fetch "$GRID_RELEASE_BASE/SHA256SUMS" "$WORK/SHA256SUMS"+ want="$(grep -E "[[:space:]]${ASSET}\$" "$WORK/SHA256SUMS" | awk '{print $1}' | head -1)"+ [ -n "$want" ] || { echo "error: the release's SHA256SUMS names no $ASSET" >&2; exit 1; }+ got="$(sha256_of "$WORK/$ASSET")"+ [ "$got" = "$want" ] || {+ echo "error: $ASSET failed checksum verification against SHA256SUMS (expected $want, got $got)" >&2+ exit 1+ }+ install -m 0755 "$WORK/$ASSET" "$STAGE/bin/grid"+ ;;+ darwin-*)+ [ "$(uname -s)" = Darwin ] || { echo "error: the macOS grid is built on macOS" >&2; exit 1; }+ [ "$(uname -m)" = "$BUILD_ARCH" ] || {+ echo "error: Nuitka cannot cross-compile — build $PLATFORM on a $BUILD_ARCH Mac (this one is $(uname -m))" >&2+ exit 1+ }+ command -v git >/dev/null 2>&1 || { echo "error: git is required" >&2; exit 1; }+ echo ">> checking out $GRID_REPO at v$VERSION"+ git clone --quiet --depth 1 --branch "v$VERSION" "$GRID_REPO" "$WORK/src"+ # grid's own build, unchanged: --standalone --onefile, its ad-hoc signature, its tempdir spec.+ (cd "$WORK/src" && bash packaging/build_binary.sh)+ install -m 0755 "$WORK/src/dist/grid" "$STAGE/bin/grid"+ # Explicit and identical to the tmux runtime's: nothing here is notarized, and nothing needs to be.+ codesign -s - --force "$STAGE/bin/grid" 2>/dev/null || true+ ;;+esac++fetch "$GRID_RAW_BASE/LICENSE" "$STAGE/LICENSE.grid"++# Smoke: the binary answers with the version asked for — on a host that can run it. Each CI runner+# builds its own platform, so this is skipped only by hand, cross-platform.+if [ "$(host_platform)" = "$PLATFORM" ]; then+ answered="$(GRID_NO_UPDATE_CHECK=1 "$STAGE/bin/grid" --version 2>&1 || true)"+ # The whole line, not a substring: `0.3.4` is inside `0.3.47`.+ if printf '%s\n' "$answered" | grep -qxE "grid ${VERSION//./\\.}"; then+ echo ">> smoke: $answered"+ else+ echo "error: $STAGE/bin/grid --version answered '$answered', not 'grid $VERSION'" >&2+ exit 1+ fi+else+ echo ">> smoke skipped: this host is $(host_platform), the archive is for $PLATFORM"+fi++mkdir -p "$OUT_DIR"+ARCHIVE="$OUT_DIR/$ROOT.tar.gz"+tar -czf "$ARCHIVE" -C "$WORK/stage" "$ROOT"+echo ">> built $ARCHIVE ($(wc -c < "$ARCHIVE" | tr -d ' ') bytes, sha256 $(sha256_of "$ARCHIVE"))"diff --git a/cli/src/scripts/buildManagedGrid.spec.ts b/cli/src/scripts/buildManagedGrid.spec.tsnew file mode 100644index 000000000..0e4c2dada--- /dev/null+++ b/cli/src/scripts/buildManagedGrid.spec.ts@@ -0,0 +1,102 @@+/**+ * `cli/scripts/build-managed-grid.sh` — the grid CLI as a managed runtime archive, one per platform.+ *+ * Linux is a DOWNLOAD of autonomous-grid's own release binary, verified against the SHA256SUMS the+ * release ships, then wrapped in the archive shape every managed runtime has+ * (`grid-<ver>-<platform>/bin/grid`). That path is driven here end to end through a fake `curl`.+ * The macOS path builds with Nuitka from a checkout and is not run here — only its refusals are.+ */+import { spawnSync } from "child_process";+import { createHash } from "crypto";+import { chmodSync, existsSync, mkdirSync, mkdtempSync, readFileSync, rmSync, statSync, writeFileSync } from "fs";+import { tmpdir } from "os";+import { join } from "path";+import { describe, expect, it } from "vitest";++const script = join(process.cwd(), "scripts", "build-managed-grid.sh");++const writeCommand = (directory: string, name: string, lines: string[]) => {+ const path = join(directory, name);+ writeFileSync(path, ["#!/bin/sh", ...lines, ""].join("\n"));+ chmodSync(path, 0o700);+};++/** A fake release: the Linux binary, its SHA256SUMS and a LICENSE, served by a `curl` that reads+ * the URL and the `-o` target off its own argv, whatever flags come before them. */+const releaseFixture = (scratch: string, tamperSums = false) => {+ const binary = join(scratch, "release", "grid-linux-x86_64");+ mkdirSync(join(scratch, "release"), { recursive: true });+ writeFileSync(binary, "#!/bin/sh\nprintf 'grid 9.9.9\\n'\n");+ const sha = createHash("sha256").update(readFileSync(binary)).digest("hex");+ writeFileSync(join(scratch, "release", "SHA256SUMS"), `${tamperSums ? "0".repeat(64) : sha} grid-linux-x86_64\n${"1".repeat(64)} grid-linux-arm64\n`);+ writeFileSync(join(scratch, "release", "LICENSE"), "MIT\n");+ writeCommand(scratch, "curl", [+ `printf '%s\\n' "$*" >> '${join(scratch, "curl-invocations")}'`,+ 'url=""; out=""; while [ $# -gt 0 ]; do case "$1" in -o) out="$2"; shift ;; http*) url="$1" ;; esac; shift; done',+ `case "$url" in *SHA256SUMS) cp '${join(scratch, "release", "SHA256SUMS")}' "$out" ;; *LICENSE) cp '${join(scratch, "release", "LICENSE")}' "$out" ;; *grid-linux-x86_64) cp '${binary}' "$out" ;; *) exit 22 ;; esac`,+ ]);+};++const run = (scratch: string, args: string[]) =>+ spawnSync("bash", [script, ...args], {+ encoding: "utf8",+ env: {+ ...process.env,+ PATH: `${scratch}:/usr/bin:/bin`,+ GRID_RELEASE_BASE: "https://cdn.example/v9.9.9",+ GRID_RAW_BASE: "https://raw.example/v9.9.9",+ },+ });++describe("scripts/build-managed-grid.sh", () => {+ it("wraps grid's Linux release binary, verified against its SHA256SUMS, in the managed-runtime shape", () => {+ const scratch = mkdtempSync(join(tmpdir(), "harness-build-grid-"));+ try {+ releaseFixture(scratch);+ const out = join(scratch, "out");+ const result = run(scratch, ["linux-x64", "9.9.9", out]);++ expect(result.status, result.stderr).toBe(0);+ const archive = join(out, "grid-9.9.9-linux-x64.tar.gz");+ expect(existsSync(archive)).toBe(true);+ const listing = spawnSync("tar", ["-tzf", archive], { encoding: "utf8" }).stdout.split("\n");+ expect(listing).toContain("grid-9.9.9-linux-x64/bin/grid");+ expect(listing).toContain("grid-9.9.9-linux-x64/LICENSE.grid");+ // The archive carries the mode the runtime is laid down with: runnable as unpacked.+ const unpack = join(scratch, "unpack");+ mkdirSync(unpack);+ spawnSync("tar", ["-xzf", archive, "-C", unpack]);+ expect(statSync(join(unpack, "grid-9.9.9-linux-x64", "bin", "grid")).mode & 0o111).not.toBe(0);+ expect(readFileSync(join(scratch, "curl-invocations"), "utf8")).toContain("https://cdn.example/v9.9.9/SHA256SUMS");+ expect(result.stdout).toContain("built ");+ } finally {+ rmSync(scratch, { recursive: true, force: true });+ }+ }, 20_000);++ it("refuses a binary whose checksum is not the one SHA256SUMS names, and builds nothing", () => {+ const scratch = mkdtempSync(join(tmpdir(), "harness-build-grid-tampered-"));+ try {+ releaseFixture(scratch, true);+ const out = join(scratch, "out");+ const result = run(scratch, ["linux-x64", "9.9.9", out]);++ expect(result.status).not.toBe(0);+ expect(result.stderr).toContain("checksum");+ expect(existsSync(join(out, "grid-9.9.9-linux-x64.tar.gz"))).toBe(false);+ } finally {+ rmSync(scratch, { recursive: true, force: true });+ }+ }, 20_000);++ it("refuses a platform it does not publish for, and a version that is not a release tag", () => {+ const scratch = mkdtempSync(join(tmpdir(), "harness-build-grid-args-"));+ try {+ expect(run(scratch, ["windows-x64", "9.9.9", scratch]).status).toBe(2);+ expect(run(scratch, ["linux-x64", "v9.9.9", scratch]).status).toBe(2);+ expect(run(scratch, ["linux-x64", "", scratch]).status).toBe(2);+ } finally {+ rmSync(scratch, { recursive: true, force: true });+ }+ });+});diff --git a/desktop/Makefile b/desktop/Makefileindex fa1c1ef37..926d0fd03 100644--- a/desktop/Makefile+++ b/desktop/Makefile@@ -1,4 +1,4 @@-.PHONY: release upload-desktop upload-desktop-linux upload-node-runtime upload-tmux-runtime terminal-local-manual terminal-local-e2e terminal-prod-e2e+.PHONY: release upload-desktop upload-desktop-linux upload-node-runtime upload-tmux-runtime upload-grid-runtime terminal-local-manual terminal-local-e2e terminal-prod-e2e## release: tag this commit vX.Y.Z_desktop and push the tag — CI builds macOS + Linux, publishes to## GCS, and cuts the GitHub Release. The version is bumped from max(last git tag, live metadata.json),@@ -35,6 +35,12 @@ upload-node-runtime:upload-tmux-runtime:bash scripts/publish-managed-tmux-runtime.sh $(ARGS)+## upload-grid-runtime: publish the grid archives built by cli/scripts/build-managed-grid.sh+## (ARGS="0.3.47 <dir>"). The manifest's version is the pin every daemon follows; CI does this from+## release-grid-runtime.yml, by hand only for a rebuild.+upload-grid-runtime:+ bash scripts/publish-managed-grid-runtime.sh $(ARGS)+## terminal-local-manual: start the local backend/CLI stack and open the desktop fixture.terminal-local-manual:bash scripts/start-terminal-local-manual.shdiff --git a/desktop/RELEASE.md b/desktop/RELEASE.mdindex ce42eeb07..2b7b684b9 100644--- a/desktop/RELEASE.md+++ b/desktop/RELEASE.md@@ -96,6 +96,42 @@ resolves a tmux — the terminal's tmux always wins, so daemon and terminal sharnever opens a Terminal window. Publish a new runtime **before** the `install.sh` that pins a newertmux level, and keep it level with what Homebrew ships.+## Managed grid runtime++The grid CLI, as a runtime beside Node and tmux: the daemon shells out to `grid` for every Local+model (`gridExec.ts`), and the Local model manager has an agent run it by name in its pane, so a+machine that installs the harness must have one without a second installer. Same shape as the other+two — `harness/runtime/grid/metadata.json`, its own manifest for the reason tmux has one, entries+`{version,url,sha256,size,archiveRoot}`, archives `grid-<ver>-<platform>/bin/grid` — with one+difference: **the manifest's version is a pin**. `install.sh` lays that grid down (step 3b, optional:+a failed download does not fail the install), and the daemon moves every installed machine to it+on its next start (`ensureManagedGrid`), keeping one version back for the panes still running the+old one. Laid down read-only, `bin/` included, so `grid update` — an `os.replace` into that+directory — fails loudly instead of overwriting the pin; the daemon also sets+`GRID_NO_UPDATE_CHECK=1` on every spawn and pane. Never linked into `~/.local/bin`: that path is+grid's own installer's (uv's, on a Mac), and the daemon puts the managed grid on an agent pane's+PATH itself.++Linux archives **wrap** autonomous-grid's own release binaries (`grid-linux-{x86_64,arm64}`, verified+against the release's `SHA256SUMS` at build time, then re-hosted under our manifest so nothing is+fetched from GitHub at install time). macOS archives are **built** by `cli/scripts/build-managed-grid.sh`+from a checkout of the release tag with grid's own `packaging/build_binary.sh` — Nuitka onefile,+ad-hoc signed, not notarized: the SIGKILL grid's README attributes to ad-hoc signing is Gatekeeper on a+*quarantined* download, which a `curl`-fetched runtime never is (the managed tmux runs the same way).+Nuitka does not cross-compile, so `darwin-x64` builds on an Intel runner; drop it from `platforms`+when none is available.++```bash+gh workflow run release-grid-runtime.yml -f grid_version=0.3.47 # build all four, publish+gh workflow run release-grid-runtime.yml -f grid_version=0.3.47 -f publish=false # build only, inspect+gh workflow run release-grid-runtime.yml -f grid_version=0.3.47 -f platforms=darwin-arm64,linux-x64,linux-arm64+make upload-grid-runtime ARGS="0.3.47 /path/to/archives" # the publisher CI calls+```++The pin may only move to a version at or above `GRID_VERSION_FLOOR` (`cli/src/lib/gridExec.ts`); the+publisher refuses anything lower, because the daemon would too. Move the floor and the pin in the+same change when a harness release starts to need a newer `grid`.+## Two macOS builds — Intel on Skia, Apple Silicon on ImpellerEvery release ships the macOS app **twice**: the same universal (arm64 + x86_64) build of the samediff --git a/desktop/scripts/publish-managed-grid-runtime.sh b/desktop/scripts/publish-managed-grid-runtime.shnew file mode 100755index 000000000..77c513f3d--- /dev/null+++ b/desktop/scripts/publish-managed-grid-runtime.sh@@ -0,0 +1,112 @@+#!/usr/bin/env bash+# Publish the grid archives that `cli/scripts/build-managed-grid.sh` produced, the same way+# publish-managed-tmux-runtime.sh publishes tmux: immutable archives under harness/runtime/grid/, and a+# manifest whose sha256 is what the installer and the daemon trust — never a checksum file fetched+# at install time. Its own manifest, harness/runtime/grid/metadata.json, rather than an entry in+# Node's: install.sh slices a manifest by the FIRST "<platform>" key it finds, and Node's already has one.+#+# The manifest's version is the PIN. `install.sh` lays that grid down; the daemon moves every installed+# machine to it on its next start (ensureManagedGrid, cli/src/lib/runtimeInstall.ts) — which is why+# this refuses a version below GRID_VERSION_FLOOR (cli/src/lib/gridExec.ts): a daemon would refuse it+# too, and a manifest nobody can follow is a manifest that pins nothing.+#+# Usage: bash scripts/publish-managed-grid-runtime.sh 0.3.47 <dir holding grid-0.3.47-<platform>.tar.gz>+# GRID_PLATFORMS="darwin-arm64 linux-x64" … to publish fewer platforms than the default four.+set -euo pipefail+set +x++VERSION="${1:-}"+ARCHIVES_DIR="${2:-}"+if [[ ! "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] || [[ -z "$ARCHIVES_DIR" ]]; then+ echo "usage: $0 <grid version, e.g. 0.3.47> <archives dir>" >&2+ exit 2+fi+[[ -d "$ARCHIVES_DIR" ]] || { echo "error: $ARCHIVES_DIR is not a directory" >&2; exit 2; }++for command in gsutil shasum python3; do+ command -v "$command" >/dev/null 2>&1 || {+ echo "error: $command is required" >&2+ exit 1+ }+done++REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"+FLOOR="$(sed -n "s/^export const GRID_VERSION_FLOOR = '\([0-9.]*\)'.*/\1/p" "$REPO_ROOT/cli/src/lib/gridExec.ts")"+[[ -n "$FLOOR" ]] || { echo "error: could not read GRID_VERSION_FLOOR from cli/src/lib/gridExec.ts" >&2; exit 1; }+if [[ "$(printf '%s\n%s\n' "$FLOOR" "$VERSION" | sort -V | head -1)" != "$FLOOR" ]]; then+ echo "error: grid $VERSION is below GRID_VERSION_FLOOR ($FLOOR) — the daemon would refuse this pin" >&2+ exit 1+fi++GCS_BUCKET="${GCS_BUCKET:-s3-autonomous-upgrade-3}"+PUBLIC_BASE="${GCS_PUBLIC_BASE_URL:-https://storage.googleapis.com/${GCS_BUCKET}}"+METADATA_PATH="${METADATA_PATH:-harness/runtime/grid/metadata.json}"+PLATFORMS="${GRID_PLATFORMS:-darwin-arm64 darwin-x64 linux-x64 linux-arm64}"+WORK_DIR="$(mktemp -d)"+SRC="$WORK_DIR/metadata.json"+DST="$WORK_DIR/metadata.next.json"+trap 'rm -rf "$WORK_DIR"' EXIT++# Every named platform or nothing: a manifest naming some and not others would make the installer's+# behaviour depend on which computer it runs on. Publish fewer on purpose with GRID_PLATFORMS.+declare -a ENTRIES=()+for platform in $PLATFORMS; do+ archive="grid-${VERSION}-${platform}.tar.gz"+ archive_path="$ARCHIVES_DIR/$archive"+ [[ -f "$archive_path" ]] || { echo "error: missing $archive_path" >&2; exit 1; }+ root="grid-${VERSION}-${platform}"+ tar -tzf "$archive_path" | grep -qx "${root}/bin/grid" || {+ echo "error: $archive has no ${root}/bin/grid" >&2+ exit 1+ }+ sha256="$(shasum -a 256 "$archive_path" | awk '{print $1}')"+ size="$(wc -c < "$archive_path" | tr -d ' ')"+ ENTRIES+=("$platform|$VERSION|$archive|$sha256|$size|$root")+done++for entry in "${ENTRIES[@]}"; do+ IFS='|' read -r platform version archive sha256 size root <<< "$entry"+ object_path="harness/runtime/grid/v${version}/${archive}"+ echo ">> uploading $archive ($size bytes, sha256 $sha256)"+ gsutil -h 'Cache-Control:public, max-age=31536000, immutable' cp \+ "$ARCHIVES_DIR/$archive" "gs://${GCS_BUCKET}/${object_path}"+done++if ! gsutil cp "gs://${GCS_BUCKET}/${METADATA_PATH}" "$SRC" 2>/dev/null; then+ printf '{}' > "$SRC"+fi++python3 - "$SRC" "$DST" "${PUBLIC_BASE%/}" "${ENTRIES[@]}" <<'PY'+import json, sys+src, dst, public_base, *entries = sys.argv[1:]+try:+ with open(src) as f:+ document = json.load(f)+except (OSError, json.JSONDecodeError):+ document = {}+if not isinstance(document, dict):+ document = {}+grid = document.get("grid")+if not isinstance(grid, dict):+ grid = {}+document["grid"] = grid+for entry in entries:+ platform, version, archive, sha256, size, root = entry.split("|", 5)+ grid[platform] = {+ "version": version,+ "url": f"{public_base}/harness/runtime/grid/v{version}/{archive}",+ "sha256": sha256,+ "size": int(size),+ "archiveRoot": root,+ }+with open(dst, "w") as f:+ json.dump(document, f, indent=2)+ f.write("\n")+PY++gsutil -h 'Content-Type:application/json' \+ -h 'Cache-Control:no-cache, no-store, must-revalidate' \+ cp "$DST" "gs://${GCS_BUCKET}/${METADATA_PATH}"++echo ">> published managed grid ${VERSION} for: ${PLATFORMS}"+echo ">> manifest: ${PUBLIC_BASE%/}/${METADATA_PATH}"