- 코워크·코드 프롬프트, 도구 선택, 문서 생성/검증 흐름을 claude-code 동등 품질 기준으로 재정렬함 - OpenAI/vLLM 경로의 오래된 tool history를 평탄화하고 최근 이력만 구조화해 컨텍스트 직렬화를 경량화함 - AX Agent UI를 테마 기준으로 재구성하고 플랜 승인/오버레이/이벤트 렌더링/명령 입력 상호작용을 개선함 - 파일 후보 제안, 반복 경로 정체 복구, LSP 보강, 문서·PPT 처리 개선, 설정/서비스 인터페이스 정리를 함께 반영함 - README.md 및 docs/DEVELOPMENT.md를 작업 시점별로 갱신함 - 검증: dotnet build src/AxCopilot/AxCopilot.csproj -c Release -v minimal -p:OutputPath=bin\\verify\\ -p:IntermediateOutputPath=obj\\verify\\ (경고 0, 오류 0)
83 lines
3.4 KiB
C#
83 lines
3.4 KiB
C#
using AxCopilot.Models;
|
|
|
|
namespace AxCopilot.Services.Agent;
|
|
|
|
public partial class AgentLoopService
|
|
{
|
|
private static (bool ShouldRun, List<ContentBlock> ParallelBatch, List<ContentBlock> SequentialBatch)
|
|
CreateParallelExecutionPlan(bool parallelEnabled, List<ContentBlock> toolCalls, int maxParallelBatch)
|
|
{
|
|
if (!parallelEnabled || toolCalls.Count <= 1)
|
|
return (false, new List<ContentBlock>(), toolCalls);
|
|
|
|
var (parallelBatch, sequentialBatch) = ClassifyToolCalls(toolCalls);
|
|
if (maxParallelBatch > 0 && parallelBatch.Count > maxParallelBatch)
|
|
{
|
|
var overflow = parallelBatch.Skip(maxParallelBatch).ToList();
|
|
parallelBatch = parallelBatch.Take(maxParallelBatch).ToList();
|
|
sequentialBatch = overflow.Concat(sequentialBatch).ToList();
|
|
}
|
|
|
|
return (true, parallelBatch, sequentialBatch);
|
|
}
|
|
|
|
private static (
|
|
string? LastFailedToolSignature,
|
|
int RepeatedFailedToolSignatureCount,
|
|
int ConsecutiveErrors,
|
|
bool CanRetry)
|
|
ComputeFailureTransitionState(
|
|
string currentToolCallSignature,
|
|
string? lastFailedToolSignature,
|
|
int repeatedFailedToolSignatureCount,
|
|
int consecutiveErrors,
|
|
int maxRetry)
|
|
{
|
|
if (string.Equals(lastFailedToolSignature, currentToolCallSignature, StringComparison.Ordinal))
|
|
repeatedFailedToolSignatureCount++;
|
|
else
|
|
{
|
|
lastFailedToolSignature = currentToolCallSignature;
|
|
repeatedFailedToolSignatureCount = 1;
|
|
}
|
|
|
|
consecutiveErrors++;
|
|
var canRetry = consecutiveErrors <= maxRetry;
|
|
return (lastFailedToolSignature, repeatedFailedToolSignatureCount, consecutiveErrors, canRetry);
|
|
}
|
|
|
|
private static bool ShouldRunPostToolVerification(
|
|
string? activeTab,
|
|
string? toolName,
|
|
bool toolSucceeded,
|
|
bool codeVerificationEnabled,
|
|
bool coworkVerificationEnabled)
|
|
{
|
|
if (!toolSucceeded || string.IsNullOrWhiteSpace(toolName))
|
|
return false;
|
|
|
|
if (string.Equals(activeTab, "Code", StringComparison.OrdinalIgnoreCase))
|
|
return codeVerificationEnabled && IsCodeVerificationTarget(toolName);
|
|
|
|
return coworkVerificationEnabled && IsDocumentCreationTool(toolName);
|
|
}
|
|
|
|
private static (bool ShouldContinue, string? TerminalResponse, string? ToolResultMessage) EvaluateDevStepDecision(string? decision)
|
|
{
|
|
if (string.Equals(decision, "중단", StringComparison.Ordinal))
|
|
return (false, "사용자가 개발자 모드에서 실행을 중단했습니다.", null);
|
|
if (string.Equals(decision, "건너뛰기", StringComparison.Ordinal))
|
|
return (true, null, "[SKIPPED by developer] 사용자가 이 도구 실행을 건너뛰었습니다.");
|
|
return (false, null, null);
|
|
}
|
|
|
|
private static (bool ShouldContinue, string? TerminalResponse, string? ToolResultMessage) EvaluateScopeDecision(string? decision)
|
|
{
|
|
if (string.Equals(decision, "취소", StringComparison.Ordinal))
|
|
return (false, "사용자가 작업을 취소했습니다.", null);
|
|
if (string.Equals(decision, "건너뛰기", StringComparison.Ordinal))
|
|
return (true, null, "[SKIPPED] 사용자가 이 작업을 건너뛰었습니다.");
|
|
return (false, null, null);
|
|
}
|
|
}
|