sideby 0.20.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.
- package/README.md +1 -0
- package/dist/build.json +1 -1
- package/dist/src/cli/commands.js +115 -10
- package/dist/src/cli/format.js +3 -2
- package/dist/src/cli/json-schemas.js +81 -46
- package/dist/src/cli/main.js +6 -3
- package/dist/src/core/accounts.d.ts +6 -1
- package/dist/src/core/accounts.js +16 -3
- package/dist/src/core/ask.d.ts +2 -1
- package/dist/src/core/ask.js +6 -3
- package/dist/src/core/claude-settings-file.d.ts +57 -0
- package/dist/src/core/claude-settings-file.js +104 -2
- package/dist/src/core/config.d.ts +29 -15
- package/dist/src/core/config.js +40 -2
- package/dist/src/core/create.js +4 -1
- package/dist/src/core/desktop-app.js +5 -1
- package/dist/src/core/handoff-overview.d.ts +4 -1
- package/dist/src/core/handoff-overview.js +3 -2
- package/dist/src/core/handoff-rules.d.ts +34 -0
- package/dist/src/core/handoff-rules.js +115 -0
- package/dist/src/core/handoff-select.js +45 -28
- package/dist/src/core/handoff-status.d.ts +37 -7
- package/dist/src/core/handoff-status.js +95 -19
- package/dist/src/core/handoff.d.ts +4 -1
- package/dist/src/core/handoff.js +8 -5
- package/dist/src/core/inbound.d.ts +11 -3
- package/dist/src/core/inbound.js +26 -74
- package/dist/src/core/launch.js +6 -4
- package/dist/src/core/quota-levels.d.ts +6 -0
- package/dist/src/core/quota-levels.js +8 -0
- package/dist/src/core/remote-control.d.ts +10 -12
- package/dist/src/core/remote-control.js +29 -86
- package/dist/src/core/tuning-apply.js +12 -20
- package/dist/src/families/agy/index.d.ts +8 -0
- package/dist/src/families/agy/index.js +53 -0
- package/dist/src/families/agy/quota.d.ts +9 -0
- package/dist/src/families/agy/quota.js +110 -0
- package/dist/src/families/index.js +7 -0
- package/dist/src/families/logos.d.ts +10 -0
- package/dist/src/families/logos.js +12 -1
- package/dist/src/menubar/script.js +26 -3
- package/dist/src/menubar/snapshot.d.ts +23 -6
- package/dist/src/menubar/snapshot.js +126 -39
- package/dist/src/menubar/strings.d.ts +12 -2
- package/dist/src/menubar/strings.js +12 -2
- package/dist/src/panel/handler.d.ts +2 -1
- package/dist/src/panel/handler.js +81 -45
- package/dist/src/panel/i18n.d.ts +58 -7
- package/dist/src/panel/i18n.js +158 -56
- package/dist/src/panel/page-logic.d.ts +52 -19
- package/dist/src/panel/page-logic.js +47 -7
- package/dist/src/panel/page-script.js +333 -115
- package/dist/src/panel/page-styles.js +112 -21
- package/dist/src/panel/page.js +3 -3
- package/dist/src/plugins/check.js +27 -13
- package/dist/src/plugins/loader.d.ts +11 -0
- package/dist/src/plugins/loader.js +47 -1
- package/dist/src/runtime.d.ts +5 -2
- package/dist/src/runtime.js +12 -5
- package/dist/src/types.d.ts +35 -5
- package/package.json +2 -2
- package/schemas/config.json +16 -1
- package/schemas/families.json +8 -5
- package/schemas/handoff-disable.json +22 -0
- package/schemas/handoff-enable.json +22 -0
- package/schemas/handoff-rules.json +302 -0
- package/schemas/handoff-status.json +26 -0
- package/schemas/list.json +5 -0
- package/schemas/menubar-snapshot.json +309 -2
- package/skills/sideby/SKILL.md +3 -2
- package/skills/sideby/references/accounts.md +1 -0
- package/skills/sideby/references/handoff.md +7 -3
- package/skills/sideby/references/quota.md +2 -0
|
@@ -1,60 +1,40 @@
|
|
|
1
|
-
|
|
2
|
-
// Claude Account's `settings.json`. Accounts that share a file (a link to the Main Account's) form one group and one
|
|
3
|
-
// write. Nothing but that key is ever read out of the file into an output, an error or the undo record; writes go
|
|
4
|
-
// through `writeIfUnchanged`, keep every other key, and never create, replace or retarget a link.
|
|
5
|
-
import { rm } from 'node:fs/promises';
|
|
6
|
-
import { keyRecordPath, readKeyRecord, readObject, settingsFileGroups, writeKeyRecord, writeSettingsKey, } from './claude-settings-file.js';
|
|
1
|
+
import { readSettingsGroups, settingsKey } from './claude-settings-file.js';
|
|
7
2
|
export const RC_KEY = 'remoteControlAtStartup';
|
|
8
|
-
|
|
3
|
+
// Records from before `on` existed lack `wrote` and mean `false`.
|
|
4
|
+
const rc = settingsKey(RC_KEY, 'remote-control', { legacyWrote: false });
|
|
9
5
|
function stateOf(v) {
|
|
10
6
|
return v === true ? 'on' : v === false ? 'off' : 'default';
|
|
11
7
|
}
|
|
12
|
-
const RECORDS = 'remote-control';
|
|
13
|
-
const recordPath = (ctx, file) => keyRecordPath(ctx.stateDir, RECORDS, file);
|
|
14
|
-
async function readRecord(ctx, file) {
|
|
15
|
-
const r = await readKeyRecord(ctx.stateDir, RECORDS, file);
|
|
16
|
-
return r && (r.previous === null || typeof r.previous === 'boolean')
|
|
17
|
-
? r
|
|
18
|
-
: null;
|
|
19
|
-
}
|
|
20
8
|
/** Every Claude Account's setting, grouped by the file it lives in. Writes nothing. */
|
|
21
9
|
export async function remoteControlGroups(accounts, ctx) {
|
|
22
10
|
const out = [];
|
|
23
|
-
for (const
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}
|
|
40
|
-
else {
|
|
41
|
-
group.state = stateOf(read.obj[RC_KEY]);
|
|
42
|
-
const record = await readRecord(ctx, where.file);
|
|
43
|
-
group.undo = record !== null && read.obj[RC_KEY] === (record.wrote ?? false);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
11
|
+
for (const g of await readSettingsGroups(accounts)) {
|
|
12
|
+
if ('why' in g)
|
|
13
|
+
out.push({
|
|
14
|
+
file: g.file,
|
|
15
|
+
accounts: g.accounts,
|
|
16
|
+
state: g.why === 'no-settings' ? 'missing' : 'blocked',
|
|
17
|
+
why: g.why,
|
|
18
|
+
reason: g.reason,
|
|
19
|
+
undo: false,
|
|
20
|
+
});
|
|
21
|
+
else
|
|
22
|
+
out.push({
|
|
23
|
+
file: g.file,
|
|
24
|
+
accounts: g.accounts,
|
|
25
|
+
state: stateOf(g.obj[RC_KEY]),
|
|
26
|
+
undo: await rc.undoable(ctx.stateDir, g.file, g.obj),
|
|
27
|
+
});
|
|
46
28
|
}
|
|
47
29
|
return out;
|
|
48
30
|
}
|
|
49
|
-
/**
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
return groups.filter((g) => g.state === 'off' || g.state === 'default');
|
|
31
|
+
/**
|
|
32
|
+
* The groups `on` or `off` would change: those that do not hold that side yet, a default counting as either. Self-
|
|
33
|
+
* contained, so the Panel page runs this same function (page-script.ts).
|
|
34
|
+
*/
|
|
35
|
+
export function remoteControlTodo(groups, to) {
|
|
36
|
+
return groups.filter((g) => g.state === 'default' || g.state === (to === 'on' ? 'off' : 'on'));
|
|
56
37
|
}
|
|
57
|
-
const writeKey = writeSettingsKey;
|
|
58
38
|
/** What `on`, `off` or `undo` says when no file needs it: always `ok: false`, so the CLI exits 1. */
|
|
59
39
|
export function remoteControlNothingToDo(action, groups) {
|
|
60
40
|
if (action === 'undo')
|
|
@@ -78,30 +58,10 @@ export function remoteControlNothingToDo(action, groups) {
|
|
|
78
58
|
*/
|
|
79
59
|
export async function setRemoteControl(accounts, ctx, to) {
|
|
80
60
|
const groups = await remoteControlGroups(accounts, ctx);
|
|
81
|
-
const todo = to ?
|
|
61
|
+
const todo = remoteControlTodo(groups, to ? 'on' : 'off');
|
|
82
62
|
if (todo.length === 0)
|
|
83
63
|
return remoteControlNothingToDo(to ? 'on' : 'off', groups);
|
|
84
|
-
const results =
|
|
85
|
-
for (const g of todo) {
|
|
86
|
-
let previous = null;
|
|
87
|
-
const failed = await writeKey(g.file, (obj) => {
|
|
88
|
-
previous = typeof obj[RC_KEY] === 'boolean' ? obj[RC_KEY] : null;
|
|
89
|
-
obj[RC_KEY] = to;
|
|
90
|
-
return obj;
|
|
91
|
-
}, (obj) => (obj[RC_KEY] === to ? `It was turned ${to ? 'on' : 'off'} meanwhile; nothing changed.` : null));
|
|
92
|
-
if (failed) {
|
|
93
|
-
results.push({ file: g.file, accounts: g.accounts, ok: false, message: failed });
|
|
94
|
-
continue;
|
|
95
|
-
}
|
|
96
|
-
const record = {
|
|
97
|
-
file: g.file,
|
|
98
|
-
previous,
|
|
99
|
-
wrote: to,
|
|
100
|
-
at: new Date().toISOString(),
|
|
101
|
-
};
|
|
102
|
-
await writeKeyRecord(ctx.stateDir, RECORDS, g.file, record);
|
|
103
|
-
results.push({ file: g.file, accounts: g.accounts, ok: true, message: to ? 'Turned on.' : 'Turned off.' });
|
|
104
|
-
}
|
|
64
|
+
const results = await rc.set(ctx.stateDir, todo, to, (v) => (v === to ? `It was turned ${to ? 'on' : 'off'} meanwhile; nothing changed.` : null), to ? 'Turned on.' : 'Turned off.');
|
|
105
65
|
const ok = results.every((r) => r.ok);
|
|
106
66
|
return {
|
|
107
67
|
ok,
|
|
@@ -126,24 +86,7 @@ export async function undoRemoteControlOff(accounts, ctx) {
|
|
|
126
86
|
const todo = groupsToUndo(await remoteControlGroups(accounts, ctx));
|
|
127
87
|
if (todo.length === 0)
|
|
128
88
|
return remoteControlNothingToDo('undo', []);
|
|
129
|
-
const results =
|
|
130
|
-
for (const g of todo) {
|
|
131
|
-
const record = await readRecord(ctx, g.file);
|
|
132
|
-
if (!record)
|
|
133
|
-
continue;
|
|
134
|
-
const failed = await writeKey(g.file, (obj) => {
|
|
135
|
-
if (record.previous === null)
|
|
136
|
-
delete obj[RC_KEY];
|
|
137
|
-
else
|
|
138
|
-
obj[RC_KEY] = record.previous;
|
|
139
|
-
return obj;
|
|
140
|
-
}, (obj) => obj[RC_KEY] === (record.wrote ?? false)
|
|
141
|
-
? null
|
|
142
|
-
: 'The setting was changed after sideby set it, so it was left alone.');
|
|
143
|
-
if (!failed)
|
|
144
|
-
await rm(recordPath(ctx, g.file), { force: true });
|
|
145
|
-
results.push({ file: g.file, accounts: g.accounts, ok: !failed, message: failed ?? 'Put back.' });
|
|
146
|
-
}
|
|
89
|
+
const results = await rc.undo(ctx.stateDir, todo);
|
|
147
90
|
const ok = results.length > 0 && results.every((r) => r.ok);
|
|
148
91
|
return {
|
|
149
92
|
ok,
|
|
@@ -3,11 +3,10 @@
|
|
|
3
3
|
// error or the undo record, and the write goes through `writeIfUnchanged`. A symlinked `settings.json` (settings
|
|
4
4
|
// shared with the Main Account) is written at the real file it points to, and the plan names every Account that
|
|
5
5
|
// shares it; a link is never created, replaced or retargeted.
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { isObj, locate, readObject, render } from './claude-settings-file.js';
|
|
6
|
+
import { rm, stat } from 'node:fs/promises';
|
|
7
|
+
import { isObj, keyRecordPath, locate, readKeyRecord, readObject, render, writeKeyRecord, } from './claude-settings-file.js';
|
|
9
8
|
import { UserError } from './errors.js';
|
|
10
|
-
import { fileHash, sha256,
|
|
9
|
+
import { fileHash, sha256, writeIfUnchanged } from './fs-safe.js';
|
|
11
10
|
import { MAX_COMPACT_WINDOW, MIN_COMPACT_WINDOW } from './tuning.js';
|
|
12
11
|
export const TUNE_KEY = 'autoCompactWindow';
|
|
13
12
|
export const MIN_WINDOW = MIN_COMPACT_WINDOW;
|
|
@@ -31,21 +30,15 @@ function overridesOf(obj) {
|
|
|
31
30
|
}
|
|
32
31
|
return out;
|
|
33
32
|
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
33
|
+
const RECORDS = 'tune';
|
|
34
|
+
const recordPath = (ctx, file) => keyRecordPath(ctx.stateDir, RECORDS, file);
|
|
37
35
|
async function readRecord(ctx, file) {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}
|
|
45
|
-
catch {
|
|
46
|
-
// no record
|
|
47
|
-
}
|
|
48
|
-
return null;
|
|
36
|
+
const r = await readKeyRecord(ctx.stateDir, RECORDS, file);
|
|
37
|
+
return r &&
|
|
38
|
+
(r.applied === null || typeof r.applied === 'number') &&
|
|
39
|
+
(r.previous === null || typeof r.previous === 'number')
|
|
40
|
+
? r
|
|
41
|
+
: null;
|
|
49
42
|
}
|
|
50
43
|
/** What applying `value` to the Account would do. Writes nothing. */
|
|
51
44
|
export async function planTuneApply(account, value, accounts) {
|
|
@@ -136,8 +129,7 @@ export async function applyTune(account, value, accounts, ctx) {
|
|
|
136
129
|
created: chained ? earlier.created : plan.creates,
|
|
137
130
|
at: new Date().toISOString(),
|
|
138
131
|
};
|
|
139
|
-
await
|
|
140
|
-
await writeFileAtomic(recordPath(ctx, plan.file), `${JSON.stringify(record, null, 2)}\n`, 0o600);
|
|
132
|
+
await writeKeyRecord(ctx.stateDir, RECORDS, plan.file, record);
|
|
141
133
|
return {
|
|
142
134
|
ok: true,
|
|
143
135
|
plan,
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { FamilyDef, Plugin } from '../../types.ts';
|
|
2
|
+
/**
|
|
3
|
+
* Antigravity CLI, a Main-only Family (ADR-0047): agy keeps its data under `$HOME/.gemini/antigravity-cli` and its
|
|
4
|
+
* Google sign-in in one fixed system keychain entry, with no variable that moves either (tried with agy 1.4.4 on
|
|
5
|
+
* 2026-10-21), so sideby knows only its Main Account.
|
|
6
|
+
*/
|
|
7
|
+
export declare const agyFamily: FamilyDef;
|
|
8
|
+
export declare const agyPlugin: Plugin;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { BUILTIN_LOGOS } from '../logos.js';
|
|
2
|
+
import { agyQuotaFetch } from './quota.js';
|
|
3
|
+
/** Lets agy run without asking before each tool call; an AI Task must keep those checks (ADR-0031). */
|
|
4
|
+
const SKIP_PERMISSIONS = '--dangerously-skip-permissions';
|
|
5
|
+
/**
|
|
6
|
+
* Antigravity CLI, a Main-only Family (ADR-0047): agy keeps its data under `$HOME/.gemini/antigravity-cli` and its
|
|
7
|
+
* Google sign-in in one fixed system keychain entry, with no variable that moves either (tried with agy 1.4.4 on
|
|
8
|
+
* 2026-10-21), so sideby knows only its Main Account.
|
|
9
|
+
*/
|
|
10
|
+
export const agyFamily = {
|
|
11
|
+
id: 'agy',
|
|
12
|
+
title: 'Antigravity CLI',
|
|
13
|
+
logo: BUILTIN_LOGOS.agy,
|
|
14
|
+
bin: 'agy',
|
|
15
|
+
installUrl: 'https://antigravity.google/docs/getting-started?tab=cli',
|
|
16
|
+
installCommand: 'curl -fsSL https://antigravity.google/cli/install.sh | bash',
|
|
17
|
+
mainOnly: true,
|
|
18
|
+
layout: { main: '.gemini/antigravity-cli' },
|
|
19
|
+
// Variables that would sign agy in with a key or route it elsewhere instead of the Google sign-in. Kept:
|
|
20
|
+
// GOOGLE_CLOUD_PROJECT (other tools use it too) and AGY_ACCOUNT (picks a connected sandbox account, not the login).
|
|
21
|
+
hijackVars: [
|
|
22
|
+
'GEMINI_API_KEY',
|
|
23
|
+
'GOOGLE_API_KEY',
|
|
24
|
+
'AGY_ADC_AUTH',
|
|
25
|
+
'GOOGLE_GENAI_USE_VERTEXAI',
|
|
26
|
+
'GOOGLE_GENAI_USE_ENTERPRISE',
|
|
27
|
+
'ANTIGRAVITY_PROJECT_ID',
|
|
28
|
+
],
|
|
29
|
+
apiVars: [],
|
|
30
|
+
// `-p` is one non-interactive prompt (agy 1.4.4 --help, 2026-10-21).
|
|
31
|
+
probe: { args: ['-p', 'Reply with OK'] },
|
|
32
|
+
// agy reads a prompt only from -p, -i or stdin: "unexpected argument" otherwise (agy 1.4.4, 2026-10-21).
|
|
33
|
+
promptArg: '--prompt-interactive',
|
|
34
|
+
aiTaskArgs: (args) => args.includes(SKIP_PERMISSIONS) ? args.filter((a) => a !== SKIP_PERMISSIONS) : [...args],
|
|
35
|
+
sharedItems: [],
|
|
36
|
+
settingsFile: 'settings.json',
|
|
37
|
+
login: {
|
|
38
|
+
args: null,
|
|
39
|
+
hint: 'Start agy and sign in with your Google account in the browser; agy keeps one sign-in per computer',
|
|
40
|
+
},
|
|
41
|
+
// The sign-in lives in the system keychain, which sideby never reads: the state is unknown. A quota check that
|
|
42
|
+
// fails for want of a sign-in says so in the Quota column.
|
|
43
|
+
async loginState() {
|
|
44
|
+
return 'unknown';
|
|
45
|
+
},
|
|
46
|
+
fetchQuota: agyQuotaFetch,
|
|
47
|
+
};
|
|
48
|
+
export const agyPlugin = {
|
|
49
|
+
name: 'agy',
|
|
50
|
+
register(api) {
|
|
51
|
+
api.family(agyFamily);
|
|
52
|
+
},
|
|
53
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Account, QuotaFetch, QuotaFetchContext, QuotaResult } from '../../types.ts';
|
|
2
|
+
export declare const AGY_QUOTA_ARGS: readonly ['-p', '/usage', '--output-format', 'json'];
|
|
3
|
+
/**
|
|
4
|
+
* The Quota in agy's JSON answer: one window per bucket, named after its model group, since each limit covers only
|
|
5
|
+
* that group's models. Only group names, windows, percentages and reset times are kept.
|
|
6
|
+
*/
|
|
7
|
+
export declare function agyQuota(answer: unknown, observedAt: string): QuotaResult | null;
|
|
8
|
+
export declare function fetchAgyQuota(account: Account, ctx: QuotaFetchContext): Promise<QuotaResult>;
|
|
9
|
+
export declare const agyQuotaFetch: QuotaFetch;
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
// Asks Antigravity CLI for the Main Account's Quota (spec §3.26, ADR-0048): `agy -p /usage --output-format json` runs
|
|
2
|
+
// the `/usage` command with agy's own sign-in and starts no model turn (`num_turns` 0, every token count 0; tried with
|
|
3
|
+
// agy 1.4.4 on 2026-10-21). sideby never reads the sign-in and sends no request of its own.
|
|
4
|
+
import { spawn } from 'node:child_process';
|
|
5
|
+
import { tmpdir } from 'node:os';
|
|
6
|
+
export const AGY_QUOTA_ARGS = ['-p', '/usage', '--output-format', 'json'];
|
|
7
|
+
/** agy answers in about 6 s; anything far larger than its answer is not one. */
|
|
8
|
+
const MAX_OUTPUT = 256 * 1024;
|
|
9
|
+
const failed = (detail) => ({ status: 'unavailable', reason: 'fetch-failed', detail });
|
|
10
|
+
const WINDOWS = {
|
|
11
|
+
'5h': { label: '5h', minutes: 300 },
|
|
12
|
+
weekly: { label: '7d', minutes: 7 * 24 * 60 },
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* The Quota in agy's JSON answer: one window per bucket, named after its model group, since each limit covers only
|
|
16
|
+
* that group's models. Only group names, windows, percentages and reset times are kept.
|
|
17
|
+
*/
|
|
18
|
+
export function agyQuota(answer, observedAt) {
|
|
19
|
+
if (typeof answer !== 'object' || answer === null)
|
|
20
|
+
return null;
|
|
21
|
+
const a = answer;
|
|
22
|
+
if (a.status !== 'SUCCESS')
|
|
23
|
+
return null;
|
|
24
|
+
const groups = a.command?.data?.groups;
|
|
25
|
+
if (!Array.isArray(groups))
|
|
26
|
+
return null;
|
|
27
|
+
const windows = [];
|
|
28
|
+
for (const g of groups) {
|
|
29
|
+
const name = typeof g?.name === 'string' ? g.name.slice(0, 60) : undefined;
|
|
30
|
+
if (!name || !Array.isArray(g.buckets))
|
|
31
|
+
continue;
|
|
32
|
+
for (const b of g.buckets) {
|
|
33
|
+
const w = WINDOWS[b?.window];
|
|
34
|
+
const left = b?.remaining_fraction;
|
|
35
|
+
if (!w || typeof left !== 'number' || !Number.isFinite(left))
|
|
36
|
+
continue;
|
|
37
|
+
const resets = typeof b.reset_time === 'string' ? Date.parse(b.reset_time) : Number.NaN;
|
|
38
|
+
if (!Number.isFinite(resets))
|
|
39
|
+
continue;
|
|
40
|
+
windows.push({
|
|
41
|
+
label: w.label,
|
|
42
|
+
name,
|
|
43
|
+
windowMinutes: w.minutes,
|
|
44
|
+
usedPercent: Math.round(Math.min(1, Math.max(0, 1 - left)) * 100),
|
|
45
|
+
resetsAt: new Date(resets).toISOString(),
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return windows.length ? { status: 'ok', windows, observedAt, source: 'agy /usage' } : null;
|
|
50
|
+
}
|
|
51
|
+
/** Why agy's answer gave no Quota, and what to do. agy's own words are only matched, never repeated. */
|
|
52
|
+
function errorDetail(account, answer) {
|
|
53
|
+
const { status, error } = (answer ?? {});
|
|
54
|
+
if (status === 'SUCCESS')
|
|
55
|
+
return 'Antigravity CLI answered in a form sideby does not recognise; update sideby';
|
|
56
|
+
if (typeof error === 'string' && /auth/i.test(error))
|
|
57
|
+
return `Antigravity CLI is not signed in; run \`sideby login ${account.ref}\` and sign in with Google`;
|
|
58
|
+
return 'Antigravity CLI could not report the quota; sideby asks again later, or start agy once';
|
|
59
|
+
}
|
|
60
|
+
export async function fetchAgyQuota(account, ctx) {
|
|
61
|
+
if (ctx.signal.aborted)
|
|
62
|
+
return failed('the quota check was stopped');
|
|
63
|
+
const child = spawn('agy', [...AGY_QUOTA_ARGS], {
|
|
64
|
+
cwd: tmpdir(),
|
|
65
|
+
env: ctx.hostEnv,
|
|
66
|
+
// stderr holds a sign-in link when signed out: never read.
|
|
67
|
+
stdio: ['ignore', 'pipe', 'ignore'],
|
|
68
|
+
});
|
|
69
|
+
const stop = () => {
|
|
70
|
+
if (child.exitCode === null && child.signalCode === null)
|
|
71
|
+
child.kill('SIGTERM');
|
|
72
|
+
};
|
|
73
|
+
ctx.signal.addEventListener('abort', stop, { once: true });
|
|
74
|
+
try {
|
|
75
|
+
return await new Promise((resolve) => {
|
|
76
|
+
const chunks = [];
|
|
77
|
+
let size = 0;
|
|
78
|
+
child.stdout.on('data', (b) => {
|
|
79
|
+
size += b.length;
|
|
80
|
+
if (size > MAX_OUTPUT)
|
|
81
|
+
return stop();
|
|
82
|
+
chunks.push(b);
|
|
83
|
+
});
|
|
84
|
+
child.on('error', (err) => resolve(failed(err.code === 'ENOENT'
|
|
85
|
+
? 'Antigravity CLI is not installed or not on PATH; install it, then refresh'
|
|
86
|
+
: `could not start Antigravity CLI (${err.code ?? 'error'})`)));
|
|
87
|
+
child.on('close', () => {
|
|
88
|
+
if (ctx.signal.aborted)
|
|
89
|
+
return resolve(failed('the quota check was stopped'));
|
|
90
|
+
let answer;
|
|
91
|
+
try {
|
|
92
|
+
answer = JSON.parse(Buffer.concat(chunks).toString('utf8'));
|
|
93
|
+
}
|
|
94
|
+
catch {
|
|
95
|
+
return resolve(failed('Antigravity CLI exited without answering; sideby asks again later'));
|
|
96
|
+
}
|
|
97
|
+
resolve(agyQuota(answer, ctx.now.toISOString()) ?? failed(errorDetail(account, answer)));
|
|
98
|
+
});
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
finally {
|
|
102
|
+
ctx.signal.removeEventListener('abort', stop);
|
|
103
|
+
stop();
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
export const agyQuotaFetch = {
|
|
107
|
+
everyMinutes: 15,
|
|
108
|
+
summary: 'Antigravity CLI asks Google for its quota, at most every 15 minutes',
|
|
109
|
+
fetch: fetchAgyQuota,
|
|
110
|
+
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { packageVersion } from '../core/version.js';
|
|
2
2
|
import { accountScript } from '../plugins/account-script.js';
|
|
3
|
+
import { agyPlugin } from './agy/index.js';
|
|
3
4
|
import { claudePlugin } from './claude/index.js';
|
|
4
5
|
import { codexPlugin } from './codex/index.js';
|
|
5
6
|
import { grokPlugin } from './grok/index.js';
|
|
@@ -31,6 +32,12 @@ export const BUILTIN_PLUGINS = [
|
|
|
31
32
|
description: 'pi family (~/.pi/agent, PI_CODING_AGENT_DIR)',
|
|
32
33
|
defaultEnabled: true,
|
|
33
34
|
},
|
|
35
|
+
{
|
|
36
|
+
plugin: agyPlugin,
|
|
37
|
+
version: VERSION,
|
|
38
|
+
description: 'Antigravity CLI family (~/.gemini/antigravity-cli, main account only)',
|
|
39
|
+
defaultEnabled: true,
|
|
40
|
+
},
|
|
34
41
|
{
|
|
35
42
|
plugin: accountScript,
|
|
36
43
|
version: VERSION,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Built-in Family marks for the Panel (FamilyDef.logo): 24x24 single-path SVG icons, drawn inline because the page CSP
|
|
2
2
|
// allows no external images.
|
|
3
3
|
// Sources: Claude, OpenAI and pi from Simple Icons (CC0 1.0, https://simpleicons.org; OpenAI from v15.0.0, the last release
|
|
4
|
-
// that ships it; pi is the mark from https://pi.dev). Grok from LobeHub Icons (MIT, Copyright (c) 2023 LobeHub,
|
|
4
|
+
// that ships it; pi is the mark from https://pi.dev). Grok and Antigravity (v1.95.1) from LobeHub Icons (MIT, Copyright (c) 2023 LobeHub,
|
|
5
5
|
// https://github.com/lobehub/lobe-icons). The marks are trademarks of their owners and only identify each Host.
|
|
6
6
|
/** Logos of the built-in Families, by Family id; each Family sets its own as `logo`. */
|
|
7
7
|
export const BUILTIN_LOGOS = {
|
|
@@ -23,4 +23,15 @@ export const BUILTIN_LOGOS = {
|
|
|
23
23
|
title: 'pi',
|
|
24
24
|
path: 'M0 0v24h6v-6h6v-6H6V6h6v6h6V0Zm18 12v12h6V12Z',
|
|
25
25
|
},
|
|
26
|
+
agy: {
|
|
27
|
+
title: 'Antigravity',
|
|
28
|
+
// The mark is a blue base with green, yellow and red washing in from the top, as in LobeHub's colour version.
|
|
29
|
+
color: '#3186FF',
|
|
30
|
+
gradients: [
|
|
31
|
+
{ from: [4, 8], to: [10, 15], color: '#00B95C' },
|
|
32
|
+
{ from: [8, 2], to: [12, 8], color: '#FFE432' },
|
|
33
|
+
{ from: [18, 2], to: [14, 10], color: '#FC413D' },
|
|
34
|
+
],
|
|
35
|
+
path: 'M21.751 22.607c1.34 1.005 3.35.335 1.508-1.508C17.73 15.74 18.904 1 12.037 1 5.17 1 6.342 15.74.815 21.1c-2.01 2.009.167 2.511 1.507 1.506 5.192-3.517 4.857-9.714 9.715-9.714 4.857 0 4.522 6.197 9.714 9.715z',
|
|
36
|
+
},
|
|
26
37
|
};
|
|
@@ -267,10 +267,21 @@ function run(argv) {
|
|
|
267
267
|
// headers cannot be clicked, and macOS greys a template image on an item that cannot be clicked.
|
|
268
268
|
var rule = logo.fillRule ? ' fill-rule="' + logo.fillRule + '"' : '';
|
|
269
269
|
var fill = /^#[0-9a-f]{3,8}$/i.test(logo.color || '') ? logo.color : dark() ? '#f5f5f7' : '#1d1d1f';
|
|
270
|
-
|
|
270
|
+
// A multicoloured mark: the shape again per wash, each filled with a gradient that fades out. Only numbers and
|
|
271
|
+
// hex colours reach the markup.
|
|
272
|
+
var defs = '', washes = '';
|
|
273
|
+
(logo.gradients || []).forEach(function (g, i) {
|
|
274
|
+
var n = [g.from[0], g.from[1], g.to[0], g.to[1]].map(Number);
|
|
275
|
+
if (!n.every(isFinite) || !/^#[0-9a-f]{3,8}$/i.test(g.color || '')) return;
|
|
276
|
+
defs += '<linearGradient id="w' + i + '" gradientUnits="userSpaceOnUse" x1="' + n[0] + '" y1="' + n[1] + '" x2="' + n[2] + '" y2="' + n[3] + '"><stop offset="0" stop-color="' + g.color + '"/><stop offset="1" stop-color="' + g.color + '" stop-opacity="0"/></linearGradient>';
|
|
277
|
+
washes += '<path' + rule + ' fill="url(#w' + i + ')" d="' + logo.path + '"/>';
|
|
278
|
+
});
|
|
279
|
+
return svgImage('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="14" height="14">' + (defs ? '<defs>' + defs + '</defs>' : '') + '<path' + rule + ' fill="' + fill + '" d="' + logo.path + '"/>' + washes + '</svg>', 14, false);
|
|
271
280
|
}
|
|
272
281
|
|
|
273
282
|
var GUTTER = $.NSImage.alloc.initWithSize($.NSMakeSize(14, 14));
|
|
283
|
+
// Model group lines sit a little in from their account's name.
|
|
284
|
+
var GROUP_INDENT = '\u2003';
|
|
274
285
|
// Where a menu item draws its image and its title (macOS 26 and 27), for the header views that line up with them.
|
|
275
286
|
var HEAD_X = 15, HEAD_TEXT_X = 34;
|
|
276
287
|
|
|
@@ -308,7 +319,10 @@ function run(argv) {
|
|
|
308
319
|
sections.forEach(function (s) {
|
|
309
320
|
nameW = Math.max(nameW, width(s.title, L.head));
|
|
310
321
|
if (s.columns[0]) first = true;
|
|
311
|
-
s.rows.concat(s.more ? s.more.rows : []).forEach(function (r) {
|
|
322
|
+
s.rows.concat(s.more ? s.more.rows : []).forEach(function (r) {
|
|
323
|
+
nameW = Math.max(nameW, width(r.label, L.font));
|
|
324
|
+
(r.groups || []).forEach(function (g) { nameW = Math.max(nameW, width(GROUP_INDENT + g.label, L.font)); });
|
|
325
|
+
});
|
|
312
326
|
});
|
|
313
327
|
var pctW = width('100%', L.mono), x = Math.ceil(nameW) + 20, stops = [], at = [];
|
|
314
328
|
function tab(pos) { stops.push($.NSTextTab.alloc.initWithTextAlignmentLocationOptions($.NSTextAlignmentLeft, pos, $())); }
|
|
@@ -365,6 +379,15 @@ function run(argv) {
|
|
|
365
379
|
mi.attributedTitle = t;
|
|
366
380
|
}
|
|
367
381
|
}
|
|
382
|
+
// A Host that gives each model group its own limits: a line per group under the account, with that group's bars.
|
|
383
|
+
// Clicking one starts the same account.
|
|
384
|
+
(r.groups || []).forEach(function (g) {
|
|
385
|
+
refs.push(r.ref);
|
|
386
|
+
var gi = add(menu, g.label, 'start:', refs.length);
|
|
387
|
+
gi.attributedTitle = rowTitle({ label: GROUP_INDENT + g.label, bars: g.bars, reset: g.reset, stale: r.stale, note: g.reset }, L);
|
|
388
|
+
gi.image = GUTTER;
|
|
389
|
+
gi.toolTip = g.tip;
|
|
390
|
+
});
|
|
368
391
|
return mi;
|
|
369
392
|
}
|
|
370
393
|
// A tool's header: its mark, its name, and the window names over the bar columns. A view, not a title: macOS dims
|
|
@@ -375,7 +398,7 @@ function run(argv) {
|
|
|
375
398
|
line.appendAttributedString(str(s.title, attrs($.NSColor.labelColor, L.head, L.headPara)));
|
|
376
399
|
var cols = L.first ? s.columns : [s.columns[1]];
|
|
377
400
|
cols.forEach(function (c) { line.appendAttributedString(str('\t' + (c || ''), attrs($.NSColor.secondaryLabelColor, L.small, L.headPara))); });
|
|
378
|
-
if (s.rows.some(function (r) { return r.reset; }))
|
|
401
|
+
if (s.rows.some(function (r) { return r.reset || (r.groups || []).some(function (g) { return g.reset; }); }))
|
|
379
402
|
line.appendAttributedString(str('\t' + snap.labels.resetsHeader, attrs($.NSColor.secondaryLabelColor, L.small, L.headPara)));
|
|
380
403
|
var W = Math.max(280, L.width), H = 24;
|
|
381
404
|
var v = $.NSView.alloc.initWithFrame($.NSMakeRect(0, 0, W, H));
|
|
@@ -20,13 +20,23 @@ export interface MenubarRow {
|
|
|
20
20
|
observedAt: string | null;
|
|
21
21
|
/** An old or undated reading, or a failed quota query. */
|
|
22
22
|
stale: boolean;
|
|
23
|
-
/** Hover text: when each window
|
|
23
|
+
/** Hover text: when the numbers were read, each window's use and reset, and what a click does. */
|
|
24
24
|
tip: string;
|
|
25
25
|
/**
|
|
26
26
|
* The bars, in two columns: the shorter window, then the longer one. A Family with one window (such as `7d`) fills
|
|
27
27
|
* the second, so the long windows of all Families line up. Null when the row has no Quota to draw.
|
|
28
28
|
*/
|
|
29
29
|
bars: [MenubarBar | null, MenubarBar | null] | null;
|
|
30
|
+
/**
|
|
31
|
+
* A Host whose every limit covers one model group (Antigravity CLI): a line per group under the account, each with
|
|
32
|
+
* its own two bars, reset and hover text, while the account's own `bars` stay null. Null otherwise.
|
|
33
|
+
*/
|
|
34
|
+
groups: {
|
|
35
|
+
label: string;
|
|
36
|
+
bars: MenubarRow['bars'];
|
|
37
|
+
reset: string;
|
|
38
|
+
tip: string;
|
|
39
|
+
}[] | null;
|
|
30
40
|
/** How long until the fullest window resets, such as `4d 17h`; empty when nothing is used. */
|
|
31
41
|
reset: string;
|
|
32
42
|
/** A no-quota explanation, or an old-reading warning beside the bars. */
|
|
@@ -39,11 +49,7 @@ export interface MenubarSection {
|
|
|
39
49
|
* The Family's mark before its title, as the Panel draws it: in its brand `color` when it has one, else in the
|
|
40
50
|
* menu's text colour; null when the Family has no mark.
|
|
41
51
|
*/
|
|
42
|
-
logo:
|
|
43
|
-
path: string;
|
|
44
|
-
fillRule?: 'nonzero' | 'evenodd';
|
|
45
|
-
color?: string;
|
|
46
|
-
} | null;
|
|
52
|
+
logo: Pick<FamilyLogo, 'path' | 'fillRule' | 'color' | 'gradients'> | null;
|
|
47
53
|
/** The window names above the two bar columns, such as `5h` and `7d`; null where no row has that column. */
|
|
48
54
|
columns: [string | null, string | null];
|
|
49
55
|
/** The recommended account first, then the others in Display Order. */
|
|
@@ -109,6 +115,17 @@ export declare const DEFAULT_MENUBAR_HOTKEY = "opt+x";
|
|
|
109
115
|
export declare function menubarHotkey(value: string | undefined): MenubarHotkey | null;
|
|
110
116
|
/** `2h 5m`, `3d 4h` or `12m` until `at`; at least one minute. */
|
|
111
117
|
export declare function untilText(at: string, now: Date, s: MenubarStrings): string;
|
|
118
|
+
/**
|
|
119
|
+
* The model groups of a Quota whose every window covers one group (Antigravity CLI), in the order the Host lists them,
|
|
120
|
+
* as the Panel shows them: each with its own windows, so the menu draws a line per group with its `5h` and `7d` bars.
|
|
121
|
+
* Null when some window covers every model.
|
|
122
|
+
*/
|
|
123
|
+
export declare function quotaGroups(quota: QuotaResult): {
|
|
124
|
+
name: string;
|
|
125
|
+
quota: QuotaResult & {
|
|
126
|
+
status: 'ok';
|
|
127
|
+
};
|
|
128
|
+
}[] | null;
|
|
112
129
|
/**
|
|
113
130
|
* Each Family's number is the Quota Pressure of the account `sideby next` would pick, or, when every account is past
|
|
114
131
|
* the fail level, the lowest of theirs; the title shows the highest of these, so it turns red when some tool has
|