From 680ff2267a718fceaf549e322c94e9dd67dcc5e3 Mon Sep 17 00:00:00 2001 From: brennanb2025 Date: Tue, 28 Apr 2026 10:58:17 -0700 Subject: [PATCH] refactor(ipc): dedupe AppRuntimeFlags in preload, fix JSDoc semantics MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Import AppRuntimeFlags/DaemonTransitionNotice from ./api-types instead of re-declaring their shapes inline on getRuntimeFlags / consumeDaemonTransitionNotice — ipcRenderer.invoke returns Promise so inline drift would not be caught by the compiler. - Rewrite JSDoc on agentDashboardEnabledAtStartup to describe what the flag actually reports (raw setting value at boot). Install failures for Claude/Codex/Gemini hooks are logged but do not flip the flag; the prior wording implied install-success semantics that did not hold. Co-authored-by: Orca --- src/main/ipc/app.ts | 8 +++++--- src/preload/index.ts | 8 +++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/main/ipc/app.ts b/src/main/ipc/app.ts index dd5d4b9fb..4910184bf 100644 --- a/src/main/ipc/app.ts +++ b/src/main/ipc/app.ts @@ -10,9 +10,11 @@ export type AppRuntimeFlags = { * The renderer compares this against the current setting to decide whether * a "restart required" banner needs to be shown on the Experimental pane. */ daemonEnabledAtStartup: boolean - /** Whether the experimental agent dashboard was enabled at startup — i.e. - * whether Claude/Codex/Gemini managed hooks were installed for this - * session. Toggling the setting only flips hook installation on the next + /** Whether the experimental agent dashboard setting was enabled when this + * session booted. When true, Claude/Codex/Gemini managed hook installation + * was attempted at startup (individual install failures are logged but do + * not flip this flag — the dashboard UI itself treats missing hooks as + * no-ops). Toggling the setting only affects hook installation on the next * launch, so the renderer compares this against the current setting to * decide whether a "restart required" banner needs to be shown. */ agentDashboardEnabledAtStartup: boolean diff --git a/src/preload/index.ts b/src/preload/index.ts index 998a54bbc..a472eb96e 100644 --- a/src/preload/index.ts +++ b/src/preload/index.ts @@ -4,6 +4,7 @@ review and type drift checks easier than scattering these bindings across module import { contextBridge, ipcRenderer, webFrame, webUtils } from 'electron' import { electronAPI } from '@electron-toolkit/preload' import { preloadE2EConfig } from './e2e-config' +import type { AppRuntimeFlags, DaemonTransitionNotice } from './api-types' import type { CliInstallStatus } from '../shared/cli-install-types' import type { AgentHookInstallStatus } from '../shared/agent-hook-types' import type { @@ -174,11 +175,8 @@ document.addEventListener( // Custom APIs for renderer const api = { app: { - getRuntimeFlags: (): Promise<{ - daemonEnabledAtStartup: boolean - agentDashboardEnabledAtStartup: boolean - }> => ipcRenderer.invoke('app:getRuntimeFlags'), - consumeDaemonTransitionNotice: (): Promise<{ killedCount: number } | null> => + getRuntimeFlags: (): Promise => ipcRenderer.invoke('app:getRuntimeFlags'), + consumeDaemonTransitionNotice: (): Promise => ipcRenderer.invoke('app:consumeDaemonTransitionNotice'), relaunch: (): Promise => ipcRenderer.invoke('app:relaunch'), // Why: on macOS this returns AppleCurrentKeyboardLayoutInputSourceID so