Local-first AI coding agent desktop: Electron + Rust host core + pi Agent Harness + user-installable plugins
TypeScript ai-agentcoding-agentdesktop-appelectronglobali18nlocal-firstmcppipi-agentpi-desktoppluginsreactrusttypescript
test(e2e): keep startup overlays off for automated renderer sessions
vastsa525a5801814b
diff --git a/apps/desktop/src/capture/renderer-api.ts b/apps/desktop/src/capture/renderer-api.tsindex bedeea3ff..b03b2da0d 100644--- a/apps/desktop/src/capture/renderer-api.ts+++ b/apps/desktop/src/capture/renderer-api.ts@@ -11,6 +11,7 @@*/import { useAppStore, type AppState, type ToastOptions } from "../stores/app-store";import type { CaptureRig, CaptureRigMethods } from "./capture-rig";+import { useStartupGuideRequest } from "../features/startup/startup-guide-request";type CaptureRigMethod = keyof CaptureRigMethods;@@ -30,6 +31,8 @@ export type RendererApi = {setThemeAttr: (theme: "light" | "dark") => void;clearProject: () => Promise<void>;showToast: (message: string, opts?: ToastOptions) => void;+ /** Keep the startup guide and release announcement off for automation. */+ skipStartupOverlays: () => void;} & (CaptureRigStubs | CaptureRigMethods);declare global {@@ -109,6 +112,7 @@ export function installRendererApi(): () => void {},clearProject: () => useAppStore.getState().clearProject(),showToast: (message, opts) => useAppStore.getState().showToast(message, opts),+ skipStartupOverlays: () => useStartupGuideRequest.getState().suppress(),...stubs,};window.__PI_DESKTOP__ = surface;diff --git a/apps/desktop/src/features/startup/AppOverlayHost.tsx b/apps/desktop/src/features/startup/AppOverlayHost.tsxindex 2e2c9ac60..ff6d962f1 100644--- a/apps/desktop/src/features/startup/AppOverlayHost.tsx+++ b/apps/desktop/src/features/startup/AppOverlayHost.tsx@@ -67,6 +67,7 @@ export function AppOverlayHost({ active }: { active: boolean }) {const setSettingsTab = useAppStore((s) => s.setSettingsTab);const replayRequested = useStartupGuideRequest((s) => s.requested);const clearReplay = useStartupGuideRequest((s) => s.clear);+ const suppressed = useStartupGuideRequest((s) => s.suppressed);const hasUsableModel = useHasUsableModel();const [decided, setDecided] = useState(false);const [guide, setGuide] = useState<ActiveGuide | null>(null);@@ -75,8 +76,9 @@ export function AppOverlayHost({ active }: { active: boolean }) {useEffect(() => {if (!active || decided) return;setDecided(true);- // Screenshot capture drives a fixed scene; first-run hints would cover it.- if (window.__PI_CAPTURE__) return;+ // Screenshot capture and automation drive a fixed scene; first-run hints+ // would cover it.+ if (window.__PI_CAPTURE__ || suppressed) return;const plan = planStartupGuide({completedVersion: loadStartupGuideCompletedVersion(),hasUsableModel,@@ -90,7 +92,15 @@ export function AppOverlayHost({ active }: { active: boolean }) {) {setAnnouncement(schedule);}- }, [active, decided, hasUsableModel]);+ }, [active, decided, hasUsableModel, suppressed]);++ // Suppression may arrive after the decision: drop what is showing without+ // recording it as seen.+ useEffect(() => {+ if (!suppressed) return;+ setGuide((current) => (current?.source === "auto" ? null : current));+ setAnnouncement(null);+ }, [suppressed]);useEffect(() => {if (!replayRequested) return;diff --git a/apps/desktop/src/features/startup/startup-guide-request.ts b/apps/desktop/src/features/startup/startup-guide-request.tsindex 00f470d72..e96b55745 100644--- a/apps/desktop/src/features/startup/startup-guide-request.ts+++ b/apps/desktop/src/features/startup/startup-guide-request.ts@@ -1,16 +1,24 @@import { create } from "zustand";/**- * A user request to replay the startup guide (Settings → About). Kept apart- * from the automatic first-launch decision: a replay never touches the- * "guide completed" marker.+ * Renderer-side requests that steer the startup overlays from outside the+ * host component:+ * - `requested`: the user asked to replay the startup guide (Settings → Info).+ * A replay never touches the "guide completed" marker.+ * - `suppressed`: automation (`window.__PI_DESKTOP__.skipStartupOverlays`)+ * drives a fresh profile and must not be covered by first-run overlays.+ * Nothing is recorded as seen, so the real user flow is unchanged.*/export const useStartupGuideRequest = create<{requested: boolean;+ suppressed: boolean;request: () => void;clear: () => void;+ suppress: () => void;}>((set) => ({requested: false,+ suppressed: false,request: () => set({ requested: true }),clear: () => set({ requested: false }),+ suppress: () => set({ suppressed: true }),}));diff --git a/apps/desktop/test/e2e/plugin-ui-slots/clients.mjs b/apps/desktop/test/e2e/plugin-ui-slots/clients.mjsindex ca152cc45..f85c37fcb 100644--- a/apps/desktop/test/e2e/plugin-ui-slots/clients.mjs+++ b/apps/desktop/test/e2e/plugin-ui-slots/clients.mjs@@ -103,6 +103,21 @@ export async function connectRenderer(port) {// element.focus(), and the focus-return checks would read the desktop's// window stacking instead of the app.await call("Emulation.setFocusEmulationEnabled", { enabled: true });+ // A fresh profile shows the first-launch guide over the shell; automation+ // drives the shell itself, so keep the startup overlays off. The automation+ // surface is installed when the shell mounts, before the overlays decide.+ {+ const deadline = Date.now() + 30_000;+ while (Date.now() < deadline) {+ const skipped = await run(() => {+ if (!window.__PI_DESKTOP__?.skipStartupOverlays) return false;+ window.__PI_DESKTOP__.skipStartupOverlays();+ return true;+ });+ if (skipped) break;+ await sleep(50);+ }+ }return {run,async until(fn, arg, label, timeoutMs = 15_000) {diff --git a/apps/desktop/test/e2e/trusted-extensions/drive.mjs b/apps/desktop/test/e2e/trusted-extensions/drive.mjsindex d6b33a208..732567bd5 100644--- a/apps/desktop/test/e2e/trusted-extensions/drive.mjs+++ b/apps/desktop/test/e2e/trusted-extensions/drive.mjs@@ -251,6 +251,9 @@ check("a model turn refreshes the plugin credential and uses its access token",check("the refresh callback ran in the plugin process", readFileSync(hookPath, "utf8").includes("provider_oauth_refresh"));check("refresh credentials never enter model requests", !JSON.stringify(oauthRequest ?? {}).includes("plugin-refresh"));+// Settings is a dialog: close any instance left from the OAuth step first.+await ui.run(() => document.querySelector('[data-nav="close-settings"]')?.click());+await ui.until(() => !document.querySelector(".settings-dialog"), null, "Settings dialog to close");await ui.click('button[data-nav="settings"]');await ui.until(() => Boolean(document.querySelector(".settings-shell-full")), null, "Settings before sign-out");const reopenedModels = await ui.run((label) => {diff --git a/docs/spec/04-ux/05-onboarding.md b/docs/spec/04-ux/05-onboarding.mdindex bd31d7aca..8d7ba7580 100644--- a/docs/spec/04-ux/05-onboarding.md+++ b/docs/spec/04-ux/05-onboarding.md@@ -42,7 +42,10 @@ rules, `AppOverlayHost.tsx` owns presentation).- **Replay**: Settings → About → *Startup guide* opens the guide for theuser's current state. A replay never writes the completion marker. While itis up, Settings waits underneath and returns when the guide ends.-- Not shown in screenshot capture (`window.__PI_CAPTURE__`).+- Not shown in screenshot capture (`window.__PI_CAPTURE__`) or after+ automation calls `window.__PI_DESKTOP__.skipStartupOverlays()` (the shared+ E2E renderer client does this on connect); suppression records nothing as+ seen and also keeps the announcement off.## 4. Release announcement