권한 모드 동등화: Plan 추가 및 claw-code 권한 별칭 정규화 반영
Some checks failed
Release Gate / gate (push) Has been cancelled
Some checks failed
Release Gate / gate (push) Has been cancelled
- 전역 권한 모드를 Ask/Plan/Auto/Deny 4단계로 확장 - claw-code 계열 권한 값(default/acceptEdits/dontAsk/bypassPermissions) 입력 시 내부 모드로 정규화 - AgentContext 권한 판정 경로(전역/도구 오버라이드/패턴 오버라이드) 정규화 적용 - Chat/Settings UI에서 Plan 모드 노출 및 인라인 순환(Ask->Plan->Auto->Deny) 반영 - AppState/SettingsViewModel/SettingsService에 권한값 정규화 및 저장 시 일관성 적용 - Permission lifecycle 이벤트 메시지에 유효 모드 표기 보강 - 빌드/테스트 검증: dotnet build 경고0 오류0, dotnet test 372/372 통과
This commit is contained in:
@@ -1282,7 +1282,7 @@ public partial class ChatWindow : Window
|
||||
var llm = _settings.Settings.Llm;
|
||||
|
||||
if (conv != null && conv.Permission != null)
|
||||
_settings.Settings.Llm.FilePermission = conv.Permission;
|
||||
_settings.Settings.Llm.FilePermission = PermissionModeCatalog.NormalizeGlobalMode(conv.Permission);
|
||||
|
||||
_folderDataUsage = conv?.DataUsage ?? llm.FolderDataUsage ?? "active";
|
||||
_selectedMood = conv?.Mood ?? llm.DefaultMood ?? "modern";
|
||||
@@ -1304,7 +1304,7 @@ public partial class ChatWindow : Window
|
||||
}
|
||||
else
|
||||
{
|
||||
conv.Permission = _settings.Settings.Llm.FilePermission;
|
||||
conv.Permission = PermissionModeCatalog.NormalizeGlobalMode(_settings.Settings.Llm.FilePermission);
|
||||
conv.DataUsage = _folderDataUsage;
|
||||
conv.Mood = _selectedMood;
|
||||
_storage.Save(conv);
|
||||
@@ -1485,10 +1485,11 @@ public partial class ChatWindow : Window
|
||||
|
||||
var levels = new (string Level, string Sym, string Desc, string Color)[] {
|
||||
("Ask", "\uE8D7", "매번 확인 — 파일 접근 시 사용자에게 묻습니다", "#4B5EFC"),
|
||||
("Plan", "\uE7C3", "계획/승인 중심 — 실행 전 계획과 사용자 확인 흐름을 우선합니다", "#4338CA"),
|
||||
("Auto", "\uE73E", "자동 허용 — 파일을 자동으로 읽고 씁니다", "#DD6B20"),
|
||||
("Deny", "\uE711", "접근 차단 — 파일 접근을 허용하지 않습니다", "#C50F1F"),
|
||||
};
|
||||
var current = _settings.Settings.Llm.FilePermission;
|
||||
var current = PermissionModeCatalog.NormalizeGlobalMode(_settings.Settings.Llm.FilePermission);
|
||||
foreach (var (level, sym, desc, color) in levels)
|
||||
{
|
||||
var isActive = level.Equals(current, StringComparison.OrdinalIgnoreCase);
|
||||
@@ -1548,7 +1549,7 @@ public partial class ChatWindow : Window
|
||||
var capturedLevel = level;
|
||||
btn.Click += (_, _) =>
|
||||
{
|
||||
_settings.Settings.Llm.FilePermission = capturedLevel;
|
||||
_settings.Settings.Llm.FilePermission = PermissionModeCatalog.NormalizeGlobalMode(capturedLevel);
|
||||
UpdatePermissionUI();
|
||||
SaveConversationSettings();
|
||||
PermissionPopup.IsOpen = false;
|
||||
@@ -1571,7 +1572,7 @@ public partial class ChatWindow : Window
|
||||
}
|
||||
else
|
||||
{
|
||||
toolPermissions[existingKey ?? toolName] = mode;
|
||||
toolPermissions[existingKey ?? toolName] = PermissionModeCatalog.NormalizeToolOverride(mode);
|
||||
}
|
||||
|
||||
try { _settings.Save(); } catch { }
|
||||
@@ -1601,10 +1602,11 @@ public partial class ChatWindow : Window
|
||||
ChatConversation? currentConversation;
|
||||
lock (_convLock) currentConversation = _currentConversation;
|
||||
var summary = _appState.GetPermissionSummary(currentConversation);
|
||||
var perm = summary.EffectiveMode;
|
||||
var perm = PermissionModeCatalog.NormalizeGlobalMode(summary.EffectiveMode);
|
||||
PermissionLabel.Text = perm;
|
||||
PermissionIcon.Text = perm switch
|
||||
{
|
||||
"Plan" => "\uE7C3",
|
||||
"Auto" => "\uE73E",
|
||||
"Deny" => "\uE711",
|
||||
_ => "\uE8D7",
|
||||
@@ -1629,8 +1631,12 @@ public partial class ChatWindow : Window
|
||||
{
|
||||
_autoWarningDismissed = false; // Auto가 아닌 모드로 전환하면 리셋
|
||||
var defaultFg = TryFindResource("SecondaryText") as Brush ?? Brushes.Gray;
|
||||
var iconFg = perm == "Deny" ? new SolidColorBrush(Color.FromRgb(0xC5, 0x0F, 0x1F))
|
||||
: new SolidColorBrush(Color.FromRgb(0x4B, 0x5E, 0xFC)); // Ask = 파란색
|
||||
var iconFg = perm switch
|
||||
{
|
||||
"Deny" => new SolidColorBrush(Color.FromRgb(0xC5, 0x0F, 0x1F)),
|
||||
"Plan" => new SolidColorBrush(Color.FromRgb(0x43, 0x38, 0xCA)),
|
||||
_ => new SolidColorBrush(Color.FromRgb(0x4B, 0x5E, 0xFC)), // Ask = 파란색
|
||||
};
|
||||
PermissionLabel.Foreground = defaultFg;
|
||||
PermissionIcon.Foreground = iconFg;
|
||||
if (AutoPermissionWarning != null)
|
||||
@@ -1739,11 +1745,11 @@ public partial class ChatWindow : Window
|
||||
if (_activeTab == "Chat")
|
||||
{
|
||||
// Chat 탭: 경고 배너 숨기고 기본 Ask 모드로 복원
|
||||
_settings.Settings.Llm.FilePermission = "Ask";
|
||||
_settings.Settings.Llm.FilePermission = PermissionModeCatalog.Ask;
|
||||
UpdatePermissionUI();
|
||||
return;
|
||||
}
|
||||
var defaultPerm = _settings.Settings.Llm.DefaultAgentPermission;
|
||||
var defaultPerm = PermissionModeCatalog.NormalizeGlobalMode(_settings.Settings.Llm.DefaultAgentPermission);
|
||||
if (!string.IsNullOrEmpty(defaultPerm))
|
||||
{
|
||||
_settings.Settings.Llm.FilePermission = defaultPerm;
|
||||
@@ -10318,9 +10324,10 @@ public partial class ChatWindow : Window
|
||||
"detailed" => "높음",
|
||||
_ => "중간",
|
||||
};
|
||||
private static string NextPermission(string current) => (current ?? "Ask").ToLowerInvariant() switch
|
||||
private static string NextPermission(string current) => PermissionModeCatalog.NormalizeGlobalMode(current).ToLowerInvariant() switch
|
||||
{
|
||||
"ask" => "Auto",
|
||||
"ask" => "Plan",
|
||||
"plan" => "Auto",
|
||||
"auto" => "Deny",
|
||||
_ => "Ask",
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user