The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
docs(desktop): document Settings ▸ Plugins pages; hello-runtime example
Teknium6421b9f97785
diff --git a/apps/desktop/src/plugins/hello-runtime/plugin.runtime.js b/apps/desktop/src/plugins/hello-runtime/plugin.runtime.jsindex 6647138e1fe..c4ebdbbe00a 100644--- a/apps/desktop/src/plugins/hello-runtime/plugin.runtime.js+++ b/apps/desktop/src/plugins/hello-runtime/plugin.runtime.js@@ -4,22 +4,32 @@* rewrite -> SDK/react shim blobs -> blob import -> register). Plain ESM js* with `jsx()` calls — exactly what an agent (or a compiler) writes into* `~/.hermes/desktop-plugins/<name>/plugin.js`.+ *+ * It also shows the Settings ▸ Plugins contract: one settings page with two+ * sub-pages (`ctx.registerSettingsPage`), persisted with `ctx.storage`.*/-import { cn, host, Tip, useValue } from '@hermes/plugin-sdk'+import { atom, cn, host, ListRow, SegmentedControl, Tip, ToggleRow, useValue } from '@hermes/plugin-sdk'import { jsx, jsxs } from 'react/jsx-runtime'-function RuntimeChip() {+const DEFAULTS = { label: 'word', showChip: true }++function RuntimeChip({ prefs }) {const gateway = useValue(host.state.gateway)+ const { label, showChip } = useValue(prefs)++ if (!showChip) {+ return null+ }return jsx(Tip, {label: `Loaded at RUNTIME through blob import + SDK injection (gateway: ${gateway})`,children: jsxs('span', {- className: cn(- 'inline-flex h-full items-center gap-1 px-1.5 text-[0.6875rem]',- 'text-(--ui-text-tertiary)'- ),- children: [jsx('span', { 'aria-hidden': true, children: '⚡' }), jsx('span', { children: 'runtime' })]+ className: cn('inline-flex h-full items-center gap-1 px-1.5 text-[0.6875rem]', 'text-(--ui-text-tertiary)'),+ children: [+ jsx('span', { 'aria-hidden': true, children: '⚡' }),+ label === 'word' ? jsx('span', { children: 'runtime' }) : null+ ]})})}@@ -28,11 +38,75 @@ export default {id: 'hello-runtime',name: 'Hello Runtime',register(ctx) {+ const prefs = atom({ ...DEFAULTS, ...ctx.storage.get('prefs', {}) })++ const update = patch => {+ prefs.set({ ...prefs.get(), ...patch })+ ctx.storage.set('prefs', prefs.get())+ }+ctx.register({id: 'chip',area: 'statusBar.right',order: 110,- render: () => jsx(RuntimeChip, {})+ render: () => jsx(RuntimeChip, { prefs })+ })++ // Settings ▸ Plugins ▸ Hello Runtime (▸ Chip, ▸ About). Feature-detected+ // so the plugin still loads on hosts that predate the helper.+ ctx.registerSettingsPage?.({+ id: 'settings',+ title: 'Hello Runtime',+ icon: 'zap',+ render: function General() {+ const { showChip } = useValue(prefs)++ return jsx(ToggleRow, {+ checked: showChip,+ description: 'The ⚡ chip at the right end of the status bar.',+ label: 'Show status-bar chip',+ onChange: on => update({ showChip: on })+ })+ },+ children: [+ {+ id: 'chip',+ title: 'Chip',+ render: function Chip() {+ const { label } = useValue(prefs)++ return jsx(ListRow, {+ action: jsx(SegmentedControl, {+ onChange: value => update({ label: value }),+ options: [+ { id: 'word', label: '⚡ runtime' },+ { id: 'icon', label: '⚡' }+ ],+ value: label+ }),+ description: 'How much room the chip takes in the status bar.',+ title: 'Label'+ })+ }+ },+ {+ id: 'about',+ title: 'About',+ render: function About() {+ const gateway = useValue(host.state.gateway)++ return jsxs('div', {+ children: [+ jsx(ListRow, {+ description: 'Plain ESM loaded through the runtime pipeline (blob import + SDK injection).',+ title: 'Loaded at runtime'+ }),+ jsx(ListRow, { description: String(gateway), title: 'Gateway' })+ ]+ })+ }+ }+ ]})}}diff --git a/website/docs/developer-guide/desktop-plugin-sdk.md b/website/docs/developer-guide/desktop-plugin-sdk.mdindex 3bd8c430f69..c9eb8490d6b 100644--- a/website/docs/developer-guide/desktop-plugin-sdk.md+++ b/website/docs/developer-guide/desktop-plugin-sdk.md@@ -182,6 +182,8 @@ interface PluginContext {register: (c: PluginContribution) => () => void/** Register several at once; the returned disposer removes all of them. */registerMany: (cs: PluginContribution[]) => () => void+ /** Own entry (+ sub-pages) under Settings → Plugins. Removed on disable/unload. */+ registerSettingsPage: (page: PluginSettingsPage) => () => void/** REST to this plugin's own backend namespace (`/api/plugins/<id>`). */rest: <T>(path: string, opts?: PluginRestOptions) => Promise<T>/** Live WebSocket to this plugin's own namespace. Returns a disposer. */@@ -236,6 +238,7 @@ Import the area constants from the SDK; each area has its own `data` payload.| Composer | `COMPOSER_AREAS.*` | render slots, or middleware / attachment providers || Model menu rows | `MODEL_MENU_ROW_AREA` | `data: ModelMenuRowContribution` — a leading icon / trailing badge per model || Appearance settings | `APPEARANCE_AREAS.extra` | `render` — controls appended to Settings → Appearance |+| Plugin settings page | `SETTINGS_PLUGINS_AREA` (`'settings.plugins'`) | Use `ctx.registerSettingsPage({ id, title, render, icon?, order?, children? })` — your own entry (with sub-pages) under Settings → Plugins |### Panes@@ -793,6 +796,48 @@ Migrations for the plugins that motivated this slot:that reaches into Settings; the settings *values* still go through`host.settings` (allowlisted keys) and `THEMES_AREA`.+### Plugin settings pages (Settings → Plugins) {#plugin-settings-pages}++**Settings → Plugins** is the one home for plugin preferences, laid out like+WoW's AddOns options: every plugin with settings gets its own entry in the+Settings rail, and selecting it folds out that plugin's sub-pages. Don't build a+preferences dialog, pane, or sidebar row for settings. Register a page:++```javascript+ctx.registerSettingsPage?.({+ id: 'settings', // unique within your plugin+ title: 'Weather', // rail label + breadcrumb+ icon: 'cloud', // codicon name; a plug when omitted+ order: 0, // ascending; ties sort by title+ render: () => jsx(General, {}), // the entry's landing page+ children: [ // optional sub-pages, listed in this order+ { id: 'units', title: 'Units', render: () => jsx(Units, {}) },+ { id: 'alerts', title: 'Alerts', render: () => jsx(Alerts, {}) }+ ]+})+```++- The page lives as long as the plugin. Disable or unload removes it, the same+ as every other `ctx` registration, and the returned disposer removes it early.+- Build the page from the settings primitives (`ToggleRow`, `ListRow`,+ `SegmentedControl`, `Select*`) and persist with `ctx.storage` so it looks like+ core Settings. Each page renders inside its own error boundary.+- `registerSettingsPage` is new; the `?.` keeps the plugin loading on older+ hosts. On those hosts, `ctx.register({ area: SETTINGS_PLUGINS_AREA, id, title,+ render, data: { icon, children } })` is the same thing spelled out.+- Deep link: `host.navigate(pluginSettingsHref('<your-plugin-id>', 'units'))`+ (`/settings?tab=plugins&plugin=<id>&ppage=<sub-page>`).+- **Agent plugins get a page automatically.** A `config_schema` in+ `plugin.yaml` renders as a form under Settings → Plugins, saved through+ `plugins.manage settings` for the profile the Settings scope selector targets.+ The gear on the plugin's Capabilities → Plugins row opens that page. In a+ unified package (agent half plus `desktop/plugin.js`), when the desktop half+ also registers a page, the schema form shows up as that entry's+ **Agent settings** sub-page, so the package has one entry.++`src/plugins/hello-runtime/plugin.runtime.js` is a complete runtime example: one+page and two sub-pages, backed by `ctx.storage`.+### Embedding external contentUse the SDK's `<SandboxedFrame src title />` for any external web content@@ -1649,7 +1694,9 @@ For gateway-wide data (not your own namespace), use `host.request` (JSON-RPC) an## Settings, enable state, and storageEvery plugin — enabled or not — inventories in **Capabilities → Plugins**, where the-user toggles it live (no app restart), reveals its folder, or rescans. The user's+user toggles it live (no app restart), reveals its folder, or rescans. A plugin's+own preferences belong in **Settings → Plugins**+([plugin settings pages](#plugin-settings-pages)). The user'schoice is remembered:- No choice yet → the plugin's own `defaultEnabled` (default `true`). Set@@ -1746,8 +1793,8 @@ pipeline as a trust boundary.|----------|---------|| Host | `host` (`.state.*`, `.settings`, `.notify`, `.notifyError`, `.navigate`, `.onEvent`, `.logs`, `.status`, `.restartGateway`, `.request`, `.composer`, `.sessions`, `.skills`, `.toolsets`, `.profiles`, `.pluginDecisions`) || Plugin contract | `HermesPlugin`, `PluginContext`, `PluginContribution`, `PluginStorage`, `PluginOs`, `PluginRestOptions`, `PluginNativeNotificationInput`, `PluginNotificationAction`, `HermesOpenTarget`, `Contribution` |-| Area constants | `PANES_AREA`, `ROUTES_AREA`, `SIDEBAR_NAV_AREA`, `STATUSBAR_AREAS`, `TITLEBAR_AREAS`, `WORKSPACE_PAGE_HEADER_AREA`, `PALETTE_AREA`, `KEYBINDS_AREA`, `THEMES_AREA`, `COMPOSER_AREAS`, `MODEL_MENU_ROW_AREA`, `SESSION_ROW_AREAS`, `SIDEBAR_NAV_PREFS_AREA`, `APPEARANCE_AREAS` |-| Area payloads | `RouteContribution`, `SidebarNavContribution`, `StatusbarItem`, `TitlebarTool`, `PaletteContribution`, `KeybindContribution`, `ComposerMiddleware`, `ComposerAttachmentProvider`, `SessionRowSlotContribution`, `SidebarNavPrefsContribution` |+| Area constants | `PANES_AREA`, `ROUTES_AREA`, `SIDEBAR_NAV_AREA`, `STATUSBAR_AREAS`, `TITLEBAR_AREAS`, `WORKSPACE_PAGE_HEADER_AREA`, `PALETTE_AREA`, `KEYBINDS_AREA`, `THEMES_AREA`, `COMPOSER_AREAS`, `MODEL_MENU_ROW_AREA`, `SESSION_ROW_AREAS`, `SIDEBAR_NAV_PREFS_AREA`, `APPEARANCE_AREAS`, `SETTINGS_PLUGINS_AREA` |+| Area payloads | `PluginSettingsPage`, `PluginSettingsSubpage` (+ `pluginSettingsHref`), `RouteContribution`, `SidebarNavContribution`, `StatusbarItem`, `TitlebarTool`, `PaletteContribution`, `KeybindContribution`, `ComposerMiddleware`, `ComposerAttachmentProvider`, `SessionRowSlotContribution`, `SidebarNavPrefsContribution` || React / state | `useValue`, `atom`, `computed`, `useQuery`, `useMutation`, `useQueryClient`, `queryClient`, `Contribute`, `WorkspacePageHeaderControl` || Theming | `useTheme`, `requestTheme`, `setAccentOverride`, `$accentOverride`, `retintTheme`, `themeHue`, `DesktopTheme`, `DesktopThemeColors`, plus OKLCH math (`hexToOklch`, `oklchToHex`, `oklchToSrgb255`, `mixOklab`, `maxChroma`, `hueDelta`, `normalizeHex`) and sRGB measures (`contrastRatio` — `number | null`, null for unparseable input — `readableOn`) || UI kit | `Button`, `Input`, `Textarea`, `Select*`, `Switch`, `Checkbox`, `SegmentedControl`, `Tabs*`, `Dialog*`, `ConfirmDialog`, `DropdownMenu*`, `ContextMenu*`, `Popover*`, `Tip`/`Tooltip*`, `Badge`, `Kbd`/`KbdGroup`, `SearchField`, `ScrollArea`, `Separator`, `Skeleton`, `GlyphSpinner`, `Loader`, `EmptyState`, `ErrorState`, `CopyButton`, `StatusDot`, `LogView`, `Codicon`, `DecodeText`, `SandboxedFrame` |