diff --git a/docs/subsystems/provider-plugins.md b/docs/subsystems/provider-plugins.md index 8a5bc4db3..183a6a73a 100644 --- a/docs/subsystems/provider-plugins.md +++ b/docs/subsystems/provider-plugins.md @@ -58,7 +58,7 @@ A plugin can press its vendor's daily check-in (签到) itself: its `auth` hook The hook returns `{outcome, credit?, streak?, message?, until?}`. `outcome` is one of `claimed` (checked in now), `done` (already in today), `ineligible`, `inactive` (no check-in event now), `captcha` or `failed`. A throw, or an outcome not in that list, is `failed` with the reason; for an outcome not in the list the reason names what the plugin answered, before its own message (`the plugin answered "yes": …`), so a plugin's wording isn't read as magpie's. `captcha` means the vendor wants a captcha: magpie never solves one, and says "check in in its own app" instead. A plugin must not solve captchas either. An `inactive` or `ineligible` result with a `message` shows it beside the fixed label ("No check-in event now · ") on the card, where it wraps rather than ends in "…", in Settings' check-in line and in `magpie accounts checkin`; the TUI's narrow cell says `c` says why, and `c`'s flash carries it (plugins#304). Without a message the label reads alone. -[`plugin_checkin.go`](../../internal/provider/plugin_checkin.go) runs these through the same `checkiner` as the built-in check-ins ([`checkin.go`](../../internal/provider/checkin.go)): each signed-in, in-use account once a Beijing day, the first look 2 minutes after start and then every 30 minutes, a `failed` asked again after 30 minutes, every other outcome settled for the day. A `done`, `inactive` or `ineligible` answered before noon Beijing (`checkinSureHour`) for an account magpie hasn't seen claim that Beijing day is provisional (`provisional`, #3326): a vendor whose day turns at UTC midnight (08:00 Beijing) or later still answers yesterday's "already" at 00:00, and magpie took it for today's and never asked again. The loop asks it again 30 minutes after the answer, until a claim or an answer from noon on, so at most 24 more asks a day and none once magpie claims; a press (`soon`) asks it again at once, whatever the hour, since the vendor's answer is what the press is for. A claim stamps `Claimed`, carried over while later answers that day say done, so a done after magpie's own claim is settled. Such a record is sent with `again: true` (`shown`, never kept), and the card, Settings, TUI and CLI say the vendor said already checked in and magpie asks again later, not "Checked in today", and the card keeps *Check in now*. A vendor whose day turns after noon Beijing (a US day) is not covered. The Qoder and Qoder CN plugins are the exception, as magpie's own Qoder check-in is (`recheck`, `pluginRechecks`, #2696): a campaign can open mid-day (Qoder CN's ran 10:00 to 09:59 the next day), so the loop asks again 30 minutes after the last answer whatever it was, and *Check in now* asks at once, and their card keeps *Check in now* for an `inactive` result. Every other plugin keeps the day's result. A plugin whose vendor's day turns at another hour says when in `until` (an RFC 3339 time or epoch milliseconds; `host.js` passes it on as RFC 3339, `plugin.Checkin.Until`), kept as the record's `ValidUntil`: the answer is settled only until then, whatever its outcome (`settled`), the loop wakes then rather than at its next 30-minute look (`wbCheckinLoop.tick`), and an early `done` that says it isn't provisional, since the vendor said when its day turns. Qoder's daily credits open at 10:00 UTC+8 and close at 09:59 the next day (its `/me/campaigns` `startAt`/`endAt`); the Qoder plugins from 0.2.43 answer `until` a minute past the next opening, so a check-in before 10:00, which claims or meets the day before's campaign, is asked again at 10:01, not up to half an hour later (sdytman on Discord). Times are compared as instants, so the machine's zone doesn't matter. Results are kept in `plugin-checkin.json` by `provider|` (`pluginCheckinKey`: the key `plugin-auth.json` keeps the sign-in under, `autoclaw` or `autoclaw#x1y2z3`), never by the display name: two sign-ins can share a name (AutoClaw's default can't be changed), and keyed by it only the first of them was ever checked in, by the loop or *Check in now* (plugins#254). The sign-in key holds over a refresh and over signing in to the same account again (`settle` in `host.js` puts it back under its key); a sign-in made after one was signed out the same day may take the freed key, and with it that day's result. An entry kept by `provider|` before then is carried over once the plugin's accounts are listed (`adoptLegacyPluginCheckins`): a check-in goes to the first sign-in in use of that name, the one the old key asked, and only to it, so its namesakes are asked and none twice; an `Off` in `settings.CheckinOff` goes to every sign-in of that name, since none of them was checked in while it was off. A `plugin-checkin.json` that can't be read or parsed is left as it is and carried over once it reads; until then no plugin account is checked in, and each says why (`readCheckins`, as for every vendor's check-in file). A failure is recorded as failed and never resets an account, a key or a previous day's result. Each account's Usage card has the check-in row (`checkinBy: "plugin:"`), and Settings → Usage has a Plugins tab with a Daily check-in switch per provider (`settings.PluginCheckins`, `POST /api/settings/plugin-checkin {provider, on}`; *Check in now* is `POST /api/usage/plugin-checkin {provider}`). The press says what it came to, a count per kind (`checkinPressSaid`, #3326): claimed now with the credits, already checked in today, not available yet (`inactive`, `ineligible`, or an `again` answer), to check in in the vendor's own app, failed; a result is claimed now only when it carries `asked` (`Asked`, sent but never kept), so an account claimed earlier today counts as already. `magpie accounts checkin` and `c` on the TUI's Usage page include them. Every check-in, built-in or a plugin's, also skips an account listed in `settings.CheckinOff` by its file key (#1902): `checkinNow` asks nothing for it, by the loop or a press, `CheckinAccounts()` lists each account with its own `on` for Settings (`checkinAccounts`, a row each under the vendor's switch when it has two or more, `POST /api/settings/checkin-account {key, on}`), and its card carries `checkinOff`. +[`plugin_checkin.go`](../../internal/provider/plugin_checkin.go) runs these through the same `checkiner` as the built-in check-ins ([`checkin.go`](../../internal/provider/checkin.go)): each signed-in, in-use account once a Beijing day, the first look 2 minutes after start and then every 30 minutes, a `failed` asked again after 30 minutes, every other outcome settled for the day. A `done`, `inactive` or `ineligible` answered before noon Beijing (`checkinSureHour`) for an account magpie hasn't seen claim that Beijing day is provisional (`provisional`, #3326): a vendor whose day turns at UTC midnight (08:00 Beijing) or later still answers yesterday's "already" at 00:00, and magpie took it for today's and never asked again. The loop asks it again 30 minutes after the answer, until a claim or an answer from noon on, so at most 24 more asks a day and none once magpie claims; a press (`soon`) asks it again at once, whatever the hour, since the vendor's answer is what the press is for. A claim stamps `Claimed`, carried over while later answers that day say done, so a done after magpie's own claim is settled. Such a record is sent with `again: true` (`shown`, never kept), and the card, Settings, TUI and CLI say the vendor said already checked in and magpie asks again later, not "Checked in today", and the card keeps *Check in now*. A vendor whose day turns after noon Beijing (a US day) is not covered. The Qoder and Qoder CN plugins are the exception, as magpie's own Qoder check-in is (`recheck`, `pluginRechecks`, #2696): a campaign can open mid-day (Qoder CN's ran 10:00 to 09:59 the next day), so the loop asks again 30 minutes after the last answer whatever it was, and *Check in now* asks at once, and their card keeps *Check in now* for an `inactive` result. Every other plugin keeps the day's result. A plugin whose vendor's day turns at another hour says when in `until` (an RFC 3339 time or epoch milliseconds; `host.js` passes it on as RFC 3339, `plugin.Checkin.Until`), kept as the record's `ValidUntil`: the answer is settled only until then, whatever its outcome (`settled`), the loop wakes then rather than at its next 30-minute look (`wbCheckinLoop.tick`), and an early `done` that says it isn't provisional, since the vendor said when its day turns. Qoder's daily credits open at 10:00 UTC+8 and close at 09:59 the next day (its `/me/campaigns` `startAt`/`endAt`); the Qoder plugins from 0.2.43 answer `until` a minute past the next opening, so a check-in before 10:00, which claims or meets the day before's campaign, is asked again at 10:01, not up to half an hour later (sdytman on Discord). Times are compared as instants, so the machine's zone doesn't matter. Results are kept in `plugin-checkin.json` by `provider|` (`pluginCheckinKey`: the key `plugin-auth.json` keeps the sign-in under, `autoclaw` or `autoclaw#x1y2z3`), never by the display name: two sign-ins can share a name (AutoClaw's default can't be changed), and keyed by it only the first of them was ever checked in, by the loop or *Check in now* (plugins#254). The sign-in key holds over a refresh and over signing in to the same account again (`settle` in `host.js` puts it back under its key); a sign-in made after one was signed out the same day may take the freed key, and with it that day's result. An entry kept by `provider|` before then is carried over once the plugin's accounts are listed (`adoptLegacyPluginCheckins`): a check-in goes to the first sign-in in use of that name, the one the old key asked, and only to it, so its namesakes are asked and none twice; an `Off` in `settings.CheckinOff` goes to every sign-in of that name, since none of them was checked in while it was off. A `plugin-checkin.json` that can't be read or parsed is left as it is and carried over once it reads; until then no plugin account is checked in, and each says why (`readCheckins`, as for every vendor's check-in file). A failure is recorded as failed and never resets an account, a key or a previous day's result. Each account's Usage card has the check-in row (`checkinBy: "plugin:"`), and Settings → Usage has a Plugins tab with a Daily check-in switch per provider (`settings.PluginCheckins`, `POST /api/settings/plugin-checkin {provider, on}`; *Check in now* is `POST /api/usage/plugin-checkin {provider}`). The press says what it came to, a count per kind (`checkinPressSaid`, #3326): claimed now with the credits, already checked in today, not available yet (`inactive`, `ineligible`, or an `again` answer), to check in in the vendor's own app, failed; a result is claimed now only when it carries `asked` (`Asked`, sent but never kept), so an account claimed earlier today counts as already. `magpie accounts checkin` and `c` on the TUI's Usage page include them. Every check-in, built-in or a plugin's, also skips an account listed in `settings.CheckinOff` by its file key (#1902): `checkinNow` asks nothing for it, by the loop or a press, `CheckinAccounts()` lists each account with its own `on` for Settings (`checkinAccounts`, a row each under the vendor's switch when it has two or more, `POST /api/settings/checkin-account {key, on}`), and its card carries `checkinOff`. Under each vendor's switch in Settings, a *Check in now* row checks one account in once (`checkinNowRow`, drawn by [`checkinnow.js`](../../internal/gui/assets/checkinnow.js), loaded when Settings draws a vendor's check-in so it weighs nothing on the core; `POST /api/usage/checkin-account {by, key}`, `provider.CheckInAccount`; xiaowu_95660 on Discord): the same `checkinNow` press, with `only` set to that account's key, so no other account is asked or reported, and the account is asked even while its switch is off, which the press leaves as it is. With two or more accounts the button opens the app menu to pick one. The row says what came of it: checked in with the credit and streak, already checked in today, not eligible or no check-in event with the vendor's message, check in in the vendor's own app, or the failure. It reads the Usage cards again but doesn't draw Settings again under the button. The switch is off by default. For a provider whose vendor magpie checked in through the plugin's fetch before (WorkBuddy, Trae CN, MiniMax Code, Qoder), it follows that vendor's existing switch until set on its own, and magpie's own check-in leaves that provider's accounts to the plugin (`pluginChecksIn`), so an account is never checked in twice. diff --git a/internal/gui/assets/app.js b/internal/gui/assets/app.js index cd83d0620..3ca008c4a 100644 --- a/internal/gui/assets/app.js +++ b/internal/gui/assets/app.js @@ -17867,13 +17867,9 @@ function creditsSwitch(q, cls, on, title, body, label, said) { return b; } -// checkinRow is a WorkBuddy (China), Trae CN or MiniMax Code account's daily check-in -// on its Usage card: today's (a Beijing day) done, with the credits and -// the streak, or why not, or the last day it was; the vendor's first such -// row also holds the switch, which is Settings' "Daily check-in", and a -// press for its accounts not in yet today (#694, Dazzle-sys: -// 卡片显示今日是否已经签到; Hu9956: TRAE cn 也有每天签到送100积分; -// #811, MiniMax Code's). +// checkinRow: an account's daily check-in on its Usage card, today's +// (Beijing) or why not; the vendor's first row holds its switch and press +// (#694, #811) const CHECKINS = { "": { pref: "workbuddyCheckin", api: "workbuddy-checkin", @@ -19781,8 +19777,8 @@ function renderSettings() { $(`#${id}CheckinSegs`).replaceChildren(segs([["off", t("Off")], ["on", t("On")]], s[on] ? "on" : "off", (v) => savePrefs({ ...keep, [on]: v === "on" }))); sub.textContent = [say, ...ciLines(s[on + "s"])].filter(Boolean).join(" · "); sub.title = as; - list.querySelectorAll(".ci-acct").forEach((x) => x.remove()); - list.append(...checkinAccountRows(s, id === "wb" ? "" : id)); + list.querySelectorAll(".ci-acct, .ci-now-row").forEach((x) => x.remove()); + list.append(...checkinAccountRows(s, id === "wb" ? "" : id), ...checkinNowRow(s, id === "wb" ? "" : id)); } setWarmTab(warmTab); // and the plugins that check in themselves, a row each, their tab shown @@ -22544,8 +22540,7 @@ async function renderUpdate(r, u) { if (kept && !pageShown) kept.remove(); } -// renderPluginCheckins draws a Daily check-in row for each plugin's -// provider that checks in itself (auth.checkin), under the Plugins tab. +// a Daily check-in row per plugin that checks in itself (auth.checkin) function renderPluginCheckins(s) { const ps = s.checkinPlugins || []; $("#warmTab-plugins").hidden = !ps.length; @@ -22568,13 +22563,21 @@ function renderPluginCheckins(s) { } })); row.append(who, segBox); - return [row, ...checkinAccountRows(s, "plugin:" + p.id)]; + return [row, ...checkinAccountRows(s, "plugin:" + p.id), ...checkinNowRow(s, "plugin:" + p.id)]; }).flat()); } -// checkinAccountRows are an Off/On row for each account vendor by checks -// in (#1902, magicLaLa: 根据每个账号设置是否开启自动签到), under its Daily -// check-in; none for a vendor of one account, whose switch is its own. +// one account's Check in now (xiaowu_95660), drawn by checkinnow.js +function checkinNowRow(s, by) { + if (!(s.checkinAccounts || []).some((a) => (a.by || "") === by)) return []; + const row = el("div", "row pref warm-now ci-now-row"); + if (window.ciNowFill) ciNowFill(row, s, by); + else { row.hidden = true; import("./checkinnow.js").then(() => ciNowFill(row, s, by), () => {}); } + return [row]; +} + +// checkinAccountRows: an Off/On row per account under vendor by's Daily +// check-in when it has two or more (#1902, magicLaLa) function checkinAccountRows(s, by) { const accts = (s.checkinAccounts || []).filter((a) => (a.by || "") === by); if (accts.length < 2) return []; diff --git a/internal/gui/assets/checkinnow.js b/internal/gui/assets/checkinnow.js new file mode 100644 index 000000000..67b597c01 --- /dev/null +++ b/internal/gui/assets/checkinnow.js @@ -0,0 +1,89 @@ +// Settings' Check in now for one account (xiaowu_95660: 手动签到一次): +// its row, the press and what it came to. app.js imports this when +// Settings draws a vendor's check-in (checkinNowRow), so it weighs nothing +// on the core. + +// what each vendor's last press said, kept over Settings' redraws +const checkinNowSaid = {}; + +// ciNowFill draws Check in now into row, for vendor by's accounts: one +// account checked in once now, picked from the app menu when there are +// several, its switch and the account's left as they are; what came of it +// is said in the row. +window.ciNowFill = function (row, s, by) { + const accts = (s.checkinAccounts || []).filter((a) => (a.by || "") === by); + row.dataset.by = by; + const sub = el("div", "sub"); + const who = el("div", "who"); + who.append(el("div", "name", t("Check in now")), sub); + const box = el("div"); + row.append(who, box); + const draw = () => { + const said = checkinNowSaid[by]; + sub.textContent = said ? said.text : t("Checks one account in once now; the daily check-in's switches stay as they are"); + sub.classList.toggle("err", !!said?.bad); + const b = el("button", "text ci-now-go", t(accts.length > 1 ? "Check in…" : "Check in")); + b.type = "button"; + b.disabled = !!said?.busy; + b.classList.toggle("busy", !!said?.busy); + if (accts.length > 1) b.setAttribute("aria-haspopup", "menu"); + b.onclick = (e) => { + e.stopPropagation(); + if (accts.length === 1) return send(accts[0]); + if (b.classList.contains("open")) return closeProtoMenu(); + openProtoMenu(b, accts.map((a) => ({ v: a.key, name: a.user || a.key, note: "", literalName: true })), null, + (k) => send(accts.find((a) => a.key === k)), "Check in which account", "sess-menu", "right"); + }; + box.replaceChildren(b); + }; + const send = (a) => ciNowSend(a, by, (o) => { checkinNowSaid[by] = o; if (row.isConnected) draw(); }); + draw(); + row.hidden = false; +}; + +// ciNowSend checks account a of vendor by in once now and says, through +// say, how it went; no switch is changed. +window.ciNowSend = async function (a, by, say) { + if (!a) return; + const name = a.user || a.key; + say({ busy: true, text: t("Checking in {who}…", { who: name }) }); + try { + const r = await api("usage/checkin-account", { by, key: a.key }); + const said = checkinNowLine(r, name); + say(said); + status(said.text, said.bad ? "err" : "ok"); + } catch (err) { + const text = t("Couldn't check in {who}: {why}", { who: name, why: t(err.message) }); + say({ bad: true, text }); + status(text, "err"); + } + // the Usage cards' lines read again; Settings isn't drawn again under + // the button just pressed, which a redraw moved at 420px + loadQuotas(); +}; + +// checkinNowLine is what one account's press came to: checked in now, +// already in today, not eligible or no event, its own app's, or failed, +// with the vendor's reason. +function checkinNowLine(r, who) { + const why = r?.msg ? " · " + r.msg : ""; + switch (r?.outcome) { + case "claimed": + case "done": + if (r.again) return { text: t("{user}: {name} says already checked in; magpie asks again later", { user: who, name: checkinVendorName(r) }) }; + if (r.outcome === "claimed" && r.asked) return { text: t("Checked in {who}", { who }) + (r.credit ? " +" + r.credit : "") + (r.streak ? " · " + t("{n}-day streak", { n: r.streak }) : "") }; + return { text: t("{who} was already checked in today", { who }) }; + case "ineligible": + return { text: t("{user} is not eligible", { user: who }) + why }; + case "inactive": + return { text: t("{user}: no check-in event now", { user: who }) + why }; + case "captcha": + return { text: t("{user} is asked for a captcha; check in in the app", { user: who }) }; + case "own-app": + return { text: r.by === "trae" + ? t("{user}: Trae CN refused this check-in (9074: too many taking part); check in in the Trae CN app", { user: who }) + : t("{user}: {name} only gives check-in credits to its own app; check in in the {name} app", { user: who, name: checkinVendorName(r) }) }; + default: + return { bad: true, text: t("Couldn't check in {who}: {why}", { who, why: r?.msg || t("Check-in failed") }) }; + } +} diff --git a/internal/gui/assets/i18n.js b/internal/gui/assets/i18n.js index 2146763ee..4b5f0c144 100644 --- a/internal/gui/assets/i18n.js +++ b/internal/gui/assets/i18n.js @@ -1270,6 +1270,15 @@ const I18N = { "Daily check-in turned off": "已关闭每日自动签到", "Daily check-in turned on; magpie checks in within a few minutes": "已开启每日自动签到;magpie 几分钟内会签到", "Check in now": "立即签到", + "Checks one account in once now; the daily check-in's switches stay as they are": "现在给一个账号签到一次;每日签到的开关保持不变", + "Check in…": "签到…", + "Check in": "签到", + "Check in which account": "给哪个账号签到", + "Checking in {who}…": "正在给 {who} 签到…", + "Couldn't check in {who}: {why}": "{who} 签到失败:{why}", + "Checked in {who}": "{who} 已签到", + "{who} was already checked in today": "{who} 今天已经签过到了", + "No daily check-in reaches this account": "这个账号没有可用的每日签到", "Press 签到 now for the accounts not checked in today": "现在为今天还没签到的账号点「签到」", "Trae CN's daily check-in, as pressing 签到 in Trae does": "Trae CN 的每日签到,和在 Trae 里点「签到」一样", "On: magpie checks each Trae CN account in once a day, as Settings' Daily check-in does. Click to turn it off.": "已开启:每天为每个 Trae CN 账号签到一次,与设置中的「每日自动签到」为同一开关。点击关闭。", @@ -5640,6 +5649,15 @@ const I18N = { "Daily check-in turned off": "已關閉每日自動簽到", "Daily check-in turned on; magpie checks in within a few minutes": "已開啟每日自動簽到;magpie 幾分鐘內會簽到", "Check in now": "立即簽到", + "Checks one account in once now; the daily check-in's switches stay as they are": "現在給一個帳號簽到一次;每日簽到的開關保持不變", + "Check in…": "簽到…", + "Check in": "簽到", + "Check in which account": "給哪個帳號簽到", + "Checking in {who}…": "正在給 {who} 簽到…", + "Couldn't check in {who}: {why}": "{who} 簽到失敗:{why}", + "Checked in {who}": "{who} 已簽到", + "{who} was already checked in today": "{who} 今天已經簽過到了", + "No daily check-in reaches this account": "這個帳號沒有可用的每日簽到", "Press 签到 now for the accounts not checked in today": "現在為今天還沒簽到的帳號點「簽到」", "Trae CN's daily check-in, as pressing 签到 in Trae does": "Trae CN 的每日簽到,和在 Trae 裡點「簽到」一樣", "On: magpie checks each Trae CN account in once a day, as Settings' Daily check-in does. Click to turn it off.": "已開啟:每天為每個 Trae CN 帳號簽到一次,與設定中的「每日自動簽到」為同一開關。點選關閉。", @@ -9979,6 +9997,15 @@ const I18N = { "Daily check-in turned off": "毎日のチェックインをオフにしました", "Daily check-in turned on; magpie checks in within a few minutes": "毎日のチェックインをオンにしました。magpie が数分以内にチェックインします", "Check in now": "今すぐチェックイン", + "Checks one account in once now; the daily check-in's switches stay as they are": "1 つのアカウントを今すぐ 1 回チェックインします。毎日のチェックインのスイッチはそのままです", + "Check in…": "チェックイン…", + "Check in": "チェックイン", + "Check in which account": "チェックインするアカウント", + "Checking in {who}…": "{who} をチェックイン中…", + "Couldn't check in {who}: {why}": "{who} をチェックインできませんでした: {why}", + "Checked in {who}": "{who} をチェックインしました", + "{who} was already checked in today": "{who} は今日すでにチェックイン済みです", + "No daily check-in reaches this account": "このアカウントに使える毎日のチェックインはありません", "Press 签到 now for the accounts not checked in today": "今日まだチェックインしていないアカウントで今すぐ「签到」を押します", "Trae CN's daily check-in, as pressing 签到 in Trae does": "Trae CN の毎日のチェックイン(Trae で「签到」を押すのと同じ)", "On: magpie checks each Trae CN account in once a day, as Settings' Daily check-in does. Click to turn it off.": "オン:magpie が各 Trae CN アカウントを 1 日 1 回チェックインします。設定の「毎日のチェックイン」と同じです。クリックでオフにします。", @@ -14349,6 +14376,15 @@ const I18N = { "Daily check-in turned off": "Täglicher Check-in ausgeschaltet", "Daily check-in turned on; magpie checks in within a few minutes": "Täglicher Check-in eingeschaltet; magpie checkt in wenigen Minuten ein", "Check in now": "Jetzt einchecken", + "Checks one account in once now; the daily check-in's switches stay as they are": "Checkt ein Konto jetzt einmal ein; die Schalter des täglichen Check-ins bleiben, wie sie sind", + "Check in…": "Einchecken…", + "Check in": "Einchecken", + "Check in which account": "Welches Konto einchecken", + "Checking in {who}…": "{who} wird eingecheckt…", + "Couldn't check in {who}: {why}": "{who} konnte nicht eingecheckt werden: {why}", + "Checked in {who}": "{who} eingecheckt", + "{who} was already checked in today": "{who} war heute schon eingecheckt", + "No daily check-in reaches this account": "Kein täglicher Check-in erreicht dieses Konto", "Press 签到 now for the accounts not checked in today": "Jetzt 签到 für die heute noch nicht eingecheckten Konten drücken", "Trae CN's daily check-in, as pressing 签到 in Trae does": "Täglicher Check-in von Trae CN, wie ein Klick auf 签到 in Trae", "On: magpie checks each Trae CN account in once a day, as Settings' Daily check-in does. Click to turn it off.": "An: magpie checkt jedes Trae-CN-Konto einmal täglich ein, wie „Täglicher Check-in“ in den Einstellungen. Zum Ausschalten klicken.", diff --git a/internal/gui/core_budget_test.go b/internal/gui/core_budget_test.go index b571993f0..43907d0b5 100644 --- a/internal/gui/core_budget_test.go +++ b/internal/gui/core_budget_test.go @@ -16,7 +16,7 @@ import ( // raises them and says why in its commit. const ( appScriptBudget = 1_316_874 // app.js: 1,198,239 after Usage left (P2); 1,218,098 with the 10-15 fixes to pages still in the core; 1,232,466 with the provider editor's Advanced fold and every dialog holding its place, the core's own (10-16); 1,250,533 with the quota refresh kept through redraws, the core's own since the tray panel draws it too, plus 1.5% (#2397); 1,269,083 with Free first's option in the provider editor's ROUTINGS, which the Routing page reads too, plus 1.5%; 1,272,726 with the Providers page drawing its last list at once (#1519), the core's page, and the Routing trace's account names read without Object.entries (#1481), plus 1.5%; a dialog growing out of the row that opened it and folding back into it, the core's own since every page's dialogs open through it (10-20); Codex's and Claude Code's own settings moved from Settings into the agent's row on the Agents page, the core's own since the tray panel and the window both draw them (10-20); 1,314,432 with Settings › Privacy's record of what was masked (its summary, the records view and the local model's controls), which belongs to Settings, the core's own, plus 1.5%; 1,336,481 with a provider's Names & levels saying Provider in model names is Settings' and opening it there (joe), and Settings' Image recognition saying where a custom provider's model is marked (nexnull), both in the core's own pages, with no room added (10-23); 1,337,633 with Settings › Models › Replies' Intent classifier timeout (#2934, reyoung), Settings' own row, drawn by waitRow, which the Image generation timeout's row now shares, with no room added; 1,337,735 with the provider editor's link naming a partner's page by its own host (siteHost) instead of usemagpie.ai's /go link, the core's own editor, with no room added (10-23); 1,338,084 with Check in now saying what the press came to (claimed +credits, already today, not available yet) where it said "refreshed" (#3326), the check-in row the tray panel draws too, the core's own, with no room added (10-23); 1,338,929 with a new partner's tile keeping a small dot until it is opened, in the add sheet, the core's own, with no room added (10-23); 1,343,324 with the sidebar's open-page row marked by one shape that moves on a spring (navTopGo), the window's own shell, which every page sits beside, with no room added (10-23); 1,343,465 with a dialog kept centred while its content comes in, until it is pressed (holdModal, every page's dialogs), the core's own, with no room added (10-24); 1,317,486 with what masking did moved out to Insights › Masking (plugins/redact), the budget lowered to it (10-24); 1,321,336 with Codex's one subagent model, its card's square saying plainly what each choice does and a row with a name in its sheet, where two squares read alike (the owner), the Agents page's, which the tray panel draws too, the core's own, with no room added (10-24); 1,321,424 with Settings › Models' Image generation MCP server row beside Image recognition's (JonahFu on X), the two drawn by one helper (mcpRow), Settings' own, with no room added (10-25); 1,321,994 with a provider of the user's set never to rest for a limit (zoecats), the provider editor's Advanced row, the core's own editor, with no room added (10-25); 1,322,289 with Settings › Privacy's Keep a key's form under Mask secrets (Charles Cao on X), Settings' own row, with no room added (10-25); 1,322,537 with no Codex squares beside its named settings rows (the owner), with no room added (10-25); 1,323,401 with the tray panel drawing its last allowances at once and asking for them beside the state (#3160, #3134), the tray panel's, the core's own, and the 4 bytes 84c50f032 added, with no room added (10-25); 1,326,105 with many releases' notes merged into one list by kind, each line with its version (the owner), in the update sheet and What's new, with no room added (10-25); 1,321,319 with Settings › Observability moved out to its plugin (plugins/otel/page.js) and its Langfuse setup there (an X user), the budget lowered to it (10-26); a quota card whose window is used but names no reset no longer saying "Not used yet" (windy on Discord) raised it to 1,321,347, and back to 1,321,319 with Settings' model pickers sharing one row helper (modelOpt) where six kept their own copy, no raise (10-26); 1,325,845 with every slow page's skeletons getting magpie's bird hopping bar to bar (skelBird, the owner after the Plugins page's README), one bird for the window over whatever page or dialog is loading, the core's own, with no room added (10-26); 1,310,129 with Settings › Network and sharing's gateway rows (its port, bare ids, local network, allowed addresses, web pages) moved out to the gateway plugin (plugins/gateway/settings.js), the budget lowered to it (10-27); 1,310,269 with Test models naming the first model that failed and its error in the status line, where it said only how many (ysm119 on Discord), the provider editor's, the core's own, with no room added (10-27); 1,310,460 with Settings › About's Website row linking usemagpie.ai (the owner), Settings' own row, with no room added (10-27); 1,309,669 with a pool's Stop at the caps and Check usage near a cap ticks under a provider's accounts (plugins#349), the core's own editor, its account rows' Remove and add rows each drawn by one helper (forgetOf, addRow), with no room added (10-28); 1,311,681 with Install another agent on the Agents page naming the agents Plugins has (More in Plugins) and opening Plugins at its Agents (the owner), the Agents page's, the core's own, with no room added (10-28); 1,311,735 with More in Plugins in sight while Install another agent is folded (the owner), with no room added (10-29); 1,313,704 with a window whose WebKit scrolls under wheels it never tells of (macOS 13) remembered once seen, a scroll at rest then waiting 120ms for a second the same way within 80ms before it is put back, kept for a late wheel to give back (waitsBack), and a load landing under the wheel keeping the reader's way (backAfterLoad, issennknight), the window's own scroll guard, with no room added (10-29); back to 1,311,735 with Settings › Models › Web search's rows (renderSearch, renderSearcher, the search APIs' keys) moved out to the search plugin (plugins/search/settings.js), app.js 1,292,527 after it, not lowered further since what is left plus 1.5% is over it (#4133, 10-29); 1,315,316 with the Agents row of a Claude Code or Codex not connected saying the account it is signed in to and switching it to another (Switch accounts only, the owner on X), in place of the failover line's ChatGPT accounts button, the Agents page's, the core's own, its comments cut down, with no room added (10-30); 1,317,705 with a Claude account added from a setup-token (sfss5362 on X): the sign-in's Use a setup-token instead…, its sheet, and its account row's magpie only, the provider editor's account rows, the core's own editor, its comments cut down, with no room added (10-30); back to 1,315,316 with the setup-token sheet and Copilot's GHE.com one moved out to signsheets.js, loaded when one is asked for (signAsk, 10-30); 1,315,479 with the provider editor lining its Advanced up with its fields (the owner: 高级这个折叠按钮为什么在一个前不着村后不着店的位置?) and a refresh on each of its accounts (在这里也要加上手动刷新用量的按钮), the core's own editor, with no room added (10-31); 1,315,603 with About's Log row, the path of the log the app writes and an Open for its folder (rayem1w on X), in app.js, its comment cut to one line, with no room added (10-31); 1,316,781 with a provider's model listed by an id of the user's (zeewell on X), the provider editor's Names & levels Listed as box beside Same as, the core's own editor, with no room added (10-31); 1,316,874 with a package manager's magpie (the AUR's magpie-bin) naming the command that updates it in Settings' Version row and lighting no Update pill (shuhai on Discord), the core's own update row, which the tray panel reads too, its comments cut to one line, with no room added (10-31); Settings › Sync's Kept on this computer row (hayden4608 on Discord) raised it to 1,317,497, which is no bound; the 1,316,874 it had came back once later trims left app.js at 1,308,363 (10-31) - coreScriptBudget = 1_533_802 // every core script: 1,358,034 after Usage left; 1,380,003 with them; 1,405,937 with the fold; 1,426,102 with 10-16's core work (the GitHub list loading, the move to plugins, Settings › Long conversations), plus 1.5% (#2612); 1,447,368 with loadBack, the window's one state read per return, which every page needs and so is the core's own (1,446,845 before it, 155 bytes under), plus 1.5%; OpenCode Zen's card saying OpenCode tells no key its balance adds ~390 bytes inside it; 1,472,589 with the dialog that grows out of its row and the agents' own settings in their rows, on main's 10-20 core work (the Providers page's last list, the Routing trace's names), plus 1.5% (10-20); 1,506,192 with Settings › Privacy's record of what was masked, plus 1.5%; 1,529,393 with the Intent classifier timeout row (#2934), with no room added; 1,529,495 with the editor's partner link host, with no room added; 1,529,844 with Check in now's press summary (#3326), with no room added; 1,530,689 with the new partner tile's dot, with no room added; 1,535,084 with the sidebar's spring, with no room added; 1,549,478 with the context window card's map (tiles by tokens, the default look, the block grid a switch away) and its text view showing an inline image, in context.js, which the Routing page draws as well as Usage, so the core's own, with no room added (10-24); 1,550,768 with a usage card's refresh opening after its text (#840's card, which the tray panel draws too), the Add key spinner, and a dialog kept centred while its content comes in, with no room added (10-24); 1,524,789 with what masking did moved out to Insights › Masking, lowered to it; 1,528,525 with Codex's one subagent model, with no room added (10-24); 1,528,972 with the Image generation MCP server row (JonahFu on X), with no room added (10-25); 1,529,542 with the limit-rest row (zoecats), with no room added (10-25); 1,529,837 with Keep a key's form (Charles Cao on X), with no room added (10-25); 1,530,050 with no Codex squares beside its named settings rows (the owner), with no room added (10-25); 1,530,631 with a plugin's page growing to its README on the dialog's spring instead of in one jump (the owner), the Plugins page's, in plugins.js, with no room added (10-25); 1,533,445 with the context map counting its tokens on as a live request grows, a tile pointed at keeping its tip, a tool's gathered results saying how many and the small files their folder (the owner, after flohoeller's map on X), in context.js, which the Routing page draws as well as Usage, and the 4 bytes 84c50f032 added to app.js (Settings' Version row) without a raise, with no room added (10-25); 1,534,312 with the tray panel's last allowances drawn at once (#3160, #3134), with no room added (10-25); 1,537,016 with many releases' notes merged into one list by kind (the owner), in app.js, with no room added (10-25); 1,542,244 with a plugin's README loading under magpie's bird bouncing down its lines instead of pulsing bars (the owner), the Plugins page's, in plugins.js, with no room added (10-26); 1,542,418 with a page plugin's sidebar tab coming and going as it is installed, switched on or off, or removed, instead of on the Plugins page's next load (the owner), in plugins.js, with no room added (10-26); 1,537,645 with Settings › Observability moved out to plugins/otel, lowered to it (10-26); 1,537,673 with a used window with no reset not "Not used yet" (windy on Discord), and back to 1,537,645 with Settings' model pickers sharing modelOpt (10-26); 1,541,967 with every slow page's skeletons getting magpie's bird (skelBird, the owner), in app.js, the README's bird sharing its drawing and styles, with no room added (10-26); 1,526,251 with Settings' gateway rows moved out to plugins/gateway/settings.js, lowered to it (10-27); 1,526,391 with Test models naming the first failed model and its error (ysm119 on Discord), in app.js, with no room added (10-27); 1,526,556 with About's Website row (the owner), in app.js, with no room added (10-27); 1,526,500 with a pool's cap ticks (plugins#349), in app.js, with no room added (10-28); 1,527,245 with About's Open-source licenses row and dialog (the owner), in app.js, with no room added (10-28); 1,528,076 with the Partners heading's light (the owner), in app.js, with no room added (10-28); 1,530,449 with Install another agent's More in Plugins row (the owner), in app.js, and Plugins opening at its Agents, in plugins.js, with no room added (10-28); 1,530,807 with layout.js measuring the scrollbar into --bar, which every page's right padding takes off so its sides match (the owner), the window's own shell, with no room added (10-28); 1,530,861 with More in Plugins in sight while Install another agent is folded (the owner), in app.js, with no room added (10-29); 1,532,830 with waitsBack and backAfterLoad (issennknight, macOS 13), the window's own scroll guard, in app.js, with no room added (10-29); the context map's tile wording (a4e929212) and Cindy's Add magpie (628ac36fc) had taken the core over it, and Web search's rows moved out to plugins/search/settings.js brought it back to 1,530,861 (#4133, 10-29); 1,532,459 with a provider editor's account rows on one line each, First or Make first at its right end and the settings that aren't set under ⋯ (the owner), the core's own editor, in app.js, which stays in its budget with its comments cut down, with no room added (10-29); 1,532,602 with a plugin's README waiting for its bird to land on three lines before it goes in, however soon it came (the owner, 10-30), in plugins.js, with no room added; 1,536,357 with Switch accounts only on the Agents row (the owner on X), in app.js, with no room added (10-30); 1,537,034 with a plugin's README read once shown at once, with no bird, when its page opens again and read again behind it, the last 20 kept (the owner), in plugins.js, with no room added (10-30); 1,539,423 with a Claude account added from a setup-token (sfss5362 on X), in app.js, with no room added (10-30); 1,538,975 with purposes.js written as compact JSON by genpurposes and the MCP tool purpose in it, 448 bytes less in all (ferock on Discord), lowered to it (10-30); 1,536,586 with the setup-token sheet and Copilot's GHE.com one moved out to signsheets.js, lowered by the 2,389 the setup-token raised it (10-30); 1,536,631 with the 45 bytes b62fa332f added to app.js (Send requests unmasked for subscriptions and plugin providers too) without a raise, with no room added (10-31); 1,537,356 with Settings › Models › Replies › Claude Code's interactive mode, a row beside Short Claude system prompt (the owner), in app.js, with no room added (10-31); Long conversations in Codex's row naming the config.toml keys Codex reads before it, with Take it out, and the window magpie tells Codex for the model it runs (zgjfjfl on Discord) raised it to 1,537,669, and it is back under 1,537,356 with the key list and the window's size written by the server (codexKeysText, tokensSize) and the row's words cut, no raise (10-31); 1,538,554 with the same two, with no room added (10-31); 1,538,678 with About's Log row (rayem1w on X), with no room added (10-31); 1,539,856 with a model's Listed as id (zeewell on X), in app.js, with no room added (10-31); Tuned for you's Codex row offering the advice to background compaction (herman_hong on Discord) and a package manager's magpie naming its command (shuhai on Discord) took it to 1,541,798, and the release notes' dialogs (What's new, the update's ask) moved out to whatsnew.js, loaded when one opens, brought it back under 1,539,856, no raise (10-31); 1,540,479 for Settings › Sync's Kept on this computer row (hayden4608 on Discord) was taken back to 1,539,856 once the core weighed 1,533,355, no raise (10-31); 1,532,958 with the context window card's head naming the agent and the model's lab (the owner), in context.js, after the card's part text viewer moved out to ctxtext.js (7,005 bytes), lowered to it (10-31); 1,533,105 with the provider editor's Claude Code runs as row moved above the accounts, its pill and hover card in claudemode.js, and Settings found at the row that draws anew (the owner), in app.js and i18n.js, with no room added (11-01); a Codex account's credits spent only after every other account, key and fallback (gokoshiki on Discord) fit in it with the Codex options' comments in app.js cut down, no raise (11-01); a plugin option's words in the window's language and the filtered-models note (plugins#590, anewuser6937 on Discord) fit in it with three of the provider editor's comments in app.js cut down, no raise (11-01); 1,533,802 with a closed Mac window telling its page it is out of sight (#4293, pipi-1997), in app.js, which every page needs, its comments cut to one line, with no room added (11-01); Warm up on a Codex or Claude account's Usage card (01huadalang on Discord), in plugins/usage/page.js, its one call in app.js paid for by two comments cut, no raise (11-01) + coreScriptBudget = 1_533_802 // every core script: 1,358,034 after Usage left; 1,380,003 with them; 1,405,937 with the fold; 1,426,102 with 10-16's core work (the GitHub list loading, the move to plugins, Settings › Long conversations), plus 1.5% (#2612); 1,447,368 with loadBack, the window's one state read per return, which every page needs and so is the core's own (1,446,845 before it, 155 bytes under), plus 1.5%; OpenCode Zen's card saying OpenCode tells no key its balance adds ~390 bytes inside it; 1,472,589 with the dialog that grows out of its row and the agents' own settings in their rows, on main's 10-20 core work (the Providers page's last list, the Routing trace's names), plus 1.5% (10-20); 1,506,192 with Settings › Privacy's record of what was masked, plus 1.5%; 1,529,393 with the Intent classifier timeout row (#2934), with no room added; 1,529,495 with the editor's partner link host, with no room added; 1,529,844 with Check in now's press summary (#3326), with no room added; 1,530,689 with the new partner tile's dot, with no room added; 1,535,084 with the sidebar's spring, with no room added; 1,549,478 with the context window card's map (tiles by tokens, the default look, the block grid a switch away) and its text view showing an inline image, in context.js, which the Routing page draws as well as Usage, so the core's own, with no room added (10-24); 1,550,768 with a usage card's refresh opening after its text (#840's card, which the tray panel draws too), the Add key spinner, and a dialog kept centred while its content comes in, with no room added (10-24); 1,524,789 with what masking did moved out to Insights › Masking, lowered to it; 1,528,525 with Codex's one subagent model, with no room added (10-24); 1,528,972 with the Image generation MCP server row (JonahFu on X), with no room added (10-25); 1,529,542 with the limit-rest row (zoecats), with no room added (10-25); 1,529,837 with Keep a key's form (Charles Cao on X), with no room added (10-25); 1,530,050 with no Codex squares beside its named settings rows (the owner), with no room added (10-25); 1,530,631 with a plugin's page growing to its README on the dialog's spring instead of in one jump (the owner), the Plugins page's, in plugins.js, with no room added (10-25); 1,533,445 with the context map counting its tokens on as a live request grows, a tile pointed at keeping its tip, a tool's gathered results saying how many and the small files their folder (the owner, after flohoeller's map on X), in context.js, which the Routing page draws as well as Usage, and the 4 bytes 84c50f032 added to app.js (Settings' Version row) without a raise, with no room added (10-25); 1,534,312 with the tray panel's last allowances drawn at once (#3160, #3134), with no room added (10-25); 1,537,016 with many releases' notes merged into one list by kind (the owner), in app.js, with no room added (10-25); 1,542,244 with a plugin's README loading under magpie's bird bouncing down its lines instead of pulsing bars (the owner), the Plugins page's, in plugins.js, with no room added (10-26); 1,542,418 with a page plugin's sidebar tab coming and going as it is installed, switched on or off, or removed, instead of on the Plugins page's next load (the owner), in plugins.js, with no room added (10-26); 1,537,645 with Settings › Observability moved out to plugins/otel, lowered to it (10-26); 1,537,673 with a used window with no reset not "Not used yet" (windy on Discord), and back to 1,537,645 with Settings' model pickers sharing modelOpt (10-26); 1,541,967 with every slow page's skeletons getting magpie's bird (skelBird, the owner), in app.js, the README's bird sharing its drawing and styles, with no room added (10-26); 1,526,251 with Settings' gateway rows moved out to plugins/gateway/settings.js, lowered to it (10-27); 1,526,391 with Test models naming the first failed model and its error (ysm119 on Discord), in app.js, with no room added (10-27); 1,526,556 with About's Website row (the owner), in app.js, with no room added (10-27); 1,526,500 with a pool's cap ticks (plugins#349), in app.js, with no room added (10-28); 1,527,245 with About's Open-source licenses row and dialog (the owner), in app.js, with no room added (10-28); 1,528,076 with the Partners heading's light (the owner), in app.js, with no room added (10-28); 1,530,449 with Install another agent's More in Plugins row (the owner), in app.js, and Plugins opening at its Agents, in plugins.js, with no room added (10-28); 1,530,807 with layout.js measuring the scrollbar into --bar, which every page's right padding takes off so its sides match (the owner), the window's own shell, with no room added (10-28); 1,530,861 with More in Plugins in sight while Install another agent is folded (the owner), in app.js, with no room added (10-29); 1,532,830 with waitsBack and backAfterLoad (issennknight, macOS 13), the window's own scroll guard, in app.js, with no room added (10-29); the context map's tile wording (a4e929212) and Cindy's Add magpie (628ac36fc) had taken the core over it, and Web search's rows moved out to plugins/search/settings.js brought it back to 1,530,861 (#4133, 10-29); 1,532,459 with a provider editor's account rows on one line each, First or Make first at its right end and the settings that aren't set under ⋯ (the owner), the core's own editor, in app.js, which stays in its budget with its comments cut down, with no room added (10-29); 1,532,602 with a plugin's README waiting for its bird to land on three lines before it goes in, however soon it came (the owner, 10-30), in plugins.js, with no room added; 1,536,357 with Switch accounts only on the Agents row (the owner on X), in app.js, with no room added (10-30); 1,537,034 with a plugin's README read once shown at once, with no bird, when its page opens again and read again behind it, the last 20 kept (the owner), in plugins.js, with no room added (10-30); 1,539,423 with a Claude account added from a setup-token (sfss5362 on X), in app.js, with no room added (10-30); 1,538,975 with purposes.js written as compact JSON by genpurposes and the MCP tool purpose in it, 448 bytes less in all (ferock on Discord), lowered to it (10-30); 1,536,586 with the setup-token sheet and Copilot's GHE.com one moved out to signsheets.js, lowered by the 2,389 the setup-token raised it (10-30); 1,536,631 with the 45 bytes b62fa332f added to app.js (Send requests unmasked for subscriptions and plugin providers too) without a raise, with no room added (10-31); 1,537,356 with Settings › Models › Replies › Claude Code's interactive mode, a row beside Short Claude system prompt (the owner), in app.js, with no room added (10-31); Long conversations in Codex's row naming the config.toml keys Codex reads before it, with Take it out, and the window magpie tells Codex for the model it runs (zgjfjfl on Discord) raised it to 1,537,669, and it is back under 1,537,356 with the key list and the window's size written by the server (codexKeysText, tokensSize) and the row's words cut, no raise (10-31); 1,538,554 with the same two, with no room added (10-31); 1,538,678 with About's Log row (rayem1w on X), with no room added (10-31); 1,539,856 with a model's Listed as id (zeewell on X), in app.js, with no room added (10-31); Tuned for you's Codex row offering the advice to background compaction (herman_hong on Discord) and a package manager's magpie naming its command (shuhai on Discord) took it to 1,541,798, and the release notes' dialogs (What's new, the update's ask) moved out to whatsnew.js, loaded when one opens, brought it back under 1,539,856, no raise (10-31); 1,540,479 for Settings › Sync's Kept on this computer row (hayden4608 on Discord) was taken back to 1,539,856 once the core weighed 1,533,355, no raise (10-31); 1,532,958 with the context window card's head naming the agent and the model's lab (the owner), in context.js, after the card's part text viewer moved out to ctxtext.js (7,005 bytes), lowered to it (10-31); 1,533,105 with the provider editor's Claude Code runs as row moved above the accounts, its pill and hover card in claudemode.js, and Settings found at the row that draws anew (the owner), in app.js and i18n.js, with no room added (11-01); a Codex account's credits spent only after every other account, key and fallback (gokoshiki on Discord) fit in it with the Codex options' comments in app.js cut down, no raise (11-01); a plugin option's words in the window's language and the filtered-models note (plugins#590, anewuser6937 on Discord) fit in it with three of the provider editor's comments in app.js cut down, no raise (11-01); 1,533,802 with a closed Mac window telling its page it is out of sight (#4293, pipi-1997), in app.js, which every page needs, its comments cut to one line, with no room added (11-01); Warm up on a Codex or Claude account's Usage card (01huadalang on Discord), in plugins/usage/page.js, its one call in app.js paid for by two comments cut, no raise (11-01); Settings' Check in now for one account (xiaowu_95660), its row and press in checkinnow.js, loaded when Settings draws a check-in, its one call in app.js paid for by three check-in comments cut, no raise (11-02) ) func TestCoreScriptBudget(t *testing.T) { diff --git a/internal/gui/tests/checkin-now-account.test.cjs b/internal/gui/tests/checkin-now-account.test.cjs new file mode 100644 index 000000000..ea8b55f34 --- /dev/null +++ b/internal/gui/tests/checkin-now-account.test.cjs @@ -0,0 +1,220 @@ +// Run with Node's test runner and Playwright on the module path; see README.md. +// xiaowu_95660 on Discord: a manual "check in once now" beside the daily +// check-in switch. The last row of each check-in tab in Settings › Usage, +// Check in now, checks one account in at a press (POST +// /api/usage/checkin-account {by, key}); with several the press opens the +// app's menu of them (no