Files
AX-Copilot/src/AxCopilot/Models/AppSettings.AgentConfig.cs
lacvet f5a1ba999c [Phase 45] AppSettings.cs 클래스 파일 분리 (57% 감소)
31개 클래스 혼재 AppSettings.cs (1,320줄)를 3개 파일로 분리:
- AppSettings.cs → 564줄 (AppSettings·LauncherSettings·CustomThemeColors 등 17개 클래스)
- AppSettings.LlmSettings.cs → 481줄 (LlmSettings 408줄·CodeSettings)
- AppSettings.AgentConfig.cs → 284줄 (권한·훅·이벤트·모델·프리셋 등 12개 클래스)

모두 독립 top-level 클래스 (partial 불필요)
빌드: 경고 0, 오류 0

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-03 20:10:03 +09:00

285 lines
9.5 KiB
C#

using System;
using System.Collections.Generic;
using System.Text.Json.Serialization;
namespace AxCopilot.Models;
/// <summary>Phase 17-F: 에이전트 권한 설정.</summary>
public class PermissionsConfig
{
/// <summary>권한 모드. default | acceptEdits | plan | bypassPermissions</summary>
[JsonPropertyName("mode")]
public string Mode { get; set; } = "default";
/// <summary>허용 규칙 목록. 규칙 매칭 시 확인 없이 자동 허용.</summary>
[JsonPropertyName("allow")]
public List<PermissionRuleEntry> AllowRules { get; set; } = new();
/// <summary>차단 규칙 목록. 규칙 매칭 시 즉시 차단.</summary>
[JsonPropertyName("deny")]
public List<PermissionRuleEntry> DenyRules { get; set; } = new();
}
/// <summary>권한 규칙 항목 (설정 저장용).</summary>
public class PermissionRuleEntry
{
[JsonPropertyName("tool")]
public string ToolName { get; set; } = "";
[JsonPropertyName("pattern")]
public string? Pattern { get; set; }
[JsonPropertyName("behavior")]
public string Behavior { get; set; } = "allow"; // allow | deny | ask
}
/// <summary>Phase 17-B: 이벤트 로그 설정.</summary>
public class EventLogConfig
{
[JsonPropertyName("enabled")]
public bool Enabled { get; set; } = true;
[JsonPropertyName("retention_days")]
public int RetentionDays { get; set; } = 30;
}
/// <summary>Phase 17-A: Reflexion(자기성찰) 설정.</summary>
public class ReflexionConfig
{
[JsonPropertyName("enabled")]
public bool Enabled { get; set; } = true;
[JsonPropertyName("max_context_entries")]
public int MaxContextEntries { get; set; } = 5;
[JsonPropertyName("evaluate_on_success")]
public bool EvaluateOnSuccess { get; set; } = true;
}
/// <summary>Phase 17-C: 확장 훅 설정.</summary>
public class ExtendedHooksConfig
{
[JsonPropertyName("user_prompt_submit")]
public List<ExtendedHookEntryConfig> UserPromptSubmit { get; set; } = new();
[JsonPropertyName("pre_compact")]
public List<ExtendedHookEntryConfig> PreCompact { get; set; } = new();
[JsonPropertyName("post_compact")]
public List<ExtendedHookEntryConfig> PostCompact { get; set; } = new();
[JsonPropertyName("file_changed")]
public List<ExtendedHookEntryConfig> FileChanged { get; set; } = new();
[JsonPropertyName("session_start")]
public List<ExtendedHookEntryConfig> SessionStart { get; set; } = new();
[JsonPropertyName("session_end")]
public List<ExtendedHookEntryConfig> SessionEnd { get; set; } = new();
[JsonPropertyName("permission_request")]
public List<ExtendedHookEntryConfig> PermissionRequest { get; set; } = new();
}
/// <summary>확장 훅 항목 설정.</summary>
public class ExtendedHookEntryConfig
{
[JsonPropertyName("name")]
public string Name { get; set; } = "";
[JsonPropertyName("mode")]
public string Mode { get; set; } = "command"; // command | http | prompt | agent
[JsonPropertyName("matcher")]
public string? Matcher { get; set; }
[JsonPropertyName("script_path")]
public string? ScriptPath { get; set; }
[JsonPropertyName("url")]
public string? Url { get; set; }
[JsonPropertyName("prompt")]
public string? Prompt { get; set; }
[JsonPropertyName("model")]
public string? Model { get; set; }
[JsonPropertyName("enabled")]
public bool Enabled { get; set; } = true;
[JsonPropertyName("once")]
public bool Once { get; set; } = false;
[JsonPropertyName("async")]
public bool IsAsync { get; set; } = false;
[JsonPropertyName("timeout_seconds")]
public int TimeoutSeconds { get; set; } = 30;
[JsonPropertyName("status_message")]
public string? StatusMessage { get; set; }
[JsonPropertyName("watch_paths")]
public List<string> WatchPaths { get; set; } = new();
}
/// <summary>사용자 정의 커스텀 프리셋 (settings.json에 저장).</summary>
public class CustomPresetEntry
{
[JsonPropertyName("id")]
public string Id { get; set; } = Guid.NewGuid().ToString("N")[..8];
[JsonPropertyName("label")]
public string Label { get; set; } = "";
[JsonPropertyName("description")]
public string Description { get; set; } = "";
[JsonPropertyName("systemPrompt")]
public string SystemPrompt { get; set; } = "";
[JsonPropertyName("color")]
public string Color { get; set; } = "#6366F1";
[JsonPropertyName("symbol")]
public string Symbol { get; set; } = "\uE713";
/// <summary>프리셋이 속하는 탭. "Chat" | "Cowork" | "Code"</summary>
[JsonPropertyName("tab")]
public string Tab { get; set; } = "Chat";
}
/// <summary>사용자 정의 디자인 무드 (CSS 템플릿).</summary>
public class CustomMoodEntry
{
[JsonPropertyName("key")]
public string Key { get; set; } = "";
[JsonPropertyName("label")]
public string Label { get; set; } = "";
[JsonPropertyName("icon")]
public string Icon { get; set; } = "🎯";
[JsonPropertyName("description")]
public string Description { get; set; } = "";
[JsonPropertyName("css")]
public string Css { get; set; } = "";
}
/// <summary>저장된 프롬프트 템플릿.</summary>
public class PromptTemplate
{
[JsonPropertyName("name")]
public string Name { get; set; } = "";
[JsonPropertyName("content")]
public string Content { get; set; } = "";
[JsonPropertyName("icon")]
public string Icon { get; set; } = "\uE8BD";
}
/// <summary>
/// 사내 LLM 등록 모델. 별칭(UI 표시용) + 암호화된 실제 모델명.
/// 향후 멀티 에이전트에서는 특화 업무와 연결됩니다.
/// </summary>
public class RegisteredModel
{
/// <summary>UI에 표시할 별칭 (예: "코드 리뷰 전용", "일반 대화")</summary>
[JsonPropertyName("alias")]
public string Alias { get; set; } = "";
/// <summary>실제 모델명. EncryptionEnabled=true일 때 PortableEncrypt로 암호화된 Base64 값, false일 때 평문.</summary>
[JsonPropertyName("encryptedModelName")]
public string EncryptedModelName { get; set; } = "";
/// <summary>이 모델이 연결될 서비스 타입. ollama | vllm</summary>
[JsonPropertyName("service")]
public string Service { get; set; } = "ollama";
/// <summary>이 모델 전용 서버 엔드포인트. 비어있으면 LlmSettings의 기본 엔드포인트 사용.</summary>
[JsonPropertyName("endpoint")]
public string Endpoint { get; set; } = "";
/// <summary>이 모델 전용 API 키. 비어있으면 LlmSettings의 기본 API 키 사용.</summary>
[JsonPropertyName("apiKey")]
public string ApiKey { get; set; } = "";
// ── CP4D (IBM Cloud Pak for Data) 인증 ──────────────────────────────
/// <summary>인증 방식. bearer (기본) | cp4d</summary>
[JsonPropertyName("authType")]
public string AuthType { get; set; } = "bearer";
/// <summary>CP4D 인증 서버 URL (예: https://cpd-host.example.com)</summary>
[JsonPropertyName("cp4dUrl")]
public string Cp4dUrl { get; set; } = "";
/// <summary>CP4D 사용자 이름</summary>
[JsonPropertyName("cp4dUsername")]
public string Cp4dUsername { get; set; } = "";
/// <summary>CP4D 비밀번호 또는 API 키 (EncryptionEnabled=true 시 암호화 저장)</summary>
[JsonPropertyName("cp4dPassword")]
public string Cp4dPassword { get; set; } = "";
}
/// <summary>
/// 자동 모델 라우팅용 모델 능력 점수.
/// 각 모델의 인텐트 카테고리별 적합도를 0.0~1.0으로 지정합니다.
/// 개발자가 하드코딩 기본값을 수정하려면 ModelRouterService.GetDefaultCapabilities()를 참조하세요.
/// </summary>
public class ModelCapability
{
/// <summary>서비스 타입. ollama | vllm | gemini | claude</summary>
[JsonPropertyName("service")]
public string Service { get; set; } = "";
/// <summary>모델 식별자. 서비스별 모델 ID (예: "gemini-2.5-flash", "claude-sonnet-4-6")</summary>
[JsonPropertyName("model")]
public string Model { get; set; } = "";
/// <summary>UI 표시용 별칭.</summary>
[JsonPropertyName("alias")]
public string Alias { get; set; } = "";
/// <summary>인텐트 카테고리별 적합도 점수. key=카테고리명, value=0.0~1.0</summary>
[JsonPropertyName("scores")]
public Dictionary<string, double> Scores { get; set; } = new();
/// <summary>라우팅 후보에 포함 여부.</summary>
[JsonPropertyName("enabled")]
public bool Enabled { get; set; } = true;
}
/// <summary>에이전트 훅 설정 항목. 도구 실행 전/후 사용자 스크립트 실행.</summary>
public class AgentHookEntry
{
/// <summary>훅 이름 (UI 표시용).</summary>
[JsonPropertyName("name")]
public string Name { get; set; } = "";
/// <summary>대상 도구 이름. "*" = 모든 도구, 특정 도구명 = 해당 도구만.</summary>
[JsonPropertyName("toolName")]
public string ToolName { get; set; } = "*";
/// <summary>실행 타이밍. "pre" = 도구 실행 전, "post" = 도구 실행 후.</summary>
[JsonPropertyName("timing")]
public string Timing { get; set; } = "post";
/// <summary>실행할 스크립트 경로 (.bat, .ps1, .cmd).</summary>
[JsonPropertyName("scriptPath")]
public string ScriptPath { get; set; } = "";
/// <summary>스크립트에 전달할 추가 인수 (선택).</summary>
[JsonPropertyName("arguments")]
public string Arguments { get; set; } = "";
/// <summary>활성화 여부.</summary>
[JsonPropertyName("enabled")]
public bool Enabled { get; set; } = true;
}