@kapybara/zerosub 1.0.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -8,6 +8,7 @@ Use several Claude and ChatGPT (Codex) subscriptions side by side in [Paseo](htt
8
8
  - **Automatic failover.** When an account hits its 5-hour or weekly limit, the agent moves to the account with the most room left and carries on. New agents skip exhausted accounts.
9
9
  - **Live usage.** Each account shows its own 5-hour and weekly usage and when they reset. Accounts in use refresh about every minute and after each turn, and a limit shows up the moment it hits.
10
10
  - **Banked resets.** If a provider has banked limit resets on an account, you can use one from the account card or the agent's account button.
11
+ - **Set an account aside.** Disable an account for a while and its agents move to your other accounts, then come back when you enable it again.
11
12
  - **Several hosts.** Each Paseo host keeps its own accounts, and the Accounts screen says which host you're looking at.
12
13
  - **Fork to the other provider (optional).** When every Claude account is out, a stopped chat can carry on in a new ChatGPT agent, and the other way round.
13
14
  - **Everything else stays the same.** Every account shares your settings, skills, plugins, MCP servers, `CLAUDE.md`/`AGENTS.md` and conversation history.
@@ -40,6 +41,7 @@ Then open **Accounts (ZeroSub)** in the sidebar.
40
41
  - **The account button in an agent's message box**: moves that one agent.
41
42
  - **`/account work`** in the message box, or `/account default` to follow the default again.
42
43
  - **⌘K → "Make … the default"**.
44
+ - **Disable for now** (the pause button on a card): the account stays signed in but ZeroSub stops using it. Its agents move to your other accounts right away (busy ones after their turn) and come back when you press **Enable**. ChatGPT conversations already on it stay, since they can't change accounts. You can't disable the last usable account of a provider.
43
45
  4. Leave **Automatic switching** on (in Accounts, or **Settings → Plugins → zerosub → ZeroSub preferences**) and limits take care of themselves:
44
46
  - Only the CLIs' own limit notices trigger a switch. That covers Claude Code's "You've hit your session limit · resets 3pm" and Codex's "You’ve hit your usage limit…".
45
47
  - A short note in the agent's timeline says what happened.
@@ -10,6 +10,7 @@ import {
10
10
  clearAccountLimit,
11
11
  removeAccount,
12
12
  renameAccount,
13
+ setAccountEnabled,
13
14
  setDefaultAccount,
14
15
  type ReopenSummary,
15
16
  } from "../shared/rpc";
@@ -61,7 +62,15 @@ export function AccountsSurface(props: PluginSurfaceProps & { store: ZeroSubStor
61
62
  Subscription accounts
62
63
  </Text>
63
64
  {state ? (
64
- <IconButton theme={theme} icon="RefreshCw" label="Refresh usage" busy={refreshing} onPress={() => void refreshUsage()} />
65
+ <IconButton
66
+ theme={theme}
67
+ icon="RefreshCw"
68
+ label="Refresh usage"
69
+ tooltip="Refresh usage for every account now"
70
+ tooltipPlacement="bottom"
71
+ busy={refreshing}
72
+ onPress={() => void refreshUsage()}
73
+ />
65
74
  ) : null}
66
75
  </View>
67
76
  <Text style={text.muted}>
@@ -81,7 +90,14 @@ export function AccountsSurface(props: PluginSurfaceProps & { store: ZeroSubStor
81
90
  }`
82
91
  : `Could not reach the daemon: ${error}`}
83
92
  </Text>
84
- <Button theme={theme} label="Try again" icon="RefreshCw" onPress={() => void store.refresh()} />
93
+ <Button
94
+ theme={theme}
95
+ label="Try again"
96
+ icon="RefreshCw"
97
+ tooltip="Ask this host for its accounts again"
98
+ tooltipAlign="start"
99
+ onPress={() => void store.refresh()}
100
+ />
85
101
  </Card>
86
102
  ) : null}
87
103
 
@@ -185,6 +201,8 @@ function FamilySection({
185
201
  icon="Plus"
186
202
  label={compact ? "Add" : "Add account"}
187
203
  accessibilityLabel={`Add ${FAMILY_LABEL[family]} account`}
204
+ tooltip={`Sign in another ${FAMILY_LABEL[family]} account`}
205
+ tooltipAlign="end"
188
206
  onPress={onAdd}
189
207
  />
190
208
  </View>
@@ -222,7 +240,7 @@ function AccountCard({
222
240
  }) {
223
241
  const text = useText(theme);
224
242
  const toast = useToast();
225
- const [busy, setBusy] = useState<"default" | "remove" | "clear" | null>(null);
243
+ const [busy, setBusy] = useState<"default" | "remove" | "clear" | "toggle" | null>(null);
226
244
  const [renaming, setRenaming] = useState(false);
227
245
  const [confirmRemove, setConfirmRemove] = useState(false);
228
246
  const [confirmReset, setConfirmReset] = useState(false);
@@ -231,10 +249,31 @@ function AccountCard({
231
249
  const summary = usageSummary(account);
232
250
  const subtitle = accountSubtitle(account);
233
251
  const signedOut = account.status === "signed_out";
252
+ const disabled = account.status === "disabled";
253
+ const faded = disabled ? { opacity: 0.55 } : null;
234
254
  const windows = account.usage?.windows ?? [];
235
255
  const agents = account.agentCount === 0 ? "No agents" : `${account.agentCount} agent${account.agentCount === 1 ? "" : "s"}`;
236
256
  const freshness = !signedOut && account.usage && windows.length > 0 ? `updated ${formatAge(account.usage.fetchedAt)}` : null;
237
257
 
258
+ // Sets the account aside for a while, or brings it back; its agents move off it and back.
259
+ const toggle = useCallback(async () => {
260
+ const enabling = account.status === "disabled";
261
+ setBusy("toggle");
262
+ try {
263
+ const result = await store.rpc(setAccountEnabled, { accountId: account.id, enabled: enabling });
264
+ const message = describeReopen(`${account.label} is ${enabling ? "enabled" : "disabled"}`, result);
265
+ const stayed =
266
+ result.stayed > 0
267
+ ? ` · ${result.stayed} ChatGPT conversation${result.stayed === 1 ? " stays" : "s stay"} on it (they can't change accounts)`
268
+ : "";
269
+ toast.show(`${message}${stayed}`, { variant: "success", durationMs: 5_000 });
270
+ } catch (error) {
271
+ toast.error(describe(error));
272
+ } finally {
273
+ setBusy(null);
274
+ }
275
+ }, [account, store, toast]);
276
+
238
277
  const makeDefault = useCallback(async () => {
239
278
  setBusy("default");
240
279
  try {
@@ -283,8 +322,10 @@ function AccountCard({
283
322
  return (
284
323
  <Card theme={theme} fill>
285
324
  <View style={{ flexDirection: "row", alignItems: "flex-start", gap: 12 }}>
286
- <Avatar theme={theme} label={account.label} />
287
- <View style={{ flex: 1, minWidth: 0, gap: 3 }}>
325
+ <View style={faded}>
326
+ <Avatar theme={theme} label={account.label} />
327
+ </View>
328
+ <View style={[{ flex: 1, minWidth: 0, gap: 3 }, faded]}>
288
329
  <Text style={text.strong} numberOfLines={1}>
289
330
  {account.label}
290
331
  </Text>
@@ -300,25 +341,40 @@ function AccountCard({
300
341
  theme={theme}
301
342
  icon="CircleCheck"
302
343
  label="Mark as available again (it has room)"
344
+ tooltip="Mark as available: use it again before its limit resets, e.g. after upgrading"
303
345
  busy={busy === "clear"}
304
346
  onPress={() => void markAvailable()}
305
347
  />
306
348
  ) : null}
307
- {!account.isDefault && account.status !== "signed_out" ? (
349
+ {!account.isDefault && !signedOut && !disabled ? (
308
350
  <IconButton
309
351
  theme={theme}
310
352
  icon="Star"
311
353
  label="Make default"
354
+ tooltip="Make default: new agents start on this account"
312
355
  busy={busy === "default"}
313
356
  onPress={() => void makeDefault()}
314
357
  />
315
358
  ) : null}
316
- <IconButton theme={theme} icon="Pencil" label="Rename" onPress={() => setRenaming(true)} />
359
+ <IconButton
360
+ theme={theme}
361
+ icon={disabled ? "CirclePlay" : "CirclePause"}
362
+ label={disabled ? "Enable account" : "Disable for now (agents won't use it)"}
363
+ tooltip={
364
+ disabled
365
+ ? "Enable: agents can use this account again"
366
+ : "Disable for now: agents stop using it and move to your other accounts"
367
+ }
368
+ busy={busy === "toggle"}
369
+ onPress={() => void toggle()}
370
+ />
371
+ <IconButton theme={theme} icon="Pencil" label="Rename" tooltip="Rename this account" onPress={() => setRenaming(true)} />
317
372
  {account.kind !== "main" ? (
318
373
  <IconButton
319
374
  theme={theme}
320
375
  icon="Trash2"
321
376
  label="Remove"
377
+ tooltip="Remove: sign it out and delete its saved login"
322
378
  tone="danger"
323
379
  busy={busy === "remove"}
324
380
  onPress={() => setConfirmRemove(true)}
@@ -327,8 +383,9 @@ function AccountCard({
327
383
  </View>
328
384
  </View>
329
385
 
330
- <View style={{ flexDirection: "row", flexWrap: "wrap", alignItems: "center", gap: 6 }}>
386
+ <View style={[{ flexDirection: "row", flexWrap: "wrap", alignItems: "center", gap: 6 }, faded]}>
331
387
  {account.isDefault ? <Badge theme={theme} label="Default" tone="accent" /> : null}
388
+ {disabled ? <Badge theme={theme} label="Disabled" /> : null}
332
389
  {plan ? <Badge theme={theme} label={plan} /> : null}
333
390
  {account.kind === "main" ? <Badge theme={theme} label="CLI login" /> : null}
334
391
  {account.status === "limited" ? <Badge theme={theme} label="Limit reached" tone="danger" /> : null}
@@ -336,7 +393,7 @@ function AccountCard({
336
393
  {resets && !signedOut ? <Badge theme={theme} label={resetBadge(resets)} tone="accent" /> : null}
337
394
  </View>
338
395
 
339
- <View style={{ gap: 10 }}>
396
+ <View style={[{ gap: 10 }, faded]}>
340
397
  {signedOut ? (
341
398
  <Text style={text.small}>Sign in again to use this account.</Text>
342
399
  ) : windows.length > 0 ? (
@@ -365,10 +422,31 @@ function AccountCard({
365
422
  }}
366
423
  >
367
424
  <Text style={[text.small, { flexShrink: 1 }]} numberOfLines={1}>
368
- {freshness ? `${agents} · ${freshness}` : agents}
425
+ {disabled ? "Disabled · agents won't use it" : freshness ? `${agents} · ${freshness}` : agents}
369
426
  </Text>
370
427
  {signedOut ? (
371
- <Button theme={theme} size="small" tone="primary" icon="LogIn" label="Sign in" onPress={onSignIn} />
428
+ <Button
429
+ theme={theme}
430
+ size="small"
431
+ tone="primary"
432
+ icon="LogIn"
433
+ label="Sign in"
434
+ tooltip="Sign this account in again"
435
+ tooltipAlign="end"
436
+ onPress={onSignIn}
437
+ />
438
+ ) : disabled ? (
439
+ <Button
440
+ theme={theme}
441
+ size="small"
442
+ tone="primary"
443
+ icon="CirclePlay"
444
+ label="Enable"
445
+ tooltip="Use this account again; its agents move back to it"
446
+ tooltipAlign="end"
447
+ busy={busy === "toggle"}
448
+ onPress={() => void toggle()}
449
+ />
372
450
  ) : resets ? (
373
451
  <Button
374
452
  theme={theme}
@@ -377,6 +455,8 @@ function AccountCard({
377
455
  icon="TimerReset"
378
456
  label="Use reset"
379
457
  accessibilityLabel="Use a banked reset"
458
+ tooltip="Spend a banked reset to refill this account's limits now"
459
+ tooltipAlign="end"
380
460
  disabled={!resets.usableNow}
381
461
  onPress={() => setConfirmReset(true)}
382
462
  />
@@ -410,12 +490,14 @@ function AccountCard({
410
490
  : "This signs the account out on this machine and deletes its saved login. New agents use the default account. Existing ChatGPT conversations on it can't move, so start new agents for them."}
411
491
  </Text>
412
492
  <View style={{ flexDirection: "row", gap: 8, justifyContent: "flex-end" }}>
413
- <Button theme={theme} label="Cancel" onPress={() => setConfirmRemove(false)} />
493
+ <Button theme={theme} label="Cancel" tooltip="Keep this account" tooltipAlign="end" onPress={() => setConfirmRemove(false)} />
414
494
  <Button
415
495
  theme={theme}
416
496
  tone="danger"
417
497
  icon="Trash2"
418
498
  label="Remove"
499
+ tooltip="Sign it out and delete its saved login; its agents move to the default"
500
+ tooltipAlign="end"
419
501
  busy={busy === "remove"}
420
502
  onPress={() => void remove()}
421
503
  />
@@ -484,11 +566,13 @@ function RenameModal({
484
566
  accessibilityLabel="Account name"
485
567
  />
486
568
  <View style={{ flexDirection: "row", gap: 8, justifyContent: "flex-end" }}>
487
- <Button theme={theme} label="Cancel" onPress={onClose} />
569
+ <Button theme={theme} label="Cancel" tooltip="Keep the current name" tooltipAlign="end" onPress={onClose} />
488
570
  <Button
489
571
  theme={theme}
490
572
  tone="primary"
491
573
  label="Save"
574
+ tooltip="Save the new name"
575
+ tooltipAlign="end"
492
576
  busy={saving}
493
577
  disabled={!label.trim()}
494
578
  onPress={() => void save()}
@@ -96,8 +96,16 @@ export function AddAccountModal({
96
96
  <>
97
97
  <Text style={text.danger}>{startError}</Text>
98
98
  <Row>
99
- <Button theme={theme} label="Close" onPress={close} />
100
- <Button theme={theme} tone="primary" icon="RefreshCw" label="Try again" onPress={() => void begin(method)} />
99
+ <Button theme={theme} label="Close" tooltip="Close without adding an account" tooltipAlign="end" onPress={close} />
100
+ <Button
101
+ theme={theme}
102
+ tone="primary"
103
+ icon="RefreshCw"
104
+ label="Try again"
105
+ tooltip="Start the sign-in again"
106
+ tooltipAlign="end"
107
+ onPress={() => void begin(method)}
108
+ />
101
109
  </Row>
102
110
  </>
103
111
  );
@@ -131,7 +139,7 @@ export function AddAccountModal({
131
139
  move an agent to it from the account button in the message box.
132
140
  </Text>
133
141
  <Row>
134
- <Button theme={theme} tone="primary" label="Done" onPress={onClose} />
142
+ <Button theme={theme} tone="primary" label="Done" tooltip="Close this window" tooltipAlign="end" onPress={onClose} />
135
143
  </Row>
136
144
  </>
137
145
  );
@@ -142,8 +150,16 @@ export function AddAccountModal({
142
150
  {login.message ?? (login.step === "canceled" ? "Sign-in was canceled." : "Sign-in failed.")}
143
151
  </Text>
144
152
  <Row>
145
- <Button theme={theme} label="Close" onPress={close} />
146
- <Button theme={theme} tone="primary" icon="RefreshCw" label="Try again" onPress={() => void begin(method)} />
153
+ <Button theme={theme} label="Close" tooltip="Close without adding an account" tooltipAlign="end" onPress={close} />
154
+ <Button
155
+ theme={theme}
156
+ tone="primary"
157
+ icon="RefreshCw"
158
+ label="Try again"
159
+ tooltip="Start the sign-in again"
160
+ tooltipAlign="end"
161
+ onPress={() => void begin(method)}
162
+ />
147
163
  </Row>
148
164
  </>
149
165
  );
@@ -242,8 +258,26 @@ function SignInSteps({
242
258
  : "Sign in with the account you want to add, using a browser on the host's own computer. It finishes by itself."}
243
259
  </Text>
244
260
  <Row start>
245
- <Button theme={theme} tone="primary" icon="ExternalLink" label="Open sign-in page" disabled={!link} onPress={open} />
246
- {link ? <Button theme={theme} icon="Copy" label="Copy link" onPress={() => void copy(link, "Link")} /> : null}
261
+ <Button
262
+ theme={theme}
263
+ tone="primary"
264
+ icon="ExternalLink"
265
+ label="Open sign-in page"
266
+ tooltip={`Open the ${service} sign-in page in your browser`}
267
+ tooltipAlign="start"
268
+ disabled={!link}
269
+ onPress={open}
270
+ />
271
+ {link ? (
272
+ <Button
273
+ theme={theme}
274
+ icon="Copy"
275
+ label="Copy link"
276
+ tooltip="Copy the sign-in link, for example to open it on another device"
277
+ tooltipAlign="start"
278
+ onPress={() => void copy(link, "Link")}
279
+ />
280
+ ) : null}
247
281
  </Row>
248
282
  </Step>
249
283
 
@@ -253,7 +287,14 @@ function SignInSteps({
253
287
  {login.userCode}
254
288
  </Text>
255
289
  <Row start>
256
- <Button theme={theme} icon="Copy" label="Copy code" onPress={() => void copy(login.userCode ?? "", "Code")} />
290
+ <Button
291
+ theme={theme}
292
+ icon="Copy"
293
+ label="Copy code"
294
+ tooltip="Copy the code to enter on the sign-in page"
295
+ tooltipAlign="start"
296
+ onPress={() => void copy(login.userCode ?? "", "Code")}
297
+ />
257
298
  </Row>
258
299
  <Text style={text.small}>
259
300
  If the page says code sign-in is off, turn on device code sign-in in ChatGPT → Settings → Security (or ask
@@ -281,6 +322,8 @@ function SignInSteps({
281
322
  theme={theme}
282
323
  tone="primary"
283
324
  label="Continue"
325
+ tooltip="Finish signing in with the pasted code"
326
+ tooltipAlign="start"
284
327
  busy={submitting}
285
328
  disabled={!code.trim()}
286
329
  onPress={() => void submit()}
@@ -46,6 +46,7 @@ export function contributeCommands(client: PluginClientContext, store: ZeroSubSt
46
46
  throw new Error(`No ${FAMILY_LABEL[family]} account matches "${query}". Accounts: ${names || "none"}.`);
47
47
  }
48
48
  if (match.status === "signed_out") throw new Error(`${match.label} is signed out. Sign it in from Accounts first.`);
49
+ if (match.status === "disabled") throw new Error(`${match.label} is disabled. Enable it in Accounts first.`);
49
50
  await store.rpc(setAgentAccount, { agentId: agent.id, accountId: match.id });
50
51
  },
51
52
  }),
@@ -63,7 +64,7 @@ export function contributeCommands(client: PluginClientContext, store: ZeroSubSt
63
64
  dynamic = [];
64
65
  if (!state) return;
65
66
  state.accounts.forEach((account, index) => {
66
- if (account.isDefault || account.status === "signed_out") return;
67
+ if (account.isDefault || account.status === "signed_out" || account.status === "disabled") return;
67
68
  dynamic.push(
68
69
  client.addCommandCenterItem({
69
70
  id: `default-${index}`,
@@ -41,12 +41,14 @@ export function forkPopover(store: ZeroSubStore, agentId: string, from: Family,
41
41
  </Text>
42
42
  {error ? <Text style={text.danger}>{error}</Text> : null}
43
43
  <View style={{ flexDirection: "row", flexWrap: "wrap", gap: 8, justifyContent: "flex-end" }}>
44
- <Button theme={theme} label="Not now" onPress={close} disabled={busy} />
44
+ <Button theme={theme} label="Not now" tooltip="Close without starting a new agent" tooltipAlign="end" onPress={close} disabled={busy} />
45
45
  <Button
46
46
  theme={theme}
47
47
  tone="primary"
48
48
  icon="GitFork"
49
49
  label={`Continue on ${FAMILY_LABEL[to]}`}
50
+ tooltip={`Start a new ${FAMILY_LABEL[to]} agent with this conversation so far`}
51
+ tooltipAlign="end"
50
52
  busy={busy}
51
53
  onPress={() => void start()}
52
54
  />
package/client/pills.ts CHANGED
@@ -161,7 +161,7 @@ function buttonFor(
161
161
  const other: Family = family === "claude" ? "codex" : "claude";
162
162
  const offerFork =
163
163
  current.status === "limited" &&
164
- accounts.every((account) => account.status === "limited" || account.status === "signed_out") &&
164
+ accounts.every((account) => account.status === "limited" || account.status === "signed_out" || account.status === "disabled") &&
165
165
  state.accounts.some((account) => account.family === other && account.status === "ready");
166
166
  if (accounts.length < 2 && !(current.status === "limited" && (offerReset || offerFork))) return null;
167
167
 
@@ -176,7 +176,7 @@ function buttonFor(
176
176
  id: `account-${index}`,
177
177
  title: account.id === current.id || movable ? menuTitle(account) : `Continue on ${account.label} (new agent)`,
178
178
  icon: account.id === current.id ? "CircleCheck" : movable ? "Circle" : "CopyPlus",
179
- disabled: account.status === "signed_out" || account.id === current.id,
179
+ disabled: account.status === "signed_out" || account.status === "disabled" || account.id === current.id,
180
180
  behavior: { kind: "action", onPress: choose(account.id) },
181
181
  }));
182
182
  // When the agent is stuck on a limit, a way out is the most useful thing in the menu.
@@ -237,6 +237,7 @@ function buttonFor(
237
237
 
238
238
  function menuTitle(account: AccountView): string {
239
239
  if (account.status === "signed_out") return `${account.label} — signed out`;
240
+ if (account.status === "disabled") return `${account.label} — disabled`;
240
241
  if (account.status === "limited") return `${account.label} — limit reached`;
241
242
  const peak = account.usage ? peakUsage(account.usage.windows) : null;
242
243
  return peak ? `${account.label} — ${formatPercent(peak.usedPercent)} used` : account.label;
@@ -73,7 +73,7 @@ export function ResetConfirm({
73
73
  return (
74
74
  <View style={{ gap: 12 }}>
75
75
  <Text style={text.body}>{account.label} has no banked resets right now.</Text>
76
- <Button theme={theme} label="Close" onPress={onCancel} />
76
+ <Button theme={theme} label="Close" tooltip="Close this window" tooltipAlign="end" onPress={onCancel} />
77
77
  </View>
78
78
  );
79
79
  }
@@ -87,12 +87,14 @@ export function ResetConfirm({
87
87
  {resets.blockedReason ? <Text style={text.warning}>{resets.blockedReason}</Text> : null}
88
88
  {error ? <Text style={text.danger}>{error}</Text> : null}
89
89
  <View style={{ flexDirection: "row", flexWrap: "wrap", gap: 8, justifyContent: "flex-end" }}>
90
- <Button theme={theme} label="No, keep it" onPress={onCancel} disabled={busy} />
90
+ <Button theme={theme} label="No, keep it" tooltip="Keep the reset for later" tooltipAlign="end" onPress={onCancel} disabled={busy} />
91
91
  <Button
92
92
  theme={theme}
93
93
  tone="primary"
94
94
  icon="TimerReset"
95
95
  label="Yes, use my reset"
96
+ tooltip="Spend one banked reset now; it can't be undone"
97
+ tooltipAlign="end"
96
98
  busy={busy}
97
99
  disabled={!resets.usableNow}
98
100
  onPress={() => void confirm()}
@@ -15,6 +15,10 @@ function cause(row: SwitchRow): string | null {
15
15
  return `${from} is signed out — sign it in again from Accounts.`;
16
16
  case "removed":
17
17
  return `${from} was removed.`;
18
+ case "disabled":
19
+ return `${from} was disabled for now.`;
20
+ case "enabled":
21
+ return `${row.to} is enabled again.`;
18
22
  case "default":
19
23
  return "The default account changed.";
20
24
  default:
@@ -59,7 +63,8 @@ export function describeRow(row: SwitchRow): string {
59
63
  case "pending":
60
64
  return `${lead}Moves to ${row.to} when its session next starts.`;
61
65
  default: {
62
- const from = row.from && row.reason !== "limit" && row.reason !== "signed_out" ? `from ${row.from} ` : "";
66
+ const from =
67
+ row.from && row.reason !== "limit" && row.reason !== "signed_out" && row.reason !== "disabled" ? `from ${row.from} ` : "";
63
68
  return `${lead}Switched ${from}to ${row.to}${row.continued ? " and carried on" : ""}.`;
64
69
  }
65
70
  }
package/client/ui.tsx CHANGED
@@ -1,6 +1,6 @@
1
1
  import type { PluginHostProps } from "@getpaseo/plugin/client";
2
2
  import { Icon } from "@getpaseo/plugin/client/react-native";
3
- import { useMemo, type ReactNode } from "react";
3
+ import { useCallback, useEffect, useMemo, useRef, useState, type ReactNode } from "react";
4
4
  import { ActivityIndicator, Pressable, Text, View } from "react-native";
5
5
  import { formatPercent, formatResetIn } from "../shared/format";
6
6
  import type { UsageWindow } from "../shared/model";
@@ -9,6 +9,75 @@ type Theme = PluginHostProps["theme"];
9
9
 
10
10
  export type ButtonTone = "primary" | "secondary" | "danger" | "ghost";
11
11
 
12
+ /** How a tooltip lines up with its control. `end` keeps a right-hand control's tip out of the next card. */
13
+ export type TooltipAlign = "start" | "center" | "end";
14
+
15
+ const TOOLTIP_HOVER_MS = 350;
16
+ const TOOLTIP_TOUCH_MS = 1_800;
17
+ const TOOLTIP_WIDTH = 240;
18
+
19
+ /** Hover (desktop, web) or long-press (touch) shows a short hint; pressing hides it. */
20
+ function useTooltip(text: string | undefined) {
21
+ const [visible, setVisible] = useState(false);
22
+ const timer = useRef<ReturnType<typeof setTimeout> | null>(null);
23
+ const clear = useCallback(() => {
24
+ if (timer.current) clearTimeout(timer.current);
25
+ timer.current = null;
26
+ }, []);
27
+ useEffect(() => clear, [clear]);
28
+ const show = useCallback(
29
+ (delay: number, hideAfter?: number) => {
30
+ clear();
31
+ timer.current = setTimeout(() => {
32
+ setVisible(true);
33
+ if (hideAfter) timer.current = setTimeout(() => setVisible(false), hideAfter);
34
+ }, delay);
35
+ },
36
+ [clear],
37
+ );
38
+ const hide = useCallback(() => {
39
+ clear();
40
+ setVisible(false);
41
+ }, [clear]);
42
+ if (!text) return { visible: false, handlers: {} };
43
+ return {
44
+ visible,
45
+ handlers: {
46
+ onHoverIn: () => show(TOOLTIP_HOVER_MS),
47
+ onHoverOut: hide,
48
+ onPressIn: hide,
49
+ onLongPress: () => show(0, TOOLTIP_TOUCH_MS),
50
+ },
51
+ };
52
+ }
53
+
54
+ function TooltipBubble({
55
+ theme,
56
+ text,
57
+ placement,
58
+ align,
59
+ }: {
60
+ theme: Theme;
61
+ text: string;
62
+ placement: "top" | "bottom";
63
+ align: TooltipAlign;
64
+ }) {
65
+ const vertical = placement === "top" ? { bottom: "100%" as const, marginBottom: 6 } : { top: "100%" as const, marginTop: 6 };
66
+ const horizontal =
67
+ align === "end"
68
+ ? { right: 0, alignItems: "flex-end" as const }
69
+ : align === "start"
70
+ ? { left: 0, alignItems: "flex-start" as const }
71
+ : { left: "50%" as const, marginLeft: -TOOLTIP_WIDTH / 2, alignItems: "center" as const };
72
+ return (
73
+ <View pointerEvents="none" style={{ position: "absolute", width: TOOLTIP_WIDTH, zIndex: 1000, ...vertical, ...horizontal }}>
74
+ <View style={{ paddingHorizontal: 8, paddingVertical: 5, borderRadius: 6, backgroundColor: theme.colors.foreground }}>
75
+ <Text style={{ color: theme.colors.surface0, fontSize: 12, lineHeight: 16 }}>{text}</Text>
76
+ </View>
77
+ </View>
78
+ );
79
+ }
80
+
12
81
  export function Button({
13
82
  theme,
14
83
  label,
@@ -19,6 +88,9 @@ export function Button({
19
88
  disabled,
20
89
  busy,
21
90
  accessibilityLabel,
91
+ tooltip,
92
+ tooltipAlign = "center",
93
+ tooltipPlacement = "top",
22
94
  }: {
23
95
  theme: Theme;
24
96
  label: string;
@@ -30,8 +102,13 @@ export function Button({
30
102
  disabled?: boolean;
31
103
  busy?: boolean;
32
104
  accessibilityLabel?: string;
105
+ /** A short explanation shown on hover or long-press. */
106
+ tooltip?: string;
107
+ tooltipAlign?: TooltipAlign;
108
+ tooltipPlacement?: "top" | "bottom";
33
109
  }) {
34
110
  const small = size === "small";
111
+ const tip = useTooltip(tooltip);
35
112
  const colors = theme.colors;
36
113
  const palette = {
37
114
  primary: { background: colors.accent, foreground: colors.accentForeground, border: colors.accent },
@@ -41,33 +118,38 @@ export function Button({
41
118
  }[tone];
42
119
  const inactive = disabled || busy;
43
120
  return (
44
- <Pressable
45
- accessibilityRole="button"
46
- accessibilityLabel={accessibilityLabel ?? label}
47
- accessibilityState={{ disabled: Boolean(inactive), busy: Boolean(busy) }}
48
- disabled={inactive}
49
- onPress={onPress}
50
- style={({ pressed }) => ({
51
- flexDirection: "row",
52
- alignItems: "center",
53
- justifyContent: "center",
54
- gap: small ? 5 : 6,
55
- paddingHorizontal: small ? 10 : 12,
56
- paddingVertical: small ? 5 : 8,
57
- borderRadius: small ? 7 : 8,
58
- borderWidth: 1,
59
- borderColor: palette.border,
60
- backgroundColor: palette.background,
61
- opacity: inactive ? 0.55 : pressed ? 0.8 : 1,
62
- })}
63
- >
64
- {busy ? (
65
- <ActivityIndicator size="small" color={palette.foreground} />
66
- ) : icon ? (
67
- <Icon name={icon} size={small ? 13 : 15} color={palette.foreground} />
68
- ) : null}
69
- <Text style={{ color: palette.foreground, fontSize: small ? 12 : 13, fontWeight: "600" }}>{label}</Text>
70
- </Pressable>
121
+ <View style={{ position: "relative", zIndex: tip.visible ? 1000 : undefined }}>
122
+ <Pressable
123
+ accessibilityRole="button"
124
+ accessibilityLabel={accessibilityLabel ?? label}
125
+ accessibilityHint={tooltip}
126
+ accessibilityState={{ disabled: Boolean(inactive), busy: Boolean(busy) }}
127
+ disabled={inactive}
128
+ onPress={onPress}
129
+ {...tip.handlers}
130
+ style={({ pressed }) => ({
131
+ flexDirection: "row",
132
+ alignItems: "center",
133
+ justifyContent: "center",
134
+ gap: small ? 5 : 6,
135
+ paddingHorizontal: small ? 10 : 12,
136
+ paddingVertical: small ? 5 : 8,
137
+ borderRadius: small ? 7 : 8,
138
+ borderWidth: 1,
139
+ borderColor: palette.border,
140
+ backgroundColor: palette.background,
141
+ opacity: inactive ? 0.55 : pressed ? 0.8 : 1,
142
+ })}
143
+ >
144
+ {busy ? (
145
+ <ActivityIndicator size="small" color={palette.foreground} />
146
+ ) : icon ? (
147
+ <Icon name={icon} size={small ? 13 : 15} color={palette.foreground} />
148
+ ) : null}
149
+ <Text style={{ color: palette.foreground, fontSize: small ? 12 : 13, fontWeight: "600" }}>{label}</Text>
150
+ </Pressable>
151
+ {tip.visible && tooltip ? <TooltipBubble theme={theme} text={tooltip} placement={tooltipPlacement} align={tooltipAlign} /> : null}
152
+ </View>
71
153
  );
72
154
  }
73
155
 
@@ -79,6 +161,9 @@ export function IconButton({
79
161
  onPress,
80
162
  disabled,
81
163
  busy,
164
+ tooltip,
165
+ tooltipAlign = "end",
166
+ tooltipPlacement = "top",
82
167
  }: {
83
168
  theme: Theme;
84
169
  icon: string;
@@ -87,44 +172,55 @@ export function IconButton({
87
172
  onPress(): void;
88
173
  disabled?: boolean;
89
174
  busy?: boolean;
175
+ /** Shown on hover or long-press; an icon alone never says enough, so it falls back to `label`. */
176
+ tooltip?: string;
177
+ tooltipAlign?: TooltipAlign;
178
+ tooltipPlacement?: "top" | "bottom";
90
179
  }) {
91
180
  const colors = theme.colors;
92
181
  const inactive = disabled || busy;
182
+ const hint = tooltip ?? label;
183
+ const tip = useTooltip(hint);
93
184
  return (
94
- <Pressable
95
- accessibilityRole="button"
96
- accessibilityLabel={label}
97
- accessibilityState={{ disabled: Boolean(inactive), busy: Boolean(busy) }}
98
- disabled={inactive}
99
- onPress={onPress}
100
- hitSlop={4}
101
- style={(state) => {
102
- const active = state.pressed || (state as { hovered?: boolean }).hovered;
103
- return {
104
- width: 30,
105
- height: 30,
106
- borderRadius: 8,
107
- alignItems: "center",
108
- justifyContent: "center",
109
- backgroundColor: active ? colors.surface2 : "transparent",
110
- opacity: inactive ? 0.45 : 1,
111
- };
112
- }}
113
- >
114
- {({ pressed, hovered }: { pressed: boolean; hovered?: boolean }) =>
115
- busy ? (
116
- <ActivityIndicator size="small" color={colors.foregroundMuted} />
117
- ) : (
118
- <Icon
119
- name={icon}
120
- size={15}
121
- color={
122
- tone === "danger" && (pressed || hovered) ? colors.statusDanger : colors.foregroundMuted
123
- }
124
- />
125
- )
126
- }
127
- </Pressable>
185
+ <View style={{ position: "relative", zIndex: tip.visible ? 1000 : undefined }}>
186
+ <Pressable
187
+ accessibilityRole="button"
188
+ accessibilityLabel={label}
189
+ accessibilityHint={tooltip}
190
+ accessibilityState={{ disabled: Boolean(inactive), busy: Boolean(busy) }}
191
+ disabled={inactive}
192
+ onPress={onPress}
193
+ hitSlop={4}
194
+ {...tip.handlers}
195
+ style={(state) => {
196
+ const active = state.pressed || (state as { hovered?: boolean }).hovered;
197
+ return {
198
+ width: 30,
199
+ height: 30,
200
+ borderRadius: 8,
201
+ alignItems: "center",
202
+ justifyContent: "center",
203
+ backgroundColor: active ? colors.surface2 : "transparent",
204
+ opacity: inactive ? 0.45 : 1,
205
+ };
206
+ }}
207
+ >
208
+ {({ pressed, hovered }: { pressed: boolean; hovered?: boolean }) =>
209
+ busy ? (
210
+ <ActivityIndicator size="small" color={colors.foregroundMuted} />
211
+ ) : (
212
+ <Icon
213
+ name={icon}
214
+ size={15}
215
+ color={
216
+ tone === "danger" && (pressed || hovered) ? colors.statusDanger : colors.foregroundMuted
217
+ }
218
+ />
219
+ )
220
+ }
221
+ </Pressable>
222
+ {tip.visible ? <TooltipBubble theme={theme} text={hint} placement={tooltipPlacement} align={tooltipAlign} /> : null}
223
+ </View>
128
224
  );
129
225
  }
130
226
 
package/index.server.ts CHANGED
@@ -12,6 +12,7 @@ import {
12
12
  renameAccount,
13
13
  setAgentAccount,
14
14
  setDefaultAccount,
15
+ setAccountEnabled,
15
16
  forkAgent,
16
17
  startLogin,
17
18
  submitLoginCode,
@@ -83,6 +84,7 @@ export default function contribute(server: PluginServerContext) {
83
84
  server.handle(redeemReset, ({ accountId, agentId }, { paseo }) => service.redeem(paseo, accountId, agentId));
84
85
  server.handle(setAgentAccount, ({ agentId, accountId }, { paseo }) => service.setAgentAccount(paseo, agentId, accountId));
85
86
  server.handle(forkAgent, ({ agentId }, { paseo }) => service.forkAgent(paseo, agentId));
87
+ server.handle(setAccountEnabled, ({ accountId, enabled }, { paseo }) => service.setAccountEnabled(paseo, accountId, enabled));
86
88
 
87
89
  return async () => {
88
90
  stopSettings();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kapybara/zerosub",
3
- "version": "1.0.0",
3
+ "version": "1.2.0",
4
4
  "description": "ZeroSub: use several Claude and ChatGPT (Codex) subscriptions side by side in Paseo. Add accounts in-app, pick one per agent, and switch automatically when an account hits its limit.",
5
5
  "keywords": [
6
6
  "paseo",
package/paseo-plugin.json CHANGED
@@ -1,6 +1,5 @@
1
1
  {
2
2
  "id": "zerosub",
3
- "description": "ZeroSub: use several Claude and ChatGPT (Codex) subscriptions side by side. Add accounts in-app, pick one per agent, and switch automatically when an account hits its limit.",
4
3
  "requirements": {
5
4
  "paseo": ">=0.9.1"
6
5
  }
package/server/codex.ts CHANGED
@@ -57,7 +57,7 @@ class AppServer {
57
57
  try {
58
58
  await server.request(
59
59
  "initialize",
60
- { clientInfo: { name: CLIENT_NAME, title: "Paseo ZeroSub", version: "1.0.0" }, capabilities: { experimentalApi: false } },
60
+ { clientInfo: { name: CLIENT_NAME, title: "Paseo ZeroSub", version: "1.2.0" }, capabilities: { experimentalApi: false } },
61
61
  60_000,
62
62
  );
63
63
  server.send({ method: "initialized" });
package/server/routing.ts CHANGED
@@ -17,7 +17,7 @@ export function isLimited(account: StoredAccount, now: number): boolean {
17
17
  }
18
18
 
19
19
  export function isUsable(account: StoredAccount, now: number): boolean {
20
- return account.signedIn && !isLimited(account, now);
20
+ return account.signedIn && !account.disabled && !isLimited(account, now);
21
21
  }
22
22
 
23
23
  /** Lower is better. Unknown usage ranks in the middle so a known-quiet account wins over a mystery. */
@@ -76,14 +76,15 @@ export interface RouteDecision {
76
76
  /** A binding to persist so the agent stays where it was routed. */
77
77
  bind: Binding | null;
78
78
  /** Why the preferred account was skipped, if it was. */
79
- skipped: { account: StoredAccount; why: "limited" | "signed_out" } | null;
79
+ skipped: { account: StoredAccount; why: "limited" | "signed_out" | "disabled" } | null;
80
80
  }
81
81
 
82
82
  /**
83
83
  * Which account a session opens on: the agent's own binding, else (for balanced new agents) the
84
84
  * roomiest account, else the default. An exhausted or signed-out choice is swapped for the roomiest
85
85
  * usable account when automatic switching is on — for new agents always, and for existing ones
86
- * only when their conversation can move between accounts.
86
+ * only when their conversation can move between accounts. A disabled choice is always swapped,
87
+ * and the agent keeps its own binding so it returns once the account is enabled again.
87
88
  */
88
89
  export function chooseAccount(state: StoredState, input: RouteInput): RouteDecision | null {
89
90
  const accounts = accountsOf(state, input.family);
@@ -110,14 +111,21 @@ export function chooseAccount(state: StoredState, input: RouteInput): RouteDecis
110
111
  if (!account) return null;
111
112
 
112
113
  let skipped: RouteDecision["skipped"] = null;
113
- const why = !account.signedIn ? "signed_out" : isLimited(account, input.now) ? "limited" : null;
114
+ const why = !account.signedIn ? "signed_out" : account.disabled ? "disabled" : isLimited(account, input.now) ? "limited" : null;
114
115
  const mayMove = fresh || input.portable;
115
- if (why && mayMove && (input.autoSwitch || why === "signed_out")) {
116
+ if (why && mayMove && (input.autoSwitch || why !== "limited")) {
116
117
  const alternative = mostAvailable(state, input.family, input.usageOf, input.now, new Set([account.id]));
117
118
  if (alternative) {
118
119
  skipped = { account, why };
119
120
  account = alternative;
120
- bind = { accountId: alternative.id, source: input.portable ? "auto" : "thread", at };
121
+ // A thread that can't move lives where it starts. Otherwise a disabled account keeps its
122
+ // agents' bindings, so they return when it's enabled again; a limit re-pins them.
123
+ bind =
124
+ !input.portable
125
+ ? { accountId: alternative.id, source: "thread", at }
126
+ : why === "disabled"
127
+ ? null
128
+ : { accountId: alternative.id, source: "auto", at };
121
129
  }
122
130
  }
123
131
  return { account, bind, skipped };
package/server/service.ts CHANGED
@@ -230,7 +230,7 @@ export class Service {
230
230
  const attempted = this.usageAttemptAt.get(account.id) ?? 0;
231
231
  const busy = now - (this.activeAt.get(account.id) ?? 0) < ACTIVE_WINDOW_MS;
232
232
  const isDefault = defaultAccount(state, account.family)?.id === account.id;
233
- const every = busy ? USAGE_BUSY_MS : isDefault ? USAGE_DEFAULT_MS : USAGE_IDLE_MS;
233
+ const every = account.disabled ? USAGE_IDLE_MS : busy ? USAGE_BUSY_MS : isDefault ? USAGE_DEFAULT_MS : USAGE_IDLE_MS;
234
234
  if (account.signedIn && now - attempted > every) {
235
235
  void this.refreshUsage(account.id).catch((error: unknown) => log(`usage refresh for ${account.label} failed`, error));
236
236
  }
@@ -555,7 +555,7 @@ export class Service {
555
555
  }
556
556
  const next = mostAvailable(latest, family, (id) => this.usage.get(id), now, new Set([account.id]));
557
557
  if (!next) {
558
- if (problem.kind === "limit" && problem.hit.kind === "window" && this.prefs.autoRedeem) {
558
+ if (problem.kind === "limit" && problem.hit.kind === "window" && this.prefs.autoRedeem && !account.disabled) {
559
559
  // Opt-in: every account is out, so spend a banked reset rather than stop.
560
560
  const reply = await this.redeemOn(account, true);
561
561
  if (reply.outcome === "reset") {
@@ -1219,7 +1219,7 @@ export class Service {
1219
1219
  email: account.email,
1220
1220
  plan: account.plan,
1221
1221
  organization: account.organization,
1222
- status: !account.signedIn ? "signed_out" : limited ? "limited" : "ready",
1222
+ status: !account.signedIn ? "signed_out" : account.disabled ? "disabled" : limited ? "limited" : "ready",
1223
1223
  isDefault: defaultAccount(state, account.family)?.id === account.id,
1224
1224
  limitedUntil: limited ? account.limitedUntil : null,
1225
1225
  usage: this.usage.get(account.id) ?? null,
@@ -1291,6 +1291,7 @@ export class Service {
1291
1291
  const account = findAccount(await this.store.read(), accountId);
1292
1292
  if (!account) throw new Error("That account no longer exists.");
1293
1293
  if (!account.signedIn) throw new Error(`${account.label} is signed out. Sign it in first.`);
1294
+ if (account.disabled) throw new Error(`${account.label} is disabled. Enable it before making it the default.`);
1294
1295
  if (!this.adapters[account.family].portable) await this.pinThreads(paseo, account.family);
1295
1296
  await this.store.update((draft) => {
1296
1297
  draft.defaults[account.family] = account.id;
@@ -1299,6 +1300,40 @@ export class Service {
1299
1300
  return this.reconcile(paseo, "default");
1300
1301
  }
1301
1302
 
1303
+ /**
1304
+ * Sets an account aside for a while, or brings it back. A disabled account stays signed in, but
1305
+ * nothing is routed to it: its agents move to the next account now (busy ones after their turn)
1306
+ * and return when it's enabled again. ChatGPT conversations can't change accounts, so the ones
1307
+ * already on it stay there; `stayed` counts them.
1308
+ */
1309
+ async setAccountEnabled(paseo: PaseoApi, accountId: string, enabled: boolean): Promise<ReopenSummary & { stayed: number }> {
1310
+ this.attach(paseo);
1311
+ const state = await this.store.read();
1312
+ const account = findAccount(state, accountId);
1313
+ if (!account) throw new Error("That account no longer exists.");
1314
+ if (account.disabled === !enabled) return { ...emptySummary(), stayed: 0 };
1315
+ if (!enabled && !accountsOf(state, account.family).some((other) => other.id !== account.id && other.signedIn && !other.disabled)) {
1316
+ // With nothing else to route to, sessions would quietly fall back to the CLI login.
1317
+ throw new Error(`${account.label} is the only ${FAMILY_LABEL[account.family]} account in use. Add or enable another one first.`);
1318
+ }
1319
+ await this.store.update((draft) => {
1320
+ const target = findAccount(draft, accountId);
1321
+ if (target) target.disabled = !enabled;
1322
+ });
1323
+ console.log(`[ZeroSub] ${account.label} is ${enabled ? "enabled" : "disabled"}`);
1324
+ const summary = await this.reconcile(paseo, enabled ? "enabled" : "disabled");
1325
+ let stayed = 0;
1326
+ if (!enabled && !this.adapters[account.family].portable) {
1327
+ const families = await this.families.resolve(paseo);
1328
+ const latest = await this.store.read();
1329
+ stayed = (await listAgents(paseo, false)).agents.filter(
1330
+ (agent) =>
1331
+ families[agent.provider] === account.family && agent.hasHistory && this.targetFor(latest, agent.id, account.family) === accountId,
1332
+ ).length;
1333
+ }
1334
+ return { ...summary, stayed };
1335
+ }
1336
+
1302
1337
  /**
1303
1338
  * Pins every existing agent of a non-portable provider to the account it runs on now, before the
1304
1339
  * default changes. Agents that haven't opened a session since ZeroSub was installed have no pin yet.
@@ -1342,6 +1377,7 @@ export class Service {
1342
1377
  const target = accountId ? findAccount(state, accountId) : defaultAccount(state, family);
1343
1378
  if (!target || target.family !== family) throw new Error("That account can't be used with this agent.");
1344
1379
  if (!target.signedIn) throw new Error(`${target.label} is signed out. Sign it in first.`);
1380
+ if (accountId && target.disabled) throw new Error(`${target.label} is disabled. Enable it in Accounts first.`);
1345
1381
 
1346
1382
  if (!adapter.portable) {
1347
1383
  if (info.status === "running" || info.status === "initializing") {
@@ -1599,6 +1635,7 @@ function newAccount(fields: Pick<StoredAccount, "id" | "family" | "kind" | "home
1599
1635
  organization: null,
1600
1636
  identity: null,
1601
1637
  signedIn: true,
1638
+ disabled: false,
1602
1639
  limitedUntil: null,
1603
1640
  limitKind: null,
1604
1641
  limitedAt: null,
package/server/state.ts CHANGED
@@ -19,6 +19,8 @@ export const StoredAccountSchema = z.object({
19
19
  /** Stable identity used to spot the same account being added twice. */
20
20
  identity: z.string().nullable().default(null),
21
21
  signedIn: z.boolean().default(true),
22
+ /** Set aside by the user for a while: stays signed in, but nothing is routed to it. */
23
+ disabled: z.boolean().default(false),
22
24
  limitedUntil: z.string().nullable().default(null),
23
25
  /** What kind of limit `limitedUntil` records; only `window` limits clear from usage readings. */
24
26
  limitKind: z.enum(["window", "budget"]).nullable().default(null),
package/shared/format.ts CHANGED
@@ -87,6 +87,7 @@ export function formatAge(at: string, now: number = Date.now()): string {
87
87
  }
88
88
 
89
89
  export function usageSummary(account: AccountView, now: number = Date.now()): string | null {
90
+ if (account.status === "disabled") return "Disabled for now";
90
91
  if (account.status === "limited") {
91
92
  const reset = formatResetIn(account.limitedUntil, now);
92
93
  return reset ? `Limit reached · resets ${reset}` : "Limit reached";
package/shared/model.ts CHANGED
@@ -56,7 +56,8 @@ export const AccountKindSchema = z.enum([
56
56
  ]);
57
57
  export type AccountKind = z.infer<typeof AccountKindSchema>;
58
58
 
59
- export const AccountStatusSchema = z.enum(["ready", "signed_out", "limited", "checking"]);
59
+ /** `disabled`: the user set it aside for a while; it stays signed in but nothing is routed to it. */
60
+ export const AccountStatusSchema = z.enum(["ready", "signed_out", "limited", "checking", "disabled"]);
60
61
  export type AccountStatus = z.infer<typeof AccountStatusSchema>;
61
62
 
62
63
  export const AccountViewSchema = z.object({
package/shared/rpc.ts CHANGED
@@ -102,6 +102,16 @@ export const setDefaultAccount = defineRpc({
102
102
  output: ReopenSummarySchema,
103
103
  });
104
104
 
105
+ /** Sets an account aside for a while (nothing is routed to it) or brings it back. */
106
+ export const setAccountEnabled = defineRpc({
107
+ name: "zerosub.accounts.enabled",
108
+ input: z.object({ accountId: z.string(), enabled: z.boolean() }),
109
+ output: ReopenSummarySchema.extend({
110
+ /** ChatGPT conversations that stay on the disabled account because they can't change accounts. */
111
+ stayed: z.number(),
112
+ }),
113
+ });
114
+
105
115
  /** Carries an agent's work on in a new agent on the other provider (Claude ↔ ChatGPT). */
106
116
  export const forkAgent = defineRpc({
107
117
  name: "zerosub.agents.fork",
@@ -19,6 +19,10 @@ export const SwitchRowSchema = z.object({
19
19
  "default",
20
20
  /** `from` was removed. */
21
21
  "removed",
22
+ /** `from` was disabled for a while. */
23
+ "disabled",
24
+ /** `to` was enabled again, and this agent returns to it. */
25
+ "enabled",
22
26
  /** Every account of this provider is at its limit; nothing to switch to. */
23
27
  "exhausted",
24
28
  ]),