@songsid/agend 2.3.5-alpha.11 → 2.3.5-alpha.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/accounts-view.d.ts +3 -0
- package/dist/accounts-view.js +2 -2
- package/dist/accounts-view.js.map +1 -1
- package/dist/auth-api.js +12 -28
- package/dist/auth-api.js.map +1 -1
- package/dist/backend/claude-code.js +16 -3
- package/dist/backend/claude-code.js.map +1 -1
- package/dist/backend/credential-profile.d.ts +16 -0
- package/dist/backend/credential-profile.js +44 -0
- package/dist/backend/credential-profile.js.map +1 -1
- package/dist/backend/muse.d.ts +3 -1
- package/dist/backend/muse.js +31 -1
- package/dist/backend/muse.js.map +1 -1
- package/dist/backend/types.d.ts +12 -0
- package/dist/backend/types.js.map +1 -1
- package/dist/build-provenance.json +1 -1
- package/dist/create-host-account.d.ts +17 -0
- package/dist/create-host-account.js +47 -0
- package/dist/create-host-account.js.map +1 -0
- package/dist/daemon.d.ts +23 -0
- package/dist/daemon.js +114 -8
- package/dist/daemon.js.map +1 -1
- package/dist/delivery-outbox.js +7 -0
- package/dist/delivery-outbox.js.map +1 -1
- package/dist/fleet-manager.d.ts +32 -8
- package/dist/fleet-manager.js +146 -31
- package/dist/fleet-manager.js.map +1 -1
- package/dist/general-knowledge/skills/concepts/SKILL.md +1 -1
- package/dist/general-knowledge/skills/kiro-engine-migration/SKILL.md +1 -1
- package/dist/instance-lifecycle.js +29 -1
- package/dist/instance-lifecycle.js.map +1 -1
- package/dist/locale.js +7 -7
- package/dist/public-web-link.d.ts +5 -0
- package/dist/public-web-link.js +8 -0
- package/dist/public-web-link.js.map +1 -1
- package/dist/settings-api.js +5 -17
- package/dist/settings-api.js.map +1 -1
- package/dist/signin-keepalive.d.ts +25 -1
- package/dist/signin-keepalive.js +44 -1
- package/dist/signin-keepalive.js.map +1 -1
- package/dist/ui/accounts-view.js +9 -7
- package/dist/ui/hub-strings.js +6 -6
- package/dist/ui/panel-chat.js +2 -1
- package/dist/ui/panel-fleet.js +7 -1
- package/dist/ui/panel-settings.js +7 -1
- package/dist/ui/settings-access-overview.js +167 -0
- package/dist/ui/settings-access-strings.js +1 -1
- package/dist/ui/settings-devices.js +5 -5
- package/dist/ui/settings-layout.js +3 -1
- package/dist/ui/settings-strings.js +8 -8
- package/dist/ui/shared/app-shell.js +1 -1
- package/dist/ui/shared/app-store.js +2 -0
- package/dist/ui/shared/app.css +50 -12
- package/dist/ui/shared/chat-render.js +17 -5
- package/dist/ui/shared/device-roles.js +1 -1
- package/dist/ui/shared/signin.js +130 -43
- package/dist/ui/shared/usage-dialog.js +27 -15
- package/dist/ui/shared/web-authorize.js +2 -2
- package/dist/ui/signin.html +19 -8
- package/dist/usage/format-rich.js +1 -1
- package/dist/usage/format-rich.js.map +1 -1
- package/dist/usage/usage-api.d.ts +8 -2
- package/dist/usage/usage-api.js +12 -5
- package/dist/usage/usage-api.js.map +1 -1
- package/dist/web-api.d.ts +5 -0
- package/dist/web-api.js +58 -0
- package/dist/web-api.js.map +1 -1
- package/dist/web-backend-login.d.ts +2 -0
- package/dist/web-backend-login.js.map +1 -1
- package/dist/web-remote-access.d.ts +71 -3
- package/dist/web-remote-access.js +197 -6
- package/dist/web-remote-access.js.map +1 -1
- package/package.json +1 -1
- package/dist/ui/shared/signin-authenticator.js +0 -60
- package/dist/ui/signin-authenticator.html +0 -60
package/dist/ui/shared/signin.js
CHANGED
|
@@ -12,9 +12,9 @@
|
|
|
12
12
|
const T = {
|
|
13
13
|
en: {
|
|
14
14
|
signout_unsaved: "Signed out for now, but the change could not be saved: a restart may bring the session back. This page cannot repair session storage.",
|
|
15
|
-
checking: "Checking your session…", title: "Sign in to AgEnD", lead: "Enter your sign
|
|
16
|
-
label: "
|
|
17
|
-
hint: "
|
|
15
|
+
checking: "Checking your session…", title: "Sign in to AgEnD", lead: "Enter your authenticator app’s 6-digit code to sign in automatically.",
|
|
16
|
+
label: "Authenticator or device sign-in code", submit: "Sign in", working: "Signing in…",
|
|
17
|
+
hint: "Paste an 8-character device sign-in code",
|
|
18
18
|
nobot: "No chat bot?", nobot_body: "Ask the operator to run agend web --code on the AgEnD computer.",
|
|
19
19
|
safe: "Page looks wrong after signing in?", safe_body: "Your custom CSS may be hiding something. Add ?safe=1 to the end of the address to load the page without it, then fix it or turn it off in Settings → Look.",
|
|
20
20
|
refused: "The code is invalid or no longer works. Send /web in General, then press a sign-in button for a new code.",
|
|
@@ -42,6 +42,14 @@
|
|
|
42
42
|
hint_outside: "Lost your phone? On the AgEnD computer, choose \u201cSet up again\u201d.",
|
|
43
43
|
refused_outside: "That code didn't work. Check that your phone's clock is right and try the newest code.",
|
|
44
44
|
paused_outside: "Too many wrong codes. Try again in {duration}.",
|
|
45
|
+
totp_refused: "Code not accepted. Try the next code.",
|
|
46
|
+
totp_help: "Sign-in may be limited. If the code is right, use an 8-character code or a signed-in device.",
|
|
47
|
+
unavailable: "Authenticator sign-in is not available here. Paste an 8-character device sign-in code, or use a device you have signed in from before.",
|
|
48
|
+
invalid: "Enter a 6-digit authenticator code or an 8-character device sign-in code.",
|
|
49
|
+
pause_for: "Sign-in is paused. Please wait {duration}, then try again.", pause_button: "Sign-in paused", ready_again: "You can try signing in again.",
|
|
50
|
+
reach_title: "How does my phone reach AgEnD?", reach_lead: "Open the AgEnD address in your phone’s browser:",
|
|
51
|
+
reach_wifi: "Same Wi-Fi: use the computer’s local network address.", reach_private: "Private network, such as Tailscale: connect both devices to that network first.",
|
|
52
|
+
reach_outside: "Outside connection: use the address your admin provides.",
|
|
45
53
|
minutes: "{0} minutes", minute: "1 minute", hours: "{0} hours", hour: "1 hour",
|
|
46
54
|
// #3061: sign in with another device — an 8-character code shown here, approved on a device that is already signed in.
|
|
47
55
|
another: "Sign in with another device", dev_title: "Sign in with another device",
|
|
@@ -55,9 +63,9 @@
|
|
|
55
63
|
},
|
|
56
64
|
"zh-TW": {
|
|
57
65
|
signout_unsaved: "暫時登出了,但變更沒能儲存:重新啟動後這個工作階段可能會回來。這個頁面無法修復工作階段的儲存問題。",
|
|
58
|
-
checking: "正在確認登入狀態…", title: "登入 AgEnD", lead: "
|
|
59
|
-
label: "
|
|
60
|
-
hint: "
|
|
66
|
+
checking: "正在確認登入狀態…", title: "登入 AgEnD", lead: "填入驗證器 App 的 6 位數驗證碼,即可自動登入。",
|
|
67
|
+
label: "驗證碼或裝置登入碼", submit: "登入", working: "登入中…",
|
|
68
|
+
hint: "也可以貼上 8 字元裝置登入碼",
|
|
61
69
|
nobot: "沒有聊天 bot?", nobot_body: "請管理員在 AgEnD 電腦執行 agend web --code。",
|
|
62
70
|
safe: "登入後畫面不對勁?", safe_body: "可能是你的自訂 CSS 把東西藏起來了。在網址最後加上 ?safe=1,就會不套用它地載入;再到「設定 → 外觀」修正或關閉。",
|
|
63
71
|
refused: "裝置登入碼無效或已失效。請在 General 傳 /web,再按登入按鈕取新碼。",
|
|
@@ -80,6 +88,14 @@
|
|
|
80
88
|
hint_outside: "手機遺失?請在 AgEnD 電腦上選「重新設定」。",
|
|
81
89
|
refused_outside: "驗證碼不對。請確認手機時間正確,並輸入最新的驗證碼。",
|
|
82
90
|
paused_outside: "錯誤次數太多,請 {duration} 後再試。",
|
|
91
|
+
totp_refused: "驗證碼未通過;若剛換碼,請等下一組再試。",
|
|
92
|
+
totp_help: "驗證碼正確也可能暫時受限。請改貼 8 字元裝置登入碼,或使用先前登入過的裝置。",
|
|
93
|
+
unavailable: "這裡無法使用驗證器 App 登入。請貼上 8 字元裝置登入碼,或使用先前登入過的裝置。",
|
|
94
|
+
invalid: "請輸入 6 位數驗證碼或 8 字元裝置登入碼。",
|
|
95
|
+
pause_for: "登入已暫停,請等 {duration}後再試。", pause_button: "暫時無法登入", ready_again: "可以再次嘗試登入。",
|
|
96
|
+
reach_title: "如何在手機開啟 AgEnD?", reach_lead: "在手機瀏覽器開啟 AgEnD 網址:",
|
|
97
|
+
reach_wifi: "同一個 Wi-Fi:使用電腦的區網網址。", reach_private: "私人網路(如 Tailscale):兩台裝置先連上同一個網路。",
|
|
98
|
+
reach_outside: "外部連線:使用管理員提供的網址。",
|
|
83
99
|
minutes: "{0} 分鐘", minute: "1 分鐘", hours: "{0} 小時", hour: "1 小時",
|
|
84
100
|
another: "使用其他裝置登入", dev_title: "使用其他裝置登入",
|
|
85
101
|
dev_lead: "在已登入且已驗證擁有者的裝置上,開啟「設定 → 存取與安全」,在「裝置與登入」選「新增裝置」,輸入這組裝置登入碼。",
|
|
@@ -111,8 +127,21 @@
|
|
|
111
127
|
// here (a WSL install) is pointed at its desktop shortcut. Only words change: the page issues nothing itself (D3).
|
|
112
128
|
const local = !outside && /^(localhost|127(\.\d{1,3}){3}|\[?::1\]?)$/i.test((typeof location !== "undefined" && location.hostname) || "");
|
|
113
129
|
const win = local && /Windows/i.test((typeof navigator !== "undefined" && navigator.userAgent) || "");
|
|
114
|
-
const
|
|
130
|
+
const deviceText = (k) => (win && (T[lang][`${k}_local_win`] || T.en[`${k}_local_win`]))
|
|
115
131
|
|| (local && (T[lang][`${k}_local`] || T.en[`${k}_local`])) || (noChat && (T[lang][`${k}_web`] || T.en[`${k}_web`])) || T[lang][k] || T.en[k] || k;
|
|
132
|
+
// Input routing is by the complete code, on every surface; device-code recovery retains its existing local/chat words.
|
|
133
|
+
const t = (k) => ["lead", "label", "hint"].includes(k) ? T[lang][k] : (outside && (T[lang][`${k}_outside`] || T.en[`${k}_outside`])) || deviceText(k);
|
|
134
|
+
function paint(node, text) {
|
|
135
|
+
if (!node) return;
|
|
136
|
+
if (typeof node.replaceChildren !== "function") { node.textContent = text; return; }
|
|
137
|
+
const terms = lang === "zh-TW" ? /(8 字元裝置登入碼|使用先前登入過的裝置|驗證器 App|驗證器|驗證碼|同一個網路|自動登入|每組|立即|直接|核准)/g : /(8-character)/g;
|
|
138
|
+
const parts = text.split(terms);
|
|
139
|
+
if (parts.length === 1) { node.textContent = text; return; }
|
|
140
|
+
node.replaceChildren(...parts.map((part, i) => {
|
|
141
|
+
if (i % 2 === 0) return part;
|
|
142
|
+
const span = document.createElement("span"); span.className = "signin-term"; span.textContent = part; return span;
|
|
143
|
+
}));
|
|
144
|
+
}
|
|
116
145
|
/** A wait as words: "15 minutes" / 「15 分鐘」, "2 hours" / 「2 小時」 (rounded up). */
|
|
117
146
|
const duration = (ms) => {
|
|
118
147
|
const minutes = Math.max(1, Math.ceil(ms / 60000));
|
|
@@ -124,11 +153,9 @@
|
|
|
124
153
|
if (noChat || local) document.querySelectorAll("details.help").forEach((d) => { if (d.querySelector && d.querySelector('[data-i18n="nobot"]')) d.hidden = true; });
|
|
125
154
|
document.documentElement.lang = lang === "zh-TW" ? "zh-Hant" : "en";
|
|
126
155
|
$("checking").setAttribute?.("aria-label", t("checking"));
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
input.setAttribute("pattern", "[0-9 ]*");
|
|
131
|
-
}
|
|
156
|
+
// Also repairs an old cached HTML shell’s numeric/short field constraints.
|
|
157
|
+
$("code").setAttribute("inputmode", "text"); $("code").setAttribute("maxlength", "32"); $("code").setAttribute("placeholder", "");
|
|
158
|
+
$("code").removeAttribute?.("pattern");
|
|
132
159
|
|
|
133
160
|
// #3270: `agend web` opens this page on this computer as /signin#code=XXXX-XXXX. A fragment is never sent to the server, a
|
|
134
161
|
// log or a Referer; it is read here and taken out of the address bar and the history entry BEFORE anything else runs —
|
|
@@ -170,12 +197,18 @@
|
|
|
170
197
|
document.querySelectorAll("[data-i18n]").forEach((el) => {
|
|
171
198
|
const text = t(el.getAttribute("data-i18n"));
|
|
172
199
|
const m = CMD.exec(text);
|
|
173
|
-
if (!m) { el
|
|
200
|
+
if (!m) { paint(el, text); return; }
|
|
174
201
|
const code = document.createElement("code");
|
|
175
202
|
code.textContent = m[0];
|
|
176
203
|
el.replaceChildren(text.slice(0, m.index), code, text.slice(m.index + m[0].length));
|
|
177
204
|
});
|
|
178
205
|
|
|
206
|
+
// New help is optional: new JS still works with cached HTML, and old JS leaves it hidden.
|
|
207
|
+
if ($("reachHelp")) {
|
|
208
|
+
for (const [id, key] of [["reachTitle", "reach_title"], ["reachLead", "reach_lead"], ["reachWifi", "reach_wifi"], ["reachPrivate", "reach_private"], ["reachOutside", "reach_outside"]]) paint($(id), t(key));
|
|
209
|
+
$("reachHelp").hidden = false;
|
|
210
|
+
}
|
|
211
|
+
|
|
179
212
|
// An old deep link, /ui#instance=<name> (#1408 §3): the fragment never reaches the server, and the sign-in page is
|
|
180
213
|
// served at the URL that was asked for, so it is still in location.hash here. Exactly that one form becomes the new
|
|
181
214
|
// path /ui/chat/<name>; any other fragment is dropped. The name is held to the same rule as the server's.
|
|
@@ -337,6 +370,7 @@
|
|
|
337
370
|
$("devQr").hidden = false;
|
|
338
371
|
}
|
|
339
372
|
async function devStart() {
|
|
373
|
+
retireEntries();
|
|
340
374
|
devStop();
|
|
341
375
|
$("form").hidden = true; $("device").hidden = false; $("devNew").hidden = true;
|
|
342
376
|
hideQr();
|
|
@@ -419,7 +453,7 @@
|
|
|
419
453
|
}
|
|
420
454
|
|
|
421
455
|
// What a refused POST /auth/login says (the form's and the fragment's exchange alike): 429 and 5xx are not a wrong code.
|
|
422
|
-
const failureText = (status) => (status === 429 ?
|
|
456
|
+
const failureText = (status) => (status === 429 ? deviceText("paused") : status >= 500 ? deviceText("unconfirmed") : deviceText("refused"));
|
|
423
457
|
|
|
424
458
|
// #3270: the exchange of the code `agend web` put in the fragment. Resolves null once the browser is on its way into the
|
|
425
459
|
// app, else the words for why not — the form then shows them, so an expired or used code never leaves a blank page. The
|
|
@@ -440,38 +474,91 @@
|
|
|
440
474
|
}
|
|
441
475
|
}
|
|
442
476
|
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
const
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
477
|
+
// S-118: one complete value chooses one existing route. Never strip a letter/dash into a TOTP.
|
|
478
|
+
function codeValue() {
|
|
479
|
+
const raw = $("code").value.trim();
|
|
480
|
+
if (/^[0-9]{6}$/.test(raw)) return { path: "/auth/totp", code: raw, wait: /^[2-7]{6}$/.test(raw) };
|
|
481
|
+
if (/^(?:[A-Z2-7]{8}|[A-Z2-7]{4}-[A-Z2-7]{4})$/i.test(raw)) return { path: "/auth/login", code: raw.replace("-", "").toUpperCase(), wait: false };
|
|
482
|
+
return null;
|
|
483
|
+
}
|
|
484
|
+
const autoAttempts = new Set(), activeEntries = new Map();
|
|
485
|
+
let entryTimer = 0, pauseTimer = 0, pausedUntil = 0, entryVersion = 0, latestEntry = null;
|
|
486
|
+
let composing = false, pasteInput = false, entryStopped = false, signedIn = false, observedValue = "";
|
|
487
|
+
const entryKey = (value) => value ? `${value.path}:${value.code}` : `invalid:${$("code").value}`;
|
|
488
|
+
function cancelEntryTimer() { clearTimeout(entryTimer); entryTimer = 0; }
|
|
489
|
+
function retireEntries() {
|
|
490
|
+
cancelEntryTimer(); entryVersion++; latestEntry = null;
|
|
491
|
+
for (const attempt of activeEntries.values()) attempt.controller?.abort();
|
|
492
|
+
activeEntries.clear();
|
|
493
|
+
}
|
|
494
|
+
function entryCurrent(mine) {
|
|
495
|
+
return !entryStopped && !signedIn && !$("form").hidden && mine === latestEntry && mine.version === entryVersion && entryKey(codeValue()) === mine.key;
|
|
496
|
+
}
|
|
497
|
+
function entryMessage(text, hint = "") {
|
|
498
|
+
paint($("msg"), text); $("msg").classList?.remove("ok");
|
|
499
|
+
if ($("authHint")) { paint($("authHint"), hint); $("authHint").hidden = !hint; }
|
|
500
|
+
else if (hint) paint($("msg"), `${text} ${hint}`); // cached HTML still gets the complete recovery guidance
|
|
501
|
+
}
|
|
502
|
+
function entryButton() {
|
|
503
|
+
const paused = pausedUntil > Date.now();
|
|
504
|
+
$("go").disabled = paused || !!(latestEntry && activeEntries.get(latestEntry.key) === latestEntry);
|
|
505
|
+
$("go").textContent = paused ? t("pause_button") : $("go").disabled ? t("working") : t("submit");
|
|
506
|
+
}
|
|
507
|
+
async function submitEntry(manual = false) {
|
|
508
|
+
cancelEntryTimer();
|
|
509
|
+
if (entryStopped || signedIn || $("form").hidden || composing || pausedUntil > Date.now()) return;
|
|
510
|
+
const value = codeValue();
|
|
511
|
+
if (!value) { if (manual) entryMessage(t("invalid")); return; }
|
|
512
|
+
const key = entryKey(value);
|
|
513
|
+
if (activeEntries.has(key) || (!manual && autoAttempts.has(key))) return;
|
|
514
|
+
// Explicit submit may be the first observation of the value (autofill or an old HTML form).
|
|
515
|
+
if (observedValue !== key) { retireEntries(); observedValue = key; }
|
|
516
|
+
autoAttempts.add(key);
|
|
517
|
+
const mine = { key, version: entryVersion, controller: typeof AbortController === "function" ? new AbortController() : null };
|
|
518
|
+
latestEntry = mine; activeEntries.set(key, mine); entryMessage(""); entryButton();
|
|
451
519
|
try {
|
|
452
|
-
const r = await fetch(
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
});
|
|
458
|
-
if (r.ok) { clearBounce(); location.replace(nextTarget()); return; }
|
|
459
|
-
if (outside && r.status === 429) {
|
|
520
|
+
const r = await fetch(value.path, { method: "POST", credentials: "same-origin", headers: { "Content-Type": "application/json" },
|
|
521
|
+
body: JSON.stringify({ code: value.code }), ...(mine.controller ? { signal: mine.controller.signal } : {}) });
|
|
522
|
+
if (!entryCurrent(mine)) return;
|
|
523
|
+
if (r.ok) { signedIn = true; cancelEntryTimer(); clearTimeout(pauseTimer); clearBounce(); location.replace(nextTarget()); return; }
|
|
524
|
+
if (r.status === 429) {
|
|
460
525
|
let wait = Number(r.headers.get("Retry-After")) * 1000;
|
|
461
|
-
try { const body = await r.json(); if (Number.isFinite(body && body.retryAfterMs)
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
526
|
+
try { const body = await r.json(); if (Number.isFinite(body?.retryAfterMs) && body.retryAfterMs > 0) wait = body.retryAfterMs; } catch { /* use the header */ }
|
|
527
|
+
if (!entryCurrent(mine)) return;
|
|
528
|
+
wait = Number.isFinite(wait) && wait > 0 ? wait : 60000;
|
|
529
|
+
pausedUntil = Date.now() + wait;
|
|
530
|
+
entryMessage(t("pause_for").replace("{duration}", duration(wait))); $("msg").classList?.add("ok");
|
|
531
|
+
clearTimeout(pauseTimer);
|
|
532
|
+
pauseTimer = setTimeout(() => {
|
|
533
|
+
if (entryStopped || signedIn) return;
|
|
534
|
+
pausedUntil = 0; entryMessage(t("ready_again")); $("msg").classList?.add("ok"); entryButton();
|
|
535
|
+
}, wait);
|
|
536
|
+
} else if (value.path === "/auth/totp" && r.status === 404) entryMessage(t("unavailable"));
|
|
537
|
+
else if (value.path === "/auth/totp" && r.status === 401) entryMessage(t("totp_refused"), t("totp_help"));
|
|
538
|
+
else entryMessage(failureText(r.status));
|
|
539
|
+
} catch {
|
|
540
|
+
if (entryCurrent(mine)) entryMessage(t("network"));
|
|
541
|
+
} finally {
|
|
542
|
+
if (activeEntries.get(key) === mine) activeEntries.delete(key);
|
|
543
|
+
if (entryCurrent(mine)) { entryButton(); if (!(pausedUntil > Date.now())) $("code").select(); }
|
|
470
544
|
}
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
545
|
+
}
|
|
546
|
+
function entryInput(event = {}) {
|
|
547
|
+
cancelEntryTimer();
|
|
548
|
+
const value = codeValue(), key = entryKey(value);
|
|
549
|
+
if (key !== observedValue) { retireEntries(); observedValue = key; if (!(pausedUntil > Date.now())) entryMessage(""); entryButton(); }
|
|
550
|
+
const pasted = pasteInput || event.inputType === "insertFromPaste"; pasteInput = false;
|
|
551
|
+
if (entryStopped || signedIn || $("form").hidden || composing || event.isComposing || pausedUntil > Date.now() || !value) return;
|
|
552
|
+
if (!pasted && value.wait) entryTimer = setTimeout(() => { submitEntry(); }, 800);
|
|
553
|
+
else void submitEntry();
|
|
554
|
+
}
|
|
555
|
+
$("code").addEventListener("keydown", cancelEntryTimer);
|
|
556
|
+
$("code").addEventListener("paste", () => { cancelEntryTimer(); pasteInput = true; Promise.resolve().then(() => { pasteInput = false; }); });
|
|
557
|
+
$("code").addEventListener("input", entryInput);
|
|
558
|
+
$("code").addEventListener("compositionstart", () => { composing = true; cancelEntryTimer(); });
|
|
559
|
+
$("code").addEventListener("compositionend", () => { composing = false; entryInput(); });
|
|
560
|
+
$("form").addEventListener("submit", (event) => { event.preventDefault(); return submitEntry(true); });
|
|
561
|
+
globalThis.addEventListener?.("pagehide", () => { entryStopped = true; retireEntries(); clearTimeout(pauseTimer); });
|
|
475
562
|
|
|
476
563
|
(async () => {
|
|
477
564
|
// Someone who already has a session is simply let in: the code in the link is not exchanged over it (it stays unspent
|
|
@@ -39,20 +39,16 @@ function expiryText(iso) {
|
|
|
39
39
|
}
|
|
40
40
|
/**
|
|
41
41
|
* #3066 §1: a server line ({ text, i18n }) in this page's language — or, when this tab's strings predate the key (a
|
|
42
|
-
* stale tab), the server's own English text, never the bare key.
|
|
42
|
+
* stale tab), the server's own English text, never the bare key. M-2815: the card no longer draws capacity; kept
|
|
43
|
+
* exported so a module from another release that imports it still links (settings-stale-module-link-3321).
|
|
43
44
|
*/
|
|
44
45
|
export function capacityLine(x) {
|
|
45
46
|
if (!x || typeof x.text !== "string") return "";
|
|
46
47
|
const key = x.i18n && typeof x.i18n.key === "string" ? `view.${x.i18n.key}` : null;
|
|
47
48
|
return key && t(key) !== key ? usageText(x.text, x.i18n) : x.text;
|
|
48
49
|
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
const notes = Array.isArray(c.notes) ? c.notes : [];
|
|
52
|
-
return html`<div class=${`u-cap${c.status === "ok" ? "" : " u-cap-wait"}`}>
|
|
53
|
-
<div class="u-cap-line">${capacityLine(c.line)}</div>
|
|
54
|
-
${notes.map((n, i) => html`<div key=${i} class="u-cap-note">${capacityLine(n)}</div>`)}</div>`;
|
|
55
|
-
}
|
|
50
|
+
// M-2815 (the user): the card shows no measured capacity ("100% ≈ …" and its fleet-only note) — get_usage and the usage
|
|
51
|
+
// report keep it (#3066 §1); a weekly metric's `capacity` is left unread here.
|
|
56
52
|
export function UsageMetric({ m }) {
|
|
57
53
|
const bar = useRef(null);
|
|
58
54
|
const label = usageText(m.label, m.labelI18n);
|
|
@@ -67,8 +63,7 @@ export function UsageMetric({ m }) {
|
|
|
67
63
|
const sub = [note, resetText(m.resetsAt)].filter(Boolean).join(" · ");
|
|
68
64
|
return html`<div class="u-metric"><div class="u-row"><span class="u-label">${label}</span>${word ? html`<span class=${`u-status ${cls}`}>${word}</span>` : null}
|
|
69
65
|
<span class=${`u-pct ${cls}`}>${pct.toFixed(0)}<span class="u-unit">%</span></span></div>
|
|
70
|
-
<div class="u-meter"><div ref=${bar} class=${`u-fill ${cls}`}></div></div>${sub ? html`<div class="u-sub">${sub}</div>` : null}
|
|
71
|
-
${m.capacity ? html`<${UsageCapacity} c=${m.capacity} />` : null}</div>`;
|
|
66
|
+
<div class="u-meter"><div ref=${bar} class=${`u-fill ${cls}`}></div></div>${sub ? html`<div class="u-sub">${sub}</div>` : null}</div>`;
|
|
72
67
|
}
|
|
73
68
|
if (m.type === "dollars") {
|
|
74
69
|
const val = m.limit ? `$${(m.used ?? 0).toFixed(2)} / $${m.limit.toFixed(2)}` : `$${(m.used ?? 0).toFixed(2)}`;
|
|
@@ -149,12 +144,28 @@ export function compactSlots(p) {
|
|
|
149
144
|
const pct = ((p && p.metrics) || []).filter((m) => m && m.type === "percent" && !m.resetPassed);
|
|
150
145
|
const isShort = (m) => Number(m.windowMs) > 0 && m.windowMs < TWO_DAYS;
|
|
151
146
|
const short = pct.filter(isShort).sort((a, b) => a.windowMs - b.windowMs)[0] || null;
|
|
152
|
-
|
|
147
|
+
// M-2815: the long column is the account's own week; a per-model one (scope "model") only when it has nothing else.
|
|
148
|
+
const longest = (list) => list.map((m, i) => ({ m, i }))
|
|
153
149
|
.sort((a, b) => ((Number(b.m.windowMs) || -1) - (Number(a.m.windowMs) || -1)) || a.i - b.i)[0]?.m || null;
|
|
150
|
+
const longs = pct.filter((m) => !isShort(m));
|
|
151
|
+
const long = longest(longs.filter((m) => m.scope !== "model")) || longest(longs);
|
|
154
152
|
return { short, long };
|
|
155
153
|
}
|
|
156
|
-
/**
|
|
157
|
-
|
|
154
|
+
/**
|
|
155
|
+
* The windows a compact line shows, short first; then (M-2815, the user) each per-model weekly ("Fable (weekly)") the
|
|
156
|
+
* server sends, on its own labelled bar — a per-model window under two days stays in the full card.
|
|
157
|
+
*/
|
|
158
|
+
export const compactMetrics = (p) => {
|
|
159
|
+
const { short, long } = compactSlots(p);
|
|
160
|
+
const models = ((p && p.metrics) || []).filter((m) => m && m.type === "percent" && !m.resetPassed && m.scope === "model"
|
|
161
|
+
&& m !== long && Number(m.windowMs) >= TWO_DAYS);
|
|
162
|
+
return [short, long, ...models].filter(Boolean);
|
|
163
|
+
};
|
|
164
|
+
/** A per-model window's tag on the compact line: the model's name ("Fable"), the window's full name in its tooltip. */
|
|
165
|
+
export function modelTag(m) {
|
|
166
|
+
const arg = m && m.labelI18n && Array.isArray(m.labelI18n.args) ? m.labelI18n.args[0] : null;
|
|
167
|
+
return typeof arg === "string" && arg ? arg : String((m && m.label) || "").replace(/\s*\(weekly\)$/i, "");
|
|
168
|
+
}
|
|
158
169
|
/**
|
|
159
170
|
* The logins grouped by provider for the compact view (nine logins, five of them Claude's: the provider once, then a
|
|
160
171
|
* line per login), in the order the person set (↑↓): a group where its first login is, its logins in their order.
|
|
@@ -206,13 +217,14 @@ export function CompactRow({ p, onExpand }) {
|
|
|
206
217
|
const say = stale ? stale.mark : note || tn("usage.no_data");
|
|
207
218
|
const detail = stale ? [stale.mark, stale.detail].filter(Boolean).join(" — ") : say;
|
|
208
219
|
const name = title.profile || title.base;
|
|
209
|
-
|
|
220
|
+
const models = !pools && metrics.some((m) => m.scope === "model");
|
|
221
|
+
return html`<button type="button" class=${`u-crow${p.stale ? " is-stale" : ""}${pools ? " is-pooled" : ""}${models ? " has-models" : ""}`} aria-expanded="false" title=${`${p.name} — ${tn("usageExpand")}`} onClick=${onExpand}>
|
|
210
222
|
<span class="u-crow-head"><span class="u-crow-name">${name}</span>
|
|
211
223
|
${p.plan ? html`<span class="pill u-plan" title=${p.plan}><span aria-hidden="true">${planBadge(p.plan)}</span><span class="sr-only">${p.plan}</span></span>` : null}
|
|
212
224
|
${stale && metrics.length ? html`<span class="u-crow-stale" title=${detail}>${p.cachedAt ? tn("usageCachedAt", { at: usageClock(p.cachedAt) }) : stale.mark}<span class="sr-only"> (${detail})</span></span>` : null}</span>
|
|
213
225
|
${pools ? pools.map((x) => html`<${CompactMeter} key=${x.pool.label} m=${x.worst} tag=${usageText(x.pool.label, x.pool.labelI18n)}
|
|
214
226
|
title=${x.metrics.map((m) => { const c = resetClock(m); return `${usageText(m.label, m.labelI18n)}: ${pctOf(m).toFixed(0)}%${c ? ` (${c})` : ""}`; }).join(" · ")} />`)
|
|
215
|
-
: metrics.length ? metrics.map((m, j) => html`<${CompactMeter} key=${j} m=${m} />`)
|
|
227
|
+
: metrics.length ? metrics.map((m, j) => html`<${CompactMeter} key=${j} m=${m} tag=${m.scope === "model" ? modelTag(m) : undefined} />`)
|
|
216
228
|
: html`<span class=${`u-crow-note${(stale || (p.status === "error" && !p.transient)) ? " is-alert" : ""}`} title=${detail}>${say}</span>`}
|
|
217
229
|
</button>`;
|
|
218
230
|
}
|
|
@@ -55,8 +55,8 @@ register("webauth", {
|
|
|
55
55
|
reason_disabled: "網頁授權已關閉。",
|
|
56
56
|
reason_loopback_only: "只有這台電腦可以授權,而這個瀏覽器不在這台電腦上。",
|
|
57
57
|
reason_no_account: "這個瀏覽器沒有聊天帳號身分。請到 Telegram 或 Discord 的 General 傳送 /web,以你的帳號登入。",
|
|
58
|
-
reason_host_sign_in: "
|
|
59
|
-
reason_not_admin: "你的帳號在這裡不是 fleet
|
|
58
|
+
reason_host_sign_in: "這個瀏覽器已沒有這台電腦的管理員授權。請用這台電腦的新登入碼重新綁定。",
|
|
59
|
+
reason_not_admin: "你的帳號在這裡不是 fleet 管理員。",
|
|
60
60
|
reason_not_admin_session: "訪客無法授權。",
|
|
61
61
|
reason_token_rotated: "儀表板的 token 已變更:請重新登入。",
|
|
62
62
|
reason_public_link: "這個登入無法透過這個連結授權。",
|
package/dist/ui/signin.html
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
<style>
|
|
18
18
|
/* #1408 step 5: the app's tokens (tokens.css), light and dark like every page (theme.js before paint). */
|
|
19
19
|
* { box-sizing: border-box; }
|
|
20
|
-
body { margin: 0; min-height: 100vh; display: flex; align-items:
|
|
20
|
+
body { margin: 0; min-height: 100vh; display: flex; align-items: flex-start; justify-content: center; padding: var(--s-4); padding-top: calc(var(--s-8) + var(--s-4));
|
|
21
21
|
background: var(--bg); color: var(--text); font: var(--fw-regular) var(--fs-md)/var(--lh-md) var(--font-ui); -webkit-font-smoothing: antialiased; }
|
|
22
22
|
main { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 28px 24px; }
|
|
23
23
|
.brand { margin: 0 0 18px; font-size: var(--fs-lg); font-weight: var(--fw-bold); }
|
|
@@ -27,10 +27,10 @@
|
|
|
27
27
|
input { width: 100%; padding: 12px; font: 600 22px/1 var(--font-mono); letter-spacing: .18em; text-align: center;
|
|
28
28
|
text-transform: uppercase; background: var(--bg); color: var(--text); border: 1px solid var(--border-strong); border-radius: var(--r-sm); }
|
|
29
29
|
input:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px var(--accent-dim); }
|
|
30
|
-
button { width: 100%; margin-top: 14px; padding: 12px; font: var(--fw-semibold) var(--fs-md) var(--font-ui); color: var(--on-accent); background: var(--accent-fill);
|
|
30
|
+
button { width: 100%; min-height: var(--tap); margin-top: 14px; padding: 12px; font: var(--fw-semibold) var(--fs-md) var(--font-ui); color: var(--on-accent); background: var(--accent-fill);
|
|
31
31
|
border: 0; border-radius: var(--r-full); cursor: pointer; }
|
|
32
32
|
button:hover:not(:disabled) { opacity: .88; }
|
|
33
|
-
button:disabled { opacity:
|
|
33
|
+
button:disabled { color: var(--text-2); background: var(--surface-2); opacity: 1; cursor: default; }
|
|
34
34
|
button.secondary { margin-top: 10px; color: var(--text); background: transparent; border: 1px solid var(--border-strong); }
|
|
35
35
|
#msg { min-height: 1.5em; margin-top: 14px; font-size: var(--fs-sm); color: var(--danger); }
|
|
36
36
|
#msg.ok { color: var(--text-2); }
|
|
@@ -44,7 +44,16 @@
|
|
|
44
44
|
.devqr { margin: 4px 0 8px; text-align: center; }
|
|
45
45
|
.devqr svg { width: 168px; height: 168px; border-radius: var(--r-sm); border: 1px solid var(--border-strong); }
|
|
46
46
|
.devqr p { margin: 8px 0 0; font-size: var(--fs-xs); color: var(--text-3); }
|
|
47
|
-
.hint { margin
|
|
47
|
+
.hint { margin: var(--s-2) 0 0; font-size: var(--fs-xs); color: var(--text-2); }
|
|
48
|
+
.signin-term { white-space: nowrap; }
|
|
49
|
+
#authHint { margin: var(--s-2) 0 0; color: var(--text-2); font-size: var(--fs-sm); }
|
|
50
|
+
#reachHelp { margin-top: var(--s-4); border-top: 1px solid var(--border); padding-top: var(--s-2); }
|
|
51
|
+
#reachHelp summary { min-height: var(--tap); display: flex; align-items: center; color: var(--text-2); }
|
|
52
|
+
#reachHelp summary::before { content: "▸"; margin-right: var(--s-2); }
|
|
53
|
+
#reachHelp[open] summary::before { content: "▾"; }
|
|
54
|
+
#reachHelp ul { padding-left: var(--s-5); margin: var(--s-2) 0; }
|
|
55
|
+
#reachHelp li { margin: var(--s-2) 0; }
|
|
56
|
+
@media (max-width: 899px) { body { padding-top: var(--s-7); } }
|
|
48
57
|
.hint code, .help code { white-space: nowrap; font-family: var(--font-mono); }
|
|
49
58
|
/* #1854: the operator's way in (no chat bot) — closed until asked for. */
|
|
50
59
|
.help { margin-top: 8px; font-size: var(--fs-xs); color: var(--text-3); }
|
|
@@ -61,15 +70,17 @@
|
|
|
61
70
|
</div>
|
|
62
71
|
<form id="form" hidden autocomplete="off">
|
|
63
72
|
<h1 data-i18n="title">Sign in to AgEnD</h1>
|
|
64
|
-
<p data-i18n="lead">Enter your sign
|
|
65
|
-
<label for="code" data-i18n="label">
|
|
73
|
+
<p data-i18n="lead">Enter your authenticator app’s 6-digit code to sign in automatically.</p>
|
|
74
|
+
<label for="code" data-i18n="label">Authenticator or device sign-in code</label>
|
|
66
75
|
<input id="code" name="code" inputmode="text" autocomplete="one-time-code" autocapitalize="characters"
|
|
67
|
-
autocorrect="off" spellcheck="false" maxlength="
|
|
76
|
+
autocorrect="off" spellcheck="false" maxlength="32" placeholder="" aria-describedby="codeHint" required>
|
|
77
|
+
<div id="codeHint" class="hint" data-i18n="hint">Paste an 8-character device sign-in code</div>
|
|
68
78
|
<button id="go" type="submit" data-i18n="submit">Sign in</button>
|
|
69
79
|
<button id="resend" type="button" class="secondary" hidden data-i18n="resend">Send me a new code</button>
|
|
70
80
|
<button id="another" type="button" class="secondary" hidden data-i18n="another">Sign in with another device</button>
|
|
71
81
|
<div id="msg" role="alert" aria-live="polite"></div>
|
|
72
|
-
<
|
|
82
|
+
<p id="authHint" hidden></p>
|
|
83
|
+
<details id="reachHelp" class="help" hidden><summary id="reachTitle">How does my phone reach AgEnD?</summary><p id="reachLead"></p><ul><li id="reachWifi"></li><li id="reachPrivate"></li><li id="reachOutside"></li></ul></details>
|
|
73
84
|
<details class="help"><summary data-i18n="nobot">No chat bot?</summary><p data-i18n="nobot_body">Ask the operator to run <code>agend web --code</code> on the AgEnD computer.</p></details>
|
|
74
85
|
<details class="help"><summary data-i18n="safe">Page looks wrong after signing in?</summary><p data-i18n="safe_body">Your custom CSS may be hiding something. Add ?safe=1 to the end of the address to load the page without it, then fix it or turn it off in Settings → Web appearance.</p></details>
|
|
75
86
|
</form>
|
|
@@ -79,7 +79,7 @@ function toBlocks(payload) {
|
|
|
79
79
|
: null,
|
|
80
80
|
okHint: usageStaleText(p) ?? ((p.status === "ok" || p.stale) && p.hint ? usageText(p.hint, p.hintI18n) : null),
|
|
81
81
|
lines: p.status === "ok"
|
|
82
|
-
? p.metrics.filter(isVisibleUsageMetric).map(metricLine).filter((l) => l !== null)
|
|
82
|
+
? p.metrics.filter((m) => isVisibleUsageMetric(m, p)).map(metricLine).filter((l) => l !== null)
|
|
83
83
|
: [],
|
|
84
84
|
}));
|
|
85
85
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"format-rich.js","sourceRoot":"","sources":["../../src/usage/format-rich.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,oBAAoB,EAAqB,MAAM,gBAAgB,CAAC;AACzE,OAAO,EAAE,CAAC,EAAE,MAAM,cAAc,CAAC;AACjC,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,cAAc,EAAE,YAAY,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAE1H,MAAM,SAAS,GAAG,EAAE,CAAC;AAErB,8EAA8E;AAC9E,MAAM,UAAU,QAAQ,CAAC,OAAe;IACtC,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,GAAG,GAAG,GAAG,SAAS,CAAC,CAAC;IACjF,OAAO,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,GAAG,CAAC,MAAM,CAAC,SAAS,GAAG,MAAM,CAAC,CAAC;AAC7D,CAAC;AAED,SAAS,SAAS,CAAC,CAAgB;IACjC,0EAA0E;IAC1E,IAAI,CAAC,CAAC,KAAK;QAAE,OAAO,IAAI,CAAC;IACzB,4EAA4E;IAC5E,IAAI,CAAC,CAAC,SAAS;QAAE,OAAO,IAAI,CAAC;IAC7B,IAAI,CAAC,CAAC,MAAM,KAAK,OAAO;QAAE,OAAO,IAAI,CAAC;IACtC,IAAI,CAAC,CAAC,MAAM,KAAK,gBAAgB;QAAE,OAAO,GAAG,CAAC;IAC9C,6EAA6E;IAC7E,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C,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,GAAG,WAAW,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;QACvF,CAAC;QACD,IAAI,CAAC,CAAC,MAAM;YAAE,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;IAC/C,CAAC;IACD,OAAO,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACxB,CAAC"}
|
|
@@ -32,8 +32,14 @@ export type UsagePayload = {
|
|
|
32
32
|
providers: ProviderUsage[];
|
|
33
33
|
refreshing?: boolean;
|
|
34
34
|
};
|
|
35
|
-
/**
|
|
36
|
-
|
|
35
|
+
/**
|
|
36
|
+
* Keep primary account limits even at zero; hide only unused per-model noise (another vendor's 0% model quota, e.g.
|
|
37
|
+
* Codex-Spark). M-2815 (the user): a Claude login's per-model weekly ("Fable (weekly)") is shown even at 0% — it is the
|
|
38
|
+
* limit that model will hit, and the card has room for it. `provider` is the row the metric belongs to.
|
|
39
|
+
*/
|
|
40
|
+
export declare function isVisibleUsageMetric(metric: UsageMetric, provider?: {
|
|
41
|
+
id: string;
|
|
42
|
+
}): boolean;
|
|
37
43
|
/** Map runtime backend names to the subscription provider row they consume (cli-registry.ts: `host.usage.providerId`); null for a backend with no row. */
|
|
38
44
|
export declare function usageProviderIdForBackend(backend: string | undefined): string | null;
|
|
39
45
|
/** Filter a cached all-provider snapshot without mutating the shared cache. */
|
package/dist/usage/usage-api.js
CHANGED
|
@@ -9,13 +9,20 @@ import { t } from "../locale.js";
|
|
|
9
9
|
import { usageExpiryText, usageResetSinceText, usageResetText, usageRowName, usageStaleText, usageText } from "./i18n.js";
|
|
10
10
|
import { guestRequestOf } from "../web-guest-access.js";
|
|
11
11
|
import { quotaHistoryOffForTests, recordQuotaReadings } from "./quota-history.js";
|
|
12
|
-
/**
|
|
13
|
-
|
|
12
|
+
/**
|
|
13
|
+
* Keep primary account limits even at zero; hide only unused per-model noise (another vendor's 0% model quota, e.g.
|
|
14
|
+
* Codex-Spark). M-2815 (the user): a Claude login's per-model weekly ("Fable (weekly)") is shown even at 0% — it is the
|
|
15
|
+
* limit that model will hit, and the card has room for it. `provider` is the row the metric belongs to.
|
|
16
|
+
*/
|
|
17
|
+
export function isVisibleUsageMetric(metric, provider) {
|
|
18
|
+
if (metric.scope === "model" && provider && isClaudeUsageRow(provider.id))
|
|
19
|
+
return true;
|
|
14
20
|
return !(metric.scope === "model"
|
|
15
21
|
&& metric.type === "percent"
|
|
16
22
|
&& typeof metric.used === "number"
|
|
17
23
|
&& metric.used <= 0);
|
|
18
24
|
}
|
|
25
|
+
const isClaudeUsageRow = (id) => id === "claude" || id.startsWith("claude:");
|
|
19
26
|
/** Map runtime backend names to the subscription provider row they consume (cli-registry.ts: `host.usage.providerId`); null for a backend with no row. */
|
|
20
27
|
export function usageProviderIdForBackend(backend) {
|
|
21
28
|
return hostFacts(backend, "usage")?.providerId ?? null;
|
|
@@ -32,7 +39,7 @@ export function filterUsageProviders(payload, providerIds, opts = {}) {
|
|
|
32
39
|
.filter(provider => !active || active.has(provider.id) || (opts.hostLogins === true && isHostLoginUsageProvider(provider.id)))
|
|
33
40
|
.map(provider => ({
|
|
34
41
|
...provider,
|
|
35
|
-
metrics: provider.metrics.filter(isVisibleUsageMetric),
|
|
42
|
+
metrics: provider.metrics.filter(m => isVisibleUsageMetric(m, provider)),
|
|
36
43
|
})),
|
|
37
44
|
};
|
|
38
45
|
}
|
|
@@ -537,7 +544,7 @@ export function formatUsageSummary(payload) {
|
|
|
537
544
|
lines.push(`· ${name}: ${t("usage.value.unlimited")}`);
|
|
538
545
|
continue;
|
|
539
546
|
}
|
|
540
|
-
const parts = provider.metrics.filter(isVisibleUsageMetric).map(formatMetric).filter(Boolean);
|
|
547
|
+
const parts = provider.metrics.filter(m => isVisibleUsageMetric(m, provider)).map(formatMetric).filter(Boolean);
|
|
541
548
|
const marked = usageStaleText(provider);
|
|
542
549
|
const staleness = marked ? ` (${marked})` : provider.hint ? ` (${usageText(provider.hint, provider.hintI18n)})` : "";
|
|
543
550
|
lines.push(`· ${name}: ${parts.length ? parts.join(" | ") : t("usage.no_data")}${staleness}`);
|
|
@@ -597,7 +604,7 @@ export function formatDiscordUsageActivity(payload) {
|
|
|
597
604
|
// A stale-while-rate-limited row has the old metrics but says so in its
|
|
598
605
|
// hint. Do not turn an old number into a falsely live presence.
|
|
599
606
|
const percent = provider.metrics
|
|
600
|
-
.filter(isVisibleUsageMetric)
|
|
607
|
+
.filter(m => isVisibleUsageMetric(m, provider))
|
|
601
608
|
.filter(metric => metric.type === "percent" && typeof metric.used === "number")
|
|
602
609
|
.sort((a, b) => Number(/weekly/i.test(b.label)) - Number(/weekly/i.test(a.label)))[0];
|
|
603
610
|
if (!percent)
|