refactor(ipc): dedupe AppRuntimeFlags in preload, fix JSDoc semantics

- Import AppRuntimeFlags/DaemonTransitionNotice from ./api-types instead
  of re-declaring their shapes inline on getRuntimeFlags /
  consumeDaemonTransitionNotice — ipcRenderer.invoke returns Promise<any>
  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 <help@stably.ai>
This commit is contained in:
brennanb2025
2026-04-28 10:58:17 -07:00
co-authored by Orca
parent feddc001e0
commit 680ff2267a
2 changed files with 8 additions and 8 deletions
+5 -3
View File
@@ -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
+3 -5
View File
@@ -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<AppRuntimeFlags> => ipcRenderer.invoke('app:getRuntimeFlags'),
consumeDaemonTransitionNotice: (): Promise<DaemonTransitionNotice | null> =>
ipcRenderer.invoke('app:consumeDaemonTransitionNotice'),
relaunch: (): Promise<void> => ipcRenderer.invoke('app:relaunch'),
// Why: on macOS this returns AppleCurrentKeyboardLayoutInputSourceID so