sideby 0.21.0 → 0.22.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 (73) hide show
  1. package/README.md +1 -0
  2. package/dist/build.json +1 -1
  3. package/dist/src/cli/commands.js +115 -10
  4. package/dist/src/cli/format.js +3 -2
  5. package/dist/src/cli/json-schemas.js +81 -46
  6. package/dist/src/cli/main.js +6 -3
  7. package/dist/src/core/accounts.d.ts +6 -1
  8. package/dist/src/core/accounts.js +16 -3
  9. package/dist/src/core/ask.d.ts +2 -1
  10. package/dist/src/core/ask.js +6 -3
  11. package/dist/src/core/claude-settings-file.d.ts +57 -0
  12. package/dist/src/core/claude-settings-file.js +104 -2
  13. package/dist/src/core/config.d.ts +29 -15
  14. package/dist/src/core/config.js +40 -2
  15. package/dist/src/core/create.js +4 -1
  16. package/dist/src/core/desktop-app.js +5 -1
  17. package/dist/src/core/handoff-overview.d.ts +4 -1
  18. package/dist/src/core/handoff-overview.js +3 -2
  19. package/dist/src/core/handoff-rules.d.ts +34 -0
  20. package/dist/src/core/handoff-rules.js +115 -0
  21. package/dist/src/core/handoff-select.js +45 -28
  22. package/dist/src/core/handoff-status.d.ts +37 -7
  23. package/dist/src/core/handoff-status.js +95 -19
  24. package/dist/src/core/handoff.d.ts +4 -1
  25. package/dist/src/core/handoff.js +8 -5
  26. package/dist/src/core/inbound.d.ts +11 -3
  27. package/dist/src/core/inbound.js +26 -74
  28. package/dist/src/core/launch.js +6 -4
  29. package/dist/src/core/quota-levels.d.ts +6 -0
  30. package/dist/src/core/quota-levels.js +8 -0
  31. package/dist/src/core/remote-control.d.ts +10 -12
  32. package/dist/src/core/remote-control.js +29 -86
  33. package/dist/src/core/tuning-apply.js +12 -20
  34. package/dist/src/families/agy/index.d.ts +8 -0
  35. package/dist/src/families/agy/index.js +53 -0
  36. package/dist/src/families/agy/quota.d.ts +9 -0
  37. package/dist/src/families/agy/quota.js +110 -0
  38. package/dist/src/families/index.js +7 -0
  39. package/dist/src/families/logos.d.ts +10 -0
  40. package/dist/src/families/logos.js +12 -1
  41. package/dist/src/menubar/script.js +26 -3
  42. package/dist/src/menubar/snapshot.d.ts +23 -6
  43. package/dist/src/menubar/snapshot.js +126 -39
  44. package/dist/src/menubar/strings.d.ts +12 -2
  45. package/dist/src/menubar/strings.js +12 -2
  46. package/dist/src/panel/handler.d.ts +2 -1
  47. package/dist/src/panel/handler.js +81 -45
  48. package/dist/src/panel/i18n.d.ts +57 -7
  49. package/dist/src/panel/i18n.js +156 -56
  50. package/dist/src/panel/page-logic.d.ts +47 -19
  51. package/dist/src/panel/page-logic.js +33 -7
  52. package/dist/src/panel/page-script.js +263 -94
  53. package/dist/src/panel/page-styles.js +105 -8
  54. package/dist/src/panel/page.js +3 -3
  55. package/dist/src/plugins/check.js +27 -13
  56. package/dist/src/plugins/loader.d.ts +11 -0
  57. package/dist/src/plugins/loader.js +47 -1
  58. package/dist/src/runtime.d.ts +5 -2
  59. package/dist/src/runtime.js +12 -5
  60. package/dist/src/types.d.ts +35 -5
  61. package/package.json +2 -2
  62. package/schemas/config.json +16 -1
  63. package/schemas/families.json +8 -5
  64. package/schemas/handoff-disable.json +22 -0
  65. package/schemas/handoff-enable.json +22 -0
  66. package/schemas/handoff-rules.json +302 -0
  67. package/schemas/handoff-status.json +26 -0
  68. package/schemas/list.json +5 -0
  69. package/schemas/menubar-snapshot.json +309 -2
  70. package/skills/sideby/SKILL.md +3 -2
  71. package/skills/sideby/references/accounts.md +1 -0
  72. package/skills/sideby/references/handoff.md +7 -3
  73. package/skills/sideby/references/quota.md +2 -0
@@ -429,6 +429,7 @@ const en = {
429
429
  'ai.ask.pin': 'Pin claude:work to the top.',
430
430
  'ai.ask.fix': 'Check my accounts and fix what they should share.',
431
431
  'ai.ask.handoff': 'Turn on Auto Handoff.',
432
+ 'ai.ask.handoffRules': 'When does Auto Handoff switch accounts, and could it use my API accounts?',
432
433
  'ai.ask.rc': 'Turn off Remote Control for every Claude account.',
433
434
  'ai.ask.relogin': 'Two of my accounts are the same login; help me sign one in with another account.',
434
435
  'ai.orderHint': 'or ask your AI',
@@ -739,52 +740,93 @@ const en = {
739
740
  'md.saved': 'Saved. New sessions of {ref} use it.',
740
741
  'page.handoff': 'Auto Handoff',
741
742
  'hp.title': 'Auto Handoff',
743
+ 'hp.statusOn': 'Auto Handoff is on',
744
+ 'hp.statusOff': 'Auto Handoff is off',
742
745
  'hp.advanced': 'Advanced settings',
743
746
  'hp.loading': 'Checking…',
744
- 'hp.intro': 'When an account is about to run out of quota, your work moves to the next account by itself. You do not have to do anything.',
745
- 'hp.how1': 'You keep working in a session you started with sideby (a short command such as cc001, or sideby run).',
746
- 'hp.how2': 'When that account reaches {p}% of its quota, sideby has the AI write a short note about the task and ends the session.',
747
- 'hp.how3': 'After a {s}-second countdown (Enter cancels), the next account starts in the same terminal and carries on from the note.',
748
- 'hp.noStarters': 'None of your accounts can start a hand-over yet. Add a Claude, Codex or Grok account first.',
749
- 'hp.sameFamily': 'Also switch between accounts of the same tool (for example cc001 to cc002)',
747
+ 'hp.intro': 'When an account runs low on quota, the AI writes a handoff note. The next account takes over in the same terminal. You do not have to do anything.',
748
+ 'hp.noStarters': 'None of your accounts can start a handoff yet. Add a Claude, Codex or Grok account first.',
749
+ 'hp.sameFamily': 'Also switch between accounts of the same AI (for example cc001 to cc002)',
750
750
  'hp.turnOn': 'Turn on Auto Handoff',
751
751
  'hp.turnOff': 'Turn off',
752
752
  'hp.willDo': 'To turn it on, sideby will:',
753
753
  'hp.step.config': 'Switch Auto Handoff on in sideby’s settings',
754
- 'hp.step.quota': 'Turn on {host} quota display (hand-over needs it to know how much is used)',
755
- 'hp.step.hook': 'Add sideby’s hand-over hook to {host}',
754
+ 'hp.step.quota': 'Show {host} quota (Auto Handoff needs it to track usage)',
755
+ 'hp.step.hook': 'Add sideby’s handoff hook to {host}',
756
756
  'hp.step.copy': 'Copy the hook file into your other {host} accounts ({accounts}); nothing else in them changes',
757
757
  'hp.showChange': 'Show the change',
758
- 'hp.sameFamilyOffNote': 'Accounts of the same tool will not switch between each other. You can turn that on later on this page.',
758
+ 'hp.sameFamilyOffNote': 'Accounts of the same AI will not take over from each other. You can turn this on later on this page.',
759
759
  'hp.manual.codexTrust': 'Codex asks once per account to trust sideby’s hooks. Type /hooks in Codex the first time and trust them; sideby reminds you then.',
760
760
  'hp.blocked': 'It cannot be turned on yet: {why}',
761
761
  'hp.confirmOn': 'Confirm and turn on',
762
762
  'hp.applying': 'Turning on…',
763
763
  'hp.stepFailed': 'Stopped at: {step}. {why}',
764
764
  'hp.tryAgain': 'Nothing after it was changed. Try again, or ask for help.',
765
- 'hp.onNote': 'When an account reaches {p}% of its quota, its session moves to the next account by itself.',
765
+ 'hp.onNote': 'Sessions you start with sideby move to the next account by themselves, following the rules below.',
766
766
  'hp.takeover': 'Where work goes next',
767
767
  'hp.used': '{p}% used',
768
768
  'hp.noQuota': 'quota unknown',
769
- 'hp.goesTo': 'at {p}% it moves to {to}',
769
+ 'hp.goesTo': 'moves to {to}',
770
770
  'hp.goesToLimit': 'when it hits its usage limit it moves to {to}',
771
771
  'hp.waits': 'at the limit it waits: quota is back at {at}',
772
- 'hp.waitRule': 'If its quota comes back within {w} minutes at that point, it waits instead of switching.',
773
772
  'hp.planChanged': 'Something changed since you looked, so sideby has not changed anything yet. This is what it would do now; confirm again.',
774
773
  'hp.none': 'no account can take over right now',
775
774
  'hp.noneBack': 'no account can take over now; {ref} is back at {at}',
776
- 'hp.noAccounts': 'No subscription account can start a hand-over.',
777
- 'hp.recent': 'Recent hand-overs',
775
+ 'hp.noAccounts': 'No subscription account can start a handoff.',
776
+ 'hp.recent': 'Recent handoffs',
778
777
  'hp.noneYet': 'None yet. The next time an account runs low you will see it here.',
779
- 'hp.why.threshold': 'quota reached the hand-over level',
778
+ 'hp.why.threshold': 'quota reached the handoff level',
780
779
  'hp.why.limit': 'it hit its usage limit',
781
780
  'hp.why.manual': 'handed over on request',
782
781
  'hp.missing': 'One step left',
783
782
  'hp.complete': 'Finish setting up',
784
783
  'hp.onlySideby': 'Only sessions started with sideby hand over (a short command such as cc001, or sideby run). Typing claude directly does not.',
785
784
  'hp.sameConfirm': 'Switch it on',
786
- 'hp.sameOn': 'Same-tool hand-over is on.',
787
- 'hp.sameOff': 'Same-tool hand-over is off.',
785
+ 'hp.sameOn': 'Same-AI handoff is on.',
786
+ 'hp.sameOff': 'Same-AI handoff is off.',
787
+ 'hp.takeoverIf': 'If a handoff started now',
788
+ 'hp.rules': 'Hand-over rules',
789
+ 'hp.rulesNote': 'These rules decide when an account hands over and which account takes over. Each change applies at once and can be undone.',
790
+ 'hp.rule.whenAdaptive': 'The AI writes a handoff note at {prepare}% used. Handoff starts at {p}% used until sideby learns how fast this session spends quota, then between {prepare}% and {max}%, earlier if recent turns used a lot.',
791
+ 'hp.rule.when': 'The AI writes a handoff note at {prepare}% used. Handoff starts at {p}% used.',
792
+ 'hp.rule.windows': 'Every quota window counts (5 hours, weekly, a billing period): the fullest one decides. No AI has a daily quota.',
793
+ 'hp.rule.takeover': 'Accounts already over {limit}% used will not take over, so the next account has room to work. This stays 10 points below the handoff level ({p}%).',
794
+ 'hp.rule.wait': 'If the quota comes back within {w} minutes and the session carries on by itself at that point (Claude Code), it waits instead of switching. Codex and Grok switch right away.',
795
+ 'hp.rule.noWait': 'It never waits for quota to come back; it switches right away.',
796
+ 'hp.rule.sameOn': 'Other accounts of the same AI can take over first (for example cc001 to cc002). The account with the most quota left goes first.',
797
+ 'hp.rule.sameOff': 'Other accounts of the same AI do not take over.',
798
+ 'hp.rule.otherOn': 'When the same AI has no accounts left to take over, another AI does, in the order below. The account with the most quota left goes first.',
799
+ 'hp.rule.otherOff': 'Other AIs do not take over (for example Claude Code to Codex).',
800
+ 'hp.rule.apiOn': 'API accounts take over last, when no subscription account can. They are billed per use; sideby cannot limit the spend.',
801
+ 'hp.rule.apiOff': 'API accounts do not take over: they are billed per use.',
802
+ 'hp.rule.org': 'An account signed in to another organization (team, company) does not take over.',
803
+ 'hp.rule.orgExcept': 'An account signed in to another organization (team, company) does not take over, except {refs}.',
804
+ 'hp.rule.order': 'From {host}, accounts are tried in your order: {order}.',
805
+ 'hp.rule.countdown': 'Before the next account starts, a {s}-second countdown runs; Enter cancels it.',
806
+ 'hp.rule.noCountdown': 'The next account starts right away, without a countdown.',
807
+ 'hp.on': 'On',
808
+ 'hp.off': 'Off',
809
+ 'hp.edit': 'Change…',
810
+ 'hp.adaptive': 'Adjust the timing to recent use',
811
+ 'hp.adaptiveOn': 'The handoff timing now follows recent use.',
812
+ 'hp.adaptiveOff': 'Handoff now always happens at the set quota level.',
813
+ 'hp.otherFamilies': 'Let other AIs take over',
814
+ 'hp.otherOn': 'Other AIs can now take over.',
815
+ 'hp.otherOff': 'Other AIs will not take over.',
816
+ 'hp.aiOrderSaved': 'Order saved.',
817
+ 'hp.api': 'Let API accounts take over',
818
+ 'hp.apiOn': 'API accounts may take over last.',
819
+ 'hp.apiOff': 'API accounts no longer take over.',
820
+ 'hp.noApi': 'You have no API account yet.',
821
+ 'hp.apiWarn': 'API accounts are billed for every request. sideby cannot see or limit what you spend: set a monthly limit in your provider’s console first.',
822
+ 'hp.apiConfirm': 'Allow API accounts',
823
+ 'hp.apiAskTitle': 'Should API accounts still take over?',
824
+ 'hp.apiAskBody': 'They used to take over by themselves when quota ran out. They are billed per use, so now they only do when you allow it.',
825
+ 'hp.apiKeepOff': 'Keep them out',
826
+ 'hp.apiKeepOn': 'Let them take over',
827
+ 'hp.apiKeptOff': 'API accounts stay out of handoffs.',
828
+ 'hp.undone': 'Changed back.',
829
+ 'hp.noneAll': 'No account can take over right now. Turn on rule 5 (same AI) or rule 6 (other AIs) in the rules below.',
788
830
  'page.accounts': 'Accounts',
789
831
  'page.tuning': 'Context tuning',
790
832
  'page.sessions': 'Sessions',
@@ -991,8 +1033,6 @@ const en = {
991
1033
  'inb.state.default': 'Not set',
992
1034
  'inb.state.refuse': 'Turned off',
993
1035
  'inb.state.cannot': 'Cannot change',
994
- 'inb.change': '{from} → "accept"',
995
- 'inb.notSet': 'not set',
996
1036
  'inb.confirmNote': 'Choose "Receive directly" so messages arrive on their own. Only this one setting changes; sessions already running pick it up when they restart. You can undo it.',
997
1037
  'inb.accept': 'Receive directly',
998
1038
  'inb.undo': 'Undo last change',
@@ -1017,6 +1057,8 @@ const en = {
1017
1057
  'tune.hostDefaultRange': 'Default ({lo}–{hi} by model)',
1018
1058
  'tune.best': 'Suggested',
1019
1059
  'tune.saved': 'Expected to use about {n}% fewer tokens (an estimate).',
1060
+ 'tune.savedLabel': 'Saves about',
1061
+ 'tune.savedValue': '{n}%',
1020
1062
  'tune.compactions.one': 'It compacted once, when the conversation reached about {size}.',
1021
1063
  'tune.compactions.other': 'It compacted {n} times, usually when the conversation reached about {size}.',
1022
1064
  'tune.noCompactions': 'It did not compact in this period.',
@@ -1064,6 +1106,7 @@ const en = {
1064
1106
  'nf.accounts.other': '{n} accounts',
1065
1107
  'nf.runOnce': 'Run {bin} once first',
1066
1108
  'nf.notInstalled': 'Not installed',
1109
+ 'nf.mainOnly': 'Main account only for now: it keeps one sign-in per computer',
1067
1110
  'nf.broken': 'Install broken',
1068
1111
  'nf.name': 'Name',
1069
1112
  'nf.namePh': 'name',
@@ -1102,19 +1145,19 @@ const en = {
1102
1145
  'ah.on': 'On',
1103
1146
  'ah.off': 'Off',
1104
1147
  'ah.title': 'Auto Handoff',
1105
- 'ah.intro': 'When a session that sideby started runs low on quota, it writes a handoff brief, sideby ends it, and the next account carries on in the same terminal. Off by default.',
1148
+ 'ah.intro': 'When a session that sideby started runs low on quota, it writes a handoff note, sideby ends it, and the next account carries on in the same terminal. Off by default.',
1106
1149
  'ah.auto': 'Hand over when quota runs low',
1107
- 'ah.sameFamily': 'Also hand over between accounts of the same tool',
1108
- 'ah.sameFamilyWarn': 'Moving work between subscriptions of one vendor to get past a limit may break its terms; the risk is yours.',
1109
- 'ah.prepareAt': 'Start the brief at (%)',
1150
+ 'ah.sameFamily': 'Also hand over between accounts of the same AI',
1151
+ 'ah.sameFamilyWarn': 'Switching between accounts of the same vendor to bypass limits may violate its terms. Use at your own risk.',
1152
+ 'ah.prepareAt': 'Write handoff note at (%)',
1110
1153
  'ah.threshold': 'Hand over at (%)',
1111
- 'ah.wait': 'Wait if it resets within (min)',
1154
+ 'ah.wait': 'Wait if quota resets within (min)',
1112
1155
  'ah.countdown': 'Countdown before switching (s)',
1113
- 'ah.badLevels': 'Start the brief below the hand-over level.',
1156
+ 'ah.badLevels': 'Start the handoff note below the handoff level.',
1114
1157
  'ah.order': '{host} hands over to',
1115
1158
  'ah.byQuota': 'Most quota left',
1116
1159
  'ah.myOrder': 'My order',
1117
- 'ah.byQuotaHint': 'Its own accounts with the most quota left (when same-tool hand-over is on), then API accounts.',
1160
+ 'ah.byQuotaHint': 'Accounts of the same AI with the most quota left (when same-AI handoff is on), then API accounts.',
1118
1161
  'ah.add': 'Add account',
1119
1162
  'ah.up': 'Move up',
1120
1163
  'ah.down': 'Move down',
@@ -1132,9 +1175,11 @@ const en = {
1132
1175
  'ah.nothing': 'Nothing to change.',
1133
1176
  'ah.saved': 'Saved to {file}.',
1134
1177
  'ah.changes': 'This changes {file}:',
1135
- 'ah.hint': '{ref} is at {p}% of its quota. Sessions can hand their task to another account by themselves when quota runs low.',
1178
+ 'ah.hint': '{ref} is at {p}% quota. Sessions can hand their task to another account automatically when quota runs low.',
1136
1179
  'ah.setUp': 'Set up',
1137
1180
  'ah.dismiss': 'Not now',
1181
+ 'ah.crossOrg': 'Other organizations',
1182
+ 'ah.crossOrgHint': 'Accounts checked here may take over even when signed in to another organization than the account that runs out.',
1138
1183
  'toast.ahOn': 'Auto Handoff is on for sessions you start with sideby.',
1139
1184
  'toast.ahOff': 'Auto Handoff is off.',
1140
1185
  'qs.title': 'Turn on {host} quota',
@@ -1158,11 +1203,11 @@ const en = {
1158
1203
  'rc.hidden': 'Hidden in this browser. sideby remote-control off turns it off later.',
1159
1204
  'rc.readOnly': 'Run sideby remote-control off to turn it off.',
1160
1205
  'rc.confirmTitle': 'Turn off Remote Control at startup?',
1161
- 'rc.change': 'remoteControlAtStartup {from} → {to}',
1162
1206
  'rc.notSet': 'not set',
1163
1207
  'rc.usedBy': 'used by {refs}',
1164
1208
  'rc.confirmNote': 'Running sessions stay connected until you restart them. You can still start it in a session with /remote-control.',
1165
1209
  'rc.confirm': 'Turn off',
1210
+ 'rc.skipped': 'Not changed: ',
1166
1211
  'rc.done': 'Remote Control is off for new sessions. Restart sessions that are running.',
1167
1212
  'rc.failed': 'Could not turn it off: {msg}',
1168
1213
  'set.button': 'Settings',
@@ -1281,8 +1326,13 @@ const en = {
1281
1326
  'rc.state.off': 'Off',
1282
1327
  'rc.state.missing': 'No settings file',
1283
1328
  'rc.state.blocked': 'Cannot read',
1329
+ 'settings.why.no-settings': 'This account has no settings.json. Run sideby doctor --fix so it shares the main one, then try again.',
1330
+ 'settings.why.broken-link': 'settings.json links to a file that does not exist. Run sideby doctor to see how to fix it.',
1331
+ 'settings.why.unsafe': 'settings.json cannot be changed safely. Fix or move the file, then try again.',
1332
+ 'settings.why.refuse': 'You set it to refuse, so sideby leaves it alone and Messages to these sessions need pasting. To get them, set "crossSessionInbound": "accept" in this file yourself.',
1333
+ 'settings.why.other': 'It holds a value sideby does not know, so sideby leaves it alone. Set "crossSessionInbound" to "accept" in this file yourself, or remove the key and try again.',
1284
1334
  'rc.dialogTitle': 'Remote Control at startup',
1285
- 'rc.explain': 'When it is on, each new Claude session connects to claude.ai and the Claude app, where every device signed in to that account can read it. Default leaves it to Claude Code or your organization.',
1335
+ 'rc.explain': 'When it is on, each new Claude session connects to claude.ai and the Claude app, where every device signed in to that account can read it. Where it is not set (Left to Claude Code), Claude Code or your organization decides.',
1286
1336
  'rc.allOff': 'Off everywhere. You can still start it in a session with /remote-control, or switch it on above.',
1287
1337
  'rc.undo': 'Undo last change',
1288
1338
  'rc.switch': 'New sessions start it by themselves',
@@ -1725,6 +1775,7 @@ const zh = {
1725
1775
  'ai.ask.pin': '把 claude:work 置顶。',
1726
1776
  'ai.ask.fix': '检查一下我的账号,把该共享的修好。',
1727
1777
  'ai.ask.handoff': '帮我开启自动接力。',
1778
+ 'ai.ask.handoffRules': '自动接力什么时候换号?会不会用到我的 API 账号?',
1728
1779
  'ai.ask.rc': '把所有 Claude 账号的远程控制关掉。',
1729
1780
  'ai.ask.relogin': '我有两个账号登录的是同一个号,帮我把其中一个换成别的账号。',
1730
1781
  'ai.orderHint': '也可以让 AI 帮你排',
@@ -2035,52 +2086,93 @@ const zh = {
2035
2086
  'md.saved': '已保存,{ref} 的新会话会用它。',
2036
2087
  'page.handoff': '自动接力',
2037
2088
  'hp.title': '自动接力',
2089
+ 'hp.statusOn': '自动接力已开启',
2090
+ 'hp.statusOff': '自动接力未开启',
2038
2091
  'hp.advanced': '高级设置',
2039
2092
  'hp.loading': '检查中…',
2040
- 'hp.intro': '账号额度快用完时,你的工作会自动换到下一个账号接着做,不用你操心。',
2041
- 'hp.how1': '你照常在用 sideby 启动的会话里工作(短命令如 cc001,或 sideby run)。',
2042
- 'hp.how2': '这个账号用到 {p}% 时,sideby 让 AI 写一份任务小结,然后结束这个会话。',
2043
- 'hp.how3': '倒计时 {s} 秒后(按回车可取消),下一个账号在同一个终端里按小结接着做。',
2093
+ 'hp.intro': '账号额度快用完时,AI 会写好接力笔记。下一个账号在同一个终端里接着做,你不用做任何事。',
2044
2094
  'hp.noStarters': '你的账号里还没有能发起接力的。先添加一个 Claude、Codex 或 Grok 账号。',
2045
- 'hp.sameFamily': '同一个工具的账号之间也切换(例如 cc001 到 cc002)',
2095
+ 'hp.sameFamily': '同一个 AI 的账号之间也换(例如 cc001 到 cc002)',
2046
2096
  'hp.turnOn': '开启自动接力',
2047
2097
  'hp.turnOff': '关闭',
2048
2098
  'hp.willDo': '开启时 sideby 会:',
2049
2099
  'hp.step.config': '在 sideby 的设置里打开自动接力',
2050
- 'hp.step.quota': '打开 {host} 的额度显示(接力要靠它知道用了多少)',
2100
+ 'hp.step.quota': '打开 {host} 的额度显示(自动接力需要查看当前用量)',
2051
2101
  'hp.step.hook': '给 {host} 装上 sideby 的接力钩子',
2052
2102
  'hp.step.copy': '把钩子文件复制到你的其他 {host} 账号({accounts}),它们的其他文件不动',
2053
2103
  'hp.showChange': '查看改动',
2054
- 'hp.sameFamilyOffNote': '同一个工具的账号之间不会互相切换,之后可以在本页打开。',
2104
+ 'hp.sameFamilyOffNote': '同一个 AI 的账号之间不会互相接力。你之后可以在本页开启。',
2055
2105
  'hp.manual.codexTrust': 'Codex 每个账号第一次要信任 sideby 的钩子:第一次启动时在 Codex 里输入 /hooks 并信任,到时 sideby 会提醒你。',
2056
2106
  'hp.blocked': '暂时不能开启:{why}',
2057
2107
  'hp.confirmOn': '确认开启',
2058
2108
  'hp.applying': '正在开启…',
2059
2109
  'hp.stepFailed': '停在这一步:{step}。{why}',
2060
2110
  'hp.tryAgain': '它之后的步骤没有执行。可以重试,或找人帮忙。',
2061
- 'hp.onNote': '任一账号用到 {p}% 时,它的会话会自动换到下一个账号。',
2111
+ 'hp.onNote': '用 sideby 启动的会话会按下面的规则自动换到下一个账号。',
2062
2112
  'hp.takeover': '接下来会交给谁',
2063
2113
  'hp.used': '已用 {p}%',
2064
2114
  'hp.noQuota': '额度未知',
2065
- 'hp.goesTo': '到 {p}% 时交给 {to}',
2066
- 'hp.goesToLimit': '撞到用量上限时交给 {to}',
2115
+ 'hp.goesTo': '交给 {to}',
2116
+ 'hp.goesToLimit': '用量达到上限时交给 {to}',
2067
2117
  'hp.waits': '到上限时会等待:{at} 额度恢复',
2068
- 'hp.waitRule': '如果那时离额度恢复不到 {w} 分钟,就原地等,不换号。',
2069
2118
  'hp.planChanged': '你查看之后设置有了变化,所以还没有改任何东西。下面是现在要做的改动,请再确认一次。',
2070
2119
  'hp.none': '现在没有能接手的账号',
2071
2120
  'hp.noneBack': '现在没有能接手的账号;{ref} 在 {at} 恢复',
2072
2121
  'hp.noAccounts': '没有能发起接力的订阅账号。',
2073
2122
  'hp.recent': '最近的接力',
2074
2123
  'hp.noneYet': '还没有。下次有账号额度快用完时,这里会出现记录。',
2075
- 'hp.why.threshold': '额度到了接力线',
2124
+ 'hp.why.threshold': '用量达到了设定的接力比例',
2076
2125
  'hp.why.limit': '撞到了用量上限',
2077
2126
  'hp.why.manual': '按你的要求接力',
2078
2127
  'hp.missing': '还差一步',
2079
2128
  'hp.complete': '补全设置',
2080
2129
  'hp.onlySideby': '只有用 sideby 启动的会话才会接力(短命令如 cc001,或 sideby run)。直接敲 claude 启动的不会。',
2081
2130
  'hp.sameConfirm': '确认打开',
2082
- 'hp.sameOn': '已开启同工具接力。',
2083
- 'hp.sameOff': '已关闭同工具接力。',
2131
+ 'hp.sameOn': '已开启同一个 AI 接力。',
2132
+ 'hp.sameOff': '已关闭同一个 AI 接力。',
2133
+ 'hp.takeoverIf': '如果现在接力',
2134
+ 'hp.rules': '接力规则',
2135
+ 'hp.rulesNote': '这些规则决定什么时候接力、交给哪个账号。每项改动立即生效,可以撤销。',
2136
+ 'hp.rule.whenAdaptive': '用量到 {prepare}% 时,AI 会写好接力笔记。sideby 了解本次会话的消耗速度前,会在用量到 {p}% 时接力;之后会在 {prepare}% 到 {max}% 之间接力,最近几轮用得多就更早接力。',
2137
+ 'hp.rule.when': '用量到 {prepare}% 时,AI 会写好接力笔记;用量到 {p}% 时接力。',
2138
+ 'hp.rule.windows': '每个额度窗口都算(5 小时、每周、计费周期),以用得最多的那个为准。目前没有 AI 设日额度。',
2139
+ 'hp.rule.takeover': '用量超过 {limit}% 的账号不会接手,确保下一个账号有足够额度干活。这条线始终比接力用量({p}%)低 10 个百分点。',
2140
+ 'hp.rule.wait': '如果 {w} 分钟内额度就恢复,而且会话到时会自己继续(Claude Code),就原地等,不换号。Codex 和 Grok 直接换号。',
2141
+ 'hp.rule.noWait': '不等额度恢复,直接换号。',
2142
+ 'hp.rule.sameOn': '同一个 AI 的其他账号优先接手(例如 cc001 到 cc002),剩余额度最多的优先。',
2143
+ 'hp.rule.sameOff': '同一个 AI 的其他账号不接手。',
2144
+ 'hp.rule.otherOn': '同一个 AI 没有可用账号时,按下方顺序交给其他 AI。其中剩余额度最多的账号优先。',
2145
+ 'hp.rule.otherOff': '其他 AI 不接手(例如 Claude Code 换到 Codex)。',
2146
+ 'hp.rule.apiOn': '没有订阅账号能接手时,最后交给 API 账号。API 按用量计费,sideby 管不了花费上限。',
2147
+ 'hp.rule.apiOff': 'API 账号不接手,因为它按用量计费。',
2148
+ 'hp.rule.org': '登录在其他组织(团队、公司)的账号不接手。',
2149
+ 'hp.rule.orgExcept': '登录在其他组织(团队、公司)的账号不接手,{refs} 除外。',
2150
+ 'hp.rule.order': '从 {host} 接力时,按你排的顺序试:{order}。',
2151
+ 'hp.rule.countdown': '下一个账号启动前倒计时 {s} 秒,按回车可取消。',
2152
+ 'hp.rule.noCountdown': '下一个账号直接启动,不倒计时。',
2153
+ 'hp.on': '开',
2154
+ 'hp.off': '关',
2155
+ 'hp.edit': '修改…',
2156
+ 'hp.adaptive': '按近期消耗调整接力时机',
2157
+ 'hp.adaptiveOn': '接力时机会按近期消耗调整。',
2158
+ 'hp.adaptiveOff': '用量达到设定值时才会接力。',
2159
+ 'hp.otherFamilies': '允许换到其他 AI',
2160
+ 'hp.otherOn': '其他 AI 现在可以接手。',
2161
+ 'hp.otherOff': '其他 AI 不再接手。',
2162
+ 'hp.aiOrderSaved': '顺序已保存。',
2163
+ 'hp.api': '允许 API 账号接手',
2164
+ 'hp.apiOn': 'API 账号会在最后接手。',
2165
+ 'hp.apiOff': 'API 账号不再接手。',
2166
+ 'hp.noApi': '你还没有 API 账号。',
2167
+ 'hp.apiWarn': 'API 账号每次请求都计费。sideby 看不到、也管不了你的花费,请先在服务商后台设好每月上限。',
2168
+ 'hp.apiConfirm': '允许 API 账号',
2169
+ 'hp.apiAskTitle': '还让 API 账号接手吗?',
2170
+ 'hp.apiAskBody': '以前额度用完时,API 账号会自动接手。它按用量计费,所以现在要你同意才会接手。',
2171
+ 'hp.apiKeepOff': '不让它接手',
2172
+ 'hp.apiKeepOn': '继续让它接手',
2173
+ 'hp.apiKeptOff': 'API 账号不参与接力。',
2174
+ 'hp.undone': '已改回。',
2175
+ 'hp.noneAll': '目前没有账号能接手。开启接力规则第 5 条(同一个 AI)或第 6 条(其他 AI)即可。',
2084
2176
  'page.accounts': '账号',
2085
2177
  'page.tuning': '上下文调优',
2086
2178
  'page.sessions': '会话',
@@ -2287,8 +2379,6 @@ const zh = {
2287
2379
  'inb.state.default': '未设置',
2288
2380
  'inb.state.refuse': '已关闭',
2289
2381
  'inb.state.cannot': '无法修改',
2290
- 'inb.change': '{from} → "accept"',
2291
- 'inb.notSet': '未设置',
2292
2382
  'inb.confirmNote': '选「直接接收」,消息就会自己到达。只改这一项设置;已经在运行的会话要重启后才生效。可以撤销。',
2293
2383
  'inb.accept': '直接接收',
2294
2384
  'inb.undo': '撤销上次修改',
@@ -2313,6 +2403,8 @@ const zh = {
2313
2403
  'tune.hostDefaultRange': '默认({lo}–{hi},看模型)',
2314
2404
  'tune.best': '建议',
2315
2405
  'tune.saved': '预计能少用约 {n}% 的 token(估算)。',
2406
+ 'tune.savedLabel': '预计少用',
2407
+ 'tune.savedValue': '约 {n}%',
2316
2408
  'tune.compactions.one': '最近自动压缩了 1 次,在对话长到约 {size} 时触发。',
2317
2409
  'tune.compactions.other': '最近自动压缩了 {n} 次,通常在对话长到约 {size} 时触发。',
2318
2410
  'tune.noCompactions': '这段时间没有压缩过。',
@@ -2360,6 +2452,7 @@ const zh = {
2360
2452
  'nf.accounts.other': '{n} 个账号',
2361
2453
  'nf.runOnce': '先运行一次 {bin}',
2362
2454
  'nf.notInstalled': '未安装',
2455
+ 'nf.mainOnly': '暂时只支持主账号:它在一台电脑上只保留一个登录',
2363
2456
  'nf.broken': '安装已损坏',
2364
2457
  'nf.name': '名称',
2365
2458
  'nf.namePh': '名称',
@@ -2398,19 +2491,19 @@ const zh = {
2398
2491
  'ah.on': '开',
2399
2492
  'ah.off': '关',
2400
2493
  'ah.title': '自动接力',
2401
- 'ah.intro': 'sideby 启动的会话额度快用完时,会写好接力说明,sideby 结束它,下一个账号在同一个终端里接着做。默认关闭。',
2494
+ 'ah.intro': 'sideby 启动的会话额度快用完时,会先写好接力笔记,sideby 再结束它,下一个账号在同一个终端里接着做。默认关闭。',
2402
2495
  'ah.auto': '额度快用完时自动接力',
2403
- 'ah.sameFamily': '也允许同一工具的账号之间接力',
2404
- 'ah.sameFamilyWarn': '同一家厂商的多个订阅之间接力来绕过限额,可能违反厂商条款,风险由你承担。',
2405
- 'ah.prepareAt': '开始写接力说明(%)',
2406
- 'ah.threshold': '接力阈值(%)',
2407
- 'ah.wait': '这么多分钟内重置就等待',
2496
+ 'ah.sameFamily': '同一个 AI 的账号之间也允许接力',
2497
+ 'ah.sameFamilyWarn': '在同一家厂商的多个订阅账号间换号以绕过限额,可能违反对方条款,请自行承担风险。',
2498
+ 'ah.prepareAt': '开始写接力笔记(%)',
2499
+ 'ah.threshold': '接力用量(%)',
2500
+ 'ah.wait': '额度在此时间内恢复则等待(分钟)',
2408
2501
  'ah.countdown': '接力前倒计时(秒)',
2409
- 'ah.badLevels': '开始写说明的比例要低于接力阈值。',
2502
+ 'ah.badLevels': '写接力笔记的用量必须低于接力用量。',
2410
2503
  'ah.order': '{host} 交给',
2411
2504
  'ah.byQuota': '剩余额度最多的',
2412
2505
  'ah.myOrder': '按我的顺序',
2413
- 'ah.byQuotaHint': '先选同一工具里剩余额度最多的账号(需打开同工具接力),再选 API 账号。',
2506
+ 'ah.byQuotaHint': '优先选同一个 AI 剩余额度最多的账号(需开启同一个 AI 接力),最后选 API 账号。',
2414
2507
  'ah.add': '添加账号',
2415
2508
  'ah.up': '上移',
2416
2509
  'ah.down': '下移',
@@ -2428,9 +2521,11 @@ const zh = {
2428
2521
  'ah.nothing': '没有要改的。',
2429
2522
  'ah.saved': '已保存到 {file}。',
2430
2523
  'ah.changes': '将修改 {file}:',
2431
- 'ah.hint': '{ref} 的额度已用 {p}%。会话可以在额度快用完时,自己把任务交给另一个账号。',
2524
+ 'ah.hint': '{ref} 的额度已用了 {p}%。额度快用完时,会话可以自动把任务交给另一个账号。',
2432
2525
  'ah.setUp': '去设置',
2433
2526
  'ah.dismiss': '暂不',
2527
+ 'ah.crossOrg': '其他组织',
2528
+ 'ah.crossOrgHint': '勾选的账号即使登录在别的组织,也可以接手。',
2434
2529
  'toast.ahOn': '自动接力已开启,对用 sideby 启动的会话生效。',
2435
2530
  'toast.ahOff': '自动接力已关闭。',
2436
2531
  'qs.title': '开启 {host} 额度显示',
@@ -2454,11 +2549,11 @@ const zh = {
2454
2549
  'rc.hidden': '本浏览器不再提示。以后可以运行 sideby remote-control off 关闭。',
2455
2550
  'rc.readOnly': '运行 sideby remote-control off 关闭。',
2456
2551
  'rc.confirmTitle': '关闭 Remote Control 自动打开?',
2457
- 'rc.change': 'remoteControlAtStartup {from} → {to}',
2458
2552
  'rc.notSet': '未设置',
2459
2553
  'rc.usedBy': '用于 {refs}',
2460
2554
  'rc.confirmNote': '已经开着的会话要重开才断开。需要时仍可在会话里运行 /remote-control 手动打开。',
2461
2555
  'rc.confirm': '确认关闭',
2556
+ 'rc.skipped': '不会改:',
2462
2557
  'rc.done': '新会话不会再自动打开 Remote Control。开着的会话要重开。',
2463
2558
  'rc.failed': '没能关闭:{msg}',
2464
2559
  'set.button': '设置',
@@ -2577,8 +2672,13 @@ const zh = {
2577
2672
  'rc.state.off': '关',
2578
2673
  'rc.state.missing': '没有设置文件',
2579
2674
  'rc.state.blocked': '读不了',
2675
+ 'settings.why.no-settings': '这个账号没有 settings.json。运行 sideby doctor --fix 让它共用主账号的,再试一次。',
2676
+ 'settings.why.broken-link': 'settings.json 指向的文件不存在。运行 sideby doctor 看怎么修。',
2677
+ 'settings.why.unsafe': 'settings.json 现在没法安全修改。先修好或移走这个文件,再试一次。',
2678
+ 'settings.why.refuse': '你设成了拒绝,sideby 不会改它,发给这些会话的消息只能粘贴。想直接收到,请自己在这个文件里写 "crossSessionInbound": "accept"。',
2679
+ 'settings.why.other': '这里是 sideby 不认识的值,sideby 不会改它。请自己把 "crossSessionInbound" 改成 "accept",或删掉这个键后再试一次。',
2580
2680
  'rc.dialogTitle': 'Remote Control 自动打开',
2581
- 'rc.explain': '打开时,每个新的 Claude 会话都会连到 claude.ai 和 Claude 手机 App,登录这个账号的设备都能看到对话。「默认」表示交给 Claude Code 或你的组织决定。',
2681
+ 'rc.explain': '打开时,每个新的 Claude 会话都会连到 claude.ai 和 Claude 手机 App,登录这个账号的设备都能看到对话。没写这个设置的文件显示「由 Claude Code 决定」,由 Claude Code 或你的组织决定。',
2582
2682
  'rc.allOff': '已全部关闭。需要时仍可在会话里运行 /remote-control 手动打开,或在上面切到「开」。',
2583
2683
  'rc.undo': '撤销上次更改',
2584
2684
  'rc.switch': '新会话自动打开',
@@ -1,3 +1,4 @@
1
+ import type { HandoffSettings } from '../core/config.ts';
1
2
  /** The parts of a PanelAccount the helpers read. */
2
3
  export interface LogicAccount {
3
4
  family: string;
@@ -60,6 +61,14 @@ export declare function windowState(w: {
60
61
  passed: boolean;
61
62
  level: string;
62
63
  };
64
+ /**
65
+ * The window that binds first among those sharing one column (a model group with a 5-hour and a weekly limit, as
66
+ * Antigravity CLI reports): the most used as the page draws it, the first on a tie. Undefined for none.
67
+ */
68
+ export declare function bindingWindow<W extends {
69
+ usedPercent: number;
70
+ resetsAt: string;
71
+ }>(list: W[], now: number, warn: number, fail: number): W | undefined;
63
72
  /**
64
73
  * A window whose reset time has passed: the numbers on record are from before the reset and nothing newer came
65
74
  * in. `since` is when they were last seen (the Quota's observation time, or the reset itself when that is
@@ -434,18 +443,8 @@ export declare function handoffHintAccount(accounts: readonly LogicAccount[], se
434
443
  ref: string;
435
444
  pressure: number;
436
445
  } | null;
437
- export interface HandoffSettingsView {
438
- auto: boolean;
439
- sameFamily: boolean;
440
- prepareAt: number;
441
- threshold: number;
442
- waitIfResetWithinMinutes: number;
443
- countdownSeconds: number;
444
- families: Record<string, {
445
- policy: string;
446
- order: string[];
447
- }>;
448
- }
446
+ /** The settings `/api/handoff/*` sends, as `sideby handoff --json` prints them. */
447
+ export type HandoffSettingsView = HandoffSettings;
449
448
  export interface HandoffForm {
450
449
  auto: boolean;
451
450
  sameFamily: boolean;
@@ -457,6 +456,8 @@ export interface HandoffForm {
457
456
  policy: string;
458
457
  order: string[];
459
458
  }>;
459
+ /** Left out: unchanged. */
460
+ crossOrganization?: string[];
460
461
  }
461
462
  /** What the Panel's Auto Handoff form changed, as the `change` /api/handoff/configure takes; {} when nothing. */
462
463
  export declare function handoffChangeOf(s: HandoffSettingsView, f: HandoffForm): Record<string, unknown>;
@@ -469,13 +470,6 @@ export declare function remoteControlSummary(groups: readonly {
469
470
  accounts: readonly string[];
470
471
  state: string;
471
472
  }[], apiRefs: readonly string[]): 'on' | 'default' | 'off' | null;
472
- /**
473
- * The groups that turning Remote Control `to` on or off changes (spec §3.22): those that do not hold it yet, a
474
- * default counting as either. A file that is missing or cannot be read is never changed.
475
- */
476
- export declare function remoteControlTodo<G extends {
477
- state: string;
478
- }>(groups: readonly G[], to: 'on' | 'off'): G[];
479
473
  /**
480
474
  * Where a menu or popover goes next to its anchor, all in viewport pixels. It opens below when its whole height fits
481
475
  * there, else above when it fits there, else on the side with more room, its height capped at that room so it scrolls
@@ -852,3 +846,37 @@ export type HistFilters = {
852
846
  };
853
847
  /** The History filters saved before a reload, each dropped back to its default when it is missing or malformed. */
854
848
  export declare function histFilters(raw: unknown): HistFilters;
849
+ /**
850
+ * Saves one Auto Handoff change from the Handoff page (spec §3.17 "接力规则"): every change applies at once, and
851
+ * the toast offers the undo the server read from the config as it was. Undoing offers no undo of its own.
852
+ */
853
+ export declare function saveHandoffChange(post: (path: string, body: object) => Promise<{
854
+ undo?: Record<string, unknown>;
855
+ }>, change: Record<string, unknown>, opts?: {
856
+ noUndo?: boolean;
857
+ }): Promise<{
858
+ undo: Record<string, unknown> | null;
859
+ }>;
860
+ /**
861
+ * What the Handoff page shows after confirming the plan that turns Auto Handoff on (ADR-0013): the plan again when
862
+ * it changed since it was shown (unless nothing is left to do) or is blocked, the first step that failed, or done.
863
+ */
864
+ export declare function enableOutcome<P extends {
865
+ alreadyOn?: boolean;
866
+ blocked?: unknown;
867
+ }, S extends {
868
+ ok: boolean;
869
+ }>(r: {
870
+ changed?: boolean;
871
+ plan: P;
872
+ results: S[];
873
+ }): {
874
+ kind: 'changed' | 'blocked';
875
+ plan: P;
876
+ } | {
877
+ kind: 'failed';
878
+ step: S;
879
+ plan: P;
880
+ } | {
881
+ kind: 'done';
882
+ };
@@ -27,6 +27,17 @@ export function windowState(w, now, warn, fail) {
27
27
  const level = passed ? 'reset' : pct >= fail ? 'fail' : pct >= warn ? 'warn' : 'ok';
28
28
  return { pct, passed, level };
29
29
  }
30
+ /**
31
+ * The window that binds first among those sharing one column (a model group with a 5-hour and a weekly limit, as
32
+ * Antigravity CLI reports): the most used as the page draws it, the first on a tie. Undefined for none.
33
+ */
34
+ export function bindingWindow(list, now, warn, fail) {
35
+ let best;
36
+ for (const w of list)
37
+ if (!best || windowState(w, now, warn, fail).pct > windowState(best, now, warn, fail).pct)
38
+ best = w;
39
+ return best;
40
+ }
30
41
  /**
31
42
  * A window whose reset time has passed: the numbers on record are from before the reset and nothing newer came
32
43
  * in. `since` is when they were last seen (the Quota's observation time, or the reset itself when that is
@@ -820,6 +831,8 @@ export function handoffChangeOf(s, f) {
820
831
  }
821
832
  if (orders.length)
822
833
  c.orders = orders;
834
+ if (f.crossOrganization && f.crossOrganization.join('\n') !== s.crossOrganization.join('\n'))
835
+ c.crossOrganization = f.crossOrganization.slice();
823
836
  return c;
824
837
  }
825
838
  /**
@@ -837,13 +850,6 @@ export function remoteControlSummary(groups, apiRefs) {
837
850
  return 'default';
838
851
  return 'off';
839
852
  }
840
- /**
841
- * The groups that turning Remote Control `to` on or off changes (spec §3.22): those that do not hold it yet, a
842
- * default counting as either. A file that is missing or cannot be read is never changed.
843
- */
844
- export function remoteControlTodo(groups, to) {
845
- return groups.filter((g) => g.state === 'default' || g.state === (to === 'on' ? 'off' : 'on'));
846
- }
847
853
  /**
848
854
  * Where a menu or popover goes next to its anchor, all in viewport pixels. It opens below when its whole height fits
849
855
  * there, else above when it fits there, else on the side with more room, its height capped at that room so it scrolls
@@ -1574,3 +1580,23 @@ export function histFilters(raw) {
1574
1580
  scripts: o.scripts === true,
1575
1581
  };
1576
1582
  }
1583
+ /**
1584
+ * Saves one Auto Handoff change from the Handoff page (spec §3.17 "接力规则"): every change applies at once, and
1585
+ * the toast offers the undo the server read from the config as it was. Undoing offers no undo of its own.
1586
+ */
1587
+ export async function saveHandoffChange(post, change, opts = {}) {
1588
+ const r = await post('/api/handoff/configure', { change, confirm: true });
1589
+ return { undo: opts.noUndo || !r.undo ? null : r.undo };
1590
+ }
1591
+ /**
1592
+ * What the Handoff page shows after confirming the plan that turns Auto Handoff on (ADR-0013): the plan again when
1593
+ * it changed since it was shown (unless nothing is left to do) or is blocked, the first step that failed, or done.
1594
+ */
1595
+ export function enableOutcome(r) {
1596
+ if (r.changed && !r.plan.alreadyOn)
1597
+ return { kind: 'changed', plan: r.plan };
1598
+ if (r.plan.blocked)
1599
+ return { kind: 'blocked', plan: r.plan };
1600
+ const bad = r.results.find((x) => !x.ok);
1601
+ return bad ? { kind: 'failed', step: bad, plan: r.plan } : { kind: 'done' };
1602
+ }