sideby 0.19.0 → 0.20.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.
- package/README.md +7 -4
- package/ai-tasks.json +28 -0
- package/dist/build.json +1 -1
- package/dist/src/cli/commands.d.ts +22 -1
- package/dist/src/cli/commands.js +815 -21
- package/dist/src/cli/format.d.ts +4 -0
- package/dist/src/cli/format.js +42 -4
- package/dist/src/cli/json-schemas.js +334 -4
- package/dist/src/cli/main.js +159 -13
- package/dist/src/core/accounts.d.ts +6 -0
- package/dist/src/core/accounts.js +12 -0
- package/dist/src/core/autostart.d.ts +11 -0
- package/dist/src/core/autostart.js +32 -5
- package/dist/src/core/browser-profiles.d.ts +23 -2
- package/dist/src/core/browser-profiles.js +148 -37
- package/dist/src/core/claude-settings-file.d.ts +18 -0
- package/dist/src/core/claude-settings-file.js +52 -3
- package/dist/src/core/config.d.ts +5 -0
- package/dist/src/core/config.js +12 -1
- package/dist/src/core/edit-settings.d.ts +7 -0
- package/dist/src/core/edit-settings.js +10 -5
- package/dist/src/core/file-memo.js +26 -4
- package/dist/src/core/history-group.d.ts +28 -0
- package/dist/src/core/history-group.js +47 -0
- package/dist/src/core/history-index.d.ts +145 -0
- package/dist/src/core/history-index.js +447 -0
- package/dist/src/core/history-project.d.ts +13 -0
- package/dist/src/core/history-project.js +87 -0
- package/dist/src/core/history.d.ts +210 -0
- package/dist/src/core/history.js +952 -0
- package/dist/src/core/inbound.d.ts +62 -0
- package/dist/src/core/inbound.js +215 -0
- package/dist/src/core/launch.d.ts +9 -1
- package/dist/src/core/launch.js +58 -24
- package/dist/src/core/live-sessions-copy.d.ts +5 -0
- package/dist/src/core/live-sessions-copy.js +46 -0
- package/dist/src/core/live-sessions-procs.d.ts +89 -0
- package/dist/src/core/live-sessions-procs.js +296 -0
- package/dist/src/core/live-sessions-title.d.ts +28 -0
- package/dist/src/core/live-sessions-title.js +80 -0
- package/dist/src/core/live-sessions.d.ts +68 -0
- package/dist/src/core/live-sessions.js +163 -0
- package/dist/src/core/login-check.d.ts +15 -0
- package/dist/src/core/login-check.js +32 -0
- package/dist/src/core/messages.d.ts +83 -0
- package/dist/src/core/messages.js +433 -0
- package/dist/src/core/project-categories.d.ts +14 -0
- package/dist/src/core/project-categories.js +48 -0
- package/dist/src/core/quota-fetch.d.ts +3 -3
- package/dist/src/core/quota-fetch.js +5 -5
- package/dist/src/core/quota-levels.d.ts +5 -0
- package/dist/src/core/quota-levels.js +5 -0
- package/dist/src/core/remote-control.d.ts +2 -0
- package/dist/src/core/remote-control.js +34 -59
- package/dist/src/core/run-link.d.ts +76 -0
- package/dist/src/core/run-link.js +245 -0
- package/dist/src/core/same-login.d.ts +4 -3
- package/dist/src/core/same-login.js +10 -7
- package/dist/src/core/session-select.d.ts +31 -0
- package/dist/src/core/session-select.js +44 -0
- package/dist/src/families/browser.d.ts +7 -18
- package/dist/src/families/browser.js +19 -8
- package/dist/src/families/claude/deliver.d.ts +2 -0
- package/dist/src/families/claude/deliver.js +43 -0
- package/dist/src/families/claude/history.d.ts +2 -0
- package/dist/src/families/claude/history.js +192 -0
- package/dist/src/families/claude/live-sessions.d.ts +13 -0
- package/dist/src/families/claude/live-sessions.js +117 -0
- package/dist/src/families/claude/messaging.d.ts +69 -0
- package/dist/src/families/claude/messaging.js +165 -0
- package/dist/src/families/claude/mod.d.ts +26 -0
- package/dist/src/families/claude/mod.js +105 -0
- package/dist/src/families/claude/session-files.d.ts +21 -0
- package/dist/src/families/claude/session-files.js +54 -0
- package/dist/src/families/codex/deliver.d.ts +5 -0
- package/dist/src/families/codex/deliver.js +76 -0
- package/dist/src/families/codex/history.d.ts +7 -0
- package/dist/src/families/codex/history.js +174 -0
- package/dist/src/families/codex/index.js +2 -0
- package/dist/src/families/codex/live-sessions.d.ts +12 -0
- package/dist/src/families/codex/live-sessions.js +193 -0
- package/dist/src/families/codex/quota.d.ts +3 -0
- package/dist/src/families/codex/quota.js +123 -0
- package/dist/src/families/codex/rate-limits.js +2 -0
- package/dist/src/families/codex/rollout.js +1 -1
- package/dist/src/families/grok/browser.d.ts +3 -0
- package/dist/src/families/grok/browser.js +5 -0
- package/dist/src/families/grok/history.d.ts +2 -0
- package/dist/src/families/grok/history.js +157 -0
- package/dist/src/families/grok/live-sessions.d.ts +4 -0
- package/dist/src/families/grok/live-sessions.js +80 -0
- package/dist/src/families/grok/login-key.d.ts +14 -0
- package/dist/src/families/grok/login-key.js +37 -0
- package/dist/src/families/history.d.ts +20 -0
- package/dist/src/families/history.js +81 -0
- package/dist/src/families/live-sessions.d.ts +26 -0
- package/dist/src/families/live-sessions.js +9 -0
- package/dist/src/families/login-keys.js +5 -1
- package/dist/src/families/messaging.d.ts +27 -0
- package/dist/src/families/messaging.js +6 -0
- package/dist/src/families/pi/history.d.ts +2 -0
- package/dist/src/families/pi/history.js +124 -0
- package/dist/src/families/pi/live-sessions.d.ts +2 -0
- package/dist/src/families/pi/live-sessions.js +70 -0
- package/dist/src/families/shared/history-text.d.ts +65 -0
- package/dist/src/families/shared/history-text.js +261 -0
- package/dist/src/menubar/hotkey.d.ts +86 -0
- package/dist/src/menubar/hotkey.js +159 -0
- package/dist/src/menubar/script.d.ts +2 -0
- package/dist/src/menubar/script.js +118 -22
- package/dist/src/menubar/snapshot.d.ts +8 -4
- package/dist/src/menubar/snapshot.js +45 -13
- package/dist/src/menubar/strings.d.ts +24 -6
- package/dist/src/menubar/strings.js +24 -6
- package/dist/src/panel/handler.d.ts +69 -0
- package/dist/src/panel/handler.js +686 -15
- package/dist/src/panel/i18n.d.ts +304 -3
- package/dist/src/panel/i18n.js +669 -67
- package/dist/src/panel/orca.d.ts +48 -0
- package/dist/src/panel/orca.js +153 -0
- package/dist/src/panel/page-logic.d.ts +255 -13
- package/dist/src/panel/page-logic.js +483 -1
- package/dist/src/panel/page-script.js +2265 -207
- package/dist/src/panel/page-styles.js +404 -32
- package/dist/src/panel/page.js +1 -0
- package/dist/src/plugins/account-script.js +61 -27
- package/dist/src/plugins/check.js +16 -4
- package/dist/src/plugins/loader.d.ts +8 -1
- package/dist/src/plugins/loader.js +72 -7
- package/dist/src/runtime.d.ts +5 -0
- package/dist/src/runtime.js +27 -5
- package/dist/src/types.d.ts +116 -1
- package/dist/testing/index.d.ts +5 -0
- package/dist/testing/index.js +5 -0
- package/mods/claude/.claude-plugin/plugin.json +7 -0
- package/mods/claude/hooks/hooks.json +1 -0
- package/mods/claude/hooks/register.js +261 -0
- package/package.json +5 -2
- package/schemas/autostart.json +74 -1
- package/schemas/browser-set.json +110 -0
- package/schemas/browser.json +22 -2
- package/schemas/config.json +26 -1
- package/schemas/history-index.json +209 -0
- package/schemas/history-projects.json +133 -0
- package/schemas/history-show.json +275 -0
- package/schemas/history.json +410 -0
- package/schemas/menubar-hotkey.json +139 -0
- package/schemas/menubar-snapshot.json +36 -2
- package/schemas/menubar.json +74 -1
- package/schemas/messages-inbound.json +258 -0
- package/schemas/messages.json +164 -0
- package/schemas/send.json +165 -0
- package/schemas/sessions-copy.json +113 -0
- package/schemas/sessions-open-run.json +97 -0
- package/schemas/sessions.json +237 -0
- package/skills/sideby/SKILL.md +10 -5
- package/skills/sideby/references/accounts.md +11 -0
- package/skills/sideby/references/ai-tasks.md +17 -1
- package/skills/sideby/references/panel.md +6 -4
- package/skills/sideby/references/quota.md +2 -2
- package/skills/sideby/references/sessions.md +79 -0
package/dist/src/cli/main.js
CHANGED
|
@@ -70,12 +70,32 @@ Usage:
|
|
|
70
70
|
sideby desktop <account> open the desktop app (Claude Desktop, the Codex app) as this
|
|
71
71
|
account, next to the others (macOS)
|
|
72
72
|
sideby desktop grok-bot:<name> open a Grok Bot window, a new one for a new name (macOS)
|
|
73
|
+
sideby sessions [<account>|<family>] which session each account runs now, needing you first
|
|
74
|
+
sideby sessions copy <account|session-id> [--as reference|id|resume]
|
|
75
|
+
copy one for another AI: a reference to its record (default),
|
|
76
|
+
its id or its resume command
|
|
77
|
+
sideby sessions open-run <account|session-id>
|
|
78
|
+
open the run report of the dispatched task that session works for
|
|
79
|
+
sideby history [<words>...] find any past session of any account, by project, AI, time
|
|
80
|
+
or what was said (--project, --family, --account, --since,
|
|
81
|
+
--tools also searches tool output)
|
|
82
|
+
sideby history show <id> read one session; history projects lists the projects
|
|
83
|
+
sideby history index [--clear] the local search index: how far it is built, or delete it
|
|
84
|
+
sideby send <account|session> "<text>" [--image <path>]...
|
|
85
|
+
tell another session something (a screenshot too): Claude
|
|
86
|
+
sessions get it at once, others through a line you paste
|
|
87
|
+
sideby messages [--to <account|session>]
|
|
88
|
+
the messages you sent and whether each was delivered or read
|
|
89
|
+
sideby messages inbound [accept|undo] [--yes]
|
|
90
|
+
whether Claude sessions show messages from other sessions at once
|
|
73
91
|
sideby edit <account> [--path] open the account's own settings file (settings.json,
|
|
74
92
|
config.toml) in your editor
|
|
75
93
|
sideby browser [--enable [--yes]] which Chrome browser user signed in to each account's website
|
|
76
94
|
(read on this computer only; off until you enable it)
|
|
77
95
|
sideby browser open <account> [--profile <name>]
|
|
78
96
|
open claude.ai, chatgpt.com or grok.com in that browser user
|
|
97
|
+
sideby browser set <account> <name> | --auto
|
|
98
|
+
choose that browser user yourself, or let sideby find it again
|
|
79
99
|
sideby app install [--url <url>] add a sideby app that opens the panel (macOS, Linux)
|
|
80
100
|
sideby app uninstall remove that app
|
|
81
101
|
sideby shell-init zsh|bash print shell functions, e.g. eval "$(sideby shell-init zsh)"
|
|
@@ -91,6 +111,7 @@ Usage:
|
|
|
91
111
|
sideby autostart [on|off] [--yes] start the panel in the background at login (macOS; shows the
|
|
92
112
|
file first)
|
|
93
113
|
sideby menubar [on|off] [--yes] show quota in the macOS menu bar; click an account to start it
|
|
114
|
+
sideby menubar hotkey [<keys>|off] show or change the shortcut that opens that menu (⌥X)
|
|
94
115
|
sideby config get [<key>] every setting with its value and meaning, or one setting
|
|
95
116
|
sideby config set <key> <value> [--yes]
|
|
96
117
|
change any setting (sideby config set panel.theme dark)
|
|
@@ -100,10 +121,10 @@ Usage:
|
|
|
100
121
|
|
|
101
122
|
Options:
|
|
102
123
|
--json machine-readable output (list, new, next, alias, doctor, quota, tune, model, remote-control, handoff,
|
|
103
|
-
families, plugins, app, desktop,
|
|
104
|
-
autostart, menubar, config)
|
|
124
|
+
families, plugins, app, desktop, sessions, history, send, messages, edit, browser, update, local, ask,
|
|
125
|
+
terminal, key, try, autostart, menubar, config)
|
|
105
126
|
-h, --help show this help; \`sideby <command> --help\` for new, alias, login, doctor, families, desktop, edit, browser,
|
|
106
|
-
autostart, menubar, config
|
|
127
|
+
autostart, menubar, config, sessions, history, send, messages
|
|
107
128
|
-v, --version show the version
|
|
108
129
|
|
|
109
130
|
An <account> is <family>:<name> (claude:work) or just <name> when it is unique.
|
|
@@ -120,7 +141,7 @@ Updates: once a day sideby asks the npm registry for its newest version and says
|
|
|
120
141
|
Turn it off with NO_UPDATE_NOTIFIER=1 or config "update": { "check": false }; "auto": true installs by itself.`;
|
|
121
142
|
/** `sideby <command> --help` for the commands agents use to set up and repair accounts (spec §3.16). */
|
|
122
143
|
const COMMAND_HELP = {
|
|
123
|
-
ask: 'sideby ask [<text>] [--task free|fix|quota|account|host|plugin|terminal|handoff] [--account <ref>] [--terminal <id>] [--attach <file>]... [--print] [--json]\nsideby ask --run <id> [--state-dir <dir>]\nsideby ask --spec - [--print] --json\nsideby ask --choices --json\nOpen a task in your terminal. --spec reads a Task Spec (one JSON object, at most 1 MB) from stdin, as a Portal sends it; --choices lists the accounts and terminals a task can use. --attach adds an image (PNG, JPEG, GIF, WebP; up to 20 MB) or a video (MP4, MOV, WebM; up to 200 MB), at most 5. --print prints only the prompt. If opening fails, paste the command into a terminal.',
|
|
144
|
+
ask: 'sideby ask [<text>] [--task free|fix|quota|account|host|plugin|terminal|handoff|menubar|hotkey] [--account <ref>] [--terminal <id>] [--attach <file>]... [--print] [--json]\nsideby ask --run <id> [--state-dir <dir>]\nsideby ask --spec - [--print] --json\nsideby ask --choices --json\nOpen a task in your terminal. --spec reads a Task Spec (one JSON object, at most 1 MB) from stdin, as a Portal sends it; --choices lists the accounts and terminals a task can use. --attach adds an image (PNG, JPEG, GIF, WebP; up to 20 MB) or a video (MP4, MOV, WebM; up to 200 MB), at most 5. --print prints only the prompt. If opening fails, paste the command into a terminal.',
|
|
124
145
|
terminal: "sideby terminal [--set <id>|--custom '<program> … {cwd} … {cmd}'|--unset] [--json]\nList terminals or save your preference; --custom saves and selects your own launch command.",
|
|
125
146
|
key: 'sideby key <account> [--var <NAME>] [--json]\nEnter an API key without echo. Run in a terminal or use the Panel key box.',
|
|
126
147
|
try: 'sideby try <account> [--yes] [--json]\nSend a short request through the Host. This spends a few tokens. Exit 10 waits for --yes.',
|
|
@@ -217,6 +238,102 @@ Examples:
|
|
|
217
238
|
sideby desktop grok-bot:002 --remove --yes
|
|
218
239
|
Exit: 0 opened, brought to the front or removed; 1 not macOS, no desktop app for that host, API account, app not
|
|
219
240
|
installed, a bad window name, or the app did not open; 10 --remove without --yes; 2 malformed command line.`,
|
|
241
|
+
sessions: `sideby sessions [<account>|<family>] [--json]
|
|
242
|
+
sideby sessions copy <account|session-id> [--as reference|id|resume] [--lang en|zh] [--json]
|
|
243
|
+
sideby sessions open-run <account|session-id> [--json]
|
|
244
|
+
|
|
245
|
+
List the sessions every account runs now (Claude Code, Codex, Grok Build, pi): each row shows the Session Label
|
|
246
|
+
(account · the host's own title · first 8 of the id), whether it needs you, its directory and when it started.
|
|
247
|
+
Sessions that need you come first. Codex and pi sessions sideby cannot tie to a running program show the account's
|
|
248
|
+
newest session, marked "guessed". Read-only: sideby reads the hosts' session files, never a credential.
|
|
249
|
+
|
|
250
|
+
copy puts one session on the clipboard (pbcopy on macOS, wl-copy or xclip on Linux; without one it prints the text):
|
|
251
|
+
by default a Session Reference, one sentence that points another AI at the session's record; --as id copies the bare
|
|
252
|
+
id, --as resume the command that resumes it. The reference follows your locale; --lang chooses.
|
|
253
|
+
When an account runs several sessions, copy lists them: copy one by its id.
|
|
254
|
+
|
|
255
|
+
open-run opens the run report (Run Board) of the task a session works for, when a local orchestrator such as the
|
|
256
|
+
agent-dispatch skill says so, with the default program. It picks the session the way copy does.
|
|
257
|
+
|
|
258
|
+
Examples:
|
|
259
|
+
sideby sessions
|
|
260
|
+
sideby sessions cc002 --json
|
|
261
|
+
sideby sessions copy cc002
|
|
262
|
+
sideby sessions copy 61230c3d --as resume
|
|
263
|
+
sideby sessions open-run cc002
|
|
264
|
+
Exit: 0 listed, copied or opened; 1 no such account or running session, several to choose from, or the session is
|
|
265
|
+
in no run (or its report changed or did not open); 2 malformed command line.`,
|
|
266
|
+
history: `sideby history [<words>...] [--project <path|name>] [--category <name>] [--family <id>]
|
|
267
|
+
[--account <account>] [--since today|7d|30d|all] [--group project|category|account|family|day|none]
|
|
268
|
+
[--scripts] [--tools] [--limit <n>] [--offset <n>] [--json]
|
|
269
|
+
sideby history show <session-id> [--account <account>] [--before <n>] [--limit <n>] [--json]
|
|
270
|
+
sideby history projects [--family <id>] [--account <account>] [--since <s>] [--scripts] [--json]
|
|
271
|
+
sideby history index [--clear] [--json]
|
|
272
|
+
|
|
273
|
+
Find any past session of any account (Claude Code, Codex, Grok Build, pi), grouped by Project: the git repository it
|
|
274
|
+
ran in, with worktrees and subfolders folded into it. Each row shows when it was last active, the account, its title
|
|
275
|
+
(the name you gave it, else the host's title, else your first prompt), the project, the branch and its id; with words,
|
|
276
|
+
a snippet of where they matched. Every word must match, in the title, project, branch, account, your prompts or the
|
|
277
|
+
replies; one- and two-character words work too, and "two words" in double quotes match as one phrase. Results come
|
|
278
|
+
best match first, newer ones ahead. --project takes a project's name or any folder in it (. for the current one).
|
|
279
|
+
--group lists the sessions under a heading per project, category, account, AI or day; --category keeps one category
|
|
280
|
+
when a plugin sorts projects into categories. --limit (at most 500, default 30) and --offset page through the list.
|
|
281
|
+
|
|
282
|
+
sideby keeps a local search index (the History Index) of each session's title, project, your prompts and the replies,
|
|
283
|
+
never tool output, in its state folder (mode 600). The first run builds it (it shows progress); later runs read only
|
|
284
|
+
changed files. When the index fills fewer rows than --limit, --tools also reads the session files in scope for tool
|
|
285
|
+
output, keeping nothing (the total then counts those matches too; they get foundIn "tools" in --json, and
|
|
286
|
+
toolOutputMore says more matched than the page holds). Script and SDK sessions are hidden unless --scripts. config history.index false turns the index off and deletes it; index --clear deletes it.
|
|
287
|
+
|
|
288
|
+
show prints one session read-only, the newest 200 messages (--before goes further back), tool calls as one line each.
|
|
289
|
+
Its last line is the command that continues it where it was (continueCommand in --json): it goes to its folder
|
|
290
|
+
and resumes it in the account that holds it. Read-only: sideby reads the hosts' session files, never a credential, and writes nothing there.
|
|
291
|
+
To search for the words show, projects or index, put them after --.
|
|
292
|
+
|
|
293
|
+
Examples:
|
|
294
|
+
sideby history login page
|
|
295
|
+
sideby history --project . --since 7d
|
|
296
|
+
sideby history "fix login" --group day
|
|
297
|
+
sideby history 登录 --family claude --json
|
|
298
|
+
sideby history show 61230c3d
|
|
299
|
+
Exit: 0 listed; 1 no such session, project or account, or several sessions match the id; 2 malformed command line.`,
|
|
300
|
+
send: `sideby send <account|session> "<text>" [--image <path>]... [--lang en|zh] [--json]
|
|
301
|
+
|
|
302
|
+
Tell another running session something, with screenshots if you like. <account> is a short command or ref whose
|
|
303
|
+
account runs one session now; <session> is a session id or its first 8 characters (see \`sideby sessions\`).
|
|
304
|
+
sideby first keeps the message as a file in its state folder (mode 600), with each screenshot copied next to it.
|
|
305
|
+
Then a Claude Code session gets it at once through Claude Code's own messages between sessions, with a first line
|
|
306
|
+
naming who sent it and one line per screenshot path. Codex, Grok Build and pi have no channel sideby can deliver to
|
|
307
|
+
yet: sideby copies one line to the clipboard ("Read the message sideby kept for you at <file> ...") and says which
|
|
308
|
+
tab to paste it into. A Claude session in bypass permission mode holds the message until you approve it in its
|
|
309
|
+
terminal (about 5 minutes); \`sideby messages inbound accept\` makes it show them at once.
|
|
310
|
+
Screenshots: PNG, JPEG, GIF or WebP, up to 20 MB each. Run it inside a session and the message names that session as
|
|
311
|
+
the sender. --lang chooses the language of the line to paste (default: your locale).
|
|
312
|
+
|
|
313
|
+
Examples:
|
|
314
|
+
sideby send cc002 "the tests pass now, go ahead and release"
|
|
315
|
+
sideby send 61230c3d "this is the error I see" --image ~/Desktop/shot.png
|
|
316
|
+
sideby send codex:team "read the plan in docs/plan.md" --json
|
|
317
|
+
Exit: 0 delivered or kept for pasting; 1 no such running session, several to choose from, or a screenshot sideby
|
|
318
|
+
refuses; 2 malformed command line.`,
|
|
319
|
+
messages: `sideby messages [--to <account|session>] [--limit <n>] [--json]
|
|
320
|
+
sideby messages inbound [accept|undo] [--yes] [--json]
|
|
321
|
+
|
|
322
|
+
List the messages you sent with \`sideby send\`, newest first: to which session, and how far each got (delivered,
|
|
323
|
+
read once it shows in the target's record, or needs paste).
|
|
324
|
+
|
|
325
|
+
inbound shows, for each Claude account, its crossSessionInbound setting: accept shows a message from another session
|
|
326
|
+
at once; hold, or no setting in a session in bypass permission mode, waits for you to approve it and drops it after
|
|
327
|
+
about 5 minutes; refuse drops it. accept shows the change to each settings.json (only that key) and writes it with
|
|
328
|
+
--yes; a file shared by several accounts is written once, a "refuse" or any other value is left alone and named. undo puts
|
|
329
|
+
back exactly what was there, while the key still holds what sideby wrote.
|
|
330
|
+
|
|
331
|
+
Examples:
|
|
332
|
+
sideby messages
|
|
333
|
+
sideby messages --to cc002 --json
|
|
334
|
+
sideby messages inbound accept --yes
|
|
335
|
+
Exit: 0 listed or changed; 1 a file could not be changed or nothing was changed; 10 a change was shown and waits for --yes; 2 malformed
|
|
336
|
+
command line.`,
|
|
220
337
|
edit: `sideby edit <account> [--path] [--json]
|
|
221
338
|
|
|
222
339
|
Open the account's own settings file in your editor: settings.json for claude and pi accounts, config.toml for codex
|
|
@@ -249,8 +366,9 @@ Examples:
|
|
|
249
366
|
Exit: 0 shown, done or nothing to change; 10 a change was shown and waits for --yes; 1 refused (not macOS, sideby
|
|
250
367
|
in the npx cache or a temporary folder, a file that is not sideby's) or failed; 2 malformed command line.`,
|
|
251
368
|
menubar: `sideby menubar [on|off] [--yes] [--json]
|
|
252
|
-
sideby menubar snapshot [--lang en|zh] [--json]
|
|
369
|
+
sideby menubar snapshot [--refresh] [--lang en|zh] [--json]
|
|
253
370
|
sideby menubar start <account> [--json]
|
|
371
|
+
sideby menubar hotkey [<keys>|off|default] [--json]
|
|
254
372
|
|
|
255
373
|
Show quota in the macOS menu bar: a gauge with one percent, how much the account sideby would pick next has used
|
|
256
374
|
in your tightest tool (orange from 60%, red from 85%). Click it for every account's 5-hour and 7-day quota; click
|
|
@@ -259,12 +377,15 @@ icon. macOS only for now (a LaunchAgent, ~/Library/LaunchAgents/dev.sideby.menub
|
|
|
259
377
|
|
|
260
378
|
Without on or off it says whether it is on, off, out of date or blocked by a file that is not sideby's. on and off
|
|
261
379
|
show the file first; --yes does it. snapshot prints what the menu shows (the menu bar item runs it every 2 minutes).
|
|
262
|
-
start opens an account in your preferred terminal, as clicking it does.
|
|
380
|
+
start opens an account in your preferred terminal, as clicking it does. hotkey shows or changes the shortcut that
|
|
381
|
+
opens the menu from anywhere (⌥X by default): opt, cmd or ctrl, any of shift, and one letter or digit; off turns
|
|
382
|
+
it off. A running menu bar item takes the new one within seconds, without a restart.
|
|
263
383
|
|
|
264
384
|
Examples:
|
|
265
385
|
sideby menubar on --yes
|
|
266
386
|
sideby menubar snapshot --json
|
|
267
387
|
sideby menubar start claude:work
|
|
388
|
+
sideby menubar hotkey ctrl+opt+s
|
|
268
389
|
sideby menubar off --yes
|
|
269
390
|
Exit: 0 shown, done or nothing to change; 10 a change was shown and waits for --yes; 1 refused (not macOS, sideby
|
|
270
391
|
in the npx cache or a temporary folder, a file that is not sideby's), failed, or the terminal did not open; 2
|
|
@@ -291,17 +412,24 @@ Exit: 0 shown, saved or nothing to change; 10 a change was shown and waits for -
|
|
|
291
412
|
does not take, or the file changed meanwhile; 2 malformed command line.`,
|
|
292
413
|
browser: `sideby browser [--enable|--disable] [--yes] [--json]
|
|
293
414
|
sideby browser open <account> [--profile <folder|name>] [--json]
|
|
415
|
+
sideby browser set <account> <folder|name> [--json]
|
|
416
|
+
sideby browser set <account> --auto [--json]
|
|
294
417
|
|
|
295
418
|
Find which Google Chrome browser user signed in to each account's website (claude.ai for claude accounts,
|
|
296
|
-
chatgpt.com for codex accounts), and open the website in that browser user.
|
|
419
|
+
chatgpt.com for codex accounts, the website a plugin family declares), and open the website in that browser user.
|
|
420
|
+
macOS and WSL only for now.
|
|
297
421
|
|
|
298
422
|
Everything is read on this computer and sent nowhere. sideby reads each browser user's name, the key names (never
|
|
299
|
-
the values) claude.ai
|
|
300
|
-
Codex login file, only to compare. It never opens cookies, saved passwords or the Keychain, and never changes Chrome.
|
|
423
|
+
the values) claude.ai, chatgpt.com, grok.com and plugin websites keep in that browser user's Local Storage, and the account id
|
|
424
|
+
in each Claude, Codex, Grok or plugin login file, only to compare. It never opens cookies, saved passwords or the Keychain, and never changes Chrome.
|
|
301
425
|
It is off until you turn it on: --enable shows what it reads and changes config browser.signIns after --yes.
|
|
302
426
|
|
|
303
427
|
"Signed in to" means that browser user's data shows a sign-in as that account; it may be left over from before a
|
|
304
|
-
sign-out.
|
|
428
|
+
sign-out. When several browser users show one account, sideby keeps those whose Google account in Chrome is the
|
|
429
|
+
account's login email. An account found nowhere gets the one browser user whose Google account is its login email.
|
|
430
|
+
|
|
431
|
+
When sideby picks the wrong browser user, set chooses one for the account (saved in config browser.choices; it
|
|
432
|
+
replaces what sideby finds, and open uses it). --auto forgets the choice. Only sideby's config is written.
|
|
305
433
|
|
|
306
434
|
open uses the one browser user that signed in to the account, or the one --profile names (folder such as
|
|
307
435
|
"Profile 7", or the name Chrome shows). It runs: open -na "Google Chrome" --args --profile-directory=<folder> <url>.
|
|
@@ -311,7 +439,8 @@ Examples:
|
|
|
311
439
|
sideby browser
|
|
312
440
|
sideby browser open cc008
|
|
313
441
|
sideby browser open grok:main --profile Work
|
|
314
|
-
|
|
442
|
+
sideby browser set codex:main "Profile 7"
|
|
443
|
+
Exit: 0 shown, changed, chosen or opened; 1 not macOS, Chrome not installed, no or several browser users to choose from, or
|
|
315
444
|
Chrome did not open; 10 --enable/--disable without --yes; 2 malformed command line.`,
|
|
316
445
|
families: `sideby families [family] [--json]
|
|
317
446
|
|
|
@@ -342,7 +471,7 @@ const COMMANDS = {
|
|
|
342
471
|
key: { flags: ['json'], valued: ['var'] },
|
|
343
472
|
try: { flags: ['json', 'yes'] },
|
|
344
473
|
autostart: { flags: ['json', 'yes', 'refresh'] },
|
|
345
|
-
menubar: { flags: ['json', 'yes', 'refresh'], valued: ['lang'] },
|
|
474
|
+
menubar: { flags: ['json', 'yes', 'refresh'], valued: ['lang', 'hotkey', 'hotkey-label', 'icon'] },
|
|
346
475
|
config: { flags: ['json', 'yes'] },
|
|
347
476
|
list: { flags: ['json'] },
|
|
348
477
|
pin: { flags: ['json'] },
|
|
@@ -366,8 +495,15 @@ const COMMANDS = {
|
|
|
366
495
|
ui: { flags: ['no-open', 'background', 'stop', 'serve-detached'], valued: ['port'] },
|
|
367
496
|
app: { flags: ['json'], valued: ['url'] },
|
|
368
497
|
desktop: { flags: ['json', 'remove', 'yes'] },
|
|
498
|
+
sessions: { flags: ['json'], valued: ['as', 'lang'] },
|
|
499
|
+
history: {
|
|
500
|
+
flags: ['json', 'scripts', 'tools', 'clear'],
|
|
501
|
+
valued: ['project', 'category', 'group', 'family', 'account', 'since', 'limit', 'offset', 'before'],
|
|
502
|
+
},
|
|
503
|
+
send: { flags: ['json'], valued: ['image', 'lang'] },
|
|
504
|
+
messages: { flags: ['json', 'yes'], valued: ['to', 'limit'] },
|
|
369
505
|
edit: { flags: ['json', 'path'] },
|
|
370
|
-
browser: { flags: ['json', 'enable', 'disable', 'yes'], valued: ['profile'] },
|
|
506
|
+
browser: { flags: ['json', 'enable', 'disable', 'yes', 'auto'], valued: ['profile'] },
|
|
371
507
|
'shell-init': { flags: ['write', 'yes', 'undo', 'json'] },
|
|
372
508
|
plugins: { flags: ['json'] },
|
|
373
509
|
families: { flags: ['json'] },
|
|
@@ -544,6 +680,8 @@ export async function main(argv) {
|
|
|
544
680
|
// parseArgs keeps the last value of an option; `ask --attach` may be given several times.
|
|
545
681
|
if (cmd === 'ask')
|
|
546
682
|
parsed.attach = repeatedValues(own, 'attach');
|
|
683
|
+
if (cmd === 'send')
|
|
684
|
+
parsed.images = repeatedValues(own, 'image');
|
|
547
685
|
const cmds = await import('./commands.js');
|
|
548
686
|
if (wantsJson && noticeAllowed(cmd, parsed)) {
|
|
549
687
|
notice = await jsonNoticeFor();
|
|
@@ -616,6 +754,14 @@ async function dispatch(cmd, parsed, io, cmds) {
|
|
|
616
754
|
return await cmds.cmdApp(parsed, io);
|
|
617
755
|
case 'desktop':
|
|
618
756
|
return await cmds.cmdDesktop(parsed, io);
|
|
757
|
+
case 'sessions':
|
|
758
|
+
return await cmds.cmdSessions(parsed, io);
|
|
759
|
+
case 'history':
|
|
760
|
+
return await cmds.cmdHistory(parsed, io);
|
|
761
|
+
case 'send':
|
|
762
|
+
return await cmds.cmdSend(parsed, io);
|
|
763
|
+
case 'messages':
|
|
764
|
+
return await cmds.cmdMessages(parsed, io);
|
|
619
765
|
case 'edit':
|
|
620
766
|
return await cmds.cmdEdit(parsed, io);
|
|
621
767
|
case 'browser':
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Account, FamilyDef } from '../types.ts';
|
|
2
2
|
import { ACCOUNT_NAME } from './account-name.ts';
|
|
3
|
+
import { type Config } from './config.ts';
|
|
3
4
|
import { UserError } from './errors.ts';
|
|
4
5
|
export { ACCOUNT_NAME };
|
|
5
6
|
export declare function looksLikeBackup(name: string): boolean;
|
|
@@ -18,3 +19,8 @@ export declare class AccountRefError extends UserError {
|
|
|
18
19
|
export declare function resolveRef(ref: string, accounts: readonly Account[], aliases?: Readonly<Record<string, string>>): Account;
|
|
19
20
|
/** Alias names per Account ref, sorted. An alias whose target matches no Account is left out. */
|
|
20
21
|
export declare function aliasesByAccount(aliases: Readonly<Record<string, string>> | undefined, accounts: readonly Account[]): Map<string, string[]>;
|
|
22
|
+
/**
|
|
23
|
+
* The argument lists an Account may start with: its config `accounts.<ref>.args`, then each of its short commands'
|
|
24
|
+
* own arguments. Doctor and the Panel read them to tell whether its sessions start in bypass permission mode.
|
|
25
|
+
*/
|
|
26
|
+
export declare function startArgsOf(config: Pick<Config, 'accounts' | 'aliases'>, accounts: readonly Account[]): (a: Account) => string[][];
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { readdir } from 'node:fs/promises';
|
|
2
2
|
import { join } from 'node:path';
|
|
3
3
|
import { ACCOUNT_NAME } from './account-name.js';
|
|
4
|
+
import { aliasArgs, aliasRefs } from './config.js';
|
|
4
5
|
import { UserError } from './errors.js';
|
|
5
6
|
import { lstatOrNull, statOrNull } from './fs-safe.js';
|
|
6
7
|
export { ACCOUNT_NAME };
|
|
@@ -129,3 +130,14 @@ export function aliasesByAccount(aliases, accounts) {
|
|
|
129
130
|
}
|
|
130
131
|
return out;
|
|
131
132
|
}
|
|
133
|
+
/**
|
|
134
|
+
* The argument lists an Account may start with: its config `accounts.<ref>.args`, then each of its short commands'
|
|
135
|
+
* own arguments. Doctor and the Panel read them to tell whether its sessions start in bypass permission mode.
|
|
136
|
+
*/
|
|
137
|
+
export function startArgsOf(config, accounts) {
|
|
138
|
+
const byAccount = aliasesByAccount(aliasRefs(config.aliases), accounts);
|
|
139
|
+
return (a) => [
|
|
140
|
+
config.accounts?.[a.ref]?.args ?? [],
|
|
141
|
+
...(byAccount.get(a.ref) ?? []).map((n) => aliasArgs(config.aliases?.[n])),
|
|
142
|
+
];
|
|
143
|
+
}
|
|
@@ -42,6 +42,8 @@ export interface AutostartContext {
|
|
|
42
42
|
loginHome?: string;
|
|
43
43
|
/** The environment an agent's `environment` takes its variables from; this process's by default. */
|
|
44
44
|
env?: Env;
|
|
45
|
+
/** Waits between launchctl calls; tests pass one that returns at once. */
|
|
46
|
+
sleep?: (ms: number) => Promise<void>;
|
|
45
47
|
}
|
|
46
48
|
export interface AutostartStatus {
|
|
47
49
|
/** False on a system sideby cannot start at login yet; `reason` says so. */
|
|
@@ -55,6 +57,12 @@ export interface AutostartStatus {
|
|
|
55
57
|
current: boolean;
|
|
56
58
|
/** Recorded paths that no longer exist (state `stale`). */
|
|
57
59
|
missing?: string[];
|
|
60
|
+
/**
|
|
61
|
+
* Whether launchd holds the agent now, for an agent that keeps running (`restartOnCrash`) while it is on: false means
|
|
62
|
+
* the file is there but nothing runs it until the next login, and `sideby <command> on` starts it again. Absent when
|
|
63
|
+
* launchd cannot be asked (another HOME than the login one).
|
|
64
|
+
*/
|
|
65
|
+
loaded?: boolean;
|
|
58
66
|
}
|
|
59
67
|
export interface AutostartPlan {
|
|
60
68
|
action: 'on' | 'off';
|
|
@@ -84,6 +92,7 @@ export interface AutostartResult {
|
|
|
84
92
|
loaded: boolean;
|
|
85
93
|
note?: string;
|
|
86
94
|
}
|
|
95
|
+
export declare const defaultExec: AutostartExec;
|
|
87
96
|
export declare const PANEL_AGENT: LoginAgent;
|
|
88
97
|
export declare const agentPath: (home: string, agent: LoginAgent) => string;
|
|
89
98
|
export declare const autostartPath: (home: string) => string;
|
|
@@ -105,6 +114,8 @@ export declare function autostartLauncherProblem(l: AskLauncher, command?: strin
|
|
|
105
114
|
} | null>;
|
|
106
115
|
/** What `on` or `off` would change; writes nothing. */
|
|
107
116
|
export declare function planAutostart(ctx: AutostartContext, action: 'on' | 'off', agent?: LoginAgent): Promise<AutostartPlan>;
|
|
117
|
+
/** Whether launchctl may run: only for the login user's own LaunchAgents, never for a demo or test HOME. */
|
|
118
|
+
export declare function launchctlNote(ctx: AutostartContext): string | null;
|
|
108
119
|
/** Carries out a plan the user confirmed. Refuses, changing nothing, when the file changed since it was planned. */
|
|
109
120
|
export declare function applyAutostart(ctx: AutostartContext, plan: AutostartPlan, agent?: LoginAgent): Promise<AutostartResult>;
|
|
110
121
|
/**
|
|
@@ -12,7 +12,7 @@ import { askLauncher, launcherProblem } from './terminal.js';
|
|
|
12
12
|
export const AUTOSTART_LABEL = 'dev.sideby.panel';
|
|
13
13
|
/** Present in every agent sideby writes; a file without it is someone else's. */
|
|
14
14
|
export const AUTOSTART_MARKER = 'Written by `sideby autostart`';
|
|
15
|
-
const defaultExec = (file, args) => new Promise((resolve) => {
|
|
15
|
+
export const defaultExec = (file, args) => new Promise((resolve) => {
|
|
16
16
|
execFile(file, [...args], { timeout: 15_000 }, (err, stdout, stderr) => {
|
|
17
17
|
const code = err ? (typeof err.code === 'number' ? err.code : 1) : 0;
|
|
18
18
|
resolve({ code, output: `${stdout}${stderr}` });
|
|
@@ -115,12 +115,14 @@ export async function autostartStatus(ctx, agent = PANEL_AGENT) {
|
|
|
115
115
|
const launcher = ctx.launcher ?? askLauncher();
|
|
116
116
|
const want = agent.programArguments(launcher);
|
|
117
117
|
const current = args.length === want.length && args.every((a, i) => a === want[i]);
|
|
118
|
+
const loaded = agent.restartOnCrash && !launchctlNote(ctx) ? await agentLoaded(ctx, agent) : undefined;
|
|
118
119
|
return {
|
|
119
120
|
...base,
|
|
120
121
|
state: missing.length ? 'stale' : 'on',
|
|
121
122
|
programArguments: args,
|
|
122
123
|
current,
|
|
123
124
|
...(missing.length ? { missing } : {}),
|
|
125
|
+
...(loaded === undefined ? {} : { loaded }),
|
|
124
126
|
};
|
|
125
127
|
}
|
|
126
128
|
/** Under the system's temporary folders, which are emptied without asking. */
|
|
@@ -197,7 +199,7 @@ export async function planAutostart(ctx, action, agent = PANEL_AGENT) {
|
|
|
197
199
|
const same = hash !== null && hash === sha256(content);
|
|
198
200
|
// The file alone does not start it: launchd may have let it go (a `launchctl bootout`, a failed start), and then
|
|
199
201
|
// only loading it again brings it back.
|
|
200
|
-
const loaded = !same || (await agentLoaded(ctx, agent));
|
|
202
|
+
const loaded = !same || (status.loaded ?? (await agentLoaded(ctx, agent)));
|
|
201
203
|
return plan({
|
|
202
204
|
changed: !same || !loaded,
|
|
203
205
|
content,
|
|
@@ -216,8 +218,23 @@ async function agentLoaded(ctx, agent) {
|
|
|
216
218
|
const r = await (ctx.exec ?? defaultExec)('launchctl', ['print', `gui/${uidOf(ctx)}/${agent.label}`]).catch(() => null);
|
|
217
219
|
return r === null || r.code === 0;
|
|
218
220
|
}
|
|
221
|
+
const BOOTSTRAP_RETRIES = 3;
|
|
222
|
+
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
223
|
+
/**
|
|
224
|
+
* Waits, up to 10 s, until launchd no longer holds the agent: `launchctl bootout` returns while the job is still being
|
|
225
|
+
* torn down, and a bootstrap then fails. (`bootout --wait` exists on newer macOS but may block for ever.)
|
|
226
|
+
*/
|
|
227
|
+
async function untilUnloaded(ctx, agent) {
|
|
228
|
+
const exec = ctx.exec ?? defaultExec;
|
|
229
|
+
for (let i = 0; i < 50; i++) {
|
|
230
|
+
const r = await exec('launchctl', ['print', `gui/${uidOf(ctx)}/${agent.label}`]).catch(() => null);
|
|
231
|
+
if (r?.code !== 0)
|
|
232
|
+
return;
|
|
233
|
+
await (ctx.sleep ?? sleep)(200);
|
|
234
|
+
}
|
|
235
|
+
}
|
|
219
236
|
/** Whether launchctl may run: only for the login user's own LaunchAgents, never for a demo or test HOME. */
|
|
220
|
-
function launchctlNote(ctx) {
|
|
237
|
+
export function launchctlNote(ctx) {
|
|
221
238
|
let login = ctx.loginHome;
|
|
222
239
|
if (login === undefined)
|
|
223
240
|
try {
|
|
@@ -257,15 +274,25 @@ export async function applyAutostart(ctx, plan, agent = PANEL_AGENT) {
|
|
|
257
274
|
await run(bootout(ctx, agent));
|
|
258
275
|
return { changed: true, state: 'off', path, loaded: note === null, ...(note ? { note } : {}) };
|
|
259
276
|
}
|
|
260
|
-
if (plan.status.state !== 'off')
|
|
277
|
+
if (plan.status.state !== 'off') {
|
|
261
278
|
await run(bootout(ctx, agent));
|
|
279
|
+
if (!note)
|
|
280
|
+
await untilUnloaded(ctx, agent);
|
|
281
|
+
}
|
|
262
282
|
await mkdir(dirname(path), { recursive: true, mode: 0o755 });
|
|
263
283
|
// launchd skips an agent that others can write; 644 is what it expects.
|
|
264
284
|
if (!(await writeIfUnchanged(path, plan.hash, plan.content, 0o644)))
|
|
265
285
|
throw new UserError(`${path} changed while sideby was writing it; nothing was changed. Run the command again`, {
|
|
266
286
|
code: 'changed',
|
|
267
287
|
});
|
|
268
|
-
|
|
288
|
+
let r = await run(bootstrap(ctx, path));
|
|
289
|
+
// Error 5 (Input/output error): launchd is still tearing down the job a bootout let go (a bootout returns before it
|
|
290
|
+
// is done). Wait until it is gone and try again, a few times.
|
|
291
|
+
for (let i = 0; r && r.code === 5 && i < BOOTSTRAP_RETRIES; i++) {
|
|
292
|
+
await untilUnloaded(ctx, agent);
|
|
293
|
+
await (ctx.sleep ?? sleep)(500);
|
|
294
|
+
r = await run(bootstrap(ctx, path));
|
|
295
|
+
}
|
|
269
296
|
const result = {
|
|
270
297
|
changed: true,
|
|
271
298
|
state: 'on',
|
|
@@ -33,10 +33,17 @@ export interface BrowserReport {
|
|
|
33
33
|
matched: string[];
|
|
34
34
|
openOnly: string[];
|
|
35
35
|
};
|
|
36
|
+
/** The website each of those Families opens, Family id → https address. */
|
|
37
|
+
sites: Record<string, string>;
|
|
38
|
+
/**
|
|
39
|
+
* The browser user the user chose for an Account (config `browser.choices`), ref → folder, only where that folder
|
|
40
|
+
* still exists; such an Account appears in that profile's `signIns` alone.
|
|
41
|
+
*/
|
|
42
|
+
choices: Record<string, string>;
|
|
36
43
|
/** Problems met while reading, without file contents. */
|
|
37
44
|
problems: string[];
|
|
38
45
|
}
|
|
39
|
-
/** `id` appears in `key` as a whole segment: not glued to another letter
|
|
46
|
+
/** `id` appears in `key` as a whole segment: not glued to another letter or digit. */
|
|
40
47
|
export declare function keyHasId(key: string, id: string): boolean;
|
|
41
48
|
/** The Browser Report for `sideby browser` and the Panel. Reads nothing of the browser while it is off. */
|
|
42
49
|
export declare function browserReport(rt: Runtime, accounts: readonly Account[]): Promise<BrowserReport>;
|
|
@@ -55,8 +62,22 @@ export interface BrowserOpenResult {
|
|
|
55
62
|
* Chrome lists in `Local State`.
|
|
56
63
|
*/
|
|
57
64
|
export declare function openInBrowser(rt: Runtime, account: Account, profile?: string): Promise<BrowserOpenResult>;
|
|
65
|
+
export interface BrowserChoice {
|
|
66
|
+
ref: string;
|
|
67
|
+
/** The browser user now chosen, or null when sideby finds it again by itself. */
|
|
68
|
+
profile: {
|
|
69
|
+
dir: string;
|
|
70
|
+
name: string;
|
|
71
|
+
} | null;
|
|
72
|
+
changed: boolean;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* `sideby browser set` and the Panel (spec §3.24 "手动指定"): remembers which Chrome browser user is an Account's, in
|
|
76
|
+
* config `browser.choices`, or with `profile` null forgets it so sideby finds it again. Only sideby's config is written.
|
|
77
|
+
*/
|
|
78
|
+
export declare function setBrowserChoice(rt: Runtime, account: Account, profile: string | null): Promise<BrowserChoice>;
|
|
58
79
|
/** What turning Browser Sign-ins on reads, for the confirmation in the CLI and the Panel. */
|
|
59
|
-
export declare const BROWSER_READS: readonly ["the name of each Google Chrome browser user and the Google account email it uses in Chrome (from Chrome's Local State)", 'the key names claude.ai
|
|
80
|
+
export declare const BROWSER_READS: readonly ["the name of each Google Chrome browser user and the Google account email it uses in Chrome (from Chrome's Local State)", 'the key names claude.ai, chatgpt.com, grok.com and the websites of plugin tools that declare one keep in each browser user’s Local Storage, never their values', 'the account id in each Claude, Codex and Grok login file, and the one a plugin tool reads from its own, only to compare; it is never shown or saved'];
|
|
60
81
|
export interface BrowserSwitch {
|
|
61
82
|
enabled: boolean;
|
|
62
83
|
changed: boolean;
|