diff --git a/internal/cli/accounts_cli.go b/internal/cli/accounts_cli.go index ba4933cb6..5cbb86868 100644 --- a/internal/cli/accounts_cli.go +++ b/internal/cli/accounts_cli.go @@ -360,7 +360,7 @@ func accountRows(ls []provider.Login, now time.Time) []accountRow { // a pool's own windows stand in for the models' drawing on it, // as the usage page shows them for _, w := range provider.PooledWindows(q.Windows) { - s := quotaSpan{Name: w.Name, Used: w.Used, Remaining: max(0, 100-w.Used), ResetsAt: w.ResetsAt, Display: w.Display, Pool: w.Pool} + s := quotaSpan{Name: w.Name, Used: w.Used, Remaining: max(0, 100-w.Used), ResetsAt: w.ResetsAt, Display: w.Display, Text: w.Text, Pool: w.Pool} if s.ResetsAt == nil && w.ResetSecs > 0 { t := now.Add(time.Duration(w.ResetSecs) * time.Second) s.ResetsAt = &t @@ -382,7 +382,10 @@ func quotaCell(w quotaSpan, now time.Time) string { return name + " unlimited" } cell := fmt.Sprintf("%s %.0f%%", name, w.Used) - if w.Display != "" { + if w.Text { + // a row of text alone has no share to tell + cell = name + " " + w.Display + } else if w.Display != "" { cell += " (" + w.Display + ")" } if w.ResetsAt != nil { diff --git a/internal/cli/accounts_cli_test.go b/internal/cli/accounts_cli_test.go index 6ef4a4c08..0e3de619f 100644 --- a/internal/cli/accounts_cli_test.go +++ b/internal/cli/accounts_cli_test.go @@ -143,6 +143,14 @@ func TestQuotaCell(t *testing.T) { if got := quotaCell(quotaSpan{Name: "Limit", Unlimited: true}, now); got != "Limit unlimited" { t.Fatalf("unlimited: %q", got) } + // a plugin's row of text alone is its text, not 0% (its used 0) + if got := quotaCell(quotaSpan{Name: "积分余额", Display: "1,234 积分", Text: true}, now); got != "积分余额 1,234 积分" { + t.Fatalf("text: %q", got) + } + // and the status line's cell too + if got := statuslineCard(provider.Quota{Provider: "autoclaw-plugin", Windows: []provider.QuotaSpan{{Name: "积分余额", Display: "1,234 积分", Text: true}, {Name: "5 hours", Used: 40}}}, now); got != "autoclaw-plugin 积分余额 1,234 积分 5h 40%" { + t.Fatalf("status line: %q", got) + } } // accountRows shows a pool's own windows in place of its models', as the diff --git a/internal/cli/statusline_cli.go b/internal/cli/statusline_cli.go index f19972a7c..6eb480354 100644 --- a/internal/cli/statusline_cli.go +++ b/internal/cli/statusline_cli.go @@ -155,6 +155,9 @@ func statuslineCard(q provider.Quota, now time.Time) string { switch { case w.Unlimited: cells = append(cells, n+" ∞") + case w.Text: + // a row of text alone (a plugin's balance) has no share + cells = append(cells, n+" "+w.Display) case w.ResetsAt != nil && !w.ResetsAt.After(now): // its window has started again since it was read cells = append(cells, n+" 0%") diff --git a/internal/gui/assets/app.js b/internal/gui/assets/app.js index 8f75c413b..7b4e7b156 100644 --- a/internal/gui/assets/app.js +++ b/internal/gui/assets/app.js @@ -804,7 +804,7 @@ function renderProfiles() { c._profile = p.name; if (profilePending.has(p.name)) c.classList.add("pending"); const lib = profileLibrary(p.library); - c.title = [p.inUse && t("In use"), p.summary, lib].filter(Boolean).join("\n"); + c.title = tipLines(p.inUse && t("In use"), p.summary, lib); // the one the setup is now, ticked as a menu ticks the item in effect if (p.inUse) { c.classList.add("cur"); @@ -13551,7 +13551,7 @@ function accountQuota(data, user, capFor = () => 0, settable = null) { if (q?.resets?.count && !q.error) { const words = resetsWords(q.resets); const resets = el("span", "aq-w aq-resets"); - resets.title = [words.textContent, words.title].filter(Boolean).join("\n"); + resets.title = tipLines(words.textContent, words.title); resets.append(words.querySelector(".resets-n")); line.append(resets); } @@ -13580,23 +13580,23 @@ function accountQuota(data, user, capFor = () => 0, settable = null) { if (!ws.length) { line.append(el("span", "aq-none", t("Unlimited"))); return line; } if (ws.some((w) => w.members)) return poolLine(line, ws, q, capFor, settable); line.title = ws.slice(2).map((w) => w.tiers ? tiersText(w) : t(w.name) + " " + quotaText(w)).join(ws !== counted ? "\n" : " · "); - if (q.asOf) line.title = [line.title, asOfText(q)].filter(Boolean).join("\n"); + if (q.asOf) line.title = tipLines(line.title, asOfText(q)); for (const w of ws.slice(0, 2)) { - const used = Math.max(0, Math.min(100, w.used)); + const used = to100(w.used); const m = el("span", "aq-w" + (used >= 90 ? " full" : "")); const track = el("span", "aq-track"); const fill = el("i"); fill.style.width = quotaFill(w) + "%"; track.append(fill); capMark(track, w, capFor(w)); - m.append(el("span", "aq-n", t(w.name)), track, el("b", "", quotaText(w))); + m.append(el("span", "aq-n", t(w.name)), ...(w.text ? [] : [track]), el("b", "", quotaText(w))); if (w.resetsAt) { const at = new Date(w.resetsAt); m.title = resetText(at, at.toLocaleString(intlLang())); if (used >= 80) m.append(el("span", "aq-r", resetInText(at))); } const out = runsOutText(w, (at) => at.toLocaleString(intlLang())); - if (out) m.title = [m.title, out].filter(Boolean).join("\n"); + if (out) m.title = tipLines(m.title, out); if (w.tiers) m.title = tiersText(w); line.append(settable ? settable(m, w) : m); } @@ -13981,13 +13981,16 @@ setInterval(refreshLanes, 2000); // every meter and the menu bar, kept in the settings (#122). The vendor's // own count, where it gives one, stands before the percentage. let quotaLeft = false; +function to100(v) { return Math.max(0, Math.min(100, v)); } +function tipLines(...a) { return a.filter(Boolean).join("\n"); } function quotaFill(w) { - const used = Math.round(Math.max(0, Math.min(100, w.used))); + const used = Math.round(to100(w.used)); return quotaLeft ? 100 - used : used; } function quotaText(w) { if (w.unlimited) return t("Unlimited"); - const used = Math.max(0, Math.min(100, w.used)); + if (w.text) return w.display; + const used = to100(w.used); const n = quotaLeft ? 100 - used : used; const pct = t(quotaLeft ? "{n} left" : "{n} used", { n: (Number.isInteger(n) ? n : n.toFixed(1)) + "%" }); const count = quotaCount(w); @@ -14004,7 +14007,7 @@ function quotaPace(w, now = Date.now()) { if (w.unlimited || w.historyMissing || !w.startsAt || !w.resetsAt) return null; const s = Date.parse(w.startsAt), e = Date.parse(w.resetsAt); if (!(e > s) || now < s || now >= e) return null; - const d = Math.max(0, Math.min(100, w.used)) - (100 * (now - s)) / (e - s); + const d = to100(w.used) - (100 * (now - s)) / (e - s); const n = Math.round(quotaLeft ? -d : d); return { n: n === 0 ? 0 : n, over: Math.round(d) > 0, under: Math.round(d) < 0, by: Math.abs(Math.round(d)) }; } @@ -16340,7 +16343,7 @@ function quotaSpan(lines, range, now) { // new subpath at each cycle's start; the point before x0 and the one after // x1 go along, so the line reaches the box's edges function quotaPaths(points, x0, x1, w, h) { - const X = (t) => ((t - x0) / (x1 - x0)) * w, Y = (v) => h - (Math.max(0, Math.min(100, v)) / 100) * h; + const X = (t) => ((t - x0) / (x1 - x0)) * w, Y = (v) => h - (to100(v) / 100) * h; let d = "", prev = null; for (let i = 0; i < points.length; i++) { const p = points[i]; @@ -16477,7 +16480,7 @@ function quotaCurve(sub) { pace.textContent = p ? quotaEtaText(longest, now) : ""; // which window it is, and the instant with its year, behind a line // that holds day and minute and is cut short rather than wrapped - pace.title = p ? [shown.length > 1 ? longest.label : "", pace.textContent, p.out != null ? new Date(p.out).toLocaleString(intlLang()) : ""].filter(Boolean).join("\n") : ""; + pace.title = p ? tipLines(shown.length > 1 ? longest.label : "", pace.textContent, p.out != null ? new Date(p.out).toLocaleString(intlLang()) : "") : ""; }; box.append(head, g, axis, legend); box.draw(); @@ -16623,7 +16626,7 @@ function sparkGap(points, start, reset, now, w, h) { } if (pts.length < 2) return null; const X = (at) => ((at - start) / (reset - start)) * w; - const Y = (v) => h - (Math.max(0, Math.min(100, v)) / 100) * h; + const Y = (v) => h - (to100(v) / 100) * h; const E = (at) => ((at - start) / (reset - start)) * h; // the even burn's y const a = pts[0].at, b = pts[pts.length - 1].at; const poly = pts.map((p) => X(p.at).toFixed(1) + "," + Y(p.left).toFixed(1)) @@ -17316,9 +17319,10 @@ function panelQuotaCard(q) { const balance = q.balance && balanceRow(q, "What is left on the account besides its windows", false); // a pool's 5-hour and weekly rings, every pool's (a third pool once left // Claude's out: 01huadalang on Discord), else three - const fam = familyWindows(q.windows.filter((w) => !w.unlimited)); - if (!fam.length && q.windows.some((w) => w.unlimited)) { - card.append(pqLine(t("Unlimited"), q)); + const fam = familyWindows(q.windows.filter((w) => !w.unlimited && !w.text)); + const tx = q.windows.filter((w) => w.text).map((w) => t(w.name) + " " + w.display).join(" · "); + if (!fam.length && (tx || q.windows.some((w) => w.unlimited))) { + card.append(pqLine(tx || t("Unlimited"), q)); if (balance) card.append(balance); return card; } @@ -17346,7 +17350,7 @@ function panelQuotaCard(q) { card.append(pqLine(say, q)); const rings = el("span", "pq-rings" + (ws.length > 4 ? " many" : "")); for (const w of ws) { - const used = Math.max(0, Math.min(100, w.used)); + const used = to100(w.used); const r = el("span", "pq-ring" + (used >= 90 ? " full" : "")); const dial = el("span", "pq-dial"); dial.style.setProperty("--p", quotaFill(w)); @@ -18036,7 +18040,7 @@ function balanceShown(q) { // balanceMeter: a balance field's percent, as a meter. function balanceMeter(percent) { - const share = Math.max(0, Math.min(100, percent)); + const share = to100(percent); const track = el("div", "quota-track" + (share >= 90 ? " full" : "")); const fill = el("i"); fill.style.width = share + "%"; @@ -18308,7 +18312,7 @@ function quotaWindows(sub) { if (w.historyMissing) track.style.visibility = "hidden"; track.append(fill); quota.append(labels); - if (!w.unlimited) quota.append(track); + if (!w.unlimited && !w.text) quota.append(track); // when it starts again, on the clock and how long until then let r = null; if (w.resetsAt) { @@ -18332,7 +18336,7 @@ function quotaWindows(sub) { if (!r) quota.append(r = el("div", "quota-reset")); else r.append(" · "); r.append(el("span", "", out + " ·"), " ", el("span", "", untilText(new Date(w.runsOutAt)))); - quota.title = [quota.title, runsOutText(w, (at) => at.toLocaleString(intlLang()))].filter(Boolean).join("\n"); + quota.title = tipLines(quota.title, runsOutText(w, (at) => at.toLocaleString(intlLang()))); } // what the whole window holds, by what magpie routed in it (Chiao), on // the reset's line, so the window keeps its three rows @@ -18353,7 +18357,7 @@ function quotaWindows(sub) { // a model family's figure: its models, level by level, in its tooltip if (w.tiers) quota.title = t("{family}: the most used of its models", { family: w.name }) + "\n" + tiersText(w); // a pool's: when it starts again, and the models it counts - if (w.members) quota.title = [quota.title, poolTip(w)].filter(Boolean).join("\n"); + if (w.members) quota.title = tipLines(quota.title, poolTip(w)); windows.append(quota); } quotaFit.observe(windows); @@ -18441,7 +18445,7 @@ function ledGroupSpeed(x) { const [a, b] = measured && floor && kf > kv ? [floor, measured] : [measured || floor, measured && floor]; const say = (p) => p.count ? p.head + " · " + p.count : p.head; const main = say(a), other = b ? say(b) : ""; - return { v: a.s, text: other ? t("{a}; {b}", { a: main, b: other }) : main, main, mainParts: a.count ? [a.head, " " + a.count] : [a.head], other, title: [a.title, b?.title].filter(Boolean).join("\n") }; + return { v: a.s, text: other ? t("{a}; {b}", { a: main, b: other }) : main, main, mainParts: a.count ? [a.head, " " + a.count] : [a.head], other, title: tipLines(a.title, b?.title) }; } // their mean wait for the first token, 0 for none const ledTTFT = (x) => x?.timed > 0 ? x.ttft_ms / x.timed : 0; diff --git a/internal/gui/tests/quota-text-row.test.cjs b/internal/gui/tests/quota-text-row.test.cjs new file mode 100644 index 000000000..0775b04fd --- /dev/null +++ b/internal/gui/tests/quota-text-row.test.cjs @@ -0,0 +1,78 @@ +// Run with Node's test runner and Playwright on the module path; see README.md. +// A plugin's usage row that is its text alone (the server's text: an +// aside with a display and nothing counted, as AutoClaw's 积分余额, Cline's +// balance or Cursor's Auto + Composer note) reads as that text: no meter, +// no ring and no "100% left" or "0% used" after it. Before, its used 0 drew +// an empty meter and "· 100% left". A counted window beside it is drawn +// as before. English and Chinese; no backend, the API is faked here. +const assert = require("node:assert/strict"); +const fs = require("node:fs/promises"); +const path = require("node:path"); +const { test } = require("node:test"); +const { chromium, webkit } = require("playwright"); + +const assets = path.resolve(__dirname, "../assets"); + +function serve(lang) { + const settings = { theme: "light", lang, tray: "panel" }; + return async (route) => { + const url = new URL(route.request().url()); + const json = (data) => route.fulfill({ json: data }); + if (url.pathname === "/boot.js") return route.fulfill({ contentType: "text/javascript", body: `window.bootPrefs = {lang:"${lang}",theme:"light",web:false};` }); + if (url.pathname === "/wails/runtime.js") return route.fulfill({ contentType: "text/javascript", body: "export const Window = {};" }); + if (url.pathname === "/api/state") return json({ agents: [], profiles: [], settings }); + if (url.pathname === "/api/settings") return json(settings); + if (url.pathname === "/api/groups") return json({ groups: [], models: [] }); + if (url.pathname === "/api/plugins") return json({ plugins: [] }); + if (url.pathname.startsWith("/api/")) return json({}); + const file = path.join(assets, url.pathname === "/" ? "index.html" : url.pathname); + const contentType = { ".html": "text/html", ".js": "text/javascript", ".css": "text/css", ".svg": "image/svg+xml", ".png": "image/png" }[path.extname(file)]; + await route.fulfill({ body: await fs.readFile(file), contentType }); + }; +} + +for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", "webkit"])) { + for (const lang of ["en", "zh"]) { + test(`${engine} ${lang}: a usage row of text alone shows its text only`, async (t) => { + const browser = await (engine === "webkit" ? webkit.launch() : chromium.launch({ channel: "chromium" })); + t.after(() => browser.close()); + const page = await (await browser.newContext({ viewport: { width: 900, height: 700 } })).newPage(); + const errors = []; + page.on("pageerror", (e) => errors.push(e.message)); + await page.route("**/*", serve(lang)); + await page.goto("http://magpie.test/"); + await page.waitForFunction(() => typeof panelQuotaCard === "function"); + const got = await page.evaluate(() => { + const read = (windows) => { + const q = { windows, name: "AutoClaw", user: "test" }; + const row = accountQuota({ test: q }, "test"), panel = panelQuotaCard(q), usage = quotaWindows(q); + return { + row: row.textContent, meters: row.querySelectorAll(".aq-track").length, + panel: panel.textContent, rings: panel.querySelectorAll(".pq-ring").length, + usage: usage.textContent, tracks: usage.querySelectorAll(".quota-track").length, + text: quotaText(windows[windows.length - 1]), + }; + }; + const balance = { name: "积分余额", used: 0, display: "1,234 积分", text: true }; + return { alone: read([balance]), beside: read([{ name: "5 hours", used: 40 }, balance]) }; + }); + const { alone, beside } = got; + assert.equal(alone.text, "1,234 积分"); + for (const [where, s] of Object.entries({ row: alone.row, panel: alone.panel, usage: alone.usage })) { + assert.match(s, /1,234 积分/, where); + assert.doesNotMatch(s, /%/, where); + } + assert.equal(alone.meters, 0); + assert.equal(alone.rings, 0); + assert.equal(alone.tracks, 0); + // the counted window keeps its meter, ring and share; the text row none + assert.equal(beside.text, "1,234 积分"); + assert.equal(beside.meters, 1); + assert.equal(beside.rings, 1); + assert.equal(beside.tracks, 1); + assert.match(beside.usage, /1,234 积分/); + assert.equal((beside.usage.match(/%/g) || []).length, 1, beside.usage); + assert.deepEqual(errors, []); + }); + } +} diff --git a/internal/provider/plugin_usage.go b/internal/provider/plugin_usage.go index 6c259a75d..f1f3bcdf8 100644 --- a/internal/provider/plugin_usage.go +++ b/internal/provider/plugin_usage.go @@ -158,6 +158,10 @@ func quotaOfPlugin(q SubscriptionQuota, u plugin.Usage) SubscriptionQuota { w := QuotaWindow{Name: x.Name, Used: x.Used, ResetSecs: x.ResetSecs, Display: x.Display, Amount: x.Amount, Limit: x.Limit, Unit: x.Unit, Span: time.Duration(x.Span * float64(time.Second)), Model: strings.ToLower(x.Model), Aside: x.Aside} + // a row set aside with text and nothing counted is that text: a + // window that counts nothing yet says 0 with a count, or with no + // text, and one that stops the account is a reading at 0 + w.Text = x.Aside && x.Display != "" && x.Used == 0 && x.Amount == 0 && x.Limit == 0 if t, err := time.Parse(time.RFC3339, x.ResetsAt); err == nil { w.ResetsAt = &t } diff --git a/internal/provider/plugin_usage_text_test.go b/internal/provider/plugin_usage_text_test.go new file mode 100644 index 000000000..91cd3d0f0 --- /dev/null +++ b/internal/provider/plugin_usage_text_test.go @@ -0,0 +1,40 @@ +package provider + +import ( + "encoding/json" + "strings" + "testing" + "time" + + "github.com/yetone/magpie/internal/plugin" +) + +// A plugin's row set aside with text and nothing counted (AutoClaw's +// 积分余额, Cline's balance, Cursor's Auto + Composer note) is that text: +// QuotaWindow.Text, carried to /api/quotas' span, so the GUI, TUI and CLI +// don't read its used 0 as "100% left". A window that counts, a 0 with a +// limit, and one not set aside (Cursor's On-demand "$0 / $20", a real 0%) +// are readings and stay so. +func TestPluginTextRowIsText(t *testing.T) { + q := quotaOfPlugin(SubscriptionQuota{Provider: "autoclaw-plugin", User: "u"}, plugin.Usage{Windows: []plugin.UsageWindow{ + {Name: "积分余额", Display: "1,234 积分", Aside: true}, + {Name: "5 hours", Used: 40, Display: "40 / 100"}, + {Name: "Credits", Display: "0 / 50", Limit: 50, Aside: true}, + {Name: "On-demand", Display: "$0 / $20"}, + {Name: "Bare", Aside: true}, + }}) + want := []bool{true, false, false, false, false} + for i, w := range q.Windows { + if w.Text != want[i] { + t.Errorf("%s: Text %v", w.Name, w.Text) + } + } + r := quotaReport([]SubscriptionQuota{q}, nil, nil, time.Now()) + if len(r) != 1 || len(r[0].Windows) != 5 || !r[0].Windows[0].Text || r[0].Windows[1].Text { + t.Fatalf("report %+v", r) + } + b, _ := json.Marshal(r[0].Windows[:2]) + if s := string(b); strings.Count(s, `"text":true`) != 1 { + t.Fatalf("json %s", s) + } +} diff --git a/internal/provider/quotas.go b/internal/provider/quotas.go index 06435b08e..fbfe24b1b 100644 --- a/internal/provider/quotas.go +++ b/internal/provider/quotas.go @@ -124,6 +124,9 @@ type QuotaSpan struct { Remaining float64 `json:"remaining"` ResetsAt *time.Time `json:"resetsAt,omitempty"` Display string `json:"display,omitempty"` // the vendor's own count, "1.2k / 3k" + // Text: the window is its Display alone, Used and Remaining no + // reading (QuotaWindow.Text) + Text bool `json:"text,omitempty"` // Amount of Limit in Unit: the window's count, used, when the vendor // counts it so ("credits") Amount float64 `json:"amount,omitempty"` @@ -185,7 +188,7 @@ func quotaReport(subs, plans, balances []SubscriptionQuota, now time.Time) []Quo // a pool's own windows stand in for the models' drawing on it, // as the usage page shows them for _, w := range PooledWindows(q.Windows) { - s := QuotaSpan{Unlimited: w.Unlimited, Name: w.Name, Used: w.Used, Remaining: max(0, 100-w.Used), ResetsAt: w.ResetsAt, Display: w.Display, + s := QuotaSpan{Unlimited: w.Unlimited, Name: w.Name, Used: w.Used, Remaining: max(0, 100-w.Used), ResetsAt: w.ResetsAt, Display: w.Display, Text: w.Text, Amount: w.Amount, Limit: w.Limit, Unit: w.Unit, Pool: w.Pool, Holds: w.Holds, HoldsWhy: w.HoldsWhy} if s.ResetsAt == nil && w.ResetSecs > 0 { t := now.Add(time.Duration(w.ResetSecs) * time.Second) diff --git a/internal/provider/subscription_usage.go b/internal/provider/subscription_usage.go index 1d501ebab..012e69763 100644 --- a/internal/provider/subscription_usage.go +++ b/internal/provider/subscription_usage.go @@ -33,6 +33,13 @@ type QuotaWindow struct { ResetsAt *time.Time `json:"resetsAt,omitempty"` ResetSecs int64 `json:"resetSecs,omitempty"` Display string `json:"display,omitempty"` + // Text is set on a window that is its Display alone, with no share + // to tell: a plugin's row of what an account holds or has done + // (AutoClaw's 积分余额 and 每日签到, Cursor's on-demand spend, ZCode's + // gift to claim), which plugins send set aside with used 0 and no + // count. Its Used is no reading, so it is told as its text, never as + // "100% left". + Text bool `json:"text,omitempty"` // Amount of Limit is the window's own count in Unit, when the vendor // counts it so (WorkBuddy's credits): Used is Amount as a share of // Limit. The GUI says it as used or left, as it says the share (#659). diff --git a/internal/tui/pages.go b/internal/tui/pages.go index a2c24388f..624045b3a 100644 --- a/internal/tui/pages.go +++ b/internal/tui/pages.go @@ -1440,6 +1440,10 @@ func quotaCell(w provider.QuotaWindow, left bool, now time.Time) string { pct = c + " · " + pct } c := sMuted.Render(w.Name) + " " + fill.Render(strings.Repeat("█", on)) + sFaint.Render(strings.Repeat("░", cells-on)) + " " + sText.Render(pct) + if w.Text { + // a row of text alone: no meter, no share to tell + c = sMuted.Render(w.Name) + " " + sText.Render(w.Display) + } var at time.Time if w.ResetsAt != nil { at = *w.ResetsAt diff --git a/internal/tui/usage_test.go b/internal/tui/usage_test.go index 2730b6c44..a66f80ee4 100644 --- a/internal/tui/usage_test.go +++ b/internal/tui/usage_test.go @@ -122,6 +122,17 @@ func TestUnlimitedQuotaCell(t *testing.T) { } } +// A plugin's row of text alone (AutoClaw's 积分余额) reads as its text: no +// meter and no share after it, where its used 0 read "100% left". +func TestTextQuotaCell(t *testing.T) { + for _, left := range []bool{false, true} { + got := quotaCell(provider.QuotaWindow{Name: "积分余额", Display: "1,234 积分", Text: true}, left, time.Now()) + if !strings.Contains(got, "1,234 积分") || strings.Contains(got, "%") || strings.Contains(got, "░") { + t.Fatalf("text: %q", got) + } + } +} + // The Usage page shows, under the gateway's calls, those the agents made // on their own, read from their session files, as the app's Usage page // counts them (Kumo31 on Discord: Codex used outside magpie wasn't in the