refactor: fold single-consumer helper types into their owners
Consolidate small single-purpose types into the files that own them: StreamResult into StreamAnalyzer, the Planning context records into PlanningSessionContext, PrimeClock/PrimeSchedulerOptions into PrimeScheduler, AgentMcpTools into LifecycleMcpTools, the locator subclasses into InstallArtifactLocator, LogLineViewModel into DetailsIslandViewModel, RepoImportItemViewModel into its modal, and StepViewModel into InstallPageViewModel. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
18
src/ClaudeDo.Worker/External/AgentMcpTools.cs
vendored
18
src/ClaudeDo.Worker/External/AgentMcpTools.cs
vendored
@@ -1,18 +0,0 @@
|
||||
using System.ComponentModel;
|
||||
using ClaudeDo.Data.Models;
|
||||
using ClaudeDo.Worker.Agents;
|
||||
using ModelContextProtocol.Server;
|
||||
|
||||
namespace ClaudeDo.Worker.External;
|
||||
|
||||
[McpServerToolType]
|
||||
public sealed class AgentMcpTools
|
||||
{
|
||||
private readonly AgentFileService _agents;
|
||||
|
||||
public AgentMcpTools(AgentFileService agents) => _agents = agents;
|
||||
|
||||
[McpServerTool, Description("List available agent definition files (name, description, path) for use as a task's agent path.")]
|
||||
public async Task<IReadOnlyList<AgentInfo>> ListAgents(CancellationToken cancellationToken)
|
||||
=> await _agents.ScanAsync(cancellationToken);
|
||||
}
|
||||
@@ -1,11 +1,25 @@
|
||||
using System.ComponentModel;
|
||||
using ClaudeDo.Data.Models;
|
||||
using ClaudeDo.Data.Repositories;
|
||||
using ClaudeDo.Worker.Agents;
|
||||
using ClaudeDo.Worker.Lifecycle;
|
||||
using ModelContextProtocol.Server;
|
||||
using TaskStatus = ClaudeDo.Data.Models.TaskStatus;
|
||||
|
||||
namespace ClaudeDo.Worker.External;
|
||||
|
||||
[McpServerToolType]
|
||||
public sealed class AgentMcpTools
|
||||
{
|
||||
private readonly AgentFileService _agents;
|
||||
|
||||
public AgentMcpTools(AgentFileService agents) => _agents = agents;
|
||||
|
||||
[McpServerTool, Description("List available agent definition files (name, description, path) for use as a task's agent path.")]
|
||||
public async Task<IReadOnlyList<AgentInfo>> ListAgents(CancellationToken cancellationToken)
|
||||
=> await _agents.ScanAsync(cancellationToken);
|
||||
}
|
||||
|
||||
[McpServerToolType]
|
||||
public sealed class LifecycleMcpTools
|
||||
{
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
namespace ClaudeDo.Worker.Planning;
|
||||
|
||||
public sealed record InteractiveLaunchContext(
|
||||
string TaskId,
|
||||
string WorkingDir,
|
||||
string InitialPrompt);
|
||||
@@ -1,6 +0,0 @@
|
||||
namespace ClaudeDo.Worker.Planning;
|
||||
|
||||
public sealed class PlanningMcpContext
|
||||
{
|
||||
public required string ParentTaskId { get; init; }
|
||||
}
|
||||
@@ -1,5 +1,20 @@
|
||||
namespace ClaudeDo.Worker.Planning;
|
||||
|
||||
public sealed record PlanningSessionFiles(
|
||||
string SessionDirectory,
|
||||
string SystemPromptPath,
|
||||
string InitialPromptPath);
|
||||
|
||||
public sealed record InteractiveLaunchContext(
|
||||
string TaskId,
|
||||
string WorkingDir,
|
||||
string InitialPrompt);
|
||||
|
||||
public sealed class PlanningMcpContext
|
||||
{
|
||||
public required string ParentTaskId { get; init; }
|
||||
}
|
||||
|
||||
public sealed record PlanningSessionStartContext(
|
||||
string ParentTaskId,
|
||||
string WorkingDir,
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
namespace ClaudeDo.Worker.Planning;
|
||||
|
||||
public sealed record PlanningSessionFiles(
|
||||
string SessionDirectory,
|
||||
string SystemPromptPath,
|
||||
string InitialPromptPath);
|
||||
@@ -1,5 +0,0 @@
|
||||
namespace ClaudeDo.Worker.Prime;
|
||||
public sealed class PrimeClock : IPrimeClock
|
||||
{
|
||||
public DateTimeOffset Now => DateTimeOffset.Now;
|
||||
}
|
||||
@@ -5,6 +5,17 @@ using Microsoft.Extensions.Hosting;
|
||||
|
||||
namespace ClaudeDo.Worker.Prime;
|
||||
|
||||
public sealed class PrimeClock : IPrimeClock
|
||||
{
|
||||
public DateTimeOffset Now => DateTimeOffset.Now;
|
||||
}
|
||||
|
||||
public sealed record PrimeSchedulerOptions(TimeSpan CatchUpWindow)
|
||||
{
|
||||
public static PrimeSchedulerOptions Default { get; } =
|
||||
new(TimeSpan.FromMinutes(30));
|
||||
}
|
||||
|
||||
public sealed class PrimeScheduler : BackgroundService
|
||||
{
|
||||
private readonly IDbContextFactory<ClaudeDoDbContext> _dbFactory;
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
namespace ClaudeDo.Worker.Prime;
|
||||
|
||||
public sealed record PrimeSchedulerOptions(TimeSpan CatchUpWindow)
|
||||
{
|
||||
public static PrimeSchedulerOptions Default { get; } =
|
||||
new(TimeSpan.FromMinutes(30));
|
||||
}
|
||||
@@ -2,6 +2,17 @@ using System.Text.Json;
|
||||
|
||||
namespace ClaudeDo.Worker.Runner;
|
||||
|
||||
public sealed class StreamResult
|
||||
{
|
||||
public string? ResultMarkdown { get; set; }
|
||||
public string? StructuredOutputJson { get; set; }
|
||||
public string? SessionId { get; set; }
|
||||
public int TurnCount { get; set; }
|
||||
public int TokensIn { get; set; }
|
||||
public int TokensOut { get; set; }
|
||||
public int ApiRetryCount { get; set; }
|
||||
}
|
||||
|
||||
public sealed class StreamAnalyzer
|
||||
{
|
||||
private string? _resultMarkdown;
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
namespace ClaudeDo.Worker.Runner;
|
||||
|
||||
public sealed class StreamResult
|
||||
{
|
||||
public string? ResultMarkdown { get; set; }
|
||||
public string? StructuredOutputJson { get; set; }
|
||||
public string? SessionId { get; set; }
|
||||
public int TurnCount { get; set; }
|
||||
public int TokensIn { get; set; }
|
||||
public int TokensOut { get; set; }
|
||||
public int ApiRetryCount { get; set; }
|
||||
}
|
||||
Reference in New Issue
Block a user