From f6ab055cf99ef46876a5e861d47e70ec7169d6b1 Mon Sep 17 00:00:00 2001 From: Brennan Benson <79079362+brennanb2025@users.noreply.github.com> Date: Mon, 12 Oct 2026 23:51:44 -0700 Subject: [PATCH] feat(settings): move Permissions for new chats into the Chat page's Behavior section The new-chat permission default sat alone above Appearance with its own header. It is a behaviour choice, so it now renders as the first row of the Behavior card, laid out like the rows already there. Its search entry and section id are unchanged, so search and deep links still land on it. --- .../settings/ChatBehaviorSetting.test.tsx | 19 ++++++++++++++++++- .../settings/ChatBehaviorSetting.tsx | 8 ++++++++ .../settings/ChatPermissionSetting.tsx | 8 ++++---- .../settings/ChatSettingsSection.tsx | 6 ------ 4 files changed, 30 insertions(+), 11 deletions(-) diff --git a/src/renderer/src/components/settings/ChatBehaviorSetting.test.tsx b/src/renderer/src/components/settings/ChatBehaviorSetting.test.tsx index af6b4743c9b7..eed7605218e1 100644 --- a/src/renderer/src/components/settings/ChatBehaviorSetting.test.tsx +++ b/src/renderer/src/components/settings/ChatBehaviorSetting.test.tsx @@ -7,6 +7,7 @@ import type { GlobalSettings } from '../../../../shared/global-settings-types' import { AGENT_SESSION_QUEUED_MESSAGES_RUNTIME_CAPABILITY } from '../../../../shared/protocol-version' import { setLocalRuntimeCapabilitiesForTests } from '@/runtime/local-runtime-capabilities' import { ChatBehaviorSetting } from './ChatBehaviorSetting' +import { TooltipProvider } from '../ui/tooltip' afterEach(() => { cleanup() @@ -18,11 +19,13 @@ const SHELL_ENV_TOGGLE = '[aria-label="Toggle using your shell environment"]' const NAME_INPUT = '#settings-native-chat-shell-environment-name' function renderSetting(overrides: Partial, updateSettings = vi.fn()) { + // The wrapper also covers rerender: the permission picker's tooltip needs the app's provider. return render( + />, + { wrapper: TooltipProvider } ) } @@ -221,3 +224,17 @@ describe('ChatBehaviorSetting resume after restart', () => { expect(updateSettings).toHaveBeenCalledWith({ nativeChatResumeWorkOnRestart: true }) }) }) + +describe('ChatBehaviorSetting permissions', () => { + it('shows the new-chat permission picker as the first Behavior row', () => { + const { container } = renderSetting({ nativeChatPermissionMode: 'full-access' }) + const rows = container.querySelectorAll('.divide-y > *') + expect(rows[0]?.id).toBe('chat-permissions') + expect(container.querySelector('button[aria-label="Permissions Full access"]')).not.toBeNull() + }) + + it('leaves the row out when the host has no value', () => { + const { container } = renderSetting({ nativeChatPermissionMode: undefined }) + expect(container.querySelector('#chat-permissions')).toBeNull() + }) +}) diff --git a/src/renderer/src/components/settings/ChatBehaviorSetting.tsx b/src/renderer/src/components/settings/ChatBehaviorSetting.tsx index ab4a1f96ab65..a81971726f7c 100644 --- a/src/renderer/src/components/settings/ChatBehaviorSetting.tsx +++ b/src/renderer/src/components/settings/ChatBehaviorSetting.tsx @@ -4,10 +4,12 @@ import type { RuntimeClientTarget } from '../../../../shared/runtime-client-targ import { useStructuredAgentSessionHostQueuesMessages } from '@/runtime/structured-agent-session-host-capability' import { useAppStore } from '../../store' import { Card, CardContent } from '../ui/card' +import { ChatPermissionSetting } from './ChatPermissionSetting' import { NativeChatShellEnvironmentSetting } from './NativeChatShellEnvironmentSetting' import { SearchableSetting } from './SearchableSetting' import { SettingsSubsectionHeader, SettingsSwitchRow } from './SettingsFormControls' import { getChatBehaviorEntriesByKey, getChatBehaviorTitle } from './chat-behavior-search' +import { getChatPermissionSearchEntry } from './chat-permission-search' import { matchesSettingsSearch } from './settings-search' // This screen edits this machine's settings, so it asks this machine's runtime; a paired host that @@ -30,6 +32,7 @@ export function ChatBehaviorSetting({ const hostQueuesMessages = useStructuredAgentSessionHostQueuesMessages(STRUCTURED_CHAT_HOST) const entries = getChatBehaviorEntriesByKey() const rows = [ + ...(settings.nativeChatPermissionMode !== undefined ? [getChatPermissionSearchEntry()] : []), entries.resumeOnRestart, ...(hostQueuesMessages ? [entries.queueFollowUps] : []), entries.shellEnvironment @@ -45,6 +48,11 @@ export function ChatBehaviorSetting({
+ - {isMounted ? (
- {matchesSettingsSearch(query, [{ title }, ...getChatAppearanceSearchEntries()]) ? (