AddTask, planning CreateChildTask, and SuggestImprovement now accept an optional alias-validated model (haiku/sonnet/opus; blank = inherit) so the model is chosen at creation time instead of a follow-up set_task_config call. The planning, system, and improvement prompts instruct Claude to pick the cheapest capable model (haiku < sonnet < opus). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
30 lines
1.2 KiB
C#
30 lines
1.2 KiB
C#
namespace ClaudeDo.Data.Models;
|
|
|
|
public static class ModelRegistry
|
|
{
|
|
public static readonly IReadOnlyList<string> Aliases = new[] { "sonnet", "opus", "haiku" };
|
|
|
|
/// <summary>Model aliases ordered cheapest → most capable. Single source for prompt cost guidance.</summary>
|
|
public static readonly IReadOnlyList<string> ByCostAscending = new[] { "haiku", "sonnet", "opus" };
|
|
|
|
public const string DefaultAlias = "sonnet";
|
|
public const string PlanningAlias = "opus";
|
|
|
|
public const string ListDefaultSentinel = "(default)";
|
|
public const string TaskInheritSentinel = "(inherit)";
|
|
|
|
/// <summary>
|
|
/// Validate a model alias from external input. Null/blank → null (inherit).
|
|
/// Returns the canonical lowercase alias; throws on an unknown value.
|
|
/// </summary>
|
|
public static string? NormalizeAlias(string? model)
|
|
{
|
|
var m = model?.Trim();
|
|
if (string.IsNullOrEmpty(m)) return null;
|
|
foreach (var alias in Aliases)
|
|
if (string.Equals(alias, m, StringComparison.OrdinalIgnoreCase))
|
|
return alias;
|
|
throw new ArgumentException($"Unknown model '{model}'. Allowed: {string.Join(", ", Aliases)}.");
|
|
}
|
|
}
|