Some checks failed
Release Gate / gate (push) Has been cancelled
- 권한 명칭을 활용하지 않음/소극 활용/적극 활용/계획 중심/완전 자동/질문 없이 진행 체계로 통일 - 권한 팝업 선택 순서를 Deny 우선 순서로 재정렬하고 고급 분리를 줄여 단일 흐름으로 정리 - 하단 권한 라벨/상단 권한 배너/작업요약 권한 액션 버튼의 용어·색상·설명을 동일 체계로 맞춤 - Chat 탭 기본 권한 적용을 활용하지 않음으로 조정하여 보수적 기본 동작 강화 - /sandbox-toggle 및 AgentSettingsWindow 권한 순환 순서를 동일 체계로 통일 - 좌측 패널 모드 배지 헤더를 숨겨 탭별 핵심 선택 중심으로 UI 밀도 단순화 - 개발문서 업데이트: README.md, docs/DEVELOPMENT.md (2026-04-04 12:22 KST) - 운영 모드 점검 근거 반영: OperationModePolicy/Readiness/LlmOperationMode 테스트 필터 18건 통과 기록
118 lines
3.9 KiB
C#
118 lines
3.9 KiB
C#
namespace AxCopilot.Services.Agent;
|
|
|
|
/// <summary>
|
|
/// AX Agent permission mode constants and normalization helpers.
|
|
/// Uses AX-native permission vocabulary only.
|
|
/// </summary>
|
|
public static class PermissionModeCatalog
|
|
{
|
|
public const string Default = "Default";
|
|
public const string Ask = Default;
|
|
public const string AcceptEdits = "AcceptEdits";
|
|
public const string Plan = "Plan";
|
|
public const string BypassPermissions = "BypassPermissions";
|
|
public const string DontAsk = "DontAsk";
|
|
public const string Auto = AcceptEdits;
|
|
public const string Deny = "Deny";
|
|
|
|
public static readonly IReadOnlyList<string> UserSelectableModes = new[]
|
|
{
|
|
Deny,
|
|
Default,
|
|
AcceptEdits,
|
|
Plan,
|
|
BypassPermissions,
|
|
DontAsk,
|
|
};
|
|
|
|
/// <summary>
|
|
/// Normalize global permission mode.
|
|
/// Supported values: ask/plan/auto/deny (case-insensitive).
|
|
/// </summary>
|
|
public static string NormalizeGlobalMode(string? value)
|
|
{
|
|
if (string.IsNullOrWhiteSpace(value))
|
|
return Default;
|
|
|
|
return value.Trim().ToLowerInvariant() switch
|
|
{
|
|
"default" => Default,
|
|
"ask" => Ask,
|
|
"acceptedits" => AcceptEdits,
|
|
"accept" => AcceptEdits,
|
|
"auto" => Auto,
|
|
"plan" => Plan,
|
|
"bypasspermissions" => BypassPermissions,
|
|
"bypass" => BypassPermissions,
|
|
"dontask" => DontAsk,
|
|
"don't ask" => DontAsk,
|
|
"allow" => AcceptEdits,
|
|
"deny" => Deny,
|
|
_ => Default,
|
|
};
|
|
}
|
|
|
|
/// <summary>
|
|
/// Normalize tool override permission.
|
|
/// Tool override is constrained to ask/auto/deny.
|
|
/// </summary>
|
|
public static string NormalizeToolOverride(string? value)
|
|
{
|
|
var mode = NormalizeGlobalMode(value);
|
|
return mode switch
|
|
{
|
|
AcceptEdits => AcceptEdits,
|
|
Plan => Plan,
|
|
BypassPermissions => BypassPermissions,
|
|
DontAsk => DontAsk,
|
|
Deny => Deny,
|
|
_ => Default,
|
|
};
|
|
}
|
|
|
|
public static bool IsAuto(string? mode) =>
|
|
IsAcceptEdits(mode) || IsBypassPermissions(mode) || IsDontAsk(mode);
|
|
|
|
public static bool IsDefault(string? mode) =>
|
|
string.Equals(NormalizeGlobalMode(mode), Default, StringComparison.OrdinalIgnoreCase);
|
|
|
|
public static bool IsAcceptEdits(string? mode) =>
|
|
string.Equals(NormalizeGlobalMode(mode), AcceptEdits, StringComparison.OrdinalIgnoreCase);
|
|
|
|
public static bool IsPlan(string? mode) =>
|
|
string.Equals(NormalizeGlobalMode(mode), Plan, StringComparison.OrdinalIgnoreCase);
|
|
|
|
public static bool IsBypassPermissions(string? mode) =>
|
|
string.Equals(NormalizeGlobalMode(mode), BypassPermissions, StringComparison.OrdinalIgnoreCase);
|
|
|
|
public static bool IsDontAsk(string? mode) =>
|
|
string.Equals(NormalizeGlobalMode(mode), DontAsk, StringComparison.OrdinalIgnoreCase);
|
|
|
|
public static bool IsDeny(string? mode) =>
|
|
string.Equals(NormalizeGlobalMode(mode), Deny, StringComparison.OrdinalIgnoreCase);
|
|
|
|
public static bool RequiresUserApproval(string? mode)
|
|
{
|
|
var normalized = NormalizeGlobalMode(mode);
|
|
return !IsAcceptEdits(normalized)
|
|
&& !IsBypassPermissions(normalized)
|
|
&& !IsDontAsk(normalized)
|
|
&& !string.Equals(normalized, Deny, StringComparison.OrdinalIgnoreCase);
|
|
}
|
|
|
|
public static string ToDisplayLabel(string? mode)
|
|
{
|
|
var normalized = NormalizeGlobalMode(mode);
|
|
return normalized switch
|
|
{
|
|
Default => "소극 활용",
|
|
AcceptEdits => "적극 활용",
|
|
Plan => "계획 중심",
|
|
BypassPermissions => "완전 자동",
|
|
DontAsk => "질문 없이 진행",
|
|
Deny => "활용하지 않음",
|
|
_ => normalized,
|
|
};
|
|
}
|
|
}
|