Local-first AI coding agent desktop: Electron + Rust host core + pi Agent Harness + user-installable plugins
TypeScript ai-agentcoding-agentdesktop-appelectronglobali18nlocal-firstmcppipi-agentpi-desktoppluginsreactrusttypescript
fix(desktop): bound the startup wait and make a stuck boot recoverable
vastsa6fd65068627d
diff --git a/apps/desktop/electron/main/ipc/app-ipc.ts b/apps/desktop/electron/main/ipc/app-ipc.tsindex 3de3eccd5..287c05fea 100644--- a/apps/desktop/electron/main/ipc/app-ipc.ts+++ b/apps/desktop/electron/main/ipc/app-ipc.ts@@ -1,4 +1,4 @@-import { BrowserWindow } from "electron";+import { app, BrowserWindow } from "electron";import { dirname, join, resolve } from "node:path";import { existsSync, statSync } from "node:fs";import { listInstalledFonts } from "../system-fonts";@@ -108,6 +108,18 @@ export function registerAppIpc({return { ok: true };});+ /**+ * The renderer's own quit. A startup that never reaches the shell still has to+ * be able to exit the app (issue #831), and the tray/menu path is unreachable+ * from a window that shows no menu. This goes through `app.quit()` exactly like+ * the Quit menu item, so the ordered shutdown, the confirmation dialog, and the+ * close behavior stay the ones the app already has.+ */+ handle(IPC.invoke.appQuit, async () => {+ app.quit();+ return { ok: true };+ });+let systemFontsCache: { at: number; fonts: string[] } | null = null;handle(IPC.invoke.systemFontsList, async () => {const now = Date.now();diff --git a/apps/desktop/src/components/StartupRecovery.tsx b/apps/desktop/src/components/StartupRecovery.tsxnew file mode 100644index 000000000..51b35765a--- /dev/null+++ b/apps/desktop/src/components/StartupRecovery.tsx@@ -0,0 +1,157 @@+import { useState } from "react";+import { useTranslation } from "react-i18next";+import { api } from "../lib/api";+import {+ buildStartupDiagnostics,+ type StartupPhase,+} from "../lib/startup-watchdog";+import { useAppStore } from "../stores/app-store";+import { BrandLogo } from "./BrandLogo";++type CopyState = "idle" | "copied" | "failed";++/**+ * The window's surface while it has no initial state.+ *+ * Issue #831: a launch that never receives its chats and settings used to stay+ * on the boot surface forever — no menu, no data, and nothing to act on except+ * force-quitting the process. This surface is shown by the startup watchdog when+ * that wait outgrows every bound the startup itself can fail at, and every action+ * on it is available without any backend: retry the wait, take the logs, copy a+ * short report for a bug report, or quit.+ *+ * It is presentation only. The wait it describes keeps running underneath, so a+ * boot that does finish replaces this surface with the shell on its own.+ */+export function StartupRecovery({+ phase,+ waitedMs,+ onRetry,+ down,+}: {+ phase: StartupPhase;+ /** Waited time, read when the report is copied — never during render. */+ waitedMs: () => number;+ onRetry: () => void;+ /** What the main process last reported as down, when it reported anything. */+ down?: { component?: string; message?: string } | null;+}) {+ const { t, i18n } = useTranslation();+ const [copyState, setCopyState] = useState<CopyState>("idle");++ if (phase === "starting") return null;+ const stalled = phase === "stalled";++ /**+ * The version the main process knows. Read from main instead of the store,+ * because the store only learns it after a successful startup — which is+ * exactly what did not happen. Bounded, so a wedged bridge cannot hang the+ * copy action it is meant to serve.+ */+ const appVersionFromMain = async (): Promise<string | null> => {+ try {+ const info = await Promise.race([+ api.getVersion(),+ new Promise<null>((resolve) => setTimeout(() => resolve(null), 2000)),+ ]);+ return info?.version ?? null;+ } catch {+ return null;+ }+ };++ const copyDiagnostics = async () => {+ const state = useAppStore.getState();+ const report = buildStartupDiagnostics({+ phase,+ elapsedMs: waitedMs(),+ platform: window.piDesktop?.platform ?? "unknown",+ locale: i18n.resolvedLanguage ?? i18n.language ?? null,+ appVersion: state.version?.version ?? (await appVersionFromMain()),+ error: state.error ?? null,+ downComponent: down?.component ?? null,+ downMessage: down?.message ?? null,+ });+ try {+ await navigator.clipboard.writeText(report);+ setCopyState("copied");+ } catch {+ // A refused clipboard is not worth a dialog on a surface this broken; the+ // label reports it and the logs action stays available.+ setCopyState("failed");+ }+ };++ const copyLabel =+ copyState === "copied"+ ? t("startup.diagnosticsCopied")+ : copyState === "failed"+ ? t("startup.diagnosticsFailed")+ : t("startup.copyDiagnostics");++ return (+ <div+ className="startup-recovery"+ role="alertdialog"+ aria-modal="true"+ aria-labelledby="startup-recovery-title"+ aria-describedby="startup-recovery-body"+ data-testid="startup-recovery"+ data-phase={phase}+ >+ <div className="startup-recovery-card">+ <div className="startup-recovery-mark" aria-hidden>+ <BrandLogo size={44} />+ </div>+ <h1 id="startup-recovery-title" className="startup-recovery-title">+ {stalled ? t("startup.stalledTitle") : t("startup.slowTitle")}+ </h1>+ <p id="startup-recovery-body" className="startup-recovery-body">+ {stalled ? t("startup.stalledBody") : t("startup.slowBody")}+ </p>+ {stalled ? null : (+ /* The splash's own track: while the wait is still legitimately in+ flight, it has to keep reading as progress, not as a dead screen. */+ <div className="startup-splash-track" aria-hidden>+ <span className="startup-splash-bar" />+ </div>+ )}+ <div className="startup-recovery-actions no-drag">+ {stalled && (+ <button+ type="button"+ className="btn btn-primary"+ onClick={onRetry}+ >+ {t("errors.action.retry")}+ </button>+ )}+ <button+ type="button"+ className="btn btn-secondary"+ onClick={() => void api.openLogs().catch(() => undefined)}+ >+ {t("status.openLogs")}+ </button>+ <button+ type="button"+ className="btn btn-secondary"+ onClick={() => void copyDiagnostics()}+ >+ {copyLabel}+ </button>+ <button+ type="button"+ className="btn btn-secondary"+ onClick={() => {+ // The answer may never arrive: quitting tears this window down.+ void api.quitApp().catch(() => undefined);+ }}+ >+ {t("tray.quit")}+ </button>+ </div>+ </div>+ </div>+ );+}diff --git a/apps/desktop/src/features/app/AppShell.tsx b/apps/desktop/src/features/app/AppShell.tsxindex 890463836..ee41d4b31 100644--- a/apps/desktop/src/features/app/AppShell.tsx+++ b/apps/desktop/src/features/app/AppShell.tsx@@ -13,6 +13,7 @@ import { Sidebar } from "../../components/Sidebar";import { ToastHost } from "../../components/Toast";import { UpdateBanner } from "../../components/UpdateBanner";import { cx, TooltipButton } from "../../components/ui";+import { StartupRecovery } from "../../components/StartupRecovery";import { WindowControls } from "../../components/WindowControls";import { WorkPanel } from "../../components/workpanel/WorkPanel";import { api } from "../../lib/api";@@ -79,10 +80,26 @@ export function AppShell() {setArchMismatch,showSplash,splash,+ startupPhase,+ startupWaitedMs,+ retryStartup,sidebarToggleShortcut,workPanelToggleTooltip,} = useAppShellRuntime();+ // A boot that never reaches the shell gets a surface it can act on instead of+ // a window that only knows how to wait (issue #831). Rendered as a direct child+ // of the shell so it can layer above the splash and below the window controls.+ const startupRecovery =+ startupPhase === "starting" ? null : (+ <StartupRecovery+ phase={startupPhase}+ waitedMs={startupWaitedMs}+ onRetry={retryStartup}+ down={backendDown}+ />+ );+let shell: ReactNode = null;if (ready) {if (page === "settings") {@@ -309,9 +326,14 @@ export function AppShell() {<div className="app-scenic-backdrop" aria-hidden />{shell}{/* Outside pane stacking; skip splash so the band cannot cover boot chrome. */}- {ready && !showSplash && <WindowControls />}+ {/* A window parked on the recovery surface is not ready either, and the+ renderer-drawn controls are the only ones Windows/Linux have. */}+ {(ready || startupPhase !== "starting") && !showSplash ? (+ <WindowControls />+ ) : null}<ProjectCreateDialog />{splash}+ {startupRecovery}</div>);}diff --git a/apps/desktop/src/features/app/useAppShellRuntime.tsx b/apps/desktop/src/features/app/useAppShellRuntime.tsxindex a3bf9ec56..82c417dbd 100644--- a/apps/desktop/src/features/app/useAppShellRuntime.tsx+++ b/apps/desktop/src/features/app/useAppShellRuntime.tsx@@ -29,6 +29,7 @@ import {import { browserPluginTab } from "../../lib/work-panel-tabs";import { useAppStore } from "../../stores/app-store";import { useSidebarTransition } from "./useSidebarTransition";+import { useStartupWatchdog } from "./useStartupWatchdog";import { useTraySessions } from "./useTraySessions";const MODIFIER_ONLY_KEYS = new Set([@@ -817,8 +818,17 @@ export function useAppShellRuntime() {};}, [ready]);+ const {+ phase: startupPhase,+ waitedMs: startupWaitedMs,+ retry: retryStartup,+ } = useStartupWatchdog(ready);const showSplash = splashPhase !== "done";- const splash = showSplash ? (+ // The splash and the recovery surface answer the same question ("nothing to+ // show yet"), and on macOS the shell hides every child except the splash while+ // it animates. Exactly one of them is mounted, so neither has to fight the+ // other's layering.+ const splash = showSplash && startupPhase === "starting" ? (<StartupSplash exiting={splashPhase === "exiting"} />) : null;@@ -902,6 +912,9 @@ export function useAppShellRuntime() {setArchMismatch,showSplash,splash,+ startupPhase,+ startupWaitedMs,+ retryStartup,sidebarToggleShortcut,workPanelToggleTooltip,};diff --git a/apps/desktop/src/features/app/useStartupWatchdog.ts b/apps/desktop/src/features/app/useStartupWatchdog.tsnew file mode 100644index 000000000..e9d387639--- /dev/null+++ b/apps/desktop/src/features/app/useStartupWatchdog.ts@@ -0,0 +1,67 @@+import { useCallback, useEffect, useRef, useState } from "react";+import {+ createStartupWatchdog,+ type StartupPhase,+} from "../../lib/startup-watchdog";+import { useAppStore } from "../../stores/app-store";++const clockNow = () =>+ typeof performance !== "undefined" ? performance.now() : Date.now();++export type StartupWatchdogState = {+ /** Where the wait for the first state currently is. */+ phase: StartupPhase;+ /** Milliseconds waited so far, read on demand (never during render). */+ waitedMs: () => number;+ /**+ * Ask for the initial state again after a stalled boot. The watchdog restarts+ * with the attempt, so the retry gets its own full window before it is called+ * stalled again.+ */+ retry: () => void;+};++/**+ * Watch the initial-state wait and report it as it ages.+ *+ * The watchdog never cancels the startup it watches: a slow launch that does+ * finish still flips `ready` and takes the window over, which is why the phase+ * resets as soon as it does. Failure to reach the first state at all is the case+ * issue #831 reports, and that is the one the caller renders a recovery surface+ * for.+ */+export function useStartupWatchdog(ready: boolean): StartupWatchdogState {+ const [phase, setPhase] = useState<StartupPhase>("starting");+ const [attempt, setAttempt] = useState(0);+ const startedAtRef = useRef(clockNow());++ useEffect(() => {+ if (ready) {+ setPhase("starting");+ return;+ }+ startedAtRef.current = clockNow();+ const watchdog = createStartupWatchdog({+ onPhase: setPhase,+ scheduler: {+ setTimeout: (handler, ms) => setTimeout(handler, ms),+ clearTimeout: (handle) =>+ clearTimeout(handle as ReturnType<typeof setTimeout>),+ },+ });+ watchdog.start();+ // The wait is over on either exit: the initial state arrived, the retry+ // restarted it, or the surface unmounted. Leaving either timer armed past+ // that would publish a phase for an app that already has data.+ return () => watchdog.stop();+ }, [ready, attempt]);++ const retry = useCallback(() => {+ setAttempt((current) => current + 1);+ void useAppStore.getState().bootstrap();+ }, []);++ const waitedMs = useCallback(() => clockNow() - startedAtRef.current, []);++ return { phase, waitedMs, retry };+}diff --git a/apps/desktop/src/lib/api.ts b/apps/desktop/src/lib/api.tsindex 54efa37e5..7342cdb4c 100644--- a/apps/desktop/src/lib/api.ts+++ b/apps/desktop/src/lib/api.ts@@ -1242,6 +1242,12 @@ export const api = {executeCommand: (commandId: string) =>invoke(IPC.invoke.commandPaletteExecute, commandId),openLogs: () => invoke(IPC.invoke.logOpenFolder),+ /**+ * Quit the application. Used by the surfaces that own the window before the+ * shell has data; the main process runs the same ordered shutdown as the Quit+ * menu item, so the answer may never arrive — callers must not depend on it.+ */+ quitApp: () => invoke<{ ok: boolean }>(IPC.invoke.appQuit),/** Toggles the devtools console; rejects unless developer mode is on. */toggleDevTools: (open?: boolean) =>invoke<{ open: boolean }>(IPC.invoke.devtoolsToggle, { open }),diff --git a/apps/desktop/src/lib/startup-watchdog.ts b/apps/desktop/src/lib/startup-watchdog.tsnew file mode 100644index 000000000..13665b823--- /dev/null+++ b/apps/desktop/src/lib/startup-watchdog.ts@@ -0,0 +1,148 @@+/**+ * Renderer startup watchdog.+ *+ * The shell paints only once `bootstrap` publishes the initial state. A startup+ * read that never settles therefore leaves the window on the boot surface+ * forever, with no menu, no data, and nothing the user can act on (issue #831).+ * This module owns the two boundaries of that wait so the window can always fall+ * back to a surface the user can operate.+ *+ * Both bounds are deliberately far above a healthy boot: the splash is designed+ * around a sub-second boot, and the slowest realistic backend answer is the+ * main↔service RPC ceiling. See `STARTUP_STALLED_MS`.+ */++/** Boot phases the window reports while it still has no initial state. */+export type StartupPhase = "starting" | "slow" | "stalled";++/**+ * When to tell the user the boot is slow, without calling it a failure.+ *+ * A healthy boot finishes in about a second (the splash's own minimum dwell is+ * 420ms), so anything past this is a real wait — and the phase exists so the logs+ * can be collected *before* the user gives up on a stuck launch instead of after+ * force-quitting it. It stays far below every failure bound below, so it can+ * never read as an error by itself.+ */+export const STARTUP_SLOW_HINT_MS = 30_000;++/**+ * When the boot is treated as stalled.+ *+ * The renderer's startup reads go to the local service through the main process,+ * and `DEFAULT_RPC_TIMEOUT_MS` (130s, packages/shared/src/rpc-timeouts.ts) is the+ * longest a single one of them can stay unanswered before it rejects on its own.+ * Below that ceiling every read is still legitimately "in flight", so declaring+ * the boot stalled any earlier would turn a slow-but-successful launch into an+ * error screen. This bound is that ceiling plus a margin for the reads to settle+ * and for the store to publish.+ */+export const STARTUP_STALLED_MS = 180_000;++/** Phase for the time already spent waiting for the initial state. */+export function startupPhaseFor(+ elapsedMs: number,+ bounds: { slowMs?: number; stalledMs?: number } = {},+): StartupPhase {+ const slowMs = bounds.slowMs ?? STARTUP_SLOW_HINT_MS;+ const stalledMs = bounds.stalledMs ?? STARTUP_STALLED_MS;+ if (elapsedMs >= stalledMs) return "stalled";+ if (elapsedMs >= slowMs) return "slow";+ return "starting";+}++/** The two timers a watchdog needs; injectable so tests need no real clock. */+export type StartupWatchdogScheduler = {+ setTimeout: (handler: () => void, ms: number) => unknown;+ clearTimeout: (handle: unknown) => void;+};++export type StartupWatchdog = {+ /** Arm the bounds. Safe to call once per wait. */+ start: () => void;+ /** Disarm every pending bound. Idempotent. */+ stop: () => void;+};++/**+ * Announces each phase as its bound passes.+ *+ * Two one-shot timers rather than one interval: a phase is a boundary crossing,+ * not a poll, and a watchdog that also reported "starting" would republish state+ * on every tick. Nothing here decides whether the boot failed — the caller keeps+ * the underlying startup promise running, so a slow launch that does finish+ * still takes the window over.+ */+export function createStartupWatchdog({+ onPhase,+ slowMs = STARTUP_SLOW_HINT_MS,+ stalledMs = STARTUP_STALLED_MS,+ scheduler,+}: {+ onPhase: (phase: StartupPhase) => void;+ slowMs?: number;+ stalledMs?: number;+ scheduler: StartupWatchdogScheduler;+}): StartupWatchdog {+ let handles: unknown[] = [];+ let stopped = false;+ return {+ start: () => {+ if (stopped || handles.length > 0) return;+ handles = [+ scheduler.setTimeout(() => {+ if (!stopped) onPhase("slow");+ }, slowMs),+ scheduler.setTimeout(() => {+ if (!stopped) onPhase("stalled");+ }, stalledMs),+ ];+ },+ stop: () => {+ stopped = true;+ for (const handle of handles) scheduler.clearTimeout(handle);+ handles = [];+ },+ };+}++/** Facts about a stalled boot that the renderer knows without another IPC call. */+export type StartupDiagnosticsInput = {+ phase: StartupPhase;+ elapsedMs: number;+ platform: string;+ locale?: string | null;+ appVersion?: string | null;+ /** Last error the store published for the startup, if any. */+ error?: string | null;+ /** Component the main process reported as down, if it did. */+ downComponent?: string | null;+ downMessage?: string | null;+};++/**+ * The report behind "copy diagnostics".+ *+ * Built only from what the renderer already holds: asking the local service for+ * more would repeat the very call that is not answering. Deliberately plain text+ * so it can be pasted into a bug report as-is, and deliberately free of anything+ * the user did not already see (no paths, tokens, or session content).+ */+export function buildStartupDiagnostics(input: StartupDiagnosticsInput): string {+ const seconds = Math.round(input.elapsedMs / 1000);+ const lines = [+ "PI-Desktop startup diagnostics",+ `phase: ${input.phase}`,+ `waited: ${seconds}s`,+ `platform: ${input.platform}`,+ `locale: ${input.locale ?? "unknown"}`,+ `app version: ${input.appVersion ?? "unknown"}`,+ `last startup error: ${input.error ?? "none"}`,+ `reported down: ${+ input.downComponent+ ? `${input.downComponent}${input.downMessage ? ` (${input.downMessage})` : ""}`+ : "none"+ }`,+ ];+ return lines.join("\n");+}diff --git a/apps/desktop/src/styles/chrome.css b/apps/desktop/src/styles/chrome.cssindex ea7e922f9..2a96e807d 100644--- a/apps/desktop/src/styles/chrome.css+++ b/apps/desktop/src/styles/chrome.css@@ -187,6 +187,90 @@}}+/*+ * Startup recovery — the surface the startup watchdog falls back to when the+ * renderer never receives its initial state (issue #831).+ *+ * It sits above the splash and is opaque by design: the window has no data to+ * show, so there is nothing behind it worth seeing. Unlike the splash it must be+ * operable — every control on it works without any backend — so it is draggable+ * like the splash while its action row opts back out.+ */+.startup-recovery {+ position: fixed;+ inset: 0;+ z-index: 1400; /* above the splash (1300) it replaces */+ display: flex;+ align-items: center;+ justify-content: center;+ padding: 24px;+ background: var(--ds-bg-primary);+ -webkit-app-region: drag;+ animation: startup-splash-in var(--motion-duration-slow) var(--motion-ease-out) both;+}++/*+ * The renderer-drawn window controls (Windows/Linux, no native chrome) are+ * hidden until the shell is ready, so a window sitting on this surface would+ * have no close control at all. Keep them above it: the surface's own Quit+ * action must not be the only way out of a stuck startup.+ */+.app-shell:has(> .startup-recovery) > .window-controls {+ z-index: 1500;+}++.startup-recovery-card {+ display: flex;+ flex-direction: column;+ align-items: center;+ gap: 14px;+ width: min(100%, 420px);+ text-align: center;+ -webkit-app-region: no-drag;+}++.startup-recovery-mark {+ display: flex;+ width: 56px;+ height: 56px;+ align-items: center;+ justify-content: center;+ border-radius: var(--ds-composer-radius);+ background: var(--ds-tile-deep);+}++.startup-recovery-title {+ margin: 0;+ color: var(--ds-text-primary);+ font-size: var(--text-lg);+ font-weight: var(--font-weight-semibold);+ letter-spacing: var(--tracking-tight);+ line-height: var(--leading-tighter);+}++.startup-recovery-body {+ margin: 0;+ color: var(--ds-text-secondary);+ font-size: var(--text-md);+ line-height: var(--leading-body);+ overflow-wrap: anywhere;+}++.startup-recovery-actions {+ display: flex;+ flex-wrap: wrap;+ justify-content: center;+ gap: 8px;+ margin-top: 4px;+}++@media (prefers-reduced-motion: reduce) {+ .startup-recovery {+ animation-duration: 0.01ms !important;+ animation-delay: 0ms !important;+ }+}+.sidebar-surface,.sidebar-rail {background-color: var(--ds-bg-sidebar, var(--ds-bg-primary));diff --git a/apps/desktop/test/startup-watchdog.test.mjs b/apps/desktop/test/startup-watchdog.test.mjsnew file mode 100644index 000000000..cd8b30256--- /dev/null+++ b/apps/desktop/test/startup-watchdog.test.mjs@@ -0,0 +1,283 @@+/**+ * Issue #831: a launch that never receives its initial state left the window on+ * the boot surface forever. These tests cover the watchdog's own bounds (they+ * are the contract that keeps a slow boot from being called a failure), its+ * timer ownership, the diagnostics report behind the copy action, and the+ * wiring that puts the recovery surface in front of the user.+ */+import { readAppSource } from "./helpers/source-contracts.mjs";+import assert from "node:assert/strict";+import { readFile } from "node:fs/promises";+import test from "node:test";+import { DEFAULT_RPC_TIMEOUT_MS } from "@pi-desktop/shared";+import {+ STARTUP_SLOW_HINT_MS,+ STARTUP_STALLED_MS,+ buildStartupDiagnostics,+ createStartupWatchdog,+ startupPhaseFor,+} from "../src/lib/startup-watchdog.ts";+import { loadStyles } from "./helpers/styles.mjs";++const read = (path) => readFile(new URL(path, import.meta.url), "utf8");++const [+ shell,+ recovery,+ apiSource,+ mainIpc,+ protocol,+ css,+ english,+ chinese,+ traditional,+] = await Promise.all([+ readAppSource(),+ read("../src/components/StartupRecovery.tsx"),+ read("../src/lib/api.ts"),+ read("../electron/main/ipc/app-ipc.ts"),+ read("../../../packages/shared/src/protocol.ts"),+ loadStyles(),+ read("../../../packages/i18n/src/locales/en/index.ts"),+ read("../../../packages/i18n/src/locales/zh-CN/index.ts"),+ read("../../../packages/i18n/src/locales/zh-TW/index.ts"),+]);++/** Deterministic scheduler so the watchdog is tested without a real clock. */+function fakeScheduler() {+ const pending = new Map();+ let sequence = 0;+ return {+ scheduler: {+ setTimeout: (handler, ms) => {+ sequence += 1;+ pending.set(sequence, { handler, ms });+ return sequence;+ },+ clearTimeout: (handle) => {+ pending.delete(handle);+ },+ },+ armed: () => pending.size,+ fire: (ms) => {+ for (const [handle, entry] of [...pending]) {+ if (entry.ms !== ms) continue;+ pending.delete(handle);+ entry.handler();+ }+ },+ };+}++test("a boot is only slow after the hint, and only stalled after the ceiling", () => {+ assert.equal(STARTUP_SLOW_HINT_MS, 30_000);+ assert.equal(STARTUP_STALLED_MS, 180_000);+ assert.equal(startupPhaseFor(0), "starting");+ assert.equal(startupPhaseFor(STARTUP_SLOW_HINT_MS - 1), "starting");+ assert.equal(startupPhaseFor(STARTUP_SLOW_HINT_MS), "slow");+ assert.equal(startupPhaseFor(STARTUP_STALLED_MS - 1), "slow");+ assert.equal(startupPhaseFor(STARTUP_STALLED_MS), "stalled");+ assert.equal(startupPhaseFor(9_999_999), "stalled");+});++test("the stalled bound outlives every startup read that can fail on its own", () => {+ // A renderer startup read that never settles rejects only at the shared RPC+ // ceiling. Declaring the boot stalled before that would turn a slow but+ // successful launch into an error screen, so the bound has to stay above it.+ assert.ok(+ STARTUP_STALLED_MS > DEFAULT_RPC_TIMEOUT_MS,+ `stalled bound ${STARTUP_STALLED_MS} must exceed the RPC ceiling ${DEFAULT_RPC_TIMEOUT_MS}`,+ );+ assert.ok(STARTUP_SLOW_HINT_MS < DEFAULT_RPC_TIMEOUT_MS);+});++test("the watchdog announces each bound once, in order", () => {+ const fake = fakeScheduler();+ const phases = [];+ const watchdog = createStartupWatchdog({+ onPhase: (phase) => phases.push(phase),+ scheduler: fake.scheduler,+ });++ watchdog.start();+ assert.equal(fake.armed(), 2);+ // Arming is not a phase: nothing is published until a bound actually passes.+ assert.deepEqual(phases, []);++ fake.fire(STARTUP_SLOW_HINT_MS);+ assert.deepEqual(phases, ["slow"]);+ fake.fire(STARTUP_STALLED_MS);+ assert.deepEqual(phases, ["slow", "stalled"]);+});++test("stopping the watchdog disarms both bounds and silences late phases", () => {+ const fake = fakeScheduler();+ const phases = [];+ const watchdog = createStartupWatchdog({+ onPhase: (phase) => phases.push(phase),+ scheduler: fake.scheduler,+ });++ watchdog.start();+ watchdog.stop();+ assert.equal(fake.armed(), 0);+ // A timer that already fired before `stop` must not publish either.+ fake.fire(STARTUP_SLOW_HINT_MS);+ fake.fire(STARTUP_STALLED_MS);+ assert.deepEqual(phases, []);++ // Idempotent, and a stopped watchdog cannot be restarted.+ watchdog.stop();+ watchdog.start();+ assert.equal(fake.armed(), 0);+});++test("re-arming an already-armed watchdog does not double its bounds", () => {+ const fake = fakeScheduler();+ const phases = [];+ const watchdog = createStartupWatchdog({+ onPhase: (phase) => phases.push(phase),+ scheduler: fake.scheduler,+ });++ watchdog.start();+ watchdog.start();+ assert.equal(fake.armed(), 2);+ fake.fire(STARTUP_SLOW_HINT_MS);+ assert.deepEqual(phases, ["slow"]);+});++test("the diagnostics report states what the renderer already knows", () => {+ const report = buildStartupDiagnostics({+ phase: "stalled",+ elapsedMs: 181_400,+ platform: "darwin",+ locale: "zh-CN",+ appVersion: "0.15.2",+ error: "host RPC timeout: settings.get",+ downComponent: "host",+ downMessage: "HOST_UNAVAILABLE",+ });++ assert.match(report, /^PI-Desktop startup diagnostics\n/);+ assert.match(report, /phase: stalled/);+ assert.match(report, /waited: 181s/);+ assert.match(report, /platform: darwin/);+ assert.match(report, /locale: zh-CN/);+ assert.match(report, /app version: 0\.15\.2/);+ assert.match(report, /last startup error: host RPC timeout: settings\.get/);+ assert.match(report, /reported down: host \(HOST_UNAVAILABLE\)/);+});++test("the diagnostics report degrades to explicit unknowns, never to silence", () => {+ const report = buildStartupDiagnostics({+ phase: "slow",+ elapsedMs: 30_400,+ platform: "win32",+ });++ assert.match(report, /waited: 30s/);+ assert.match(report, /locale: unknown/);+ assert.match(report, /app version: unknown/);+ assert.match(report, /last startup error: none/);+ assert.match(report, /reported down: none/);+ // Nothing the user did not already see: no paths, no session or token data.+ assert.doesNotMatch(report, /\/(Users|home)\//);+});++test("the recovery surface stays operable with no backend at all", () => {+ assert.match(recovery, /data-testid="startup-recovery"/);+ assert.match(recovery, /role="alertdialog"/);+ assert.match(recovery, /aria-labelledby="startup-recovery-title"/);+ assert.match(recovery, /aria-describedby="startup-recovery-body"/);+ // Retry, logs, diagnostics and quit: every action is renderer-local or main-only.+ assert.match(recovery, /onClick=\{onRetry\}/);+ assert.match(recovery, /api\.openLogs\(\)/);+ assert.match(recovery, /navigator\.clipboard\.writeText\(report\)/);+ assert.match(recovery, /api\.quitApp\(\)/);+ // The stalled state offers the retry; the slow state must not, because the+ // startup it is waiting for is still in flight.+ assert.match(recovery, /\{stalled && \(/);+ assert.match(recovery, /t\("errors\.action\.retry"\)/);+ assert.match(recovery, /t\("status\.openLogs"\)/);+ assert.match(recovery, /t\("tray\.quit"\)/);+ // A copy that fails still says so instead of looking like a dead button.+ assert.match(recovery, /setCopyState\("failed"\)/);+ assert.match(recovery, /startup\.diagnosticsCopied/);+ assert.match(recovery, /startup\.diagnosticsFailed/);+ // The version read is bounded: a wedged bridge must not hang the action.+ assert.match(recovery, /Promise\.race\(/);+});++test("the shell watches the wait and renders the recovery surface", () => {+ assert.match(shell, /import \{ useStartupWatchdog \} from "\.\/useStartupWatchdog"/);+ assert.match(shell, /useStartupWatchdog\(ready\)/);+ assert.match(shell, /import \{ StartupRecovery \} from "\.\.\/\.\.\/components\/StartupRecovery"/);+ assert.match(shell, /<StartupRecovery[\s\S]*onRetry=\{retryStartup\}/);+ assert.match(shell, /startupPhase !== "starting"/);+ // Exactly one boot surface is mounted: the splash yields to the recovery.+ assert.match(shell, /const splash = showSplash && startupPhase === "starting"/);+ // Window controls are the only ones Windows/Linux have; they must be there+ // while the recovery surface owns the window.+ assert.match(shell, /\{\(ready \|\| startupPhase !== "starting"\) && !showSplash \? \(/);+ assert.match(shell, /startupWaitedMs/);+});++test("the watchdog hook owns its timers and keeps the wait alive on retry", () => {+ const hook = shell.match(/useStartupWatchdog\.ts[\s\S]*$/)?.[0] ?? shell;+ assert.match(hook, /return \(\) => watchdog\.stop\(\)/);+ assert.match(hook, /setAttempt\(\(current\) => current \+ 1\)/);+ // A boot that does finish must clear the phase, or the surface would outlive+ // the data it was covering.+ assert.match(hook, /if \(ready\) \{\n\s+setPhase\("starting"\);/);+ assert.match(hook, /void useAppStore\.getState\(\)\.bootstrap\(\)/);+});++test("quitting from the recovery surface is main-process owned", () => {+ assert.match(protocol, /appQuit: "pi-desktop\/app\/quit"/);+ assert.match(mainIpc, /handle\(IPC\.invoke\.appQuit, async \(\) => \{\n\s+app\.quit\(\);/);+ assert.match(mainIpc, /^import \{ app, BrowserWindow \} from "electron";/m);+ assert.match(apiSource, /quitApp: \(\) => invoke<\{ ok: boolean \}>\(IPC\.invoke\.appQuit\)/);+});++test("the recovery surface layers above the splash and below the window controls", () => {+ assert.match(css, /\.startup-recovery \{[\s\S]*position: fixed;[\s\S]*inset: 0;/);+ assert.match(css, /\.app-shell > \.startup-splash \{\n\s+z-index: 1300;/);+ assert.match(css, /\.startup-recovery \{[\s\S]*z-index: 1400;/);+ assert.match(+ css,+ /\.app-shell:has\(> \.startup-recovery\) > \.window-controls \{\n\s+z-index: 1500;/,+ );+ assert.match(css, /\.startup-recovery-actions \{[\s\S]*flex-wrap: wrap;/);+ // The surface is draggable like the splash, but its controls are not.+ assert.match(css, /\.startup-recovery \{[\s\S]*-webkit-app-region: drag;/);+ assert.match(css, /\.startup-recovery-card \{[\s\S]*-webkit-app-region: no-drag;/);+ assert.match(css, /prefers-reduced-motion: reduce\)[\s\S]*\.startup-recovery \{/);+});++test("the recovery copy is catalog-backed in every mirrored locale", () => {+ for (const [name, catalog] of [+ ["en", english],+ ["zh-CN", chinese],+ ["zh-TW", traditional],+ ]) {+ for (const key of [+ "slowTitle",+ "slowBody",+ "stalledTitle",+ "stalledBody",+ "copyDiagnostics",+ "diagnosticsCopied",+ "diagnosticsFailed",+ ]) {+ assert.match(catalog, new RegExp(`${key}:`), `${name} is missing startup.${key}`);+ }+ }+ assert.match(english, /stalledTitle: "PI-Desktop couldn't finish starting"/);+ assert.match(chinese, /stalledTitle: "PI-Desktop 未能完成启动"/);+ // User-facing copy: the local service is never called a host or a backend.+ const startupDomain = english.match(/\n startup: \{[\s\S]*?\n \},/)?.[0] ?? "";+ assert.ok(startupDomain.length > 0, "the English startup domain was not found");+ assert.doesNotMatch(startupDomain, /host|backend|sidecar|renderer/i);+ assert.match(startupDomain, /local service/);+});diff --git a/apps/desktop/test/window-menu.test.mjs b/apps/desktop/test/window-menu.test.mjsindex d1cb11a4a..a3ac543a9 100644--- a/apps/desktop/test/window-menu.test.mjs+++ b/apps/desktop/test/window-menu.test.mjs@@ -166,7 +166,12 @@ test("Windows and Linux use menu-free frameless chrome with window controls", ()assert.match(controlsSource, /ariaLabel=\{t\("window\.minimize"/);assert.match(controlsSource, /ariaLabel=\{t\("window\.close"/);assert.equal((appSource.match(/<WindowControls\s*\/>/g) ?? []).length, 1);- assert.match(appSource, /\{shell\}[\s\S]*?\{ready && !showSplash && <WindowControls \/>\}/);+ // The controls are rendered under the boot surfaces too, so a window that+ // never reaches the shell is still closable (issue #831).+ assert.match(+ appSource,+ /\{shell\}[\s\S]*?\{\(ready \|\| startupPhase !== "starting"\) && !showSplash \?/,+ );assert.match(stylesSource,/\.window-control-btn\s*\{[^}]*-webkit-app-region:\s*no-drag;[^}]*pointer-events:\s*auto;/s,diff --git a/apps/desktop/test/work-panel.test.mjs b/apps/desktop/test/work-panel.test.mjsindex d814524a9..39d93b82b 100644--- a/apps/desktop/test/work-panel.test.mjs+++ b/apps/desktop/test/work-panel.test.mjs@@ -614,7 +614,12 @@ test("preview mode keeps shell actions and restores routes before navigation", (assert.match(appSource, /className=\{cx\([\s\S]*?"window-chrome-row"/);assert.match(appSource, /data-nav="new-task"/);assert.match(appSource, /<CollapsedTitlebarActions[\s\S]*?onNewTask=/);- assert.match(appSource, /\{ready && !showSplash && <WindowControls \/>\}/);+ // The boot surfaces (splash and startup recovery) own the window before the+ // shell is ready, so the controls follow whichever of them is up.+ assert.match(+ appSource,+ /\{\(ready \|\| startupPhase !== "starting"\) && !showSplash \? \(\s*<WindowControls \/>/,+ );assert.match(appSource, /const workPanelMaximizedRef = useRef\(false\)/);assert.match(appSource,diff --git a/docs/spec/03-runtime/07-process-model.md b/docs/spec/03-runtime/07-process-model.mdindex 97759e26e..1654d13d7 100644--- a/docs/spec/03-runtime/07-process-model.md+++ b/docs/spec/03-runtime/07-process-model.md@@ -59,6 +59,19 @@ queued/running `plan_approvals` execution states interrupted and aborts theirrunning turns. This internal process-epoch fence is not serialized or sent overthe protocol.+The renderer bootstrap has no timeout of its own, so the renderer watches its own+wait for the first state. At `STARTUP_SLOW_HINT_MS` (30s) the boot surface adds+logs, diagnostics, and quit without calling the boot a failure; at+`STARTUP_STALLED_MS` (180s) it becomes the recovery surface, which also offers a+retry. Both bounds sit above the main↔host RPC ceiling+(`DEFAULT_RPC_TIMEOUT_MS`, 130s), so a slow but successful boot is never reported+as a failure. The watchdog never cancels the startup it watches: a boot that+finishes replaces the surface with the shell, and the recovery surface replaces+the splash. The renderer-drawn window controls stay above that surface, so a+frameless Windows/Linux window can always be closed, and quitting from it goes+through the renderer quit channel (`pi-desktop/app/quit`), which runs the same+ordered shutdown as the Quit menu item.+After host-core is up, Electron main reads `AppSettings.networkProxy` andapplies it before spawning the agent sidecar (D340). Chromium sessions use`session.setProxy`; main-process `fetch` is `net.fetch`; the sidecar receivesdiff --git a/docs/spec/06-delivery/04-e2e-test-plan.md b/docs/spec/06-delivery/04-e2e-test-plan.mdindex 90b298a14..c5964c27c 100644--- a/docs/spec/06-delivery/04-e2e-test-plan.md+++ b/docs/spec/06-delivery/04-e2e-test-plan.md@@ -4927,9 +4927,11 @@ identify the platform validation still needed.3. Wait until sessions/settings bootstrap finishes.4. Repeat with OS `prefers-reduced-motion: reduce` when available.5. On macOS, compare the splash surface with the sidebar glass after the shell appears.+ 6. Repeat with `bootstrap` held unanswered past the watchdog bounds, and observe the boot surface at 30s and after 180s (issue #831).- **Expected**:- Before ready: full-window splash with brand mark, shell name, tagline, and accessible starting status (`data-testid="startup-splash"`).- After ready: splash exits with a short fade (or instantly under reduced motion) and the main shell (or settings page) is interactive underneath.+ - If the initial state never arrives, the splash is replaced rather than held: the boot surface gains logs, diagnostics, and quit at 30s (`STARTUP_SLOW_HINT_MS`) without reporting a failure, and at 180s (`STARTUP_STALLED_MS`) becomes the recovery surface, which also offers a retry (`data-testid="startup-recovery"`); every action works without a backend, the renderer-drawn window controls stay above the surface on Windows/Linux, and quit goes through `pi-desktop/app/quit`.- On macOS the splash uses the same glass tint and sheen as the sidebar over native `sidebar` vibrancy; the mounted shell stays hidden until the splash exit fade, then cross-fades in. Other platforms keep the opaque `--ds-bg-primary` fill.- No plain unbranded “Starting…” centered text as the only boot UI.- Overlay/dialog enter motion uses shared tokens; reduced motion keeps state changes without decorative duration.diff --git a/docs/spec/08-meta/decisions-log.md b/docs/spec/08-meta/decisions-log.mdindex 4cc7e2031..317c2bb07 100644--- a/docs/spec/08-meta/decisions-log.md+++ b/docs/spec/08-meta/decisions-log.md@@ -6595,3 +6595,23 @@ that was sitting at the bottom — including after the turn had finished.by `apps/desktop/test/default-model-display.test.mjs` and`apps/desktop/test/image-generation-default.test.mjs`, with`provider-model-config.test.mjs` asserting the add branch consults them.++## 2026-09-22 — A renderer that never reaches its first state gets a bounded surface and a quit channel (D613)++- The renderer's startup had no timeout of its own: `bootstrap()` either+ publishes the initial state or nothing, so one read that never settled left the+ window on the boot surface with no menu, no data, and nothing to act on except+ force-quitting the process (issue #831). The renderer now watches its own wait.+ `STARTUP_SLOW_HINT_MS` (30s) adds logs, diagnostics, and quit to the boot+ surface without calling the boot a failure; `STARTUP_STALLED_MS` (180s) turns it+ into the recovery surface, which also offers a retry that re-runs `bootstrap()`.+- Both bounds sit above the main↔host RPC ceiling (`DEFAULT_RPC_TIMEOUT_MS`,+ 130s), so a slow but successful boot is never read as a failure, and the+ watchdog never cancels the startup it watches: a boot that finishes replaces the+ surface with the shell. The recovery surface replaces the splash (exactly one+ boot surface is mounted), and the renderer-drawn window controls stay above it,+ so a frameless Windows/Linux window can always be closed.+- The renderer gains the quit channel `pi-desktop/app/quit` (`api.quitApp()`),+ whose handler calls `app.quit()` exactly like the Quit menu item, so the ordered+ shutdown, the confirmation dialog, and the close behavior stay the ones the app+ already has. See `03-runtime/07-process-model.md` §3 and E2E-076.diff --git a/docs/zh-CN/spec/03-runtime/07-process-model.md b/docs/zh-CN/spec/03-runtime/07-process-model.mdindex fecbb9a22..5b629ecc6 100644--- a/docs/zh-CN/spec/03-runtime/07-process-model.md+++ b/docs/zh-CN/spec/03-runtime/07-process-model.md@@ -57,6 +57,15 @@ queued/running `plan_approvals` 执行状态已中断并中止它们跑步轮流。此内部进程纪元栅栏未序列化或发送协议。+渲染器的 bootstrap 本身没有超时,因此由渲染器自己监视对首个状态的等待。到达+`STARTUP_SLOW_HINT_MS`(30 秒)时,启动表面在不判定启动失败的前提下加上日志、+诊断与退出;到达 `STARTUP_STALLED_MS`(180 秒)时它变成恢复表面,并额外提供+重试。两个界限都高于 main↔host 的 RPC 上限(`DEFAULT_RPC_TIMEOUT_MS`,130 秒),+因此慢但成功的启动永远不会被报告为失败。看门狗从不取消它所监视的启动:成功完成+的启动会用 shell 替换该表面,恢复表面则替换启动画面。渲染器绘制的窗口控制按钮+保持在该表面之上,因此无边框的 Windows/Linux 窗口始终可以关闭;从该表面退出走+渲染器退出通道(`pi-desktop/app/quit`),它与“退出”菜单项执行同一套有序关停。+## 4. 崩溃策略| 崩溃 | 政策 |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 67407c32f..aae2a0e69 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@@ -3142,9 +3142,11 @@ IPC 请求无法关闭。3. 等待 sessions/settings 引导程序完成。4. 如果可用,请对 OS `prefers-reduced-motion: reduce` 重复此操作。5. 在 macOS 上,将启动面与 shell 出现后的侧边栏玻璃态对比。+ 6. 在 `bootstrap` 一直被搁置、超过看门狗界限时重复一次,在 30 秒与超过 180 秒时观察启动表面(issue #831)。- **预期**:- 准备之前:带有品牌标志、外壳名称、标语和可访问的启动状态 (`data-testid="startup-splash"`) 的全窗口启动画面。- 准备好后:启动画面会短暂淡出(或立即减少运动)退出,并且主外壳(或设置页面)在下面是交互式的。+ - 如果初始状态始终没有到达,启动画面不是被一直保留而是被替换:启动表面在 30 秒(`STARTUP_SLOW_HINT_MS`)时加上日志、诊断与退出且不报告失败,在 180 秒(`STARTUP_STALLED_MS`)时变成恢复表面,并额外提供重试(`data-testid="startup-recovery"`);每个操作都不依赖后端,Windows/Linux 上渲染器绘制的窗口控制按钮保持在该表面之上,退出走 `pi-desktop/app/quit`。- macOS 上启动页与侧边栏使用同一套玻璃 tint/sheen,叠在原生 `sidebar` vibrancy 之上;已挂载的 shell 在退出淡出前保持隐藏,再交叉淡入。其他平台仍为不透明的 `--ds-bg-primary`。- 没有简单的无品牌“开始...”居中文本作为唯一的启动 UI。- Overlay/dialog 输入动作使用共享令牌;减少的运动可以保持状态变化,而无需装饰持续时间。diff --git a/docs/zh-CN/spec/08-meta/decisions-log.md b/docs/zh-CN/spec/08-meta/decisions-log.mdindex cb3a1f969..f77ccd273 100644--- a/docs/zh-CN/spec/08-meta/decisions-log.md+++ b/docs/zh-CN/spec/08-meta/decisions-log.md@@ -4677,3 +4677,19 @@ that amendment are retired by ADR 0268; the upstream work-panel lifecycle stays.`apps/desktop/test/default-model-display.test.mjs` 与`apps/desktop/test/image-generation-default.test.mjs` 固定,`provider-model-config.test.mjs` 断言新增分支会走这两个判断。++## 2026-09-22 —— 从未拿到初始状态的渲染器有了有界表面与退出通道(D613)++- 渲染器的启动过程本身没有超时:`bootstrap()` 要么发布初始状态,要么什么都不发布,+ 因此一次始终没有落地的读取会让窗口一直停在启动表面上——没有菜单、没有数据,除了+ 强杀进程无事可做(issue #831)。渲染器现在自己监视这段等待:+ `STARTUP_SLOW_HINT_MS`(30 秒)在不判定启动失败的前提下为启动表面加上日志、诊断与+ 退出,`STARTUP_STALLED_MS`(180 秒)把它变成恢复表面,后者还提供重跑+ `bootstrap()` 的重试。+- 两个界限都高于 main↔host 的 RPC 上限(`DEFAULT_RPC_TIMEOUT_MS`,130 秒),因此慢+ 但成功的启动不会被读成失败;看门狗从不取消它所监视的启动,成功完成的启动会用 shell+ 替换该表面。恢复表面替换启动画面(同一时刻只挂载一个启动表面),渲染器绘制的窗口+ 控制按钮保持在其之上,因此无边框的 Windows/Linux 窗口始终可以关闭。+- 渲染器新增退出通道 `pi-desktop/app/quit`(`api.quitApp()`),其处理函数与“退出”+ 菜单项一样调用 `app.quit()`,因此有序关停、确认对话框和关闭行为都仍是应用已有的+ 那一套。参见 `03-runtime/07-process-model.md` §3 与 E2E-076。diff --git a/packages/i18n/src/locales/de/index.ts b/packages/i18n/src/locales/de/index.tsindex f14c49f77..deeb57119 100644--- a/packages/i18n/src/locales/de/index.ts+++ b/packages/i18n/src/locales/de/index.ts@@ -8,6 +8,15 @@ export const de = {"loadingView": "Ansicht wird geladen…","uiCrashed": "Mit der Schnittstelle ist ein Fehler aufgetreten"},+ "startup": {+ "slowTitle": "Startet noch…",+ "slowBody": "PI-Desktop braucht länger als sonst, um Ihren lokalen Dienst zu erreichen. Der Start kann noch von selbst abschließen — Sie können warten oder zuerst die Protokolle sichern.",+ "stalledTitle": "PI-Desktop konnte den Start nicht abschließen",+ "stalledBody": "Dieses Fenster hat Ihre Chats und Einstellungen nie erhalten, daher gibt es noch nichts anzuzeigen. Es wurde nichts gelöscht — Ihre Daten sind noch auf dem Datenträger.",+ "copyDiagnostics": "Diagnosen kopieren",+ "diagnosticsCopied": "Diagnosen kopiert",+ "diagnosticsFailed": "Diagnosen konnten nicht kopiert werden"+ },"common": {"close": "Schließen","cancel": "Abbrechen",diff --git a/packages/i18n/src/locales/en/index.ts b/packages/i18n/src/locales/en/index.tsindex fd21d488a..74854d2b7 100644--- a/packages/i18n/src/locales/en/index.ts+++ b/packages/i18n/src/locales/en/index.ts@@ -6,6 +6,15 @@ export const en = {loadingView: "Loading view…",uiCrashed: "Something went wrong with the interface",},+ startup: {+ slowTitle: "Still starting…",+ slowBody: "PI-Desktop is taking longer than usual to reach your local service. It may still finish on its own — you can wait, or collect the logs first.",+ stalledTitle: "PI-Desktop couldn't finish starting",+ stalledBody: "This window never received your chats and settings, so there is nothing to show yet. Nothing was deleted — your data is still on disk.",+ copyDiagnostics: "Copy diagnostics",+ diagnosticsCopied: "Diagnostics copied",+ diagnosticsFailed: "Couldn't copy diagnostics",+ },/** Verbs and states that mean the same thing wherever they appear. */common: {close: "Close",diff --git a/packages/i18n/src/locales/es/index.ts b/packages/i18n/src/locales/es/index.tsindex 9b2e313db..05093e474 100644--- a/packages/i18n/src/locales/es/index.ts+++ b/packages/i18n/src/locales/es/index.ts@@ -8,6 +8,15 @@ export const es = {"loadingView": "Cargando vista…","uiCrashed": "Algo salió mal con la interfaz"},+ "startup": {+ "slowTitle": "Aún iniciando…",+ "slowBody": "PI-Desktop está tardando más de lo habitual en alcanzar tu servicio local. Puede que aún termine por sí solo — puedes esperar o recoger los registros primero.",+ "stalledTitle": "PI-Desktop no pudo terminar de iniciarse",+ "stalledBody": "Esta ventana nunca recibió tus chats y tu configuración, así que todavía no hay nada que mostrar. No se eliminó nada — tus datos siguen en el disco.",+ "copyDiagnostics": "Copiar diagnósticos",+ "diagnosticsCopied": "Diagnósticos copiados",+ "diagnosticsFailed": "No se pudieron copiar los diagnósticos"+ },"common": {"close": "Cerrar","cancel": "Cancelar",diff --git a/packages/i18n/src/locales/fr/index.ts b/packages/i18n/src/locales/fr/index.tsindex c4ea52aea..fc06758e7 100644--- a/packages/i18n/src/locales/fr/index.ts+++ b/packages/i18n/src/locales/fr/index.ts@@ -8,6 +8,15 @@ export const fr = {"loadingView": "Chargement de la vue…","uiCrashed": "Un problème s'est produit avec l'interface"},+ "startup": {+ "slowTitle": "Démarrage toujours en cours…",+ "slowBody": "PI-Desktop met plus de temps que d'habitude à joindre votre service local. Le démarrage peut encore aboutir de lui-même — vous pouvez patienter ou récupérer d'abord les journaux.",+ "stalledTitle": "PI-Desktop n'a pas pu terminer son démarrage",+ "stalledBody": "Cette fenêtre n'a jamais reçu vos discussions ni vos paramètres, donc rien ne peut encore s'afficher. Rien n'a été supprimé — vos données sont toujours sur le disque.",+ "copyDiagnostics": "Copier les diagnostics",+ "diagnosticsCopied": "Diagnostics copiés",+ "diagnosticsFailed": "Impossible de copier les diagnostics"+ },"common": {"close": "Fermer","cancel": "Annuler",diff --git a/packages/i18n/src/locales/ko/index.ts b/packages/i18n/src/locales/ko/index.tsindex b5c012ba8..d96ce3905 100644--- a/packages/i18n/src/locales/ko/index.ts+++ b/packages/i18n/src/locales/ko/index.ts@@ -8,6 +8,15 @@ export const ko = {loadingView: "화면 불러오는 중…",uiCrashed: "인터페이스에 문제가 발생했습니다",},+ startup: {+ slowTitle: "아직 시작 중…",+ slowBody: "PI-Desktop이 로컬 서비스에 연결되는 데 평소보다 오래 걸리고 있습니다. 스스로 완료될 수도 있으니 기다리거나, 먼저 로그를 수집해 두세요.",+ stalledTitle: "PI-Desktop이 시작을 완료하지 못했습니다",+ stalledBody: "이 창은 대화와 설정을 받지 못해 아직 표시할 내용이 없습니다. 삭제된 것은 없으며 데이터는 여전히 디스크에 있습니다.",+ copyDiagnostics: "진단 정보 복사",+ diagnosticsCopied: "진단 정보 복사됨",+ diagnosticsFailed: "진단 정보를 복사하지 못했습니다",+ },/** Verbs and states that mean the same thing wherever they appear. */common: {close: "닫기",diff --git a/packages/i18n/src/locales/tr/index.ts b/packages/i18n/src/locales/tr/index.tsindex 29c94b55c..25269eca8 100644--- a/packages/i18n/src/locales/tr/index.ts+++ b/packages/i18n/src/locales/tr/index.ts@@ -8,6 +8,15 @@ export const tr = {loadingView: "Görünüm yükleniyor…",uiCrashed: "Arayüzde bir sorun oluştu",},+ startup: {+ slowTitle: "Hâlâ başlatılıyor…",+ slowBody: "PI-Desktop yerel servise ulaşmakta normalden uzun sürüyor. Kendiliğinden tamamlanabilir — bekleyebilir ya da önce günlükleri toplayabilirsiniz.",+ stalledTitle: "PI-Desktop başlatmayı tamamlayamadı",+ stalledBody: "Bu pencere sohbetlerinizi ve ayarlarınızı hiç almadı, bu yüzden henüz gösterilecek bir şey yok. Hiçbir şey silinmedi — verileriniz hâlâ diskte.",+ copyDiagnostics: "Tanılamaları kopyala",+ diagnosticsCopied: "Tanılamalar kopyalandı",+ diagnosticsFailed: "Tanılamalar kopyalanamadı",+ },/** Verbs and states that mean the same thing wherever they appear. */common: {close: "Kapat",diff --git a/packages/i18n/src/locales/zh-CN/index.ts b/packages/i18n/src/locales/zh-CN/index.tsindex cdbfe54b4..bf88084e6 100644--- a/packages/i18n/src/locales/zh-CN/index.ts+++ b/packages/i18n/src/locales/zh-CN/index.ts@@ -8,6 +8,15 @@ export const zhCN = {loadingView: "正在加载页面…",uiCrashed: "界面出现了问题",},+ startup: {+ slowTitle: "仍在启动…",+ slowBody: "PI-Desktop 连接本地服务比平时更久,可能还会自己完成启动——你可以继续等待,也可以先把日志收好。",+ stalledTitle: "PI-Desktop 未能完成启动",+ stalledBody: "这个窗口一直没拿到你的会话和设置,所以暂时没有内容可以显示。数据没有被删除,仍在磁盘上。",+ copyDiagnostics: "复制诊断信息",+ diagnosticsCopied: "诊断信息已复制",+ diagnosticsFailed: "无法复制诊断信息",+ },common: {close: "关闭",cancel: "取消",diff --git a/packages/i18n/src/locales/zh-TW/index.ts b/packages/i18n/src/locales/zh-TW/index.tsindex 39f614962..6581d7a4c 100644--- a/packages/i18n/src/locales/zh-TW/index.ts+++ b/packages/i18n/src/locales/zh-TW/index.ts@@ -8,6 +8,15 @@ export const zhTW = {loadingView: "正在載入頁面…",uiCrashed: "介面出現了問題",},+ startup: {+ slowTitle: "仍在啟動…",+ slowBody: "PI-Desktop 連接本地服務比平時更久,可能還是會自己完成啟動——你可以繼續等待,也可以先把日誌收好。",+ stalledTitle: "PI-Desktop 未能完成啟動",+ stalledBody: "這個視窗一直沒拿到你的會話與設定,所以暫時沒有內容可以顯示。資料沒有被刪除,仍在磁碟上。",+ copyDiagnostics: "複製診斷資訊",+ diagnosticsCopied: "診斷資訊已複製",+ diagnosticsFailed: "無法複製診斷資訊",+ },common: {close: "關閉",cancel: "取消",diff --git a/packages/shared/src/protocol.ts b/packages/shared/src/protocol.tsindex 10498500e..2cfc2d2dd 100644--- a/packages/shared/src/protocol.ts+++ b/packages/shared/src/protocol.ts@@ -55,6 +55,12 @@ export const IPC = {appHealth: "pi-desktop/app/health",appGetOnboarding: "pi-desktop/app/getOnboarding",appDismissOnboarding: "pi-desktop/app/dismissOnboarding",+ /**+ * Quit the whole application through the ordered shutdown. Exposed for the+ * surfaces that own the window while the shell has no data yet — a stuck+ * startup must always be able to exit the app (issue #831).+ */+ appQuit: "pi-desktop/app/quit",/** Installed system font families, resolved by Electron main. */systemFontsList: "pi-desktop/app/systemFonts",updatesGetState: "pi-desktop/updates/getState",