Initial commit: ClawdDotNet

Import des bestehenden Projektstands in Git.
- .NET 10 WinForms Anwendung (Multi-Agent / Tool-System)
- .gitignore fuer Build-Artefakte, Secrets und Runtime-Daten ergaenzt

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Richard
2026-07-26 18:21:46 +02:00
co-authored by Claude Opus 4.8
commit 2fed388c99
154 changed files with 29736 additions and 0 deletions
@@ -0,0 +1,16 @@
using ClawdDotNet.Core.State;
using Microsoft.Extensions.Logging;
namespace ClawdDotNet.Core.Tools;
public sealed record AgentToolContext(
string AgentId,
string InstanceId,
IReadOnlyDictionary<string, object?> ToolConfig,
IStateStore StateStore,
ILogger Logger,
CancellationToken CancellationToken,
string? WorkspacePath = null,
string? SharedWorkspacePath = null,
IAgentMessageRouter? MessageRouter = null
);
@@ -0,0 +1,24 @@
namespace ClawdDotNet.Core.Tools;
public sealed record AgentInfo(string AgentId, string DisplayName, string Role, string Model, bool IsRunning);
public sealed record AgentMessageResult(bool Delivered, string? Response, string? Error = null);
public sealed record AgentSpawnResult(bool Started, string? AgentId, string? FinalMessage, string? Error = null);
public interface IAgentMessageRouter
{
IReadOnlyList<AgentInfo> ListAgents(string callerAgentId);
Task<AgentMessageResult> SendMessageAsync(
string fromAgentId,
string toAgentId,
string message,
CancellationToken ct);
Task<AgentSpawnResult> SpawnAgentAsync(
string fromAgentId,
string targetAgentId,
string taskMessage,
CancellationToken ct);
}
+15
View File
@@ -0,0 +1,15 @@
using System.Text.Json;
namespace ClawdDotNet.Core.Tools;
public interface IAgentTool
{
string Name { get; }
string Description { get; }
JsonElement InputSchema { get; }
Task<ToolResult> ExecuteAsync(
JsonElement input,
AgentToolContext context,
CancellationToken ct);
}
@@ -0,0 +1,18 @@
using ClawdDotNet.Core.State;
using Microsoft.Extensions.Logging;
namespace ClawdDotNet.Core.Tools;
public interface IToolJobProvider
{
IReadOnlyList<ToolJobDefinition> GetJobDefinitions();
Task<ToolJobResult> ExecuteJobAsync(
string jobTypeId,
IReadOnlyDictionary<string, object?> toolConfig,
IStateStore stateStore,
ILogger logger,
CancellationToken ct,
string? agentId = null,
string? workspacePath = null);
}
@@ -0,0 +1,7 @@
namespace ClawdDotNet.Core.Tools;
public sealed record ToolJobDefinition(
string JobTypeId,
string DisplayName,
string Description
);
@@ -0,0 +1,26 @@
namespace ClawdDotNet.Core.Tools;
public sealed record ToolJobResult(
bool ShouldWakeAgent,
string? WakeMessage,
string? LogSummary,
bool UseChatContext = true
)
{
public static ToolJobResult NoAction(string? logSummary = null)
=> new(false, null, logSummary);
/// <summary>
/// Agent im bestehenden Chat-Kontext aufwecken (Default).
/// Die Nachricht erscheint im Chat-Tab und der Agent behält den Konversationsverlauf.
/// </summary>
public static ToolJobResult Wake(string wakeMessage, string? logSummary = null)
=> new(true, wakeMessage, logSummary, UseChatContext: true);
/// <summary>
/// Agent in einer isolierten, zustandslosen Session aufwecken.
/// Kein Chat-Verlauf, keine Persistenz — für einmalige, kontextfreie Aufgaben.
/// </summary>
public static ToolJobResult WakeStateless(string wakeMessage, string? logSummary = null)
=> new(true, wakeMessage, logSummary, UseChatContext: false);
}
@@ -0,0 +1,44 @@
using ClawdDotNet.Core.Config;
namespace ClawdDotNet.Core.Tools;
public sealed class ToolRegistry
{
private readonly Dictionary<string, IAgentTool> _tools = new();
private readonly Lock _lock = new();
public void Register(IAgentTool tool)
{
lock (_lock)
_tools[tool.Name] = tool;
}
public IAgentTool? Get(string name)
{
lock (_lock)
return _tools.GetValueOrDefault(name);
}
public IReadOnlyList<IAgentTool> GetForAgent(AgentConfig agent)
{
lock (_lock)
return _tools.Values
.Where(t => agent.Tools.ContainsKey(t.Name))
.ToList();
}
public IReadOnlyList<IAgentTool> GetAll()
{
lock (_lock)
return _tools.Values.ToList();
}
public IReadOnlyList<(IAgentTool Tool, IToolJobProvider Provider)> GetJobProviders()
{
lock (_lock)
return _tools.Values
.OfType<IToolJobProvider>()
.Select(p => ((IAgentTool)p, p))
.ToList();
}
}
+12
View File
@@ -0,0 +1,12 @@
namespace ClawdDotNet.Core.Tools;
public sealed record ToolResult(
bool Success,
string Content,
string? ErrorMessage = null
)
{
public static ToolResult Ok(string content) => new(true, content);
public static ToolResult Fail(string error) => new(false, "", error);
}