The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(desktop): desktop plugins are app-level, not per profile; catalog gets a drag sash; Accent Picker moves to its own repo
Tekniumff93f0ee9b45
diff --git a/apps/desktop/electron/desktop-plugins-root.test.ts b/apps/desktop/electron/desktop-plugins-root.test.tsnew file mode 100644index 00000000000..4358a08d1dc--- /dev/null+++ b/apps/desktop/electron/desktop-plugins-root.test.ts@@ -0,0 +1,55 @@+import fs from 'node:fs'+import os from 'node:os'+import path from 'node:path'++import { afterEach, describe, expect, it } from 'vitest'++import { migrateProfileScopedDesktopPlugins } from './desktop-plugins-root'++const homes: string[] = []++function makeHome(): string {+ const home = fs.mkdtempSync(path.join(os.tmpdir(), 'hermes-dp-root-'))+ homes.push(home)++ return home+}++afterEach(() => {+ for (const home of homes.splice(0)) {+ fs.rmSync(home, { force: true, recursive: true })+ }+})++describe('migrateProfileScopedDesktopPlugins', () => {+ it('lifts per-profile desktop plugins into the app root so they survive a profile switch', async () => {+ const home = makeHome()+ const appRoot = path.join(home, 'desktop-plugins')+ const scoped = path.join(home, 'profiles', 'workbot', 'desktop-plugins', 'hello')+ fs.mkdirSync(scoped, { recursive: true })+ fs.writeFileSync(path.join(scoped, 'plugin.js'), 'export default { id: "hello" }')+ fs.mkdirSync(appRoot, { recursive: true })++ const moved = await migrateProfileScopedDesktopPlugins(home, appRoot)++ expect(moved).toEqual([path.join(appRoot, 'hello')])+ expect(fs.existsSync(path.join(appRoot, 'hello', 'plugin.js'))).toBe(true)+ expect(fs.existsSync(path.join(home, 'profiles', 'workbot', 'desktop-plugins'))).toBe(false)+ })++ it('never overwrites a plugin already installed at the app root', async () => {+ const home = makeHome()+ const appRoot = path.join(home, 'desktop-plugins')+ fs.mkdirSync(path.join(appRoot, 'hello'), { recursive: true })+ fs.writeFileSync(path.join(appRoot, 'hello', 'plugin.js'), 'root copy')+ const scoped = path.join(home, 'profiles', 'workbot', 'desktop-plugins', 'hello')+ fs.mkdirSync(scoped, { recursive: true })+ fs.writeFileSync(path.join(scoped, 'plugin.js'), 'profile copy')++ const moved = await migrateProfileScopedDesktopPlugins(home, appRoot)++ expect(moved).toEqual([])+ expect(fs.readFileSync(path.join(appRoot, 'hello', 'plugin.js'), 'utf8')).toBe('root copy')+ expect(fs.existsSync(path.join(scoped, 'plugin.js'))).toBe(true)+ })+})diff --git a/apps/desktop/electron/desktop-plugins-root.ts b/apps/desktop/electron/desktop-plugins-root.tsnew file mode 100644index 00000000000..be41eaa747f--- /dev/null+++ b/apps/desktop/electron/desktop-plugins-root.ts@@ -0,0 +1,88 @@+// The standalone desktop-plugin root (`<HERMES_HOME>/desktop-plugins`) and its+// one-time migration out of the per-profile folders earlier builds used.+//+// A desktop plugin extends THIS APP — panes, palette commands, themes — not an+// agent. Profiles are agents; a plugin that appeared and disappeared with the+// active profile read as "my plugin vanished" every time the user switched.+// Bundled plugins never had that problem (they ship in the app), which hid+// the bug for disk installs.+import fs from 'node:fs'+import path from 'node:path'++export const DESKTOP_PLUGINS_DIR = 'desktop-plugins'++export async function ensureDir(dir: string): Promise<string> {+ try {+ await fs.promises.mkdir(dir, { recursive: true })+ } catch {+ // Best-effort create; return the path regardless so a reveal action can+ // still surface a real openPath error and the scanner can retry later.+ }++ return dir+}++/** Move every `profiles/<name>/desktop-plugins/<id>` folder into the app-level+ * root. A plugin already present at the root wins (folders are keyed by plugin+ * id, so a duplicate is the same plugin installed twice); the profile copy is+ * left in place for the user to delete rather than destroyed. Emptied profile+ * roots are removed so the migration is a no-op on the next launch. */+export async function migrateProfileScopedDesktopPlugins(hermesHome: string, appRoot: string): Promise<string[]> {+ const profilesDir = path.join(hermesHome, 'profiles')+ const moved: string[] = []++ let profiles: fs.Dirent[]++ try {+ profiles = await fs.promises.readdir(profilesDir, { withFileTypes: true })+ } catch {+ return moved+ }++ for (const profile of profiles) {+ if (!profile.isDirectory()) {+ continue+ }++ const scopedRoot = path.join(profilesDir, profile.name, DESKTOP_PLUGINS_DIR)++ let entries: fs.Dirent[]++ try {+ entries = await fs.promises.readdir(scopedRoot, { withFileTypes: true })+ } catch {+ continue+ }++ for (const entry of entries) {+ if (!entry.isDirectory()) {+ continue+ }++ const from = path.join(scopedRoot, entry.name)+ const to = path.join(appRoot, entry.name)++ if (fs.existsSync(to)) {+ continue+ }++ try {+ await fs.promises.rename(from, to)+ moved.push(to)+ } catch {+ // Cross-device or permission failure: leave the folder; the user can+ // still reach it through the profile directory.+ }+ }++ try {+ if ((await fs.promises.readdir(scopedRoot)).length === 0) {+ await fs.promises.rmdir(scopedRoot)+ }+ } catch {+ // Not empty or already gone — either is fine.+ }+ }++ return moved+}diff --git a/apps/desktop/electron/fs-ipc.ts b/apps/desktop/electron/fs-ipc.tsindex 61a3cb7db22..48c9afc34cc 100644--- a/apps/desktop/electron/fs-ipc.ts+++ b/apps/desktop/electron/fs-ipc.ts@@ -8,6 +8,7 @@ import path from 'node:path'import { ipcMain, shell } from 'electron'import { installDesktopPluginFromGit, probePluginRepo } from './desktop-plugin-install'+import { DESKTOP_PLUGINS_DIR, ensureDir, migrateProfileScopedDesktopPlugins } from './desktop-plugins-root'import { readDirForIpc } from './fs-read-dir'import { gitRootForIpc } from './git-root'@@ -78,25 +79,29 @@ export function registerFsIpc({// it yields `undefined/desktop-plugins` (or a non-existent remote path) and the// on-disk plugin door silently breaks (#66899). Electron owns this resolution// so it stays valid in every connection mode. Created on demand, like openDir.+ // Profile-scoped roots (agent plugins, logs) live under profiles/<name>/ for a+ // named Desktop profile — they belong to THAT agent. 'default'/unset pins the+ // global root.async function localPluginsRoot(dirName: string): Promise<string> {- // Profile-aware: a named Desktop profile gets its own plugin root under- // profiles/<name>/, matching the profile-scoped hermes_home the backend- // reported before this resolver existed. 'default'/unset pins the global root.const profile = readActiveDesktopProfile()const base = profile && profile !== 'default' ? path.join(hermesHome, 'profiles', profile) : hermesHome- const dir = path.join(base, dirName)- try {- await fs.promises.mkdir(dir, { recursive: true })- } catch {- // Best-effort create; return the path regardless so the reveal action can- // still surface a real openPath error and the scanner can retry later.- }+ return ensureDir(path.join(base, dirName))+ }++ // The standalone desktop-plugin root is APP-level, never profile-scoped: a+ // desktop plugin extends this app, not an agent, so it must stay installed+ // and loaded whichever profile / gateway / machine the window is pointed at.+ // Earlier builds scoped it per profile; anything left in those folders is+ // moved up once so it does not silently vanish on a profile switch.+ async function desktopPluginsRoot(): Promise<string> {+ const root = await ensureDir(path.join(hermesHome, DESKTOP_PLUGINS_DIR))+ await migrateProfileScopedDesktopPlugins(hermesHome, root)- return dir+ return root}- ipcMain.handle('hermes:fs:desktopPluginsRoot', async () => localPluginsRoot('desktop-plugins'))+ ipcMain.handle('hermes:fs:desktopPluginsRoot', async () => desktopPluginsRoot())// The LOCAL logs root (`<HERMES_HOME>/logs`, profile-aware) — the error// card's "Open Logs" action reveals agent.log/gateway.log without the user@@ -128,9 +133,7 @@ export function registerFsIpc({return { ok: false, error: 'identifier is required' }}- const desktopPluginsRoot = await localPluginsRoot('desktop-plugins')-- return installDesktopPluginFromGit(resolveGitBinary(), identifier, desktopPluginsRoot, Boolean(payload?.force))+ return installDesktopPluginFromGit(resolveGitBinary(), identifier, await desktopPluginsRoot(), Boolean(payload?.force))})// Rename a file/folder in place. The renderer passes the existing path + a newdiff --git a/apps/desktop/src/app/skills/index.tsx b/apps/desktop/src/app/skills/index.tsxindex c7e38e6ccc7..e402052d7f9 100644--- a/apps/desktop/src/app/skills/index.tsx+++ b/apps/desktop/src/app/skills/index.tsx@@ -35,6 +35,7 @@ import { queryClient } from '@/lib/query-client'import { invalidateSlashCompletions } from '@/lib/slash-completion-cache'import { normalize } from '@/lib/text'import { useStoreSelector } from '@/lib/use-session-slice'+import { cn } from '@/lib/utils'import { $gateway, activeGatewayConnectionId } from '@/store/gateway'import { $hubActions, installHubSkill, OFFICIAL_SKILLS_KEY } from '@/store/hub-actions'import { notify, notifyError } from '@/store/notifications'@@ -823,7 +824,9 @@ export function SkillsView({// with >1 option; hidden otherwise to avoid clutter.const profileScopeSelector =scopeOptions.length > 1 ? (- <div className="flex items-center gap-2 border-b border-(--ui-stroke-secondary) px-3 py-2">+ <div+ className={cn('flex items-center gap-2 px-3 py-2', mode !== 'plugins' && 'border-b border-(--ui-stroke-secondary)')}+ ><span className="text-[0.7rem] font-medium text-(--ui-text-tertiary)">{t.skills.configuringProfile}</span><Select onValueChange={changeScope} value={scopeSelectValue}><SelectTrigger className="h-7 w-56 text-xs">@@ -863,14 +866,18 @@ export function SkillsView({active, so Skills / Tools / MCP all read and write the SAME selectedprofile. */}<div className="flex h-full flex-col">- {profileScopeSelector}+ {/* Plugins renders the selector INSIDE its agent section: desktop+ plugins on that page belong to the app, not to any profile, and+ must not sit under a "Configuring: <profile>" header. */}+ {mode !== 'plugins' && profileScopeSelector}<div className="flex min-h-0 flex-1 flex-col"><div className={mode === 'skills' ? 'min-h-40 flex-1 overflow-hidden' : 'min-h-0 flex-1'}>{mode === 'plugins' ? (- // Agent plugins for the scoped profile: installed list on top,- // the live catalog picker underneath (same shape as Skills).- // Keyed on scope so a profile/connection switch reloads the list.- <PluginsTab key={`plugins-${scopeKey}`} profile={scopeProfile} />+ // Agent plugins for the scoped profile (selector in the section+ // header), app-level desktop plugins, the live catalog picker+ // underneath. Keyed on scope so a profile/connection switch+ // reloads the agent list.+ <PluginsTab key={`plugins-${scopeKey}`} profile={scopeProfile} scopeSelector={profileScopeSelector} />) : mode === 'mcp' ? (// The gateway instance backs ONLY the live `reload.mcp` RPC, and// it is the ACTIVE gateway's socket — for a scope pinned to adiff --git a/apps/desktop/src/app/skills/plugins-tab.test.tsx b/apps/desktop/src/app/skills/plugins-tab.test.tsxindex dc2eb630093..775e99fd27b 100644--- a/apps/desktop/src/app/skills/plugins-tab.test.tsx+++ b/apps/desktop/src/app/skills/plugins-tab.test.tsx@@ -1,7 +1,8 @@-import { cleanup, render, screen, waitFor } from '@testing-library/react'+import { cleanup, fireEvent, render, screen, waitFor } from '@testing-library/react'import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'import { $agentPlugins, $agentPluginsStatus } from '@/store/agent-plugins'+import { $paneHeightOverride, setPaneHeightOverride } from '@/store/panes'import { $pluginInstallRequest, closePluginInstallRequest } from '@/store/plugin-install-request'import { PluginsTab } from './plugins-tab'@@ -191,10 +192,31 @@ describe('PluginsTab catalog UX', () => {$agentPluginsStatus.set('ready')closePluginInstallRequest()requestGateway.mockClear()+ setPaneHeightOverride('capabilities-plugin-catalog', undefined)})afterEach(cleanup)+ it('grows the catalog when its top-edge sash is dragged up, and resets on double-click', () => {+ // jsdom has no layout: give the Capabilities column a real height so the+ // "never crush the lists above" clamp has something to clamp against.+ const clientHeight = vi.spyOn(HTMLElement.prototype, 'clientHeight', 'get').mockReturnValue(900)+ Object.defineProperty(window, 'innerHeight', { configurable: true, value: 1000 })+ render(<PluginsTab profile={null} />)+ const sash = screen.getByTestId('plugin-catalog-sash')++ fireEvent.pointerDown(sash, { button: 0, clientY: 600 })+ fireEvent.pointerMove(window, { clientY: 400 })+ fireEvent.pointerUp(window)++ // Default 380px + 200px of upward drag (clamped only by window/column size).+ expect($paneHeightOverride('capabilities-plugin-catalog').get()).toBe(580)++ fireEvent.doubleClick(sash)+ expect($paneHeightOverride('capabilities-plugin-catalog').get()).toBeUndefined()+ clientHeight.mockRestore()+ })+it('shows an Update chip when the catalog pin moved past the installed SHA', () => {$agentPlugins.set([{diff --git a/apps/desktop/src/app/skills/plugins-tab.tsx b/apps/desktop/src/app/skills/plugins-tab.tsxindex f0f119ed54d..1496cf57ba8 100644--- a/apps/desktop/src/app/skills/plugins-tab.tsx+++ b/apps/desktop/src/app/skills/plugins-tab.tsx@@ -1,5 +1,5 @@import { useStore } from '@nanostores/react'-import { memo, useEffect, useMemo, useState } from 'react'+import { memo, type ReactNode, type PointerEvent as ReactPointerEvent, useEffect, useMemo, useRef, useState } from 'react'import { useGatewayRequest } from '@/app/gateway/hooks/use-gateway-request'import { Button } from '@/components/ui/button'@@ -40,9 +40,16 @@ import { DesktopPluginsSection, pluginElementId, PluginListRow } from './desktopconst CATALOG_ORIGIN = 'https://hermes-agent.nousresearch.com'const CATALOG_PICKER_URL = `${CATALOG_ORIGIN}/docs/plugins?embed=picker`+// Catalog viewport: persisted through the shared pane store, dragged from the+// section's TOP edge ("pull the catalog up"), clamped so neither the catalog+// nor the plugin lists above can vanish. Same contract as EmbeddedHubPicker.const CATALOG_PANE_ID = 'capabilities-plugin-catalog'const CATALOG_DEFAULT_PX = 380+const CATALOG_MIN_PX = 120+const CATALOG_MAX_VH = 0.75const CATALOG_COLLAPSED_PX = 4+// Room the sash must always leave for the lists above the catalog.+const CATALOG_LIST_RESERVED_PX = 176interface PluginPickMessage {installCmd?: string@@ -144,7 +151,15 @@ function AgentPluginListRow({* sits with management: the live catalog picker underneath, plus a manual* "Install from Git" for anything not in the catalog. Settings no longer* carries a second, partial copy of this. */-export const PluginsTab = memo(function PluginsTab({ profile }: { profile: ProfileScope }) {+export const PluginsTab = memo(function PluginsTab({+ profile,+ scopeSelector+}: {+ profile: ProfileScope+ /** The Capabilities profile selector, rendered INSIDE the agent section so+ * the app-level desktop section below it is visibly outside its scope. */+ scopeSelector?: ReactNode+}) {const { t } = useI18n()const p = t.skills.pluginsconst { requestGateway } = useGatewayRequest()@@ -177,11 +192,45 @@ export const PluginsTab = memo(function PluginsTab({ profile }: { profile: Proficonst height = heightOverride ?? CATALOG_DEFAULT_PXconst open = height > CATALOG_COLLAPSED_PXconst [pickerMounted, setPickerMounted] = useState(open)+ const [dragging, setDragging] = useState(false)+ const sectionRef = useRef<HTMLElement>(null)if (open && !pickerMounted) {setPickerMounted(true)}+ // Top-edge sash: dragging UP grows the catalog (shrinking the lists above,+ // the flex-1 sibling); double-click resets. The cross-origin iframe gets+ // pointer-events disabled for the duration or it swallows the pointermoves.+ const startDrag = (event: ReactPointerEvent<HTMLDivElement>) => {+ if (event.button !== 0) {+ return+ }++ event.preventDefault()+ const startY = event.clientY+ const startHeight = height+ const column = sectionRef.current?.parentElement+ const columnMax = column ? column.clientHeight - CATALOG_LIST_RESERVED_PX : Number.POSITIVE_INFINITY+ const max = Math.max(CATALOG_MIN_PX, Math.round(Math.min(window.innerHeight * CATALOG_MAX_VH, columnMax)))+ setDragging(true)++ const onMove = (move: globalThis.PointerEvent) => {+ setPaneHeightOverride(+ CATALOG_PANE_ID,+ Math.round(Math.min(max, Math.max(CATALOG_MIN_PX, startHeight + (startY - move.clientY))))+ )+ }++ const onUp = () => {+ window.removeEventListener('pointermove', onMove)+ setDragging(false)+ }++ window.addEventListener('pointermove', onMove)+ window.addEventListener('pointerup', onUp, { once: true })+ }+useEffect(() => {if (!open) {return undefined@@ -228,7 +277,11 @@ export const PluginsTab = memo(function PluginsTab({ profile }: { profile: Profireturn (<div className="flex h-full min-h-0 flex-col"><div className="min-h-32 flex-1 overflow-y-auto">- <section>+ {/* The profile-scoped block is a visible container: the selector is+ its header, so everything OUTSIDE the frame (desktop plugins) is+ read as not-per-profile without a paragraph of explanation. */}+ <section className="mx-3 mt-3 rounded-lg border border-(--ui-stroke-secondary)">+ {scopeSelector && <div className="border-b border-(--ui-stroke-tertiary)">{scopeSelector}</div>}<div className="flex items-center justify-between gap-3 px-3 pt-3 pb-1"><div className="min-w-0"><div className="text-[0.62rem] font-medium tracking-wide uppercase text-(--ui-text-quaternary)">@@ -297,12 +350,31 @@ export const PluginsTab = memo(function PluginsTab({ profile }: { profile: Profi)}</section>- <div className="mt-2 mb-3 border-t border-(--ui-stroke-tertiary)">+ {/* App-level: a heavier rule than the row dividers marks the end of+ the profile-scoped block above. */}+ <div className="mt-4 mb-3"><DesktopPluginsSection profile={scope} /></div></div>- <section className={cn('relative flex min-h-9 flex-col overflow-hidden border-t border-(--ui-stroke-secondary)')}>+ <section+ className="relative flex min-h-9 flex-col overflow-hidden border-t border-(--ui-stroke-secondary)"+ ref={sectionRef}+ >+ {/* Top-edge drag sash — pull the catalog up/down. */}+ <div+ className="group/catsash absolute inset-x-0 top-0 z-10 h-1 -translate-y-1/2 cursor-row-resize"+ data-testid="plugin-catalog-sash"+ onDoubleClick={() => setPaneHeightOverride(CATALOG_PANE_ID, undefined)}+ onPointerDown={startDrag}+ >+ <div+ className={cn(+ 'absolute inset-x-0 top-1/2 h-px -translate-y-1/2 transition-colors',+ dragging ? 'bg-(--ui-stroke-secondary)' : 'group-hover/catsash:bg-(--ui-stroke-secondary)'+ )}+ />+ </div><div className="flex shrink-0 items-center justify-between px-3 py-1.5"><span className="text-[0.62rem] font-medium tracking-wide uppercase text-(--ui-text-quaternary)">{p.catalogTitle}@@ -333,6 +405,7 @@ export const PluginsTab = memo(function PluginsTab({ profile }: { profile: Profibackground: 'transparent',border: 'none',height: '133.34%',+ pointerEvents: dragging ? 'none' : 'auto',transform: 'scale(0.75)',transformOrigin: 'top left',width: '133.34%'diff --git a/apps/desktop/src/i18n/en.ts b/apps/desktop/src/i18n/en.tsindex 9dc1b8f1b30..2afec8fbed3 100644--- a/apps/desktop/src/i18n/en.ts+++ b/apps/desktop/src/i18n/en.ts@@ -444,7 +444,7 @@ export const en: Translations = {plugins: {title: 'Desktop plugins',blurb:- 'Extend this app — bundled or dropped into the desktop-plugins folder. Same for every profile; toggles apply live.',+ 'Extend this app, not an agent — installed once for the whole app, whichever profile, gateway, or machine you connect to. Bundled or dropped into the desktop-plugins folder; toggles apply live.',count: n => `${n} installed`,openFolder: 'Open plugins folder',rescan: 'Rescan',diff --git a/apps/desktop/src/plugins/accent/picker.tsx b/apps/desktop/src/plugins/accent/picker.tsxdeleted file mode 100644index 82d610632ab..00000000000--- a/apps/desktop/src/plugins/accent/picker.tsx+++ /dev/null@@ -1,325 +0,0 @@-// Dev-only: an OKLCH accent picker in the statusbar.-//-// Rebuilt from an HSV picker, which was the wrong instrument for the job: HSV-// crushes the entire blue family into a narrow band of its hue rail, so-// dragging "to blue" lands you on ~266° — pure sRGB blue, which reads violet to-// the eye. Every blue that actually looks blue (GitHub 257°, Tailwind 260°,-// Nous 263°) sits in a few degrees you cannot reliably hit in HSV. In OKLCH the-// rail is perceptually even, so those degrees get their fair share of track.-//-// The field is a CANVAS, not a CSS gradient, because a hue slice of OKLCH is a-// curved wedge in sRGB rather than a rectangle. Drawing it per-pixel through-// the real conversion means every pixel is a color the display can actually-// show, and the wedge's edge IS the gamut boundary — no silent clamping.-//-// It drives `$accentOverride`, which the theme context feeds through-// `retintTheme`, so the whole app repaints against the REAL derivation on every-// pointer move. Nothing persists: reload and you're back on the authored theme.-//-// Sizing note: the statusbar is `h-5` (20px). The TRIGGER must live inside that-// band or it clips to a sliver; the panel is a popover and can be any size.--import {- $accentOverride,- contrastRatio,- hexToOklch,- maxChroma,- type Oklch,- oklchToHex,- oklchToSrgb255,- Popover,- PopoverContent,- PopoverTrigger,- setAccentOverride,- useTheme,- useValue-} from '@hermes/plugin-sdk'-import { useCallback, useEffect, useMemo, useRef, useState } from 'react'--// Named reference points, with their OKLCH hue — the ones worth comparing while-// judging an accent. The hue spread across the blues is the whole reason this-// control exists: they look far apart and are 6° apart.-const SWATCHES: ReadonlyArray<{ hex: string; name: string }> = [- { hex: '#0053FD', name: 'Nous blue · 263° (light seed)' },- { hex: '#4a84fe', name: 'Nous blue · 263° (dark seed)' },- { hex: '#1540B1', name: 'Psyche blue · 264°' },- { hex: '#0969da', name: 'GitHub blue · 257°' },- { hex: '#196d31', name: 'GitHub green · 148°' },- { hex: '#8250df', name: 'GitHub purple · 303°' },- { hex: '#bf3989', name: 'GitHub pink · 354°' },- { hex: '#bc4c00', name: 'GitHub orange · 52°' }-]--const FIELD_W = 224-const FIELD_H = 130-const RAIL_H = 12--// Statusbar label width, in mono characters. The chip's text CHANGES as you-// drag, and the bar lays out right-to-left from the right edge — so an unpinned-// width slides the picker out from under the pointer mid-drag.-const HEX_CH = 7 // '#rrggbb'--/** Chroma axis top — past this is out of gamut at every hue, so it'd be dead space. */-const CHROMA_MAX = 0.33--const clamp01 = (n: number) => Math.min(1, Math.max(0, n))--/** Pointer drag over a box, reported as 0..1 on each axis. */-function useDrag(onMove: (x: number, y: number) => void) {- const ref = useRef<HTMLElement>(null)- const moveRef = useRef(onMove)- moveRef.current = onMove-- const onPointerDown = useCallback((event: React.PointerEvent) => {- const box = ref.current-- if (!box) {- return- }-- const emit = (clientX: number, clientY: number) => {- const r = box.getBoundingClientRect()- moveRef.current(clamp01((clientX - r.left) / r.width), clamp01((clientY - r.top) / r.height))- }-- emit(event.clientX, event.clientY)-- const onPointerMove = (e: PointerEvent) => emit(e.clientX, e.clientY)-- const stop = () => {- window.removeEventListener('pointermove', onPointerMove)- window.removeEventListener('pointerup', stop)- }-- window.addEventListener('pointermove', onPointerMove)- window.addEventListener('pointerup', stop)- }, [])-- return { onPointerDown, ref }-}--/** Lightness (y, 1→0) × chroma (x, 0→CHROMA_MAX) at one hue. */-function ChromaLightnessField({- hue,- lch,- onPick-}: {- hue: number- lch: Oklch- onPick: (l: number, c: number) => void-}) {- const canvas = useRef<HTMLCanvasElement>(null)- const drag = useDrag((x, y) => onPick(1 - y, x * CHROMA_MAX))-- useEffect(() => {- const el = canvas.current-- if (!el) {- return- }-- const ctx = el.getContext('2d')-- if (!ctx) {- return- }-- const img = ctx.createImageData(FIELD_W, FIELD_H)-- for (let y = 0; y < FIELD_H; y += 1) {- const l = 1 - y / (FIELD_H - 1)-- for (let x = 0; x < FIELD_W; x += 1) {- const rgb = oklchToSrgb255({ l, c: (x / (FIELD_W - 1)) * CHROMA_MAX, h: hue })- const i = (y * FIELD_W + x) * 4-- if (rgb) {- img.data[i] = rgb[0]- img.data[i + 1] = rgb[1]- img.data[i + 2] = rgb[2]- img.data[i + 3] = 255- } else {- // Outside sRGB: leave it transparent so the wedge's real edge shows.- img.data[i + 3] = 0- }- }- }-- ctx.clearRect(0, 0, FIELD_W, FIELD_H)- ctx.putImageData(img, 0, 0)- }, [hue])-- return (- <div- className="relative cursor-crosshair overflow-hidden rounded-sm"- onPointerDown={drag.onPointerDown}- ref={drag.ref as React.RefObject<HTMLDivElement>}- style={{ height: FIELD_H, width: FIELD_W }}- >- <canvas className="block size-full" height={FIELD_H} ref={canvas} width={FIELD_W} />- <div- className="pointer-events-none absolute size-3 -translate-x-1/2 -translate-y-1/2 rounded-full border-2 border-white shadow-[0_0_0_1px_rgba(0,0,0,.6)]"- style={{ left: `${(lch.c / CHROMA_MAX) * 100}%`, top: `${(1 - lch.l) * 100}%` }}- />- </div>- )-}--/** Hue rail, sampled through the real conversion at the current L and C. */-function HueRail({ lch, onPick }: { lch: Oklch; onPick: (h: number) => void }) {- const drag = useDrag(x => onPick(x * 360))-- // Hold the current lightness/chroma so the rail previews THIS color at every- // hue, rather than a generic rainbow that lies about where you'll land.- const gradient = useMemo(() => {- const stops: string[] = []-- for (let i = 0; i <= 36; i += 1) {- const h = (i / 36) * 360- const c = Math.min(lch.c, maxChroma(lch.l, h))- stops.push(`${oklchToHex({ l: lch.l, c, h })} ${(i / 36) * 100}%`)- }-- return `linear-gradient(to right, ${stops.join(', ')})`- }, [lch.l, lch.c])-- return (- <div- className="relative cursor-ew-resize rounded-full"- onPointerDown={drag.onPointerDown}- ref={drag.ref as React.RefObject<HTMLDivElement>}- style={{ background: gradient, height: RAIL_H, width: FIELD_W }}- >- <div- className="pointer-events-none absolute top-1/2 size-3.5 -translate-x-1/2 -translate-y-1/2 rounded-full border-2 border-white shadow-[0_0_0_1px_rgba(0,0,0,.6)]"- style={{ left: `${(lch.h / 360) * 100}%` }}- />- </div>- )-}--function AccentPicker() {- const { theme, renderedMode } = useTheme()- const override = useValue($accentOverride)- const painted = theme.colors.primary- const [lch, setLch] = useState<Oklch>(() => hexToOklch(painted) ?? { l: 0.5, c: 0.15, h: 260 })- const [text, setText] = useState(painted)-- // Follow the painted accent when it changes from outside this control — but- // never mid-drag, which would fight the user's own pointer.- const dragging = useRef(false)-- useEffect(() => {- if (!dragging.current) {- setLch(hexToOklch(painted) ?? { l: 0.5, c: 0.15, h: 260 })- setText(painted)- }- }, [painted])-- const commit = (next: Oklch) => {- dragging.current = true- setLch(next)- const hex = oklchToHex(next)- setText(hex)- setAccentOverride(hex)- requestAnimationFrame(() => {- dragging.current = false- })- }-- const surface = (renderedMode === 'dark' ? theme.darkColors : theme.colors) ?? theme.colors- const ratio = contrastRatio(painted, surface.sidebarBackground ?? surface.background)-- return (- <div className="flex flex-col gap-2 p-2" style={{ width: FIELD_W + 16 }}>- <ChromaLightnessField hue={lch.h} lch={lch} onPick={(l, c) => commit({ ...lch, c, l })} />- <HueRail lch={lch} onPick={h => commit({ ...lch, h })} />-- <div className="flex items-center gap-1.5">- <span className="size-5 shrink-0 rounded-sm border border-(--dt-border)" style={{ background: painted }} />- <input- className="min-w-0 flex-1 rounded-sm border border-(--dt-border) bg-transparent px-1.5 py-0.5 font-mono text-[11px] uppercase"- onChange={event => {- setText(event.target.value)- setAccentOverride(event.target.value)- }}- spellCheck={false}- value={text}- />- <button- className="shrink-0 rounded-sm border border-(--dt-border) px-1.5 py-0.5 text-[11px]"- onClick={() => setAccentOverride(null)}- type="button"- >- reset- </button>- </div>-- <div className="grid grid-cols-8 gap-1">- {SWATCHES.map(swatch => (- <button- className="size-5 rounded-sm border border-(--dt-border)"- key={swatch.hex}- onClick={() => setAccentOverride(swatch.hex)}- style={{ background: swatch.hex }}- title={`${swatch.name} · ${swatch.hex}`}- type="button"- />- ))}- </div>-- {/* OKLCH readout + what the theme RESOLVED to for the painted mode, which- is usually not the hex you clicked (dark adapts for contrast). Digits- are tabular and the hue/L/C fields are fixed-width: an unpinned- readout re-wraps as you drag past 100°, which resizes the popover- under the pointer. */}- <div className="flex items-center justify-between font-mono text-[10px] tabular-nums text-(--ui-text-tertiary)">- <span>- H<span className="inline-block w-[3ch] text-right">{Math.round(lch.h)}</span> L{lch.l.toFixed(2)} C- {lch.c.toFixed(3)}- </span>- <span className={ratio >= 4.5 ? '' : 'text-(--dt-destructive)'}>- {renderedMode} {ratio.toFixed(1)}:1- </span>- </div>- {/* Always occupies its row, even when empty — this line appears exactly- when a pick needs adapting, which is mid-drag, and a mounting <p>- would grow the panel while the pointer is inside it. */}- <p className="h-3 font-mono text-[10px] leading-tight text-(--ui-text-tertiary)">- {override && override.toLowerCase() !== painted.toLowerCase()- ? `picked ${override} → ${painted} for contrast`- : '\u00a0'}- </p>- </div>- )-}--export function AccentPickerTrigger() {- const { theme } = useTheme()-- return (- <Popover>- <PopoverTrigger asChild>- <button- className="inline-flex h-full items-center gap-1.5 px-1.5 text-[0.6875rem] text-(--ui-text-tertiary) hover:bg-(--chrome-action-hover) hover:text-foreground"- title="Accent color (dev)"- type="button"- >- <span- className="size-2.5 shrink-0 rounded-full border border-(--dt-border)"- style={{ background: theme.colors.primary }}- />- {/* Always the hex, never a word: a label that alternated between- `accent` and `#rrggbb` changed width on the first drag, which- reflowed the bar under the cursor. Seven mono characters, always. */}- <span className="text-center font-mono tabular-nums" style={{ width: `${HEX_CH}ch` }}>- {theme.colors.primary}- </span>- </button>- </PopoverTrigger>- <PopoverContent align="end" className="w-auto p-0" side="top">- <AccentPicker />- </PopoverContent>- </Popover>- )-}diff --git a/apps/desktop/src/plugins/accent/plugin.tsx b/apps/desktop/src/plugins/accent/plugin.tsxdeleted file mode 100644index 9ab708dd055..00000000000--- a/apps/desktop/src/plugins/accent/plugin.tsx+++ /dev/null@@ -1,70 +0,0 @@-/**- * Accent — pick the theme's accent color and watch the whole app retint live.- *- * The COLOR MATH is not here. `themes/retint.ts` owns re-seeding a palette from- * one color, and it works on any theme with any accent; this plugin is only the- * control surface for it. That split is deliberate: the retint is core behavior- * that Appearance settings and ⌘K should be able to drive too, while the- * statusbar picker is an authoring tool most users never need.- *- * Ships OFF (`defaultEnabled: false`): it inventories in Capabilities ▸ Plugins and- * registers nothing until the switch is flipped. With it off, `$accentOverride`- * stays null and `retintTheme` is never called — themes paint exactly as- * authored.- */--import type { HermesPlugin, PaletteContribution } from '@hermes/plugin-sdk'-import { $accentOverride, PALETTE_AREA, setAccentOverride, STATUSBAR_AREAS } from '@hermes/plugin-sdk'--import { AccentPickerTrigger } from './picker'--const plugin: HermesPlugin = {- id: 'accent',- name: 'Accent Picker',- description:- 'Pick the theme accent from an OKLCH color picker in the status bar; the palette re-derives live. Authoring tool — the color is not persisted.',- defaultEnabled: false,- register(ctx) {- // The override is a scratch value, not a setting. Dropping it on unregister- // means disabling the plugin (or reloading) returns every surface to the- // authored theme instead of stranding a color with no control to clear it.- ctx.onDispose(() => setAccentOverride(null))-- ctx.registerMany([- {- id: 'picker',- area: STATUSBAR_AREAS.right,- order: 90,- render: () => <AccentPickerTrigger />- },- {- id: 'reset',- area: PALETTE_AREA,- data: {- id: 'accent.reset',- label: 'Accent: reset to the theme default',- keywords: ['accent', 'color', 'theme', 'reset', 'default'],- run: () => setAccentOverride(null)- } satisfies PaletteContribution- },- {- id: 'copy',- area: PALETTE_AREA,- data: {- id: 'accent.copy',- label: 'Accent: copy the current color',- keywords: ['accent', 'color', 'hex', 'copy', 'clipboard'],- run: () => {- const hex = $accentOverride.get()-- if (hex) {- void navigator.clipboard?.writeText(hex)- }- }- } satisfies PaletteContribution- }- ])- }-}--export default plugindiff --git a/website/docs/developer-guide/desktop-plugin-sdk.md b/website/docs/developer-guide/desktop-plugin-sdk.mdindex ea889e7f98f..4f90f640afe 100644--- a/website/docs/developer-guide/desktop-plugin-sdk.md+++ b/website/docs/developer-guide/desktop-plugin-sdk.md@@ -74,8 +74,8 @@ repo.## Quick start — your first pluginCreate `$HERMES_HOME/desktop-plugins/hello/plugin.js` (that's `~/.hermes/...`-by default, or `~/.hermes/profiles/<name>/...` under a named profile). The folder-name must equal the plugin `id`.+by default). Desktop plugins are app-level — one root for every profile, gateway,+or remote machine the window connects to. The folder name must equal the plugin `id`.```javascript// ~/.hermes/desktop-plugins/hello/plugin.js@@ -380,8 +380,9 @@ host.onEvent('gateway.ready', () => {Both doors persist per profile, so a plugin-driven switch sticks exactly like amanual pick. To tint the *active* theme rather than replace it, use-`setAccentOverride(hex)` and clear it in `ctx.onDispose` — the bundled `accent`-plugin is the worked example.+`setAccentOverride(hex)` and clear it in `ctx.onDispose` — the standalone+[Accent Picker](https://github.com/NousResearch/hermes-desktop-accent-picker)+plugin is the worked example (it is also a complete, installable disk plugin).### Composer extensionsdiff --git a/website/docs/user-guide/desktop.md b/website/docs/user-guide/desktop.mdindex f160ba6a59e..17a62bdcb8b 100644--- a/website/docs/user-guide/desktop.md+++ b/website/docs/user-guide/desktop.md@@ -460,10 +460,15 @@ Hermes, in two sections on one page:configuring (the backend `plugins.manage` RPC takes a `profile` parameter).Repo-bundled built-ins (platform adapters, provider plugins) are not listed:they ship enabled and are configured from their own surfaces.-- **Desktop plugins** — extensions loaded into this app, the same for every- profile. Toggles apply live; the desktop half of a bundled agent+desktop- package shows an **agent half missing here** chip when the selected- profile's backend does not have its agent half, with a one-click repair.+- **Desktop plugins** — extensions loaded into this app. They are not tied to+ a profile: one install under `~/.hermes/desktop-plugins/` serves every+ profile, gateway, or remote machine the window connects to, which is why the+ section sits outside the profile selector. Toggles apply live; the desktop+ half of a bundled agent+desktop package shows an **agent half missing here**+ chip when the selected profile's backend lacks its agent half, with a+ one-click repair. Optional extras such as the+ [Accent Picker](https://github.com/NousResearch/hermes-desktop-accent-picker)+ install from their own repos via **Install from Git**.Discovery sits underneath: the live [Plugin Catalog](./features/plugin-catalog.md)picker installs reviewed entries at their pinned commit into the selected