Skip to content

Every agent's model. One place. Codex on DeepSeek, Claude Code on Kimi, from the menu bar.

gui: Discover is quieter: one unofficial mark, one button style, a reason in your language

yetone63c0c354af4e
diff --git a/internal/gui/assets/i18n.js b/internal/gui/assets/i18n.js
index aecd925ed..a315b18e6 100644
--- a/internal/gui/assets/i18n.js
+++ b/internal/gui/assets/i18n.js
@@ -3561,12 +3561,12 @@ const I18N = {
"Getting Bun…": "正在下载 Bun…",
"Plugins run on Bun {v}, downloaded once": "插件运行在 Bun {v} 上,只需下载一次",
"Coming soon": "即将上线",
- "Unofficial": "非官方",
- "Tagged {topic} on GitHub by its author. Nobody at magpie has read it: read its code before you install it": "作者在 GitHub 上给它打了 {topic} 标签,magpie 没有审阅过:安装前请先看看它的代码",
"{n} stars on GitHub": "GitHub 上 {n} 个 Star",
"Unofficial, on GitHub": "非官方插件 · GitHub",
"Looking on GitHub": "正在 GitHub 上查找",
"Couldn't ask GitHub: {error}": "无法连接 GitHub:{error}",
+ "GitHub didn't answer in time": "GitHub 响应超时",
+ "GitHub is turning requests away for now": "GitHub 暂时限制了请求",
"{n} more on GitHub couldn't be read: {error}": "GitHub 上还有 {n} 个插件没能读取:{error}",
"GitHub found {n} repositories, but none of them could be read: {error}": "GitHub 找到了 {n} 个仓库,但一个都没能读取:{error}",
"Couldn't ask GitHub, so these are from before: {error}": "无法连接 GitHub,下面是之前获取的列表:{error}",
@@ -7458,12 +7458,12 @@ const I18N = {
"Getting Bun…": "正在下載 Bun…",
"Plugins run on Bun {v}, downloaded once": "外掛執行在 Bun {v} 上,只需下載一次",
"Coming soon": "即將上線",
- "Unofficial": "非官方",
- "Tagged {topic} on GitHub by its author. Nobody at magpie has read it: read its code before you install it": "作者在 GitHub 上給它打了 {topic} 標籤,magpie 沒有審閱過:安裝前請先看看它的程式碼",
"{n} stars on GitHub": "GitHub 上 {n} 個 Star",
"Unofficial, on GitHub": "非官方外掛 · GitHub",
"Looking on GitHub": "正在 GitHub 上尋找",
"Couldn't ask GitHub: {error}": "無法連線 GitHub:{error}",
+ "GitHub didn't answer in time": "GitHub 回應逾時",
+ "GitHub is turning requests away for now": "GitHub 暫時限制了請求",
"{n} more on GitHub couldn't be read: {error}": "GitHub 上還有 {n} 個外掛未能讀取:{error}",
"GitHub found {n} repositories, but none of them could be read: {error}": "GitHub 找到了 {n} 個儲存庫,但一個都未能讀取:{error}",
"Couldn't ask GitHub, so these are from before: {error}": "無法連線 GitHub,以下是先前取得的列表:{error}",
@@ -11377,12 +11377,12 @@ const I18N = {
"Getting Bun…": "Bun を取得中…",
"Plugins run on Bun {v}, downloaded once": "プラグインは Bun {v} で動作します(ダウンロードは一度だけ)",
"Coming soon": "近日公開",
- "Unofficial": "非公式",
- "Tagged {topic} on GitHub by its author. Nobody at magpie has read it: read its code before you install it": "作者が GitHub で {topic} タグを付けたものです。magpie はレビューしていません。インストール前にコードを確認してください",
"{n} stars on GitHub": "GitHub のスター {n}",
"Unofficial, on GitHub": "非公式 · GitHub",
"Looking on GitHub": "GitHub を検索中",
"Couldn't ask GitHub: {error}": "GitHub に接続できませんでした:{error}",
+ "GitHub didn't answer in time": "GitHub の応答がタイムアウトしました",
+ "GitHub is turning requests away for now": "GitHub が一時的にリクエストを制限しています",
"{n} more on GitHub couldn't be read: {error}": "GitHub 上のほか {n} 件を読み込めませんでした:{error}",
"GitHub found {n} repositories, but none of them could be read: {error}": "GitHub で {n} 件のリポジトリが見つかりましたが、どれも読み込めませんでした:{error}",
"Couldn't ask GitHub, so these are from before: {error}": "GitHub に接続できないため、以前の一覧を表示しています:{error}",
@@ -15309,12 +15309,12 @@ const I18N = {
"Getting Bun…": "Bun wird geladen…",
"Plugins run on Bun {v}, downloaded once": "Erweiterungen laufen auf Bun {v}, einmalig heruntergeladen",
"Coming soon": "Demnächst",
- "Unofficial": "Inoffiziell",
- "Tagged {topic} on GitHub by its author. Nobody at magpie has read it: read its code before you install it": "Vom Autor auf GitHub mit {topic} getaggt. Niemand bei magpie hat es geprüft: Lies den Code, bevor du es installierst",
"{n} stars on GitHub": "{n} Sterne auf GitHub",
"Unofficial, on GitHub": "Inoffiziell, auf GitHub",
"Looking on GitHub": "Suche auf GitHub",
"Couldn't ask GitHub: {error}": "GitHub nicht erreichbar: {error}",
+ "GitHub didn't answer in time": "GitHub hat nicht rechtzeitig geantwortet",
+ "GitHub is turning requests away for now": "GitHub weist Anfragen vorübergehend ab",
"{n} more on GitHub couldn't be read: {error}": "{n} weitere auf GitHub konnten nicht gelesen werden: {error}",
"GitHub found {n} repositories, but none of them could be read: {error}": "GitHub hat {n} Repositories gefunden, aber keines konnte gelesen werden: {error}",
"Couldn't ask GitHub, so these are from before: {error}": "GitHub nicht erreichbar, dies ist die Liste von zuvor: {error}",
diff --git a/internal/gui/assets/plugins.css b/internal/gui/assets/plugins.css
index 4b5c6cd93..0781b0bed 100644
--- a/internal/gui/assets/plugins.css
+++ b/internal/gui/assets/plugins.css
@@ -48,11 +48,16 @@
they don't */
.pm-ghbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pm-ghbar .segs { flex: none; max-width: 100%; }
-.pm-ghfind { width: min(240px, 100%); }
+/* it takes a share of the room the strips leave, up to what its
+ placeholder needs, so "Filter by name, author or description" isn't cut */
+.pm-ghfind { flex: 4 0 auto; width: min(240px, 100%); max-width: min(320px, 100%); }
.pm-ghnone { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 22px 12px; border-radius: 12px; border: 1px dashed var(--line); font-size: 12px; color: var(--muted); text-align: center; }
/* what GitHub couldn't give, over the cards it could: a quiet line, its
reason wrapping anywhere (a URL in it is one long word) */
-.pm-ghwarn { display: flex; align-items: baseline; flex-wrap: wrap; gap: 2px 10px; font-size: 12px; color: var(--muted); }
+.pm-ghwarn { display: flex; align-items: baseline; flex-wrap: wrap; gap: 2px 6px; padding: 0 2px; font-size: 11.5px; color: var(--muted); }
+/* its Try again reads as the button it is, beside the quiet line */
+.pm-ghwarn .text { padding: 1px 6px; margin: -1px 0; font-size: 11.5px; color: var(--accent); }
+.pm-ghwarn .text:hover:not(:disabled) { color: var(--accent); background: var(--accent-soft); }
.pm-ghwarn > span, .pm-ghnone > span { overflow-wrap: anywhere; }
.pm-logo { flex: none; width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--pill); color: var(--fg-2); }
@@ -132,8 +137,12 @@ button.pm-chip:disabled { cursor: default; opacity: .6; }
/* an update out: Install's size, green for its own (#1587) */
.pm-act.pm-up { background: var(--green-soft); color: var(--green); }
.pm-act.pm-up:hover:not(:disabled) { background: var(--green); color: var(--card); }
-.pm-act.go { background: var(--accent); color: var(--accent-fg); }
-.pm-act.go:hover:not(:disabled) { filter: brightness(1.08); background: var(--accent); color: var(--accent-fg); }
+/* Sign in, in a list of cards or rows, is Install's tinted capsule: one
+ style for a row's action, so no card shouts over its neighbours (HIG's
+ one filled button is a sheet's own); a plugin's page fills it */
+.pm-act.go { background: var(--accent-soft); color: var(--accent); }
+.pm-act.go:hover:not(:disabled), .pm-dact .pm-act.go { background: var(--accent); color: var(--accent-fg); }
+.pm-dact .pm-act.go:hover:not(:disabled) { filter: brightness(1.08); }
.pm-act.done { background: none; color: var(--green); padding: 0 8px; min-width: 0; }
.pm-act.done:hover:not(:disabled) { background: var(--green-soft); color: var(--green); }
.pm-act.busy { color: var(--muted); font-weight: 500; }
@@ -278,6 +287,7 @@ button.pm-chip:disabled { cursor: default; opacity: .6; }
@media (max-width: 560px) {
.pm-head { flex-wrap: wrap; }
.pm-find { width: 100%; order: 3; }
+ .pm-ghfind { max-width: 100%; }
.pm-art { display: none; }
}
@media (prefers-reduced-motion: reduce) {
diff --git a/internal/gui/assets/plugins.js b/internal/gui/assets/plugins.js
index 0abb82bdb..c12096861 100644
--- a/internal/gui/assets/plugins.js
+++ b/internal/gui/assets/plugins.js
@@ -15,6 +15,7 @@
let listings = null; // /api/plugins/listings: the plugins suggested
let tagged = null; // /api/plugins/github: repositories their authors tagged magpie-plugin, as listings
let taggedErr = ""; // why the list isn't GitHub's whole answer: it couldn't be asked, or...
+ let taggedKind = ""; // its kind: "slow", "limited" or ""
let taggedMissing = 0; // ...this many repositories it named couldn't be read
let topic = "magpie-plugin";
const npm = {}; // /api/plugins/npm: package → what npm says of it
@@ -182,10 +183,12 @@
const got = (r.repos || []).map(ghListing);
if (!(r.error && !got.length && tagged?.length)) tagged = got;
taggedErr = r.error || "";
+ taggedKind = r.why || "";
taggedMissing = r.missing || 0;
if (r.topic) topic = r.topic;
} catch (e) {
taggedErr = e.message || String(e);
+ taggedKind = "";
taggedMissing = 0;
tagged = tagged || [];
}
@@ -526,7 +529,7 @@
const sum = el("p", "pm-sum", summary(l));
const meta = el("div", "pm-meta");
meta.append(kindChip(kindOf(l)));
- if (l.github) meta.append(unofficial(), stars(l.github.stars));
+ if (l.github) meta.append(stars(l.github.stars));
if (l.npm?.weekly) {
const d = el("span", "pm-dl");
d.append(glyph(DOWN, 11, 1.5), el("span", "", t("{n}/week", { n: count(l.npm.weekly) })));
@@ -552,13 +555,6 @@
return c;
}
- // a repository's author put it here, nobody reviewed it: said on its card
- function unofficial() {
- const u = el("span", "pm-chip warn");
- u.append(el("span", "dot"), el("span", "", t("Unofficial")));
- u.title = t("Tagged {topic} on GitHub by its author. Nobody at magpie has read it: read its code before you install it", { topic });
- return u;
- }
function stars(n) {
const d = el("span", "pm-dl");
d.append(glyph(STAR, 11, 1.4), el("span", "", count(n)));
@@ -653,10 +649,16 @@
replaceKeeping(ghSec, [ghHead, skeleton(3)]);
return ghSec;
}
- // why the list isn't GitHub's whole answer; kept: cards are shown
- const ghWhy = (kept) => taggedMissing
- ? t(kept ? "{n} more on GitHub couldn't be read: {error}" : "GitHub found {n} repositories, but none of them could be read: {error}", { n: taggedMissing, error: taggedErr })
- : t(kept ? "Couldn't ask GitHub, so these are from before: {error}" : "Couldn't ask GitHub: {error}", { error: taggedErr });
+ // why the list isn't GitHub's whole answer; kept: cards are shown. A
+ // known kind in the reader's words, the raw error as its hover
+ const ghWhy = (kept) => {
+ const error = { slow: t("GitHub didn't answer in time"), limited: t("GitHub is turning requests away for now") }[taggedKind] || taggedErr;
+ const s = el("span", "", taggedMissing
+ ? t(kept ? "{n} more on GitHub couldn't be read: {error}" : "GitHub found {n} repositories, but none of them could be read: {error}", { n: taggedMissing, error })
+ : t(kept ? "Couldn't ask GitHub, so these are from before: {error}" : "Couldn't ask GitHub: {error}", { error }));
+ if (error !== taggedErr) s.title = taggedErr;
+ return s;
+ };
// and one GitHub couldn't be asked of says so, with another go
function ghFailed() {
ghHead.replaceChildren(...ghTitle());
@@ -671,7 +673,7 @@
drawBody();
loadTagged(true).then(drawBody);
};
- box.append(el("span", "", ghWhy(false)), again);
+ box.append(ghWhy(false), again);
replaceKeeping(ghSec, [ghHead, box]);
return ghSec;
}
@@ -686,7 +688,7 @@
again.disabled = true;
loadTagged(true).then(drawBody);
};
- note.append(el("span", "", ghWhy(true)), again);
+ note.append(ghWhy(true), again);
return note;
}
function ghSection(list) {
@@ -739,7 +741,7 @@
// what's installed, on both sides of it: a reader looks for what to
// add as much as for what they have
if (both) {
- const pick = segs([["", t("All") + " · " + n(ghKind, "")], ["have", t("Installed") + " · " + n(ghKind, "have")], ["none", t("Not installed") + " · " + n(ghKind, "none")]], ghHave, (h) => { ghHave = h; drawGh(); });
+ const pick = segs([["", t("All")], ["have", t("Installed") + " · " + n(ghKind, "have")], ["none", t("Not installed") + " · " + n(ghKind, "none")]], ghHave, (h) => { ghHave = h; drawGh(); });
pick.classList.add("pm-ghhave");
pick.setAttribute("role", "group");
pick.setAttribute("aria-label", t("Installed or not"));
diff --git a/internal/gui/plugins.go b/internal/gui/plugins.go
index 0eb87a369..2d6387c37 100644
--- a/internal/gui/plugins.go
+++ b/internal/gui/plugins.go
@@ -5,6 +5,7 @@ import (
"encoding/json"
"errors"
"io"
+ "net"
"net/http"
"regexp"
"strings"
@@ -12,6 +13,7 @@ import (
"github.com/yetone/magpie/internal/agent"
"github.com/yetone/magpie/internal/gateway"
+ "github.com/yetone/magpie/internal/ghtoken"
"github.com/yetone/magpie/internal/middleware"
"github.com/yetone/magpie/internal/plugin"
"github.com/yetone/magpie/internal/provider"
@@ -522,6 +524,11 @@ func pluginRoutes(mux *http.ServeMux, w Windows) {
if errors.As(err, &m) {
out["error"], out["missing"] = m.Why.Error(), m.Missing
}
+ // and what kind of why, for the page to say in the reader's
+ // language (the raw error stays its hover)
+ if w := taggedWhyKind(err); w != "" {
+ out["why"] = w
+ }
}
writeJSON(rw, out)
})
@@ -793,3 +800,19 @@ func pluginAgentOf(spec string, errs map[string]string) *pluginAgentJSON {
}
return nil
}
+
+// taggedWhyKind is what kind of failure keeps GitHub's list from being
+// whole: "slow" when GitHub didn't answer in time, "limited" when it
+// turned magpie away for its rate limit, "" for anything else (the page
+// shows that error as it is).
+func taggedWhyKind(err error) string {
+ var lim ghtoken.Limited
+ var ne net.Error
+ switch {
+ case errors.As(err, &lim):
+ return "limited"
+ case errors.Is(err, plugin.ErrNoAnswer), errors.Is(err, context.DeadlineExceeded), errors.As(err, &ne) && ne.Timeout():
+ return "slow"
+ }
+ return ""
+}
diff --git a/internal/gui/plugins_github_why_test.go b/internal/gui/plugins_github_why_test.go
new file mode 100644
index 000000000..1097a5f11
--- /dev/null
+++ b/internal/gui/plugins_github_why_test.go
@@ -0,0 +1,52 @@
+package gui
+
+import (
+ "context"
+ "errors"
+ "fmt"
+ "net"
+ "net/url"
+ "testing"
+ "time"
+
+ "github.com/yetone/magpie/internal/ghtoken"
+ "github.com/yetone/magpie/internal/plugin"
+)
+
+// The Plugins page says why GitHub's list isn't whole in the reader's
+// language when magpie knows the kind of why, rather than Go's English in
+// the middle of the page (the Kiko03O1 reply on X: "no answer in 8s"
+// under 非官方插件 · GitHub). Each kind as the errors arrive: wrapped in
+// TaggedMissing, in a url.Error, or as they are.
+func TestTaggedWhyKind(t *testing.T) {
+ timeout := &url.Error{Op: "Get", URL: "https://raw.githubusercontent.com/a/b/main/package.json", Err: &net.OpError{Op: "dial", Net: "tcp", Err: timeoutErr{}}}
+ refused := &url.Error{Op: "Get", URL: "http://127.0.0.1:1/raw", Err: &net.OpError{Op: "dial", Net: "tcp", Err: errors.New("connect: connection refused")}}
+ for _, c := range []struct {
+ name string
+ err error
+ want string
+ }{
+ {"the page stopped waiting", &plugin.TaggedMissing{Missing: 7, Why: fmt.Errorf("%w in %s", plugin.ErrNoAnswer, 8*time.Second)}, "slow"},
+ {"a read past its deadline", &plugin.TaggedMissing{Missing: 2, Why: &url.Error{Op: "Get", URL: "https://raw.githubusercontent.com/x", Err: context.DeadlineExceeded}}, "slow"},
+ {"a dial that timed out", &plugin.TaggedMissing{Missing: 1, Why: timeout}, "slow"},
+ {"the search past its deadline", fmt.Errorf("search: %w", context.DeadlineExceeded), "slow"},
+ {"GitHub's rate limit", ghtoken.Limited{Until: time.Now().Add(time.Hour)}, "limited"},
+ {"GitHub's rate limit, missing", &plugin.TaggedMissing{Missing: 3, Why: ghtoken.Limited{Token: true}}, "limited"},
+ {"refused: said as it is", &plugin.TaggedMissing{Missing: 12, Why: refused}, ""},
+ {"anything else", errors.New("GitHub's search: 502 Bad Gateway"), ""},
+ } {
+ if got := taggedWhyKind(c.err); got != c.want {
+ t.Errorf("%s: %q, want %q (%v)", c.name, got, c.want, c.err)
+ }
+ }
+ // the error as it came is still what the line's hover says
+ if e := fmt.Errorf("%w in %s", plugin.ErrNoAnswer, 8*time.Second); e.Error() != "no answer in 8s" {
+ t.Errorf("hover: %q", e)
+ }
+}
+
+type timeoutErr struct{}
+
+func (timeoutErr) Error() string { return "i/o timeout" }
+func (timeoutErr) Timeout() bool { return true }
+func (timeoutErr) Temporary() bool { return true }
diff --git a/internal/gui/tests/plugin-github-filter.test.cjs b/internal/gui/tests/plugin-github-filter.test.cjs
index 6ee80a7cf..fb013801d 100644
--- a/internal/gui/tests/plugin-github-filter.test.cjs
+++ b/internal/gui/tests/plugin-github-filter.test.cjs
@@ -111,7 +111,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
// two of them, a provider and a middleware, are already here, as
// the page's own cards say
const have = sec.locator(".pm-ghhave .opt");
- const wantHave = async (rs) => [await tr("All") + " · " + rs.length, await tr("Installed") + " · " + rs.filter(here).length, await tr("Not installed") + " · " + rs.filter((r) => !here(r)).length];
+ const wantHave = async (rs) => [await tr("All"), await tr("Installed") + " · " + rs.filter(here).length, await tr("Not installed") + " · " + rs.filter((r) => !here(r)).length];
assert.deepEqual(await have.allTextContents(), await wantHave(GH.repos));
assert.equal(await sec.locator(".pm-ghhave .opt.on").textContent(), (await wantHave(GH.repos))[0]);
assert.deepEqual((await sec.locator(".pm-card.have .pm-name b").allInnerTexts()).sort(), names(GH.repos.filter(here)));
diff --git a/internal/gui/tests/plugin-github-wait.test.cjs b/internal/gui/tests/plugin-github-wait.test.cjs
index 927d30e03..a121409e7 100644
--- a/internal/gui/tests/plugin-github-wait.test.cjs
+++ b/internal/gui/tests/plugin-github-wait.test.cjs
@@ -65,10 +65,10 @@ function server(lang, gh, urls = []) {
}
const L = {
- en: { section: "Unofficial, on GitHub", look: "Looking on GitHub", failed: /Couldn't ask GitHub/, again: "Try again", none: /GitHub found 12 repositories, but none of them could be read/, more: /12 more on GitHub couldn't be read/ },
- zh: { section: "非官方插件 · GitHub", look: "正在 GitHub 上查找", failed: /无法连接 GitHub/, again: "重试", none: /GitHub 找到了 12 个仓库,但一个都没能读取/, more: /GitHub 上还有 12 个插件没能读取/ },
- ja: { section: "非公式 · GitHub", look: "GitHub を検索中", failed: /GitHub に接続できませんでした/, again: "再試行", none: /GitHub で 12 件のリポジトリが見つかりましたが/, more: /GitHub 上のほか 12 件を読み込めませんでした/ },
- de: { section: "Inoffiziell, auf GitHub", look: "Suche auf GitHub", failed: /GitHub nicht erreichbar/, again: "Erneut versuchen", none: /GitHub hat 12 Repositories gefunden/, more: /12 weitere auf GitHub konnten nicht gelesen werden/ },
+ en: { section: "Unofficial, on GitHub", look: "Looking on GitHub", failed: /Couldn't ask GitHub/, again: "Try again", none: /GitHub found 12 repositories, but none of them could be read/, more: /12 more on GitHub couldn't be read/, slow: /7 more on GitHub couldn't be read: GitHub didn't answer in time/ },
+ zh: { section: "非官方插件 · GitHub", look: "正在 GitHub 上查找", failed: /无法连接 GitHub/, again: "重试", none: /GitHub 找到了 12 个仓库,但一个都没能读取/, more: /GitHub 上还有 12 个插件没能读取/, slow: /GitHub 上还有 7 个插件没能读取:GitHub 响应超时/ },
+ ja: { section: "非公式 · GitHub", look: "GitHub を検索中", failed: /GitHub に接続できませんでした/, again: "再試行", none: /GitHub で 12 件のリポジトリが見つかりましたが/, more: /GitHub 上のほか 12 件を読み込めませんでした/, slow: /GitHub の応答がタイムアウトしました/ },
+ de: { section: "Inoffiziell, auf GitHub", look: "Suche auf GitHub", failed: /GitHub nicht erreichbar/, again: "Erneut versuchen", none: /GitHub hat 12 Repositories gefunden/, more: /12 weitere auf GitHub konnten nicht gelesen werden/, slow: /GitHub hat nicht rechtzeitig geantwortet/ },
};
const shot = async (loc, name) => {
@@ -216,6 +216,22 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
assert.deepEqual(urls2, ["/api/plugins/github", "/api/plugins/github?again=1"]);
assert.deepEqual(m.errors, []);
+ // GitHub too slow, as magpie tells it (why: "slow"): the line
+ // says so in the reader's language, not Go's "no answer in 8s"
+ // in the middle of the page, and the error as it came is its
+ // hover (the Kiko03O1 reply on X: ui 设计能不能好看点); Try
+ // again reads as a button, in the accent
+ const s = await open([{ json: { repos: REPOS, topic: "magpie-plugin", error: "no answer in 8s", why: "slow", missing: 7 } }]);
+ t.after(() => s.ctx.close());
+ const sLine = s.sec.locator(".pm-ghwarn");
+ await sLine.waitFor();
+ assert.match(await sLine.innerText(), w.slow);
+ assert.doesNotMatch(await sLine.innerText(), /no answer/);
+ assert.equal(await sLine.locator("span").first().getAttribute("title"), "no answer in 8s");
+ const tone = (v) => s.page.evaluate((v) => { const d = document.createElement("div"); d.style.color = `var(${v})`; document.body.append(d); const c = getComputedStyle(d).color; d.remove(); return c; }, v);
+ assert.equal(await sLine.getByRole("button", { name: w.again }).evaluate((b) => getComputedStyle(b).color), await tone("--accent"));
+ assert.deepEqual(s.errors, []);
+
// a failed ask after a list was had: the list stands, and the
// line says it is from before
const k = await open([{ json: { repos: REPOS, topic: "magpie-plugin" } }, { json: { repos: [], topic: "magpie-plugin", error: "GitHub's search: 403 rate limit" } }]);
diff --git a/internal/gui/tests/plugin-github.test.cjs b/internal/gui/tests/plugin-github.test.cjs
index a6d6e3d62..e488a522c 100644
--- a/internal/gui/tests/plugin-github.test.cjs
+++ b/internal/gui/tests/plugin-github.test.cjs
@@ -126,8 +126,10 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
assert.equal(await cards.nth(2).locator(".pm-logo img").count(), 0);
// a provider and a middleware part by hue (yetone: 中间件和供应商稍微有点区分吧)
assert.equal(await c.locator(".pm-chip.kind.pv").count(), 1);
- assert.equal((await c.locator(".pm-chip.warn").innerText()).trim(), w.chip);
- assert.match(await c.locator(".pm-chip.warn").getAttribute("title"), /magpie-plugin/);
+ // unofficial is said by the section's head, once, not by a chip on
+ // every card in it (the Kiko03O1 reply on X: ui 设计能不能好看点)
+ assert.equal(await sec.locator(".pm-chip.warn").count(), 0);
+ assert.equal(await sec.locator(".pm-meta", { hasText: w.chip }).count(), 0);
assert.equal((await c.locator(".pm-dl").innerText()).trim(), "1.3k");
assert.equal((await c.locator(".pm-ver").innerText()).trim(), "v2.2.1");
// installed by its page's URL: Installed all the same
@@ -203,7 +205,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
await page.waitForFunction(() => document.querySelectorAll("#view-plugins .pm-sec .pm-card").length === 1);
assert.deepEqual(await found.locator(".pm-name b").allInnerTexts(), ["opencode-quota"]);
await view.locator(".pm-find input").fill("nothing-like-it");
- await page.waitForFunction(() => !document.querySelector("#view-plugins .pm-sec .pm-card .pm-chip.warn"));
+ await page.waitForFunction(() => !document.querySelector("#view-plugins .pm-ghsec .pm-card"));
assert.equal(asked.filter(([k]) => k === "fetched").length, 0, "nothing fetched from outside: " + JSON.stringify(asked.filter(([k]) => k === "fetched")));
assert.deepEqual(errors, []);
diff --git a/internal/gui/tests/plugin-market.test.cjs b/internal/gui/tests/plugin-market.test.cjs
index 576473b7f..5bc160ae3 100644
--- a/internal/gui/tests/plugin-market.test.cjs
+++ b/internal/gui/tests/plugin-market.test.cjs
@@ -189,6 +189,15 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
await dlg.locator(".pm-act", { hasText: w.install }).click();
await dlg.locator(".pm-act.go", { hasText: w.signIn }).waitFor();
assert.deepEqual(asked.find(([k]) => k === "add")[1], { spec: "opencode-copilot-auth" });
+ // the page's one action is filled; on the card behind it, Sign in is
+ // Install's tinted capsule, so no card in the grid shouts over the
+ // rest (the Kiko03O1 reply on X: ui 设计能不能好看点)
+ const fill = (loc) => loc.evaluate((b) => getComputedStyle(b).backgroundColor);
+ const tone = (v) => page.evaluate((v) => { const d = document.createElement("div"); d.style.background = `var(${v})`; document.body.append(d); const c = getComputedStyle(d).backgroundColor; d.remove(); return c; }, v);
+ assert.equal(await fill(dlg.locator(".pm-act.go")), await tone("--accent"));
+ const cardGo = copilot.locator(".pm-act.go", { hasText: w.signIn });
+ await cardGo.waitFor();
+ assert.equal(await fill(cardGo), await tone("--accent-soft"));
await dlg.locator(".pm-act.go").click();
await page.locator("#view-providers").waitFor({ state: "visible" });
await page.waitForFunction(() => document.querySelector("#modal").hidden);
diff --git a/internal/plugin/github.go b/internal/plugin/github.go
index 5d8dace88..1d8d07a02 100644
--- a/internal/plugin/github.go
+++ b/internal/plugin/github.go
@@ -101,6 +101,10 @@ func taggedOnDisk() []Tagged {
return l
}
+// ErrNoAnswer is GitHub not answering a read before the page stopped
+// waiting for it.
+var ErrNoAnswer = errors.New("no answer")
+
// TaggedMissing is the error TaggedRepos gives when GitHub's search
// answered but repositories it named couldn't be read: Missing of them
// aren't in the list, for Why.
@@ -357,7 +361,7 @@ func askTagged(ctx context.Context, last []Tagged) (l []Tagged, whole bool, miss
w := why
mu.Unlock()
if w == nil {
- w = fmt.Errorf("no answer in %s", taggedWait)
+ w = fmt.Errorf("%w in %s", ErrNoAnswer, taggedWait)
}
missing = &TaggedMissing{Missing: gone, Why: w}
}