sideby 0.35.9 → 0.36.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 (66) hide show
  1. package/dist/build.json +1 -1
  2. package/dist/src/cli/commands.d.ts +12 -0
  3. package/dist/src/cli/commands.js +480 -6
  4. package/dist/src/cli/format.d.ts +12 -1
  5. package/dist/src/cli/format.js +23 -3
  6. package/dist/src/cli/json-schemas.js +166 -1
  7. package/dist/src/cli/main.js +18 -4
  8. package/dist/src/core/advisor.d.ts +176 -0
  9. package/dist/src/core/advisor.js +472 -0
  10. package/dist/src/core/browser-profiles.d.ts +16 -0
  11. package/dist/src/core/browser-profiles.js +45 -0
  12. package/dist/src/core/cli-commands.js +25 -1
  13. package/dist/src/core/config.d.ts +29 -0
  14. package/dist/src/core/config.js +25 -0
  15. package/dist/src/core/handoff-select.d.ts +13 -2
  16. package/dist/src/core/handoff-select.js +6 -2
  17. package/dist/src/core/launch.d.ts +4 -0
  18. package/dist/src/core/launch.js +7 -0
  19. package/dist/src/core/limit-reset.d.ts +198 -0
  20. package/dist/src/core/limit-reset.js +299 -0
  21. package/dist/src/core/quota-fetch.d.ts +57 -2
  22. package/dist/src/core/quota-fetch.js +291 -13
  23. package/dist/src/core/quota-levels.d.ts +70 -0
  24. package/dist/src/core/quota-levels.js +80 -0
  25. package/dist/src/core/quota-store.d.ts +15 -1
  26. package/dist/src/core/quota-store.js +26 -1
  27. package/dist/src/core/same-login.d.ts +8 -0
  28. package/dist/src/core/same-login.js +39 -2
  29. package/dist/src/core/search-catalog.js +38 -0
  30. package/dist/src/families/claude/index.js +2 -0
  31. package/dist/src/families/codex/index.js +3 -1
  32. package/dist/src/families/codex/quota.d.ts +23 -1
  33. package/dist/src/families/codex/quota.js +122 -21
  34. package/dist/src/families/grok/quota-log.d.ts +1 -0
  35. package/dist/src/menubar/script.js +70 -18
  36. package/dist/src/menubar/snapshot.d.ts +33 -1
  37. package/dist/src/menubar/snapshot.js +79 -11
  38. package/dist/src/menubar/strings.d.ts +16 -0
  39. package/dist/src/menubar/strings.js +16 -0
  40. package/dist/src/panel/handler.d.ts +21 -0
  41. package/dist/src/panel/handler.js +111 -9
  42. package/dist/src/panel/i18n.d.ts +87 -0
  43. package/dist/src/panel/i18n.js +174 -0
  44. package/dist/src/panel/page-logic.d.ts +17 -0
  45. package/dist/src/panel/page-logic.js +23 -0
  46. package/dist/src/panel/page-script.js +440 -19
  47. package/dist/src/panel/page-styles.js +38 -2
  48. package/dist/src/plugins/loader.d.ts +2 -0
  49. package/dist/src/plugins/loader.js +27 -0
  50. package/dist/src/runtime.d.ts +63 -1
  51. package/dist/src/runtime.js +529 -9
  52. package/dist/src/types.d.ts +67 -0
  53. package/package.json +1 -1
  54. package/schemas/advisor.json +332 -0
  55. package/schemas/config.json +22 -0
  56. package/schemas/error.json +4 -0
  57. package/schemas/menubar-reset.json +93 -0
  58. package/schemas/menubar-snapshot.json +70 -2
  59. package/schemas/quota-reset.json +369 -0
  60. package/schemas/quota.json +30 -0
  61. package/schemas/update.json +4 -0
  62. package/skills/sideby/SKILL.md +6 -2
  63. package/skills/sideby/references/ai-tasks.md +1 -1
  64. package/skills/sideby/references/panel.md +14 -0
  65. package/skills/sideby/references/quota.md +27 -0
  66. package/skills/sideby/references/update.md +1 -1
@@ -2,12 +2,13 @@
2
2
  import { randomBytes, timingSafeEqual } from 'node:crypto';
3
3
  import { realpath } from 'node:fs/promises';
4
4
  import { aliasesByAccount, startArgsOf } from '../core/accounts.js';
5
+ import { advisorPlan, advisorScope, checkAdvisorAccount, isAdvisorChoice, } from '../core/advisor.js';
5
6
  import { listAppProfiles, openAppProfile, removeAppProfile, } from '../core/app-profiles.js';
6
7
  import { openLoginInTerminal, openPickInTerminal, pickTaskAccount, previewAttachments, promptForTask, setCustomTerminal, setPreferredTerminal, startAiTask, taskContext, terminals, tryAccount, } from '../core/ask.js';
7
8
  import { ATTACHMENT_LIMITS, MAX_ATTACHMENTS, MAX_UPLOAD_BYTES, removeStaged, stagedAttachments, stageUpload, } from '../core/attachments.js';
8
9
  import { applyAutostart, autostartStatus, PANEL_AGENT, planAutostart, } from '../core/autostart.js';
9
10
  import { FAVICON_SVG, ICON_SVG } from '../core/brand-mark.js';
10
- import { browserReport, openInBrowser, setBrowserChoice, setBrowserSignIns, } from '../core/browser-profiles.js';
11
+ import { browserReport, openInBrowser, openVendorPage, setBrowserChoice, setBrowserSignIns, } from '../core/browser-profiles.js';
11
12
  import { aiTaskPermissions, aliasArgs, aliasRefs, EDITORS, editConfigPanel, editConfigPath, editConfigTerminal, editConfigUpdate, loadConfig, } from '../core/config.js';
12
13
  import { openDesktopApp, withDesktopApps } from '../core/desktop-app.js';
13
14
  import { editSettings, isEditor } from '../core/edit-settings.js';
@@ -18,11 +19,13 @@ import { handoffOverview } from '../core/handoff-overview.js';
18
19
  import { apiUndecided, handoffRulesView } from '../core/handoff-rules.js';
19
20
  import { configureHandoff, handoffStatus } from '../core/handoff-status.js';
20
21
  import { acceptInbound, groupsToAccept, inboundGroups, undoInbound, waitingFiles, } from '../core/inbound.js';
22
+ import { LimitResetError } from '../core/limit-reset.js';
21
23
  import { accountLabels, listLiveSessions, liveKey, referenceText, resumeCommandFor, sessionCopyText, } from '../core/live-sessions.js';
22
24
  import { listMessages, sendMessage } from '../core/messages.js';
23
25
  import { accountModel, setAccountModel } from '../core/model-choice.js';
24
26
  import { GUARDED_FAMILIES, setNetwork } from '../core/network.js';
25
27
  import { tildify } from '../core/paths.js';
28
+ import { quotaAsking } from '../core/quota-fetch.js';
26
29
  import { takeoverLimits } from '../core/quota-levels.js';
27
30
  import { remoteControlTodo } from '../core/remote-control.js';
28
31
  import { openRunBoard, withRuns } from '../core/run-link.js';
@@ -102,7 +105,13 @@ function keyFacts(def, permissions) {
102
105
  ...(def.secretFileMeansApi === false ? { keyAlways: true } : {}),
103
106
  ...(def.probe ? { tryCommand: [def.bin, ...def.probe.args] } : {}),
104
107
  ...(def.aiTaskArgs && permissions === 'checked' ? { aiTaskSafe: true } : {}),
105
- ...(def.fetchQuota ? { quotaRefresh: true } : {}),
108
+ ...(def.fetchQuota ? { quotaRefresh: true, quotaEvery: def.fetchQuota.everyMinutes } : {}),
109
+ ...(def.limitReset?.use
110
+ ? { limitReset: 'use' }
111
+ : def.limitReset?.vendorPage
112
+ ? { limitReset: 'page' }
113
+ : {}),
114
+ ...(def.limitReset?.vendorPage ? { limitResetPage: def.limitReset.vendorPage } : {}),
106
115
  };
107
116
  }
108
117
  let autostartOverride = {};
@@ -485,9 +494,26 @@ async function accountState(rt, account, families) {
485
494
  ...(errors.length ? { error: errors.join('; ') } : {}),
486
495
  };
487
496
  }
497
+ /** The model an advisor request asks for, and the Account it is limited to (a ref), checked. */
498
+ async function advisorBody(rt, body) {
499
+ if (!isAdvisorChoice(body.to))
500
+ throw new HttpError(400, '"to" must be "fable", "opus", "sonnet" or "off"');
501
+ const ref = optString(body, 'account');
502
+ return ref ? { to: body.to, account: checkAdvisorAccount(await rt.resolve(ref)).ref } : { to: body.to };
503
+ }
488
504
  function rcView(groups, home) {
489
505
  return groups.map((g) => ({ ...g, file: tildify(g.file, home) }));
490
506
  }
507
+ function advisorView(st, home) {
508
+ return {
509
+ ...st,
510
+ groups: st.groups.map((g) => ({
511
+ ...g,
512
+ file: tildify(g.file, home),
513
+ ...(g.reason ? { reason: g.reason.split(home).join('~') } : {}),
514
+ })),
515
+ };
516
+ }
491
517
  /**
492
518
  * How long one state waits for an Account's reads. A slower Account (a plugin reader that hangs, a Host that answers
493
519
  * late) is sent as pending, so it does not hold up every other row; its reads go on and the next state picks up the
@@ -557,12 +583,13 @@ async function timedAccountState(rt, account, families, mine) {
557
583
  }
558
584
  async function buildState(rt, opts) {
559
585
  const ctx = rt.readContext();
560
- const [families, accounts, history, quotaSetups, remoteControl, upd] = await Promise.all([
586
+ const [families, accounts, history, quotaSetups, remoteControl, advisor, upd] = await Promise.all([
561
587
  rt.familyInfo(),
562
588
  rt.accounts(),
563
589
  rt.doctorHistory(),
564
590
  rt.quotaSetups(),
565
591
  rt.remoteControl(),
592
+ rt.advisor(),
566
593
  opts.updates ? updateState(rt, opts.readOnly).catch(() => undefined) : Promise.resolve(undefined),
567
594
  ]);
568
595
  const health = healthByAccount(history);
@@ -574,11 +601,19 @@ async function buildState(rt, opts) {
574
601
  if (!accounts.some((a) => a.ref === ref))
575
602
  opts.readings.delete(ref);
576
603
  const aliases = aliasesByAccount(aliasRefs(rt.config.aliases), accounts);
604
+ // Asks in flight before the reads start: one that ends while they run may have left a row with the older numbers.
605
+ const askingOf = () => accounts.filter((a) => quotaAsking(rt.paths.stateDir, a.family, a.name)).map((a) => a.ref);
606
+ const askingBefore = askingOf();
577
607
  // Desktop Apps (spec §3.20): one process listing for every Account, run alongside the per-Account reads.
578
608
  const [states, appProfiles] = await Promise.all([
579
609
  withDesktopApps(rt, accounts, Promise.all(accounts.map((a) => timedAccountState(rt, a, families, opts.readings)))),
580
610
  listAppProfiles(rt),
581
611
  ]);
612
+ // A Same Login is asked through one of its Accounts, so every Account of it is waiting for that answer.
613
+ const askingNow = new Set([...askingBefore, ...askingOf()]);
614
+ const asking = states
615
+ .filter((st) => askingNow.has(st.ref) || (st.sameLogin ?? []).some((r) => askingNow.has(r)))
616
+ .map((st) => st.ref);
582
617
  const list = states.map((st) => {
583
618
  const h = health.get(st.ref);
584
619
  const names = aliases.get(st.ref);
@@ -638,6 +673,7 @@ async function buildState(rt, opts) {
638
673
  shellSetup: { ...shellSt, rc: tildify(shellSt.rc, ctx.home), block: setupBlock(shellSt.shell) },
639
674
  ...(Object.keys(handoff).length ? { handoff } : {}),
640
675
  ...(remoteControl.length ? { remoteControl: rcView(remoteControl, ctx.home) } : {}),
676
+ ...(advisor.groups.length ? { advisor: advisorView(advisor, ctx.home) } : {}),
641
677
  ...(appProfiles.length
642
678
  ? {
643
679
  appProfiles: appProfiles.map((p) => p.appData ? { ...p, appData: tildify(p.appData, rt.paths.home) } : p),
@@ -653,6 +689,7 @@ async function buildState(rt, opts) {
653
689
  ...(upd ? { update: upd } : {}),
654
690
  ...(showBrowser ? { browser } : {}),
655
691
  display: rt.displayOrder(),
692
+ ...(asking.length ? { quotaAsking: asking } : {}),
656
693
  ...(rt.quotaChecks().length ? { quotaChecks: rt.quotaChecks() } : {}),
657
694
  ...(rt.config.panel && Object.keys(rt.config.panel).length ? { panel: rt.config.panel } : {}),
658
695
  ...(network ? { network } : {}),
@@ -1052,7 +1089,7 @@ export function createPanelHandler(opts) {
1052
1089
  async run(body) {
1053
1090
  const rt = await getRuntime();
1054
1091
  const home = rt.paths.home;
1055
- const files = change.todo ? (await change.todo(rt)).map((g) => tildify(g.file, home)) : undefined;
1092
+ const files = change.todo ? (await change.todo(rt, body)).map((g) => tildify(g.file, home)) : undefined;
1056
1093
  if (!optBool(body, 'confirm'))
1057
1094
  return { applied: false, ...(files ? { files } : {}) };
1058
1095
  if (files) {
@@ -1061,7 +1098,7 @@ export function createPanelHandler(opts) {
1061
1098
  if (!same)
1062
1099
  return { applied: false, changedSince: true, files };
1063
1100
  }
1064
- const r = await change.apply(rt);
1101
+ const r = await change.apply(rt, body);
1065
1102
  return { ...r, applied: true, results: r.results.map((x) => ({ ...x, file: tildify(x.file, home) })) };
1066
1103
  },
1067
1104
  });
@@ -1430,6 +1467,30 @@ export function createPanelHandler(opts) {
1430
1467
  apply: (rt) => rt.remoteControlOn(),
1431
1468
  }),
1432
1469
  '/api/remote-control/undo': previewedChange({ apply: (rt) => rt.remoteControlUndo() }),
1470
+ // Claude Code's advisor (spec §3.41, ADR-0074): the same change as `sideby advisor <model>|off [--account]`. It
1471
+ // writes `advisorModel` only into the files the page showed (`previewedChange`); a model also turns config
1472
+ // `advisor.unlock` on, and config `claude.apiBetasOff` where the variable leaves a file API Accounts share, both
1473
+ // of which the page shows from the state it read.
1474
+ '/api/advisor/set': previewedChange({
1475
+ async todo(rt, body) {
1476
+ const { to, account } = await advisorBody(rt, body);
1477
+ const st = await rt.advisor();
1478
+ return advisorPlan(advisorScope(st.groups, account), to, st).todo;
1479
+ },
1480
+ async apply(rt, body) {
1481
+ const { to, account } = await advisorBody(rt, body);
1482
+ return rt.advisorSet(to, account ? { account } : {});
1483
+ },
1484
+ }),
1485
+ '/api/advisor/undo': previewedChange({ apply: (rt) => rt.advisorUndo() }),
1486
+ // Config `advisor.unlock` only: sideby's own setting, so the switch writes at once and the toast offers the way back.
1487
+ '/api/advisor/unlock': {
1488
+ async run(body) {
1489
+ if (typeof body.on !== 'boolean')
1490
+ throw new HttpError(400, '"on" must be true or false');
1491
+ return (await getRuntime()).advisorUnlock(body.on);
1492
+ },
1493
+ },
1433
1494
  // Sessions (spec §3.32, ADR-0039): what every Account is running now, read only, with the texts its copy buttons
1434
1495
  // copy in the Panel's language. Polled every few seconds, so it runs beside the write queue.
1435
1496
  '/api/sessions': {
@@ -2096,6 +2157,7 @@ export function createPanelHandler(opts) {
2096
2157
  restartedPanel: r.restartedPanel,
2097
2158
  refreshedApp: r.refreshedApp,
2098
2159
  ...(r.skillUpdated === undefined ? {} : { skillUpdated: r.skillUpdated }),
2160
+ ...(r.skillMessage === undefined ? {} : { skillMessage: r.skillMessage }),
2099
2161
  ...(r.skillSyncStarted === undefined ? {} : { skillSyncStarted: r.skillSyncStarted }),
2100
2162
  };
2101
2163
  },
@@ -2162,14 +2224,48 @@ export function createPanelHandler(opts) {
2162
2224
  return { display: await rt.setDisplayOrder(display) };
2163
2225
  },
2164
2226
  },
2165
- // Asks every Family that fetches Quota again now, and waits (spec §3.26); the page reloads its state after.
2227
+ // Asks every Family that fetches Quota again now, and waits (spec §3.26); the page reloads its state after. With
2228
+ // `account`, only that Account (its Same Login is asked once): the one ask after a jump to the vendor's page.
2166
2229
  '/api/quota/refresh': {
2167
- async run() {
2230
+ async run(body) {
2168
2231
  const rt = await getRuntime();
2169
- await rt.refreshQuota();
2232
+ const account = optString(body, 'account');
2233
+ await rt.refreshQuota(account ? [await rt.resolve(account)] : undefined);
2170
2234
  return { ok: true };
2171
2235
  },
2172
2236
  },
2237
+ // Using a Limit Reset (spec §3.40, ADR-0072). Without `confirm`: the plan, read from the Host now, and the
2238
+ // operation to confirm; nothing is spent. With `confirm` and that `operationId`: one spend, which cannot be
2239
+ // undone, then the Quota read again. Beside the write queue: the Runtime's own lock makes spends take turns, and
2240
+ // a Host that is slow to answer must not hold other changes back.
2241
+ '/api/quota/reset': {
2242
+ queued: false,
2243
+ async run(body) {
2244
+ const ref = optString(body, 'account');
2245
+ if (!ref)
2246
+ throw new HttpError(400, '"account" is required');
2247
+ const rt = await getRuntime();
2248
+ const account = await rt.resolve(ref);
2249
+ if (!optBool(body, 'confirm'))
2250
+ return { plan: await rt.limitResetPlan(account) };
2251
+ const operationId = optString(body, 'operationId');
2252
+ if (!operationId)
2253
+ throw new HttpError(400, '"operationId" is required to confirm');
2254
+ return { result: await rt.limitResetUse(account, operationId) };
2255
+ },
2256
+ },
2257
+ // Opens the vendor's page where a Limit Reset is spent (Claude Code, ADR-0072), in the Account's Browser Profile
2258
+ // when one is known, else the default browser. It starts a program, so a read-only Panel refuses it.
2259
+ '/api/quota/reset/open': {
2260
+ async run(body) {
2261
+ const ref = optString(body, 'account');
2262
+ if (!ref)
2263
+ throw new HttpError(400, '"account" is required');
2264
+ const rt = await getRuntime();
2265
+ const r = await openVendorPage(rt, await rt.resolve(ref));
2266
+ return { ref: r.ref, url: r.url, ...(r.profile ? { profile: r.profile } : {}) };
2267
+ },
2268
+ },
2173
2269
  // A Family's Quota check on or off: config `quota.check.<family>` (spec §3.26).
2174
2270
  '/api/quota/check': {
2175
2271
  async run(body) {
@@ -2464,7 +2560,13 @@ export function createPanelHandler(opts) {
2464
2560
  req.resume();
2465
2561
  }
2466
2562
  else if (err instanceof UserError) {
2467
- send(res, 400, err.code ? { error: err.message, code: err.code } : { error: err.message });
2563
+ // A Limit Reset that got no final answer names its operation, so the page retries that one (ADR-0072).
2564
+ const operationId = err instanceof LimitResetError ? err.operationId : undefined;
2565
+ send(res, 400, {
2566
+ error: err.message,
2567
+ ...(err.code ? { code: err.code } : {}),
2568
+ ...(operationId ? { operationId } : {}),
2569
+ });
2468
2570
  }
2469
2571
  else {
2470
2572
  send(res, 500, { error: err?.message || 'internal error' });
@@ -318,6 +318,51 @@ declare const en: {
318
318
  'quota.resetNoData': string;
319
319
  'quota.dataFrom': string;
320
320
  'quota.asOf': string;
321
+ 'quota.readAt': string;
322
+ 'quota.readUnknown': string;
323
+ 'quota.source': string;
324
+ 'reset.count.one': string;
325
+ 'reset.count.other': string;
326
+ 'reset.tip': string;
327
+ 'reset.expires': string;
328
+ 'reset.noExpiry': string;
329
+ 'reset.use': string;
330
+ 'reset.useMenu': string;
331
+ 'reset.useHint': string;
332
+ 'reset.usePage': string;
333
+ 'reset.page.tight': string;
334
+ 'reset.page.who': string;
335
+ 'reset.page.blind': string;
336
+ 'reset.page.opened': string;
337
+ 'reset.page.openedIn': string;
338
+ 'reset.page.failed': string;
339
+ 'reset.title': string;
340
+ 'reset.peers': string;
341
+ 'reset.reading': string;
342
+ 'reset.after': string;
343
+ 'reset.left.one': string;
344
+ 'reset.left.other': string;
345
+ 'reset.stockUnknown': string;
346
+ 'reset.expiryUnknown': string;
347
+ 'reset.blocked': string;
348
+ 'reset.confirm.warn': string;
349
+ 'reset.confirm.warnAll': string;
350
+ 'reset.confirm.unresolved': string;
351
+ 'reset.confirm.go': string;
352
+ 'reset.confirm.check': string;
353
+ 'reset.busy': string;
354
+ 'reset.done': string;
355
+ 'reset.done.already': string;
356
+ 'reset.done.real': string;
357
+ 'reset.done.pending': string;
358
+ 'reset.nothing.window': string;
359
+ 'reset.nothing.none': string;
360
+ 'reset.unknown': string;
361
+ 'reset.noAnswer': string;
362
+ 'reset.pick.intro': string;
363
+ 'reset.pick.none': string;
364
+ 'reset.pick.unknown': string;
365
+ 'ai.ask.reset': string;
321
366
  'quota.staleSession': string;
322
367
  'quota.quiet': string;
323
368
  'quota.sharedFrom': string;
@@ -470,6 +515,7 @@ declare const en: {
470
515
  'ai.ask.handoff': string;
471
516
  'ai.ask.handoffRules': string;
472
517
  'ai.ask.rc': string;
518
+ 'ai.ask.advisor': string;
473
519
  'ai.ask.relogin': string;
474
520
  'ai.ask.expired': string;
475
521
  'ai.orderHint': string;
@@ -1547,6 +1593,47 @@ declare const en: {
1547
1593
  'rc.failedOn': string;
1548
1594
  'rc.readOnlyBoth': string;
1549
1595
  'rc.undone': string;
1596
+ 'adv.button': string;
1597
+ 'adv.title': string;
1598
+ 'adv.explain': string;
1599
+ 'adv.pick': string;
1600
+ 'adv.state.fable': string;
1601
+ 'adv.state.opus': string;
1602
+ 'adv.state.sonnet': string;
1603
+ 'adv.state.off': string;
1604
+ 'adv.state.other': string;
1605
+ 'adv.state.mixed': string;
1606
+ 'adv.state.missing': string;
1607
+ 'adv.state.blocked': string;
1608
+ 'adv.otherValue': string;
1609
+ 'adv.unlockSwitch': string;
1610
+ 'adv.unlockHint': string;
1611
+ 'adv.unlockNote': string;
1612
+ 'adv.onNote': string;
1613
+ 'adv.offNote': string;
1614
+ 'adv.nothing': string;
1615
+ 'adv.unavailable': string;
1616
+ 'adv.envOff': string;
1617
+ 'adv.state.betas': string;
1618
+ 'adv.betasWarn': string;
1619
+ 'adv.betasNote': string;
1620
+ 'adv.apiUsedBy': string;
1621
+ 'adv.apiNote': string;
1622
+ 'adv.apiAlready': string;
1623
+ 'adv.apiOn': string;
1624
+ 'adv.apiOff': string;
1625
+ 'adv.removed': string;
1626
+ 'adv.confirmUse': string;
1627
+ 'adv.confirmOff': string;
1628
+ 'adv.undo': string;
1629
+ 'adv.done': string;
1630
+ 'adv.doneOff': string;
1631
+ 'adv.failed': string;
1632
+ 'adv.undone': string;
1633
+ 'adv.unlockOn': string;
1634
+ 'adv.unlockOff': string;
1635
+ 'adv.readOnly': string;
1636
+ 'adv.ask': string;
1550
1637
  'banner.readOnly': string;
1551
1638
  'banner.plugins.one': string;
1552
1639
  'banner.plugins.other': string;
@@ -320,6 +320,51 @@ const en = {
320
320
  'quota.resetNoData': 'Window reset · no new data since {date}',
321
321
  'quota.dataFrom': 'Data from {ago}',
322
322
  'quota.asOf': 'As of {ago}',
323
+ 'quota.readAt': 'Read {at} ({ago})',
324
+ 'quota.readUnknown': 'Read time unknown',
325
+ 'quota.source': 'Source: {source}',
326
+ 'reset.count.one': '{n} reset available',
327
+ 'reset.count.other': '{n} resets available',
328
+ 'reset.tip': 'A limit reset restores quota before a window resets by itself. {host} counted them {ago}.',
329
+ 'reset.expires': 'The next one expires {at}.',
330
+ 'reset.noExpiry': '{host} did not say when they expire.',
331
+ 'reset.use': 'Use a reset',
332
+ 'reset.useMenu': 'Use a limit reset…',
333
+ 'reset.useHint': 'Shows the numbers first; nothing is used until you confirm.',
334
+ 'reset.usePage': 'Use a reset on {site}',
335
+ 'reset.page.tight': 'Running low: {list}.',
336
+ 'reset.page.who': 'Opens {site}. Check that the page is signed in as {who}.',
337
+ 'reset.page.blind': '{host} does not tell sideby whether this account holds a reset; the page shows it.',
338
+ 'reset.page.opened': 'Opened {site} in your browser. Check that it is signed in as {who} before you use a reset.',
339
+ 'reset.page.openedIn': 'Opened {site} in the browser user {name}. Check that it is signed in as {who} before you use a reset.',
340
+ 'reset.page.failed': 'Could not open the page: {msg}. Open {url} yourself.',
341
+ 'reset.title': 'Use a limit reset',
342
+ 'reset.peers': 'Same login as {names}: one reset applies to all of them.',
343
+ 'reset.reading': 'Reading the numbers from {host}…',
344
+ 'reset.after': '{n} expected afterwards',
345
+ 'reset.left.one': '{n} reset left',
346
+ 'reset.left.other': '{n} resets left',
347
+ 'reset.stockUnknown': 'Reset count unknown',
348
+ 'reset.expiryUnknown': 'expiry unknown',
349
+ 'reset.blocked': 'A reset cannot be used right now.',
350
+ 'reset.confirm.warn': 'This uses one reset now and cannot be undone. {host} does not say beforehand which limits it restores.',
351
+ 'reset.confirm.warnAll': 'This uses one reset now, for every account of this login, and cannot be undone. {host} does not say beforehand which limits it restores.',
352
+ 'reset.confirm.unresolved': 'An earlier attempt got no answer from {host}. Checking again repeats that same request: it uses nothing more if the reset already went through, and it cannot be undone if it did not.',
353
+ 'reset.confirm.go': 'Use 1 reset',
354
+ 'reset.confirm.check': 'Check again',
355
+ 'reset.busy': 'Using a reset… waiting for {host}.',
356
+ 'reset.done': 'A reset was used for {ref}.',
357
+ 'reset.done.already': 'This reset had already been used for {ref}; nothing more was spent.',
358
+ 'reset.done.real': 'These are the numbers {host} reports now.',
359
+ 'reset.done.pending': 'The quota could not be read yet, so these are still the old numbers; they update with the next check.',
360
+ 'reset.nothing.window': 'Nothing was spent: no limit of {ref} can be reset right now.',
361
+ 'reset.nothing.none': 'Nothing was spent: {ref} holds no reset.',
362
+ 'reset.unknown': 'Outcome unknown: {host} did not answer in time, so sideby cannot tell whether the reset was used. "Check again" repeats the same request, which cannot use a second one.',
363
+ 'reset.noAnswer': 'Outcome unknown: this page got no answer to the confirmation, so sideby cannot tell whether the reset was used. "Check again" asks about the same request, which cannot use a second one.',
364
+ 'reset.pick.intro': 'Choose the account. Nothing is used until you confirm.',
365
+ 'reset.pick.none': 'No account can use a limit reset right now.',
366
+ 'reset.pick.unknown': 'Reset count not read yet',
367
+ 'ai.ask.reset': 'Use a limit reset for codex:main. Show me the plan first.',
323
368
  'quota.staleSession': 'These numbers update when a session runs in this account',
324
369
  'quota.quiet': 'Not used on this computer since · use on the web or other computers is not included',
325
370
  'quota.sharedFrom': 'Same login as {name}; quota read from {name}, {ago}',
@@ -472,6 +517,7 @@ const en = {
472
517
  'ai.ask.handoff': 'Turn on Auto Handoff.',
473
518
  'ai.ask.handoffRules': 'When does Auto Handoff switch accounts, and could it use my API accounts?',
474
519
  'ai.ask.rc': 'Turn off Remote Control for every Claude account.',
520
+ 'ai.ask.advisor': 'Let every Claude account ask Opus for advice at key moments.',
475
521
  'ai.ask.relogin': 'Two of my accounts are the same login; help me sign one in with another account.',
476
522
  'ai.ask.expired': 'Which of my accounts has an expired sign-in? Help me sign it in again.',
477
523
  'ai.orderHint': 'or ask your AI',
@@ -1549,6 +1595,47 @@ const en = {
1549
1595
  'rc.failedOn': 'Could not turn it on: {msg}',
1550
1596
  'rc.readOnlyBoth': 'Run sideby remote-control on or off to change it.',
1551
1597
  'rc.undone': 'Undone. New sessions go back to the previous setting.',
1598
+ 'adv.button': 'Advisor (ask a stronger model)',
1599
+ 'adv.title': 'Advisor',
1600
+ 'adv.explain': 'Claude asks a stronger model for advice at key moments, such as before a big change or when it is stuck. This uses more quota.',
1601
+ 'adv.pick': 'Ask for advice from',
1602
+ 'adv.state.fable': 'Fable',
1603
+ 'adv.state.opus': 'Opus',
1604
+ 'adv.state.sonnet': 'Sonnet',
1605
+ 'adv.state.off': 'Off',
1606
+ 'adv.state.other': 'Another model',
1607
+ 'adv.state.mixed': 'Mixed',
1608
+ 'adv.state.missing': 'No settings file',
1609
+ 'adv.state.blocked': 'Cannot read',
1610
+ 'adv.otherValue': 'another value',
1611
+ 'adv.unlockSwitch': 'Unlock /advisor in sessions sideby starts',
1612
+ 'adv.unlockHint': 'Claude Code shows /advisor only on accounts Anthropic has turned it on for. With this on, every Claude account sideby starts gets it; sessions started with plain claude do not.',
1613
+ 'adv.unlockNote': 'sideby will also unlock /advisor in the Claude sessions it starts, with',
1614
+ 'adv.onNote': 'Restart sessions that are already running. Sessions started with plain claude get the advisor only where Anthropic has turned it on.',
1615
+ 'adv.offNote': 'New sessions stop asking an advisor. Restart sessions that are already running.',
1616
+ 'adv.nothing': 'Every file already says this; nothing to change.',
1617
+ 'adv.unavailable': 'If a session says "Advisor unavailable", Anthropic has not enabled the advisor for that account yet, and sideby cannot change that. The first time you use Fable, Claude Code may ask you to agree.',
1618
+ 'adv.envOff': 'Your shell sets {v}, so Claude Code hides the advisor in every session, also the ones sideby starts. sideby does not change your shell; remove it from your shell profile to use the advisor.',
1619
+ 'adv.state.betas': 'Turned off by a setting',
1620
+ 'adv.betasWarn': "This file sets {v}, which turns off Claude Code's experimental features, the advisor among them. Choosing a model offers to remove it.",
1621
+ 'adv.betasNote': "Removing it also turns Claude Code's other experimental features back on.",
1622
+ 'adv.apiUsedBy': 'Also used by API accounts {refs}',
1623
+ 'adv.apiNote': 'API accounts {refs} use this file too, and their gateway may need the variable. From now on sideby gives it to them when it starts them (a value in their proxy.env still wins):',
1624
+ 'adv.apiAlready': 'API accounts {refs} already get this variable from sideby when it starts them, so they keep it.',
1625
+ 'adv.apiOn': 'sideby turns off experimental features for API accounts when it starts them ({v}=1). To stop that, run: sideby config set claude.apiBetasOff false',
1626
+ 'adv.apiOff': 'sideby does not add {v} for API accounts.',
1627
+ 'adv.removed': 'removed',
1628
+ 'adv.confirmUse': 'Use {m}',
1629
+ 'adv.confirmOff': 'Turn off',
1630
+ 'adv.undo': 'Undo last change',
1631
+ 'adv.done': 'New sessions ask {m} for advice. Restart sessions that are running.',
1632
+ 'adv.doneOff': 'The advisor is off for new sessions. Restart sessions that are running.',
1633
+ 'adv.failed': 'Could not change the advisor: {msg}',
1634
+ 'adv.undone': 'Undone. New sessions go back to the previous advisor setting.',
1635
+ 'adv.unlockOn': '/advisor is unlocked in sessions sideby starts. Restart sessions that are running.',
1636
+ 'adv.unlockOff': 'sideby no longer unlocks /advisor.',
1637
+ 'adv.readOnly': 'Run sideby advisor opus (or fable, sonnet, off) to change it.',
1638
+ 'adv.ask': 'Or ask your AI to do it',
1552
1639
  'banner.readOnly': 'Read-only view. Use the sideby CLI to fix or create accounts.',
1553
1640
  'banner.plugins.one': '{n} plugin problem.',
1554
1641
  'banner.plugins.other': '{n} plugin problems.',
@@ -1970,6 +2057,51 @@ const zh = {
1970
2057
  'quota.resetNoData': '已重置,{date}后无新数据',
1971
2058
  'quota.dataFrom': '数据来自 {ago}',
1972
2059
  'quota.asOf': '截至 {ago}',
2060
+ 'quota.readAt': '读于 {at}({ago})',
2061
+ 'quota.readUnknown': '读取时间未知',
2062
+ 'quota.source': '来源:{source}',
2063
+ 'reset.count.one': '可用重置 {n} 次',
2064
+ 'reset.count.other': '可用重置 {n} 次',
2065
+ 'reset.tip': '用一次重置,能在窗口自己重置之前恢复额度。{host} {ago}报告的次数。',
2066
+ 'reset.expires': '最近一次 {at} 到期。',
2067
+ 'reset.noExpiry': '{host} 没有说什么时候到期。',
2068
+ 'reset.use': '使用一次重置',
2069
+ 'reset.useMenu': '使用一次重置…',
2070
+ 'reset.useHint': '先给你看数字;你确认之前什么都不会用掉。',
2071
+ 'reset.usePage': '去 {site} 使用重置',
2072
+ 'reset.page.tight': '快用完了:{list}。',
2073
+ 'reset.page.who': '会打开 {site}。请确认网页登录的是 {who}。',
2074
+ 'reset.page.blind': '{host} 不告诉 sideby 这个账号有没有重置次数,要到网页上看。',
2075
+ 'reset.page.opened': '已在浏览器打开 {site}。使用重置前,请确认网页登录的是 {who}。',
2076
+ 'reset.page.openedIn': '已在浏览器用户 {name} 里打开 {site}。使用重置前,请确认网页登录的是 {who}。',
2077
+ 'reset.page.failed': '打不开页面:{msg}。请自己打开 {url}。',
2078
+ 'reset.title': '使用一次重置',
2079
+ 'reset.peers': '与 {names} 是同一登录:用一次重置,这些账号都生效。',
2080
+ 'reset.reading': '正在向 {host} 读取最新数字…',
2081
+ 'reset.after': '用后预计剩 {n} 次',
2082
+ 'reset.left.one': '还剩 {n} 次重置',
2083
+ 'reset.left.other': '还剩 {n} 次重置',
2084
+ 'reset.stockUnknown': '重置次数未知',
2085
+ 'reset.expiryUnknown': '到期时间未知',
2086
+ 'reset.blocked': '现在用不了重置。',
2087
+ 'reset.confirm.warn': '确认后立刻用掉 1 次重置,不能撤销。{host} 不会事先说明它恢复哪些额度。',
2088
+ 'reset.confirm.warnAll': '确认后立刻用掉 1 次重置,这个登录下的账号都生效,不能撤销。{host} 不会事先说明它恢复哪些额度。',
2089
+ 'reset.confirm.unresolved': '上一次尝试没有等到 {host} 的回答。再查一次会重发同一个请求:如果上次已经用掉,不会再多用;如果没有,这次用掉后不能撤销。',
2090
+ 'reset.confirm.go': '用掉 1 次重置',
2091
+ 'reset.confirm.check': '再查一次',
2092
+ 'reset.busy': '正在使用重置…等待 {host} 回答。',
2093
+ 'reset.done': '已为 {ref} 用掉 1 次重置。',
2094
+ 'reset.done.already': '{ref} 的这次重置之前已经用掉,没有再多用。',
2095
+ 'reset.done.real': '下面是 {host} 现在报告的数字。',
2096
+ 'reset.done.pending': '额度暂时没读到,下面还是旧数字,下次查询时更新。',
2097
+ 'reset.nothing.window': '没有用掉任何次数:{ref} 现在没有可以重置的额度。',
2098
+ 'reset.nothing.none': '没有用掉任何次数:{ref} 没有重置次数。',
2099
+ 'reset.unknown': '结果未知:{host} 没有按时回答,sideby 无法判断重置有没有用掉。点「再查一次」会重发同一个请求,不会用掉第二次。',
2100
+ 'reset.noAnswer': '结果未知:这个页面没有收到确认的回答,sideby 无法判断重置有没有用掉。点「再查一次」会查同一个请求,不会用掉第二次。',
2101
+ 'reset.pick.intro': '选一个账号。你确认之前什么都不会用掉。',
2102
+ 'reset.pick.none': '现在没有账号可以使用重置。',
2103
+ 'reset.pick.unknown': '还没读到重置次数',
2104
+ 'ai.ask.reset': '帮我给 codex:main 用一次重置,先给我看计划。',
1973
2105
  'quota.staleSession': '在这个账号开一次会话,这些数字就会更新',
1974
2106
  'quota.quiet': '之后这台电脑没用过这个账号 · 网页或其他电脑上的用量不在内',
1975
2107
  'quota.sharedFrom': '与 {name} 同一登录;额度读自 {name},{ago}',
@@ -2122,6 +2254,7 @@ const zh = {
2122
2254
  'ai.ask.handoff': '帮我开启自动接力。',
2123
2255
  'ai.ask.handoffRules': '自动接力什么时候换号?会不会用到我的 API 账号?',
2124
2256
  'ai.ask.rc': '把所有 Claude 账号的远程控制关掉。',
2257
+ 'ai.ask.advisor': '让所有 Claude 账号在关键时刻请教 Opus。',
2125
2258
  'ai.ask.relogin': '我有两个账号登录的是同一个号,帮我把其中一个换成别的账号。',
2126
2259
  'ai.ask.expired': '哪个账号登录过期了?帮我重新登录。',
2127
2260
  'ai.orderHint': '也可以让 AI 帮你排',
@@ -3199,6 +3332,47 @@ const zh = {
3199
3332
  'rc.failedOn': '没能打开:{msg}',
3200
3333
  'rc.readOnlyBoth': '运行 sideby remote-control on 或 off 来修改。',
3201
3334
  'rc.undone': '已撤销,新会话恢复原来的设置。',
3335
+ 'adv.button': '顾问模型(Advisor)',
3336
+ 'adv.title': '顾问模型(Advisor)',
3337
+ 'adv.explain': 'Claude 在关键时刻(比如大改动之前、卡住的时候)请教一个更强的模型。会多用额度。',
3338
+ 'adv.pick': '请教哪个模型',
3339
+ 'adv.state.fable': 'Fable',
3340
+ 'adv.state.opus': 'Opus',
3341
+ 'adv.state.sonnet': 'Sonnet',
3342
+ 'adv.state.off': '关',
3343
+ 'adv.state.other': '其他模型',
3344
+ 'adv.state.mixed': '各不相同',
3345
+ 'adv.state.missing': '没有设置文件',
3346
+ 'adv.state.blocked': '读不了',
3347
+ 'adv.otherValue': '其他值',
3348
+ 'adv.unlockSwitch': '在 sideby 启动的会话里解锁 /advisor',
3349
+ 'adv.unlockHint': 'Claude Code 只在 Anthropic 已开放的账号上显示 /advisor。打开后,sideby 启动的每个 Claude 账号都能用;直接运行 claude 开的会话不变。',
3350
+ 'adv.unlockNote': 'sideby 还会在它启动的 Claude 会话里解锁 /advisor,方法是设置',
3351
+ 'adv.onNote': '已经开着的会话要重开。直接运行 claude 开的会话,只有 Anthropic 已为账号开放时才有顾问。',
3352
+ 'adv.offNote': '新会话不再请教顾问。已经开着的会话要重开。',
3353
+ 'adv.nothing': '每个文件都已经是这个设置,不用改。',
3354
+ 'adv.unavailable': '会话里出现「Advisor unavailable」,说明 Anthropic 还没给这个账号开放,sideby 改不了。第一次用 Fable 时,Claude Code 可能会请你同意。',
3355
+ 'adv.envOff': '你的终端环境设了 {v},Claude Code 在每个会话里都会隐藏顾问,sideby 启动的也一样。sideby 不改你的终端环境;要用顾问,请从 shell 配置文件里删掉它。',
3356
+ 'adv.state.betas': '被设置关掉了',
3357
+ 'adv.betasWarn': '这个文件设了 {v},它会关掉 Claude Code 的实验功能,顾问也在其中。选模型时 sideby 会提议删掉它。',
3358
+ 'adv.betasNote': '删掉它也会重新打开 Claude Code 的其他实验功能。',
3359
+ 'adv.apiUsedBy': '同时被 API 账号 {refs} 使用',
3360
+ 'adv.apiNote': 'API 账号 {refs} 也用这个文件,它们的网关可能需要这个变量。之后 sideby 启动它们时会自动带上(proxy.env 里写了的话以它为准):',
3361
+ 'adv.apiAlready': 'API 账号 {refs} 已经由 sideby 在启动时带上这个变量,不受影响。',
3362
+ 'adv.apiOn': 'sideby 启动 API 账号时会关掉实验功能({v}=1)。不想这样,运行:sideby config set claude.apiBetasOff false',
3363
+ 'adv.apiOff': 'sideby 启动 API 账号时不会额外带上 {v}。',
3364
+ 'adv.removed': '删除',
3365
+ 'adv.confirmUse': '改用 {m}',
3366
+ 'adv.confirmOff': '确认关闭',
3367
+ 'adv.undo': '撤销上次更改',
3368
+ 'adv.done': '新会话会请教 {m}。开着的会话要重开。',
3369
+ 'adv.doneOff': '新会话不再请教顾问。开着的会话要重开。',
3370
+ 'adv.failed': '没能修改顾问模型:{msg}',
3371
+ 'adv.undone': '已撤销,新会话恢复之前的顾问设置。',
3372
+ 'adv.unlockOn': '已在 sideby 启动的会话里解锁 /advisor。开着的会话要重开。',
3373
+ 'adv.unlockOff': 'sideby 不再解锁 /advisor。',
3374
+ 'adv.readOnly': '运行 sideby advisor opus(或 fable、sonnet、off)来修改。',
3375
+ 'adv.ask': '或者让 AI 帮你设置',
3202
3376
  'banner.readOnly': '只读视图。修复或创建账号请用 sideby 命令行。',
3203
3377
  'banner.plugins.one': '{n} 个插件问题。',
3204
3378
  'banner.plugins.other': '{n} 个插件问题。',
@@ -599,6 +599,23 @@ export declare function remoteControlSummary(groups: readonly {
599
599
  accounts: readonly string[];
600
600
  state: string;
601
601
  }[], apiRefs: readonly string[]): 'on' | 'default' | 'off' | null;
602
+ /**
603
+ * What the Panel's Advisor row says (spec §3.41): the one state every readable settings file has (`fable`, `opus`,
604
+ * `sonnet`, `other` or `off`), `mixed` when they differ, `off` when none can be read; null without groups.
605
+ */
606
+ export declare function advisorSummary(groups: readonly {
607
+ state: string;
608
+ }[]): string | null;
609
+ /**
610
+ * The choice the Advisor dialog waits to confirm after a click on `v` (spec §3.41): `v`, unless it is the model the
611
+ * files already name (`current`) and choosing it changes nothing (`pending`, from `advisorPending`); then nothing waits.
612
+ * A file that already names the model but still needs a change (its `env` turns experimental features off, or the
613
+ * unlock is off) keeps the choice, so the dialog offers that change.
614
+ */
615
+ export declare function advisorPick(v: string, current: string | null, pending: {
616
+ todo: readonly unknown[];
617
+ unlocks: boolean;
618
+ }): string | null;
602
619
  /**
603
620
  * Where a menu or popover goes next to its anchor, all in viewport pixels. It opens below when its whole height fits
604
621
  * there, else above when it fits there, else on the side with more room, its height capped at that room so it scrolls
@@ -1110,6 +1110,29 @@ export function remoteControlSummary(groups, apiRefs) {
1110
1110
  return 'default';
1111
1111
  return 'off';
1112
1112
  }
1113
+ /**
1114
+ * What the Panel's Advisor row says (spec §3.41): the one state every readable settings file has (`fable`, `opus`,
1115
+ * `sonnet`, `other` or `off`), `mixed` when they differ, `off` when none can be read; null without groups.
1116
+ */
1117
+ export function advisorSummary(groups) {
1118
+ if (!groups.length)
1119
+ return null;
1120
+ const seen = [
1121
+ ...new Set(groups.filter((g) => g.state !== 'missing' && g.state !== 'blocked').map((g) => g.state)),
1122
+ ];
1123
+ if (!seen.length)
1124
+ return 'off';
1125
+ return seen.length === 1 ? seen[0] : 'mixed';
1126
+ }
1127
+ /**
1128
+ * The choice the Advisor dialog waits to confirm after a click on `v` (spec §3.41): `v`, unless it is the model the
1129
+ * files already name (`current`) and choosing it changes nothing (`pending`, from `advisorPending`); then nothing waits.
1130
+ * A file that already names the model but still needs a change (its `env` turns experimental features off, or the
1131
+ * unlock is off) keeps the choice, so the dialog offers that change.
1132
+ */
1133
+ export function advisorPick(v, current, pending) {
1134
+ return v === current && !pending.todo.length && !pending.unlocks ? null : v;
1135
+ }
1113
1136
  /**
1114
1137
  * Where a menu or popover goes next to its anchor, all in viewport pixels. It opens below when its whole height fits
1115
1138
  * there, else above when it fits there, else on the side with more room, its height capped at that room so it scrolls