@exla/rudder 5.0.14 → 5.0.18

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
@@ -603,9 +603,9 @@ reach an agent (a menu is open in its pane) says so instead of vanishing. Claude
603
603
  panes in the cloud also run with Remote Control, so they appear in the Claude
604
604
  app too.
605
605
 
606
- **Previews.** Enroll the home machine with a Tailscale auth key in the vault
607
- (`rudder cloud secrets set TS_AUTHKEY`). It reuses its persisted login on later
608
- boots. Connect your laptop to the same tailnet and run `rudder cloud preview`
606
+ **Previews.** Connect Tailscale from the app (Settings, or the Get set up card):
607
+ sign in on the link it opens and the cloud machine joins your tailnet. It keeps
608
+ that login on later boots. Connect your laptop to the same tailnet and run `rudder cloud preview`
609
609
  from the project to open its ready dev server, or `rudder cloud preview --list`
610
610
  to inspect the links. Pass a port when several servers are running.
611
611
 
@@ -0,0 +1,37 @@
1
+ export type AccountBackend = "claude" | "codex";
2
+ export declare const ACCOUNT_BACKENDS: readonly AccountBackend[];
3
+ export declare const MAIN_ACCOUNT = "main";
4
+ export type AgentAccount = {
5
+ backend: AccountBackend;
6
+ /** "main", or the extra account's id. */
7
+ id: string;
8
+ dir: string;
9
+ /** New agents on this backend start here. */
10
+ default: boolean;
11
+ };
12
+ type Env = NodeJS.ProcessEnv;
13
+ /** The variable each CLI reads its config dir from. */
14
+ export declare const ACCOUNT_ENV: Record<AccountBackend, string>;
15
+ export declare function isAccountBackend(value: unknown): value is AccountBackend;
16
+ /** The CLI's own config dir under `env`: the main account. */
17
+ export declare function mainAccountDir(backend: AccountBackend, env: Env): string;
18
+ export declare function accountDir(backend: AccountBackend, id: string, env: Env): string;
19
+ /** The env an agent on this account runs with, added to `env`. */
20
+ export declare function accountEnv(backend: AccountBackend, id: string, env: Env): Env;
21
+ /** Every account of every backend, main first, then the others oldest first. */
22
+ export declare function listAccounts(env: Env): Promise<Record<AccountBackend, AgentAccount[]>>;
23
+ /**
24
+ * A new, signed-out account: its dir with the shared parts linked to the main
25
+ * dir. The caller signs it in (the CLI's own login with `accountEnv`) and
26
+ * removes it again if that does not finish.
27
+ */
28
+ export declare function createAccount(backend: AccountBackend, env: Env): Promise<AgentAccount>;
29
+ /**
30
+ * Deletes an extra account's dir (its links go, never what they point at). New
31
+ * agents that started on it move back to main as the default. Sign it out
32
+ * first: on macOS the CLI's keychain entry outlives the dir.
33
+ */
34
+ export declare function removeAccount(backend: AccountBackend, id: string, env: Env): Promise<void>;
35
+ /** Makes `id` the account new agents on `backend` start on. */
36
+ export declare function setDefaultAccount(backend: AccountBackend, id: string, env: Env): Promise<void>;
37
+ export {};
@@ -0,0 +1,231 @@
1
+ /**
2
+ * Several signed-in accounts per agent CLI. An account is a config dir the CLI
3
+ * officially supports moving: `CLAUDE_CONFIG_DIR` for Claude Code, `CODEX_HOME`
4
+ * for Codex.
5
+ *
6
+ * - "main" is the CLI's own dir (`~/.claude`, `~/.codex`, or what the env
7
+ * already points them at). Agents on it run with the env unchanged.
8
+ * - Every other account is `<rudder home>/accounts/<backend>/<id>/`, and its
9
+ * agents run with the CLI's variable set to that dir (native signals.rs).
10
+ *
11
+ * An extra dir holds its own sign-in and links the rest to the main dir: the
12
+ * user's settings, memory, skills and hooks, and the conversation logs. So a
13
+ * chat started on one account resumes on another, and everything that reads
14
+ * transcripts, plans or usage keeps reading the main dir only.
15
+ *
16
+ * The default account of a backend (what new agents start on) is
17
+ * `backends.<backend>.account` in config.json; absent means main.
18
+ *
19
+ * Every function takes the env it resolves paths from: the Cloud home's own
20
+ * process has RUDDER_HOME set to a flag, not a dir (cloud/worker/home.mjs), so
21
+ * it passes the agents' env.
22
+ */
23
+ import fs from "node:fs";
24
+ import fsp from "node:fs/promises";
25
+ import os from "node:os";
26
+ import path from "node:path";
27
+ import { defaultConfig } from "./state.js";
28
+ import { readJson, updateJson } from "./util.js";
29
+ export const ACCOUNT_BACKENDS = ["claude", "codex"];
30
+ export const MAIN_ACCOUNT = "main";
31
+ /** The variable each CLI reads its config dir from. */
32
+ export const ACCOUNT_ENV = {
33
+ claude: "CLAUDE_CONFIG_DIR",
34
+ codex: "CODEX_HOME",
35
+ };
36
+ const ACCOUNT_ID = /^[a-z0-9]{1,32}$/;
37
+ /**
38
+ * What an extra dir links to the main dir, and nothing else: anything not
39
+ * named here is the account's own, so a file a newer CLI adds starts out
40
+ * separate. Dirs are created in the main dir when missing, so the CLI's first
41
+ * write lands in the shared one; files are linked when they exist.
42
+ *
43
+ * None of these holds a sign-in. What does, as of the versions the image pins
44
+ * (claude 2.1.328, codex 0.170.0), stays in each account's own dir:
45
+ * - Claude Code: `.credentials.json` (on macOS the keychain entry named after
46
+ * the dir, src/usage.ts claudeKeychainService), `.claude.json` (oauthAccount,
47
+ * userID, primaryApiKey, customApiKeyResponses and the org caches),
48
+ * `backups` (copies of it), `mcp-needs-auth-cache.json`, `mcp-oauth-tokens*.json`.
49
+ * - Codex: `auth.json`, `auth.lock`, `auth.json.lock`, `.credentials.json` (MCP
50
+ * OAuth), `gateway_oauth.json`, `gateway_oauth.lock`, `installation_id`, the
51
+ * app-server daemon dirs and the sqlite state (the keyring entry is keyed by
52
+ * the dir already).
53
+ */
54
+ const SHARED = {
55
+ claude: {
56
+ dirs: ["projects", "plans", "tasks", "teams", "todos", "file-history", "session-env", "shell-snapshots", "skills", "commands", "agents", "plugins", "hooks", "rules", "output-styles"],
57
+ files: ["settings.json", "CLAUDE.md", "AGENTS.md", "keybindings.json", "history.jsonl"],
58
+ },
59
+ codex: {
60
+ dirs: ["sessions", "archived_sessions", "skills", "rules", "prompts"],
61
+ files: ["config.toml", "AGENTS.md", "hooks.json", "history.jsonl", ".hook-trust"],
62
+ },
63
+ };
64
+ /**
65
+ * The parts of the main `.claude.json` a new Claude account starts with: the
66
+ * user's choices (onboarding done, theme, MCP servers, folder trust), never
67
+ * the signed-in account or its caches.
68
+ */
69
+ const CLAUDE_STATE_KEYS = [
70
+ "hasCompletedOnboarding",
71
+ "theme",
72
+ "bypassPermissionsModeAccepted",
73
+ "remoteDialogSeen",
74
+ "mcpServers",
75
+ "projects",
76
+ "autoCompactEnabled",
77
+ "editorMode",
78
+ "verbose",
79
+ "installMethod",
80
+ "autoUpdates",
81
+ ];
82
+ export function isAccountBackend(value) {
83
+ return value === "claude" || value === "codex";
84
+ }
85
+ function rudderHomeOf(env) {
86
+ return path.resolve(env.RUDDER_HOME?.trim() || path.join(os.homedir(), ".rudder"));
87
+ }
88
+ function configPath(env) {
89
+ return path.join(rudderHomeOf(env), "config.json");
90
+ }
91
+ /** The CLI's own config dir under `env`: the main account. */
92
+ export function mainAccountDir(backend, env) {
93
+ const configured = env[ACCOUNT_ENV[backend]]?.trim();
94
+ return path.resolve(configured || path.join(os.homedir(), backend === "claude" ? ".claude" : ".codex"));
95
+ }
96
+ function checkId(id) {
97
+ if (id === MAIN_ACCOUNT || !ACCOUNT_ID.test(id)) {
98
+ throw new Error(`not an account id: ${JSON.stringify(id)}`);
99
+ }
100
+ }
101
+ function extraDir(backend, id, env) {
102
+ checkId(id);
103
+ return path.join(rudderHomeOf(env), "accounts", backend, id);
104
+ }
105
+ export function accountDir(backend, id, env) {
106
+ return id === MAIN_ACCOUNT ? mainAccountDir(backend, env) : extraDir(backend, id, env);
107
+ }
108
+ const BACKEND_NAME = { claude: "Claude Code", codex: "Codex" };
109
+ function requireExtra(backend, id, env) {
110
+ const dir = extraDir(backend, id, env);
111
+ if (!fs.statSync(dir, { throwIfNoEntry: false })?.isDirectory()) {
112
+ throw new Error(`There is no ${BACKEND_NAME[backend]} account ${id}.`);
113
+ }
114
+ return dir;
115
+ }
116
+ /** The env an agent on this account runs with, added to `env`. */
117
+ export function accountEnv(backend, id, env) {
118
+ if (id === MAIN_ACCOUNT) {
119
+ return { ...env };
120
+ }
121
+ return { ...env, [ACCOUNT_ENV[backend]]: requireExtra(backend, id, env) };
122
+ }
123
+ function defaultIdOf(config, backend) {
124
+ const id = config?.backends?.[backend]?.account;
125
+ return typeof id === "string" && id ? id : MAIN_ACCOUNT;
126
+ }
127
+ /** Every account of every backend, main first, then the others oldest first. */
128
+ export async function listAccounts(env) {
129
+ const config = await readJson(configPath(env));
130
+ const out = {};
131
+ for (const backend of ACCOUNT_BACKENDS) {
132
+ const root = path.join(rudderHomeOf(env), "accounts", backend);
133
+ let entries = [];
134
+ try {
135
+ entries = await fsp.readdir(root, { withFileTypes: true });
136
+ }
137
+ catch (error) {
138
+ if (error.code !== "ENOENT")
139
+ throw error;
140
+ }
141
+ // Ids are base-36 creation times of one length, so name order is age order.
142
+ const ids = entries.filter((entry) => entry.isDirectory() && ACCOUNT_ID.test(entry.name) && entry.name !== MAIN_ACCOUNT)
143
+ .map((entry) => entry.name)
144
+ .sort();
145
+ const chosen = defaultIdOf(config, backend);
146
+ out[backend] = [MAIN_ACCOUNT, ...ids].map((id) => ({
147
+ backend,
148
+ id,
149
+ dir: accountDir(backend, id, env),
150
+ default: id === chosen,
151
+ }));
152
+ }
153
+ return out;
154
+ }
155
+ /**
156
+ * A new, signed-out account: its dir with the shared parts linked to the main
157
+ * dir. The caller signs it in (the CLI's own login with `accountEnv`) and
158
+ * removes it again if that does not finish.
159
+ */
160
+ export async function createAccount(backend, env) {
161
+ const id = Date.now().toString(36);
162
+ const dir = extraDir(backend, id, env);
163
+ const main = mainAccountDir(backend, env);
164
+ await fsp.mkdir(path.dirname(dir), { recursive: true, mode: 0o700 });
165
+ // Not recursive: an id already taken is an error, never a shared dir.
166
+ await fsp.mkdir(dir, { mode: 0o700 });
167
+ try {
168
+ await fsp.mkdir(main, { recursive: true });
169
+ for (const name of SHARED[backend].dirs) {
170
+ await fsp.mkdir(path.join(main, name), { recursive: true });
171
+ await fsp.symlink(path.join(main, name), path.join(dir, name));
172
+ }
173
+ for (const name of SHARED[backend].files) {
174
+ if (fs.existsSync(path.join(main, name))) {
175
+ await fsp.symlink(path.join(main, name), path.join(dir, name));
176
+ }
177
+ }
178
+ if (backend === "claude") {
179
+ await seedClaudeState(dir, env);
180
+ }
181
+ }
182
+ catch (error) {
183
+ await fsp.rm(dir, { recursive: true, force: true });
184
+ throw error;
185
+ }
186
+ const config = await readJson(configPath(env));
187
+ return { backend, id, dir, default: defaultIdOf(config, backend) === id };
188
+ }
189
+ async function seedClaudeState(dir, env) {
190
+ // Claude keeps `.claude.json` in its config dir only when CLAUDE_CONFIG_DIR
191
+ // names one; otherwise it is ~/.claude.json.
192
+ const configured = env.CLAUDE_CONFIG_DIR?.trim();
193
+ const mainState = configured ? path.join(path.resolve(configured), ".claude.json") : path.join(os.homedir(), ".claude.json");
194
+ const state = (await readJson(mainState)) ?? {};
195
+ const seed = {};
196
+ for (const key of CLAUDE_STATE_KEYS) {
197
+ if (key in state)
198
+ seed[key] = state[key];
199
+ }
200
+ await fsp.writeFile(path.join(dir, ".claude.json"), `${JSON.stringify(seed, null, 2)}\n`, { mode: 0o600 });
201
+ }
202
+ /**
203
+ * Deletes an extra account's dir (its links go, never what they point at). New
204
+ * agents that started on it move back to main as the default. Sign it out
205
+ * first: on macOS the CLI's keychain entry outlives the dir.
206
+ */
207
+ export async function removeAccount(backend, id, env) {
208
+ const dir = requireExtra(backend, id, env);
209
+ await fsp.rm(dir, { recursive: true });
210
+ await updateJson(configPath(env), (config) => {
211
+ if (!config || defaultIdOf(config, backend) !== id)
212
+ return undefined;
213
+ const { account: _removed, ...rest } = config.backends?.[backend] ?? {};
214
+ return { ...config, backends: { ...config.backends, [backend]: rest } };
215
+ });
216
+ }
217
+ /** Makes `id` the account new agents on `backend` start on. */
218
+ export async function setDefaultAccount(backend, id, env) {
219
+ if (id !== MAIN_ACCOUNT) {
220
+ requireExtra(backend, id, env);
221
+ }
222
+ await updateJson(configPath(env), (config) => {
223
+ // A machine nothing has configured yet starts from the defaults, as the
224
+ // dashboard's own first write does (native config.rs).
225
+ const base = (config ?? defaultConfig());
226
+ const { account: _old, ...rest } = base.backends?.[backend] ?? {};
227
+ const next = id === MAIN_ACCOUNT ? rest : { ...rest, account: id };
228
+ return { ...base, backends: { ...base.backends, [backend]: next } };
229
+ });
230
+ }
231
+ //# sourceMappingURL=accounts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"accounts.js","sourceRoot":"","sources":["../src/accounts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,GAAG,MAAM,kBAAkB,CAAC;AACnC,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE3C,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAGjD,MAAM,CAAC,MAAM,gBAAgB,GAA8B,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;AAC/E,MAAM,CAAC,MAAM,YAAY,GAAG,MAAM,CAAC;AAanC,uDAAuD;AACvD,MAAM,CAAC,MAAM,WAAW,GAAmC;IACzD,MAAM,EAAE,mBAAmB;IAC3B,KAAK,EAAE,YAAY;CACpB,CAAC;AAEF,MAAM,UAAU,GAAG,kBAAkB,CAAC;AAEtC;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,MAAM,GAAgE;IAC1E,MAAM,EAAE;QACN,IAAI,EAAE,CAAC,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,iBAAiB,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,eAAe,CAAC;QACtL,KAAK,EAAE,CAAC,eAAe,EAAE,WAAW,EAAE,WAAW,EAAE,kBAAkB,EAAE,eAAe,CAAC;KACxF;IACD,KAAK,EAAE;QACL,IAAI,EAAE,CAAC,UAAU,EAAE,mBAAmB,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,CAAC;QACrE,KAAK,EAAE,CAAC,aAA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