sideby 0.32.1 → 0.33.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/assets/brand/sai-painted-1024.png +0 -0
- package/assets/brand/sai-painted-128.png +0 -0
- package/assets/brand/sai-painted-256.png +0 -0
- package/assets/brand/sai-painted-64.png +0 -0
- package/dist/build.json +1 -1
- package/dist/src/cli/commands.js +57 -14
- package/dist/src/cli/format.js +3 -1
- package/dist/src/cli/json-schemas.js +30 -5
- package/dist/src/cli/main.js +9 -4
- package/dist/src/core/brand-mark.d.ts +18 -115
- package/dist/src/core/brand-mark.js +43 -174
- package/dist/src/core/messages.d.ts +17 -5
- package/dist/src/core/messages.js +38 -15
- package/dist/src/core/quota-fetch.js +9 -2
- package/dist/src/desktop/icon.d.ts +13 -1
- package/dist/src/desktop/icon.js +153 -285
- package/dist/src/families/claude/deliver.js +9 -1
- package/dist/src/families/claude/messaging.d.ts +7 -1
- package/dist/src/families/claude/messaging.js +10 -2
- package/dist/src/families/codex/deliver.d.ts +10 -1
- package/dist/src/families/codex/deliver.js +24 -2
- package/dist/src/families/messaging.d.ts +6 -1
- package/dist/src/menubar/script.d.ts +5 -0
- package/dist/src/menubar/script.js +111 -25
- package/dist/src/menubar/snapshot.d.ts +29 -8
- package/dist/src/menubar/snapshot.js +132 -31
- package/dist/src/menubar/strings.d.ts +22 -6
- package/dist/src/menubar/strings.js +22 -6
- package/dist/src/panel/handler.d.ts +2 -2
- package/dist/src/panel/handler.js +8 -2
- package/dist/src/panel/i18n.d.ts +5 -0
- package/dist/src/panel/i18n.js +14 -4
- package/dist/src/panel/page-logic.d.ts +25 -4
- package/dist/src/panel/page-logic.js +122 -10
- package/dist/src/panel/page-script.js +39 -8
- package/dist/src/panel/page-styles.js +5 -5
- package/dist/src/panel/page.js +2 -2
- package/dist/src/panel/theme.d.ts +4 -1
- package/dist/src/runtime.d.ts +3 -1
- package/dist/src/runtime.js +1 -1
- package/package.json +2 -1
- package/schemas/menubar-snapshot.json +102 -2
- package/schemas/messages.json +6 -2
- package/schemas/send.json +6 -2
- package/skills/sideby/SKILL.md +1 -1
- package/skills/sideby/references/panel.md +1 -1
- package/skills/sideby/references/sessions.md +6 -3
|
@@ -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_*).
|
|
@@ -80,42 +81,64 @@ function durationText(minutes, s) {
|
|
|
80
81
|
return fill(s.minutes, { m });
|
|
81
82
|
}
|
|
82
83
|
/**
|
|
83
|
-
* The model groups of a Quota
|
|
84
|
-
* as the Panel shows them: each with its own windows, so the menu draws a line per group
|
|
85
|
-
*
|
|
84
|
+
* The model groups of a Quota, from its windows that cover one group (Antigravity CLI's, Cursor's "Other models"), in
|
|
85
|
+
* the order the Host lists them, as the Panel shows them: each with its own windows, so the menu draws a line per group
|
|
86
|
+
* with its `5h` and `7d` bars. Windows that cover every model stay on the account's own line. Null when no window
|
|
87
|
+
* covers a single group.
|
|
86
88
|
*/
|
|
87
89
|
export function quotaGroups(quota) {
|
|
88
|
-
if (quota.status !== 'ok' || !quota.windows.
|
|
90
|
+
if (quota.status !== 'ok' || !quota.windows.some((w) => w.name))
|
|
89
91
|
return null;
|
|
90
92
|
const groups = new Map();
|
|
91
93
|
for (const { name, ...w } of quota.windows)
|
|
92
|
-
|
|
94
|
+
if (name)
|
|
95
|
+
groups.set(name, [...(groups.get(name) ?? []), w]);
|
|
93
96
|
return [...groups].map(([name, windows]) => ({ name, quota: { ...quota, windows } }));
|
|
94
97
|
}
|
|
95
98
|
/** A model group's name over its line, without a trailing "models" so it fits. */
|
|
96
99
|
function groupLabel(name) {
|
|
97
100
|
return name.replace(/\s+models$/i, '') || name;
|
|
98
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
|
+
}
|
|
99
111
|
/**
|
|
100
112
|
* What a Quota whose windows cover every model draws: two bar columns (the shortest window, then the fullest of the
|
|
101
113
|
* others, so a third window that is used up still shows; a single window fills the second), each colored by its own
|
|
102
114
|
* levels (a weekly window warns later, spec §3.26), which window runs out first and when it resets, and one hover line
|
|
103
|
-
* 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.
|
|
104
117
|
*/
|
|
105
|
-
function drawn(quota, now, s) {
|
|
118
|
+
function drawn(quota, now, s, lang) {
|
|
106
119
|
const open = openWindows(quota, now) ?? [];
|
|
107
120
|
const windows = quota.windows
|
|
108
121
|
.filter((w) => !w.name)
|
|
109
122
|
.sort((x, y) => (x.windowMinutes ?? 0) - (y.windowMinutes ?? 0));
|
|
110
123
|
const openOf = (w) => open.find((o) => o.label === w.label);
|
|
111
124
|
const bar = (w) => {
|
|
112
|
-
const
|
|
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);
|
|
113
134
|
return { label: w.label, percent, level: windowLevel({ ...w, usedPercent: percent }) };
|
|
114
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);
|
|
115
138
|
const longer = windows
|
|
116
139
|
.slice(1)
|
|
117
140
|
.map(bar)
|
|
118
|
-
.reduce((best, b) => (!best || b
|
|
141
|
+
.reduce((best, b) => (!best || weight(b) > weight(best) ? b : best), null);
|
|
119
142
|
const bars = !windows.length
|
|
120
143
|
? null
|
|
121
144
|
: longer
|
|
@@ -124,22 +147,40 @@ function drawn(quota, now, s) {
|
|
|
124
147
|
// The window that runs out first relative to its own kind: a weekly 87% before a 5-hour 60%.
|
|
125
148
|
const fullest = bindingWindow(open) ?? null;
|
|
126
149
|
const level = open.reduce((l, w) => worseLevel(l, windowLevel(w)), 'ok');
|
|
127
|
-
const
|
|
128
|
-
const
|
|
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;
|
|
129
155
|
const lines = windows.map((w) => {
|
|
130
156
|
const o = openOf(w);
|
|
131
|
-
const
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
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 });
|
|
135
169
|
});
|
|
136
170
|
return {
|
|
137
171
|
bars,
|
|
138
|
-
fullest,
|
|
172
|
+
fullest: shown,
|
|
139
173
|
level,
|
|
140
174
|
reset,
|
|
175
|
+
resetLabel,
|
|
141
176
|
resetTime,
|
|
142
|
-
|
|
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
|
+
}),
|
|
143
184
|
lines,
|
|
144
185
|
};
|
|
145
186
|
}
|
|
@@ -153,7 +194,25 @@ function observedText(observedAt, now, s) {
|
|
|
153
194
|
return s.observedJustNow;
|
|
154
195
|
return fill(s.observedAgo, { time: durationText(minutes, s) });
|
|
155
196
|
}
|
|
156
|
-
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) {
|
|
157
216
|
const recommended = Boolean(plan?.hasQuota && plan.pick === a.ref);
|
|
158
217
|
const startTip = fill(s.startTip, { account: a.ref });
|
|
159
218
|
const base = {
|
|
@@ -164,6 +223,8 @@ function row(a, plan, now, s, refreshable) {
|
|
|
164
223
|
bars: null,
|
|
165
224
|
groups: null,
|
|
166
225
|
reset: '',
|
|
226
|
+
resetLabel: '',
|
|
227
|
+
resetTime: '',
|
|
167
228
|
observedAt: null,
|
|
168
229
|
stale: false,
|
|
169
230
|
};
|
|
@@ -185,25 +246,51 @@ function row(a, plan, now, s, refreshable) {
|
|
|
185
246
|
...(quiet ? [s.quietTip] : []),
|
|
186
247
|
...(quota.fetchError ? [fill(s.fetchFailed, { error: quota.fetchError })] : []),
|
|
187
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] : []);
|
|
188
251
|
const groups = quotaGroups(quota);
|
|
189
252
|
if (groups) {
|
|
190
|
-
// One line per model group under the account, each with its own 5h and 7d bars (spec §3.31).
|
|
191
|
-
|
|
192
|
-
const
|
|
253
|
+
// One line per model group under the account, each with its own 5h and 7d bars (spec §3.31). Windows that cover
|
|
254
|
+
// every model (Cursor's plan total) keep their bars on the account's own line.
|
|
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;
|
|
193
262
|
return {
|
|
194
263
|
...base,
|
|
195
264
|
observedAt: quota.observedAt,
|
|
196
265
|
stale,
|
|
197
266
|
detail: [
|
|
267
|
+
...(all ? [all.parts.join(' ')] : []),
|
|
198
268
|
...drawnGroups.map((g) => `${groupLabel(g.name)} ${g.d.parts.join(' ')}`),
|
|
199
269
|
...(stale ? [s.olderReading] : []),
|
|
200
270
|
].join(s.sep),
|
|
201
|
-
level: drawnGroups.reduce((l, g) => worseLevel(l, g.d.level), 'ok'),
|
|
202
|
-
tip: [
|
|
203
|
-
|
|
271
|
+
level: drawnGroups.reduce((l, g) => worseLevel(l, g.d.level), all?.level ?? 'ok'),
|
|
272
|
+
tip: [
|
|
273
|
+
...head,
|
|
274
|
+
'',
|
|
275
|
+
...(all ? [...all.lines, ...due(all), ''] : []),
|
|
276
|
+
...drawnGroups.flatMap(groupTip),
|
|
277
|
+
'',
|
|
278
|
+
startTip,
|
|
279
|
+
].join('\n'),
|
|
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) => ({
|
|
204
289
|
label: groupLabel(g.name),
|
|
205
290
|
bars: g.d.bars,
|
|
206
291
|
reset: g.d.reset,
|
|
292
|
+
resetLabel: g.d.resetLabel,
|
|
293
|
+
resetTime: g.d.resetTime,
|
|
207
294
|
tip: [...head, '', ...groupTip(g), '', startTip].join('\n'),
|
|
208
295
|
})),
|
|
209
296
|
note: stale ? s.olderReading : '',
|
|
@@ -211,10 +298,12 @@ function row(a, plan, now, s, refreshable) {
|
|
|
211
298
|
}
|
|
212
299
|
if (openWindows(quota, now) === null)
|
|
213
300
|
return noted(s.noData);
|
|
214
|
-
const d = drawn(quota, now, s);
|
|
301
|
+
const d = drawn(quota, now, s, lang);
|
|
215
302
|
const parts = [...d.parts];
|
|
216
|
-
if (d.
|
|
303
|
+
if (d.fullest)
|
|
217
304
|
parts.push(fill(s.resets, { label: d.fullest.label, time: d.resetTime }));
|
|
305
|
+
else if (d.allPassed)
|
|
306
|
+
parts.push(s.resetDue);
|
|
218
307
|
if (stale)
|
|
219
308
|
parts.push(s.olderReading);
|
|
220
309
|
return {
|
|
@@ -223,9 +312,11 @@ function row(a, plan, now, s, refreshable) {
|
|
|
223
312
|
stale,
|
|
224
313
|
detail: parts.join(s.sep),
|
|
225
314
|
level: d.level,
|
|
226
|
-
tip: [...head, '', ...d.lines, '', startTip].join('\n'),
|
|
315
|
+
tip: [...head, '', ...d.lines, ...due(d), '', startTip].join('\n'),
|
|
227
316
|
bars: d.bars,
|
|
228
317
|
reset: d.reset,
|
|
318
|
+
resetLabel: d.resetLabel,
|
|
319
|
+
resetTime: d.resetTime,
|
|
229
320
|
note: stale ? s.olderReading : '',
|
|
230
321
|
};
|
|
231
322
|
}
|
|
@@ -237,7 +328,7 @@ function columns(rows) {
|
|
|
237
328
|
.find((l) => l !== undefined) ?? null;
|
|
238
329
|
return [at(0), at(1)];
|
|
239
330
|
}
|
|
240
|
-
function section(f, now, s) {
|
|
331
|
+
function section(f, now, s, lang) {
|
|
241
332
|
const logo = f.logo
|
|
242
333
|
? {
|
|
243
334
|
path: f.logo.path,
|
|
@@ -246,7 +337,7 @@ function section(f, now, s) {
|
|
|
246
337
|
...(f.logo.gradients?.length ? { gradients: f.logo.gradients } : {}),
|
|
247
338
|
}
|
|
248
339
|
: null;
|
|
249
|
-
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) }));
|
|
250
341
|
const aside = (a) => a.kind === 'api' || a.login === 'logged-out';
|
|
251
342
|
// A Same Login is one quota, so one row, named like the Panel's: after the directory first in Display Order (the
|
|
252
343
|
// Panel's "Set as shown name" moves one there). It is recommended when any of its directories is. The other
|
|
@@ -277,7 +368,17 @@ function section(f, now, s) {
|
|
|
277
368
|
const note = fill(s.sameLoginNote, { name: lead.a.name });
|
|
278
369
|
same.push({
|
|
279
370
|
...y,
|
|
280
|
-
r: {
|
|
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
|
+
},
|
|
281
382
|
});
|
|
282
383
|
}
|
|
283
384
|
}
|
|
@@ -308,7 +409,7 @@ export function menubarSnapshot(families, now, lang, hotkey = null) {
|
|
|
308
409
|
for (const f of families) {
|
|
309
410
|
if (!f.accounts.length)
|
|
310
411
|
continue;
|
|
311
|
-
sections.push(section(f, now, s));
|
|
412
|
+
sections.push(section(f, now, s, lang));
|
|
312
413
|
if (!f.plan?.hasQuota)
|
|
313
414
|
continue;
|
|
314
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 {
|
|
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
|
|
35
|
-
readonly
|
|
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}% · {
|
|
99
|
+
readonly windowResetsTip: '{label}:已用 {p}% · {date} 重置({left}后)';
|
|
100
|
+
readonly windowPassedTip: '{label}:已于 {date} 重置 · 下次检查时更新';
|
|
92
101
|
readonly window: '{label} {p}%';
|
|
93
|
-
readonly
|
|
94
|
-
readonly
|
|
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 {
|
|
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
|
-
|
|
35
|
-
|
|
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}% · {
|
|
99
|
+
windowResetsTip: '{label}:已用 {p}% · {date} 重置({left}后)',
|
|
100
|
+
windowPassedTip: '{label}:已于 {date} 重置 · 下次检查时更新',
|
|
92
101
|
window: '{label} {p}%',
|
|
93
|
-
|
|
94
|
-
|
|
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,
|
|
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
|
-
|
|
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
|
};
|
package/dist/src/panel/i18n.d.ts
CHANGED
|
@@ -1101,6 +1101,7 @@ declare const en: {
|
|
|
1101
1101
|
'send.stored': string;
|
|
1102
1102
|
'send.copyLine': string;
|
|
1103
1103
|
'send.copied': string;
|
|
1104
|
+
'send.copiedUnknown': string;
|
|
1104
1105
|
'send.jump': string;
|
|
1105
1106
|
'send.again': string;
|
|
1106
1107
|
'send.chip.delivered': string;
|
|
@@ -1115,6 +1116,10 @@ declare const en: {
|
|
|
1115
1116
|
'send.chip.approve': string;
|
|
1116
1117
|
'send.approve': string;
|
|
1117
1118
|
'msgn.approve': string;
|
|
1119
|
+
'send.chip.unknown': string;
|
|
1120
|
+
'send.unknown': string;
|
|
1121
|
+
'send.unknownCaution': string;
|
|
1122
|
+
'msgn.unknown': string;
|
|
1118
1123
|
'inb.title': string;
|
|
1119
1124
|
'inb.explain': string;
|
|
1120
1125
|
'inb.banner': string;
|
package/dist/src/panel/i18n.js
CHANGED
|
@@ -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
|
|
369
|
+
'quota.resetsIn': 'resets {d}',
|
|
370
370
|
'quota.staleShort': 'from {ago}',
|
|
371
371
|
'col.tokens': 'Tokens · {n} days',
|
|
372
372
|
'col.last': 'Last used',
|
|
@@ -1103,6 +1103,7 @@ const en = {
|
|
|
1103
1103
|
'send.stored': 'Saved, but not sent to {name} yet. Paste this line into its terminal tab:',
|
|
1104
1104
|
'send.copyLine': 'Copy this line',
|
|
1105
1105
|
'send.copied': "Copied. Paste it into {name}'s tab.",
|
|
1106
|
+
'send.copiedUnknown': 'Copied. Paste it into {name} only if the message never shows up there.',
|
|
1106
1107
|
'send.jump': 'Go to its Orca tab',
|
|
1107
1108
|
'send.again': 'Send another',
|
|
1108
1109
|
'send.chip.delivered': 'Delivered',
|
|
@@ -1117,6 +1118,10 @@ const en = {
|
|
|
1117
1118
|
'send.chip.approve': 'Waits for approval',
|
|
1118
1119
|
'send.approve': '{name} got it, but shows it only after you approve it in its terminal',
|
|
1119
1120
|
'msgn.approve': '{to} got a message but holds it until you approve it in its terminal',
|
|
1121
|
+
'send.chip.unknown': 'Not confirmed',
|
|
1122
|
+
'send.unknown': 'sideby could not confirm that {name} got it. It may still show up: look at the session before you send it again.',
|
|
1123
|
+
'send.unknownCaution': 'Paste this line only if the message never shows up there. If both arrive, the session gets it twice.',
|
|
1124
|
+
'msgn.unknown': 'sideby could not confirm that {to} got the message',
|
|
1120
1125
|
'inb.title': 'Receiving messages',
|
|
1121
1126
|
'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
1127
|
'inb.banner': 'Messages to {refs} wait for your approval in the terminal, and are dropped after about 5 minutes.',
|
|
@@ -1140,7 +1145,7 @@ const en = {
|
|
|
1140
1145
|
'inb.allSet': 'Every account already receives messages directly.',
|
|
1141
1146
|
'inb.readOnly': 'This Panel is read-only. Run sideby messages inbound accept, or ask your AI to do it.',
|
|
1142
1147
|
'msgn.show': 'Show',
|
|
1143
|
-
'msgn.badge': '{n}
|
|
1148
|
+
'msgn.badge': '{n} with a message to check',
|
|
1144
1149
|
'tune.title': 'Context tuning',
|
|
1145
1150
|
'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
1151
|
'tune.loading': 'Working it out from your recent sessions…',
|
|
@@ -1956,7 +1961,7 @@ const zh = {
|
|
|
1956
1961
|
'win.7d': '每周额度',
|
|
1957
1962
|
'win.5h.short': '5 小时',
|
|
1958
1963
|
'win.7d.short': '每周',
|
|
1959
|
-
'quota.resetsIn': '{d}
|
|
1964
|
+
'quota.resetsIn': '{d}重置',
|
|
1960
1965
|
'quota.staleShort': '{ago}的数据',
|
|
1961
1966
|
'col.tokens': 'Tokens · 近 {n} 天',
|
|
1962
1967
|
'col.last': '最近使用',
|
|
@@ -2693,6 +2698,7 @@ const zh = {
|
|
|
2693
2698
|
'send.stored': '已存好,但还没发给 {name}。把下面这句粘贴到它的标签页:',
|
|
2694
2699
|
'send.copyLine': '复制这句',
|
|
2695
2700
|
'send.copied': '已复制,粘贴到 {name} 的标签页即可。',
|
|
2701
|
+
'send.copiedUnknown': '已复制。只有 {name} 那边一直没出现这条消息时,才粘贴过去。',
|
|
2696
2702
|
'send.jump': '跳到它的 Orca 标签页',
|
|
2697
2703
|
'send.again': '再发一条',
|
|
2698
2704
|
'send.chip.delivered': '已送达',
|
|
@@ -2707,6 +2713,10 @@ const zh = {
|
|
|
2707
2713
|
'send.chip.approve': '等批准',
|
|
2708
2714
|
'send.approve': '{name} 已收到,但要你在它的终端里批准后才会显示',
|
|
2709
2715
|
'msgn.approve': '{to} 收到一条消息,要你在它的终端里批准后才会显示',
|
|
2716
|
+
'send.chip.unknown': '未确认送达',
|
|
2717
|
+
'send.unknown': 'sideby 没法确认 {name} 收到了。它可能稍后才出现:再发一次前,先去那个会话看看。',
|
|
2718
|
+
'send.unknownCaution': '只有那边一直没出现这条消息时,才粘贴这句。两边都到的话,它会收到两次。',
|
|
2719
|
+
'msgn.unknown': 'sideby 没法确认 {to} 收到了这条消息',
|
|
2710
2720
|
'inb.title': '接收消息',
|
|
2711
2721
|
'inb.explain': 'Claude 会话收到别的会话发来的消息时,可以直接显示,也可以先等你在终端里批准。等批准的消息约 5 分钟没人批准就会被丢掉。',
|
|
2712
2722
|
'inb.banner': '发给 {refs} 的消息要你在终端里批准,约 5 分钟后会被丢掉。',
|
|
@@ -2730,7 +2740,7 @@ const zh = {
|
|
|
2730
2740
|
'inb.allSet': '所有账号都已经直接接收消息。',
|
|
2731
2741
|
'inb.readOnly': '这个 Panel 是只读的。请运行 sideby messages inbound accept,或让你的 AI 来做。',
|
|
2732
2742
|
'msgn.show': '查看',
|
|
2733
|
-
'msgn.badge': '有 {n}
|
|
2743
|
+
'msgn.badge': '有 {n} 个会话的消息要你看一下',
|
|
2734
2744
|
'tune.title': '上下文调优',
|
|
2735
2745
|
'tune.intro': '看看你最近 {days} 天的用法,估算「自动压缩」设成多少最省 token。这只是估算;你点「使用」之前,sideby 不会改任何设置。',
|
|
2736
2746
|
'tune.loading': '正在根据你最近的会话计算…',
|
|
@@ -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.
|
|
@@ -414,10 +427,12 @@ export interface LogicMessage {
|
|
|
414
427
|
* What the "Send to it" dialog shows after a send: `done` (the Host took it; `hint` is any note, shown as a yellow
|
|
415
428
|
* hint), `approve` (it took it, but the target shows it only once the user approves it there; `reason` says how, ADR-0045),
|
|
416
429
|
* `paste` (the user pastes `pasteText`; `reason` says why, `jump` offers the
|
|
417
|
-
* target's Orca tab)
|
|
430
|
+
* target's Orca tab), `stored` (kept as a file only; `pasteText` for reference) or `unknown` (sideby could not tell if
|
|
431
|
+
* it arrived, ADR-0065: `reason` says why, and `pasteText` is offered only with a caution, never as the next step).
|
|
432
|
+
* A status this page does not know is shown as `unknown`, never as a request to paste. `key` is the headline's key.
|
|
418
433
|
*/
|
|
419
434
|
export declare function sendResultView(m: LogicMessage, orca: boolean): {
|
|
420
|
-
kind: 'done' | 'approve' | 'paste' | 'stored';
|
|
435
|
+
kind: 'done' | 'approve' | 'paste' | 'stored' | 'unknown';
|
|
421
436
|
key: string;
|
|
422
437
|
pasteText: string;
|
|
423
438
|
reason: string;
|
|
@@ -429,6 +444,11 @@ export declare function messageChip(status: string | undefined, needsApproval?:
|
|
|
429
444
|
key: string;
|
|
430
445
|
tone: 'ok' | 'warn' | 'accent';
|
|
431
446
|
} | null;
|
|
447
|
+
/**
|
|
448
|
+
* Whether a Session's latest Message asks the user to look: it waits for a paste, or it could not be confirmed. The
|
|
449
|
+
* Sessions tab counts running Sessions for which this holds.
|
|
450
|
+
*/
|
|
451
|
+
export declare function messageToCheck(status: string | undefined): boolean;
|
|
432
452
|
/** The latest Message to one Session, as `/api/sessions/messages` gives it (`PanelMessageStatus` in handler.ts). */
|
|
433
453
|
export interface LogicMessageStatus {
|
|
434
454
|
id: string;
|
|
@@ -440,11 +460,12 @@ export interface LogicMessageStatus {
|
|
|
440
460
|
}
|
|
441
461
|
/** A Session Label without its short id: `cc002 · knip cleanup · 61230c3d` → `cc002 · knip cleanup`. */
|
|
442
462
|
export declare function shortSessionLabel(label: string | undefined): string;
|
|
443
|
-
export type MessageNewsKind = 'new' | 'approve' | 'read' | 'paste';
|
|
463
|
+
export type MessageNewsKind = 'new' | 'approve' | 'read' | 'paste' | 'unknown';
|
|
444
464
|
/**
|
|
445
465
|
* What changed between two readings of the latest Messages, for the Panel's notices (spec §3.32): `new` (a Message
|
|
446
466
|
* reached a Session), `approve` (it reached one that shows it only once the user approves it, ADR-0045), `read` (its
|
|
447
|
-
* Session read it)
|
|
467
|
+
* Session read it), `paste` (it waits for the user to paste it) or `unknown` (sideby could not confirm it arrived,
|
|
468
|
+
* ADR-0065; announced once, as the status never changes by itself). The first reading (`before` null) only sets the
|
|
448
469
|
* baseline, so opening the Panel announces nothing that was already there.
|
|
449
470
|
*/
|
|
450
471
|
export declare function messageNews(before: Record<string, LogicMessageStatus> | null, after: Record<string, LogicMessageStatus>): {
|