sideby 0.35.9 → 0.36.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/cli/commands.d.ts +12 -0
- package/dist/src/cli/commands.js +489 -6
- package/dist/src/cli/format.d.ts +12 -1
- package/dist/src/cli/format.js +23 -3
- package/dist/src/cli/json-schemas.js +166 -1
- package/dist/src/cli/main.js +18 -4
- package/dist/src/core/advisor.d.ts +187 -0
- package/dist/src/core/advisor.js +519 -0
- package/dist/src/core/browser-profiles.d.ts +16 -0
- package/dist/src/core/browser-profiles.js +45 -0
- package/dist/src/core/claude-settings-file.d.ts +14 -0
- package/dist/src/core/claude-settings-file.js +62 -23
- package/dist/src/core/cli-commands.js +25 -1
- package/dist/src/core/config.d.ts +29 -0
- package/dist/src/core/config.js +25 -0
- package/dist/src/core/handoff-select.d.ts +13 -2
- package/dist/src/core/handoff-select.js +6 -2
- package/dist/src/core/launch.d.ts +4 -0
- package/dist/src/core/launch.js +7 -0
- package/dist/src/core/limit-reset.d.ts +198 -0
- package/dist/src/core/limit-reset.js +299 -0
- package/dist/src/core/quota-fetch.d.ts +57 -2
- package/dist/src/core/quota-fetch.js +291 -13
- package/dist/src/core/quota-levels.d.ts +70 -0
- package/dist/src/core/quota-levels.js +80 -0
- package/dist/src/core/quota-store.d.ts +15 -1
- package/dist/src/core/quota-store.js +26 -1
- package/dist/src/core/same-login.d.ts +8 -0
- package/dist/src/core/same-login.js +39 -2
- package/dist/src/core/search-catalog.js +38 -0
- package/dist/src/families/claude/index.js +2 -0
- package/dist/src/families/codex/index.js +3 -1
- package/dist/src/families/codex/quota.d.ts +23 -1
- package/dist/src/families/codex/quota.js +122 -21
- package/dist/src/families/grok/quota-log.d.ts +1 -0
- package/dist/src/menubar/script.js +70 -18
- package/dist/src/menubar/snapshot.d.ts +33 -1
- package/dist/src/menubar/snapshot.js +79 -11
- package/dist/src/menubar/strings.d.ts +16 -0
- package/dist/src/menubar/strings.js +16 -0
- package/dist/src/panel/handler.d.ts +21 -0
- package/dist/src/panel/handler.js +134 -12
- package/dist/src/panel/i18n.d.ts +87 -0
- package/dist/src/panel/i18n.js +174 -0
- package/dist/src/panel/page-logic.d.ts +17 -0
- package/dist/src/panel/page-logic.js +23 -0
- package/dist/src/panel/page-script.js +442 -19
- package/dist/src/panel/page-styles.js +38 -2
- package/dist/src/plugins/loader.d.ts +2 -0
- package/dist/src/plugins/loader.js +27 -0
- package/dist/src/runtime.d.ts +65 -1
- package/dist/src/runtime.js +530 -9
- package/dist/src/types.d.ts +67 -0
- package/package.json +1 -1
- package/schemas/advisor.json +332 -0
- package/schemas/config.json +22 -0
- package/schemas/error.json +4 -0
- package/schemas/menubar-reset.json +93 -0
- package/schemas/menubar-snapshot.json +70 -2
- package/schemas/quota-reset.json +369 -0
- package/schemas/quota.json +30 -0
- package/schemas/update.json +4 -0
- package/skills/sideby/SKILL.md +6 -2
- package/skills/sideby/references/ai-tasks.md +1 -1
- package/skills/sideby/references/panel.md +14 -0
- package/skills/sideby/references/quota.md +27 -0
- package/skills/sideby/references/update.md +1 -1
|
@@ -230,8 +230,44 @@ code, .mono { font-family: var(--mono); font-size: 12px; }
|
|
|
230
230
|
.ai-ask:hover { border-color: var(--btn-hover-border); color: var(--accent); }
|
|
231
231
|
.ai-ask .ic { width: 14px; height: 14px; color: var(--muted); flex: none; }
|
|
232
232
|
.arrange-text .link-btn { margin-left: 8px; }
|
|
233
|
-
|
|
234
|
-
.q-
|
|
233
|
+
/* Under the bars: how old the numbers are (once that matters) and the Limit Resets the account holds. One that
|
|
234
|
+
appears after the first paint fades in once (.q-new), so it does not snap. */
|
|
235
|
+
.q-foot { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 2px 12px; color: var(--muted); font-size: 11px; }
|
|
236
|
+
.q-asof, .q-resets { display: inline-flex; align-items: center; gap: 4px; }
|
|
237
|
+
.q-asof .ic, .q-resets .ic { width: 11px; height: 11px; }
|
|
238
|
+
.q-reset-btn { height: 22px; padding: 0 8px; gap: 4px; font-size: 11px; }
|
|
239
|
+
.q-reset-btn .ic, .q-reset-btn .spin { width: 11px; height: 11px; }
|
|
240
|
+
/* While a reset is being used or the quota is asked after the vendor's page: the old bars stay and breathe. */
|
|
241
|
+
.quota.is-resetting .bar > span, .rs-win.is-busy .bar > span { animation: rs-wait 1.2s var(--ease-out) infinite alternate; }
|
|
242
|
+
@keyframes rs-wait { from { opacity: 1; } to { opacity: .45; } }
|
|
243
|
+
/* The Limit Reset dialog: every step fills the same slots, so it opens at its final size and never jumps. */
|
|
244
|
+
.rs-body { gap: 12px; }
|
|
245
|
+
.rs-acct { font-size: 13px; }
|
|
246
|
+
.rs-peers { margin-top: 2px; color: var(--muted); font-size: 12px; }
|
|
247
|
+
.rs-wins { display: flex; flex-direction: column; gap: 10px; transition: opacity var(--duration-base) var(--ease-out); }
|
|
248
|
+
.rs-wins.is-reading { opacity: .6; }
|
|
249
|
+
.rs-win { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: baseline; column-gap: 12px; font-size: 13px; }
|
|
250
|
+
.rs-win-name { font-weight: 600; }
|
|
251
|
+
.rs-win-pct { font-variant-numeric: tabular-nums; font-weight: 600; }
|
|
252
|
+
.rs-win.lvl-warn .rs-win-pct { color: var(--warn); } .rs-win.lvl-fail .rs-win-pct { color: var(--fail); }
|
|
253
|
+
.rs-win-reset { color: var(--muted); font-size: 12px; min-width: 132px; text-align: right; }
|
|
254
|
+
.rs-win .bar { grid-column: 1 / -1; }
|
|
255
|
+
.rs-stock { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; min-height: 18px; }
|
|
256
|
+
.rs-stock .ic { width: 12px; height: 12px; flex: none; }
|
|
257
|
+
.rs-stock .spin { margin-right: 4px; }
|
|
258
|
+
.rs-slot { min-height: 76px; display: flex; }
|
|
259
|
+
.rs-msg { margin: 0; flex: 1; align-items: flex-start; line-height: 1.5; }
|
|
260
|
+
.rs-msg .spin { margin-top: 3px; }
|
|
261
|
+
.note-ok { background: var(--ok-soft, var(--surface-2)); color: var(--ok, var(--text)); }
|
|
262
|
+
.rs-pick { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
|
|
263
|
+
.rs-pick-btn { width: 100%; display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-md, 8px); background: var(--surface); color: var(--text); font: inherit; text-align: left; cursor: pointer; transition: border-color var(--duration-fast) var(--ease-out), background var(--duration-fast) var(--ease-out); }
|
|
264
|
+
.rs-pick-btn:hover { border-color: var(--btn-hover-border); background: var(--surface-2); }
|
|
265
|
+
.rs-pick-btn:focus-visible { outline: var(--focus-outline); outline-offset: 2px; }
|
|
266
|
+
.rs-pick-main { flex: 1; min-width: 0; }
|
|
267
|
+
.rs-pick-sub { display: block; color: var(--muted); font-size: 12px; }
|
|
268
|
+
.rs-pick-go { width: 14px; height: 14px; color: var(--muted); flex: none; }
|
|
269
|
+
.q-new { animation: chip-in var(--duration-base) var(--ease-out); }
|
|
270
|
+
@media (prefers-reduced-motion: reduce) { .q-new, .quota.is-resetting .bar > span, .rs-win.is-busy .bar > span { animation: none; } .rs-wins, .rs-pick-btn { transition: none; } }
|
|
235
271
|
.stat-act { align-self: flex-end; color: var(--accent); font-size: 12px; white-space: nowrap; }
|
|
236
272
|
.next-why { margin: 0 0 12px; max-width: 280px; line-height: 1.5; }
|
|
237
273
|
.next-cmd { display: block; margin-top: 8px; color: var(--muted); font-size: 11px; }
|
|
@@ -56,6 +56,8 @@ export declare const MAX_LOGO_PATH = 20000;
|
|
|
56
56
|
export declare function logoProblem(logo: unknown): string | null;
|
|
57
57
|
/** Why a Family website is unusable, or null when it is fine. */
|
|
58
58
|
export declare function websiteProblem(website: unknown): string | null;
|
|
59
|
+
/** Why a Family's `limitReset` is unusable (ADR-0072), or null when it is fine. */
|
|
60
|
+
export declare function limitResetProblem(limitReset: unknown): string | null;
|
|
59
61
|
export declare function loadPlugins(opts: {
|
|
60
62
|
builtins: BuiltinPlugin[];
|
|
61
63
|
config: Config;
|
|
@@ -112,6 +112,23 @@ export function websiteProblem(website) {
|
|
|
112
112
|
return 'website.match.signInId must be a function';
|
|
113
113
|
return null;
|
|
114
114
|
}
|
|
115
|
+
/** Why a Family's `limitReset` is unusable (ADR-0072), or null when it is fine. */
|
|
116
|
+
export function limitResetProblem(limitReset) {
|
|
117
|
+
if (typeof limitReset !== 'object' || limitReset === null || Array.isArray(limitReset))
|
|
118
|
+
return 'limitReset must be an object';
|
|
119
|
+
const { use, vendorPage } = limitReset;
|
|
120
|
+
if (use === undefined && vendorPage === undefined)
|
|
121
|
+
return 'limitReset needs use, vendorPage or both';
|
|
122
|
+
if (use !== undefined && typeof use !== 'function')
|
|
123
|
+
return 'limitReset.use must be a function';
|
|
124
|
+
if (vendorPage !== undefined && (typeof vendorPage !== 'string' || !WEBSITE_URL_RE.test(vendorPage)))
|
|
125
|
+
return 'limitReset.vendorPage must be an https address such as https://example.com/usage, with no query or fragment';
|
|
126
|
+
return null;
|
|
127
|
+
}
|
|
128
|
+
/** Only the known `limitReset` fields. */
|
|
129
|
+
function cleanLimitReset(r) {
|
|
130
|
+
return { ...(r.use ? { use: r.use } : {}), ...(r.vendorPage ? { vendorPage: r.vendorPage } : {}) };
|
|
131
|
+
}
|
|
115
132
|
/** Only the known website fields. */
|
|
116
133
|
function cleanWebsite(website) {
|
|
117
134
|
return {
|
|
@@ -202,6 +219,16 @@ async function register(plugin, bus, result, source, settings) {
|
|
|
202
219
|
else
|
|
203
220
|
clean = { ...clean, website: cleanWebsite(def.website) };
|
|
204
221
|
}
|
|
222
|
+
if (def.limitReset !== undefined) {
|
|
223
|
+
const problem = limitResetProblem(def.limitReset);
|
|
224
|
+
if (problem) {
|
|
225
|
+
stagedErrors.push(`family ${def.id}: ${problem}; it offers no Limit Reset until this is fixed`);
|
|
226
|
+
const { limitReset: _dropped, ...rest } = clean;
|
|
227
|
+
clean = rest;
|
|
228
|
+
}
|
|
229
|
+
else
|
|
230
|
+
clean = { ...clean, limitReset: cleanLimitReset(def.limitReset) };
|
|
231
|
+
}
|
|
205
232
|
if (def.history !== undefined) {
|
|
206
233
|
const h = def.history;
|
|
207
234
|
const need = ['list', 'parse', 'messages', 'resumeArgs'].filter((k) => typeof h?.[k] !== 'function');
|
package/dist/src/runtime.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type AccountRefError } from './core/accounts.ts';
|
|
2
|
+
import { type AdvisorChange, type AdvisorChoice, type AdvisorSeen, type AdvisorStatus } from './core/advisor.ts';
|
|
2
3
|
import { type Config, type DisplayConfig, type HandoffSettings } from './core/config.ts';
|
|
3
4
|
import { type CreateResult } from './core/create.ts';
|
|
4
5
|
import { type DesktopDeps } from './core/desktop-app.ts';
|
|
@@ -9,6 +10,7 @@ import { type HandoffPlan } from './core/handoff.ts';
|
|
|
9
10
|
import { type HandoffDecision, type UsedAccount } from './core/handoff-select.ts';
|
|
10
11
|
import { type DoctorHistory } from './core/last-doctor.ts';
|
|
11
12
|
import { type HostLaunch, type PreparedLaunch } from './core/launch.ts';
|
|
13
|
+
import { type LimitResetPlan, type LimitResetResult } from './core/limit-reset.ts';
|
|
12
14
|
import { type NetworkOverview } from './core/network.ts';
|
|
13
15
|
import { type Paths } from './core/paths.ts';
|
|
14
16
|
import { type PickChoice } from './core/pick-commands.ts';
|
|
@@ -332,9 +334,42 @@ export interface Runtime {
|
|
|
332
334
|
}): Promise<QuotaResult>;
|
|
333
335
|
/**
|
|
334
336
|
* Asks every Family that fetches Quota (spec §3.26) again now, for `only` or every signed-in subscription Account,
|
|
335
|
-
* and waits for the answers. Fetching that is turned off stays off.
|
|
337
|
+
* and waits for the answers; a Same Login among them is asked once. Fetching that is turned off stays off.
|
|
336
338
|
*/
|
|
337
339
|
refreshQuota(only?: readonly Account[]): Promise<void>;
|
|
340
|
+
/**
|
|
341
|
+
* The Account whose Host sideby asks for `account`'s Quota (spec §3.26): itself, or, in a Same Login, its first
|
|
342
|
+
* Account that is signed in and has no Expired Login, since the group is one vendor Quota and is asked once.
|
|
343
|
+
*/
|
|
344
|
+
quotaAsker(account: Account): Promise<Account>;
|
|
345
|
+
/**
|
|
346
|
+
* What `account` offers for a Limit Reset (spec §3.40, ADR-0072): `use` when its Host can spend one after a
|
|
347
|
+
* confirmation, `page` with the vendor's page when a Limit Reset is spent only there, null for neither (an API
|
|
348
|
+
* Account included).
|
|
349
|
+
*/
|
|
350
|
+
limitResetKind(account: Account): {
|
|
351
|
+
kind: 'use';
|
|
352
|
+
} | {
|
|
353
|
+
kind: 'page';
|
|
354
|
+
url: string;
|
|
355
|
+
} | null;
|
|
356
|
+
/**
|
|
357
|
+
* What the user confirms before one Limit Reset of `account` is spent: the Quota and the count, read from the Host
|
|
358
|
+
* now, the Accounts of its Same Login and the operation to confirm. Spends nothing. Throws a `LimitResetError`
|
|
359
|
+
* when the Account's Host cannot spend one.
|
|
360
|
+
*/
|
|
361
|
+
limitResetPlan(account: Account): Promise<LimitResetPlan>;
|
|
362
|
+
/**
|
|
363
|
+
* Spends one Limit Reset of `account` for the plan `operationId` names, which the user confirmed; it cannot be
|
|
364
|
+
* undone. One spend at a time per Same Login, across processes. An earlier attempt of that login without a final
|
|
365
|
+
* answer is asked again with its own key instead. Then the Quota is read at once. Throws a `LimitResetError` (with
|
|
366
|
+
* the `operationId` to retry) when the Host gave no final answer (`outcome-unknown`), or answered but the answer
|
|
367
|
+
* could not be recorded (`outcome-not-saved`; the message says what the Host answered). An operation that already
|
|
368
|
+
* has its answer says it again without a second request, reading the Quota when what is kept is from before the
|
|
369
|
+
* spend. Never called by sideby itself: not from Auto Handoff, `next`, a hook, a session under Unattended Mode, or
|
|
370
|
+
* in CI.
|
|
371
|
+
*/
|
|
372
|
+
limitResetUse(account: Account, operationId: string): Promise<LimitResetResult>;
|
|
338
373
|
/** Families that fetch Quota, with their switch (config `quota.check.<family>`) and why it is off, if it is. */
|
|
339
374
|
quotaChecks(): QuotaCheckInfo[];
|
|
340
375
|
/** Turns a Family's Quota fetching on (removes the key) or off (`quota.check.<family>: false`). */
|
|
@@ -384,6 +419,28 @@ export interface Runtime {
|
|
|
384
419
|
remoteControlOn(): Promise<RemoteControlChange>;
|
|
385
420
|
/** Puts back what `remoteControlOff` or `remoteControlOn` replaced, only where the key still holds what it wrote. */
|
|
386
421
|
remoteControlUndo(): Promise<RemoteControlChange>;
|
|
422
|
+
/**
|
|
423
|
+
* Claude Code's advisor (spec §3.41, ADR-0074): `advisorModel` of each Claude subscription Account's settings file,
|
|
424
|
+
* grouped by file, and whether sideby unlocks it at launch (config `advisor.unlock`).
|
|
425
|
+
*/
|
|
426
|
+
advisor(): Promise<AdvisorStatus>;
|
|
427
|
+
/**
|
|
428
|
+
* Sets `advisorModel` to `to` (`off` removes it) in every settings file that does not hold it yet, or only in the one
|
|
429
|
+
* `opts.account` uses, remembering how to undo it; a model also turns config `advisor.unlock` on. With `opts.seen`
|
|
430
|
+
* (the files as a preview showed them), a file that no longer looks like that is not written.
|
|
431
|
+
*/
|
|
432
|
+
advisorSet(to: AdvisorChoice, opts?: {
|
|
433
|
+
account?: string;
|
|
434
|
+
seen?: readonly AdvisorSeen[];
|
|
435
|
+
}): Promise<AdvisorChange>;
|
|
436
|
+
/** Puts back what `advisorSet` replaced, only where the key still holds what it wrote. */
|
|
437
|
+
advisorUndo(): Promise<AdvisorChange>;
|
|
438
|
+
/** Turns config `advisor.unlock` on or off. */
|
|
439
|
+
advisorUnlock(on: boolean): Promise<{
|
|
440
|
+
ok: boolean;
|
|
441
|
+
unlock: boolean;
|
|
442
|
+
message: string;
|
|
443
|
+
}>;
|
|
387
444
|
/**
|
|
388
445
|
* Which Account of a Family to move on to (spec §3.13), for a start the user asks for: past the Takeover Limit it
|
|
389
446
|
* falls back to the least used Account under 100% (`tight`). Throws a UserError with code `no-quota-source`
|
|
@@ -440,4 +497,11 @@ export declare function createRuntime(opts?: {
|
|
|
440
497
|
fetcher?: TraceFetcher;
|
|
441
498
|
print?: string;
|
|
442
499
|
};
|
|
500
|
+
/**
|
|
501
|
+
* Internal, for tests: how long a Limit Reset request may take before it counts as unanswered (spec §3.40), so a
|
|
502
|
+
* test of a Host that hangs need not wait the real time. Not part of the plugin or Portal contract.
|
|
503
|
+
*/
|
|
504
|
+
limitReset?: {
|
|
505
|
+
timeoutMs?: number;
|
|
506
|
+
};
|
|
443
507
|
}): Promise<Runtime>;
|