Skip to content

The agent that grows with you

style(desktop): eslint/prettier pass on the plugin-compat notice (sort-imports, curly)

Teknium2c6c64580305
diff --git a/apps/desktop/electron/main.ts b/apps/desktop/electron/main.ts
index b531d4ef798..90ec7faf491 100644
--- a/apps/desktop/electron/main.ts
+++ b/apps/desktop/electron/main.ts
@@ -204,10 +204,6 @@ import { probeGatewayWebSocket } from './gateway-ws-probe'
import { registerGitIpc } from './git-ipc'
import { clearStaleGitLocks } from './gitlock'
import { readAndConsumeHandoffResult } from './handoff-result'
-import {
- pendingNotice as pendingPluginCompatNotice,
- recordDismissed as recordPluginCompatDismissed
-} from './plugin-compat-notice'
import {
ATTACHMENT_UPLOAD_DEFAULT_MAX_BYTES,
clampDataUrlReadMaxMb,
@@ -278,6 +274,10 @@ import { serializeJsonBody, setJsonRequestHeaders } from './oauth-net-request'
import { LEGACY_OAUTH_PARTITION, resolveOauthPartition } from './oauth-partition'
import { createParentStartMarkerResolver, parentWatchdogEnv } from './parent-process-identity'
import { registerPetOverlayIpc } from './pet-overlay-ipc'
+import {
+ pendingNotice as pendingPluginCompatNotice,
+ recordDismissed as recordPluginCompatDismissed
+} from './plugin-compat-notice'
import {
buildRegistryProfileRoutes,
isLocalEnumerationFailure,
@@ -6726,18 +6726,29 @@ function getAppIconPath() {
let pluginCompatNoticeShown = false
async function showPluginCompatNoticeOnce() {
- if (pluginCompatNoticeShown) return
- if (!mainWindow || mainWindow.isDestroyed()) return
+ if (pluginCompatNoticeShown) {
+ return
+ }
+
+ if (!mainWindow || mainWindow.isDestroyed()) {
+ return
+ }
let notice
+
try {
notice = pendingPluginCompatNotice(HERMES_HOME, app.getPath('userData'))
} catch (err) {
rememberLog(`[plugins] compat notice check failed: ${err.message}`)
+
+ return
+ }
+
+ if (!notice) {
return
}
- if (!notice) return
pluginCompatNoticeShown = true
rememberLog(`[plugins] compat notice shown (${notice.key})`)
+
try {
await dialog.showMessageBox(mainWindow, {
type: 'warning',
diff --git a/apps/desktop/electron/plugin-compat-notice.test.ts b/apps/desktop/electron/plugin-compat-notice.test.ts
index c7a5e08cac2..e4032690ed0 100644
--- a/apps/desktop/electron/plugin-compat-notice.test.ts
+++ b/apps/desktop/electron/plugin-compat-notice.test.ts
@@ -2,8 +2,10 @@ import assert from 'node:assert/strict'
import fs from 'node:fs'
import os from 'node:os'
import path from 'node:path'
+
import { test } from 'vitest'
-import { DISMISSED_FILE, REPORT_FILE, pendingNotice, recordDismissed, reportKey } from './plugin-compat-notice'
+
+import { DISMISSED_FILE, pendingNotice, recordDismissed, REPORT_FILE, reportKey } from './plugin-compat-notice'
function tmp() {
return fs.mkdtempSync(path.join(os.tmpdir(), 'hermes-compat-'))
@@ -13,13 +15,28 @@ const REPORT = {
removal_date: '2026-09-14',
in_effect: false,
plugins: {
- alpha: [{ file: '__init__.py', line: 3, old: 'tools.web_tools.prefers_gateway', new: 'tools.tool_backend_helpers.prefers_gateway' }],
+ alpha: [
+ {
+ file: '__init__.py',
+ line: 3,
+ old: 'tools.web_tools.prefers_gateway',
+ new: 'tools.tool_backend_helpers.prefers_gateway'
+ }
+ ],
beta: [
{ file: 'a.py', line: 1, old: 'hermes_cli.kanban_db.connect', new: 'hermes_cli.kanban_db_connect.connect' },
- { file: 'a.py', line: 9, old: 'hermes_cli.kanban_db.connect_closing', new: 'hermes_cli.kanban_db_connect.connect_closing' }
+ {
+ file: 'a.py',
+ line: 9,
+ old: 'hermes_cli.kanban_db.connect_closing',
+ new: 'hermes_cli.kanban_db_connect.connect_closing'
+ }
]
},
- lines: ['2 plugins use import paths that stop working on 2026-09-14 (10 days): alpha (1), beta (2)', 'Details: hermes plugins compat']
+ lines: [
+ '2 plugins use import paths that stop working on 2026-09-14 (10 days): alpha (1), beta (2)',
+ 'Details: hermes plugins compat'
+ ]
}
test('no report file → no notice', () => {
@@ -33,7 +50,10 @@ test('report → one notice naming plugins, date and the CLI command', () => {
assert.ok(n)
assert.equal(n.title, 'Plugins need an update')
assert.match(n.message, /2 plugins import module paths that stop working on 2026-09-14/)
- assert.match(n.detail, /• alpha — 1 import \(e\.g\. tools\.web_tools\.prefers_gateway → tools\.tool_backend_helpers\.prefers_gateway\)/)
+ assert.match(
+ n.detail,
+ /• alpha — 1 import \(e\.g\. tools\.web_tools\.prefers_gateway → tools\.tool_backend_helpers\.prefers_gateway\)/
+ )
assert.match(n.detail, /• beta — 2 imports/)
assert.match(n.detail, /hermes plugins compat/)
})
@@ -49,7 +69,10 @@ test('dismissal is remembered for the same report and forgotten for a different
assert.equal(pendingNotice(home, userData), null, 'same report must not show twice')
// a third affected plugin is new information
- const grown = { ...REPORT, plugins: { ...REPORT.plugins, gamma: [{ file: 'g.py', line: 1, old: 'x.y', new: 'z.y' }] } }
+ const grown = {
+ ...REPORT,
+ plugins: { ...REPORT.plugins, gamma: [{ file: 'g.py', line: 1, old: 'x.y', new: 'z.y' }] }
+ }
fs.writeFileSync(path.join(home, REPORT_FILE), JSON.stringify(grown))
const second = pendingNotice(home, userData)
assert.ok(second)
diff --git a/apps/desktop/electron/plugin-compat-notice.ts b/apps/desktop/electron/plugin-compat-notice.ts
index 42e3fbc2ed6..2e01f3e8b60 100644
--- a/apps/desktop/electron/plugin-compat-notice.ts
+++ b/apps/desktop/electron/plugin-compat-notice.ts
@@ -37,6 +37,7 @@ export function reportKey(report: PluginCompatReport): string {
const parts = Object.keys(report.plugins)
.sort()
.map(name => `${name}:${report.plugins[name].length}`)
+
return `${report.in_effect ? 'disabled' : 'pending'}|${parts.join(',')}`
}
@@ -44,8 +45,15 @@ export function readReport(hermesHome: string): PluginCompatReport | null {
try {
const raw = fs.readFileSync(path.join(hermesHome, REPORT_FILE), 'utf8')
const parsed = JSON.parse(raw)
- if (!parsed || typeof parsed !== 'object' || !parsed.plugins || !Array.isArray(parsed.lines)) return null
- if (Object.keys(parsed.plugins).length === 0) return null
+
+ if (!parsed || typeof parsed !== 'object' || !parsed.plugins || !Array.isArray(parsed.lines)) {
+ return null
+ }
+
+ if (Object.keys(parsed.plugins).length === 0) {
+ return null
+ }
+
return parsed as PluginCompatReport
} catch {
return null
@@ -55,6 +63,7 @@ export function readReport(hermesHome: string): PluginCompatReport | null {
export function wasDismissed(userData: string, key: string): boolean {
try {
const raw = JSON.parse(fs.readFileSync(path.join(userData, DISMISSED_FILE), 'utf8'))
+
return Array.isArray(raw?.keys) && raw.keys.includes(key)
} catch {
return false
@@ -64,13 +73,20 @@ export function wasDismissed(userData: string, key: string): boolean {
export function recordDismissed(userData: string, key: string): void {
const file = path.join(userData, DISMISSED_FILE)
let keys: string[] = []
+
try {
const raw = JSON.parse(fs.readFileSync(file, 'utf8'))
- if (Array.isArray(raw?.keys)) keys = raw.keys.filter((k: unknown) => typeof k === 'string')
+
+ if (Array.isArray(raw?.keys)) {
+ keys = raw.keys.filter((k: unknown) => typeof k === 'string')
+ }
} catch {
/* first dismissal */
}
- if (!keys.includes(key)) keys.push(key)
+
+ if (!keys.includes(key)) {
+ keys.push(key)
+ }
fs.mkdirSync(userData, { recursive: true })
fs.writeFileSync(file, JSON.stringify({ keys: keys.slice(-20) }, null, 2))
}
@@ -85,23 +101,35 @@ export interface PendingNotice {
/** The modal to show this boot, or null (no report, or this exact report already dismissed). */
export function pendingNotice(hermesHome: string, userData: string): PendingNotice | null {
const report = readReport(hermesHome)
- if (!report) return null
+
+ if (!report) {
+ return null
+ }
const key = reportKey(report)
- if (wasDismissed(userData, key)) return null
+
+ if (wasDismissed(userData, key)) {
+ return null
+ }
const names = Object.keys(report.plugins).sort()
+
const list = names
.map(n => {
const hits = report.plugins[n]
const first = hits[0]
+
return `• ${n} — ${hits.length} import${hits.length === 1 ? '' : 's'} (e.g. ${first.old} → ${first.new})`
})
.join('\n')
+
const title = report.in_effect ? 'Some plugins were not loaded' : 'Plugins need an update'
+
const message = report.in_effect
? `${names.length} plugin${names.length === 1 ? '' : 's'} import${names.length === 1 ? 's' : ''} module paths that were removed on ${report.removal_date} and ${names.length === 1 ? 'was' : 'were'} not loaded.`
: `${names.length} plugin${names.length === 1 ? '' : 's'} import${names.length === 1 ? 's' : ''} module paths that stop working on ${report.removal_date}.`
+
const detail = report.in_effect
? `${list}\n\nUpdate the plugin(s), or force-load them with plugins.allow_deprecated_imports: true in config.yaml (they will still break once the compatibility layer is removed).\n\nFull list: hermes plugins compat`
: `${list}\n\nCheck for plugin updates or notify the author before ${report.removal_date}. After that date these plugins are not loaded.\n\nFull list: hermes plugins compat`
+
return { key, title, message, detail }
}