sideby 0.16.0 → 0.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. package/README.md +5 -3
  2. package/dist/build.json +1 -1
  3. package/dist/src/cli/commands.d.ts +16 -0
  4. package/dist/src/cli/commands.js +460 -5
  5. package/dist/src/cli/json-schemas.js +115 -0
  6. package/dist/src/cli/main.js +93 -3
  7. package/dist/src/core/ask.d.ts +150 -0
  8. package/dist/src/core/ask.js +365 -0
  9. package/dist/src/core/attachments.d.ts +50 -0
  10. package/dist/src/core/attachments.js +442 -0
  11. package/dist/src/core/autostart.d.ts +88 -0
  12. package/dist/src/core/autostart.js +256 -0
  13. package/dist/src/core/config.d.ts +97 -0
  14. package/dist/src/core/config.js +278 -10
  15. package/dist/src/core/launch.d.ts +15 -4
  16. package/dist/src/core/launch.js +27 -23
  17. package/dist/src/core/local-build.d.ts +17 -0
  18. package/dist/src/core/local-build.js +39 -3
  19. package/dist/src/core/probe.d.ts +78 -0
  20. package/dist/src/core/probe.js +127 -0
  21. package/dist/src/core/same-login.d.ts +9 -4
  22. package/dist/src/core/same-login.js +9 -4
  23. package/dist/src/core/secret-file.d.ts +26 -0
  24. package/dist/src/core/secret-file.js +126 -7
  25. package/dist/src/core/terminal.d.ts +93 -0
  26. package/dist/src/core/terminal.js +371 -0
  27. package/dist/src/core/update.d.ts +17 -0
  28. package/dist/src/core/update.js +63 -1
  29. package/dist/src/families/claude/index.js +3 -0
  30. package/dist/src/families/claude/quota-cache.d.ts +24 -7
  31. package/dist/src/families/claude/quota-cache.js +72 -21
  32. package/dist/src/families/codex/index.js +7 -0
  33. package/dist/src/families/codex/login-key.d.ts +8 -0
  34. package/dist/src/families/codex/login-key.js +33 -0
  35. package/dist/src/families/grok/index.js +3 -0
  36. package/dist/src/families/login-keys.d.ts +6 -0
  37. package/dist/src/families/login-keys.js +6 -0
  38. package/dist/src/families/pi/index.js +4 -0
  39. package/dist/src/panel/background.js +3 -2
  40. package/dist/src/panel/handler.d.ts +29 -2
  41. package/dist/src/panel/handler.js +396 -9
  42. package/dist/src/panel/i18n.d.ts +175 -2
  43. package/dist/src/panel/i18n.js +381 -35
  44. package/dist/src/panel/page-logic.d.ts +214 -0
  45. package/dist/src/panel/page-logic.js +394 -0
  46. package/dist/src/panel/page-script.js +984 -134
  47. package/dist/src/panel/page-styles.js +69 -19
  48. package/dist/src/panel/page.d.ts +5 -0
  49. package/dist/src/panel/page.js +2 -0
  50. package/dist/src/panel/server.d.ts +16 -2
  51. package/dist/src/panel/server.js +41 -13
  52. package/dist/src/plugins/check.d.ts +47 -0
  53. package/dist/src/plugins/check.js +544 -0
  54. package/dist/src/plugins/scaffold.d.ts +21 -0
  55. package/dist/src/plugins/scaffold.js +123 -0
  56. package/dist/src/quota/statusline-tap.js +1 -1
  57. package/dist/src/runtime.d.ts +10 -0
  58. package/dist/src/runtime.js +47 -16
  59. package/dist/src/types.d.ts +19 -0
  60. package/package.json +2 -2
  61. package/schemas/ask.json +180 -0
  62. package/schemas/autostart.json +165 -0
  63. package/schemas/config-get.json +132 -0
  64. package/schemas/config-set.json +107 -0
  65. package/schemas/config.json +73 -6
  66. package/schemas/key.json +93 -0
  67. package/schemas/local.json +4 -0
  68. package/schemas/plugins-check.json +113 -0
  69. package/schemas/plugins-new.json +87 -0
  70. package/schemas/terminal.json +152 -0
  71. package/schemas/try.json +109 -0
  72. package/schemas/update.json +4 -0
  73. package/skills/sideby/SKILL.md +12 -6
  74. package/skills/sideby/references/accounts.md +1 -1
  75. package/skills/sideby/references/ai-tasks.md +116 -0
  76. package/skills/sideby/references/panel.md +14 -0
  77. package/skills/sideby/references/update.md +1 -1
@@ -0,0 +1,113 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "sideby/plugins-check.json",
4
+ "type": "object",
5
+ "required": [
6
+ "schemaVersion",
7
+ "ok",
8
+ "families",
9
+ "problems"
10
+ ],
11
+ "properties": {
12
+ "schemaVersion": {
13
+ "type": "number",
14
+ "const": 1
15
+ },
16
+ "ok": {
17
+ "type": "boolean"
18
+ },
19
+ "plugin": {
20
+ "type": "string"
21
+ },
22
+ "families": {
23
+ "type": "array",
24
+ "items": {
25
+ "type": "string"
26
+ }
27
+ },
28
+ "problems": {
29
+ "type": "array",
30
+ "items": {
31
+ "type": "object",
32
+ "required": [
33
+ "code",
34
+ "message",
35
+ "fix"
36
+ ],
37
+ "properties": {
38
+ "code": {
39
+ "type": "string"
40
+ },
41
+ "message": {
42
+ "type": "string"
43
+ },
44
+ "fix": {
45
+ "type": "string"
46
+ }
47
+ }
48
+ }
49
+ },
50
+ "_notice": {
51
+ "type": "object",
52
+ "properties": {
53
+ "update": {
54
+ "type": "object",
55
+ "required": [
56
+ "current",
57
+ "latest",
58
+ "command",
59
+ "message"
60
+ ],
61
+ "properties": {
62
+ "current": {
63
+ "type": "string"
64
+ },
65
+ "latest": {
66
+ "type": "string"
67
+ },
68
+ "command": {
69
+ "type": "string",
70
+ "description": "Run it after the user agrees: it shows the plan and exits 10; then --yes."
71
+ },
72
+ "message": {
73
+ "type": "string"
74
+ }
75
+ }
76
+ },
77
+ "skill": {
78
+ "type": "object",
79
+ "required": [
80
+ "installed",
81
+ "current",
82
+ "command",
83
+ "message"
84
+ ],
85
+ "properties": {
86
+ "installed": {
87
+ "anyOf": [
88
+ {
89
+ "type": "string"
90
+ },
91
+ {
92
+ "type": "null"
93
+ }
94
+ ],
95
+ "description": "The skill's version; null when it has none."
96
+ },
97
+ "current": {
98
+ "type": "string"
99
+ },
100
+ "command": {
101
+ "type": "string",
102
+ "description": "`sideby update`, which updates the skill with sideby: run it after the user agrees; it shows the plan and exits 10, then --yes."
103
+ },
104
+ "message": {
105
+ "type": "string"
106
+ }
107
+ }
108
+ }
109
+ },
110
+ "description": "Not the answer to the task: mention it briefly afterwards and offer to update."
111
+ }
112
+ }
113
+ }
@@ -0,0 +1,87 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "sideby/plugins-new.json",
4
+ "type": "object",
5
+ "required": [
6
+ "schemaVersion",
7
+ "dir",
8
+ "files"
9
+ ],
10
+ "properties": {
11
+ "schemaVersion": {
12
+ "type": "number",
13
+ "const": 1
14
+ },
15
+ "dir": {
16
+ "type": "string"
17
+ },
18
+ "files": {
19
+ "type": "array",
20
+ "items": {
21
+ "type": "string"
22
+ }
23
+ },
24
+ "_notice": {
25
+ "type": "object",
26
+ "properties": {
27
+ "update": {
28
+ "type": "object",
29
+ "required": [
30
+ "current",
31
+ "latest",
32
+ "command",
33
+ "message"
34
+ ],
35
+ "properties": {
36
+ "current": {
37
+ "type": "string"
38
+ },
39
+ "latest": {
40
+ "type": "string"
41
+ },
42
+ "command": {
43
+ "type": "string",
44
+ "description": "Run it after the user agrees: it shows the plan and exits 10; then --yes."
45
+ },
46
+ "message": {
47
+ "type": "string"
48
+ }
49
+ }
50
+ },
51
+ "skill": {
52
+ "type": "object",
53
+ "required": [
54
+ "installed",
55
+ "current",
56
+ "command",
57
+ "message"
58
+ ],
59
+ "properties": {
60
+ "installed": {
61
+ "anyOf": [
62
+ {
63
+ "type": "string"
64
+ },
65
+ {
66
+ "type": "null"
67
+ }
68
+ ],
69
+ "description": "The skill's version; null when it has none."
70
+ },
71
+ "current": {
72
+ "type": "string"
73
+ },
74
+ "command": {
75
+ "type": "string",
76
+ "description": "`sideby update`, which updates the skill with sideby: run it after the user agrees; it shows the plan and exits 10, then --yes."
77
+ },
78
+ "message": {
79
+ "type": "string"
80
+ }
81
+ }
82
+ }
83
+ },
84
+ "description": "Not the answer to the task: mention it briefly afterwards and offer to update."
85
+ }
86
+ }
87
+ }
@@ -0,0 +1,152 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "sideby/terminal.json",
4
+ "type": "object",
5
+ "required": [
6
+ "schemaVersion",
7
+ "preferred",
8
+ "guess",
9
+ "installed",
10
+ "terminals"
11
+ ],
12
+ "properties": {
13
+ "schemaVersion": {
14
+ "type": "number",
15
+ "const": 1
16
+ },
17
+ "preferred": {
18
+ "anyOf": [
19
+ {
20
+ "type": "string"
21
+ },
22
+ {
23
+ "type": "null"
24
+ }
25
+ ]
26
+ },
27
+ "guess": {
28
+ "type": "object",
29
+ "required": [
30
+ "id",
31
+ "source"
32
+ ],
33
+ "properties": {
34
+ "id": {
35
+ "type": "string"
36
+ },
37
+ "source": {
38
+ "type": "string",
39
+ "enum": [
40
+ "config",
41
+ "env",
42
+ "default"
43
+ ]
44
+ }
45
+ }
46
+ },
47
+ "installed": {
48
+ "type": "array",
49
+ "items": {
50
+ "type": "object",
51
+ "required": [
52
+ "id"
53
+ ],
54
+ "properties": {
55
+ "id": {
56
+ "type": "string"
57
+ },
58
+ "appPath": {
59
+ "type": "string"
60
+ },
61
+ "executable": {
62
+ "type": "string"
63
+ }
64
+ }
65
+ }
66
+ },
67
+ "terminals": {
68
+ "type": "array",
69
+ "items": {
70
+ "type": "object",
71
+ "required": [
72
+ "id",
73
+ "name",
74
+ "installed"
75
+ ],
76
+ "properties": {
77
+ "id": {
78
+ "type": "string"
79
+ },
80
+ "name": {
81
+ "type": "string"
82
+ },
83
+ "installed": {
84
+ "type": "boolean"
85
+ }
86
+ }
87
+ }
88
+ },
89
+ "_notice": {
90
+ "type": "object",
91
+ "properties": {
92
+ "update": {
93
+ "type": "object",
94
+ "required": [
95
+ "current",
96
+ "latest",
97
+ "command",
98
+ "message"
99
+ ],
100
+ "properties": {
101
+ "current": {
102
+ "type": "string"
103
+ },
104
+ "latest": {
105
+ "type": "string"
106
+ },
107
+ "command": {
108
+ "type": "string",
109
+ "description": "Run it after the user agrees: it shows the plan and exits 10; then --yes."
110
+ },
111
+ "message": {
112
+ "type": "string"
113
+ }
114
+ }
115
+ },
116
+ "skill": {
117
+ "type": "object",
118
+ "required": [
119
+ "installed",
120
+ "current",
121
+ "command",
122
+ "message"
123
+ ],
124
+ "properties": {
125
+ "installed": {
126
+ "anyOf": [
127
+ {
128
+ "type": "string"
129
+ },
130
+ {
131
+ "type": "null"
132
+ }
133
+ ],
134
+ "description": "The skill's version; null when it has none."
135
+ },
136
+ "current": {
137
+ "type": "string"
138
+ },
139
+ "command": {
140
+ "type": "string",
141
+ "description": "`sideby update`, which updates the skill with sideby: run it after the user agrees; it shows the plan and exits 10, then --yes."
142
+ },
143
+ "message": {
144
+ "type": "string"
145
+ }
146
+ }
147
+ }
148
+ },
149
+ "description": "Not the answer to the task: mention it briefly afterwards and offer to update."
150
+ }
151
+ }
152
+ }
@@ -0,0 +1,109 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "sideby/try.json",
4
+ "type": "object",
5
+ "required": [
6
+ "schemaVersion",
7
+ "account",
8
+ "confirmed"
9
+ ],
10
+ "properties": {
11
+ "schemaVersion": {
12
+ "type": "number",
13
+ "const": 1
14
+ },
15
+ "account": {
16
+ "type": "string"
17
+ },
18
+ "confirmed": {
19
+ "type": "boolean"
20
+ },
21
+ "command": {
22
+ "type": "array",
23
+ "items": {
24
+ "type": "string"
25
+ }
26
+ },
27
+ "ok": {
28
+ "type": "boolean"
29
+ },
30
+ "exitCode": {
31
+ "anyOf": [
32
+ {
33
+ "type": "integer"
34
+ },
35
+ {
36
+ "type": "null"
37
+ }
38
+ ]
39
+ },
40
+ "output": {
41
+ "type": "string"
42
+ },
43
+ "timedOut": {
44
+ "type": "boolean"
45
+ },
46
+ "_notice": {
47
+ "type": "object",
48
+ "properties": {
49
+ "update": {
50
+ "type": "object",
51
+ "required": [
52
+ "current",
53
+ "latest",
54
+ "command",
55
+ "message"
56
+ ],
57
+ "properties": {
58
+ "current": {
59
+ "type": "string"
60
+ },
61
+ "latest": {
62
+ "type": "string"
63
+ },
64
+ "command": {
65
+ "type": "string",
66
+ "description": "Run it after the user agrees: it shows the plan and exits 10; then --yes."
67
+ },
68
+ "message": {
69
+ "type": "string"
70
+ }
71
+ }
72
+ },
73
+ "skill": {
74
+ "type": "object",
75
+ "required": [
76
+ "installed",
77
+ "current",
78
+ "command",
79
+ "message"
80
+ ],
81
+ "properties": {
82
+ "installed": {
83
+ "anyOf": [
84
+ {
85
+ "type": "string"
86
+ },
87
+ {
88
+ "type": "null"
89
+ }
90
+ ],
91
+ "description": "The skill's version; null when it has none."
92
+ },
93
+ "current": {
94
+ "type": "string"
95
+ },
96
+ "command": {
97
+ "type": "string",
98
+ "description": "`sideby update`, which updates the skill with sideby: run it after the user agrees; it shows the plan and exits 10, then --yes."
99
+ },
100
+ "message": {
101
+ "type": "string"
102
+ }
103
+ }
104
+ }
105
+ },
106
+ "description": "Not the answer to the task: mention it briefly afterwards and offer to update."
107
+ }
108
+ }
109
+ }
@@ -147,6 +147,10 @@
147
147
  "type": "boolean",
148
148
  "description": "The desktop app (`sideby app install`) was installed and was written again by the new version."
149
149
  },
150
+ "refreshedAutostart": {
151
+ "type": "boolean",
152
+ "description": "A login item (`sideby autostart on`) was installed and now starts the new version (false: that failed). Absent without one."
153
+ },
150
154
  "skill": {
151
155
  "type": "string",
152
156
  "description": "The command that installs the sideby skill by hand."
@@ -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), 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), 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.16.0"
5
+ version: "0.17.0"
6
6
  requires:
7
7
  bins: [sideby, node]
8
8
  cliHelp: sideby --help
@@ -18,8 +18,8 @@ Do every step you can yourself. Only browser sign-in, secrets and interactive se
18
18
 
19
19
  - **Never read credential files**: `proxy.env`, `auth.json`, `.claude.json`, or anything under an account directory that may hold a token. Do not `cat`, `grep`, `head`, open or summarize them. `sideby list --json` gives the signed-in email as `identity.email`; that is all you need.
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
- - **Never put a secret on the command line or in chat.** For API accounts, the user edits `proxy.env` themselves.
22
- - **Never start a Host session from your shell.** `sideby run`, `sideby next` (without `--dry-run`) and `sideby login` open an interactive session; give the user the command instead.
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
+ - **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` to start another session on your own (`sideby ask --print` only prints a prompt and is fine).
23
23
  - **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
24
  - **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
25
  - Do not edit Host config files (`settings.json`, `config.toml`, symlinks in account directories) by hand when a `sideby` command does the job.
@@ -27,7 +27,7 @@ Do every step you can yourself. Only browser sign-in, secrets and interactive se
27
27
  ## Output and exit codes
28
28
 
29
29
  - Every `--json` output has `schemaVersion: 1`. On an error it is `{ "schemaVersion": 1, "error": "<what to do next>", "code": "<reason>" }`; `code` is `usage` for a malformed command line.
30
- - Exit codes: `0` done, `1` failed or found a `fail` problem, `2` malformed command line, `10` **needs the user's confirmation**. `run`, `next` and `login` return the Host's own exit code once it starts.
30
+ - Exit codes: `0` done, `1` failed or found a `fail` problem, `2` malformed command line, `10` **needs the user's confirmation** (also `sideby try` before it spends tokens). `run`, `next` and `login` return the Host's own exit code once it starts.
31
31
  - On `10`: show the user the change the command printed, ask, and only after a clear yes run the same command again with `--yes` added. Never add `--yes` on your own.
32
32
  - `_notice` on any `--json` output: a newer sideby (`_notice.update`) or an installed sideby skill for another version (`_notice.skill`). It is not the answer to the task: finish the task first, then mention it in one line and offer to update, following `references/update.md`.
33
33
 
@@ -44,12 +44,18 @@ Account refs are `<family>:<name>`; a bare `<name>` works only when it is unique
44
44
  | Pin accounts or arrange their Display Order | `sideby order --json`, `sideby pin <ref> --json`, `sideby unpin <ref> --json` | `references/panel.md` |
45
45
  | Turn quota checks on or off, or refresh fetched quota | `sideby quota check <family> on|off --json`, `sideby quota [family] --refresh --json` | `references/quota.md` |
46
46
  | Set the model, effort or Remote Control | `sideby model <ref> --json`, `sideby remote-control --json` | `references/panel.md` |
47
+ | Start sideby at login ("开机启动", "start the panel when I log in") | `sideby autostart --json`, `sideby autostart on --json` (exit 10 first) | `references/panel.md` |
48
+ | Change the Panel's theme or language, or any other setting ("改成深色", "change any setting") | `sideby config get --json`, `sideby config set <key> <value> --json` (exit 10 first) | `references/panel.md` |
47
49
  | Turn Auto Update on or off | `sideby update --auto on|off --json` | `references/update.md` |
48
50
  | Switch between a local build of sideby and the release ("切换到正式版", "切回 dev 版本") | `sideby local --json`, `sideby local on|off --json` (exits 10 first) | `references/update.md` |
49
51
  | Repair drift or permissions | `sideby doctor [ref] --json`, then `--fix` after they agree | `references/diagnose.md` |
50
52
  | Keep working because an account hit its limit | `sideby next <family> --json` | `references/handoff.md` |
51
- | 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` |
53
+ | 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` |
52
54
  | Create an account with a given name, an API account, or a short command | `sideby new`, `sideby alias add` | `references/accounts.md` |
55
+ | 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` |
56
+ | 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` |
57
+ | Support a tool sideby does not list yet, or write a plugin | `sideby plugins new <id> --json`, `sideby plugins check <id> --json` | `references/ai-tasks.md` |
58
+ | Choose the terminal the Panel opens for AI Tasks and sign-in | `sideby terminal --json`, `sideby terminal --set <id> --json` | — |
53
59
  | Tune the auto-compact threshold ("which compaction setting costs the fewest tokens"), use the suggestion or undo it | `sideby tune --json`, `sideby tune apply` (exit 10 first), `sideby tune undo` | `references/diagnose.md` |
54
60
  | See or set the model and effort an account starts with ("用哪个模型", "set effort to high for cc002") | `sideby model <acct> --json`; `sideby model <acct> <model\|default> --effort <level\|default>` (exit 10 first, then `--yes` after the user agrees) | — |
55
61
  | Stop Claude sessions from connecting to claude.ai / the Claude app by themselves ("关闭 remote control", "别让别人远程看到对话") for every account | `sideby remote-control --json`, then `sideby remote-control off` (exits 10 with the change; rerun with `--yes` after they agree); `sideby remote-control undo` puts it back; `sideby remote-control on` turns it back on the same way (only when they ask for it) | — |
@@ -15,7 +15,7 @@ Only pass `--alias` when the user wants a short command. To continue their numbe
15
15
  Then:
16
16
 
17
17
  - **Subscription account**: tell the user to run `sideby login claude:work` in their own terminal (for pi, `sideby login pi:<name>` starts pi; then they type `/login`). Do not run it for them.
18
- - **API account**: tell the user to open the `proxy.env` path printed by `new` in their editor and fill in the values. Do not read or write it yourself. It then shows `login: "not-needed"`.
18
+ - **API account**: tell the user to run `sideby key <ref>` in their own terminal (or click **Enter key** in the Panel), which writes the key without showing it, or to open the `proxy.env` path printed by `new` in their editor. Never ask for the key or read the file yourself. It then shows `login: "not-needed"`.
19
19
  - **pi**: a `proxy.env` in a pi account only loads provider keys; the account stays a subscription account and still needs `/login`.
20
20
  - Afterwards: `sideby doctor <ref> --json` to confirm the new account is healthy, then the user starts it with `sideby run <ref>`.
21
21
 
@@ -0,0 +1,116 @@
1
+ # AI Tasks
2
+
3
+ An AI Task is a session of the user's own Host that sideby started for them, with a Task Prompt as its first message. The user starts it from the Panel ("Let AI do it", a Finding, a quota cell, the new-account dialog, "Other tool…", "Let AI write a plugin", "Not sure how? Let AI set it up" in the Preferred terminal dialog, "Let AI tune it" on the Auto Handoff page) or with `sideby ask` in a terminal (`--task free|fix|quota|account|host|plugin|terminal|handoff`). The prompt says what to do and gives facts sideby already knows (account refs, Family, Finding codes, the quota reason, the Panel language, the sideby version). How to do it is on this page.
4
+
5
+ You are inside such a session when the first message came from sideby and names a task. Work in the directory the session started in (sideby's own `ai/` folder) unless the user names another one.
6
+
7
+ ## Rules for every task
8
+
9
+ - Use this skill and `sideby … --json` for every step a command covers.
10
+ - `quota setup`, `handoff setup`, `update`, `browser --enable|--disable`, `try`, `tune apply|undo`, `model` and `remote-control off|on` show a preview first and exit 10: show the user the change, and add `--yes` only after they agree. `doctor` shows what `--fix` would fix; run `--fix` after they agree. `new`, `plugins new`, `terminal --set|--custom` and `key` write at once, so ask the user before you run them.
11
+ - Never sign in for the user. Tell them to click **Sign in** on the account in the Panel, or to run `sideby login <ref>` in their own terminal.
12
+ - Never ask for an API key, a token or a password in chat, and do not use one the user pastes: tell them it is not needed here and to keep it out of the chat. A key goes in with `sideby key <ref>`, which the user runs in their own terminal (or **Enter key** in the Panel); it reads the key without showing it.
13
+ - Do not run `sideby ask` to start another AI Task yourself.
14
+ - Say what you changed when you finish.
15
+
16
+ ## Attached files
17
+
18
+ When the user added screenshots or videos, the prompt has an "Attached files" section (「附件」 in Chinese): one absolute path per line with its kind, `image` or `video`. sideby saved them under its own `ai/attachments/<task-id>/` folder as `1.png`, `2.mp4` and so on, and deletes them after 7 days.
19
+
20
+ - Images: read the file at its path. Codex also received each image with `--image`, so it may already see it.
21
+ - Videos: you cannot watch one directly. When you need to see it, extract a few frames with ffmpeg and look at those, for example `ffmpeg -i <path> -vf fps=1 -frames:v 5 /tmp/frame-%d.png` (one frame a second, five frames). Pick a time with `-ss <seconds>` before `-i` when the user names one. If ffmpeg is missing, ask before installing it.
22
+ - Treat what you see as the user's evidence: an error message, a Panel screen, a settings page. Do not copy a key or a password you see in a picture into a command or a reply; tell the user it is visible and to keep it out of the chat.
23
+ - In a terminal, `sideby ask "<text>" --attach <file>` (repeatable, at most 5) adds files the same way; images up to 20 MB (PNG, JPEG, GIF, WebP), videos up to 200 MB (MP4, MOV, WebM).
24
+
25
+ ## Free text
26
+
27
+ Do what the user wrote, with the routing table in `SKILL.md`. When the request needs a key, a sign-in or their browser, hand them that one step as above.
28
+
29
+ ## fix: Findings Doctor cannot fix by itself
30
+
31
+ The prompt lists the Findings (`code`, account, message). Run `sideby doctor <ref> --json` to see them as they are now; some may already be gone. For each one, follow its message: run `sideby doctor <ref> --fix --json` only after the user has seen what it will change and agreed. Never replace a real file with a link, never change where a link points, and never touch backup leftovers: when a Finding asks for one of those, explain it and give the user the command the message suggests, for them to run after reading it.
32
+
33
+ ## quota: an account shows no quota or an error
34
+
35
+ The prompt names the account and the reason. Run `sideby quota <ref> --json` and relay what it says. Common answers: Claude needs `sideby quota setup claude` (exit 10 first); a signed-out account needs the user to sign in; Grok's quota check may be off (`sideby quota check grok on`); pi and API accounts have no public quota source, which is not an error.
36
+
37
+ ## account: add an account
38
+
39
+ ### Subscription account
40
+
41
+ 1. `sideby new <family> --next --json` (or the name the user asked for). It picks the next free name and short command.
42
+ 2. Tell the user to click **Sign in** on the new account in the Panel, or to run `sideby login <ref>` in their terminal. Wait until they say it is done.
43
+ 3. `sideby doctor <ref> --json`, then tell them how to start it (`sideby run <ref>` or the short command).
44
+
45
+ ### API account
46
+
47
+ sideby ships no list of vendors, addresses or model names. Take every fact from the vendor's own documentation and the Host's own docs or `--help`, and tell the user which page you used. Do not use blog posts, other tools' preset lists or your memory for an address or a model name.
48
+
49
+ 1. From the docs (or the link the user gave), find: the address for the Family's API format (Claude Code needs an Anthropic-compatible address, Codex an OpenAI-compatible one), the variable the key goes in, and the model names, if the Host needs one.
50
+ 2. `sideby new <family> --next --api --json`. It creates `proxy.env` (mode 600) in the new account.
51
+ 3. Set every variable except the key: show the user the lines you will add to `proxy.env` and add them after they agree. Do not read the file's other lines, and never write a key into it.
52
+ 4. Tell the user to run `sideby key <ref>` in their own terminal (or click **Enter key** in the Panel). Add `--var <NAME>` when the key belongs in a variable other than the Family's default. Wait until they say it is done.
53
+ 5. Offer `sideby try <ref> --json`: it exits 10 and says which command it runs and that it costs a few tokens. After they agree, run it with `--yes`. Exit 0 means the Host answered. On 1, read the Host's message it shows and check the mistakes below.
54
+
55
+ Common mistakes:
56
+
57
+ - **Plan address vs pay-as-you-go address.** Many vendors have one address for a coding plan and another for pay-as-you-go. A plan key on the pay-as-you-go address (or the reverse) fails or bills the wrong way. Match the address to the key the user has.
58
+ - **Key in the wrong variable.** For Claude Code, `ANTHROPIC_AUTH_TOKEN` and `ANTHROPIC_API_KEY` are not the same. A vendor that expects one gets nothing when the key is in the other, and Claude Code then asks to log in. Use the variable the vendor's docs name, with `sideby key <ref> --var <NAME>`.
59
+ - **API format does not match the address.** An OpenAI-style address under Claude Code (or the reverse) fails on the first request. Use the address the vendor lists for that format.
60
+ - **A blocked model list looks like a bad key.** Some sites put a firewall in front of their model list; the Host may report that as an invalid key. Check the Host's message before telling the user the key is wrong.
61
+ - **Leftovers after switching back to a subscription.** An account that was an API account and should sign in again still has `proxy.env`, so it stays an API account. Create a new subscription account instead, or tell the user to remove that account's `proxy.env` themselves.
62
+
63
+ ## host: a tool sideby does not support yet
64
+
65
+ First make it work for this user as a local Family Plugin; a built-in Family is a later, optional step.
66
+
67
+ 1. Gather these facts, each with its source and the evidence "tool X version Y, date" (`<tool> --version` and today's date):
68
+ - the binary name, and the install command or link;
69
+ - the environment variable that makes the tool use another config directory (without one, sideby cannot run accounts side by side; stop and tell the user);
70
+ - where the main config directory is, and how an account directory would look;
71
+ - Hijack Variables: environment variables that would override the account (keys, base URLs);
72
+ - the sign-in command, and a login-state rule that only checks whether a file exists, never what it holds;
73
+ - every Shared Item (skills, hooks, rules, settings) and its Share Mode, and whether the tool refuses links for any of them;
74
+ - whether it writes quota or usage to local files (if not, leave those readers out);
75
+ - a logo (one SVG path) with its source and license.
76
+ 2. Ask the user where the plugin should live; the default is fine for most people. `sideby plugins new <id> --json` creates it there with a skeleton and a test.
77
+ 3. Fill in every `TODO` with the facts above.
78
+ 4. `sideby plugins check <id> --json`. Fix each problem as its message says, and run it again until it passes. It runs the plugin (in a separate process with a throwaway HOME, not a sandbox) only once the loader trusts its files.
79
+ 5. Try it in a demo HOME, not the user's real one: `sideby list`, `sideby new <id> test`, `sideby doctor`. If the user has a sideby checkout, `node scripts/demo-home.ts <dir>` makes one.
80
+ 6. Tell the user it works and how to create their first account with it (`sideby new <id> --next`).
81
+ 7. To make it a built-in Family, follow "Adding a family" in the repository's `AGENTS.md`, only after the user agrees (see Sharing below).
82
+
83
+ ## plugin: a hook or a check of the user's own
84
+
85
+ Plugins are local code that runs with the user's full permissions; say so before writing one. Ask what should happen and when (before a launch, after an account is created, during Doctor), then write it with the hooks in [docs/guide/plugins.md](https://github.com/Adonis0123/sideby/blob/main/docs/guide/plugins.md). Use `import type` only. Check it with `sideby plugins --json` (no load errors) and a run in a demo HOME.
86
+
87
+ ## terminal: open tasks in a terminal sideby does not list
88
+
89
+ The prompt gives the custom command saved now, if any, and the supported terminals installed on this computer.
90
+
91
+ 1. Ask which terminal the user wants tasks to open in.
92
+ 2. Read only that terminal's official docs and its `--help` (note the version). Find how it opens a new window that runs one command in a given folder.
93
+ 3. Write it as a template: `{cmd}` is the command, `{cwd}` the folder. sideby fills them in as separate arguments; no shell runs it, so do not add quotes or `sh -c` around them.
94
+ 4. Show the user the template, then with their yes save it with `sideby terminal --custom '<template>' --json` (it changes sideby's config and selects it).
95
+ 5. Have the user click **Let AI do it** in the Panel once to try it. If it does not open, read the error with them and fix the template.
96
+
97
+ When it works, the sharing step below asks whether to make the terminal built in: a row in the terminal table of `src/core/terminal.ts`, with tests.
98
+
99
+ ## handoff: tune Auto Handoff
100
+
101
+ The prompt gives Auto Handoff as it is now, in the words of `sideby handoff status --json`: `auto`, `sameFamily`, `threshold`, `prepareAt`, the order per Family, and for each account where its quota comes from and how much is used.
102
+
103
+ 1. Run `sideby handoff status --json` and `sideby quota --json` to see the facts as they are now.
104
+ 2. Recommend, with a reason the user can follow: a `threshold` (the quota percentage at which a session hands over; leave room before 100 so the session can finish its turn) and a `prepareAt` below it; an order per Family (`pressure`, the least used first, or a fixed `order` of accounts); and whether `sameFamily` should be on. Accounts signed in as the same login share one quota and never hand over to each other.
105
+ 3. Put accounts without quota data last, and tell the user how to make them show it (`sideby quota setup claude`, signing in, `sideby quota check grok on`).
106
+ 4. Change settings only with `sideby handoff enable [--same-family] [--order <family>=<acct,…>] [--threshold n] [--prepare-at n]` or `sideby config set handoff.<key> <value>`. Both show the change first and exit 10; add `--yes` only after the user agrees.
107
+ 5. Run `sideby handoff status --json` again and tell the user what is still missing (`nextSteps`).
108
+
109
+ ## Sharing it with sideby
110
+
111
+ Once the task works, ask the user whether they would like to share the improvement (a new tool, a fixed problem, a better prompt) with sideby. Only on a clear yes:
112
+
113
+ 1. Remove everything particular to their machine: real account names, emails, home paths, hostnames, ports and the names of their own tools. Use `claude:work`, `me@example.com` and port 17420 in examples.
114
+ 2. Fork `Adonis0123/sideby`, commit and open a pull request as its `CONTRIBUTING.md` says: one tool per pull request, the Host version and date it was tried with, tried on their own machine, `pnpm check` passing.
115
+
116
+ Never fork, commit or open a pull request without that yes.