paseo-plugin-account-switcher 0.7.1 → 0.8.1

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/OVERVIEW.md CHANGED
@@ -1,4 +1,4 @@
1
- Account Switcher lets you use several Claude and ChatGPT/Codex subscription accounts in Paseo. You pick an account for each agent, switch the account of an existing chat, set a default per provider, and see each account's usage limits. Switching is manual and stays within one provider.
1
+ Account Switcher lets you use several Claude and ChatGPT/Codex subscription accounts in Paseo. You pick an account for each agent, switch the account of an existing chat, set a default per provider, and see each account's usage limits. Switching stays within one provider and is manual, unless you turn on automatic switching for when a limit runs out.
2
2
 
3
3
  Limits cover every window the provider reports, such as 5-hour and weekly use, with reset times. Codex usage-based workspace plans show their monthly credits, and Claude enterprise seats show their monthly spend allowance.
4
4
 
@@ -9,7 +9,9 @@ Limits cover every window the provider reports, such as 5-hour and weekly use, w
9
9
  - A new agent starts on its provider's default account. When the latest readings show the default has used up an account-wide limit that resets later, Codex reports that ordinary usage is not allowed, its plan lacks the Codex model chosen for the agent, or the default needs sign-in, the agent starts on the signed-in account with the largest percentage left instead. Limits of a single model and extra paid usage do not count. With every account ruled out, it stays on the default. **Always use the default** under a provider in Accounts turns this off, so the default stays binding.
10
10
  - `/account name` in the message field switches the chat's account, or `/account default` its provider's default: at once when the agent is idle, otherwise in the switcher for **Apply**. The Command Center offers **Make “name” the default** for each signed-in account.
11
11
  - A line in the chat records applied switches, and why a new agent did not start on the default. These lines are best effort and do not survive a daemon restart.
12
- - The account chip in the composer opens the switcher for that chat. Your selection applies only when you choose **Apply**, or type `/account name`, while the agent is idle with no pending permission request, and Paseo reloads the agent with its session intact. If the switch fails, the plugin tries to restore the previous account.
12
+ - Signed-in accounts also appear in Paseo's Usage view, and Paseo's usage popover for an agent on a managed account shows that account.
13
+ - When a turn stops because its account's limit is used up, the chat shows a row with the time the limit lifts and a button such as **Switch to Second and continue** for the signed-in account with the most room. After the switch the agent is asked to continue. If no other account has room, the row says so. Codex reports such a turn as failed; Claude reports it as completed, so a completed Claude turn is checked when the last reading already shows its account used up, and not while the account's paid extra usage still has room. Each time an account runs out, the chat gets one row, not one per turn. **When a limit runs out during a chat** under a provider in Accounts can be set to **Switch automatically**, which switches without the click. The default is **Offer a switch**. After a completed Claude turn the automatic switch does not ask the agent to continue, since the turn may really have finished; the row says the next message runs on the new account. Automatic switching happens once per turn and at most three times an hour for a chat, and never back to an account the chat left within that hour.
14
+ - The account chip in the composer opens the switcher for that chat. A chat changes account only through **Apply**, `/account name`, the switch button of the limit row, or automatic switching if you turn it on, and only while the agent is idle with no pending permission request; Paseo reloads the agent with its session intact. A switch refused before the reload changes nothing. If it fails once the reload has started, the plugin tries to restore the previous account.
13
15
 
14
16
  ## Setup
15
17
 
@@ -20,13 +22,17 @@ Limits cover every window the provider reports, such as 5-hour and weekly use, w
20
22
  ## What it reads and sends
21
23
 
22
24
  - It reads each account's stored sign-in: Codex's `auth.json`, and Claude's credentials from the macOS Keychain or the profile's `.credentials.json`. The Codex file identifies the ChatGPT account; the Claude access token authenticates the usage request, and the official CLI reports which Claude account is signed in. Tokens stay on the daemon. Paseo clients receive each account's email, plan, and limits.
23
- - Claude limits come from a request to `api.anthropic.com` with the account's access token. When that token has expired, for example on an idle account, the plugin runs `claude -p /usage --no-session-persistence` under the account so the official CLI renews it, at most every 10 minutes. The command sends no model message and saves no session. Codex limits and the plan's model list come from the official `codex app-server`, which asks OpenAI and may refresh the account's token. No model messages are sent.
25
+ - Claude limits come from a request to `api.anthropic.com` with the account's access token. When that token has expired, for example on an idle account, the plugin runs `claude -p /usage --no-session-persistence` under the account so the official CLI renews it, at most every 10 minutes. The command sends no model message and saves no session. Codex limits and the plan's model list come from the official `codex app-server`, which asks OpenAI and may refresh the account's token. Limit checks send no model messages.
26
+ - To list accounts in Paseo's Usage view, the plugin reports the limits it has already collected under the source name Account Switcher, without new provider requests. For an agent on a managed account, it adds that account's profile directory to the agent's session environment so Paseo's usage popover reads the right account.
27
+ - The only message the plugin sends to an agent is **Continue.**, after a switch made from the limit row, or by automatic switching after a failed turn.
24
28
  - Limits refresh every 5 minutes, and every minute while Accounts or the switcher is open. Missing values show as no data, and a failed refresh can keep the last values, marked stale.
25
29
  - Removing a managed account deletes its profile and stored sign-in, including a Claude account's Keychain item on macOS. Shared session history stays.
26
30
 
27
31
  ## Limitations
28
32
 
29
33
  - Apply reloads the agent through Paseo, which has no lock against a message sent from another client at the same moment. That message can be interrupted.
34
+ - Paseo does not say why a turn failed, and reports a Claude turn stopped by its limit as completed, so the limit row appears only when the plugin's own limit readings, taken again after the turn, show the account is used up. A limit the provider does not report gets no row, and neither does an agent whose account the plugin cannot confirm. Nothing is offered while account switching is off for the provider.
35
+ - Paseo's Usage view can show one managed account twice: after you open the usage details of an agent on that account, Paseo's own Claude or Codex card for the login can appear next to the Account Switcher card. The plugin cannot merge cards of different sources.
30
36
  - Plans differ in the models they offer: after a switch to a plan without the agent's model, its next message fails. For Codex, the switcher compares the agent's model with the models the account's plan offers and warns before **Apply**. Claude does not report its models, so there is no such check for Claude.
31
37
  - Codex's **In browser** sign-in must finish on the daemon's computer. From another device, use **Device code**.
32
38
  - Providers can change their limit formats. Values the plugin cannot read show as no data.
package/OVERVIEW.zh-CN.md CHANGED
@@ -1,4 +1,4 @@
1
- Account Switcher 让你在 Paseo 中使用多个 Claude 和 ChatGPT/Codex 订阅账号。你可以为每个智能体选择账号,切换现有对话的账号,为每个提供商设置默认账号,并查看每个账号的用量限制。切换为手动操作,且只在同一提供商内进行。
1
+ Account Switcher 让你在 Paseo 中使用多个 Claude 和 ChatGPT/Codex 订阅账号。你可以为每个智能体选择账号,切换现有对话的账号,为每个提供商设置默认账号,并查看每个账号的用量限制。切换只在同一提供商内进行,且为手动操作,除非你为限制用尽的情况开启自动切换。
2
2
 
3
3
  限制涵盖提供商报告的所有时间窗口,例如 5 小时和每周用量,并显示重置时间。Codex 按用量计费的工作区套餐显示每月额度(credits),Claude 企业席位显示每月消费额度。
4
4
 
@@ -11,7 +11,9 @@ Account Switcher 让你在 Paseo 中使用多个 Claude 和 ChatGPT/Codex 订阅
11
11
  - 新智能体会使用其提供商的默认账号。如果最近读取的数据显示:默认账号已用尽某个账号级限制且重置时间尚未到来、Codex 报告不允许常规使用、其套餐不提供为该智能体选择的 Codex 模型,或默认账号需要重新登录,智能体会改用剩余百分比最多的已登录账号。单个模型的限制和额外付费用量不计入。所有账号都被排除时,仍使用默认账号。在 Accounts 中该提供商下选择 **Always use the default** 可关闭此行为,使默认账号始终生效。
12
12
  - 在输入框中输入 `/account 名称` 可切换当前对话的账号,`/account default` 切换到提供商的默认账号:智能体空闲时立即生效,否则在切换器中通过 **Apply** 应用。命令中心(⌘K)为每个已登录账号提供 **Make “名称” the default**。
13
13
  - 对话中会有一行记录已应用的切换,以及新智能体未使用默认账号的原因。这些记录是尽力而为的,在守护进程重启后不会保留。
14
- - 输入框旁的账号标签会打开当前对话的切换器。只有在智能体空闲且没有待处理的权限请求时选择 **Apply** 或输入 `/account 名称`,所选账号才会生效,Paseo 会重新加载智能体并保留会话。如果切换失败,插件会尝试恢复之前的账号。
14
+ - 已登录的账号也会显示在 Paseo 的 Usage 视图中;使用托管账号的智能体,其 Paseo 用量弹窗会显示该账号。
15
+ - 当某个回合因所用账号的限制已用尽而停止时,对话中会出现一行,显示限制解除的时间,以及一个按钮(例如 **Switch to Second and continue**),用于切换到剩余最多的已登录账号。切换后会请智能体继续。如果没有其他账号有余量,该行会如实说明。Codex 将这类回合报告为失败;Claude 则将其报告为已完成,因此只有当上次读取的数据已显示账号用尽、且该账号的付费额外用量没有剩余时,插件才会检查已完成的 Claude 回合。每次账号用尽,对话中只出现一行,而不是每个回合一行。在 Accounts 中该提供商下,**When a limit runs out during a chat** 可设为 **Switch automatically**,无需点击即自动切换;默认值为 **Offer a switch**。在已完成的 Claude 回合之后,自动切换不会请智能体继续,因为该回合可能确实已经完成;该行会说明下一条消息将在新账号上运行。自动切换每个回合最多一次,每个对话每小时最多三次,且不会切回该对话一小时内刚离开的账号。
16
+ - 输入框旁的账号标签会打开当前对话的切换器。对话只会通过 **Apply**、`/account 名称`、限制行的切换按钮,或你开启的自动切换来更换账号,且仅在智能体空闲、没有待处理的权限请求时进行;Paseo 会重新加载智能体并保留会话。在重新加载之前被拒绝的切换不会改变任何内容。如果切换在重新加载开始后失败,插件会尝试恢复之前的账号。
15
17
 
16
18
  ## 设置
17
19
 
@@ -22,13 +24,17 @@ Account Switcher 让你在 Paseo 中使用多个 Claude 和 ChatGPT/Codex 订阅
22
24
  ## 读取和发送的内容
23
25
 
24
26
  - 插件读取每个账号已保存的登录信息:Codex 的 `auth.json`,以及 Claude 存放在 macOS 钥匙串或配置文件 `.credentials.json` 中的凭据。Codex 文件用于识别 ChatGPT 账号;Claude 访问令牌用于用量请求的认证,官方 CLI 报告当前登录的是哪个 Claude 账号。令牌只保留在守护进程上。Paseo 客户端会收到每个账号的邮箱、套餐和限制。
25
- - Claude 限制来自使用该账号访问令牌向 `api.anthropic.com` 发出的请求。当该令牌过期时(例如账号闲置),插件会以该账号运行 `claude -p /usage --no-session-persistence`,由官方 CLI 续期令牌,每 10 分钟最多一次。该命令不发送模型消息,也不保存会话。Codex 限制和套餐的模型列表来自官方 `codex app-server`,它会向 OpenAI 查询,并可能刷新账号令牌。不会发送任何模型消息。
27
+ - Claude 限制来自使用该账号访问令牌向 `api.anthropic.com` 发出的请求。当该令牌过期时(例如账号闲置),插件会以该账号运行 `claude -p /usage --no-session-persistence`,由官方 CLI 续期令牌,每 10 分钟最多一次。该命令不发送模型消息,也不保存会话。Codex 限制和套餐的模型列表来自官方 `codex app-server`,它会向 OpenAI 查询,并可能刷新账号令牌。限制检查不会发送任何模型消息。
28
+ - 为在 Paseo 的 Usage 视图中列出账号,插件会以来源名称 Account Switcher 上报它已收集的限制数据,不会产生新的提供商请求。对于使用托管账号的智能体,插件会把该账号的配置文件目录加入智能体的会话环境,使 Paseo 的用量弹窗读取正确的账号。
29
+ - 插件发给智能体的唯一消息是 **Continue.**,仅在通过限制行完成切换之后,或在失败回合之后自动切换完成时发送。
26
30
  - 限制每 5 分钟刷新一次;Accounts 或切换器打开时每分钟刷新一次。缺失的值显示为无数据,刷新失败时可能保留上次的值并标记为过期。
27
31
  - 移除托管账号会删除其配置文件和已保存的登录信息,在 macOS 上包括 Claude 账号的钥匙串项。共享的会话历史会保留。
28
32
 
29
33
  ## 限制
30
34
 
31
35
  - **Apply** 通过 Paseo 重新加载智能体,而 Paseo 无法锁定同一时刻从另一个客户端发送的消息,该消息可能被中断。
36
+ - Paseo 不会说明回合为何失败,并且会把因限制而停止的 Claude 回合报告为已完成,因此只有当插件在回合结束后重新读取的限制数据显示账号已用尽时,才会出现限制行。提供商未报告的限制不会触发该行,插件无法确认其账号的智能体也不会。该提供商的账号切换关闭时,不会给出任何切换建议。
37
+ - Paseo 的 Usage 视图可能会把同一个托管账号显示两次:在你打开使用该账号的智能体的用量详情后,Paseo 自带的 Claude 或 Codex 卡片可能会出现在 Account Switcher 卡片旁边。插件无法合并不同来源的卡片。
32
38
  - 不同套餐提供的模型不同:切换到不提供该智能体模型的套餐后,下一条消息会失败。对于 Codex,切换器会将智能体的模型与该账号套餐提供的模型进行比较,并在 **Apply** 前给出提示。Claude 不报告其模型,因此 Claude 没有此项检查。
33
39
  - Codex 的 **In browser** 登录必须在守护进程所在的电脑上完成。在其他设备上请使用 **Device code**。
34
40
  - 提供商可能更改限制格式。插件无法读取的值显示为无数据。
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- <img src="assets/icon.png" width="88" align="right" alt="">
1
+ ![Account Switcher: switch the account, keep the chat. A Codex agent moves from a used-up account to another with /account, and the chat records the switch.](docs/preview.png)
2
2
 
3
3
  # Account Switcher for Paseo
4
4
 
@@ -11,9 +11,11 @@ Listed in the [Paseo plugin directory](https://paseo.sh/plugins/dutchakdev/accou
11
11
  ![Accounts in Paseo: two Claude accounts with their 5-hour and weekly limits and the start of a Codex account. Personal details are redacted.](docs/assets/accounts.png)
12
12
 
13
13
  - **Sign in from Paseo.** Add an account, finish the official provider sign-in, and return to your chat.
14
- - **Switch per agent.** The account chip opens a dialog on desktop or a bottom sheet on mobile. Changes apply only when you choose **Apply** or type `/account name`.
14
+ - **Switch per agent.** The account chip opens a dialog on desktop or a bottom sheet on mobile. A chat changes account only through **Apply**, `/account name`, the switch button the chat offers when a limit runs out, or automatic switching in that case, if you turn it on.
15
15
  - **Keep your setup.** Profiles separate credentials while sharing provider settings, skills, and session history.
16
16
  - **Track account limits.** See used and remaining percentages, reset times, and freshness for every reported window.
17
+ - **See them in Paseo's own usage.** Signed-in accounts appear in Paseo's Usage view, and an agent's usage popover shows the account that agent runs on.
18
+ - **Carry on when a limit runs out.** When a turn stops because its account's limit is used up, the chat offers a switch to an account with room and continues there. Switching automatically is opt-in.
17
19
  - **Switch from the keyboard.** Type `/account work` in a chat, or pick **Make “Work” the Codex default** in the Command Center (⌘K).
18
20
  - **See it in the chat.** A line in the chat records applied switches, and why a new agent did not start on the default.
19
21
  - **Use a default.** Choose the account used by new agents for each provider. When the latest limits show it would fail, a new agent starts on another signed-in account instead.
@@ -29,7 +31,7 @@ The interface is in English. Reset dates use the viewing device's local time zon
29
31
 
30
32
  ## Install
31
33
 
32
- Paseo plugins are trusted, unsandboxed code with the daemon user's access to files, processes, credentials, and network. Account Switcher reads your Claude and Codex sign-ins to identify accounts and check their limits, and it sends no model messages. The commands below target the local daemon; for another host, see [remote daemons](docs/installation.md#remote-daemons).
34
+ Paseo plugins are trusted, unsandboxed code with the daemon user's access to files, processes, credentials, and network. Account Switcher reads your Claude and Codex sign-ins to identify accounts and check their limits, and checking limits sends no model messages. The only message it sends to an agent is **Continue.**, after you switch from the row a used-up limit adds to the chat, or after an automatic switch that followed a failed turn. The commands below target the local daemon; for another host, see [remote daemons](docs/installation.md#remote-daemons).
33
35
 
34
36
  On Paseo 0.11.0 or a later release, including 0.12, 0.13 and 0.14, install the reviewed version from the plugin directory:
35
37
 
@@ -54,7 +56,7 @@ To review or change the source first, install a [local checkout](docs/installati
54
56
  ## First run
55
57
 
56
58
  1. In Paseo, turn on **Settings → Plugins → Enable plugins**.
57
- 2. Check that `paseo plugin ls account-switcher` shows **running**, then open **Accounts** in the sidebar or **Accounts and limits** in the Command Center.
59
+ 2. Check that `paseo plugin ls account-switcher` shows **running**, then open **Accounts** in the sidebar or **Accounts and limits** in the Command Center. An app without Paseo's current screen API shows the same Accounts through the older surface API.
58
60
  3. Accounts lists the sign-ins your daemon already uses as **Current CLI · Claude** and **Current CLI · Codex**. A provider without its CLI has no Current CLI entry.
59
61
  4. Select **Enable** in Accounts. This is separate from Paseo's plugin switch: the plugin saves your original Claude and Codex commands and points Paseo at its launchers. It leaves running chats alone, and **Disable** restores the original commands.
60
62
 
@@ -120,19 +122,37 @@ The Command Center (⌘K) lists **Make “name” the Claude default** and **Mak
120
122
 
121
123
  The chat records the account in a quiet line:
122
124
 
123
- - after an applied switch: *Account switched from Work to Second.*
125
+ - after an applied switch: *Account switched from Work to Second.* A switch made from a [failover row](#when-a-limit-runs-out-during-a-chat) is reported on that row instead.
124
126
  - when a new agent did not start on the default: *Starting on Second: the default Work has used up a limit.* The other reasons are a plan without the agent's model, a default that needs sign-in, and a default whose sign-in could not be checked. The line is written as the agent is created, before its CLI confirms the launch.
125
127
 
126
128
  These lines live in the daemon's memory, like other plugin timeline rows: they stay through reconnects and refetches, but not a daemon restart. They are best effort: when the host refuses a line, the switch still stands and the plugin log records why.
127
129
 
128
130
  You can select an account during a response, but it is **never applied automatically**. **Cancel selection** clears it. **All accounts** opens the full account list.
129
131
 
130
- Apply reloads the agent through Paseo while preserving its native session ID. The plugin confirms the new account only after startup confirmation and successful reload. If a switch fails, it attempts to restore the previous account. **Account not confirmed** means the running account could not be established; select an account and apply again.
132
+ Apply reloads the agent through Paseo while preserving its native session ID. The plugin confirms the new account only after startup confirmation and successful reload. If a switch fails once the reload has started, it attempts to restore the previous account. A switch refused before that, for example because the agent is responding or the account needs sign-in, changes nothing, and the selection stays for a later **Apply**. **Account not confirmed** means the running account could not be established; select an account and apply again.
131
133
 
132
134
  Plans differ in the models they offer. A free ChatGPT plan, for example, refuses a model that only paid plans have, and the agent's next message fails with `model_not_found`. For Codex, the plugin reads each account's models with its limits; when the selected account's plan does not offer the agent's model, the dialog says so before **Apply** and lists the models it does offer. Claude does not report its models this way, so the dialog shows no such warning for Claude.
133
135
 
134
136
  Different agents can use different accounts in parallel. Avoid sending from another client during Apply: Paseo's native reload has no atomic lock against a concurrent message, which could be interrupted.
135
137
 
138
+ ## When a limit runs out during a chat
139
+
140
+ When a Claude or Codex turn ends because its account's limit is used up, the plugin reads the agent's account again. Codex reports such a turn as failed. Claude reports it as completed, like any other turn, so for a completed Claude turn the plugin first looks at its last reading of the account and reads again only when that already shows the account used up; an ordinary turn costs no provider request. The chat gets a row only if the new reading proves the account is used up: an account-wide limit such as the 5-hour or weekly window is at 100% with its reset still ahead, or Codex reports that ordinary usage is not allowed. Other failures, such as a network error, a tool failure, a plan without the agent's model, or a limit of a single model, add nothing. A Claude account with extra usage turned on keeps answering past a full 5-hour window, paid from its monthly spend allowance; while that allowance has room, a completed Claude turn adds nothing. One used-up account gets one row: later turns on the same account before the same reset add none, and the next time it runs out it is offered again.
141
+
142
+ - With another account available: *Work's limit is used up until 18:00.* and a button **Switch to Second and continue**. The time is the latest reset among the used-up windows, in your local time zone; without a reset time from the provider, the sentence ends at *used up*.
143
+ - Without one: *Work's limit is used up until 18:00. No other account has room.*
144
+
145
+ The offered account is the one a new agent would try instead: a signed-in account of the same provider, not in the middle of a sign-in, not used up, and for Codex with a plan that offers the agent's model. If several qualify, the one with the most room is offered. Agents on **Current CLI** are included. An agent started while no Paseo app was open, by a schedule or `paseo run`, is included too: the plugin confirms its account from the launcher's startup receipt first. An agent whose account nothing confirms gets no row. Nothing is offered while account switching is off for that provider (**Enable** in Accounts).
146
+
147
+ The button switches the chat through the same checks as **Apply** and `/account` (the agent is idle, no permission request is pending, the new account is confirmed at startup), then sends the agent **Continue.** The row follows: *Switching from Work to Second…*, then *Switched from Work to Second.* If the switch is refused or fails, the row says *Could not switch to Second* with the reason:
148
+
149
+ - A refusal before the reload, such as an agent that is responding again, changes nothing and leaves no selection behind.
150
+ - A failure once the reload has started tries to restore the previous account, as with **Apply**.
151
+ - An offer that is out of date is refused: the chat has moved to another account since (*This offer is out of date: the agent now runs on Personal.*), or it already runs on the offered one.
152
+ - An unexpected error shows *The switch failed; the plugin log has details.* Its text, which can name files, goes only to the plugin log.
153
+
154
+ To skip the click, set **When a limit runs out during a chat** to **Switch automatically** under a provider in Accounts. The control appears for a provider with more than one account, and the default is **Offer a switch**. The chat then switches and continues by itself, and the row reads *Switched automatically from Work to Second.* After a completed Claude turn the plugin switches but does not send **Continue.**, because the turn may really have finished; the row reads *Switched automatically from Work to Second. Your next message runs on Second.* The plugin limits this to one automatic switch per turn and three per agent per hour, and never moves an agent back to an account it left within that hour; when a limit stops it, the chat shows the usual offer instead. Like the other chat lines, these rows live in the daemon's memory and are best effort.
155
+
136
156
  ## Read limits
137
157
 
138
158
  Each account shows all reported limit windows, including zero usage. Measured windows show used and remaining percentages and a reset countdown. Codex usage-based workspace plans show their monthly credit allowance as a limit, with the credits left; Claude enterprise seats show their monthly spend allowance the same way. Expand details for exact local reset times, durations, fetch/check timestamps, and windows without data.
@@ -145,6 +165,15 @@ Each account shows all reported limit windows, including zero usage. Measured wi
145
165
 
146
166
  Monitoring sends no model messages. The official CLIs own authentication and token refresh; a native Codex limits request may refresh its token. A Claude access token expires when no Claude session uses the account for several hours. Before a limits check finds it expired, the plugin runs `claude -p /usage --no-session-persistence` under that account, at most every 10 minutes. This local command lets the CLI renew the token, with no model message and no saved session. **Sign in again** appears only when the CLI cannot renew it. See [monitor details](server/usage/README.md) for scheduling, identity verification, and cache behavior.
147
167
 
168
+ ### In Paseo's usage
169
+
170
+ The plugin also reports to Paseo's own Usage view, as the source **Account Switcher**. A daemon without usage sources skips this; Accounts shows the same limits.
171
+
172
+ - It lists each managed account that is signed in, with its plan and limit windows. It leaves out the **Current CLI** accounts, which Paseo's own cards already show, any account signed in as the same login as its provider's **Current CLI** account, and accounts that need sign-in or are in the middle of one.
173
+ - It shows the plugin's last reading and sends no request to a provider when you open the view. A reading marked stale in Accounts shows its last values in Paseo's view without the mark. A limit the provider names without a percentage or an amount (Claude lists a few) is left out, as Paseo's own cards leave it out.
174
+ - An agent bound to a managed account gets that account's profile directory in its session environment, so Paseo's usage popover for the agent reads the account the chat really runs on. The environment is set each time the agent's session opens (a new chat, a resume, or a switch), and only while account switching is on for the provider. Agents on **Current CLI** are unchanged and show the login Paseo uses by default.
175
+ - Known limitation: the Usage view can show one managed account twice. Once you open the usage details of an agent on a managed account, Paseo's own Claude or Codex source finds that login through the agent's session and can add its card, such as *Claude · you@example.com*, next to *Account Switcher · Work*. Both cards show the same account. Paseo keeps cards of different sources apart, so the plugin cannot merge them.
176
+
148
177
  ## Update or remove
149
178
 
150
179
  Plugin directory, npm, and Git installations update with `paseo plugin update account-switcher`, which shows the new revision and asks for approval.
@@ -153,7 +182,7 @@ Before disabling or removing the plugin, select **Disable** in Accounts to resto
153
182
 
154
183
  ## Scope
155
184
 
156
- This project supports manual, same-provider switching with subscription accounts. Automatic account rotation, API-key authentication, and Claude-to-Codex transfers are outside its scope. Provider authentication and limit formats can change with CLI versions; unsupported data is shown as unavailable.
185
+ This project supports same-provider switching with subscription accounts. Switching is manual, except for the opt-in automatic switch after a turn stopped on a used-up limit. Rotating accounts to spread usage, API-key authentication, and Claude-to-Codex transfers are outside its scope. Provider authentication and limit formats can change with CLI versions; unsupported data is shown as unavailable.
157
186
 
158
187
  Automated tests cover the implementation with synthetic accounts and provider responses. They do not establish real A → B → A switching, compaction, child-session behavior, or rewind for your accounts. Recorded checks and remaining live verification are in [verification](docs/verification.md).
159
188
 
@@ -7,9 +7,9 @@ in this launcher list.
7
7
 
8
8
  | Package | Bundled version | License | Full text |
9
9
  | --- | --- | --- | --- |
10
- | `@getpaseo/plugin` | 0.8.0 | Apache-2.0, with the upstream third-party component exception | [Paseo license](licenses/paseo-0.8.0.txt) |
10
+ | `@getpaseo/plugin` | 0.11.4 | Apache-2.0, with the upstream third-party component exception | [Paseo license](licenses/paseo-0.11.4.txt) |
11
11
  | `@iarna/toml` | 2.2.5 | ISC | [TOML license](licenses/iarna-toml-2.2.5.txt) |
12
- | `zod` | 4.6.5 | MIT | [Zod license](licenses/zod-4.6.5.txt) |
12
+ | `zod` | 4.6.7 | MIT | [Zod license](licenses/zod-4.6.7.txt) |
13
13
 
14
14
  `npm run build` preserves esbuild's legal comments and embeds each complete
15
15
  license, including copyright and permission notices, directly in the standalone
@@ -25,14 +25,14 @@ otherwise unmodified. The emitted Paseo code comes from the SDK's `rpc`,
25
25
 
26
26
  - **Paseo:** copyright 2025-present Mohamed Boudra. The published SDK package
27
27
  does not include a license file, so the complete file is copied from the
28
- matching upstream [`v0.8.0` release](https://github.com/getpaseo/paseo/blob/v0.8.0/LICENSE),
29
- commit [`b8e24677e12b226c7c38c1c3a40649daa9f1152f`](https://github.com/getpaseo/paseo/blob/b8e24677e12b226c7c38c1c3a40649daa9f1152f/LICENSE).
28
+ matching upstream [`v0.11.4` release](https://github.com/getpaseo/paseo/blob/v0.11.4/LICENSE),
29
+ commit [`dc5b02f7d7c120baea380d76def8b968020d8823`](https://github.com/getpaseo/paseo/blob/dc5b02f7d7c120baea380d76def8b968020d8823/LICENSE).
30
30
  It retains the upstream statement that third-party components keep their own
31
31
  licenses. That release has no separate root or plugin-package `NOTICE` file.
32
32
  - **`@iarna/toml`:** copyright 2016 Rebecca Turner. The full text is copied
33
33
  byte for byte from `@iarna/toml@2.2.5/LICENSE` in the installed npm package.
34
34
  - **Zod:** copyright 2025 Colin McDonnell. The full text is copied byte for byte
35
- from `zod@4.6.5/LICENSE` in the installed npm package.
35
+ from `zod@4.6.7/LICENSE` in the installed npm package.
36
36
 
37
37
  ## Updating dependencies
38
38
 
@@ -1,9 +1,9 @@
1
1
  import { useRpc, type PluginSurfaceProps } from "@getpaseo/plugin/client";
2
2
  import { useState } from "react";
3
3
  import { ScrollView, Text, View } from "react-native";
4
- import { addAccount, cancelLogin, checkLogin, cliName, missingCli, refreshUsage, removeAccount, renameAccount, setDefaultAccount, setFallback, setIntegration, startLogin,
4
+ import { addAccount, cancelLogin, checkLogin, cliName, missingCli, refreshUsage, removeAccount, renameAccount, setAutoFailover, setDefaultAccount, setFallback, setIntegration, startLogin,
5
5
  type Account, type AccountState, type LoginSession, type Provider, type UsageSnapshot } from "../shared/contracts";
6
- import { body, Button, Field, heading, IconButton, InlineAction, muted, Notice, QuotaSummary, row, Segmented, StatusDot, toneColor } from "./components";
6
+ import { body, Button, Field, heading, IconButton, InlineAction, muted, Notice, QuotaSummary, row, Segmented, StatusDot, toneColor, type ThemeProps } from "./components";
7
7
  import { useAccountsData, useAction, useNow } from "./data";
8
8
  import { accountStatus, errorMessage, providerName } from "./format";
9
9
  import { accountAvailable, addOrResumeLogin, type LoginMode } from "./login";
@@ -148,6 +148,21 @@ function AddAccountForm({ theme, host, onChanged, initialProvider, options, onCl
148
148
  </View>;
149
149
  }
150
150
 
151
+ /** Whether a chat whose turn ran out of its account's limit offers a switch or makes it. `run` is the screen's action lock. */
152
+ export function AutoFailoverSetting({ theme, provider, enabled, disabled, run }: ThemeProps & {
153
+ provider: Provider; enabled: boolean; disabled: boolean; run(action: () => Promise<unknown>): void;
154
+ }) {
155
+ const save = useRpc(setAutoFailover);
156
+ return <View style={{ gap: 4 }}>
157
+ <Segmented theme={theme} label="When a limit runs out during a chat" value={enabled ? "auto" : "offer"} disabled={disabled}
158
+ onChange={(value) => run(() => save({ provider, enabled: value === "auto" }))}
159
+ options={[{ value: "offer", label: "Offer a switch" }, { value: "auto", label: "Switch automatically" }]} />
160
+ <Text style={muted(theme)}>{enabled
161
+ ? "When a turn fails because its account's limit is used up, the chat moves to another signed-in account and continues, at most three times an hour."
162
+ : "When a turn fails because its account's limit is used up, the chat offers to move to another signed-in account."}</Text>
163
+ </View>;
164
+ }
165
+
151
166
  export function AccountsSurface(props: AccountsProps) {
152
167
  const { theme, layout, host, runtimeError, onChanged } = props;
153
168
  const { accounts, usage } = useAccountsData(host.id);
@@ -204,6 +219,7 @@ export function AccountsSurface(props: AccountsProps) {
204
219
  ? "A new agent starts on another signed-in account when the latest limits show the default would fail."
205
220
  : "New agents always start on the default, even when its limits are used up."}</Text>
206
221
  </View> : null}
222
+ {group.length > 1 ? <AutoFailoverSetting theme={theme} provider={provider} enabled={state.autoFailover[provider]} disabled={action.isPending} run={action.run} /> : null}
207
223
  {!status.available ? <Notice theme={theme}>{missingCli(provider)}</Notice>
208
224
  : enabled && !status.integrated ? <View style={{ flexDirection: "row", alignItems: "center", gap: 8, flexWrap: "wrap" }}>
209
225
  <View style={{ flex: 1, minWidth: 200 }}><Notice theme={theme} tone="warning">Account switching is off for {cliName[provider]}: its agents use the system CLI.</Notice></View>
@@ -0,0 +1,49 @@
1
+ import type { PluginCommandCapabilities, PluginTimelineItemProps } from "@getpaseo/plugin/client";
2
+ import { Icon } from "@getpaseo/plugin/client/react-native";
3
+ import { useRef, useState } from "react";
4
+ import { Text, View } from "react-native";
5
+ import { applyFailover } from "../shared/contracts";
6
+ import { failoverAction, failoverText, type FailoverRow } from "../shared/failover";
7
+ import { Button, muted } from "./components";
8
+ import { errorMessage } from "./format";
9
+
10
+ /** The local time a limit lifts: "18:00" today, with the day when it is another one. */
11
+ export function resetTime(value: string, now = Date.now()): string {
12
+ const at = new Date(value);
13
+ if (!Number.isFinite(at.getTime())) return value;
14
+ const time = at.toLocaleTimeString(undefined, { hour: "2-digit", minute: "2-digit" });
15
+ return at.toDateString() === new Date(now).toDateString() ? time : `${at.toLocaleDateString(undefined, { weekday: "short", month: "short", day: "numeric" })}, ${time}`;
16
+ }
17
+
18
+ /** The failover row's renderer. It calls the RPC through the client handed in at registration, not `useRpc`:
19
+ * an app may draw timeline rows outside the plugin's RPC provider, where the hook throws while rendering. */
20
+ export function createFailoverRow(rpc: PluginCommandCapabilities["rpc"]) {
21
+ /** A turn ran out of its account's limit: the offer to switch, then what came of it. The daemon rewrites the row with the outcome. */
22
+ return function FailoverRowView({ theme, agentId, item }: PluginTimelineItemProps<FailoverRow>) {
23
+ // A synchronous lock also blocks a second press before React renders the pending state.
24
+ const lock = useRef(false);
25
+ const [pending, setPending] = useState(false);
26
+ const [error, setError] = useState<string | null>(null);
27
+ const row = item.data, action = failoverAction(row);
28
+ const press = () => {
29
+ if (!action || lock.current) return;
30
+ lock.current = true; setPending(true); setError(null);
31
+ // The account the offer moves from lets the daemon refuse an offer that is out of date; older rows lack it.
32
+ void rpc(applyFailover, { agentId, accountId: action.accountId, rowId: row.rowId, ...(row.fromId ? { fromId: row.fromId } : {}) })
33
+ .catch((failure: unknown) => setError(errorMessage(failure)))
34
+ .finally(() => { lock.current = false; setPending(false); });
35
+ };
36
+ const failed = row.state === "failed";
37
+ return <View style={{ gap: 6, paddingVertical: 4 }}>
38
+ <View accessibilityRole={failed ? "alert" : "text"} style={{ flexDirection: "row", alignItems: "center", gap: 6 }}>
39
+ <Icon name="Users" size={14} color={failed ? theme.colors.statusDanger : theme.colors.foregroundMuted} />
40
+ <Text selectable style={{ ...muted(theme), ...(failed ? { color: theme.colors.statusDanger } : null), flexShrink: 1 }}>{failoverText(row, resetTime)}</Text>
41
+ </View>
42
+ {action ? <View style={{ alignSelf: "flex-start" }}>
43
+ <Button theme={theme} variant="primary" disabled={pending} onPress={press}>{pending ? "Switching…" : action.label}</Button>
44
+ </View> : null}
45
+ {/* Once the daemon has rewritten the row, the row itself shows the reason. */}
46
+ {action && error ? <Text selectable accessibilityRole="alert" style={{ ...muted(theme), color: theme.colors.statusDanger }}>{error}</Text> : null}
47
+ </View>;
48
+ };
49
+ }
package/client/runtime.ts CHANGED
@@ -5,7 +5,8 @@ import { currentAccount, currentAccountName, errorMessage, supportedProvider, us
5
5
 
6
6
  // npm installs omit devDependencies, so `@getpaseo/client` types are named through the host SDK entry.
7
7
  type PaseoAgent = Awaited<ReturnType<PluginClientContext["paseo"]["agents"]["list"]>>["entries"][number]["agent"];
8
- // New hosts return an owned observation; the pinned 0.8 SDK predates this handle.
8
+ // The owned observation a subscribed listing returns. Only `release` is used, so that much is declared here instead of
9
+ // naming the client SDK's type, which npm installs omit.
9
10
  type DirectorySubscription = { release(): Promise<void> };
10
11
 
11
12
  export type PillTarget = Readonly<{ workspaceId: string; agentId: string }>;
@@ -0,0 +1,30 @@
1
+ import type { PluginClientContext, PluginScreenProps, PluginSidebarItemProps, PluginSurfaceProps } from "@getpaseo/plugin/client";
2
+ import { SidebarRow } from "@getpaseo/plugin/client/ui";
3
+ import { createElement, type ComponentType } from "react";
4
+
5
+ const SCREEN_ID = "accounts";
6
+ const TITLE = "Accounts";
7
+ const ICON = "Users";
8
+
9
+ function AccountsSidebarRow({ currentScreen, openScreen }: PluginSidebarItemProps) {
10
+ return createElement(SidebarRow, { icon: ICON, active: currentScreen?.screenId === SCREEN_ID, onPress: () => openScreen({ screenId: SCREEN_ID }) });
11
+ }
12
+
13
+ // The screen API replaced surfaces in Paseo 0.11; both names exist through 0.14. Ask the app what it has, not its version.
14
+ // Each registration is decided on its own, so an app that has only half of the new API still gets both pieces.
15
+ export function registerAccountsScreen(client: PluginClientContext, Component: ComponentType<PluginScreenProps>): () => void {
16
+ const removeScreen = typeof client.addScreen === "function"
17
+ ? client.addScreen({ id: SCREEN_ID, title: TITLE, Component })
18
+ // A surface has no params; the screen component still gets the empty ones it was typed for.
19
+ : client.addSurface(SCREEN_ID, (props: PluginSurfaceProps) => createElement(Component, { ...props, params: {} }));
20
+ const removeRow = typeof client.addSidebarHeaderItem === "function"
21
+ ? client.addSidebarHeaderItem({ id: SCREEN_ID, title: TITLE, Component: AccountsSidebarRow })
22
+ : client.addSidebarItem({ id: SCREEN_ID, title: TITLE, icon: ICON, surface: SCREEN_ID });
23
+ return () => { removeRow(); removeScreen(); };
24
+ }
25
+
26
+ // Called on the object, not on detached methods: the app's functions may rely on their receiver.
27
+ export function openAccounts(capabilities: { openScreen?: (input: { screenId: string }) => void; openSurface?: (id: string) => void }): void {
28
+ if (typeof capabilities.openScreen === "function") capabilities.openScreen({ screenId: SCREEN_ID });
29
+ else capabilities.openSurface?.(SCREEN_ID);
30
+ }
package/index.client.tsx CHANGED
@@ -1,17 +1,20 @@
1
- import type { PluginButtonIconProps, PluginClientContext, PluginSurfaceProps } from "@getpaseo/plugin/client";
1
+ import type { PluginButtonIconProps, PluginClientContext, PluginScreenProps } from "@getpaseo/plugin/client";
2
2
  import { Icon, Modal } from "@getpaseo/plugin/client/react-native";
3
3
  import { useSyncExternalStore } from "react";
4
4
  import { applySwitch, listAccounts, listUsage, prepareSwitch } from "./shared/contracts";
5
+ import { FAILOVER_KIND, FAILOVER_VERSION, FailoverRowSchema } from "./shared/failover";
5
6
  import { ACCOUNT_NOTE_KIND, ACCOUNT_NOTE_VERSION, AccountNoteSchema } from "./shared/timeline";
6
7
  import { AccountsSurface } from "./client/accounts";
7
8
  import { runAccountCommand } from "./client/command";
9
+ import { createFailoverRow } from "./client/failover-row";
8
10
  import { AccountNoteRow } from "./client/note";
9
11
  import { supportedProvider } from "./client/format";
10
12
  import { createClientRuntime } from "./client/runtime";
13
+ import { openAccounts, registerAccountsScreen } from "./client/screens";
11
14
  import { AgentSwitcher } from "./client/switcher";
12
15
 
13
16
  export default function contribute(client: PluginClientContext) {
14
- const openAccounts = () => client.openSurface("accounts");
17
+ const showAccounts = () => openAccounts(client);
15
18
  const runtime = createClientRuntime(client, AccountIcon);
16
19
  // Stable component identity keeps the host modal mounted across label updates.
17
20
  function AccountIcon(props: PluginButtonIconProps) {
@@ -24,19 +27,18 @@ export default function contribute(client: PluginClientContext) {
24
27
  onOpenChange={(next) => { if (!next && open && target) runtime.closeModal(target); }}>
25
28
  {open && target ? <Modal.Content style={{ backgroundColor: props.theme.colors.surface0 }}>
26
29
  <AgentSwitcher {...props} agentId={target.agentId} close={() => runtime.closeModal(target)}
27
- onChanged={runtime.refresh} runtimeError={runtimeError} openAccounts={openAccounts} />
30
+ onChanged={runtime.refresh} runtimeError={runtimeError} openAccounts={showAccounts} />
28
31
  </Modal.Content> : null}
29
32
  </Modal>
30
33
  </>;
31
34
  }
32
- function Accounts(props: PluginSurfaceProps) {
35
+ function Accounts(props: PluginScreenProps) {
33
36
  const runtimeError = useSyncExternalStore(runtime.subscribe, runtime.getError, runtime.getError);
34
37
  return <AccountsSurface {...props} onChanged={runtime.refresh} runtimeError={runtimeError} />;
35
38
  }
36
- const removeSurface = client.addSurface("accounts", Accounts);
37
- const removeSidebar = client.addSidebarItem({ id: "accounts", title: "Accounts", icon: "Users", surface: "accounts" });
39
+ const removeScreen = registerAccountsScreen(client, Accounts);
38
40
  const removeCommand = client.addCommandCenterItem({ id: "accounts", title: "Accounts and limits", icon: "Users", context: "global",
39
- keywords: ["accounts", "quota", "claude", "codex", "limits", "account"], onSelect: ({ openSurface }) => openSurface("accounts") });
41
+ keywords: ["accounts", "quota", "claude", "codex", "limits", "account"], onSelect: openAccounts });
40
42
  const removeSlash = client.addSlashCommand({ name: "account", description: "Switch this chat's account, or open the account switcher",
41
43
  argumentHint: "[account name | default]", context: "agent",
42
44
  async onSubmit({ args, agent, rpc, paseo }) {
@@ -51,5 +53,8 @@ export default function contribute(client: PluginClientContext) {
51
53
  }).finally(runtime.refresh);
52
54
  } });
53
55
  const removeNote = client.addTimelineRenderer({ kind: ACCOUNT_NOTE_KIND, version: ACCOUNT_NOTE_VERSION, schema: AccountNoteSchema, Component: AccountNoteRow });
54
- return () => { runtime.stop(); removeNote(); removeSlash(); removeCommand(); removeSidebar(); removeSurface(); };
56
+ // Created once, so the renderer keeps its identity; the RPC is called on the client, which may rely on its receiver.
57
+ const FailoverRowView = createFailoverRow((contract, input) => client.rpc(contract, input));
58
+ const removeFailover = client.addTimelineRenderer({ kind: FAILOVER_KIND, version: FAILOVER_VERSION, schema: FailoverRowSchema, Component: FailoverRowView });
59
+ return () => { runtime.stop(); removeFailover(); removeNote(); removeSlash(); removeCommand(); removeScreen(); };
55
60
  }