Commit Graph
34 Commits
Author SHA1 Message Date
yetone 00e9a27582 site: /favicon.ico goes to /favicon.png
Search Console listed /favicon.ico as a 404 (crawled 10-28). The pages
link /favicon.png, but crawlers and old browsers still ask for the .ico.
It now gets a 301 to the PNG.

Run: node --test worker.test.mjs install.test.mjs on mote, 71/71 ok.
2026-11-09 19:03:47 +08:00
yetone da52b8ab73 site: leave Cloudflare's Web Analytics beacon to Cloudflare
Web Analytics had counted no visits for usemagpie.ai in 30 days. Every
page carried two beacons: the worker's manual one and the one Cloudflare
now injects into worker responses itself. The manual one loaded first,
took the page, and posted to cloudflareinsights.com/cdn-cgi/rum, which
answers 404 for this site's token. Cloudflare's own (r:1) posts to
usemagpie.ai/cdn-cgi/rum, which answers 204 for the same payload. The
worker now adds only PostHog.

Run: node --test worker.test.mjs install.test.mjs on mote, 68 pass. The
contributors test now fails if the worker adds cloudflareinsights again.
Checked by hand: curl with browser headers shows Cloudflare's injected
beacon on /, /zh/ and /docs/; the same-origin POST answers 204.
2026-11-09 06:40:01 +08:00
yetone 3fc6ee4111 site: release files from Cloudflare R2, GitHub behind them
Updates and the installer downloaded every file from github.com, which
answered 504 for every release file for hours on 2026-11-08. The site now
keeps a copy on R2 (bucket magpie-releases, binding RELEASES):

- A five-minute cron copies the newest release and the Stable one from
  github.com (or, when that fails, GitHub's API) into R2. R2's put takes a
  file only with the SHA-256 the release's SHA256SUMS gives. A run starts
  no copy after 4 minutes; the feeds' tags and the 4 newest besides are
  kept, older ones deleted.
- /files/<tag>/<file> serves R2's copy, Range and conditional asks
  included; a file R2 doesn't hold, or a failing R2, is a 302 to
  github.com.
- /api/latest (both channels) and /download name /files only for a file
  R2 holds under the release's hash, and give every file's github.com
  address as `github`, which the previous commit's clients fall back to.
  Older clients only mirror a github.com address, so a mirror never goes
  in front of the site's.
- start (en, zh, ja), privacy (en, zh, ja) and reference.md say where
  files come from.

Run (mote): node --test site/*.test.mjs 104/104, with files.test.mjs
(R2 stood in for by r2stub.mjs) and new worker tests for the feed,
/download, /files and the cron. wrangler deploy --dry-run binds RELEASES.

Broken by hand: onR2 taking any held file regardless of hash, two tests
red (the feed test and "bytes R2 holds under another hash").

Not tried yet: the real cron run and R2 serving (after deploy).
2026-11-09 05:48:23 +08:00
yetone c66cdbea97 update: a release file github.com won't serve comes through GitHub's API
On 2026-11-08 github.com answered 504 for every file of
yetone/magpie-releases (…/releases/download/<tag>/<file>) for hours, while
api.github.com/repos/yetone/magpie-releases/releases/assets/<id>, asked
with Accept: application/octet-stream, redirected to the same bytes.
Every self-update and the install script failed (kurutodenzeru, wjbdx,
isee1_1 on Discord). Retrying the same address (a46190e1f) can't help.
The site's feed was stuck at 0.1.3318 too: its SHA256SUMS read went to
the same address.

- internal/update: download() goes to the API route at the first busy
  status (5xx/429), or for the last try after connection errors. The
  feed's new per-asset `api` is used as it is; without it the address is
  looked up from the release's tag (apiroute.go). The file is checked
  exactly as before: the feed's SHA-256, and Stage's signing-team check on
  the Mac. A mirror the user set keeps precedence: through one, no API
  route is tried (its whole point is that GitHub isn't reachable). This is
  the one download every caller uses: the app's update, the CLI's
  `magpie update` and serve's auto-update.
- site/public/install.sh: when the feed's github.com URL fails and no
  mirror is set, it downloads through the feed's `api` (else looks it up
  with curl+sed, no jq), and checks the same SHA-256.
- site/worker.js: the feed lists `api` per asset. SHA256SUMS is read
  through the API when github.com fails. While it does, each file's `url`
  is usemagpie.ai/dl/<tag>/<file>, which 302s to the address GitHub's API
  gives (only *.githubusercontent.com or github.com, https), so an older
  magpie, which follows `url` only, updates too, still checked against the
  feed's SHA-256. That feed is cached 60s instead of 300s, so it goes
  back to github.com's URLs soon after github.com recovers.
- docs/reference.md: the API route, and that a mirror keeps precedence.

Run:
- mote: go test -tags nogui -count=1 ./internal/update (ok 20.3s).
- mote: node --test site/install.test.mjs site/worker.test.mjs
  site/stable.test.mjs: 76 pass.
- gofmt -l internal/update: clean. mote: GOOS=linux go vet -tags nogui
  ./..., GOOS=windows go vet -tags nogui ./..., GOOS=windows go vet
  ./internal/update ./internal/cli ./internal/gui: clean.
- Real, on the Linux box (wsl-run, magpie-desktop) at 10:50Z: a nogui
  build stamped 0.1.3000, `magpie update` in a sandbox HOME
  (MAGPIE_ADDR=127.0.0.1:9). MAGPIE_UPDATE_FEED was a local feed whose
  magpie-cli-linux-amd64 url answered 504, with the real `api` of
  v0.1.3319 and the sha256 from the real SHA256SUMS. The download address
  was asked once and got 504. The file came through api.github.com, and
  the binary was replaced with exactly 89fff184… and reports 0.1.3319.
- Real: install.sh's apiroute sed against api.github.com's full
  v0.1.3319 description found the right asset id for 5 files
  (723602745 for magpie-cli-linux-amd64, the same as Go's lookup).
- Full suite: not run at push; it runs after.

Broken by hand:
- No switch to the API route in download(): 3 of the 4 new Go tests red
  ("504 Gateway Timeout, on every try").
- Mirror check and the octet-stream Accept removed:
  TestMirrorKeepsPrecedenceOverTheAPIRoute red, and
  TestDownloadGoesThroughTheAPIWhenGitHubIsBusy red (checksum: GitHub's
  JSON description instead of the file).
- worker: no API read of SHA256SUMS, no /dl location cache, and no check
  of the redirect's host: each red.
- install.sh: no API fallback, then no mirror guard: each new install
  test red.

Not tried:
- The real outage itself: github.com had recovered (302, slowly) by the
  real run, so the 504 was a local server's and the API route was real.
- An old magpie through the deployed /dl route against a failing
  github.com; it is covered by the worker test only.
- install.sh end to end against the real API (only its lookup); the Mac
  app's Stage through the API route (only the fake tests, which keep the
  signing-team check unchanged).
2026-11-08 18:52:32 +08:00
yetone dac759e54c site: a contributors page, everyone magpie's history credits with the releases that came of it (packinggoodsllc_07668 on Discord)
usemagpie.ai/docs/contributors, /docs/zh/contributors and
/docs/ja/contributors list each person the release notes' thanks line
would (the previous commit's rules), with the versions their reports,
ideas or code went into, newest first: three shown, the rest under
"N more", each linking its release. A name with a known GitHub login
links it; the platform a report came from (Discord, X, …) sits under it.

How it is built: wrangler.jsonc's build runs `node credits-cli.mjs wall`
at each deploy. It reads every tag's commits from git, the issue authors
from GitHub (reusing the last build's answers), and writes
public/contributors.json and the table in each language,
public/contributors/{en,zh,ja}.html (gitignored). worker.js puts that
table into the page's #wall with HTMLRewriter; without it the page keeps
a line pointing at the release notes. A build that can't read git leaves
the last list. The page says how names are found (only as already public
in the history, no emails, no maintainer, agents or bots) and how to be
left off: Discord, an issue, or a PR to site/contributors-exclude.txt.
Every docs page's footer and the home page's (foot.contrib in zh, ja, de)
link it. Styles reuse docs.css's table and tokens.

Run (mote, node 22): node --test site/*.test.mjs 77/77. The wall on a
clone of origin/main c991733d with a real token: 1338 people over 5933
released commits in 19s, ~1MB of table a language, no email address in
it.

Broken by hand: withWall matching /docs/contributors only → the
injection test red on /docs/zh/contributors; ja/docker.html's footer link
removed → the footer test red on it.

Not tried: the page in a browser before deploy (the worker's rewriter is
stood in for in the test; the deployed pages are checked after).
2026-11-01 16:40:39 +08:00
yetone deabe0903e docker: a stable tag that follows the desktop app's Stable channel
jorbenzhu on Discord (#feedback, 10-31): "建议 docker镜像 也提供 stable 类tag,
与桌面版保持同步的稳定版发布". The desktop app's Stable channel is chosen in
site/worker.js (stableOf: once a week the newest release out three days,
or an urgent one at once) and served at /api/latest?channel=stable. The
image had latest, a version's tags, 0.1, 0 and edge, nothing for Stable.

New .github/workflows/docker-stable.yml reads that feed, hourly and after
each Docker run, and points ghcr.io/yetone/magpie:stable at the image
docker.yml already built for that version (buildx imagetools create, no
build). It decides nothing itself, so the tag can't drift from the
desktop's pick. latest, edge and the version tags aren't touched. A feed
it can't read (or one naming no version) leaves the tag where it was,
with a warning; no image for the Stable version is a red run. Images are
compared by their platform manifests, so a run with nothing to do pushes
nothing. Docker docs (en, zh, ja) list the tag; worker.js's Stable
comment points to the workflow.

Run:
- actionlint on the workflow: ok.
- The step's script locally against the real feed and ghcr (create
  swapped for an echo): feed says 0.1.1327, :stable missing -> would
  create stable from 0.1.1327; feed 404 -> warning, exit 0; stable
  already the same manifests -> "already", exit 0; no image for the
  version -> exit 4 (red).
- node --test site/*.test.mjs on mote: 49 pass.

Not tried:
- the workflow on GitHub itself: it first runs on its schedule or after
  the next Docker run; I didn't dispatch it by hand. Its first run
  creates :stable.
- whether buildx imagetools create with one source keeps the index's
  digest (the compare is by platform manifests, so either way is fine).
2026-10-31 11:51:01 +08:00
yetone 14b451c117 site: the MCP hub's docs are the MCP router's, and the old links redirect
The feature is called the MCP router now (the commit before). The docs
pages move to mcp-router.html in en, zh and ja, their wording follows
(MCP router / MCP 路由 / MCP ルーター, `magpie library mcp router on|off`),
and every docs page's link and canonical/hreflang URL points at the new
path. The worker answers /docs/mcp-hub, /docs/zh/mcp-hub and
/docs/ja/mcp-hub (with or without .html or a trailing slash) with a 301
to the new page, keeping the query, so links already shared still open.

The plugins pages' link to the router page (Search1API's tools,
from the rebase) follows too.

Run at e2583df31 (this stack on 86fef947e), on mote: gofmt -l clean;
go vet for darwin, linux (-tags nogui) and windows; go build ./...;
go test -tags nogui ./... -timeout 45m, 81 packages ok, 0 FAIL;
library, gateway, imagemcp, sessions, cli and gui again alone, ok;
site's node --test, 49 of 49. GUI on xiaomi-gpu (Windows; mote's
browsers crashed under other sessions' suites): library-*, image*,
mcp-hub-direct, i18n-keys, list-sort and plugin-tools, both engines and
every language, 1055 of 1056: i18n-keys found "{name} is given to each
agent directly" dropped from the library's strings in the rebase. Put
back in the first commit; at the pushed head i18n-keys, mcp-hub-direct
and library-mcp-hub are 48 of 48. That is the only difference from
e2583df31.
Broken by hand at e2583df31: imagemcp ignoring magpie/roots fails
TestHubCallSavesInTheCallersProject; the router asking anything but
roots/list fails TestHubAsksTheAgentItsRoots and TestHubRootsUnasked;
inHub leaving magpie-image out fails TestHubGivesMagpieImage.
Checked: no 聚合, ハブ or mcp-hub left under site/ except the redirect.
The worker's redirect test fails without the redirect line (not ok 7).
Rebased once more onto 2570efb5f, which changed library-mcp-hub,
list-sort, mcp-hub-direct and gateway-routing.md. Run at the pushed
head: go build; gateway, library, cli and imagemcp tests ok; the GUI
budget tests ok; on xiaomi-gpu i18n-keys, mcp-hub-direct,
library-mcp-hub and list-sort, 51 of 54. The three reds were WebKit
420px library-mcp-hub cases with no Connect sheet after a reload.
origin/main d77da5bff goes red the same way (de 420px, 9 of 11). In a
second run of library-mcp-hub on WebKit at this head, 11 of 11 passed.
Filed as #4483.
2026-10-31 02:49:08 +08:00
yetone cfb06e11c3 site: PostHog goes through usemagpie.ai/r/, and downloads are counted
A blocker that knows posthog.com dropped every count of the pages, so the
snippet's api_host is now this site's /r/: relay passes the library and
its config on to PostHog's assets host and the rest to its ingestion
host, with the visitor's address as X-Forwarded-For (PostHog's country)
and without the site's cookies. ui_host stays PostHog's.

Downloads weren't in PostHog at all: /download/* and install.sh are now
counted server-side, as "magpie site download" (link, file, country,
browser or command) and "magpie site install script", each under an id
of its own like the partner counts. A HEAD, or a file the release
doesn't have, isn't counted. The privacy pages (en, zh, ja) say both.

Run: node --test site/worker.test.mjs site/install.test.mjs
site/stable.test.mjs on mote, 48 pass. Broken by hand (no
X-Forwarded-For, the Cookie passed on, the download count off): the
relay and download tests went red. A Playwright page with the snippet
and every posthog.com request aborted (a blocker): Chromium on mote and
WebKit on xiaomi-gpu (mote's WebKit wouldn't launch at load 28) sent
$pageview, $autocapture, $snapshot, $$heatmap and $web_vitals through
/r/ alone, nothing blocked; under GPC nothing was fetched.
2026-10-31 01:46:34 +08:00
yetone f982e46f26 site: PostHog also records sessions, errors, dead clicks and request timings
The owner asked for every dimension. The snippet now captures dead clicks,
uncaught errors, network timings with Web Vitals, and a session recording
with every input masked. advanced_disable_flags is gone, since the
recording, heatmaps and the other switches arrive in the project's remote
config. The project's settings were changed to match: cookieless off,
session recording, heatmaps, Web Vitals, exception autocapture and dead
clicks on, recordings masking all inputs. The privacy pages (en, zh, ja)
list what is sent now.

Run on mote: a Playwright page with the worker's snippet, Chromium and
WebKit x normal/DNT/GPC, events intercepted, remote config and recorder
from the real project. Normal: $pageview, $autocapture, $$heatmap,
$web_vitals and $snapshot sent, no cookies, one ph_* localStorage key;
text typed in an input appears in no payload, and in Chromium's
recording it is a 12-star mask. DNT and GPC: nothing fetched or sent.
node --test site/worker.test.mjs site/install.test.mjs site/stable.test.mjs:
45 pass.
2026-10-30 05:05:41 +08:00
yetone 3caa125f93 site: PostHog keeps a localStorage id, so it sees country, returns and clicks
Cookieless mode drops the address before GeoIP, so the dashboard had no
country, and a visitor's id changed daily. The snippet now keeps its id in
localStorage (never a cookie: the pages vary on Cookie for the lang
redirect), and adds autocapture with heatmaps and Web Vitals. No
recordings, and still nothing loaded under DNT or GPC. The privacy pages
(en, zh, ja) say what is sent now.

Run on mote: a Playwright page with the worker's snippet, Chromium and
WebKit x normal/DNT/GPC. Normal: $pageview and $autocapture sent with a
uuid distinct_id, no cookies, one ph_* localStorage key, typed input text
not in any event. DNT and GPC: the library isn't fetched, nothing sent.
Headless Chromium needed opt_out_useragent_filter in the harness only.
node --test site/worker.test.mjs site/install.test.mjs site/stable.test.mjs:
45 pass.
2026-10-30 04:56:38 +08:00
yetone 0c12662f2f site: PostHog Web Analytics on every page, cookieless
usemagpie.ai's pages now load PostHog beside Cloudflare Web Analytics,
injected where the beacon is (worker.js, every HTML response). It runs
with cookieless_mode "always" (nothing in cookies, localStorage or
sessionStorage), page views and page leaves only (no autocapture,
recordings, surveys or flags), in the daily count's project. Under Do
Not Track or Global Privacy Control the script isn't loaded at all:
respect_dnt alone doesn't stop a cookieless capture. The privacy page
(en, zh, ja) says what PostHog gets.

The project's cookieless tracking setting must be on, or PostHog drops
these events.

Run on mote: node --test site/worker.test.mjs site/install.test.mjs
site/stable.test.mjs, 45 pass. A Playwright check (Chromium and WebKit)
loaded the snippet, routed us.i.posthog.com, gunzipped the batch: one
$pageview with distinct_id $posthog_cookieless, no cookies, nothing in
either storage. With doNotTrack "1" and with globalPrivacyControl, no
request and posthog not loaded. Broken by hand: respect_dnt alone still
sent under DNT; Playwright's webdriver flag trips posthog's bot filter,
so the check hid it.
2026-10-30 03:50:32 +08:00
yetone 8f4469954e site: a Stable update feed, a release a week and an urgent one at once
ssharpcc on X reads every changelog before updating, for fear of a ban
when behind, and with many releases a day that is a lot of reading. This
is the feed side of Settings' Update channel: /api/latest?channel=stable.

How Stable is chosen (stableOf, from the release list, never by hand):
- as each week begins (Monday 00:00 UTC), the newest release that had
  been out three days by then (published <= Monday - 3 days);
- an urgent release is Stable as soon as it is out, until a weekly pick
  passes it.
A release is urgent when a line of its notes starts with
"**Urgent release:** <why>" (quoted or not). GitHub releases are not
marked pre-release for any of this.

GitHub's newest 100 releases are about a day of magpie, so a KV ledger
(LEDGER, usemagpie-ledger) keeps 45 days of {version, published, urgent}
and each day's notes, filled by a cron every 15 minutes: the API's first
page (the releases feed when the API says no, keeping the ledger's dates
and API notes), the pages after it while there is a hole, and on back to
21 days, at most four API asks a run, writing only what changed. A
ledger that can't be read is never written over. /api/notes reads a
range older than the newest 100 on from the ledger, so a Stable app's
week of notes comes as one list. Without a ledger reaching the week's
cut, the stable feed answers 503 (no-store) rather than guess. The
default feed, and any other channel value, is unchanged.

Run: node --test site/*.test.mjs (stable.test.mjs 14 new, every clock
held: weekStart, the cut to the second, a week held and moved on, urgent
before/after its time, unknown, the ledger's paging, hole, ask cap,
broken KV, API-limited feed fallback, notes past the 100 newest; the
existing worker and install tests 31 pass). wrangler deploy --dry-run
shows the LEDGER binding.
Broken by hand, each red: no soak, a rolling 3 days instead of the week,
urgent ignored, no ledger notes, a broken read taken as empty, the
feed's date or notes over the API's, notes bucketed by the feed's date,
no hole mending, no ask cap, the index always rewritten, the marker
matched mid-line.
Not tried: a real cron run before this deploy; the anonymous API's
60/hour limit under the cron's asks beyond reasoning (one ask a run once
the ledger is deep).

Requested by ssharpcc on X.
2026-10-26 21:08:00 +08:00
yetone 761904b5ab whatsnew: Settings' What's new can show this version and the 10, 20, 50 or 100 before it (Linka)
Linka (linkaww, Discord, 10-25): 希望「关于 - 更新内容」加个可选项,查看
「上次更新以来 / 当前版本前 10 / 20 / 50 / 100 个版本」的更新说明.

Settings › About › What's new now has a pill in its head (the app's
menu, sess-pick, never a native select): "Since the last update", the
default and what it showed before, or "This version and {n} before" for
10, 20, 50 and 100. The dialog shown by itself after an update has no
pill and is unchanged.

- site/worker.js: /api/notes takes limit=, the newest that many after
  upto, so a request for 11 isn't answered with 100.
- internal/update: NotesBack(ctx, upto, n, lang) asks upto and limit
  n+1; Back(notes, upto, n) keeps upto and the n releases before it,
  newest first, Install sections stripped, empties dropped. It is not
  capped at MaxNotes (40), which only Between keeps.
- internal/gui/whatsnew.go: /api/whatsnew?all=1&last=N, for N in
  10/20/50/100 only (anything else is the default). Cached per language,
  the longest range asked kept, and a shorter one cut from it, so
  picking 10 after 100 asks nothing and a reopen asks nothing. A failed
  fetch is unknown: the reply carries error and whatever range was had
  before.
- app.js: openWhatsNew(b, last) and wnRange. A pick that fails keeps
  the notes last shown, says "Couldn't load the release notes" with Try
  again above them, and Try again asks the same range.
- The archive helpers (archivedCalls, headersPanel, downloadArchive,
  archiveBodyPanel), used only by the Usage page, moved to
  plugins/usage/page.js as d08b6118b did, so app.js stays under its
  budget (1,319,177 of 1,321,336); no budget raised.
- i18n: three strings in zh, zh-TW, ja and de.

Run at the pushed head (rebased on origin/main 0d2a10116):
- go test -count=1 -tags nogui ./internal/update/ ./internal/gui/ in a
  sandbox HOME: ok (TestNotesBack, TestWhatsNewBackRanges,
  TestCoreScriptBudget among them).
- gofmt -l: none. go build ./...; go vet ./...; GOOS=linux go vet -tags
  nogui ./...; GOOS=windows go vet ./...: ok.
- node --test site/worker.test.mjs: 21 pass (new: limit keeps the
  newest that many up to upto; "", 0, x and -1 mean no limit).
- GUI at this head, both engines: whats-new-range (new), whats-new,
  whats-new-failed, i18n-keys, ledger-cache-unknown, request-archive and
  request-archive-usage (the Usage page holds the moved helpers): 50 of
  50. whats-new-range.test.cjs alone is 12 of 12: five languages x two
  engines plus the post-update dialog in both. Covers the default label
  and no last= asked, the menu's head and five items, 10 then 100,
  the same pick asking nothing, a failed 50 keeping the 100 shown with
  the error above, Try again, no scroll, no left-border accent, and a
  440px window with the pill inside the dialog.
- Whole GUI suite (869 files), chromium then webkit, concurrency 4:
  still running at push time, started at 1f156ba40 (the same change on
  e57e78563); the tree was rebased under it at 01:45. Chromium at 01:46:
  1725 top-level tests passed, 7 red, none in a What's new or Usage file:
  agents' sign-ins, Plugins › Built-in, zh-TW 420px context map, gateway
  mode, an MCP server out of the library, and "a menu opened from a long
  text box's rule stays open" (en, zh). They will be checked against
  origin/main and filed or fixed when the run ends. Before the rebase,
  usage-ledger's "newest live route needs no return-to-live button" was
  red here and on an origin/main e57e78563 copy alike (#3104, #3001).

Broken by hand, each red, then restored:
- the pill not added to the head: whats-new-range red.
- the kept notes not used on a failure: red at "the notes shown before
  are kept".
- the ?last= route skipped: TestWhatsNewBackRanges red.
- Back not cutting to n+1: TestNotesBack red.

Not tried:
- the real site: the test fakes /api/notes and /api/whatsnew. The site
  holds GitHub's newest 100 releases, so "100 before" on the newest
  version can show at most 100. An undeployed site ignores limit; the
  app cuts the list itself.
- the real app window (Wails/WebKitGTK); only Playwright's engines.
- go test ./... in full was not run: the machine had a queue of other
  sessions' full suites, and the owner's rule is not to hold a verified
  commit behind one.

Known limits: a range view carries no pending (waiting update) notes;
if a longer cached range dropped an Install-only release, a range cut
from it can reach one release further back than a fresh ask would.
2026-10-25 01:46:55 +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 5c82e6880d site: every sponsor link goes through usemagpie.ai/go, so its clicks are counted per place
The home page's "Sponsored by" cards and the READMEs' Sponsors logo linked
the sponsors directly, so nothing told the owner how many clicks each seat
brought. They now link /go/<id>/home and https://usemagpie.ai/go/<id>/readme.
site/sponsors.js holds where each sends the browser (the sponsor's own ref
link, unchanged: APINEBULA has one per place). The worker counts a GET as
"magpie sponsor go" {id, where, country} in PostHog, beside the in-app
partners' "magpie partner go" (whose /go links were already counted), and a
HEAD goes on uncounted. A partner's keys/site links are tried first; a
sponsor link takes no region.

A test fails if index.html or either README links a sponsor's own URL
directly, or names a /go link sponsors.js doesn't have.

Run: node --test site/worker.test.mjs (20 pass) and site/install.test.mjs
(10 pass). Broke it by hand: README.zh-CN.md back on the direct link turns
the guard red. Deployed (version e4f40cff); curl on usemagpie.ai:
/go/apinebula/readme → 302 apinebula.ai/ref/qmXqFGpr, /go/apinebula/home →
302 apinebula.ai/ref/Gs54HwyB, /go/yylx/home → 302 yylx.io/?ref=magpie,
/go/yylx/readme and /go/apinebula/home/x → 404; / and /zh/ serve the /go
hrefs. Not checked: the events arriving in PostHog (the worker's key can't
read).
2026-10-13 03:29:22 +08:00
yetone f04792f906 icon: remote icons are fetched through usemagpie.ai/api/icon, so their hosts never see the user's IP
A plugin's package.json icon, an import link's icon= and the library's
market icons sit on hosts their authors pick. magpie fetched each straight
from there, so an author could log the IP of everyone who opened Discover
or the library. The owner asked for icons to keep showing without that.

- site/worker.js: /api/icon?url=<https URL> fetches the picture from
  Cloudflare with only Accept: image/* and its own User-Agent, follows
  redirects, caps it at 1 MB (the app's MaxIcon), passes on only PNG,
  JPEG, GIF, WebP, ICO or SVG (by bytes, as StoreIcon), and counts and
  keeps nothing. It refuses http, userinfo, a non-443 port and
  usemagpie.ai itself; 404s are cached 5 minutes, 5xx not at all.
- internal/iconproxy: URL(u) is the proxied address (MAGPIE_ICON_PROXY
  for tests); a picture already on usemagpie.ai is asked for as it is.
- provider.FetchIcon (plugin, import link and partner icons) and
  library.fetchImage (market icons, avatars) fetch through it. The
  import link's checks (https, public host) still come first; there is
  no direct fallback. provider.FaviconFor still reads the user's own
  provider's site directly: they already send it their requests.
- Privacy text in README en/zh, docs/reference.md and site docs
  start/import in en/zh/ja says so.

Ran:
- node --test site/*.test.mjs: 28 pass. The new test asks with Cookie,
  UA, X-Forwarded-For and CF-Connecting-IP and checks only accept and
  user-agent go upstream; 415/413/502/400 cases; its fetch stub throws
  instead of reaching the network. With the usemagpie.ai refusal
  removed by hand it goes red (27/1).
- TestFetchIconGoesThroughTheProxy and TestIconGoesThroughTheProxy
  (author host is .invalid; an httptest server stands in for the proxy):
  with the proxy taken out by hand both go red (provider: lookup
  author.invalid; library: the proxy was never asked), green restored.
- go test ./internal/iconproxy ./internal/provider ./internal/library
  ./internal/gui: ok. gofmt -l clean; go vet darwin (those four),
  linux (iconproxy, provider, library), windows (all four): clean.
2026-10-11 01:28:22 +08:00
yetone 4225ba1efb site: a partner's /go link and the home page's sponsor card say they came from magpie, as ref=magpie (yetone)
goTarget adds ref=magpie to the partner's key page or website, keeping the
address's own query and fragment; an address that names its own ref (a
referral code) keeps it as it is. The home page's sponsor card links to
yylx.io/?ref=magpie.

Run: node --test site/*.test.mjs (27 pass), with new cases for the query,
the fragment and a partner's own ref.
2026-10-10 14:18:05 +08:00
yetone 34f2078db8 site: a partner's website and key links go through usemagpie.ai/go, which counts the click; fetches of the partner list are counted too
The app's own partner counts only come from users who leave the stats on,
so a sponsor's reach and clicks are now also counted where the server sees
them. /api/partners hands out each partner's website and keysUrl (and a
region's) as usemagpie.ai/go/<id>/site|keys[/<region>]; /go sends a
"magpie partner go" event to PostHog (partner, link, region, country) and
302s to partners.js's own URL. One in ten list fetches sends "magpie
partners fetch" with weight 10 while someone is listed. Events carry a
random id each, no install id or address. Ended entries leave the list but
/go still resolves them, since added providers keep the links. Privacy text
updated in README (en, zh), docs/reference.md and the site docs (en, zh, ja).

Run: node --test site/*.test.mjs (27 pass); a scratch copy with a fake
partner served rewritten links, 302'd /go to the real URLs and posted both
events; PostHog's /i/v0/e/ answered 200 to the payload shape.
2026-10-10 13:48:26 +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
yetone bd917e7a9a site: the docs pages take the reader's language and remember the one picked, as the home page does (owner: 为啥不能自动识别用户语言以及自动记住用户上次的选择?) — / already sent a browser preferring Chinese, Japanese or German to /zh/, /ja/ or /de/ and kept the language picked in the menu (the lang cookie), but /docs/start and the other English docs pages were English for everyone and ignored the cookie. Now an English docs page (/docs/<page>, with or without .html) sends a browser whose language the docs are written in (zh, ja) to /docs/<lang>/<page>, query kept, with Vary: Accept-Language, Cookie; lang=en (picking English in the menu) keeps it English, German has no docs and stays English, a page not written in that language yet stays, and /docs/zh/… and /docs/ja/… are never moved. The test fails on the old worker. Under wrangler dev: zh-CN and lang=zh go to /docs/zh/start, intent, plugins; ja to /docs/ja/…; en and zh-CN with lang=en stay; /docs/zh/start stays for everyone. node --test worker.test.mjs passes. 2026-10-05 03:33:03 +08:00
tobitege 21702d01ff Add German translation; harden paths against unset env vars (#770)
* Add German translation and harden paths against unset env vars

Add a German locale to the GUI, tray menu, usage alerts and website home page, and refuse to start when the home folder is unset or relative so nothing is written under the working folder; the pi plugin no longer adopts the user's PI_CODING_AGENT_DIR, and an inherited APPIMAGE no longer selects portable mode. Scripts refuse to run from the wrong folder or empty a shared out folder, and a new internal/testenv sandboxes every test package from the user's real files, which also fixes the Claude picker and Termux installer tests on Windows.

* Makefile: know magpie's folder by its go.mod, so paths with spaces work

The check compared $(CURDIR) with $(dir $(abspath …)), which make splits on spaces, so a checkout under 'My Projects' or 'John Doe' refused every target. It now reads go.mod relative to the working folder and wants magpie's module there: make -C and a symlinked Makefile work, make -f from another folder still stops before any recipe runs.

* i18n: German for the strings main added since, with a parity test

75 strings main added (group order, patterns, slow-start wait, usage caps, RTK savings …) get their German, and two that main dropped go. gui-de.test.cjs checks, as gui-ja does, that de has every zh string with its placeholders and tags, and that the window reads in German when picked or on a German system.

* appdir: ignore relative folder variables when reading, keep them for children

CheckEnv no longer unsets anything. magpie reads the XDG folders, APPDATA/LOCALAPPDATA and every agent's folder variable through appdir.Getenv/LookupEnv, which pass over a relative value; the environment stays as it is, so the agents magpie starts get the variable as the user set it. That covers what proc.UserPath lends from the login shell too, which is set after main's check and reached the desktop app unchecked. On Windows a path rooted on the current drive (\Users\x, Git Bash's /c/x) counts as usable, and magpie version and help answer without a home, before run makes any folder.

* Sandbox the tests main added since

internal/wslrun gets testenv's TestMain, and four tests main added that set HOME alone set their home with testenv.SetHome, so on Windows they don't read the runner's profile through USERPROFILE.

* agentenv: PI_CONFIG_DIR and OPENCODE_DB take relative names on purpose

omp puts $PI_CONFIG_DIR under the home and OpenCode a relative $OPENCODE_DB in its data folder, so neither depends on the working folder: appdir no longer passes them over.

* i18n: German for the Library's multi-select and System One's decision API

The 19 strings main added since (#791's skill multi-select, the decision API snippets) get their German; the one main replaced (four APIs → five APIs) goes.

* appdir: tidy the import into magpie's group; say what Go makes of /c/x

The appdir import joins the group of magpie's own imports where a file has one. rooted's comment now says that Go takes a Git Bash path like /c/x as \c\x on the current drive, not C:\x.
2026-10-04 23:30:56 +08:00
yetone c96a4ba9ac site: /download links work again — since the release notes change (e5f8ff60) latest() returns { rel, degraded }, and /download still read .assets off that, so every download link (/download, /download/mac, /download/linux, /download/windows…) answered 500 (Cloudflare 1101) while /api/latest worked. /download now takes the release from got.rel. A test for /download/linux (302 to the asset) and an unknown platform (404) fails on the old code and passes; node --test site/*.test.mjs passes. 2026-10-03 17:20:58 +08:00
yetone 96e3ef6948 site: the update feed reads only what this worker kept in the edge cache — e5f8ff60 changed the shape of the cached newest release and release list but kept their names, so the entries the previous worker had put there were read as the new shape and /api/latest and /api/notes answered 500 until they ran out (up to 5 minutes after the deploy). The cache names now carry a version (__v2/), a hit is used only in the shape expected, and a cache that can't be read or written is a miss, not an error. A worker test seeds the old entries (and malformed new ones): it fails on e5f8ff60 and passes. node --test site/ passes. 2026-10-03 17:17:37 +08:00
yetone e5f8ff6026 site, gui: release notes survive GitHub limiting usemagpie.ai, and a failure to get them says so, apart from a release without any (#661) — /api/notes answered 503 {"error":"no releases"} with Cache-Control public, max-age=300 whenever GitHub's API limited the worker's shared IP, and /api/latest fell back to the release page's redirect with notes "" (kept 300 s too), so the update window had nothing to show. The worker now: never keeps an error (503 is no-store); takes the notes from GitHub's releases feed (releases.atom, not API-limited) when the API says no, turning its HTML back into the markdown the app draws and putting back the <!-- lang:zh --> marker GitHub strips (before the first Chinese heading after an English one); keeps the last whole answer for 30 days in the edge cache and serves it (merged with the feed's newer releases) when GitHub fails; keeps a degraded answer 60 s instead of 300; and sends a GITHUB_TOKEN secret to the API where one is set (none is yet). In the app, /api/whatsnew says error (and the release page's url) when the notes couldn't be had, and Settings' What's new opens a dialog saying "Couldn't load the release notes" with Try again and "Open the release page" (through the app), or "No release notes provided." with the release page and no retry for a version with none, instead of a passing toast; en/zh. Tests that fail on the old code and pass: site/worker.test.mjs (API limited: notes from the feed in either language, briefly kept; all of GitHub down: 503 no-store, then the last whole answer; the token sent), TestWhatsNewTellsFailureFromNone, and whats-new-failed.test.cjs (WebKit, en/zh: failure with retry and link, retry showing the notes, none without retry, no click moves the page). The feed parser was tried on the real releases.atom (v0.1.730–739: English and Chinese split as the API's bodies are). go vet, builds (darwin, GOOS=linux, GOOS=windows), go test -tags nogui -count=1 ./... under a temp HOME, node --test site/ and whats-new.test.cjs pass. 2026-10-03 17:12:48 +08:00
yetone 3c79152eb4 site: docs in Japanese (/docs/ja), and contents that work on a phone (owner: 文档也要支持日语,另外,文档要有友好的目录,在手机端也要有友好的目录) — /docs/ja/{start,intent,plugins,import} translate the English pages; every docs page gets the home page's language menu (English / 中文 / 日本語, the lang cookie) and a ja hreflang, /docs/ja opens the guide, and /ja/'s docs links go to the Japanese pages. docs.js (shared, replacing each page's inline scrollspy) builds the contents: every docs page, the current one's sections under it, the section being read marked with a pill (no left border); the list is sticky and scrolls on its own. Under 900px, where the contents were simply hidden (and under 600px the nav links too, so a phone had no way around the docs), a bar under the nav names the section being read and opens the contents as a menu that closes on a pick, a tap outside or Escape. The nav links give way to the contents under 1000px, long inline code wraps under 1100px, and .doc keeps .wrap's side padding (601-1168px ran the text to the screen's edge). node --test worker.test.mjs passes (/docs/ja redirect added); WebKit at 320-1280, light and dark, en/zh/ja: nothing scrolls sideways, the menu opens, jumps and closes, the bar follows the reading position. 2026-10-03 11:26:23 +08:00
yetone 4b5d6d725f site: the home page in Japanese at /ja/ too, picked from a language menu (the owner: 官网的日文也加上) — i18n.js gains a ja dictionary for every marked string, LANGS saying which languages have docs of their own (zh; /ja/ links the English docs); / sends a browser whose Accept-Language prefers Japanese to /ja/ as it does Chinese to /zh/, until a language is picked. The nav's 中文/EN link is now a globe button opening a menu of English, 中文 and 日本語, the current one checked (Escape or a click outside closes it), with hreflang ja alternates in the head; the page's scripts take T(en, zh, ja), so the routing demo, copy button, download label and theme titles speak Japanese on it, and Japanese text is set in Japanese faces (Hiragino Sans, Yu Gothic, Noto Sans CJK JP) rather than the Chinese ones. Also fixes the routing demo's stat labels in every language: since 8efd7d8 wrapped each in its own span, .rt-stats span matched the inner ones too and the labels were written into the wrong places ("errors your agent saw" twice); it now takes .rt-stats > span. Checked in WebKit: every demo string has three languages, each tab's labels are right in en/zh/ja, the menu marks and switches the language and sets the cookie, and /, /zh/ and /ja/ don't scroll sideways at 320, 390 or 768. worker.test.mjs covers the ja dictionary and the ja redirects. 2026-10-03 02:35:59 +08:00
yetone 8efd7d8027 site: the home page in Chinese at /zh/, and made for phones (the owner: magpie官网加上多语言支持,另外官网要对移动端友好) — index.html stays the one English source, each string marked data-i18n / data-i18n-attr; the worker serves /zh/ from it with i18n.js's dictionary put in by HTMLRewriter (<html lang>, docs links to /docs/zh/…, canonical and hreflang alternates), and / sends a browser whose Accept-Language prefers Chinese there until a language is picked with the nav's 中文/EN link (the lang cookie; Vary: Accept-Language, Cookie). The routing demo, copy button, download label and theme titles speak Chinese on it; the zh docs' home links go to /zh/. On phones the nav's links fold into a menu (≤860px; Escape, a click outside or on a link closes it, aria-expanded kept), Discord and GitHub move into it under 560px, the footer wraps, the routing tabs wrap, and nothing scrolls sideways at 320, 390, 768 or 1280 in either language (WebKit, light and dark). worker.test.mjs checks every marked key has its Chinese and the dictionary has none unused, and the / redirect by Accept-Language and cookie. 2026-10-03 01:09:21 +08:00
yetone aa42142ea5 update: What's new and the waiting update's notes follow the app's language (freecss on Discord: 更新后的公告的语言是不是应该设置里面的走) — the release notes were English alone. A release's notes are to carry a Simplified Chinese translation below a <!-- lang:zh --> marker (the magpie-releases workflow, changed separately); usemagpie.ai's /api/latest and /api/notes take ?lang=zh for the Chinese where a release has it, and give anything else, an app from before included, the English alone, everything above the marker. The page asks /api/whatsnew, /api/update and /api/update/check in its own language (?lang=); magpie asks the site in it, keeps What's new's notes per language, and asks again for the waiting update's notes when a page's language isn't the one they are held in (at most once a minute); a check by itself asks in the pages' last language, else the app's, as the tray menu has it. Notes that come back whole (a site not yet deployed) are cut in the app too; notes without the marker (every release so far) are English, in either language. The worker must be deployed (npx wrangler deploy in site/) before the workflow change ships, or apps would get both languages. TestInLang, TestFeedsAskInLang, TestAskedLang, TestWhatsNewInPageLang, TestUpdateNotesInPageLang, site/worker.test.mjs (node --test site/worker.test.mjs), whats-new.test.cjs's language check (Chromium and WebKit, en and zh); update-check, update-hide, update-auto, sync-update pass in WebKit. go vet, go build -tags nogui (darwin, GOOS=linux), GOOS=windows go build, go test -tags nogui ./... pass (TestClaudeRunEndsWhenTheClientLeaves flaked once under the full run, passes alone; gateway untouched). 2026-10-02 11:31:11 +08:00
yetone f22218a092 gui: after an update the window shows what changed since the version last run (a Discord user: 点更新后能弹个窗显示更新了啥吗, to see whether their issue was fixed) — magpie updated itself silently, and its release notes were only on GitHub. The version last run is now kept in magpie's own folder (last-version); started on a newer release, the window or magpie web's page asks usemagpie.ai's new /api/notes (beside /api/latest; site/worker.js lists the releases' notes from GitHub, cached as the feed is) for every release since, newest first, without their Install section, and shows them once in a What's new dialog. A fresh install, the same version, a downgrade or a build from source shows nothing; a magpie from before the version was kept, already in use, shows its own version's notes; offline nothing is shown and nothing waits on it; until the site is deployed, the update feed's newest notes stand in when they are the current version's. The tray's panel shows no dialog. The notes are drawn as text, never as HTML: headings, bullets, bold, code, http(s) links, and #NNN links to the issue, opened in the browser as the app's other links are. Settings has a What's new row under Version that opens them again, with a waiting update's notes first, marked Not installed yet; /api/update's notes leave out the Install section too. TestShowNotes, TestStripInstall, TestBetween, TestNotesBetween, TestWhatsNewAfterUpgrade, TestWhatsNewFromBefore, TestUpdateNotesWithoutInstall and whats-new.test.cjs (Chromium, WebKit, en, zh) fail without the change. go vet, go build -tags nogui (darwin, GOOS=linux), GOOS=windows go build, go test -tags nogui ./... pass; click-scroll, old-webkit, update-check, update-hide pass. 2026-10-02 03:57:55 +08:00
yetone 6882ceac7d site: a getting-started guide, in English at /docs/start and in Chinese at /docs/zh/start (/docs and /docs/zh open it) — someone who runs Claude Code, Codex and Paseo every day found magpie confusing at first and the site had only the Add to magpie page for vendors; the guide says what magpie is for and how the setup goes: add the providers you have (subscriptions signed in to in magpie, a vendor's preset and its key, any compatible URL, or Import… from Claude Code and Codex), pick a model for each agent and what that writes into its config, a new session to pick it up, then routing groups when there are several accounts (the Routing view and magpie group), Usage, profiles, the commands and a short FAQ, the Chinese one in the app's own Chinese labels. The home page's Docs link and every docs page's nav and footer lead to it, and on a phone the docs nav keeps the brand, the language, the theme and Download 2026-09-25 14:18:13 +08:00
yetone eaf0b55de1 site: the worker adds the Web Analytics beacon to each page itself — Cloudflare's automatic injection skips responses a worker returns, and since the www redirect every page is one 2026-09-24 17:34:37 +08:00
yetone 01e1971a7b site: downloads for Windows and Linux
The download button follows the visitor's OS, a platform list sits under
the final call to action, /download/{windows,linux}[-arm64] redirect to
the builds, and install.sh installs the Linux desktop app, with a menu
entry, when WebKitGTK 4.1 is present.
2026-09-24 03:22:02 +08:00
yetone 28688e2463 site: the feed survives GitHub's API limits, from SHA256SUMS alone 2026-09-24 02:03:07 +08:00
yetone 73ef0e5276 usemagpie.ai, and a magpie that updates itself
site/ is the website: a static page plus a worker that turns the newest
release of yetone/magpie-releases into an update feed (/api/latest, with
every file's SHA-256), stable download links and an install script.

The app asks the feed at start-up and every six hours, downloads a newer
version in the background, and installs it on Restart to Update or on
quit. A download must match its checksum and be signed by the same team
as the app it replaces. `magpie update` does the same from a terminal and
replaces a bare binary in place.
2026-09-24 01:57:50 +08:00