sideby 0.32.0 → 0.32.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/build.json CHANGED
@@ -1 +1 @@
1
- {"id":"20261030T091708-6dfc06"}
1
+ {"id":"20261030T183500-1af3ae"}
@@ -45,7 +45,7 @@ function run(argv) {
45
45
 
46
46
  var out = ObjC.unwrap($.NSTemporaryDirectory()) + 'sideby-menubar-' + $.NSProcessInfo.processInfo.processIdentifier + '.json';
47
47
  var snap = null, task = null, handle = null, lastStart = 0, lastOk = 0, failed = false;
48
- var refs = [], actions = [], footer = null, appearance = '';
48
+ var refs = [], actions = [], footer = null, appearance = '', manual = false;
49
49
  // The first words, before any snapshot has said which language to use.
50
50
  var zh = /^zh/i.test(lang);
51
51
  var CARD_ICON = ${JSON.stringify(FAVICON_SVG)};
@@ -89,6 +89,7 @@ function run(argv) {
89
89
  function finishSnapshot() {
90
90
  var ok = task.terminationStatus === 0;
91
91
  task = null;
92
+ manual = false;
92
93
  closeHandle();
93
94
  if (ok) {
94
95
  try {
@@ -233,7 +234,7 @@ function run(argv) {
233
234
  function footerText() {
234
235
  if (!snap) return LOADING;
235
236
  var l = snap.labels;
236
- if (task && !lastOk) return l.refreshing;
237
+ if (task && (manual || !lastOk)) return l.refreshing;
237
238
  if (failed) return l.refreshFailed;
238
239
  var minutes = Math.floor((now() - lastOk) / 60);
239
240
  return minutes < 1 ? l.updatedJustNow : l.updatedMinutes.replace('{n}', String(minutes));
@@ -465,10 +466,52 @@ function run(argv) {
465
466
  if (img) mi.image = img;
466
467
  return mi;
467
468
  }
469
+ // The last line: when the numbers were checked, and a refresh button. A button in a view keeps the menu open, so
470
+ // a click shows "Refreshing…" and then the new numbers in place, as menu bar apps such as CodexBar do. ⌘R does the
471
+ // same through a hidden item.
472
+ function footerItem(menu, L, refreshTitle) {
473
+ var W = Math.max(280, L ? L.width : 280), H = 24;
474
+ var v = $.NSView.alloc.initWithFrame($.NSMakeRect(0, 0, W, H));
475
+ v.autoresizingMask = $.NSViewWidthSizable;
476
+ var clock = symbol('clock');
477
+ if (clock) {
478
+ var iv = $.NSImageView.imageViewWithImage(clock);
479
+ iv.frame = $.NSMakeRect(HEAD_X, (H - 14) / 2, 14, 14);
480
+ iv.contentTintColor = $.NSColor.secondaryLabelColor;
481
+ v.addSubview(iv);
482
+ }
483
+ footer = $.NSTextField.labelWithString(footerText());
484
+ footer.font = $.NSFont.menuFontOfSize(0);
485
+ footer.textColor = $.NSColor.secondaryLabelColor;
486
+ footer.frame = $.NSMakeRect(HEAD_TEXT_X, (H - 17) / 2, W - HEAD_TEXT_X - 44, 17);
487
+ v.addSubview(footer);
488
+ if (refreshTitle) {
489
+ var b = $.NSButton.alloc.initWithFrame($.NSMakeRect(W - 38, (H - 22) / 2, 26, 22));
490
+ b.autoresizingMask = $.NSViewMinXMargin;
491
+ b.bezelStyle = $.NSBezelStyleRecessed;
492
+ b.showsBorderOnlyWhileMouseInside = true;
493
+ b.image = symbol('arrow.clockwise');
494
+ b.imagePosition = $.NSImageOnly;
495
+ b.toolTip = refreshTitle + ' (⌘R)';
496
+ b.target = target;
497
+ b.action = 'refresh:';
498
+ v.addSubview(b);
499
+ var key = $.NSMenuItem.alloc.initWithTitleActionKeyEquivalent(refreshTitle, 'refresh:', 'r');
500
+ key.target = target;
501
+ key.hidden = true;
502
+ key.allowsKeyEquivalentWhenHidden = true;
503
+ menu.addItem(key);
504
+ }
505
+ var mi = $.NSMenuItem.alloc.init;
506
+ mi.view = v;
507
+ menu.addItem(mi);
508
+ }
509
+ // One menu for the item's life: a rebuild swaps its items, so an open menu shows new numbers in place.
510
+ var menu = $.NSMenu.alloc.init;
511
+ menu.autoenablesItems = false;
468
512
  function build() {
469
513
  drawTitle();
470
- var menu = $.NSMenu.alloc.init;
471
- menu.autoenablesItems = false;
514
+ menu.removeAllItems;
472
515
  refs = [];
473
516
  if (snap) {
474
517
  var L = layout(snap.sections);
@@ -496,15 +539,14 @@ function run(argv) {
496
539
  }
497
540
  });
498
541
  menu.addItem($.NSMenuItem.separatorItem);
499
- footer = withImage(add(menu, footerText(), null), 'clock');
500
- withImage(add(menu, snap.labels.refresh, 'refresh:', 0, 'r'), 'arrow.clockwise');
542
+ footerItem(menu, L, snap.labels.refresh);
501
543
  withImage(add(menu, snap.labels.openPanel, 'openPanel:', 0, 'o'), 'macwindow');
502
544
  menu.addItem($.NSMenuItem.separatorItem);
503
545
  if (hotkeyStatus === 'taken' && hotkeyWant)
504
546
  withImage(add(menu, snap.labels.hotkeyTaken.replace('{key}', hotkeyWant.label), 'openPanel:'), 'keyboard');
505
547
  withImage(add(menu, snap.labels.hide, 'hide:'), 'eye.slash');
506
548
  } else {
507
- footer = withImage(add(menu, footerText(), null), 'clock');
549
+ footerItem(menu, null, null);
508
550
  withImage(add(menu, OPEN_PANEL, 'openPanel:', 0, 'o'), 'macwindow');
509
551
  }
510
552
  closeItem(menu);
@@ -538,14 +580,16 @@ function run(argv) {
538
580
  // The bars are pictures in the colours of the moment; redraw them when light or dark mode changes.
539
581
  if (ObjC.unwrap(app.effectiveAppearance.name) !== appearance) build();
540
582
  else drawTitle();
541
- if (footer) footer.title = footerText();
583
+ if (footer) footer.stringValue = footerText();
542
584
  },
543
585
  },
544
586
  'refresh:': {
545
587
  types: ['void', ['id']],
546
588
  implementation: function () {
547
589
  // A manual refresh must query the Host, even if an automatic cache read is already running.
590
+ manual = true;
548
591
  startSnapshot(true);
592
+ if (footer) footer.stringValue = footerText();
549
593
  },
550
594
  },
551
595
  // A setting changed (the shortcut): read the snapshot again now, after one that is running, with no restart.
@@ -592,7 +636,8 @@ function run(argv) {
592
636
  $.NSDistributedNotificationCenter.defaultCenter.addObserverSelectorNameObject(target, 'reload:', $('${MENUBAR_RELOAD}'), $());
593
637
  build();
594
638
  startSnapshot();
595
- $.NSTimer.scheduledTimerWithTimeIntervalTargetSelectorUserInfoRepeats(TICK, target, 'tick:', $(), true);
639
+ // Common modes: the tick also runs while the menu is open, so a refresh started there lands in place.
640
+ $.NSRunLoop.mainRunLoop.addTimerForMode($.NSTimer.timerWithTimeIntervalTargetSelectorUserInfoRepeats(TICK, target, 'tick:', $(), true), $.NSRunLoopCommonModes);
596
641
  app.run;
597
642
  }
598
643
  `;
@@ -129,9 +129,10 @@ export declare function menubarHotkey(value: string | undefined): MenubarHotkey
129
129
  /** `2h 5m`, `3d 4h` or `12m` until `at`; at least one minute. */
130
130
  export declare function untilText(at: string, now: Date, s: MenubarStrings): string;
131
131
  /**
132
- * The model groups of a Quota whose every window covers one group (Antigravity CLI), in the order the Host lists them,
133
- * as the Panel shows them: each with its own windows, so the menu draws a line per group with its `5h` and `7d` bars.
134
- * Null when some window covers every model.
132
+ * The model groups of a Quota, from its windows that cover one group (Antigravity CLI's, Cursor's "Other models"), in
133
+ * the order the Host lists them, as the Panel shows them: each with its own windows, so the menu draws a line per group
134
+ * with its `5h` and `7d` bars. Windows that cover every model stay on the account's own line. Null when no window
135
+ * covers a single group.
135
136
  */
136
137
  export declare function quotaGroups(quota: QuotaResult): {
137
138
  name: string;
@@ -80,16 +80,18 @@ function durationText(minutes, s) {
80
80
  return fill(s.minutes, { m });
81
81
  }
82
82
  /**
83
- * The model groups of a Quota whose every window covers one group (Antigravity CLI), in the order the Host lists them,
84
- * as the Panel shows them: each with its own windows, so the menu draws a line per group with its `5h` and `7d` bars.
85
- * Null when some window covers every model.
83
+ * The model groups of a Quota, from its windows that cover one group (Antigravity CLI's, Cursor's "Other models"), in
84
+ * the order the Host lists them, as the Panel shows them: each with its own windows, so the menu draws a line per group
85
+ * with its `5h` and `7d` bars. Windows that cover every model stay on the account's own line. Null when no window
86
+ * covers a single group.
86
87
  */
87
88
  export function quotaGroups(quota) {
88
- if (quota.status !== 'ok' || !quota.windows.length || quota.windows.some((w) => !w.name))
89
+ if (quota.status !== 'ok' || !quota.windows.some((w) => w.name))
89
90
  return null;
90
91
  const groups = new Map();
91
92
  for (const { name, ...w } of quota.windows)
92
- groups.set(name, [...(groups.get(name) ?? []), w]);
93
+ if (name)
94
+ groups.set(name, [...(groups.get(name) ?? []), w]);
93
95
  return [...groups].map(([name, windows]) => ({ name, quota: { ...quota, windows } }));
94
96
  }
95
97
  /** A model group's name over its line, without a trailing "models" so it fits. */
@@ -187,19 +189,30 @@ function row(a, plan, now, s, refreshable) {
187
189
  ];
188
190
  const groups = quotaGroups(quota);
189
191
  if (groups) {
190
- // One line per model group under the account, each with its own 5h and 7d bars (spec §3.31).
192
+ // One line per model group under the account, each with its own 5h and 7d bars (spec §3.31). Windows that cover
193
+ // every model (Cursor's plan total) keep their bars on the account's own line.
191
194
  const drawnGroups = groups.map((g) => ({ name: g.name, d: drawn(g.quota, now, s) }));
192
195
  const groupTip = (g) => [g.name, ...g.d.lines.map((l) => ` ${l}`)];
196
+ const all = openWindows(quota, now) ? drawn(quota, now, s) : null;
193
197
  return {
194
198
  ...base,
195
199
  observedAt: quota.observedAt,
196
200
  stale,
197
201
  detail: [
202
+ ...(all ? [all.parts.join(' ')] : []),
198
203
  ...drawnGroups.map((g) => `${groupLabel(g.name)} ${g.d.parts.join(' ')}`),
199
204
  ...(stale ? [s.olderReading] : []),
200
205
  ].join(s.sep),
201
- level: drawnGroups.reduce((l, g) => worseLevel(l, g.d.level), 'ok'),
202
- tip: [...head, '', ...drawnGroups.flatMap(groupTip), '', startTip].join('\n'),
206
+ level: drawnGroups.reduce((l, g) => worseLevel(l, g.d.level), all?.level ?? 'ok'),
207
+ tip: [
208
+ ...head,
209
+ '',
210
+ ...(all ? [...all.lines, ''] : []),
211
+ ...drawnGroups.flatMap(groupTip),
212
+ '',
213
+ startTip,
214
+ ].join('\n'),
215
+ ...(all ? { bars: all.bars, reset: all.reset } : {}),
203
216
  groups: drawnGroups.map((g) => ({
204
217
  label: groupLabel(g.name),
205
218
  bars: g.d.bars,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sideby",
3
- "version": "0.32.0",
3
+ "version": "0.32.2",
4
4
  "description": "Run work, personal and API-key accounts at the same time, without their configs drifting apart.",
5
5
  "license": "MIT",
6
6
  "author": "Adonis0123 (https://github.com/Adonis0123)",
@@ -2,7 +2,7 @@
2
2
  name: sideby
3
3
  description: Use when the user runs, or wants to run, several AI coding accounts (Claude Code, Codex, Grok Build, pi) side by side. Covers installing sideby and setting up a new account ("install sideby", "set up another Claude account", "add cc008", "配置一个 cc00x", "再加一个 Codex 账号"), explaining what accounts share and what stays separate ("what do my accounts share?", "这些账号共享了什么"), showing which account a session is ("show [cc001] in the status line", "加上账号标识"), finding a past session of any account ("找一下我上周改登录页的那个会话"), telling another running session something, in any account ("告诉 cc002 ……", "给跑构建的那个会话发消息"; Claude Code's own SendMessage reaches only sessions of the same account), seeing accounts, quota and usage, moving on when one hits its 5-hour or weekly limit, moving the current task to another account ("用 cc008 继续", "交回 cc008"), adding a short command (alias) or a pick command that starts whichever account has the most quota ("加个 cc"), adding an API account from a vendor's docs ("加一个 DeepSeek API 账号"), supporting a new tool, and repairing drifted account directories (skills, hooks, rules or settings not shared, wrong symlinks, credential file permissions). Drives the `sideby` CLI with `--json`; the agent does every step except browser sign-in, filling in secrets and starting interactive sessions, which it hands to the user as one command (inside an Auto Handoff session, `sideby handoff ready --to` moves the task itself).
4
4
  metadata:
5
- version: "0.32.0"
5
+ version: "0.32.2"
6
6
  requires:
7
7
  bins: [sideby, node]
8
8
  cliHelp: sideby --help