diff --git a/docs/reference.md b/docs/reference.md index 997c4ca62..f31d33c58 100644 --- a/docs/reference.md +++ b/docs/reference.md @@ -3590,10 +3590,12 @@ version channel first. A release marked urgent goes to Stable at once. When Stable moves past several versions, What's new lists the notes of every version since yours as one list. -A version installed from the site can be newer than Stable's; the app -keeps it and waits until Stable passes it. While it waits, the Version -row says *Up to date on Stable*, names the newest version out on Every -version, and offers to switch to Every version. +A version installed from the site, or kept from Every version when the +channel changed, can be newer than Stable's or Daily's; the app keeps it +and waits until the channel passes it. While it waits, the Version row +says so (*Newer than Daily's 0.1.4395; it updates once Daily passes it*), +names the newest version out on Every version, and offers to switch to +Every version; `magpie update` says the same. The site's downloads offer Stable's version beside the newest (`usemagpie.ai/download/stable/`). A fresh install of it (no diff --git a/internal/cli/update_ahead_cli_test.go b/internal/cli/update_ahead_cli_test.go new file mode 100644 index 000000000..1c8dd05f5 --- /dev/null +++ b/internal/cli/update_ahead_cli_test.go @@ -0,0 +1,46 @@ +package cli + +import ( + "encoding/json" + "net/http" + "net/http/httptest" + "strings" + "testing" + + "github.com/yetone/magpie/internal/settings" + "github.com/yetone/magpie/internal/update" +) + +// `magpie update` on a version newer than its channel's (realfxw on X: +// 0.1.4445 on Daily, whose pick was 0.1.4395) said it was up to date, and +// nothing came until Daily passed it. It now says it is newer than the +// channel's, and how to update now. On the channel's own version it is up +// to date as before. +func TestUpdateAheadOfChannelSaysSo(t *testing.T) { + groupsHome(t) + srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + v := "0.1.4472" + if r.URL.Query().Get("channel") == "daily" { + v = "0.1.4395" + } + json.NewEncoder(w).Encode(update.Release{Version: v}) + })) + defer srv.Close() + t.Setenv("MAGPIE_UPDATE_FEED", srv.URL) + if err := settings.Save(settings.Settings{UpdateChannel: settings.UpdateDaily}); err != nil { + t.Fatal(err) + } + was := version + t.Cleanup(func() { version = was }) + + version = "0.1.4445" + out, err := stdoutOf(t, func() error { return updateCmd([]string{"update", "check"}) }) + if err != nil || !strings.Contains(out, "is newer than the daily channel's 0.1.4395") || !strings.Contains(out, "magpie update channel every") || strings.Contains(out, "up to date") { + t.Fatalf("ahead of daily: %v %q", err, out) + } + version = "0.1.4395" + out, err = stdoutOf(t, func() error { return updateCmd([]string{"update", "check"}) }) + if err != nil || !strings.Contains(out, "is up to date on the daily channel") { + t.Fatalf("daily's own version: %v %q", err, out) + } +} diff --git a/internal/cli/update_cli.go b/internal/cli/update_cli.go index 70860ffe6..26c0d90ba 100644 --- a/internal/cli/update_cli.go +++ b/internal/cli/update_cli.go @@ -227,7 +227,11 @@ func updateCmd(args []string) error { } if !update.Newer(rel.Version, version) { if update.Released(version) { - if ch := update.Channel(); ch != "" { + if ch := update.Channel(); ch != "" && update.Newer(version, rel.Version) { + // newer than the channel's: nothing is installed until the + // channel passes it (realfxw on X), which "up to date" hid + fmt.Println("magpie", version, "is newer than the "+ch+" channel's "+rel.Version+muted.Render("; it updates once "+ch+" passes it, or now with `magpie update channel every`")) + } else if ch != "" { fmt.Println(green.Render("✓"), "magpie", version, muted.Render("is up to date on the "+ch+" channel ("+ch+" is "+rel.Version+")")) } else { fmt.Println(green.Render("✓"), "magpie", version, muted.Render("is the latest")) diff --git a/internal/gui/assets/app.js b/internal/gui/assets/app.js index cfba89f8d..755d16f3a 100644 --- a/internal/gui/assets/app.js +++ b/internal/gui/assets/app.js @@ -22719,10 +22719,10 @@ async function renderUpdate(r, u) { again(1000); break; case "latest": - // Stable's and Daily's say the newest out (ylspcm on X) - sub.textContent = u.channel === "daily" - ? t(u.newest ? "Up to date on Daily · {v} is out on Every version" : "Up to date on Daily", { v: u.newest }) - : u.newest ? t("Up to date on Stable · {v} is out on Every version", { v: u.newest }) : t(u.channel ? "Up to date on Stable" : "Up to date"); + // Stable's and Daily's say the newest out (ylspcm on X); newer than + // the channel's, that nothing comes until it passes (realfxw on X) + sub.textContent = t(u.ahead ? "Newer than {c}'s {d}; it updates once {c} passes it" : u.channel == "daily" ? "Up to date on Daily" : u.channel ? "Up to date on Stable" : "Up to date", { c: t(u.channel == "daily" ? "Daily" : "Stable"), d: u.latest }) + (u.newest ? " · " + t("{v} is out on Every version", { v: u.newest }) : ""); + if (u.ahead) sub.classList.add("wraps"); if (u.newest) btn(t("Switch to Every version"), () => savePrefs({ ...prefsKeep(prefs), updateChannel: "" })); btn(t("Check"), check); break; diff --git a/internal/gui/assets/i18n.js b/internal/gui/assets/i18n.js index 8d0648080..5d6e9a198 100644 --- a/internal/gui/assets/i18n.js +++ b/internal/gui/assets/i18n.js @@ -4253,10 +4253,10 @@ const I18N = { "Downloading {v}…": "正在下载 {v}…", "Up to date": "已是最新", "Up to date on Stable": "稳定版已是最新", - "Up to date on Stable · {v} is out on Every version": "稳定版已是最新 · 尝鲜版已有 {v}", "Daily": "每日版", "Up to date on Daily": "每日版已是最新", - "Up to date on Daily · {v} is out on Every version": "每日版已是最新 · 尝鲜版已有 {v}", + "Newer than {c}'s {d}; it updates once {c} passes it": "比{c}的 {d} 新,{c}超过它后才会更新", + "{v} is out on Every version": "尝鲜版已有 {v}", "One version a day, the newest that passed its tests, and urgent fixes at once. What's new lists every change since yours": "每天一个版本,选通过测试的最新版;紧急修复立即推送。「更新内容」会列出你当前版本以来的全部改动", "Switch to Every version": "改用尝鲜版", "What's new": "更新内容", @@ -9714,10 +9714,10 @@ const I18N = { "Downloading {v}…": "正在下載 {v}…", "Up to date": "已是最新", "Up to date on Stable": "穩定版已是最新", - "Up to date on Stable · {v} is out on Every version": "穩定版已是最新 · 搶先版已有 {v}", "Daily": "每日版", "Up to date on Daily": "每日版已是最新", - "Up to date on Daily · {v} is out on Every version": "每日版已是最新 · 搶先版已有 {v}", + "Newer than {c}'s {d}; it updates once {c} passes it": "比{c}的 {d} 新,{c}超過它後才會更新", + "{v} is out on Every version": "搶先版已有 {v}", "One version a day, the newest that passed its tests, and urgent fixes at once. What's new lists every change since yours": "每天一個版本,選通過測試的最新版;緊急修正立即推送。「更新內容」會列出你目前版本以來的全部變更", "Switch to Every version": "改用搶先版", "What's new": "更新內容", @@ -15184,10 +15184,10 @@ const I18N = { "Downloading {v}…": "{v} をダウンロード中…", "Up to date": "最新です", "Up to date on Stable": "安定版では最新です", - "Up to date on Stable · {v} is out on Every version": "安定版では最新です · 先行版では {v} が出ています", "Daily": "デイリー版", "Up to date on Daily": "デイリー版では最新です", - "Up to date on Daily · {v} is out on Every version": "デイリー版では最新です · 先行版では {v} が出ています", + "Newer than {c}'s {d}; it updates once {c} passes it": "{c}の {d} より新しいため、{c}が追い越すまで更新されません", + "{v} is out on Every version": "先行版では {v} が出ています", "One version a day, the newest that passed its tests, and urgent fixes at once. What's new lists every change since yours": "テストに通った最新のバージョンを 1 日 1 回、緊急の修正はすぐに届けます。新機能には今のバージョン以降のすべての変更がまとめて表示されます", "Switch to Every version": "先行版に切り替える", "What's new": "新機能", @@ -20675,10 +20675,10 @@ const I18N = { "Downloading {v}…": "Lade {v} herunter…", "Up to date": "Aktuell", "Up to date on Stable": "Aktuell auf Stabil", - "Up to date on Stable · {v} is out on Every version": "Aktuell auf Stabil · Unter Jede Version ist {v} erschienen", "Daily": "Täglich", "Up to date on Daily": "Aktuell auf Täglich", - "Up to date on Daily · {v} is out on Every version": "Aktuell auf Täglich · Unter Jede Version ist {v} erschienen", + "Newer than {c}'s {d}; it updates once {c} passes it": "Neuer als {d} auf {c}; Updates kommen, sobald {c} diese Version überholt", + "{v} is out on Every version": "Unter Jede Version ist {v} erschienen", "One version a day, the newest that passed its tests, and urgent fixes at once. What's new lists every change since yours": "Eine Version pro Tag, die neueste mit bestandenen Tests, dringende Korrekturen sofort. Neuigkeiten listet alle Änderungen seit Ihrer Version", "Switch to Every version": "Zu Jede Version wechseln", "What's new": "Neuigkeiten", diff --git a/internal/gui/core_budget_test.go b/internal/gui/core_budget_test.go index 76c4d7d30..cc77b5887 100644 --- a/internal/gui/core_budget_test.go +++ b/internal/gui/core_budget_test.go @@ -17,8 +17,8 @@ import ( // never what pays for a change (#5918); the history of each number is in // `git log -L` of this file. const ( - appScriptBudget = 1_088_568 // app.js: 1,080,614 at 8016205e3, with the 5,653 of room it had; +123 for a sidebar list folded from its page's row (hkwok06 on X), its chevron and fold in navicons.js, imported with the first list; +57 for each account of a provider's Usage card in a card of its own (normalcoder_ on X), past the 24 of room left; +17 for an allowance card's wallet line under its rings (apple_test_src on X), the one filter shared with its text line; +338 for the Daily update channel (fishmagic80 on X): its segment, its line under Update channel and the version row's two Up to date on Daily words, packed to the shortest form (one t() per choice); Settings › About and renderUpdate draw them on every window, so there is no page to move them to; +35 for Baidu Qianfan's Token Plan sign-in (yuushabu_buyinn on X, #5860): its field in qianfanplan.js, imported when such a provider's editor opens, drawn by renderStepPlan now told whose sign-in it brings, and what is left is the import and two quotaError lines, past the room there was; quotaError reads every card's error, so there is no page to move it to; +27 for Windows' title bar (258a14 on X): the caption buttons, their clicks, the bar's double click and what keeps them over a dialog in wincap.js, imported in Windows' window alone, the header's room for them in app.css, and what is left is the one line that imports it, past the 29 of room there was; that window's frame is drawn on every start, so there is no page to move it to; +107 for the pages in the reader's own order (chet030714 on X): the order, the sidebar and tab bar put in it, and the menu's drag and keys in navorder.js and navpages.js, imported once an order is kept or Settings draws, and what is left is the one line in navHides that imports it; navHides runs on every start, so there is no page to move it to; +275 for the grants Alibaba's Token Plan asks of a RAM user's AccessKey in the reader's language (MetalHqa on X): one string (ALI_RAM) shown under the editor's AccessKey ID and on the card that names them, less the 48 of the wrong "a RAM user that may use Model Studio is enough" it replaces; the editor and quotaError draw them on every window, so there is no page to move them to; +135 for a model test its vendor queued shown queued and not green (sufeng1894 on X): queuedSaid, one string shared by the chip's title, Test models' and Test this model's status, and the chip's amber dot; renderModels draws the provider editor's chips, so there is no page to move it to; +66 for AstrLink Guard's row saying an x64 magpie runs it under Windows on Arm's emulation until the next update installs the Arm build (EV_John_Liu on X), the Rosetta line's sibling, one line in pmSub; the Privacy rows draw it, so there is no page to move it to; +864 for Use on a Claude setup-token account, which switches Claude Code itself to it in its settings.json, and Use back on its signed-in account (liukaybee on X): one swUse helper shared by both buttons, packed to the shortest form; renderAccounts draws every account row, so there is no page to move it to; +1 for the classifier timeout's unset default, 15 and not 8 (ESern29751 on X): its second digit in the Settings row's fallback, which renderReplies draws, so there is no page to move it to; +457 for Kimi Code's subagent pool and its effort (XiaoLing_Arisa on X): the Subagents line and its pool menu in kimisub.js, imported before a Kimi Code row's Details first slides open so it measures the line, and what is left is that import, the line's place, the three fields kept out of the row's squares and the picker's note that Kimi's subagents run on the lead's model, packed to the shortest form; renderAgents draws every row, so there is no page to move it to; +354 for Images per request (#6849, Yuu_jiang_ on X): its field and parse are in maximages.js, imported as the editor draws Max output, and what stays is the import, the two saves' lines and the check that the editor is still open when it and keyrates.js land, no page to move them to; +499 for Speed beside Model and Effort in an agent's opened row (Tengs999 on X): the line, its menu and what decides the speed in agentspeed.js, imported before a fast model's Details first slides open so it measures the line, and what is left is that import and the line's place in the panel's and the window's rows, packed to one helper; renderAgents draws every row, so there is no page to move it to; -1,529: each ChatGPT account's own warm-up time (renderWarmAtOwn) moved into autoresetown.js, imported when its rows first draw, paying for a provider's editor opening Advanced when its warm-up or check-in is on (ChrisYagao on X), and the room left over given back; +103 for the sidebar foot that holds Settings' tabs marked by a class, not :has(), which Safari before 15.4 can't parse (#5919): no page's code small enough to move was left (modelInfo serves two plugins); +52 for a proxy's failure said in the reader's language (laiuuui on X): proxyWhy is in proxies.js, imported when Settings draws its saved proxies, and what is left is api()'s one line handing the reply to it; api() reads every error, so there is no page to move it to; +485 for which effort a Claude Code tier runs at (lightwlh on X): an unset tier's effort reads follows session, a set one's title says the session's effort and /effort don't change it, and New sessions' effort says a tier with its own runs at that one, one ownSaid shared by both titles, packed to the shortest form; connectPanel and the effort slider draw every agent's Details, so there is no page to move it to; -165: the provider editor's WebSocket row moved into socketrow.js, imported as the editor draws, paying for its tick opening ticked on OpenAI's own API (KawaiiZapic on X), and the room left over given back - coreScriptBudget = 1_273_259 // every core script at 8016205e3, the old measure 682 over its cap there (#5918); +367 for the model test on a chosen account (tmr11235), no page left to move it to; +151 for the provider menu's "Only on this device" item and its four translations; +458 for Settings › About's Report a problem row and its translations; +113 for withScheme, the one rule every typed address goes through (eachg0 on X), cut to the shortest form that keeps it whole; +10 for the kept whole's tooltip (Musikrv77852 on X), the past-cycle line reused for it, no page left to move it to; +1,112 for Codex's Open button and its Open Codex with menu (Yink88564391 on X), packed to the shortest form, no page left to move them to; +168 for Discover's long lists drawn in part (the owner, 11-13), after the rest of its hook moved into plugingrid.js, imported when Plugins first draws; +296 for the cap toggle and Smart sentences that say what they do and the Sign in on another computer row (Wing8Aqua on X), packed to the shortest form, no page left to move them to; +333 for In turn's figure in a provider's editor and its words naming the message that goes round (Wing8Aqua on X), the figure itself in rotfig.js, imported when In turn is first shown, the hook packed to the shortest form; +236 for a lone capped Codex account's row saying its turns go to the fallbacks when Codex is connected (not_4O4 on X), the two helpers inlined, no page left to move it to; +717 for omp's advisor (Awad_Yoo on X, #6408): its three rows moved into ompadvisor.js, imported when an omp's settings show, and what is left is the import, the role's " · off" and the Settings line's name, packed to the shortest form; +468 for a plugin's own file import (auth.import) in the import sheet, in the plugin's words (marchen_cc on X), packed to one statement; importSay is read as the Providers rows draw, so it has no lazy page to go to, and nothing else was moved out; +180 for Claude Magpie's own Claude Code folder (xMopf7RF on X, #6459): its Advanced fold in claudemagpie.js, imported when it first shows, and what is left is the import and the fold's place in the Separate app line, 216 bytes packed to the shortest form, less the 36 of room there was; +81 for the Use Claude Magpie button on Claude Desktop's row (xMopf7RF on X), drawn by claudemagpie.js too, what is left the one line that places it (#2710); +225 for the Hermes row's Other profiles lines (Norethcy on X), which 1d60b165c took out while each profile had a row and c96f33d65 left with no place at all, packed to the shortest form; the dead hermes# Default note went with it, and the Agents rows draw it, so there is no page to move it to; +397 for a key's own price rate (tnt12231 on X): its lines, check and placeholder in keyrates.js, imported when a provider with two or more keys opens, and what is left is the import, the draft's copy, Advanced opening for it, the save's one line and proxyLines drawing another kind of line; +316 for an image or video model's chip saying what it makes from its right-click (iceloon on X): the chat chip's Makes… now shared with it, and the media chip's Copy model ID left out, packed to the shortest form; the provider's editor draws it, so there is no page to move it to; +67 for the Claude Code · Claude Magpie row saying it is on magpie through Claude Magpie (xMopf7RF on X), one line in connectLine with the shortest words that say it; the Agents rows draw it, so there is no page to move it to; +12 for AIGoCode's logo in pngIcons (MindfulReturn on X), the list every drawn icon is looked up in; +491 for each cost in the tray panel's and Requests' chart and ranking in its own provider's currency (onkashiko on X): ledProv and the provider passed through, packed to the shortest form; drawLedColumns and drawLedRank are shared by the panel, so there is no page to move it to; +326 for the Qwen AI platform's Token Plan sign-in (imthe99galaxy on X): its field, sign-in and wait in qianwenplan.js, imported when such a provider's editor opens, and what is left is the import and one quotaError line for its two refusals, packed to the shortest form; quotaError reads every card's error, so there is no page to move it to; +72 for Copy all keys (emilochen on X): its row in keyrates.js, imported when a provider with two or more keys opens through keyRateField, now told which of its parts to draw, and what is left is the one line that places it; +83 for the page saying it has gone from view, so what its Sessions and Usage pages keep goes in 30 s and not 7 minutes (P0 memory): folded into the visibilitychange listener every window has, packed to the shortest form, so there is no page to move it to; +270 for Providers' Select, to remove several at once (eiyuuzaki2333 on X): its rows, bar, removal and keys in pvpick.js, imported when Select is first clicked, and what is left is pvSel, the button's click and two lines in renderProviders, which draws the list, so there is no page to move it to; +81 for each account of a provider's Usage card in a card of its own (normalcoder_ on X): one line that makes the box, its brief look left to CSS, and renderQuotas, which draws every card, so there is no page to move it to; +17 for Kimi Code's booster balance under an allowance card's rings in the tray panel (apple_test_src on X): the card's text line and the wallet line share one filter, packed to the shortest form; panelQuotaCard draws every card, so there is no page to move it to; +51 for what a failed plugin install left in plugins/, listed under Installed with a Remove (CHENGJIAHEGOXIS on X): its section in plugininstalled.js as pmLeftovers, imported when Plugins first draws, and what is left is the one call after drawInstalled; draw is what draws the page, so there is no page to move it to; +123 for a sidebar list folded from its page's row (hkwok06 on X): the chevron, its click and the fold kept per page in navicons.js, imported with the first list, and what is left is the folded list read beside the hidden pages' (navList, which navMine now shares) and the two rows' clicks asking navFold first; navSubs draws every list, so there is no page to move it to; +338 for the Daily update channel (fishmagic80 on X): its segment, its line under Update channel and the version row's two Up to date on Daily words, packed to the shortest form (one t() per choice); Settings › About and renderUpdate draw them on every window, so there is no page to move them to; +35 for Baidu Qianfan's Token Plan sign-in (yuushabu_buyinn on X, #5860): its field in qianfanplan.js, imported when such a provider's editor opens, drawn by renderStepPlan now told whose sign-in it brings, and what is left is the import and two quotaError lines, past the room there was; quotaError reads every card's error, so there is no page to move it to; +27 for Windows' title bar (258a14 on X): the caption buttons, their clicks, the bar's double click and what keeps them over a dialog in wincap.js, imported in Windows' window alone, the header's room for them in app.css, and what is left is the one line that imports it, past the 29 of room there was; that window's frame is drawn on every start, so there is no page to move it to; +107 for the pages in the reader's own order (chet030714 on X): the order, the sidebar and tab bar put in it, and the menu's drag and keys in navorder.js and navpages.js, imported once an order is kept or Settings draws, and what is left is the one line in navHides that imports it; navHides runs on every start, so there is no page to move it to; +275 for the grants Alibaba's Token Plan asks of a RAM user's AccessKey in the reader's language (MetalHqa on X): one string (ALI_RAM) shown under the editor's AccessKey ID and on the card that names them, less the 48 of the wrong "a RAM user that may use Model Studio is enough" it replaces; the editor and quotaError draw them on every window, so there is no page to move them to; +135 for a model test its vendor queued shown queued and not green (sufeng1894 on X): queuedSaid, one string shared by the chip's title, Test models' and Test this model's status, and the chip's amber dot; renderModels draws the provider editor's chips, so there is no page to move it to; +66 for AstrLink Guard's row saying an x64 magpie runs it under Windows on Arm's emulation until the next update installs the Arm build (EV_John_Liu on X), the Rosetta line's sibling, one line in pmSub; the Privacy rows draw it, so there is no page to move it to; +189 for Let magpie set it on a Codex card locked by config.toml's own compact limit or background threshold (sufeng1894 on X), and Undo for a background share taken over: the shared send posts it, packed to the shortest form; adviceRow draws every card, so there is no page to move it to; +864 for Use on a Claude setup-token account, which switches Claude Code itself to it in its settings.json, and Use back on its signed-in account (liukaybee on X): one swUse helper shared by both buttons, packed to the shortest form; renderAccounts draws every account row, so there is no page to move it to; +1 for the classifier timeout's unset default, 15 and not 8 (ESern29751 on X): its second digit in the Settings row's fallback, which renderReplies draws, so there is no page to move it to; +457 for Kimi Code's subagent pool and its effort (XiaoLing_Arisa on X): the Subagents line and its pool menu in kimisub.js, imported before a Kimi Code row's Details first slides open so it measures the line, and what is left is that import, the line's place, the three fields kept out of the row's squares and the picker's note that Kimi's subagents run on the lead's model, packed to the shortest form; renderAgents draws every row, so there is no page to move it to; +354 for Images per request (#6849, Yuu_jiang_ on X): its field and parse are in maximages.js, imported as the editor draws Max output, and what stays is the import, the two saves' lines and the check that the editor is still open when it and keyrates.js land, no page to move them to; +499 for Speed beside Model and Effort in an agent's opened row (Tengs999 on X): the line, its menu and what decides the speed in agentspeed.js, imported before a fast model's Details first slides open so it measures the line, and what is left is that import and the line's place in the panel's and the window's rows, packed to one helper; renderAgents draws every row, so there is no page to move it to; -1,529: each ChatGPT account's own warm-up time moved into autoresetown.js, paying for Advanced opening on a warm-up or check-in that is on (ChrisYagao on X), the room left over given back; +103 for the same .with-sub foot (#5919); +52 for the Advisor kind of an advisor call's own usage row (#6977, Refeccd on Discord): its entry in the generated purposes.js; the kinds are read wherever Usage and Routing draw a row, so there is no page to move it to; +54 for a proxy's failure said in the reader's language (laiuuui on X): proxyWhy is in proxies.js, imported when Settings draws its saved proxies, and what is left is api()'s one line handing the reply to it; api() reads every error, so there is no page to move it to; +843 for which effort a Claude Code tier runs at (lightwlh on X): an unset tier's effort reads follows session, a set one's title says the session's effort and /effort don't change it, and New sessions' effort says a tier with its own runs at that one, one ownSaid shared by both titles, packed to the shortest form; connectPanel and the effort slider draw every agent's Details, so there is no page to move it to; -165: the provider editor's WebSocket row moved into socketrow.js, imported as the editor draws, paying for its tick opening ticked on OpenAI's own API (KawaiiZapic on X), and the room left over given back + appScriptBudget = 1_088_636 // app.js: 1,080,614 at 8016205e3, with the 5,653 of room it had; +123 for a sidebar list folded from its page's row (hkwok06 on X), its chevron and fold in navicons.js, imported with the first list; +57 for each account of a provider's Usage card in a card of its own (normalcoder_ on X), past the 24 of room left; +17 for an allowance card's wallet line under its rings (apple_test_src on X), the one filter shared with its text line; +338 for the Daily update channel (fishmagic80 on X): its segment, its line under Update channel and the version row's two Up to date on Daily words, packed to the shortest form (one t() per choice); Settings › About and renderUpdate draw them on every window, so there is no page to move them to; +35 for Baidu Qianfan's Token Plan sign-in (yuushabu_buyinn on X, #5860): its field in qianfanplan.js, imported when such a provider's editor opens, drawn by renderStepPlan now told whose sign-in it brings, and what is left is the import and two quotaError lines, past the room there was; quotaError reads every card's error, so there is no page to move it to; +27 for Windows' title bar (258a14 on X): the caption buttons, their clicks, the bar's double click and what keeps them over a dialog in wincap.js, imported in Windows' window alone, the header's room for them in app.css, and what is left is the one line that imports it, past the 29 of room there was; that window's frame is drawn on every start, so there is no page to move it to; +107 for the pages in the reader's own order (chet030714 on X): the order, the sidebar and tab bar put in it, and the menu's drag and keys in navorder.js and navpages.js, imported once an order is kept or Settings draws, and what is left is the one line in navHides that imports it; navHides runs on every start, so there is no page to move it to; +275 for the grants Alibaba's Token Plan asks of a RAM user's AccessKey in the reader's language (MetalHqa on X): one string (ALI_RAM) shown under the editor's AccessKey ID and on the card that names them, less the 48 of the wrong "a RAM user that may use Model Studio is enough" it replaces; the editor and quotaError draw them on every window, so there is no page to move them to; +135 for a model test its vendor queued shown queued and not green (sufeng1894 on X): queuedSaid, one string shared by the chip's title, Test models' and Test this model's status, and the chip's amber dot; renderModels draws the provider editor's chips, so there is no page to move it to; +66 for AstrLink Guard's row saying an x64 magpie runs it under Windows on Arm's emulation until the next update installs the Arm build (EV_John_Liu on X), the Rosetta line's sibling, one line in pmSub; the Privacy rows draw it, so there is no page to move it to; +864 for Use on a Claude setup-token account, which switches Claude Code itself to it in its settings.json, and Use back on its signed-in account (liukaybee on X): one swUse helper shared by both buttons, packed to the shortest form; renderAccounts draws every account row, so there is no page to move it to; +1 for the classifier timeout's unset default, 15 and not 8 (ESern29751 on X): its second digit in the Settings row's fallback, which renderReplies draws, so there is no page to move it to; +457 for Kimi Code's subagent pool and its effort (XiaoLing_Arisa on X): the Subagents line and its pool menu in kimisub.js, imported before a Kimi Code row's Details first slides open so it measures the line, and what is left is that import, the line's place, the three fields kept out of the row's squares and the picker's note that Kimi's subagents run on the lead's model, packed to the shortest form; renderAgents draws every row, so there is no page to move it to; +354 for Images per request (#6849, Yuu_jiang_ on X): its field and parse are in maximages.js, imported as the editor draws Max output, and what stays is the import, the two saves' lines and the check that the editor is still open when it and keyrates.js land, no page to move them to; +499 for Speed beside Model and Effort in an agent's opened row (Tengs999 on X): the line, its menu and what decides the speed in agentspeed.js, imported before a fast model's Details first slides open so it measures the line, and what is left is that import and the line's place in the panel's and the window's rows, packed to one helper; renderAgents draws every row, so there is no page to move it to; -1,529: each ChatGPT account's own warm-up time (renderWarmAtOwn) moved into autoresetown.js, imported when its rows first draw, paying for a provider's editor opening Advanced when its warm-up or check-in is on (ChrisYagao on X), and the room left over given back; +103 for the sidebar foot that holds Settings' tabs marked by a class, not :has(), which Safari before 15.4 can't parse (#5919): no page's code small enough to move was left (modelInfo serves two plugins); +52 for a proxy's failure said in the reader's language (laiuuui on X): proxyWhy is in proxies.js, imported when Settings draws its saved proxies, and what is left is api()'s one line handing the reply to it; api() reads every error, so there is no page to move it to; +485 for which effort a Claude Code tier runs at (lightwlh on X): an unset tier's effort reads follows session, a set one's title says the session's effort and /effort don't change it, and New sessions' effort says a tier with its own runs at that one, one ownSaid shared by both titles, packed to the shortest form; connectPanel and the effort slider draw every agent's Details, so there is no page to move it to; -165: the provider editor's WebSocket row moved into socketrow.js, imported as the editor draws, paying for its tick opening ticked on OpenAI's own API (KawaiiZapic on X), and the room left over given back; +68 for the version row saying a version newer than its channel's waits until the channel passes it (realfxw on X): one t() for both channels and the Every version tail shared with Up to date, packed to the shortest form; renderUpdate draws it on every window, so there is no page to move it to + coreScriptBudget = 1_273_327 // every core script at 8016205e3, the old measure 682 over its cap there (#5918); +367 for the model test on a chosen account (tmr11235), no page left to move it to; +151 for the provider menu's "Only on this device" item and its four translations; +458 for Settings › About's Report a problem row and its translations; +113 for withScheme, the one rule every typed address goes through (eachg0 on X), cut to the shortest form that keeps it whole; +10 for the kept whole's tooltip (Musikrv77852 on X), the past-cycle line reused for it, no page left to move it to; +1,112 for Codex's Open button and its Open Codex with menu (Yink88564391 on X), packed to the shortest form, no page left to move them to; +168 for Discover's long lists drawn in part (the owner, 11-13), after the rest of its hook moved into plugingrid.js, imported when Plugins first draws; +296 for the cap toggle and Smart sentences that say what they do and the Sign in on another computer row (Wing8Aqua on X), packed to the shortest form, no page left to move them to; +333 for In turn's figure in a provider's editor and its words naming the message that goes round (Wing8Aqua on X), the figure itself in rotfig.js, imported when In turn is first shown, the hook packed to the shortest form; +236 for a lone capped Codex account's row saying its turns go to the fallbacks when Codex is connected (not_4O4 on X), the two helpers inlined, no page left to move it to; +717 for omp's advisor (Awad_Yoo on X, #6408): its three rows moved into ompadvisor.js, imported when an omp's settings show, and what is left is the import, the role's " · off" and the Settings line's name, packed to the shortest form; +468 for a plugin's own file import (auth.import) in the import sheet, in the plugin's words (marchen_cc on X), packed to one statement; importSay is read as the Providers rows draw, so it has no lazy page to go to, and nothing else was moved out; +180 for Claude Magpie's own Claude Code folder (xMopf7RF on X, #6459): its Advanced fold in claudemagpie.js, imported when it first shows, and what is left is the import and the fold's place in the Separate app line, 216 bytes packed to the shortest form, less the 36 of room there was; +81 for the Use Claude Magpie button on Claude Desktop's row (xMopf7RF on X), drawn by claudemagpie.js too, what is left the one line that places it (#2710); +225 for the Hermes row's Other profiles lines (Norethcy on X), which 1d60b165c took out while each profile had a row and c96f33d65 left with no place at all, packed to the shortest form; the dead hermes# Default note went with it, and the Agents rows draw it, so there is no page to move it to; +397 for a key's own price rate (tnt12231 on X): its lines, check and placeholder in keyrates.js, imported when a provider with two or more keys opens, and what is left is the import, the draft's copy, Advanced opening for it, the save's one line and proxyLines drawing another kind of line; +316 for an image or video model's chip saying what it makes from its right-click (iceloon on X): the chat chip's Makes… now shared with it, and the media chip's Copy model ID left out, packed to the shortest form; the provider's editor draws it, so there is no page to move it to; +67 for the Claude Code · Claude Magpie row saying it is on magpie through Claude Magpie (xMopf7RF on X), one line in connectLine with the shortest words that say it; the Agents rows draw it, so there is no page to move it to; +12 for AIGoCode's logo in pngIcons (MindfulReturn on X), the list every drawn icon is looked up in; +491 for each cost in the tray panel's and Requests' chart and ranking in its own provider's currency (onkashiko on X): ledProv and the provider passed through, packed to the shortest form; drawLedColumns and drawLedRank are shared by the panel, so there is no page to move it to; +326 for the Qwen AI platform's Token Plan sign-in (imthe99galaxy on X): its field, sign-in and wait in qianwenplan.js, imported when such a provider's editor opens, and what is left is the import and one quotaError line for its two refusals, packed to the shortest form; quotaError reads every card's error, so there is no page to move it to; +72 for Copy all keys (emilochen on X): its row in keyrates.js, imported when a provider with two or more keys opens through keyRateField, now told which of its parts to draw, and what is left is the one line that places it; +83 for the page saying it has gone from view, so what its Sessions and Usage pages keep goes in 30 s and not 7 minutes (P0 memory): folded into the visibilitychange listener every window has, packed to the shortest form, so there is no page to move it to; +270 for Providers' Select, to remove several at once (eiyuuzaki2333 on X): its rows, bar, removal and keys in pvpick.js, imported when Select is first clicked, and what is left is pvSel, the button's click and two lines in renderProviders, which draws the list, so there is no page to move it to; +81 for each account of a provider's Usage card in a card of its own (normalcoder_ on X): one line that makes the box, its brief look left to CSS, and renderQuotas, which draws every card, so there is no page to move it to; +17 for Kimi Code's booster balance under an allowance card's rings in the tray panel (apple_test_src on X): the card's text line and the wallet line share one filter, packed to the shortest form; panelQuotaCard draws every card, so there is no page to move it to; +51 for what a failed plugin install left in plugins/, listed under Installed with a Remove (CHENGJIAHEGOXIS on X): its section in plugininstalled.js as pmLeftovers, imported when Plugins first draws, and what is left is the one call after drawInstalled; draw is what draws the page, so there is no page to move it to; +123 for a sidebar list folded from its page's row (hkwok06 on X): the chevron, its click and the fold kept per page in navicons.js, imported with the first list, and what is left is the folded list read beside the hidden pages' (navList, which navMine now shares) and the two rows' clicks asking navFold first; navSubs draws every list, so there is no page to move it to; +338 for the Daily update channel (fishmagic80 on X): its segment, its line under Update channel and the version row's two Up to date on Daily words, packed to the shortest form (one t() per choice); Settings › About and renderUpdate draw them on every window, so there is no page to move them to; +35 for Baidu Qianfan's Token Plan sign-in (yuushabu_buyinn on X, #5860): its field in qianfanplan.js, imported when such a provider's editor opens, drawn by renderStepPlan now told whose sign-in it brings, and what is left is the import and two quotaError lines, past the room there was; quotaError reads every card's error, so there is no page to move it to; +27 for Windows' title bar (258a14 on X): the caption buttons, their clicks, the bar's double click and what keeps them over a dialog in wincap.js, imported in Windows' window alone, the header's room for them in app.css, and what is left is the one line that imports it, past the 29 of room there was; that window's frame is drawn on every start, so there is no page to move it to; +107 for the pages in the reader's own order (chet030714 on X): the order, the sidebar and tab bar put in it, and the menu's drag and keys in navorder.js and navpages.js, imported once an order is kept or Settings draws, and what is left is the one line in navHides that imports it; navHides runs on every start, so there is no page to move it to; +275 for the grants Alibaba's Token Plan asks of a RAM user's AccessKey in the reader's language (MetalHqa on X): one string (ALI_RAM) shown under the editor's AccessKey ID and on the card that names them, less the 48 of the wrong "a RAM user that may use Model Studio is enough" it replaces; the editor and quotaError draw them on every window, so there is no page to move them to; +135 for a model test its vendor queued shown queued and not green (sufeng1894 on X): queuedSaid, one string shared by the chip's title, Test models' and Test this model's status, and the chip's amber dot; renderModels draws the provider editor's chips, so there is no page to move it to; +66 for AstrLink Guard's row saying an x64 magpie runs it under Windows on Arm's emulation until the next update installs the Arm build (EV_John_Liu on X), the Rosetta line's sibling, one line in pmSub; the Privacy rows draw it, so there is no page to move it to; +189 for Let magpie set it on a Codex card locked by config.toml's own compact limit or background threshold (sufeng1894 on X), and Undo for a background share taken over: the shared send posts it, packed to the shortest form; adviceRow draws every card, so there is no page to move it to; +864 for Use on a Claude setup-token account, which switches Claude Code itself to it in its settings.json, and Use back on its signed-in account (liukaybee on X): one swUse helper shared by both buttons, packed to the shortest form; renderAccounts draws every account row, so there is no page to move it to; +1 for the classifier timeout's unset default, 15 and not 8 (ESern29751 on X): its second digit in the Settings row's fallback, which renderReplies draws, so there is no page to move it to; +457 for Kimi Code's subagent pool and its effort (XiaoLing_Arisa on X): the Subagents line and its pool menu in kimisub.js, imported before a Kimi Code row's Details first slides open so it measures the line, and what is left is that import, the line's place, the three fields kept out of the row's squares and the picker's note that Kimi's subagents run on the lead's model, packed to the shortest form; renderAgents draws every row, so there is no page to move it to; +354 for Images per request (#6849, Yuu_jiang_ on X): its field and parse are in maximages.js, imported as the editor draws Max output, and what stays is the import, the two saves' lines and the check that the editor is still open when it and keyrates.js land, no page to move them to; +499 for Speed beside Model and Effort in an agent's opened row (Tengs999 on X): the line, its menu and what decides the speed in agentspeed.js, imported before a fast model's Details first slides open so it measures the line, and what is left is that import and the line's place in the panel's and the window's rows, packed to one helper; renderAgents draws every row, so there is no page to move it to; -1,529: each ChatGPT account's own warm-up time moved into autoresetown.js, paying for Advanced opening on a warm-up or check-in that is on (ChrisYagao on X), the room left over given back; +103 for the same .with-sub foot (#5919); +52 for the Advisor kind of an advisor call's own usage row (#6977, Refeccd on Discord): its entry in the generated purposes.js; the kinds are read wherever Usage and Routing draw a row, so there is no page to move it to; +54 for a proxy's failure said in the reader's language (laiuuui on X): proxyWhy is in proxies.js, imported when Settings draws its saved proxies, and what is left is api()'s one line handing the reply to it; api() reads every error, so there is no page to move it to; +843 for which effort a Claude Code tier runs at (lightwlh on X): an unset tier's effort reads follows session, a set one's title says the session's effort and /effort don't change it, and New sessions' effort says a tier with its own runs at that one, one ownSaid shared by both titles, packed to the shortest form; connectPanel and the effort slider draw every agent's Details, so there is no page to move it to; -165: the provider editor's WebSocket row moved into socketrow.js, imported as the editor draws, paying for its tick opening ticked on OpenAI's own API (KawaiiZapic on X), and the room left over given back; +68 for the version row saying a version newer than its channel's waits until the channel passes it (realfxw on X): one t() for both channels and the Every version tail shared with Up to date, packed to the shortest form; renderUpdate draws it on every window, so there is no page to move it to ) // codeBytes is how many bytes of b are code: its blank lines, its lines diff --git a/internal/gui/tests/update-stable-newest.test.cjs b/internal/gui/tests/update-stable-newest.test.cjs index 38fc278cb..beffb1632 100644 --- a/internal/gui/tests/update-stable-newest.test.cjs +++ b/internal/gui/tests/update-stable-newest.test.cjs @@ -34,6 +34,17 @@ const dailyWords = { de: { newest: "Aktuell auf Täglich · Unter Jede Version ist 0.1.410 erschienen", daily: "Aktuell auf Täglich" }, }; +// newer than the channel's pick (realfxw on X: 0.1.4445 on Daily's +// 0.1.4395): the row says nothing comes until the channel passes it, +// not that it is up to date, and still offers the newest +const aheadWords = { + en: { daily: "Newer than Daily's 0.1.390; it updates once Daily passes it · 0.1.410 is out on Every version", stable: "Newer than Stable's 0.1.390; it updates once Stable passes it" }, + zh: { daily: "比每日版的 0.1.390 新,每日版超过它后才会更新 · 尝鲜版已有 0.1.410", stable: "比稳定版的 0.1.390 新,稳定版超过它后才会更新" }, + "zh-TW": { daily: "比每日版的 0.1.390 新,每日版超過它後才會更新 · 搶先版已有 0.1.410", stable: "比穩定版的 0.1.390 新,穩定版超過它後才會更新" }, + ja: { daily: "デイリー版の 0.1.390 より新しいため、デイリー版が追い越すまで更新されません · 先行版では 0.1.410 が出ています", stable: "安定版の 0.1.390 より新しいため、安定版が追い越すまで更新されません" }, + de: { daily: "Neuer als 0.1.390 auf Täglich; Updates kommen, sobald Täglich diese Version überholt · Unter Jede Version ist 0.1.410 erschienen", stable: "Neuer als 0.1.390 auf Stabil; Updates kommen, sobald Stabil diese Version überholt" }, +}; + function settingsPayload(lang, ctl) { const s = { theme: "light", lang, tray: "panel", quotaLeft: false, currency: "usd", @@ -69,7 +80,7 @@ function server(lang, ctl) { } if (url.pathname === "/api/update") { if (ctl.channel !== "stable" && ctl.channel !== "daily") return json({ state: "latest", current: "0.1.400", latest: "0.1.410" }); - return json({ state: "latest", current: "0.1.400", latest: "0.1.390", channel: ctl.channel, ...(ctl.newest ? { newest: ctl.newest } : {}) }); + return json({ state: "latest", current: "0.1.400", latest: "0.1.390", channel: ctl.channel, ...(ctl.newest ? { newest: ctl.newest } : {}), ...(ctl.ahead ? { ahead: true } : {}) }); } if (url.pathname === "/api/plugins") return json({ plugins: [] }); if (url.pathname === "/api/usage/quotas") return json([]); @@ -159,6 +170,29 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", await openPart(page, "about"); await page.waitForFunction((s) => document.querySelector("#about .row.pref .sub.say")?.textContent === s, dailyWords[lang].daily); assert.equal(await row.locator("button", { hasText: w.go }).count(), 0); + + // ahead of Daily, the newest out: said, the switch offered, and + // the row fits at 420 without a sideways scroll + ctl.ahead = true; + ctl.newest = "0.1.410"; + await page.reload(); + await settingsDrawn(page); + await openPart(page, "about"); + await page.waitForFunction((s) => document.querySelector("#about .row.pref .sub.say")?.textContent === s, aheadWords[lang].daily); + await row.locator("button", { hasText: w.go }).waitFor(); + await showRow(page, row); + assert.equal(await page.evaluate(() => document.documentElement.scrollWidth <= document.documentElement.clientWidth), true, "no sideways scroll ahead of Daily"); + const aheadRight = await row.locator("button", { hasText: w.go }).evaluate((b) => b.getBoundingClientRect().right); + assert.ok(aheadRight <= width, `the button ends at ${aheadRight}, past ${width}`); + // ahead of Stable, nothing newer + ctl.channel = "stable"; + ctl.newest = ""; + await page.reload(); + await settingsDrawn(page); + await openPart(page, "about"); + await page.waitForFunction((s) => document.querySelector("#about .row.pref .sub.say")?.textContent === s, aheadWords[lang].stable); + assert.equal(await row.locator("button", { hasText: w.go }).count(), 0); + ctl.ahead = false; assert.deepEqual(errors, []); }); } diff --git a/internal/gui/update.go b/internal/gui/update.go index 71180961b..d1bf9920d 100644 --- a/internal/gui/update.go +++ b/internal/gui/update.go @@ -152,7 +152,13 @@ type updateJSON struct { // isn't the newest Channel string `json:"channel,omitempty"` Newest string `json:"newest,omitempty"` - Done int64 `json:"done,omitempty"` // downloading: bytes so far + // Ahead: latest on Stable or Daily, this version is newer than the + // channel's (Latest). Nothing is installed until the channel passes + // it, and "up to date on Daily" read as an update that never came + // (realfxw on X: 0.1.4445 on Daily, whose pick was 0.1.4395, restarted + // again and again) + Ahead bool `json:"ahead,omitempty"` + Done int64 `json:"done,omitempty"` // downloading: bytes so far // downloading: the step under way, "" before the first // (update.StepDownload, StepRetry, StepVerify, StepUnpack, // StepSignature), and how fast the bytes came over the last seconds, @@ -808,6 +814,7 @@ func (u *updater) jsonIn(lang string) updateJSON { j.Channel = u.channel if u.state == "latest" { j.Newest = u.newest + j.Ahead = update.Newer(Version, u.latest.Version) } } if u.latestStale() { diff --git a/internal/gui/update_channel_test.go b/internal/gui/update_channel_test.go index 15a60ae76..443d5e829 100644 --- a/internal/gui/update_channel_test.go +++ b/internal/gui/update_channel_test.go @@ -314,3 +314,67 @@ func TestStableUpToDateNamesNewest(t *testing.T) { t.Fatalf("every version: %v, asked %d times", j, asked.Load()-before) } } + +// A version newer than its channel's (realfxw on X): 0.1.4445 on Daily, +// whose pick was 0.1.4395, with 0.1.4472 out on every version. The row +// said "up to date on Daily", nothing was installed until Daily passed +// 0.1.4445, and the user restarted again and again for an update that +// wasn't coming. The answer now says it is ahead (the row: newer than +// Daily's, it updates once Daily passes it), and still names the newest. +// The same version as the channel's, or every version, isn't ahead. +func TestUpdateAheadOfChannel(t *testing.T) { + sandboxHome(t) + srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + v := "0.1.4472" + if r.URL.Query().Get("channel") == "daily" { + v = "0.1.4395" + } + json.NewEncoder(w).Encode(update.Release{Version: v, Notes: "- x"}) + })) + defer srv.Close() + t.Setenv("MAGPIE_UPDATE_FEED", srv.URL) + oldV := Version + defer func() { Version = oldV }() + exe, err := update.Executable() + if err != nil { + t.Fatal(err) + } + o := updates + defer func() { updates = o }() + // as the page reads it + check := func(channel, v string) map[string]any { + t.Helper() + s := settings.Load() + s.UpdateChannel, s.NoAutoUpdate = channel, true + if err := settings.Save(s); err != nil { + t.Fatal(err) + } + Version = v + u := &updater{exe: exe} + u.self, _ = os.Stat(exe) + updates = u + u.check() + for range 1000 { + if j := u.json(); j.State != "checking" && j.State != "downloading" { + var m map[string]any + b, _ := json.Marshal(j) + if err := json.Unmarshal(b, &m); err != nil { + t.Fatal(err) + } + return m + } + time.Sleep(10 * time.Millisecond) + } + t.Fatalf("still %s", u.json().State) + return nil + } + if j := check(settings.UpdateDaily, "0.1.4445"); j["state"] != "latest" || j["ahead"] != true || j["channel"] != "daily" || j["latest"] != "0.1.4395" || j["newest"] != "0.1.4472" { + t.Fatalf("ahead of Daily: %v", j) + } + if j := check(settings.UpdateDaily, "0.1.4395"); j["state"] != "latest" || j["ahead"] != nil || j["newest"] != "0.1.4472" { + t.Fatalf("Daily's own version: %v", j) + } + if j := check("", "0.1.4472"); j["state"] != "latest" || j["ahead"] != nil || j["channel"] != nil { + t.Fatalf("every version: %v", j) + } +}