Skip to content

The agent that grows with you

feat(desktop): choose plugin install profile (#118889)

Siddharth Balyanb54c9568e70d
diff --git a/apps/desktop/src/app/settings/plugin-install-modal.test.tsx b/apps/desktop/src/app/settings/plugin-install-modal.test.tsx
index e2c1a59cdc0..5ad620907a2 100644
--- a/apps/desktop/src/app/settings/plugin-install-modal.test.tsx
+++ b/apps/desktop/src/app/settings/plugin-install-modal.test.tsx
@@ -24,7 +24,7 @@ import {
closePluginInstallRequest,
openPluginInstallRequest
} from '@/store/plugin-install-request'
-import { $activeGatewayProfile } from '@/store/profile'
+import { $activeGatewayProfile, $profiles } from '@/store/profile'
import { $connection, $gatewayState } from '@/store/session'
import { PluginsTab } from '../capabilities/plugins/plugins-tab'
@@ -46,10 +46,32 @@ const renderFlow = () =>
beforeEach(() => {
vi.clearAllMocks()
+ Object.defineProperty(Element.prototype, 'scrollIntoView', { configurable: true, value: vi.fn() })
queryClient.clear()
closePluginInstallRequest()
$gatewayState.set('idle')
$activeGatewayProfile.set('default')
+ $profiles.set([
+ {
+ has_env: false,
+ is_default: true,
+ model: null,
+ name: 'default',
+ path: '/profiles/default',
+ provider: null,
+ skill_count: 0
+ },
+ {
+ display_name: 'Research Bot',
+ has_env: false,
+ is_default: false,
+ model: null,
+ name: 'research',
+ path: '/profiles/research',
+ provider: null,
+ skill_count: 0
+ }
+ ])
probePluginRepo.mockResolvedValue({ ok: true, agent: true, desktop: true, warnings: [] })
vi.stubGlobal('hermesDesktop', { probePluginRepo, installDesktopPlugin })
})
@@ -125,6 +147,28 @@ describe('Install from Git entry flow', () => {
expect(installDesktopPlugin).not.toHaveBeenCalled()
})
+ it('installs a deep-linked agent plugin into the selected profile', async () => {
+ probePluginRepo.mockResolvedValue({ ok: true, agent: true, desktop: false, warnings: [] })
+ requestGateway.mockImplementation(async method =>
+ method === 'plugins.manage' ? { ok: true, plugin_name: 'plugin', plugins: [] } : { plugins: [] }
+ )
+ renderFlow()
+ act(() => openPluginInstallRequest({ catalogName: 'plugin', repo: 'https://github.com/example/plugin' }))
+
+ const profile = await screen.findByRole('combobox', { name: 'Install for profile' })
+
+ fireEvent.click(profile)
+ fireEvent.click(await screen.findByRole('option', { name: 'Research Bot' }))
+ fireEvent.click(screen.getByRole('button', { name: 'Install' }))
+
+ await waitFor(() =>
+ expect(requestGateway).toHaveBeenCalledWith(
+ 'plugins.manage',
+ expect.objectContaining({ action: 'install', catalog_name: 'plugin', profile: 'research' })
+ )
+ )
+ })
+
it('pins a custom install to a full commit SHA and refuses anything shorter', async () => {
probePluginRepo.mockResolvedValue({ ok: true, agent: true, desktop: false, warnings: [] })
requestGateway.mockImplementation(async method =>
diff --git a/apps/desktop/src/app/settings/plugin-install-modal.tsx b/apps/desktop/src/app/settings/plugin-install-modal.tsx
index ea111cdc79c..355cf742697 100644
--- a/apps/desktop/src/app/settings/plugin-install-modal.tsx
+++ b/apps/desktop/src/app/settings/plugin-install-modal.tsx
@@ -16,6 +16,7 @@ import {
preventCloseButtonAutoFocus
} from '@/components/ui/dialog'
import { Input } from '@/components/ui/input'
+import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select'
import { Switch } from '@/components/ui/switch'
import { discoverRuntimePlugins } from '@/contrib/runtime-loader'
import { useI18n } from '@/i18n'
@@ -30,7 +31,7 @@ import {
openPluginInstallRequest,
type PluginInstallRequest
} from '@/store/plugin-install-request'
-import { $activeGatewayProfile, $profileScope } from '@/store/profile'
+import { $activeGatewayProfile, $profiles, $profileScope, normalizeProfileKey, profileLabel } from '@/store/profile'
import { $connection } from '@/store/session'
import { runGatewayRestart } from '@/store/system-actions'
@@ -48,9 +49,11 @@ export function PluginInstallModal() {
const onSettings = location.pathname.startsWith(SETTINGS_ROUTE)
const connection = useStore($connection)
const activeProfile = useStore($activeGatewayProfile)
+ const profiles = useStore($profiles)
const profileScope = useStore($profileScope)
const [repoInput, setRepoInput] = useState('')
+ const [targetProfile, setTargetProfile] = useState('default')
const [phase, setPhase] = useState<ProbePhase>('idle')
const [probe, setProbe] = useState<ProbeResult | null>(null)
const [installAgent, setInstallAgent] = useState(true)
@@ -151,21 +154,23 @@ export function PluginInstallModal() {
return
}
+ setTargetProfile(normalizeProfileKey(request.profile || activeProfile || profileScope))
+
if (request.repo) {
void runProbe(request)
}
- }, [request, resetState, runProbe])
+ }, [activeProfile, profileScope, request, resetState, runProbe])
- const profileLabel = request?.profile || activeProfile || profileScope || 'default'
+ const targetProfileInfo = profiles.find(profile => normalizeProfileKey(profile.name) === targetProfile)
+ const profileOptions = targetProfileInfo ? profiles : [...profiles, { name: targetProfile }]
+ const targetProfileLabel = profileLabel(targetProfileInfo ?? { name: targetProfile })
const agentTargetHint =
connection?.mode === 'remote'
- ? m.agentTargetRemote(profileLabel)
+ ? m.agentTargetRemote(targetProfileLabel)
: m.agentTargetLocal(
- profileLabel,
- request?.profile && request.profile !== 'default'
- ? `~/.hermes/profiles/${request.profile}/plugins/`
- : '~/.hermes/plugins/'
+ targetProfileLabel,
+ targetProfile === 'default' ? '~/.hermes/plugins/' : `~/.hermes/profiles/${targetProfile}/plugins/`
)
// A unified package installed into a local backend carries its own desktop
@@ -211,7 +216,7 @@ export function PluginInstallModal() {
enable: enableAgent,
catalogName: request.catalogName,
ref: pinRefTrimmed || undefined,
- profile: request.profile
+ profile: targetProfile
})
if (result.ok) {
@@ -272,7 +277,7 @@ export function PluginInstallModal() {
}
}
- await loadAgentPlugins(requestGateway)
+ await loadAgentPlugins(requestGateway, targetProfile)
if (errors.length === 0) {
for (const message of successes) {
@@ -419,20 +424,39 @@ export function PluginInstallModal() {
</div>
{probe.agent && (
- <label className="flex items-start gap-3 rounded-lg border border-(--ui-stroke-tertiary) px-3 py-2">
- <Checkbox
- checked={installAgent}
- disabled={busy}
- onCheckedChange={value => setInstallAgent(value === true)}
- />
- <span className="min-w-0">
- <span className="block font-medium text-foreground">{m.agentLabel}</span>
- <span className="block text-[length:var(--conversation-caption-font-size)] text-(--ui-text-tertiary)">
- {agentTargetHint}
- {probe.agentName ? ` · ${probe.agentName}` : ''}
+ <div className="space-y-2 rounded-lg border border-(--ui-stroke-tertiary) px-3 py-2">
+ <label className="flex items-start gap-3">
+ <Checkbox
+ checked={installAgent}
+ disabled={busy}
+ onCheckedChange={value => setInstallAgent(value === true)}
+ />
+ <span className="min-w-0">
+ <span className="block font-medium text-foreground">{m.agentLabel}</span>
+ <span className="block text-[length:var(--conversation-caption-font-size)] text-(--ui-text-tertiary)">
+ {agentTargetHint}
+ {probe.agentName ? ` · ${probe.agentName}` : ''}
+ </span>
</span>
- </span>
- </label>
+ </label>
+ <label className="block space-y-1 pl-7">
+ <span className="text-[length:var(--conversation-caption-font-size)] text-foreground">
+ {m.profileLabel}
+ </span>
+ <Select disabled={busy || !installAgent} onValueChange={setTargetProfile} value={targetProfile}>
+ <SelectTrigger aria-label={m.profileLabel} className="w-full">
+ <SelectValue />
+ </SelectTrigger>
+ <SelectContent>
+ {profileOptions.map(profile => (
+ <SelectItem key={profile.name} value={normalizeProfileKey(profile.name)}>
+ {profileLabel(profile)}
+ </SelectItem>
+ ))}
+ </SelectContent>
+ </Select>
+ </label>
+ </div>
)}
{probe.desktop && (
diff --git a/apps/desktop/src/i18n/en.ts b/apps/desktop/src/i18n/en.ts
index 9b3153d61e5..11b383587c1 100644
--- a/apps/desktop/src/i18n/en.ts
+++ b/apps/desktop/src/i18n/en.ts
@@ -595,6 +595,7 @@ export const en: Translations = {
includesHeading: 'This package includes',
agentLabel: 'Agent plugin',
desktopLabel: 'Desktop UI',
+ profileLabel: 'Install for profile',
agentTargetLocal: (profile, dir) => `Installs into the ${profile} backend (${dir})`,
agentTargetRemote: profile => `Installs into the connected ${profile} backend`,
catalogPinned: (name, sha) =>
diff --git a/apps/desktop/src/i18n/ru.ts b/apps/desktop/src/i18n/ru.ts
index 17da8e73841..244a2817edb 100644
--- a/apps/desktop/src/i18n/ru.ts
+++ b/apps/desktop/src/i18n/ru.ts
@@ -501,6 +501,7 @@ export const ru = defineLocale({
includesHeading: 'Состав пакета',
agentLabel: 'Плагин агента',
desktopLabel: 'UI приложения',
+ profileLabel: 'Установить для профиля',
agentTargetLocal: (profile, dir) => `Устанавливается в локальный бэкенд ${profile} (${dir})`,
agentTargetRemote: profile => `Устанавливается в подключённый бэкенд ${profile}`,
desktopTarget: 'Устанавливается в локальную папку desktop-plugins этого приложения',
diff --git a/apps/desktop/src/i18n/types.ts b/apps/desktop/src/i18n/types.ts
index 0966d8a1f6f..29831a72a8a 100644
--- a/apps/desktop/src/i18n/types.ts
+++ b/apps/desktop/src/i18n/types.ts
@@ -485,6 +485,7 @@ export interface Translations {
includesHeading: string
agentLabel: string
desktopLabel: string
+ profileLabel: string
agentTargetLocal: (profile: string, dir: string) => string
agentTargetRemote: (profile: string) => string
catalogPinned: (name: string, sha: string) => string
diff --git a/apps/desktop/src/i18n/zh.ts b/apps/desktop/src/i18n/zh.ts
index 6d988ed2f3f..f48363cadb1 100644
--- a/apps/desktop/src/i18n/zh.ts
+++ b/apps/desktop/src/i18n/zh.ts
@@ -622,6 +622,7 @@ export const zh = defineLocale({
includesHeading: '此包包含',
agentLabel: '智能体插件',
desktopLabel: '桌面 UI',
+ profileLabel: '安装到配置文件',
agentTargetLocal: (profile, dir) => `安装到 ${profile} 后端(${dir})`,
agentTargetRemote: profile => `安装到已连接的 ${profile} 后端`,
catalogPinned: (name, sha) =>