Skip to content

The agent that grows with you

feat(desktop): typed skills/toolsets/profiles bridge for plugins

tobenwarriorbd5563324866
diff --git a/apps/desktop/src/sdk/index.test.ts b/apps/desktop/src/sdk/index.test.ts
index 796bb948e09..bf5fc54fffc 100644
--- a/apps/desktop/src/sdk/index.test.ts
+++ b/apps/desktop/src/sdk/index.test.ts
@@ -449,3 +449,57 @@ describe('host.sessions session-list mutations', () => {
expect($sessionColorOverrides.get()).toEqual({})
})
})
+
+// The typed capabilities bridge: plugins configure skills/toolsets/profiles
+// through the SAME endpoints the Capabilities page uses, and read the plugin
+// decision map through one accessor instead of raw storage writes.
+describe('host capability namespaces', () => {
+ const desktopWindow = window as unknown as { hermesDesktop?: Window['hermesDesktop'] }
+ const originalDesktop = desktopWindow.hermesDesktop
+ const api = vi.fn(async (request: { path: string }) => ({ ok: true, path: request.path }))
+
+ beforeEach(() => {
+ api.mockClear()
+ desktopWindow.hermesDesktop = { ...originalDesktop, api } as unknown as Window['hermesDesktop']
+ })
+
+ afterEach(() => {
+ desktopWindow.hermesDesktop = originalDesktop
+ })
+
+ it('skills.setEnabled routes through the Capabilities toggle endpoint with the profile scope', async () => {
+ await host.skills.setEnabled('docx', false, { profile: 'writer' })
+
+ expect(api).toHaveBeenCalledWith(
+ expect.objectContaining({
+ body: { enabled: false, name: 'docx' },
+ method: 'PUT',
+ path: '/api/skills/toggle',
+ profile: 'writer'
+ })
+ )
+ })
+
+ it('toolsets.setEnabled routes through the toolset endpoint', async () => {
+ await host.toolsets.setEnabled('browser', true)
+
+ expect(api).toHaveBeenCalledWith(
+ expect.objectContaining({ body: { enabled: true }, method: 'PUT', path: '/api/tools/toolsets/browser' })
+ )
+ })
+
+ it('profiles.list reads the same endpoint the profile rail does', async () => {
+ await host.profiles.list()
+
+ expect(api).toHaveBeenCalledWith(expect.objectContaining({ path: '/api/profiles' }))
+ })
+
+ it('pluginDecisions reads the live decisions store', async () => {
+ const { $pluginDecisions } = await import('@/contrib/plugins-store')
+
+ $pluginDecisions.set({ demo: false })
+
+ expect(host.pluginDecisions.get('demo')).toBe(false)
+ expect(host.pluginDecisions.all()).toEqual({ demo: false })
+ })
+})
diff --git a/apps/desktop/src/sdk/index.ts b/apps/desktop/src/sdk/index.ts
index 8d5c7b91acb..f48c6e022bc 100644
--- a/apps/desktop/src/sdk/index.ts
+++ b/apps/desktop/src/sdk/index.ts
@@ -21,7 +21,10 @@
import { atom, computed, type ReadableAtom } from 'nanostores'
import type { ReactNode } from 'react'
-import { capabilityScoped } from '@/api/client'
+import { capabilityScoped, type ProfileScope } from '@/api/client'
+import { getProfiles } from '@/api/profiles'
+import { getSkills, setSkillEnabled } from '@/api/skills'
+import { getToolsets, setToolsetEnabled } from '@/api/toolsets'
import { PRIMARY_SESSION_VIEW } from '@/app/chat/session-view'
import { openSession, type OpenSessionIntent } from '@/app/open-session'
import { syncWorkspaceRoute } from '@/app/routes'
@@ -44,6 +47,7 @@ import {
type WorkspaceNewSessionTarget
} from '@/components/pane-shell/workspace-scope'
import { onGatewayEvent } from '@/contrib/events'
+import { $pluginDecisions, setPluginEnabled } from '@/contrib/plugins-store'
import { registry } from '@/contrib/registry'
import type { WorkspaceMode } from '@/contrib/types'
import { deleteProfile, getLogs, getStatus, hermesApi, type HermesGateway } from '@/hermes'
@@ -922,6 +926,45 @@ export const host = {
/** Session-list mutations (pin, reorder, colour) — see `./sessions`. */
sessions: sessionsHost,
+ /** Capability management — the SAME endpoints the Capabilities page uses,
+ * wrapped with the app's profile scoping, so a plugin configuring skills or
+ * toolsets behaves exactly like the page (and stops calling
+ * `window.hermesDesktop.api` raw). Every call takes an optional
+ * `ProfileScope` to configure ANY profile without swapping the app-wide
+ * active profile; omit it for the active one. */
+ skills: {
+ /** Every skill the backend reports for the scope. */
+ list: (profile?: ProfileScope) => getSkills(profile),
+ /** Enable/disable a skill (the Capabilities toggle). */
+ setEnabled: (name: string, enabled: boolean, profile?: ProfileScope) => setSkillEnabled(name, enabled, profile)
+ },
+
+ toolsets: {
+ /** Every toolset with its enabled state for the scope. */
+ list: (profile?: ProfileScope) => getToolsets(profile),
+ /** Enable/disable a toolset (the Capabilities toggle). */
+ setEnabled: (name: string, enabled: boolean, profile?: ProfileScope) => setToolsetEnabled(name, enabled, profile)
+ },
+
+ profiles: {
+ /** The profile list as the app's own surfaces read it (same endpoint and
+ * startup timeout as the profile rail). */
+ list: (scope?: ProfileScope) => getProfiles(scope)
+ },
+
+ /** This window's plugin enable/disable decisions — the persisted map the
+ * Capabilities → Plugins page writes. Read it to respect a user's choice;
+ * `set` goes through the SAME live toggle the page uses (deactivate and
+ * activate included), never a raw storage write. */
+ pluginDecisions: {
+ /** Every recorded decision, id → enabled. */
+ all: (): Readonly<Record<string, boolean>> => $pluginDecisions.get(),
+ /** One decision, or undefined when the user never made one. */
+ get: (id: string): boolean | undefined => $pluginDecisions.get()[id],
+ /** Flip one decision (persists + applies immediately). */
+ set: (id: string, enabled: boolean): Promise<void> => setPluginEnabled(id, enabled)
+ },
+
/** Open a stored session the way core surfaces do. A plugin/Bot Mode open
* is navigation, not a workspace or chrome API-home switch —
* keepAllProfilesScope defaults true so `$activeGatewayProfile` /
diff --git a/website/docs/developer-guide/desktop-plugin-sdk.md b/website/docs/developer-guide/desktop-plugin-sdk.md
index 0eff36d1025..8cb0c18630e 100644
--- a/website/docs/developer-guide/desktop-plugin-sdk.md
+++ b/website/docs/developer-guide/desktop-plugin-sdk.md
@@ -835,6 +835,13 @@ host.sessions.pin(storedSessionId, pinned?, index?) // pin/unpin (default pinne
host.sessions.reorder(ids) // replace the manual Recents order (what a drag persists); [] resets
host.sessions.reorderPinned(ids) // permute the Pinned section (the pinned drag path)
host.sessions.setColor(storedSessionId, color | null) // per-session colour override; null clears
+host.skills.list(profile?) // every skill for the scope (Capabilities endpoints)
+host.skills.setEnabled(name, on, profile?) // enable/disable a skill — the Capabilities toggle
+host.toolsets.list(profile?) // toolsets + enabled state
+host.toolsets.setEnabled(name, on, profile?)// enable/disable a toolset
+host.profiles.list(scope?) // the profile list the profile rail reads
+host.pluginDecisions.all() / .get(id) // this window's plugin enable/disable decisions
+host.pluginDecisions.set(id, enabled) // flip one through the live toggle (persists + applies)
```
`host.request` is the same JSON-RPC the app itself uses (sessions, config, skills,