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(updater): add automatic and manual update preference
vastsa1f88f4d09551
diff --git a/apps/desktop/electron/main/index.ts b/apps/desktop/electron/main/index.tsindex 114e2337a..a56da6cf6 100644--- a/apps/desktop/electron/main/index.ts+++ b/apps/desktop/electron/main/index.ts@@ -272,6 +272,19 @@ const updater = new AppUpdaterController({currentVersion: APP_VERSION,isPackaged: !isDevelopmentBuild,getLocale: () => mainState.updaterLocale,+ readUpdateSettings: async () => {+ const host = getHost();+ if (!host?.isAvailable()) throw new Error("host unavailable");+ return host.call<{+ updatePreference?: unknown;+ lastNotifiedUpdateVersion?: unknown;+ }>("settings.get");+ },+ persistLastNotifiedVersion: async (version) => {+ const host = getHost();+ if (!host?.isAvailable()) throw new Error("host unavailable");+ await host.call("settings.set", { lastNotifiedUpdateVersion: version });+ },});/**diff --git a/apps/desktop/electron/main/ipc/register.ts b/apps/desktop/electron/main/ipc/register.tsindex aee38990e..3aa90c810 100644--- a/apps/desktop/electron/main/ipc/register.ts+++ b/apps/desktop/electron/main/ipc/register.ts@@ -268,6 +268,7 @@ export function registerIpcHandlers(dependencies: RegisterIpcDependencies) {applyDeveloperMode,applyPreventScreenSleep,applyKeepAwakeWhileRunning,+ applyUpdatePreference: (preference) => updater.setPreference(preference),resolveEffectiveCommandShell,});registerConfigSyncIpc({diff --git a/apps/desktop/electron/main/ipc/settings-ipc.ts b/apps/desktop/electron/main/ipc/settings-ipc.tsindex 94f7ae5d4..2fb6f249d 100644--- a/apps/desktop/electron/main/ipc/settings-ipc.ts+++ b/apps/desktop/electron/main/ipc/settings-ipc.ts@@ -1,4 +1,4 @@-import { IPC } from "@pi-desktop/shared";+import { IPC, type UpdatePreference } from "@pi-desktop/shared";import type { AgentSidecar } from "../agent-sidecar";import type { HostProcess } from "../host-process";import type { IpcRegistrar } from "./types";@@ -22,6 +22,7 @@ export type SettingsIpcDependencies = {applyDeveloperMode: (settings?: { developerMode?: unknown } | null) => void;applyPreventScreenSleep: (settings?: { preventScreenSleep?: unknown } | null) => void;applyKeepAwakeWhileRunning: (settings?: { keepAwakeWhileRunning?: unknown } | null) => void;+ applyUpdatePreference: (preference: UpdatePreference) => void;resolveEffectiveCommandShell: () => Promise<unknown>;};@@ -40,6 +41,7 @@ export function registerSettingsIpc({applyDeveloperMode,applyPreventScreenSleep,applyKeepAwakeWhileRunning,+ applyUpdatePreference,resolveEffectiveCommandShell,}: SettingsIpcDependencies): void {let host: HostProcess | null = null;@@ -66,6 +68,11 @@ export function registerSettingsIpc({if (!host) throw new Error("host unavailable");const validatedSettings = validateSettingsWrite(settings);const result = await host.call("settings.set", validatedSettings);+ const updatePreference = (validatedSettings as { updatePreference?: unknown })+ .updatePreference;+ if (updatePreference === "automatic" || updatePreference === "manual") {+ applyUpdatePreference(updatePreference);+ }if (typeof (validatedSettings as { keepAwakeWhileRunning?: unknown }).keepAwakeWhileRunning === "boolean") {applyKeepAwakeWhileRunning(validatedSettings as { keepAwakeWhileRunning: boolean });diff --git a/apps/desktop/electron/main/manual-update-reminder.ts b/apps/desktop/electron/main/manual-update-reminder.tsnew file mode 100644index 000000000..76cf2452b--- /dev/null+++ b/apps/desktop/electron/main/manual-update-reminder.ts@@ -0,0 +1,29 @@+export type ManualUpdateReminderDecision = {+ show: boolean;+ persist: boolean;+};++/** Keeps manual update notices to one visible announcement per release. */+export class ManualUpdateReminderTracker {+ private lastNotifiedVersion?: string;+ private activeVersion?: string;+ private activeReminder = false;++ constructor(lastNotifiedVersion?: string) {+ this.lastNotifiedVersion = lastNotifiedVersion;+ }++ hydrate(lastNotifiedVersion?: string): void {+ if (lastNotifiedVersion) this.lastNotifiedVersion = lastNotifiedVersion;+ }++ observe(version: string): ManualUpdateReminderDecision {+ if (this.activeVersion === version) {+ return { show: this.activeReminder, persist: false };+ }+ this.activeVersion = version;+ this.activeReminder = version !== this.lastNotifiedVersion;+ if (this.activeReminder) this.lastNotifiedVersion = version;+ return { show: this.activeReminder, persist: this.activeReminder };+ }+}diff --git a/apps/desktop/electron/main/runtime/provider-catalog.ts b/apps/desktop/electron/main/runtime/provider-catalog.tsindex 864c7d543..6cddf6703 100644--- a/apps/desktop/electron/main/runtime/provider-catalog.ts+++ b/apps/desktop/electron/main/runtime/provider-catalog.ts@@ -205,6 +205,8 @@ export function createProviderCatalogRuntime({defaultCommandShell?: unknown;infiniteProviderRetry?: unknown;keepAwakeWhileRunning?: unknown;+ updatePreference?: unknown;+ lastNotifiedUpdateVersion?: unknown;networkProxy?: unknown;};if (@@ -231,6 +233,25 @@ export function createProviderCatalogRuntime({errorCode: ErrorCodes.INVALID_PARAMS,});}+ if (+ Object.prototype.hasOwnProperty.call(value, "updatePreference") &&+ value.updatePreference !== "automatic" &&+ value.updatePreference !== "manual"+ ) {+ throw Object.assign(new Error("updatePreference is invalid"), {+ errorCode: ErrorCodes.INVALID_PARAMS,+ });+ }+ if (+ Object.prototype.hasOwnProperty.call(value, "lastNotifiedUpdateVersion") &&+ (typeof value.lastNotifiedUpdateVersion !== "string" ||+ value.lastNotifiedUpdateVersion.trim().length === 0 ||+ value.lastNotifiedUpdateVersion.length > 128)+ ) {+ throw Object.assign(new Error("lastNotifiedUpdateVersion is invalid"), {+ errorCode: ErrorCodes.INVALID_PARAMS,+ });+ }if (Object.prototype.hasOwnProperty.call(value, "networkProxy")) {const proxy = validateNetworkProxy(value.networkProxy);if (!proxy.ok) {diff --git a/apps/desktop/electron/main/update-policy.ts b/apps/desktop/electron/main/update-policy.tsnew file mode 100644index 000000000..bdd437d0d--- /dev/null+++ b/apps/desktop/electron/main/update-policy.ts@@ -0,0 +1,58 @@+import type { UpdateMode, UpdatePreference } from "@pi-desktop/shared";++export type WindowsDistribution = "installed" | "zip";++export function supportsAutomaticUpdates(+ platform: NodeJS.Platform,+ isPackaged: boolean,+ env: NodeJS.ProcessEnv = process.env,+): boolean {+ if (!isPackaged) return false;+ if (platform === "win32" || platform === "darwin") return true;+ return platform === "linux" && Boolean(env.APPIMAGE);+}++export function resolveDefaultUpdatePreference(+ platform: NodeJS.Platform,+ isPackaged: boolean,+ env: NodeJS.ProcessEnv = process.env,+ distribution?: WindowsDistribution,+): UpdatePreference {+ if (!supportsAutomaticUpdates(platform, isPackaged, env)) return "manual";+ if (+ platform === "win32" &&+ (Boolean(env.PORTABLE_EXECUTABLE_FILE) || distribution === "zip")+ ) {+ return "manual";+ }+ return "automatic";+}++export function resolveStoredUpdatePreference(+ value: unknown,+ fallback: UpdatePreference,+): UpdatePreference {+ return value === "automatic" || value === "manual" ? value : fallback;+}++export function resolveEffectiveUpdatePreference(+ preference: UpdatePreference,+ automaticSupported: boolean,+): UpdatePreference {+ return automaticSupported ? preference : "manual";+}++export function resolveUpdateMode(+ platform: NodeJS.Platform,+ isPackaged: boolean,+ env: NodeJS.ProcessEnv = process.env,+ distribution?: WindowsDistribution,+ preference?: UpdatePreference,+): UpdateMode {+ if (!isPackaged) return "disabled";+ if (!supportsAutomaticUpdates(platform, isPackaged, env)) return "manual";+ const selected =+ preference ??+ resolveDefaultUpdatePreference(platform, isPackaged, env, distribution);+ return selected === "automatic" ? "in-app" : "manual";+}diff --git a/apps/desktop/electron/main/updater.ts b/apps/desktop/electron/main/updater.tsindex ad7230568..febf058e5 100644--- a/apps/desktop/electron/main/updater.ts+++ b/apps/desktop/electron/main/updater.ts@@ -26,7 +26,7 @@ import type { AppUpdater, UpdateInfo, ProgressInfo } from "electron-updater";import {formatChangelogNotes,IPC,- type UpdateMode,+ type UpdatePreference,type UpdateState,} from "@pi-desktop/shared";import type { Logger } from "./logger";@@ -42,6 +42,18 @@ import {raceWithTimeout,UPDATE_CHECK_TIMEOUT_CODE,} from "./update-timeout";+import {+ resolveDefaultUpdatePreference,+ resolveEffectiveUpdatePreference,+ resolveStoredUpdatePreference,+ resolveUpdateMode as resolveUpdateModePolicy,+ supportsAutomaticUpdates,+ type WindowsDistribution,+} from "./update-policy";+import { ManualUpdateReminderTracker } from "./manual-update-reminder";++export { resolveUpdateMode } from "./update-policy";+export type { WindowsDistribution } from "./update-policy";const { NsisUpdater, autoUpdater } = electronUpdaterPkg;@@ -69,10 +81,17 @@ export const AUTO_CHECK_TIMEOUT_MS = 8_000;/** Manual check can wait a bit longer; still far below the socket timeout. */export const MANUAL_CHECK_TIMEOUT_MS = 15_000;+export type UpdaterSettings = {+ updatePreference?: unknown;+ lastNotifiedUpdateVersion?: unknown;+};+export type UpdaterOptions = {logger: Logger;send: (channel: string, payload: unknown) => void;currentVersion: string;+ readUpdateSettings?: () => Promise<UpdaterSettings>;+ persistLastNotifiedVersion?: (version: string) => Promise<void>;/*** Active product UI locale for shipped-locale release notes.* Called when attaching notes to update state; defaults to English.@@ -89,30 +108,24 @@ export type UpdaterOptions = {distribution?: WindowsDistribution;};-export type WindowsDistribution = "installed" | "zip";--export function resolveUpdateMode(- platform: NodeJS.Platform,- isPackaged: boolean,- env: NodeJS.ProcessEnv = process.env,- distribution?: WindowsDistribution,-): UpdateMode {- if (!isPackaged) return "disabled";- if (platform === "win32") {- return env.PORTABLE_EXECUTABLE_FILE || distribution === "zip"- ? "manual"- : "in-app";- }- if (platform === "darwin") return "in-app";- if (platform === "linux" && env.APPIMAGE) return "in-app";- // non-AppImage linux installs- return "manual";-}-export class AppUpdaterController {private readonly logger: Logger;private readonly send: (channel: string, payload: unknown) => void;private readonly getLocale: () => string | null | undefined;+ private readonly platform: NodeJS.Platform;+ private readonly isPackaged: boolean;+ private readonly env: NodeJS.ProcessEnv;+ private readonly distribution?: WindowsDistribution;+ private readonly defaultPreference: UpdatePreference;+ private readonly automaticSupported: boolean;+ private readonly readUpdateSettings?: () => Promise<UpdaterSettings>;+ private readonly persistLastNotifiedVersion?: (version: string) => Promise<void>;+ private readonly manualReminderTracker = new ManualUpdateReminderTracker();+ private preference: UpdatePreference;+ private preferenceRevision = 0;+ private settingsReady: Promise<void> | null = null;+ private autoCheckStarted = false;+ private disposed = false;private state: UpdateState;private manualRequested = false;private initialTimer: NodeJS.Timeout | null = null;@@ -167,11 +180,30 @@ export class AppUpdaterController {(platform === "win32"? this.readPackagedDistribution(isPackaged): undefined);- const mode = resolveUpdateMode(+ this.platform = platform;+ this.isPackaged = isPackaged;+ this.env = process.env;+ this.distribution = distribution;+ this.defaultPreference = resolveDefaultUpdatePreference(+ platform,+ isPackaged,+ this.env,+ distribution,+ );+ this.preference = this.defaultPreference;+ this.automaticSupported = supportsAutomaticUpdates(+ platform,+ isPackaged,+ this.env,+ );+ this.readUpdateSettings = options.readUpdateSettings;+ this.persistLastNotifiedVersion = options.persistLastNotifiedVersion;+ const mode = resolveUpdateModePolicy(platform,isPackaged,- process.env,+ this.env,distribution,+ this.preference,);const defaultCacheBasePath = defaultUpdateCacheBasePath({platform,@@ -207,6 +239,10 @@ export class AppUpdaterController {});this.state = {mode,+ preference: this.preference,+ defaultPreference: this.defaultPreference,+ automaticSupported: this.automaticSupported,+ manualReminder: false,status: "idle",currentVersion: options.currentVersion,releasesUrl: RELEASES_URL,@@ -220,20 +256,129 @@ export class AppUpdaterController {return formatChangelogNotes(version, this.getLocale());}+ private ensureSettingsLoaded(): Promise<void> {+ if (this.settingsReady) return this.settingsReady;+ const preferenceRevision = this.preferenceRevision;+ this.settingsReady = (async () => {+ if (!this.readUpdateSettings) {+ this.applyPreference(this.preference, false);+ return;+ }+ try {+ const settings = await this.readUpdateSettings();+ if (this.disposed) return;+ const lastNotifiedVersion = settings.lastNotifiedUpdateVersion;+ if (+ typeof lastNotifiedVersion === "string" &&+ lastNotifiedVersion.length > 0 &&+ lastNotifiedVersion.length <= 128+ ) {+ this.manualReminderTracker.hydrate(lastNotifiedVersion);+ }+ const preference = resolveStoredUpdatePreference(+ settings.updatePreference,+ this.defaultPreference,+ );+ if (preferenceRevision === this.preferenceRevision) {+ this.applyPreference(preference, false);+ }+ } catch (error) {+ this.logger.app("updater", "warn", "update preferences unavailable", {+ data: { detail: String(error) },+ });+ if (preferenceRevision === this.preferenceRevision) {+ this.applyPreference("manual", false);+ }+ }+ })();+ return this.settingsReady;+ }++ private manualReminderFor(version: string): boolean {+ const decision = this.manualReminderTracker.observe(version);+ if (decision.persist && this.persistLastNotifiedVersion) {+ void this.persistLastNotifiedVersion(version).catch((error) => {+ this.logger.app("updater", "warn", "manual update reminder persistence failed", {+ data: { detail: String(error), version },+ });+ });+ }+ return decision.show;+ }++ private applyPreference(+ preference: UpdatePreference,+ checkImmediately: boolean,+ ): void {+ const previousMode = this.state.mode;+ const effectivePreference = resolveEffectiveUpdatePreference(+ preference,+ this.automaticSupported,+ );+ const mode = resolveUpdateModePolicy(+ this.platform,+ this.isPackaged,+ this.env,+ this.distribution,+ effectivePreference,+ );+ const preferenceChanged =+ effectivePreference !== this.preference || mode !== previousMode;+ this.preference = effectivePreference;+ this.autoUpdater.autoDownload = mode === "in-app";+ this.autoUpdater.autoInstallOnAppQuit = mode === "in-app";+ if (!preferenceChanged) return;++ const patch: Partial<UpdateState> = {+ mode,+ preference: effectivePreference,+ manualReminder: false,+ };+ if (mode === "manual") {+ if (+ this.state.status === "downloading" ||+ this.state.status === "downloaded"+ ) {+ patch.status = this.state.availableVersion ? "available" : "idle";+ patch.progressPercent = undefined;+ }+ if (this.state.availableVersion) {+ patch.manualReminder = this.manualReminderFor(+ this.state.availableVersion,+ );+ }+ }+ this.setState(patch);+ if (+ checkImmediately &&+ previousMode === "manual" &&+ mode === "in-app"+ ) {+ void this.check().catch(() => undefined);+ }+ }++ setPreference(preference: UpdatePreference): void {+ if (preference !== "automatic" && preference !== "manual") return;+ this.preferenceRevision += 1;+ this.applyPreference(preference, true);+ }+private attachListeners() {if (this.listenersAttached) return;this.listenersAttached = true;- this.autoUpdater.autoDownload = this.state.mode === "in-app";+ // Do not let cached updates download or install before Host preferences load.+ this.autoUpdater.autoDownload = false;+ this.autoUpdater.autoInstallOnAppQuit = false;// electron-updater defaults allowPrerelease=true when the installed// version has a prerelease component (e.g. 0.2.0-rc.6). That pins the// GitHub provider to the same custom channel ("rc") and never offers a// newer stable release such as 0.2.2. Always track GitHub's latest// stable release so RC installs can graduate to stable.this.autoUpdater.allowPrerelease = false;- // Even if the user ignores the restart prompt, a downloaded update- // lands on the next normal quit.- this.autoUpdater.autoInstallOnAppQuit = true;+ // Only automatic mode may install on quit; manual mode never hands an+ // installer a no-install/portable directory.this.autoUpdater.logger = {info: (m: unknown) =>this.logger.app("updater", "info", "updater diagnostic", {@@ -257,11 +402,15 @@ export class AppUpdaterController {this.setState({ status: "checking", error: undefined });});this.autoUpdater.on("update-available", (info: UpdateInfo) => {+ const automatic = this.state.mode === "in-app";this.setState({- status: this.state.mode === "in-app" ? "downloading" : "available",+ status: automatic ? "downloading" : "available",availableVersion: info.version,releaseNotes: this.notesFor(info.version),- progressPercent: this.state.mode === "in-app" ? 0 : undefined,+ progressPercent: automatic ? 0 : undefined,+ manualReminder: automatic+ ? false+ : this.manualReminderFor(info.version),});});this.autoUpdater.on("update-not-available", () => {@@ -270,6 +419,7 @@ export class AppUpdaterController {availableVersion: undefined,releaseNotes: undefined,progressPercent: undefined,+ manualReminder: false,});// In-app installs have no newer staged installer after the feed reports// current. Keep the differential baselines for the next update. Manual@@ -279,6 +429,7 @@ export class AppUpdaterController {}});this.autoUpdater.on("download-progress", (progress: ProgressInfo) => {+ if (this.state.mode !== "in-app") return;this.setState({status: "downloading",// Preserve notes already attached when discovery advanced to download.@@ -288,11 +439,15 @@ export class AppUpdaterController {});});this.autoUpdater.on("update-downloaded", (info: UpdateInfo) => {+ const automatic = this.state.mode === "in-app";this.setState({- status: "downloaded",+ status: automatic ? "downloaded" : "available",availableVersion: info.version,releaseNotes: this.notesFor(info.version),- progressPercent: 100,+ progressPercent: automatic ? 100 : undefined,+ manualReminder: automatic+ ? false+ : this.manualReminderFor(info.version),});});this.autoUpdater.on("error", (error: Error) => {@@ -326,6 +481,7 @@ export class AppUpdaterController {/** User- or schedule-triggered check. Resolves with the settled state. */async check(options: { manual?: boolean } = {}): Promise<UpdateState> {+ await this.ensureSettingsLoaded();if (this.state.mode === "disabled") {throw new Error("updates are disabled in development builds");}@@ -399,7 +555,7 @@ export class AppUpdaterController {/** Quit and install a downloaded update (in-app mode). */install(): void {- if (this.state.status !== "downloaded") {+ if (this.state.mode !== "in-app" || this.state.status !== "downloaded") {throw new Error("no downloaded update to install");}// Marked before the call: quitAndInstall spawns the installer itself, so@@ -426,18 +582,21 @@ export class AppUpdaterController {* first window or pin the updater on `checking`.*/startAutoCheck() {- if (this.state.mode === "disabled" || this.initialTimer || this.intervalTimer) {- return;- }- this.initialTimer = setTimeout(() => {- void this.check().catch(() => undefined);- }, AUTO_CHECK_INITIAL_DELAY_MS);- this.intervalTimer = setInterval(() => {- void this.check().catch(() => undefined);- }, AUTO_CHECK_INTERVAL_MS);+ if (this.autoCheckStarted || this.state.mode === "disabled") return;+ this.autoCheckStarted = true;+ void this.ensureSettingsLoaded().then(() => {+ if (this.disposed || this.state.mode === "disabled") return;+ this.initialTimer = setTimeout(() => {+ void this.check().catch(() => undefined);+ }, AUTO_CHECK_INITIAL_DELAY_MS);+ this.intervalTimer = setInterval(() => {+ void this.check().catch(() => undefined);+ }, AUTO_CHECK_INTERVAL_MS);+ });}dispose() {+ this.disposed = true;if (this.initialTimer) clearTimeout(this.initialTimer);if (this.intervalTimer) clearInterval(this.intervalTimer);this.initialTimer = null;diff --git a/apps/desktop/src/components/UpdateBanner.tsx b/apps/desktop/src/components/UpdateBanner.tsxindex 35322352c..e83c6a084 100644--- a/apps/desktop/src/components/UpdateBanner.tsx+++ b/apps/desktop/src/components/UpdateBanner.tsx@@ -1,4 +1,4 @@-import { useState } from "react";+import { useEffect, useState } from "react";import { useTranslation } from "react-i18next";import type { UpdateState } from "@pi-desktop/shared";import { api } from "../lib/api";@@ -6,6 +6,8 @@ import { useUpdateState } from "../hooks/use-update-state";import { Button, TooltipButton } from "./ui";import { IconClose, IconCloudDown, IconExternal } from "./icons";+const shownManualReminderVersions = new Set<string>();+/*** Ambient update notice in the main pane's top safe area. Appears when an* update is ready to install (in-app mode) or newly detected (manual mode);@@ -16,6 +18,27 @@ import { IconClose, IconCloudDown, IconExternal } from "./icons";export function UpdateBanner() {const { t } = useTranslation();const update = useUpdateState();+ const manualReminderVersion =+ update?.status === "available" &&+ update.mode === "manual" &&+ update.manualReminder === true+ ? update.availableVersion+ : undefined;+ const [presentedManualReminder, setPresentedManualReminder] = useState<+ string | null+ >(() =>+ manualReminderVersion && shownManualReminderVersions.has(manualReminderVersion)+ ? manualReminderVersion+ : null,+ );+ useEffect(() => {+ if (!manualReminderVersion) return;+ if (shownManualReminderVersions.has(manualReminderVersion)) {+ setPresentedManualReminder(manualReminderVersion);+ return;+ }+ shownManualReminderVersions.add(manualReminderVersion);+ }, [manualReminderVersion]);const [dismissedState, setDismissedState] = useState<string | null>(null);if (!update?.availableVersion) return null;@@ -25,7 +48,10 @@ export function UpdateBanner() {const visible =update.status === "downloaded" ||update.status === "downloading" ||- (update.status === "available" && update.mode === "manual");+ (update.status === "available" &&+ update.mode === "manual" &&+ update.manualReminder === true &&+ presentedManualReminder !== update.availableVersion);if (!visible) return null;const message = bannerMessage(update, t);diff --git a/apps/desktop/src/features/settings/SettingsPage.tsx b/apps/desktop/src/features/settings/SettingsPage.tsxindex 74631e1dc..a5cb65cea 100644--- a/apps/desktop/src/features/settings/SettingsPage.tsx+++ b/apps/desktop/src/features/settings/SettingsPage.tsx@@ -593,7 +593,11 @@ export function SettingsPage() {{t("settings.openFeedback")}</Button></SettingsRow>- <UpdatesRow currentVersion={version?.version} />+ <UpdatesRow+ currentVersion={version?.version}+ settings={settings ?? null}+ saveSettings={saveSettings}+ /></SettingsCard>{settings && (diff --git a/apps/desktop/src/features/settings/agent-sections.tsx b/apps/desktop/src/features/settings/agent-sections.tsxindex a17264dfd..f4816cc8c 100644--- a/apps/desktop/src/features/settings/agent-sections.tsx+++ b/apps/desktop/src/features/settings/agent-sections.tsx@@ -1,11 +1,14 @@import { useCallback, useEffect, useState, type ReactNode } from "react";import { useTranslation } from "react-i18next";-import type { AgentInstructionFile } from "@pi-desktop/shared";+import type { AgentInstructionFile, AppSettings, UpdatePreference } from "@pi-desktop/shared";import { api } from "../../lib/api";+import { useAppStore } from "../../stores/app-store";import { useUpdateState } from "../../hooks/use-update-state";import { Button } from "../../components/ui";import { IconFileText } from "../../components/icons";import { ReleaseNotesDialog } from "../../components/ReleaseNotesDialog";+import { SettingsMenuSelect } from "../../components/settings/SettingsMenuSelect";+import { persistUpdatePreference } from "./update-preference";import { SettingsCard, SettingsRow } from "./primitives";export function AgentInstructionsSection() {@@ -71,13 +74,48 @@ export function AgentInstructionsSection() {);}-export function UpdatesRow({ currentVersion }: { currentVersion?: string }) {+export function UpdatesRow({+ currentVersion,+ settings,+ saveSettings,+}: {+ currentVersion?: string;+ settings: AppSettings | null;+ saveSettings: (patch: Partial<AppSettings>) => Promise<void>;+}) {const { t } = useTranslation();const update = useUpdateState();+ const showToast = useAppStore((state) => state.showToast);const [releaseNotesOpen, setReleaseNotesOpen] = useState(false);+ const [preferenceSaving, setPreferenceSaving] = useState(false);+ const selectedPreference: UpdatePreference =+ update?.automaticSupported === false+ ? "manual"+ : settings?.updatePreference ??+ update?.preference ??+ update?.defaultPreference ??+ "manual";+ const savePreference = useCallback(async (value: string) => {+ if (value !== "automatic" && value !== "manual") return;+ setPreferenceSaving(true);+ try {+ await persistUpdatePreference(value, saveSettings);+ } catch {+ if (useAppStore.getState().settings?.updatePreference !== value) {+ showToast(t("updates.preferenceSaveFailed"), { variant: "error" });+ }+ } finally {+ setPreferenceSaving(false);+ }+ }, [saveSettings, showToast, t]);const closeReleaseNotes = useCallback(() => setReleaseNotesOpen(false), []);const disabled = !update || update.mode === "disabled";const busy = update?.status === "checking" || update?.status === "downloading";+ const preferenceLocked =+ !update ||+ update.mode === "disabled" ||+ !settings ||+ update.status === "downloading";let action: ReactNode;if (update?.status === "downloaded") {@@ -152,36 +190,75 @@ export function UpdatesRow({ currentVersion }: { currentVersion?: string }) {update?.status === "downloaded");return (- <SettingsRow title={t("updates.title")} description={t("updates.desc")}>- <div className="flex flex-col items-end gap-1.5">- <div className="update-settings-actions">- <Button- variant="secondary"- onClick={() => setReleaseNotesOpen(true)}- >- <IconFileText size={14} />- {t("updates.releaseNotes")}- </Button>- {action}+ <>+ <SettingsRow+ title={t("updates.preferenceTitle")}+ description={t("updates.preferenceDesc")}+ >+ <div className="flex flex-col items-end gap-1.5">+ <SettingsMenuSelect+ label={t("updates.preferenceTitle")}+ value={selectedPreference}+ options={[+ {+ id: "automatic",+ label: t("updates.automatic"),+ disabled:+ update?.automaticSupported !== true || preferenceLocked,+ },+ {+ id: "manual",+ label: t("updates.manual"),+ disabled: preferenceLocked,+ },+ ]}+ disabled={preferenceLocked}+ busy={preferenceSaving || update?.status === "downloading"}+ onChange={(value) => void savePreference(value)}+ />+ {update?.automaticSupported === false ? (+ <div className="text-right text-xs-plus text-text-muted">+ {t("updates.automaticUnsupported")}+ </div>+ ) : null}+ {update?.automaticSupported && update.defaultPreference === "manual" ? (+ <div className="text-right text-xs-plus text-text-muted">+ {t("updates.automaticPortableWarning")}+ </div>+ ) : null}</div>- {statusText ? (- <div className="text-right text-xs-plus text-text-muted">{statusText}</div>- ) : null}- {showNotes ? (- <div className="update-settings-notes">- <div className="update-settings-notes-label">{t("updates.whatsNew")}</div>- <pre className="update-settings-notes-body">{notes}</pre>+ </SettingsRow>+ <SettingsRow title={t("updates.title")} description={t("updates.desc")}>+ <div className="flex flex-col items-end gap-1.5">+ <div className="update-settings-actions">+ <Button+ variant="secondary"+ onClick={() => setReleaseNotesOpen(true)}+ >+ <IconFileText size={14} />+ {t("updates.releaseNotes")}+ </Button>+ {action}</div>+ {statusText ? (+ <div className="text-right text-xs-plus text-text-muted">{statusText}</div>+ ) : null}+ {showNotes ? (+ <div className="update-settings-notes">+ <div className="update-settings-notes-label">{t("updates.whatsNew")}</div>+ <pre className="update-settings-notes-body">{notes}</pre>+ </div>+ ) : null}+ </div>+ {releaseNotesOpen ? (+ <ReleaseNotesDialog+ currentVersion={update?.currentVersion ?? currentVersion}+ availableVersion={update?.availableVersion}+ onClose={closeReleaseNotes}+ />) : null}- </div>- {releaseNotesOpen ? (- <ReleaseNotesDialog- currentVersion={update?.currentVersion ?? currentVersion}- availableVersion={update?.availableVersion}- onClose={closeReleaseNotes}- />- ) : null}- </SettingsRow>+ </SettingsRow>+ </>);}diff --git a/apps/desktop/src/features/settings/update-preference.ts b/apps/desktop/src/features/settings/update-preference.tsnew file mode 100644index 000000000..266b3c2b5--- /dev/null+++ b/apps/desktop/src/features/settings/update-preference.ts@@ -0,0 +1,14 @@+import type { AppSettings, UpdatePreference } from "@pi-desktop/shared";++export function isUpdatePreference(value: unknown): value is UpdatePreference {+ return value === "automatic" || value === "manual";+}++export async function persistUpdatePreference(+ value: string,+ saveSettings: (patch: Partial<AppSettings>) => Promise<void>,+): Promise<boolean> {+ if (!isUpdatePreference(value)) return false;+ await saveSettings({ updatePreference: value });+ return true;+}diff --git a/apps/desktop/src/lib/api.ts b/apps/desktop/src/lib/api.tsindex 9600ebf0f..f4c60c636 100644--- a/apps/desktop/src/lib/api.ts+++ b/apps/desktop/src/lib/api.ts@@ -390,6 +390,8 @@ export function validateSettingsWrite(settings: AppSettings): AppSettings {chatContentMaxWidth?: unknown;infiniteProviderRetry?: unknown;smoothStreaming?: unknown;+ updatePreference?: unknown;+ lastNotifiedUpdateVersion?: unknown;networkProxy?: unknown;networkPolicy?: unknown;};@@ -442,6 +444,25 @@ export function validateSettingsWrite(settings: AppSettings): AppSettings {errorCode: "INVALID_PARAMS",});}+ if (+ Object.prototype.hasOwnProperty.call(value, "updatePreference") &&+ value.updatePreference !== "automatic" &&+ value.updatePreference !== "manual"+ ) {+ throw Object.assign(new Error("updatePreference is invalid"), {+ errorCode: "INVALID_PARAMS",+ });+ }+ if (+ Object.prototype.hasOwnProperty.call(value, "lastNotifiedUpdateVersion") &&+ (typeof value.lastNotifiedUpdateVersion !== "string" ||+ value.lastNotifiedUpdateVersion.trim().length === 0 ||+ value.lastNotifiedUpdateVersion.length > 128)+ ) {+ throw Object.assign(new Error("lastNotifiedUpdateVersion is invalid"), {+ errorCode: "INVALID_PARAMS",+ });+ }if (Object.prototype.hasOwnProperty.call(value, "networkProxy")) {const proxy = validateNetworkProxy(value.networkProxy);if (!proxy.ok) {diff --git a/apps/desktop/src/lib/settings-search.ts b/apps/desktop/src/lib/settings-search.tsindex ce27479ab..c61eca514 100644--- a/apps/desktop/src/lib/settings-search.ts+++ b/apps/desktop/src/lib/settings-search.ts@@ -318,6 +318,7 @@ export const SETTINGS_NAV: SettingsNavEntry[] = ["settings.logs","settings.feedback","updates.title",+ "updates.preferenceTitle","settings.developer","settings.developerMode","settings.devTools",diff --git a/apps/desktop/test/auto-update.test.mjs b/apps/desktop/test/auto-update.test.mjsindex 024683a44..bad2dbb0c 100644--- a/apps/desktop/test/auto-update.test.mjs+++ b/apps/desktop/test/auto-update.test.mjs@@ -93,18 +93,20 @@ test("main process registers update handlers and the auto-check lifecycle", () =});test("updater gates delivery mode by platform and delivery policy", () => {- // 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[\s\S]*distribution === "zip"/,- );+ // The pure policy tests cover platform capability and portable defaults.+ assert.match(updaterSource, /resolveUpdateModePolicy/);+ assert.match(updaterSource, /resolveDefaultUpdatePreference/);+ assert.match(updaterSource, /supportsAutomaticUpdates/);assert.match(updaterSource, /piDistribution/);- assert.match(updaterSource, /platform === "darwin"[\s\S]*return "in-app"/);- assert.match(updaterSource, /APPIMAGE/);- assert.match(updaterSource, /autoInstallOnAppQuit = true/);+ assert.match(updaterSource, /autoUpdater\.autoDownload = false/);+ assert.match(updaterSource, /autoUpdater\.autoInstallOnAppQuit = false/);+ assert.match(updaterSource, /autoUpdater\.autoDownload = mode === "in-app"/);+ assert.match(updaterSource, /autoUpdater\.autoInstallOnAppQuit = mode === "in-app"/);+ assert.match(updaterSource, /this\.applyPreference\(preference, false\)/);+ assert.match(updaterSource, /manualReminderTracker/);+ assert.match(updaterSource, /applyPreference\(this\.preference, false\)/);+ assert.match(updaterSource, /resolveStoredUpdatePreference/);+ assert.match(updaterSource, /if \(!preferenceChanged\) return/);assert.match(updaterSource,/allowPrerelease = false/,@@ -176,8 +178,11 @@ test("renderer exposes the updates API, banner and settings row", () => {assert.match(bannerSource, /releaseNotes/);assert.match(bannerSource, /availableVersion}:\$\{update\.status/);assert.match(bannerSource, /className="update-notice"/);+ assert.match(bannerSource, /manualReminder === true/);assert.match(bannerSource, /role="progressbar"/);- assert.match(settingsSource, /<UpdatesRow currentVersion=/);+ assert.match(settingsSource, /<UpdatesRow[\s\S]*currentVersion=\{version\?\.version\}/);+ assert.match(settingsSource, /settings=\{settings\}/);+ assert.match(settingsSource, /saveSettings=\{saveSettings\}/);assert.match(settingsSource, /update-settings-notes/);assert.match(settingsSource, /updates\.whatsNew/);assert.match(settingsSource, /updates\.releaseNotes/);@@ -221,6 +226,13 @@ test("check-for-updates is reachable from the application menu", () => {"closeReleaseNotes","currentBadge","availableBadge",+ "preferenceTitle",+ "preferenceDesc",+ "automatic",+ "manual",+ "automaticUnsupported",+ "automaticPortableWarning",+ "preferenceSaveFailed",]) {assert.match(source, new RegExp(`${key}:`), key);}diff --git a/apps/desktop/test/update-preference.test.mjs b/apps/desktop/test/update-preference.test.mjsnew file mode 100644index 000000000..f192b71ed--- /dev/null+++ b/apps/desktop/test/update-preference.test.mjs@@ -0,0 +1,86 @@+import assert from "node:assert/strict";+import test from "node:test";+import { dirname, join } from "node:path";+import { register } from "node:module";+import { fileURLToPath, pathToFileURL } from "node:url";+import { readFile } from "node:fs/promises";++const here = dirname(fileURLToPath(import.meta.url));+register(pathToFileURL(join(here, "helpers/ts-import-hooks.mjs")));++const [+ policy,+ reminders,+ settingsPreference,+ updateSettingsSource,+ updateBannerSource,+] = await Promise.all([+ import("../electron/main/update-policy.ts"),+ import("../electron/main/manual-update-reminder.ts"),+ import("../src/features/settings/update-preference.ts"),+ readFile(new URL("../src/features/settings/agent-sections.tsx", import.meta.url), "utf8"),+ readFile(new URL("../src/components/UpdateBanner.tsx", import.meta.url), "utf8"),+]);++const {+ resolveDefaultUpdatePreference,+ resolveEffectiveUpdatePreference,+ resolveStoredUpdatePreference,+ resolveUpdateMode,+} = policy;+const { ManualUpdateReminderTracker } = reminders;+const { persistUpdatePreference } = settingsPreference;++ test("installed builds keep automatic by default while portable and ZIP builds default to manual", () => {+ assert.equal(resolveDefaultUpdatePreference("win32", true, {}, "installed"), "automatic");+ assert.equal(resolveDefaultUpdatePreference("win32", true, {}, "zip"), "manual");+ assert.equal(+ resolveDefaultUpdatePreference("win32", true, { PORTABLE_EXECUTABLE_FILE: "PI-Desktop.exe" }),+ "manual",+ );+ assert.equal(resolveDefaultUpdatePreference("darwin", true), "automatic");+ assert.equal(resolveDefaultUpdatePreference("linux", true, { APPIMAGE: "/tmp/app.AppImage" }), "automatic");+ assert.equal(resolveDefaultUpdatePreference("linux", true, {}), "manual");+});++test("unset preferences use package defaults and unsupported automatic preferences fail safe", () => {+ assert.equal(resolveStoredUpdatePreference(undefined, "automatic"), "automatic");+ assert.equal(resolveStoredUpdatePreference("manual", "automatic"), "manual");+ assert.equal(resolveStoredUpdatePreference("invalid", "manual"), "manual");+ assert.equal(resolveEffectiveUpdatePreference("automatic", false), "manual");+ assert.equal(resolveEffectiveUpdatePreference("automatic", true), "automatic");+});++test("manual preference disables in-app delivery and explicit automatic restores supported delivery", () => {+ assert.equal(resolveUpdateMode("win32", true, {}, "installed", "manual"), "manual");+ assert.equal(resolveUpdateMode("win32", true, {}, "zip"), "manual");+ assert.equal(resolveUpdateMode("win32", true, {}, "zip", "automatic"), "in-app");+ assert.equal(resolveUpdateMode("darwin", true, {}, undefined, "automatic"), "in-app");+ assert.equal(resolveUpdateMode("linux", true, {}, undefined, "automatic"), "manual");+ assert.equal(resolveUpdateMode("win32", false, {}, undefined, "automatic"), "disabled");+});++test("manual update reminder is persisted once per version and stays visible only in the current run", () => {+ const firstRun = new ManualUpdateReminderTracker();+ assert.deepEqual(firstRun.observe("0.15.9"), { show: true, persist: true });+ assert.deepEqual(firstRun.observe("0.15.9"), { show: true, persist: false });++ const afterRestart = new ManualUpdateReminderTracker("0.15.9");+ assert.deepEqual(afterRestart.observe("0.15.9"), { show: false, persist: false });+ assert.deepEqual(afterRestart.observe("0.15.10"), { show: true, persist: true });+});++test("Settings → Info saves only valid automatic/manual preferences", async () => {+ const writes = [];+ const saveSettings = async (patch) => writes.push(patch);+ assert.equal(await persistUpdatePreference("manual", saveSettings), true);+ assert.equal(await persistUpdatePreference("automatic", saveSettings), true);+ assert.equal(await persistUpdatePreference("disabled", saveSettings), false);+ assert.deepEqual(writes, [+ { updatePreference: "manual" },+ { updatePreference: "automatic" },+ ]);+ assert.match(updateSettingsSource, /<SettingsMenuSelect/);+ assert.match(updateSettingsSource, /persistUpdatePreference\(value, saveSettings\)/);+ assert.match(updateBannerSource, /manualReminder === true/);+});diff --git a/crates/host-core/src/rpc/mod.rs b/crates/host-core/src/rpc/mod.rsindex 16d6c7149..293974441 100644--- a/crates/host-core/src/rpc/mod.rs+++ b/crates/host-core/src/rpc/mod.rs@@ -897,6 +897,31 @@ fn validate_settings_value(value: &Value) -> Result<(), JsonRpcError> {return Err(rpc_err(1002, message, "INVALID_PARAMS"));}}+ if let Some(preference) = object.get("updatePreference") {+ if !matches!(preference.as_str(), Some("automatic") | Some("manual")) {+ return Err(rpc_err(+ 1002,+ "updatePreference must be automatic or manual",+ "INVALID_PARAMS",+ ));+ }+ }+ if let Some(version) = object.get("lastNotifiedUpdateVersion") {+ let Some(version) = version.as_str() else {+ return Err(rpc_err(+ 1002,+ "lastNotifiedUpdateVersion must be a non-empty string",+ "INVALID_PARAMS",+ ));+ };+ if version.trim().is_empty() || version.len() > 128 {+ return Err(rpc_err(+ 1002,+ "lastNotifiedUpdateVersion must contain 1 to 128 characters",+ "INVALID_PARAMS",+ ));+ }+ }if let Some(infinite_retry) = object.get("infiniteProviderRetry") {if !infinite_retry.is_boolean() {return Err(rpc_err(@@ -9059,3 +9084,29 @@ mod image_generation_settings_tests {}}}++#[cfg(test)]+mod update_settings_tests {+ use super::*;++ #[test]+ fn validates_update_preference_and_reminder_version() {+ for value in [+ json!({}),+ json!({"updatePreference": "automatic"}),+ json!({"updatePreference": "manual"}),+ json!({"lastNotifiedUpdateVersion": "0.15.9"}),+ ] {+ assert!(validate_settings_value(&value).is_ok(), "{value}");+ }+ for value in [+ json!({"updatePreference": "sometimes"}),+ json!({"updatePreference": null}),+ json!({"lastNotifiedUpdateVersion": " "}),+ json!({"lastNotifiedUpdateVersion": 12}),+ json!({"lastNotifiedUpdateVersion": "x".repeat(129)}),+ ] {+ assert!(validate_settings_value(&value).is_err(), "{value}");+ }+ }+}diff --git a/docs/adr/0022-application-update-delivery.md b/docs/adr/0022-application-update-delivery.mdindex 83de9fe8d..bb1d64918 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 / D603 / ADR 0197, D450 / ADR 0289)+- Status: Accepted (amended by D364 / D603 / D628 / ADR 0197, D450 / ADR 0289; issue #1098)- Date: 2026-07-26- Deciders: PI-Desktop core-- Related: D120, D126, D364, D603, D010, D450, ADR 0021, ADR 0197, ADR 0289+- Related: D120, D126, D364, D603, D628, D010, D450, ADR 0021, ADR 0197, ADR 0289## Context@@ -104,3 +104,20 @@ baselines for the next differential update. The defaultcache location remains unchanged unless the variable is set. Main does not writeto the installation directory: the NSIS script still writes its `installer.exe`baseline to `%LOCALAPPDATA%`, which Main adopts on the next launch.+++## Amendment (D628)++Settings → Info exposes a persisted per-install `updatePreference` with+`automatic` and `manual` values. Automatic preserves the existing in-app+installer lane. Manual continues stable-release checks but disables automatic+download and install-on-quit, and raises one reminder per discovered version.+The last reminded version is stored in the existing Host-owned app settings+JSON and is intentionally omitted from portable configuration sync.++Installed Windows NSIS, packaged macOS, and Linux AppImage default to Automatic.+Windows ZIP/portable packages default to Manual; opting into Automatic is+available on supported Windows packages only after the UI warns that NSIS may+replace the extracted no-install copy. Unsupported installer formats remain+Manual. This additive setting requires no database schema or host protocol+version change.diff --git a/docs/spec/03-runtime/07-process-model.md b/docs/spec/03-runtime/07-process-model.mdindex 59b0b9205..e1117741b 100644--- a/docs/spec/03-runtime/07-process-model.md+++ b/docs/spec/03-runtime/07-process-model.md@@ -303,11 +303,17 @@ the next launch rather than changing the NSIS installer or writing intopure-JS helpers it calls without changing process or protocol ownership- renderer dependencies ship through Vite output rather than duplicate rawpackage trees; no interactive PTY native module is packaged-- packaged builds use the Main-owned update controller. macOS, non-AppImage- Linux, and Windows ZIP runs are manual-delivery modes; legacy Windows- portable executables remain manual when `PORTABLE_EXECUTABLE_FILE` is set.- Windows NSIS and Linux AppImage use the in-app feeds published by D126 tag- releases+- packaged builds use the Main-owned update controller and a persisted+ per-install `updatePreference`. Automatic mode keeps the existing in-app+ download/install flow on supported packages; Manual mode checks the fixed+ stable feed without starting downloads or installing on quit, and reminds+ once per available version. Defaults are Automatic for Windows NSIS,+ packaged macOS, and Linux AppImage; Windows ZIP/portable and packages without+ automatic-install support default to Manual. Windows ZIP/portable users can+ explicitly opt into Automatic after a warning that the NSIS installer may+ replace the extracted copy. Preference and last-reminded version use the+ existing host-owned app settings JSON; neither is included in portable+ configuration sync.## 7. Remote target topology (post-MVP)diff --git a/docs/spec/04-ux/09-interaction-patterns.md b/docs/spec/04-ux/09-interaction-patterns.mdindex 68ca8db77..6d29ffbcf 100644--- a/docs/spec/04-ux/09-interaction-patterns.md+++ b/docs/spec/04-ux/09-interaction-patterns.md@@ -574,20 +574,26 @@ 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 (non-AppImage Linux and Windows ZIP runs, or legacy Windows- portable runs with `PORTABLE_EXECUTABLE_FILE`) stops at `available` and- 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.+- Settings → Info adds a persisted Automatic / Manual update preference.+ Automatic preserves the existing in-app flow where supported; Manual keeps+ scheduled checks but never starts an automatic download or install-on-quit.+ Installed Windows NSIS, packaged macOS, and Linux AppImage default to+ Automatic. Windows ZIP/portable defaults to Manual, with a warning before an+ explicit Automatic opt-in; packages without an automatic installer remain+ Manual.+- Manual mode raises one ambient reminder for each newly available version.+ The last reminded version is Host-persisted, so repeated checks, dismissal,+ route remounts, and app restarts do not re-announce that version. Settings →+ 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`.-- A compact update notice appears in the main pane's top-right safe area only- for manual `available`, in-app `downloading`, or `downloaded`. It stays clear- of the bottom composer at every supported window size and draft height. The- notice uses a stable icon/title/message hierarchy, shows determinate download- progress when available, and keeps the relevant action inside the same- surface. Dismissal suppresses the current version-and-status stage; a later- stage such as `downloaded` appears again.+- A compact update notice appears in the main pane's top-right safe area for+ the one-time manual reminder, in-app `downloading`, or `downloaded`. It stays+ clear of the bottom composer at every supported window size and draft height.+ The notice uses a stable icon/title/message hierarchy, shows determinate+ download progress when available, and keeps the relevant action inside the+ same surface. Dismissal remains local to the current renderer session; the+ persisted version marker prevents the same manual reminder from returning.- When Main attaches localized product notes for the discovered version(`UpdateState.releaseNotes`, D164), the notice and Settings → Info Updatesrow show a compact "What's new" list under the status message. Notes comediff --git a/docs/spec/06-delivery/04-e2e-test-plan.md b/docs/spec/06-delivery/04-e2e-test-plan.mdindex 1b3a1a825..50b673406 100644--- a/docs/spec/06-delivery/04-e2e-test-plan.md+++ b/docs/spec/06-delivery/04-e2e-test-plan.md@@ -8558,7 +8558,7 @@ must keep splitting are covered by `markdown-blocks.test.mjs`.| G — Plugins | E2E-022, E2E-022A, E2E-022B, E2E-022C, E2E-023, E2E-024, E2E-024B, E2E-024C, E2E-024D, E2E-024AA, E2E-024E, E2E-024W, E2E-024F, E2E-024G, E2E-024H, E2E-024I, E2E-024J, E2E-024K, E2E-024L, E2E-024M, E2E-024N, E2E-024O, E2E-024P, E2E-025, E2E-026, E2E-105, E2E-117, E2E-120, E2E-122, E2E-123, E2E-024Q, E2E-148, E2E-152, E2E-153, E2E-PLUGIN-imported-pi-package-skills, E2E-PLUGIN-imported-pi-package-wrapper, E2E-PLUGIN-import-extension-installs-dependencies, E2E-PLUGIN-import-extension-reports-missing-dependency, E2E-PLUGIN-global-shortcut-owns-only-its-own-command, E2E-PLUGIN-permission-gate-for-real-time-capabilities, E2E-PLUGIN-background-audio-and-realtime-connection, E2E-PLUGIN-fs-root-follows-the-calling-session || H — Diagnostics | E2E-027, E2E-031, E2E-034, E2E-042, E2E-096, E2E-098, E2E-104, E2E-107, E2E-108, E2E-109, E2E-110, E2E-113, E2E-115, E2E-116, E2E-118, E2E-121, E2E-146, E2E-146a, E2E-155, E2E-159, E2E-176, E2E-194, E2E-195 || Security | E2E-028, E2E-029, E2E-030, E2E-024J, E2E-024K, E2E-024M, E2E-049, E2E-068, E2E-086, E2E-102c, E2E-102d, E2E-102e, E2E-105, E2E-106, E2E-107, E2E-108, E2E-109, E2E-110, E2E-112, E2E-113, E2E-115, E2E-116, E2E-117, E2E-119, E2E-121, E2E-122, E2E-123, E2E-142, E2E-148, E2E-151, E2E-153, E2E-158, E2E-187, E2E-196c, E2E-196b, E2E-196, E2E-PLUGIN-fs-root-follows-the-calling-session |-| Quality | E2E-CHAT-running-status-survives-output-pauses, E2E-032, E2E-033, E2E-039, E2E-043, E2E-044, E2E-045, E2E-046, E2E-047, E2E-048, E2E-048A, E2E-049, E2E-050, E2E-053, E2E-055, E2E-056, E2E-057, E2E-058, E2E-059, E2E-060, E2E-061, E2E-062, E2E-063, E2E-064, E2E-065, E2E-066, E2E-067, E2E-068, E2E-069, E2E-070, E2E-071, E2E-072, E2E-073, E2E-074, E2E-075, E2E-076, E2E-077, E2E-078, E2E-079, E2E-080, E2E-081, E2E-082, E2E-083, E2E-084, E2E-085, E2E-086, E2E-092, E2E-093, E2E-094, E2E-095, E2E-096, E2E-097, E2E-098, E2E-099, E2E-100, E2E-101, E2E-102, E2E-102a, E2E-102b, E2E-102c, E2E-102d, E2E-102e, E2E-103, E2E-AGENTS-001, E2E-021a, E2E-024N, E2E-059a, E2E-060b, E2E-060c, E2E-061a, E2E-073a, E2E-111, E2E-114, E2E-117, E2E-118, E2E-119, E2E-120, E2E-122, E2E-123, E2E-142, E2E-143, E2E-144, E2E-145, E2E-146, E2E-147, E2E-148, E2E-150, E2E-151, E2E-153, E2E-155, E2E-158, E2E-159, E2E-160, E2E-161, E2E-162, E2E-163, E2E-168, E2E-172, E2E-173, E2E-174, E2E-011g, E2E-176, E2E-177, E2E-178, E2E-179, E2E-180, E2E-181, E2E-182, E2E-183, E2E-186, E2E-187, E2E-194, E2E-195, E2E-196a, E2E-196b, E2E-196c, E2E-198, E2E-199, E2E-200, E2E-196, E2E-201, E2E-204, E2E-202, E2E-203, E2E-205, E2E-206, E2E-207, E2E-208, E2E-209, E2E-210, E2E-218, E2E-259, E2E-219, E2E-250, E2E-252, E2E-102i, E2E-SUBAGENT-settlement-updates-before-parent-poll, E2E-PLUGIN-imported-pi-package-skills, E2E-PLUGIN-fs-root-follows-the-calling-session, E2E-SUBAGENT-resume-a-settled-delegation |+| Quality | E2E-CHAT-running-status-survives-output-pauses, E2E-032, E2E-033, E2E-039, E2E-043, E2E-044, E2E-045, E2E-046, E2E-047, E2E-048, E2E-048A, E2E-049, E2E-050, E2E-053, E2E-055, E2E-056, E2E-057, E2E-058, E2E-059, E2E-060, E2E-061, E2E-062, E2E-063, E2E-064, E2E-065, E2E-066, E2E-067, E2E-068, E2E-069, E2E-070, E2E-071, E2E-072, E2E-073, E2E-074, E2E-075, E2E-076, E2E-077, E2E-078, E2E-079, E2E-080, E2E-081, E2E-082, E2E-083, E2E-084, E2E-085, E2E-086, E2E-092, E2E-093, E2E-094, E2E-095, E2E-096, E2E-097, E2E-098, E2E-099, E2E-100, E2E-101, E2E-102, E2E-102a, E2E-102b, E2E-102c, E2E-102d, E2E-102e, E2E-103, E2E-AGENTS-001, E2E-021a, E2E-024N, E2E-059a, E2E-060b, E2E-060c, E2E-061a, E2E-073a, E2E-111, E2E-114, E2E-117, E2E-118, E2E-119, E2E-120, E2E-122, E2E-123, E2E-142, E2E-143, E2E-144, E2E-145, E2E-146, E2E-147, E2E-148, E2E-150, E2E-151, E2E-153, E2E-155, E2E-158, E2E-159, E2E-160, E2E-161, E2E-162, E2E-163, E2E-168, E2E-172, E2E-173, E2E-174, E2E-011g, E2E-176, E2E-177, E2E-178, E2E-179, E2E-180, E2E-181, E2E-182, E2E-183, E2E-186, E2E-187, E2E-194, E2E-195, E2E-196a, E2E-196b, E2E-196c, E2E-198, E2E-199, E2E-200, E2E-196, E2E-201, E2E-204, E2E-202, E2E-203, E2E-205, E2E-206, E2E-207, E2E-208, E2E-209, E2E-210, E2E-UPDATE-preference-and-once-only-reminder, E2E-218, E2E-259, E2E-219, E2E-250, E2E-252, E2E-102i, E2E-SUBAGENT-settlement-updates-before-parent-poll, E2E-PLUGIN-imported-pi-package-skills, E2E-PLUGIN-fs-root-follows-the-calling-session, E2E-SUBAGENT-resume-a-settled-delegation || Quality (project ordering) | E2E-253 || C — Conversation & stream (IME slash alias) | E2E-255 || E — Tools & permissions (Skill residency) | E2E-254 |@@ -8610,7 +8610,7 @@ must keep splitting are covered by `markdown-blocks.test.mjs`.| M2 (IME slash alias) | E2E-255 || M5 (Skill residency) | E2E-254 || M6 | E2E-104, E2E-105, E2E-106, E2E-107, E2E-108, E2E-109, E2E-110, E2E-111, E2E-112, E2E-113, E2E-114, E2E-115, E2E-116, E2E-117, E2E-118, E2E-119, E2E-120, E2E-103, E2E-172 |-| M6+ | E2E-121, E2E-122, E2E-148, E2E-150, E2E-151, E2E-154, E2E-155, E2E-158, E2E-159, E2E-160, E2E-161, E2E-162, E2E-163, E2E-166, E2E-168, E2E-173, E2E-174, E2E-176, E2E-179, E2E-196a, E2E-196b, E2E-196c, E2E-198, E2E-199, E2E-200, E2E-202, E2E-203, E2E-205, E2E-209, E2E-210, E2E-212, E2E-213, E2E-214, E2E-215, E2E-216, E2E-217, E2E-218, E2E-259, E2E-219, E2E-257, E2E-SUBAGENT-settlement-updates-before-parent-poll, E2E-PLUGIN-fs-root-follows-the-calling-session, E2E-SUBAGENT-resume-a-settled-delegation |+| M6+ | E2E-121, E2E-122, E2E-148, E2E-150, E2E-151, E2E-154, E2E-155, E2E-158, E2E-159, E2E-160, E2E-161, E2E-162, E2E-163, E2E-166, E2E-168, E2E-173, E2E-174, E2E-176, E2E-179, E2E-196a, E2E-196b, E2E-196c, E2E-198, E2E-199, E2E-200, E2E-202, E2E-203, E2E-205, E2E-209, E2E-210, E2E-UPDATE-preference-and-once-only-reminder, E2E-212, E2E-213, E2E-214, E2E-215, E2E-216, E2E-217, E2E-218, E2E-259, E2E-219, E2E-257, E2E-SUBAGENT-settlement-updates-before-parent-poll, E2E-PLUGIN-fs-root-follows-the-calling-session, E2E-SUBAGENT-resume-a-settled-delegation || M6+ (Session Orchestrator) | E2E-PLUGIN-session-orchestrator-real-workers || M6+ (Selected model order) | E2E-MODEL-selected-order-persists || M6+ (Session list responsiveness) | E2E-SESSION-list-refresh-keeps-desktop-responsive |@@ -12240,14 +12240,17 @@ are withdrawn with ADR 0165.portable ZIP to a user-writable directory without running the NSIS installer.3) Launch the extracted `PI-Desktop.exe`. 4) Confirm there is noadministrator prompt and that the running app has the PI-Desktop icon and- taskbar entry. 5) Invoke Check for Updates. 6) Confirm Settings → Info offers- the releases page rather than Restart to update. 7) Quit and relaunch the+ taskbar entry. 5) Open Settings → Info and confirm Manual is selected by+ default; briefly select Automatic to inspect its replacement warning, then+ restore Manual. 6) Invoke Check for Updates. 7) Confirm Settings → Info offers+ the releases page rather than Restart to update. 8) Quit and relaunch theextracted executable.- **Expected**: Both Windows artifacts are space-free and uploaded. `latest.yml`points at the NSIS installer only. The extracted ZIP app starts without asetup wizard or administrator prompt, keeps the normal PI-Desktop taskbaridentity/icon, uses the existing application data directory, and reports- update mode `manual`. An available update does not download or run+ update preference `manual` by default and effective update mode `manual`.+ An available update does not download or run`PI-Desktop-Setup-<version>.exe`. Relaunch restores sessions from that sameprofile.- **Specs linked**: `01-product/01-product-scope.md`,@@ -12258,6 +12261,37 @@ are withdrawn with ADR 0165.- **Status**: Unit/source-contract covered (`auto-update.test.mjs`); nativeWindows launch remains runner validation (run only in a capable environment when this surface changes)+#### E2E-UPDATE-preference-and-once-only-reminder++- **Preconditions**: A disposable packaged profile on a supported automatic+ installer lane and a Windows portable ZIP profile. The update discovery path+ can provide the same stable available version across repeated checks without+ running a production installer.+- **Steps**: 1) Open Settings → Info on the installed package and confirm+ Automatic is selected by default. 2) Choose Manual, close/reopen Settings,+ then restart the app and confirm Manual persists. 3) Surface one available+ stable version; verify no download/install starts and one notice appears.+ Dismiss it, navigate away and back, repeat the check, then restart and check+ again. 4) Confirm the same version does not raise another notice, while the+ Settings row still shows it and opens Releases. 5) Select Automatic and+ confirm the existing in-app download/install behavior resumes. 6) Launch the+ portable ZIP profile and confirm Manual is the default; inspect the warning+ before explicitly selecting Automatic.+- **Expected**: The preference persists per installation. Manual performs+ discovery only and stores the last reminded version so repeated checks and+ app restarts do not repeat the notice; the Info row remains actionable.+ Automatic retains the existing installer behavior where supported. ZIP and+ legacy portable builds default to Manual, and Automatic is an explicit,+ warned opt-in that can replace the extracted copy with NSIS.+- **Specs linked**: `03-runtime/07-process-model.md`,+ `04-ux/09-interaction-patterns.md`, ADR 0022 / D628+- **Acceptance**: Quality (settings interaction and release safety)+- **Milestone**: M6++- **Status**: Setting selection/persistence covered by+ `pnpm test:e2e:settings-scroll`; mode/reminder policy covered by+ `update-preference.test.mjs`. Packaged Windows installer journey remains+ runner validation.+#### E2E-213: The first Composer model menu paint keeps configured aliases- **Preconditions**: A runnable provider has at least one configured model withdiff --git a/docs/spec/08-meta/decisions-log.md b/docs/spec/08-meta/decisions-log.mdindex 2deebf421..0c0cdcd5e 100644--- a/docs/spec/08-meta/decisions-log.md+++ b/docs/spec/08-meta/decisions-log.md@@ -351,7 +351,8 @@ Gold source: local Codex electron captures; latest row wins where rows conflict.| ID | Topic | Decision | Rationale ||---|---|---|---|| D118 | Platform application menu and window chrome | **macOS installs a conventional system application menu and keeps hidden-inset traffic lights. Windows/Linux use the shared 46px frameless shell with localized File/Edit/View/Window/Help menus and renderer-drawn minimize/maximize-or-restore/close controls. Both menu surfaces route renderer-owned actions through a fixed `AppMenuCommand` allowlist; renderer menus route native editing/window actions through a separate fixed allowlist. Target packaging builds the local release host before Electron packaging. This adds platform-ready shell behavior but does not reverse D010: Windows/Linux release qualification remains post-MVP.** | A default Electron menu leaves macOS shell commands incomplete, while a frameless Windows/Linux window otherwise loses both application menus and window controls. Shared allowlists keep behavior consistent without exposing an arbitrary privileged command bridge. |-| D120 | Application update delivery | *(amended by D364 / D603)* **Electron Main exclusively owns a fixed GitHub Releases feed, update polling, typed state, and install lifecycle. Development is disabled; packaged macOS and non-AppImage Linux use notify-and-link delivery, while Windows NSIS and Linux AppImage download in-app and install on quit. Renderer IPC cannot provide feed URLs. Automatic failures stay ambient, explicit checks surface status, and downloaded state remains actionable. The updater always forces `allowPrerelease = false` so prerelease installs (for example `0.2.0-rc.6`) track GitHub's latest stable release instead of electron-updater's default same-channel pin. D126 later publishes every platform feed produced by the tag matrix while macOS remains manual until a signed channel is qualified.** | Keep package installation outside the sandboxed renderer, match delivery to each installer format, and provide one consistent state across menus, Settings, and the update banner (ADR 0022). Without the stable-channel pin, RC builds never surface newer stables because electron-updater treats `rc` as a custom channel. |+| D120 | Application update delivery | *(amended by D364 / D603 / D628)* **Electron Main exclusively owns a fixed GitHub Releases feed, update polling, typed state, and install lifecycle. Development is disabled; packaged macOS and non-AppImage Linux use notify-and-link delivery, while Windows NSIS and Linux AppImage download in-app and install on quit. Renderer IPC cannot provide feed URLs. Automatic failures stay ambient, explicit checks surface status, and downloaded state remains actionable. The updater always forces `allowPrerelease = false` so prerelease installs (for example `0.2.0-rc.6`) track GitHub's latest stable release instead of electron-updater's default same-channel pin. D126 later publishes every platform feed produced by the tag matrix while macOS remains manual until a signed channel is qualified.** | Keep package installation outside the sandboxed renderer, match delivery to each installer format, and provide one consistent state across menus, Settings, and the update banner (ADR 0022). Without the stable-channel pin, RC builds never surface newer stables because electron-updater treats `rc` as a custom channel. |+| D628 | User-selectable application update behavior | **Amend D120 / D603 / ADR 0022: persist a per-install `AppSettings.updatePreference` (`automatic` or `manual`). Automatic preserves the existing in-app download/install behavior; it is available only where the platform supports installation. Manual disables automatic download/install-on-quit, keeps scheduled stable-release checks, and reminds once per available version. `lastNotifiedUpdateVersion` persists in the existing Host-owned app settings; neither field is included in portable configuration sync. Default Automatic for Windows NSIS, packaged macOS, and Linux AppImage; default Manual for Windows ZIP/portable and non-AppImage Linux. Windows ZIP/portable can explicitly select Automatic after a warning that NSIS may replace the extracted no-install copy. No database schema or host protocol version bump.** | Give users control while preserving a safe default for no-install packages and preventing repeated notices. || D313 | Main-owned GitHub issue feedback | **GitHub issue forms are the only intake path. The bug form requires description, reproduction steps, expected and actual behavior, app version, and OS; the feature form requires a problem and a proposed change. Settings → Info exposes one Report a problem action on `pi-desktop/app/openFeedback`. Electron Main builds a fixed `bug_report.yml` URL, prefills `app-version` / `os` / `environment` from Main-owned version info, and opens it with `shell.openExternal`. The renderer cannot supply a URL. Feature requests stay on GitHub's template picker. No host-protocol, storage, or update-feed change (ADR 0157).** | Reports without version or steps cannot be triaged, and a renderer-chosen destination would weaken the same Main-owned GitHub URL rule as D120. || D330 | Main-owned `openExternal` protocol allowlist | **Every `shell.openExternal` call parses the URL first. Only `http:`, `https:` (hostname plus a written `//`), and `mailto:` (non-empty address) reach the OS, as a normalized href. `file:`, `javascript:`, `data:`, and custom URI schemes throw `DISALLOWED_EXTERNAL_URL` / plugin `INVALID_ARGUMENT`. Window-open handlers deny in-app and catch the error. Workspace files keep using `shell.openPath` after the path gate (ADR 0109). Preview "open in browser" uses the allowlist for web/mail URLs and `openPath` for an in-root file page (ADR 0168).** | Unvalidated `setWindowOpenHandler` → `openExternal` lets a clicked `ms-msdt:` / `file:` / custom-scheme link invoke an OS protocol handler. || D332 | Classified plugin file preview and live workspace events | **Amend ADR 0104 / 0105 / 0109 / 0111: add `fs.readPreview` under `fs.read` (text / image data URL / binary / tooLarge, same caps as the host Files tab). Broadcast panel events to docked views as well as detached windows. Deliver `workspace:changed` to panels and plugin processes. The bundled Files view restores Open with default app, search, image preview, and copy path on those public channels.** | `fs.readText` cannot preview images or cap large binaries; docked views missed `appearance:changed`; Files polled for project switches. |@@ -467,7 +468,7 @@ section mirrors only marketplace/catalog items still blocking nothing.|---|---|---|---|| D126 | Three-platform release delivery (lifts D010) | *(amended by D364 / D603)* **Tag builds publish every artifact the matrix produces to the GitHub Release: macOS dmg/zip (arm64), Windows NSIS x64, Linux AppImage + deb (x64), each with blockmaps and the platform's `latest*.yml` electron-updater feed. Publishing the feeds activates D120's in-app update lanes for Windows NSIS and Linux AppImage; macOS stays in notify-and-link mode until a signed channel is qualified. The NSIS artifact name is pinned space-free (`PI-Desktop-Setup-${version}.${ext}`) because GitHub asset URLs mangle spaces. D010's macOS-only scope is lifted per the baseline-bump rule (baseline `0.4.7`); the release pipeline itself was qualified end-to-end on v0.1.1-rc.1/v0.1.1.** | The pipeline builds and validates all three platforms on every tag anyway; keeping installers as expiring Actions artifacts (90-day retention) withheld them from users without adding safety. Publishing the update feeds is the point of shipping: platforms with in-app lanes update silently, and future platform regressions surface through real installs instead of unused artifacts. || D364 | Windows portable exe without installer | *(superseded by D603)* **Amend D120 / D126 / ADR 0022: tag builds publish a Windows x64 portable exe `PI-Desktop-Portable-${version}.exe` alongside the NSIS installer `PI-Desktop-Setup-${version}.exe`. The portable target does not write `latest.yml`. Packaged portable runs (`PORTABLE_EXECUTABLE_FILE`) use notify-and-link delivery. NSIS installs keep in-app download and quit-and-install. Data stays in the existing application data directory. Portable requests user execution level.** | Company environments that whitelist a single executable cannot run the NSIS installer. Applying the NSIS updater to a portable run would install the app, so portable stays manual (ADR 0197, E2E-211). |-| D603 | Windows portable delivery uses a normal ZIP | **Amend D364 / ADR 0022 / ADR 0197: tag builds publish a Windows x64 portable ZIP `PI-Desktop-Portable-${version}.zip` alongside the NSIS installer `PI-Desktop-Setup-${version}.exe`. The Windows release helper builds NSIS and ZIP separately, stamps ZIP app metadata with `piDistribution = "zip"`, and keeps the ZIP target out of `latest.yml`. Extracted ZIP runs use notify-and-link delivery; the updater still recognizes `PORTABLE_EXECUTABLE_FILE` for older portable executables. Data stays in the existing application data directory.** | The self-extracting portable wrapper could trigger administrator prompts and did not provide a reliable normal executable identity for the taskbar. A user-extracted ZIP launches `PI-Desktop.exe` directly and preserves the manual-update boundary. |+| D603 | Windows portable delivery uses a normal ZIP | *(amended by D628)* **Amend D364 / ADR 0022 / ADR 0197: tag builds publish a Windows x64 portable ZIP `PI-Desktop-Portable-${version}.zip` alongside the NSIS installer `PI-Desktop-Setup-${version}.exe`. The Windows release helper builds NSIS and ZIP separately, stamps ZIP app metadata with `piDistribution = "zip"`, and keeps the ZIP target out of `latest.yml`. Extracted ZIP runs use notify-and-link delivery; the updater still recognizes `PORTABLE_EXECUTABLE_FILE` for older portable executables. Data stays in the existing application data directory.** | The self-extracting portable wrapper could trigger administrator prompts and did not provide a reliable normal executable identity for the taskbar. A user-extracted ZIP launches `PI-Desktop.exe` directly and preserves the manual-update boundary. || D260 | Release documentation is a version surface | **A stable version bump must update every version-bearing surface before the tag: the shipped-locale in-app changelog and its test list, every workspace `package.json` including `docs/package.json` (a third workspace root `scripts/release.mjs` previously skipped), the Cargo workspace version and `host-core` lockfile entry, `APP_VERSION`, and the `<major>.<minor>.x` release line stated in `README.md` and `README.zh-CN.md`. `scripts/check-release-docs.mjs` verifies all of them; `scripts/release.mjs` runs it after bumping and refuses to commit or tag while any surface disagrees, with `--skip-docs-check` reserved for deliberate non-release bumps. Extends D164.** | The in-app changelog gate alone left published documentation behind: the READMEs still advertised the `0.5.x` line at `0.10.8`, and `docs/package.json` sat at `0.5.8`. A tag is irreversible, so the check runs before the tag exists rather than as review etiquette. || D371 | Explicit unsigned macOS first-launch helper | *(amended by D406 and D443)* **Every macOS distribution ships an executable `PI-Desktop-macOS-open.command`, placed on the DMG in a visible first-launch row below the drag-to-Applications gesture. It searches only `/Applications/PI-Desktop.app` and `~/Applications/PI-Desktop.app`, verifies `CFBundleIdentifier` is `net.aiuo.pi-desktop`, removes only `com.apple.quarantine` when present, and opens the app. It never uses `sudo`, accepts no arbitrary path, and does not replace Developer ID signing or notarization.** | The unsigned macOS lane can be blocked by quarantine with a misleading damaged-app message, and the terminal-only `xattr -cr` note was broader than the launch failure requires (ADR 0204, E2E-196b) || D443 | Canonical application ID and macOS codesign identifier | **Amend D141 / D371 / ADR 0204: the application ID is `net.aiuo.pi-desktop` (`APP_ID`, electron-builder `appId`, macOS `CFBundleIdentifier`, Windows AppUserModelID). Development macOS hosts use `net.aiuo.pi-desktop.dev`. Do not adhoc-sign the unsigned pack in `afterPack`/`afterSign`: nested Electron helpers are still unsigned and `codesign` fails with `code object is not signed at all`. See ADR 0278 and issue #524.** | The owner domain is `net.aiuo.pi-desktop`. Binding the unsigned outer identifier is deferred until a helper-safe pack path exists. |@@ -7155,3 +7156,19 @@ must keep splitting are covered by `markdown-blocks.test.mjs`.duplicating an id), plus the `scripts/e2e/provider-api-style.tsx` and`scripts/e2e/image-generation-ui.tsx` probes, which no longer click Managemodels.++## 2026-09-26 — User-selectable application update behavior (D628)++- Settings → Info now stores Automatic / Manual per installation. Supported+ installer builds default to Automatic; Windows ZIP/portable packages and+ packages without an automatic-install lane default to Manual. Choosing Manual+ disables automatic download and install-on-quit but keeps scheduled checks.+- Manual mode announces an available version once. Host settings remember the+ last reminded version across restarts; the renderer also suppresses a second+ banner after route remount. The Settings row remains available for checking+ status and opening the fixed Releases page.+- Windows ZIP/portable users may explicitly opt into Automatic only after a+ warning that the NSIS installer can replace the extracted copy. No database+ migration or host protocol version change is required.+- Covered by `apps/desktop/test/update-preference.test.mjs`, the updated+ `apps/desktop/test/auto-update.test.mjs`, and E2E-UPDATE-preference-and-once-only-reminder.diff --git a/docs/zh-CN/spec/03-runtime/07-process-model.md b/docs/zh-CN/spec/03-runtime/07-process-model.mdindex bb2835bd1..dd9a42b66 100644--- a/docs/zh-CN/spec/03-runtime/07-process-model.md+++ b/docs/zh-CN/spec/03-runtime/07-process-model.md@@ -216,10 +216,13 @@ sidecar/host 关闭序列在更新程序替换应用程序之前运行。它调用的纯 JS 助手无需更改进程或协议所有权- 渲染器依赖项通过 Vite 输出传送,而不是重复原始数据包树;桌面包不再携带交互式 PTY 原生模块-- 打包版本使用 Main 拥有的更新控制器。macOS、非 AppImage Linux 和- Windows ZIP 运行为手动交付模式;旧 Windows 便携版 exe 在设置了- `PORTABLE_EXECUTABLE_FILE` 时仍保持手动交付。Windows NSIS 和 Linux- AppImage 使用 D126 标签发布的应用内提要+- 打包版本使用 Main 拥有的更新控制器,并使用按安装实例持久化的+ `updatePreference`。自动模式在受支持的包上保持现有应用内下载/安装流程;手动模式+ 继续检查固定稳定版更新,但不自动下载或退出安装,并对每个可用版本只提醒一次。+ Windows NSIS、已打包 macOS 和 Linux AppImage 默认自动;Windows ZIP/便携版,以及+ 不支持自动安装的包默认手动。Windows ZIP/便携版可在确认 NSIS 可能替换解压副本的+ 警告后明确选择自动。偏好和最近提醒版本保存在 Host 所有的应用设置 JSON 中,且不会+ 进入便携配置同步。## 7. 远程目标拓扑(MVP 后)diff --git a/docs/zh-CN/spec/04-ux/09-interaction-patterns.md b/docs/zh-CN/spec/04-ux/09-interaction-patterns.mdindex f30e81896..b8abd75dd 100644--- a/docs/zh-CN/spec/04-ux/09-interaction-patterns.md+++ b/docs/zh-CN/spec/04-ux/09-interaction-patterns.md@@ -467,16 +467,18 @@- 设置 → 信息和应用程序菜单检查共享一种类型的更新状态。手动检查公开最新或错误反馈;自动故障不会打开 Toast 或环境横幅。-- 手动交付(非 AppImage Linux、Windows ZIP,以及带有 `PORTABLE_EXECUTABLE_FILE` 的旧 Windows 便携版运行)在 `available` 停止,并提供固定的 GitHub 发布页面。应用内交付(打包的 macOS、Windows NSIS 和 Linux AppImage)自动推进 `downloading` 到稳定的 `downloaded` 状态。+- 设置 → 关于新增按安装实例保存的「自动 / 手动」更新方式。自动模式在受支持的包上+ 保持现有应用内流程;手动模式继续定期检查,但不自动下载或退出安装。Windows NSIS、+ 已打包 macOS 和 Linux AppImage 默认自动。Windows ZIP/便携版默认手动;明确选择自动+ 前会提示 NSIS 可能替换解压目录中的副本。不支持自动安装的包始终保持手动。+- 手动模式对每个新版本只显示一次环境横幅。Host 持久化最近提醒的版本,因此重复检查、+ 关闭/重开窗口和应用重启都不会重复提示;设置 → 关于仍显示可用版本与发布页入口。- `downloaded` 保持可操作状态,直至重新启动更新或正常应用退出;稍后的 scheduled/manual 检查不会将其替换为 `checking`。-- 紧凑的更新通知仅出现在主窗格的右上角安全区域中- 适用于手动 `available`、应用内 `downloading` 或 `downloaded`。它保持清晰- 每个受支持的窗口大小和草稿高度的底部编辑器。的- 通知使用稳定的 icon/title/message 层次结构,显示确定的下载- 可用时取得进展,并将相关操作保持在同一状态- 表面。解雇会抑制当前版本和状态阶段;稍后- `downloaded` 等阶段再次出现。+- 紧凑更新通知位于主窗格右上角安全区域;手动模式仅显示一次新版本提醒,应用内模式+ 在 `downloading` 或 `downloaded` 时显示。它不会遮挡底部编辑器,且在受支持窗口尺寸与+ 草稿高度下保持可见。通知使用稳定的图标/标题/消息层次,下载期间显示进度,并将操作+ 放在同一表面。手动提醒的已提醒版本跨重启保留;后续安装阶段仍可再次显示。- 当 Main 附加发现版本的本地化产品说明时(`UpdateState.releaseNotes`,D164),通知和设置→信息更新行在状态消息下显示紧凑的“新增内容”列表。笔记来了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 8eb3b1489..13730f607 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@@ -5386,7 +5386,7 @@ eleven-tool-round desktop paths are verified by| G——插件 | E2E-022、E2E-022A、E2E-022B、E2E-022C、E2E-023、E2E-024、E2E-024B、E2E-024C、E2E-024D、E2E-024AA、E2E-024E、E2E-024W、E2E-024F、E2E-024G、E2E-024H、 E2E-024I、E2E-024J、E2E-024K、E2E-024L、E2E-024M、E2E-024N、E2E-024O、E2E-024P、E2E-025、E2E-026、E2E-105、E2E-117、E2E-120、E2E-122、E2E-123、E2E-148、E2E-153、E2E-PLUGIN-imported-pi-package-skills、E2E-PLUGIN-imported-pi-package-wrapper、E2E-PLUGIN-import-extension-installs-dependencies、E2E-PLUGIN-import-extension-reports-missing-dependency、E2E-PLUGIN-global-shortcut-owns-only-its-own-command、E2E-PLUGIN-permission-gate-for-real-time-capabilities、E2E-PLUGIN-background-audio-and-realtime-connection || H——诊断 | E2E-027、E2E-031、E2E-034、E2E-042、E2E-096、E2E-098、E2E-104、E2E-107、E2E-108、E2E-109、E2E-110、E2E-113、E2E-115、E2E-116、 E2E-118、E2E-121、E2E-146、E2E-194、E2E-195 || 安全性 | E2E-028、E2E-029、E2E-030、E2E-024J、E2E-024K、E2E-024M、E2E-049、E2E-068、E2E-086、E2E-105、E2E-106、E2E-107、E2E-108、E2E-109、 E2E-110、E2E-112、E2E-113、E2E-115、E2E-116、E2E-117、E2E-119、E2E-121、E2E-122、E2E-123、E2E-142、E2E-148、E2E-151、E2E-153 |-| 品质 | E2E-CHAT-running-status-survives-output-pauses、E2E-032、E2E-033、E2E-039、E2E-043、E2E-044、E2E-045、E2E-046、E2E-047、E2E-048、E2E-048A、E2E-049、E2E-050、E2E-053、E2E-055、 E2E-056、E2E-057、E2E-058、E2E-059、E2E-060、E2E-061、E2E-062、E2E-063、E2E-064、E2E-065、E2E-066、E2E-067、E2E-068、E2E-069、 E2E-070、E2E-071、E2E-072、E2E-073、E2E-074、E2E-075、E2E-076、E2E-077、E2E-078、E2E-079、E2E-080、E2E-081、E2E-082、E2E-083、 E2E-084、E2E-085、E2E-086、E2E-092、E2E-093、E2E-094、E2E-095、E2E-096、E2E-097、E2E-098、E2E-099、E2E-100、E2E-101、E2E-102、 E2E-102a、E2E-102b、E2E-103、E2E-AGENTS-001、E2E-024N、E2E-024O、E2E-059a、E2E-060b、E2E-060c、E2E-060d、E2E-061a、E2E-073a、E2E-111、 E2E-114、E2E-117、E2E-118、E2E-119、E2E-120、E2E-122、E2E-123、E2E-142、E2E-143、E2E-144、E2E-145、E2E-146、E2E-147、E2E-148、E2E-150、E2E-151、E2E-153、E2E-194、E2E-195、E2E-199、E2E-200、E2E-201、E2E-202、E2E-203、E2E-204、E2E-209、E2E-210、E2E-250、E2E-PLUGIN-imported-pi-package-skills、E2E-SUBAGENT-resume-a-settled-delegation |+| 品质 | E2E-CHAT-running-status-survives-output-pauses、E2E-032、E2E-033、E2E-039、E2E-043、E2E-044、E2E-045、E2E-046、E2E-047、E2E-048、E2E-048A、E2E-049、E2E-050、E2E-053、E2E-055、 E2E-056、E2E-057、E2E-058、E2E-059、E2E-060、E2E-061、E2E-062、E2E-063、E2E-064、E2E-065、E2E-066、E2E-067、E2E-068、E2E-069、 E2E-070、E2E-071、E2E-072、E2E-073、E2E-074、E2E-075、E2E-076、E2E-077、E2E-078、E2E-079、E2E-080、E2E-081、E2E-082、E2E-083、 E2E-084、E2E-085、E2E-086、E2E-092、E2E-093、E2E-094、E2E-095、E2E-096、E2E-097、E2E-098、E2E-099、E2E-100、E2E-101、E2E-102、 E2E-102a、E2E-102b、E2E-103、E2E-AGENTS-001、E2E-024N、E2E-024O、E2E-059a、E2E-060b、E2E-060c、E2E-060d、E2E-061a、E2E-073a、E2E-111、 E2E-114、E2E-117、E2E-118、E2E-119、E2E-120、E2E-122、E2E-123、E2E-142、E2E-143、E2E-144、E2E-145、E2E-146、E2E-147、E2E-148、E2E-150、E2E-151、E2E-153、E2E-194、E2E-195、E2E-199、E2E-200、E2E-201、E2E-202、E2E-203、E2E-204、E2E-209、E2E-210、E2E-UPDATE-preference-and-once-only-reminder、E2E-250、E2E-PLUGIN-imported-pi-package-skills、E2E-SUBAGENT-resume-a-settled-delegation || 品质(项目排序) | E2E-253 || C — 对话和直播(输入法斜杠别名) | E2E-255 || E——工具和权限(Skill 常驻) | E2E-254 |@@ -5438,7 +5438,7 @@ eleven-tool-round desktop paths are verified by| M2(输入法斜杠别名) | E2E-255 || M5(Skill 常驻) | E2E-254 || M6 | E2E-104、E2E-105、E2E-106、E2E-107、E2E-108、E2E-109、E2E-110、E2E-111、E2E-112、E2E-113、E2E-114、E2E-115、E2E-116、E2E-117、 E2E-118、E2E-119、E2E-120、E2E-103 |-| M6+ | E2E-121、E2E-122、E2E-123、E2E-142、E2E-148、E2E-150、E2E-151、E2E-168、E2E-199、E2E-200、E2E-202、E2E-203、E2E-209、E2E-211、E2E-212、E2E-213、E2E-214、E2E-215、E2E-216、E2E-217、E2E-257、E2E-166、E2E-SUBAGENT-resume-a-settled-delegation |+| M6+ | E2E-121、E2E-122、E2E-123、E2E-142、E2E-148、E2E-150、E2E-151、E2E-168、E2E-199、E2E-200、E2E-202、E2E-203、E2E-209、E2E-211、E2E-UPDATE-preference-and-once-only-reminder、E2E-212、E2E-213、E2E-214、E2E-215、E2E-216、E2E-217、E2E-257、E2E-166、E2E-SUBAGENT-resume-a-settled-delegation || M6+(Session Orchestrator) | E2E-PLUGIN-session-orchestrator-real-workers || M6+(已选模型顺序) | E2E-MODEL-selected-order-persists || M6+(会话列表响应性) | E2E-SESSION-list-refresh-keeps-desktop-responsive |@@ -7248,11 +7248,13 @@ eleven-tool-round desktop paths are verified by有干净用户配置;账户是无需管理员提升的标准用户。- **步骤**:1) 检查发布目录和 `latest.yml`。2) 将便携版 ZIP 解压到用户可写目录,不运行 NSIS 安装程序。3) 启动解压后的 `PI-Desktop.exe`。4) 确认没有管理员提示,- 且运行中的应用显示 PI-Desktop 图标和任务栏入口。5) 调用检查更新。6) 确认设置 → 信息- 提供发布页而不是“重启以更新”。7) 退出并再次启动解压后的可执行文件。+ 且运行中的应用显示 PI-Desktop 图标和任务栏入口。5) 打开设置 → 关于,确认默认选择+ 手动;短暂选择自动并查看替换警告,再恢复手动。6) 调用检查更新。7) 确认设置 → 关于+ 提供发布页而不是“重启以更新”。8) 退出并再次启动解压后的可执行文件。- **预期**:两个 Windows 工件都无空格并已上传。`latest.yml` 只指向 NSIS 安装程序。ZIP 解压后的应用无需安装向导或管理员提示即可启动,保持正常的 PI-Desktop 任务栏- 标识和图标,使用现有应用数据目录,并报告更新模式 `manual`。可用更新不会下载或运行+ 标识和图标,使用现有应用数据目录,并默认选择更新偏好 `manual`、报告有效更新模式+ `manual`。可用更新不会下载或运行`PI-Desktop-Setup-<version>.exe`。再次启动从同一配置恢复会话。- **链接规格**:`01-product/01-product-scope.md`、`06-delivery/06-release-runbook.md`、`03-runtime/07-process-model.md`、@@ -7262,6 +7264,26 @@ eleven-tool-round desktop paths are verified by- **状态**:单元/源合同已覆盖(`auto-update.test.mjs`);本机 Windows 启动仍为运行器验证(除非明确要求,否则不要在本地跑 E2E)+#### E2E-UPDATE-preference-and-once-only-reminder:更新偏好与单次提醒++- **前提条件**:有隔离的打包应用配置(支持自动安装的 Windows NSIS 安装版和+ Windows 便携 ZIP),并可在不运行生产安装程序的情况下让更新发现路径在多次检查中+ 返回同一个稳定版。+- **步骤**:1) 在已安装包中打开设置 → 关于,确认默认选择自动。2) 选择手动,关闭并重新+ 打开设置,再重启应用,确认手动偏好仍保留。3) 让检查发现一个稳定版;确认没有自动下载+ 或安装,只显示一次提醒。关闭提醒、离开再返回,重复检查后重启并再次检查。4) 确认同一+ 版本不会再次提醒,但设置行仍显示版本并可打开发布页。5) 选择自动,确认受支持平台恢复+ 现有应用内下载/安装行为。6) 启动便携 ZIP,确认默认手动;明确选择自动前先查看风险警告。+- **预期**:偏好按安装实例持久化。手动模式只检查,并保存最近提醒版本,避免重复检查和+ 重启后重复提示;关于页中的状态与发布页入口始终可用。自动模式在支持的平台维持现有行为。+ ZIP/便携包默认手动,只有经过带警告的明确选择才可改为自动。+- **链接规格**:`03-runtime/07-process-model.md`、`04-ux/09-interaction-patterns.md`、+ ADR 0022 / D628+- **验收**:质量(设置交互与更新安全)+- **里程碑**:M6++- **状态**:`pnpm test:e2e:settings-scroll` 覆盖设置选择与持久化;+ `update-preference.test.mjs` 覆盖模式/提醒策略。打包 Windows 安装器旅程仍需运行器验证。+#### E2E-201:为已配置模型设置别名并复制模型 id- **前提条件**:已保存一个提供商,至少两个模型绑定,其中至少一个目录发布了显示名。diff --git a/docs/zh-CN/spec/08-meta/decisions-log.md b/docs/zh-CN/spec/08-meta/decisions-log.mdindex bc82d7919..a17e6eacd 100644--- a/docs/zh-CN/spec/08-meta/decisions-log.md+++ b/docs/zh-CN/spec/08-meta/decisions-log.md@@ -353,7 +353,8 @@| 身份证号 | 主题 | 决定 | 基本原理 ||---|---|---|---|| D118 | 平台应用程序菜单和窗口镶边 | **macOS 安装传统的系统应用程序菜单并保留隐藏式交通信号灯。 Windows/Linux 使用共享的 46px 无框架外壳以及本地化的 File/Edit/View/Window/Help 菜单和渲染器绘制的 minimize/maximize-or-restore/close 控件。两个菜单表面都通过固定的 `AppMenuCommand` 允许列表路由渲染器拥有的操作;渲染器菜单通过单独的固定允许列表路由本机 editing/window 操作。目标打包在 Electron 打包之前构建本地发布主机。这增加了平台就绪的 shell 行为,但不会逆转 D010:Windows/Linux 发布资格在 MVP 后仍然有效。** | 默认的 Electron 菜单会使 macOS shell 命令不完整,而无框 Windows/Linux 窗口会丢失应用程序菜单和窗口控件。共享允许列表可以保持行为一致,而不会暴露任意特权命令桥。 |-| D120 | 应用程序更新交付 | *(amended by D364 / D603)* **Electron Main 独家拥有固定的 GitHub 发布源、更新轮询、类型化状态和安装生命周期。开发被禁用;打包的 macOS 和非 AppImage Linux 使用通知和链接传递,而 Windows NSIS 和 Linux AppImage 在应用程序内下载并在退出时安装。 Renderer IPC 无法提供 Feed URL。自动故障保持环境状态,显式检查表面状态,下载状态保持可操作。更新程序始终强制使用 `allowPrerelease = false`,因此预发布安装(例如 `0.2.0-rc.6`)会跟踪 GitHub 的最新稳定版本,而不是 electro-updater 的默认同通道引脚。 D126 随后发布由标签矩阵生成的每个平台提要,而 macOS 仍保持手动状态,直到签名通道合格为止。** | 将软件包安装保持在沙盒渲染器之外,匹配每种安装程序格式的交付,并在菜单、设置和更新横幅之间提供一种一致的状态 (ADR 0022)。如果没有稳定通道引脚,RC 不会构建更新的稳定通道,因为电子更新程序将 `rc` 视为自定义通道。 |+| D120 | 应用程序更新交付 | *(amended by D364 / D603 / D628)* **Electron Main 独家拥有固定的 GitHub 发布源、更新轮询、类型化状态和安装生命周期。开发被禁用;打包的 macOS 和非 AppImage Linux 使用通知和链接传递,而 Windows NSIS 和 Linux AppImage 在应用程序内下载并在退出时安装。 Renderer IPC 无法提供 Feed URL。自动故障保持环境状态,显式检查表面状态,下载状态保持可操作。更新程序始终强制使用 `allowPrerelease = false`,因此预发布安装(例如 `0.2.0-rc.6`)会跟踪 GitHub 的最新稳定版本,而不是 electro-updater 的默认同通道引脚。 D126 随后发布由标签矩阵生成的每个平台提要,而 macOS 仍保持手动状态,直到签名通道合格为止。** | 将软件包安装保持在沙盒渲染器之外,匹配每种安装程序格式的交付,并在菜单、设置和更新横幅之间提供一种一致的状态 (ADR 0022)。如果没有稳定通道引脚,RC 不会构建更新的稳定通道,因为电子更新程序将 `rc` 视为自定义通道。 |+| D628 | 用户可选择应用更新方式 | **修订 D120 / D603 / ADR 0022:`AppSettings.updatePreference` 按安装实例持久化 `automatic` 或 `manual`。自动模式保持现有的应用内下载与安装;仅支持自动安装的平台提供此选项。手动模式不自动下载或退出安装,继续定期检查稳定版,并对每个可用版本提醒一次。`lastNotifiedUpdateVersion` 保存在现有 Host 所有的应用设置中;这两个字段都不参与便携配置同步。Windows NSIS、已打包 macOS、Linux AppImage 默认自动;Windows ZIP/便携版和非 AppImage Linux 默认手动。Windows ZIP/便携版可以在看到 NSIS 可能替换解压副本的警告后明确选择自动。无需数据库 schema 或 Host 协议版本升级。** | 在为用户提供选择的同时,让免安装包默认保持安全并避免重复提醒。 || D313 | 主进程拥有的 GitHub 问题反馈 | **GitHub issue 表单是唯一入口。Bug 表单必填描述、复现步骤、预期/实际行为、应用版本和操作系统;功能表单必填问题和期望改动。设置 → 信息提供一条「问题反馈」,走 `pi-desktop/app/openFeedback`。Electron Main 构造固定的 `bug_report.yml` URL,用主进程版本信息预填 `app-version` / `os` / `environment`,再以 `shell.openExternal` 打开。渲染器不能提供 URL。功能请求仍从 GitHub 模板选择器进入。不改 host 协议、存储或更新源(ADR 0157)。** | 缺少版本或复现步骤的报告无法排查;由渲染器选择目标会削弱 D120 同样的「GitHub URL 归主进程」规则。 || D330 | 由主进程拥有的 openExternal 协议白名单 | **每次 `shell.openExternal` 先解析 URL。只有 `http:`、`https:`(含主机名和写出的 `//`)以及 `mailto:`(非空地址)会以规范化 href 到达操作系统。`file:`、`javascript:`、`data:` 和自定义方案被拒绝。见 ADR 0168。** | 任意协议的 openExternal 会把沙箱渲染器变成打开本地文件或执行脚本的入口。 || D332 | 分类的插件文件预览与实时工作区事件 | **修订 ADR 0104 / 0105 / 0109 / 0111:在 `fs.read` 下增加 `fs.readPreview`(文本 / 图片 data URL / 二进制 / tooLarge,上限与宿主 Files 页相同)。工作区事件同时广播给停靠视图和独立面板。** | 插件需要与 Files 页同类的预览,以及工作区变更的实时信号。 |@@ -468,7 +469,7 @@|---|---|---|---|| D126 | 三平台发布交付(电梯D010) | *(amended by D364 / D603)* **标签构建将矩阵生成的每个工件发布到 GitHub 版本:macOS dmg/zip (arm64)、Windows NSIS x64、Linux AppImage + deb (x64),每个都有块图和平台的 `latest*.yml` 电子更新器提要。发布提要会激活 D120 的 Windows NSIS 和 Linux AppImage 的应用内更新通道; macOS 保持通知和链接模式,直到签名通道合格为止。 NSIS 工件名称固定为无空格 (`PI-Desktop-Setup-${version}.${ext}`),因为 GitHub 资产 URL 会损坏空格。根据基线凹凸规则(基线 `0.4.7`),D010 的仅限 macOS 范围被提升;发布管道本身在 v0.1.1-rc.1/v0.1.1 上通过了端到端合格。** | 无论如何,管道都会在每个标签上构建并验证所有三个平台;将安装程序保留为过期的 Actions 工件(保留 90 天)会阻止用户安装它们,而不会增加安全性。发布更新源是交付的重点:具有应用程序内通道的平台会静默更新,并且未来的平台回归会通过实际安装而不是未使用的工件来呈现。 || D364 | Windows portable exe without installer | *(superseded by D603)* **Amend D120 / D126 / ADR 0022: tag builds publish a Windows x64 portable exe `PI-Desktop-Portable-${version}.exe` alongside the NSIS installer `PI-Desktop-Setup-${version}.exe`. The portable target does not write `latest.yml`. Packaged portable runs (`PORTABLE_EXECUTABLE_FILE`) use notify-and-link delivery. NSIS installs keep in-app download and quit-and-install. Data stays in the existing application data directory. Portable requests user execution level.** | Company environments that whitelist a single executable cannot run the NSIS installer. Applying the NSIS updater to a portable run would install the app, so portable stays manual (ADR 0197, E2E-211). |-| D603 | Windows portable delivery uses a normal ZIP | **Amend D364 / ADR 0022 / ADR 0197: tag builds publish a Windows x64 portable ZIP `PI-Desktop-Portable-${version}.zip` alongside the NSIS installer `PI-Desktop-Setup-${version}.exe`. The Windows release helper builds NSIS and ZIP separately, stamps ZIP app metadata with `piDistribution = "zip"`, and keeps the ZIP target out of `latest.yml`. Extracted ZIP runs use notify-and-link delivery; the updater still recognizes `PORTABLE_EXECUTABLE_FILE` for older portable executables. Data stays in the existing application data directory.** | The self-extracting portable wrapper could trigger administrator prompts and did not provide a reliable normal executable identity for the taskbar. A user-extracted ZIP launches `PI-Desktop.exe` directly and preserves the manual-update boundary. |+| D603 | Windows portable delivery uses a normal ZIP | *(amended by D628)* **Amend D364 / ADR 0022 / ADR 0197: tag builds publish a Windows x64 portable ZIP `PI-Desktop-Portable-${version}.zip` alongside the NSIS installer `PI-Desktop-Setup-${version}.exe`. The Windows release helper builds NSIS and ZIP separately, stamps ZIP app metadata with `piDistribution = "zip"`, and keeps the ZIP target out of `latest.yml`. Extracted ZIP runs use notify-and-link delivery; the updater still recognizes `PORTABLE_EXECUTABLE_FILE` for older portable executables. Data stays in the existing application data directory.** | The self-extracting portable wrapper could trigger administrator prompts and did not provide a reliable normal executable identity for the taskbar. A user-extracted ZIP launches `PI-Desktop.exe` directly and preserves the manual-update boundary. || D260 | 发布文档是一个版本载体 | **稳定版本号提升必须在打标签之前更新每一处带版本号的载体:双语言的应用内变更日志及其测试清单、每个工作区的 `package.json`(包括之前被第三个工作区根 `scripts/release.mjs` 跳过的 `docs/package.json`)、Cargo 工作区版本与 `host-core` 的锁文件条目、`APP_VERSION`,以及 `README.md` 和 `README.zh-CN.md` 中声明的 `<major>.<minor>.x` 发布线。`scripts/check-release-docs.mjs` 校验全部这些;`scripts/release.mjs` 在提升版本号之后运行它,只要任一载体不一致就拒绝提交或打标签,`--skip-docs-check` 仅保留给刻意的非发布性版本提升。扩展 D164。** | 仅有应用内变更日志这道闸门,导致已发布的文档落后:版本已到 `0.10.8`,两个 README 仍在宣传 `0.5.x` 线,而 `docs/package.json` 停在 `0.5.8`。标签是不可逆的,所以这项检查在标签存在之前运行,而不是作为评审礼节。 || D371 | 显式的未签名 macOS 首次启动助手 | *(由 D406 和 D443 修订)* **每个 macOS 分发都附带可执行的 `PI-Desktop-macOS-open.command`,放在 DMG 上拖入 Applications 手势下方的可见首启行。它只查找 `/Applications/PI-Desktop.app` 与 `~/Applications/PI-Desktop.app`,校验 `CFBundleIdentifier` 为 `net.aiuo.pi-desktop`,仅在存在时移除 `com.apple.quarantine`,然后打开应用。永不使用 `sudo`,不接受任意路径,也不替代 Developer ID 签名或公证。** | 未签名的 macOS 通道可能被 quarantine 拦截并显示误导性的\"已损坏\"提示,而仅限终端的 `xattr -cr` 说明比启动失败所需的范围更宽(ADR 0204,E2E-196b) || D443 | 规范应用 ID 与 macOS 代码签名标识 | **修订 D141 / D371 / ADR 0204:应用 ID 为 `net.aiuo.pi-desktop`(`APP_ID`、electron-builder `appId`、macOS `CFBundleIdentifier`、Windows AppUserModelID)。开发用 macOS 宿主为 `net.aiuo.pi-desktop.dev`。不要在 `afterPack`/`afterSign` 对未签名包做 adhoc 签名:嵌套 Electron helper 此时尚未签名,`codesign` 会报 `code object is not signed at all`。见 ADR 0278、issue #524。** | 所有者域名为 `net.aiuo.pi-desktop`。未签名包的 Identifier 绑定推迟到有安全的 helper 签名路径之后。 |@@ -5064,3 +5065,15 @@ Markdown 源码,不是 `text/html` 负载;对禁用行内 HTML 的外部编`includeNonChat` 补上被隐藏的端点且不丢 id、不重复),另有`scripts/e2e/provider-api-style.tsx` 与 `scripts/e2e/image-generation-ui.tsx`探针——它们不再点击「管理模型」。++## 2026-09-26 —— 用户可选择应用更新方式(D628)++- 设置 → 关于新增按安装实例保存的「自动 / 手动」更新方式。支持自动安装的+ Windows NSIS、已打包 macOS 与 Linux AppImage 默认自动;Windows ZIP/便携版和+ 不支持自动安装的包默认手动。手动模式仍定期检查,但不自动下载或退出安装。+- 手动模式对每个新版本只提醒一次。Host 设置会跨重启记录最近提醒版本;Renderer+ 也会阻止路由重新挂载后重复显示。设置 → 关于仍保留版本状态和发布页入口。+- Windows ZIP/便携版可明确选择自动,但会先提示 NSIS 可能替换解压目录中的副本。+ 无需数据库迁移或 Host 协议版本变更。+- 覆盖:`apps/desktop/test/update-preference.test.mjs`、更新后的+ `apps/desktop/test/auto-update.test.mjs` 与 E2E-UPDATE-preference-and-once-only-reminder。diff --git a/packages/i18n/src/locales/de/index.ts b/packages/i18n/src/locales/de/index.tsindex 8f09636b5..710ff14a3 100644--- a/packages/i18n/src/locales/de/index.ts+++ b/packages/i18n/src/locales/de/index.ts@@ -99,6 +99,13 @@ export const de = {"updates": {"title": "Updates","desc": "Updates werden von GitHub Releases heruntergeladen.",+ "preferenceTitle": "Update-Verhalten",+ "preferenceDesc": "Automatisch lädt Updates herunter und installiert sie; Manuell prüft und erinnert einmal pro neuer Version.",+ "automatic": "Automatisch",+ "manual": "Manuell",+ "automaticUnsupported": "Dieses Paket unterstützt keine automatische Installation.",+ "automaticPortableWarning": "Bei automatischen Updates kann eine portable Kopie durch die installierte Version ersetzt werden.",+ "preferenceSaveFailed": "Die Update-Einstellung konnte nicht gespeichert werden.","check": "Nach Updates suchen","checking": "Nach Updates suchen…","upToDate": "Sie sind auf der neuesten Version.",diff --git a/packages/i18n/src/locales/en/index.ts b/packages/i18n/src/locales/en/index.tsindex 8bc63bb51..8e1b7dc4b 100644--- a/packages/i18n/src/locales/en/index.ts+++ b/packages/i18n/src/locales/en/index.ts@@ -106,6 +106,13 @@ export const en = {updates: {title: "Updates",desc: "Updates are downloaded from GitHub Releases.",+ preferenceTitle: "Update behavior",+ preferenceDesc: "Automatic mode downloads and installs updates; Manual mode checks and reminds you once per new version.",+ automatic: "Automatic",+ manual: "Manual",+ automaticUnsupported: "Automatic installation isn't supported by this package.",+ automaticPortableWarning: "Automatic updates can replace an extracted portable copy with the installed version.",+ preferenceSaveFailed: "Couldn't save the update preference.",check: "Check for updates",checking: "Checking for updates…",upToDate: "You're on the latest version.",diff --git a/packages/i18n/src/locales/es/index.ts b/packages/i18n/src/locales/es/index.tsindex 9e93304e4..b1666c157 100644--- a/packages/i18n/src/locales/es/index.ts+++ b/packages/i18n/src/locales/es/index.ts@@ -99,6 +99,13 @@ export const es = {"updates": {"title": "Actualizaciones","desc": "Las actualizaciones se descargan de las versiones de GitHub.",+ "preferenceTitle": "Comportamiento de actualización",+ "preferenceDesc": "El modo automático descarga e instala actualizaciones; el manual comprueba y avisa una vez por versión nueva.",+ "automatic": "Automático",+ "manual": "Manual",+ "automaticUnsupported": "Este paquete no admite la instalación automática.",+ "automaticPortableWarning": "Las actualizaciones automáticas pueden reemplazar una copia portable por la versión instalada.",+ "preferenceSaveFailed": "No se pudo guardar la preferencia de actualización.","check": "Buscar actualizaciones","checking": "Buscando actualizaciones...","upToDate": "Estás en la última versión.",diff --git a/packages/i18n/src/locales/fr/index.ts b/packages/i18n/src/locales/fr/index.tsindex cda7420a1..1bf9e2fd2 100644--- a/packages/i18n/src/locales/fr/index.ts+++ b/packages/i18n/src/locales/fr/index.ts@@ -99,6 +99,13 @@ export const fr = {"updates": {"title": "Mises à jour","desc": "Les mises à jour sont téléchargées à partir des versions de GitHub.",+ "preferenceTitle": "Mode de mise à jour",+ "preferenceDesc": "Le mode automatique télécharge et installe les mises à jour ; le mode manuel vérifie et avertit une fois par nouvelle version.",+ "automatic": "Automatique",+ "manual": "Manuel",+ "automaticUnsupported": "Ce paquet ne prend pas en charge l'installation automatique.",+ "automaticPortableWarning": "Les mises à jour automatiques peuvent remplacer une copie portable par la version installée.",+ "preferenceSaveFailed": "Impossible d'enregistrer le mode de mise à jour.","check": "Vérifier les mises à jour","checking": "Vérifier les mises à jour…","upToDate": "Vous utilisez la dernière version.",diff --git a/packages/i18n/src/locales/ko/index.ts b/packages/i18n/src/locales/ko/index.tsindex 1a72127f2..66081e682 100644--- a/packages/i18n/src/locales/ko/index.ts+++ b/packages/i18n/src/locales/ko/index.ts@@ -108,6 +108,13 @@ export const ko = {updates: {title: "업데이트",desc: "업데이트는 GitHub Releases에서 다운로드됩니다.",+ preferenceTitle: "업데이트 방식",+ preferenceDesc: "자동 업데이트는 업데이트를 다운로드하고 설치하며, 수동 업데이트는 확인 후 새 버전마다 한 번만 알립니다.",+ automatic: "자동 업데이트",+ manual: "수동 업데이트",+ automaticUnsupported: "이 패키지는 자동 설치를 지원하지 않습니다.",+ automaticPortableWarning: "포터블 또는 ZIP에서 자동 업데이트를 선택하면 설치 버전으로 대체될 수 있습니다.",+ preferenceSaveFailed: "업데이트 방식을 저장하지 못했습니다.",check: "업데이트 확인",checking: "업데이트 확인 중…",upToDate: "최신 버전을 사용 중입니다.",diff --git a/packages/i18n/src/locales/pt-BR/index.ts b/packages/i18n/src/locales/pt-BR/index.tsindex f4964ca18..a57c86b0e 100644--- a/packages/i18n/src/locales/pt-BR/index.ts+++ b/packages/i18n/src/locales/pt-BR/index.ts@@ -98,6 +98,13 @@ export const ptBR = {updates: {title: "Atualizações",desc: "As atualizações são baixadas do GitHub Releases.",+ preferenceTitle: "Comportamento das atualizações",+ preferenceDesc: "O modo automático baixa e instala atualizações; o manual verifica e avisa uma vez por nova versão.",+ automatic: "Automático",+ manual: "Manual",+ automaticUnsupported: "Este pacote não oferece instalação automática.",+ automaticPortableWarning: "No modo automático, uma cópia portátil ou ZIP pode ser substituída pela versão instalada.",+ preferenceSaveFailed: "Não foi possível salvar a preferência de atualização.",check: "Verificar atualizações",checking: "Verificando atualizações…",upToDate: "Você está na versão mais recente.",diff --git a/packages/i18n/src/locales/tr/index.ts b/packages/i18n/src/locales/tr/index.tsindex 38b7ee62b..6b73ca076 100644--- a/packages/i18n/src/locales/tr/index.ts+++ b/packages/i18n/src/locales/tr/index.ts@@ -108,6 +108,13 @@ export const tr = {updates: {title: "Güncellemeler",desc: "Güncellemeler GitHub Releases’ten indirilir.",+ preferenceTitle: "Güncelleme davranışı",+ preferenceDesc: "Otomatik mod güncellemeleri indirip kurar; manuel mod denetler ve her yeni sürüm için bir kez bildirir.",+ automatic: "Otomatik",+ manual: "Manuel",+ automaticUnsupported: "Bu paket otomatik kurulumu desteklemiyor.",+ automaticPortableWarning: "Taşınabilir veya ZIP sürümünde otomatik güncelleme, kurulu sürümle değiştirebilir.",+ preferenceSaveFailed: "Güncelleme tercihi kaydedilemedi.",check: "Güncellemeleri denetle",checking: "Güncellemeler denetleniyor…",upToDate: "En son sürümü kullanıyorsunuz.",diff --git a/packages/i18n/src/locales/zh-CN/index.ts b/packages/i18n/src/locales/zh-CN/index.tsindex 4d3114563..3dd81f3c6 100644--- a/packages/i18n/src/locales/zh-CN/index.ts+++ b/packages/i18n/src/locales/zh-CN/index.ts@@ -101,6 +101,13 @@ export const zhCN = {updates: {title: "软件更新",desc: "更新通过 GitHub Releases 分发。",+ preferenceTitle: "更新方式",+ preferenceDesc: "自动更新会下载并安装更新;手动更新只检查,并对每个新版本提醒一次。",+ automatic: "自动更新",+ manual: "手动更新",+ automaticUnsupported: "此安装包不支持自动安装更新。",+ automaticPortableWarning: "便携版或 ZIP 切换为自动更新后,可能会被安装版替换。",+ preferenceSaveFailed: "无法保存更新方式。",check: "检查更新",checking: "正在检查更新…",upToDate: "已是最新版本。",diff --git a/packages/i18n/src/locales/zh-TW/index.ts b/packages/i18n/src/locales/zh-TW/index.tsindex e8780c47e..67bae8389 100644--- a/packages/i18n/src/locales/zh-TW/index.ts+++ b/packages/i18n/src/locales/zh-TW/index.ts@@ -101,6 +101,13 @@ export const zhTW = {updates: {title: "軟體更新",desc: "更新通過 GitHub Releases 分發。",+ preferenceTitle: "更新方式",+ preferenceDesc: "自動更新會下載並安裝更新;手動更新只檢查,並對每個新版本提醒一次。",+ automatic: "自動更新",+ manual: "手動更新",+ automaticUnsupported: "此安裝套件不支援自動安裝更新。",+ automaticPortableWarning: "便攜版或 ZIP 切換為自動更新後,可能會被安裝版取代。",+ preferenceSaveFailed: "無法儲存更新方式。",check: "檢查更新",checking: "正在檢查更新…",upToDate: "已是最新版本。",diff --git a/packages/shared/src/types/platform.ts b/packages/shared/src/types/platform.tsindex 0fd4e5455..81e392782 100644--- a/packages/shared/src/types/platform.ts+++ b/packages/shared/src/types/platform.ts@@ -35,12 +35,13 @@ export type HostStatusEvent = {archMismatch?: { platform: string; processArch: string; machineArch: string };};+/** User-selected update behavior; unsupported installers remain manual. */+export type UpdatePreference = "automatic" | "manual";+/**- * How app updates are delivered on this install:- * - 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- * (Linux deb/rpm, Windows ZIP)+ * Effective update delivery on this install:+ * - in-app: electron-updater downloads and installs+ * - manual: detect versions and link to the releases page* - disabled: development / unpackaged build*/export type UpdateMode = "in-app" | "manual" | "disabled";@@ -57,6 +58,11 @@ export type UpdateStatus =/** Snapshot pushed on the `updatesState` event and returned by updates IPC. */export type UpdateState = {mode: UpdateMode;+ preference: UpdatePreference;+ defaultPreference: UpdatePreference;+ automaticSupported: boolean;+ /** Manual-mode banner is shown once for each discovered version. */+ manualReminder?: boolean;status: UpdateStatus;currentVersion: string;availableVersion?: string;diff --git a/packages/shared/src/types/settings.ts b/packages/shared/src/types/settings.tsindex 3e84f8c97..e0fb8754f 100644--- a/packages/shared/src/types/settings.ts+++ b/packages/shared/src/types/settings.ts@@ -9,6 +9,7 @@ import type { GlobalPermissionMode } from "./permissions.js";import type { PluginMarketSource } from "./plugins.js";import type { SpeechSettings } from "./speech.js";import type { ThinkingLevel } from "./models.js";+import type { UpdatePreference } from "./platform.js";export type ThemePreference = "system" | "light" | "dark" | `plugin:${string}`;@@ -28,6 +29,10 @@ export type AppSettings = {imageGenerationModels?: import("../image-generation.js").ImageGenerationBinding[] | null;defaultProviderId?: string;defaultModelId?: string;+ /** Per-install update behavior; absent uses the package's safe default. */+ updatePreference?: UpdatePreference;+ /** Last manually announced release; kept local to avoid repeating notices. */+ lastNotifiedUpdateVersion?: string;/** Host speech bindings. Absent means voice actions stay disabled. */speech?: SpeechSettings;defaultMode: Mode;diff --git a/scripts/e2e/settings-scroll.jsx b/scripts/e2e/settings-scroll.jsxindex af265221f..2647ba792 100644--- a/scripts/e2e/settings-scroll.jsx+++ b/scripts/e2e/settings-scroll.jsx@@ -23,17 +23,45 @@ let settings = {enterToSend: true,developerMode: false,};+let updateState = {+ mode: "in-app",+ preference: "automatic",+ defaultPreference: "automatic",+ automaticSupported: true,+ manualReminder: false,+ status: "available",+ currentVersion: "0.15.8",+ availableVersion: "0.15.9",+ releasesUrl: "https://github.com/vastsa/PI-Desktop/releases/latest",+};+const updateStateListeners = new Set();window.piDesktop = {- platform: "darwin", on: () => () => {},+ platform: "darwin",+ on(channel, listener) {+ if (channel === IPC.event.updatesState) updateStateListeners.add(listener);+ return () => updateStateListeners.delete(listener);+ },async invoke(channel, input) {let data;switch (channel) {case IPC.invoke.pluginScenicThemesDestinations: data = destinations; break;case IPC.invoke.settingsGet: data = settings; break;- case IPC.invoke.settingsSet: settings = input; data = settings; break;+ case IPC.invoke.settingsSet:+ settings = input;+ data = settings;+ if (settings.updatePreference === "automatic" || settings.updatePreference === "manual") {+ updateState = {+ ...updateState,+ preference: settings.updatePreference,+ mode: settings.updatePreference === "automatic" ? "in-app" : "manual",+ };+ for (const listener of updateStateListeners) listener(updateState);+ }+ break;case IPC.invoke.providersList: data = { providers: [] }; break;case IPC.invoke.sessionList: data = { sessions: [] }; break;case IPC.invoke.appGetOnboarding: data = {}; break;+ case IPC.invoke.updatesGetState: data = updateState; break;case IPC.invoke.configSyncGetState:data = {configured: false,@@ -130,6 +158,50 @@ async function scroll() {assert(pane().scrollTop > 0, "Destination must be scrollable for this check");return pane().scrollTop;}+async function exerciseUpdatePreference() {+ await select("Info");+ await settle();+ const trigger = () => document.querySelector('button[aria-label="Update behavior"]');+ assert(trigger() instanceof HTMLButtonElement, "Update behavior selector must render");+ assert(trigger().textContent?.includes("Automatic"), "Installed package defaults to Automatic");+ assert(+ [...document.querySelectorAll(".update-settings-actions button")]+ .some((button) => button.textContent?.includes("Check for updates")),+ "Automatic mode keeps the existing update check action",+ );++ async function choosePreference(label, value) {+ const selectTrigger = trigger();+ assert(selectTrigger instanceof HTMLButtonElement, "Update selector trigger must remain mounted");+ flushSync(() => selectTrigger.click());+ await settle();+ const option = [...document.querySelectorAll('[role="option"]')]+ .find((candidate) => candidate.textContent?.trim() === label);+ assert(option instanceof HTMLButtonElement, `Missing update preference option: ${label}`);+ flushSync(() => option.click());+ await settle();+ assert(settings.updatePreference === value, `${label} preference must persist through settings IPC`);+ assert(useAppStore.getState().settings?.updatePreference === value, `${label} preference must update the renderer store`);+ assert(updateState.preference === value, `${label} preference must update the shared update state`);+ }++ await choosePreference("Manual", "manual");+ assert(trigger().textContent?.includes("Manual"), "Manual must become the selected value");+ assert(+ [...document.querySelectorAll(".update-settings-actions button")]+ .some((button) => button.textContent?.includes("View release")),+ "Manual mode must offer the release page for an available version",+ );++ await select("AI");+ await select("Info");+ await settle();+ assert(trigger().textContent?.includes("Manual"), "Manual preference must survive leaving and reopening Info");+ await choosePreference("Automatic", "automatic");+ assert(trigger().textContent?.includes("Automatic"), "Automatic must be selectable again");+ return { updatePreference: settings.updatePreference, updateMode: updateState.mode };+}+async function exerciseBrazilianPortuguese() {await select("General");const trigger = document.querySelector(".settings-language-trigger");@@ -238,6 +310,7 @@ window.settingsScrollProbe = async () => {assert(pane().scrollTop > 0, "Search within the active tab must still locate its row");checks.push({ theme, ok: true });}+ checks.push(await exerciseUpdatePreference());checks.push(await exerciseBrazilianPortuguese());return { ok: true, checks };};