paseo-plugin-account-switcher 0.2.0 → 0.3.2
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 +26 -0
- package/README.md +37 -40
- package/client/accounts.tsx +22 -8
- package/client/runtime.ts +18 -3
- package/client/switcher.tsx +10 -4
- package/package.json +3 -1
- package/paseo-plugin.json +1 -1
- package/server/auth.ts +2 -1
- package/server/controller.ts +9 -3
- package/server/integration.ts +31 -16
- package/server/launcher-artifact.ts +1 -1
- package/server/store.ts +7 -3
- package/server/switching.ts +20 -8
- package/shared/contracts.ts +6 -0
package/OVERVIEW.md
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
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.
|
|
2
|
+
|
|
3
|
+
## How it works
|
|
4
|
+
|
|
5
|
+
- Each account you add gets its own credential profile. Settings, skills, and session history stay shared with your existing CLI setup, so a profile is not a sandbox.
|
|
6
|
+
- **Enable** in Accounts points Paseo's Claude and Codex commands at the plugin's launchers, which start the official CLI under the agent's account. **Disable** restores the original commands; use it before removing the plugin.
|
|
7
|
+
- The account chip in the composer opens the switcher for that chat. Your selection applies only when you choose **Apply** while the agent is idle with no pending permission request, and Paseo reloads the agent with its session intact.
|
|
8
|
+
|
|
9
|
+
## Setup
|
|
10
|
+
|
|
11
|
+
- Paseo 0.8 to 0.12 on a macOS or Linux daemon, with Node.js 22.12 or newer.
|
|
12
|
+
- The official Paseo CLI and at least one of Claude Code or Codex on the daemon. A provider without its CLI shows as unavailable; after you install it, reload the plugin and select **Enable** in that provider's section.
|
|
13
|
+
- A Claude or ChatGPT subscription for each account. API keys are not supported. Adding an account runs the official CLI sign-in from Paseo.
|
|
14
|
+
|
|
15
|
+
## What it reads and sends
|
|
16
|
+
|
|
17
|
+
- 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.
|
|
18
|
+
- Claude limits come from a request to `api.anthropic.com` with the account's access token. Codex limits come from the official `codex app-server`, which asks OpenAI and may refresh the account's token. No model messages are sent.
|
|
19
|
+
- 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.
|
|
20
|
+
- Removing a managed account deletes its profile and stored sign-in, including a Claude account's Keychain item on macOS. Shared session history stays.
|
|
21
|
+
|
|
22
|
+
## Limitations
|
|
23
|
+
|
|
24
|
+
- 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.
|
|
25
|
+
- Codex's **In browser** sign-in must finish on the daemon's computer. From another device, use **Device code**.
|
|
26
|
+
- Providers can change their limit formats. Values the plugin cannot read show as no data.
|
package/README.md
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
# Account Switcher for Paseo
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://github.com/dutchakdev/paseo-plugin-account-switcher/actions/workflows/ci.yml) [](https://www.npmjs.com/package/paseo-plugin-account-switcher)
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Use several Claude and ChatGPT/Codex subscription accounts in Paseo. Choose an account for each agent, switch the account of an existing chat, and see the limits of every saved account.
|
|
6
|
+
|
|
7
|
+
Listed in the [Paseo plugin directory](https://paseo.sh/plugins/dutchakdev/account-switcher) and on [paseo.cafe](https://paseo.cafe/plugins/account-switcher/).
|
|
8
|
+
|
|
9
|
+

|
|
6
10
|
|
|
7
11
|
- **Sign in from Paseo.** Add an account, finish the official provider sign-in, and return to your chat.
|
|
8
12
|
- **Switch per agent.** The account chip opens a dialog on desktop or a bottom sheet on mobile. Changes apply only when you choose **Apply**.
|
|
@@ -12,44 +16,43 @@ Use multiple Claude and ChatGPT/Codex subscription accounts in Paseo. Choose an
|
|
|
12
16
|
|
|
13
17
|
## Requirements
|
|
14
18
|
|
|
15
|
-
- **Paseo 0.8.x, 0.9.x, 0.10.x, or 0.
|
|
19
|
+
- **Paseo 0.8.x, 0.9.x, 0.10.x, 0.11.x, or 0.12.x**, including beta releases, on a **macOS or Linux** daemon and on the connected client.
|
|
16
20
|
- **Node.js 22.12.0 or newer**, with npm.
|
|
17
|
-
-
|
|
21
|
+
- The official **Paseo** CLI and at least one of **Claude Code** or **Codex** available to the daemon. A provider whose CLI is missing is skipped; after installing it, reload the plugin and select **Enable** in its section.
|
|
18
22
|
- Claude or ChatGPT subscription authentication. API keys and custom authentication/provider overrides are unsupported.
|
|
19
23
|
|
|
20
24
|
The interface is in English. Reset dates use the viewing device's local time zone. See [installation](docs/installation.md) for remote hosts and [verification](docs/verification.md) for the scope of recorded testing.
|
|
21
25
|
|
|
22
|
-
##
|
|
26
|
+
## Install
|
|
27
|
+
|
|
28
|
+
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).
|
|
23
29
|
|
|
24
|
-
|
|
30
|
+
On Paseo 0.11.0 or a later release, including 0.12, install the reviewed version from the plugin directory:
|
|
25
31
|
|
|
26
32
|
```sh
|
|
27
|
-
paseo plugin
|
|
33
|
+
paseo plugin add dutchakdev/account-switcher
|
|
28
34
|
```
|
|
29
35
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
36
|
+
On Paseo 0.9 and 0.10, and on the 0.11.0 betas, install from npm. On 0.11 and 0.12, npm also gets a new version before the directory approves it:
|
|
37
|
+
|
|
38
|
+
```sh
|
|
39
|
+
paseo plugin install npm:paseo-plugin-account-switcher
|
|
40
|
+
```
|
|
35
41
|
|
|
36
|
-
|
|
42
|
+
On Paseo 0.8, install from GitHub. Paseo then runs the manifest's dependency and build steps on the daemon:
|
|
37
43
|
|
|
38
44
|
```sh
|
|
39
|
-
|
|
40
|
-
npm run build
|
|
41
|
-
npm run typecheck
|
|
42
|
-
npm test
|
|
43
|
-
paseo plugin install "$PWD" --host 127.0.0.1:6767
|
|
44
|
-
paseo plugin ls account-switcher --host 127.0.0.1:6767
|
|
45
|
+
paseo plugin install dutchakdev/paseo-plugin-account-switcher
|
|
45
46
|
```
|
|
46
47
|
|
|
47
|
-
|
|
48
|
-
2. Confirm that `account-switcher` is **running**. Open **Accounts** in the sidebar, or **Accounts and limits** in the Command Center.
|
|
49
|
-
3. Your existing **Current CLI · Claude** and **Current CLI · Codex** profiles appear automatically. They use the daemon's existing CLI authentication.
|
|
50
|
-
4. Select **Enable** in Accounts to turn on account switching. This saves the original provider commands and installs the plugin's launchers.
|
|
48
|
+
To review or change the source first, install a [local checkout](docs/installation.md#install-a-local-checkout).
|
|
51
49
|
|
|
52
|
-
|
|
50
|
+
## First run
|
|
51
|
+
|
|
52
|
+
1. In Paseo, turn on **Settings → Plugins → Enable plugins**.
|
|
53
|
+
2. Check that `paseo plugin ls account-switcher` shows **running**, then open **Accounts** in the sidebar or **Accounts and limits** in the Command Center.
|
|
54
|
+
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.
|
|
55
|
+
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.
|
|
53
56
|
|
|
54
57
|
## Add an account
|
|
55
58
|
|
|
@@ -63,18 +66,18 @@ Select **Add**, choose a provider, name the account, and select **Add and sign i
|
|
|
63
66
|
If clipboard access is unavailable, expand **Show sign-in link** and copy its selectable text.
|
|
64
67
|
|
|
65
68
|
- **Claude:** finish on the provider's page. If it gives you an authorization code, paste the **complete code, including the part after `#`**, into **Authorization code** and select **Finish sign-in**.
|
|
66
|
-
- **Codex
|
|
67
|
-
- **Codex
|
|
69
|
+
- **Codex, Device code:** enter the displayed code on the provider's page. Use it from a phone or another computer.
|
|
70
|
+
- **Codex, In browser:** finish in a browser on the **daemon's computer**, because the callback uses localhost. From another device, cancel and choose **Device code**.
|
|
68
71
|
|
|
69
|
-
|
|
72
|
+
After sign-in, the plugin verifies the account and refreshes its limits. To check again, use **Check sign-in** in the account's **⋯** menu. Enter passwords only on the provider's official page.
|
|
70
73
|
|
|
71
74
|
Closing the dialog leaves **Continue sign-in** on the account. **Cancel sign-in** stops the process before releasing the profile. While sign-in is active, the account cannot be applied, made the default, or deleted. A failed start leaves the account available for **Retry sign-in** without creating a duplicate. Plugin reloads stop pending sign-ins; start again afterward.
|
|
72
75
|
|
|
73
76
|
### Manage accounts
|
|
74
77
|
|
|
75
|
-
The **⋯** menu contains refresh, check sign-in, default, sign-in, rename, and
|
|
78
|
+
The **⋯** menu contains refresh, check sign-in, default, sign-in, rename, and remove actions. Account rows show identity, default status, and counts of current and pending agents.
|
|
76
79
|
|
|
77
|
-
Before signing in again, switch agents away from that profile. To
|
|
80
|
+
Before signing in again, switch agents away from that profile. To remove a managed account, clear its default and all current or pending selections first. Removal asks for confirmation. **Archived agents retain their account binding for resume**; restore and switch them before removing the account. **Current CLI** accounts cannot be removed.
|
|
78
81
|
|
|
79
82
|
## Switch an existing chat
|
|
80
83
|
|
|
@@ -82,6 +85,8 @@ Before signing in again, switch agents away from that profile. To delete a manag
|
|
|
82
85
|
2. Under **Switch to**, choose a verified account from the **same provider**. The existing account stays marked **current**; the selected account is **pending**.
|
|
83
86
|
3. When the agent is idle and has no pending permission request, select **Apply “name”**.
|
|
84
87
|
|
|
88
|
+
<img src="docs/assets/account-dialog.png" width="420" alt="The Account dialog for a Claude agent: limits of its current account and the accounts it can switch to.">
|
|
89
|
+
|
|
85
90
|
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.
|
|
86
91
|
|
|
87
92
|
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.
|
|
@@ -92,7 +97,7 @@ Different agents can use different accounts in parallel. Avoid sending from anot
|
|
|
92
97
|
|
|
93
98
|
Each account shows all reported limit windows, including zero usage. Measured windows show used and remaining percentages and a reset countdown. Expand details for exact local reset times, durations, fetch/check timestamps, and windows without data.
|
|
94
99
|
|
|
95
|
-
- Checks run every **5 minutes** in the background and every **
|
|
100
|
+
- Checks run every **5 minutes** in the background and every **minute** while Accounts or the switcher is open.
|
|
96
101
|
- **Refresh** requests new data for one account; the header refresh action covers all accounts. Provider retry delays still apply.
|
|
97
102
|
- Color thresholds are **80%**, **95%**, and **100%** used. Missing data stays **No data**, never an invented zero.
|
|
98
103
|
- Failed requests can retain the last confirmed values as **stale**. Required sign-in, errors, and freshness remain visible.
|
|
@@ -102,17 +107,9 @@ Monitoring sends no model messages. The official CLIs own authentication and tok
|
|
|
102
107
|
|
|
103
108
|
## Update or remove
|
|
104
109
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
```sh
|
|
108
|
-
npm ci --ignore-scripts --legacy-peer-deps
|
|
109
|
-
npm run build
|
|
110
|
-
npm run typecheck
|
|
111
|
-
npm test
|
|
112
|
-
paseo plugin reload account-switcher --host 127.0.0.1:6767
|
|
113
|
-
```
|
|
110
|
+
Plugin directory, npm, and Git installations update with `paseo plugin update account-switcher`, which shows the new revision and asks for approval.
|
|
114
111
|
|
|
115
|
-
Before disabling or removing the plugin, select **Disable** in Accounts to restore the original provider commands. Removal does not delete the separately stored account data. See [update and removal](docs/installation.md#update) for
|
|
112
|
+
Before disabling or removing the plugin, select **Disable** in Accounts to restore the original provider commands. Removal does not delete the separately stored account data. See [update and removal](docs/installation.md#update) for a local checkout, the full steps, and recovery.
|
|
116
113
|
|
|
117
114
|
## Scope
|
|
118
115
|
|
package/client/accounts.tsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
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, refreshUsage, removeAccount, renameAccount, setDefaultAccount, setIntegration, startLogin,
|
|
4
|
+
import { addAccount, cancelLogin, checkLogin, cliName, missingCli, refreshUsage, removeAccount, renameAccount, setDefaultAccount, setIntegration, startLogin,
|
|
5
5
|
type Account, type AccountState, type LoginSession, type Provider, type UsageSnapshot } from "../shared/contracts";
|
|
6
6
|
import { body, Button, Field, heading, IconButton, InlineAction, muted, Notice, QuotaSummary, row, Segmented, StatusDot, toneColor } from "./components";
|
|
7
7
|
import { useAccountsData, useAction, useNow } from "./data";
|
|
@@ -15,6 +15,12 @@ type SignInActions = { onStarted(account: Account, session: LoginSession): void;
|
|
|
15
15
|
|
|
16
16
|
const loginModes = [{ value: "device", label: "Device code" }, { value: "browser", label: "In browser" }] as const;
|
|
17
17
|
const providers = [{ value: "claude", label: providerName.claude }, { value: "codex", label: providerName.codex }] as const;
|
|
18
|
+
type ProviderOption = (typeof providers)[number];
|
|
19
|
+
|
|
20
|
+
// A system account stands for a CLI the daemon does not have. Managed sign-ins stay listed so they can be removed.
|
|
21
|
+
function listed(account: Account, state: AccountState): boolean {
|
|
22
|
+
return state.providers[account.provider].available || account.source === "managed";
|
|
23
|
+
}
|
|
18
24
|
|
|
19
25
|
function AccountCard({ account, state, snapshot, now, theme, layout, host, onChanged, onStarted, onResume }: AccountsProps & SignInActions & {
|
|
20
26
|
account: Account; state: AccountState; snapshot: UsageSnapshot | undefined; now: number;
|
|
@@ -109,7 +115,7 @@ function AccountCard({ account, state, snapshot, now, theme, layout, host, onCha
|
|
|
109
115
|
</View>;
|
|
110
116
|
}
|
|
111
117
|
|
|
112
|
-
function AddAccountForm({ theme, host, onChanged, initialProvider, onClose, onStarted }: AccountsProps & Pick<SignInActions, "onStarted"> & { initialProvider: Provider; onClose(): void }) {
|
|
118
|
+
function AddAccountForm({ theme, host, onChanged, initialProvider, options, onClose, onStarted }: AccountsProps & Pick<SignInActions, "onStarted"> & { initialProvider: Provider; options: readonly ProviderOption[]; onClose(): void }) {
|
|
113
119
|
const add = useRpc(addAccount);
|
|
114
120
|
const login = useRpc(startLogin);
|
|
115
121
|
const action = useAction(host.id, onChanged);
|
|
@@ -128,7 +134,7 @@ function AddAccountForm({ theme, host, onChanged, initialProvider, onClose, onSt
|
|
|
128
134
|
});
|
|
129
135
|
return <View style={{ gap: 10, padding: 12, backgroundColor: theme.colors.surface1, borderColor: theme.colors.border, borderWidth: 1, borderRadius: 10 }}>
|
|
130
136
|
<View style={row}>
|
|
131
|
-
<Segmented<Provider> theme={theme} label="Provider" value={provider} options={
|
|
137
|
+
<Segmented<Provider> theme={theme} label="Provider" value={provider} options={options} onChange={setProvider} disabled={busy || Boolean(created)} />
|
|
132
138
|
{provider === "codex" ? <Segmented<LoginMode> theme={theme} label="ChatGPT sign-in method" value={mode} options={loginModes} onChange={setMode} disabled={busy} /> : null}
|
|
133
139
|
</View>
|
|
134
140
|
<View style={row}>
|
|
@@ -156,18 +162,20 @@ export function AccountsSurface(props: AccountsProps) {
|
|
|
156
162
|
const onResume = (account: Account, sessionId: string) => setSignIn({ account, hostId: host.id, sessionId, autoOpen: false });
|
|
157
163
|
const state = accounts.data;
|
|
158
164
|
const enabled = state?.integration.enabled ?? false;
|
|
165
|
+
const installed = providers.filter((option) => state?.providers[option.value].available ?? true);
|
|
159
166
|
const toggleIntegration = () => action.run(() => integration({ enabled: !enabled }));
|
|
167
|
+
const enableIntegration = () => action.run(() => integration({ enabled: true }));
|
|
160
168
|
return <><ScrollView style={{ flex: 1, backgroundColor: theme.colors.surface0 }} contentContainerStyle={{ padding: layout.compact ? 12 : 20, gap: 12, width: "100%", maxWidth: 960, alignSelf: "center", paddingBottom: 40 }} keyboardShouldPersistTaps="handled">
|
|
161
169
|
<View style={{ flexDirection: "row", alignItems: "center", gap: 8 }}>
|
|
162
170
|
<View style={{ flex: 1, minWidth: 0, gap: 1 }}>
|
|
163
171
|
<Text style={{ color: theme.colors.foreground, fontSize: layout.compact ? 20 : 22, fontWeight: "700" }}>Accounts</Text>
|
|
164
172
|
{state ? <View style={{ flexDirection: "row", alignItems: "center", gap: 6, flexWrap: "wrap" }}>
|
|
165
|
-
<Text style={muted(theme)}>Accounts: {state.accounts.length} · switching {enabled ? "on" : "off"}</Text>
|
|
173
|
+
<Text style={muted(theme)}>Accounts: {state.accounts.filter((account) => listed(account, state)).length} · switching {enabled ? "on" : "off"}</Text>
|
|
166
174
|
{enabled ? <InlineAction theme={theme} disabled={action.isPending} onPress={toggleIntegration}>Disable</InlineAction> : null}
|
|
167
175
|
</View> : <Text style={muted(theme)}>{accounts.isPending ? "Loading…" : "Data unavailable"}</Text>}
|
|
168
176
|
</View>
|
|
169
177
|
<IconButton theme={theme} icon="RefreshCw" label="Refresh all limits" disabled={action.isPending} onPress={() => action.run(() => refresh({}))} />
|
|
170
|
-
<Button theme={theme} variant="primary" disabled={action.isPending} onPress={() => setAdding(adding ? null :
|
|
178
|
+
<Button theme={theme} variant="primary" disabled={action.isPending || (!adding && !installed.length)} onPress={() => setAdding(adding ? null : installed[0]?.value ?? null)}>{adding ? "Close" : "Add"}</Button>
|
|
171
179
|
</View>
|
|
172
180
|
{state && !enabled ? <View style={{ flexDirection: "row", alignItems: "center", gap: 8, flexWrap: "wrap" }}>
|
|
173
181
|
<View style={{ flex: 1, minWidth: 200 }}><Notice theme={theme} tone="warning">Account switching in the composer is off: agents use the system CLI.</Notice></View>
|
|
@@ -178,16 +186,22 @@ export function AccountsSurface(props: AccountsProps) {
|
|
|
178
186
|
{action.error ? <Notice theme={theme} tone="danger">{errorMessage(action.error)}</Notice> : null}
|
|
179
187
|
{accounts.error ? <Notice theme={theme} tone="danger">Could not refresh accounts: {errorMessage(accounts.error)}</Notice> : null}
|
|
180
188
|
{usage.error ? <Notice theme={theme} tone="danger">Could not refresh limits: {errorMessage(usage.error)}</Notice> : null}
|
|
181
|
-
{adding ? <AddAccountForm key={adding} {...props} initialProvider={adding} onStarted={onStarted} onClose={() => setAdding(null)} /> : null}
|
|
189
|
+
{adding ? <AddAccountForm key={adding} {...props} initialProvider={adding} options={installed} onStarted={onStarted} onClose={() => setAdding(null)} /> : null}
|
|
182
190
|
{state ? (["claude", "codex"] as const).map((provider) => {
|
|
183
|
-
const
|
|
191
|
+
const status = state.providers[provider];
|
|
192
|
+
const group = state.accounts.filter((account) => account.provider === provider && listed(account, state));
|
|
184
193
|
return <View key={provider} style={{ gap: 8 }}>
|
|
185
194
|
<View style={{ flexDirection: "row", alignItems: "baseline", gap: 6, paddingTop: 4 }}>
|
|
186
195
|
<Text accessibilityRole="header" style={heading(theme)}>{providerName[provider]}</Text>
|
|
187
196
|
<Text style={muted(theme)}>{group.length}</Text>
|
|
188
197
|
</View>
|
|
198
|
+
{!status.available ? <Notice theme={theme}>{missingCli(provider)}</Notice>
|
|
199
|
+
: enabled && !status.integrated ? <View style={{ flexDirection: "row", alignItems: "center", gap: 8, flexWrap: "wrap" }}>
|
|
200
|
+
<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>
|
|
201
|
+
<Button theme={theme} disabled={action.isPending} onPress={enableIntegration}>Enable</Button>
|
|
202
|
+
</View> : null}
|
|
189
203
|
{group.map((account) => <AccountCard key={account.id} {...props} account={account} state={state} snapshot={usage.data?.accounts.find((item) => item.accountId === account.id)} now={now} onStarted={onStarted} onResume={onResume} />)}
|
|
190
|
-
{!group.length ? <View style={{ flexDirection: "row", alignItems: "center", gap: 6 }}>
|
|
204
|
+
{!group.length && status.available ? <View style={{ flexDirection: "row", alignItems: "center", gap: 6 }}>
|
|
191
205
|
<Text style={muted(theme)}>No accounts.</Text>
|
|
192
206
|
<InlineAction theme={theme} onPress={() => setAdding(provider)}>Add</InlineAction>
|
|
193
207
|
</View> : null}
|
package/client/runtime.ts
CHANGED
|
@@ -4,6 +4,8 @@ import { currentAccount, currentAccountName, errorMessage, supportedProvider, us
|
|
|
4
4
|
|
|
5
5
|
// npm installs omit devDependencies, so `@getpaseo/client` types are named through the host SDK entry.
|
|
6
6
|
type PaseoAgent = Awaited<ReturnType<PluginClientContext["paseo"]["agents"]["list"]>>["entries"][number]["agent"];
|
|
7
|
+
// New hosts return an owned observation; the pinned 0.8 SDK predates this handle.
|
|
8
|
+
type DirectorySubscription = { release(): Promise<void> };
|
|
7
9
|
|
|
8
10
|
export type PillTarget = Readonly<{ workspaceId: string; agentId: string }>;
|
|
9
11
|
|
|
@@ -26,7 +28,14 @@ export function createClientRuntime(client: PluginClientContext, icon: PluginBut
|
|
|
26
28
|
let loadingData = false;
|
|
27
29
|
let queuedRefresh = false;
|
|
28
30
|
let modalTarget: PillTarget | null = null;
|
|
29
|
-
|
|
31
|
+
let observingDirectory = false;
|
|
32
|
+
let directorySubscription: DirectorySubscription | undefined;
|
|
33
|
+
|
|
34
|
+
function releaseDirectory(subscription: DirectorySubscription | undefined) {
|
|
35
|
+
if (subscription) void subscription.release().catch((error) => {
|
|
36
|
+
console.error(`Could not release agent account switchers: ${errorMessage(error)}`);
|
|
37
|
+
});
|
|
38
|
+
}
|
|
30
39
|
|
|
31
40
|
function notify() { for (const listener of listeners) listener(); }
|
|
32
41
|
function closeModal(expected: PillTarget) {
|
|
@@ -82,8 +91,13 @@ export function createClientRuntime(client: PluginClientContext, icon: PluginBut
|
|
|
82
91
|
const listed = new Map<string, PaseoAgent>();
|
|
83
92
|
let cursor: string | undefined;
|
|
84
93
|
do {
|
|
85
|
-
|
|
86
|
-
|
|
94
|
+
// Establish one host-owned observation. Pagination and polling are plain
|
|
95
|
+
// reads, so they neither leak observations nor replace the legacy filter.
|
|
96
|
+
const observe = !observingDirectory && !cursor;
|
|
97
|
+
const result = await client.paseo.agents.list({ scope: "active", page: { limit: 100, ...(cursor ? { cursor } : {}) }, ...(observe ? { subscribe: {} } : {}) });
|
|
98
|
+
const subscription = (result as typeof result & { subscription?: DirectorySubscription }).subscription;
|
|
99
|
+
if (stopped) { releaseDirectory(subscription); return; }
|
|
100
|
+
if (observe) { observingDirectory = true; directorySubscription = subscription; }
|
|
87
101
|
for (const entry of result.entries) listed.set(entry.agent.id, entry.agent);
|
|
88
102
|
const next = result.pageInfo.hasMore ? result.pageInfo.nextCursor ?? undefined : undefined;
|
|
89
103
|
if (next && next === cursor) throw new Error("Could not load the next page of agents.");
|
|
@@ -134,6 +148,7 @@ export function createClientRuntime(client: PluginClientContext, icon: PluginBut
|
|
|
134
148
|
stop() {
|
|
135
149
|
if (stopped) return;
|
|
136
150
|
stopped = true; clearInterval(timer); unsubscribe();
|
|
151
|
+
releaseDirectory(directorySubscription); directorySubscription = undefined;
|
|
137
152
|
if (modalTarget) closeModal(modalTarget);
|
|
138
153
|
listeners.clear();
|
|
139
154
|
for (const { registration } of pills.values()) registration.remove();
|
package/client/switcher.tsx
CHANGED
|
@@ -2,7 +2,7 @@ import { useAgent, usePaseo, useRpc, type PluginHostProps } from "@getpaseo/plug
|
|
|
2
2
|
import { useQuery, useQueryClient } from "@tanstack/react-query";
|
|
3
3
|
import { useEffect, useMemo } from "react";
|
|
4
4
|
import { Pressable, Text, View } from "react-native";
|
|
5
|
-
import { applySwitch, prepareSwitch, refreshUsage } from "../shared/contracts";
|
|
5
|
+
import { applySwitch, cliName, missingCli, prepareSwitch, refreshUsage } from "../shared/contracts";
|
|
6
6
|
import { body, Button, heading, InlineAction, muted, Notice, QuotaSummary, row, StatusDot, tabular } from "./components";
|
|
7
7
|
import { useAccountsData, useAction, useNow } from "./data";
|
|
8
8
|
import { currentAccount, currentAccountName, errorMessage, idleForSwitch, providerName, supportedProvider, usageSummary } from "./format";
|
|
@@ -35,7 +35,13 @@ export function AgentSwitcher({ theme, host, agentId, onChanged, openAccounts, c
|
|
|
35
35
|
const unconfirmed = Boolean(binding && binding.currentAccountId === null);
|
|
36
36
|
const pending = state?.accounts.find((account) => account.id === binding?.pendingAccountId);
|
|
37
37
|
const snapshot = usage.data?.accounts.find((item) => item.accountId === current?.id);
|
|
38
|
-
|
|
38
|
+
// Switching needs the provider CLI and its launcher; integration can cover one provider only.
|
|
39
|
+
const status = state && provider ? state.providers[provider] : undefined;
|
|
40
|
+
const enabled = Boolean(status?.available && status.integrated);
|
|
41
|
+
const off = !state || !provider || enabled ? null
|
|
42
|
+
: !state.providers[provider].available ? missingCli(provider)
|
|
43
|
+
: state.integration.enabled ? `Account switching is off for ${cliName[provider]}. Enable it in Accounts.`
|
|
44
|
+
: "Account switching is disabled in Accounts.";
|
|
39
45
|
const idle = !live.error && idleForSwitch(live.data) && selected?.status === "idle" && selected.attentionReason !== "permission";
|
|
40
46
|
const switching = binding?.status === "switching";
|
|
41
47
|
const disabled = action.isPending || switching || !enabled;
|
|
@@ -57,8 +63,8 @@ export function AgentSwitcher({ theme, host, agentId, onChanged, openAccounts, c
|
|
|
57
63
|
{usage.error ? <Notice theme={theme} tone="danger">{errorMessage(usage.error)}</Notice> : null}
|
|
58
64
|
{live.error ? <Notice theme={theme} tone="danger">Agent status unconfirmed: {errorMessage(live.error)}</Notice> : null}
|
|
59
65
|
{!provider && !live.isPending ? <Notice theme={theme}>Account switching is available for Claude and Codex only.</Notice> : null}
|
|
60
|
-
{
|
|
61
|
-
<View style={{ flex: 1, minWidth: 0 }}><Notice theme={theme} tone="warning">
|
|
66
|
+
{off ? <View style={{ flexDirection: "row", alignItems: "center", gap: 8 }}>
|
|
67
|
+
<View style={{ flex: 1, minWidth: 0 }}><Notice theme={theme} tone="warning">{off}</Notice></View>
|
|
62
68
|
<InlineAction theme={theme} onPress={leave}>Open</InlineAction>
|
|
63
69
|
</View> : null}
|
|
64
70
|
{unconfirmed
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "paseo-plugin-account-switcher",
|
|
3
|
-
"version": "0.2
|
|
3
|
+
"version": "0.3.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "dutchakdev",
|
|
@@ -41,6 +41,7 @@
|
|
|
41
41
|
"esbuild": "^0.25.12",
|
|
42
42
|
"react": "19.1.0",
|
|
43
43
|
"react-native": "0.81.5",
|
|
44
|
+
"semver": "^7.8.5",
|
|
44
45
|
"typescript": "^5.9.3",
|
|
45
46
|
"vitest": "^4.1.11",
|
|
46
47
|
"zod": "^4.4.3"
|
|
@@ -55,6 +56,7 @@
|
|
|
55
56
|
},
|
|
56
57
|
"files": [
|
|
57
58
|
"paseo-plugin.json",
|
|
59
|
+
"OVERVIEW.md",
|
|
58
60
|
"index.client.tsx",
|
|
59
61
|
"index.server.ts",
|
|
60
62
|
"client/",
|
package/paseo-plugin.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"id":"account-switcher","requirements":{"paseo":"^0.8.0 || 0.9.* || 0.10.* || 0.11.*"}}
|
|
1
|
+
{"id":"account-switcher","requirements":{"paseo":"^0.8.0 || 0.9.* || 0.10.* || 0.11.* || 0.12.*"}}
|
package/server/auth.ts
CHANGED
|
@@ -3,12 +3,13 @@ import { lstat, mkdir, readFile, realpath } from "node:fs/promises";
|
|
|
3
3
|
import { createHash } from "node:crypto";
|
|
4
4
|
import { basename, dirname, isAbsolute, join, resolve } from "node:path";
|
|
5
5
|
import type { PaseoApi } from "./paseo-api";
|
|
6
|
-
import type
|
|
6
|
+
import { missingCli, type Provider } from "../shared/contracts";
|
|
7
7
|
import { accountFrom, type AccountStore, type Registry, type StoredAccount } from "./store";
|
|
8
8
|
import { assertManagedCommand, buildAccountEnv, prepareProfile } from "./profiles";
|
|
9
9
|
import { launcherPath, writeLaunchers } from "./integration";
|
|
10
10
|
|
|
11
11
|
export function accountCommand(registry: Registry, provider: Provider): string[] {
|
|
12
|
+
if (!registry.available[provider]) throw new Error(missingCli(provider));
|
|
12
13
|
const command = registry.commands[provider];
|
|
13
14
|
if (!command?.length || !command[0]) throw new Error("The provider CLI is not configured. Enable account integration.");
|
|
14
15
|
return [...command];
|
package/server/controller.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { join, dirname, resolve } from "node:path";
|
|
|
5
5
|
import { lstat, readFile, realpath, rm } from "node:fs/promises";
|
|
6
6
|
import { randomUUID } from "node:crypto";
|
|
7
7
|
import type { PaseoApi } from "./paseo-api";
|
|
8
|
-
import { AccountSchema, type LoginSession, type Provider } from "../shared/contracts";
|
|
8
|
+
import { AccountSchema, missingCli, type LoginSession, type Provider } from "../shared/contracts";
|
|
9
9
|
import { AccountStore, accountFrom, type Registry, type StoredAccount } from "./store";
|
|
10
10
|
import { prepareProfile } from "./profiles";
|
|
11
11
|
import { accountCommand, accountEnvironment, launchLogin, probeAccount, removeAccountCredentials } from "./auth";
|
|
@@ -109,6 +109,7 @@ export class AccountController {
|
|
|
109
109
|
if(existing){if(!verifyCredentials)return existing;await existing.catch(()=>{});return this.checkAccount(id,true);}
|
|
110
110
|
const task=(async()=>{
|
|
111
111
|
const state=await this.store.read(), account=accountFrom(state,id);
|
|
112
|
+
if(!state.available[account.provider])throw new Error(missingCli(account.provider));
|
|
112
113
|
if(account.loginToken)throw new Error("Finish signing in, then click “Check sign-in”.");
|
|
113
114
|
let identity:Awaited<ReturnType<typeof probeAccount>>;
|
|
114
115
|
let stableVersion:string|undefined;
|
|
@@ -144,9 +145,9 @@ export class AccountController {
|
|
|
144
145
|
await this.reconcileLogins();
|
|
145
146
|
const initial=await this.store.read();
|
|
146
147
|
const target=initial.accounts.find(account=>account.id===input.verifyAccountId);
|
|
147
|
-
if(target&&initial.commands[target.provider]&&!target.loginToken)await this.checkAccount(target.id,true).catch(()=>{this.credentialProofs.delete(target.id);});
|
|
148
|
+
if(target&&initial.available[target.provider]&&initial.commands[target.provider]&&!target.loginToken)await this.checkAccount(target.id,true).catch(()=>{this.credentialProofs.delete(target.id);});
|
|
148
149
|
const state=await this.store.read();
|
|
149
|
-
return state.accounts.filter(a=>state.commands[a.provider]&&!a.loginToken).map(account=>this.toQuotaAccount(account,state));
|
|
150
|
+
return state.accounts.filter(a=>state.available[a.provider]&&state.commands[a.provider]&&!a.loginToken).map(account=>this.toQuotaAccount(account,state));
|
|
150
151
|
}
|
|
151
152
|
private toQuotaAccount(account:StoredAccount,state:Registry):QuotaAccount {
|
|
152
153
|
const env=accountEnvironment(account,state);
|
|
@@ -159,6 +160,7 @@ export class AccountController {
|
|
|
159
160
|
}
|
|
160
161
|
async add(provider:Provider,label:string) {
|
|
161
162
|
await this.ready;
|
|
163
|
+
if(!(await this.store.read()).available[provider])throw new Error(missingCli(provider));
|
|
162
164
|
const account=await this.store.add(provider,label);
|
|
163
165
|
try{const state=await this.store.read();await prepareProfile({provider,home:account.home,sourceHome:state.sourceHomes[provider],sourceEnvironment:state.sourceEnvironment[provider]});return AccountSchema.parse(account);}
|
|
164
166
|
catch(error){await this.store.remove(account.id,async()=>{await rm(dirname(account.home),{recursive:true,force:true});});throw error;}
|
|
@@ -312,6 +314,10 @@ export class AccountController {
|
|
|
312
314
|
const host=listen.replace(/^0\.0\.0\.0:/,"127.0.0.1:");
|
|
313
315
|
try{await execFileAsync("paseo",["agent","reload",id,"--json","--host",host],{timeout:120_000,maxBuffer:1024*1024,env:process.env});}
|
|
314
316
|
catch{throw new Error("The native agent reload failed. Check the agent status and try again.");}
|
|
317
|
+
// Paseo 0.11 reloads into an idle session and spawns the CLI on first use; listing
|
|
318
|
+
// commands starts it so the launcher can confirm the account. Older hosts already started it.
|
|
319
|
+
const agent=paseo.agents.ref(id) as {commands?:()=>Promise<unknown>};
|
|
320
|
+
if(agent.commands)await agent.commands().catch(()=>{/* The receipt check reports a failed start. */});
|
|
315
321
|
}});
|
|
316
322
|
this.switches.set(paseo,service);return service;
|
|
317
323
|
}
|
package/server/integration.ts
CHANGED
|
@@ -11,6 +11,7 @@ import { assertSubscriptionEnvironment } from "./profiles";
|
|
|
11
11
|
|
|
12
12
|
const providers = ["claude", "codex"] as const;
|
|
13
13
|
const COMMAND_DRIFT = "Provider commands changed outside the plugin. Enable integration again to apply accounts.";
|
|
14
|
+
export const NO_PROVIDER_CLI = "Provider CLI not found. Install Claude Code or Codex, or configure its command in Paseo.";
|
|
14
15
|
export const launcherPath = (root: string, provider: Provider): string => join(root, "bin", `${provider}-launcher`);
|
|
15
16
|
export async function writeLaunchers(store: AccountStore): Promise<void> {
|
|
16
17
|
for (const provider of providers) await atomicWrite(launcherPath(store.root, provider), LAUNCHER_SOURCE, 0o700);
|
|
@@ -22,7 +23,9 @@ function commandArray(value: unknown): string[] | null {
|
|
|
22
23
|
return [...value];
|
|
23
24
|
}
|
|
24
25
|
function owned(command: string[] | null, wrapper: string): boolean { return command?.length === 1 && command[0] === wrapper; }
|
|
25
|
-
|
|
26
|
+
function sameProviders(left: readonly Provider[], right: readonly Provider[]): boolean { return left.length === right.length && left.every(provider => right.includes(provider)); }
|
|
27
|
+
/** Resolves a provider command to an executable path, or null when no executable exists. */
|
|
28
|
+
async function resolveCommand(command: string[], wrappers: string[]): Promise<string[] | null> {
|
|
26
29
|
if (command.some(part => wrappers.includes(part))) throw new Error("A recursive launcher command was detected. Restore the original CLI.");
|
|
27
30
|
const candidates = isAbsolute(command[0]) || command[0].includes("/") ? [resolve(command[0])] : (process.env.PATH ?? "").split(delimiter).filter(Boolean).map(path => join(path, command[0]));
|
|
28
31
|
for (const candidate of candidates) {
|
|
@@ -33,7 +36,7 @@ async function resolveCommand(command: string[], wrappers: string[]): Promise<st
|
|
|
33
36
|
return [candidate, ...command.slice(1)];
|
|
34
37
|
} catch (error) { if ((error as Error).message === "recursion") throw new Error("A recursive launcher command was detected. Restore the original CLI."); }
|
|
35
38
|
}
|
|
36
|
-
|
|
39
|
+
return null;
|
|
37
40
|
}
|
|
38
41
|
|
|
39
42
|
export async function prepareRuntime(paseo: PaseoApi, store: AccountStore): Promise<void> {
|
|
@@ -41,7 +44,7 @@ export async function prepareRuntime(paseo: PaseoApi, store: AccountStore): Prom
|
|
|
41
44
|
}
|
|
42
45
|
|
|
43
46
|
function disableIntegration(state: Registry, error: string): void {
|
|
44
|
-
state.integration = { enabled: false, error };
|
|
47
|
+
state.integration = { ...state.integration, enabled: false, error };
|
|
45
48
|
for (const binding of state.bindings) {
|
|
46
49
|
const awaitingReceipt = binding.launchToken !== null && binding.currentAccountId === null;
|
|
47
50
|
binding.launchToken = null;
|
|
@@ -52,15 +55,18 @@ function disableIntegration(state: Registry, error: string): void {
|
|
|
52
55
|
}
|
|
53
56
|
|
|
54
57
|
export async function reconcileIntegration(paseo: PaseoApi, store: AccountStore): Promise<void> {
|
|
55
|
-
|
|
58
|
+
const registry = await store.read();
|
|
59
|
+
let ownership: Provider[];
|
|
56
60
|
try {
|
|
57
61
|
const { config } = await paseo.config.get();
|
|
58
62
|
for (const provider of providers) {
|
|
63
|
+
// A provider without a CLI never launches, so its settings cannot affect the other.
|
|
64
|
+
if (!registry.available[provider]) continue;
|
|
59
65
|
assertSubscriptionEnvironment(provider, process.env);
|
|
60
66
|
const environment = config.providers[provider]?.env;
|
|
61
67
|
assertSubscriptionEnvironment(provider, environment && typeof environment === "object" ? environment as Record<string, unknown> : {});
|
|
62
68
|
}
|
|
63
|
-
ownership = providers.
|
|
69
|
+
ownership = providers.filter(provider => owned(commandArray(config.providers[provider]?.command), launcherPath(store.root, provider)));
|
|
64
70
|
} catch {
|
|
65
71
|
const message = "Could not verify Paseo provider commands. Check the configuration and authentication overrides, then enable integration again.";
|
|
66
72
|
await store.change(state => { disableIntegration(state, message); });
|
|
@@ -68,9 +74,9 @@ export async function reconcileIntegration(paseo: PaseoApi, store: AccountStore)
|
|
|
68
74
|
}
|
|
69
75
|
// Restoring the wrapper paths alone cannot authorize old launch receipts.
|
|
70
76
|
// Only explicit installIntegration enables a disabled registry again.
|
|
71
|
-
if (ownership.
|
|
77
|
+
if (ownership.length && sameProviders(ownership, registry.integration.providers)) return;
|
|
72
78
|
await store.change(state => {
|
|
73
|
-
if (state.integration.enabled || ownership.
|
|
79
|
+
if (state.integration.enabled || ownership.length || state.bindings.some(binding => binding.launchToken !== null)) disableIntegration(state, COMMAND_DRIFT);
|
|
74
80
|
});
|
|
75
81
|
}
|
|
76
82
|
|
|
@@ -87,17 +93,23 @@ async function discoverRuntime(paseo: PaseoApi, store: AccountStore) {
|
|
|
87
93
|
const wrappers = providers.map(provider => launcherPath(store.root, provider));
|
|
88
94
|
const commands = { ...registry.commands }, originals = { ...registry.originalCommands }, sourceHomes = { ...registry.sourceHomes };
|
|
89
95
|
const sourceEnvironment: typeof registry.sourceEnvironment = { claude: {}, codex: {} };
|
|
90
|
-
const
|
|
96
|
+
const available = { claude: false, codex: false };
|
|
97
|
+
const ownership: Provider[] = [];
|
|
91
98
|
for (const provider of providers) {
|
|
92
99
|
const current = commandArray(config.providers[provider]?.command);
|
|
93
|
-
ownership.push(owned(current, launcherPath(store.root, provider)));
|
|
94
100
|
if (owned(current, launcherPath(store.root, provider))) {
|
|
101
|
+
ownership.push(provider);
|
|
95
102
|
if (!commands[provider]) throw new Error("The launcher is active without the original CLI command; restore the configuration manually.");
|
|
96
|
-
|
|
103
|
+
// Keep the recorded command when its CLI is gone: restoration still needs it.
|
|
104
|
+
const resolved = await resolveCommand(commands[provider]!, wrappers);
|
|
105
|
+
if (resolved) commands[provider] = resolved;
|
|
106
|
+
available[provider] = resolved !== null;
|
|
97
107
|
} else {
|
|
98
108
|
originals[provider] = current;
|
|
99
109
|
commands[provider] = await resolveCommand(current ?? [provider], wrappers);
|
|
110
|
+
available[provider] = commands[provider] !== null;
|
|
100
111
|
}
|
|
112
|
+
if (!available[provider]) { Object.assign(sourceEnvironment[provider], registry.sourceEnvironment[provider]); continue; }
|
|
101
113
|
const environment = config.providers[provider]?.env;
|
|
102
114
|
const configured = environment && typeof environment === "object" ? environment as Record<string, unknown> : {};
|
|
103
115
|
assertSubscriptionEnvironment(provider, process.env);
|
|
@@ -118,21 +130,24 @@ async function discoverRuntime(paseo: PaseoApi, store: AccountStore) {
|
|
|
118
130
|
const value = provider === "claude" ? sourceEnvironment.claude.CLAUDE_CONFIG_DIR : sourceEnvironment.codex.CODEX_HOME;
|
|
119
131
|
sourceHomes[provider] = typeof value === "string" && isAbsolute(value) ? resolve(value) : join(homedir(), provider === "claude" ? ".claude" : ".codex");
|
|
120
132
|
}
|
|
133
|
+
if (!available.claude && !available.codex) throw new Error(NO_PROVIDER_CLI);
|
|
121
134
|
await writeLaunchers(store);
|
|
122
135
|
// The wrapper must see its originals before the daemon can run provider discovery.
|
|
123
136
|
await store.change(state => {
|
|
124
|
-
state.commands = commands; state.originalCommands = originals; state.sourceHomes = sourceHomes; state.sourceEnvironment = sourceEnvironment;
|
|
125
|
-
if (!ownership.
|
|
137
|
+
state.commands = commands; state.originalCommands = originals; state.sourceHomes = sourceHomes; state.sourceEnvironment = sourceEnvironment; state.available = available;
|
|
138
|
+
if (!sameProviders(ownership, state.integration.providers) && (ownership.length || state.integration.enabled || state.bindings.some(binding => binding.launchToken !== null))) disableIntegration(state, COMMAND_DRIFT);
|
|
126
139
|
for (const account of state.accounts) if (account.source === "system") account.home = sourceHomes[account.provider];
|
|
127
140
|
});
|
|
128
141
|
return config;
|
|
129
142
|
}
|
|
130
143
|
|
|
131
144
|
export async function installIntegration(paseo: PaseoApi, store: AccountStore): Promise<void> {
|
|
132
|
-
const config = await discoverCommands(paseo, store);
|
|
145
|
+
const config = await discoverCommands(paseo, store), { available } = await store.read();
|
|
146
|
+
// A provider without a CLI keeps its Paseo command. One whose launcher is already installed stays owned.
|
|
147
|
+
const integrated = providers.filter(provider => available[provider] || owned(commandArray(config.providers[provider]?.command), launcherPath(store.root, provider)));
|
|
133
148
|
try {
|
|
134
|
-
await paseo.config.patch({ providers: Object.fromEntries(
|
|
135
|
-
await store.change(state => { state.integration = { enabled: true, error: null }; });
|
|
149
|
+
await paseo.config.patch({ providers: Object.fromEntries(integrated.map(provider => [provider, { ...config.providers[provider], command: [launcherPath(store.root, provider)] }])) });
|
|
150
|
+
await store.change(state => { state.integration = { enabled: true, error: null, providers: integrated }; });
|
|
136
151
|
} catch { throw new Error("Paseo did not apply provider integration. Check the configuration and try again."); }
|
|
137
152
|
}
|
|
138
153
|
|
|
@@ -147,6 +162,6 @@ export async function restoreIntegration(paseo: PaseoApi, store: AccountStore):
|
|
|
147
162
|
}
|
|
148
163
|
try {
|
|
149
164
|
if (Object.keys(patch).length) await paseo.config.patch({ providers: patch });
|
|
150
|
-
await store.change(state => { state.integration = { enabled: false, error: null }; });
|
|
165
|
+
await store.change(state => { state.integration = { ...state.integration, enabled: false, error: null }; });
|
|
151
166
|
} catch { throw new Error("Paseo did not restore the original provider commands. Try again."); }
|
|
152
167
|
}
|