sideby 0.32.2 → 0.34.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 (60) hide show
  1. package/assets/brand/sai-painted-1024.png +0 -0
  2. package/assets/brand/sai-painted-128.png +0 -0
  3. package/assets/brand/sai-painted-256.png +0 -0
  4. package/assets/brand/sai-painted-64.png +0 -0
  5. package/dist/build.json +1 -1
  6. package/dist/src/cli/commands.js +76 -18
  7. package/dist/src/cli/format.js +3 -1
  8. package/dist/src/cli/json-schemas.js +34 -6
  9. package/dist/src/cli/main.js +12 -5
  10. package/dist/src/core/brand-mark.d.ts +18 -115
  11. package/dist/src/core/brand-mark.js +43 -174
  12. package/dist/src/core/live-sessions.d.ts +4 -0
  13. package/dist/src/core/live-sessions.js +17 -3
  14. package/dist/src/core/messages.d.ts +26 -5
  15. package/dist/src/core/messages.js +73 -16
  16. package/dist/src/core/quota-fetch.js +9 -2
  17. package/dist/src/core/session-status.d.ts +55 -0
  18. package/dist/src/core/session-status.js +59 -0
  19. package/dist/src/core/unattended-retry.d.ts +39 -0
  20. package/dist/src/core/unattended-retry.js +107 -0
  21. package/dist/src/core/unattended.d.ts +2 -2
  22. package/dist/src/core/unattended.js +10 -2
  23. package/dist/src/desktop/icon.d.ts +13 -1
  24. package/dist/src/desktop/icon.js +153 -285
  25. package/dist/src/families/claude/deliver.js +14 -2
  26. package/dist/src/families/claude/messaging.d.ts +14 -1
  27. package/dist/src/families/claude/messaging.js +24 -4
  28. package/dist/src/families/codex/deliver.d.ts +10 -1
  29. package/dist/src/families/codex/deliver.js +24 -2
  30. package/dist/src/families/messaging.d.ts +12 -1
  31. package/dist/src/handoff/messages.js +1 -1
  32. package/dist/src/menubar/script.d.ts +5 -0
  33. package/dist/src/menubar/script.js +111 -25
  34. package/dist/src/menubar/snapshot.d.ts +25 -5
  35. package/dist/src/menubar/snapshot.js +114 -26
  36. package/dist/src/menubar/strings.d.ts +22 -6
  37. package/dist/src/menubar/strings.js +22 -6
  38. package/dist/src/panel/handler.d.ts +2 -2
  39. package/dist/src/panel/handler.js +8 -2
  40. package/dist/src/panel/i18n.d.ts +11 -0
  41. package/dist/src/panel/i18n.js +35 -13
  42. package/dist/src/panel/page-logic.d.ts +41 -4
  43. package/dist/src/panel/page-logic.js +145 -10
  44. package/dist/src/panel/page-script.js +50 -11
  45. package/dist/src/panel/page-styles.js +5 -5
  46. package/dist/src/panel/page.js +2 -2
  47. package/dist/src/panel/theme.d.ts +4 -1
  48. package/dist/src/runtime.d.ts +3 -1
  49. package/dist/src/runtime.js +1 -1
  50. package/dist/src/unattended/hook.d.ts +4 -0
  51. package/dist/src/unattended/hook.js +86 -2
  52. package/package.json +2 -1
  53. package/schemas/menubar-snapshot.json +102 -2
  54. package/schemas/messages.json +6 -2
  55. package/schemas/send.json +6 -2
  56. package/schemas/sessions.json +22 -1
  57. package/skills/sideby/SKILL.md +1 -1
  58. package/skills/sideby/references/panel.md +1 -1
  59. package/skills/sideby/references/sessions.md +7 -4
  60. package/skills/sideby/references/unattended.md +4 -2
Binary file
Binary file
Binary file
package/dist/build.json CHANGED
@@ -1 +1 @@
1
- {"id":"20261030T183500-1af3ae"}
1
+ {"id":"20261101T024154-fb1cda"}
@@ -19,13 +19,15 @@ import { installHint, runHost } from '../core/launch.js';
19
19
  import { loginAfterLine, loginBeforeLine } from '../core/login-check.js';
20
20
  import { accountModel, setAccountModel } from '../core/model-choice.js';
21
21
  import { resolvePaths, tildify } from '../core/paths.js';
22
+ import { quotaCheckOff } from '../core/quota-fetch.js';
22
23
  import { takeoverLimits, USAGE_DAYS } from '../core/quota-levels.js';
24
+ import { quotaStoreFile, readQuotaStore } from '../core/quota-store.js';
23
25
  import { groupsToUndo, remoteControlNothingToDo, remoteControlTodo, } from '../core/remote-control.js';
24
26
  import { SEARCH_CATALOG, searchCatalog } from '../core/search-catalog.js';
25
27
  import { SHELLS } from '../core/shell-init.js';
26
28
  import { clockText, daysText } from '../core/unattended-state.js';
27
29
  import { MODEL_NAME } from '../families/shared/model-args.js';
28
- import { AI_TASK_KINDS, hiddenIn, inDisplayOrder, pinnedIn, suggestAlias, suggestName, withPinned, } from '../panel/page-logic.js';
30
+ import { AI_TASK_KINDS, hiddenIn, inDisplayOrder, pinnedIn, resetWhen, suggestAlias, suggestName, withPinned, } from '../panel/page-logic.js';
29
31
  import { createRuntime, UnknownFamilyError } from '../runtime.js';
30
32
  import { UsageError } from './args.js';
31
33
  import { c, clock, compactNumber, quotaText, table, truncate, tuningLines, usageText } from './format.js';
@@ -576,7 +578,7 @@ async function runPick(rt, name, args, io, opts = {}) {
576
578
  if (choice.ref === null) {
577
579
  const now = rt.readContext().now;
578
580
  const why = choice.earliestReset
579
- ? `every signed-in ${family} account has used up its quota; ${choice.earliestReset.ref} is back at ${clock(choice.earliestReset.at, now)}`
581
+ ? `every signed-in ${family} account has used up its quota; ${choice.earliestReset.ref} is back ${resetWhen(choice.earliestReset.at, now.getTime(), 'en')}`
580
582
  : `no ${family} account can be used now`;
581
583
  const signIn = choice.signIn.length
582
584
  ? `; sign in with \`sideby login ${choice.signIn.join('` or `sideby login ')}\``
@@ -650,10 +652,10 @@ export async function cmdNext(a, io) {
650
652
  return includeApi ? 'API account, pay per use' : 'left out; add --include-api to use it';
651
653
  if (low(e)) {
652
654
  const over = `past its limit: ${closest(e)} (limits ${limits.short}% for 5-hour, ${limits.long}% for weekly windows)`;
653
- return e.resetsAt ? `${over} until ${clock(e.resetsAt, now)}` : over;
655
+ return e.resetsAt ? `${over}; resets ${resetWhen(e.resetsAt, now.getTime(), 'en')}` : over;
654
656
  }
655
657
  if (e.state === 'full')
656
- return e.resetsAt ? `used up; back at ${clock(e.resetsAt, now)}` : 'used up';
658
+ return e.resetsAt ? `used up; back ${resetWhen(e.resetsAt, now.getTime(), 'en')}` : 'used up';
657
659
  return `signed out; sign in with \`sideby login ${e.ref}\``;
658
660
  };
659
661
  const mark = { ready: c.green, unknown: c.yellow, api: c.cyan, full: c.red, 'logged-out': c.dim };
@@ -669,7 +671,7 @@ export async function cmdNext(a, io) {
669
671
  const out = plan.accounts.filter((e) => e.state === 'logged-out').map((e) => `sideby login ${e.ref}`);
670
672
  const apiLeft = !includeApi && plan.accounts.some((e) => e.state === 'api');
671
673
  const why = plan.earliestReset
672
- ? `every signed-in ${family} account has used up its quota; ${plan.earliestReset.ref} is back at ${clock(plan.earliestReset.at, now)}`
674
+ ? `every signed-in ${family} account has used up its quota; ${plan.earliestReset.ref} is back ${resetWhen(plan.earliestReset.at, now.getTime(), 'en')}`
673
675
  : `no ${family} account can be used now`;
674
676
  const same = plan.accounts.filter((e) => e.sameLoginAs).map((e) => e.ref);
675
677
  const sameNote = same.length ? `; ${same.join(', ')} share the quota of ${plan.from}` : '';
@@ -2649,8 +2651,12 @@ async function lastLocalUse(rt, list) {
2649
2651
  const newest = Math.max(...times.filter(Number.isFinite));
2650
2652
  return Number.isFinite(newest) ? new Date(newest).toISOString() : undefined;
2651
2653
  }
2652
- /** What the Menu Bar Item lists (spec §3.31): each Family's accounts in Display Order, with its Handoff ranking. */
2653
- async function menubarFamilies(rt) {
2654
+ /**
2655
+ * What the Menu Bar Item lists (spec §3.31): each Family's accounts in Display Order, with its Handoff ranking. `fetch`
2656
+ * `never` reads only the kept answers (the script's cache-only snapshots during a refresh). With `since` (when a manual
2657
+ * refresh started, ms), each account that refresh asks says whether its answer is still to come or failed.
2658
+ */
2659
+ async function menubarFamilies(rt, o = {}) {
2654
2660
  // Hidden Families and Accounts (spec §3.25) stay out of the menu and its percent; a Same Login is hidden whole.
2655
2661
  const display = rt.displayOrder();
2656
2662
  const every = displayOrdered(await rt.accounts(), rt);
@@ -2661,13 +2667,26 @@ async function menubarFamilies(rt) {
2661
2667
  const ids = [...new Set(accounts.map((x) => x.family))];
2662
2668
  return Promise.all(ids.map(async (id) => {
2663
2669
  const f = rt.families.get(id);
2664
- const plan = f.readQuota || f.fetchQuota ? await rt.handoff(id).catch(() => null) : null;
2670
+ const plan = f.readQuota || f.fetchQuota ? await rt.handoff(id, { fetch: o.fetch }).catch(() => null) : null;
2665
2671
  const now = rt.readContext().now.getTime();
2672
+ // Whether the refresh asks this Family at all: the same rule as `refreshQuota` and `ownQuota`.
2673
+ const asks = o.since !== undefined && Boolean(f.fetchQuota) && !quotaCheckOff(f.id, rt.config, rt.env);
2666
2674
  const list = await Promise.all(accounts
2667
2675
  .filter((x) => x.family === id)
2668
2676
  .map(async (x) => {
2669
- const quota = await rt.quota(x);
2677
+ const quota = await rt.quota(x, { fetch: o.fetch });
2670
2678
  const sameLogin = await rt.sameLogin(x);
2679
+ const login = x.kind === 'api' ? 'not-needed' : (await rt.status(x)).login;
2680
+ let refresh;
2681
+ if (asks && x.kind === 'subscription' && login !== 'logged-out') {
2682
+ const kept = await readQuotaStore(quotaStoreFile(rt.paths.stateDir, x.family, x.name));
2683
+ const attempted = kept ? Date.parse(kept.attemptedAt) : Number.NaN;
2684
+ // The refresh's own snapshot has nothing left waiting: an answer it could not keep counts as failed.
2685
+ if (!(attempted >= o.since))
2686
+ refresh = o.final ? 'failed' : 'waiting';
2687
+ else if (kept?.error)
2688
+ refresh = 'failed';
2689
+ }
2671
2690
  // Usage is read only for a reading over an hour old, to tell whether this computer used the login since.
2672
2691
  const old = quota.status === 'ok' && now - Date.parse(quota.observedAt) > 3600_000;
2673
2692
  const lastUseAt = old
@@ -2677,9 +2696,10 @@ async function menubarFamilies(rt) {
2677
2696
  ref: x.ref,
2678
2697
  name: x.name,
2679
2698
  kind: x.kind,
2680
- login: x.kind === 'api' ? 'not-needed' : (await rt.status(x)).login,
2699
+ login,
2681
2700
  quota,
2682
2701
  sameLogin,
2702
+ ...(refresh ? { refresh } : {}),
2683
2703
  ...(lastUseAt ? { lastUseAt } : {}),
2684
2704
  };
2685
2705
  }));
@@ -2703,10 +2723,15 @@ export async function cmdMenubar(a, io) {
2703
2723
  if (action === 'snapshot') {
2704
2724
  const reported = a.flags.get('hotkey');
2705
2725
  const icon = a.flags.get('icon');
2726
+ const sinceFlag = a.flags.get('refreshing-since');
2727
+ const since = sinceFlag === undefined ? undefined : Date.parse(sinceFlag);
2728
+ const cached = a.flags.has('cached');
2706
2729
  if (extra !== undefined ||
2730
+ (cached && a.flags.has('refresh')) ||
2731
+ (since !== undefined && (!cached || !Number.isFinite(since))) ||
2707
2732
  (reported !== undefined && reported !== 'ok' && reported !== 'taken') ||
2708
2733
  (icon !== undefined && icon !== 'visible' && icon !== 'hidden'))
2709
- throw new UsageError('usage: sideby menubar snapshot [--refresh] [--lang en|zh] [--hotkey ok|taken [--hotkey-label <label>]] [--icon visible|hidden] [--json]');
2734
+ throw new UsageError('usage: sideby menubar snapshot [--refresh | --cached [--refreshing-since <ISO time>]] [--lang en|zh] [--hotkey ok|taken [--hotkey-label <label>]] [--icon visible|hidden] [--json]');
2710
2735
  const { menubarHotkey, menubarLang, menubarSnapshot } = await import('../menubar/snapshot.js');
2711
2736
  const rt = await createRuntime();
2712
2737
  const hotkey = menubarHotkey(rt.config.menubar?.hotkey);
@@ -2732,9 +2757,15 @@ export async function cmdMenubar(a, io) {
2732
2757
  }).catch(() => { });
2733
2758
  }
2734
2759
  const lang = menubarLang(rt.config.panel?.language, a.flags.get('lang') ?? rt.env.LANG);
2735
- if (a.flags.has('refresh'))
2760
+ // A refresh asks every account now; its own snapshot then marks the ones whose answer failed. A cache-only snapshot
2761
+ // (`--cached`, which the menu bar script runs every 2 s during a refresh) never asks a Host.
2762
+ let refreshedSince;
2763
+ if (a.flags.has('refresh')) {
2764
+ refreshedSince = Date.now();
2736
2765
  await rt.refreshQuota();
2737
- const snap = menubarSnapshot(await menubarFamilies(rt), rt.readContext().now, lang, hotkey);
2766
+ }
2767
+ const families = await menubarFamilies(rt, cached ? { fetch: 'never', since } : { since: refreshedSince, final: true });
2768
+ const snap = menubarSnapshot(families, rt.readContext().now, lang, hotkey);
2738
2769
  if (wantJson)
2739
2770
  json(io, snap);
2740
2771
  else {
@@ -3026,6 +3057,17 @@ const SESSION_STATUS = {
3026
3057
  idle: 'idle',
3027
3058
  unknown: '—',
3028
3059
  };
3060
+ /** What the user does for a Session that needs them, when it is not the Host itself asking (spec §3.32 step 1). */
3061
+ const NEEDS_YOU_FOR = {
3062
+ 'pending-decision': 'a decision',
3063
+ 'message-to-approve': 'approve a message',
3064
+ 'message-to-paste': 'paste a message',
3065
+ };
3066
+ function sessionStatusText(s) {
3067
+ const why = s.reason ? NEEDS_YOU_FOR[s.reason] : undefined;
3068
+ const text = SESSION_STATUS[s.status] ?? SESSION_STATUS.unknown;
3069
+ return s.status === 'needs-you' ? c.yellow(why ? `${text}: ${why}` : text) : text;
3070
+ }
3029
3071
  /** The language of a copied Session Reference: `--lang`, else the user's locale. */
3030
3072
  function copyLang(a, env) {
3031
3073
  const flag = a.flags.get('lang');
@@ -3076,7 +3118,7 @@ export async function cmdSessions(a, io, runtime) {
3076
3118
  const anyRun = sessions.some((s) => s.run);
3077
3119
  const rows = sessions.map((s) => [
3078
3120
  c.bold(sessionLabel(s.accountLabel, truncate(s.title, 40), s.sessionId)),
3079
- s.status === 'needs-you' ? c.yellow(SESSION_STATUS[s.status]) : SESSION_STATUS[s.status],
3121
+ sessionStatusText(s),
3080
3122
  s.cwd ? tildify(s.cwd, home) : '',
3081
3123
  s.startedAt ? clock(s.startedAt, now) : '',
3082
3124
  ...(anyRun
@@ -3095,6 +3137,10 @@ export async function cmdSessions(a, io, runtime) {
3095
3137
  io.out(c.dim(`Run: ${title} ${tildify(board, home)}`));
3096
3138
  if (boards.size)
3097
3139
  io.out(c.dim('Open its run report: sideby sessions open-run <account|session-id>'));
3140
+ if (sessions.some((s) => s.reason === 'pending-decision'))
3141
+ io.out(c.dim('See the decisions waiting for you: sideby unattended pending'));
3142
+ if (sessions.some((s) => s.reason === 'message-to-paste' || s.reason === 'message-to-approve'))
3143
+ io.out(c.dim('See the messages waiting for you, with the line to paste: sideby messages'));
3098
3144
  io.out(c.dim('Copy one for another AI: sideby sessions copy <account|session-id>'));
3099
3145
  return 0;
3100
3146
  }
@@ -3537,6 +3583,12 @@ export async function cmdSend(a, io) {
3537
3583
  if (r.needsApproval)
3538
3584
  io.out(` To receive messages without approving each one: ${c.bold('sideby messages inbound accept')}`);
3539
3585
  }
3586
+ else if (r.status === 'unknown') {
3587
+ // Not copied: it may already be there, and a paste on top would deliver it twice (ADR-0065).
3588
+ io.out(`${c.yellow('●')} sideby could not confirm that ${c.bold(r.to)} got message ${r.id}`);
3589
+ // The note says why, and ends with the same advice.
3590
+ io.out(` ${r.note ?? UNCONFIRMED_ADVICE}`);
3591
+ }
3540
3592
  else {
3541
3593
  io.out(`${c.yellow('●')} kept message ${r.id} for ${c.bold(r.to)}; it needs a paste`);
3542
3594
  if (r.note)
@@ -3552,7 +3604,9 @@ const MESSAGE_STATUS = {
3552
3604
  delivered: 'delivered',
3553
3605
  read: 'read',
3554
3606
  'paste-needed': 'needs paste',
3607
+ unknown: 'Not confirmed',
3555
3608
  };
3609
+ const UNCONFIRMED_ADVICE = 'It may still show up: look at that session before you send it again.';
3556
3610
  /**
3557
3611
  * `sideby messages [--to <account|session>] [--limit <n>]`: the Messages sideby kept and how far each got;
3558
3612
  * `sideby messages inbound [accept|undo] [--yes]`: whether Claude sessions show them at once.
@@ -3586,7 +3640,7 @@ export async function cmdMessages(a, io, runtime) {
3586
3640
  const rows = list.map((m) => [
3587
3641
  clock(m.sentAt, now),
3588
3642
  c.bold(m.to),
3589
- m.status === 'paste-needed'
3643
+ m.status === 'paste-needed' || m.status === 'unknown'
3590
3644
  ? c.yellow(MESSAGE_STATUS[m.status])
3591
3645
  : m.needsApproval
3592
3646
  ? c.yellow('waits for approval')
@@ -3603,6 +3657,10 @@ export async function cmdMessages(a, io, runtime) {
3603
3657
  io.out(`${c.yellow('Paste this line into')} ${c.bold(m.to)}${m.note ? c.dim(` (${m.note})`) : ''}:`);
3604
3658
  io.out(` ${m.pasteText}`);
3605
3659
  }
3660
+ if (list.some((m) => m.status === 'unknown')) {
3661
+ io.out('');
3662
+ io.out(`${c.yellow('Some messages are not confirmed:')} sideby could not tell if they arrived. ${UNCONFIRMED_ADVICE}`);
3663
+ }
3606
3664
  if (list.some((m) => m.needsApproval)) {
3607
3665
  io.out('');
3608
3666
  io.out(`${c.yellow('Some messages wait for approval')} in the target's terminal and are dropped after about 5 minutes. To receive them directly: ${c.bold('sideby messages inbound accept')}`);
@@ -4009,12 +4067,12 @@ function unattendedLine(s, now) {
4009
4067
  const at = (iso) => clock2(iso, now);
4010
4068
  const slot = s.slot ? ` · Slot "${s.slot}"` : '';
4011
4069
  if (s.reason === 'slot' || s.reason === 'manual')
4012
- return `${c.green('on')}${s.reason === 'manual' ? ' · turned on by hand' : slot}${s.until ? ` · until ${at(s.until)}` : ' · no end: the Schedule covers every hour'}`;
4070
+ return `${c.green('on')}${s.until ? ` · until ${at(s.until)}` : ' · no end: the Schedule covers every hour'}${s.reason === 'manual' ? ' · turned on by hand' : slot}`;
4013
4071
  if (s.reason === 'session')
4014
4072
  return `${c.green('on')} for this session only (started with --unattended)`;
4015
4073
  if (s.reason === 'paused')
4016
- return `${c.yellow('paused')}${slot}${s.until ? ` · until ${at(s.until)}, then the Schedule goes on` : ' · until you turn it on (`sideby unattended on`)'}`;
4017
- return `${c.dim('off')}${s.next ? ` · next ${at(s.next.at)}${s.next.slot ? ` (${s.next.slot})` : ''}` : ''}`;
4074
+ return `${c.yellow('paused')}${s.until ? ` · back on at ${at(s.until)}` : ' · until you turn it on (`sideby unattended on`)'}${slot}`;
4075
+ return `${c.dim('off')}${s.next ? ` · turns on at ${at(s.next.at)}${s.next.slot ? ` (Slot "${s.next.slot}")` : ''}` : ''}`;
4018
4076
  }
4019
4077
  const clock2 = (iso, now) => clockText(Date.parse(iso), now.getTime());
4020
4078
  function printSchedule(io, schedule) {
@@ -1,5 +1,6 @@
1
1
  import { windowLevel } from '../core/quota-levels.js';
2
2
  import { MIN_CALLS } from '../core/tuning.js';
3
+ import { resetWhen } from '../panel/page-logic.js';
3
4
  const useColor = () => !process.env.NO_COLOR && Boolean(process.stdout.isTTY);
4
5
  const paint = (code) => (s) => (useColor() ? `\x1b[${code}m${s}\x1b[0m` : s);
5
6
  export const c = {
@@ -91,7 +92,8 @@ function windowText(w, now) {
91
92
  // Each window by its own levels: a weekly window warns at 85% and turns red at 95% (spec §3.26).
92
93
  const level = windowLevel({ ...w, usedPercent: pct });
93
94
  const color = level === 'fail' ? c.red : level === 'warn' ? c.yellow : c.green;
94
- return `${label} ${color(`${pct}%`)} ${c.dim(`→ ${clock(w.resetsAt, now)}`)}`;
95
+ // The same words as the menu bar and the Panel (spec §3.31): a countdown under a day, then tomorrow, a weekday, a date.
96
+ return `${label} ${color(`${pct}%`)} ${c.dim(`resets ${resetWhen(w.resetsAt, now.getTime(), 'en')}`)}`;
95
97
  }
96
98
  export const QUOTA_REASON = {
97
99
  'not-enabled': 'off',
@@ -400,9 +400,24 @@ const Overview = Type.Object({
400
400
  });
401
401
  const MenubarLevel = Type.Union(['ok', 'warn', 'fail', 'none'].map((k) => Type.Literal(k)));
402
402
  const MenubarBar = Type.Union([
403
- Type.Object({ label: Str, percent: Type.Number(), level: MenubarLevel }),
403
+ Type.Object({
404
+ label: Str,
405
+ percent: Type.Number(),
406
+ level: MenubarLevel,
407
+ passed: Type.Optional(Type.Literal(true, {
408
+ description: 'The window is past its reset time and no newer reading has come: drawn grey with `–`, its level `none`.',
409
+ })),
410
+ }),
404
411
  Type.Null(),
405
412
  ]);
413
+ const ResetParts = {
414
+ resetLabel: Type.String({
415
+ description: 'The window of `reset` as the column headers name it (`5h`, `7d`); empty when the cell names none.',
416
+ }),
417
+ resetTime: Type.String({
418
+ description: 'When it resets (`in 4h 20m`, `tomorrow 4:59 PM`, `Wed 4:59 PM`, `Nov 11, 4:59 PM`), or what the cell says instead: every window is past its reset, refreshing, or refresh failed.',
419
+ }),
420
+ };
406
421
  const MenubarRow = Type.Object({
407
422
  ref: Str,
408
423
  label: Str,
@@ -422,6 +437,7 @@ const MenubarRow = Type.Object({
422
437
  label: Str,
423
438
  bars: Type.Union([Type.Tuple([MenubarBar, MenubarBar]), Type.Null()]),
424
439
  reset: Str,
440
+ ...ResetParts,
425
441
  tip: Str,
426
442
  })),
427
443
  Type.Null(),
@@ -429,8 +445,15 @@ const MenubarRow = Type.Object({
429
445
  description: "A Host whose every limit covers one model group: a line per group under the account, each with its own bars; the account's `bars` are then null.",
430
446
  }),
431
447
  reset: Type.String({
432
- description: 'Which window resets and how long until it does, such as `7d · in 4d 17h`: the window closest to its own red level (85% for 5 hours, 95% for longer windows). Empty when nothing is used.',
448
+ description: 'Which window resets and when, such as `7d · tomorrow 4:59 PM`: the window closest to its own red level (85% for 5 hours, 95% for longer windows); `resetLabel` and `resetTime` joined. Empty when nothing is used.',
433
449
  }),
450
+ ...ResetParts,
451
+ refreshing: Type.Optional(Type.Literal(true, {
452
+ description: 'A manual refresh is asking the Host for this account and has no answer yet (`--refreshing-since`).',
453
+ })),
454
+ refreshFailed: Type.Optional(Type.Literal(true, {
455
+ description: 'This refresh asked the Host for this account and the answer failed.',
456
+ })),
434
457
  note: Type.String({
435
458
  description: 'A no-quota explanation, or an old-reading warning beside the bars.',
436
459
  }),
@@ -443,13 +466,15 @@ const MessageReceipt = Type.Object({
443
466
  toSessionId: Str,
444
467
  toAccount: Type.String({ description: 'The account ref that holds the target session.' }),
445
468
  from: Type.Optional(Type.String({ description: 'The Session Label of the session that sent it, when sideby could tell.' })),
446
- status: Type.Union(['stored', 'delivered', 'read', 'paste-needed'].map((k) => Type.Literal(k)), {
447
- description: "stored: kept as a file only; delivered: the host's own channel took it; read: it shows in the target's record; paste-needed: the user pastes pasteText into the target.",
469
+ status: Type.Union(['stored', 'delivered', 'read', 'paste-needed', 'unknown'].map((k) => Type.Literal(k)), {
470
+ description: "stored: kept as a file only; delivered: the host's own channel took it; read: it shows in the target's record; paste-needed: the user pastes pasteText into the target; unknown: the channel was given it but never confirmed it (ADR-0065), so it may still arrive: check the target before sending or pasting again. unknown becomes read when the id shows in the target's record and never changes by itself otherwise.",
448
471
  }),
449
472
  file: Type.String({ description: "The Message file (mode 600) in sideby's state folder." }),
450
473
  attachments: Type.Array(Str, { description: 'Screenshots copied next to the Message file.' }),
451
474
  pasteText: Type.String({ description: 'One line that tells the target AI to read the Message file.' }),
452
- note: Type.Optional(Type.String({ description: 'Why a paste is needed, or that the target must approve it (bypass mode).' })),
475
+ note: Type.Optional(Type.String({
476
+ description: 'Why a paste is needed, that the target must approve it (bypass mode), or why the delivery could not be confirmed.',
477
+ })),
453
478
  needsApproval: Type.Optional(Type.Boolean({
454
479
  description: 'true while a delivered Message waits for the user to approve it in the target terminal (ADR-0045); dropped once it is read, and after 6 minutes unread the status becomes paste-needed.',
455
480
  })),
@@ -977,8 +1002,11 @@ export const OUTPUT_SCHEMAS = {
977
1002
  description: 'The Session Label: `<accountLabel> · <title> · <first 8 of sessionId>`.',
978
1003
  }),
979
1004
  status: Type.Union(['needs-you', 'busy', 'idle', 'unknown'].map((k) => Type.Literal(k)), {
980
- description: '`needs-you`: it waits for the user (a permission or a question); `unknown` where the host does not say.',
1005
+ description: "`needs-you`: the user has to act on it (`reason` says why); `busy` and `idle` as the host says; `unknown` where the host does not say. The first matching row of spec §3.32 step 1's status table.",
981
1006
  }),
1007
+ reason: Type.Optional(Type.Union(['host-waits', 'pending-decision', 'message-to-approve', 'message-to-paste'].map((k) => Type.Literal(k)), {
1008
+ description: 'Only with `needs-you`: the host waits for a permission or an answer; an open Pending Decision names the session (`sideby unattended pending`); a Message to it waits for the user to approve it in its terminal; or a Message to it waits to be pasted (`sideby messages`). New values may be added.',
1009
+ })),
982
1010
  cwd: Type.Optional(Str),
983
1011
  pid: Type.Optional(Type.Integer({ description: 'The host process running it.' })),
984
1012
  startedAt: Type.Optional(Str),
@@ -178,19 +178,21 @@ yet: sideby copies one line to the clipboard ("Read the message sideby kept for
178
178
  tab to paste it into. A Claude session in bypass permission mode holds the message until you approve it in its
179
179
  terminal (about 5 minutes); \`sideby messages inbound accept\` makes it show them at once.
180
180
  Screenshots: PNG, JPEG, GIF or WebP, up to 20 MB each. Run it inside a session and the message names that session as
181
- the sender. --lang chooses the language of the line to paste (default: your locale).
181
+ the sender and ends with a Reply line the other AI can answer with. "Not confirmed" means sideby handed it over but
182
+ could not tell whether it arrived: look at that session before you send it again. --lang chooses the language of the line to paste (default: your locale).
182
183
 
183
184
  Examples:
184
185
  sideby send cc002 "the tests pass now, go ahead and release"
185
186
  sideby send 61230c3d "this is the error I see" --image ~/Desktop/shot.png
186
187
  sideby send codex:team "read the plan in docs/plan.md" --json
187
- Exit: 0 delivered or kept for pasting; 1 no such running session, several to choose from, or a screenshot sideby
188
+ Exit: 0 delivered, not confirmed, or kept for pasting; 1 no such running session, several to choose from, or a screenshot sideby
188
189
  refuses; 2 malformed command line.`,
189
190
  messages: `sideby messages [--to <account|session>] [--limit <n>] [--json]
190
191
  sideby messages inbound [accept|undo] [--yes] [--json]
191
192
 
192
193
  List the messages you sent with \`sideby send\`, newest first: to which session, and how far each got (delivered,
193
- read once it shows in the target's record, or needs paste).
194
+ read once it shows in the target's record, needs paste, or Not confirmed: it may still show up, so check the session
195
+ before you send it again).
194
196
 
195
197
  inbound shows, for each Claude account, its crossSessionInbound setting: accept shows a message from another session
196
198
  at once; hold, or no setting in a session in bypass permission mode, waits for you to approve it and drops it after
@@ -336,7 +338,9 @@ a Claude or Codex session sideby started is not allowed to ask a question: the m
336
338
  where it can be undone, and skips anything hard to undo (deleting, sending, publishing, deploying, paying). Each
337
339
  question it could not ask, and each thing it skipped (\`defer\`), is kept as a Pending Decision for when you are back.
338
340
  In Claude sessions, a permission prompt Claude Code is about to show (a command it wants a person to confirm, also in
339
- a subagent) is answered with "no" and how to do it without one, and kept as a Pending Decision too. Codex's own
341
+ a subagent) is answered with "no" and how to do it without one, and kept as a Pending Decision too. A Claude turn
342
+ that failed for a passing reason (an overloaded server, a dropped connection, a rate limit that is not a used-up
343
+ Quota) is started again after 1, 2, then 4 minutes; after three it is kept as a Pending Decision. Codex's own
340
344
  approval prompts are not covered.
341
345
 
342
346
  When it is on: during a Slot of the Schedule (local days and times; an end before the start is the next day), from
@@ -437,7 +441,10 @@ const COMMANDS = {
437
441
  key: { flags: ['json'], valued: ['var'] },
438
442
  try: { flags: ['json', 'yes'], valued: ['model'] },
439
443
  autostart: { flags: ['json', 'yes', 'refresh'] },
440
- menubar: { flags: ['json', 'yes', 'refresh'], valued: ['lang', 'hotkey', 'hotkey-label', 'icon'] },
444
+ menubar: {
445
+ flags: ['json', 'yes', 'refresh', 'cached'],
446
+ valued: ['lang', 'hotkey', 'hotkey-label', 'icon', 'refreshing-since'],
447
+ },
441
448
  config: { flags: ['json', 'yes'] },
442
449
  theme: { flags: ['json', 'yes', 'undo'], valued: ['id', 'out'] },
443
450
  list: { flags: ['json', 'all'] },
@@ -1,119 +1,22 @@
1
- /** A colour by name, or a fixed hex colour for a prop. */
2
- export type Paint = 'ink' | 'light' | `#${string}`;
3
- /** An outlined shape of one buddy, as SVG path data (absolute M, L, H, Q, C, Z) on its 64-unit grid. */
4
- export interface BuddyPath {
5
- d: string;
6
- /** `body`, `shade`: the buddy's own colours; `none`: an open line. */
7
- fill: 'body' | 'shade' | 'none' | Paint;
8
- /** Line colour; `none` draws no line. Default ink. */
9
- stroke?: Paint | 'none';
10
- /** Line width on the 64-unit grid, before the buddy's scale. Default: the outline width. */
11
- width?: number;
12
- }
13
- /** A filled ellipse without outline: the eyes and their highlights. */
14
- export interface BuddyDot {
15
- cx: number;
16
- cy: number;
17
- rx: number;
18
- ry: number;
19
- fill: 'ink' | 'light';
20
- }
21
- /** The body both buddies share, back to front: feet, arms, body; then the eyes. No forehead `>`: that belongs to Nika. */
22
- export declare const BUDDY: {
23
- paths: readonly BuddyPath[];
24
- eyes: readonly BuddyDot[];
25
- };
26
- /** What one buddy wears and how it smiles: `behind` the body, its `mouth`, and `above` the face. */
27
- export interface BuddyProps {
28
- behind: readonly BuddyPath[];
29
- mouth: BuddyPath;
30
- above: readonly BuddyPath[];
31
- }
32
- /** Sai (blue): a red cape behind the shoulders, a gold crown with a red jewel, a small smile. */
33
- export declare const SAI: BuddyProps;
34
- /** Bai (amber): a green spare battery on its back, a bent antenna with a ball, an open laugh. */
35
- export declare const BAI: BuddyProps;
36
- /** The eye highlights sit towards where the buddy looks: `1` right, `-1` left. */
37
- export declare function highlights(look: 1 | -1): BuddyDot[];
38
- export interface BuddyColors {
39
- body: string;
40
- shade: string;
41
- }
42
- export declare const MARK_COLORS: {
43
- readonly blue: {
44
- readonly body: '#3f8fc4';
45
- readonly shade: '#29658e';
46
- };
47
- readonly amber: {
48
- readonly body: '#f2b35e';
49
- readonly shade: '#c98a35';
50
- };
51
- readonly ink: '#1e2a44';
52
- readonly light: '#f6f0e5';
53
- };
54
- export interface PlacedBuddy {
55
- colors: BuddyColors;
56
- props: BuddyProps;
57
- /** Where the buddy looks (and which way its eye highlights sit). */
58
- look: 1 | -1;
59
- /** Mirror the props left to right, so what is worn on the back stays behind a buddy that turns the other way. */
60
- mirror?: boolean;
61
- /** 64-unit grid → mark units: translate by (x, y), then scale. */
62
- x: number;
63
- y: number;
64
- scale: number;
65
- }
66
- /** The two buddies in mark units, back first. The blue one in front is the one a Portal's `logoColor` recolours. */
67
- export declare const MARK: {
68
- line: number;
69
- placedLine: number;
70
- back: PlacedBuddy;
71
- front: PlacedBuddy;
72
- };
73
- /** The square the pair is drawn in, in mark units (the Panel's 40 px tile and the app icon tile). */
74
- export declare const MARK_VIEWBOX: {
75
- readonly x: -2.5;
76
- readonly y: 3;
77
- readonly size: 69;
78
- };
79
- /** Path data mirrored on the 64-unit grid (x → 64 − x); absolute M, L, H, Q, C, Z only. */
80
- export declare function mirrorPath(d: string): string;
81
- /** One shape of a placed buddy with its colours resolved; `fill` undefined inherits the surrounding fill. */
82
- export interface BuddyShape {
83
- d: string;
84
- fill: string | undefined;
85
- stroke: string;
86
- width?: number;
87
- }
88
- /**
89
- * One buddy's shapes, back to front: the props behind, the body, the mouth, the eyes, the props above.
90
- * `bodyFill`: `undefined` keeps the buddy's body colour, `null` leaves the body unfilled so it inherits.
91
- */
92
- export declare function buddyShapes(b: PlacedBuddy, bodyFill?: string | null): {
93
- paths: BuddyShape[];
94
- above: BuddyShape[];
95
- dots: BuddyDot[];
96
- };
97
- /** One placed buddy as SVG, drawn inside a group that sets the ink outline (`MARK_OUTLINE`). */
98
- export declare function buddySvg(b: PlacedBuddy, line: number, bodyFill?: string | null): string;
99
- export declare const MARK_OUTLINE: string;
100
- /**
101
- * The mark as SVG children (no outer <svg>). With `front` omitted the blue buddy's body has no fill of its own, so it
102
- * takes the surrounding `fill` (the Panel's `--logo-fg`, which Portals set with `logoColor`); everything else is fixed.
103
- */
104
- export declare function markSvgBody(front?: string): string;
105
- /** The Panel's header logo: the mark sized for its 40 px tile. */
106
- export declare const MARK_SVG: string;
107
- /** `<basePath>/icon.svg`: the whole mark on a transparent square, for a Portal's tab or menu (ADR-0006 amendment). */
1
+ /** The sizes painted, in pixels; `assets/brand/sai-painted-<size>.png`. */
2
+ export declare const MARK_SIZES: readonly [64, 128, 256, 1024];
3
+ export type MarkSize = (typeof MARK_SIZES)[number];
4
+ /** The painting at `size` as PNG bytes, from `assets/brand/` (two levels above src/, three above dist/src/). */
5
+ export declare function markPng(size: MarkSize): Buffer;
6
+ /** The painting at `size` as a `data:` URI. */
7
+ export declare const markDataUri: (size: MarkSize) => string;
8
+ /** The light tile behind the mark: the Panel's `--logo-bg` default and the app icon's tile. */
9
+ export declare const MARK_TILE = "#e5f2fb";
10
+ /** How much of its tile the painting fills on each side: 3 of 40 px in the Panel header. */
11
+ export declare const MARK_INSET: number;
12
+ /** The Panel's header logo: the painting for its 40 px tile (sharp at 3x). The page's CSP allows `data:` images. */
13
+ export declare const MARK_IMG: string;
14
+ /** `<basePath>/icon.svg`: the mark on a transparent square, for a Portal's tab or menu (ADR-0006 amendment). */
108
15
  export declare const ICON_SVG: string;
109
- /**
110
- * `<basePath>/favicon.svg`: the small cut for sizes below about 24 px, for a 16 pt browser tab (ADR-0022): Sai alone
111
- * on a 32 grid at half scale, his body, eyes, cape and crown; no feet, arms or mouth. The same cut as the tab icons
112
- * of the brand design sheet.
113
- */
16
+ /** `<basePath>/favicon.svg`: the same painting at the size a 16 to 32 px browser tab needs. */
114
17
  export declare const FAVICON_SVG: string;
115
18
  /**
116
- * The Menu Bar Item's icon (spec §3.31): the favicon's small cut of Sai in colour, 18 pt square. It keeps its colours
117
- * in light and dark mode, as the brand's tab icons do; the body's dark outline keeps it visible on both.
19
+ * The Menu Bar Item's icon (spec §3.31) and its card's, as base64 PNG: Sai in colour, drawn at 18 pt and 30 pt. It
20
+ * keeps its colours in light and dark mode; the painting's dark outline keeps it visible on both.
118
21
  */
119
- export declare const MENUBAR_ICON_SVG: string;
22
+ export declare const MENUBAR_ICON_PNG: string;