Local-first AI coding agent desktop: Electron + Rust host core + pi Agent Harness + user-installable plugins
TypeScript ai-agentcoding-agentdesktop-appelectronglobali18nlocal-firstmcppipi-agentpi-desktoppluginsreactrusttypescript
fix(windows): reuse the registered install scope on NSIS updates
Zeding Zhang7d0f4ab62837
diff --git a/apps/desktop/build/installer.nsh b/apps/desktop/build/installer.nshnew file mode 100644index 000000000..c348e9d4d--- /dev/null+++ b/apps/desktop/build/installer.nsh@@ -0,0 +1,12 @@+!ifndef BUILD_UNINSTALLER+ !macro customInstallMode+ ; Let the assisted installer apply the selected scope and handle elevation.+ ${If} ${isUpdated}+ ${AndIf} $hasPerMachineInstallation != $hasPerUserInstallation+ ${AndIfNot} ${isForAllUsers}+ ${AndIfNot} ${isForCurrentUser}+ StrCpy $isForceMachineInstall $hasPerMachineInstallation+ StrCpy $isForceCurrentInstall $hasPerUserInstallation+ ${EndIf}+ !macroend+!endifdiff --git a/apps/desktop/test/nsis-update-scope.nsi b/apps/desktop/test/nsis-update-scope.nsinew file mode 100644index 000000000..5898f099f--- /dev/null+++ b/apps/desktop/test/nsis-update-scope.nsi@@ -0,0 +1,51 @@+; Compile with makensis and run the resulting executable. A nonzero exit code+; identifies the failing case. No registry writes or elevation are needed.+Unicode true+Name "NSIS update scope test"+OutFile "nsis-update-scope.exe"+RequestExecutionLevel user+SilentInstall silent+!include LogicLib.nsh+!include "..\build\installer.nsh"++Var updated+Var requestedScope+Var hasPerMachineInstallation+Var hasPerUserInstallation+Var isForceMachineInstall+Var isForceCurrentInstall++!define isUpdated '$updated == "1"'+!define isForAllUsers '$requestedScope == "all"'+!define isForCurrentUser '$requestedScope == "current"'++!macro checkScope machine user forceMachine forceCurrent+ StrCpy $hasPerMachineInstallation ${machine}+ StrCpy $hasPerUserInstallation ${user}+ StrCpy $isForceMachineInstall 0+ StrCpy $isForceCurrentInstall 0+ !insertmacro customInstallMode+ ${If} $isForceMachineInstall != ${forceMachine}+ ${OrIf} $isForceCurrentInstall != ${forceCurrent}+ SetErrorLevel ${__LINE__}+ Quit+ ${EndIf}+!macroend++Section+ StrCpy $updated 1+ !insertmacro checkScope 1 0 1 0+ !insertmacro checkScope 0 1 0 1+ !insertmacro checkScope 1 1 0 0+ !insertmacro checkScope 0 0 0 0++ StrCpy $requestedScope current+ !insertmacro checkScope 1 0 0 0+ StrCpy $requestedScope all+ !insertmacro checkScope 0 1 0 0++ StrCpy $requestedScope ""+ StrCpy $updated 0+ !insertmacro checkScope 1 0 0 0+ !insertmacro checkScope 0 1 0 0+SectionEnddiff --git a/docs/spec/04-ux/09-interaction-patterns.md b/docs/spec/04-ux/09-interaction-patterns.mdindex 0c8ba2310..cba9b08b0 100644--- a/docs/spec/04-ux/09-interaction-patterns.md+++ b/docs/spec/04-ux/09-interaction-patterns.md@@ -659,6 +659,9 @@ may be retained while exactly one workspace supplies the visible shell context.Info continues to show the available version and the Releases action.- `downloaded` remains actionable until Restart to update or normal app quit;later scheduled/manual checks do not replace it with `checking`.+- On Windows, Restart to update reuses the registered NSIS install scope when+ exactly one exists. An all-users update requests elevation when needed.+ The installer asks for the scope when it finds no registered install or finds both.- A compact update notice appears in the main pane's top-right safe area forthe one-time manual reminder, in-app `downloading`, or `downloaded`. It staysclear of the bottom composer at every supported window size and draft height.diff --git a/docs/spec/06-delivery/e2e/release-and-platform.md b/docs/spec/06-delivery/e2e/release-and-platform.mdindex 9f6b3a417..7b91c6554 100644--- a/docs/spec/06-delivery/e2e/release-and-platform.md+++ b/docs/spec/06-delivery/e2e/release-and-platform.md@@ -616,7 +616,11 @@(and supervision/capture equivalents) and confirm `app.quit()` exits without adialog. 6) On packaged Windows NSIS or Linux AppImage, restart to install anupdate; confirm no quit warning appears and the installer completes upgrade- and relaunch.+ and relaunch. On Windows, repeat with only a current-user install and only+ an all-users install. Verify each update skips the scope page and updates+ the same directory, accepting UAC if prompted for the all-users install.+ With both scopes registered, verify the installer asks which copy to update.+ Also verify a fresh interactive install offers both scopes.- **Expected**: Accidental explicit quit is cancellable. Repeated quit requestscannot duplicate or bypass an outstanding confirmation; Cancel clears thepending decision so a later quit asks again. Tray Quit presents the dialog@@ -635,9 +639,11 @@shutdown lifecycle covered (`lifecycle-dialog-broker.test.mjs`,`lifecycle-confirmation-dialog-user-path.test.mjs`,`lifecycle-close-behavior-runtime.test.mjs`, `close-behavior-tray.test.mjs`,- `shutdown-regenerate-persistence.test.mjs`). Full application shutdown and- packaged update journey remains Draft; run in a capable release environment- when lifecycle wiring changes.+ `shutdown-regenerate-persistence.test.mjs`). For the Windows scope cases,+ compile `apps/desktop/test/nsis-update-scope.nsi` with `makensis` and run+ the resulting executable. Exit code 0 means all scope cases passed.+ The full shutdown and packaged update journey remains Draft. Run it in a+ capable release environment when lifecycle wiring changes.## E2E-067A: Prerelease install discovers newer stable release (D120)