feat(pool): an admin's switch moves a user's Claude login at once

PUT /api/accounts/pins (and agenthub accounts pin) now writes a pinned
Claude login into the user's home right away (claude-pool.switchHome):
every home's newer pair is copied back first, the member's own login is
never written over, and no pane is restarted — running sessions take the
new pair at their next credentials read. A live home stays on the login it
holds, so unpinning does not flip it back. The Users page calls it
"Switch a user's account" and says what happened.
This commit is contained in:
2026-10-19 10:23:44 +07:00
parent 9c98638ec0
commit 776ad6466f
16 changed files with 208 additions and 89 deletions
+9 -8
View File
@@ -1061,15 +1061,16 @@ export const api = {
method: "POST",
body: JSON.stringify({ ...body, currentPassword }),
}),
/** PUT /api/accounts/pins — admin: pin a user to one account (`null` unpins), password again. */
/** PUT /api/accounts/pins — admin: switch a user to one account (`null` = automatic), password again. */
pin: (tool: PoolTool, userId: number, account: string | null, currentPassword: string) =>
request<{ pin: { userId: number; username: string; account: string | null } }>(
"/accounts/pins",
{
method: "PUT",
body: JSON.stringify({ tool, userId, account, currentPassword }),
}
),
request<{
pin: { userId: number; username: string; account: string | null };
/** What happened now: a Claude login goes into the user's home at once. */
switched: "switched" | "kept" | "own-login" | "expired" | "next-session" | null;
}>("/accounts/pins", {
method: "PUT",
body: JSON.stringify({ tool, userId, account, currentPassword }),
}),
/** DELETE /api/accounts/:name — admin, with their OWN password again. */
remove: (tool: PoolTool, name: string, currentPassword: string) =>
request<{ ok: true }>(`/accounts/${encodeURIComponent(name)}`, {