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
Kelvin8114cb0a359b
diff --cc .github/workflows/release-grid-runtime.ymlindex bdeaab630,000000000..5c70bca4fmode 100644,000000..100644--- a/.github/workflows/release-grid-runtime.yml+++ b/.github/workflows/release-grid-runtime.yml@@@ -1,189 -1,0 +1,169 @@@+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:+ # 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.++ # Federation is the only path: the GCP_SA_KEY fallback and the key behind it were retired on++ # 2026-09-17. If this step fails, fix the provider or the service account's binding — do not++ # reintroduce a key.+ - 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" | 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+ - 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 cli/src/cli.tsindex ea5363f51,01022c122..f0972c6d2--- a/cli/src/cli.ts+++ b/cli/src/cli.ts@@@ -591,14 -535,11 +589,11 @@@ async function loginCommand}throw err}- return succeed(true)+ return await succeed(true)}// A forced login may intentionally switch SSO accounts. The old daemon must not keep streaming- // under its existing socket while this process replaces the durable session. A daemon running- // WITHOUT a session holds no account to switch away from, and stopping it here would take every- // local terminal down for as long as the person is in the browser — it is swapped afterwards- // instead (restartDaemonForIdentity), once there is an identity to swap to.- if (force && readAuthSession()) await stopDaemonProcess()+ // under its existing socket while this process replaces the durable session.+ if (force) await stopDaemonProcess()const callback = createServer()await new Promise<void>((resolve, reject) => {callback.once('error', reject)@@@ -1040,26 -966,16 +1027,19 @@@ async function updateCommand(force: booasync function logout(): Promise<void> {// Through the lock-taking stop, not an inline kill: a logout that lands mid-handoff would otherwise// SIGTERM the OLD daemon, leave the new one coming up, and then delete the session under it.- const { stopped } = await stopDaemonProcess()+ await stopDaemonProcess()+ // Before clearAuthSession: see the note above on serve children. Its exit code is deliberately+ // dropped — this command cannot fail — and its own words have already reached the terminal.+ const gridOut = await passThroughToGridLogout([])clearAuthSession()rmSync(MACHINE_NAME_FILE, { force: true })// Same reason as the name above: the cached machine list describes the account that just left, and the// local `/api/machines` fallback would otherwise hand it to whoever signs in next on this computer.rmSync(machineListCachePath(), { force: true })+ console.log('Signed out. Run `harness login`, then `harness start`, to reconnect this computer.')- // Existence is the whole of the test — nothing is read out of the store, and nothing is written- // into it. On stderr, so a script reading this command's output is unaffected by it.- warnIfGridSignInRemains()+ // Only when there was no `grid` to run at all. A child that ran has already said what it did, and+ // repeating "your grid sign-in is still here" after a successful sign-out would be false.+ if (!gridOut.ran) warnIfGridSignInRemains()- // A daemon that was up comes back signed out. Signing out is leaving the account, not stopping the- // agents on this computer — the desktop window is still open on them, and the dial is still plugged in.- if (stopped) {- console.log('Signed out. Restarting the daemon for this computer only…')- await launch(false) // prints the guest status block and exits- return- }- console.log('Signed out. Run `harness start` to serve this computer; `harness login` to reach other machines.')process.exit(0)}