From 73661c80a4ec064f3db64959a3a3a82ec5aed7e1 Mon Sep 17 00:00:00 2001 From: iliya Date: Sat, 21 Mar 2026 12:25:06 +0200 Subject: [PATCH] feat: auto-allow all tools toggle + fix team color fallback - Add autoAllowAll setting: overrides all individual auto-allow rules, instantly approves every tool call without user interaction - Settings panel: "Auto-allow all tools" checkbox at top, individual checkboxes greyed out when all-allow is active - Fix team color badge: use getTeamColorSet(teamName) as fallback instead of getMemberColorByName which uses a different palette and produced wrong colors (yellow instead of pink) --- src/main/ipc/teams.ts | 3 ++ src/main/utils/toolApprovalRules.ts | 5 +++ .../components/team/ToolApprovalSheet.tsx | 6 ++-- .../dialogs/ToolApprovalSettingsPanel.tsx | 33 ++++++++++++++++--- src/renderer/store/slices/teamSlice.ts | 1 + src/shared/types/team.ts | 3 ++ 6 files changed, 42 insertions(+), 9 deletions(-) diff --git a/src/main/ipc/teams.ts b/src/main/ipc/teams.ts index 61c347ce..2e46faf3 100644 --- a/src/main/ipc/teams.ts +++ b/src/main/ipc/teams.ts @@ -2767,6 +2767,9 @@ async function handleToolApprovalSettings( return { success: false, error: 'Settings must be an object' }; } const s = settings as Record; + if (typeof s.autoAllowAll !== 'boolean') { + return { success: false, error: 'autoAllowAll must be a boolean' }; + } if (typeof s.autoAllowFileEdits !== 'boolean') { return { success: false, error: 'autoAllowFileEdits must be a boolean' }; } diff --git a/src/main/utils/toolApprovalRules.ts b/src/main/utils/toolApprovalRules.ts index 1036f6bb..c6abc196 100644 --- a/src/main/utils/toolApprovalRules.ts +++ b/src/main/utils/toolApprovalRules.ts @@ -116,6 +116,11 @@ export function shouldAutoAllow( toolName: string, toolInput: Record ): AutoAllowResult { + // Auto-allow ALL tools (overrides everything) + if (settings.autoAllowAll) { + return { autoAllow: true, reason: 'auto_allow_all' }; + } + // File edit auto-allow if (settings.autoAllowFileEdits && FILE_EDIT_TOOLS.has(toolName)) { return { autoAllow: true, reason: 'auto_allow_category' }; diff --git a/src/renderer/components/team/ToolApprovalSheet.tsx b/src/renderer/components/team/ToolApprovalSheet.tsx index e8a74721..6f986f5a 100644 --- a/src/renderer/components/team/ToolApprovalSheet.tsx +++ b/src/renderer/components/team/ToolApprovalSheet.tsx @@ -4,7 +4,6 @@ import { getTeamColorSet, getThemedBadge } from '@renderer/constants/teamColors' import { useTheme } from '@renderer/hooks/useTheme'; import { useStore } from '@renderer/store'; import { highlightLines } from '@renderer/utils/syntaxHighlighter'; -import { getMemberColorByName } from '@shared/constants/memberColors'; import { AlertTriangle, FileText, Search, Terminal } from 'lucide-react'; import { ToolApprovalDiffPreview } from './ToolApprovalDiffPreview'; @@ -170,10 +169,9 @@ export const ToolApprovalSheet: React.FC = () => { if (!current) return null; // Prefer color from the approval itself (always available, even during provisioning), - // fall back to teams list, then deterministic color from team name. + // fall back to teams list, then getTeamColorSet hashes unknown names into TEAMMATE_COLORS. const teamSummary = teams.find((t) => t.teamName === current.teamName); - const colorName = - current.teamColor ?? teamSummary?.color ?? getMemberColorByName(current.teamName); + const colorName = current.teamColor ?? teamSummary?.color ?? current.teamName; const teamColor = getTeamColorSet(colorName); const displayName = current.teamDisplayName ?? teamSummary?.displayName ?? current.teamName; diff --git a/src/renderer/components/team/dialogs/ToolApprovalSettingsPanel.tsx b/src/renderer/components/team/dialogs/ToolApprovalSettingsPanel.tsx index 5e314c0c..963209aa 100644 --- a/src/renderer/components/team/dialogs/ToolApprovalSettingsPanel.tsx +++ b/src/renderer/components/team/dialogs/ToolApprovalSettingsPanel.tsx @@ -50,13 +50,32 @@ export const ToolApprovalSettingsPanel: React.FC = () => { borderColor: 'var(--color-border)', }} > - {/* Auto-allow file edits */} + {/* Auto-allow ALL */} + + {/* Separator */} +
+ + {/* Auto-allow file edits */} +