feat(worker): PlanningSessionManager.DiscardAsync
This commit is contained in:
@@ -53,6 +53,19 @@ public sealed class PlanningSessionManager
|
||||
return new PlanningSessionStartContext(taskId, list.WorkingDir, files);
|
||||
}
|
||||
|
||||
public async Task DiscardAsync(string taskId, CancellationToken ct)
|
||||
{
|
||||
var ok = await _tasks.DiscardPlanningAsync(taskId, ct);
|
||||
var sessionDir = Path.Combine(_rootDirectory, taskId);
|
||||
if (Directory.Exists(sessionDir))
|
||||
{
|
||||
try { Directory.Delete(sessionDir, recursive: true); }
|
||||
catch { /* best effort */ }
|
||||
}
|
||||
if (!ok)
|
||||
throw new InvalidOperationException($"Task {taskId} was not in Planning state; nothing to discard.");
|
||||
}
|
||||
|
||||
public async Task<PlanningSessionResumeContext> ResumeAsync(string taskId, CancellationToken ct)
|
||||
{
|
||||
var task = await _tasks.GetByIdAsync(taskId, ct)
|
||||
|
||||
Reference in New Issue
Block a user