Werkzeugkasten: Zugangsdaten je Einheit (#692)

A unit holds credentials for its members, by tool and setting - needed once,
not once per agent, and other units never get them.

- UnitConfig.credentials, protected by ConfigSecrets like every secret.
- OrgChart.ToolSettingsFor: an agent's own settings, completed by the nearest
  unit up that holds the value; own non-empty values win; no tool is granted.
  Used for runs, tool jobs and preflight probes.
- OrgAdministration.SetUnitCredential, PUT /organisation/units/{id}/credentials;
  the view lists held settings, never values.
- Templates never carry unit credentials; they are named instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Richard
2026-10-01 12:50:27 +02:00
co-authored by Claude Opus 5.5
parent 661807b2d0
commit 9a265888f8
17 changed files with 306 additions and 13 deletions
@@ -330,6 +330,22 @@ public sealed class OrgAdministrationTests : IDisposable
Unit("marketing").Votes.ShouldBeNull();
}
// ═══════════════════ credentials per unit (#692) ═══════════════════
[Fact]
public void A_unit_holds_a_credential_until_it_is_removed()
{
BuildMarketing();
Org.SetUnitCredential("marketing", "", "apiKey", "x").Ok.ShouldBeFalse();
Org.SetUnitCredential("marketing", "WebFetch", "token", "t-1", "shared key").Ok.ShouldBeTrue();
Unit("marketing").Credentials!["WebFetch"]["token"].ShouldBe("t-1");
Org.Current().ToolSettingsFor(Find("ads"), "WebFetch")["token"].ShouldBe("t-1", "ads sits in amazon, below marketing");
Org.SetUnitCredential("marketing", "webfetch", "TOKEN", null).Ok.ShouldBeTrue();
Unit("marketing").Credentials.ShouldBeNull();
}
// ═══════════════════ templates (#691) ═══════════════════
private static Core.Organisation.OrgTemplate Shop() => new()