f2eb56c6bbde1300dddc402861b59cd4e45e0215
74
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
40af660275 |
gui: failed calls told through statusErr, statusTErr and settingsErr (#3685)
origin/main |
||
|
|
dc0ec94d89 |
plugins: a repository's package.json name no longer hides npm's package (#3685)
A search left out npm's card of any package a tagged repository's package.json names, as if npm's package were that repository's. It is only when npm has the package from that repository, and then the repository's card is installed by npm's name (ghListing's spec). Otherwise npm's package of that name, if npm has one, is another plugin, which a search never showed. Now a search leaves out npm's card only of a listing's package, or of a tagged repository's that npm has from that repository, whose card installs by npm's name. npm's package of a name another repository's package.json gives stays, and its Install asks before it takes an installed repository's place (the first commit). Not changed: the GitHub section drops a tagged repository whose package.json names a listing's package (`listed`), the same rule the other way. Showing those would put repositories named like community plugins beside them, and that's the owner's call (#3929). Both sets are built from every listing and tagged repository, not from what the query left, as before. An npm card installs by the bare name, which resolve takes for a community plugin's where one is called by it (#3928). plugins.js grows 153 bytes, the core's scripts to 1,530,343 of 1,530,449: 2,028 bytes for the three commits, in the 2,134 the room makes. What was run (tree a5364df0, on origin/main |
||
|
|
7ea9056ae3 |
plugins: a GitHub card reads Installed only for the repository installed (#3685)
entryOf took a tagged repository's card for an installed git plugin of the package the repository's package.json names, so a second repository naming that package read Installed too. EchoChan314 (#3685) had github:mu-zi-lee/magpie-our-free-model installed, and Gyarados4157's repository of the same package showed a second Installed card, though nothing of it was on disk. Now a repository's card reads Installed only when the plugin installed is that repository, by whichever spec names it: GitHub's shorthand, its page, a git URL over https, ssh with a user, scp's colon or a port, ssh.github.com and git://, owner/repo, in any case and with a ref. ghRepo read only the shorthand, its page and owner/repo before. The other repository's card reads Install, and its Install asks first (the commit before), naming the spec installed. One case turns from Installed to Install: a repository renamed or moved on GitHub, installed by its old name. The page can't tell that from another repository of the same package without asking GitHub, and the latter is #3685, so it asks before a reinstall. And a card found by another spec than its own (its page, a git URL) shows no Sign in, as the page's URL didn't before: actionFor reads the sign-ins by the card's spec (#3930). plugins.js grows 41 bytes, the core's scripts to 1,530,190 of 1,530,449. What was run (tree c3898368, on origin/main |
||
|
|
5e8ddf5003 |
plugins: Install asks before it replaces a plugin of the same package (#3685)
plugins/ holds one package of a name, so plugin.Add installs another
source of an installed plugin's package in its place: the old one is
removed, its options and Off carry over, and the sign-ins saved for the
providers it served stay with those providers (plugin-auth.json keeps
them by provider id) for whichever code serves them next. The Plugins
page did that with no word: a listing's card over a git install of its
package, a tagged repository's card over npm's package of the name its
package.json gives, and the field's Install ("Have one in mind?") over
either. EchoChan314 (#3685) had github:mu-zi-lee/magpie-our-free-model
installed, and worried that a click on the card of Gyarados4157's
repository, of the same package, would switch the source quietly. Once
that card reads Install, as it should, its Install would do just that,
sign-ins included.
Now Install asks first when it would take another source's place, and
names both by their source, a git spec or npm:<name> (resolve's word for
npm's own package). For #3685's two repositories it asks "Replace
github:mu-zi-lee/magpie-our-free-model with
github:Gyarados4157/magpie-our-free-model?" (in the field; the card asks
the same once the next commit has it read Install), and says only one of
them can be installed, that the old one is removed and its options and
sign-ins pass to the new one, and, when the old one is off, that the new
one is installed off too. Cancel installs nothing. The same repository
by another spec, npm's package at another version, and a package nothing
installed has, install at once as before.
The field asks the same for a repository the page has read, npm:<name>
and a scoped name. A bare name, which resolve may take for a community
plugin's, and a repository the page hasn't read are known only once
installed, so they install at once as before; #3927 has them, with
`magpie plugin add` and a backup's or a sync's plugins, which replace
the same way.
Not covered: npm's cards still send the bare name, so where it is also a
name a community plugin goes by, the dialog names npm:<name> while the
community package is what gets installed (#3928).
The strings are in zh, zh-TW, ja and de. plugins.js grows 1,834 bytes,
the core's scripts to 1,530,149 of 1,530,449, in the room the commit
before makes.
What was run (tree 7ca08da4, on origin/main
|
||
|
|
dfc08e8824 |
gui: one NO_SCROLL for 90 focus calls, one statusErr for 68 failed calls (#3685)
Room for #3685, which did not fit the core script budget. The budget is not raised; two repeated forms move into one name each. - NO_SCROLL: `{ preventScroll: true }` was written out at 90 focus calls (89 in app.js, 1 in plugins.js). It is one const at the top of app.js now. - statusErr(e): `status(e.message, "err")` was written out for 68 failed calls (app.js 61, plugins.js 3, context.js 4), 15 of them as a `e => status(e.message, "err")` callback that now passes statusErr. renderSync is left alone: `status` is a local string there (#4066). Saves 2,016 bytes: core 1,536,751 of 1,537,034 and app.js 1,312,975 of 1,315,316 with #3685 on top. quota-refresh-order.test.cjs evals parts of app.js in a vm and gets both names as stubs. The idea is Coffemon's (JoeyWu-tech) e7af88774, which no longer applied to main; it was redone on the current tree. Landed by yetone in a batch of Coffemon's patches from the issues. What was run, go1.26.8, on origin/main |
||
|
|
ef7f55fe98 |
plugin: Discover lists a repository of gateway hooks alone, as a request hook (#3821)
MengXiangxi (#3821): a GitHub repository tagged magpie-plugin whose package.json has magpie.hooks and no main, exports or index.js, a gateway request hook alone that installs and runs, never showed in the Plugins page's "Unofficial, on GitHub". readTagged read the magpie block's middleware, agent and page but not hooks, so such a package was taken for a provider: the file #1327's check looks for in the repository was its entry as Bun resolves it, index.js, which it hasn't, and the 404 left it out without a word. An inert index.js, as the reporter tried, lists it, as a provider. readTagged reads magpie.hooks. A package with hooks, no main or exports, and none of middleware, agent or page is of kind "hooks", and the file #1327's check looks for is its hooks file, so one whose hooks file isn't committed (a dist built only to publish) is still left out, as a middleware's is. The Plugins page picks "hooks" out with middleware, as both run in the gateway (kindOf), and its chip says Request hook, as an installed one's row does, through the word kindChip takes since the previous commit. docs/subsystems/gateway-request-hooks.md says so. Not changed: a raw 404 that GitHub's cache answers just after a push is still kept for that push in this process (the reporter's second point, #4067). plugins.js grows 51 bytes for it. With the previous commit the core's scripts are 24 bytes under main's, 1,527,948 of 1,528,076. What was run (tree 79884772, on origin/main |
||
|
|
7a1bfaf2f0 |
plugins: kindChip says the word it is given, so a request hook's chip is one call (#3821)
The Installed tab's row of a gateway request hook made its chip as middleware's and then wrote "Request hook" over the chip's word, in five lines. kindChip now takes a word to say in place of its kind's, and the row asks for its chip in one line. Behaviour is unchanged: the same chip, class, glyph and tooltip, its word translated as before. This makes room under TestCoreScriptBudget for the next commit without raising the budget: the core's scripts go from 1,527,972 to 1,527,897 of 1,528,076. plugin-gateway.test.cjs, which opens such a row, now checks its chip says Request hook in each of its five languages; nothing checked it. What was run (tree 0b0ba0c9, on origin/main |
||
|
|
1027db4081 |
plugins: a README read once shows at once when its page opens again
The owner (10-30): closing a plugin's page and opening it again played
the loading bird over a README already read, and memory for them must
stay bounded, and a README changed since must not stay old.
detail() keeps each page read in a Map, the last 20 opened only: a new
read goes to the end and the oldest is dropped past 20. Opening a page
that is there draws its README and date at once, with no loader and no
bird, and reads the page again behind it; a README that changed takes
the old one's place, and a failed read keeps the one shown. A page never
read still loads under the bird, waiting for its three landings.
The core's scripts grow 677 bytes; coreScriptBudget is raised to the
exact size, 1,537,034, with no room added.
Run (mote, at
|
||
|
|
56bc3d515a |
plugins: a plugin's README waits for its bird to land on three lines
The owner (10-30): opening a plugin's page, the README came so fast that the bird dropped in and flew straight off, the same flash the skeleton bird had ( |
||
|
|
f463a8aaf7 |
gui: Settings has Loading bird, which keeps magpie's bird off skeletons and stops looking for them
Yayoi_no_yume on X, agreed by GymlinZhu: they run magpie on a 1-core,
1GB server and asked for a way to turn the loading bird off. The owner
wanted the bird, so it stays on by default. Settings -> General now has
"Loading bird" (Off / On), below Reduce motion.
- settings.json keeps noBird (omitted when the bird is on), and boot.js
passes it. A POST that leaves it out keeps it, as with the other prefs.
theme.js sets data-bird="off" on <html> before the first paint, and
applyPrefs changes it.
- skelBird (app.js): with the bird off, nothing looks for skeletons at
all. No 250ms interval and no observer run. Turning it off mid-hop ends
the hops, and the bird flies off.
- With the bird on, the look is driven by events. Before, the 250ms
setInterval ran forever, scanning the DOM for .skeleton whether or not
one existed. Now a MutationObserver watches for an added node that is or
holds a skeleton, the 250ms look runs only while one is in the page,
and the look stops itself once none are left.
- The README's bird (plugins.js bounceLoader): with the bird off, the four
lines stand straight with no bird, and the box goes when the README
comes.
- Strings are in en, zh, zh-TW, ja and de. App.js is 1,294,016 bytes, under
its budget, which is not raised.
Tests:
- skeleton-bird.test.cjs adds three tests:
- with no skeleton left, the look stops, and a skeleton added later
starts it again;
- with the setting saved off, no bird, no dip and no look ever starts
(setInterval is wrapped to count the look);
- the Settings row shows On by default; Off posts noBird:true, stops a
running look, and a skeleton added after that starts none; On posts
false and the look starts again.
- plugin-readme-bird.test.cjs: with the setting off, the lines stay
straight, no .sk-bird is drawn, and the box goes at once.
- settings-general: #birdSegs is in the list of bare rows.
- TestSettingsNoBird: off by default, kept by a POST that leaves it out,
cleared by false, in settings.json and boot.js.
Run at this head (rebased on
|
||
|
|
e8e9245ecf |
agents: Install another agent says Plugins has more agents, and opens them
The owner, on the Agents page: 因为我们支持Agent插件了,这里是不是也应该 显示插件中有更多? Install another agent listed only the agents magpie has an install command for; the agents a plugin adds were nowhere on that page. - GET /api/plugins/agents names the suggested agent plugins (the market's kind "agent") not installed here. One installed but turned off, or pinned to a version, counts as installed: Plugins turns it on. - Install another agent counts them in its header and ends with one row, "More in Plugins" with their names, as the Providers add sheet does for subscriptions. The row opens Plugins › Discover scrolled to its Agents, only while the click is fresh (scrollOnPurpose), on the section drawn last, since npm's answers draw it again. - The list is fetched beside the install commands, not before them, so a slow market never holds the commands back. With no install command left, the section shows the plugins' row alone and no install note. - Budgets: app.js 1,311,681 and the core 1,530,449 (+1,430 / +2,408 over main), the Agents page and Plugins page are the core's own, no room added. Run at this tree, rebased on |
||
|
|
766356cd3f |
plugins: a row's "Serves" chip names the providers the plugin registers (#3902)
The chip named only built-ins moved onto a plugin (provider.MovedOnto), so a plugin magpie never shipped as a built-in, like magpie-magicrew-auth signing in to letsmagic.cn and magicrew.ai, said nothing about what it carries. /api/plugins now sends `serves`: the names of the providers the plugin registers (plugin.Cached, which the row's provider names already come from), once each, leaving out the moved ones (a moved built-in's id is the plugin's provider id; the page names it as the built-in). It is sent when the plugin has a moved built-in or registers two or more providers: a lone provider is the row's title already. No package.json field. The "in place of the built-in" tooltip stays on a chip that names a moved built-in only. plugins.js is 27 bytes smaller; no budget touched. Analysis and the proposal by MYCF711 (mycf_711 on Discord) in #3902. Run: - go test ./internal/gui -count=1: ok (107s) - TestPluginServesItsProviders red with servesBeside returning nil (three cases), green restored - plugin-release.test.cjs (chromium + webkit, en + zh): 6/6; with origin/main's plugins.js 0/6 - plugin-*.test.cjs plugins-*.test.cjs i18n-keys.test.cjs: 661/664. The 3 reds are on main too: i18n-keys "a plugin's words are its own" (#3897) and plugin-card-update webkit en under load (#3079; 2 of 5 red on origin/main's plugins.js too, load ~65) - gofmt -l, go vet, GOOS=windows go vet, GOOS=linux go vet -tags nogui on internal/gui: clean Not tried: a real install of magpie-magicrew-auth in the window. |
||
|
|
ed5cc959a7 |
gui: every slow page's skeletons get magpie's bird hopping bar to bar
The owner, after the Plugins page's README bird ( |
||
|
|
689cf41423 |
plugins: a row's picture is asked for as it nears the screen (#909, #1956, #2459)
Each SVG an <img> draws is a document of its own in the webview (its
own Page, style engine and DOM, ~0.6 MB), kept while the window is
open. Opening Plugins drew 122 pictures at once, 57 of them SVGs, so
the renderer took 58 documents more, most for rows far below the fold.
icon() takes a lazy flag that sets loading="lazy" on the <img> it makes
for a stored picture or a -color/PNG icon; Plugins' rows and cards pass
it, the plugin's own page header (big) does not. Menus and other pages
keep loading at once, so nothing that opens on screen waits a frame.
Measured in Chromium against a dev backend with a copy of the real
library and its stored icons, every page visited then on Settings
(memory-infra dump of the renderer, then ps RSS):
- documents: 81 -> 37
- malloc 90.3 -> 81.7 MB, blink_gc 41.7 -> 39.7, partition_alloc
25.4 -> 20.5, image cache 5.3 -> 1.3
- renderer RSS 256-289 -> 243 MiB
Scrolled to the bottom of Discover, all 122 pictures load in Chromium
and WebKit (screenshot checked); before scrolling, 52 and 18.
Run at this head:
- go test ./internal/gui -count=1 -timeout 45m: ok 125s
- GUI: tests/plugin*.test.cjs, models-add-and-icons, mono-icon-redraw,
routing-log-icons, tray-logos, i18n-keys: 691 of 693 pass; the one
red is webkit en of plugin-card-update, waiting 5s for the Update
button under load 10 (#3079, filed on main
|
||
|
|
385ce789e4 |
gui: a page plugin's sidebar tab comes and goes as it is installed or switched
The owner: after installing a page plugin, its tab took a long while to show
in the sidebar. The Plugins page's actions (Install, Switch on/off, Remove,
the market card's Switch on, Move) re-read the plugin list and providers in
refresh(), but only the Plugins page's own load told the sidebar to read
/api/plugin-pages again, so the tab came when that page was next opened or
the language changed. The backend was never slow: POST /api/plugins/{op} and
GET /api/plugin-pages both answer synchronously.
refresh() now calls loadPluginPages first, without waiting on the providers'
answer, which can be slow.
Core script budget raised by 174 bytes to 1,542,418, measured at origin/main
|
||
|
|
722483c089 |
plugins: a plugin's README loads under magpie's bird bouncing down its lines
The owner found the plugin page's pulsing skeleton bars boring and picked concept F (Trampoline) from the design round. While the README loads, the skeleton's four lines are strings. magpie's bird drops onto the first, bounces down them, and each string bends under its feet and wobbles after it as a damped spring. A string it has landed on turns faintly to the accent colour. From the last string it is thrown off the top and drops in again. When the README comes, the strings fade and the bird flies off up-right while the dialog grows to the README on its spring, as before. With reduced motion the strings are drawn straight and the bird sits on the first one. How it fits the dialog: - The leaving box goes into #modal, beside the dialog, not inside it. Anywhere in the dialog (a scroller), an absolutely positioned box made WebKit lay the fields out 8px short until it was removed, so the dialog's last frame jumped 8px and modal-centred-late's "centred in every frame" went red at 820px in WebKit. Tried in the README and in the dialog first; both were red. - Its marks are data-* attributes, not classes, so holdModal's MutationObserver (class/hidden/open) doesn't run on every hop. It is removed 200ms after the 570ms height spring would end. - The README fades in alone (n, not the readme box), so the bird isn't faded with it. - Only the README skeleton changes; the small .skeleton bars elsewhere are as they were. Core budget: 1,537,016 -> 1,542,244, the bytes plugins.js grew, with no room added. Run at |
||
|
|
54b198c5c1 |
gui: a plugin's page grows to its README on a spring, not in one jump
A plugin's page (Plugins › Discover) opens with a skeleton for its README, and when the README came in the dialog took its new height in one frame. Now detail()'s fill() measures the dialog, puts the README in, re-centres it (holdModal), and animates height and top together from the old box to the new on SPRING, the curve the dialog opened on (570ms, 1.5% over), clipped while it grows; the README fades in over it. Height and top move on one curve, so the dialog keeps the middle in every frame. The same for the error note when npm or GitHub doesn't answer. Reduced motion: no animation, as before. Budget: the core 1,530,050 -> 1,530,631, the 581 bytes of fill(), the Plugins page's own, no room added. Run at this head (rebased on |
||
|
|
894ec96036 |
plugins: "More in Plugins" opens Discover, not the tab visited last (outloudvi on Discord)
On Providers, 「插件里还有更多」 / "More in Plugins" opened whichever
Plugins tab was visited last (Built-in, Installed). pluginQuery("")
returned early when the query was already empty, before it set the
tab to Discover. The early return is gone, so an empty query also
switches to Discover; a non-empty one already did.
plugins-more-discover.test.cjs visits Built-in, then Installed, in en
and zh, goes back to Providers and clicks the add sheet's More in
Plugins tile, expecting Discover with its cards and no Built-in list;
then the "look for a plugin" link with a search, expecting Discover
with that search.
Run:
- plugins-more-discover.test.cjs, chromium and webkit: 3 of 3 green.
- 61 GUI files the change can reach (plugin-*, plugins-*, builtins,
deprecat*, add-sheet*, provider-search*, i18n-keys, nav-sub-unroll,
mobile-web, market-have, sidebar-tab-top), both engines: 412 pass,
1 fail each: builtins.test.cjs's sidebar list lacks the masking
tab, red the same with the old plugins.js (#3498).
- go test ./internal/gui/ -count=1 (budgets included): ok but
TestMainWindowCorners/macOS_15_SDK killed at load ~200 (#1936,
#2645); alone it passes.
- At the rebased head (
|
||
|
|
63c0c354af |
gui: Discover is quieter: one unofficial mark, one button style, a reason in your language
Kiko03O1 on X asked for a better-looking Plugins › Discover page
("ui 设计能不能好看点"). Five things on it said one thing twice or said
it raw:
- A GitHub card had an "Unofficial" chip. A GitHub card is only ever
drawn in the 非官方插件 · GitHub section, so the chip repeated the
section's head on every card. It is gone from the card; the plugin's
page keeps its full warning.
- Sign in on a card and on an Installed row is tinted like Install,
not filled. It stays filled only in the plugin's sheet, so each level
of action has one look.
- The GitHub line said Go's English in the middle of a zh page ("no
answer in 8s"). internal/plugin's GitHub read now wraps its timeout in
ErrNoAnswer; /api/plugins/github passes `why`: "slow" for that or any
timeout, "limited" for GitHub's rate limit (ghtoken.Limited), and the page says "GitHub 响应超时" (zh, zh-TW, ja, de); the raw
error is the line's hover. The line is smaller and muted, and Retry
takes the accent colour.
- The second filter row's All had a count. It always equalled
Installed + Not installed and the first row's picked count, so
"全部 · N" showed twice side by side. It has no count now.
- Found on the way, same page: the filter box's placeholder was cut off
in en at 1280/1100/980 and in de at every width but 420. It fits at
every width now; the filter bar wraps where it did.
Looked at and left alone: the 8px inset on the borderless Signed in,
and the monospace version numbers.
plugins.js nets -25 bytes (the Unofficial chip's code went), so the
core script budget is unchanged: TestCoreScriptBudget passes at the
pushed head with no raise.
What was run, at this change on origin/main
|
||
|
|
fb101b0d57 |
plugins: a GitHub list that couldn't be read says why with Try again, instead of the section vanishing (till on Discord)
till (Windows, v0.1.1293, Belarus network) saw no "Unofficial plugins ·
GitHub" section in Plugins › Discover; a magpie in Japan shows it. On
v0.1.1293 the section shows its loading skeleton and then disappears
whenever GitHub can't be read: plugin.TaggedRepos returned the last list
(or nothing) with no error when the topic search failed, and an empty
list with no error when the search answered but every package.json read
from raw.githubusercontent.com failed or timed out. /api/plugins/github
answered 200 {repos:[]}, and the page showed ghFailed only on an HTTP
error, never in a search, and never once a list had been had.
Now:
- TaggedRepos returns the error with what it has. A failed search keeps
the last list and says why (held a minute, like before); repositories
the search found but that couldn't be read come back as a
*TaggedMissing with their count and the last read error.
- /api/plugins/github sends error and missing beside repos; ?again asks
GitHub again at once when the last answer had an error.
- The page shows the reason and Try again: in place of the section when
nothing could be read (in Discover and in a search), and as a line over
the cards when some were read or an older list is kept. Try again keeps
the cards while it asks. zh, zh-TW, ja and de strings added.
No Windows-only cause was found in the code: the fetch goes through the
same netproxy on every OS (a PAC-only system proxy isn't read anywhere).
The likely cause is the network reaching api.github.com or
raw.githubusercontent.com, or the unauthenticated search limit; the page
now names which.
Run (worktree on
|
||
|
|
33dbdcc529 |
plugins: Sign in on Installed takes the reader down to the plugin's sign-in
Sign in on Plugins › Installed (or a plugin card) opens the Providers add
sheet with the plugin's sign-in drawn at the sheet's foot, under every
tile. With many plugins the sheet is taller than the window and the reader
was left at its top, the sign-in out of sight: the click seemed to do
nothing (the owner, on magpie-intelligence-check).
The click now passes its event, so pluginSignIn scrolls the sign-in into
the middle of the view on purpose. In WebKit that alone didn't hold: the
list show() loads redraws the sheet after the scroll, WebKit pulls the view
to 0 while it is drawn, and inside the purpose window that 0 was taken as
the reader's, then backToReader returned there. arrived(v) ends the
purpose window once the scroll is done and keeps where it left the view as
where the reader is, so the redraw is put back to the sign-in.
Run:
- plugin-signin-scrolls.test.cjs (new; 24 signed-in plugins and one
signed out, 900x560, Chromium and WebKit, en and zh): 6/6 pass. On
origin/main 0/6 ("the page went down to the sign-in"); with the scroll
but without arrived(), Chromium passes and WebKit fails 2/2.
- GUI: plugin*, *scroll*, *signin*, builtins: 1033 pass, 0 fail.
- go test -tags nogui ./internal/gui: ok (script budget, guard tests).
No Go changes.
|
||
|
|
d783df46cb |
plugin: a plugin's page adds items to a provider's and an agent's row menu (P6)
package.json's magpie.actions: [{id, menu, title, titles}] puts items in
the row menus magpie draws, after its own: a provider row's (right-click)
and an agent row's (its handle, or right-click). Picking one opens the
plugin's page and posts it {event: "action", data: {id, provider|agent:
{id, name}}}, nothing else of the row; the bridge's magpie.onAction(fn)
gets it, and an action picked before fn was given waits for it.
- plugin.Window reads them (page.go): menu one of ActionMenus (provider,
agent; a session's menu is left out, its title is user content), id
^[a-z0-9][a-z0-9-]{0,39}$, an id given twice is the first's, 8 at most,
none for a plugin with no page.
- /api/plugin-pages carries them on the page; a missing title is the
page's, in each language (pluginpage.go).
- pluginpages.js: magpie.actions(menu, context) gives the row menu's
items; openRowMenu draws a plugin's name as written (literal), not
through t().
- The Plugins page says which menus a plugin adds to (actionsLine),
translated in zh, zh-TW, ja and de.
- Docs: plugin-runtime.md's P6 section and verification; the site's
plugin docs (en, zh, ja) gain "Items in magpie's menus".
- The core's budget (TestCoreScriptBudget) is not raised (#2710): with
P6 the core came to 1,447,648 bytes, 648 over. pluginpages.js's header
now says P5's and P6's part in one paragraph and points to
plugin-runtime.md, which says it in full, and plugins.js's panels and
actions lines share whereLine: 1,446,845, 155 under.
Run:
- Full: this series (P5, the Plugins dot, the probe test, P6, and a
built-ins-on commit since dropped for main's own
|
||
|
|
8e44c2f351 |
gui: the dot on Plugins says what it is, and leads to the plugins with an update
The owner, on the sidebar's dot beside Plugins: no one can tell what it means, and once they click it, they should see which plugins need updating. It meant "a plugin update is waiting", said only in a hover title, and Plugins opened on whatever tab was last open. - Sidebar: under Plugins, Installed reads "1 update" / "N updates" in the dot's colour in place of its count, with a title saying where to update. - Opening Plugins while an update waits lands on Installed. - Installed names the plugins with a newer version in a bar above the list, with Update all beside them (moved there from the footer). Each row still shows its own "vX out" and Update. - Strings in zh, zh-TW, ja and de; the docs (en, zh, ja) say the same. Run: - plugin-updates.test.cjs: chromium and webkit, en zh zh-TW ja de, at 1024 (sidebar) and 600 (tab bar), 22 ok. Also ok in both engines: plugin-git, plugin-update-button, plugin-check-updates, plugin-card-update, plugin-prerelease, nav-sub-unroll, sidebar, builtins, i18n-keys. go test ./internal/gui/ -run 'TestCoreScriptBudget' ok. - Broken by hand, each red: no sidebar label (the 1024 cases), no jump to Installed, no bar (every case). - Looked at in WebKit screenshots, zh at 1024 and de at 600. Full run, with the rest of its series: this series (P5, the Plugins dot, the probe test, P6, and a built-ins-on commit since dropped for main's own |
||
|
|
b9f790d37b |
plugins: panels in magpie's pages, a page that replaces a built-in one, titles in the window's language, and a look that matches
P5 of the plugin runtime (docs/subsystems/plugin-runtime.md):
- Panels (magpie.panels): a plugin draws a frame into a slot of a
built-in page (a provider's editor, Settings, Usage); magpie.context
says where it is, and the frame is as tall as what it draws.
- A page can replace a built-in one (magpie.page.replaces); show() opens
it in that page's place, and the sidebar row goes to it.
- page.titles and a panel's titles name it in the window's language
({"zh": …}); a malformed map is dropped, the title kept
(TestWindowTitles).
- main's #2501 already names wails:// in the policy of a page in the
desktop window (through ownWindow), which is why the usage page drew as
bare HTML from v0.1.1259. TestPluginPageLoadsItsFilesInTheWindow loads
a page through ownWindow in a real WKWebView, which Playwright on http
can't; the subsystem page says how.
- The bridge adds magpie's look for what a page leaves unstyled, every
rule in :where() so any rule of the page's wins, and the theme's
colours as --magpie-* variables.
One commit: the panels, the replacing pages and the titles share hunks
in page.go, pluginpage.go, pluginpages.js and the docs, and couldn't be
split cleanly.
Run:
- Full: this series (P5, the Plugins dot, the probe test, P6, and a
built-ins-on commit since dropped for main's own
|
||
|
|
17557132cb |
gui: in a narrow window the title bar's tools show their icons, then the title gives way; nothing lies over it (#2625, linusxiong)
Beside the sidebar, Library's, Plugins' and Settings' heads sit in the
title bar after the breadcrumb, between --tools-l (the crumb's right +
16) and the window's buttons, laid out flex-end. When the tools needed
more than that room they ran on to the left, over the crumb: at about
650pt with the sidebar, Library -> MCP servers had 「发现」 over
「MCP 服务器」's last character. The crumb never gave way to them.
app.js tools() now shares the room out, laying out and reading each
step in its one frame, the next only if the tools still run over:
1. the crumb whole (its natural width from its parts, the last one's
scrollWidth) and the tools with their words;
2. body.tools-tight: Library's Discover / Library folder / Backups and
Plugins' "Mirrors in China" show their icon (or switch) alone. Each
keeps its name as aria-label (a hidden span leaves the accessible
name) and its tooltip as before (the folder's path, the backups'
note and path, Discover's and the mirrors' sentences);
3. --crumb-max: the crumb drops its leading parts ("Work /"), a part
and its slash at a time, and last cuts the page's name at its end.
In the side-nav head the Library buttons and the mirror switch are
flex: none and Plugins' search keeps 120px, so what doesn't fit shows
as running over rather than shrinking out of sight. The views'
MutationObserver also asks tools() again, as a tab's own tools change
(Discover only on MCP servers and Skills) without the crumb resizing.
title-bar-tools.test.cjs (new): every Library tab, Plugins' three and
Settings, sidebar picked, window mode, at 560 (the window's least),
650, 760, 900, 1024 and 1280px, in zh, zh-TW, ja, de and en, Chromium
and WebKit. No tool lies over the shown title or another tool or out
of the bar, no label is cut, an icon-only tool has aria-label and
title, only leading crumb parts go and the page's name shows, whole
from 650px. Against the old assets (MAGPIE_GUI_ASSETS) it fails in all
five languages at 560px Library Instructions ("a tool lies over the
title"); with the change Chromium 5/5 and WebKit 5/5. Looked at
screenshots of zh Library MCP servers and Plugins Discover at 560, 650
and 760px.
docs/subsystems/gui-shell.md says how the title bar gives way.
Run with both #2623's and #2625's changes, on
|
||
|
|
7d7dba31ae |
provider: removing or turning off a moved subscription's plugin moves nothing back
The built-ins are being retired (the owner, 10-16: 陆续把内置Provider下线掉),
so the last way back to one is gone. MoveBack, moveBack and releasePlugin
are removed, with the Left flag they set.
- SetPluginOff only turns the plugin off. A moved subscription stays
moved, off with it.
- RemovePlugin records the moved ids as the new state "removed". The
record keeps its accounts, which plugin.Remove leaves in the plugin's
auth store. Nothing moves or installs it by itself: MoveRetiring
skips it and keepMovedCurrent reads only "plugin".
- HandOver turns a removed record whose plugin is installed and current
back into "plugin", record and all. So does Adopt (the editor's Move).
- MoveRetiring moves an old "back" record again, whatever Left said.
- Plugins page, rm/off confirms: "{names} stops working until the plugin
is installed again. Its accounts are kept." / "... while the plugin
is off." The status after removing no longer says it is back on the
built-in.
- Strings: five old strings dropped ("Moving back…" among them), three
new ones in zh, zh-TW, ja and de.
- `magpie plugins rm`/`off` say the same in their output.
- Docs: provider-plugins.md (the states table, the Move-back paragraph)
and AGENTS.md.
Tests:
- TestNoWayBack is new. It covers a "back" record moved again, the
plugin turned off (still moved, accounts kept), removed (removed, not
reinstalled by keepMovedCurrent or MoveRetiring), installed again
(HandOver), and removed again then Adopt.
- TestReleasePlugin and TestMoveBackKeepsLapse asserted the way back
and are deleted.
- TestMove, TestHandOver, TestMoveTidiesItsPlugin and
TestAdoptBeforeSigningIn no longer call MoveBack. TestKeepMovedCurrent
uses the removed state.
- plugin-release.test.cjs checks the new asks and that the status names
no built-in.
Run:
- Broken by hand:
- With HEAD's migrate.go, TestNoWayBack is red at "turning the plugin
off moved it back".
- With HandOver's removed branch disabled, it is red at "installed
again: map[], moved false".
- go test -tags nogui ./internal/provider -run
'TestMove|TestNoWayBack|TestHandOver|TestKeepMovedCurrent|TestAdopt|TestInstallPlugin|TestWorkBuddyCheckin|Plugin|Migrat':
ok.
- GUI (NODE_PATH playwright, --test-concurrency=1): plugin-release,
plugin-move and i18n-keys, chromium and webkit: 17/17.
- gofmt -l clean; GOOS=linux and windows go vet of provider, gui and cli.
- Full suite: go test -tags nogui ./... -count=1 -timeout 90m at this commit rebased on
|
||
|
|
1d6f461a99 |
plugins: the Unofficial, on GitHub section shows while GitHub hasn't answered, looking, with cards still to come
On a slow line the section wasn't drawn until /api/plugins/github
answered, so Discover read as having no unofficial plugins (yetone:
当还没加载完的时候,压根就不显示,会让那些网慢的用户以为没有非官方插件).
While it waits, the section stands in its place before the field: its
head and hint, a quiet "Looking on GitHub" with three breathing dots
(role=status, aria-busy on the section), and three card-shaped ghosts
(logo, name, author, button, two lines, two chips) a soft light passes
over, each card a beat after the last. When GitHub answers, its cards
come in where the ghosts were with a short staggered fade-up. A search
while it waits shows the same. When the ask fails (and nothing was
loaded before) the section says "Couldn't ask GitHub: <error>" with Try
again, instead of disappearing. prefers-reduced-motion stops all of it.
Strings in zh, zh-TW, ja and de.
Run:
- new internal/gui/tests/plugin-github-wait.test.cjs: 18/18 on this tree
(Chromium and WebKit; en, zh, ja, de; 980 and 440 wide; held, search
while held, let go, 502 then Try again, no scroll on the click).
With MAGPIE_WAIT_ASSETS at origin/main's assets: 9/9 red (Chromium).
Screenshots of each state looked at.
- GUI files around it (plugin-*, i18n-*, builtins, nav-sub*,
click-scroll, old-webkit, mobile-web): 602/620 under load. The reds,
rerun one file at a time here and on origin/main
|
||
|
|
9b04c4e20f |
plugin: async gateway request hooks, run in Bun before routing and after the reply (#2118)
A package's magpie.hooks entry (or a *.hooks.{js,mjs,ts,mts} file) exports
`async onRequest(body, ctx)` and an optional `onResponse(reply, ctx)`. They
run in the Bun plugin host, so a hook can await I/O, for example a context
service like PowerContext, which the sync moejs middleware can't. The
gateway still makes one model request per client request. A hook adds
context to the body; it doesn't register tools or run a loop, so magpie
doesn't become an agent runtime.
Ported from Tsukikage7/magpie#1. Changes from the fork:
- The entry name is magpie.hooks / *.hooks.*. The fork's magpie.gateway /
*.gateway.mjs is already the middleware's alias, so a hook importing
node:fs was also loaded as moejs middleware and failed there.
TestGatewayHookNamesApartFromMiddleware fails if the two sets overlap.
- onRequest is rolled back, and counts as failed with no onResponse, when
it throws, times out, returns non-JSON, or changes tools, tool_choice,
function_call, functions, toolConfig, model or stream.
- onResponse gets the client-facing reply, merged through the gateway's own
stream decoder, collector and renderer (no second merger).
- Codex's native passthrough (/backend-api/codex) runs the hooks too,
without the sync middleware.
- The run ends with the request handler, not the client connection. Codex
hangs up on response.completed, and the reply it got is still captured
as a success. TestGatewayHookSeesReplyAfterClientHangsUp is red on the
old `r.Context().Err()` check and green with -count=3.
- ctx.origin is host-derived (local / gateway-key / remote). Headers, keys
and peer addresses never reach the hook.
- Plugins page: a hook package shows a "Request hook" chip, a diagnostics
line (outcome code, calls, avg ms, bytes, failures; no content), and
Options. Strings are in en, zh, zh-TW, ja and de.
Docs: docs/subsystems/gateway-request-hooks.md (new), provider-plugins.md,
gateway-middleware.md, and site docs plugins.html in en, zh and ja.
Real use, sandbox HOME on 127.0.0.1:3486 with the owner's real Codex Pro
sign-in. The probe hook adds a codename note and logs both callbacks:
- /v1/responses, /v1/messages, Gemini generateContent: stream and
non-stream. onRequest's note reached the model (the answer had the
codename), and onResponse got success=true and the whole reply.
- /v1/chat/completions: with the probe also changing `model`, the change
was rolled back (the reply came from the asked model) and no onResponse
ran. Without that change, earlier: stream and non-stream success.
- The real Codex CLI 0.162.1 `codex exec` through openai_base_url ->
/backend-api/codex: the hook saw origin=local, agent=codex and the
query; the answer had the codename; onResponse success=true (before the
hang-up fix it never ran: the context was already cancelled).
- `magpie plugin list` shows only "async gateway hook onRequest" for the
hook package, no failed middleware.
Tests (base origin/main
|
||
|
|
b6533893a7 |
plugins: Discover lists tools and page plugins, and the intro links to the plugin docs
Every kind of plugin magpie runs now has its place on the Plugins page, so
someone looking to extend magpie finds what exists and how to write one:
- Discover has "Tools for agents" (market kind "tools") and "Pages" (kind
"page") sections beside Subscriptions, Gateway middleware and Agents,
each card with its own chip (a new Tools chip, the Page chip). Before,
both kinds fell under Subscriptions as Providers.
- A GitHub repository tagged magpie-plugin whose package.json has
magpie.page.file is a Page, and that file must be committed, as a
provider's entry must (TaggedRepos).
- An installed plugin that only gives tools wears the Tools chip.
- The intro says what a plugin can be (provider, gateway middleware,
routing strategy, tools, an agent, a page) and its "Write a plugin" link
opens usemagpie.ai/docs/plugins in the window's language (zh and zh-TW
to zh/, ja to ja/), outside the window.
- The docs' Publishing section lists the "tools", "page" and "agent"
registry kinds and the community package names for each, in en, zh, ja.
Run at the reviewed head (on origin/main
|
||
|
|
dfdb6f8a35 |
gui: a plugin that takes a deprecated built-in's place says "Replaces built-in"
molvqingtai on Discord: the Plugins card's "Also built in" chip read as "magpie has this anyway", so why install a plugin. A new user can't add a deprecated built-in at all: the Add sheet leaves one with no account out (unusedSub). And installing the plugin moves the built-in's accounts to it (provider.HandOver: at once with none, from the hourly KeepRetiringMoved with some). The chip now says "Replaces built-in". Its tooltip, and the note on the plugin's page, say that magpie's own sign-in to this subscription is deprecated, that the plugin takes its place, and that accounts signed in there move to it. This is in en, zh, zh-TW, ja and de. Run: - plugin-market.test.cjs: asserts the Zed card's chip text and tooltip in en and zh, in Chromium and WebKit. Red on the old strings. - plugin-move, plugin-movable-review, plugin-move-unserved and deprecation-notice: 37/38 in one concurrent run. The red was plugin-move WebKit en, a scroll measure in the editor, which doesn't draw this chip. It passed 3/3 alone and 8 at once, and is filed as #2431. Full suite: not run for this commit alone; run on the batch before push. |
||
|
|
acb0d4ba0a |
gui: Plugins' "Unofficial, on GitHub" picks out what's installed beside its kinds, and the two narrow it together (#2381)
The owner: 插件发现这里加一个未安装. MiFaZhan's patch (#2381, fork commit 295eb0e9): beside the kinds, a second segmented control, All · Installed · Not installed, each with how many there are. Each strip counts what the other, the section's field and the page's search leave, so picking Middleware turns the installed strip's counts into the middleware's alone; Show all clears it with the kind and the field. Which repositories are installed is asked once each (entryOf, the same call the cards' "have" comes from). "Installed or not" and "Not installed" in zh, zh-TW, ja and de; Installed reuses its key. Changed from the patch, on review: - The strip shows only while the list has both installed and not installed repositories, as one kind alone gets no kinds strip: with nothing from GitHub installed, Not installed was All again and Installed always 0. - A pick the strip can no longer show is dropped, rather than narrowing the grid out of sight: Installed picked, then the page's search left only repositories not installed, hid the strip and kept an empty grid. - The test checks the page's own .pm-card.have against the two the fixture installs (it had compared a package-name rule of its own), and adds: nothing installed has no strip, and the strip going takes its pick with it. Its 420px run is the commit before. Run (at this commit): - plugin-github-filter.test.cjs, en/zh/zh-TW/ja/de at 1100/980/420 plus "nothing installed": chromium 17/17, webkit 17/17. - Broken by hand, each red in both engines: the pick kept when the strip goes (16 red), the strip always shown (17), Show all leaving the pick (16), the kinds' counts ignoring the installed pick (16), the installed strip's counts ignoring the kind (16). - plugin-github.test.cjs 9/9, i18n-keys.test.cjs 3/3, go test -tags nogui -run 'TestCoreScriptBudget|TestBuiltinsTranslated' ./internal/gui ok. No Go file changed; git diff --check clean. Not tried: the real app window; the patch's threshold (no bar at six tagged repositories or fewer) is kept as it was. Full suite: SUITE_LINE Co-authored-by: MiFaZhan <MiFaZhan10@gmail.com> |
||
|
|
3f913b3de6 |
plugins: a JS gateway plugin serves routings (strategies) and watches usage rows (onUsage); plugins/middleware is "JS gateway plugins" (P4)
A plugin's gateway module (magpie.middleware, or its alias magpie.gateway,
or a *.gateway.js file) may now export, besides onRequest/onEvent/onResponse:
- strategies: {name: (pool, seats, options) => order}. Each is a routing
"<short name>/<name>", registered with routes.Register while the plugin is
on and loaded and removed when it goes off or reloads. Seats are
routes.Seat in camelCase JSON. 20ms each; it fails open: a throw, a timeout
or a result that isn't an order of the seats means the listed order. The
failure is counted and logged, rate-limited. A file's name is made into a
routing-safe prefix.
- onUsage(row, options): gets an allow-listed usage row (no bodies, prompts,
error text, sessions or request ids). The rows come from a bounded queue
(1024) with one worker, off the request path; a full queue drops the row
and counts it, and a request never waits. 250ms each.
plugins/middleware is renamed "JS gateway plugins", with a new Sub
(en/zh/zh-TW/ja/de). It registers usage.Observe(middleware.Points()). Off,
no JS hook, strategy or onUsage runs. InUse is unchanged.
providers.json keeps a routing of the form <plugin>/<name> as saved
(provider.PluginRouting) in provider and group Save, whether or not a
plugin serves it now. Before this, `group set g routing=pick/last`
stored nothing.
GUI: the settings state carries jsRoutings. Provider and group routing
pickers offer the served ones, marked data-feature=middleware. A saved
routing that no plugin serves now shows as it is, with a hint. The
Plugins page's line shows routings, how often they were asked, onUsage
rows and dropped rows. The CLI accepts `group set <id> routing=<plugin>/<name>`.
`magpie plugin` lists a module's routings and onUsage; a strategy-only
module had printed nothing after "gateway middleware".
Docs: docs/subsystems/gateway-middleware.md (Routings and usage rows,
limits, verification) and plugin-runtime.md (P4: community plugins at
every point). site/public/docs plugins.html in en, zh and ja has an
example: internal/middleware/testdata/spread.gateway.js, which
TestDocsExample runs.
What was run (worktree on 4df1ba0c6, -p 2):
- gofmt -l: clean. go vet on internal/{middleware,cli,gui,plugin,provider}
and plugins/...: darwin, GOOS=linux -tags nogui, GOOS=windows; all
clean, run after the last Go change.
- go test, after the last Go change: internal/middleware ok,
plugins/middleware ok, internal/provider ok (210s), internal/cli ok
(203s). Earlier in the work: internal/plugin ok (385s), internal/pluginrt
ok, internal/gui (Go) ok (320s), and plugins/... ok. The first
plugins/... run printed a bare FAIL line that `tail` cut off before its
cause showed. The rerun was all ok; the cause is unknown.
- GUI, both engines (routing-*, group-*, builtins, i18n-keys, gui-de/ja/zh-tw,
plugin-middleware): 1220 tests, 1204 pass, 16 fail.
- routing-manual (4): mine. A group's own "manual" was offered a second
time as a routing no plugin serves. Fixed in client.js withJS. The
coordinator is rerunning routing-manual, keys-fold, group-fold,
intent-entry and routing-js alone in both engines, so that rerun is
not recorded here.
- routing-model-rest: red alone too, and red on untouched 4df1ba0c6
(3/20). It is #2115; I commented there with the webkit cases.
- group-member-weight webkit de 420 is #2387.
- group-from-model-add webkit zh: it passes alone 2 of 2. Under load it
waits a fixed 2s for the save post. Filed as #2388.
- routing-keys-fold (webkit zh/ja/de), routing-group-fold (goto timeout)
and routing-intent-entry (browser launch timeout 180s) are load
timeouts. The coordinator is rerunning them alone.
- routing-js.test.cjs (new) passed in chromium en and zh, before the full run.
Broken by hand, each test went red, then restored:
- the permutation check: TestStrategyFailsOpen;
- the queue's non-blocking send: TestOnUsageNeverBlocks ("Ledger waited
2.04s");
- the allow-list: TestUsageRowAllowList;
- unregister on off: TestStrategiesServedWhileOn and
TestStrategiesStopWithServe;
- the CLI pattern: TestParseRoutingStays;
- Observe in plugins/middleware: TestOnServesStrategies;
- PluginRouting in provider.go and in group.go: TestPluginRoutingKept;
- the prefix sanitizing: TestRoutingFromFileName;
- the CLI list line: TestPluginListSaysMiddleware;
- the GUI's data-feature mark and its unserved-saved entry: routing-js.
Real use: a sandbox HOME, the gateway served on 127.0.0.1:3682 by a
-tags nogui build, a fake vendor on 3681, and providers fa (key ka) and
fb (key kb) in group g. pick.gateway.js has strategy last (reverse) and an
onUsage that logs.
- `group set g routing=pick/last` stored it.
- A request to group/g reached the vendor with Bearer kb, and the
"usage-row fb m in=5 keys=17" line was logged.
- `plugin off pick.gateway.js`: Bearer ka (listed order), no onUsage,
routing still pick/last.
- `plugin on`: Bearer kb and onUsage again.
- `plugin builtin off middleware` says "in use and stays on", as InUse
should.
- Not tried: the GUI against that gateway, or a real vendor account.
|
||
|
|
64b0f3a201 |
plugins: a community plugin's own page in magpie's window, shut in a sandboxed frame (P4)
A plugin's package.json may declare magpie.page {title, file, icon} and
magpie.permissions.reads. While the plugin is on, its page gets a tab in a
"Plugins" group after the built-in pages, drawn in an iframe sandboxed to
allow-scripts only (an opaque origin: no cookie, no storage, no parent).
Its files come from /_magpie/plugin/<token>/ (HMAC of the spec with a
per-process secret) under a CSP with connect-src 'none' and
frame-ancestors 'self'; a path that leaves the page's folder, a symlink
out, or an off plugin's token is refused. The window's postMessage bridge
answers only that frame (event.source checked) with theme and language,
the plugin's own options.get/set (throttled), and the reads it declared;
any other read is refused in the window and again by the server, and no
read carries a secret. /api refuses Origin: null and frame/iframe
fetch-dest requests (noFramedAPI), so the frame never reaches the GUI's
API even with the cookie. A page that throws or never says hello shows
the kernel's broken-page state with Try again. The Plugins page shows the
page and what it reads before the plugin is turned on.
Docs: gui-shell.md, plugin-runtime.md (P4 section), site docs en/zh/ja
with an example plugin; i18n zh, zh-TW, ja, de; fixture in
internal/gui/testdata/page-plugin.
Run (worktree at base 4df1ba0c6, -p 2, one package at a time):
- go test -count=1 -timeout 45m: internal/gui ok, internal/plugin ok,
internal/pluginrt ok, plugins/... (budget groups middleware otel redact
rotation search) ok.
- gofmt -l clean; go vet darwin, GOOS=linux -tags nogui, GOOS=windows clean.
- Playwright (chromium + webkit, 5 languages, narrow widths): plugin-page 4/4,
plugin-kernel 4/4, builtins 4/4, i18n-keys, gui-de, gui-ja, gui-zh-tw 3/3,
plugin-middleware 24/24, plugin-own-icon 22/22, plugin-options 22/22,
plugin-local 8/8, plugin-agent 22/22, click-scroll 22/22.
Broken by hand, each went red: CSP without connect-src; apiFramed always
false; the server's read check removed; the noFramedAPI wrap removed from
api.go (red through the real Handler); inside() letting every path
through; CORP same-origin re-added; in JS the client read check removed,
the ev.source check removed, and allow-same-origin added to the sandbox.
Without the Array.isArray guard on /api/plugin-pages, plugin-kernel,
builtins and plugin-middleware/own-icon/options went red (their mocks
answer a non-list) - that was found by the run, then fixed.
Real use: built magpie, `magpie web` on 127.0.0.1:3472 (gateway 3471) in a
sandbox HOME with the example plugin added. curl: the page file loads
with the CSP and no cookie, traversal and a bad token are 404, /api with
Origin: null or Sec-Fetch-Dest: iframe is 403 even with the cookie, an
undeclared read 403, a declared one 200. Chromium and WebKit at 1100 and
420: the page draws its declared read, the probe's fetch/absolute
fetch/top access/undeclared read are all refused, an <img> of /api is
refused, no page errors. Real use found that a
Cross-Origin-Resource-Policy: same-origin header blocked the frame's own
files (its origin is opaque); it is gone and a test guards it.
Not tried: the desktop (Wails) window. Market cards of plugins not yet
installed don't show a page's reads. The Playwright suite mirrors the
CSP in a mock route rather than the Go server (the Go tests and real use
cover the server).
|
||
|
|
6ac7032b4b |
plugins: a community plugin's tools reach every agent through magpie's MCP server /mcp/magpie/tools (P4 tool point)
A plugin's OpenCode `tool` hook ({tool: {name: tool({description, args,
execute})}}) used to reach no agent. Now the plugin host collects each
loaded plugin's tools, turns their zod args (v3/v4 shape or object; a
raw JSON Schema is kept) into JSON Schema, and runs one on a `tool`
call: arguments checked against the tool's own zod first (defaults
filled, a wrong one named), execute raced against ToolTimeout (55s,
ctx.abort fires), the answer as text.
The gateway serves them as an MCP server at /mcp/magpie/tools
(tools_mcp.go, guarded by serveMCP as the search one, 4 MiB body):
tools/list names each <plugin short name>_<tool>, at most 64 chars,
a shared name numbered _2; tools/call holds the call to the calling
key's limit through reserveFor and runs it with the calling agent.
The built-in plugin `tools` ("Plugin tools", Essential) serves
gwtool.PluginTools; off, nothing is listed, a call says the plugin is
off and the host isn't asked. InUse counts plugins that are on and
gave tools, from plugin-tools.json, which the host writes after each
load (whole, only on change), so it never starts Bun; the gateway's
KeepFresh watches that note too. Tool answers go to the calling
agent only, so masking doesn't apply (said in the docs).
The Plugins page lists an on plugin's tools by their MCP names, with
descriptions on hover and a button copying the server's address; a
plugin of tools alone has no Provider chip and isn't said to sign in
to nothing. Not done: a Library featured opt-in entry; wiring is the
copied address.
Docs: docs/subsystems/plugin-tools.md (new), plugin-runtime.md's new
"P4: community plugins at every point" section with the tool row, the
README index, usemagpie.ai/docs/plugins#tools in en, zh, ja with an
example. Strings in zh, zh-TW, ja, de. Example plugin:
internal/plugin/testdata/tools.
Run at this commit's tree (base 4df1ba0c6), each package alone, -p 2:
- gofmt -l clean; go vet darwin, GOOS=linux -tags nogui, GOOS=windows
over internal/plugin, gwtool, gateway, plugins/..., gui, pluginrt: ok
- go test ./internal/plugin -run Tool; ./plugins/...; ./internal/pluginrt;
./internal/gui -run 'Builtin|Plugins'; ./internal/gateway -timeout 45m
-run 'ToolsMCP|ServingGates|OwnMCPRejects|SearchOnAndOff|KeyLimitsOnAndOff':
all ok
- GUI, Chromium and WebKit: every plugin-*.test.cjs, i18n-keys,
builtins: 461/461 pass; plugin-tools.test.cjs (new) covers en, zh,
zh-TW, ja, de at 980 and 420 px
Broken by hand, each red, then restored:
- tools/list ignoring the gwtool gate -> TestToolsMCPOff
- tools/call ignoring the gate -> TestToolsMCPOff
- reserveFor removed -> TestToolsMCPHeldToKeyLimit (tool ran)
- collision suffix dropped -> TestToolsMCPServesPluginTools
- ToolsOn ignoring Off -> TestPluginTools
- host arg check removed -> TestPluginTools
- host timeout race not listening -> TestPluginTools (answered at
5.3s by Go's backstop; the test now bounds it at 4s, and the first
try at this break was a syntax error that proved nothing)
- GUI listing an off plugin's tools -> plugin-tools.test.cjs
Real use: a built magpie in a sandbox HOME (MAGPIE_ADDR 127.0.0.1:3491,
real Bun), the example plugin added with `magpie plugin add`. curl over
MCP: initialize, tools/list (4 tools, schemas), shout "HI HI (for
curl)", a missing argument as isError naming it, add {"sum":6.5}, fail
"it broke", a foreign Origin 403; plugin-tools.json written. Claude
Code (sandbox CLAUDE_CONFIG_DIR) `claude mcp add --transport http` +
`mcp list`: Connected. Not tried: a model calling a tool through a
real agent turn (no model in the sandbox). Binary and HOME removed.
|
||
|
|
1fd73a3fce |
gui: a folder plugin on a Windows path is a folder on the Plugins page (#2266, ggbdpq)
plugins.js isPath took a spec as a path only when it started with ./, /, file:// or a drive letter. plugin.IsPath also takes a leading backslash (#2229), so a plugin added from \\server\share\plugin or \Users\me\plugin was installed as a folder. The Plugins page, though, named it by its whole path and treated it as an npm package. isPath now takes a leading \ too. Sibling: name() cut a spec at its last @ before label() could see it was a path, so C:\Users\me@corp\plugin was labelled "me". It now returns a path whole, as plugin.Name does. The test has that case. No other isPath copy exists in the GUI: label, isGit, onNPM and the local check all go through this one. Run (this commit is the last of four in this push; the run covers all four at this head): - gofmt -l: clean. go vet ./... darwin -tags nogui, GOOS=linux CGO_ENABLED=0 -tags nogui, GOOS=windows CGO_ENABLED=0: clean. - set -o pipefail; go test -tags nogui -p 4 -timeout 40m ./... in a sandbox HOME: exit 0, 55 packages ok, no FAIL. - The issue's plugin-folder-path.test.cjs, with the @ case added: Chromium and WebKit pass. - Every GUI test that opens the Plugins page (37 files, 504 tests) passes in Chromium and WebKit. - Rebased on |
||
|
|
3ccbe6bc15 |
plugins: a runtime for built-in plugins, and Plugins › Built-in to switch them (P0)
Lxxyx on X (https://x.com/Lxxyx_/status/2109506752656150974): magpie has too much in it. This is P0 of making magpie's parts plugins, as DeepSeek Harness does: a runtime, plugins.yml, and the first five built-in plugins the user can switch off. - internal/pluginrt: a registry (Register from init), a manifest (API caret range, Requires/Provides, Essential, InUse, Apply, Parts, Defaults) and Reconcile: the plugins no longer wanted, with whatever needs a service they provided, are disposed newest first; the wanted ones are applied once their services are there. A plugin that fails or panics is failed and the rest run. TestPluginsImportOnlyCore keeps the boundary: nothing outside plugins/ imports one, none imports another. - plugins.yml (appdir.Config()): default → preset (essentials | all) → the user's rows → in use. A new install is written Essentials, a magpie that ran here before (settings.RanBefore) All, so existing users keep everything. Writes are locked, whole and keep a .bak; a file that doesn't parse is an error, never empty, and is never written over. - plugins/groups, library, otel, sessions, warmups. In P0 a plugin off is the window's alone: its page, sections and rows (data-feature) leave the window; the gateway, TUI and CLI serve the same, nothing is deleted. One in use stays on. - The window: Plugins › Built-in, the first tab, a switch per plugin; GET/POST /api/plugins/builtin; boot.js says which are off before the first paint. CLI: magpie plugin builtin [on|off <id>], plugin preset, plugin dump [--json]. - docs/subsystems/plugin-runtime.md, gui-shell.md. Run: go test ./internal/pluginrt/ ./internal/settings/ ./internal/gui/; gofmt -l; go vet ./...; GOOS=linux go vet -tags nogui ./...; GOOS=windows go vet ./.... GUI: builtins.test.cjs in Chromium and WebKit, 5 languages, 1100/800/420; list-sort, mobile-web, routing-keys-fold, routing-sessions pass. By hand under a sandbox HOME: a new install gets essentials, an existing one all, a broken plugins.yml is refused and kept, dump works. Full suite results after the rebase are in the push notes. |
||
|
|
d9a050cc19 |
gui: Check for updates no longer calls every plugin up to date when some couldn't be checked, and names GitHub's rate limit on a plugin from GitHub (#1942, bingqilinweimaotai)
The summary read "Every plugin is up to date · 1 couldn't be checked" (所有插件都是最新的 · N 个无法检查), which contradicts itself: a plugin that couldn't be checked isn't known to be current. When any plugin couldn't be checked and none has an update, it now reads "No updates for the plugins checked · N couldn't be checked: …" (zh, zh-TW, ja, de added). A git plugin's reason now uses the check's new `limited` field (when the limit lifts, and whether a token was sent) through the rate-limit strings the Library already translates, instead of the raw error, so it says to add a GitHub token in Settings → Network and sharing, or that the token's own limit is used up. Run: new plugin-check-github-limit.test.cjs (en, zh, ja, de at 980 and 420, with and without a token) in Chromium and WebKit, 18/18; red with the old summary and with the raw error restored by hand. plugin-check-updates, plugin-git, i18n-keys, gui-ja, gui-de in Chromium and WebKit: green. |
||
|
|
e0a3b8c60a |
library, plugins: the RTK page and the Installed plugin list open without waiting on the package manager or the plugins' vendors (#1178)
The Library's RTK page took ~3.9s to open and the Plugins page's Installed list ~2.2s, every time. - Installed named each plugin's subscriptions from plugin.Providers, the whole providers RPC: each plugin in turn fetching its vendor's model list. The page uses only the names, which plugin.Cached keeps without starting the host (refreshed in the background when a sign-in or the plugins change). It now reads those: 2.2s to 13ms with seven plugins. A plugin added a moment ago has no names yet, so its row no longer claims it "signs in to nothing magpie can use" until the plugins have answered (plugin.Answered, the row's named). - ReadRTK waited up to 3s for GitHub and the package manager; winget show refreshes its sources and takes ~7.7s, so every open waited the full 3s and #1025's "waiting for winget" tag never came from it. GitHub stays on the first read; the package manager is asked in the background, its answer kept 6 hours as before. 3.9s to 1.6s. - ReadRTK and SetRTK detected the agents twice per call; once now. wizzy-yang's PR head 12342aa3, which conflicted with main: plugins.go keeps main's clash rows (plugin.Clashes) with the names from Cached, idName filled from Cached too; plugins.js keeps main's middleware/agent and clash branches ahead of the PR's named one; providers.go keeps main's Told and Settle beside the PR's Answered. Run: see the next commit. |
||
|
|
1eea68e0cd |
gui: Plugins' "Unofficial, on GitHub" has its kinds to pick and a field of its own to narrow it
The owner: 这里应该有分类以及搜索框方便用户筛选. The section lists every
repository tagged magpie-plugin, 31 on the dev instance today, as one
long grid, and the page's only search ("Search plugins and npm…") sits
at the top and also asks npm.
Once more than six repositories are tagged, the section's head has:
- its kinds as a segmented control (All · 31, Provider · 27,
Middleware · 3, Agent · 1): only kinds that have repositories, each
counting what the field leaves, and none when one kind is all there is;
- a field that narrows by name, author or description as it is typed,
with Escape to clear it;
- "No plugin on GitHub matches" with Show all when nothing is left.
Both narrow what the page's search has already found. Only the section
is drawn again as they change. The section, its field and the page's
body are made once and kept in the page, as the page's own field is
(#1055), so an answer that redraws the page while someone types (npm's)
keeps the field's focus and every key. Strings in zh, zh-TW, ja and de.
Run:
- plugin-github-filter.test.cjs (new), built on the dev instance's real
/api/plugins/github answer: chromium and webkit, en/zh/zh-TW/ja/de,
980px and 440px, 22/22. Putting back drawBody's replaceChildren turns
the field-keeps-its-focus check red.
- Every other plugin-* GUI test, plus i18n-keys and nav-sub-unroll, in
both engines: all green. plugin-github went 0/18 at first, because two
fields matched its `.pm-find input`; with the six-repository threshold
its four repositories show the plain grid, and it is 18/18.
- Looked at in dark WebKit at 1200px and light Chromium at 440px.
|
||
|
|
31c1e3ab1c |
gui: dates, times and numbers read in the GUI's language, not the system's, so a Chinese Mac set to English no longer shows Routing's days as 10月11日 周日 (#1843)
What changed: intlLang() was the GUI's tag for Intl, but returned
undefined for English ("the system's own formats"), and about 60 calls
in app.js, routing.js, library.js, plugins.js, caller-keys.js and
context.js formatted with no locale, [] or undefined anyway. All of
those follow the system's locale, so with magpie set to English on a
zh-CN Mac, Routing's day pills read "10月11日 周日" (the report), and so
did request times, reset/until titles on Accounts and Usage, plugin and
library dates, the restore notice, and key rest times. Now intlLang()
always returns a tag: zh-CN, zh-TW, ja-JP, de-DE for those languages,
and for English the system's own English (en-GB keeps day-month) or
plain "en" on a system in another language. Every date, time and number
formatting call in the assets takes intlLang(); the `intlLang() || "en"`
and `documentElement.lang || undefined` variants are folded into it.
<html lang> stays "en" for English. Routing's clock formatters, made
once, are made again when the language changes.
Tests: dates-gui-lang.test.cjs runs English on a zh-CN browser, English
on en-GB, and zh, zh-TW, ja, de on en-US, in Chromium and WebKit at
1100 and 390px: Routing's day pills (in the bar and under its menu) and
a request's time must read in the GUI's tag and not the browser's.
TestDatesFollowGUILanguage (Go, so CI runs it) fails on any formatting
call in the assets given no locale, [] or undefined.
github-token and reset-each-title computed their expected text in the
browser's locale, i.e. they encoded the bug for zh/ja/de; they now ask
intlLang().
Run: with routing.js put back to origin/main the new GUI test fails 10
of 12 (all but en-GB, where the system's English is right either way);
with intlLang() returning undefined for English the English cases fail.
TestDatesFollowGUILanguage fails on origin/main's routing.js (lines 244,
688, 1925, 2230, ...) and passes on the fix. gofmt -l clean; go vet
./internal/gui on darwin, GOOS=linux -tags nogui and GOOS=windows ok;
go test -tags nogui ./internal/gui ok. Full GUI suite (621 files,
concurrency 6): 51 failures in 21 files; rerun alone, the same 8 files
fail the same way on an origin/main
|
||
|
|
0738154520 |
plugin, gui: an installed plugin's row and page show its own magpie.icon, not its first provider's (#1775)
peterroe's plugin signs in to several providers. Each provider gets its own picture from the auth hook, and package.json's magpie.icon is the picture for the plugin itself. Settings → Plugins → Installed only took a plugin picture from the market listing. A plugin that isn't listed (installed from a path, git or an unlisted npm package) had none, so its row and its page showed its first provider's picture. - plugin.InstalledIcon reads magpie.icon from the installed package.json. It goes through the same ownIcon check as a listing's icon (data: or https only). - pluginsState stores the picture through provider.RepoIcons, as listed plugins' pictures are, and returns it as `icon` on each plugin entry. - plugins.js: the installed row and the detail page use the listing's icon, then the plugin's own, then its first provider's, as before. - Docs (en, zh, ja): magpie.icon is the plugin's picture (Discover card and Installed row) and the fallback for providers without their own. A plugin of several providers gives each provider auth.icon. Run: - go test ./internal/plugin ./internal/gui: ok. TestPluginsStateGivesThePluginsOwnIcon covers a data: icon (kept), no icon and a plain-http icon (both ""). - internal/gui/tests/plugin-own-icon.test.cjs: Chromium and WebKit, en, zh, zh-TW, ja, de, at 980 and 420 wide. It fails on the old plugins.js (the row shows pa.png). - The plugins GUI tests: 34/34 in each engine. - gofmt; go vet darwin, windows, and linux -tags nogui. - Full go test ./...: the only red is gateway OTel timing under load ~79. That's #1794, commented there; alone it passes 3/3. Not tried with peterroe's real package; the fixture follows the layout the issue describes. |
||
|
|
e9b16ca184 |
gui: a plugin's Update is a button the size of Install, in green, on its card, its row and Update all (#1587, timonwong)
timonwong saw a plugin update announced on Plugins but the button that
brings it hard to find: on a card it was a small chip among the meta
chips ("Update to v0.0.9"), on the Installed row a text link, and Update
all a text link in the footer.
- One updateButton() makes every plugin Update: .pm-act (Install's height,
min width, padding, font and corners) with .pm-up, green-soft with
green text, filled green on hover (the app's own tokens; no stripes).
Its title says the version (or the repo's newer commit for a git one),
and for a community package that magpie updates by itself within the
hour.
- A card's one button is Update in place of Signed in / Installed, as an
app store's Update takes Open's place, and the card's version reads
"v0.0.7 → v0.0.9" then. Sign in, not done yet, and Move keep their
place; the Installed row offers Update then. The plugin's page uses the
same button (actionFor).
- The Installed row's Update and the footer's Update all are the same
green button.
- The class is pm-up, not update: the title bar's app-update pill owns
.update (margin, height 22px), which the first try picked up.
Tests:
- new plugin-update-button.test.cjs: at 520px, Chromium and WebKit, en,
zh, zh-TW, ja, de: the card's Update, the row's Update and Update all
have Install's height, min width, padding, font, corners and margins,
are at least Install's width, have a colour that isn't Install's, fit in
the card, no sideways scroll. On the old plugins.js/css 7/7 fail; with
the class named update the margins check fails.
- plugin-card-update.test.cjs follows the chip to the card's button.
- every plugin*.test.cjs, both engines: 274/274. The
first run caught Update taking Sign in's place on the plugin's page
(plugin-market), fixed by the order above.
JS/CSS only; no Go changed.
|
||
|
|
7af45761f7 |
plugin, gui: a plugin from a git repository shows Update only when its repository has new commits (ARNO on Discord)
ARNO installed opencode-codearts-auth as github:yuweihao17/codearts. Its row
on Plugins always had an Update button, and still did right after updating
it to the newest commit. The page drew Update for every git plugin whatever
its commit, since npm has no version to compare for one, and nothing asked
the repository.
|
||
|
|
cc2092a4b0 |
plugin, gui: a market plugin's card wears the picture its package gives (magpie.icon from npm) when the market gives none
yetone: 这里的 agent plugin 为什么没有 logo. Aider's card in Discover › Agent showed the generic agent glyph: the registry entry has no icon, and the card only read the registry's, which is one of magpie's icon names. A GitHub-tagged plugin's card already read package.json's magpie.icon; a listed one didn't. - plugin: npm's /latest answer carries package.json, so NPM.Icon is its magpie.icon, an https URL or data:image URI only (ownIcon, now shared with the GitHub listing's check). - gui: listings, market and /api/plugins/npm keep that picture as an installed plugin's is (provider.RepoIcons) and send the page a file: icon, never the data URI or the remote URL. - plugins.js: card, plugin page and installed row use l.icon, then l.npm.icon. - Registry icons stay names, so older magpies aren't handed a URL they would draw as a broken mask. - docs: magpie.icon also shows on the Discover card (en, zh, ja). agent-aider 0.1.1 (magpie-community/plugins bcc94e5) gives aider.chat's icon as magpie.icon and agent.icon. Ran: - go test ./internal/plugin ./internal/gui; go test ./internal/provider alone (504s, pass); go test ./... otherwise ok. - gofmt -l; vet linux/windows ./internal/plugin. - internal/gui/tests/plugin*.test.cjs in chromium+webkit; plugin-agent's new check goes red (11 fail) with the card reading l.icon only. - Sandbox HOME with the real npm package 0.1.1: the Discover card, Installed row and Agents row all show Aider's icon, in chromium and webkit at 1100 and 420. |
||
|
|
cb406c8425 |
plugins: a plugin can add an agent magpie has no setup of its own for
Plugins could be subscription providers or gateway middleware. Now a third
kind: an agent plugin, so a user whose agent magpie doesn't ship can still
put it on magpie.
- internal/agentplug: a plugin's magpie.agent module (or a *.agent.js file)
exports agent = {id, name, config, format?, model, prefix?, bin?, dir?,
ua?, icon?, notice?} and an optional connect({gateway, model, models,
agent}) returning the other keys to write. Compiled in moejs, reloaded
when plugins.json or the file changes; why one didn't load is kept.
- internal/jsmod: module compiling (imports kept inside the plugin), moved
out of middleware so both share it.
- internal/agent/plugged.go: each becomes an Agent (Plugin set) after
magpie's own. JSON, YAML and env files are edited key by key, comments
kept; what each key held is stashed typed under plugin:<id>:<path>, and
its own model or Disconnect puts every key back. A built-in id is
refused; a connect that throws writes nothing. Key magpie-<id>; usage
names it by key or ua (usage.PluginAgents).
- GUI Plugins page: an Agent kind chip and glyph, a Discover "Agents"
section (market kind "agent"), and an installed row line "Adds X to
Agents" or why it didn't load. zh, zh-TW, ja, de strings.
- Docs: site Plugins page (en, zh, ja) "Agent plugins", reference.md,
agent-wiring.md, gateway-middleware.md.
Run:
- go test ./... (all ok); gofmt -l clean; GOOS=linux go vet -tags nogui
./... and GOOS=windows go vet ./... clean.
- TestPluggedYAML, TestPluggedJSONUnwire, TestPluggedRefused.
- GUI: plugin-agent.test.cjs 22/22 (en, zh, zh-TW, ja, de; 980 and 420;
chromium and webkit); all plugin-*.test.cjs, i18n-keys,
deprecated-subscriptions, filter-ime: 315 pass, 0 fail.
- Real use, in a sandbox HOME: an Aider plugin (~/.aider.conf.yml, prefix
openai/, connect writes openai-api-base/key) installed in a dev build;
picking DeepSeek V4.1 Flash on the Agents page wired the file keeping the
user's comment and keys; real aider 0.86.2 `--message` answered through
magpie from the real DeepSeek account; usage.jsonl recorded agent aider,
provider deepseek, 200; Disconnect restored the file byte for byte.
|
||
|
|
e5f04f38e8 |
plugin: a plugin on a pre-release whose release is out shows the update on its row, as the Plugins dot already did; versions are ordered as semver orders pre-releases, in Go and in the page
The Plugins dot comes from update.Newer, and the Installed rows (chip,
Update, Update all) from plugins.js's own newer(). They disagreed:
- newer() read only x.y.z, so 2.0.0-beta.1 with 2.0.0 out had the dot
and no row to update it from. Real case: opencode-antigravity-auth,
whose latest is 1.6.0 after 1.6.0-beta.0..2.
- update.Newer compared pre-releases as strings, so 1.0.0-beta.10 came
before 1.0.0-beta.9 (and 1.6.0-10 before 1.6.0-9): a missed update,
and the other way round, an "update" to an older beta.
- update.Newer didn't parse build metadata, so 1.0.1+build.1 was never
newer than anything.
Both now order as semver §11: no pre-release comes after any;
identifiers compared one by one, numbers as numbers, a number before a
word, and a shorter list before a longer one it starts. Build metadata
is ignored. A version that isn't x.y.z is never newer, as before.
Tests:
- internal/update TestNewer gains the pairs. On the old Newer 4 fail
(beta.10/beta.9 both ways, 1.6.0-10/-9, +build).
- internal/gui/tests/plugin-prerelease.test.cjs: seven installed
plugins, the dot's waiting list as update.Newer gives it, and each
row's chip and Update button, plus the Update all count, must match.
On the old plugins.js it fails at "v2.0.0 out" in both engines. No
strings change, so it's English only.
Reproduced in a sandbox HOME with the real package:
`magpie plugin add opencode-antigravity-auth@1.6.0-beta.2`, then Check
for updates. Before: /api/plugins/updates listed it, and the Plugins
nav had the dot, but the row had no chip and no Update, and there was no
Update all. After: the row shows "v1.6.0 out", Update, and Update all (1).
Update all then installed 1.6.0 and the waiting list emptied.
Run: gofmt; go vet -tags nogui for darwin, linux and windows on
internal/update, internal/plugin, internal/gui and the root package; go
test -tags nogui of the root package, internal/{gui,plugin,provider,
stats,update} under a temp HOME; GUI tests plugin-prerelease,
plugin-updates, plugin-card-update, plugin-check-updates, plugin-market,
plugin-release, plugin-git and plugin-local in Chromium and WebKit.
|
||
|
|
7d0e415e62 |
plugins: two plugins that sign in to one provider are both listed, each row says which serves it, and Use for picks the other (neiko on Discord)
neiko on Discord installed a third-party plugin beside a plugin of their
own, added by its folder. Only the third-party one could be seen. Both
plugins' auth hooks name the same provider id. The host's auths() keeps
the last plugin in plugins.json for an id, as OpenCode does, so the
user's own plugin silently lost it:
- its row read "Signs in to nothing magpie can use";
- its provider was gone from the Add sheet;
- keepUnloaded could list the id a second time, from the
plugin-providers.json kept before.
A package-name clash and a display-name clash were tried as well. Both
plugins stay visible in those cases, because a folder plugin's name is
its path.
What changed:
- host.js:
- init gives each loaded plugin the ids it signs in to (provides) and,
for each id another plugin serves, that plugin's spec (servedBy).
- auths() honours plugins.json's new prefer map (id -> spec).
- Only the serving plugin's provider.models hook runs for the id.
- plugin:
- Clashes() turns provides and servedBy into {id, by, with} per spec.
- Prefer() records a pick and restarts the host.
- Remove drops the removed plugin's picks.
- Re-adding a plugin under a new spec carries its picks over.
- remove, off, options and prefer find a plugin by its exact spec
before its package name (indexOf), so acting on one plugin never
reaches another of the same package.
- keepUnloaded no longer re-adds a provider from before when another
plugin serves its id now.
- GUI:
- /api/plugins rows carry clashes, with the provider's listed name.
- POST /api/plugins/prefer {spec, provider}.
- The serving row says "{other} signs in to {name} too; this one
serves it".
- The other row says, in amber, "{name} is served by {other}, which
signs in to it too", with a "Use for {name}" button.
- New strings in zh, zh-TW, ja and de.
- CLI: `magpie plugin` prints the same lines, with the command that
fixes it, and `magpie plugin use <name> <provider>` makes the pick.
- Docs: docs/subsystems/provider-plugins.md, docs/reference.md and
site/public/docs/{,zh/,ja/}plugins.html.
What was run:
- Reproduced under a sandbox HOME with magpie web on 3562: a fake npm
plugin and a folder plugin, both on id "acme".
- Old binary: the local row had providers [] and /api/providers
listed acme twice.
- New binary: both rows carry the clash; prefer moves acme to the
folder plugin; remove clears the pick and leaves the other plugin
serving acme.
- New Go tests:
- TestTwoPluginsOneProvider, a real Bun host: Prefer, restart,
off/on and Remove.
- TestClashes, TestPluginNamedExactlyFirst and
TestKeepUnloadedLeavesAServedID.
- TestPluginsClashRows (gui) and TestPluginListSaysClash (CLI).
- Each fails when its piece is broken by hand: prefer ignored in
host.js, the keepUnloaded id check removed, name before exact spec,
Remove keeping picks, no provides, no clashes in the rows, no
prefer route.
- plugin-clash.test.cjs, in Chromium and WebKit, in en, zh, zh-TW, ja
and de, at 1100 and 560px: 22/22 pass. It times out on the old
plugins.js.
- gui-de, gui-ja, gui-zh-tw, i18n-keys and every plugin-*.test.cjs:
248 tests.
- 245 passed in the 4-wide run.
- plugin-moved-signin (webkit) failed once in that run, then passed
3/3 alone and 26/26 in a smaller 4-wide rerun.
- gofmt -l; go vet ./...; GOOS=linux and GOOS=windows go vet -tags
nogui ./...; go build ./...
- The full go test -tags nogui ./... under a temp HOME with the caches
pinned: 44 packages ok, none failed.
- After rebasing onto
|
||
|
|
a3a8e25792 |
plugins: a repository tagged magpie-plugin shows the icon its package.json gives (yetone: 非官方的插件能否支持 icon)
magpie.icon, an https URL or a data:image URI, is read with the rest of package.json and kept through pluginOwnIcon as an installed plugin's is; the card shows it, else the puzzle piece. Ran: go test ./internal/plugin ./internal/gui ./internal/provider; the plugin GUI tests in Chromium and WebKit (en/zh/ja/de, 980 and 440). |
||
|
|
849faea3a3 |
plugins: a card's kind and Unofficial chips without fills, provider and middleware each their own hue (yetone)
Unofficial is a hairline with a small amber dot; what a plugin is reads as its glyph and word, periwinkle for a provider and teal for middleware, apart from the community badge's green. Ran: plugin-github, plugin-middleware and plugin-check-updates GUI tests in Chromium and WebKit (en/zh/ja/de, 980 and 440), light and dark looked at. |
||
|
|
07e246e515 |
gui: a key typed into the routing group filter, a provider's keys filter or the plugins search goes in once, through an IME too (#1055: 1, 2 → 1122)
Each filter drew its row again from its own input event, and the redraw took the focused field out of the page and put it back (the routing header's replaceChildren; the keys filter's whole renderProviders, which made a new field; the plugins page's draw, which made a new head). An IME committing while the field was out wrote its text twice. replaceKeeping (app.js) replaces a box's children but leaves a node already there in place. The routing header redraws around its filter, the keys filter redraws its list around the filter instead of the whole Providers page, and the plugins page keeps one head and one search field and redraws around them. Everything around each field is still drawn again, so a language switch, Select, and the counts follow as before. The cause was found by KuaaMU in #1056, which stopped the routing header being rebuilt while its shape was the same. That kept a language switch from reaching the header and left the two sibling filters; this carries over the diagnosis and fixes all three by not moving the field at all. Verified: internal/gui/tests/filter-ime.test.cjs types into each field through an IME in Chromium (CDP Input.imeSetComposition, then Input.insertText) and by key in WebKit, in en/zh/ja/de at 1100px and 440px: 48/48 pass. Against origin/main's assets 48/48 fail (routing: '1122', field out 4 times; keys and plugins: field taken out). Reverting only routing.js, only plugins.js, or only the keys filter's oninput fails exactly that field's 16 tests. Full GUI suite (both engines): 3326/3350; the 24 failures (codex-auto-reset, mobile-web, old-webkit, profile-confirm, purpose-filter, routing-failed-open, session-identity, text-size) fail the same on origin/main. go build -tags nogui and go test ./internal/gui pass. Co-authored-by: KuaaMU <KuaaMU@users.noreply.github.com> |