Commit Graph
21 Commits
Author SHA1 Message Date
yetone 89f66966d9 release builds: the UI's files are packed into one zip, ~5.7 MB off each binary (@ZhangXiaof48473 on X)
The Windows and Linux downloads (and the CLI builds) are the raw binary, so
what is embedded counts in full. 8.2 MB of the 12 MB under internal/gui/assets
is scripts, styles and svgs. `make assets-pack` (build/assetpack) writes them
to internal/gui/assets.zip (deflate; png/jpg/webm stored), and the release
targets and `make app` build with -tags packedassets, which embeds that zip
instead of the tree (assets_packed.go: a file is unpacked once, on first use,
and served seekable with no modification time, as an embedded one is). Plain
`go build`, `make build`, `make cli` and every test still embed the tree.
The zip is git-ignored and made before every release build.

Sizes (go build -trimpath -ldflags="-s -w", on mote, at e430e2750):
  linux/amd64 nogui   73,203,874 -> 67,502,242  (-5,701,632)
  windows/amd64 app   88,401,408 -> 82,755,584  (-5,645,824)
The macOS zip/dmg compress the binary already, so they gain nothing.

Run: assetpack, then `go test -tags packedassets -run TestPacked ./internal/gui`
(passes: every file byte for byte and no other; / and a range of the webm served;
no Last-Modified). The first try failed it with "packed has 0 files, the tree
301" (zip entries lacked the assets/ prefix), so it does go red on a bad pack.
go vet ./internal/gui on darwin, linux nogui, windows and -tags packedassets:
clean. gofmt clean.

Not run: the full suite and the GUI suite (default builds embed the tree as
before; api.go only lost the embed line), a real release through
magpie-releases (its release.yml calls these make targets), the Linux GTK
build (cgo).
2026-11-11 10:28:05 +08:00
yetone bdb856b23c icon: the bird is white in macOS 26's clear and tinted icon styles, where it was a dark glass bird on a dark tile
psikent (Discord #feedback, 11-03) sent a dark Launchpad where magpie's
icon was a near-black tile with a near-black, glassy bird. AppIcon.icon
gave the bird a fill for the light and dark appearances only, so in the
Clear and Tinted styles (System Settings, Appearance, Icon & widget
style), which draw from the tintable rendition, actool used the light
fill: the bird at 0.086 grey, whose luminance is what the system tints.
On a dark tile that is dark on dark. The bird now has a "tinted" fill of
white, so it takes the tint (or the clear glass) at full brightness.
Light and plain Dark are unchanged.

Not (a) or (c): the shipped Assets.car (v0.1.2816 in /Applications,
same sha as build/darwin/Assets.car) matched icon.json, its dark
rendition already a 0.957 bird on the dark grey tile, and the release
build (magpie-releases release.yml, `make app`) copies that file.

Run at this head, on mote (macOS 27.2, Xcode 27.2):
- xcrun actool on build/darwin/AppIcon.icon, as `make icons` runs it;
  that output is this Assets.car (sha 72fe0ee3). The old one was made by
  Xcode 26.5; StorageVersion 17 and the 25 renditions are the same, and
  this Mac's macOS 26.2 assetutil reads it, the tintable group now
  filled with Color-2 (white).
- A test bundle (build/darwin/Info.plist, magpie.icns, the Assets.car)
  drawn by IconServices for appearances 0-3 x variants 0-3, and by
  NSWorkspace iconForFile under AppleIconAppearanceTheme RegularLight,
  RegularDark, ClearLight, ClearDark, TintedLight and TintedDark (mote's
  setting put back after). The old Assets.car reproduces the report in
  ClearDark and TintedDark; the new one shows a bright bird in all six,
  and RegularLight / RegularDark look as before.
- Broken by hand: a colour-coded icon (light red, dark green, tinted
  blue) showed Clear and Tinted draw from the "tinted" fill.

Not tried: drawing it on macOS 26 itself (no macOS 26 test box; mote is
on 27), and macOS 15 or older, which use the flattened renditions that
this change doesn't alter. IconServices' variant 1 with dark appearance
(no setting in the six themes maps to it) still draws the light bird on
a black tile, as before.
2026-11-03 21:14:33 +08:00
yetone fb3942ee67 windows: the app's icon fills its square in the taskbar, the tray and Start (dzxx0496)
On Windows 10 magpie's icon looked a size smaller than its neighbours
in the taskbar, the tray overflow and Start's "Recently added"
(dzxx0496 on Discord, #general). Every Windows icon was the Mac's tile:
build/windows/icon-*.png (75cb19264, the exe's icon group #3, which
the window, the taskbar and the Start shortcut's IconLocation exe,0
all use) and internal/gui/icon.png (the tray) were build/icon/gen.go's
app(), on macOS's grid, the tile 80% of the canvas with 10% clear on
each side. Windows draws an app to the edges of its square.

- gen.go: app() and the new win() share tile(). win() is the same
  white tile, shading and bird (.8 of the tile), a 32nd of the side
  clear from 32px up (1px at 32 and 48, 8px at 256) so the rounded
  corners' soft edge stays inside, and to the edge under 32px, where
  that pixel would only blur it; corner radius .2 of the side (.225 on
  the Mac). No new colour.
- build/windows: icon-16 to icon-256 drawn by win(), plus 20, 24 and
  40 px, which Windows asks for at 125% to 250%; winres.json lists
  them.
- The tray takes internal/gui/icon-windows.ico (16, 20, 24, 32, 40,
  48, 64); Wails picks the SM_CXSMICON entry, where the 64px PNG was
  scaled down by the system. icon.png, only the tray's, is gone.
- Makefile's icons target draws all of these.

Not changed: macOS (app() is byte for byte the same at 64, 256 and
1024: cmp against the committed icon-256.png and icon-1024.png; the
.icns, Assets.car and tray.png untouched). Linux: its tray is the
glyph with no tile, and its desktop icon (icon-256.png) keeps the
margin GNOME's and the hicolor theme's app icons have too.

What was run:
- mote: go test ./internal/gui: TestWindowsIconsFillTheirSquare (new),
  TestTrayIconPerOS and TestTrayIconSize ok. Red, each filed and none
  about icons: TestSettingsSaveKeepsWhatItDoesNotSend (#4514, red 3 of
  3 at a fresh origin/main 733fac48f), TestMainWindowCorners/macOS_26_SDK
  (#3949, macOS 27) and TestColdTurnsTaken once in the package run,
  ok when run again (#4510). go vet ./..., GOOS=linux go vet -tags
  nogui ./..., GOOS=windows go vet ./..., go build and GOOS=windows
  go build: ok. gofmt -l prints nothing.
- Broken by hand: the old PNGs, winres.json and the old 64px picture
  as the tray's .ico: TestWindowsIconsFillTheirSquare red, "tile
  (25,25)-(231,231) in (0,0)-(256,256), want at least 15/16 of the
  side, centred" and the same for each size, "icon-windows.ico has no
  16px picture".
- make release-windows on mote at origin/main and at this change, both
  exes on the Windows 11 box (xiaomi-gpu). Its console was locked at
  the PIN screen, so no desktop screenshot: instead Windows itself
  drew each exe and a .lnk to it through IShellItemImageFactory (what
  Explorer, the taskbar and Start use) at 16/24/32/48/256, beside
  Docker Desktop, Claude, Explorer, Edge and Notepad, and the tray
  icon through CreateIconFromResourceEx at 16 to 40 as Wails makes it.
  Before: the tile 80% of the square, the tray blurred. After: the
  tile fills it as Docker's, Claude's and Edge's do; the tray is
  crisp at each size.

Not run: go test -tags nogui ./... (the change is internal/gui's
embeds, which nogui leaves out, and build/).
Not tried: Windows 10 itself, and the real taskbar, tray and Start
with the desktop unlocked. Windows keeps an exe's icon in its icon
cache by path, so a user may see the old one until the cache renews.
2026-11-01 11:02:56 +08:00
yetone 6b253dbb3f windows: magpie.com is written again only when the launcher changes, not on every update
lucky_eagle_38410 on Discord (#general, 10-28): every run of the command
line wrote a new magpie.com. magpie.com is the console launcher from
2afacd7d1 (#3737): PowerShell and cmd run magpie.com before magpie.exe
(PATHEXT), and wait for it, so a prompt, a password and the exit code
reach the terminal; the GUI-linked magpie.exe alone gives the prompt back
at once. It is needed, and writeCom already writes it only when its bytes
differ.

They differed on every release. `make release-windows` built the
launcher from the git checkout with Go's default -buildvcs, which stamps
vcs.revision and vcs.time into the binary, so each release carried a
different magpie.com though the launcher's source hadn't changed, and the
first `magpie` after each update (several a day) wrote it again, moving a
running one aside as magpie.com.old. The launcher is now built with
-buildvcs=false, so magpie.com changes only when the launcher does.

Run:
- Windows box (xiaomi-gpu, PowerShell 5.1 over a ConPTY, sandbox
  USERPROFILE/APPDATA, a folder of its own on PATH), the app run as
  magpie.exe, then through magpie.com, then the next version copied over
  magpie.exe and run again:
  - real releases v0.1.1861 -> v0.1.1862: magpie.com 5F55B8D4... ->
    2E6AD7D9..., rewritten on the update.
  - make release-windows at origin/main 6e080ca04, at two commits of the
    same tree: B26668C1... -> 15AD7512..., rewritten.
  - make release-windows with this change, the same two commits:
    782517C6... both times, mtime unchanged.
- mote: go test -tags nogui ./internal/update/...: ok. GOOS=windows and
  GOOS=linux go vet ./internal/update/: ok. gofmt -l: clean.
- win-run: TestLauncherSameAtEveryCommit, TestWriteCom, TestComOwner,
  TestEnsureCompanion, TestFindCLIPrefersCom pass on Windows.

Broken by hand: the Makefile without -buildvcs=false makes
TestLauncherSameAtEveryCommit red ("the launcher built at the next
commit differs ([-trimpath -ldflags=-s -w])"). The test builds a
program with the Makefile's launcher flags in a scratch git repo at two
commits and compares the bytes.

Not tried:
- A real release build in magpie-releases; the next tag is the first.
  The first update to it still writes magpie.com once (its bytes change
  from the stamped one); after that only a launcher change does.
- The arm64 build on a real ARM machine.
- The full go test ./...; only internal/update changed (a Makefile flag,
  a comment and a test).
2026-10-28 17:32:28 +08:00
yetone e8c7dddcb4 notices: the release carries the third-party licence notices
The owner asked for the licence notices in the release package (moejs
alpha.11 compiles Intl's data in, which carries its own notices).
THIRD_PARTY_NOTICES is embedded in the binary (main.go, //go:embed) and
handed to internal/notices; `magpie licenses` prints it, GET /api/notices
serves it, and Settings › About has an Open-source licenses row that
opens it in a dialog, in every language. `make app` copies the file into
the .app's Resources too. The core's scripts are 1,527,245 bytes, their
budget raised to it with no room added; app.js stays under its own.

Run at this head (rebased on origin/main):
- win-run (Windows 11): go vet -tags nogui . ./internal/notices
  ./internal/cli; go test TestNoticesFollowMoejs (.), ./internal/cli,
  TestCoreScriptBudget (./internal/gui): ok.
- wsl-run (Ubuntu 24.04): go vet -tags nogui ./..., go build -tags
  nogui: ok.
Run at the pre-rebase head 14e2d13fb, on mote (macOS):
- gofmt; make app's copy byte-identical to the file; `magpie licenses`
  output equal to the file; GOOS=linux/windows vet and build;
  go test . ./internal/cli: ok. ./internal/gui: only
  TestMainWindowCorners red, the same on origin/main (#3949).
- about-notices.test.cjs: chromium and webkit, en zh zh-TW ja de, 1100
  and 420px: all ok.
Broken by hand: TestNoticesFollowMoejs red with the embedded file cut.
Not run: the GUI suite at this head. The rebase met main's cancelAsk
helper where showNotices sat, and the dialog's Done now uses it (the
same stopPropagation + closeConfirmAsk). The whole GUI suite at
14e2d13fb was cut off when mote went down at load ~50: the files it
reached outside About had reds, most of them 180s browser-launch
timeouts, the rest passing in other languages or the other engine; they
are run again once mote is back, and any that stay red are filed.
2026-10-28 16:40:03 +08:00
yetone 2afacd7d18 windows: a terminal waits for magpie, through a magpie.com beside the app (#3737)
The Windows app is linked with -H windowsgui so a double click opens no
console, and PowerShell and cmd don't wait for a GUI program. The prompt
came back before magpie printed, and `magpie plugin login`'s password
keys went to the shell as well as to magpie (tom047784 / TomXPRIME on
Discord, 10-27; the handle error in the same report was 9298d2a).

A shell looks for `magpie` by PATHEXT, which lists .COM before .EXE. So
magpie now writes magpie.com beside the app. It is a 1.9MB console program
(internal/update/launcher), built and embedded by `make release-windows`
(the comlauncher tag). The shell waits for it. It runs the app with its own
std handles, passes MAGPIE_COM=1, waits, and exits with the app's code. The
app keeps those handles and borrows the console for the streams Windows
dropped (a GUI child gets no console handles), so redirection, pipes and
hidden prompts work. A command that opens the window (none, app, gui, tray,
panel, -Embedding, magpie: links) is started DETACHED, and the shell isn't
held. A double click and the Start menu still open magpie.exe.

Why this, and not a console-subsystem copy or a magpie-cli.exe: the
running process is still magpie.exe, so autostart, shortcuts, relaunch and
every os.Executable() use are unchanged. There is no new release asset (still
16), and magpie-releases needs no change. The trailer names the app, so a
download kept as magpie-windows-amd64.exe is run by its own name.

Where it is written:
- Settings › Command line's Add (cliPlace) writes it instead of magpie.cmd
  in a build that carries it.
- A terminal command run as magpie.exe writes it when the folder is on PATH
  or has a magpie.com or magpie.cmd, so existing users get it on their next
  `magpie <cmd>`.
- The app's start (placeExe) writes it again when the bytes differ, so an
  update brings it along.
- A running magpie.com is moved aside and cleared on the next run.
- A copy beside a magpie.exe leaves `magpie` to it (comOwner).
- The Command line row reads magpie.com as this app, with "(which runs
  magpie.exe)".

Run, at 2e165fe9d (main since then touches none of these files):
- gofmt -l: clean
- go vet ./...; GOOS=linux go vet -tags nogui ./...; GOOS=windows go vet ./...
- go build for darwin, linux -tags nogui and windows
- make release-windows: amd64 and arm64 are PE subsystem 2 (GUI), as before
- go test -tags nogui -count=1 -timeout 45m ./internal/update/...
  ./internal/cli/ ./internal/gui/ ./internal/proc/: all ok
- cli-path.test.cjs in chromium and webkit (11 + 11 pass); i18n-keys,
  gui-zh-tw, gui-ja, gui-de pass
- The Windows box, with GOOS=windows test binaries: launcher's TestArgsOf,
  TestOpensWindow and TestTargetName pass; update's TestWriteCom,
  TestComOwner, TestEnsureCompanion, TestFindCLIPrefersCom and
  TestCLIShim pass. TestComMagicIsTheLaunchers reads the source, so it
  can't run from a copied binary there; it passes on macOS.
- The Windows box, sandbox HOME, release build, interactive ConPTY over
  ssh -tt with typed keys:
  - Old v0.1.1675 in PowerShell 7.5.4: the prompt comes back before
    "magpie 0.1.1675", $LASTEXITCODE is empty, `> out.txt` is empty, and
    backup's passphrase is split between the shell and magpie.
  - New build in PowerShell 7.5.4: the first `magpie` as magpie.exe wrote
    magpie.com, and Get-Command then resolves it. `magpie version` prints
    before the next line, with exit 0. A bad command gives 1. `> out.txt`
    holds the version. backup reads "Passphrase for the backup:" and
    "Again:" typed. restore reads "Passphrase:" typed. A piped passphrase
    is read (wrong passphrase, exit 1).
  - New build in cmd: `where` lists magpie.com first. The same version,
    ERRORLEVEL 0 and 1, and typed backup and restore passphrases work.
    Ctrl+C at a prompt ends it with 0xC000013A and leaves no magpie.exe.
  - The update: an older magpie.com in place was moved aside and rewritten
    by the first command of the new build, and the .old was gone after the
    next one.

Broken by hand, red:
- writeCom always rewriting: TestWriteCom
- EnsureCompanion ignoring PATH: TestEnsureCompanion
- comOwner always true: TestComOwner
- app.js's old shim-only condition: the "magpie.com is said to run the app"
  case in en and zh

Not tried:
- A real double click or the Start menu on the box. magpie.exe is still
  GUI-subsystem and is what they open, but no window was opened there. The
  sandbox app would share the gateway's port with the box's own magpie.
- Windows Terminal itself; the ConPTY ssh -tt gives is what it uses.
- The arm64 build on a real ARM machine.
- The full go test ./... at this head. Another session's agent and
  gateway suite was running on the machine (load ~115), so only the
  touched packages and internal/proc ran.
2026-10-27 12:08:16 +08:00
yetone 742d6c06e0 gui: on Linux the window and its desktop entry name each other, and the icon is installed (#2626)
unfallenwill: the dock and the app grid showed a gear for magpie on Linux.
The desktop entry registerScheme writes had no StartupWMClass, and its
Icon=magpie named an icon nothing installed.

What the window reports, from the source (not guessed):
- GTK3 (gtk-3-24): an X11 window's WM_CLASS is (g_get_prgname(),
  gdk_get_program_class()), the class being the prgname with its first
  letter upper-cased; a Wayland xdg_toplevel's app_id is g_get_prgname(),
  falling back to the program class.
- Wails v3.0.0-beta.24 (gtk3 build, which magpie's Linux build uses):
  LinuxOptions.ProgramName goes to g_set_prgname before
  g_application_run. Without it the prgname is the executable's name,
  magpie-linux-amd64 for a release run as downloaded, which no entry names.

So magpie now sets ProgramName "magpie" (internal/gui/desktop.go), making
WM_CLASS ("magpie", "Magpie") and app_id "magpie", and the entry says
StartupWMClass=magpie. An ApplicationID was not used: WebKitGTK keys its
data folder by the prgname (~/.local/share/<prgname>), so "magpie" keeps an
install.sh user's data where it is. A binary run under another name had
its data under that name; keepWebData moves it to ~/.local/share/magpie
before the first webview, unless magpie's folder is there already (Go's
os.Rename refuses an existing directory, which is the guard).

registerScheme also writes a 256px icon to
$XDG_DATA_HOME/icons/hicolor/256x256/apps/magpie.png (temp file and rename,
skipped when the bytes match), and rewrites an earlier entry for the same
executable that lacks StartupWMClass. Flatpak is left alone as before.
install.sh's own entry gets StartupWMClass=magpie too. The icon is
build/icon/gen.go's 256px output (make icons now writes it), the same bytes
as site/public/img/icon-256.png.

Siblings checked: the autostart entry starts the app and needs no
StartupWMClass. The repo has no deb, rpm, AppImage, AUR or flatpak
packaging (#2225 plans deb/rpm); install.sh is the only other entry.

Tests: TestRegisterScheme checks the entry's StartupWMClass and Icon and
the installed PNG (256x256); TestRegisterSchemeBindsAnOlderEntry;
TestKeepWebData (moved, magpie's folder there already, no localstorage);
TestLinuxWindowNamedAsItsEntry (gui build); install.test.mjs asserts the
line. Each was broken by hand and went red: entry without StartupWMClass,
icon not installed, the short-circuit without the StartupWMClass check,
keepWebData returning at once, linuxOptions without ProgramName.

Run: the Linux tests cross-compiled (linux/arm64, nogui) and run in a
busybox container, the whole internal/gui package passing there;
TestLinuxWindowNamedAsItsEntry on darwin; node --test site/install.test.mjs
10/10; gofmt -l clean; go vet -tags nogui ./... for darwin, linux and
windows; the full go test -tags nogui -timeout 45m ./... under pipefail, both
fixes together on origin/main ec6454395: exit 0, 66 packages ok, no FAIL.

Not tried: a real Linux desktop (GNOME or KDE, X11 or Wayland). No such
session was available, so the dock icon itself was not seen; the binding
rests on the GTK and Wails source above. The gtk3-tagged gui build was not
compiled for Linux here (needs cgo and GTK).
2026-10-17 05:33:18 +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
Snowyy fa1e3947f9 plugin: isolate stalled streams and guard GUI refreshes (#664)
* plugin,gui: a stalled stream can't wedge the host, stale reads can't draw, and the browser suite runs in CI

internal/plugin: the host has one reader of the child's stdout, and it handed
each message to its call by sending on that call's channel. A caller that
stopped draining a streamed body (a slow HTTP client on a plugin-backed chat
stream) filled the channel; the reader then blocked, and every other call
through the host -- all plugin providers and accounts, moved built-ins
included -- stopped being dispatched until the stalled stream was drained. A
second call's answer arrived only after the first was drained.

Each call now queues its head and chunks in a bounded backlog (4 MiB of
chunks, 4096 of them) drained by its own reader, so the host's reader never
waits on one consumer; a call whose consumer stops reading is given up on
alone, with the limit as why. Aborts go through a goroutine too (abortLoop),
so a child that stopped reading its stdin can't make an abort wait either.
host_test.go covers the stalled consumer, the bounds and the abort path.

internal/gui: loadUsage() and refreshUsage() both read the Overview's
usage?period=, and neither checked after the await that its answer was still
the newest: a 24 h answer landing after a 7 d one drew the old period's
figures under the new period's name, and leaving the tab could still write the
Overview's cost into the shared header. Both now claim one shared read
generation before the request and draw only when it is still the newest and
the page, tab and period are unchanged. providersWhileFetching() also stopped
for good after one failed poll or reload; it now asks again.

usage-stale-answer.test.cjs and providers-fetching-retry.test.cjs lift the
real functions out of app.js and drive them with a faked api/page/timers, so
they need no browser; usage-refresh-flight.test.cjs gains the browser case for
the same race.

Makefile/.github: `make test-ui` runs every internal/gui/tests/*.test.cjs
through Node's test runner -- auto-discovered, UI_TEST_CONCURRENCY files at a
time (default 2) -- and a new `ui` job in Test runs it on ubuntu-latest with
Playwright's Chromium and WebKit. A missing browser fails the job; it never
skips to a pass. internal/gui/tests/README.md points at `make test-ui` instead
of a hand-kept command line.

Verified: node --test on the two new files 21/21; go test -count=1
./internal/plugin/ ok; go test -race -count=1 ./internal/plugin/ ok; go vet
./internal/plugin/ and go build ./... clean; node --check on the changed JS;
actionlint on the workflow.

Not verified: the full browser suite is not green yet. `make test-ui` is 1641
passed / 70 failed of 1711 across 225 files, and 12 of the 19 failing files
fail the same way on a pristine main (a known baseline: a fixture boots the
page in web mode while asserting the desktop window's narrow behaviour). The
`ui` job will be red until those baselines are dealt with -- nothing is
skipped or masked -- and the job has not yet run on a GitHub-hosted runner.

* plugin: distinguish stalled readers from large responses

* plugin: clarify best-effort abort delivery
2026-10-04 11:22:31 +08:00
XYenonandAmp 69368007b0 termux: support Android builds and installation (#644)
* termux: build natively and run plugins on Bun 1.4.2

Select nogui for Android builds, open browser and OAuth links with
termux-open-url, and write an executable Termux:Boot script that starts
the gateway with shell-quoted paths.

Bun 1.3 has no official Android build. Upgrade the default plugin runtime
to 1.4.2, add the official Android arm64 and amd64 download targets, and
update SHA-256 checksums for every supported platform.

Document Termux installation, startup and source updates.

Validation on Termux arm64:
- Native build and go vet pass.
- A fresh config downloads and verifies Android Bun 1.4.2 and loads a
  test plugin.
- Boot startup can be enabled and disabled.
- The Web page, authenticated state API, unauthenticated API rejection,
  gateway healthcheck and Web quit action work.
- Browser argument preservation, boot path quoting and permissions, and
  plugin tests pass.

Co-authored-by: Amp <amp@ampcode.com>
Amp-Thread-ID: https://ampcode.com/threads/T-01a10014-56c1-73d3-b3ee-2ea569713989

* site: install Android builds in Termux

Detect Termux through TERMUX_VERSION or its PREFIX and select the Android
CLI asset instead of a Linux binary. Install into PREFIX/bin by default,
keep MAGPIE_BIN_DIR overrides, and suggest the Web or terminal interface
without Linux desktop setup instructions.

When the release has no Android asset, explain how to build from source.
Add android/arm64 to release-cli and stop the build loop on failure.
Document the installer and its release-asset requirement.

Shell syntax and all 11 site tests pass, covering platform selection,
custom paths, missing assets, checksum rejection and existing Linux
installation paths. The Android arm64 release build succeeds on Termux;
with a simulated release feed, the installer verifies and installs that
binary into PREFIX/bin and the installed command runs successfully.

Amp-Thread-ID: https://ampcode.com/threads/T-01a10014-56c1-73d3-b3ee-2ea569713989
Co-authored-by: Amp <amp@ampcode.com>

* ci: check Android releases and the installer

Build both linux/amd64 and android/arm64 through make release-cli in the
CLI test matrix. Run the site and installer tests in the Linux job with
Node 22, and check the installer's shell syntax.

The release workflow in yetone/magpie-releases already calls the source
Makefile's release-cli target, uploads dist/magpie-cli-*, and generates
checksums for every artifact. The Android target added to TARGETS is
therefore included without changing that workflow.

Replace the full Termux README section with a short platform note beside
the Linux and Windows installation requirements, removing duplicate
commands, the fork URL and temporary release availability details.

Both CLI release builds, all 11 site tests, shell syntax checks and
actionlint validation pass locally.

Amp-Thread-ID: https://ampcode.com/threads/T-01a10014-56c1-73d3-b3ee-2ea569713989
Co-authored-by: Amp <amp@ampcode.com>

---------

Co-authored-by: Amp <amp@ampcode.com>
2026-10-03 14:29:32 +08:00
yetone b881932ec2 gui: the page runs in macOS 12's WebKit — no regex lookbehind, the few newer built-ins filled in, fallbacks for container queries, subgrid, :has and color-mix (#220 uclort: on macOS 12.7.6 the app opened blank, the panel showing its tab bar, a "Profiles + Save current" heading and "Open magpie · Quit" and nothing else, no button working) — the page runs in the system's WebKit, on macOS 12 Safari 15.x's, and app.js's snippet highlighter had a regex lookbehind, (?<==)\S+ (app.js:2167), which WebKit only parses from Safari 16.4: a SyntaxError in a literal fails the whole file, so app.js never ran (and routing.js and library.js, which lean on it, threw), leaving index.html's static markup; library.js had two more, (?<![\w-]) in the SVG greying (library.js:162-163). The highlighter now finds a value after "=" by hand (the character before the match, a sticky \S+) and the greying checks the character before a colour name in its replace callback, each giving the same output as before (compared on shell, curl, Python and Node snippets and an SVG with attribute and style colours, data-fill and x-color left alone). Built-ins newer than Safari 15.0 in use, routing.js:307's findLast and library.js:1042's structuredClone (15.4), are filled in by a new compat.js loaded before the other scripts (with at, findLastIndex and Object.hasOwn), each only where missing; structuredClone there is a JSON copy, enough for the API's plain data. Styles: a selector list with :focus-visible (15.4) drops the whole rule before 15.4, so the agent handle's hover, an account's Remove and protocol buttons showing on hover, the protocol menu's hover and the editor's focus ring are split from their :focus-visible (or it is dropped where :focus covers it); .acc:has(.aq) and the panel's .profiles:has(> .chip-input) hint (15.4) are classes set by app.js (with-aq, naming); the Routing page's container queries and the request list's subgrid (16) get @supports not fallbacks by the window's width (the tray panel is narrower than all of them) and a row's own columns; and the panel's --panel-tint, a color-mix() (16.2) in a custom property that would have gone invalid and painted the panel clear (tintPanel then handing the system white under dark text), falls back to --bg, as the floating status and Library's sticky head do. Other things newer than 15.0 are left as cosmetic: inert (15.5) on the folded agent list, accent-color, the rest of color-mix() on hover and focus shades, .quota's subgrid rows. The build: Go 1.25 and later run on macOS 12 and up only (the linker stamps 12.0 as the oldest), so Info.plist's LSMinimumSystemVersion and the Makefile's -mmacosx-version-min go from 11.0 to 12.0 and the site says macOS 12+ rather than 11+. Tested with a new internal/gui/tests/old-webkit.test.cjs: every assets/*.js parsed with the Babel parser Playwright bundles, failing on a regex lookbehind, v flag or modifiers (in a literal or new RegExp("…")), a class static block, decorators, import attributes or using (checked against the old highlighter's regex and a static block, and not on named groups, lookahead, ??= or private methods); a grep for built-ins newer than 15.0 (at, findLast, structuredClone, hasOwn, toSorted and co., Set methods, groupBy, withResolvers, Iterator helpers, popover …) unless compat.js fills them in (fails on main's routing.js:307 and library.js:1042 without it); compat.js the first of the page's scripts and every script loaded; the CSS with no :has(), no :focus-visible in a mixed list, no nesting or dvh, and @container, subgrid columns and a color-mix() custom property only with an @supports not fallback in the same file; and, in WebKit with those built-ins deleted, the panel's tabs, Save current's name field and every window page drawn with no page error. Documented in internal/gui/tests/README.md. go build -tags nogui (and GOOS=linux, GOOS=windows), go build (darwin GUI), go test -tags nogui ./... and the whole GUI suite (130 tests) pass. Not tried on a real macOS 12 or Safari 15: the old engine's parse is judged by the parser, not run. 2026-09-29 23:52:38 +08:00
yetone ebc33c721b tray: a click on the bird flaps it — the wing beats twice and the tail flicks up once, 16 frames over about half a second (build/icon/gen.go tray-flap bends the outline about the tail's root and the shoulder, eased, so it stays one line); and the usage beside it no longer sits hard against it, a thin space between (Image #13: 图标与用量之间没有任何的间距) 2026-09-28 16:15:40 +08:00
yetone 8f34b6d37e icon: macOS 26 draws magpie's icon light or dark — AppIcon.icon (the bird on a pale tile, or in white on a dark one) compiled into Assets.car beside the .icns, where the .icns alone was darkened whole in dark mode, the black bird lost on a black tile (#117); the app no longer sets a light picture over it in the Dock 2026-09-27 22:55:20 +08:00
yetone 5474a977fc gui: magpie's Dock icon is sharp — the app was given the 64px icon, which macOS puts in the Dock in place of the bundle's .icns and scaled up to the Dock's size, so the magpie there was blurred; it is given a 1024px one (30 KB, from the same drawing, made by make icons), and the 64px one stays for the trays of Windows and Linux 2026-09-26 01:03:33 +08:00
yetone 9a0078f08c dev: a Go change under make dev rebuilds and restarts only the backend — the API and the gateway — behind windows and a tray that stay up, and the page refreshes what it shows in place, keeping its tab and anything open; a build that fails leaves the running backend be (build/dev.sh) 2026-09-25 01:14:56 +08:00
yetone 75cb192647 Desktop app for Windows and Linux
The Windows app cross-compiles (WebView2, no cgo) as a GUI program with an
icon, version info and a DPI-aware manifest; run from a terminal with a
command it borrows the console. The Linux app links GTK 3 and WebKitGTK
4.1. Off the Mac the app updates its own binary from its own build:
downloaded in the background, swapped in on restart or quit, and the
relaunched process waits for the old one before taking the gateway. The
window leaves room for traffic lights only on a Mac.
2026-09-24 03:22:02 +08:00
yetone 402a96c39d Rename dial to magpie, with a magpie for a logo
The product, module path (github.com/yetone/magpie), binaries, env vars
(MAGPIE_ADDR, MAGPIE_DEV_UI, MAGPIE_THEME, MAGPIE_DEBUG), config and cache
folders (~/.config/magpie, ~/.cache/magpie), bundle id (com.yetone.magpie),
gateway provider id and token, and every UI string now say magpie.

On first run magpie copies ~/.config/dial and ~/.cache/dial to the new
folders when they don't exist yet (copy, not move, so a still-running dial
keeps working; the old folders can be deleted by hand later).

The logo is a small round magpie in profile: one path for the header and
the tray, and the app tile adds the white belly and the blue-green tail.
The header mark is drawn in ink rather than the accent colour, which
fought the text in light mode.
2026-09-23 23:55:11 +08:00
yetone 9d85f6bfb8 make dev: Ctrl-C ends the loop; dialog never wider than the window
fswatch swallows SIGINT, so the shell went round again instead of
exiting; a trap now stops the child and leaves. The loop also kills
only its own dial-dev rather than every one on the machine.

The editor grid's 1fr column had an auto minimum, so a long endpoint
error pushed the dialog past the window edge.
2026-09-23 19:14:26 +08:00
yetone c374e55926 gui: real vendor logos on every picker row, no monograms
Every model option now names its vendor's bundled logo: a models.dev
provider id maps through the presets, and model families (claude, gpt,
gemini, deepseek, grok, kimi, glm, qwen, mistral, minimax) are recognised
by id for lists that have no provider, such as Copilot's. Claude Code's
aliases and own models carry the Claude mark, Codex's the OpenAI mark,
Copilot's and Cursor's auto their own. The two-letter monogram fallback
is gone: an option without a known vendor keeps an empty slot, and a
custom provider shows a plain outline glyph. A foreign ANTHROPIC_BASE_URL
now names the Claude Code group instead of being appended to the first
row's note.

Window header content moves 1.5pt down to sit level with the traffic
lights. Dev builds also serve the UI over plain HTTP when DIAL_DEV_UI is
set (make dev uses 127.0.0.1:3427) so it can be checked in a browser.
2026-09-23 01:09:01 +08:00
yetone 3a5f00ac71 Add make dev with live reload; align the window header with the traffic lights; make the profiles hint readable 2026-09-23 00:31:26 +08:00
yetoneandClaude 0a234ce41d dial: one dial for every coding agent's model
Wails v3 tray panel and window, TUI and CLI. Switches model, effort and
provider for Claude Code, Codex, Gemini CLI, OpenCode, Pi, Goose, Cursor,
Copilot CLI and Crush with format-preserving config edits. Providers page
and registry, stored keys, live vendor model lists, profiles.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-09-22 21:47:29 +08:00