- Cases/Decisions in der Instanz-DB; CaseDesk fuehrt die Regeln, der Brett-Task traegt den Vorgang zum jeweiligen Halter - Eskalation nur nach oben, eine Ebene je Schritt; die Leitung entscheidet (mit Begruendung, bindet ihren Bereich), erledigt selbst oder reicht mit Einschaetzung weiter - Erst nachsehen: bindende Beschluesse werden vor dem Eskalieren gezeigt; dieselbe Frage aus derselben Einheit schliesst sich dem offenen Vorgang an - Tagesdeckel je Einheit; nach der Frist wird ein Mensch gerufen (Anschluss fuer #644) - Konflikt: zuerst die Gegenseite, dann Zustellung an die niedrigste gemeinsame Leitung; Ebenen dazwischen vermerkt, nicht befragt - Fremdinhalt-Stufe (#715): Eskalation ohne eigenen Text, kein Konflikt mit Position - Jede Ebene haengt an (#697), beim Halter gerahmt als Daten - Escalation ist ein implizites Werkzeug jedes Agenten; Briefing nennt den Weg - Scanner behaelt einen im Lauf gesetzten Status blockiert/abgebrochen Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
54 lines
1.5 KiB
C#
54 lines
1.5 KiB
C#
using ClawdDotNet.Core.Config;
|
|
|
|
namespace ClawdDotNet.Core.Tools;
|
|
|
|
public sealed class ToolRegistry
|
|
{
|
|
private readonly Dictionary<string, IAgentTool> _tools = new();
|
|
|
|
/// <summary>
|
|
/// #689: Tools every agent has, without being granted them. Escalation is one: a case
|
|
/// nobody can raise is a case nobody solves — being able to say "I cannot get on" is not a
|
|
/// permission, it is part of working in an organisation.
|
|
/// </summary>
|
|
public static readonly IReadOnlySet<string> ImplicitTools =
|
|
new HashSet<string>(StringComparer.OrdinalIgnoreCase) { Cases.CaseDesk.ToolName };
|
|
|
|
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) || ImplicitTools.Contains(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();
|
|
}
|
|
}
|