The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(desktop): route bot skill installs to owner
Abuarchiv2683899b817a
diff --git a/apps/desktop/src/plugins/hermes-bots/create-dialog.tsx b/apps/desktop/src/plugins/hermes-bots/create-dialog.tsxindex 0dad5b8d96f..ea70859f4d8 100644--- a/apps/desktop/src/plugins/hermes-bots/create-dialog.tsx+++ b/apps/desktop/src/plugins/hermes-bots/create-dialog.tsx@@ -874,7 +874,6 @@ export function CreateAgentDialog({ open, onClose, roster }: CreateAgentDialogPr</div><div className="text-[0.65rem] leading-4 text-(--ui-text-quaternary)">{`Catalog from ${caps.source} — unchecked skills are disabled after creation.`}</div><HubSkillsSection- forProfile={null}onInstalled={name =>setCaps(prev =>!prev || prev.skills.some(s => s.name === name)diff --git a/apps/desktop/src/plugins/hermes-bots/profile-config.tsx b/apps/desktop/src/plugins/hermes-bots/profile-config.tsxindex a431bcfe9ca..fe379580ddb 100644--- a/apps/desktop/src/plugins/hermes-bots/profile-config.tsx+++ b/apps/desktop/src/plugins/hermes-bots/profile-config.tsx@@ -376,7 +376,7 @@ export function AdvancedProfileConfig({ bot, state, setState }: AdvancedProfileC<CheckList columns={2} items={visibleSkills} onToggle={toggleSkill} /></div><HubSkillsSection- forProfile={backendScope}+ bot={bot}onInstalled={name =>setState(prev =>prev.skills.some(s => s.name === name)diff --git a/apps/desktop/src/plugins/hermes-bots/skills-hub-picker.test.tsx b/apps/desktop/src/plugins/hermes-bots/skills-hub-picker.test.tsxindex e8f5222106d..088ae42cd26 100644--- a/apps/desktop/src/plugins/hermes-bots/skills-hub-picker.test.tsx+++ b/apps/desktop/src/plugins/hermes-bots/skills-hub-picker.test.tsx@@ -10,7 +10,7 @@*/import type * as HermesSdk from '@hermes/plugin-sdk'-import { cleanup, fireEvent, render, screen } from '@testing-library/react'+import { cleanup, fireEvent, render, screen, waitFor } from '@testing-library/react'import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'const HUB_ORIGIN = 'https://hermes-agent.nousresearch.com'@@ -18,7 +18,8 @@ const HUB_ORIGIN = 'https://hermes-agent.nousresearch.com'const mocks = vi.hoisted(() => ({notify: vi.fn(),notifyError: vi.fn(),- request: vi.fn(async (_method: string, _params: Record<string, unknown>) => ({}))+ request: vi.fn(async (_method: string, _params: Record<string, unknown>) => ({})),+ requestProfile: vi.fn(async (_route: unknown, _method: string, _params: Record<string, unknown>) => ({}))}))vi.mock('@hermes/plugin-sdk', async importOriginal => {@@ -26,7 +27,13 @@ vi.mock('@hermes/plugin-sdk', async importOriginal => {return {...original,- host: { ...original.host, notify: mocks.notify, notifyError: mocks.notifyError, request: mocks.request }+ host: {+ ...original.host,+ notify: mocks.notify,+ notifyError: mocks.notifyError,+ request: mocks.request,+ requestProfile: mocks.requestProfile+ }}})@@ -40,7 +47,7 @@ interface PickMessage {/** Mount the section with the hub browser open and hand back its frame. */function openHubBrowser() {- const { container } = render(<HubSkillsSection forProfile={null} />)+ const { container } = render(<HubSkillsSection />)fireEvent.click(screen.getByRole('button', { name: /browse the full hub/ }))@@ -65,6 +72,10 @@ function installCalls() {return mocks.request.mock.calls.filter(([, params]) => params.action === 'install')}+function routedInstallCalls() {+ return mocks.requestProfile.mock.calls.filter(([, , params]) => params.action === 'install')+}+beforeEach(() => {vi.clearAllMocks()})@@ -87,6 +98,51 @@ describe('hub pick messages', () => {expect(installCalls()).toEqual([['skills.manage', { action: 'install', query: 'nous/web-research' }]])})+ it('routes an existing source-scoped bot install through its owner connection', async () => {+ const { container } = render(+ <HubSkillsSection+ bot={{+ name: 'worker',+ remoteSource: true,+ route: {+ connectionId: 'remote-a',+ mode: 'remote',+ profile: 'worker',+ targetProfile: 'backend-worker'+ },+ sourceScoped: true+ }}+ />+ )++ fireEvent.click(screen.getByRole('button', { name: /browse the full hub/ }))+ const frame = container.querySelector('iframe') as HTMLIFrameElement++ postPick(+ { identifier: 'nous/web-research', name: 'Web Research', type: 'hermes-skill-pick' },+ { source: frame.contentWindow }+ )++ await waitFor(() => expect(routedInstallCalls()).toHaveLength(1))+ expect(routedInstallCalls()).toEqual([+ [+ expect.objectContaining({+ connectionId: 'remote-a',+ mode: 'remote',+ profile: 'worker',+ targetProfile: 'backend-worker'+ }),+ 'skills.manage',+ {+ action: 'install',+ profile: 'backend-worker',+ query: 'nous/web-research'+ }+ ]+ ])+ expect(installCalls()).toEqual([])+ })+it('regression: ignores a same-origin window that is NOT the picker frame', () => {openHubBrowser()diff --git a/apps/desktop/src/plugins/hermes-bots/skills-hub.tsx b/apps/desktop/src/plugins/hermes-bots/skills-hub.tsxindex 164ea07ef9c..fb81988d7fb 100644--- a/apps/desktop/src/plugins/hermes-bots/skills-hub.tsx+++ b/apps/desktop/src/plugins/hermes-bots/skills-hub.tsx@@ -10,6 +10,8 @@ import { Button, host, Input } from '@hermes/plugin-sdk'import { useEffect, useRef, useState } from 'react'import { useBots } from './i18n'+import { requestForBot } from './routing'+import type { RosterRow } from './types'// ── skills hub section: the REAL hub page (docs) embedded as a picker ──────// https://hermes-agent.nousresearch.com/docs/skills?embed=picker hides the@@ -26,13 +28,12 @@ interface HubSkillResult {name: string}interface HubSkillsSectionProps {- /** Install target: a bare profile name, a connection-scoped descriptor for a- * bot on another gateway, or null for the launch profile (create time). */- forProfile: null | string | { connectionId?: null | string; profile?: null | string }+ /** Existing bot to route through; omitted for the launch profile at create time. */+ bot?: RosterRowonInstalled?: (name: string) => void}-export function HubSkillsSection({ forProfile, onInstalled }: HubSkillsSectionProps) {+export function HubSkillsSection({ bot, onInstalled }: HubSkillsSectionProps) {const b = useBots()const [query, setQuery] = useState('')const [results, setResults] = useState<HubSkillResult[] | null>(null)@@ -119,18 +120,15 @@ export function HubSkillsSection({ forProfile, onInstalled }: HubSkillsSectionPrsetInstalling(label)try {- // With forProfile the install lands in that bot's skills dir- // (gateway skills.manage profile scoping); null = launch profile,- // which is right at create time — the new bot clones/copies from it.- await host.request('skills.manage', {+ // Existing bots must use their owner route; the active gateway is not+ // necessarily the gateway that owns the bot. Create-time installs stay+ // ambient because there is no bot row to route yet.+ const params = {action: 'install',query: name,- ...(forProfile- ? {- profile: forProfile- }- : {})- })+ ...(bot ? { profile: bot.name } : {})+ }+ await (bot ? requestForBot(bot, 'skills.manage', params) : host.request('skills.manage', params))setInstalled(prev => ({...prev,[label]: true