feat(settings): claude_bin im Dateien-Tab setzbar, mit Auflösungs-Check
Bisher nur per Hand in worker.config.json. Neuer Abschnitt CLAUDE CLI mit eigenem Save-Button (die Datei gehoert dem Worker, nicht app_settings) und einer Zeile, wohin der Wert per ExecutableResolver tatsaechlich aufloest — 'nicht im PATH gefunden' war bisher erst am fehlgeschlagenen Run zu sehen. WorkerConfig ist DI-Singleton und ClaudeProcess loest pro Spawn auf, also greift die Aenderung ab dem naechsten Run ohne Neustart. SaveOnlineInbox/SaveClaudeBin teilen jetzt ein SaveKey(), damit beide dieselbe read-modify-write-Semantik haben (alle anderen Keys bleiben unberuehrt). Die zugehoerigen Locale-Keys sind im vorigen Commit mitgelaufen.
This commit is contained in:
@@ -96,6 +96,14 @@ public sealed class WorkerConfig
|
||||
/// Reads the existing JSON, replaces the <c>online_inbox</c> node, and writes back indented.
|
||||
/// </summary>
|
||||
public void SaveOnlineInbox(string? path = null)
|
||||
=> SaveKey("online_inbox", JsonSerializer.SerializeToNode(OnlineInbox, InboxSerializerOpts), path);
|
||||
|
||||
/// <summary>Persists ONLY <c>claude_bin</c>, same read-modify-write as
|
||||
/// <see cref="SaveOnlineInbox"/> — every other field in the file stays untouched.</summary>
|
||||
public void SaveClaudeBin(string? path = null)
|
||||
=> SaveKey("claude_bin", JsonValue.Create(ClaudeBin), path);
|
||||
|
||||
private static void SaveKey(string key, JsonNode? value, string? path)
|
||||
{
|
||||
path ??= DefaultConfigPath;
|
||||
|
||||
@@ -103,7 +111,7 @@ public sealed class WorkerConfig
|
||||
? JsonNode.Parse(File.ReadAllText(path)) as JsonObject ?? new JsonObject()
|
||||
: new JsonObject();
|
||||
|
||||
root["online_inbox"] = JsonSerializer.SerializeToNode(OnlineInbox, InboxSerializerOpts);
|
||||
root[key] = value;
|
||||
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(path)!);
|
||||
File.WriteAllText(path, root.ToJsonString(WriteOpts));
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System.Globalization;
|
||||
using System.Reflection;
|
||||
using ClaudeDo.Data;
|
||||
using ClaudeDo.Data.Environment;
|
||||
using ClaudeDo.Data.Models;
|
||||
using ClaudeDo.Data.Repositories;
|
||||
using ClaudeDo.Worker.Agents;
|
||||
@@ -1000,6 +1001,22 @@ public sealed class WorkerHub : Microsoft.AspNetCore.SignalR.Hub
|
||||
return ids.Count;
|
||||
}
|
||||
|
||||
public ClaudeBinDto GetClaudeBin() => DescribeClaudeBin();
|
||||
|
||||
/// Blank resets to the plain "claude" command. WorkerConfig is a DI singleton and
|
||||
/// ClaudeProcess resolves it per spawn, so the change applies to the next run without a
|
||||
/// restart — but it is persisted too, since Load() re-reads the file on startup.
|
||||
public ClaudeBinDto SetClaudeBin(string? value)
|
||||
{
|
||||
_cfg.ClaudeBin = string.IsNullOrWhiteSpace(value) ? "claude" : value.Trim();
|
||||
_cfg.SaveClaudeBin();
|
||||
_ = _broadcaster.WorkerLog($"claude_bin set to '{_cfg.ClaudeBin}'", WorkerLogLevel.Info, DateTime.UtcNow);
|
||||
return DescribeClaudeBin();
|
||||
}
|
||||
|
||||
private ClaudeBinDto DescribeClaudeBin() =>
|
||||
new(_cfg.ClaudeBin, ExecutableResolver.Resolve(_cfg.ClaudeBin)?.Path);
|
||||
|
||||
#pragma warning disable CA1416 // ClaudeDo.Worker is Windows-only; DPAPI calls are safe here.
|
||||
public OnlineInboxStateDto GetOnlineInboxState()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user