e4e9eb0928becfa4e48484dde85ef5032671d582
2
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
ec97a4d7bb |
plugins: a dependency no plugin needs no longer fails another's install
CHENGJIAHEGOXIS on X (v0.1.4178, Windows) couldn't install GoAnyAPI from Plugins: "agency-agents" failed with 从缓存复制到目标目录失败, and it was on no plugin's row, so nothing could remove it. Cause: every bun add/update/remove installs every dependency in plugins/package.json again, and a failed `bun add` writes its package there before exiting 1. agency-agents (a repository with no package.json) was left by such an add; on Windows a file of its copy in node_modules is held open, Bun fails "EBUSY: failed copying files from cache to destination for package agency-agents", and so every later install failed over a package nothing used. Fix (internal/plugin/leftover.go, store.go): - A package Bun says it couldn't install that no plugin is installed as (on the list, on or off, an add in flight, pi's agent) is taken out of package.json and node_modules and the command runs again: install() and runBun, so add, update, check and remove all get it. - A failed install puts back the dependencies and bun.lock it found. - An add whose own package went in while another listed plugin's failed succeeds; that plugin keeps its dependency. - Remove and add's clean-ups drop the dependency by hand when bun remove fails. - What is left from before is listed under Installed as "Not used by any plugin", each with a Remove (/api/plugins leftovers, POST /api/plugins/leftover; pmLeftovers in plugininstalled.js, imported when Plugins first draws), in every language. - plugins.json there and unreadable: nothing is a leftover. - Core script budget +51 for the one call left in plugins.js (reason in core_budget_test.go). Run: - mote-run: go vet ./..., GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet ./...: ok. go test ./internal/plugin (169s) and ./internal/provider (148s): ok. - mica-run go test -count=1 ./internal/gui with the leftovers drawing moved into plugininstalled.js: ok (133s); main since touches none of internal/gui's core scripts, internal/plugin or plugins.go. - win-run go test -run 'Leftover|FailedAdd|AnotherPlugin|RemoveTakes| BunFailed' ./internal/plugin on xiaomi-gpu: ok. - Reproduced the EBUSY with Bun 1.4.2 on xiaomi-gpu (a file in node_modules/agency-agents held open, then bun add another package). - Red on the old store.go: TestLeftoverDoesNotFailAnotherAdd, TestFailedAddLeavesNoDependency, TestAnotherPluginsFailureDoesNotFailAdd, TestRemoveTakesDependencyOutWhenBunFails. - GUI: plugin-leftover.test.cjs 42/42 (chromium + webkit, en zh zh-TW ja de, 980/420px, with and without a plugin); old plugins.js: 21/21 chromium red. - mote-run, rebased on |
||
|
|
65f745dd4c |
plugins: Installed is narrowed by Discover's kinds and origins
WJaunita45604 on X asked for the Installed tab to be filtered by Discover's categories, and by whether a plugin is official, with Discover's own categorisation. Installed now has the same strip and menu as Discover: - the kinds strip (All, Subscriptions, Middleware, Agents, Tools, Pages), each with how many are installed; - the Origin menu (magpie community, other authors, unofficial on GitHub), without Discover's "Not installed only". browseBar's strip and Origin button are split out (kindStrip, originButton) so both tabs draw the same component. The rest is in plugininstalled.js, imported when Plugins first draws, as plugingrid.js is (old-webkit lists it); until it is in, the list is drawn whole. What is left in the core is 674 bytes, within its budget's room. A plugin Discover lists is put where its card is (kindOf, srcOf). One it doesn't list (a folder, an unlisted npm package) is put by what it is: middleware or gateway, agent, tools only, a page, else a subscription; from GitHub, @magpie-community, else other authors. The strip shows only when two or more kinds are installed, and the menu only when two or more origins are. A pick that leaves nothing says "No plugin matches" with Show all. Installed keeps its pick across tabs and Discover keeps its own. The list head grows when it wraps (.pm-listhead.pm-bar), so a narrow row doesn't run under the list. There are no new strings, no native select (the app menu), and no left-border accents. New plugin-installed-filter.test.cjs: seven installed plugins of every kind and origin, two of them GitHub repos from fixtures/plugins-github-31. It runs in every language, both engines, at 1100px and 420px. Run (on mote, Playwright 1.62.0, chromium + webkit): the new test, 20 of 20. Red on origin/main |