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
Merge origin/main into feat/harness-grid
Kelvinb72d3532705a
diff --cc .github/workflows/release-grid-runtime.ymlindex 3a757986f,000000000..bdeaab630mode 100644,000000..100644--- a/.github/workflows/release-grid-runtime.yml+++ b/.github/workflows/release-grid-runtime.yml@@@ -1,151 -1,0 +1,189 @@@+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++ id-token: write # only used by the Workload Identity Federation variant of the auth steps below++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++ env:++ # The `secrets` context cannot be read from a step-level `if:`, so reduce it to a boolean++ # here — job-level `env:` can see it. Holds "true"/"false", never the value itself.++ HAS_WIF: ${{ secrets.GCP_WORKLOAD_IDENTITY_PROVIDER != '' }}+ steps:- - uses: google-github-actions/auth@v2++ # GCP auth, WITHOUT a long-lived key — the same pattern release-tmux-runtime.yml and the rest++ # of the repo run. A service-account JSON key is a bearer credential with no expiry: it is only++ # as safe as every place it has ever been copied to. Workload Identity Federation replaces it++ # with a short-lived token minted from this job's own OIDC identity (hence `id-token: write`++ # above), so there is nothing to leak and nothing to rotate.++ #++ # Every GCS call below — and in publish-managed-grid-runtime.sh — is `gcloud storage`, never++ # gsutil: gsutil cannot use the external-account credential WIF issues, so it fails on every++ # call while the identical `gcloud storage` call works. Do not reintroduce it here.++ #++ # Two steps, not one, only for the duration of the cutover: WIF whenever the++ # GCP_WORKLOAD_IDENTITY_PROVIDER secret exists, the key only when it does not. DELETE the++ # second step once a publish has gone green on the first, together with the tmux workflow's.++ - name: Authenticate to GCP (workload identity federation)++ if: env.HAS_WIF == 'true'++ uses: google-github-actions/auth@v2++ with:++ workload_identity_provider: ${{ secrets.GCP_WORKLOAD_IDENTITY_PROVIDER }}++ service_account: ${{ secrets.GCP_SERVICE_ACCOUNT }}++ - name: Authenticate to GCP (service-account key — legacy fallback)++ if: env.HAS_WIF != 'true'++ 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"++ echo "$GITHUB_RUN_ID" | gcloud storage cp - "$probe"++ gcloud storage 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++ env:++ # The `secrets` context cannot be read from a step-level `if:`, so reduce it to a boolean++ # here — job-level `env:` can see it. Holds "true"/"false", never the value itself.++ HAS_WIF: ${{ secrets.GCP_WORKLOAD_IDENTITY_PROVIDER != '' }}+ 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++ - name: Authenticate to GCP (workload identity federation)++ if: env.HAS_WIF == 'true'++ uses: google-github-actions/auth@v2++ with:++ workload_identity_provider: ${{ secrets.GCP_WORKLOAD_IDENTITY_PROVIDER }}++ service_account: ${{ secrets.GCP_SERVICE_ACCOUNT }}++ - name: Authenticate to GCP (service-account key — legacy fallback)++ if: env.HAS_WIF != '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 --cc desktop/scripts/publish-managed-grid-runtime.shindex 77c513f3d,000000000..a7ceefa1cmode 100755,000000..100755--- a/desktop/scripts/publish-managed-grid-runtime.sh+++ b/desktop/scripts/publish-managed-grid-runtime.sh@@@ -1,112 -1,0 +1,134 @@@+#!/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++for command in shasum python3; do+ command -v "$command" >/dev/null 2>&1 || {+ echo "error: $command is required" >&2+ exit 1+ }+done+++# --- GCS client: `gcloud storage`, and only `gcloud storage` ---++# gsutil was retired from this repo on 2026-09-17 (see publish-managed-tmux-runtime.sh). It is a++# standalone Python tool that only understands gcloud's *user* and *service-account-key*++# credentials: it cannot use the external-account (federated) credential Workload Identity++# Federation issues, so every call fails under WIF while the identical `gcloud storage` call works++# — it is the same gcloud binary that performed the token exchange. Do not reintroduce it.++command -v gcloud >/dev/null 2>&1 || {++ echo "error: gcloud not found — install/authenticate the gcloud SDK" >&2++ exit 1++}++gcloud storage --help >/dev/null 2>&1 || {++ echo "error: this gcloud is too old for 'gcloud storage' — update the gcloud SDK" >&2++ exit 1++}++++# gcs_cp <src> <dst> [cache-control] [content-type] — either side may be gs:// or a local path or `-`.++gcs_cp() {++ local src="$1" dst="$2" cc="${3:-}" ct="${4:-}" args=(storage cp)++ if [ -n "$cc" ]; then args+=("--cache-control=$cc"); fi++ if [ -n "$ct" ]; then args+=("--content-type=$ct"); fi++ gcloud "${args[@]}" "$src" "$dst"++}+++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}"++ gcs_cp "$ARCHIVES_DIR/$archive" "gs://${GCS_BUCKET}/${object_path}" \++ 'public, max-age=31536000, immutable'+done+- if ! gsutil cp "gs://${GCS_BUCKET}/${METADATA_PATH}" "$SRC" 2>/dev/null; then++if ! gcs_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}"++gcs_cp "$DST" "gs://${GCS_BUCKET}/${METADATA_PATH}" \++ 'no-cache, no-store, must-revalidate' 'application/json'++echo ">> published managed grid ${VERSION} for: ${PLATFORMS}"+echo ">> manifest: ${PUBLIC_BASE%/}/${METADATA_PATH}"