Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions apps/desktop/src/app/capabilities/index.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,29 @@ afterEach(() => {
// all 11 tests (2× in a row on PR #93612, plus a main run the same hour).
// Give this file headroom; the tests are not slow individually.
describe('CapabilitiesView toolset management', { timeout: 60_000 }, () => {
it.each(['matrix_read', 'matrix_unread', 'matrix_image_packs', 'matrix_reaction', 'matrix_followup'])(
'excludes %s from Desktop rows and bulk writes',
async name => {
const matrix = toolset({ name, label: 'Matrix channel', tools: [name] })
getToolsets.mockResolvedValue([toolset(), matrix])
await renderSkills()
await screen.findByRole('switch', { name: 'Turn Web Search toolset off' })
expect(screen.getAllByRole('switch').map(element => element.getAttribute('aria-label'))).toEqual([
'Turn Web Search toolset off'
])

await act(async () => {
fireEvent.pointerDown(screen.getByRole('button', { name: 'Tools' }), { button: 0, ctrlKey: false })
})
const all = await screen.findByRole('menuitem', { name: 'All' })
await act(async () => {
fireEvent.click(all)
})
await waitFor(() => expect(setToolsetEnabled.mock.calls).toEqual([['web', false, 'default']]))
expect(matrix).toEqual(toolset({ name, label: 'Matrix channel', tools: [name] }))
}
)

it('renders a switch for each toolset and toggles it off', async () => {
await renderSkills()

Expand Down
51 changes: 51 additions & 0 deletions apps/desktop/src/app/capabilities/toolsets/toolsets-data.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import { describe, expect, it } from 'vitest'

import type { ToolsetInfo } from '@/types/hermes'

import { filteredToolsets, toolsetSearchTerms, visibleToolsetCount } from './toolsets-data'

describe('Desktop toolset curation', () => {
it('excludes platform-only toolsets from rows, counts and search suggestions without changing their configuration', () => {
const row = (name: string): ToolsetInfo => ({
name,
label: name,
description: name,
tools: [name],
enabled: true,
configured: true
})

const web = row('web')

const extension = row('matrix_custom')

const rows = [
web,
row('matrix_read'),
row('matrix_admin'),
row('matrix_unread'),
row('matrix_image_packs'),
row('matrix_reaction'),
row('matrix_followup'),
extension
]

const before = structuredClone(rows)

const visible = filteredToolsets(rows, '', { web: 10 }, true)

expect({
visible,
count: visibleToolsetCount(rows),
suggestions: toolsetSearchTerms(rows),
searched: filteredToolsets(rows, 'matrix', {}, true),
configuration: rows
}).toEqual({
visible: [web, extension],
count: 2,
suggestions: ['web', 'matrix_custom'],
searched: [extension],
configuration: before
})
})
})
6 changes: 6 additions & 0 deletions apps/desktop/src/lib/desktop-toolsets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ const DESKTOP_HIDDEN_TOOLSETS = new Set([
// adapter; `hermes tools` restricts these off the CLI too.
'discord',
'discord_admin',
'matrix_admin',
'matrix_read',
'matrix_unread',
'matrix_image_packs',
'matrix_reaction',
'matrix_followup',
'yuanbao',
// Internal plumbing, not a user capability toggle.
'context_engine',
Expand Down