Some checks failed
Release Gate / gate (push) Has been cancelled
- 도구 동등화: task/todo/tool-search + plan/worktree/team/cron 도구군 추가 및 ToolRegistry 등록\n- claw-code CamelCase 별칭 정규화 확장: EnterPlanMode/EnterWorktree/TeamCreate/CronCreate 등 -> 내부 snake_case 매핑\n- AgentLoop 런타임 강화: Code 탭 전용 도구 토글(CodeSettings) 반영, 비활성 도구 자동 차단\n- Worktree 상태 복원 연결: .ax/worktree_state.json 기반 루트 탐색/활성 worktree 복원 및 BuildContext 연동\n- 권한/플러그인 하드닝 기존 반영분 유지: target 기반 권한 판정 + internal 모드 플러그인 경로/manifest 검증\n- 설정 연동(UI): SettingsWindow Code 패널에 Plan/Worktree/Team/Cron 도구 on/off 토글 추가\n- 테스트 보강: AgentParityTools/AgentLoopE2E에 worktree 지속성, alias 정규화, 설정 차단 시나리오 추가\n- 검증 완료: dotnet build(경고0/오류0), ParityBenchmark 11/11, ReplayStability 12/12, 전체 371/371, release-gate 통과\n- 문서 동기화: AGENT_ROADMAP/NEXT_ROADMAP/CLAW_CODE_PARITY_PLAN 수치 및 기준 최신화
71 lines
2.8 KiB
C#
71 lines
2.8 KiB
C#
using System.IO;
|
|
using System.Linq;
|
|
using System.Text.Json;
|
|
|
|
namespace AxCopilot.Services.Agent;
|
|
|
|
public sealed class TaskUpdateTool : IAgentTool
|
|
{
|
|
public string Name => "task_update";
|
|
|
|
public string Description =>
|
|
"Update task fields (status/title/description/priority) in the workspace task board.";
|
|
|
|
public ToolParameterSchema Parameters => new()
|
|
{
|
|
Properties = new()
|
|
{
|
|
["id"] = new() { Type = "integer", Description = "Task id" },
|
|
["status"] = new() { Type = "string", Description = "open | in_progress | blocked | done | stopped" },
|
|
["title"] = new() { Type = "string", Description = "New title (optional)" },
|
|
["description"] = new() { Type = "string", Description = "New description (optional)" },
|
|
["priority"] = new() { Type = "string", Description = "high | medium | low" },
|
|
},
|
|
Required = ["id"]
|
|
};
|
|
|
|
public Task<ToolResult> ExecuteAsync(JsonElement args, AgentContext context, CancellationToken ct = default)
|
|
{
|
|
if (!args.TryGetProperty("id", out var idEl))
|
|
return Task.FromResult(ToolResult.Fail("id is required."));
|
|
if (string.IsNullOrWhiteSpace(context.WorkFolder) || !Directory.Exists(context.WorkFolder))
|
|
return Task.FromResult(ToolResult.Fail("valid WorkFolder is required."));
|
|
|
|
var id = idEl.GetInt32();
|
|
var tasks = TaskBoardStore.Load(context.WorkFolder);
|
|
var task = tasks.FirstOrDefault(t => t.Id == id);
|
|
if (task == null)
|
|
return Task.FromResult(ToolResult.Fail($"Task #{id} not found."));
|
|
|
|
if (args.TryGetProperty("status", out var statusEl))
|
|
{
|
|
var status = (statusEl.GetString() ?? "").Trim().ToLowerInvariant();
|
|
if (!TaskBoardStore.IsValidStatus(status))
|
|
return Task.FromResult(ToolResult.Fail("Invalid status."));
|
|
task.Status = status;
|
|
}
|
|
|
|
if (args.TryGetProperty("title", out var titleEl))
|
|
{
|
|
var title = (titleEl.GetString() ?? "").Trim();
|
|
if (!string.IsNullOrWhiteSpace(title))
|
|
task.Title = title;
|
|
}
|
|
|
|
if (args.TryGetProperty("description", out var descEl))
|
|
task.Description = (descEl.GetString() ?? "").Trim();
|
|
|
|
if (args.TryGetProperty("priority", out var priEl))
|
|
{
|
|
var priority = (priEl.GetString() ?? "").Trim().ToLowerInvariant();
|
|
if (!TaskBoardStore.IsValidPriority(priority))
|
|
return Task.FromResult(ToolResult.Fail("Invalid priority."));
|
|
task.Priority = priority;
|
|
}
|
|
|
|
task.UpdatedAt = DateTime.Now;
|
|
TaskBoardStore.Save(context.WorkFolder, tasks);
|
|
return Task.FromResult(ToolResult.Ok($"Updated task #{task.Id}: [{task.Status}] {task.Title}"));
|
|
}
|
|
}
|