sideby 0.16.1 → 0.18.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 (128) hide show
  1. package/README.md +7 -3
  2. package/ai-tasks.json +90 -0
  3. package/dist/build.json +1 -1
  4. package/dist/src/cli/commands.d.ts +25 -1
  5. package/dist/src/cli/commands.js +802 -15
  6. package/dist/src/cli/json-schemas.js +252 -1
  7. package/dist/src/cli/main.js +143 -4
  8. package/dist/src/core/after-install.d.ts +54 -0
  9. package/dist/src/core/after-install.js +78 -0
  10. package/dist/src/core/ask.d.ts +222 -0
  11. package/dist/src/core/ask.js +465 -0
  12. package/dist/src/core/attachments.d.ts +50 -0
  13. package/dist/src/core/attachments.js +442 -0
  14. package/dist/src/core/autostart.d.ts +118 -0
  15. package/dist/src/core/autostart.js +302 -0
  16. package/dist/src/core/brand-mark.d.ts +49 -11
  17. package/dist/src/core/brand-mark.js +116 -38
  18. package/dist/src/core/config.d.ts +102 -0
  19. package/dist/src/core/config.js +289 -11
  20. package/dist/src/core/desktop-app.d.ts +1 -1
  21. package/dist/src/core/desktop-app.js +2 -2
  22. package/dist/src/core/edit-settings.d.ts +24 -0
  23. package/dist/src/core/edit-settings.js +97 -0
  24. package/dist/src/core/handoff-brief.d.ts +4 -2
  25. package/dist/src/core/handoff-brief.js +6 -1
  26. package/dist/src/core/handoff-chain.d.ts +24 -0
  27. package/dist/src/core/handoff-chain.js +2 -0
  28. package/dist/src/core/handoff-run.d.ts +4 -3
  29. package/dist/src/core/handoff-run.js +14 -9
  30. package/dist/src/core/launch.d.ts +17 -4
  31. package/dist/src/core/launch.js +32 -24
  32. package/dist/src/core/local-build.d.ts +17 -5
  33. package/dist/src/core/local-build.js +61 -23
  34. package/dist/src/core/lock.d.ts +30 -0
  35. package/dist/src/core/lock.js +143 -0
  36. package/dist/src/core/probe.d.ts +78 -0
  37. package/dist/src/core/probe.js +127 -0
  38. package/dist/src/core/quota-levels.d.ts +6 -1
  39. package/dist/src/core/quota-levels.js +16 -5
  40. package/dist/src/core/same-login.d.ts +9 -4
  41. package/dist/src/core/same-login.js +9 -4
  42. package/dist/src/core/secret-file.d.ts +26 -0
  43. package/dist/src/core/secret-file.js +126 -7
  44. package/dist/src/core/task-spec.d.ts +95 -0
  45. package/dist/src/core/task-spec.js +209 -0
  46. package/dist/src/core/terminal.d.ts +93 -0
  47. package/dist/src/core/terminal.js +376 -0
  48. package/dist/src/core/update.d.ts +34 -12
  49. package/dist/src/core/update.js +96 -84
  50. package/dist/src/desktop/icon.js +12 -15
  51. package/dist/src/families/claude/ai-task.d.ts +8 -0
  52. package/dist/src/families/claude/ai-task.js +38 -0
  53. package/dist/src/families/claude/handoff-hook.js +4 -4
  54. package/dist/src/families/claude/index.js +6 -0
  55. package/dist/src/families/claude/quota-cache.d.ts +24 -7
  56. package/dist/src/families/claude/quota-cache.js +72 -21
  57. package/dist/src/families/codex/handoff-hook.js +4 -4
  58. package/dist/src/families/codex/index.js +16 -0
  59. package/dist/src/families/codex/login-key.d.ts +8 -0
  60. package/dist/src/families/codex/login-key.js +33 -0
  61. package/dist/src/families/grok/handoff-hook.js +4 -4
  62. package/dist/src/families/grok/index.js +4 -0
  63. package/dist/src/families/login-keys.d.ts +6 -0
  64. package/dist/src/families/login-keys.js +6 -0
  65. package/dist/src/families/pi/index.js +5 -0
  66. package/dist/src/handoff/hook.js +51 -30
  67. package/dist/src/handoff/levels.d.ts +24 -0
  68. package/dist/src/handoff/levels.js +70 -0
  69. package/dist/src/handoff/messages.d.ts +6 -3
  70. package/dist/src/handoff/messages.js +20 -7
  71. package/dist/src/handoff/reader.d.ts +6 -3
  72. package/dist/src/menubar/agent.d.ts +3 -0
  73. package/dist/src/menubar/agent.js +21 -0
  74. package/dist/src/menubar/script.d.ts +8 -0
  75. package/dist/src/menubar/script.js +457 -0
  76. package/dist/src/menubar/snapshot.d.ts +115 -0
  77. package/dist/src/menubar/snapshot.js +255 -0
  78. package/dist/src/menubar/strings.d.ts +87 -0
  79. package/dist/src/menubar/strings.js +88 -0
  80. package/dist/src/panel/background.js +15 -21
  81. package/dist/src/panel/handler.d.ts +41 -2
  82. package/dist/src/panel/handler.js +394 -10
  83. package/dist/src/panel/i18n.d.ts +205 -2
  84. package/dist/src/panel/i18n.js +441 -35
  85. package/dist/src/panel/page-logic.d.ts +301 -0
  86. package/dist/src/panel/page-logic.js +532 -0
  87. package/dist/src/panel/page-script.js +1135 -185
  88. package/dist/src/panel/page-styles.js +111 -32
  89. package/dist/src/panel/page.d.ts +12 -0
  90. package/dist/src/panel/page.js +7 -0
  91. package/dist/src/panel/server.d.ts +16 -2
  92. package/dist/src/panel/server.js +41 -13
  93. package/dist/src/plugins/check.d.ts +47 -0
  94. package/dist/src/plugins/check.js +544 -0
  95. package/dist/src/plugins/scaffold.d.ts +21 -0
  96. package/dist/src/plugins/scaffold.js +123 -0
  97. package/dist/src/quota/statusline-tap.js +1 -1
  98. package/dist/src/runtime.d.ts +19 -1
  99. package/dist/src/runtime.js +53 -14
  100. package/dist/src/types.d.ts +33 -0
  101. package/package.json +4 -3
  102. package/schemas/ask-choices.json +168 -0
  103. package/schemas/ask-print.json +87 -0
  104. package/schemas/ask.json +180 -0
  105. package/schemas/autostart.json +165 -0
  106. package/schemas/config-get.json +132 -0
  107. package/schemas/config-set.json +107 -0
  108. package/schemas/config.json +90 -7
  109. package/schemas/edit.json +119 -0
  110. package/schemas/error.json +4 -0
  111. package/schemas/families.json +4 -0
  112. package/schemas/key.json +93 -0
  113. package/schemas/list.json +4 -0
  114. package/schemas/local.json +1 -1
  115. package/schemas/menubar-snapshot.json +646 -0
  116. package/schemas/menubar-start.json +112 -0
  117. package/schemas/menubar.json +165 -0
  118. package/schemas/plugins-check.json +113 -0
  119. package/schemas/plugins-new.json +87 -0
  120. package/schemas/terminal.json +152 -0
  121. package/schemas/try.json +109 -0
  122. package/schemas/update.json +4 -0
  123. package/skills/sideby/SKILL.md +16 -6
  124. package/skills/sideby/references/accounts.md +1 -1
  125. package/skills/sideby/references/ai-tasks.md +126 -0
  126. package/skills/sideby/references/handoff.md +3 -1
  127. package/skills/sideby/references/panel.md +20 -0
  128. package/skills/sideby/references/update.md +1 -1
@@ -8,6 +8,28 @@ const ReasonCode = Type.Union(['local-build', 'npx', 'volta', 'not-writable', 'p
8
8
  const Level = Type.Union([Type.Literal('ok'), Type.Literal('warn'), Type.Literal('fail')]);
9
9
  const Kind = Type.Union([Type.Literal('subscription'), Type.Literal('api')]);
10
10
  const Version = Type.Literal(1);
11
+ /** `sideby autostart` and `sideby menubar` (ADR-0029, ADR-0034): a LaunchAgent sideby writes. */
12
+ const loginItem = (current) => Type.Object({
13
+ schemaVersion: Version,
14
+ supported: Type.Boolean({
15
+ description: 'False on a system sideby cannot start at login yet; `reason` says so.',
16
+ }),
17
+ reason: Type.Optional(Str),
18
+ state: Type.Union(['off', 'on', 'stale', 'foreign'].map((k) => Type.Literal(k)), {
19
+ description: '`stale`: the Node or sideby it starts no longer exists; `foreign`: a file at that path that sideby did not write.',
20
+ }),
21
+ path: Str,
22
+ programArguments: Type.Optional(Type.Array(Str)),
23
+ current: Type.Boolean({ description: current }),
24
+ missing: Type.Optional(Type.Array(Str)),
25
+ action: Type.Optional(Type.Union([Type.Literal('on'), Type.Literal('off')])),
26
+ changed: Type.Optional(Type.Boolean()),
27
+ applied: Type.Optional(Type.Boolean()),
28
+ content: Type.Optional(Type.String({ description: 'The file `on` writes.' })),
29
+ commands: Type.Optional(Type.Array(Type.Array(Str))),
30
+ loaded: Type.Optional(Type.Boolean({ description: 'launchd took the change now.' })),
31
+ note: Type.Optional(Str),
32
+ });
11
33
  const Choice = Type.Object({ model: Type.Optional(Str), effort: Type.Optional(Str) });
12
34
  const Shown = Type.Object({
13
35
  value: Str,
@@ -60,6 +82,9 @@ const FamilyInfo = Type.Object({
60
82
  brokenBin: Type.Optional(Str),
61
83
  plugin: Str,
62
84
  tuning: Type.Boolean(),
85
+ settingsFile: Type.Optional(Type.String({
86
+ description: "The Host's settings file `sideby edit` opens, relative to the account directory.",
87
+ })),
63
88
  });
64
89
  const ShareModeSchema = Type.Union(['link', 'copy', 'link-or-copy', 'link-or-local', 'local', 'local-if-api', 'info', 'json-key'].map((m) => Type.Literal(m)));
65
90
  const FamilyDetail = Type.Intersect([
@@ -315,6 +340,28 @@ const Overview = Type.Object({
315
340
  ]),
316
341
  })),
317
342
  });
343
+ const MenubarLevel = Type.Union(['ok', 'warn', 'fail', 'none'].map((k) => Type.Literal(k)));
344
+ const MenubarBar = Type.Union([
345
+ Type.Object({ label: Str, percent: Type.Number(), level: MenubarLevel }),
346
+ Type.Null(),
347
+ ]);
348
+ const MenubarRow = Type.Object({
349
+ ref: Str,
350
+ label: Str,
351
+ detail: Type.String({ description: 'The whole row as one line of text.' }),
352
+ level: MenubarLevel,
353
+ recommended: Type.Boolean({ description: 'The account `sideby next` would pick in this Family.' }),
354
+ tip: Type.String({ description: 'Hover text: when each window resets, and what a click does.' }),
355
+ bars: Type.Union([Type.Tuple([MenubarBar, MenubarBar]), Type.Null()], {
356
+ description: 'The shorter window, then the longer one; a single window fills the second. Null without quota.',
357
+ }),
358
+ reset: Type.String({
359
+ description: 'Until the fullest window resets, such as `4d 17h`; empty when nothing is used.',
360
+ }),
361
+ note: Type.String({
362
+ description: 'Text drawn instead of bars, such as `API key`; empty when bars are drawn.',
363
+ }),
364
+ });
318
365
  export const OUTPUT_SCHEMAS = {
319
366
  pin: PinResult,
320
367
  unpin: PinResult,
@@ -352,7 +399,7 @@ export const OUTPUT_SCHEMAS = {
352
399
  message: Type.Optional(Str),
353
400
  restartedPanel: Type.Optional(Type.Boolean()),
354
401
  skillSynced: Type.Optional(Type.Boolean({
355
- description: 'Back on npm, `sideby update --yes` brought the sideby skill to that version (true) or failed (false).',
402
+ description: 'Back on npm, `sideby update --skill --yes` brought the sideby skill to that version (true) or failed (false).',
356
403
  })),
357
404
  }, { title: 'sideby local --json' }),
358
405
  list: Type.Object({
@@ -632,6 +679,21 @@ export const OUTPUT_SCHEMAS = {
632
679
  command: Type.Optional(Type.Array(Str, { description: 'The `open` command sideby ran.' })),
633
680
  notices: Type.Array(Str),
634
681
  }, { title: 'sideby desktop --json' }),
682
+ edit: Type.Object({
683
+ schemaVersion: Version,
684
+ ref: Str,
685
+ family: Str,
686
+ file: Type.String({
687
+ description: 'The settings file as the family names it, such as `settings.json`.',
688
+ }),
689
+ path: Type.String({ description: 'The file inside the account directory.' }),
690
+ target: Type.Optional(Type.String({ description: 'Where the file really is; only when `path` is a link.' })),
691
+ sharedWith: Type.Array(Str, {
692
+ description: 'Other accounts of the family whose settings file is this same file, so a change applies to them too.',
693
+ }),
694
+ opened: Type.Boolean({ description: 'False with --path, which only says where the file is.' }),
695
+ command: Type.Optional(Type.Array(Str, { description: 'The program and arguments that opened the file.' })),
696
+ }, { title: 'sideby edit --json' }),
635
697
  'desktop-remove': Type.Object({
636
698
  schemaVersion: Version,
637
699
  ref: Str,
@@ -709,6 +771,9 @@ export const OUTPUT_SCHEMAS = {
709
771
  refreshedApp: Type.Optional(Type.Boolean({
710
772
  description: 'The desktop app (`sideby app install`) was installed and was written again by the new version.',
711
773
  })),
774
+ refreshedAutostart: Type.Optional(Type.Boolean({
775
+ description: 'A login item (`sideby autostart on`) was installed and now starts the new version (false: that failed). Absent without one.',
776
+ })),
712
777
  skill: Type.Optional(Type.String({ description: 'The command that installs the sideby skill by hand.' })),
713
778
  skillUpdate: Type.Optional(Type.Object({
714
779
  installed: Type.Array(Type.Union([Str, Type.Null()]), {
@@ -738,7 +803,193 @@ export const OUTPUT_SCHEMAS = {
738
803
  code: Type.String({
739
804
  description: '`usage` for a malformed command line (exit 2), a reason such as `no-quota-source` or `alias-invalid`, or `error`.',
740
805
  }),
806
+ reason: Type.Optional(Type.String({
807
+ description: 'Same as `code`, for a refused Task Spec (`sideby ask --spec -`): `spec-invalid`, `spec-too-large`, `bad-cwd`, or `spec-version` (exit 2: update sideby).',
808
+ })),
741
809
  }, { title: 'sideby error --json' }),
810
+ ask: Type.Object({
811
+ schemaVersion: Version,
812
+ task: Type.Union([Str, Type.Null()]),
813
+ account: Type.Union([Str, Type.Null()]),
814
+ terminal: Type.Union([Str, Type.Null()]),
815
+ opened: Type.Boolean(),
816
+ command: Type.Union([Str, Type.Null()]),
817
+ removedSecrets: Type.Boolean(),
818
+ reason: Type.Optional(Type.String({
819
+ enum: [
820
+ 'no-accounts',
821
+ 'none-signed-in',
822
+ 'all-full',
823
+ 'not-installed',
824
+ 'automation-denied',
825
+ 'npx-cache',
826
+ 'unsafe-path',
827
+ 'failed',
828
+ 'unsupported-platform',
829
+ ],
830
+ description: 'Why nothing opened (only when `opened` is false); `detail` says what to do next.',
831
+ })),
832
+ detail: Type.Optional(Type.String({ description: 'What to do next, for a person.' })),
833
+ prompt: Type.Optional(Str),
834
+ attachments: Type.Array(Type.Object({
835
+ path: Type.String({ description: 'Absolute path of the copy saved for the task.' }),
836
+ kind: Type.String({ enum: ['image', 'video'] }),
837
+ bytes: Type.Integer({ minimum: 0 }),
838
+ }), { description: 'Files given with `--attach`, in order; empty without any.' }),
839
+ }),
840
+ 'ask-print': Type.Object({
841
+ schemaVersion: Version,
842
+ prompt: Type.String({
843
+ description: 'The Task Prompt the Host would get, attachments section included.',
844
+ }),
845
+ removedSecrets: Type.Boolean({ description: 'Whether key-shaped text was taken out of the prompt.' }),
846
+ }, { title: 'sideby ask --spec - --print --json' }),
847
+ 'ask-choices': Type.Object({
848
+ schemaVersion: Version,
849
+ account: Type.Union([Str, Type.Null()], {
850
+ description: 'The Account an AI Task would use now; null when none can be picked (see `reason`).',
851
+ }),
852
+ accounts: Type.Array(Type.Object({
853
+ ref: Str,
854
+ label: Type.String({ description: 'What to show for it, as the Panel does.' }),
855
+ signedIn: Type.Boolean({ description: 'False for a Subscription Account that is signed out.' }),
856
+ }), {
857
+ description: 'Signed-in Subscription Accounts, then API Accounts, then signed-out ones; each by ref.',
858
+ }),
859
+ terminal: Type.String({ description: 'The terminal a task opens: the preferred one, else the guess.' }),
860
+ terminals: Type.Array(Type.Object({ id: Str, label: Str }), {
861
+ description: 'The supported terminals installed here.',
862
+ }),
863
+ reason: Type.Union([Type.String({ enum: ['no-accounts', 'none-signed-in', 'all-full'] }), Type.Null()]),
864
+ detail: Type.Union([Type.String({ description: 'What to do next, for a person.' }), Type.Null()]),
865
+ }, { title: 'sideby ask --choices --json' }),
866
+ terminal: Type.Object({
867
+ schemaVersion: Version,
868
+ preferred: Type.Union([Str, Type.Null()]),
869
+ guess: Type.Object({ id: Str, source: Type.String({ enum: ['config', 'env', 'default'] }) }),
870
+ installed: Type.Array(Type.Object({ id: Str, appPath: Type.Optional(Str), executable: Type.Optional(Str) })),
871
+ terminals: Type.Array(Type.Object({ id: Str, name: Str, installed: Type.Boolean() })),
872
+ }),
873
+ key: Type.Object({
874
+ schemaVersion: Version,
875
+ account: Str,
876
+ var: Str,
877
+ written: Type.Literal(true),
878
+ path: Str,
879
+ }),
880
+ try: Type.Object({
881
+ schemaVersion: Version,
882
+ account: Str,
883
+ confirmed: Type.Boolean(),
884
+ command: Type.Optional(Type.Array(Str)),
885
+ ok: Type.Optional(Type.Boolean()),
886
+ exitCode: Type.Optional(Type.Union([Type.Integer(), Type.Null()])),
887
+ output: Type.Optional(Str),
888
+ timedOut: Type.Optional(Type.Boolean()),
889
+ }),
890
+ 'plugins-new': Type.Object({ schemaVersion: Version, dir: Str, files: Type.Array(Str) }),
891
+ 'plugins-check': Type.Object({
892
+ schemaVersion: Version,
893
+ ok: Type.Boolean(),
894
+ plugin: Type.Optional(Str),
895
+ families: Type.Array(Str),
896
+ problems: Type.Array(Type.Object({ code: Str, message: Str, fix: Str })),
897
+ }),
898
+ autostart: loginItem('The login item starts this sideby with this Node.'),
899
+ menubar: loginItem('The menu bar item runs this sideby with this Node.'),
900
+ 'menubar-snapshot': Type.Object({
901
+ schemaVersion: Version,
902
+ title: Type.String({
903
+ description: 'The words next to the icon, such as `Codex 62%`, once the tightest tool reaches 60%; empty otherwise.',
904
+ }),
905
+ level: Type.Union(['ok', 'warn', 'fail', 'none'].map((k) => Type.Literal(k))),
906
+ tooltip: Str,
907
+ updatedAt: Type.String({ description: 'When this snapshot was made (ISO).' }),
908
+ lang: Type.Union([Type.Literal('en'), Type.Literal('zh')]),
909
+ card: Type.Union([
910
+ Type.Object({
911
+ status: Str,
912
+ detail: Str,
913
+ level: Type.Union(['ok', 'warn', 'fail', 'none'].map((k) => Type.Literal(k))),
914
+ }),
915
+ Type.Null(),
916
+ ], {
917
+ description: 'The card at the top of the menu: a bold status and a line naming the account; null without quota data.',
918
+ }),
919
+ hotkey: Type.Union([Type.Object({ keyCode: Type.Number(), modifiers: Type.Number(), label: Str }), Type.Null()], {
920
+ description: 'The shortcut that opens the menu (config `menubar.hotkey`): a macOS key code and Carbon modifiers.',
921
+ }),
922
+ headline: Type.String({
923
+ description: 'The grey first line of the menu: which account the title belongs to; empty without quota data.',
924
+ }),
925
+ sections: Type.Array(Type.Object({
926
+ family: Str,
927
+ title: Str,
928
+ logo: Type.Union([
929
+ Type.Object({
930
+ path: Str,
931
+ fillRule: Type.Optional(Type.String({ enum: ['nonzero', 'evenodd'] })),
932
+ color: Type.Optional(Type.String({ description: 'Brand colour; without one the mark follows the text colour.' })),
933
+ }),
934
+ Type.Null(),
935
+ ]),
936
+ columns: Type.Tuple([Type.Union([Str, Type.Null()]), Type.Union([Str, Type.Null()])], {
937
+ description: 'The window names over the two bar columns, such as `5h` and `7d`.',
938
+ }),
939
+ rows: Type.Array(MenubarRow, { description: 'The recommended account first, then Display Order.' }),
940
+ more: Type.Union([Type.Object({ title: Str, rows: Type.Array(MenubarRow) }), Type.Null()], {
941
+ description: 'API key and signed-out accounts behind one submenu; null when there are none.',
942
+ }),
943
+ }), { description: 'One per Family with accounts, in Display Order.' }),
944
+ labels: Type.Record(Str, Str, { description: 'Footer words; `{n}` in `updatedMinutes` is minutes.' }),
945
+ }),
946
+ 'menubar-start': Type.Object({
947
+ schemaVersion: Version,
948
+ task: Str,
949
+ account: Str,
950
+ terminal: Str,
951
+ opened: Type.Boolean(),
952
+ command: Type.String({
953
+ description: 'The command the terminal runs; paste it into a terminal when `opened` is false.',
954
+ }),
955
+ reason: Type.Optional(Type.String({
956
+ enum: [
957
+ 'not-installed',
958
+ 'automation-denied',
959
+ 'npx-cache',
960
+ 'unsafe-path',
961
+ 'failed',
962
+ 'unsupported-platform',
963
+ ],
964
+ })),
965
+ detail: Type.Optional(Type.String({ description: 'What to do next, for a person.' })),
966
+ }),
967
+ 'config-get': Type.Object({
968
+ schemaVersion: Version,
969
+ file: Type.Optional(Str),
970
+ keys: Type.Optional(Type.Array(Type.Object({
971
+ key: Type.String({ description: 'Dot path; `<…>` marks a part you fill in.' }),
972
+ meaning: Str,
973
+ takes: Str,
974
+ value: Type.Optional(Type.Unknown()),
975
+ entries: Type.Optional(Type.Array(Type.Object({ key: Str, value: Type.Unknown() }))),
976
+ }))),
977
+ key: Type.Optional(Str),
978
+ set: Type.Optional(Type.Boolean()),
979
+ value: Type.Optional(Type.Unknown()),
980
+ meaning: Type.Optional(Str),
981
+ takes: Type.Optional(Str),
982
+ }),
983
+ 'config-set': Type.Object({
984
+ schemaVersion: Version,
985
+ action: Type.Union([Type.Literal('set'), Type.Literal('unset')]),
986
+ key: Str,
987
+ file: Str,
988
+ changed: Type.Boolean(),
989
+ applied: Type.Boolean(),
990
+ before: Type.Optional(Type.Unknown()),
991
+ after: Type.Optional(Type.Unknown()),
992
+ }),
742
993
  config: ConfigSchema,
743
994
  };
744
995
  for (const [name, schema] of Object.entries(OUTPUT_SCHEMAS)) {
@@ -7,6 +7,10 @@ const MIN_NODE = [22, 18];
7
7
  const HELP = `sideby — run every AI coding account side by side
8
8
 
9
9
  Usage:
10
+ sideby ask [<text>] [--print] let your AI handle a sideby task
11
+ sideby terminal [--set <id>|--custom <t>|--unset] choose your terminal
12
+ sideby key <account> [--var <NAME>] enter an API key without echo
13
+ sideby try <account> [--yes] try the Host with a short paid request
10
14
  sideby list accounts (same as \`sideby list\`)
11
15
  sideby run <account> [-- args] start the host CLI for one account
12
16
  sideby new <family> <name>|--next [--api] [--alias <short>]
@@ -21,6 +25,7 @@ Usage:
21
25
  sideby order --reset restore default order, keeping pins
22
26
  sideby quota check <family> on|off turn quota fetching on or off
23
27
  sideby update --auto on|off set Auto Update without running an update
28
+ sideby update --skill [--yes] update only the installed sideby skill to this version
24
29
  sideby families [family] what each host's accounts share with the main account,
25
30
  where they live and how they sign in
26
31
  sideby alias add <short> <account> [-- args]
@@ -61,6 +66,8 @@ Usage:
61
66
  sideby desktop <account> open the desktop app (Claude Desktop, the Codex app) as this
62
67
  account, next to the others (macOS)
63
68
  sideby desktop grok-bot:<name> open a Grok Bot window, a new one for a new name (macOS)
69
+ sideby edit <account> [--path] open the account's own settings file (settings.json,
70
+ config.toml) in your editor
64
71
  sideby browser [--enable [--yes]] which Chrome browser user signed in to each account's website
65
72
  (read on this computer only; off until you enable it)
66
73
  sideby browser open <account> [--profile <name>]
@@ -71,14 +78,25 @@ Usage:
71
78
  sideby shell-init [zsh|bash] --write
72
79
  rewrite the config's shellInitFile with them
73
80
  sideby plugins list loaded plugins and load errors
81
+ sideby plugins new <id> create a local Family Plugin skeleton
82
+ sideby plugins check <id|path> check a plugin and show fixes
74
83
  sideby update [--yes] update sideby to the newest version (shows the command first)
84
+ sideby autostart [on|off] [--yes] start the panel in the background at login (macOS; shows the
85
+ file first)
86
+ sideby menubar [on|off] [--yes] show quota in the macOS menu bar; click an account to start it
87
+ sideby config get [<key>] every setting with its value and meaning, or one setting
88
+ sideby config set <key> <value> [--yes]
89
+ change any setting (sideby config set panel.theme dark)
90
+ sideby config unset <key> [--yes] back to the default
75
91
  sideby local [on|off] [--yes] for sideby developers: switch the global sideby between the
76
92
  last local build (pnpm local) and the npm package
77
93
 
78
94
  Options:
79
95
  --json machine-readable output (list, new, next, alias, doctor, quota, tune, model, remote-control, handoff,
80
- families, plugins, app, desktop, browser, update, local)
81
- -h, --help show this help; \`sideby <command> --help\` for new, alias, login, doctor, families, desktop, browser
96
+ families, plugins, app, desktop, edit, browser, update, local, ask, terminal, key, try,
97
+ autostart, menubar, config)
98
+ -h, --help show this help; \`sideby <command> --help\` for new, alias, login, doctor, families, desktop, edit, browser,
99
+ autostart, menubar, config
82
100
  -v, --version show the version
83
101
 
84
102
  An <account> is <family>:<name> (claude:work) or just <name> when it is unique.
@@ -95,6 +113,11 @@ Updates: once a day sideby asks the npm registry for its newest version and says
95
113
  Turn it off with NO_UPDATE_NOTIFIER=1 or config "update": { "check": false }; "auto": true installs by itself.`;
96
114
  /** `sideby <command> --help` for the commands agents use to set up and repair accounts (spec §3.16). */
97
115
  const COMMAND_HELP = {
116
+ 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.',
117
+ 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.",
118
+ key: 'sideby key <account> [--var <NAME>] [--json]\nEnter an API key without echo. Run in a terminal or use the Panel key box.',
119
+ try: 'sideby try <account> [--yes] [--json]\nSend a short request through the Host. This spends a few tokens. Exit 10 waits for --yes.',
120
+ plugins: 'sideby plugins [--json]\nsideby plugins new <id> [--json]\nsideby plugins check <id|path> [--json]\nPlugins run as you, with your permissions. Only load plugins you trust.',
98
121
  new: `sideby new <family> <name> [--api] [--alias <short>] [--json]
99
122
  sideby new <family> --next [--api] [--alias <short>] [--json]
100
123
 
@@ -179,6 +202,78 @@ Examples:
179
202
  sideby desktop grok-bot:002 --remove --yes
180
203
  Exit: 0 opened, brought to the front or removed; 1 not macOS, no desktop app for that host, API account, app not
181
204
  installed, a bad window name, or the app did not open; 10 --remove without --yes; 2 malformed command line.`,
205
+ edit: `sideby edit <account> [--path] [--json]
206
+
207
+ Open the account's own settings file in your editor: settings.json for claude and pi accounts, config.toml for codex
208
+ and grok accounts. It opens with the system's default program (the default text editor on macOS, the Windows default
209
+ program on WSL, xdg-open on other Linux). --path only prints where the file is.
210
+
211
+ sideby reads nothing of the file and never changes it; your editor does. When the file is a link (accounts that
212
+ share their settings with the main account), it says where the real file is and which accounts the change affects.
213
+ A missing file is not created: the message says how to get one.
214
+
215
+ Examples:
216
+ sideby edit claude:work
217
+ sideby edit cc008 --path
218
+ Exit: 0 opened (or printed with --path); 1 no settings file, the family names none, or it could not be opened; 2
219
+ malformed command line.`,
220
+ autostart: `sideby autostart [on|off] [--yes] [--json]
221
+
222
+ Start the panel in the background when you log in, so it already shows fresh quota when you open it. It never
223
+ opens a window or a browser and never starts a host. macOS only for now (a LaunchAgent,
224
+ ~/Library/LaunchAgents/dev.sideby.panel.plist, that starts this Node and this sideby with ui --background).
225
+
226
+ Without on or off it says whether it is on, off, out of date (the Node or sideby it starts was moved) or blocked
227
+ by a file that is not sideby's. on and off show the file and the launchctl command first; --yes does it.
228
+ \`sideby update\` and \`pnpm local\` keep an existing login item pointing at the sideby in use.
229
+
230
+ Examples:
231
+ sideby autostart --json
232
+ sideby autostart on --yes
233
+ sideby autostart off --yes
234
+ Exit: 0 shown, done or nothing to change; 10 a change was shown and waits for --yes; 1 refused (not macOS, sideby
235
+ in the npx cache or a temporary folder, a file that is not sideby's) or failed; 2 malformed command line.`,
236
+ menubar: `sideby menubar [on|off] [--yes] [--json]
237
+ sideby menubar snapshot [--lang en|zh] [--json]
238
+ sideby menubar start <account> [--json]
239
+
240
+ Show quota in the macOS menu bar: a gauge with one percent, how much the account sideby would pick next has used
241
+ in your tightest tool (orange from 60%, red from 85%). Click it for every account's 5-hour and 7-day quota; click
242
+ an account to start it in your preferred terminal. It runs the system's osascript, starts at login and has no Dock
243
+ icon. macOS only for now (a LaunchAgent, ~/Library/LaunchAgents/dev.sideby.menubar.plist).
244
+
245
+ 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
246
+ show the file first; --yes does it. snapshot prints what the menu shows (the menu bar item runs it every 2 minutes).
247
+ start opens an account in your preferred terminal, as clicking it does.
248
+
249
+ Examples:
250
+ sideby menubar on --yes
251
+ sideby menubar snapshot --json
252
+ sideby menubar start claude:work
253
+ sideby menubar off --yes
254
+ Exit: 0 shown, done or nothing to change; 10 a change was shown and waits for --yes; 1 refused (not macOS, sideby
255
+ in the npx cache or a temporary folder, a file that is not sideby's), failed, or the terminal did not open; 2
256
+ malformed command line.`,
257
+ config: `sideby config get [<key>] [--json]
258
+ sideby config set <key> <value> [--yes] [--json]
259
+ sideby config unset <key> [--yes] [--json]
260
+
261
+ Read or change any setting in sideby's config file. <key> is a dot path such as handoff.threshold or panel.theme;
262
+ \`sideby config get\` lists every key with its value, what it does and the values it takes. A value is read as
263
+ JSON when it parses (90, true, ["cc002","codex001"]), otherwise as text (dark).
264
+
265
+ set and unset show the change first; --yes saves it. The whole file must still be a valid config, and other keys
266
+ and their order are kept. A plugin's own settings are not read or changed here (they may hold secrets), only
267
+ plugins.<plugin>.enabled. accounts.<family>:<name>.args takes only the model and effort arguments, as
268
+ \`sideby model\` does.
269
+
270
+ Examples:
271
+ sideby config get --json
272
+ sideby config set panel.theme dark --yes
273
+ sideby config set handoff.threshold 90 --yes
274
+ sideby config unset panel.language --yes
275
+ Exit: 0 shown, saved or nothing to change; 10 a change was shown and waits for --yes; 1 not a key, a value the key
276
+ does not take, or the file changed meanwhile; 2 malformed command line.`,
182
277
  browser: `sideby browser [--enable|--disable] [--yes] [--json]
183
278
  sideby browser open <account> [--profile <folder|name>] [--json]
184
279
 
@@ -224,6 +319,16 @@ export function nodeTooOld(version = process.versions.node) {
224
319
  return maj < MIN_NODE[0] || (maj === MIN_NODE[0] && min < MIN_NODE[1]);
225
320
  }
226
321
  const COMMANDS = {
322
+ ask: {
323
+ flags: ['json', 'print', 'choices'],
324
+ valued: ['task', 'account', 'terminal', 'run', 'state-dir', 'attach', 'spec'],
325
+ },
326
+ terminal: { flags: ['json', 'unset'], valued: ['set', 'custom'] },
327
+ key: { flags: ['json'], valued: ['var'] },
328
+ try: { flags: ['json', 'yes'] },
329
+ autostart: { flags: ['json', 'yes', 'refresh'] },
330
+ menubar: { flags: ['json', 'yes', 'refresh'], valued: ['lang'] },
331
+ config: { flags: ['json', 'yes'] },
227
332
  list: { flags: ['json'] },
228
333
  pin: { flags: ['json'] },
229
334
  unpin: { flags: ['json'] },
@@ -246,18 +351,33 @@ const COMMANDS = {
246
351
  ui: { flags: ['no-open', 'background', 'stop', 'serve-detached'], valued: ['port'] },
247
352
  app: { flags: ['json'], valued: ['url'] },
248
353
  desktop: { flags: ['json', 'remove', 'yes'] },
354
+ edit: { flags: ['json', 'path'] },
249
355
  browser: { flags: ['json', 'enable', 'disable', 'yes'], valued: ['profile'] },
250
356
  'shell-init': { flags: ['write'] },
251
357
  plugins: { flags: ['json'] },
252
358
  families: { flags: ['json'] },
253
- update: { flags: ['json', 'yes'], valued: ['auto'] },
359
+ update: { flags: ['json', 'yes', 'skill'], valued: ['auto'] },
254
360
  local: { flags: ['json', 'yes'] },
255
361
  'update-check': { flags: [] },
256
362
  };
363
+ /** Every value of a repeatable option (`--attach a --attach=b`), in order. */
364
+ function repeatedValues(args, name) {
365
+ const out = [];
366
+ for (let i = 0; i < args.length; i++) {
367
+ const a = args[i];
368
+ if (a === `--${name}` && args[i + 1] !== undefined)
369
+ out.push(args[++i]);
370
+ else if (a.startsWith(`--${name}=`))
371
+ out.push(a.slice(name.length + 3));
372
+ }
373
+ return out;
374
+ }
257
375
  /** Commands that never print an Update Notice: their output is read by a shell or an agent, or they are internal. */
258
376
  function noticeAllowed(cmd, parsed) {
259
377
  if (cmd === 'shell-init' || cmd === 'update' || cmd === 'update-check')
260
378
  return false;
379
+ if (cmd === 'ask' && (parsed.flags.has('print') || parsed.flags.has('run')))
380
+ return false;
261
381
  if (cmd === 'ui' && parsed.flags.has('serve-detached'))
262
382
  return false;
263
383
  if (cmd === 'handoff' && parsed.positionals[0] === 'ready')
@@ -349,7 +469,7 @@ export async function main(argv) {
349
469
  return runHandoffHook(rest, process.env, process.stdin, process.stdout);
350
470
  }
351
471
  if (nodeTooOld()) {
352
- console.error(`sideby needs Node ${MIN_NODE.join('.')} or newer (you have ${process.versions.node}). Upgrade: https://nodejs.org`);
472
+ console.error(`sideby needs Node ${MIN_NODE.join('.')} or newer (you have ${process.versions.node}). Upgrade: https://nodejs.org, or with nvm: \`nvm install 22 && nvm alias default 22\`, then \`npm i -g sideby\` again (each Node version has its own global packages).`);
353
473
  return 1;
354
474
  }
355
475
  if (first === '-v' || first === '--version' || first === 'version') {
@@ -404,6 +524,9 @@ export async function main(argv) {
404
524
  console.log(COMMAND_HELP[cmd] ?? HELP);
405
525
  return 0;
406
526
  }
527
+ // parseArgs keeps the last value of an option; `ask --attach` may be given several times.
528
+ if (cmd === 'ask')
529
+ parsed.attach = repeatedValues(own, 'attach');
407
530
  const cmds = await import('./commands.js');
408
531
  if (wantsJson && noticeAllowed(cmd, parsed)) {
409
532
  notice = await jsonNoticeFor();
@@ -431,6 +554,14 @@ export async function main(argv) {
431
554
  }
432
555
  async function dispatch(cmd, parsed, io, cmds) {
433
556
  switch (cmd) {
557
+ case 'ask':
558
+ return cmds.cmdAsk(parsed, io);
559
+ case 'terminal':
560
+ return cmds.cmdTerminal(parsed, io);
561
+ case 'key':
562
+ return cmds.cmdKey(parsed, io);
563
+ case 'try':
564
+ return cmds.cmdTry(parsed, io);
434
565
  case 'pin':
435
566
  case 'unpin':
436
567
  return await cmds.cmdPin(parsed, io, cmd === 'pin');
@@ -468,6 +599,8 @@ async function dispatch(cmd, parsed, io, cmds) {
468
599
  return await cmds.cmdApp(parsed, io);
469
600
  case 'desktop':
470
601
  return await cmds.cmdDesktop(parsed, io);
602
+ case 'edit':
603
+ return await cmds.cmdEdit(parsed, io);
471
604
  case 'browser':
472
605
  return await cmds.cmdBrowser(parsed, io);
473
606
  case 'shell-init':
@@ -482,6 +615,12 @@ async function dispatch(cmd, parsed, io, cmds) {
482
615
  return await cmds.cmdUpdateCheck(parsed, io);
483
616
  case 'local':
484
617
  return await cmds.cmdLocal(parsed, io);
618
+ case 'autostart':
619
+ return await cmds.cmdAutostart(parsed, io);
620
+ case 'menubar':
621
+ return await cmds.cmdMenubar(parsed, io);
622
+ case 'config':
623
+ return await cmds.cmdConfig(parsed, io);
485
624
  }
486
625
  return 2;
487
626
  }
@@ -0,0 +1,54 @@
1
+ import type { Env } from '../types.ts';
2
+ import type { SkillUpdatePlan, UpdateDeps } from './update.ts';
3
+ /**
4
+ * The skill step the new code runs by name. `--skill` updates only the installed skill: it never installs the CLI,
5
+ * even when the registry has moved on since the user confirmed.
6
+ */
7
+ export declare const SKILL_SYNC: readonly ['sideby', 'update', '--skill', '--yes'];
8
+ /** Runs the skills tool when the plan says the skill is outdated and sideby may; null when it did nothing. */
9
+ export declare function runSkillUpdate(m: UpdateDeps, plan: SkillUpdatePlan | undefined, env: Env, onOutput?: (text: string) => void): Promise<{
10
+ ok: boolean;
11
+ message: string;
12
+ } | null>;
13
+ export interface AfterInstallOptions {
14
+ home: string;
15
+ /** Frees the install lock. Called once, before anything starts that takes the lock itself. */
16
+ release: () => Promise<void>;
17
+ /** Write an installed desktop app again from the new code (an Update). */
18
+ app?: boolean;
19
+ /**
20
+ * Points an existing login item at the new code; undefined when there is none. Without it, `sideby autostart
21
+ * --refresh` of the new code does that where a login item is installed.
22
+ */
23
+ autostart?: () => Promise<boolean | undefined>;
24
+ /**
25
+ * The installed sideby skill: `plan` when the caller has looked at it (an Update), `by-name` when only the new code
26
+ * can tell (a switch back to npm). Absent: nothing to bring along.
27
+ */
28
+ skill?: {
29
+ plan: SkillUpdatePlan | undefined;
30
+ } | 'by-name';
31
+ /**
32
+ * `background` (the Panel): the new code updates the skill on its own after the answer. Its fetch can take minutes,
33
+ * and a Portal that moves to the new code, or the Panel restarting from it, ends the request it runs in.
34
+ */
35
+ skillSync?: 'wait' | 'background';
36
+ /** The port of the background Panel to start again, or null when none runs. */
37
+ panelPort?: () => Promise<number | null>;
38
+ onOutput?: (text: string) => void;
39
+ }
40
+ export interface AfterInstallResult {
41
+ restartedPanel: boolean;
42
+ refreshedApp: boolean;
43
+ /** Absent when there is no login item. */
44
+ refreshedAutostart?: boolean;
45
+ /** `plan`, waited for: the skill was updated (true) or that failed (false); absent when it was not tried. */
46
+ skillUpdated?: boolean;
47
+ skillMessage?: string;
48
+ /** `by-name`, waited for: `sideby update --skill --yes` of the new code succeeded. */
49
+ skillSynced?: boolean;
50
+ /** `background`: `sideby update --skill --yes` of the new code started on its own. */
51
+ skillSyncStarted?: boolean;
52
+ }
53
+ /** Runs the steps above in their order. Never throws, and a failed step never fails the install before it. */
54
+ export declare function afterInstall(m: UpdateDeps, env: Env, o: AfterInstallOptions): Promise<AfterInstallResult>;