fix(desktop): keep notification IPC types independent of the renderer

The Electron composite project imported src/global.d.ts and followed its renderer-only dependencies. Share the notification payload from a dependency-free Electron module instead; all desktop typechecks and lint now pass.
This commit is contained in:
brooklyn!
2026-09-09 21:34:56 -07:00
parent 85571c16b6
commit 78052fe437
4 changed files with 23 additions and 22 deletions
@@ -3,7 +3,7 @@ import { EventEmitter } from 'node:events'
import type { BrowserWindow, IpcMainInvokeEvent } from 'electron'
import { beforeEach, expect, it, vi } from 'vitest'
import type { HermesNotification } from '../src/global'
import type { HermesNotification } from './notification-types'
const host = vi.hoisted(() => ({
handle: vi.fn(),
+2 -2
View File
@@ -1,10 +1,9 @@
import { BrowserWindow, ipcMain, Notification } from 'electron'
import type { HermesNotification } from '../src/global'
import { createEventDeduper } from './event-dedupe'
import { resolveNotificationAction } from './notification-actions'
import { createNotificationRegistry } from './notification-registry'
import type { HermesNotification } from './notification-types'
interface NotificationHost {
getMainWindow: () => BrowserWindow | null
@@ -31,6 +30,7 @@ export function registerNativeNotifications({ getMainWindow, focusWindow }: Noti
const actions = Array.isArray(payload?.actions) ? payload.actions : []
const icon = typeof payload?.icon === 'string' && payload.icon.trim() ? payload.icon.trim() : undefined
const notification = new Notification({
title: payload?.title || 'Hermes',
body: payload?.body || '',
@@ -0,0 +1,19 @@
export interface HermesNotification {
title?: string
body?: string
silent?: boolean
kind?: string
sessionId?: string
/** Durable click target captured before runtime bindings can be recycled. */
focusSessionId?: string
/** Dedupe discriminator for session-less notifications (e.g. plugin id). */
tag?: string
/** Absolute icon path for Electron `Notification`. */
icon?: string
/** Resolved hash-router path opened on body click (plugin / deeplink-compatible). */
activate?: string
/** Renderer handle for onActivate / onAction callbacks. */
notifyId?: string
actions?: { id: string; text: string; activate?: string }[]
}
+1 -19
View File
@@ -1,6 +1,7 @@
import type { GatewayWsUrlResult } from '@hermes/shared'
import type { TranslucencyState } from '@hermes/shared/translucency'
import type { HermesNotification } from '../electron/notification-types'
import type { PoolLimits } from '../electron/pool-limits'
import type { WakeIndicatorState } from './lib/wake-indicator'
@@ -1238,25 +1239,6 @@ export interface HermesApiRequest {
connectionId?: string | null
}
export interface HermesNotification {
title?: string
body?: string
silent?: boolean
kind?: string
sessionId?: string
/** Durable click target captured before runtime bindings can be recycled. */
focusSessionId?: string
/** Dedupe discriminator for session-less notifications (e.g. plugin id). */
tag?: string
/** Absolute icon path for Electron `Notification`. */
icon?: string
/** Resolved hash-router path opened on body click (plugin / deeplink-compatible). */
activate?: string
/** Renderer handle for onActivate / onAction callbacks. */
notifyId?: string
actions?: { id: string; text: string; activate?: string }[]
}
export interface HermesPreviewTarget {
binary?: boolean
byteSize?: number