Skip to content

A local-first multi-agent app development platform, built on PenguinHarness

feat(plugins): 插件市场的货架也列出发布到 npm 的插件

lmliheng06681fd70797
diff --git a/changelog/unreleased/2026-11-01-plugin-market-reads-npm.md b/changelog/unreleased/2026-11-01-plugin-market-reads-npm.md
new file mode 100644
index 00000000..b20bd235
--- /dev/null
+++ b/changelog/unreleased/2026-11-01-plugin-market-reads-npm.md
@@ -0,0 +1,56 @@
+# The plugin market lists the plugins published to npm, not only the ones this build carries
+
+- **Date:** 2026-11-01
+- **Type:** feature
+- **Scope:** `server`, `web`, `plugins`, `docs`
+- **Breaking:** no
+
+[中文](2026-11-01-plugin-market-reads-npm.zh.md)
+
+Until now the shelf was whatever a build carried: a plugin reached the market only by being added to
+the repository and shipped with a release. A plugin `@adelie/gpu-model-serving` had to be collected
+into the build for that reason alone. The shelf now has a second side that is read from npm, so a
+package reaches it with its next version.
+
+The rule is the package's own declaration: a package scoped `@adelie/` and carrying the
+`adelie-plugin` keyword is on the shelf. The scope is what makes the keyword safe to read — anyone
+may publish a package with a keyword, nobody outside the project can publish under that scope.
+Every plugin package in `plugins/` now carries the keyword (the four `sandbox-*` ones stay out:
+they are `private` and never reach npm), so a release is all it takes for them to appear there too.
+
+What a published entry offers is one action, **Add to the library** — the npm import an operator
+would otherwise type into the download dialog themselves, an admin's action like every other write
+into the plugin directory. Once it lands, the plugin is like any other: install it on an agent to
+put it to work. An entry this build already carries is the build's own, with the version installed
+here; the published side is for plugins that got to npm without a release.
+
+## Details
+
+- `packages/server/src/plugin/registry.ts`: `npmPluginRegistry` reads npm's search API
+ (`keywords:adelie-plugin`, restricted to the `@adelie/` scope) and maps each result to a shelf
+ entry — name, version, description, authors, license, the package's npm page as `homepage`, its
+ repository with npm's `git+`/`.git` stripped, keywords and publish date. A result the registry
+ described incompletely is left out rather than shown as a nameless row. One listing serves every
+ caller and is cached for ten minutes (two after a failure, which serves the previous one); a
+ readme is the package's own, read from its packument, cached per name including the miss.
+- `packages/server/src/http/routes/plugins.ts`: the registry routes now assemble the shelf from two
+ sources — what the build carries first, then the published side — deduplicated by name, with the
+ readme taken from the first source that has one.
+- `packages/web/src/features/plugins/plugins-page.tsx`: a row per published entry that neither the
+ build nor the library holds, filed under **Available** whatever agent the page is working with,
+ its verb **Add to the library**. A 409 opens the same overwrite confirmation the import dialog
+ raises, and the answer re-sends the request with `overwrite`.
+- `ADELIE_PLUGIN_MARKET=off` turns the outbound lookup off, leaving the shelf local — what an
+ offline or closed network wants. The server's automatic outbound calls are now two: the update
+ check and this one.
+- `plugins/*/package.json`: sixteen public plugin packages gain the keyword (eight already had it).
+- `packages/docs/content/skills.{zh,en}.md` and `configuration.{zh,en}.md`: the second side of the
+ shelf, what an entry on it offers, and the new variable.
+
+## Compatibility
+
+- No interface changed: the registry response and the shelf UI gained rows, not fields.
+- A deployment with no route to npm sees what it saw before — the library, the plugin directory and
+ the plugins this build carries. The lookup never fails a page load.
+- The keyword arrives on npm with each package's next release; until then those packages are still
+ on the shelf whenever a build carries them.
diff --git a/changelog/unreleased/2026-11-01-plugin-market-reads-npm.zh.md b/changelog/unreleased/2026-11-01-plugin-market-reads-npm.zh.md
new file mode 100644
index 00000000..a95bbf6e
--- /dev/null
+++ b/changelog/unreleased/2026-11-01-plugin-market-reads-npm.zh.md
@@ -0,0 +1,48 @@
+# 插件市场的货架不再只列随构建发布的插件,也列出发布到 npm 的插件
+
+- **Date:** 2026-11-01
+- **Type:** feature
+- **Scope:** `server`, `web`, `plugins`, `docs`
+- **Breaking:** no
+
+[English](2026-11-01-plugin-market-reads-npm.md)
+
+此前货架就是「这次构建带了什么」:插件要进市场,只能先进仓库、再随一次版本发出去。仅为了这一
+条,`@adelie/gpu-model-serving` 也得先收进构建里。现在货架多了一侧,直接读自 npm,包的下一个版本
+就会出现在上面。
+
+规则写在包自己身上:作用域是 `@adelie/`、并带 `adelie-plugin` 关键词的包,就在货架上。作用域限制
+了关键词的风险——关键词谁都能写,但项目之外的人发布不到这个作用域下。`plugins/` 里每个插件包现在
+都带这个关键词(四个 `sandbox-*` 不带:它们是 `private` 的,根本到不了 npm),所以它们下一次发布
+就会跟着出现。
+
+npm 那一侧只有一条目时,唯一的动作是**装入插件库**——就是把运维本来要手工敲进下载对话框的 npm
+导入搬到这一行上,管理员操作,和写插件目录的其他动作一样。装进来以后它就与别的插件无异:装到
+Agent 上才算用上。本次构建已经带的条目仍旧取本地那一份,版本也是本机装的那个;npm 那一侧是为
+「没有随发布进构建、但已经发布到 npm」的插件准备的。
+
+## 细节
+
+- `packages/server/src/plugin/registry.ts`:`npmPluginRegistry` 读 npm 的搜索接口
+ (`keywords:adelie-plugin`,并限定 `@adelie/` 作用域),把每条结果映射成货架条目——名称、版本、
+ 简介、作者、许可证、把包的 npm 页面作为 `homepage`、仓库地址(去掉 npm 给的 `git+` 前缀与 `.git`
+ 后缀)、关键词与发布日期。缺字段、描述不全的结果宁可不列,也不摆一条没有名字的行。一次查询服务
+ 所有调用方,缓存十分钟(失败缓存两分钟并沿用上一次的结果);说明文档读包自己的 packument,按名
+ 缓存,未命中同样缓存。
+- `packages/server/src/http/routes/plugins.ts`:注册表路由现在由两个来源拼出整张货架——先本地构建
+ 带的,再 npm 那一侧——按名去重,说明文档取第一个有内容的那份。
+- `packages/web/src/features/plugins/plugins-page.tsx`:构建与插件库都没有的发布条目各占一行,无条件
+ 归入**可安装**,按钮是**装入插件库**。遇到 409 时弹出与导入对话框同一份覆盖确认,确认后带
+ `overwrite` 重发。
+- `ADELIE_PLUGIN_MARKET=off` 关掉这一次对外查询,货架只剩本地那一侧,断网或封闭环境应当如此。服务
+ 器自动发起的对外请求现在是两个:新版本检查,以及这一条。
+- `plugins/*/package.json`:十六个公开发布的插件包补上这个关键词(已有八个)。
+- `packages/docs/content/skills.{zh,en}.md` 与 `configuration.{zh,en}.md`:货架的另一侧、那一侧的
+ 条目能做什么,以及新增的环境变量。
+
+## 兼容
+
+- 接口一个都没动:注册表响应与货架界面是多了一些行,不是多了字段。
+- 到不了 npm 的部署看到的和以前一样——插件库、插件目录,以及本次构建自带的插件。这一次查询永远不
+ 会让页面加载失败。
+- 关键词要等各包下一次发布才生效;在那之前,只要某个构建带了它们,它们仍在货架上。
diff --git a/packages/docs/content/configuration.en.md b/packages/docs/content/configuration.en.md
index 584ec71d..0e23bd1a 100644
--- a/packages/docs/content/configuration.en.md
+++ b/packages/docs/content/configuration.en.md
@@ -23,6 +23,7 @@ The CLI and the server load a `.env` file from the working directory on startup.
| `ADELIE_SEED_ADMIN_PASSWORD` | Fixed initial password for the seeded built-in admin (automated tests / e2e) | Unset: a random password is generated |
| `ADELIE_LANG` | CLI language (`en` / `zh`), set with `penguin config lang` | `en` |
| `ADELIE_UPDATE_CHECK` | `off` disables the Web App's new-release check | Enabled |
+| `ADELIE_PLUGIN_MARKET` | `off` lists only the plugins this build carries in the plugin market, never querying npm | Enabled |
| `PENGUIN_NO_LOGIN_SHELL_ENV` | Any non-empty value stops the desktop app from importing the login shell's environment on macOS/Linux GUI launches | Unset: the import runs |
| `ADELIE_SHELL` | The shell that runs agent commands (an executable name or path) | Unset: picked automatically, see [Tools & Approval](/tools#command-sessions) |
| `ADELIE_CLI_ENTRY` | The CLI entry script this installation offers the agents it runs (see [PATH launcher](#path-launcher)) | Set by `penguin server` / `penguin web` and by the desktop app |
@@ -35,6 +36,7 @@ Notes:
- `PENGUIN_GO_ORIGIN`: server configuration, not an endpoint the browser can name. It must be a bare HTTPS origin; plain HTTP is accepted only for `localhost`, `127.0.0.1` and `[::1]`, for integration environments. A path, credentials, a query string or a fragment is rejected at startup. See [Connect an account](/models#connect-an-account).
- `MODELSCOPE_BRIDGE_URL`: server configuration like `PENGUIN_GO_ORIGIN`, not an endpoint the browser can name. It must be an HTTPS address with no credentials, query string or fragment. Unlike `PENGUIN_GO_ORIGIN`, a path prefix **is** allowed, because the production bridge lives under `https://go.penguin.ooo/modelscope`. See [Connect an account](/models#connect-an-account).
- `ADELIE_UPDATE_CHECK`: `off` turns off the automatic release check, nothing else. Model requests, an enabled remote-control connection, provider key authorization and the proxy test still reach the network.
+- `ADELIE_PLUGIN_MARKET`: the market's shelf has two sides — the plugins this build carries (read locally, no network) and the ones published to npm. For the second the server queries npm's search API once, caching the result for ten minutes (for two minutes after a failure, serving the previous listing). With `off` that side is never queried and the shelf is the local one alone, which is what an offline or closed network wants. See [Plugins](/skills).
- `PENGUIN_NO_LOGIN_SHELL_ENV`: without it, the import fills only variables the launch left unset. See [Desktop quickstart](/quickstart-desktop).
- `ADELIE_CLI_ENTRY`: when the server was started from a source checkout, it falls back to that checkout's `packages/cli/dist/penguin.js`.
diff --git a/packages/docs/content/configuration.zh.md b/packages/docs/content/configuration.zh.md
index 7f888e16..a1e41136 100644
--- a/packages/docs/content/configuration.zh.md
+++ b/packages/docs/content/configuration.zh.md
@@ -23,6 +23,7 @@ CLI 和服务器启动时会从工作目录加载 `.env` 文件。
| `ADELIE_SEED_ADMIN_PASSWORD` | 预置内置管理员的固定初始密码(自动化测试 / e2e) | 未设置:生成随机密码 |
| `ADELIE_LANG` | CLI 语言(`en` / `zh`),用 `penguin config lang` 设置 | `en` |
| `ADELIE_UPDATE_CHECK` | 设为 `off` 时关闭 Web App 的新版本检查 | 启用 |
+| `ADELIE_PLUGIN_MARKET` | 设为 `off` 时插件市场只列出本次构建自带的插件,不查询 npm | 启用 |
| `PENGUIN_NO_LOGIN_SHELL_ENV` | 设为任意非空值后,桌面应用在 macOS/Linux 上从图形界面启动时不再导入登录 shell 的环境变量 | 未设置:照常导入 |
| `ADELIE_SHELL` | 运行 Agent 命令的 shell(可执行文件名或路径) | 未设置:自动选择,见[工具与审批](/tools#命令会话) |
| `ADELIE_CLI_ENTRY` | 本安装提供给所运行 Agent 的 CLI 入口脚本(见 [PATH 启动脚本](#path-启动脚本)) | 由 `penguin server` / `penguin web` 和桌面应用设置 |
@@ -35,6 +36,7 @@ CLI 和服务器启动时会从工作目录加载 `.env` 文件。
- `PENGUIN_GO_ORIGIN`:它是服务端配置,不接受浏览器指定的端点。取值必须是不带路径的 HTTPS 源;只有 `localhost`、`127.0.0.1` 和 `[::1]` 这类集成环境可以用明文 HTTP。带路径、凭据、查询参数或 fragment 的取值会在启动时被拒绝。见[连接账户](/models#连接账户)。
- `MODELSCOPE_BRIDGE_URL`:与 `PENGUIN_GO_ORIGIN` 一样是服务端配置,不接受浏览器指定的端点。它必须是不带凭据、查询参数或 fragment 的 HTTPS 地址。不同之处是**它允许带路径前缀**,因为生产环境的中转层就挂在 `https://go.penguin.ooo/modelscope` 下。见[连接账户](/models#连接账户)。
- `ADELIE_UPDATE_CHECK`:设为 `off` 只关闭自动的版本检查,不影响其他对外请求:模型请求、已启用的远程控制连接、Key 授权和代理测试照常联网。
+- `ADELIE_PLUGIN_MARKET`:插件市场的货架有两侧,一侧是本次构建自带的插件(本地读,不联网),另一侧是发布到 npm 的插件。服务器为此查一次 npm 的搜索接口,结果缓存十分钟(失败时缓存两分钟并沿用上一次的结果)。设为 `off` 后这一侧完全不查,货架只剩本地那一侧——断网或封闭环境里应当如此。见[插件](/skills)。
- `PENGUIN_NO_LOGIN_SHELL_ENV`:不设置时,导入只填补启动过程没有设置的变量。见[桌面应用快速开始](/quickstart-desktop)。
- `ADELIE_CLI_ENTRY`:服务器从源码检出启动时,会回退到检出目录中的 `packages/cli/dist/penguin.js`。
diff --git a/packages/docs/content/skills.en.md b/packages/docs/content/skills.en.md
index ad537619..d78a6eb5 100644
--- a/packages/docs/content/skills.en.md
+++ b/packages/docs/content/skills.en.md
@@ -17,7 +17,7 @@ A **Skill** is a set of reusable instructions that an agent reads when a task ca
## Browse plugins
1. In the sidebar, select **Plugins**.
-2. Browse the lists. **Installed plugins** comes first and starts folded; select its header to unfold it. It holds the plugin library, followed by the server plugins the current Project asks for. **Available** lists the server plugins the Project can still add.
+2. Browse the lists. **Installed plugins** comes first and starts folded; select its header to unfold it. It holds the plugin library, followed by the server plugins the current Project asks for. **Available** lists the server plugins the Project can still add, plus the plugins published to npm that this build does not carry (their row's button is **Add to the library**).
3. To narrow the lists, type in the search box, or pick options in the filter column beside them: **Categories**, **Contains** and **Status**. **Clear filters** clears the picks and the search box. Both lists unfold while a search or filter is active.
4. Select a library plugin's card to open its details.
@@ -169,6 +169,8 @@ A server plugin extends the server itself rather than an agent: it is an npm pac
On the **Plugins** page, a server plugin's row shows its package name, description, version and status, with tags for its categories, **built in** when it ships with Adelie, and its keywords. Select a row to open the plugin's page, with its license, authors, links and documentation. The shelf is complete: the four sandbox backends are hand-written entries, and every plugin package this build carries has one of its own (the library's skills/hooks packages included), with version, description, license, category and keywords read from the package itself. Only a plugin imported on this machine has no entry, and therefore no page.
+The shelf has a second side: **the plugins published to npm**. A package scoped `@adelie/` that carries the `adelie-plugin` keyword appears on the shelf with its next version — no release of Adelie required. The server queries npm for that side (the listing is cached for ten minutes, or two after a failure, in which case the previous one is served; `ADELIE_PLUGIN_MARKET=off` stops the query altogether — see [Configuration](/configuration)). A plugin this build already carries does not gain a second row: the local copy wins for a shared name, because that is the one installed. An entry only the npm side has offers one action, **Add to the library**: it fetches the package into this machine's plugin directory, after which it is like any other plugin and installing it on an agent is what puts it to work. That step is an admin's, and it is the same path as **Download from a URL or npm** in the page header.
+
To add a server plugin to the current Project:
1. Under **Available**, select **Install** on the plugin's row.
diff --git a/packages/docs/content/skills.zh.md b/packages/docs/content/skills.zh.md
index 2f433b90..a998e0d8 100644
--- a/packages/docs/content/skills.zh.md
+++ b/packages/docs/content/skills.zh.md
@@ -17,7 +17,7 @@ description: 浏览插件,为 Agent 安装 Skill 和钩子包,为 Project
## 浏览插件
1. 在侧边栏选择**插件市场**。
-2. 浏览列表。**已安装的插件**排在最前,默认折叠,点击标题即可展开。其中先是插件库,然后是当前 Project 要求的服务端插件。**可安装**列出 Project 还可以添加的服务端插件。
+2. 浏览列表。**已安装的插件**排在最前,默认折叠,点击标题即可展开。其中先是插件库,然后是当前 Project 要求的服务端插件。**可安装**列出 Project 还可以添加的服务端插件,以及发布到 npm、本次构建还没带的插件(后者那一行的按钮是**装入插件库**)。
3. 要缩小范围,可以在搜索框中输入,或在列表旁的筛选栏中勾选选项:**分类**、**包含**和**状态**。**清除筛选**会清空已选的选项和搜索框。有搜索词或筛选条件时,两个列表都会展开。
4. 点击插件库插件的卡片打开详情。
@@ -169,6 +169,8 @@ zip 文件最大 14 MB,最多 200 个文件;解压后单个文件不超过 5
在**插件市场**页面上,服务端插件的一行显示包名、描述、版本和状态,标签标出它的分类、随 Adelie 发布时的**内置**,以及关键词。点击这一行打开插件页面,查看许可证、作者、链接和说明文档。市场里条目齐全:四个沙箱后端是手写的条目,此外本次构建自带的每个插件包各有一条(插件库里的技能/钩子包也算),版本、简介、许可证、分类和关键词都读自包本身。只有本机导入的插件没有条目,也就没有页面。
+货架还有另一侧:**发布到 npm 的插件**。包的作用域是 `@adelie/`,并且带 `adelie-plugin` 这个关键词,它的下一个版本就会出现在货架上,不必等一次产品发布。这一侧由服务器向 npm 查询(结果缓存十分钟,失败时缓存两分钟并沿用上一次的结果;把 `ADELIE_PLUGIN_MARKET` 设为 `off` 则完全不查,见[配置](/configuration))。本次构建已经带了的插件不会因此多出一行:同名时取本地那一份,因为装的就是它。点开只有 npm 那一侧才有的条目,唯一的动作是**装入插件库**:把包取到本机的插件目录,成功后它就和别的插件一样,装到 Agent 上即可使用。这一步是管理员操作,和页头的**从地址或 npm 下载**是同一条路径。
+
为当前 Project 添加服务端插件:
1. 在**可安装**下,点击插件那一行的**安装**。
diff --git a/packages/server/src/http/routes/plugins.ts b/packages/server/src/http/routes/plugins.ts
index f1613872..07e74479 100644
--- a/packages/server/src/http/routes/plugins.ts
+++ b/packages/server/src/http/routes/plugins.ts
@@ -52,6 +52,7 @@ import type {
PluginDirectoryResponse,
PluginFilesResponse,
PluginImportResponse,
+ PluginIndexEntry,
PluginIndexResponse,
PluginLibraryResponse,
PluginReadmeResponse,
@@ -64,7 +65,12 @@ import type { Access } from "../../mechanisms/projects.js";
import type { Sessions as ManagerIface } from "../../runtime/session-manager.js";
import { Bind, Component, Use } from "@adelie/core/kernel";
import { agentHooksRoutes } from "./hooks.js";
-import { builtinPluginRegistry, shippedPluginNames } from "../../plugin/registry.js";
+import {
+ builtinPluginRegistry,
+ configuredPluginMarket,
+ shippedPluginNames,
+} from "../../plugin/registry.js";
+import type { PluginRegistry } from "../../plugin/registry.js";
import { pluginBases } from "../../plugin/loader.js";
import type { PluginBase } from "../../plugin/loader.js";
@@ -527,16 +533,34 @@ export class PluginRoutes {
export function pluginRegistryRoutes(
bases: () => readonly PluginBase[],
root: () => string,
+ /** The published side of the shelf, or null when this deployment lists only what it carries. */
+ published: PluginRegistry | null = null,
): Hono<AppEnv> {
const app = new Hono<AppEnv>();
- const registry = builtinPluginRegistry({
+ const builtin = builtinPluginRegistry({
bases,
// The shelf is what this build ships: read per call, because a push moves both the
// assets prefix the bases name and the library a deployment carries.
shipped: () => shippedPluginNames(root(), bases()),
});
+ // The sources, in precedence order: what this build carries first, then the published side.
+ // A package both of them list is ONE entry — the build's, whose version is the one installed
+ // here — so a plugin that ships needs no entry written for it on the published side.
+ const sources: readonly PluginRegistry[] = published === null ? [builtin] : [builtin, published];
+ const index = async (): Promise<PluginIndexEntry[]> => {
+ const seen = new Set<string>();
+ const entries: PluginIndexEntry[] = [];
+ for (const source of sources) {
+ for (const entry of await source.index()) {
+ if (seen.has(entry.name)) continue;
+ seen.add(entry.name);
+ entries.push(entry);
+ }
+ }
+ return entries;
+ };
app.get("/", async (c) => {
- const body: PluginIndexResponse = { plugins: await registry.index() };
+ const body: PluginIndexResponse = { plugins: await index() };
return c.json(body);
});
app.get("/readme", async (c) => {
@@ -546,11 +570,18 @@ export function pluginRegistryRoutes(
}
// Only entries this deployment actually lists: the readme map is keyed by specifier,
// and answering for an unlisted name would make the endpoint a probe of what exists.
- const listed = (await registry.index()).some((e) => e.name === name);
+ const listed = (await index()).some((e) => e.name === name);
if (!listed) {
return c.json({ error: { code: "not_found", message: "no such plugin" } }, 404);
}
- const body: PluginReadmeResponse = { name, readme: await registry.readme(name) };
+ // The first source that has one: a shipped package's README is the copy on this machine,
+ // and only a package this build does not carry falls through to the published one.
+ let readme: string | null = null;
+ for (const source of sources) {
+ readme = await source.readme(name);
+ if (readme !== null) break;
+ }
+ const body: PluginReadmeResponse = { name, readme };
return c.json(body);
});
return app;
@@ -561,6 +592,12 @@ export function pluginRegistryRoutes(
* nested under /api/plugins/registry so both views answer under one prefix. The specifier
* is a query parameter on `readme`, not a path segment, because it is scoped
* (`@scope/name`) and would otherwise have to survive two rounds of slash encoding.
+ *
+ * The shelf has two sides and only one of them is local: what this build carries, and what the
+ * project has published (`npmPluginRegistry`). The published side is the server's second
+ * automatic outbound call — the update check's is the first — and follows the same rules: one
+ * cached lookup, a bounded timeout, never an error the page has to handle, and a switch
+ * (`ADELIE_PLUGIN_MARKET=off`) for a deployment that must not dial out at all.
*/
@Component({
contributes: {
@@ -577,12 +614,15 @@ export function pluginRegistryRoutes(
export class PluginRegistryRoutes {
@Use() private readonly config!: Config;
@Use() private readonly hmr!: Hmr;
+ /** Environment to read ADELIE_PLUGIN_MARKET from; a test wires its own. */
+ private env: Record<string, string | undefined> = process.env;
@Bind("PluginRegistryRoutes.routes") routes!: Hono<AppEnv>;
setup() {
// Read per request: a push moves the shipped prefix to a new assets directory.
this.routes = pluginRegistryRoutes(
() => pluginBases(this.config.root, this.hmr.assetsDir()),
() => this.config.root,
+ configuredPluginMarket(this.env),
);
}
}
diff --git a/packages/server/src/plugin/registry.ts b/packages/server/src/plugin/registry.ts
index 4ae02196..3efcc703 100644
--- a/packages/server/src/plugin/registry.ts
+++ b/packages/server/src/plugin/registry.ts
@@ -292,3 +292,241 @@ export function httpPluginRegistry(
readme: () => Promise.resolve(null),
};
}
+
+// ---------------------------------------------------------------------------
+// The published side of the shelf
+// ---------------------------------------------------------------------------
+
+/** The npm registry this reads: npm's own, the same constant services/plugin-download.ts names. */
+const NPM_REGISTRY = "https://registry.npmjs.org";
+
+/**
+ * The keyword a plugin package publishes itself under. It is how the market finds a plugin
+ * that is NOT part of a build — a package the repository never carried, or one an older build
+ * predates — without anyone curating a list: publish `@adelie/<name>` with this keyword and its
+ * next version appears on the shelf.
+ */
+export const PLUGIN_KEYWORD = "adelie-plugin";
+
+/**
+ * The scopes the market lists from npm. One entry today: Adelie's own packages, which is what
+ * makes the keyword safe to read — a keyword alone would let anyone put their package in front
+ * of every user's Install button, while nobody outside the project can publish under this scope.
+ * Widening this list is the deliberate act of letting another publisher onto the shelf.
+ */
+const MARKET_SCOPES: readonly string[] = ["@adelie/"];
+
+/** How long a successful listing of the published side is reused. */
+export const NPM_LIST_TTL_MS = 10 * 60 * 1000;
+/** How long a failed listing is reused (short: a transient failure should heal on its own). */
+export const NPM_LIST_FAILURE_TTL_MS = 2 * 60 * 1000;
+/** How long one npm request may take. Bounded so an unreachable registry cannot pin a page load. */
+const NPM_TIMEOUT_MS = 10_000;
+
+/** What the npm registry reads through; a test stands in a canned fetch and a clock. */
+export interface NpmRegistryOptions {
+ fetchImpl?: typeof fetch;
+ timeoutMs?: number;
+ /** How long a successful listing is served from cache. */
+ ttlMs?: number;
+ /** How long a failed listing is served from cache. */
+ failureTtlMs?: number;
+ now?: () => number;
+}
+
+/** The npm search document's package object, as much of it as the index entry needs. */
+interface NpmSearchPackage {
+ name?: unknown;
+ version?: unknown;
+ description?: unknown;
+ license?: unknown;
+ keywords?: unknown;
+ date?: unknown;
+ publisher?: { username?: unknown };
+ author?: { name?: unknown };
+ maintainers?: Array<{ username?: unknown }>;
+ links?: { npm?: unknown; repository?: unknown };
+}
+
+function isNonEmptyString(value: unknown): value is string {
+ return typeof value === "string" && value !== "";
+}
+
+function stringArray(value: unknown): string[] {
+ return Array.isArray(value) ? value.filter(isNonEmptyString) : [];
+}
+
+/**
+ * A repository link the registry hands out, turned into a page a reader can open: npm writes
+ * `git+https://…/x.git`, and the `git+` prefix and the `.git` tail are both for `git clone`,
+ * not for a browser. Anything that is not http(s) after that is dropped — the index's links
+ * are rendered as links, so a `git://` or a bare path would be a dead one.
+ */
+function browsableRepository(raw: unknown): string | undefined {
+ if (typeof raw !== "string") return undefined;
+ let value = raw.trim();
+ if (value.startsWith("git+")) value = value.slice(4);
+ if (value.endsWith(".git")) value = value.slice(0, -4);
+ try {
+ const url = new URL(value);
+ return url.protocol === "http:" || url.protocol === "https:" ? url.toString() : undefined;
+ } catch {
+ return undefined;
+ }
+}
+
+/**
+ * One search result as an index entry, or null when this package cannot be described by one.
+ *
+ * Every field the entry needs must come from the package: an entry invented around a package
+ * the registry described incompletely would put a nameless or licenseless row in front of the
+ * reader, which is worse than leaving the package off (the same call the built-in registry's
+ * own reader makes). `homepage` is the package's npm page — the one address the registry knows
+ * is a page — and no `categories` are set: a category is the plugin's own (`plugin.json`), which
+ * lives in the tarball, not in a search result.
+ */
+function searchEntry(raw: unknown): PluginIndexEntry | null {
+ if (typeof raw !== "object" || raw === null) return null;
+ const { package: pkg } = raw as { package?: unknown };
+ if (typeof pkg !== "object" || pkg === null) return null;
+ const p = pkg as NpmSearchPackage;
+ const { name, version, description, license } = p;
+ if (
+ !isNonEmptyString(name) ||
+ !isNonEmptyString(version) ||
+ !isNonEmptyString(description) ||
+ !isNonEmptyString(license)
+ ) {
+ return null;
+ }
+ if (!MARKET_SCOPES.some((scope) => name.startsWith(scope))) return null;
+ const authors = [
+ ...new Set(
+ [
+ p.publisher?.username,
+ p.author?.name,
+ ...(p.maintainers ?? []).map((m) => m?.username),
+ ].filter(isNonEmptyString),
+ ),
+ ];
+ if (authors.length === 0) return null;
+ const keywords = stringArray(p.keywords);
+ const date = typeof p.date === "string" ? Date.parse(p.date) : Number.NaN;
+ const repository = browsableRepository(p.links?.repository);
+ const homepage = typeof p.links?.npm === "string" ? p.links.npm : undefined;
+ return {
+ name,
+ version,
+ description,
+ authors,
+ license,
+ ...(repository === undefined ? {} : { repository }),
+ ...(homepage === undefined ? {} : { homepage }),
+ ...(keywords.length === 0 ? {} : { keywords }),
+ ...(Number.isFinite(date) ? { updatedAt: Math.floor(date / 1000) } : {}),
+ };
+}
+
+/**
+ * The published side of the market: `@adelie` packages that carry the plugin keyword, read from
+ * npm's search API. This is what lets a plugin reach the shelf without a release — the built-in
+ * registry can only describe what a build carries.
+ *
+ * Strictly fail-soft, like the update check: `index()` never throws. A failed lookup answers
+ * with whatever the last successful one found (nothing, the first time) and is retried after a
+ * short TTL, because a plugin page that cannot reach npm must still show the library. One
+ * listing is shared by every caller and served from cache between lookups, so opening the page
+ * repeatedly is one request per TTL.
+ *
+ * `readme` reads the package's own README from its packument — the file the package publishes,
+ * the same one the built-in side reads from a local copy — and caches per name, including a
+ * miss. It is a second request, made only when somebody opens an entry.
+ */
+export function npmPluginRegistry(options: NpmRegistryOptions = {}): PluginRegistry {
+ const {
+ fetchImpl = fetch,
+ timeoutMs = NPM_TIMEOUT_MS,
+ ttlMs = NPM_LIST_TTL_MS,
+ failureTtlMs = NPM_LIST_FAILURE_TTL_MS,
+ now = Date.now,
+ } = options;
+ const listing = `${NPM_REGISTRY}/-/v1/search?text=${encodeURIComponent(`keywords:${PLUGIN_KEYWORD}`)}&size=250`;
+ let cached: { entries: PluginIndexEntry[]; expiresAt: number } | null = null;
+ let inflight: Promise<PluginIndexEntry[]> | null = null;
+ const readmes = new Map<string, string | null>();
+
+ const search = async (): Promise<PluginIndexEntry[]> => {
+ const res = await fetchImpl(listing, {
+ headers: { accept: "application/json", "user-agent": "adelie-server" },
+ signal: AbortSignal.timeout(timeoutMs),
+ });
+ if (!res.ok) throw new Error(`npm search answered HTTP ${res.status}`);
+ const body = (await res.json()) as { objects?: unknown };
+ const objects = Array.isArray(body.objects) ? body.objects : [];
+ return objects.map(searchEntry).filter((e): e is PluginIndexEntry => e !== null);
+ };
+
+ return {
+ source: "npm",
+ index: async () => {
+ if (cached !== null && now() < cached.expiresAt) return cached.entries;
+ inflight ??= search().then(
+ (entries) => {
+ cached = { entries, expiresAt: now() + ttlMs };
+ return entries;
+ },
+ (err: unknown) => {
+ // The stale listing is better than an empty shelf; with none, the page simply shows
+ // the library. One line, not a thrown error: this runs on a page load.
+ console.warn(
+ `plugin market: npm listing failed (${err instanceof Error ? err.message : String(err)}${cached === null ? "" : "; serving the previous listing"})`,
+ );
+ const entries = cached?.entries ?? [];
+ cached = { entries, expiresAt: now() + failureTtlMs };
+ return entries;
+ },
+ );
+ try {
+ return await inflight;
+ } finally {
+ inflight = null;
+ }
+ },
+ readme: async (name) => {
+ const hit = readmes.get(name);
+ if (hit !== undefined) return hit;
+ let found: string | null = null;
+ try {
+ const res = await fetchImpl(`${NPM_REGISTRY}/${encodeURIComponent(name)}`, {
+ headers: { accept: "application/json", "user-agent": "adelie-server" },
+ signal: AbortSignal.timeout(timeoutMs),
+ });
+ if (res.ok) {
+ const body = (await res.json()) as { readme?: unknown };
+ found = isNonEmptyString(body.readme) ? body.readme : null;
+ }
+ } catch {
+ // A readme nobody can fetch is a missing readme, not a failed page: it is not cached,
+ // so the next visit tries again.
+ return null;
+ }
+ readmes.set(name, found);
+ return found;
+ },
+ };
+}
+
+/**
+ * The published side as this process is configured, or null when the deployment has opted out.
+ *
+ * `ADELIE_PLUGIN_MARKET=off` is for a machine that must reach nobody (an air-gapped install, a
+ * locked-down network): the market then lists only what the build carries, exactly as it did
+ * before this side existed. Reading it here rather than inside `npmPluginRegistry` keeps the
+ * switch with the decision it makes, and out of the registry, which is one cached lookup whether
+ * or not anybody uses it.
+ */
+export function configuredPluginMarket(
+ env: Record<string, string | undefined>,
+): PluginRegistry | null {
+ return env["ADELIE_PLUGIN_MARKET"] === "off" ? null : npmPluginRegistry();
+}
diff --git a/packages/server/test/plugin-registry.test.ts b/packages/server/test/plugin-registry.test.ts
index dfc9ddb2..1c9385ce 100644
--- a/packages/server/test/plugin-registry.test.ts
+++ b/packages/server/test/plugin-registry.test.ts
@@ -24,12 +24,15 @@ import type { PluginIndexEntry, PluginIndexResponse } from "../src/api/types.js"
import type { PluginBase } from "../src/plugin/loader.js";
import {
builtinPluginRegistry,
+ configuredPluginMarket,
httpPluginRegistry,
+ npmPluginRegistry,
parsePluginIndex,
shippedPluginNames,
} from "../src/plugin/registry.js";
import type { PluginRegistry } from "../src/plugin/registry.js";
-import { fakeFetch, jsonResponse } from "./fixtures/fetch.js";
+import { pluginRegistryRoutes } from "../src/http/routes/plugins.js";
+import { fakeFetch, fetchFailed, jsonResponse } from "./fixtures/fetch.js";
import { apiClient, createTestApp, loginAdmin } from "./helpers.js";
import type { TestApp } from "./helpers.js";
@@ -356,10 +359,15 @@ describe("what this build ships", () => {
describe("the registry routes", () => {
let t: TestApp;
beforeAll(async () => {
+ // Without this the app's shelf would have its published side too, and listing it is a real
+ // request to npm — the switch is what a test has instead of the network. The merge of the
+ // two sides is covered below, against a registry that never dials out.
+ process.env.ADELIE_PLUGIN_MARKET = "off";
t = await createTestApp();
});
afterAll(async () => {
await t.cleanup();
+ delete process.env.ADELIE_PLUGIN_MARKET;
});
it("requires auth, then serves the builtin index", async () => {
@@ -417,3 +425,229 @@ describe("the registry routes", () => {
);
});
});
+
+/**
+ * The published side of the shelf: the `@adelie` packages that carry the plugin keyword, read
+ * from npm's search API. No network — the same fetch fake as above, plus an injected clock — and
+ * the behaviour pinned is what a page load depends on: one listing serves every caller, a failure
+ * keeps the previous one rather than emptying the shelf, and a readme is the package's own.
+ */
+describe("npmPluginRegistry", () => {
+ const listing = "https://registry.npmjs.org/-/v1/search?text=keywords%3Aadelie-plugin&size=250";
+ const packument = "https://registry.npmjs.org/%40adelie%2Fuse-example";
+
+ /** One result of npm's search API, as much of it as the shelf reads. */
+ const hit = (over: Record<string, unknown> = {}) => ({
+ package: {
+ name: "@adelie/use-example",
+ version: "1.2.0",
+ description: "An example plugin.",
+ license: "Apache-2.0",
+ keywords: ["adelie-plugin", "example"],
+ date: "2026-10-30T12:00:00.000Z",
+ publisher: { username: "lmliheng" },
+ links: {
+ npm: "https://www.npmjs.com/package/@adelie/use-example",
+ repository: "git+https://github.com/lmliheng/Adelie.git",
+ },
+ ...over,
+ },
+ });
+
+ it("maps a search result into a shelf entry, with the page and the repository a reader can open", async () => {
+ const fake = fakeFetch(() => jsonResponse({ objects: [hit()] }));
+ const entries = await npmPluginRegistry({ fetchImpl: fake.fetch }).index();
+ // One request, the keyword it searches for, and nothing else dialled.
+ expect(fake.calls.map((call) => call.url)).toEqual([listing]);
+ expect(entries).toEqual([
+ {
+ name: "@adelie/use-example",
+ version: "1.2.0",
+ description: "An example plugin.",
+ authors: ["lmliheng"],
+ license: "Apache-2.0",
+ // npm hands out a clone URL (`git+…git`); the shelf links a page instead.
+ repository: "https://github.com/lmliheng/Adelie",
+ homepage: "https://www.npmjs.com/package/@adelie/use-example",
+ keywords: ["adelie-plugin", "example"],
+ updatedAt: Math.floor(Date.parse("2026-10-30T12:00:00.000Z") / 1000),
+ },
+ ]);
+ });
+
+ it("leaves out a package the shelf cannot describe, and any outside the market's own scopes", async () => {
+ // The scope is what keeps the keyword safe to read: anyone can publish a package with it,
+ // nobody outside the project can publish under @adelie/.
+ const fake = fakeFetch(() =>
+ jsonResponse({
+ objects: [
+ hit({ name: "@acme/not-ours" }),
+ hit({ license: undefined }),
+ hit({ description: undefined }),
+ hit({ version: undefined }),
+ hit({ publisher: undefined, author: undefined, maintainers: [] }),
+ hit({
+ links: {
+ npm: "https://www.npmjs.com/package/@adelie/use-example",
+ repository: "git://example.invalid/x.git",
+ },
+ }),
+ { package: null },
+ null,
+ ],
+ }),
+ );
+ const entries = await npmPluginRegistry({ fetchImpl: fake.fetch }).index();
+ expect(entries).toHaveLength(1);
+ // A repository npm gives as something a browser cannot open is dropped, not rendered as a
+ // dead link; everything else the entry needs came from the package.
+ expect(entries[0]?.repository).toBeUndefined();
+ expect(entries[0]?.name).toBe("@adelie/use-example");
+ });
+
+ it("serves one cached listing, keeps the previous one across a failure, and retries it briefly", async () => {
+ let now = 0;
+ let answer = (): Response => jsonResponse({ objects: [hit()] });
+ const fake = fakeFetch(() => answer());
+ const registry = npmPluginRegistry({
+ fetchImpl: fake.fetch,
+ now: () => now,
+ ttlMs: 1000,
+ failureTtlMs: 10,
+ });
+
+ expect((await registry.index()).map((e) => e.name)).toEqual(["@adelie/use-example"]);
+ await registry.index();
+ now = 999;
+ await registry.index();
+ // Three page loads inside the TTL are one npm request.
+ expect(fake.calls).toHaveLength(1);
+
+ // The TTL elapsed and npm cannot be reached: the stale listing is better than an empty shelf.
+ now = 1001;
+ answer = () => {
+ throw fetchFailed("ECONNREFUSED");
+ };
+ expect((await registry.index()).map((e) => e.name)).toEqual(["@adelie/use-example"]);
+ expect(fake.calls).toHaveLength(2);
+
+ // A failure is cached for the shorter TTL, so a page opened twice does not retry twice...
+ now = 1002;
+ await registry.index();
+ expect(fake.calls).toHaveLength(2);
+ // ...and the retry after it is the recovery, with nothing to lose.
+ now = 1012;
+ await registry.index();
+ expect(fake.calls).toHaveLength(3);
+ });
+
+ it("answers an empty shelf rather than throwing when npm is unreachable and there is nothing cached", async () => {
+ const refused = fakeFetch(() => {
+ throw fetchFailed("ECONNREFUSED");
+ });
+ expect(await npmPluginRegistry({ fetchImpl: refused.fetch }).index()).toEqual([]);
+ // An HTTP error is the same story: the library is what the page falls back to.
+ const http = fakeFetch(() => new Response("nope", { status: 503 }));
+ expect(await npmPluginRegistry({ fetchImpl: http.fetch }).index()).toEqual([]);
+ });
+
+ it("answers a readme from the package's own packument, and caches the hit and the miss alike", async () => {
+ const fake = fakeFetch((call) =>
+ call.url === listing
+ ? jsonResponse({ objects: [hit()] })
+ : jsonResponse({ readme: "# use-example\n" }),
+ );
+ const registry = npmPluginRegistry({ fetchImpl: fake.fetch });
+ await registry.index();
+ expect(await registry.readme("@adelie/use-example")).toBe("# use-example\n");
+ // A readme is asked for once per name, however many times the entry is opened.
+ expect(await registry.readme("@adelie/use-example")).toBe("# use-example\n");
+ expect(fake.calls.map((call) => call.url)).toEqual([listing, packument]);
+
+ // A package that publishes no readme is a miss, cached like a hit.
+ const bare = fakeFetch(() => jsonResponse({}));
+ const other = npmPluginRegistry({ fetchImpl: bare.fetch });
+ expect(await other.readme("@adelie/readme-less")).toBeNull();
+ expect(await other.readme("@adelie/readme-less")).toBeNull();
+ expect(bare.calls).toHaveLength(1);
+
+ // A miss nobody answered is not cached: the next visit tries again.
+ const broken = fakeFetch(() => {
+ throw fetchFailed("ECONNREFUSED");
+ });
+ const third = npmPluginRegistry({ fetchImpl: broken.fetch });
+ expect(await third.readme("@adelie/use-example")).toBeNull();
+ expect(await third.readme("@adelie/use-example")).toBeNull();
+ expect(broken.calls).toHaveLength(2);
+ });
+});
+
+describe("configuredPluginMarket", () => {
+ it("is the published side, and null where the deployment opted out of dialling out", () => {
+ expect(configuredPluginMarket({})?.source).toBe("npm");
+ expect(configuredPluginMarket({ ADELIE_PLUGIN_MARKET: "on" })?.source).toBe("npm");
+ // The switch is authoritative: an air-gapped deployment lists only what its build carries.
+ expect(configuredPluginMarket({ ADELIE_PLUGIN_MARKET: "off" })).toBeNull();
+ });
+});
+
+/**
+ * The shelf as the route assembles it: what this build carries first, then the published side,
+ * one entry per name. A name both sides carry is the BUILD's entry — its version is the one
+ * installed here — and its readme is the copy on this machine, so the published side is a
+ * fallback rather than a second opinion.
+ */
+describe("the shelf's two sides", () => {
+ const REPO_ROOT = fileURLToPath(new URL("../../../", import.meta.url));
+ const published: PluginIndexEntry = {
+ name: "@adelie/not-in-this-build",
+ version: "0.1.0",
+ description: "Published without a release.",
+ authors: ["Prism Shadow"],
+ license: "Apache-2.0",
+ };
+ const fromNpm = (entries: PluginIndexEntry[], readme: string | null = null): PluginRegistry => ({
+ source: "npm",
+ index: async () => entries,
+ readme: async () => readme,
+ });
+ const shelf = (side: PluginRegistry | null) =>
+ pluginRegistryRoutes(
+ () => [],
+ () => REPO_ROOT,
+ side,
+ );
+ const listed = async (side: PluginRegistry | null): Promise<PluginIndexEntry[]> =>
+ ((await (await shelf(side).request("/")).json()) as PluginIndexResponse).plugins;
+
+ it("lists what the build carries first, one entry per name", async () => {
+ const builtin = await listed(null);
+ expect(builtin.length).toBeGreaterThan(0);
+ // A published copy of a name the build already carries: the entry on the shelf stays the
+ // build's, whose version is the one this machine installs.
+ const shadowing = { ...builtin[builtin.length - 1]!, version: "9.9.9" };
+ const merged = await listed(fromNpm([shadowing, published]));
+ expect(merged.map((e) => e.name)).toEqual([...builtin.map((e) => e.name), published.name]);
+ expect(merged.at(-2)?.version).not.toBe("9.9.9");
+ });
+
+ it("falls through to the published side's readme only for a package this build does not carry", async () => {
+ const side = fromNpm([published], "# from npm\n");
+ const body = await shelf(side).request(`/readme?name=${encodeURIComponent(published.name)}`);
+ expect(await body.json()).toEqual({ name: published.name, readme: "# from npm\n" });
+
+ // A shipped package's readme is read here, so the published copy is never consulted.
+ const shipped = "@adelie/requirements-box";
+ const ours = await shelf(side).request(`/readme?name=${encodeURIComponent(shipped)}`);
+ const readme = (await ours.json()) as { readme: string | null };
+ expect(readme.readme).toContain("#");
+ expect(readme.readme).not.toBe("# from npm\n");
+ });
+
+ it("still refuses a name neither side lists, so the route cannot probe for what exists", async () => {
+ const res = await shelf(fromNpm([published])).request(
+ "/readme?name=" + encodeURIComponent("@someone/not-listed"),
+ );
+ expect(res.status).toBe(404);
+ });
+});
diff --git a/packages/web/src/features/plugins/plugins-page.tsx b/packages/web/src/features/plugins/plugins-page.tsx
index 29e33ae2..832bce3d 100644
--- a/packages/web/src/features/plugins/plugins-page.tsx
+++ b/packages/web/src/features/plugins/plugins-page.tsx
@@ -112,7 +112,7 @@ import { downloadArchive } from "../agents/archive-download";
import type { WriteOutcome } from "../models/write-outcome";
import { PluginDetailModal } from "./plugin-detail";
import { PluginImportActions } from "./plugin-import-dialog";
-import { pluginImportErrorText } from "./plugin-import";
+import { pluginImportErrorText, pluginNameFromError } from "./plugin-import";
import { SettingsDialog } from "../settings/settings-dialog";
import { formatRelativeDate } from "../../lib/format";
import { SkillTile } from "../skills/skill-icon-view";
@@ -381,6 +381,17 @@ export function PluginsPage() {
*/
const [applyRefusal, setApplyRefusal] = useState<string | null>(null);
+ /**
+ * Fetching a published plugin into the library, by specifier (null = none): the row's own busy
+ * state, and — when the name is already taken — the overwrite confirmation that the import
+ * dialog raises for the same 409.
+ */
+ const [publishing, setPublishing] = useState<string | null>(null);
+ const [overwriteImport, setOverwriteImport] = useState<{
+ specifier: string;
+ name: string;
+ } | null>(null);
+
/**
* Open the confirmation for one module plugin change, without the previous refusal: that
* sentence belonged to the attempt before (one attempt, one reason).
@@ -761,12 +772,60 @@ export function PluginsPage() {
return { ok: true };
};
+ /**
+ * "Add to the library" on a published plugin's row: exactly the import the header's dialog
+ * performs — POST /api/plugins/download, which the server reads as an npm package name — so a
+ * plugin that is on the shelf because it was published needs no typed address. An admin's
+ * action, like every other write into the plugin directory, and the row keeps the refresh:
+ * once it lands, the library listing carries the new card and this row is gone.
+ *
+ * A 409 (the name is taken) opens the same overwrite question the dialog asks for its own
+ * imports rather than a toast: it is a question, and the answer resends the request with
+ * `overwrite`.
+ */
+ const addPublishedToLibrary = async (specifier: string, overwrite = false) => {
+ setPublishing(specifier);
+ try {
+ const res = await api.importPluginFromUrl({
+ url: specifier,
+ ...(overwrite ? { overwrite: true } : {}),
+ });
+ setOverwriteImport(null);
+ toastSuccess(S.plugins.importDoneToast(res.plugin.name));
+ await reloadLibrary();
+ } catch (e) {
+ if (e instanceof ApiError && e.status === 409 && e.code === "plugin_exists") {
+ setOverwriteImport({
+ specifier,
+ name: pluginNameFromError(e, specifier.split("/").pop() ?? specifier),
+ });
+ } else {
+ setOverwriteImport(null);
+ toastError(pluginImportErrorText(e));
+ }
+ } finally {
+ setPublishing(null);
+ }
+ };
+
// The library's rows, divided by what the Agent the page is working with holds (the value
// each card's tag shows), then the module rows the Project does not list yet. The two lists
// below are exactly these: nothing else decides which section a row lands in.
const libraryRows = installedPluginRows(groups ?? [], locale, deployment, index ?? [], view);
const offeredRows = availablePluginRows(deployment, index ?? [], view);
- const divided = splitPluginRows(libraryRows, agents, installed, currentAgent?.agentId ?? null);
+ // What the project published and this deployment does not carry: rows that only exist on the
+ // shelf. They go through the same division so a published plugin is filed with what is offered.
+ const publishedRows = publishedPluginRows(
+ index ?? [],
+ (view.remote ?? deployment)?.shipped ?? [],
+ (groups ?? []).flatMap((group) => group.plugins.map((plugin) => plugin.name)),
+ );
+ const divided = splitPluginRows(
+ [...libraryRows, ...publishedRows],
+ agents,
+ installed,
+ currentAgent?.agentId ?? null,
+ );
const allInstalled = divided.installed;
const allAvailable = [...divided.available, ...offeredRows];
const facets = pluginFacets([...allInstalled, ...allAvailable]);
@@ -806,6 +865,49 @@ export function PluginsPage() {
/>
);
+ /**
+ * The row a module or published plugin draws, whichever list it is filed under. A module row's
+ * verbs depend on that list — installed offers Remove, available offers Install — while a
+ * published one only ever offers the first step, because it is nowhere until it is fetched.
+ */
+ const shelfRow = (
+ row: Extract<PluginRow, { kind: "module" | "published" }>,
+ install: boolean,
+ ) => {
+ if (row.kind === "published") {
+ return (
+ <ModuleRow
+ key={`published:${row.specifier}`}
+ specifier={row.specifier}
+ entry={row.entry}
+ state="none"
+ shipped={false}
+ installLabel={S.plugins.addToLibrary}
+ busy={publishing === row.specifier}
+ blocked={publishing !== null && publishing !== row.specifier}
+ onInstall={isAdmin ? () => void addPublishedToLibrary(row.specifier) : null}
+ onRemove={null}
+ />
+ );
+ }
+ return (
+ <ModuleRow
+ key={`module:${row.specifier}`}
+ specifier={row.specifier}
+ entry={row.entry}
+ state={row.state}
+ error={row.error}
+ shipped={row.shipped}
+ onlyOn={row.onlyOn}
+ removeBlocked={row.removeBlocked}
+ busy={pendingSpecifier === row.specifier}
+ blocked={pendingSpecifier !== null && pendingSpecifier !== row.specifier}
+ onInstall={install && isAdmin ? () => askApply(row.specifier, true) : null}
+ onRemove={install || !isAdmin ? null : () => askApply(row.specifier, false)}
+ />
+ );
+ };
+
// The scrollbar gutter stays reserved: a filter that shortens the page below the viewport
// would otherwise take the scrollbar with it and shift everything sideways at the click.
return (
@@ -930,24 +1032,7 @@ export function PluginsPage() {
onToggle={() => setInstalledOpen((v) => !v)}
>
{installedRows.map((row) =>
- row.kind === "library" ? (
- libraryCard(row)
- ) : (
- <ModuleRow
- key={`module:${row.specifier}`}
- specifier={row.specifier}
- entry={row.entry}
- state={row.state}
- error={row.error}
- shipped={row.shipped}
- onlyOn={row.onlyOn}
- removeBlocked={row.removeBlocked}
- busy={pendingSpecifier === row.specifier}
- blocked={pendingSpecifier !== null && pendingSpecifier !== row.specifier}
- onInstall={null}
- onRemove={isAdmin ? () => askApply(row.specifier, false) : null}
- />
- ),
+ row.kind === "library" ? libraryCard(row) : shelfRow(row, false),
)}
</PluginList>
{availableRows.length > 0 && (
@@ -957,21 +1042,7 @@ export function PluginsPage() {
onToggle={() => setAvailableOpen((v) => !v)}
>
{availableRows.map((row) =>
- row.kind === "library" ? (
- libraryCard(row)
- ) : (
- <ModuleRow
- key={`module:${row.specifier}`}
- specifier={row.specifier}
- entry={row.entry}
- state={row.state}
- shipped={row.shipped}
- busy={pendingSpecifier === row.specifier}
- blocked={pendingSpecifier !== null && pendingSpecifier !== row.specifier}
- onInstall={isAdmin ? () => askApply(row.specifier, true) : null}
- onRemove={null}
- />
- ),
+ row.kind === "library" ? libraryCard(row) : shelfRow(row, true),
)}
</PluginList>
)}
@@ -1053,11 +1124,31 @@ export function PluginsPage() {
</div>
</ConfirmModal>
)}
+ {/* Fetching a published plugin into the library, when its name is already taken: the row's
+ own confirm, and the same question the header's import dialog asks — one name, one
+ plugin, and the answer re-sends the request with overwrite, which is what replaces the
+ existing copy's files. */}
+ {overwriteImport !== null && (
+ <ConfirmModal
+ open
+ title={S.plugins.importOverwriteTitle}
+ tone="primary"
+ confirmLabel={S.plugins.importOverwriteAction}
+ cancelLabel={S.common.cancel}
+ busy={publishing !== null}
+ onClose={() => setOverwriteImport(null)}
+ onConfirm={() => void addPublishedToLibrary(overwriteImport.specifier, true)}
+ >
+ <p className="text-sm text-gray-600 dark:text-gray-300">
+ {S.plugins.importOverwriteBody(overwriteImport.name)}
+ </p>
+ </ConfirmModal>
+ )}
</PageFrame>
);
}
-/** One row of the page: a library plugin (skills / hooks, installed per Agent) or a module plugin (listed per Project). */
+/** One row of the page: a library plugin (skills / hooks, installed per Agent), a module plugin (listed per Project), or a published one (on the shelf, not here yet). */
type PluginRow =
| {
kind: "library";
@@ -1070,7 +1161,20 @@ type PluginRow =
*/
market?: MarketState;
}
- | ModulePluginRow;
+ | ModulePluginRow
+ | PublishedPluginRow;
+/**
+ * A plugin the project has published but this deployment does not carry: an entry on the shelf
+ * whose package is neither part of this build nor in the library. The row exists so the plugin is
+ * visible where plugins are browsed, and its verb is the first step of installing it — fetch it
+ * into the library (the npm import an operator would otherwise have to type), after which it
+ * behaves like any other plugin.
+ */
+interface PublishedPluginRow {
+ kind: "published";
+ specifier: string;
+ entry: PluginIndexEntry;
+}
interface ModulePluginRow {
kind: "module";
specifier: string;
@@ -1202,6 +1306,12 @@ export function splitPluginRows(
const installed: PluginRow[] = [];
const available: PluginRow[] = [];
for (const row of rows) {
+ // A published plugin is nowhere yet — not on an Agent, not even in the library — so it
+ // belongs with what could be installed whatever Agent the page is working with.
+ if (row.kind === "published") {
+ available.push(row);
+ continue;
+ }
if (row.kind === "module" || currentAgentId === null) {
installed.push(row);
continue;
@@ -1260,6 +1370,31 @@ export function availablePluginRows(
return rows;
}
+/**
+ * The plugins the project has published that this deployment does not carry yet: shelf entries
+ * whose package is neither part of this build nor in the library. What is left is the published
+ * side of the market — a plugin that reached npm without a release — and each becomes a row whose
+ * verb fetches it into the library.
+ *
+ * An entry the build ships is left to `availablePluginRows` (a module row for a Project to ask
+ * for), and one the library already holds is left to the card that library row draws: those are
+ * the same plugin seen from where it can actually be installed, and a second row for it would
+ * claim a state the other row contradicts.
+ */
+export function publishedPluginRows(
+ index: readonly PluginIndexEntry[],
+ shipped: readonly string[],
+ library: readonly string[],
+): PublishedPluginRow[] {
+ const known = new Set([...shipped, ...library.map((name) => name.split("/").pop() ?? name)]);
+ const rows: PublishedPluginRow[] = [];
+ for (const entry of index) {
+ if (known.has(entry.name) || known.has(entry.name.split("/").pop() ?? entry.name)) continue;
+ rows.push({ kind: "published", specifier: entry.name, entry });
+ }
+ return rows;
+}
+
/**
* The market entry that describes a library plugin, when the registry has one. The two lists
* name the same package differently: the library by the directory its package was read from
@@ -1343,6 +1478,11 @@ export function rowFacets(row: PluginRow): {
// Agent does not hold is offered, whichever section the page currently files it under.
return { categories: [row.category], kinds, states: [libraryState(row)] };
}
+ // A published plugin is not here, so nothing on this machine says what it carries: its kinds
+ // stay empty rather than being guessed from a search result. It is offered, which is one state.
+ if (row.kind === "published") {
+ return { categories: row.entry.categories ?? [], kinds: [], states: ["available"] };
+ }
const states: PluginState[] =
row.state === "active"
? ["installed", "running"]
@@ -2100,6 +2240,7 @@ function ModuleRow({
removeBlocked,
busy,
blocked,
+ installLabel,
onInstall,
onRemove,
}: {
@@ -2118,10 +2259,17 @@ function ModuleRow({
busy: boolean;
/** Another row's is: one at a time, so the rest are held rather than queued. */
blocked: boolean;
+ /**
+ * What the install verb says, when it is not the Project's own install. A published row
+ * fetches the package into the library rather than listing it for the Project, so its verb
+ * names that first step instead.
+ */
+ installLabel?: string;
onInstall: (() => void) | null;
onRemove: (() => void) | null;
}) {
const { locale } = useLocale();
+ const installText = installLabel ?? S.plugins.install;
const stateText =
state === "active"
? S.plugins.stateActive
@@ -2225,9 +2373,9 @@ function ModuleRow({
<Button
size="sm"
className="h-8 w-8 shrink-0 justify-center p-0"
- aria-label={`${busy ? S.plugins.installing : S.plugins.install} ${specifier}`}
+ aria-label={`${busy ? S.plugins.installing : installText} ${specifier}`}
aria-busy={busy}
- title={busy ? S.plugins.installing : S.plugins.install}
+ title={busy ? S.plugins.installing : installText}
disabled={busy || blocked}
onClick={onInstall}
>
diff --git a/packages/web/src/lib/strings-en.ts b/packages/web/src/lib/strings-en.ts
index c6061c3a..cdd6b608 100644
--- a/packages/web/src/lib/strings-en.ts
+++ b/packages/web/src/lib/strings-en.ts
@@ -2750,6 +2750,14 @@ export const en: Strings = {
detailMarketLink: "View market entry",
/** The "built in" tag on a library plugin: it ships with the build and needs no download. */
libraryBuiltinHint: "Ships with this build; install it to an agent to use it there.",
+ /**
+ * The verb on a PUBLISHED plugin's row: the entry is on the shelf because its package was
+ * published to npm, not because this build carries it, so the row's one step is to fetch it
+ * into the plugin library \u2014 the npm import an operator would otherwise type into the
+ * download dialog themselves. Reuses the dialog's copy for everything after that (the
+ * success toast, the overwrite question).
+ */
+ addToLibrary: "Add to the library",
pluginCount: (n: number): string => (n === 1 ? "1 plugin" : `${n} plugins`),
searchPlaceholder: "Search plugins",
/** Section labels of the plugin detail Modal. */
diff --git a/packages/web/src/lib/strings.ts b/packages/web/src/lib/strings.ts
index 3e27d9fd..517b4f93 100644
--- a/packages/web/src/lib/strings.ts
+++ b/packages/web/src/lib/strings.ts
@@ -2791,6 +2791,14 @@ export const zh = {
detailMarketLink: "查看市场条目",
/** The "built in" tag on a library plugin: it ships with the build and needs no download. */
libraryBuiltinHint: "随本次构建自带;安装到 Agent 即可在那里使用。",
+ /**
+ * The verb on a PUBLISHED plugin's row: the entry is on the shelf because its package was
+ * published to npm, not because this build carries it, so the row's one step is to fetch it
+ * into the plugin library — the npm import an operator would otherwise type into the
+ * download dialog themselves. Reuses the dialog's copy for everything after that (the
+ * success toast, the overwrite question).
+ */
+ addToLibrary: "装入插件库",
/** Plugin count in the group header (small text to the right of the category name). */
pluginCount: (n: number): string => `${n} 个插件`,
/** Search box of the create dialog's plugin picker. */
diff --git a/packages/web/test/plugins-page.test.ts b/packages/web/test/plugins-page.test.ts
index 896c40bc..a2cb72cc 100644
--- a/packages/web/test/plugins-page.test.ts
+++ b/packages/web/test/plugins-page.test.ts
@@ -36,6 +36,7 @@ import {
outdatedAgentIds,
pluginInstalled,
pluginUpdatePlan,
+ publishedPluginRows,
rowFacets,
splitPluginRows,
type AgentInstalls,
@@ -150,6 +151,32 @@ describe("availablePluginRows", () => {
});
});
+/**
+ * The published side of the shelf: entries that are on the market because their package was
+ * published to npm, not because this build carries it. The row exists so such a plugin is
+ * visible where plugins are browsed, and its verb fetches it into the library.
+ */
+describe("publishedPluginRows", () => {
+ it("offers an entry this build does not carry and the library does not hold", () => {
+ const rows = publishedPluginRows(
+ [entry("@adelie/not-in-this-build"), entry("@adelie/csu-mail")],
+ [],
+ ["csu-mail"],
+ );
+ expect(rows.map((r) => r.specifier)).toEqual(["@adelie/not-in-this-build"]);
+ });
+
+ it("leaves a shipped one to the row that installs it, and a library one to its card", () => {
+ // The two lists name the same package differently — the shelf by its package specifier, the
+ // library by the directory it was read from — so both spellings count as known.
+ expect(
+ publishedPluginRows([entry("@adelie/sandbox-bwrap")], ["@adelie/sandbox-bwrap"], []),
+ ).toEqual([]);
+ expect(publishedPluginRows([entry("@adelie/csu-mail")], [], ["csu-mail"])).toEqual([]);
+ expect(publishedPluginRows([entry("csu-mail")], [], ["csu-mail"])).toEqual([]);
+ });
+});
+
describe("marketEntryFor", () => {
const card = { name: "csu-mail", version: "2026.10.05.1" };
@@ -362,6 +389,13 @@ describe("splitPluginRows", () => {
const nameOfRow = (row: ReturnType<typeof splitPluginRows>["installed"][number]): string =>
row.kind === "library" ? row.plugin.name : row.specifier;
+ /** A shelf entry that only the published side carries: nowhere on this machine yet. */
+ const publishedRow = (name: string) => ({
+ kind: "published" as const,
+ specifier: name,
+ entry: entry(name),
+ });
+
it("puts a library plugin the working Agent holds under installed, and one it lacks under available", () => {
const { installed, available } = splitPluginRows(
[held, missing, projectRow],
@@ -374,6 +408,29 @@ describe("splitPluginRows", () => {
expect(available.map(nameOfRow)).toEqual(["csu-mail"]);
});
+ it("files a published plugin under available whatever Agent the page is working with", () => {
+ const shelf = publishedRow("@adelie/not-in-this-build");
+ const rows = [held, missing, projectRow, shelf];
+ const agents = [agent("alpha")];
+ const held_ = new Map([["alpha", installs({ "web-design": "2026.08.01.1" }, {})]]);
+
+ // With an Agent selected: the library plugin it lacks is offered beside it.
+ expect(splitPluginRows(rows, agents, held_, "alpha").available.map(nameOfRow)).toEqual([
+ "csu-mail",
+ "@adelie/not-in-this-build",
+ ]);
+ // With none: the library either way stays where it is, but a published plugin is nowhere
+ // until it is fetched — no Agent's install state can make it installed, so it is offered
+ // in both cases.
+ const none = splitPluginRows(rows, agents, held_, null);
+ expect(none.available.map(nameOfRow)).toEqual(["@adelie/not-in-this-build"]);
+ expect(none.installed.map(nameOfRow)).not.toContain("@adelie/not-in-this-build");
+
+ // Its facets say it is offered, and claim nothing about what it carries: nothing on this
+ // machine has read the package yet.
+ expect(rowFacets(shelf)).toEqual({ categories: [], kinds: [], states: ["available"] });
+ });
+
it("files a copy the server lists as behind under installed: an update is what that card offers", () => {
const { installed, available } = splitPluginRows(
[held],
diff --git a/plugins/agent-company/package.json b/plugins/agent-company/package.json
index af7629b3..9d70a60e 100644
--- a/plugins/agent-company/package.json
+++ b/plugins/agent-company/package.json
@@ -8,6 +8,10 @@
"url": "git+https://github.com/lmliheng/Adelie.git",
"directory": "plugins/agent-company"
},
+ "keywords": [
+ "adelie-plugin",
+ "penguin-harness"
+ ],
"files": [
"plugin.json",
"icon.svg",
diff --git a/plugins/agent-development/package.json b/plugins/agent-development/package.json
index 20635be0..6530d6ad 100644
--- a/plugins/agent-development/package.json
+++ b/plugins/agent-development/package.json
@@ -8,6 +8,10 @@
"url": "git+https://github.com/lmliheng/Adelie.git",
"directory": "plugins/agent-development"
},
+ "keywords": [
+ "adelie-plugin",
+ "penguin-harness"
+ ],
"files": [
"plugin.json",
"icon.svg",
diff --git a/plugins/agent-tuning/package.json b/plugins/agent-tuning/package.json
index b4c66357..2f09bd5e 100644
--- a/plugins/agent-tuning/package.json
+++ b/plugins/agent-tuning/package.json
@@ -8,6 +8,10 @@
"url": "git+https://github.com/lmliheng/Adelie.git",
"directory": "plugins/agent-tuning"
},
+ "keywords": [
+ "adelie-plugin",
+ "penguin-harness"
+ ],
"files": [
"plugin.json",
"icon.svg",
diff --git a/plugins/browser-automation/package.json b/plugins/browser-automation/package.json
index bc4436ba..985def22 100644
--- a/plugins/browser-automation/package.json
+++ b/plugins/browser-automation/package.json
@@ -8,6 +8,10 @@
"url": "git+https://github.com/lmliheng/Adelie.git",
"directory": "plugins/browser-automation"
},
+ "keywords": [
+ "adelie-plugin",
+ "penguin-harness"
+ ],
"files": [
"plugin.json",
"icon.svg",
diff --git a/plugins/continual-learning/package.json b/plugins/continual-learning/package.json
index 1cb3eb07..cdc876ac 100644
--- a/plugins/continual-learning/package.json
+++ b/plugins/continual-learning/package.json
@@ -8,6 +8,10 @@
"url": "git+https://github.com/lmliheng/Adelie.git",
"directory": "plugins/continual-learning"
},
+ "keywords": [
+ "adelie-plugin",
+ "penguin-harness"
+ ],
"files": [
"plugin.json",
"icon.svg",
diff --git a/plugins/csu-mail/package.json b/plugins/csu-mail/package.json
index 89d2309d..ad6182d2 100644
--- a/plugins/csu-mail/package.json
+++ b/plugins/csu-mail/package.json
@@ -8,6 +8,10 @@
"url": "git+https://github.com/lmliheng/Adelie.git",
"directory": "plugins/csu-mail"
},
+ "keywords": [
+ "adelie-plugin",
+ "penguin-harness"
+ ],
"files": [
"plugin.json",
"icon.svg",
diff --git a/plugins/data-analysis/package.json b/plugins/data-analysis/package.json
index 5c61b974..5cf7ec4f 100644
--- a/plugins/data-analysis/package.json
+++ b/plugins/data-analysis/package.json
@@ -8,6 +8,10 @@
"url": "git+https://github.com/lmliheng/Adelie.git",
"directory": "plugins/data-analysis"
},
+ "keywords": [
+ "adelie-plugin",
+ "penguin-harness"
+ ],
"files": [
"plugin.json",
"icon.svg",
diff --git a/plugins/goal/package.json b/plugins/goal/package.json
index 6fd2a8ec..d0563299 100644
--- a/plugins/goal/package.json
+++ b/plugins/goal/package.json
@@ -8,6 +8,10 @@
"url": "git+https://github.com/lmliheng/Adelie.git",
"directory": "plugins/goal"
},
+ "keywords": [
+ "adelie-plugin",
+ "penguin-harness"
+ ],
"files": [
"plugin.json",
"icon.svg",
diff --git a/plugins/humanizer/package.json b/plugins/humanizer/package.json
index f9c3e9f1..9cd1af8b 100644
--- a/plugins/humanizer/package.json
+++ b/plugins/humanizer/package.json
@@ -8,6 +8,10 @@
"url": "git+https://github.com/lmliheng/Adelie.git",
"directory": "plugins/humanizer"
},
+ "keywords": [
+ "adelie-plugin",
+ "penguin-harness"
+ ],
"files": [
"plugin.json",
"icon.svg",
diff --git a/plugins/model-development/package.json b/plugins/model-development/package.json
index f81494de..5bc5aa36 100644
--- a/plugins/model-development/package.json
+++ b/plugins/model-development/package.json
@@ -8,6 +8,10 @@
"url": "git+https://github.com/lmliheng/Adelie.git",
"directory": "plugins/model-development"
},
+ "keywords": [
+ "adelie-plugin",
+ "penguin-harness"
+ ],
"files": [
"plugin.json",
"icon.svg",
diff --git a/plugins/skill-porting/package.json b/plugins/skill-porting/package.json
index b602d47f..94a8655c 100644
--- a/plugins/skill-porting/package.json
+++ b/plugins/skill-porting/package.json
@@ -8,6 +8,10 @@
"url": "git+https://github.com/lmliheng/Adelie.git",
"directory": "plugins/skill-porting"
},
+ "keywords": [
+ "adelie-plugin",
+ "penguin-harness"
+ ],
"files": [
"plugin.json",
"icon.svg",
diff --git a/plugins/software-development/package.json b/plugins/software-development/package.json
index 4e5bdf7b..bbb5286d 100644
--- a/plugins/software-development/package.json
+++ b/plugins/software-development/package.json
@@ -8,6 +8,10 @@
"url": "git+https://github.com/lmliheng/Adelie.git",
"directory": "plugins/software-development"
},
+ "keywords": [
+ "adelie-plugin",
+ "penguin-harness"
+ ],
"files": [
"plugin.json",
"icon.svg",
diff --git a/plugins/use-bento-slides/package.json b/plugins/use-bento-slides/package.json
index 82ff3c69..88bee41c 100644
--- a/plugins/use-bento-slides/package.json
+++ b/plugins/use-bento-slides/package.json
@@ -8,6 +8,10 @@
"url": "git+https://github.com/lmliheng/Adelie.git",
"directory": "plugins/use-bento-slides"
},
+ "keywords": [
+ "adelie-plugin",
+ "penguin-harness"
+ ],
"files": [
"plugin.json",
"icon.svg",
diff --git a/plugins/use-claude-code/package.json b/plugins/use-claude-code/package.json
index e58f9ee6..2cd8ffa2 100644
--- a/plugins/use-claude-code/package.json
+++ b/plugins/use-claude-code/package.json
@@ -8,6 +8,10 @@
"url": "git+https://github.com/lmliheng/Adelie.git",
"directory": "plugins/use-claude-code"
},
+ "keywords": [
+ "adelie-plugin",
+ "penguin-harness"
+ ],
"files": [
"plugin.json",
"icon.svg",
diff --git a/plugins/use-firecrawl/package.json b/plugins/use-firecrawl/package.json
index 9fd517cc..3aee243a 100644
--- a/plugins/use-firecrawl/package.json
+++ b/plugins/use-firecrawl/package.json
@@ -8,6 +8,10 @@
"url": "git+https://github.com/lmliheng/Adelie.git",
"directory": "plugins/use-firecrawl"
},
+ "keywords": [
+ "adelie-plugin",
+ "penguin-harness"
+ ],
"files": [
"plugin.json",
"icon.svg",
diff --git a/plugins/wechat-miniprogram/package.json b/plugins/wechat-miniprogram/package.json
index f5cc2d1b..30f14f19 100644
--- a/plugins/wechat-miniprogram/package.json
+++ b/plugins/wechat-miniprogram/package.json
@@ -8,6 +8,10 @@
"url": "git+https://github.com/lmliheng/Adelie.git",
"directory": "plugins/wechat-miniprogram"
},
+ "keywords": [
+ "adelie-plugin",
+ "penguin-harness"
+ ],
"files": [
"plugin.json",
"icon.svg",