feat(settings): Replicas connection card with environment setup
Merged
AG
5d ago+974+974+012345678901234567890123456789-12-12-01234567890123456789
Replaces the generic remote-connection card for the Replicas provider with a dedicated settings card built on the existing Control routes. No new backend contract; the dashboard only reads and writes what Control already serves.
What the card shows
- Connection: the one-step flow stays. The person pastes a Replicas API key (connect or replace); the key is cleared on submit and never shown again. Disconnect keeps the existing warning that it revokes every replica's Relay access. Non-managers see the same prompt as for the other providers.
- Status line: organization already connected elsewhere, key refused (with the date), missing or departed responsible member, failed automatic setup, pending setup, or configured, always followed by "N of M environments configured".
- Responsible member: a select over the organization's members labelled
Name (email)so same-name members can be told apart, with "No default principal" and a disabled "Former member" option when the stored principal left. Apply Relay setup stores the choice and then runs an environment sync. - Environments: one row per environment with its status (Configured, Pending, Registration unconfirmed, Not listed by Replicas, Key refused, Opted out, Disabled, plus "stale connection"), bound count, unmapped creators, and Opt out / Enable / Retry buttons. Errors are shown on the row they belong to.
- Replica bindings: every spawn with its agent or replica id, state, error and rejected / uncertain / retrying message counts.
Every write re-reads the policies and spawns, so a conflict leaves the newer server state on screen.
Files
src/admin/remote-agent-api.ts:replicasApi(workspace spawns, environment policies, sync, environment update, principal) with tolerant zod schemas (status strings open, unknown fields stripped).src/admin/replicas-settings.tsx: the card.src/admin/remote-agents.tsx,src/admin/settings.tsx: route thereplicasprovider to the new card and pass the organization id for the member list.src/admin/replicas-settings.test.tsx: six tests (responsible-member listing with duplicate names, apply then sync ordering, opt out / retry / enable writes, binding list with errors and counts, connect without leaking the key, non-manager view with no controls and no Replicas reads).
Checks
npm run lint, vitest run src/admin/replicas-settings.test.tsx src/admin/remote-agents.test.tsx (25 passed) and npm run build all pass locally on this head.
Opened with merge-train:hold: no merge, image cut or deploy without a direct OK.
🤖 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.