Skip to content

The agent that grows with you

merge origin/main (6 commits) into ethie/pm-clean

ethernetee13ef27f3e1
diff --cc apps/desktop/electron/main.ts
index 2cb9f80a085,213cd10586f..d3c3bbef68e
--- a/apps/desktop/electron/main.ts
+++ b/apps/desktop/electron/main.ts
@@@ -16142,41 -17210,34 +16142,41 @@@ ipcMain.handle('hermes:api', async (_ev
const mutatingProfile = deletingProfile || profileRenameFromRequest(request)?.oldName || null
const registryConnectionId = apiRequestRegistryConnectionId(request)
- if (deletingProfile && registryConnectionId) {
- return dispatchConnectionScopedProfileDelete(request, {
- acquire: profile => profileDeletionGate.acquire(profile),
- connectionKind: connectionId => registryConnectionKind(connectionId),
- dispatch: routeProfile =>
- dispatchRegistryApiRequest(request, registryConnectionId, routeProfile, deletingProfile),
- isDefaultProfile: profile => profile === 'default',
- isValidProfileName: profile => PROFILE_NAME_RE.test(profile),
- prepareLocal: localRequest => prepareProfileDeleteRequest(localRequest).then(() => undefined),
- teardownConnection: (connectionId, profile) => teardownConnectionScopedProfileBackend(connectionId, profile)
- })
- }
+ try {
+ if (deletingProfile && registryConnectionId) {
+ return await dispatchConnectionScopedProfileDelete(request, {
+ acquire: profile => profileDeletionGate.acquire(profile),
+ connectionKind: connectionId => registryConnectionKind(connectionId),
+ dispatch: routeProfile =>
+ dispatchRegistryApiRequest(request, registryConnectionId, routeProfile, deletingProfile),
+ isDefaultProfile: profile => profile === 'default',
+ isValidProfileName: profile => PROFILE_NAME_RE.test(profile),
+ prepareLocal: localRequest => prepareProfileDeleteRequest(localRequest).then(() => undefined),
+ teardownConnection: (connectionId, profile) => teardownConnectionScopedProfileBackend(connectionId, profile)
+ })
+ }
- if (!mutatingProfile) {
- return handleHermesApiRequest(request)
- }
+ if (!mutatingProfile) {
+ return await handleHermesApiRequest(request)
+ }
- const releaseProfileDeletion = profileDeletionGate.acquire(mutatingProfile)
+ const releaseProfileDeletion = profileDeletionGate.acquire(mutatingProfile)
- return handleHermesApiRequest(request).finally(releaseProfileDeletion)
+ return await handleHermesApiRequest(request).finally(releaseProfileDeletion)
+ } catch (error) {
+ // Persist the failure (full stack) before the rejection crosses to the
+ // renderer, where the invoke wrapper strips it to a one-line message.
+ rememberLog(formatApiRequestFailure(request, error))
+ flushDesktopLogBufferSync()
+ throw error
+ }
})
-// Main serializes cross-window ambient claims (see event-dedupe.ts for why a
-// spoken reply holds its claim far longer than a beep).
-const ownsAmbientCue = createAmbientClaimArbiter()
-ipcMain.handle('hermes:ambient:claim', (_event, key) => ownsAmbientCue(String(key ?? '')))
+// Speech claims outlive instant cues so throttled peer windows cannot replay a reply.
+const ownsAmbientCue: ReturnType<typeof createAmbientClaimArbiter> = createAmbientClaimArbiter()
+ipcMain.handle('hermes:ambient:claim', (_event: IpcMainInvokeEvent, key: unknown): boolean => ownsAmbientCue(String(key ?? '')))
- registerNativeNotifications({ getMainWindow: (): BrowserWindow | null => mainWindow, focusWindow })
-const nativeNotifications = registerNativeNotifications({ getMainWindow: () => mainWindow, focusWindow })
++const nativeNotifications = registerNativeNotifications({ getMainWindow: (): BrowserWindow | null => mainWindow, focusWindow })
// Data-URL file load cap (composer attach + local previews). Main owns the
// persisted MB value so every IPC read honours Settings → Chat without the