diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7fd133b..5f14f5f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -57,10 +57,29 @@ jobs: - name: Sync version run: node scripts/set-version.mjs "${{ needs.create-release.outputs.version }}" + # The automation runtime (tron snapshot/analyze/run/mcp/automate) is the + # compiled browser-core, agent-runtime and sdk packages, which + # build-release.sh stages only when it can build them. That takes pnpm and + # the workspace's dev dependencies; without this step the stage is skipped + # with a one-line note and every release ships without `sdk/`. + - name: Install workspace (for the automation runtime) + if: matrix.platform != 'windows' + run: | + corepack enable + corepack prepare pnpm@9.12.0 --activate + pnpm install --frozen-lockfile --filter @tronbrowser/sdk... + - name: Package (linux/macos) if: matrix.platform != 'windows' run: bash apps/desktop/scripts/build-release.sh "v${{ needs.create-release.outputs.version }}" ${{ matrix.platform }} + - name: Check the automation runtime is in the archive + if: matrix.platform != 'windows' + run: | + if [ "${{ matrix.platform }}" = linux ]; then list="tar -tzf dist/tronbrowser-linux-x64.tar.gz"; else list="unzip -Z1 dist/tronbrowser-macos.zip"; fi + $list | grep -q 'sdk/automate-bin.js' \ + || { echo "::error::release archive has no sdk/automate-bin.js (automation runtime was not staged)"; exit 1; } + - name: Package (linux deb + rpm + AppImage) if: matrix.platform == 'linux' run: | diff --git a/apps/desktop/scripts/build-release.sh b/apps/desktop/scripts/build-release.sh index 558580f..97cdab2 100755 --- a/apps/desktop/scripts/build-release.sh +++ b/apps/desktop/scripts/build-release.sh @@ -42,7 +42,12 @@ stage_automation() { # dest dir local s="$1" command -v node >/dev/null 2>&1 && command -v pnpm >/dev/null 2>&1 || { echo " ! automation runtime skipped (needs node + pnpm)"; return; } - if ( cd "$REPO_ROOT" && pnpm --filter @tronbrowser/browser-core --filter @tronbrowser/agent-runtime --filter @tronbrowser/sdk build >/dev/null 2>&1 ); then + # Keep the build log: a silent skip here shipped releases with no sdk/ for a + # while (nothing installed pnpm on the release runner) and the only trace was + # one line in the job log. + local log="$s/../automation-build.log" + if ( cd "$REPO_ROOT" && pnpm --filter @tronbrowser/browser-core --filter @tronbrowser/agent-runtime --filter @tronbrowser/sdk build >"$log" 2>&1 ); then + rm -f "$log" rm -rf "$s/automate" "$s/analyze" "$s/sdk" cp -R "$REPO_ROOT/packages/browser-core/dist" "$s/automate" printf '{\n "type": "module"\n}\n' > "$s/automate/package.json" @@ -52,7 +57,9 @@ stage_automation() { # dest dir printf '{\n "type": "module"\n}\n' > "$s/sdk/package.json" echo " + bundled automation + analyze + SDK (tron snapshot/extract/analyze/run)" else - echo " ! automation runtime skipped (browser-core/agent-runtime/sdk build failed)" + echo " ! automation runtime skipped (browser-core/agent-runtime/sdk build failed):" + tail -n 20 "$log" 2>/dev/null | sed 's/^/ /' + rm -f "$log" fi } diff --git a/services/api/src/mcp/tron.ts b/services/api/src/mcp/tron.ts index e255c02..edbea57 100644 --- a/services/api/src/mcp/tron.ts +++ b/services/api/src/mcp/tron.ts @@ -169,7 +169,8 @@ export function tronRelay(deps: TronRelayDeps = {}): TronRelay { c.json({ ok: true, name: 'TronBrowser', - mcp: `${new URL(c.req.url).origin}/mcp/tron`, + // Railway terminates TLS, so the origin seen here is http://; report what the caller used. + mcp: `${(c.req.header('x-forwarded-proto') ?? new URL(c.req.url).protocol.replace(':', '')).split(',')[0]}://${new URL(c.req.url).host}/mcp/tron`, descriptor: DESCRIPTOR_URL, tools: toolNames, engines: engines