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
@@ -1,4 +1,5 @@
1
1
  import { bindingWindow, openWindows, quotaIsStale, windowLevel, worseLevel, } from '../core/quota-levels.js';
2
+ import { resetDate, resetWhen } from '../panel/page-logic.js';
2
3
  import { fill, MENUBAR_STRINGS } from './strings.js';
3
4
  export const DEFAULT_MENUBAR_HOTKEY = 'opt+x';
4
5
  // macOS virtual key codes of the ANSI letters and digits (HIToolbox Events.h, kVK_ANSI_*).
@@ -98,26 +99,46 @@ export function quotaGroups(quota) {
98
99
  function groupLabel(name) {
99
100
  return name.replace(/\s+models$/i, '') || name;
100
101
  }
102
+ /** A window by its length, as hover text spells it (`5-hour window`, `7天窗口`); its label when the length is odd. */
103
+ function windowName(w, s) {
104
+ const m = Number(w.windowMinutes);
105
+ if (m > 0 && m % 1440 === 0)
106
+ return fill(s.daysWindow, { n: m / 1440 });
107
+ if (m > 0 && m % 60 === 0)
108
+ return fill(s.hoursWindow, { n: m / 60 });
109
+ return w.label;
110
+ }
101
111
  /**
102
112
  * What a Quota whose windows cover every model draws: two bar columns (the shortest window, then the fullest of the
103
113
  * others, so a third window that is used up still shows; a single window fills the second), each colored by its own
104
114
  * levels (a weekly window warns later, spec §3.26), which window runs out first and when it resets, and one hover line
105
- * per window with its use and reset.
115
+ * per window with its use and reset. A window past its reset keeps its old bar in grey and counts toward no level;
116
+ * when every window is past its reset, the reset cell says so instead of a time.
106
117
  */
107
- function drawn(quota, now, s) {
118
+ function drawn(quota, now, s, lang) {
108
119
  const open = openWindows(quota, now) ?? [];
109
120
  const windows = quota.windows
110
121
  .filter((w) => !w.name)
111
122
  .sort((x, y) => (x.windowMinutes ?? 0) - (y.windowMinutes ?? 0));
112
123
  const openOf = (w) => open.find((o) => o.label === w.label);
113
124
  const bar = (w) => {
114
- const percent = Math.round(openOf(w)?.usedPercent ?? 0);
125
+ const o = openOf(w);
126
+ if (!o)
127
+ return {
128
+ label: w.label,
129
+ percent: Math.round(Math.min(100, Math.max(0, Number(w.usedPercent) || 0))),
130
+ level: 'none',
131
+ passed: true,
132
+ };
133
+ const percent = Math.round(o.usedPercent);
115
134
  return { label: w.label, percent, level: windowLevel({ ...w, usedPercent: percent }) };
116
135
  };
136
+ // An open window always beats one past its reset, whatever the old reading said.
137
+ const weight = (b) => (b.passed ? -1 : b.percent);
117
138
  const longer = windows
118
139
  .slice(1)
119
140
  .map(bar)
120
- .reduce((best, b) => (!best || b.percent > best.percent ? b : best), null);
141
+ .reduce((best, b) => (!best || weight(b) > weight(best) ? b : best), null);
121
142
  const bars = !windows.length
122
143
  ? null
123
144
  : longer
@@ -126,22 +147,40 @@ function drawn(quota, now, s) {
126
147
  // The window that runs out first relative to its own kind: a weekly 87% before a 5-hour 60%.
127
148
  const fullest = bindingWindow(open) ?? null;
128
149
  const level = open.reduce((l, w) => worseLevel(l, windowLevel(w)), 'ok');
129
- const resetTime = fullest && fullest.usedPercent > 0 ? untilText(fullest.resetsAt, now, s) : '';
130
- const reset = resetTime ? fill(s.resetIn, { label: fullest.label, time: resetTime }) : '';
150
+ const allPassed = windows.length > 0 && open.length === 0;
151
+ const shown = fullest && fullest.usedPercent > 0 ? fullest : null;
152
+ const resetLabel = shown ? shown.label : '';
153
+ const resetTime = shown ? resetWhen(shown.resetsAt, now.getTime(), lang) : allPassed ? s.resetDue : '';
154
+ const reset = resetLabel ? fill(s.resetIn, { label: resetLabel, time: resetTime }) : resetTime;
131
155
  const lines = windows.map((w) => {
132
156
  const o = openOf(w);
133
- const p = bar(w).percent;
134
- return o && p > 0
135
- ? fill(s.windowResetsTip, { label: w.label, p, time: untilText(o.resetsAt, now, s) })
136
- : fill(s.windowTip, { label: w.label, p });
157
+ const b = bar(w);
158
+ const label = windowName(w, s);
159
+ if (b.passed)
160
+ return fill(s.windowPassedTip, { label, date: resetDate(w.resetsAt, now.getTime(), lang) });
161
+ return o && b.percent > 0
162
+ ? fill(s.windowResetsTip, {
163
+ label,
164
+ p: b.percent,
165
+ date: resetDate(o.resetsAt, now.getTime(), lang),
166
+ left: untilText(o.resetsAt, now, s),
167
+ })
168
+ : fill(s.windowTip, { label, p: b.percent });
137
169
  });
138
170
  return {
139
171
  bars,
140
- fullest,
172
+ fullest: shown,
141
173
  level,
142
174
  reset,
175
+ resetLabel,
143
176
  resetTime,
144
- parts: windows.map((w) => fill(s.window, { label: w.label, p: bar(w).percent })),
177
+ allPassed,
178
+ parts: windows.map((w) => {
179
+ const b = bar(w);
180
+ return b.passed
181
+ ? fill(s.windowPassed, { label: w.label })
182
+ : fill(s.window, { label: w.label, p: b.percent });
183
+ }),
145
184
  lines,
146
185
  };
147
186
  }
@@ -155,7 +194,25 @@ function observedText(observedAt, now, s) {
155
194
  return s.observedJustNow;
156
195
  return fill(s.observedAgo, { time: durationText(minutes, s) });
157
196
  }
158
- function row(a, plan, now, s, refreshable) {
197
+ function row(a, plan, now, s, refreshable, lang) {
198
+ const r = quotaRow(a, plan, now, s, refreshable, lang);
199
+ if (!a.refresh)
200
+ return r;
201
+ // A manual refresh in progress (spec §3.31): the old bars stay, and the reset cell says where the refresh stands.
202
+ const says = a.refresh === 'waiting' ? s.rowRefreshing : s.rowRefreshFailed;
203
+ const flag = a.refresh === 'waiting' ? { refreshing: true } : { refreshFailed: true };
204
+ const cell = { reset: says, resetLabel: '', resetTime: says };
205
+ if (!r.bars && !r.groups)
206
+ return { ...r, ...flag, note: says, detail: says };
207
+ return {
208
+ ...r,
209
+ ...flag,
210
+ ...(r.bars ? cell : {}),
211
+ groups: r.groups?.map((g) => ({ ...g, ...cell })) ?? null,
212
+ detail: [r.detail, says].filter(Boolean).join(s.sep),
213
+ };
214
+ }
215
+ function quotaRow(a, plan, now, s, refreshable, lang) {
159
216
  const recommended = Boolean(plan?.hasQuota && plan.pick === a.ref);
160
217
  const startTip = fill(s.startTip, { account: a.ref });
161
218
  const base = {
@@ -166,6 +223,8 @@ function row(a, plan, now, s, refreshable) {
166
223
  bars: null,
167
224
  groups: null,
168
225
  reset: '',
226
+ resetLabel: '',
227
+ resetTime: '',
169
228
  observedAt: null,
170
229
  stale: false,
171
230
  };
@@ -187,13 +246,19 @@ function row(a, plan, now, s, refreshable) {
187
246
  ...(quiet ? [s.quietTip] : []),
188
247
  ...(quota.fetchError ? [fill(s.fetchFailed, { error: quota.fetchError })] : []),
189
248
  ];
249
+ // Every window is past its reset: Refresh asks now, where the Family can be asked.
250
+ const due = (d) => (d.allPassed && refreshable ? [s.resetDueTip] : []);
190
251
  const groups = quotaGroups(quota);
191
252
  if (groups) {
192
253
  // One line per model group under the account, each with its own 5h and 7d bars (spec §3.31). Windows that cover
193
254
  // every model (Cursor's plan total) keep their bars on the account's own line.
194
- const drawnGroups = groups.map((g) => ({ name: g.name, d: drawn(g.quota, now, s) }));
195
- const groupTip = (g) => [g.name, ...g.d.lines.map((l) => ` ${l}`)];
196
- const all = openWindows(quota, now) ? drawn(quota, now, s) : null;
255
+ const drawnGroups = groups.map((g) => ({ name: g.name, d: drawn(g.quota, now, s, lang) }));
256
+ const groupTip = (g) => [
257
+ g.name,
258
+ ...g.d.lines.map((l) => ` ${l}`),
259
+ ...due(g.d).map((l) => ` ${l}`),
260
+ ];
261
+ const all = openWindows(quota, now) ? drawn(quota, now, s, lang) : null;
197
262
  return {
198
263
  ...base,
199
264
  observedAt: quota.observedAt,
@@ -207,16 +272,25 @@ function row(a, plan, now, s, refreshable) {
207
272
  tip: [
208
273
  ...head,
209
274
  '',
210
- ...(all ? [...all.lines, ''] : []),
275
+ ...(all ? [...all.lines, ...due(all), ''] : []),
211
276
  ...drawnGroups.flatMap(groupTip),
212
277
  '',
213
278
  startTip,
214
279
  ].join('\n'),
215
- ...(all ? { bars: all.bars, reset: all.reset } : {}),
216
- groups: drawnGroups.map((g) => ({
280
+ ...(all
281
+ ? { bars: all.bars, reset: all.reset, resetLabel: all.resetLabel, resetTime: all.resetTime }
282
+ : {}),
283
+ // Under an account with its own plan-wide bars, a model group nobody has used yet (Claude's Fable at 0%) gets no
284
+ // line of its own: it would double the list with zeros. Its numbers stay in the hover text, and its line comes
285
+ // back once it is used or its window passes its reset. An account made only of groups keeps every line.
286
+ groups: drawnGroups
287
+ .filter((g) => !all || (g.d.bars ?? []).some((b) => b && (b.percent > 0 || b.passed)))
288
+ .map((g) => ({
217
289
  label: groupLabel(g.name),
218
290
  bars: g.d.bars,
219
291
  reset: g.d.reset,
292
+ resetLabel: g.d.resetLabel,
293
+ resetTime: g.d.resetTime,
220
294
  tip: [...head, '', ...groupTip(g), '', startTip].join('\n'),
221
295
  })),
222
296
  note: stale ? s.olderReading : '',
@@ -224,10 +298,12 @@ function row(a, plan, now, s, refreshable) {
224
298
  }
225
299
  if (openWindows(quota, now) === null)
226
300
  return noted(s.noData);
227
- const d = drawn(quota, now, s);
301
+ const d = drawn(quota, now, s, lang);
228
302
  const parts = [...d.parts];
229
- if (d.resetTime)
303
+ if (d.fullest)
230
304
  parts.push(fill(s.resets, { label: d.fullest.label, time: d.resetTime }));
305
+ else if (d.allPassed)
306
+ parts.push(s.resetDue);
231
307
  if (stale)
232
308
  parts.push(s.olderReading);
233
309
  return {
@@ -236,9 +312,11 @@ function row(a, plan, now, s, refreshable) {
236
312
  stale,
237
313
  detail: parts.join(s.sep),
238
314
  level: d.level,
239
- tip: [...head, '', ...d.lines, '', startTip].join('\n'),
315
+ tip: [...head, '', ...d.lines, ...due(d), '', startTip].join('\n'),
240
316
  bars: d.bars,
241
317
  reset: d.reset,
318
+ resetLabel: d.resetLabel,
319
+ resetTime: d.resetTime,
242
320
  note: stale ? s.olderReading : '',
243
321
  };
244
322
  }
@@ -250,7 +328,7 @@ function columns(rows) {
250
328
  .find((l) => l !== undefined) ?? null;
251
329
  return [at(0), at(1)];
252
330
  }
253
- function section(f, now, s) {
331
+ function section(f, now, s, lang) {
254
332
  const logo = f.logo
255
333
  ? {
256
334
  path: f.logo.path,
@@ -259,7 +337,7 @@ function section(f, now, s) {
259
337
  ...(f.logo.gradients?.length ? { gradients: f.logo.gradients } : {}),
260
338
  }
261
339
  : null;
262
- const all = f.accounts.map((a) => ({ a, r: row(a, f.plan, now, s, f.refreshable !== false) }));
340
+ const all = f.accounts.map((a) => ({ a, r: row(a, f.plan, now, s, f.refreshable !== false, lang) }));
263
341
  const aside = (a) => a.kind === 'api' || a.login === 'logged-out';
264
342
  // A Same Login is one quota, so one row, named like the Panel's: after the directory first in Display Order (the
265
343
  // Panel's "Set as shown name" moves one there). It is recommended when any of its directories is. The other
@@ -290,7 +368,17 @@ function section(f, now, s) {
290
368
  const note = fill(s.sameLoginNote, { name: lead.a.name });
291
369
  same.push({
292
370
  ...y,
293
- r: { ...y.r, bars: null, reset: '', note, detail: note, level: 'none', recommended: false },
371
+ r: {
372
+ ...y.r,
373
+ bars: null,
374
+ reset: '',
375
+ resetLabel: '',
376
+ resetTime: '',
377
+ note,
378
+ detail: note,
379
+ level: 'none',
380
+ recommended: false,
381
+ },
294
382
  });
295
383
  }
296
384
  }
@@ -321,7 +409,7 @@ export function menubarSnapshot(families, now, lang, hotkey = null) {
321
409
  for (const f of families) {
322
410
  if (!f.accounts.length)
323
411
  continue;
324
- sections.push(section(f, now, s));
412
+ sections.push(section(f, now, s, lang));
325
413
  if (!f.plan?.hasQuota)
326
414
  continue;
327
415
  // The plan lists the usable accounts first, least used first; past them, the least used of the full ones.
@@ -29,10 +29,18 @@ export declare const MENUBAR_STRINGS: {
29
29
  readonly quietTip: 'Not used on this computer since · use on the web or other computers is not included';
30
30
  readonly fetchFailed: 'The last check failed: {error}';
31
31
  readonly windowTip: '{label}: {p}% used';
32
- readonly windowResetsTip: '{label}: {p}% used · resets in {time}';
32
+ readonly windowResetsTip: '{label}: {p}% used · resets {date} (in {left})';
33
+ readonly windowPassedTip: '{label}: reset at {date} · new numbers come with the next check';
33
34
  readonly window: '{label} {p}%';
34
- readonly resets: '{label} resets in {time}';
35
- readonly resetIn: '{label} · in {time}';
35
+ readonly windowPassed: '{label} –';
36
+ readonly resets: '{label} resets {time}';
37
+ readonly resetIn: '{label} · {time}';
38
+ readonly resetDue: 'Reset due; awaiting update';
39
+ readonly resetDueTip: 'Every window has reset · click Refresh to check now';
40
+ readonly rowRefreshing: 'Refreshing…';
41
+ readonly rowRefreshFailed: 'Refresh failed';
42
+ readonly hoursWindow: '{n}-hour window';
43
+ readonly daysWindow: '{n}-day window';
36
44
  readonly moreApi: 'API keys ({n})';
37
45
  readonly moreSignedOut: '{n} signed out';
38
46
  readonly moreMixed: '{n} more';
@@ -88,10 +96,18 @@ export declare const MENUBAR_STRINGS: {
88
96
  readonly quietTip: '之后这台电脑没用过这个账号 · 网页或其他电脑上的用量不在内';
89
97
  readonly fetchFailed: '上次检查没成功:{error}';
90
98
  readonly windowTip: '{label}:已用 {p}%';
91
- readonly windowResetsTip: '{label}:已用 {p}% · {time}后重置';
99
+ readonly windowResetsTip: '{label}:已用 {p}% · {date} 重置({left}后)';
100
+ readonly windowPassedTip: '{label}:已于 {date} 重置 · 下次检查时更新';
92
101
  readonly window: '{label} {p}%';
93
- readonly resets: '{label} {time}后重置';
94
- readonly resetIn: '{label} · {time}后';
102
+ readonly windowPassed: '{label} –';
103
+ readonly resets: '{label} {time}重置';
104
+ readonly resetIn: '{label} · {time}';
105
+ readonly resetDue: '已到重置时间,待更新';
106
+ readonly resetDueTip: '所有窗口都已重置 · 点“刷新”马上检查';
107
+ readonly rowRefreshing: '刷新中…';
108
+ readonly rowRefreshFailed: '刷新失败';
109
+ readonly hoursWindow: '{n}小时窗口';
110
+ readonly daysWindow: '{n}天窗口';
95
111
  readonly moreApi: '{n} 个 API 密钥账号';
96
112
  readonly moreSignedOut: '{n} 个未登录账号';
97
113
  readonly moreMixed: '另外 {n} 个账号';
@@ -29,10 +29,18 @@ export const MENUBAR_STRINGS = {
29
29
  quietTip: 'Not used on this computer since · use on the web or other computers is not included',
30
30
  fetchFailed: 'The last check failed: {error}',
31
31
  windowTip: '{label}: {p}% used',
32
- windowResetsTip: '{label}: {p}% used · resets in {time}',
32
+ windowResetsTip: '{label}: {p}% used · resets {date} (in {left})',
33
+ windowPassedTip: '{label}: reset at {date} · new numbers come with the next check',
33
34
  window: '{label} {p}%',
34
- resets: '{label} resets in {time}',
35
- resetIn: '{label} · in {time}',
35
+ windowPassed: '{label} –',
36
+ resets: '{label} resets {time}',
37
+ resetIn: '{label} · {time}',
38
+ resetDue: 'Reset due; awaiting update',
39
+ resetDueTip: 'Every window has reset · click Refresh to check now',
40
+ rowRefreshing: 'Refreshing…',
41
+ rowRefreshFailed: 'Refresh failed',
42
+ hoursWindow: '{n}-hour window',
43
+ daysWindow: '{n}-day window',
36
44
  moreApi: 'API keys ({n})',
37
45
  moreSignedOut: '{n} signed out',
38
46
  moreMixed: '{n} more',
@@ -88,10 +96,18 @@ export const MENUBAR_STRINGS = {
88
96
  quietTip: '之后这台电脑没用过这个账号 · 网页或其他电脑上的用量不在内',
89
97
  fetchFailed: '上次检查没成功:{error}',
90
98
  windowTip: '{label}:已用 {p}%',
91
- windowResetsTip: '{label}:已用 {p}% · {time}后重置',
99
+ windowResetsTip: '{label}:已用 {p}% · {date} 重置({left}后)',
100
+ windowPassedTip: '{label}:已于 {date} 重置 · 下次检查时更新',
92
101
  window: '{label} {p}%',
93
- resets: '{label} {time}后重置',
94
- resetIn: '{label} · {time}后',
102
+ windowPassed: '{label} –',
103
+ resets: '{label} {time}重置',
104
+ resetIn: '{label} · {time}',
105
+ resetDue: '已到重置时间,待更新',
106
+ resetDueTip: '所有窗口都已重置 · 点“刷新”马上检查',
107
+ rowRefreshing: '刷新中…',
108
+ rowRefreshFailed: '刷新失败',
109
+ hoursWindow: '{n}小时窗口',
110
+ daysWindow: '{n}天窗口',
95
111
  moreApi: '{n} 个 API 密钥账号',
96
112
  moreSignedOut: '{n} 个未登录账号',
97
113
  moreMixed: '另外 {n} 个账号',
@@ -83,9 +83,9 @@ export interface PanelMessageStatus {
83
83
  /** The target's Session Label, and the sender's when sideby could tell it, for the Panel's message notices. */
84
84
  to: string;
85
85
  from?: string;
86
- /** For `paste-needed`: the line to paste into the target's tab. */
86
+ /** For `paste-needed`: the line to paste into the target's tab; for `unknown`, the same line behind a click (ADR-0065). */
87
87
  pasteText?: string;
88
- /** Why a paste is needed, or what the target must still do. */
88
+ /** Why a paste is needed, what the target must still do, or why the delivery could not be confirmed. */
89
89
  note?: string;
90
90
  /** Delivered, but the target shows it only once the user approves it in its terminal (ADR-0045). */
91
91
  needsApproval?: true;
@@ -1656,7 +1656,13 @@ export function createPanelHandler(opts) {
1656
1656
  const session = (await liveSessions(rt)).sessions.find((s) => s.sessionId === id);
1657
1657
  if (!session)
1658
1658
  throw new HttpError(404, 'This session is no longer running; refresh the list.');
1659
- const receipt = await sendTo(rt, id, { text, images: images.map((f) => f.path), lang });
1659
+ // The person at the Panel sends it, never a Session the server happens to run under.
1660
+ const receipt = await sendTo(rt, id, {
1661
+ text,
1662
+ images: images.map((f) => f.path),
1663
+ lang,
1664
+ fromUser: true,
1665
+ });
1660
1666
  // The Message has its own copies now; the staged ones would only wait a day to be cleared.
1661
1667
  await removeStaged(rt.paths, ids).catch(() => 0);
1662
1668
  // Only a Message the user pastes needs the way to the target's tab.
@@ -1683,7 +1689,7 @@ export function createPanelHandler(opts) {
1683
1689
  sentAt: m.sentAt,
1684
1690
  to: m.to,
1685
1691
  ...(m.from ? { from: m.from } : {}),
1686
- ...(m.status === 'paste-needed' ? { pasteText: m.pasteText } : {}),
1692
+ ...(m.status === 'paste-needed' || m.status === 'unknown' ? { pasteText: m.pasteText } : {}),
1687
1693
  ...(m.note ? { note: m.note } : {}),
1688
1694
  ...(m.needsApproval ? { needsApproval: true } : {}),
1689
1695
  };
@@ -935,6 +935,12 @@ declare const en: {
935
935
  'spage.status.busy': string;
936
936
  'spage.status.idle': string;
937
937
  'spage.status.unknown': string;
938
+ 'spage.why.host-waits': string;
939
+ 'spage.why.pending-decision': string;
940
+ 'spage.why.message-to-approve': string;
941
+ 'spage.why.message-to-paste': string;
942
+ 'spage.decision': string;
943
+ 'spage.decisionTip': string;
938
944
  'spage.guessed': string;
939
945
  'spage.guessedTip': string;
940
946
  'spage.run': string;
@@ -1101,6 +1107,7 @@ declare const en: {
1101
1107
  'send.stored': string;
1102
1108
  'send.copyLine': string;
1103
1109
  'send.copied': string;
1110
+ 'send.copiedUnknown': string;
1104
1111
  'send.jump': string;
1105
1112
  'send.again': string;
1106
1113
  'send.chip.delivered': string;
@@ -1115,6 +1122,10 @@ declare const en: {
1115
1122
  'send.chip.approve': string;
1116
1123
  'send.approve': string;
1117
1124
  'msgn.approve': string;
1125
+ 'send.chip.unknown': string;
1126
+ 'send.unknown': string;
1127
+ 'send.unknownCaution': string;
1128
+ 'msgn.unknown': string;
1118
1129
  'inb.title': string;
1119
1130
  'inb.explain': string;
1120
1131
  'inb.banner': string;
@@ -366,7 +366,7 @@ const en = {
366
366
  'win.7d': 'Weekly',
367
367
  'win.5h.short': '5-hour',
368
368
  'win.7d.short': 'Weekly',
369
- 'quota.resetsIn': 'resets in {d}',
369
+ 'quota.resetsIn': 'resets {d}',
370
370
  'quota.staleShort': 'from {ago}',
371
371
  'col.tokens': 'Tokens · {n} days',
372
372
  'col.last': 'Last used',
@@ -937,6 +937,12 @@ const en = {
937
937
  'spage.status.busy': 'Working',
938
938
  'spage.status.idle': 'Idle',
939
939
  'spage.status.unknown': 'Running',
940
+ 'spage.why.host-waits': 'It waits in its terminal for your answer or your approval.',
941
+ 'spage.why.pending-decision': 'It asked something while you were away, and the answer is still yours to give. See it under Unattended.',
942
+ 'spage.why.message-to-approve': 'A message sent to it shows only once you approve it in its terminal.',
943
+ 'spage.why.message-to-paste': 'A message sent to it is waiting for you to paste it into its tab.',
944
+ 'spage.decision': 'Decision waiting',
945
+ 'spage.decisionTip': 'Open Unattended to see what it asked and mark it done.',
940
946
  'spage.guessed': 'newest session (guessed)',
941
947
  'spage.guessedTip': 'sideby could not tell which session this account is running, so it shows the newest one.',
942
948
  'spage.run': 'Task: {title}',
@@ -1103,6 +1109,7 @@ const en = {
1103
1109
  'send.stored': 'Saved, but not sent to {name} yet. Paste this line into its terminal tab:',
1104
1110
  'send.copyLine': 'Copy this line',
1105
1111
  'send.copied': "Copied. Paste it into {name}'s tab.",
1112
+ 'send.copiedUnknown': 'Copied. Paste it into {name} only if the message never shows up there.',
1106
1113
  'send.jump': 'Go to its Orca tab',
1107
1114
  'send.again': 'Send another',
1108
1115
  'send.chip.delivered': 'Delivered',
@@ -1117,6 +1124,10 @@ const en = {
1117
1124
  'send.chip.approve': 'Waits for approval',
1118
1125
  'send.approve': '{name} got it, but shows it only after you approve it in its terminal',
1119
1126
  'msgn.approve': '{to} got a message but holds it until you approve it in its terminal',
1127
+ 'send.chip.unknown': 'Not confirmed',
1128
+ 'send.unknown': 'sideby could not confirm that {name} got it. It may still show up: look at the session before you send it again.',
1129
+ 'send.unknownCaution': 'Paste this line only if the message never shows up there. If both arrive, the session gets it twice.',
1130
+ 'msgn.unknown': 'sideby could not confirm that {to} got the message',
1120
1131
  'inb.title': 'Receiving messages',
1121
1132
  'inb.explain': 'A Claude session can show a message from another session right away, or hold it until you approve it in its terminal. A held message is dropped after about 5 minutes.',
1122
1133
  'inb.banner': 'Messages to {refs} wait for your approval in the terminal, and are dropped after about 5 minutes.',
@@ -1140,7 +1151,7 @@ const en = {
1140
1151
  'inb.allSet': 'Every account already receives messages directly.',
1141
1152
  'inb.readOnly': 'This Panel is read-only. Run sideby messages inbound accept, or ask your AI to do it.',
1142
1153
  'msgn.show': 'Show',
1143
- 'msgn.badge': '{n} waiting for you to paste into their tab',
1154
+ 'msgn.badge': '{n} with a message to check',
1144
1155
  'tune.title': 'Context tuning',
1145
1156
  'tune.intro': 'Looks at how you used this over the last {days} days and estimates what auto-compact size would use the fewest tokens. It is only an estimate, and nothing changes until you press Use.',
1146
1157
  'tune.loading': 'Working it out from your recent sessions…',
@@ -1507,13 +1518,13 @@ const en = {
1507
1518
  'ua.untilDay': 'until {day} {time}',
1508
1519
  'ua.backToday': 'back on at {time}',
1509
1520
  'ua.backDay': 'back on {day} {time}',
1510
- 'ua.nextToday': 'next: {time}',
1511
- 'ua.nextDay': 'next: {day} {time}',
1521
+ 'ua.nextToday': 'turns on at {time}',
1522
+ 'ua.nextDay': 'turns on {day} {time}',
1512
1523
  'ua.today': 'today',
1513
1524
  'ua.tomorrow': 'tomorrow',
1514
1525
  'ua.noEnd': 'stays on: your Schedule covers every hour',
1515
1526
  'ua.pausedOpen': 'until you turn it on again',
1516
- 'ua.onNote': 'Sessions sideby starts do not stop to wait for you. Questions go on with the recommended choice; a step Claude Code wants you to confirm is refused, and the session finds another way or skips it. What they skipped is listed below.',
1527
+ 'ua.onNote': 'Sessions sideby starts do not stop to wait for you. Questions go on with the recommended choice; a step Claude Code wants you to confirm is refused, and the session finds another way or skips it; a Claude turn cut off by a passing server or network error is started again, up to 3 times. What they skipped is listed below.',
1517
1528
  'ua.offNote': 'When it is on, sessions sideby starts do not stop to wait for you: no questions, and no prompts asking you to confirm a step.',
1518
1529
  'ua.pausedNote': 'Until then, sessions ask you as usual. Turn it on now to go back.',
1519
1530
  'ua.turnOn': 'Turn on now',
@@ -1956,7 +1967,7 @@ const zh = {
1956
1967
  'win.7d': '每周额度',
1957
1968
  'win.5h.short': '5 小时',
1958
1969
  'win.7d.short': '每周',
1959
- 'quota.resetsIn': '{d}后重置',
1970
+ 'quota.resetsIn': '{d}重置',
1960
1971
  'quota.staleShort': '{ago}的数据',
1961
1972
  'col.tokens': 'Tokens · 近 {n} 天',
1962
1973
  'col.last': '最近使用',
@@ -2527,6 +2538,12 @@ const zh = {
2527
2538
  'spage.status.busy': '运行中',
2528
2539
  'spage.status.idle': '空闲',
2529
2540
  'spage.status.unknown': '在运行',
2541
+ 'spage.why.host-waits': '它在终端里等你回答或批准。',
2542
+ 'spage.why.pending-decision': '你不在时它问过一件事,还等你决定。在「无人值守」页能看到。',
2543
+ 'spage.why.message-to-approve': '发给它的消息要你在它的终端里批准后才显示。',
2544
+ 'spage.why.message-to-paste': '发给它的消息还等你粘贴到它的标签页里。',
2545
+ 'spage.decision': '有事待你决定',
2546
+ 'spage.decisionTip': '打开「无人值守」页,看它问了什么,处理完标为已完成。',
2530
2547
  'spage.guessed': '最新会话(推测)',
2531
2548
  'spage.guessedTip': 'sideby 没法确定这个账号正在跑哪个会话,先显示它最新的一个。',
2532
2549
  'spage.run': '任务:{title}',
@@ -2693,6 +2710,7 @@ const zh = {
2693
2710
  'send.stored': '已存好,但还没发给 {name}。把下面这句粘贴到它的标签页:',
2694
2711
  'send.copyLine': '复制这句',
2695
2712
  'send.copied': '已复制,粘贴到 {name} 的标签页即可。',
2713
+ 'send.copiedUnknown': '已复制。只有 {name} 那边一直没出现这条消息时,才粘贴过去。',
2696
2714
  'send.jump': '跳到它的 Orca 标签页',
2697
2715
  'send.again': '再发一条',
2698
2716
  'send.chip.delivered': '已送达',
@@ -2707,6 +2725,10 @@ const zh = {
2707
2725
  'send.chip.approve': '等批准',
2708
2726
  'send.approve': '{name} 已收到,但要你在它的终端里批准后才会显示',
2709
2727
  'msgn.approve': '{to} 收到一条消息,要你在它的终端里批准后才会显示',
2728
+ 'send.chip.unknown': '未确认送达',
2729
+ 'send.unknown': 'sideby 没法确认 {name} 收到了。它可能稍后才出现:再发一次前,先去那个会话看看。',
2730
+ 'send.unknownCaution': '只有那边一直没出现这条消息时,才粘贴这句。两边都到的话,它会收到两次。',
2731
+ 'msgn.unknown': 'sideby 没法确认 {to} 收到了这条消息',
2710
2732
  'inb.title': '接收消息',
2711
2733
  'inb.explain': 'Claude 会话收到别的会话发来的消息时,可以直接显示,也可以先等你在终端里批准。等批准的消息约 5 分钟没人批准就会被丢掉。',
2712
2734
  'inb.banner': '发给 {refs} 的消息要你在终端里批准,约 5 分钟后会被丢掉。',
@@ -2730,7 +2752,7 @@ const zh = {
2730
2752
  'inb.allSet': '所有账号都已经直接接收消息。',
2731
2753
  'inb.readOnly': '这个 Panel 是只读的。请运行 sideby messages inbound accept,或让你的 AI 来做。',
2732
2754
  'msgn.show': '查看',
2733
- 'msgn.badge': '有 {n} 个会话等你把消息粘贴过去',
2755
+ 'msgn.badge': '有 {n} 个会话的消息要你看一下',
2734
2756
  'tune.title': '上下文调优',
2735
2757
  'tune.intro': '看看你最近 {days} 天的用法,估算「自动压缩」设成多少最省 token。这只是估算;你点「使用」之前,sideby 不会改任何设置。',
2736
2758
  'tune.loading': '正在根据你最近的会话计算…',
@@ -3094,16 +3116,16 @@ const zh = {
3094
3116
  'ua.slotQuoted': '时段『{name}』',
3095
3117
  'ua.slotN': '时段 {n}',
3096
3118
  'ua.untilToday': '到 {time}',
3097
- 'ua.untilDay': '到{day} {time}',
3098
- 'ua.backToday': '到 {time} 后恢复',
3099
- 'ua.backDay': '到{day} {time} 后恢复',
3100
- 'ua.nextToday': '下一次 {time}',
3101
- 'ua.nextDay': '下一次 {day} {time}',
3119
+ 'ua.untilDay': '到 {day} {time}',
3120
+ 'ua.backToday': '{time} 自动恢复',
3121
+ 'ua.backDay': '{day} {time} 自动恢复',
3122
+ 'ua.nextToday': '{time} 自动开启',
3123
+ 'ua.nextDay': '{day} {time} 自动开启',
3102
3124
  'ua.today': '今天',
3103
3125
  'ua.tomorrow': '明天',
3104
3126
  'ua.noEnd': '一直开着:时间表覆盖了每个小时',
3105
3127
  'ua.pausedOpen': '等你再打开',
3106
- 'ua.onNote': 'sideby 启动的会话不会停下来等你:提问按推荐继续;Claude Code 要你确认的操作直接拒绝,会话换个做法或跳过。跳过的记在下面。',
3128
+ 'ua.onNote': 'sideby 启动的会话不会停下来等你:提问按推荐继续;Claude Code 要你确认的操作直接拒绝,会话换个做法或跳过;Claude 回合因为服务器或网络的暂时问题中断时,自动接着跑,最多 3 次。跳过的记在下面。',
3107
3129
  'ua.offNote': '开着时,sideby 启动的会话不停下来等你:不提问,也不弹要你确认的框。',
3108
3130
  'ua.pausedNote': '在那之前,会话照常问你。现在开就恢复。',
3109
3131
  'ua.turnOn': '现在开',
@@ -52,6 +52,19 @@ export interface LogicUsage {
52
52
  }
53
53
  /** A short countdown such as `2h 05m`, `3d 4h` or `12m` (`2小时05分` in Chinese); fixed shape so it does not jump. */
54
54
  export declare function formatDuration(ms: number, lang: string): string;
55
+ /**
56
+ * When a quota window resets, in words (spec §3.31): under 24 hours a countdown (`in 4h 20m`, `4小时20分后`); else
57
+ * the next local calendar day (`tomorrow 4:59 PM`, `明天 16:59`), up to 6 days the weekday (`Wed 4:59 PM`, `周三
58
+ * 16:59`), later the date (`Nov 11, 4:59 PM`, `11月11日 16:59`) with the year when it is not this year. One rule for
59
+ * the menu bar, the Panel and the CLI. `timeZone` is for tests; the local zone otherwise. Times are composed by hand
60
+ * from numbers, so ICU's spacing (a narrow no-break space before PM) never shows.
61
+ */
62
+ export declare function resetWhen(resetsAt: string, now: number, lang: string, timeZone?: string): string;
63
+ /**
64
+ * A reset time in full for hover text, such as `Wed, Nov 4, 4:59 PM` or `11月4日周三 16:59`, with the year when it is
65
+ * not this year. `timeZone` is for tests.
66
+ */
67
+ export declare function resetDate(resetsAt: string, now: number, lang: string, timeZone?: string): string;
55
68
  /**
56
69
  * A Long Window: longer than one day (weekly, a billing period), from `windowMinutes` or else a label such as `7d`.
57
70
  * The page's copy of `isLongWindow` in core/quota-levels.ts; a test keeps the two equal.
@@ -389,6 +402,22 @@ export declare function sortSessions<T extends LogicSession>(list: readonly T[])
389
402
  * shown before comes ahead of the shown ones, in `sortSessions` order.
390
403
  */
391
404
  export declare function steadyOrder<T extends LogicSession>(shown: readonly string[], list: readonly T[]): T[];
405
+ /**
406
+ * Everything a Sessions row shows except its age, as plain values: the page redraws a row only when this changes.
407
+ * `reason` is in it, so a Session that keeps `needs-you` for another reason (a decision instead of its Host asking)
408
+ * gets its button and its hint redrawn.
409
+ */
410
+ export declare function sessionRowShape(s: LogicSession & {
411
+ family?: string;
412
+ reason?: string;
413
+ guessed?: boolean;
414
+ copy?: unknown;
415
+ orca?: unknown;
416
+ run?: unknown;
417
+ }, msg?: {
418
+ status: string;
419
+ needsApproval?: boolean;
420
+ }): unknown[];
392
421
  /** How long ago a Session was last active, as a message key and count; null when it has no time at all. */
393
422
  export declare function sessionAge(s: LogicSession, now: number): {
394
423
  key: string;
@@ -414,10 +443,12 @@ export interface LogicMessage {
414
443
  * What the "Send to it" dialog shows after a send: `done` (the Host took it; `hint` is any note, shown as a yellow
415
444
  * hint), `approve` (it took it, but the target shows it only once the user approves it there; `reason` says how, ADR-0045),
416
445
  * `paste` (the user pastes `pasteText`; `reason` says why, `jump` offers the
417
- * target's Orca tab) or `stored` (kept as a file only; `pasteText` for reference). `key` is the headline's message key.
446
+ * target's Orca tab), `stored` (kept as a file only; `pasteText` for reference) or `unknown` (sideby could not tell if
447
+ * it arrived, ADR-0065: `reason` says why, and `pasteText` is offered only with a caution, never as the next step).
448
+ * A status this page does not know is shown as `unknown`, never as a request to paste. `key` is the headline's key.
418
449
  */
419
450
  export declare function sendResultView(m: LogicMessage, orca: boolean): {
420
- kind: 'done' | 'approve' | 'paste' | 'stored';
451
+ kind: 'done' | 'approve' | 'paste' | 'stored' | 'unknown';
421
452
  key: string;
422
453
  pasteText: string;
423
454
  reason: string;
@@ -429,6 +460,11 @@ export declare function messageChip(status: string | undefined, needsApproval?:
429
460
  key: string;
430
461
  tone: 'ok' | 'warn' | 'accent';
431
462
  } | null;
463
+ /**
464
+ * Whether a Session's latest Message asks the user to look: it waits for a paste, or it could not be confirmed. The
465
+ * Sessions tab counts running Sessions for which this holds.
466
+ */
467
+ export declare function messageToCheck(status: string | undefined): boolean;
432
468
  /** The latest Message to one Session, as `/api/sessions/messages` gives it (`PanelMessageStatus` in handler.ts). */
433
469
  export interface LogicMessageStatus {
434
470
  id: string;
@@ -440,11 +476,12 @@ export interface LogicMessageStatus {
440
476
  }
441
477
  /** A Session Label without its short id: `cc002 · knip cleanup · 61230c3d` → `cc002 · knip cleanup`. */
442
478
  export declare function shortSessionLabel(label: string | undefined): string;
443
- export type MessageNewsKind = 'new' | 'approve' | 'read' | 'paste';
479
+ export type MessageNewsKind = 'new' | 'approve' | 'read' | 'paste' | 'unknown';
444
480
  /**
445
481
  * What changed between two readings of the latest Messages, for the Panel's notices (spec §3.32): `new` (a Message
446
482
  * reached a Session), `approve` (it reached one that shows it only once the user approves it, ADR-0045), `read` (its
447
- * Session read it) or `paste` (it waits for the user to paste it). The first reading (`before` null) only sets the
483
+ * Session read it), `paste` (it waits for the user to paste it) or `unknown` (sideby could not confirm it arrived,
484
+ * ADR-0065; announced once, as the status never changes by itself). The first reading (`before` null) only sets the
448
485
  * baseline, so opening the Panel announces nothing that was already there.
449
486
  */
450
487
  export declare function messageNews(before: Record<string, LogicMessageStatus> | null, after: Record<string, LogicMessageStatus>): {