Einheiten, Stufe 4: API und WebUI-Seite "Organisation" (#683)

- /api/organisation: Baum (Einheiten mit Pfad, Tiefe, eigener und
  wirksamer Obergrenze, Vorgaben; Agenten mit Einheit, Leitung, effektiver
  Leitung, Werkzeugen, Budget), Probleme der Struktur, bekannte Werkzeuge.
  Anlegen, Aendern, Loeschen, Leitung, Umzug von Agent und Einheit,
  Obergrenze, Sammelwerte mit Vorschau. Umzug und Obergrenze kennen
  preview=true; die Entscheidung trifft allein OrgAdministration.
- Neue Agenten koennen ueber die API gleich in eine Einheit gelegt werden.
- WebUI #/organisation: links der Baum (oberste Ebene, Einheiten, Leitungen
  mit Stern, Mitglieder), rechts die Bearbeitung. Eine Begruendung fuer das
  Audit gilt fuer jede Aenderung. Wo etwas verloren gehen kann, zuerst die
  Vorschau: laufende Agenten und Probleme halten an, wegfallende Werkzeuge
  muessen in einem Dialog bestaetigt werden. Sammelwerte als Tabelle mit
  Ausreissern markiert und abgewaehlt. Bei aktivierter Begrenzung ist
  vorausgewaehlt, was von oben ohnehin erlaubt ist. Sprachpakete en/de.

Geprueft im Browser mit einem Pruefgestell (API durch Attrappe ersetzt):
Baum, Auswahl, Obergrenze mit Bestaetigungsdialog, Sammelwert-Vorschau
mit Ausreisser und das Schreiben nur der gewaehlten Agenten.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Richard
2026-09-24 12:54:16 +02:00
co-authored by Claude Opus 5.5
parent 68a432fec6
commit e4ecf2d5ca
10 changed files with 866 additions and 2 deletions
+1 -1
View File
@@ -97,7 +97,7 @@ public sealed record ServiceDto(
public sealed record ServiceInputDto(string Name, string Type, int Port, string Description = "");
/// <summary>Ein neuer Agent.</summary>
public sealed record NewAgentDto(string AgentId, string DisplayName, string Model, string Description = "");
public sealed record NewAgentDto(string AgentId, string DisplayName, string Model, string Description = "", string? UnitId = null);
/// <summary>Eine Aufgabe vom Taskboard.</summary>
public sealed record TaskDto(
@@ -0,0 +1,63 @@
namespace ClawdDotNet.Web.Contracts;
/// <summary>#683: The organisation of an instance — units, members, and what is wrong with it.</summary>
public sealed record OrganisationDto(
IReadOnlyList<UnitDto> Units,
IReadOnlyList<OrgMemberDto> Agents,
IReadOnlyList<string> Problems,
IReadOnlyList<string> KnownTools);
public sealed record UnitDto(
string Id,
string Name,
string? ParentId,
string? LeaderAgentId,
string Goal,
IReadOnlyList<string>? ToolCeiling,
IReadOnlyList<string>? EffectiveToolCeiling,
UnitDefaultsDto Defaults,
string Path,
int Depth);
public sealed record UnitDefaultsDto(string? Model, decimal? DailyCostUsd, long? DailyTokens, string? WhenExhausted);
/// <summary>An agent as the organisation page shows it: where it is, whom it answers to.</summary>
public sealed record OrgMemberDto(
string AgentId,
string DisplayName,
string? UnitId,
bool IsLead,
string? EffectiveLeadId,
DateTime? UnitSinceUtc,
IReadOnlyList<string> Tools,
decimal DailyCostUsd,
long DailyTokens,
string Model);
public sealed record UnitInputDto(string Id, string Name, string? ParentId = null, string? Goal = null, string Reason = "");
public sealed record UnitUpdateDto(string? Name = null, string? Goal = null, string Reason = "");
public sealed record LeaderInputDto(string? AgentId, string Reason = "");
/// <summary>
/// A move or a ceiling change. With <see cref="Preview"/> nothing is written — the answer
/// says what would happen. <see cref="DropExcessTools"/> confirms removing the tools beyond a
/// ceiling that the preview named.
/// </summary>
public sealed record MoveInputDto(string? Target, string Reason = "", bool DropExcessTools = false, bool Preview = false);
public sealed record CeilingInputDto(IReadOnlyList<string>? Tools, string Reason = "", bool DropExcessTools = false, bool Preview = false);
public sealed record StructurePreviewDto(
IReadOnlyList<string> AffectedAgents,
IReadOnlyDictionary<string, IReadOnlyList<string>> ToolsLost,
IReadOnlyList<string> Running,
IReadOnlyList<string> Problems,
bool CanApply);
public sealed record SettingPreviewInputDto(string Setting, string Value, string Mode = "PerAgent");
public sealed record SettingChangeDto(string AgentId, string DisplayName, string Current, string Proposed, bool Outlier, bool SelectedByDefault);
public sealed record SettingApplyDto(string Setting, IReadOnlyDictionary<string, string> Values, string Reason = "", string? DefaultValue = null);