feat(worker): PlanningSessionManager.ResumeAsync
This commit is contained in:
@@ -53,6 +53,25 @@ public sealed class PlanningSessionManager
|
||||
return new PlanningSessionStartContext(taskId, list.WorkingDir, files);
|
||||
}
|
||||
|
||||
public async Task<PlanningSessionResumeContext> ResumeAsync(string taskId, CancellationToken ct)
|
||||
{
|
||||
var task = await _tasks.GetByIdAsync(taskId, ct)
|
||||
?? throw new InvalidOperationException($"Task {taskId} not found.");
|
||||
if (task.Status != TaskStatus.Planning)
|
||||
throw new InvalidOperationException($"Task is in status {task.Status}; resume requires Planning.");
|
||||
if (string.IsNullOrEmpty(task.PlanningSessionId))
|
||||
throw new InvalidOperationException("No Claude session ID captured yet; cannot resume.");
|
||||
|
||||
var sessionDir = Path.Combine(_rootDirectory, taskId);
|
||||
var mcpConfigPath = Path.Combine(sessionDir, "mcp.json");
|
||||
if (!File.Exists(mcpConfigPath))
|
||||
throw new InvalidOperationException($"Session directory missing: {sessionDir}");
|
||||
|
||||
var list = await _lists.GetByIdAsync(task.ListId, ct)
|
||||
?? throw new InvalidOperationException($"List {task.ListId} not found.");
|
||||
return new PlanningSessionResumeContext(taskId, list.WorkingDir, task.PlanningSessionId, mcpConfigPath);
|
||||
}
|
||||
|
||||
private static string GenerateToken()
|
||||
{
|
||||
var bytes = RandomNumberGenerator.GetBytes(32);
|
||||
|
||||
Reference in New Issue
Block a user