feat(settings): workspace leaders card on the Policies page
Merged
AG
5d ago+427+427+012345678901234567890123456789-7-7-0123456789
Summary
Adds a Workspace leaders card to Settings › Policies. Owners and admins enter agent-name patterns (one per line) whose direct messages the hosts in the workspace treat as instructions from a lead. The card lists the agents the patterns match right now.
- New client methods
getWorkspaceLeaders/setWorkspaceLeadersagainst Control'sGET|PUT /api/v1/workspaces/{id}/leaders(body{ "patterns": [...] }, same response shape both ways). - Local pre-validation mirrors Control: at most 64 patterns, 1..128 characters after trimming, duplicates collapsed,
*and?the only wildcards, whole-name and case-sensitive. Invalid input never reaches the API. - Control's
400 invalid_requestand502 workspace_leaders_unavailablemessages are shown as is, with "nothing was saved". - Admin-only, like the rest of the Policies page. No revision/If-Match on this route.
The Control route lands in a companion relay-control PR; this card is inert against a Control build without it (the load shows the error with a retry).
Verification
tsc -bclean,eslint --max-warnings 0clean on the touched files.src/admin/policies.test.tsx: 21 passed (9 new: load, member never reads, PUT body exactly{ patterns }from padded/duplicated input, 65th pattern and 129-char pattern blocked before any write, 502 and 400 messages, URL encoding, normaliser unit test).
🤖 Generated with Claude Code
![Autofix with [code]smith](https://pr-comments-assets.blacksmith.sh/codesmith/autofix-with-codesmith-dark-3x.png)
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.
Preview
Policies page card, dark theme, rendered from this branch against a stubbed GET /workspaces/{id}/leaders answer (*grok and lead set; lead and reviewgrok matched):
