Commit Graph
7 Commits
Author SHA1 Message Date
yetone d1436466a6 gui: Kimi Code's region picker says to pick by the account's region (Kimi)
Kimi (a sponsor) asked for two things on 10-27: start the partner card
at the user's region, which ef155a5ca did, and "并在编辑器加一句「按你的
Kimi 账号所在区域选择」", because China and Global accounts don't work
on each other's endpoints. The second was not done: the picker still
said "which endpoint Kimi Code is reached through".

Now a partner whose regions include both China's and Global's (placeOf,
the same reading homeRegion uses) is sent with splitAccounts, and its
picker's hint reads "pick the region of your {p} account" (zh: 按你的
{p} 账号所在区域选择, and zh-TW, ja, de). Of the partners served on
10-27 only Kimi has both; APIKEY.FAN's Default/Direct and the partners
without regions keep the old hint. Built-in presets are left alone:
yylx lists Global and China Mainland, and one yylx account works at
both, so the rule is not true for every China/Global pair.

app.js stays within TestCoreScriptBudget without a raise: the test is
decided in Go, the English key is short, and the Bedrock comment above
the picker is one line.

Tests:
- TestPartnerStartsAtTheUsersRegion: SplitAccounts is set on kimi and on
  no other partner of testdata/partners-2026-10-27.json, at home and
  abroad. Broken by hand (SplitAccounts always false): "kimi (-1):
  SplitAccounts false".
- partners.test.cjs: the region hint in en/zh/ja/de at 900 and 440,
  chromium and webkit, 19/19 each. Broken by hand (app.js back to the
  old hint): "actual: 'which endpoint Acme AI is reached through'".
- add-sheet, key-plan, segment-press-dialog, tencent-cloud,
  strip-scrollbar: chromium and webkit, all pass.
- i18n-keys: 3/4; "a plugin's words are its own" fails the same at
  origin/main 2b0387574 without this change (#3897).
- go test -tags nogui ./internal/gui ok. ./internal/provider: crashed in
  TestUnreadLoginsWriteErrorsKeepCredentials (#3632); with that test
  skipped, three reds, TestFetchAsksASharedBaseOnce and two siblings,
  which fail the same at 2b0387574 without this change (#3854).
- gofmt -l clean; go vet on darwin, linux (nogui) and windows for
  internal/provider.

Not tried: the real app with Kimi's live partner card; no full ./... run.
2026-10-28 00:19:58 +08:00
yetone ef3b9f85a4 gui: a new partner puts a still dot on Providers in the sidebar
yetone: 有新的合作伙伴的时候,侧边栏这个地方是否也应该有一个精致优雅的点来提醒
用户一下呀?…就是不要太打扰用户。

markNewPartners now lights Providers in the nav (window mode) together with
the add button's dot: the same has-dot Plugins uses for an update (6px at
the sidebar row's end, 5px at a tab's corner, accent, no animation), titled
with the new partners' names. It goes out with the add button's dot, when
the add sheet has shown the partners. prefetchProviders calls it once the
background read lands, so an app opened on another page shows it too.

Run at 81a58d2f3 + this change (rebased, the pushed tree):
- partners.test.cjs, chromium + webkit: 38 of 38 (new: nav dot at 1280
  sidebar and 900 tabs, en + zh, opened on ?view=agents, gone after the
  sheet and after a reload; the add-button tests also check the nav).
  With app.js reverted: the 8 dot tests per engine red (18 fail).
- plugin-updates, provider-add-gemini, partners alone: 80 of 80.
- The 66 GUI files naming has-dot / has-new / addProvider / side-nav plus
  i18n-keys, concurrency 4 at load ~48: 877 of 894. Reds: builtins and
  sidebar (masking tab, the same on an origin/main 81a58d2f3 copy, #3498);
  plugin-updates de 1024 (#3633) and provider-add-gemini webkit 420px
  (#3634), both green alone and on the main copy.
- Screenshots of the sidebar, light and dark, at 1280: the dot sits at the
  Providers row's end like Plugins'.
Not run: the whole 893-file GUI suite (another session's GUI suite was on
the machine); the real Wails app.
2026-10-26 00:40:50 +08:00
yetone ade2f06288 gui: a new partner's tile in the add sheet keeps a small dot until it is opened
yetone asked that a new partner's card carry a dot too, small and quiet:
"有了新的合作方、供应商,它对应的Card上应该也有小点来提醒一下用户…不要太打扰
用户,也不要太丑". The dot on the + button (05b596587) goes once the sheet
shows the partner, so the sheet itself said nothing about which tile was
new.

Each partner still new (p.new, not added) when the sheet first shows it
gets a 6px accent dot after its name, the same dot and colour as the +
button's. It scales in and rings once, then rests; a hidden sheet's
animation would start over on showing, so the dot drops .in when its
ring ends, and a tile drawn again doesn't animate. Reduced motion: none.
Opening the tile spends the dot. The set lives for this run of the GUI,
since p.new is spent on the server once the sheet showed it. The dot is
role=img, labelled "New" (zh/zh-TW 新, ja 新着, de Neu).

app.js grows 850 bytes, in the add sheet, the core's own; the budgets
are raised by exactly that, with no room added.

Run at 7e0c03105, then rebased on 91b0be836 (the routing plugin only,
outside the core budget), where go test ./internal/gui -run
'Budget|Asset|I18n' is ok:
- partners.test.cjs, chromium and webkit, en/zh/ja/de at 900 and 440,
  with new cases for en and zh at both widths: the dot on Acme only in
  en (China Only is zh-only), on both in zh; 6px, painted, inside its
  tile, labelled; still there after the sheet closes and opens; no .in
  on a dot drawn again; gone from Acme after opening it, in the sheet it
  folds back into and in the sheet opened again: 30/30.
- Broken by hand (the dot never appended): 10 of 30 red, the new cases
  in both engines.
- i18n-keys, gui-ja, gui-de: 9/9.
- go test ./internal/gui: ok (TestCoreScriptBudget red at 1,339,300
  before trimming comments and raising the budget).
- gofmt -l internal/gui: clean.

Not run: the whole GUI suite (850 files). Only partners.test.cjs gives
a partner new, and the dot draws only for one. Not tried in the real app.
2026-10-23 22:15:50 +08:00
yetone 19f9a80d90 gui: a partner's editor link names its own page (www.kimi.com), not usemagpie.ai
The feed sends a partner's website through usemagpie.ai/go/<id>/site so
the visit is counted, and the provider editor's "↗" link read its host:
Kimi Code's editor said "usemagpie.ai ↗" where Kimi asked for
"www.kimi.com ↗". The worker now sends the website's own host beside it
as siteHost (partner and region), the app keeps it on the PresetDef and
Region, and the editor's link reads siteHost first, following the region
picked. The click still opens the /go link.

app.js grows 102 bytes; both budgets are raised by exactly that, no room
added.

Run at origin/main be002aca0 (this commit's parent):
- site: node --test worker.test.mjs 20/20 (new siteHost asserts).
- go test ./internal/provider -run 'Partner|Preset' ok; TestPartnersFromTheFeed
  checks siteHost survives the partner leaving the feed and a restart.
- go test ./internal/gui ok (budgets).
- partners.test.cjs 30/30, chromium and webkit, en/zh; red on the old
  label code (read "usemagpie.ai ↗").
- 86-file GUI run (editor header and every file it can reach): 1117/1118;
  the red is sessions-codex-provider chromium zh's nav click at 5s under
  load, 4/4 alone three times, filed as #3360.
- gofmt clean; GOOS=windows go vet ./internal/provider ./internal/gui ok.
Not tried: the live app; it needs this release and the worker deploy.
2026-10-23 15:44:48 +08:00
yetone 05b5965872 providers, gui: a partner listed since the add sheet last showed the partners puts a small dot on the "+ Add provider" button, its name in the title, until the sheet shows it (yetone: 有了新的合作伙伴的时候,这里能否有个小小的精致优雅的提醒吸引用户点击查看)
Ran: go test ./internal/provider ./internal/gui ./internal/tui .;
partners.test.cjs (chromium + webkit, en/zh at 900 and 440), i18n-keys,
gui-ja, gui-de; GOOS=linux -tags nogui and GOOS=windows builds.
2026-10-09 01:45:43 +08:00
yetone 7d663a2769 providers, stats: count how often each partner is shown, opened, has its key page opened and is added, per day and capped, and send the days that have ended with the daily stats as "magpie partner" events; off with the stats or with what magpie is used with (yetone: 能否统计每个合作伙伴的展示数和点击数)
Ran: go test ./internal/provider ./internal/stats ./internal/gui ./internal/tui .;
partners.test.cjs (chromium + webkit), privacy-usage-stats, i18n-keys,
gui-ja, gui-de; GOOS=linux -tags nogui and GOOS=windows builds.
2026-10-09 01:40:02 +08:00
yetone 10578ce683 providers: the add sheet lists Partners first, above Subscriptions, under a heading that says they sponsor magpie; who they are comes from usemagpie.ai/api/partners (site/partners.js), so a paid listing changes with a deploy, not a release (yetone)
The app fetches the list behind the call every 6 hours (10 minutes after a
failure), never waiting, and keeps it in the cache folder. Each entry is
checked: its own id, never a built-in preset's; a name and an endpoint;
https only; at most 12; no decision API, no-key or user endpoint. Its logo
goes through FetchIcon. A partner is a preset to the rest of magpie, and
one that has left still is to the providers added from it, unsponsored.
The window lists a partner in the languages it names only, with its tagline
in the page's language; `magpie presets` and the TUI list them first too.
MAGPIE_PARTNERS moves the list, off lists none.

Run: go test -tags nogui -race ./internal/provider ./internal/gui
./internal/tui . (ok); TestPartners* -race -count=3; node --test
internal/gui/tests/partners.test.cjs add-sheet gui-ja gui-de i18n-keys in
Chromium and WebKit (en/zh/ja/de, 900 and 440px); node --test
site/worker.test.mjs site/install.test.mjs; the built binary in a sandbox
HOME against a local feed: listed, an http entry left out, listed from the
cache with the site down, `provider add` from it.
2026-10-08 22:52:30 +08:00