Some checks failed
Release Gate / gate (push) Has been cancelled
- claude-code 선택적 탐색 흐름을 참고해 Cowork/Code 시스템 프롬프트에서 folder_map 상시 선행 지시를 완화하고 glob/grep 기반 좁은 탐색을 우선하도록 조정함 - FolderMapTool 기본 depth를 2로, include_files 기본값을 false로 낮추고 MultiReadTool 최대 파일 수를 8개로 줄여 초기 과탐색 폭을 보수적으로 조정함 - AgentLoopExplorationPolicy partial을 추가해 탐색 범위 분류, broad-scan corrective hint, exploration_breadth 성능 로그를 연결함 - AgentLoopService에 탐색 범위 가이드 주입과 실행 중 탐색 폭 추적을 추가하고, 좁은 질문에서 반복적인 folder_map/대량 multi_read를 교정하도록 정리함 - DocxToHtmlConverter nullable 경고를 수정해 Release 빌드 경고 0 / 오류 0 기준을 다시 충족함 - README와 docs/DEVELOPMENT.md에 2026-04-09 10:36 (KST) 기준 개발 이력을 반영함
81 lines
2.4 KiB
C#
81 lines
2.4 KiB
C#
using System.Text;
|
|
using System.Text.Json;
|
|
using System.IO;
|
|
|
|
namespace AxCopilot.Services;
|
|
|
|
public static class AgentPerformanceLogService
|
|
{
|
|
private static readonly string PerfDir;
|
|
private static readonly object _lock = new();
|
|
private static readonly JsonSerializerOptions _jsonOptions = new()
|
|
{
|
|
WriteIndented = false,
|
|
Encoder = System.Text.Encodings.Web.JavaScriptEncoder.UnsafeRelaxedJsonEscaping,
|
|
};
|
|
|
|
static AgentPerformanceLogService()
|
|
{
|
|
PerfDir = Path.Combine(
|
|
Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
|
|
"AxCopilot",
|
|
"perf");
|
|
try { Directory.CreateDirectory(PerfDir); } catch { }
|
|
}
|
|
|
|
public static void LogMetric(
|
|
string area,
|
|
string name,
|
|
string conversationId,
|
|
string tab,
|
|
long durationMs,
|
|
object? detail = null)
|
|
{
|
|
try
|
|
{
|
|
var fileName = $"performance-{DateTime.Now:yyyy-MM-dd}.json";
|
|
var filePath = Path.Combine(PerfDir, fileName);
|
|
var json = JsonSerializer.Serialize(new AgentPerformanceEntry
|
|
{
|
|
Timestamp = DateTime.Now,
|
|
Area = area,
|
|
Name = name,
|
|
ConversationId = conversationId ?? "",
|
|
Tab = tab ?? "",
|
|
DurationMs = durationMs,
|
|
Detail = detail == null ? "" : JsonSerializer.Serialize(detail, _jsonOptions),
|
|
}, _jsonOptions);
|
|
|
|
lock (_lock)
|
|
{
|
|
File.AppendAllText(filePath, json + Environment.NewLine, Encoding.UTF8);
|
|
}
|
|
}
|
|
catch
|
|
{
|
|
// 성능 로그 실패는 런타임에 영향 주지 않음
|
|
}
|
|
}
|
|
|
|
public static void LogExplorationBreadth(
|
|
string conversationId,
|
|
string tab,
|
|
object detail)
|
|
{
|
|
LogMetric("agent_loop", "exploration_breadth", conversationId, tab, 0, detail);
|
|
}
|
|
|
|
public static string GetPerformanceFolder() => PerfDir;
|
|
}
|
|
|
|
public sealed class AgentPerformanceEntry
|
|
{
|
|
public DateTime Timestamp { get; init; }
|
|
public string Area { get; init; } = "";
|
|
public string Name { get; init; } = "";
|
|
public string ConversationId { get; init; } = "";
|
|
public string Tab { get; init; } = "";
|
|
public long DurationMs { get; init; }
|
|
public string Detail { get; init; } = "";
|
|
}
|