sideby 0.18.0 → 0.19.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.
Files changed (42) hide show
  1. package/README.md +8 -0
  2. package/dist/build.json +1 -1
  3. package/dist/src/cli/commands.js +159 -13
  4. package/dist/src/cli/json-schemas.js +39 -1
  5. package/dist/src/cli/main.js +23 -6
  6. package/dist/src/core/ask.d.ts +14 -0
  7. package/dist/src/core/ask.js +16 -1
  8. package/dist/src/core/browser-profiles.js +7 -32
  9. package/dist/src/core/config.d.ts +14 -0
  10. package/dist/src/core/config.js +64 -1
  11. package/dist/src/core/file-memo.js +26 -4
  12. package/dist/src/core/pick-commands.d.ts +42 -0
  13. package/dist/src/core/pick-commands.js +44 -0
  14. package/dist/src/core/shell-init.js +3 -1
  15. package/dist/src/core/shell-setup.d.ts +40 -0
  16. package/dist/src/core/shell-setup.js +54 -0
  17. package/dist/src/core/skill-check.d.ts +2 -0
  18. package/dist/src/core/skill-check.js +2 -0
  19. package/dist/src/core/terminal.d.ts +21 -4
  20. package/dist/src/core/terminal.js +149 -9
  21. package/dist/src/core/update.js +2 -2
  22. package/dist/src/core/windows-dirs.d.ts +19 -0
  23. package/dist/src/core/windows-dirs.js +39 -0
  24. package/dist/src/panel/handler.d.ts +18 -0
  25. package/dist/src/panel/handler.js +69 -1
  26. package/dist/src/panel/i18n.d.ts +39 -0
  27. package/dist/src/panel/i18n.js +78 -0
  28. package/dist/src/panel/page-script.js +184 -3
  29. package/dist/src/panel/page-styles.js +3 -0
  30. package/dist/src/panel/page.js +6 -1
  31. package/dist/src/plugins/account-script.js +61 -27
  32. package/dist/src/runtime.d.ts +35 -1
  33. package/dist/src/runtime.js +96 -3
  34. package/package.json +2 -2
  35. package/schemas/alias-list.json +119 -0
  36. package/schemas/alias.json +27 -1
  37. package/schemas/config.json +11 -0
  38. package/schemas/new.json +19 -0
  39. package/schemas/shell-init-setup.json +124 -0
  40. package/skills/sideby/SKILL.md +6 -3
  41. package/skills/sideby/references/accounts.md +10 -0
  42. package/skills/sideby/references/setup.md +1 -1
@@ -0,0 +1,124 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "sideby/shell-init-setup.json",
4
+ "type": "object",
5
+ "required": [
6
+ "schemaVersion",
7
+ "shell",
8
+ "rc",
9
+ "status"
10
+ ],
11
+ "properties": {
12
+ "schemaVersion": {
13
+ "type": "number",
14
+ "const": 1
15
+ },
16
+ "shell": {
17
+ "anyOf": [
18
+ {
19
+ "type": "string",
20
+ "const": "zsh"
21
+ },
22
+ {
23
+ "type": "string",
24
+ "const": "bash"
25
+ }
26
+ ]
27
+ },
28
+ "rc": {
29
+ "type": "string",
30
+ "description": "The rc file, with ~ for the home folder."
31
+ },
32
+ "status": {
33
+ "anyOf": [
34
+ {
35
+ "type": "string",
36
+ "const": "loaded"
37
+ },
38
+ {
39
+ "type": "string",
40
+ "const": "confirm"
41
+ },
42
+ {
43
+ "type": "string",
44
+ "const": "added"
45
+ },
46
+ {
47
+ "type": "string",
48
+ "const": "removed"
49
+ },
50
+ {
51
+ "type": "string",
52
+ "const": "not-added"
53
+ }
54
+ ],
55
+ "description": "`loaded`: new terminals already load the short commands. `confirm` (exit 10): nothing written; `block` is what --yes appends. `not-added`: --undo found no line sideby added."
56
+ },
57
+ "block": {
58
+ "type": "string"
59
+ },
60
+ "_notice": {
61
+ "type": "object",
62
+ "properties": {
63
+ "update": {
64
+ "type": "object",
65
+ "required": [
66
+ "current",
67
+ "latest",
68
+ "command",
69
+ "message"
70
+ ],
71
+ "properties": {
72
+ "current": {
73
+ "type": "string"
74
+ },
75
+ "latest": {
76
+ "type": "string"
77
+ },
78
+ "command": {
79
+ "type": "string",
80
+ "description": "Run it after the user agrees: it shows the plan and exits 10; then --yes."
81
+ },
82
+ "message": {
83
+ "type": "string"
84
+ }
85
+ }
86
+ },
87
+ "skill": {
88
+ "type": "object",
89
+ "required": [
90
+ "installed",
91
+ "current",
92
+ "command",
93
+ "message"
94
+ ],
95
+ "properties": {
96
+ "installed": {
97
+ "anyOf": [
98
+ {
99
+ "type": "string"
100
+ },
101
+ {
102
+ "type": "null"
103
+ }
104
+ ],
105
+ "description": "The skill's version; null when it has none."
106
+ },
107
+ "current": {
108
+ "type": "string"
109
+ },
110
+ "command": {
111
+ "type": "string",
112
+ "description": "`sideby update`, which updates the skill with sideby: run it after the user agrees; it shows the plan and exits 10, then --yes."
113
+ },
114
+ "message": {
115
+ "type": "string"
116
+ }
117
+ }
118
+ }
119
+ },
120
+ "description": "Not the answer to the task: mention it briefly afterwards and offer to update."
121
+ }
122
+ },
123
+ "title": "sideby shell-init setup --json"
124
+ }
@@ -1,8 +1,8 @@
1
1
  ---
2
2
  name: sideby
3
- description: Use when the user runs, or wants to run, several AI coding accounts (Claude Code, Codex, Grok Build, pi) side by side. Covers installing sideby and setting up a new account ("install sideby", "set up another Claude account", "add cc008", "配置一个 cc00x", "再加一个 Codex 账号"), explaining what accounts share and what stays separate ("what do my accounts share?", "这些账号共享了什么"), showing which account a session is ("show [cc001] in the status line", "加上账号标识"), seeing accounts, quota and usage, moving on when one hits its 5-hour or weekly limit, moving the current task to another account ("用 cc008 继续", "交回 cc008"), adding a short command (alias), adding an API account from a vendor's docs ("加一个 DeepSeek API 账号"), supporting a new tool, and repairing drifted account directories (skills, hooks, rules or settings not shared, wrong symlinks, credential file permissions). Drives the `sideby` CLI with `--json`; the agent does every step except browser sign-in, filling in secrets and starting interactive sessions, which it hands to the user as one command (inside an Auto Handoff session, `sideby handoff ready --to` moves the task itself).
3
+ description: Use when the user runs, or wants to run, several AI coding accounts (Claude Code, Codex, Grok Build, pi) side by side. Covers installing sideby and setting up a new account ("install sideby", "set up another Claude account", "add cc008", "配置一个 cc00x", "再加一个 Codex 账号"), explaining what accounts share and what stays separate ("what do my accounts share?", "这些账号共享了什么"), showing which account a session is ("show [cc001] in the status line", "加上账号标识"), seeing accounts, quota and usage, moving on when one hits its 5-hour or weekly limit, moving the current task to another account ("用 cc008 继续", "交回 cc008"), adding a short command (alias) or a pick command that starts whichever account has the most quota ("加个 cc"), adding an API account from a vendor's docs ("加一个 DeepSeek API 账号"), supporting a new tool, and repairing drifted account directories (skills, hooks, rules or settings not shared, wrong symlinks, credential file permissions). Drives the `sideby` CLI with `--json`; the agent does every step except browser sign-in, filling in secrets and starting interactive sessions, which it hands to the user as one command (inside an Auto Handoff session, `sideby handoff ready --to` moves the task itself).
4
4
  metadata:
5
- version: "0.18.0"
5
+ version: "0.19.1"
6
6
  requires:
7
7
  bins: [sideby, node]
8
8
  cliHelp: sideby --help
@@ -20,6 +20,7 @@ Do every step you can yourself. Only browser sign-in, secrets and interactive se
20
20
  - **Never sign in for the user.** Give them `sideby login <ref>` as one line to run in their own terminal (Claude Code: `! sideby login <ref>`). OAuth needs their browser and their decision.
21
21
  - **Never put a secret on the command line or in chat.** Never ask for a key. For API accounts, the user runs `sideby key <ref>` in their own terminal (or **Enter key** in the Panel); it reads the key without showing it.
22
22
  - **Never start a Host session from your shell.** `sideby run`, `sideby next` (without `--dry-run`), `sideby login` and `sideby ask` open an interactive session; give the user the command instead. An AI Task is started by the user, from the Panel or with `sideby ask`; never run `sideby ask` (or `sideby ask --spec -`) to start another session on your own (`sideby ask --print`, `sideby ask --spec - --print` and `sideby ask --choices` only read and are fine).
23
+ The one exception: when the user has explicitly asked you to dispatch work to other accounts, you may start non-interactive worker runs with `sideby run <ref> -- <the Host's headless flags>` (Claude `-p`, Codex `exec`, Grok `--prompt-file`), with stdin closed and output redirected to a file. Never `login`, `ask`, `next` or an interactive `run` for this, and the next rule still holds: a worker never moves the user's own sessions. How such workers are sized and reviewed belongs to the `agent-dispatch` skill; which account to pick is in `references/handoff.md`.
23
24
  - **Never switch, rotate or proxy accounts yourself.** Do not work around sideby by editing config, copying session files or moving credentials. `sideby next` only recommends. Moving a running task on its own is Auto Handoff, which the user turns on: use `sideby handoff enable` (exit 10, then their yes), never hand-edit `config.json`. Inside such a session (the environment has `SIDEBY_HANDOFF_RUN`), when the user wants the task to go on in another account ("用 cc008 继续", "交回 cc008"), do not hand them a command to start it: update the brief, run `sideby handoff ready --to <account>`, tell them the account it prints, and end your turn; sideby starts that account in the same terminal.
24
25
  - **Say what you change.** Read-only commands first. What the user asked for (the account they asked to create, its short command, the shell line that makes it work) you do, saying what you do. Changes they did not ask for (`doctor --fix` on other accounts, `quota setup`, `app install`) wait until they have seen the change and agreed.
25
26
  - Do not edit Host config files (`settings.json`, `config.toml`, symlinks in account directories) by hand when a `sideby` command does the job.
@@ -53,6 +54,8 @@ Account refs are `<family>:<name>`; a bare `<name>` works only when it is unique
53
54
  | Keep working because an account hit its limit | `sideby next <family> --json` | `references/handoff.md` |
54
55
  | Turn on Auto Handoff ("自动接力", "自动交接", "hand over when quota runs low"), see what it still needs, hand this session over now, or pick an account with room for a subtask | `sideby handoff status --json`, `sideby handoff enable --json` (exit 10 first), `sideby handoff ready`, `sideby next <family> --json` | `references/handoff.md` |
55
56
  | Create an account with a given name, an API account, or a short command | `sideby new`, `sideby alias add` | `references/accounts.md` |
57
+ | One command that always starts the account with the most quota left ("加个 cc", "自动挑额度最多的账号启动", "start whichever has room") | `sideby alias add <short> --pick <family> --json` (exit 10 first), `sideby alias list --json` | `references/accounts.md` |
58
+ | Short commands say "command not found" in a new terminal ("cc 用不了", "短命令不生效") | `sideby shell-init setup --json` (exit 10 first) | `references/setup.md` |
56
59
  | Do something in sideby as an AI Task (the first message came from sideby or the Panel's "Let AI do it") | follow the task it names | `references/ai-tasks.md` |
57
60
  | A Portal starts AI Tasks through sideby, or one of its tasks failed (`spec-version`, `bad-cwd`, "which account would it use?") | `sideby ask --choices --json`, `sideby ask --spec - --print --json` (read only) | `references/ai-tasks.md` |
58
61
  | Add an API account from a vendor's address or docs link, enter its key, check it works | `sideby new <family> --next --api --json`, then the user runs `sideby key <ref>`; `sideby try <ref> --json` (exit 10 first) | `references/ai-tasks.md` |
@@ -70,7 +73,7 @@ Read only the reference the task needs.
70
73
 
71
74
  ## Launching and the panel
72
75
 
73
- `eval "$(sideby shell-init zsh)"` defines one function per account (`sideby-claude-work`) plus the config `aliases`. Users who source a file instead set config `shellInitFile` (for example `{ "zsh": "~/.config/sideby/shell-init.zsh" }`); `new` and `alias add|rm` keep it current, and `sideby shell-init zsh --write` rewrites it. New functions work in a new shell.
76
+ `eval "$(sideby shell-init zsh)"` defines one function per account (`sideby-claude-work`) plus the config `aliases` and `pickCommands`. Users who source a file instead set config `shellInitFile` (for example `{ "zsh": "~/.config/sideby/shell-init.zsh" }`); `new` and `alias add|rm` keep it current, and `sideby shell-init zsh --write` rewrites it. New functions work in a new shell.
74
77
 
75
78
  When a terminal manager such as Orca reopens a pane with a bare `claude --resume <id>` (or `codex resume <id>`, `grok --resume <id>`) and the Host says `No conversation found`, the session lives in another account. Suggest config `"resumeRouting": true` followed by `sideby shell-init --write` (or a new shell with `eval`): `shell-init` then defines Host-named functions that call `sideby resume <family>`, which starts the account holding that session. For a one-off, find it with `ls -d ~/.claude*/projects/*/<id>.jsonl` and run `sideby run <ref> -- --resume <id>`. When no account has that file, the session was opened but never got a message, so there is nothing to resume: `ls -d ~/.claude*/session-env/<id>` names the account that started it, and with routing on `sideby resume` starts a new session there by itself.
76
79
 
@@ -29,3 +29,13 @@ To start one account with fixed Host arguments, such as another model, put them
29
29
  - A refusal names the next step (`sideby alias rm <short>` first).
30
30
  - Entry points that need environment variables are not aliases: leave them in the user's shell rc.
31
31
  - Do not edit `aliases` in the config by hand.
32
+
33
+ ## Pick commands (start the account with the most room)
34
+
35
+ A pick command is a short command bound to a tool (Family), not to one account: each run starts the account of that tool `sideby next` would pick, the one with the lowest Quota Pressure, and prints which (`cc → claude:work (12% used, the most room)`). When no account of the tool has quota data yet it starts the main account and says so; when every account is full or signed out it starts nothing and says which comes back first. API accounts are never picked.
36
+
37
+ - Add: `sideby alias add <short> --pick <family> --json` exits 10 with `status: "confirm"` and writes nothing; tell the user what it adds, then run it again with `--yes`. Then make sure new terminals load it: `sideby shell-init setup --json` (see `setup.md` step 7). Offer `cc` for Claude, `cx` for Codex, `gk` for Grok, or the letters the user's numbered short commands share (`cc001`, `cc008` → `cc`); pi gets none, since `pi` is the tool itself. `sideby new` offers one (`pickCommandOffer`) when a tool gets its second subscription account.
38
+ - With `shadows` in that answer, the name hides a command on PATH (for example `/usr/bin/cc`, the C compiler on macOS). Tell the user that typing the name would start the tool instead, and run again with `--yes` only after they agree to that, or pick another name.
39
+ - `sideby alias list --json` lists both kinds (`kind: "pick"` or `"account"`); `sideby alias rm <short>` removes either. Pick commands and short commands share one set of names.
40
+ - The user types the name in a new terminal; you never run it (it starts an interactive session). A shell alias of the same name in their rc (`alias cc=…`) still wins: when the name does not start sideby, tell them to remove that alias.
41
+ - Do not edit `pickCommands` in the config by hand.
@@ -14,7 +14,7 @@ For "install sideby", "set up another Claude account", "add cc008", "配置一
14
14
  6. **user: sign in or fill in the key.**
15
15
  - Subscription account: `sideby login <ref>`. It opens the Host's sign-in in their browser. For pi it starts pi; they type `/login`.
16
16
  - API account: they open the `proxy.env` path that `new` printed and fill in the values. Never read or write it, and never ask for the key in chat.
17
- 7. **Short command in new terminals.** If `~/.config/sideby/config.json` has no `shellInitFile`, and `~/.zshrc` (bash: `~/.bashrc`) has no line containing `sideby shell-init`, say so and append `eval "$(sideby shell-init zsh)"` (or `bash`). It takes effect in new terminals. Skip this when the user wanted no short command.
17
+ 7. **Short command in new terminals.** `sideby shell-init setup --json`: `status: "loaded"` means new terminals already have the short commands. Exit 10 (`status: "confirm"`) shows the `block` it would append to `rc`; say so, then run it again with `--yes` (the user asked for the short command, so this is part of it). It takes effect in new terminals; `sideby shell-init setup --undo` takes the line out. Never append the line by hand. Skip this when the user wanted no short command.
18
18
  8. **Account badge.** Offer to show which account each session is (`[cc008]` in the status line or tab title); if they want it, follow `badge.md`.
19
19
  9. **Verify.** `sideby doctor <ref> --json` should report no `fail`; fix only the new account with `sideby doctor <ref> --fix`. After the user signed in, `sideby list --json` shows `login: "logged-in"` for it.
20
20
  10. **Optional, Claude Code:** for quota in `sideby quota` and the panel, follow `quota.md` (it needs the user's yes).