Local-first AI coding agent desktop: Electron + Rust host core + pi Agent Harness + user-installable plugins
TypeScript ai-agentcoding-agentdesktop-appelectronglobali18nlocal-firstmcppipi-agentpi-desktoppluginsreactrusttypescript
feat(release): sign, notarize, and in-app update official macOS builds
vastsa31b660a22ec3
diff --git a/.github/workflows/release.yml b/.github/workflows/release.ymlindex 02df4fa6a..47061e255 100644--- a/.github/workflows/release.yml+++ b/.github/workflows/release.yml@@ -12,7 +12,8 @@# with its native pi-desktop-host-core Rust sidecar. The Linux app.asar is also# exported as a system-Electron repackaging asset, and all outputs — with their# electron-updater latest*.yml feeds — are published to the GitHub Release-# (D126/D285/D364).+# (D126/D285/D364). macOS tag artifacts are Developer ID-signed, notarized, and+# stapled before upload (D450 / ADR 0289).## It also builds the headless `pi-host` bundle for every Linux platform the# desktop publishes (currently x64) and publishes it as@@ -29,9 +30,9 @@ on:workflow_dispatch:inputs:sign_macos:- description: 'Sign and notarize macOS artifacts for this run'+ description: 'Sign and notarize macOS artifacts (default true; set false only for unsigned debug artifacts)'required: false- default: false+ default: truetype: boolean# Least privilege by default; only the publish job needs to write the release.@@ -84,6 +85,9 @@ jobs:build:name: Build ${{ matrix.name }}needs: verify+ env:+ # Tag pushes always sign. workflow_dispatch signs unless explicitly disabled.+ MACOS_SIGN_RELEASE: ${{ github.event_name != 'workflow_dispatch' || inputs.sign_macos == true }}strategy:fail-fast: falsematrix:@@ -194,10 +198,9 @@ jobs:run: pnpm --filter @pi-desktop/desktop run ${{ matrix.dist }} -- --${{ matrix.arch }}- name: Package unsigned macOS installer- if: matrix.platform == 'macos' && inputs.sign_macos != true+ if: matrix.platform == 'macos' && env.MACOS_SIGN_RELEASE != 'true'env:- # Default release lane: macOS artifacts stay unsigned unless a- # workflow_dispatch run explicitly sets sign_macos=true.+ # Debug-only lane: workflow_dispatch with sign_macos=false.CSC_IDENTITY_AUTO_DISCOVERY: 'false'run: |set -euo pipefail@@ -205,11 +208,38 @@ jobs:# pattern labels ZIPs, and the dmg target pattern labels DMGs.pnpm --filter @pi-desktop/desktop run dist:mac -- --${{ matrix.arch }}+ - name: Require macOS signing and notarization secrets+ if: matrix.platform == 'macos' && env.MACOS_SIGN_RELEASE == 'true'+ env:+ CSC_LINK: ${{ secrets.CSC_LINK }}+ CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }}+ APPLE_ID: ${{ secrets.APPLE_ID }}+ APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLE_APP_SPECIFIC_PASSWORD }}+ APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}+ run: |+ set -euo pipefail+ missing=()+ [[ -n "${CSC_LINK}" ]] || missing+=(CSC_LINK)+ [[ -n "${CSC_KEY_PASSWORD}" ]] || missing+=(CSC_KEY_PASSWORD)+ [[ -n "${APPLE_ID}" ]] || missing+=(APPLE_ID)+ [[ -n "${APPLE_APP_SPECIFIC_PASSWORD}" ]] || missing+=(APPLE_APP_SPECIFIC_PASSWORD)+ [[ -n "${APPLE_TEAM_ID}" ]] || missing+=(APPLE_TEAM_ID)+ if ((${#missing[@]} > 0)); then+ echo "::error::Missing GitHub Actions secrets for macOS signing/notarization: ${missing[*]}"+ echo "::error::Add them under Settings → Secrets and variables → Actions. See docs/spec/06-delivery/06-release-runbook.md."+ exit 1+ fi+ if [[ "${APPLE_TEAM_ID}" != "DUV63RKYTW" ]]; then+ echo "::error::APPLE_TEAM_ID must be DUV63RKYTW (XingYu Liu Developer ID team)."+ exit 1+ fi+- name: Package signed and notarized macOS installer- if: matrix.platform == 'macos' && inputs.sign_macos == true+ if: matrix.platform == 'macos' && env.MACOS_SIGN_RELEASE == 'true'env:CSC_LINK: ${{ secrets.CSC_LINK }}CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }}+ CSC_NAME: "Developer ID Application: XingYu Liu (DUV63RKYTW)"APPLE_ID: ${{ secrets.APPLE_ID }}APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLE_APP_SPECIFIC_PASSWORD }}APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}@@ -218,15 +248,16 @@ jobs:# Artifact names are defined in apps/desktop/package.json: the mac# pattern labels ZIPs, and the dmg target pattern labels DMGs.pnpm --filter @pi-desktop/desktop run dist:mac -- --${{ matrix.arch }} \+ -c.mac.identity="Developer ID Application: XingYu Liu (DUV63RKYTW)" \-c.mac.forceCodeSigning=true \-c.mac.notarize=true- name: Staple macOS installer ticket- if: matrix.platform == 'macos' && inputs.sign_macos == true+ if: matrix.platform == 'macos' && env.MACOS_SIGN_RELEASE == 'true'run: scripts/staple-macos-release-dmg.sh apps/desktop/release- name: Verify signed and notarized macOS installer- if: matrix.platform == 'macos' && inputs.sign_macos == true+ if: matrix.platform == 'macos' && env.MACOS_SIGN_RELEASE == 'true'run: scripts/verify-macos-release.sh apps/desktop/release- name: Verify Linux host-core glibc floordiff --git a/.gitignore b/.gitignoreindex e1ca7d9bf..fe94fa8bb 100644--- a/.gitignore+++ b/.gitignore@@ -29,6 +29,10 @@ docs/image/pi_logo.webp.env.*!.env.example*.local+*.p12+*.cer+*.p8+*.mobileprovision# IDE / OS.DS_Storediff --git a/README.md b/README.mdindex 1eff409b0..48e6543ea 100644--- a/README.md+++ b/README.md@@ -364,15 +364,15 @@ The target distribution still needs the required native host and packaged resour</details><details>-<summary><strong>macOS unsigned-build notes</strong></summary>+<summary><strong>macOS first-launch notes</strong></summary><br />-The tagged-release workflow publishes unsigned macOS artifacts by default.+Official GitHub Release macOS builds are Developer ID-signed, notarized, and stapled. After moving `PI-Desktop.app` to `/Applications`, the app should open without extra steps.-For a trusted unsigned install, move `PI-Desktop.app` to `/Applications` and open it. If macOS reports the app as damaged or refuses to open it:+Local or unsigned debug builds can still carry Apple's quarantine attribute. If macOS reports the app as damaged or refuses to open it:-1. Confirm the app came from a trusted PI-Desktop release.+1. Confirm the app came from a trusted PI-Desktop source.2. Move `PI-Desktop.app` to `/Applications`.3. Run:@@ -386,12 +386,14 @@ The DMG includes `If app won't open, read this.txt`. The ZIP also includes `PI-DThe command only removes Apple's quarantine attribute. Do not use it for an untrusted app.-A manually dispatched run with `sign_macos: true` signs, notarizes, and staples macOS artifacts with Developer ID credentials before publication; signed builds do not need this fallback.+Signed and notarized builds do not need this fallback.</details>### Code signing+macOS GitHub Release artifacts are signed with Developer ID Application `XingYu Liu (DUV63RKYTW)` and notarized by Apple.+Windows releases of PI-Desktop are digitally signed with free code signing provided by [SignPath.io](https://signpath.io/), using a certificate from the [SignPath Foundation](https://signpath.org/).---diff --git a/README.zh-CN.md b/README.zh-CN.mdindex 242837e4a..b0e2dcaed 100644--- a/README.zh-CN.md+++ b/README.zh-CN.md@@ -466,22 +466,23 @@ electron PI-Desktop-<version>-linux-x64.asar</details><details>-<summary><strong>macOS 未签名版本说明</strong></summary>+<summary><strong>macOS 首次启动说明</strong></summary><br />-当前 tagged-release workflow 默认发布未签名的 macOS 构建。+GitHub Release 上的正式 macOS 构建已使用 Developer ID 签名、公证并装订。将 `PI-Desktop.app` 移到 `/Applications` 后应可直接打开。-如果你确认安装包来自可信的 PI-Desktop Release:+本地或未签名的调试构建仍可能带有 Apple 隔离属性。如果 macOS 提示 App 已损坏或无法打开:-1. 将 `PI-Desktop.app` 移动到 `/Applications`-2. 如果 macOS 提示 App 已损坏或无法打开,运行:+1. 确认安装包来自可信的 PI-Desktop 来源+2. 将 `PI-Desktop.app` 移动到 `/Applications`+3. 运行:```bashxattr -r -d com.apple.quarantine /Applications/PI-Desktop.app```-3. 再次打开 PI-Desktop+4. 再次打开 PI-DesktopDMG 内包含 `If app won't open, read this.txt`。@@ -491,11 +492,13 @@ ZIP 包也包含 `PI-Desktop-macOS-open.command`,在应用移动到 Applicatio**不要对来源不可信的 App 使用。**-使用 `sign_macos: true` 手动触发发布流程时,可以通过 Developer ID 对 macOS 产物完成签名、公证与 stapling;已签名版本不需要这套 fallback。+已签名并公证的版本不需要这套 fallback。</details>-### Windows 代码签名+### 代码签名++macOS GitHub Release 产物使用 Developer ID Application `XingYu Liu (DUV63RKYTW)` 签名,并由 Apple 公证。PI-Desktop 的 Windows Release 使用 [SignPath.io](https://signpath.io/) 提供的免费代码签名服务,并通过 [SignPath Foundation](https://signpath.org/) 的证书完成签名。diff --git a/apps/desktop/PI-Desktop-macOS-opening-help.txt b/apps/desktop/PI-Desktop-macOS-opening-help.txtindex 9d3a5eddd..43eb64f18 100644--- a/apps/desktop/PI-Desktop-macOS-opening-help.txt+++ b/apps/desktop/PI-Desktop-macOS-opening-help.txt@@ -1,7 +1,10 @@PI-Desktop macOS first launch-This build is unsigned. After moving PI-Desktop.app to Applications, if macOS-says the app is damaged or does not open, open Terminal and run:+Official GitHub Release builds are Developer ID-signed and notarized. After+moving PI-Desktop.app to Applications, the app should open without extra steps.++If you are using a local or unsigned build and macOS says the app is damaged+or does not open, open Terminal and run:xattr -r -d com.apple.quarantine /Applications/PI-Desktop.appdiff --git a/apps/desktop/build/entitlements.mac.plist b/apps/desktop/build/entitlements.mac.plistindex a15d96827..3160f6017 100644--- a/apps/desktop/build/entitlements.mac.plist+++ b/apps/desktop/build/entitlements.mac.plist@@ -2,15 +2,19 @@<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"><plist version="1.0"><dict>- <!-- Standard Electron hardened-runtime entitlements (JIT for V8). -->+ <!-- V8 / Chromium cannot run under Hardened Runtime without JIT. --><key>com.apple.security.cs.allow-jit</key><true/>+ <!-- V8 on Apple Silicon also needs unsigned executable memory. --><key>com.apple.security.cs.allow-unsigned-executable-memory</key><true/>+ <!-- Electron helpers and plugin-loaded native addons are not all signed by+ Team DUV63RKYTW; library validation would refuse them. --><key>com.apple.security.cs.disable-library-validation</key><true/>+ <!-- Isolated plugin panels may capture microphone after the user grants+ `ui.microphone` (ADR 0257). Host speech v1 does not capture. --><key>com.apple.security.device.audio-input</key><true/></dict>-</plist>diff --git a/apps/desktop/electron/main/updater.ts b/apps/desktop/electron/main/updater.tsindex 9caa40eb4..f0b287177 100644--- a/apps/desktop/electron/main/updater.ts+++ b/apps/desktop/electron/main/updater.ts@@ -5,13 +5,11 @@* .github/workflows/release.yml. Discovery always tracks the latest stable* release (`allowPrerelease = false`) so RC installs still graduate to newer* stables. Delivery mode per install:- * - Windows NSIS / Linux AppImage → full in-app flow: silent background- * download, "restart to update" prompt, install-on-quit fallback.+ * - Windows NSIS / Linux AppImage / packaged macOS → full in-app flow: silent+ * background download, "restart to update" prompt, install-on-quit fallback.* - Windows portable (`PORTABLE_EXECUTABLE_FILE`) → notify + link. The* NSIS installer must not replace a no-install run.- * - macOS → manual discovery and a releases-page link. In-app installation- * remains disabled pending a separate delivery-policy qualification.- * - Linux deb (no $APPIMAGE in env) → notify + link, like macOS.+ * - Linux deb (no $APPIMAGE in env) → notify + link.* - Unpackaged dev runs → disabled (no app-update.yml in resources).*/import { app, shell } from "electron";@@ -64,8 +62,9 @@ export function resolveUpdateMode(if (platform === "win32") {return env.PORTABLE_EXECUTABLE_FILE ? "manual" : "in-app";}+ if (platform === "darwin") return "in-app";if (platform === "linux" && env.APPIMAGE) return "in-app";- // darwin (unsigned) and non-AppImage linux installs+ // non-AppImage linux installsreturn "manual";}diff --git a/apps/desktop/package.json b/apps/desktop/package.jsonindex 84c2f754c..e32f18b47 100644--- a/apps/desktop/package.json+++ b/apps/desktop/package.json@@ -149,6 +149,7 @@"entitlementsInherit": "build/entitlements.mac.plist","extendInfo": {"NSLocalNetworkUsageDescription": "PI-Desktop needs local network access so agents can reach OpenAI-compatible providers, Ollama, and other AI endpoints running on your LAN. / PI-Desktop 需要本地网络访问权限,以便助手请求同一局域网中的 OpenAI 兼容服务、Ollama 等本地 AI 端点。",+ "NSMicrophoneUsageDescription": "PI-Desktop plugins may use the microphone after you grant them audio access. / 在你授权后,PI-Desktop 插件可以使用麦克风。","NSBonjourServices": ["_http._tcp","_https._tcp"diff --git a/apps/desktop/test/auto-update.test.mjs b/apps/desktop/test/auto-update.test.mjsindex f195e675d..272082182 100644--- a/apps/desktop/test/auto-update.test.mjs+++ b/apps/desktop/test/auto-update.test.mjs@@ -91,11 +91,12 @@ test("main process registers update handlers and the auto-check lifecycle", () =});test("updater gates delivery mode by platform and delivery policy", () => {- // macOS stays manual-delivery even for notarized artifacts; dev builds are- // disabled outright.+ // Packaged macOS, Windows NSIS, and Linux AppImage use in-app delivery.+ // Dev builds are disabled outright.assert.match(updaterSource, /if \(!isPackaged\) return "disabled"/);assert.match(updaterSource, /win32.*in-app|in-app.*win32/s);assert.match(updaterSource, /PORTABLE_EXECUTABLE_FILE \? "manual"/);+ assert.match(updaterSource, /platform === "darwin"[\s\S]*return "in-app"/);assert.match(updaterSource, /APPIMAGE/);assert.match(updaterSource, /autoInstallOnAppQuit = true/);assert.match(diff --git a/apps/desktop/test/ci-workflow.test.mjs b/apps/desktop/test/ci-workflow.test.mjsindex f7b0ee787..5259fe16d 100644--- a/apps/desktop/test/ci-workflow.test.mjs+++ b/apps/desktop/test/ci-workflow.test.mjs@@ -208,26 +208,37 @@ test("release matrix packages both native macOS architectures", () => {assert.match(releaseWorkflowSource, /Merge macOS updater metadata[\s\S]*?ruby/);});-test("macOS release signing is opt-in and disabled by default", () => {+test("macOS release signing is required on tag pushes", () => {assert.match(releaseWorkflowSource,- /workflow_dispatch:\s+inputs:\s+sign_macos:[\s\S]*?default:\s*false[\s\S]*?type:\s*boolean/,+ /workflow_dispatch:\s+inputs:\s+sign_macos:[\s\S]*?default:\s*true[\s\S]*?type:\s*boolean/,+ );+ assert.ok(+ releaseWorkflowSource.includes(+ "MACOS_SIGN_RELEASE: ${{ github.event_name != 'workflow_dispatch' || inputs.sign_macos == true }}",+ ),);const unsignedBlock = releaseWorkflowSource.match(/- name: Package unsigned macOS installer[\s\S]*?(?=\n - name:)/,)?.[0];- assert.ok(unsignedBlock, "default unsigned macOS package step is missing");- assert.match(unsignedBlock, /inputs\.sign_macos != true/);+ assert.ok(unsignedBlock, "unsigned macOS debug package step is missing");+ assert.match(unsignedBlock, /env\.MACOS_SIGN_RELEASE != 'true'/);assert.match(unsignedBlock, /CSC_IDENTITY_AUTO_DISCOVERY:\s*'false'/);assert.doesNotMatch(unsignedBlock, /CSC_LINK:|CSC_KEY_PASSWORD:|APPLE_/);assert.doesNotMatch(unsignedBlock, /forceCodeSigning|notarize/);+ assert.match(+ releaseWorkflowSource,+ /Require macOS signing and notarization secrets[\s\S]*?Missing GitHub Actions secrets for macOS signing/,+ );+ assert.match(releaseWorkflowSource, /APPLE_TEAM_ID must be DUV63RKYTW/);+const signedBlock = releaseWorkflowSource.match(/- name: Package signed and notarized macOS installer[\s\S]*?(?=\n - name:)/,)?.[0];- assert.ok(signedBlock, "explicit signed macOS package step is missing");- assert.match(signedBlock, /inputs\.sign_macos == true/);+ assert.ok(signedBlock, "signed macOS package step is missing");+ assert.match(signedBlock, /env\.MACOS_SIGN_RELEASE == 'true'/);for (const secret of ["CSC_LINK","CSC_KEY_PASSWORD",@@ -237,11 +248,19 @@ test("macOS release signing is opt-in and disabled by default", () => {]) {assert.match(signedBlock, new RegExp(`${secret}:\\s*\\$\\{\\{\\s*secrets\\.${secret}\\s*\\}\\}`));}+ assert.match(+ signedBlock,+ /CSC_NAME: "Developer ID Application: XingYu Liu \(DUV63RKYTW\)"/,+ );+ assert.match(+ signedBlock,+ /-c\.mac\.identity="Developer ID Application: XingYu Liu \(DUV63RKYTW\)"/,+ );assert.match(signedBlock, /-c\.mac\.forceCodeSigning=true/);assert.match(signedBlock, /-c\.mac\.notarize=true/);assert.match(releaseWorkflowSource,- /Staple macOS installer ticket[\s\S]*?if: matrix\.platform == 'macos' && inputs\.sign_macos == true[\s\S]*?Verify signed and notarized macOS installer/,+ /Staple macOS installer ticket[\s\S]*?if: matrix\.platform == 'macos' && env\.MACOS_SIGN_RELEASE == 'true'[\s\S]*?Verify signed and notarized macOS installer/,);});@@ -250,6 +269,7 @@ test("the signed local macOS lane selects the native runner architecture", () =>assert.match(releaseMacScriptSource, /MAC_ARCH="\$\{MAC_ARCH:-\$DEFAULT_MAC_ARCH\}"/);assert.match(releaseMacScriptSource, /must match the host/);assert.match(releaseMacScriptSource, /electron-builder --mac "--\$\{MAC_ARCH\}"/);+ assert.match(releaseMacScriptSource, /XingYu Liu \(DUV63RKYTW\)/);assert.doesNotMatch(releaseMacScriptSource,/-c\.(?:dmg|zip)\.artifactName/,diff --git a/apps/desktop/test/macos-release-verification.test.mjs b/apps/desktop/test/macos-release-verification.test.mjsindex 6dea2eec2..14f7bfe6e 100644--- a/apps/desktop/test/macos-release-verification.test.mjs+++ b/apps/desktop/test/macos-release-verification.test.mjs@@ -14,6 +14,18 @@ const stapleScript = new URL(import.meta.url,);+const SIGNING_IDENTITY = "Developer ID Application: XingYu Liu (DUV63RKYTW)";++async function writeSignedAppFixture(release) {+ const app = join(release, "mac-arm64", "PI-Desktop.app");+ const hostCore = join(app, "Contents", "Resources", "bin", "pi-desktop-host-core");+ const dmg = join(release, "PI-Desktop-0.14.2-arm64.dmg");+ await mkdir(join(app, "Contents", "Resources", "bin"), { recursive: true });+ await writeFile(hostCore, "fixture");+ await writeFile(dmg, "fixture");+ return { app, dmg };+}+test("macOS release finalization staples the generated DMG", async (t) => {const root = await mkdtemp(join(tmpdir(), "pi-desktop-macos-staple-"));t.after(() => rm(root, { recursive: true, force: true }));@@ -48,16 +60,13 @@ test("macOS release verification requires a notarized Developer ID app and DMG",t.after(() => rm(root, { recursive: true, force: true }));const release = join(root, "release");- const app = join(release, "mac-arm64", "PI-Desktop.app");const bin = join(root, "bin");const staplerLog = join(root, "stapler.log");- const dmg = join(release, "PI-Desktop-0.14.2-arm64.dmg");- await mkdir(app, { recursive: true });+ const { app, dmg } = await writeSignedAppFixture(release);await mkdir(bin, { recursive: true });- await writeFile(dmg, "fixture");await writeFile(join(bin, "codesign"),- "#!/usr/bin/env bash\nif [[ \"$*\" == *\"-dv\"* ]]; then echo 'Authority=Developer ID Application: PI-Desktop (TEAM123)' >&2; fi\nexit 0\n",+ `#!/usr/bin/env bash\nif [[ "$*" == *"-dv"* ]]; then echo 'Authority=${SIGNING_IDENTITY}' >&2; echo 'flags=0x10000(runtime)' >&2; fi\nexit 0\n`,);await writeFile(join(bin, "spctl"),@@ -83,6 +92,7 @@ test("macOS release verification requires a notarized Developer ID app and DMG",assert.equal(result.status, 0, `${result.stdout}\n${result.stderr}`);assert.match(result.stdout, /Notarized Developer ID/);assert.match(result.stdout, /PI-Desktop-0\.14\.2-arm64\.dmg/);+ assert.match(result.stdout, /host-core sidecar/);assert.equal(await readFile(staplerLog, "utf8"),`stapler validate ${app}\nstapler validate ${dmg}\n`,@@ -94,14 +104,12 @@ test("macOS release verification rejects a Developer ID app without notarizationt.after(() => rm(root, { recursive: true, force: true }));const release = join(root, "release");- const app = join(release, "mac-arm64", "PI-Desktop.app");const bin = join(root, "bin");- await mkdir(app, { recursive: true });+ await writeSignedAppFixture(release);await mkdir(bin, { recursive: true });- await writeFile(join(release, "PI-Desktop-0.14.2-arm64.dmg"), "fixture");await writeFile(join(bin, "codesign"),- "#!/usr/bin/env bash\nif [[ \"$*\" == *\"-dv\"* ]]; then echo 'Authority=Developer ID Application: PI-Desktop (TEAM123)' >&2; fi\n",+ `#!/usr/bin/env bash\nif [[ "$*" == *"-dv"* ]]; then echo 'Authority=${SIGNING_IDENTITY}' >&2; fi\n`,);await writeFile(join(bin, "spctl"),diff --git a/docs/adr/0022-application-update-delivery.md b/docs/adr/0022-application-update-delivery.mdindex b728fb45e..697522710 100644--- a/docs/adr/0022-application-update-delivery.md+++ b/docs/adr/0022-application-update-delivery.md@@ -1,9 +1,9 @@# ADR 0022: Application Update Delivery-- Status: Accepted (amended by D364 / ADR 0197)+- Status: Accepted (amended by D364 / ADR 0197, D450 / ADR 0289)- Date: 2026-07-26- Deciders: PI-Desktop core-- Related: D120, D126, D364, D010, ADR 0021, ADR 0197+- Related: D120, D126, D364, D010, D450, ADR 0021, ADR 0197, ADR 0289## Context@@ -20,12 +20,12 @@ download-and-install flow.Releases feed, update polling, and install lifecycle. Renderer IPC exposesonly allowlisted check, state, release-link, and install operations; callerscannot supply a feed URL.-2. Development builds keep updates disabled. Packaged macOS and non-AppImage- Linux use manual delivery: discovery stops at `available` and opens the- fixed releases page. Windows NSIS and Linux AppImage use in-app download and- quit-and-install delivery. Windows portable builds (`PORTABLE_EXECUTABLE_FILE`)- use the same notify-and-link path as macOS so an NSIS installer cannot replace- a no-install run.+2. Development builds keep updates disabled. Packaged macOS, Windows NSIS, and+ Linux AppImage use in-app download and quit-and-install delivery. Non-AppImage+ Linux (deb/rpm) and Windows portable builds (`PORTABLE_EXECUTABLE_FILE`) use+ notify-and-link delivery so an NSIS installer cannot replace a no-install+ run. (Packaged macOS was notify-and-link until D450 / ADR 0289 qualified the+ signed in-app channel.)3. The updater always sets `allowPrerelease = false`. electron-updater wouldotherwise pin prerelease installs (for example `0.2.0-rc.6`) to the samecustom channel (`rc`) and never offer a newer stable GitHub latest release.@@ -40,8 +40,7 @@ download-and-install flow.cannot be validated.6. D126 later lifts D010's macOS-only publication scope and publishes allplatform artifacts and update manifests produced by the release matrix.- macOS remains notify-and-link until a signed in-app channel is separately- qualified.+ D450 / ADR 0289 qualifies the signed macOS in-app channel on that same feed.7. Dual-locale product "what's new" text (D164) is maintained in`packages/shared` as EN + zh-CN catalogs. Main formats notes for thediscovered version using the product UI locale and attaches them as optional@@ -54,14 +53,15 @@ download-and-install flow.Settings, and the ambient banner.- The sandboxed renderer cannot redirect update traffic or install arbitrarypackages.-- Windows NSIS and Linux AppImage can update in-app from published tag feeds;- macOS, Linux deb, and Windows portable users install from the release page.+- Windows NSIS, Linux AppImage, and packaged macOS can update in-app from+ published tag feeds; Linux deb and Windows portable users install from the+ release page.- Prerelease installs graduate to newer stable releases through the samelatest feed; a dedicated RC channel is not active.- In-app bilingual release highlights ship with the build and follow theproduct locale without a second network surface.-- Signing, rollback, staged rollout, and optional prerelease-channel policy- remain operational follow-ups rather than renderer capabilities.+- Rollback, staged rollout, and optional prerelease-channel policy remain+ operational follow-ups rather than renderer capabilities.## Alternatives@@ -71,3 +71,10 @@ download-and-install flow.installation path.- Force one delivery mode on every platform: rejected because installer andsigning guarantees differ by target.++## Amendment (D450 / ADR 0289)++Official GitHub tag macOS artifacts are Developer ID-signed, notarized, and+stapled. Packaged macOS therefore uses the same in-app `electron-updater` lane+as Windows NSIS and Linux AppImage. Local unsigned packaging without a+certificate remains available (D078).diff --git a/docs/adr/0145-native-macos-intel-release-lane.md b/docs/adr/0145-native-macos-intel-release-lane.mdindex c929ca75c..387996444 100644--- a/docs/adr/0145-native-macos-intel-release-lane.md+++ b/docs/adr/0145-native-macos-intel-release-lane.md@@ -1,9 +1,9 @@# ADR 0145: Publish Native macOS Intel Artifacts-- Status: Accepted (amended by D353 and ADR 0191)+- Status: Accepted (amended by D353, ADR 0191, D450 / ADR 0289)- Date: 2026-09-01- Deciders: PI-Desktop core-- Related: D126, D285, D353, D354, ADR 0022, ADR 0191, E2E-092+- Related: D126, D285, D353, D354, D450, ADR 0022, ADR 0191, ADR 0289, E2E-092## Context@@ -34,9 +34,9 @@ unless the sidecar architecture is independently managed and verified.supersedes that suffix convention: both lanes now use their standardarchitecture labels, `-arm64` and `-x64`, with updater URLs and checksumsgenerated from those final names.-6. macOS update behavior remains notify-and-link until a signed in-app channel- is qualified. This decision changes release artifact coverage and native- packaging only; it does not change updater ownership or signing policy.+6. macOS in-app update delivery is qualified separately by D450 / ADR 0289.+ This decision changes release artifact coverage and native packaging only;+ it does not change updater ownership.## Consequences@@ -62,3 +62,8 @@ unless the sidecar architecture is independently managed and verified.- Publish separate updater feeds permanently: rejected because the currentmacOS delivery mode is notify-and-link and the GitHub Release should exposeone macOS feed when a signed update channel becomes available.++## Amendment (D450 / ADR 0289)++The merged `latest-mac.yml` now drives in-app macOS updates. Architecture+coverage and native packaging in this ADR are unchanged.diff --git a/docs/adr/0191-label-both-macos-release-architectures.md b/docs/adr/0191-label-both-macos-release-architectures.mdindex d45db68c0..b2d14d2ab 100644--- a/docs/adr/0191-label-both-macos-release-architectures.md+++ b/docs/adr/0191-label-both-macos-release-architectures.md@@ -1,9 +1,9 @@# ADR 0191: Label Both macOS Release Architectures-- Status: Accepted+- Status: Accepted (amended by D450 / ADR 0289)- Date: 2026-09-09- Deciders: PI-Desktop core-- Related: D126, D285, D353, D354, ADR 0145, E2E-092+- Related: D126, D285, D353, D354, D450, ADR 0145, ADR 0289, E2E-092## Context@@ -24,8 +24,8 @@ electron-builder.4. The convention applies to unsigned and signed macOS workflow paths. Thegenerated per-architecture updater feeds retain these final asset URLs andchecksums before the publish job merges them.-5. This changes release asset naming only; updater ownership, signing policy, and- notify-and-link delivery remain unchanged.+5. This changes release asset naming only. Signing policy and in-app macOS+ delivery are recorded in D450 / ADR 0289.## Consequences@@ -42,3 +42,9 @@ electron-builder.- Use `Intel` for x64 and `Apple-Silicon` for arm64: rejected because the releasematrix and Electron target use standard architecture identifiers, which areshorter and easier to match to the actual package contents.++## Amendment (D450 / ADR 0289)++Architecture-labelled ZIP names remain the in-app updater payloads. Official+tag artifacts are signed and notarized; the `-arm64` / `-x64` convention is+unchanged.diff --git a/docs/adr/0204-unsigned-macos-first-launch-helper.md b/docs/adr/0204-unsigned-macos-first-launch-helper.mdindex 6af45845a..fca034d31 100644--- a/docs/adr/0204-unsigned-macos-first-launch-helper.md+++ b/docs/adr/0204-unsigned-macos-first-launch-helper.md@@ -1,13 +1,13 @@# ADR 0204: Explicit Unsigned macOS First-Launch Helper-- Status: Accepted (amended by D406 / ADR 0232)+- Status: Accepted (amended by D406 / ADR 0232, D450 / ADR 0289)- Date: 2026-09-09- Deciders: PI-Desktop core-- Related: D078, D371, D406, E2E-196b+- Related: D078, D371, D406, D450, E2E-196b, ADR 0289## Context-The default macOS distribution lane remains unsigned so contributors and+Local and debug macOS packaging remain unsigned so contributors andrelease operators can build without Developer ID credentials. A trusteddownload of that artifact can still carry Apple's quarantine attribute, whichmay make Gatekeeper report that PI-Desktop is damaged. The existing guidance@@ -60,3 +60,9 @@ describes a helper that is present in the DMG.would expand the privilege and application scope of an installer workaround.- Require signing for every local build: rejected because D078 intentionallykeeps local packaging available without Developer ID credentials.++## Amendment (D450 / ADR 0289)++Official GitHub tag releases are Developer ID-signed and notarized. The+first-launch helper and opening note remain for trusted unsigned local or+debug artifacts only. Official Release DMGs must not claim they are unsigned.diff --git a/docs/adr/0289-signed-macos-github-releases.md b/docs/adr/0289-signed-macos-github-releases.mdnew file mode 100644index 000000000..2ec07ae4d--- /dev/null+++ b/docs/adr/0289-signed-macos-github-releases.md@@ -0,0 +1,78 @@+# ADR 0289: Signed macOS GitHub Releases and in-app update delivery++- Status: Accepted+- Date: 2026-09-18+- Deciders: PI-Desktop core+- Decision: D450+- Amends: ADR 0022, ADR 0145, ADR 0191, ADR 0204, D078+- Related: D120, D126, D164, D364, ADR 0197, ADR 0232, ADR 0257, ADR 0278, E2E-196a, E2E-196c, E2E-067A++## Context++Official GitHub tag releases already produce native macOS arm64 and Intel x64+DMG/ZIP artifacts, merge `latest-mac.yml`, and ship `electron-updater`. The+default CI lane still disabled identity discovery, skipped notarization, and+kept packaged macOS on notify-and-link delivery because unsigned artifacts+cannot provide a qualified in-app upgrade. Local packaging without a+certificate must stay possible (D078). Contributors must not commit+certificate material.++A Developer ID Application certificate for team `DUV63RKYTW` is now available+for the official `vastsa/PI-Desktop` release lane.++## Decision++1. Every GitHub tag release (`vX.Y.Z`) Developer ID-signs, notarizes with+ `xcrun notarytool` through electron-builder 26 (`-c.mac.notarize=true`),+ staples the DMG, and verifies the app as `Notarized Developer ID` before+ upload. Missing signing or notarization secrets fail the job; unsigned+ macOS artifacts must not be published from a tag.+2. The signing identity is+ `Developer ID Application: XingYu Liu (DUV63RKYTW)`. CI pins it with+ `CSC_NAME` and `-c.mac.identity`. The Apple team id is `DUV63RKYTW`.+3. Certificate material stays in GitHub Actions secrets:+ `CSC_LINK` (p12, file path or base64), `CSC_KEY_PASSWORD`, `APPLE_ID`,+ `APPLE_APP_SPECIFIC_PASSWORD`, and `APPLE_TEAM_ID`. Nothing of that set is+ committed, echoed, or written into electron-builder config.+4. Local `pnpm dist:mac` / `pnpm pack` remain unsigned when no identity is+ configured. `scripts/release-macos.sh` remains the local signed lane.+ `workflow_dispatch` may set `sign_macos: false` only to produce unsigned+ debug artifacts; that path must not be used for a GitHub Release tag.+5. Packaged macOS uses the existing in-app `electron-updater` lane (ZIP ++ merged `latest-mac.yml` + `quitAndInstall`), same as Windows NSIS and+ Linux AppImage. Linux deb/rpm and Windows portable stay notify-and-link.+ Renderer IPC, feed ownership, `allowPrerelease = false`, and auto-check+ timing are unchanged.+6. Do not reintroduce `afterPack` / `afterSign` adhoc codesign (ADR 0278).+ electron-builder's Developer ID pass signs the app, helpers, and the+ `pi-desktop-host-core` sidecar.+7. The unsigned first-launch note and ZIP helper remain for trusted local or+ debug unsigned builds. Official GitHub Release DMGs are signed and+ notarized and must not claim otherwise.+8. Hardened runtime stays on. Entitlements stay the minimum required set:+ V8 JIT, unsigned executable memory, library-validation disable (Electron+ helpers and plugin-loaded native addons), and microphone input for the+ existing plugin capture permission (ADR 0257), with+ `NSMicrophoneUsageDescription` in Info.plist.++## Consequences++- Users who download a tagged DMG should open PI-Desktop without a+ Gatekeeper “unidentified developer” or quarantine-damaged warning.+- Packaged macOS installs can check GitHub Releases, download the arch ZIP,+ and restart into the new version. Existing unsigned installs may still need+ one manual signed DMG before in-app updates succeed.+- Windows and Linux packaging, artifact names, and updater modes are+ unchanged.+- Operators must create the five Actions secrets before the next tag.++## Alternatives considered++- Keep unsigned tag artifacts and opt-in signing: rejected; it leaves+ production users on the Gatekeeper warning path.+- Hard-code the identity in `apps/desktop/package.json`: rejected; local+ packaging without the certificate must keep working (D078).+- Apple API key (`APPLE_API_KEY`) instead of Apple ID + app-specific+ password: deferred; the existing electron-builder 26 Apple ID path is+ already wired.+- Separate macOS updater implementation: rejected; reuse `electron-updater`.diff --git a/docs/adr/README.md b/docs/adr/README.mdindex c1a1703e1..a9b1b5d58 100644--- a/docs/adr/README.md+++ b/docs/adr/README.md@@ -315,4 +315,5 @@ Each ADR includes:| 0286 | [Remote-host desktop kernel](0286-remote-host-desktop-kernel.md) | Accepted for implementation (D449; ADR 0205 R2) || 0287 | [Host-rendered plugin scenic Settings surfaces](0287-host-rendered-plugin-scenic-settings-surfaces.md) | Accepted for implementation || 0288 | [Package-local theme assets remain available](0288-package-local-theme-assets.md) | Accepted for implementation (amends ADR 0255) |+| 0289 | [Signed macOS GitHub Releases and in-app update delivery](0289-signed-macos-github-releases.md) | Accepted (D450; amends ADR 0022 / 0145 / 0191 / 0204 / D078) || turn-process-and-thinking-display | [Turn process and thinking presentation](turn-process-and-thinking-display.md) | Accepted |diff --git a/docs/spec/04-ux/09-interaction-patterns.md b/docs/spec/04-ux/09-interaction-patterns.mdindex 862da2631..c77e59642 100644--- a/docs/spec/04-ux/09-interaction-patterns.md+++ b/docs/spec/04-ux/09-interaction-patterns.md@@ -510,10 +510,10 @@ may be retained while exactly one workspace supplies the visible shell context.- Settings → Info and application-menu checks share one typed update state.Manual checks expose up-to-date or error feedback; automatic failures do notopen a toast or ambient banner.-- Manual delivery (`darwin`, non-AppImage Linux, and Windows portable runs+- Manual delivery (non-AppImage Linux and Windows portable runswith `PORTABLE_EXECUTABLE_FILE`) stops at `available` and- offers the fixed GitHub Releases page. In-app delivery (Windows NSIS and- Linux AppImage readiness builds) automatically advances through+ offers the fixed GitHub Releases page. In-app delivery (packaged macOS,+ Windows NSIS, and Linux AppImage) automatically advances through`downloading` to the stable `downloaded` state.- `downloaded` remains actionable until Restart to update or normal app quit;later scheduled/manual checks do not replace it with `checking`.@@ -536,9 +536,9 @@ may be retained while exactly one workspace supplies the visible shell context.The current release and a discovered available release are identified withcompact badges. The list scrolls independently, closes by its close control,Escape, or the backdrop, and restores focus to the invoking control.-- D126 tag releases publish all platform manifests and installers. Windows- NSIS and Linux AppImage therefore use the in-app lane; macOS and Linux deb/rpm- remain notify-and-link delivery modes.+- D126 tag releases publish all platform manifests and installers. Packaged+ macOS, Windows NSIS, and Linux AppImage use the in-app lane; Linux deb/rpm+ and Windows portable remain notify-and-link delivery modes.## 2. Streaming message behaviordiff --git a/docs/spec/05-security/01-security.md b/docs/spec/05-security/01-security.mdindex 03936d75e..9e0c4172b 100644--- a/docs/spec/05-security/01-security.md+++ b/docs/spec/05-security/01-security.md@@ -170,16 +170,16 @@ explicit local/LAN endpoints; the market path does not widen that policy.GitHub's latest stable release rather than a same-channel prerelease pin.- Feed manifests bind artifacts with electron-builder hashes. An error,unavailable feed, hash mismatch, or invalid updater state must not install.-- Packaged macOS is manual-only: it detects a release and opens the fixed- releases page, but never downloads or installs it in-app. Enabling a signed- macOS in-app channel requires a later explicit decision and qualification.+- Packaged macOS, Windows NSIS, and Linux AppImage download and install in-app+ from the GitHub Releases feed. Linux deb/rpm and Windows portable detect a+ release and open the fixed releases page.- D126 tag releases publish Windows NSIS and Linux AppImage installers withtheir update manifests, plus Linux deb/rpm packages and a Windows portableexe. The NSIS and AppImage artifacts activate the existing in-app lanes.The portable exe uses notify-and-link delivery and does not write- `latest.yml`. macOS tag artifacts- are Developer ID-signed, notarized, and stapled before upload; rollback and- staged-rollout qualification remain release follow-ups.+ `latest.yml`. macOS tag artifacts are Developer ID-signed, notarized, and+ stapled before upload; rollback and staged-rollout qualification remain+ release follow-ups.- The client carries no GitHub token. A private or otherwise unreachable feedfails closed; automatic failures stay ambient and explicit checks expose theerror.diff --git a/docs/spec/06-delivery/04-e2e-test-plan.md b/docs/spec/06-delivery/04-e2e-test-plan.mdindex 4092e98ad..57c933a8b 100644--- a/docs/spec/06-delivery/04-e2e-test-plan.md+++ b/docs/spec/06-delivery/04-e2e-test-plan.md@@ -260,25 +260,23 @@ identify the platform validation still needed.`development-branding.test.mjs`, `ci-workflow.test.mjs`); Fedora KDE/Waylandinstallation remains runner validation-#### E2E-196a: Default unsigned macOS release lane--- **Preconditions**: A `vX.Y.Z` tag matches `apps/desktop/package.json`, or the- Release workflow is manually dispatched with `sign_macos` omitted or false;- Windows and Linux release credentials are not affected.-- **Steps**: 1) Run the tag workflow or dispatch it with the default signing- input. 2) Confirm both macOS architectures complete ordinary DMG/ZIP- packaging without certificate secrets. 3) Inspect the artifacts and workflow- steps.+#### E2E-196a: Unsigned macOS debug lane++- **Preconditions**: The Release workflow is manually dispatched with+ `sign_macos: false`; Windows and Linux release credentials are not affected.+ This path must not be used to publish a GitHub Release tag.+- **Steps**: 1) Dispatch the Release workflow with `sign_macos: false`. 2)+ Confirm both macOS architectures complete ordinary DMG/ZIP packaging without+ certificate secrets. 3) Inspect the artifacts and workflow steps.- **Expected**: macOS DMG/ZIP artifacts are produced and uploaded withoutDeveloper ID signatures or notarization, using explicit `-arm64` and `-x64`filename markers for their native architecture; macOS staple and Gatekeeperchecks are explicitly skipped. Windows/Linux artifacts and the merged updater- feed still publish normally. This exception must be removed before the next- stable release; it does not satisfy E2E-196c.+ feed still publish normally. This exception does not satisfy E2E-196c.- **Specs linked**: `06-delivery/06-release-runbook.md`-- **Acceptance**: Quality (default release packaging)+- **Acceptance**: Quality (debug packaging)- **Milestone**: M6+-- **Status**: Active default; this scenario does not satisfy E2E-196c.+- **Status**: Opt-in debug lane; tag releases must satisfy E2E-196c.#### E2E-196b: Unsigned macOS packages expose first-launch guidance@@ -314,24 +312,26 @@ identify the platform validation still needed.#### E2E-196c: macOS tag artifacts pass Gatekeeper without a quarantine bypass-- **Preconditions**: The Release workflow is manually dispatched for a- `vX.Y.Z` tag with `sign_macos: true`; the tag matches- `apps/desktop/package.json`; GitHub Actions has `CSC_LINK`, `CSC_KEY_PASSWORD`, `APPLE_ID`,+- **Preconditions**: A `vX.Y.Z` tag matching `apps/desktop/package.json` is+ pushed, or the Release workflow is dispatched with `sign_macos: true`+ (default); GitHub Actions has `CSC_LINK`, `CSC_KEY_PASSWORD`, `APPLE_ID`,`APPLE_APP_SPECIFIC_PASSWORD`, and `APPLE_TEAM_ID` secrets; both native macOSrunners are available.-- **Steps**: 1) Run the explicitly signed workflow. 2) For each macOS architecture,- inspect the unpacked app with `codesign -dv --verbose=4` and confirm a- `Developer ID Application` authority. 3) Run `codesign --verify --deep- --strict`, `spctl -a -vv`, and `xcrun stapler validate` against the app. 4)- Run `xcrun stapler validate` against the matching DMG. 5) Download the DMG on- a clean macOS profile, move the app to `/Applications`, and open it without- clearing `com.apple.quarantine`.+- **Steps**: 1) Run the tag workflow. 2) For each macOS architecture, inspect+ the unpacked app with `codesign -dv --verbose=4` and confirm authority+ `Developer ID Application: XingYu Liu (DUV63RKYTW)`. 3) Run+ `codesign --verify --deep --strict --verbose=2`,+ `spctl --assess --type execute --verbose=4`, and `xcrun stapler validate`+ against the app, including `Contents/Resources/bin/pi-desktop-host-core`.+ 4) Run `xcrun stapler validate` against the matching DMG. 5) Download the+ DMG on a clean macOS profile, move the app to `/Applications`, and open it+ without clearing `com.apple.quarantine`.- **Expected**: Each macOS app passes signature integrity, Gatekeeper reports- `Notarized Developer ID`, and both app and DMG contain valid stapled tickets.- The app opens normally; no `xattr` quarantine-removal command or Security &- Privacy override is required.+ `source=Notarized Developer ID`, and both app and DMG contain valid stapled+ tickets. The app opens normally; no `xattr` quarantine-removal command or+ Security & Privacy override is required. Missing secrets fail the job.- **Specs linked**: `06-delivery/06-release-runbook.md`,- `05-security/01-security.md`+ `05-security/01-security.md`, ADR 0289- **Acceptance**: Quality, Security- **Milestone**: M6+- **Status**: Workflow script/unit-covered; clean-machine journey required for@@ -3894,12 +3894,12 @@ identify the platform validation still needed.automatic check or invoke Check for Updates from the application menu /Settings → Info.- **Expected**: Update state reports `available` (manual platforms) or- advances through in-app download for Windows NSIS / Linux AppImage with- `availableVersion` equal to the newer stable tag. A Windows portable run- (`PORTABLE_EXECUTABLE_FILE`) stays on the manual notify-and-link path and- must not download or run the NSIS installer. The client must not report- up-to-date merely because no newer release shares the same `rc` prerelease- channel.+ advances through in-app download for packaged macOS, Windows NSIS, and+ Linux AppImage with `availableVersion` equal to the newer stable tag. A+ Windows portable run (`PORTABLE_EXECUTABLE_FILE`) stays on the manual+ notify-and-link path and must not download or run the NSIS installer. The+ client must not report up-to-date merely because no newer release shares the+ same `rc` prerelease channel.- **Specs linked**: `04-ux/09-interaction-patterns.md`,`05-security/01-security.md`, `08-meta/decisions-log.md` (D120),ADR 0022diff --git a/docs/spec/06-delivery/06-release-runbook.md b/docs/spec/06-delivery/06-release-runbook.mdindex 2d42e490e..602590e97 100644--- a/docs/spec/06-delivery/06-release-runbook.md+++ b/docs/spec/06-delivery/06-release-runbook.md@@ -46,25 +46,28 @@ when macOS `iconutil` is available, without overwriting the canonical source.## 2. Prerequisites (release lane)1. Apple Developer account with a **Developer ID Application** certificate in- the login keychain.-2. Environment variables:- - `MAC_SIGNING_IDENTITY` — e.g. `Developer ID Application: <Name> (<TEAMID>)`+ the login keychain. Official identity:+ `Developer ID Application: XingYu Liu (DUV63RKYTW)` (Team ID `DUV63RKYTW`).+2. Environment variables for the local signed lane:+ - `MAC_SIGNING_IDENTITY` — defaults to the official identity above- `APPLE_ID`, `APPLE_APP_SPECIFIC_PASSWORD`, `APPLE_TEAM_ID` — required for- notarization.+ notarization (`APPLE_TEAM_ID` must be `DUV63RKYTW`)3. Rust toolchain and pnpm workspace installed. The Rust toolchain must run onthe native macOS runner: arm64 for Apple Silicon or x86_64 for Intel.## 3. What the build ships- Electron app with hardened runtime + entitlements- (`build/entitlements.mac.plist`: JIT + unsigned-executable-memory +- library-validation disable — the standard Electron set), plus the- `NSLocalNetworkUsageDescription` string in Info.plist (via- `apps/desktop/package.json` → `mac.extendInfo`) so macOS 15+ prompts for- Local Network access and grants it to both the Chromium main process and- the `ELECTRON_RUN_AS_NODE` agent sidecar — without it, LAN provider- requests from the sidecar fail with `EHOSTUNREACH` even though the main- process's Test Provider fetch succeeds (issue #573).+ (`build/entitlements.mac.plist`: V8 JIT, unsigned-executable-memory,+ library-validation disable for Electron helpers and plugin native addons,+ and microphone input for plugin capture after user grant — ADR 0257), plus+ `NSLocalNetworkUsageDescription` and `NSMicrophoneUsageDescription` in+ Info.plist (via `apps/desktop/package.json` → `mac.extendInfo`). The local+ network string is required so macOS 15+ prompts for Local Network access and+ grants it to both the Chromium main process and the `ELECTRON_RUN_AS_NODE`+ agent sidecar — without it, LAN provider requests from the sidecar fail with+ `EHOSTUNREACH` even though the main process's Test Provider fetch succeeds+ (issue #573).- `Resources/bin/pi-desktop-host-core` — Rust host binary (release build).- Windows NSIS builds include an x64 `pi-desktop-host-core.exe` staticallylinked to the MSVC CRT, so a clean Windows x64 or Windows 11 ARM64@@ -208,26 +211,26 @@ runtime, verifying the host build, building the Desktop application once, andinvoking electron-builder. This avoids a redundant Desktop build withoutchanging the package scripts or release artifacts.-**Default macOS release policy:** the GitHub Release workflow packages macOS-DMG/ZIP artifacts unsigned by default. Tag pushes and manual runs with-`sign_macos` omitted or set to `false` disable identity discovery, do not receive-signing or notarization secrets, and skip macOS stapling and signature-verification. To explicitly sign a run, manually dispatch the workflow for the-target tag with `sign_macos: true`. The local `scripts/release-macos.sh` command-remains the explicit signed lane.+**Default macOS release policy:** GitHub tag releases Developer ID-sign,+notarize, staple, and Gatekeeper-verify macOS DMG/ZIP before upload (D450 /+ADR 0289). Missing signing or notarization secrets fail the job. A+`workflow_dispatch` run may set `sign_macos: false` only to produce unsigned+debug artifacts; that path must not be used for a GitHub Release tag. Local+`scripts/release-macos.sh` remains the explicit signed local lane; `pnpm dist:mac`+stays unsigned without a configured certificate (D078).The macOS matrix uses `macos-15` for arm64 and `macos-15-intel` for Intel x64.Each job verifies `uname -m`, passes the matching `--arm64` or `--x64` flag toelectron-builder, and builds `pi-desktop-host-core` on that same native-runner. The default macOS package step is unsigned. When a manual run explicitly-sets `sign_macos: true`, it receives `CSC_LINK`, `CSC_KEY_PASSWORD`, `APPLE_ID`,-`APPLE_APP_SPECIFIC_PASSWORD`, and `APPLE_TEAM_ID` only from GitHub Actions-secrets. It then forces code signing and notarization, verifies the Developer ID-authority, code-signing integrity, Gatekeeper assessment, and stapled app-ticket, and explicitly staples and validates the generated DMG before any-artifact upload. The per-architecture-`latest-mac.yml` files are renamed before upload; the publish job merges them-into one feed after downloading both artifacts.+runner. Tag builds and `sign_macos: true` (the dispatch default) receive+`CSC_LINK`, `CSC_KEY_PASSWORD`, `APPLE_ID`, `APPLE_APP_SPECIFIC_PASSWORD`, and+`APPLE_TEAM_ID` only from GitHub Actions secrets, pin identity+`Developer ID Application: XingYu Liu (DUV63RKYTW)`, force code signing and+`notarytool` notarization, verify that identity, code-signing integrity+(including `pi-desktop-host-core`), Gatekeeper `Notarized Developer ID`, and+the stapled app ticket, and staple and validate the DMG before any artifact+upload. The per-architecture `latest-mac.yml` files are renamed before upload;+the publish job merges them into one feed after downloading both artifacts.The shared electron-builder configuration applies the architecture-labelledpattern at the macOS platform level for ZIPs and overrides it at the DMG target@@ -297,20 +300,43 @@ Re-running the workflow for the same tag is safe if the CNB pipeline isidempotent. It does not rebuild desktop artifacts and does not changeelectron-updater feeds.+### 4.5 GitHub Actions secrets for macOS signing++Create these under GitHub → repository `vastsa/PI-Desktop` → Settings →+Secrets and variables → Actions. Never commit the p12, password, Apple ID, or+app-specific password. Never `echo` these values in CI.++| Secret | Value |+|---|---|+| `CSC_LINK` | Base64 of the exported Developer ID Application `.p12` (Certificate + Private Key). electron-builder also accepts a file path, but CI uses the secret body. |+| `CSC_KEY_PASSWORD` | Password used when exporting that `.p12` |+| `APPLE_ID` | Apple ID email that belongs to team `DUV63RKYTW` |+| `APPLE_APP_SPECIFIC_PASSWORD` | App-specific password from https://appleid.apple.com → Sign-In and Security → App-Specific Passwords |+| `APPLE_TEAM_ID` | `DUV63RKYTW` |++Encode the p12 locally (do not paste the output into chat or the repo):++```bash+base64 -i developer-id-application.p12 | pbcopy+```++On Linux use `base64 -w0 developer-id-application.p12`. Files that must never+enter git: `*.p12`, `*.cer`, `*.p8`, `*.mobileprovision`.+## 5. Verification gates-For the default unsigned macOS lane, do not treat macOS artifacts as-Gatekeeper-qualified. The signature and staple checks below apply only when a-run explicitly enables `sign_macos: true`.+Unsigned debug artifacts (`workflow_dispatch` with `sign_macos: false`) are+not Gatekeeper-qualified. Tag releases must pass the signature and staple+checks below or the workflow fails.-Run after every release build:+Run after every signed release build:```bashfor APP in apps/desktop/release/mac-*/PI-Desktop.app; do- codesign -dv --verbose=2 "$APP" # identity + hardened runtime flags- codesign --verify --deep --strict "$APP" # signature integrity- spctl -a -vv "$APP" # Gatekeeper assessment (notarized Developer ID)- xcrun stapler validate "$APP" # notarization staple+ codesign -dv --verbose=4 "$APP" # identity + hardened runtime flags+ codesign --verify --deep --strict --verbose=2 "$APP"+ spctl --assess --type execute --verbose=4 "$APP"+ xcrun stapler validate "$APP"donexcrun stapler validate apps/desktop/release/*.dmg```@@ -479,13 +505,13 @@ Shell smoke on each native runner:## 7. Known limitations-- macOS, Linux deb/rpm, and the Windows portable exe remain notify-and-link- update modes.+- Linux deb/rpm and the Windows portable exe remain notify-and-link update+ modes. Packaged macOS, Windows NSIS, and Linux AppImage use in-app+ `electron-updater`.- Linux x64 packages are built on Ubuntu 22.04 so host-core needs glibc 2.35or newer (Ubuntu 22.04, Debian 12, Fedora 36+). The tag job runs`scripts/check-linux-host-glibc.mjs` and refuses a binary that needs anewer glibc.-- In-app macOS delivery, rollback, staged rollout, and prerelease channel- policy remain open release work. GitHub Release macOS artifacts are unsigned- by default; only a manual `sign_macos: true` run receives Developer ID- signing, notarization, and stapling before publication.+- Rollback, staged rollout, and prerelease channel policy remain open release+ work. Existing unsigned macOS installs may need one manual signed DMG before+ in-app updates succeed.diff --git a/docs/spec/08-meta/decisions-log.md b/docs/spec/08-meta/decisions-log.mdindex f8be7e013..3c93690f8 100644--- a/docs/spec/08-meta/decisions-log.md+++ b/docs/spec/08-meta/decisions-log.md@@ -24,6 +24,7 @@ This log freezes previously open questions into concrete decisions.| D374 | Remote Agent Control v1 target amendments | **Amend D373 / ADR 0205: `RACP-WS` is the only normative v1 binding (`RACP-HTTP` is the browser profile, `RACP-GRPC` is reserved); typebox in `packages/shared` is the single contract source; the headless `packages/agent-host` module is the first deliverable and is shared by desktop IPC, local MCP, and RACP; cursors are `{ epoch, sequence }` with ephemeral deltas; the turn queue moves into the Host; host-core exposes `permissions.pending`; remote approvals carry the full local decision vocabulary under a default `ask` ceiling; browser clients use a cookie profile; the first deployment is single-tenant.** | Reviewing the D373 draft against the shipped desktop found the remote approval vocabulary narrower than the local contracts, pending requests held as connection state, per-token deltas exhausting the replay window, and more bindings than v1 can carry (ADR 0205) || D447 | Headless runtime boundary | **Amend ADR 0205 rollout R2 prerequisites (ADR 0284): the Electron-independent runtime layer under the Agent Host module lives in `packages/host-runtime` — the host-core and sidecar stdio transports, the restart supervisor (process-model §4 policy), the durable turn lifecycle (`RuntimeService` as the module's `RuntimePort`: `session.beginTurn` → user row → prompt → `session.endTurn`, abort lock, stale-terminal guard, single-flight finalization), transcript persistence with the D299 checkpoint, a headless launch resolver over host-core's own registries, approved Plan/Goal dispatch (D189), and the host-core adapters for `SessionPort` / `QueueStore` / `permissions.pending`. Electron main keeps thin adapters (binary and bundle locations, `ELECTRON_RUN_AS_NODE`, redacted stderr, schema/glibc diagnoses, renderer status pushes) and its own local prompt path. `TurnStartRequest` gains an optional `userMessageId`. No IPC, sidecar, host-core, Plugin SDK, default, or persisted-data change.** | `pi-host` must run the same lifecycle invariants as the desktop without Electron; a second implementation of abort locks, stale terminal events, and queue release after durable settlement would drift from the one the desktop already fixed || D448 | RACP-WS transport and device pairing | **Amend ADR 0205 rollout R2 (ADR 0285): `packages/racp` holds both ends of the normative `RACP-WS` binding. `RacpServer` dispatches every catalog operation through its role rule onto the Agent Host module and a `RacpHostOperations` interface the Host implements; `RacpClient` correlates requests, answers server-initiated requests, tracks the last durable cursor per session, reconnects with bounded backoff, and fails the dropped connection's in-flight calls with `HOST_DISCONNECTED` instead of re-sending them. Authentication is the header profile with Host-issued `pdt1.` device tokens and single-use, expiring `ppt1.` pairing tokens (hashed, constant-time compared; never in a URL); `connection/pair` mints an `owner` device. `connection/pair`, `project/register`, `project/browse`, `server.hostId`, the `events/closed` notification, and the codes `PAIRING_FAILED`, `PAIRING_TOKEN_EXPIRED`, `CAPABILITY_UNAVAILABLE`, `REMOTE_PATH_NOT_FOUND`, `REMOTE_PATH_FORBIDDEN`, `HOST_DISCONNECTED`, `HOST_BOOTSTRAP_FAILED`, `HOST_VERSION_MISMATCH`, `REMOTE_AUTH_FAILED`, `REMOTE_CONNECTION_FAILED`, `REMOTE_FORWARD_FAILED` join the contract (spec §14a). The bind refuses non-loopback addresses; attachments and the tool relay are advertised unavailable.** | The SSH-tunnel topology needs a server `pi-host` can bind and a client the desktop can run, with the pairing the security spec describes; the conformance behaviors that need no machine boundary become package tests |+| D450 | Signed macOS GitHub Releases | **Amend D078 / ADR 0022: GitHub tag releases Developer ID-sign, notarize (`notarytool` via electron-builder 26), staple, and Gatekeeper-verify macOS DMG/ZIP before upload, using identity `Developer ID Application: XingYu Liu (DUV63RKYTW)` / team `DUV63RKYTW` from Actions secrets (`CSC_LINK`, `CSC_KEY_PASSWORD`, `APPLE_ID`, `APPLE_APP_SPECIFIC_PASSWORD`, `APPLE_TEAM_ID`). Missing secrets fail the job. Local unsigned packaging without a certificate remains. `workflow_dispatch` may set `sign_macos: false` only for unsigned debug artifacts. Packaged macOS uses in-app `electron-updater` (ZIP + merged `latest-mac.yml`); Linux deb/rpm and Windows portable stay notify-and-link. No afterPack/afterSign adhoc codesign (ADR 0278).** | Production DMGs must open without a Gatekeeper warning, and signed macOS installs can download and restart into a new tag. See ADR 0289, E2E-196c, E2E-067A. |## B. Secondary implementation defaults@@ -173,7 +174,7 @@ Gold source: local Codex electron captures; latest row wins where rows conflict.| ID | Topic | Decision | Rationale ||---|---|---|---|-| D078 | macOS signing lanes | **Static configuration does not embed a certificate identity, so local builds without a configured certificate remain unsigned. Release lanes require Developer ID signing and Apple notarization; CI receives certificate material through Actions secrets and rejects unstapled artifacts.** | Contributors can package without credentials while published macOS artifacts satisfy Gatekeeper. See 06-delivery/06-release-runbook. |+| D078 | macOS signing lanes | *(amended by D450 / ADR 0289)* **Static configuration does not embed a certificate identity, so local builds without a configured certificate remain unsigned. Official GitHub tag releases require Developer ID signing and Apple notarization; CI receives certificate material through Actions secrets and rejects unstapled artifacts.** | Contributors can package without credentials while published macOS artifacts satisfy Gatekeeper. See 06-delivery/06-release-runbook. || D079 | App icon / brand mark v1 | *(renderer asset path refined by D221)* **`build/icon_1024.png` is the canonical PI-Desktop logo; `scripts/make-icon.py` derives `build/icon.icns` without overwriting the PNG; packaged macOS builds, `pnpm dev`, and renderer chrome reuse those assets** | Keep one visual identity across development, renderer, and packaged lanes while preventing the derivation script from restoring the obsolete generated mark || D080 | Backend supervision | **Child exit rejects in-flight RPCs immediately; backoff restarts (0.5s→4s, max 3 per 2min); `hostStatus` events drive renderer degradation UI** | Crash recovery without hangs; fail visible, not silent || D081 | Renderer sandbox | **`sandbox: true` with fully bundled CJS preload; production CSP drops `unsafe-eval` and localhost connect-src** | Electron security baseline; verified by `test:e2e:boot` |diff --git a/docs/zh-CN/adr/index.md b/docs/zh-CN/adr/index.mdindex a008fd57b..968f3b345 100644--- a/docs/zh-CN/adr/index.md+++ b/docs/zh-CN/adr/index.md@@ -295,6 +295,7 @@ ADR 记录那些不应被静默改变的架构选择。中文入口与英文索| 0284 | [`packages/host-runtime` 的无头运行时边界](/adr/0284-headless-runtime-boundary) | 已接受(实施中)(D447;ADR 0205 R2 前置) || 0285 | [`packages/racp` 的 `RACP-WS` 传输](/adr/0285-racp-ws-transport) | 已接受(实施中)(D448;ADR 0205 R2) || turn-process-and-thinking-display | [回合过程与思考展示](/adr/turn-process-and-thinking-display) | 已接受 |+| 0289 | [签名的 macOS GitHub Release 与应用内更新](/adr/0289-signed-macos-github-releases) | 已接受(D450;修订 ADR 0022 / 0145 / 0191 / 0204 / D078) |## 什么时候看 ADRdiff --git a/docs/zh-CN/spec/04-ux/09-interaction-patterns.md b/docs/zh-CN/spec/04-ux/09-interaction-patterns.mdindex 453e551d7..5097cee91 100644--- a/docs/zh-CN/spec/04-ux/09-interaction-patterns.md+++ b/docs/zh-CN/spec/04-ux/09-interaction-patterns.md@@ -425,11 +425,7 @@- 设置 → 信息和应用程序菜单检查共享一种类型的更新状态。手动检查公开最新或错误反馈;自动故障不会打开 Toast 或环境横幅。-- 手动交付(`darwin`、非 AppImage Linux,以及带有- `PORTABLE_EXECUTABLE_FILE` 的 Windows 便携版运行)在 `available` 停止,并且- 提供固定的 GitHub 发布页面。应用内交付(Windows NSIS 和- Linux AppImage 准备就绪构建)自动推进- `downloading` 到稳定的 `downloaded` 状态。+- 手动交付(非 AppImage Linux,以及带有 `PORTABLE_EXECUTABLE_FILE` 的 Windows 便携版运行)在 `available` 停止,并提供固定的 GitHub 发布页面。应用内交付(打包的 macOS、Windows NSIS 和 Linux AppImage)自动推进 `downloading` 到稳定的 `downloaded` 状态。- `downloaded` 保持可操作状态,直至重新启动更新或正常应用退出;稍后的 scheduled/manual 检查不会将其替换为 `checking`。- 紧凑的更新通知仅出现在主窗格的右上角安全区域中@@ -451,9 +447,7 @@当前版本和发现的可用版本标识为紧凑的徽章。列表独立滚动,通过其关闭控制关闭,转义或背景,并将焦点恢复到调用控件。-- D126 标签版本发布所有平台清单和安装程序。 Windows- 因此,NSIS 和 Linux AppImage 使用应用内通道; macOS 和 Linux deb/rpm- 保持通知和链接传递模式。+- D126 标签版本发布所有平台清单和安装程序。打包的 macOS、Windows NSIS 和 Linux AppImage 使用应用内通道;Linux deb/rpm 和 Windows 便携版保持通知和链接传递模式。## 2. 流消息行为diff --git a/docs/zh-CN/spec/05-security/01-security.md b/docs/zh-CN/spec/05-security/01-security.mdindex 83abd936d..253915667 100644--- a/docs/zh-CN/spec/05-security/01-security.md+++ b/docs/zh-CN/spec/05-security/01-security.md@@ -149,13 +149,8 @@ MCP 市场只接受无凭据的公网 HTTPS 源和目录端点。Main 在每次GitHub 的最新稳定版本而不是同通道预发布 pin。- Feed 清单将工件与电子构建器哈希绑定。一个错误,无法安装提要、哈希不匹配或无效的更新程序状态。-- 打包的 macOS 仅供手动使用:它检测释放并打开固定的- 发布页面,但从未在应用程序中下载或安装它。启用签名- macOS 应用内渠道需要稍后的明确决策和资格。-- D126 标签版本发布 Windows NSIS 和 Linux AppImage 安装程序及其- 更新清单,以及 Linux deb/rpm 包和 Windows 便携版 exe。NSIS 和 AppImage- 工件激活现有应用内通道。便携版 exe 使用通知加链接交付,并且不写入- `latest.yml`。平台签约、回滚和分阶段推出资格仍处于发布后续阶段。+- 打包的 macOS、Windows NSIS 和 Linux AppImage 从 GitHub Releases 源应用内下载并安装。Linux deb/rpm 和 Windows 便携版只检测新版本并打开固定发布页。+- D126 标签版本发布 Windows NSIS 和 Linux AppImage 安装程序及其更新清单,以及 Linux deb/rpm 包和 Windows 便携版 exe。NSIS、AppImage 与打包的 macOS 走应用内通道。便携版 exe 使用通知加链接交付,并且不写入 `latest.yml`。macOS 标签工件在上传前完成 Developer ID 签名、公证和装订;回滚和分阶段推出仍是发布后续工作。- 客户端不携带 GitHub 令牌。私人或其他无法访问的提要关闭失败;自动故障保持在环境状态,显式检查会暴露错误。diff --git a/docs/zh-CN/spec/06-delivery/04-e2e-test-plan.md b/docs/zh-CN/spec/06-delivery/04-e2e-test-plan.mdindex c712bce15..19c42e580 100644--- a/docs/zh-CN/spec/06-delivery/04-e2e-test-plan.md+++ b/docs/zh-CN/spec/06-delivery/04-e2e-test-plan.md@@ -3469,21 +3469,15 @@ IPC 请求无法关闭。- **状态**:单位覆盖(`mermaid-rendering.test.mjs`);提供安全性和视觉场景草稿-#### E2E-196a:默认未签名的 macOS 发布通道--- **先决条件**:`vX.Y.Z` 标签与 `apps/desktop/package.json` 匹配,或手动运行- Release 工作流时省略 `sign_macos` 或将其设为 false;Windows 和 Linux 的发布- 凭据不受影响。-- **步骤**:1) 运行标签工作流,或使用默认签名输入手动运行。2) 确认两个 macOS- 架构都完成普通的 DMG/ZIP 打包,且没有使用证书密钥。3) 检查工件和工作流步骤。-- **预期**:macOS DMG/ZIP 工件生成并上传,文件名分别带有 `-arm64` 和 `-x64`- 架构标记,不包含 Developer ID 签名或公证;macOS 装订和 Gatekeeper 检查明确跳过。- Windows/Linux 工件和合并后的更新源仍正常发布。该例外必须在下一个稳定版本前移除,- 且不满足 E2E-196c。+#### E2E-196a:未签名的 macOS 调试通道++- **先决条件**:手动运行 Release 工作流并设置 `sign_macos: false`;Windows 和 Linux 的发布凭据不受影响。该路径不得用于发布 GitHub Release 标签。+- **步骤**:1) 以 `sign_macos: false` 手动运行 Release 工作流。2) 确认两个 macOS 架构都完成普通的 DMG/ZIP 打包,且没有使用证书密钥。3) 检查工件和工作流步骤。+- **预期**:macOS DMG/ZIP 工件生成并上传,文件名分别带有 `-arm64` 和 `-x64` 架构标记,不包含 Developer ID 签名或公证;macOS 装订和 Gatekeeper 检查明确跳过。Windows/Linux 工件和合并后的更新源仍正常发布。该例外不满足 E2E-196c。- **关联规格**:`06-delivery/06-release-runbook.md`-- **验收**:质量(默认发布打包)+- **验收**:质量(调试打包)- **里程碑**:M6+-- **状态**:当前默认行为;本场景不满足 E2E-196c。+- **状态**:可选调试通道;标签发布必须满足 E2E-196c。#### E2E-196b:未签名的 macOS 软件包展示首次启动指引@@ -3510,20 +3504,10 @@ IPC 请求无法关闭。#### E2E-196c:macOS 标签工件通过 Gatekeeper 且无需移除隔离属性-- **先决条件**:针对 `vX.Y.Z` 标签手动运行 Release 工作流并设置- `sign_macos: true`;标签与 `apps/desktop/package.json` 匹配;GitHub Actions- 已配置 `CSC_LINK`、`CSC_KEY_PASSWORD`、`APPLE_ID`、- `APPLE_APP_SPECIFIC_PASSWORD` 和 `APPLE_TEAM_ID` 密钥;两个本机 macOS- 运行器均可用。-- **步骤**:1) 运行明确启用签名的工作流。2) 对每个 macOS 架构检查解压后的应用,- 使用 `codesign -dv --verbose=4` 确认 `Developer ID Application` 权限。3) 对应用运行- `codesign --verify --deep --strict`、`spctl -a -vv` 和 `xcrun stapler validate`。- 4) 对对应的 DMG 运行 `xcrun stapler validate`。5) 在干净的 macOS 配置文件中下载- DMG,将应用移到 `/Applications` 后不清除 `com.apple.quarantine` 直接打开。-- **预期**:每个 macOS 应用通过签名完整性检查,Gatekeeper 报告- `Notarized Developer ID`,应用和 DMG 都包含有效的装订票据;应用正常打开,无需- `xattr` 命令或“安全性与隐私”覆盖操作。-- **关联规格**:`06-delivery/06-release-runbook.md`、`05-security/01-security.md`+- **先决条件**:推送与 `apps/desktop/package.json` 匹配的 `vX.Y.Z` 标签,或手动运行 Release 工作流并保持 `sign_macos: true`(默认);GitHub Actions 已配置 `CSC_LINK`、`CSC_KEY_PASSWORD`、`APPLE_ID`、`APPLE_APP_SPECIFIC_PASSWORD` 和 `APPLE_TEAM_ID` 密钥;两个本机 macOS 运行器均可用。+- **步骤**:1) 运行标签工作流。2) 对每个 macOS 架构检查解压后的应用,使用 `codesign -dv --verbose=4` 确认权限为 `Developer ID Application: XingYu Liu (DUV63RKYTW)`。3) 对应用运行 `codesign --verify --deep --strict --verbose=2`、`spctl --assess --type execute --verbose=4` 和 `xcrun stapler validate`,并检查 `Contents/Resources/bin/pi-desktop-host-core`。4) 对对应的 DMG 运行 `xcrun stapler validate`。5) 在干净的 macOS 配置文件中下载 DMG,将应用移到 `/Applications` 后不清除 `com.apple.quarantine` 直接打开。+- **预期**:每个 macOS 应用通过签名完整性检查,Gatekeeper 报告 `source=Notarized Developer ID`,应用和 DMG 都包含有效的装订票据。应用可正常打开,无需 `xattr` 命令或“安全性与隐私”覆盖。缺少密钥则整个作业失败。+- **关联规格**:`06-delivery/06-release-runbook.md`、`05-security/01-security.md`、ADR 0289- **验收**:质量、安全- **里程碑**:M6+- **状态**:工作流脚本/单元已覆盖;每次发布仍需在干净机器上验证(适用变更合入前需在具备条件的环境中运行 E2E)diff --git a/docs/zh-CN/spec/06-delivery/06-release-runbook.md b/docs/zh-CN/spec/06-delivery/06-release-runbook.mdindex 25348c2b6..133a064cd 100644--- a/docs/zh-CN/spec/06-delivery/06-release-runbook.md+++ b/docs/zh-CN/spec/06-delivery/06-release-runbook.md@@ -188,11 +188,7 @@ GitHub Release 工作流程启动所有本机平台运行程序,无需调用电子构建器。这避免了多余的桌面构建,而无需更改包脚本或发布工件。-**macOS 默认发布策略:** GitHub Release 工作流程默认生成未签名的 macOS-DMG/ZIP。标签推送以及 `sign_macos` 未填写或设为 `false` 的手动运行都会关闭-身份发现,不接收签名或公证密钥,并跳过 macOS 装订和签名验证。如需明确签名,-请针对目标标签手动运行工作流程并设置 `sign_macos: true`。本地-`scripts/release-macos.sh` 仍是明确的签名通道。+**macOS 默认发布策略:** GitHub tag 发布会在上传前对 macOS DMG/ZIP 做 Developer ID 签名、公证、装订和 Gatekeeper 校验(D450 / ADR 0289)。缺少签名或公证密钥则作业失败。`workflow_dispatch` 仅可把 `sign_macos: false` 用于未签名调试产物,不得用于 GitHub Release 标签。本地 `scripts/release-macos.sh` 仍是明确的本地签名通道;未配置证书时 `pnpm dist:mac` 保持未签名(D078)。macOS 矩阵使用 arm64 的 `macos-15` 和 Intel x64 的`macos-15-intel`。每个作业验证 `uname -m`,向 electron-builder 传入匹配@@ -229,12 +225,7 @@ xattr -r -d com.apple.quarantine /Applications/PI-Desktop.app该助手仅适用于可信来源的未签名工件在 macOS 上提示应用已损坏的场景;已签名并公证的版本无需执行它。-默认 macOS 打包步骤生成未签名工件。只有手动运行明确设置-`sign_macos: true` 时,才会从 GitHub Actions 密钥接收 `CSC_LINK`、-`CSC_KEY_PASSWORD`、`APPLE_ID`、`APPLE_APP_SPECIFIC_PASSWORD` 和-`APPLE_TEAM_ID`,强制执行代码签名和公证,然后验证 Developer ID 权限、代码-签名完整性、Gatekeeper 评估以及已装订的应用票据。生成的 DMG 也会在任何-工件上传前显式装订并验证。+标签构建和 `sign_macos: true`(手动运行的默认值)仅从 GitHub Actions 密钥接收 `CSC_LINK`、`CSC_KEY_PASSWORD`、`APPLE_ID`、`APPLE_APP_SPECIFIC_PASSWORD` 和 `APPLE_TEAM_ID`,固定身份 `Developer ID Application: XingYu Liu (DUV63RKYTW)`,强制代码签名与 `notarytool` 公证,然后验证该身份、代码签名完整性(含 `pi-desktop-host-core`)、Gatekeeper `Notarized Developer ID` 以及已装订的应用票据。生成的 DMG 也会在任何工件上传前显式装订并验证。DMG、ZIP、NSIS、AppImage、deb、rpm、块图和更新程序提要输出已压缩或压缩不敏感。因此,工作流程会上传它们的@@ -262,17 +253,16 @@ https://cnb.cool/aixk/Pi-Desktop 拉取的用户使用。## 5. 验证门-对于默认未签名的 macOS 通道,不要将工件视为通过 Gatekeeper 资格验证;-以下签名和装订检查仅适用于明确设置 `sign_macos: true` 的运行。+未签名调试产物(`workflow_dispatch` 且 `sign_macos: false`)不视为通过 Gatekeeper。标签发布必须通过以下签名和装订检查,否则工作流失败。-每次发布版本后运行:+每次已签名发布后运行:```bashfor APP in apps/desktop/release/mac-*/PI-Desktop.app; do- codesign -dv --verbose=2 "$APP" # identity + hardened runtime flags- codesign --verify --deep --strict "$APP" # signature integrity- spctl -a -vv "$APP" # Gatekeeper assessment (notarized Developer ID)- xcrun stapler validate "$APP" # notarization staple+ codesign -dv --verbose=4 "$APP"+ codesign --verify --deep --strict --verbose=2 "$APP"+ spctl --assess --type execute --verbose=4 "$APP"+ xcrun stapler validate "$APP"donexcrun stapler validate apps/desktop/release/*.dmg```@@ -431,10 +421,6 @@ electron PI-Desktop-<version>-linux-x64.asar## 7. 已知限制-- macOS、Linux deb/rpm 和 Windows 便携版 exe 仍保持通知和链接更新模式。-- Linux x64 包在 Ubuntu 22.04 上构建,因此 host-core 需要 glibc 2.35 或更高- 版本(Ubuntu 22.04、Debian 12、Fedora 36+)。标签作业运行- `scripts/check-linux-host-glibc.mjs`,拒绝需要更新 glibc 的二进制文件。-- 应用内 macOS 交付、回滚、分阶段部署和预发布渠道政策仍保持公开发布工作。- GitHub Release 的 macOS 工件默认未签名;只有手动运行并明确设置- `sign_macos: true` 时,才会在发布前完成 Developer ID 签名、公证和装订。+- Linux deb/rpm 和 Windows 便携版 exe 仍保持通知和链接更新模式。打包的 macOS、Windows NSIS 和 Linux AppImage 使用应用内 `electron-updater`。+- Linux x64 包在 Ubuntu 22.04 上构建,因此 host-core 需要 glibc 2.35 或更高版本(Ubuntu 22.04、Debian 12、Fedora 36+)。标签作业运行 `scripts/check-linux-host-glibc.mjs`,拒绝需要更新 glibc 的二进制文件。+- 回滚、分阶段部署和预发布渠道政策仍是开放的发布工作。现有未签名 macOS 安装可能需要先手动安装一次已签名 DMG,之后应用内更新才能成功。diff --git a/docs/zh-CN/spec/08-meta/decisions-log.md b/docs/zh-CN/spec/08-meta/decisions-log.mdindex 7bd47a623..ccb480e6f 100644--- a/docs/zh-CN/spec/08-meta/decisions-log.md+++ b/docs/zh-CN/spec/08-meta/decisions-log.md@@ -27,6 +27,7 @@| D374 | 远程 Agent 控制 v1 目标修订 | **修订 D373 / ADR 0205:`RACP-WS` 是 v1 唯一规范绑定(`RACP-HTTP` 为浏览器 profile,`RACP-GRPC` 保留);`packages/shared` 中的 typebox 是唯一契约来源;无头的 `packages/agent-host` 模块是首个交付物,桌面 IPC、本地 MCP 与 RACP 共同调用;游标为 `{ epoch, sequence }` 且增量为临时数据;回合队列移入 Host;host-core 暴露 `permissions.pending`;远程审批携带完整本地决策词汇并默认 `ask` 上限;浏览器客户端使用 cookie profile;首个部署为单租户。** | 对照已交付桌面审查 D373 草案发现远程审批词汇比本地契约窄、待处理请求被当作连接状态、逐 token 增量会耗尽重放窗口、绑定数量超过 v1 承载能力(ADR 0205) || D447 | 无头运行时边界 | **修订 ADR 0205 里程碑 R2 的前置条件(ADR 0284):Agent Host 模块之下与 Electron 无关的运行时层放入 `packages/host-runtime` —— host-core 与 sidecar 的 stdio 传输、重启监督器(进程模型 §4 的策略)、持久回合生命周期(`RuntimeService` 作为模块的 `RuntimePort`:`session.beginTurn` → 用户行 → prompt → `session.endTurn`、中止锁、过期终态事件守卫、单飞终结)、带 D299 检查点的转录持久化、基于 host-core 自身注册表的无头启动解析器、已批准 Plan/Goal 的派发(D189),以及 `SessionPort` / `QueueStore` / `permissions.pending` 的 host-core 适配器。Electron main 只保留薄适配层(二进制与资源位置、`ELECTRON_RUN_AS_NODE`、脱敏 stderr、schema/glibc 诊断、渲染层状态推送)以及自己的本地 prompt 路径。`TurnStartRequest` 新增可选 `userMessageId`。不改 IPC、sidecar、host-core、插件 SDK、默认值或持久化数据。** | `pi-host` 必须在没有 Electron 的情况下运行与桌面相同的生命周期不变量;第二份中止锁、过期终态事件与持久落库后释放队列的实现会与桌面已修好的那份漂移 || D448 | RACP-WS 传输与设备配对 | **修订 ADR 0205 里程碑 R2(ADR 0285):`packages/racp` 同时承载规范绑定 `RACP-WS` 的两端。`RacpServer` 按目录的角色规则把每个操作分发到 Agent Host 模块与 Host 实现的 `RacpHostOperations` 接口;`RacpClient` 关联请求、应答服务端发起的请求、按会话记录最后的持久游标、以有界退避重连,并让断开连接上未完成的调用以 `HOST_DISCONNECTED` 失败而不是重发。认证采用 header profile:Host 签发的 `pdt1.` 设备令牌与一次性、有时限的 `ppt1.` 配对令牌(散列存储、常量时间比较、绝不出现在 URL 中);`connection/pair` 铸造 `owner` 设备。`connection/pair`、`project/register`、`project/browse`、`server.hostId`、`events/closed` 通知,以及错误码 `PAIRING_FAILED`、`PAIRING_TOKEN_EXPIRED`、`CAPABILITY_UNAVAILABLE`、`REMOTE_PATH_NOT_FOUND`、`REMOTE_PATH_FORBIDDEN`、`HOST_DISCONNECTED`、`HOST_BOOTSTRAP_FAILED`、`HOST_VERSION_MISMATCH`、`REMOTE_AUTH_FAILED`、`REMOTE_CONNECTION_FAILED`、`REMOTE_FORWARD_FAILED` 进入契约(规格 §14a)。绑定拒绝非回环地址;附件与工具中继宣告为不可用。** | SSH 隧道拓扑需要 `pi-host` 能绑定的服务端和桌面能运行的客户端,以及安全规格描述的配对;不需要机器边界的一致性行为成为包内测试 |+| D450 | 签名的 macOS GitHub Release | **修订 D078 / ADR 0022:GitHub tag 发布使用身份 `Developer ID Application: XingYu Liu (DUV63RKYTW)` / 团队 `DUV63RKYTW`,通过 Actions 密钥(`CSC_LINK`、`CSC_KEY_PASSWORD`、`APPLE_ID`、`APPLE_APP_SPECIFIC_PASSWORD`、`APPLE_TEAM_ID`)对 macOS DMG/ZIP 做 Developer ID 签名、`notarytool` 公证、装订和 Gatekeeper 校验;缺少密钥则失败。无证书的本地未签名打包仍可用。`workflow_dispatch` 仅可把 `sign_macos: false` 用于未签名调试产物。打包的 macOS 走应用内 `electron-updater`(ZIP + 合并后的 `latest-mac.yml`);Linux deb/rpm 与 Windows portable 仍为通知并打开发布页。禁止 afterPack/afterSign adhoc 签名(ADR 0278)。** | 正式 DMG 应无需 Gatekeeper 警告即可打开,已签名 macOS 安装可下载并重启到新 tag。见 ADR 0289、E2E-196c、E2E-067A。 |## B. 辅助实现默认值@@ -176,7 +177,7 @@| 身份证号 | 主题 | 决定 | 基本原理 ||---|---|---|---|-| D078 | macOS 签名通道 | **静态配置不嵌入证书身份,因此未配置证书的本地构建保持未签名。发布通道需要 Developer ID 签名和 Apple 公证;CI 通过 Actions 密钥接收证书材料,并拒绝未装订的工件。** | 贡献者无需证书即可打包,同时已发布的 macOS 工件满足 Gatekeeper 要求。参见 06-delivery/06-release-runbook。 |+| D078 | macOS 签名通道 | *(由 D450 / ADR 0289 修订)* **静态配置不嵌入证书身份,因此未配置证书的本地构建保持未签名。正式 GitHub tag 发布需要 Developer ID 签名和 Apple 公证;CI 通过 Actions 密钥接收证书材料,并拒绝未装订的工件。** | 贡献者无需证书即可打包,同时已发布的 macOS 工件满足 Gatekeeper 要求。参见 06-delivery/06-release-runbook。 || D079 | 应用程序图标/品牌标记 v1 | *(渲染器资源路径由 D221 细化)* **`build/icon_1024.png` 是规范的 PI-Desktop 徽标; `scripts/make-icon.py` 派生 `build/icon.icns` 而不覆盖 PNG;打包的 macOS 构建、`pnpm dev` 和渲染器 chrome 重用这些资源** | 在开发、渲染器和打包通道中保持一种视觉标识,同时防止派生脚本恢复过时的生成标记 || D080 | 后台监管 | **子出口立即拒绝正在进行的 RPC;退避重新启动(0.5s→4s,每2分钟最多3次); `hostStatus` 事件导致渲染器性能下降 UI** | 崩溃恢复,无挂起;失败是可见的,而不是沉默的 || D081 | Renderer 沙箱 | **`sandbox: true` 与完全捆绑的 CJS preload;生产 CSP 删除 `unsafe-eval` 和 localhost connect-src** | Electron 安全基线;由 `test:e2e:boot` 验证 |diff --git a/packages/shared/src/types/platform.ts b/packages/shared/src/types/platform.tsindex 7b625842c..484da2145 100644--- a/packages/shared/src/types/platform.ts+++ b/packages/shared/src/types/platform.ts@@ -35,9 +35,10 @@ export type HostStatusEvent = {/*** How app updates are delivered on this install:- * - in-app: electron-updater downloads and installs (Windows NSIS, Linux AppImage)+ * - in-app: electron-updater downloads and installs (Windows NSIS, Linux+ * AppImage, packaged macOS)* - manual: we only detect new versions and link to the releases page- * (unsigned macOS builds, Linux deb)+ * (Linux deb/rpm, Windows portable)* - disabled: development / unpackaged build*/export type UpdateMode = "in-app" | "manual" | "disabled";diff --git a/scripts/README.md b/scripts/README.mdindex a554beba3..9d2fb958f 100644--- a/scripts/README.md+++ b/scripts/README.md@@ -78,7 +78,7 @@ job uses Ubuntu 22.04 so host-core stays on glibc 2.35, then`scripts/check-linux-host-glibc.mjs` refuses a binary that needs a newerglibc. The Linux runner also exports the exact app.asar from `linux-unpacked`as a versioned release asset; the macOS matrix covers arm64 and Intel x64 and-the publish job assembles the GitHub Release. The release workflow defaults to-unsigned macOS artifacts; manually dispatch it with `sign_macos: true` to opt-into signing and notarization. See the [release+the publish job assembles the GitHub Release. Tag builds Developer ID-sign,+notarize, and staple macOS artifacts; `workflow_dispatch` may set+`sign_macos: false` only for unsigned debug artifacts. See the [releaserunbook](../docs/spec/06-delivery/06-release-runbook.md).diff --git a/scripts/release-macos.sh b/scripts/release-macos.shindex 99a2c6b83..19951e45b 100755--- a/scripts/release-macos.sh+++ b/scripts/release-macos.sh@@ -4,10 +4,10 @@# Local builds without a certificate remain unsigned. This script injects a# real signing identity and requires notarization credentials:#-# MAC_SIGNING_IDENTITY e.g. "Developer ID Application: Your Name (TEAMID)"+# MAC_SIGNING_IDENTITY default: "Developer ID Application: XingYu Liu (DUV63RKYTW)"# APPLE_ID Apple ID email for notarization# APPLE_APP_SPECIFIC_PASSWORD app-specific password for the Apple ID-# APPLE_TEAM_ID Apple Developer Team ID+# APPLE_TEAM_ID Apple Developer Team ID (must be DUV63RKYTW)# MAC_ARCH optional `arm64` or `x64`; must match the host## See docs/spec/06-delivery/06-release-runbook.md for the full runbook.@@ -44,14 +44,17 @@ if [[ "$MAC_ARCH" != "$DEFAULT_MAC_ARCH" ]]; thenexit 1fi-if [[ -z "${MAC_SIGNING_IDENTITY:-}" ]]; then- echo "error: MAC_SIGNING_IDENTITY is not set." >&2+MAC_SIGNING_IDENTITY="${MAC_SIGNING_IDENTITY:-Developer ID Application: XingYu Liu (DUV63RKYTW)}"+APPLE_TEAM_ID="${APPLE_TEAM_ID:-DUV63RKYTW}"++if [[ -z "${APPLE_ID:-}" || -z "${APPLE_APP_SPECIFIC_PASSWORD:-}" ]]; then+ echo "error: notarization credentials are required (APPLE_ID / APPLE_APP_SPECIFIC_PASSWORD)." >&2echo "For an unsigned local build use: pnpm --filter @pi-desktop/desktop dist" >&2exit 1fi-if [[ -z "${APPLE_ID:-}" || -z "${APPLE_APP_SPECIFIC_PASSWORD:-}" || -z "${APPLE_TEAM_ID:-}" ]]; then- echo "error: notarization credentials are required (APPLE_ID / APPLE_APP_SPECIFIC_PASSWORD / APPLE_TEAM_ID)." >&2+if [[ "$APPLE_TEAM_ID" != "DUV63RKYTW" ]]; then+ echo "error: APPLE_TEAM_ID must be DUV63RKYTW (got: $APPLE_TEAM_ID)." >&2exit 1fidiff --git a/scripts/verify-macos-release.sh b/scripts/verify-macos-release.shindex d4d35174a..b99f88760 100755--- a/scripts/verify-macos-release.sh+++ b/scripts/verify-macos-release.sh@@ -6,6 +6,7 @@ set -euo pipefailRELEASE_DIR="${1:-apps/desktop/release}"PRODUCT_NAME="PI-Desktop"+EXPECTED_IDENTITY="${MAC_SIGNING_IDENTITY:-Developer ID Application: XingYu Liu (DUV63RKYTW)}"if [[ ! -d "$RELEASE_DIR" ]]; thenecho "error: release directory does not exist: $RELEASE_DIR" >&2@@ -28,20 +29,32 @@ fiAPP="${APPS[0]}"DMG="${DMGS[0]}"+HOST_CORE="$APP/Contents/Resources/bin/pi-desktop-host-core"echo "==> Inspecting Developer ID signature: $APP"SIGNATURE_INFO="$(codesign -dv --verbose=4 "$APP" 2>&1)"printf '%s\n' "$SIGNATURE_INFO"-if [[ "$SIGNATURE_INFO" != *"Authority=Developer ID Application:"* ]]; then- echo "error: $APP is not signed with a Developer ID Application certificate." >&2+if [[ "$SIGNATURE_INFO" != *"Authority=${EXPECTED_IDENTITY}"* ]]; then+ echo "error: $APP is not signed with $EXPECTED_IDENTITY." >&2exit 1fi+if [[ "$SIGNATURE_INFO" != *"flags=0x10000(runtime)"* && "$SIGNATURE_INFO" != *"flags=runtime"* && "$SIGNATURE_INFO" != *"runtime"* ]]; then+ echo "warning: hardened runtime flag not found in codesign -dv output; continuing with --deep --strict."+fiecho "==> Verifying code-signing integrity: $APP"codesign --verify --deep --strict --verbose=2 "$APP"+if [[ -f "$HOST_CORE" ]]; then+ echo "==> Verifying host-core sidecar signature: $HOST_CORE"+ codesign --verify --strict --verbose=2 "$HOST_CORE"+else+ echo "error: missing host-core sidecar at $HOST_CORE" >&2+ exit 1+fi+echo "==> Assessing Gatekeeper notarization: $APP"-ASSESSMENT="$(spctl -a -vv "$APP" 2>&1)"+ASSESSMENT="$(spctl --assess --type execute --verbose=4 "$APP" 2>&1)"printf '%s\n' "$ASSESSMENT"if [[ "$ASSESSMENT" != *"source=Notarized Developer ID"* ]]; thenecho "error: Gatekeeper did not recognize $APP as notarized." >&2