sideby 0.31.0 → 0.31.1
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 +1 -1
- package/dist/src/menubar/script.d.ts +5 -0
- package/dist/src/menubar/script.js +27 -10
- package/package.json +1 -1
- package/skills/sideby/SKILL.md +1 -1
package/dist/build.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"id":"
|
|
1
|
+
{"id":"20261030T033929-5e5870"}
|
|
@@ -5,6 +5,11 @@ export declare const TICK_SECONDS = 5;
|
|
|
5
5
|
export declare const STALE_SECONDS: number;
|
|
6
6
|
/** A snapshot still running after this is ended, so a stuck one cannot stop the refreshes. */
|
|
7
7
|
export declare const SNAPSHOT_TIMEOUT_SECONDS = 60;
|
|
8
|
+
/**
|
|
9
|
+
* Hours after which an idle item starts itself again. Over many hours the menu took longer and longer to open (1.6 to
|
|
10
|
+
* 2 s after 18 hours on macOS 27, 2026-10-30, against about 0.1 s fresh), with no cause found in the script.
|
|
11
|
+
*/
|
|
12
|
+
export declare const RESTART_HOURS = 6;
|
|
8
13
|
/** The macOS distributed notification that makes a running item read its snapshot again (`nudgeMenubar`). */
|
|
9
14
|
export declare const MENUBAR_RELOAD = "dev.sideby.menubar.reload";
|
|
10
15
|
export declare const MENUBAR_SCRIPT: string;
|
|
@@ -10,11 +10,17 @@ export const TICK_SECONDS = 5;
|
|
|
10
10
|
export const STALE_SECONDS = 15 * 60;
|
|
11
11
|
/** A snapshot still running after this is ended, so a stuck one cannot stop the refreshes. */
|
|
12
12
|
export const SNAPSHOT_TIMEOUT_SECONDS = 60;
|
|
13
|
+
/**
|
|
14
|
+
* Hours after which an idle item starts itself again. Over many hours the menu took longer and longer to open (1.6 to
|
|
15
|
+
* 2 s after 18 hours on macOS 27, 2026-10-30, against about 0.1 s fresh), with no cause found in the script.
|
|
16
|
+
*/
|
|
17
|
+
export const RESTART_HOURS = 6;
|
|
13
18
|
/** The macOS distributed notification that makes a running item read its snapshot again (`nudgeMenubar`). */
|
|
14
19
|
export const MENUBAR_RELOAD = 'dev.sideby.menubar.reload';
|
|
15
20
|
export const MENUBAR_SCRIPT = String.raw `
|
|
16
21
|
ObjC.import('Cocoa');
|
|
17
22
|
ObjC.import('Carbon');
|
|
23
|
+
ObjC.import('stdlib');
|
|
18
24
|
function run(argv) {
|
|
19
25
|
var node = argv[0], entry = argv[1];
|
|
20
26
|
var SNAPSHOT = ${SNAPSHOT_SECONDS}, TICK = ${TICK_SECONDS}, STALE = ${STALE_SECONDS}, TIMEOUT = ${SNAPSHOT_TIMEOUT_SECONDS};
|
|
@@ -46,6 +52,9 @@ function run(argv) {
|
|
|
46
52
|
var LOADING = zh ? ${JSON.stringify(MENUBAR_STRINGS.zh.loading)} : ${JSON.stringify(MENUBAR_STRINGS.en.loading)};
|
|
47
53
|
var OPEN_PANEL = zh ? ${JSON.stringify(MENUBAR_STRINGS.zh.openPanel)} : ${JSON.stringify(MENUBAR_STRINGS.en.openPanel)};
|
|
48
54
|
var now = function () { return Date.now() / 1000; };
|
|
55
|
+
// The clock NSEvent timestamps use.
|
|
56
|
+
var uptime = function () { return Number($.NSProcessInfo.processInfo.systemUptime); };
|
|
57
|
+
var started = now();
|
|
49
58
|
|
|
50
59
|
function sideby(args) {
|
|
51
60
|
var t = $.NSTask.alloc.init;
|
|
@@ -96,7 +105,7 @@ function run(argv) {
|
|
|
96
105
|
// RegisterEventHotKey: it needs no permission, unlike watching every key press. macOS hands a press to this app as a
|
|
97
106
|
// system-defined event of subtype 6 whose data1 is the key's reference. While the menu is open the key is
|
|
98
107
|
// unregistered, so the press reaches the menu, where a hidden item with the same key closes it.
|
|
99
|
-
var hotkeyWant = null, hotkeyRef = 0, hotkeyBound = false, menuOpen = false, closedAt = 0;
|
|
108
|
+
var hotkeyWant = null, hotkeyRef = 0, hotkeyBound = false, menuOpen = false, closedAt = 0, lastUse = 0;
|
|
100
109
|
// Whether the shortcut could be registered ('ok', 'taken', '' when off), and what the last snapshot was told: the
|
|
101
110
|
// status with the shortcut it is about, so a report never lands on a shortcut changed since.
|
|
102
111
|
var hotkeyStatus = '', hotkeyReported = '';
|
|
@@ -116,8 +125,8 @@ function run(argv) {
|
|
|
116
125
|
function watchKeys() {
|
|
117
126
|
if (monitor) return;
|
|
118
127
|
monitor = $.NSEvent.addLocalMonitorForEventsMatchingMaskHandler($.NSEventMaskSystemDefined, function (e) {
|
|
119
|
-
// A press
|
|
120
|
-
if (e.subtype === 6 && hotkeyRef && Number(e.data1) === hotkeyRef && !menuOpen &&
|
|
128
|
+
// A press made before the menu closed meant "close", not "open again"; any later press opens it at once.
|
|
129
|
+
if (e.subtype === 6 && hotkeyRef && Number(e.data1) === hotkeyRef && !menuOpen && Number(e.timestamp) > closedAt) openMenu();
|
|
121
130
|
return e;
|
|
122
131
|
});
|
|
123
132
|
}
|
|
@@ -286,22 +295,27 @@ function run(argv) {
|
|
|
286
295
|
var HEAD_X = 15, HEAD_TEXT_X = 34;
|
|
287
296
|
|
|
288
297
|
// A quota window as a small rounded bar: a soft track, filled as far as it is used, coloured by level.
|
|
289
|
-
|
|
298
|
+
// Drawn once per fill and colour and kept until light or dark mode changes, so a refresh draws none again.
|
|
299
|
+
var BAR_W = 44, BAR_H = 5, bars = {}, barsDark = null;
|
|
290
300
|
function bar(b, old) {
|
|
301
|
+
var d = dark(), fill = stale() || old ? 'old' : BAR[b.level] || BAR.ok, pct = Math.max(0, Math.min(100, b.percent));
|
|
302
|
+
if (d !== barsDark) { bars = {}; barsDark = d; }
|
|
303
|
+
var key = pct + fill;
|
|
304
|
+
if (bars[key]) return bars[key];
|
|
291
305
|
var img = $.NSImage.alloc.initWithSize($.NSMakeSize(BAR_W, BAR_H));
|
|
292
306
|
img.lockFocus;
|
|
293
|
-
hex(
|
|
307
|
+
hex(d ? '#1f2c3a' : '#e4edf4').set;
|
|
294
308
|
$.NSBezierPath.bezierPathWithRoundedRectXRadiusYRadius($.NSMakeRect(0, 0, BAR_W, BAR_H), BAR_H / 2, BAR_H / 2).fill;
|
|
295
|
-
if (
|
|
296
|
-
(
|
|
297
|
-
var w = Math.max(BAR_H, BAR_W *
|
|
309
|
+
if (pct > 0) {
|
|
310
|
+
(fill === 'old' ? $.NSColor.tertiaryLabelColor : hex(fill)).set;
|
|
311
|
+
var w = Math.max(BAR_H, BAR_W * pct / 100);
|
|
298
312
|
$.NSBezierPath.bezierPathWithRoundedRectXRadiusYRadius($.NSMakeRect(0, 0, w, BAR_H), BAR_H / 2, BAR_H / 2).fill;
|
|
299
313
|
}
|
|
300
314
|
img.unlockFocus;
|
|
301
315
|
var att = $.NSTextAttachment.alloc.init;
|
|
302
316
|
att.image = img;
|
|
303
317
|
att.bounds = $.NSMakeRect(0, 1.5, BAR_W, BAR_H);
|
|
304
|
-
return $.NSAttributedString.attributedStringWithAttachment(att);
|
|
318
|
+
return (bars[key] = $.NSAttributedString.attributedStringWithAttachment(att));
|
|
305
319
|
}
|
|
306
320
|
|
|
307
321
|
// Columns: the name, then per window its bar and percent, then the reset time. One set of tab stops lines them up
|
|
@@ -501,13 +515,16 @@ function run(argv) {
|
|
|
501
515
|
'menuWillOpen:': { types: ['void', ['id']], implementation: function () { menuOpen = true; try { unregisterHotkey(); } catch (e) {} } },
|
|
502
516
|
'menuDidClose:': {
|
|
503
517
|
types: ['void', ['id']],
|
|
504
|
-
implementation: function () { menuOpen = false; closedAt = now(); try { registerHotkey(); } catch (e) {} },
|
|
518
|
+
implementation: function () { menuOpen = false; closedAt = uptime(); lastUse = now(); try { registerHotkey(); } catch (e) {} },
|
|
505
519
|
},
|
|
506
520
|
'closeMenu:': { types: ['void', ['id']], implementation: function () {} },
|
|
507
521
|
'tick:': {
|
|
508
522
|
types: ['void', ['id']],
|
|
509
523
|
implementation: function () {
|
|
510
524
|
actions = actions.filter(function (t) { return t.running; });
|
|
525
|
+
// After RESTART_HOURS, while nothing is open, running or just used, it ends with a failure code so launchd
|
|
526
|
+
// starts it again at once (it restarts only after a failed exit): the icon is gone for about a second.
|
|
527
|
+
if (now() - started > ${RESTART_HOURS} * 3600 && !menuOpen && !task && !actions.length && now() - lastUse > 60) $.exit(75);
|
|
511
528
|
if (task && task.running && now() - lastStart > TIMEOUT) task.terminate;
|
|
512
529
|
if (task && !task.running) finishSnapshot();
|
|
513
530
|
lookAtIcon();
|
package/package.json
CHANGED
package/skills/sideby/SKILL.md
CHANGED
|
@@ -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.31.
|
|
5
|
+
version: "0.31.1"
|
|
6
6
|
requires:
|
|
7
7
|
bins: [sideby, node]
|
|
8
8
|
cliHelp: sideby --help
|