Soul-driven AI agent with permission-hardened tools, token budgets, and multi-channel access. Runs 24/7 from CLI, Telegram or More.
release: 1.5.0 — one tag builds and ships the server, the desktop app and the website
Salman Qureshie6424fb41261
diff --git a/.github/workflows/desktop-release.yml b/.github/workflows/desktop-release.ymlindex 7955dbf0..ab2fe255 100644--- a/.github/workflows/desktop-release.yml+++ b/.github/workflows/desktop-release.yml@@ -7,7 +7,7 @@ name: Desktop release# to website/static/desktop/ and records the release in the update manifest).## Secrets: TAURI_SIGNING_PRIVATE_KEY, TAURI_SIGNING_PRIVATE_KEY_PASSWORD (the-# updater key, docs/updates.md). Optional macOS signing: APPLE_CERTIFICATE,+# updater key, UPDATES.md). Optional macOS signing: APPLE_CERTIFICATE,# APPLE_CERTIFICATE_PASSWORD, APPLE_SIGNING_IDENTITY, APPLE_ID, APPLE_PASSWORD,# APPLE_TEAM_ID.diff --git a/.github/workflows/release.yml b/.github/workflows/release.ymlnew file mode 100644index 00000000..ccc465c8--- /dev/null+++ b/.github/workflows/release.yml@@ -0,0 +1,243 @@+name: Release++# One tag, everything shipped: push `vX.Y.Z` (the version in package.json and+# apps/desktop) and this builds, then publishes, in an order that never leaves+# a half release in public:+#+# 1. server — every standalone binary + web.tar.gz + checksums into a DRAFT+# GitHub release (notes from RELEASE.md);+# 2. desktop — Mercury Desktop for macOS (arm64, x64), Windows and Linux,+# plus the updater's latest.json, into the same draft;+# 3. publish — only when 1 and 2 succeeded: the release goes public, npm+# publishes the package;+# 4. website — downloads page, desktop/latest.json and the signed update+# manifest point at the release; docs/ is rebuilt and pushed to+# main (GitHub Pages serves main:/docs).+#+# A failure before 3 leaves only a draft (delete it, fix, push the tag again).+# Secrets: NPM_TOKEN, TAURI_SIGNING_PRIVATE_KEY, TAURI_SIGNING_PRIVATE_KEY_PASSWORD.+# Desktop builds are not code-signed yet (macOS ad-hoc); see UPDATES.md.++on:+ push:+ tags: ['v[0-9]+.[0-9]+.[0-9]+']+ workflow_dispatch:+ inputs:+ tag:+ description: 'Existing tag to (re)build, e.g. v1.5.0'+ required: true++concurrency:+ group: release+ cancel-in-progress: false++permissions:+ contents: write++env:+ TAG: ${{ inputs.tag || github.ref_name }}++jobs:+ checks:+ name: Typecheck, tests, package+ runs-on: ubuntu-latest+ steps:+ - uses: actions/checkout@v4+ with:+ ref: ${{ env.TAG }}+ - uses: actions/setup-node@v4+ with:+ node-version: 22+ cache: npm+ - run: npm ci --no-audit --no-fund+ - run: npm run typecheck+ - run: npm test+ - run: npm run build+ - run: node scripts/verify-package.cjs++ server:+ name: Server binaries (draft release)+ needs: checks+ # Built on a Mac, as releases always were: Bun signs the macOS binaries+ # there (Apple Silicon refuses unsigned ones) and cross-compiles the rest.+ runs-on: macos-14+ outputs:+ version: ${{ steps.v.outputs.version }}+ release_id: ${{ steps.draft.outputs.id }}+ steps:+ - uses: actions/checkout@v4+ with:+ ref: ${{ env.TAG }}+ - uses: actions/setup-node@v4+ with:+ node-version: 22+ cache: npm+ - uses: oven-sh/setup-bun@v2+ with:+ bun-version: latest+ - name: The tag, package.json and the desktop agree+ id: v+ run: |+ v="${TAG#v}"+ for f in package.json apps/desktop/package.json apps/desktop/src-tauri/tauri.conf.json; do+ have=$(node -p "require('./$f').version")+ [ "$have" = "$v" ] || { echo "::error::$f says $have, the tag says $v"; exit 1; }+ done+ grep -q "^version = \"$v\"" apps/desktop/src-tauri/Cargo.toml || { echo "::error::Cargo.toml is not $v"; exit 1; }+ grep -q "^# Release v$v" RELEASE.md || { echo "::error::RELEASE.md is not the notes for v$v"; exit 1; }+ if npm view "@cosmicstack/mercury-agent@$v" version >/dev/null 2>&1; then echo "::error::$v is already on npm"; exit 1; fi+ echo "version=$v" >> "$GITHUB_OUTPUT"+ - run: npm ci --no-audit --no-fund+ - run: npm run build+ - name: Build every standalone binary+ run: node scripts/build-bin.cjs --all+ - run: node scripts/verify-standalone-release.cjs "release/v${{ steps.v.outputs.version }}"+ - name: Draft the GitHub release+ id: draft+ env:+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}+ run: |+ v="${{ steps.v.outputs.version }}"+ dir="release/v$v"+ # A re-run replaces an earlier draft of the same tag; never a published release.+ if gh release view "v$v" --json isDraft -q .isDraft 2>/dev/null | grep -q false; then+ echo "::error::v$v is already published"; exit 1+ fi+ gh release delete "v$v" --yes 2>/dev/null || true+ tail -n +3 RELEASE.md > notes.md+ files=$(find "$dir" -maxdepth 1 -type f \( -name 'mercury-*' -o -name 'web.tar.gz' -o -name 'checksums.txt' \) | sort)+ gh release create "v$v" --draft --verify-tag --title "Mercury v$v" --notes-file notes.md $files+ id=$(gh api "repos/${{ github.repository }}/releases" --jq ".[] | select(.tag_name==\"v$v\") | .id" | head -1)+ [ -n "$id" ] || { echo "::error::draft not found"; exit 1; }+ echo "id=$id" >> "$GITHUB_OUTPUT"++ desktop:+ name: Desktop (${{ matrix.label }})+ needs: server+ strategy:+ fail-fast: true+ matrix:+ include:+ - { os: macos-14, label: macOS Apple Silicon, args: '--target aarch64-apple-darwin', rust: aarch64-apple-darwin }+ - { os: macos-14, label: macOS Intel, args: '--target x86_64-apple-darwin', rust: x86_64-apple-darwin }+ - { os: ubuntu-22.04, label: Linux x64, args: '', rust: '' }+ - { os: windows-latest, label: Windows x64, args: '', rust: '' }+ runs-on: ${{ matrix.os }}+ steps:+ - uses: actions/checkout@v4+ with:+ ref: ${{ env.TAG }}+ - uses: actions/setup-node@v4+ with:+ node-version: 22+ cache: npm+ cache-dependency-path: |+ ui/package-lock.json+ apps/desktop/package-lock.json+ - name: Linux system libraries+ if: runner.os == 'Linux'+ run: |+ sudo apt-get update+ sudo apt-get install -y libwebkit2gtk-4.1-dev libayatana-appindicator3-dev librsvg2-dev patchelf libdbus-1-dev pkg-config rpm+ - uses: dtolnay/rust-toolchain@stable+ with:+ targets: ${{ matrix.rust }}+ - uses: Swatinem/rust-cache@v2+ with:+ workspaces: apps/desktop/src-tauri+ - run: npm ci --no-audit --no-fund+ working-directory: ui+ - run: npm ci --no-audit --no-fund+ working-directory: apps/desktop+ - uses: tauri-apps/tauri-action@v0+ env:+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}+ TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}+ TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}+ # A fresh computer gets the runtime from this same release.+ MERCURY_RUNTIME_TAG: v${{ needs.server.outputs.version }}+ with:+ projectPath: apps/desktop+ releaseId: ${{ needs.server.outputs.release_id }}+ includeUpdaterJson: true+ updaterJsonPreferNsis: true+ args: ${{ matrix.args }} --config src-tauri/tauri.release.conf.json++ publish:+ name: Publish (release + npm)+ needs: [server, desktop]+ runs-on: ubuntu-latest+ permissions:+ contents: write+ id-token: write+ steps:+ - uses: actions/checkout@v4+ with:+ ref: ${{ env.TAG }}+ - uses: actions/setup-node@v4+ with:+ node-version: 22+ registry-url: https://registry.npmjs.org+ cache: npm+ - name: The draft holds the server and every desktop download+ env:+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}+ run: |+ v="${{ needs.server.outputs.version }}"+ names=$(gh api "repos/${{ github.repository }}/releases/${{ needs.server.outputs.release_id }}" --jq '.assets[].name')+ echo "$names"+ for re in '^checksums\.txt$' '^web\.tar\.gz$' '^mercury-macos-arm64$' '^mercury-linux-x64$' '^mercury-win-x64\.exe$' \+ '^latest\.json$' '_aarch64\.dmg$' '_x64\.dmg$' '_x64-setup\.exe$' '_amd64\.AppImage$' '_amd64\.deb$'; do+ echo "$names" | grep -Eq "$re" || { echo "::error::the release has no asset matching $re"; exit 1; }+ done+ - run: npm ci --no-audit --no-fund+ - run: npm run build+ - name: Make the release public+ env:+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}+ run: gh release edit "v${{ needs.server.outputs.version }}" --draft=false --latest+ - name: Publish to npm+ env:+ NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}+ run: npm publish --access public --provenance++ website:+ name: Website (downloads, updates, docs)+ needs: [server, publish]+ runs-on: ubuntu-latest+ steps:+ - uses: actions/checkout@v4+ with:+ ref: main+ fetch-depth: 0+ - uses: actions/setup-node@v4+ with:+ node-version: 22+ cache: npm+ cache-dependency-path: |+ website/package-lock.json+ apps/desktop/package-lock.json+ - run: npm ci --no-audit --no-fund+ working-directory: apps/desktop+ - run: npm ci --no-audit --no-fund+ working-directory: website+ - name: Point the site and the update manifest at the release+ env:+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}+ TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}+ TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}+ run: |+ git show "${TAG}:RELEASE.md" > /tmp/RELEASE.md+ node scripts/release-site.mjs "${{ needs.server.outputs.version }}" --notes /tmp/RELEASE.md+ - name: Rebuild the site (docs/)+ working-directory: website+ run: npm run build:prod+ - name: Keep the hand-written files docs/ also holds+ run: git ls-files -d docs | xargs -r git checkout --+ - name: Push to main+ run: |+ git config user.name "mercury-release[bot]"+ git config user.email "[email protected]"+ git add website/static/desktop website/static/updates website/src/data docs+ git commit -m "release: v${{ needs.server.outputs.version }} on mercuryagent.sh (downloads, updates, docs)" || { echo "nothing to publish"; exit 0; }+ git push origin HEAD:maindiff --git a/CHANGELOG.md b/CHANGELOG.mdindex a29f84d2..f1562cc5 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -2,6 +2,36 @@## Unreleased+## 1.5.0 — Mercury Desktop, updates that roll back, remote access you control++### Mercury Desktop (new)+- **One app for chat, code, bots and research.** It installs and starts Mercury on this computer for you, or connects to any number of Mercury servers (one window per server, switch in a click).+- **Download it at [mercuryagent.sh/download](https://mercuryagent.sh/download).** This first release isn't code-signed yet: macOS asks you to allow it once (System Settings → Privacy & Security → Open Anyway), Windows SmartScreen once (More info → Run anyway).+- **Bots 2.0 in the app.** An inbox of run reports, create and edit bots in words, answer a bot's question mid-run (Allow once, Always allow, Deny), design a fleet's crew or let Mercury decide.+- **Commands and skills in the composer** (`/` and `#`), saved chats, microphone and permissions for Optimus on every OS.++### Updates that never leave you broken+- **An Update button, top right, like Chrome's.** It appears only when the app or one of your servers has an update, gets more noticeable the longer it waits, and shows what's new before you update. Settings → About checks the app and every server in one go, and "Update everything" does them all.+- **Server updates roll back by themselves.** `mercury upgrade` (and the desktop) waits for running work, downloads with checksums (resuming if interrupted), backs up, installs, starts the new version and checks it works. If it doesn't, the old version and your settings come back on their own.+- **Desktop updates** download in the background, resume after a dropped connection, are verified before install, and install when you restart or quit.+- **Required updates** (for example a security fix) show a full screen; continuing without updating takes ticking every risk. Everything else is dismissible.+- **One signed update notice** tells every install what's current; an unsigned or tampered one is ignored, and being offline never blocks anything.++### Remote access you control+- **New devices need your approval.** A phone or laptop signing in shows a code; you approve it with `approve CODE` on Telegram or WhatsApp, in `/server`, or in Mercury Desktop.+- **Sensitive actions from a remote device ask you first** (the shell, Allow All, plugins, channel tokens, restarts, server updates). Remote shell is off by default.+- **Tunnels no longer count as "this computer"**, unused devices expire after 30 days, revoking a device cuts it off at once, and a known device from a new address tells you.+- **`/server` and `mercury server`**: remote access on/off, allowed IP addresses, device tokens (list, make, revoke), approvals and the security log. `mercury doctor --security` checks it all.++### Research+- **One visible run**: a plan you can approve, live progress with failures and their reasons, "Write the report now", and a report even when a run is cut short.+- **Reports export as PDF and Word**, sources show their site icons, and everything Mercury makes is saved in `~/mercury-artifacts` (one folder per chat) instead of loose in your home folder.++### Also in this release+- **Chat attachments** (photos and PDFs), bots take files too, bot avatars, renaming bots.+- Runcrate provider preset; a declared vision capability beats the name-based guess; a zero daily budget means no ceiling; Telegram keeps typing while Mercury prepares.++### MCP servers (ADR-029)- **MCP servers: Mercury can use tools from Model Context Protocol servers.** Add a local server (`mercury mcp add files --stdio npx -- -y @modelcontextprotocol/server-filesystem ~/Documents`) or a remote one (`--http <url>`), allow the tools you want (`mercury mcp allow`), and the agent can call them next to its built-in tools. Every MCP call asks first in Ask Me mode, and Allow All does not cover MCP tools; only tools you list in `autoApprove` run without a prompt, and only those run in scheduled tasks. Secrets stay in `.env` as `${env:NAME}` references and are masked everywhere they could appear. Local servers get a minimal environment, never Mercury's API keys, and remote servers go through the SSRF guard. Check health with `mercury mcp test`, `mercury doctor --mcp`, `/mcp` in chat, or the new read-only **MCP** dashboard page. The agent's file tools now always ask before writing `mercury.yaml`, `permissions.yaml` or `.env`, even under Allow All. See [MCP Servers](https://mercuryagent.sh/docs/integrations/mcp) and ADR-029.diff --git a/RELEASE.md b/RELEASE.mdindex f2b08c82..3e966db9 100644--- a/RELEASE.md+++ b/RELEASE.md@@ -1,31 +1,38 @@-# Release v1.4.2--## ☿ Mercury Agent v1.4.2--Web search finds things again, with no key and with any model, and the research prompt now asks only when you actually want a research article.--### Web search-- **Three sources that answer.** `web_search` asks [Parallel's public search](https://search.parallel.ai/mcp) first (keyless, built for agents, about a second, with excerpts and dates), then DuckDuckGo's html page, then its lite page. Bing's web feed, which had started returning unrelated pages, and the engines that refuse automated requests are gone.-- **DuckDuckGo read exactly.** Both pages are parsed from their real markup: the title, the real address behind DuckDuckGo's redirect, and the snippet. Ads are dropped, a bot challenge is retried once, and a page Mercury can't read is reported instead of looking empty.-- **News links open the article.** News comes from Parallel's article links, then Bing News with its redirects unwrapped to the publisher, then Google News and Hacker News.-- **Never the model's own search.** Results come only from Mercury's search tools, so search works the same whichever model you use.-- **You can see what happened.** Every result ends with a `Searched:` trail, such as `Parallel: timed out → DuckDuckGo: 8 results`, so "nothing found" and "every source was blocked" read differently.-- The built-in `web-search` skill (1.3.0) describes the sources. An installed skill that scraped DuckDuckGo directly is replaced, and your copy is kept as `SKILL.md.replaced.bak`.--### Chat-- **The research prompt asks only when you mean it.** It used to fire on words like "latest" or "explain", so instructions such as "convert the latest epub" got a research question. One short model call now decides; instructions, quick questions and today's news never get the prompt.-- **Quick answer comes first**, so an accidental Enter never starts a long research run.--### Upgrade--**npm:**-```-npm install -g @cosmicstack/[email protected]-mercury restart-```--**Standalone binary:** `mercury upgrade`, or re-run the one-line installer from mercuryagent.sh.--No config changes needed.--**Full Changelog**: https://github.com/cosmicstack-labs/mercury-agent/compare/v1.4.1...v1.4.2+# Release v1.5.0++## ☿ Mercury Agent v1.5.0: Mercury Desktop++Mercury now has a desktop app for macOS, Windows and Linux. It runs Mercury on your computer or connects to Mercury on a server, keeps itself and your servers up to date, and asks you before anyone new gets in.++### Mercury Desktop (new)+- **One app for chat, code, bots and research.** It installs and starts Mercury on this computer for you, or connects to any number of Mercury servers (one window per server, switch in a click).+- **Download it at [mercuryagent.sh/download](https://mercuryagent.sh/download).** This first release isn't code-signed yet: macOS asks you to allow it once (System Settings → Privacy & Security → Open Anyway), Windows SmartScreen once (More info → Run anyway).+- **Bots 2.0 in the app.** An inbox of run reports, create and edit bots in words, answer a bot's question mid-run (Allow once, Always allow, Deny), design a fleet's crew or let Mercury decide.+- **Commands and skills in the composer** (`/` and `#`), saved chats, microphone and permissions for Optimus on every OS.++### Updates that never leave you broken+- **An Update button, top right, like Chrome's.** It appears only when the app or one of your servers has an update, gets more noticeable the longer it waits, and shows what's new before you update. Settings → About checks the app and every server in one go, and "Update everything" does them all.+- **Server updates roll back by themselves.** `mercury upgrade` (and the desktop) waits for running work, downloads with checksums (resuming if interrupted), backs up, installs, starts the new version and checks it works. If it doesn't, the old version and your settings come back on their own.+- **Desktop updates** download in the background, resume after a dropped connection, are verified before install, and install when you restart or quit.+- **Required updates** (for example a security fix) show a full screen; continuing without updating takes ticking every risk. Everything else is dismissible.+- **One signed update notice** tells every install what's current; an unsigned or tampered one is ignored, and being offline never blocks anything.++### Remote access you control+- **New devices need your approval.** A phone or laptop signing in shows a code; you approve it with `approve CODE` on Telegram or WhatsApp, in `/server`, or in Mercury Desktop.+- **Sensitive actions from a remote device ask you first** (the shell, Allow All, plugins, channel tokens, restarts, server updates). Remote shell is off by default.+- **Tunnels no longer count as "this computer"**, unused devices expire after 30 days, revoking a device cuts it off at once, and a known device from a new address tells you.+- **`/server` and `mercury server`**: remote access on/off, allowed IP addresses, device tokens (list, make, revoke), approvals and the security log. `mercury doctor --security` checks it all.++### Research+- **One visible run**: a plan you can approve, live progress with failures and their reasons, "Write the report now", and a report even when a run is cut short.+- **Reports export as PDF and Word**, sources show their site icons, and everything Mercury makes is saved in `~/mercury-artifacts` (one folder per chat) instead of loose in your home folder.++### Also in this release+- **MCP servers**: Mercury can use tools from Model Context Protocol servers (`mercury mcp add`).+- **Chat attachments** (photos and PDFs), bots take files too, bot avatars, renaming bots.+- Runcrate provider preset; a declared vision capability beats the name-based guess; a zero daily budget means no ceiling; Telegram keeps typing while Mercury prepares.++### Install+- **Desktop:** [mercuryagent.sh/download](https://mercuryagent.sh/download)+- **Server / CLI:** `curl -fsSL https://mercuryagent.sh/install.sh | sh` · Windows: `irm https://mercuryagent.sh/install.ps1 | iex` · npm: `npm i -g @cosmicstack/mercury-agent`+- **Already installed:** `mercury upgrade`diff --git a/docs/updates.md b/UPDATES.mdsimilarity index 100%rename from docs/updates.mdrename to UPDATES.mddiff --git a/apps/desktop/package-lock.json b/apps/desktop/package-lock.jsonindex 79300013..a14bd69a 100644--- a/apps/desktop/package-lock.json+++ b/apps/desktop/package-lock.json@@ -1,12 +1,12 @@{"name": "mercury-desktop",- "version": "0.1.0",+ "version": "1.5.0","lockfileVersion": 3,"requires": true,"packages": {"": {"name": "mercury-desktop",- "version": "0.1.0",+ "version": "1.5.0","dependencies": {"@fontsource-variable/geist": "^5.3.0","@fontsource-variable/geist-mono": "^5.3.0",diff --git a/apps/desktop/package.json b/apps/desktop/package.jsonindex e5575880..19cac035 100644--- a/apps/desktop/package.json+++ b/apps/desktop/package.json@@ -1,7 +1,7 @@{"name": "mercury-desktop","private": true,- "version": "0.1.0",+ "version": "1.5.0","description": "Mercury Desktop \u2014 native shell for the Mercury agent runtime","type": "module","scripts": {diff --git a/apps/desktop/src-tauri/Cargo.lock b/apps/desktop/src-tauri/Cargo.lockindex 0f6aa056..807c7a2a 100644--- a/apps/desktop/src-tauri/Cargo.lock+++ b/apps/desktop/src-tauri/Cargo.lock@@ -2409,7 +2409,7 @@ dependencies = [[[package]]name = "mercury-desktop"-version = "0.1.0"+version = "1.5.0"dependencies = ["base64 0.22.1","dirs 6.0.0",diff --git a/apps/desktop/src-tauri/Cargo.toml b/apps/desktop/src-tauri/Cargo.tomlindex 7cf778b3..059e0ff7 100644--- a/apps/desktop/src-tauri/Cargo.toml+++ b/apps/desktop/src-tauri/Cargo.toml@@ -1,6 +1,6 @@[package]name = "mercury-desktop"-version = "0.1.0"+version = "1.5.0"description = "Mercury Desktop — native shell for the Mercury agent runtime"authors = ["Cosmic Stack"]license = "MIT"diff --git a/apps/desktop/src-tauri/src/commands/updates.rs b/apps/desktop/src-tauri/src/commands/updates.rsindex 361cc89a..ba0d2cab 100644--- a/apps/desktop/src-tauri/src/commands/updates.rs+++ b/apps/desktop/src-tauri/src/commands/updates.rs@@ -1,5 +1,5 @@//! Updates for Mercury Desktop itself, and the signed update manifest-//! (docs/updates.md).+//! (UPDATES.md).//!//! - `updates_manifest`: fetch `manifest.json` + `.sig`, verify the minisign//! signature with the updater's public key (the one in tauri.conf.json:diff --git a/apps/desktop/src-tauri/tauri.conf.json b/apps/desktop/src-tauri/tauri.conf.jsonindex 88e60915..4ae36313 100644--- a/apps/desktop/src-tauri/tauri.conf.json+++ b/apps/desktop/src-tauri/tauri.conf.json@@ -1,7 +1,7 @@{"$schema": "https://schema.tauri.app/config/2","productName": "Mercury",- "version": "0.1.0",+ "version": "1.5.0","identifier": "sh.mercuryagent.desktop","build": {"beforeDevCommand": "npm run dev",diff --git a/apps/desktop/src-tauri/tauri.release.conf.json b/apps/desktop/src-tauri/tauri.release.conf.jsonindex d57cd002..fe9ada96 100644--- a/apps/desktop/src-tauri/tauri.release.conf.json+++ b/apps/desktop/src-tauri/tauri.release.conf.json@@ -1,5 +1,8 @@{"bundle": {- "createUpdaterArtifacts": true+ "createUpdaterArtifacts": true,+ "macOS": {+ "signingIdentity": "-"+ }}}diff --git a/apps/desktop/src/updates/logic.ts b/apps/desktop/src/updates/logic.tsindex e318b776..14edf171 100644--- a/apps/desktop/src/updates/logic.ts+++ b/apps/desktop/src/updates/logic.ts@@ -2,7 +2,7 @@Update rules, kept pure so they're tested: version order, how loudthe Update button is, whether a force update applies and whether its"continue anyway" still holds, and which manifest messages show.- See docs/updates.md.+ See UPDATES.md.═══════════════════════════════════════════════════════════════ */import type { ManifestMessage, Minimum, UpdateManifest } from "./types";diff --git a/apps/desktop/src/updates/store.ts b/apps/desktop/src/updates/store.tsindex b28cc9a0..9cd89571 100644--- a/apps/desktop/src/updates/store.ts+++ b/apps/desktop/src/updates/store.ts@@ -3,7 +3,7 @@manifest says. One store so the Update button, the panel, the forcescreen, Settings and the toasts all agree.- Rules (docs/updates.md):+ Rules (UPDATES.md):- nothing here blocks the app unless a VERIFIED manifest (or theserver's own check) says an update is required;- downloads run quietly in the background and resume; failures arediff --git a/apps/desktop/src/updates/types.ts b/apps/desktop/src/updates/types.tsindex 5d8c6527..77b02dc6 100644--- a/apps/desktop/src/updates/types.ts+++ b/apps/desktop/src/updates/types.ts@@ -1,4 +1,4 @@-/* The shapes in docs/updates.md, as the desktop reads them. */+/* The shapes in UPDATES.md, as the desktop reads them. */export interface ChannelRelease {version: string;diff --git a/package-lock.json b/package-lock.jsonindex d02c3265..168d95db 100644--- a/package-lock.json+++ b/package-lock.json@@ -1,12 +1,12 @@{"name": "@cosmicstack/mercury-agent",- "version": "1.4.2",+ "version": "1.5.0","lockfileVersion": 2,"requires": true,"packages": {"": {"name": "@cosmicstack/mercury-agent",- "version": "1.4.2",+ "version": "1.5.0","hasInstallScript": true,"license": "MIT","dependencies": {diff --git a/package.json b/package.jsonindex 2426a30a..408f6f24 100644--- a/package.json+++ b/package.json@@ -1,6 +1,6 @@{"name": "@cosmicstack/mercury-agent",- "version": "1.4.2",+ "version": "1.5.0","description": "Soul-driven AI agent with Second Brain memory, permission-hardened tools, token budgets, and multi-channel access. Runs 24/7 from CLI or Telegram.","type": "module","main": "dist/index.js",diff --git a/scripts/publish.sh b/scripts/publish.shindex 749b5b8d..ce76fcde 100755--- a/scripts/publish.sh+++ b/scripts/publish.sh@@ -41,6 +41,6 @@ echo "✓ Published ${PKG_NAME}@${PKG_VERSION}"echo "Tagging git..."git tag -a "v${PKG_VERSION}" -m "v${PKG_VERSION}"echo "Done. Push with: git push origin main --tags"echo ""-echo "Apps learn about the release from the signed update manifest (docs/updates.md)."+echo "Apps learn about the release from the signed update manifest (UPDATES.md)."echo "Once the GitHub release and its binaries are up, record it and deploy the website:"echo " node scripts/update-manifest.mjs release server ${PKG_VERSION} --notes RELEASE.md"diff --git a/scripts/release-site.mjs b/scripts/release-site.mjsnew file mode 100644index 00000000..74ad7a17--- /dev/null+++ b/scripts/release-site.mjs@@ -0,0 +1,96 @@+#!/usr/bin/env node+/**+ * Point the website at a published release (run by .github/workflows/release.yml+ * after the GitHub release is public; can be run by hand the same way):+ *+ * node scripts/release-site.mjs 1.5.0 [--no-desktop] [--notes RELEASE.md]+ *+ * 1. reads the release's assets from GitHub;+ * 2. desktop: checks latest.json (every platform has a url and a signature —+ * the updater rejects the whole file otherwise) and writes it to+ * website/static/desktop/latest.json, the updater endpoint; writes the+ * download page's website/src/data/desktop-release.json;+ * 3. records the release in the signed update manifest (server, and desktop+ * unless --no-desktop) and re-signs it.+ *+ * It changes files only; the website goes live when docs/ is rebuilt and pushed.+ * GITHUB_TOKEN is used when set (higher API limits); the release must be public.+ */+import { execFileSync } from 'node:child_process';+import { mkdirSync, writeFileSync } from 'node:fs';+import { dirname, join, resolve } from 'node:path';+import { fileURLToPath } from 'node:url';++const ROOT = resolve(dirname(fileURLToPath(import.meta.url)), '..');+const REPO = 'cosmicstack-labs/mercury-agent';+const args = process.argv.slice(2);+const version = args[0];+const withDesktop = !args.includes('--no-desktop');+const notesAt = args.indexOf('--notes');+const notesFile = notesAt > 0 ? args[notesAt + 1] : join(ROOT, 'RELEASE.md');++const die = (msg) => { console.error(`✗ ${msg}`); process.exit(1); };+if (!/^\d+\.\d+\.\d+$/.test(version ?? '')) die('Usage: node scripts/release-site.mjs <version> [--no-desktop] [--notes file.md]');++const headers = { Accept: 'application/vnd.github+json', 'User-Agent': 'mercury-release' };+if (process.env.GITHUB_TOKEN) headers.Authorization = `Bearer ${process.env.GITHUB_TOKEN}`;++const res = await fetch(`https://api.github.com/repos/${REPO}/releases/tags/v${version}`, { headers });+if (!res.ok) die(`Release v${version}: GitHub answered ${res.status}. Is it published?`);+const release = await res.json();+if (release.draft) die(`Release v${version} is still a draft.`);+const assets = release.assets ?? [];+const byName = new Map(assets.map((a) => [a.name, a]));++// The server's own assets must be there: installers and `mercury upgrade` fetch them.+for (const need of ['checksums.txt', 'web.tar.gz', 'mercury-macos-arm64', 'mercury-linux-x64', 'mercury-win-x64.exe']) {+ if (!byName.has(need)) die(`Release v${version} has no ${need}.`);+}++const run = (file, argv) => execFileSync(process.execPath, [join(ROOT, 'scripts', file), ...argv], { stdio: 'inherit', cwd: ROOT });++if (withDesktop) {+ const latestAsset = byName.get('latest.json');+ if (!latestAsset) die(`Release v${version} has no latest.json (the desktop build didn't finish?).`);+ const latest = await (await fetch(latestAsset.browser_download_url)).json();+ if (String(latest.version).replace(/^v/, '') !== version) die(`latest.json says ${latest.version}, not ${version}.`);+ const platforms = Object.entries(latest.platforms ?? {});+ if (!platforms.length) die('latest.json lists no platforms.');+ for (const [name, p] of platforms) if (!p?.url || !p?.signature) die(`latest.json: ${name} has no url or signature.`);+ latest.notes = release.body || latest.notes || '';+ const out = join(ROOT, 'website/static/desktop/latest.json');+ mkdirSync(dirname(out), { recursive: true });+ writeFileSync(out, `${JSON.stringify(latest, null, 2)}\n`);+ console.log(`✓ website/static/desktop/latest.json: ${platforms.map(([n]) => n).join(', ')}`);++ // The download page: one file per platform, found by the names tauri-action gives them.+ const find = (re) => {+ const a = assets.find((x) => re.test(x.name));+ return a ? { url: a.browser_download_url, name: a.name, size: a.size } : undefined;+ };+ const downloads = {+ version,+ date: (release.published_at ?? new Date().toISOString()).slice(0, 10),+ notesUrl: release.html_url,+ assets: Object.fromEntries(Object.entries({+ 'macos-arm64': find(/_aarch64\.dmg$/),+ 'macos-x64': find(/_x64\.dmg$/),+ 'windows-x64-setup': find(/_x64-setup\.exe$/),+ 'windows-x64-msi': find(/_x64_[^_]+\.msi$/),+ 'linux-appimage': find(/_amd64\.AppImage$/),+ 'linux-deb': find(/_amd64\.deb$/),+ 'linux-rpm': find(/\.x86_64\.rpm$/),+ }).filter(([, v]) => v)),+ };+ const missing = ['macos-arm64', 'macos-x64', 'windows-x64-setup', 'linux-appimage'].filter((k) => !downloads.assets[k]);+ if (missing.length) die(`Release v${version} is missing desktop downloads: ${missing.join(', ')}.`);+ const dl = join(ROOT, 'website/src/data/desktop-release.json');+ mkdirSync(dirname(dl), { recursive: true });+ writeFileSync(dl, `${JSON.stringify(downloads, null, 2)}\n`);+ console.log(`✓ website/src/data/desktop-release.json: ${Object.keys(downloads.assets).join(', ')}`);+}++run('update-manifest.mjs', ['release', 'server', version, '--notes', notesFile, '--url', release.html_url]);+if (withDesktop) run('update-manifest.mjs', ['release', 'desktop', version, '--notes', notesFile, '--url', release.html_url]);+run('update-manifest.mjs', ['verify']);+console.log(`Website files point at v${version}. Rebuild docs/ (cd website && npm run build:prod) and push to deploy.`);diff --git a/scripts/update-manifest.mjs b/scripts/update-manifest.mjsindex 8e9f1f5c..2c8090a0 100644--- a/scripts/update-manifest.mjs+++ b/scripts/update-manifest.mjs@@ -1,6 +1,6 @@#!/usr/bin/env node/**- * Edit and sign the update manifest (docs/updates.md):+ * Edit and sign the update manifest (UPDATES.md):* website/static/updates/manifest.json + manifest.json.sig.** node scripts/update-manifest.mjs show@@ -22,6 +22,7 @@* website deploys.*/import { execFileSync } from 'node:child_process';+import { createHash, createPublicKey, verify as cryptoVerify } from 'node:crypto';import { existsSync, readFileSync, writeFileSync, mkdirSync, unlinkSync } from 'node:fs';import { homedir } from 'node:os';import { dirname, join, resolve } from 'node:path';@@ -64,19 +65,29 @@ const app = (name) => (name === 'server' || name === 'desktop' ? name : die(`Sayconst version = (v) => (VERSION_RE.test(String(v)) ? String(v) : die(`"${v}" is not a version like 1.5.0.`));const isoDay = (v) => (v ? (Number.isNaN(Date.parse(v)) ? die(`"${v}" is not a date.`) : new Date(v).toISOString()) : null);-function keyPaths() {- const key = process.env.TAURI_SIGNING_PRIVATE_KEY_PATH || join(homedir(), '.tauri/mercury-updates.key');- if (!existsSync(key)) die(`No signing key at ${key}. Set TAURI_SIGNING_PRIVATE_KEY_PATH.`);- let password = process.env.TAURI_SIGNING_PRIVATE_KEY_PASSWORD;- if (password === undefined && existsSync(`${key}.password`)) password = readFileSync(`${key}.password`, 'utf-8').trim();- return { key, password: password ?? '' };+/**+ * The signing key: TAURI_SIGNING_PRIVATE_KEY (the key text, as in CI) or the+ * key file (TAURI_SIGNING_PRIVATE_KEY_PATH, default ~/.tauri/mercury-updates.key,+ * with its password from TAURI_SIGNING_PRIVATE_KEY_PASSWORD or the .password+ * file beside it). The password travels in the environment, never argv.+ */+function signingEnv() {+ const env = { ...process.env };+ if (env.TAURI_SIGNING_PRIVATE_KEY) return env;+ const key = env.TAURI_SIGNING_PRIVATE_KEY_PATH || join(homedir(), '.tauri/mercury-updates.key');+ if (!existsSync(key)) die(`No signing key: set TAURI_SIGNING_PRIVATE_KEY, or put the key at ${key}.`);+ env.TAURI_SIGNING_PRIVATE_KEY = readFileSync(key, 'utf-8').trim();+ if (env.TAURI_SIGNING_PRIVATE_KEY_PASSWORD === undefined && existsSync(`${key}.password`)) {+ env.TAURI_SIGNING_PRIVATE_KEY_PASSWORD = readFileSync(`${key}.password`, 'utf-8').trim();+ }+ delete env.TAURI_SIGNING_PRIVATE_KEY_PATH;+ return env;}function sign() {if (!existsSync(TAURI)) die('Install the desktop dependencies first (cd apps/desktop && npm ci): signing uses the Tauri CLI.');- const { key, password } = keyPaths();if (existsSync(SIG)) unlinkSync(SIG);- execFileSync(TAURI, ['signer', 'sign', '-f', key, '-p', password, FILE], { stdio: ['ignore', 'ignore', 'inherit'] });+ execFileSync(TAURI, ['signer', 'sign', FILE], { stdio: ['ignore', 'ignore', 'inherit'], env: signingEnv() });if (!existsSync(SIG)) die('Signing wrote no signature.');console.log(`✓ Signed ${FILE.replace(`${ROOT}/`, '')}`);}@@ -88,16 +99,29 @@ function save(m) {sign();}+/**+ * Check the committed signature with the public key every install has+ * (tauri.conf.json's updater pubkey): Ed25519 over BLAKE2b-512 of the file+ * (minisign "ED"), plus the global signature over the trusted comment.+ * The same check as src/updates/minisign.ts, without needing a build.+ */function verify() {- // The runtime's verifier is the one clients use; run it on the committed files.- const out = execFileSync(process.execPath, ['--import', 'tsx', '-e', `- import { readFileSync } from 'node:fs';- import { verifyMinisign } from ${JSON.stringify(join(ROOT, 'src/updates/minisign.ts'))};- import { UPDATE_PUBLIC_KEY } from ${JSON.stringify(join(ROOT, 'src/updates/public-key.ts'))};- const ok = verifyMinisign(readFileSync(${JSON.stringify(FILE)}), readFileSync(${JSON.stringify(SIG)}, 'utf-8').trim(), UPDATE_PUBLIC_KEY);- console.log(ok ? 'ok' : 'bad');- `], { cwd: ROOT, encoding: 'utf-8' }).trim();- if (!out.endsWith('ok')) die('The signature does not match the manifest.');+ const conf = JSON.parse(readFileSync(join(ROOT, 'apps/desktop/src-tauri/tauri.conf.json'), 'utf-8'));+ const b64text = (v) => Buffer.from(v.trim(), 'base64').toString('utf8');+ const lines = (t) => t.split(/\r?\n/).map((l) => l.trim()).filter(Boolean);+ const pkRaw = Buffer.from(lines(b64text(conf.plugins.updater.pubkey)).find((l) => !/^untrusted comment:/i.test(l)), 'base64');+ const sigLines = lines(b64text(readFileSync(SIG, 'utf-8')));+ const sigRaw = Buffer.from(sigLines[1], 'base64');+ const trusted = sigLines[2].replace(/^trusted comment:\s?/i, '');+ const globalSig = Buffer.from(sigLines[3], 'base64');+ const key = createPublicKey({ key: { kty: 'OKP', crv: 'Ed25519', x: pkRaw.subarray(10, 42).toString('base64url') }, format: 'jwk' });+ const alg = sigRaw.subarray(0, 2).toString('latin1');+ const data = readFileSync(FILE);+ const message = alg === 'ED' ? createHash('blake2b512').update(data).digest() : data;+ const ok = sigRaw.subarray(2, 10).equals(pkRaw.subarray(2, 10))+ && cryptoVerify(null, message, key, sigRaw.subarray(10, 74))+ && cryptoVerify(null, Buffer.concat([sigRaw.subarray(10, 74), Buffer.from(trusted, 'utf8')]), key, globalSig);+ if (!ok) die('The signature does not match the manifest.');console.log('✓ Signature verifies with the public key clients have.');}diff --git a/src/cli/upgrade-cli.ts b/src/cli/upgrade-cli.tsindex cf2556cc..77ff7b4b 100644--- a/src/cli/upgrade-cli.ts+++ b/src/cli/upgrade-cli.ts@@ -8,7 +8,7 @@ import { HEALTH_TIMEOUT_MS, readJob, realWorkerSteps, runUpdateWorker, startServ/*** `mercury upgrade` and `mercury update`: the same fail-safe update the- * apps start (docs/updates.md §2), in a terminal, with a progress bar.+ * apps start (UPDATES.md §2), in a terminal, with a progress bar.** mercury upgrade update to the newest version (waits for running work)* mercury upgrade --now don't wait for running workdiff --git a/src/updates/manifest.ts b/src/updates/manifest.tsindex c6e0a3aa..cb8ba705 100644--- a/src/updates/manifest.ts+++ b/src/updates/manifest.ts@@ -6,7 +6,7 @@ import { verifyMinisign } from './minisign.js';import { UPDATE_PUBLIC_KEY } from './public-key.js';/**- * The update manifest (docs/updates.md §1): one signed file that says what+ * The update manifest (UPDATES.md §1): one signed file that says what* the newest Mercury and Mercury Desktop are, which versions must update,* and what to tell people.*diff --git a/src/updates/server-updater.ts b/src/updates/server-updater.tsindex 7a053944..a344a35c 100644--- a/src/updates/server-updater.ts+++ b/src/updates/server-updater.ts@@ -8,7 +8,7 @@ import { NotAvailableError, downloadRelease, downloadsDir, type DownloadProgressimport { NPM_PACKAGE, type InstallInfo, type InstallKind } from './install-kind.js';/**- * Updating the server without breaking it (docs/updates.md §2).+ * Updating the server without breaking it (UPDATES.md §2).** The running Mercury does the safe half: waits for running work, downloads* (resumable, checksum-verified) and backs up the settings files, all whilediff --git a/src/updates/status.ts b/src/updates/status.tsindex 93a36a96..bedada59 100644--- a/src/updates/status.ts+++ b/src/updates/status.ts@@ -7,7 +7,7 @@ import { compareVersions, getManifest, latestFor, messagesFor, readManifestCacheimport { blockedFor, justUpdated, markJustUpdatedSeen, readJob, updatesHome, type UpdateJob } from './server-updater.js';/**- * What GET /api/updates says (docs/updates.md §2): this server's version,+ * What GET /api/updates says (UPDATES.md §2): this server's version,* the newest one, whether it must update, and how an update is going.*/diff --git a/src/web/api-contract.ts b/src/web/api-contract.tsindex 90762cc1..a319969b 100644--- a/src/web/api-contract.ts+++ b/src/web/api-contract.ts@@ -55,7 +55,7 @@ export const API_FEATURES: readonly string[] = Object.freeze(['artifacts.folder', // GET /api/artifacts/folder (the output folder, loose files), POST /api/artifacts/folder/tidy'chat.favicon', // GET /api/chat/favicon?domain= — a site's icon (204 when it has none), fetched and cached by the runtime'security.remote', // device pairing needs the owner (202 + POST /api/auth/token/pending), sensitive remote actions 428 + X-Mercury-Approval, /api/security/* (this computer), SSE 'owner_approval' (local activity), expired devices 401 { expired }- 'updates', // GET /api/updates[?seen=1], POST /api/updates/check, POST /api/updates/server { version?, now? } (202; remote → 428 owner), POST /api/updates/server/cancel — see docs/updates.md+ 'updates', // GET /api/updates[?seen=1], POST /api/updates/check, POST /api/updates/server { version?, now? } (202; remote → 428 owner), POST /api/updates/server/cancel — see UPDATES.md'chat.research', // SSE 'research' / 'research_plan' / 'research_plan_resolved' / 'notice'; GET /api/chat/threads/:id/research, POST …/research/finish, …/research/off, POST /api/chat/research/plan/:id; message.research; step_done { failed, reason }]);diff --git a/src/web/api/updates.ts b/src/web/api/updates.tsindex 8edb8b11..d0303050 100644--- a/src/web/api/updates.ts+++ b/src/web/api/updates.ts@@ -9,7 +9,7 @@ import { compareVersions } from '../../updates/manifest.js';import { detectInstall } from '../../updates/install-kind.js';/**- * Updating this Mercury (docs/updates.md §2):+ * Updating this Mercury (UPDATES.md §2):** GET /api/updates[?seen=1] version, newest, required, the job* POST /api/updates/check the same, checked again now (rate limited)diff --git a/website/static/updates/manifest.json.sig b/website/static/updates/manifest.json.sigindex 80494083..8e372b6c 100644--- a/website/static/updates/manifest.json.sig+++ b/website/static/updates/manifest.json.sig@@ -1 +1 @@-dW50cnVzdGVkIGNvbW1lbnQ6IHNpZ25hdHVyZSBmcm9tIHRhdXJpIHNlY3JldCBrZXkKUlVUV2VUTlRLNTFvNjdndUpSMHBZOFZ2a2U0SmdxVW1scTd0UU5sZHMzM0NPQ0d6d0FFeTJvOG5ldERhTVZ0V0YxeXZZRW1DenhqZTZTcVJlcmUreFRVbTFUaU9TcHFmTXdVPQp0cnVzdGVkIGNvbW1lbnQ6IHRpbWVzdGFtcDoxNzkzNjgzNDM5CWZpbGU6bWFuaWZlc3QuanNvbgp3TzFyMFczTlpIT0xzYmlsVW12TGZxenRoNzEzSmplQ3dJYWpxSVZYck9rRzVVZnV6eXhYbjUvcXBvLzNIZmJ4RzI0WW80SDFrNlN5ZGVzbFZPUEhCdz09Cg==\ No newline at end of file+dW50cnVzdGVkIGNvbW1lbnQ6IHNpZ25hdHVyZSBmcm9tIHRhdXJpIHNlY3JldCBrZXkKUlVUV2VUTlRLNTFvNjd4V0VHT0c0Nzc2bStoTjNWc3VtSVhKTlArd2FDWHhMdzVlZkFyMlVDMUxyTUtRcEl5UzBydW9UeGxZSEJKbFVNUVhmSHdsTlhPRS9nRGJLUU5EU2c4PQp0cnVzdGVkIGNvbW1lbnQ6IHRpbWVzdGFtcDoxNzkzNjg2NTY5CWZpbGU6bWFuaWZlc3QuanNvbgp4UnNRVWdESjlseWRvYWtVYmkzRDNwUGNqbkdYVHU0WWJ0ZnNNM0RhaUd0ZDlIREN4MG1USkJYa3hHZHZ4SHY0dTVDOE9VZG1YR3pWdDlOWS85b0NCZz09Cg==\ No newline at end of file