Merge branch 'main' into main

This commit is contained in:
github-actions[bot]
2026-04-29 08:54:27 +00:00
committed by GitHub
2 changed files with 20 additions and 6 deletions

View File

@@ -1,5 +1,5 @@
import { describe, it, expect, vi } from 'vitest'
import { render as rtlRender, screen, fireEvent, act } from '@testing-library/react'
import { render as rtlRender, screen, fireEvent, act, waitFor } from '@testing-library/react'
import { AiPanel } from './AiPanel'
import { UNSUPPORTED_INLINE_PASTE_MESSAGE } from './InlineWikilinkInput'
import { TooltipProvider } from '@/components/ui/tooltip'
@@ -152,7 +152,7 @@ describe('AiPanel', () => {
expect(screen.getByRole('radio', { name: 'Power User' })).toBeDisabled()
})
it('renders the permission mode toggle with high contrast selected state and explanatory tooltip', async () => {
it('renders the permission mode toggle with high contrast selected state and per-mode tooltips', async () => {
render(<AiPanel onClose={vi.fn()} vaultPath="/tmp/vault" />)
expect(screen.getByTestId('ai-permission-mode-toggle')).toHaveClass('border', 'bg-muted')
@@ -166,8 +166,17 @@ describe('AiPanel', () => {
fireEvent.focus(safeMode)
expect(await screen.findByTestId('ai-permission-mode-tooltip')).toHaveTextContent(
'Vault Safe keeps agents to file, search, and edit tools. Power User also allows local shell commands for this vault.',
'Vault Safe keeps agents limited to file, search, and edit tools.',
)
fireEvent.blur(safeMode)
fireEvent.focus(powerUserMode)
await waitFor(() => {
expect(screen.getByTestId('ai-permission-mode-tooltip')).toHaveTextContent(
'Power User also allows local shell commands for this vault.',
)
})
})
it('renders data-testid ai-panel', () => {

View File

@@ -16,8 +16,13 @@ import type { AiAgentReadiness } from '../lib/aiAgents'
import type { NoteReference } from '../utils/ai-context'
import type { VaultEntry } from '../types'
const AI_PERMISSION_MODE_TOOLTIP = {
label: 'Vault Safe keeps agents to file, search, and edit tools. Power User also allows local shell commands for this vault.',
const AI_PERMISSION_MODE_TOOLTIPS: Record<AiAgentPermissionMode, { label: string }> = {
safe: {
label: 'Vault Safe keeps agents limited to file, search, and edit tools.',
},
power_user: {
label: 'Power User also allows local shell commands for this vault.',
},
}
interface AiPanelHeaderProps {
@@ -228,7 +233,7 @@ function AiPermissionModeToggle({
return (
<ActionTooltip
key={mode}
copy={AI_PERMISSION_MODE_TOOLTIP}
copy={AI_PERMISSION_MODE_TOOLTIPS[mode]}
side="bottom"
contentTestId="ai-permission-mode-tooltip"
>