@elizaos/plugin-registry 2.0.11-beta.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +90 -0
- package/dist/api/app-plugins-routes.d.ts +103 -0
- package/dist/api/app-plugins-routes.d.ts.map +1 -0
- package/dist/api/app-plugins-routes.js +1185 -0
- package/dist/api/app-plugins-routes.js.map +1 -0
- package/dist/api/plugin-routes.d.ts +140 -0
- package/dist/api/plugin-routes.d.ts.map +1 -0
- package/dist/api/plugin-routes.js +1391 -0
- package/dist/api/plugin-routes.js.map +1 -0
- package/dist/index.d.ts +26 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +23 -0
- package/dist/index.js.map +1 -0
- package/dist/services/plugin-installer.d.ts +22 -0
- package/dist/services/plugin-installer.d.ts.map +1 -0
- package/dist/services/plugin-installer.js +34 -0
- package/dist/services/plugin-installer.js.map +1 -0
- package/package.json +58 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Shaw Walters and elizaOS Contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# @elizaos/plugin-registry
|
|
2
|
+
|
|
3
|
+
Plugin discovery, manifest reading, install/uninstall lifecycle, and HTTP route handlers for plugin management in elizaOS.
|
|
4
|
+
|
|
5
|
+
## What it does
|
|
6
|
+
|
|
7
|
+
`@elizaos/plugin-registry` consolidates the plugin-management HTTP API that was previously split across `@elizaos/agent` and `@elizaos/app-core`. It provides:
|
|
8
|
+
|
|
9
|
+
- **Plugin list API** — merges bundled plugins (from the static registry), runtime-loaded plugins, and store-installed plugins into a single list with enabled/active status, validation errors, and registry metadata (version, release stream, icon, links).
|
|
10
|
+
- **Plugin toggle and config** — `PUT /api/plugins/:id` enables/disables a plugin and writes config env vars; changes are applied to the live runtime when possible, or a restart is scheduled.
|
|
11
|
+
- **Install / update / uninstall** — `POST /api/plugins/install|update|uninstall` download or remove plugins from the npm registry, update `eliza.json`, and attempt a live runtime reload.
|
|
12
|
+
- **Advanced lifecycle operations** — eject a plugin to a local source checkout (`/eject`), sync it with upstream (`/sync`), or restore it to the registry version (`/reinject`).
|
|
13
|
+
- **Secrets surface** — `GET /api/secrets` aggregates all sensitive plugin parameters across the full plugin list; `PUT /api/secrets` bulk-writes secrets to `process.env`.
|
|
14
|
+
- **Plugin health probes** — `POST /api/plugins/:id/test` calls a plugin's `health`/`testConnection` method or performs a live connectivity check (e.g. Telegram bot token validation).
|
|
15
|
+
- **Core plugin management** — `GET /api/plugins/core` and `POST /api/plugins/core/toggle` manage optional core plugins via the `plugins.allow` list in `eliza.json`.
|
|
16
|
+
- **Drift diagnostics** — `GET /api/plugins/diagnostics` detects mismatches between the Settings UI model and the raw config.
|
|
17
|
+
|
|
18
|
+
## Exported API
|
|
19
|
+
|
|
20
|
+
```ts
|
|
21
|
+
import {
|
|
22
|
+
// Agent-tier route handler
|
|
23
|
+
handlePluginRoutes,
|
|
24
|
+
|
|
25
|
+
// App-core compat-tier route handler + list builder
|
|
26
|
+
handlePluginsCompatRoutes,
|
|
27
|
+
buildPluginListResponse,
|
|
28
|
+
|
|
29
|
+
// Install lifecycle forwarders (lazy-load; break app-core ↔ agent cycle)
|
|
30
|
+
installPlugin,
|
|
31
|
+
installAndRestart,
|
|
32
|
+
uninstallPlugin,
|
|
33
|
+
uninstallAndRestart,
|
|
34
|
+
listInstalledPlugins,
|
|
35
|
+
|
|
36
|
+
// Types
|
|
37
|
+
type InstallPhase,
|
|
38
|
+
type InstallProgress,
|
|
39
|
+
type InstallResult,
|
|
40
|
+
type ProgressCallback,
|
|
41
|
+
type UninstallResult,
|
|
42
|
+
} from "@elizaos/plugin-registry";
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Route surface
|
|
46
|
+
|
|
47
|
+
### Agent-tier (`handlePluginRoutes`)
|
|
48
|
+
|
|
49
|
+
| Method | Path | Description |
|
|
50
|
+
|--------|------|-------------|
|
|
51
|
+
| GET | `/api/plugins` | Full plugin list |
|
|
52
|
+
| PUT | `/api/plugins/:id` | Toggle enabled / write config |
|
|
53
|
+
| GET | `/api/secrets` | Aggregate sensitive params |
|
|
54
|
+
| PUT | `/api/secrets` | Bulk-write secrets to env |
|
|
55
|
+
| POST | `/api/plugins/:id/test` | Plugin health probe |
|
|
56
|
+
| POST | `/api/plugins/install` | Install from npm registry |
|
|
57
|
+
| POST | `/api/plugins/update` | Update installed plugin |
|
|
58
|
+
| POST | `/api/plugins/uninstall` | Uninstall plugin |
|
|
59
|
+
| POST | `/api/plugins/:id/eject` | Eject to local source |
|
|
60
|
+
| POST | `/api/plugins/:id/sync` | Sync ejected plugin |
|
|
61
|
+
| POST | `/api/plugins/:id/reinject` | Restore to registry version |
|
|
62
|
+
| GET | `/api/plugins/installed` | List runtime-installed plugins |
|
|
63
|
+
| GET | `/api/plugins/ejected` | List ejected plugins |
|
|
64
|
+
| GET | `/api/core/status` | `@elizaos/core` eject status |
|
|
65
|
+
| GET | `/api/plugins/core` | Core + optional-core list |
|
|
66
|
+
| POST | `/api/plugins/core/toggle` | Toggle optional-core plugin |
|
|
67
|
+
|
|
68
|
+
### App-core compat-tier (`handlePluginsCompatRoutes`)
|
|
69
|
+
|
|
70
|
+
| Method | Path | Description |
|
|
71
|
+
|--------|------|-------------|
|
|
72
|
+
| GET | `/api/plugins` | Plugin list (registry + manifest + runtime) |
|
|
73
|
+
| GET | `/api/plugins/diagnostics` | Drift diagnostics |
|
|
74
|
+
| PUT | `/api/plugins/:id` | Toggle / config + vault mirror |
|
|
75
|
+
| POST | `/api/plugins/:id/test` | Connectivity test |
|
|
76
|
+
| POST | `/api/plugins/:id/reveal` | Reveal raw env value from vault |
|
|
77
|
+
|
|
78
|
+
## Required config / env
|
|
79
|
+
|
|
80
|
+
This package reads no env vars of its own. Plugin-specific env vars (e.g. `OPENAI_API_KEY`, `TELEGRAM_BOT_TOKEN`) are declared by each plugin's `pluginParameters` manifest entry and are read from `process.env` when building the plugin list or handling config writes.
|
|
81
|
+
|
|
82
|
+
The optional `ELIZA_SETTINGS_DEBUG` env var enables verbose before/after logging on PUT operations.
|
|
83
|
+
|
|
84
|
+
## Dependencies
|
|
85
|
+
|
|
86
|
+
- `@elizaos/core` — `AgentRuntime`, `logger`
|
|
87
|
+
- `@elizaos/shared` — shared request/response schemas, plugin constants
|
|
88
|
+
- `@elizaos/vault` — encrypted secret storage (via `@elizaos/app-core` vault-mirror service)
|
|
89
|
+
|
|
90
|
+
The canonical plugin install implementation lives in `@elizaos/agent`. The forwarders in `src/services/plugin-installer.ts` lazy-load it at call time to avoid a static circular dependency.
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import type http from "node:http";
|
|
2
|
+
import { loadElizaConfig } from "@elizaos/agent";
|
|
3
|
+
import { type CompatRuntimeState } from "@elizaos/app-core/api/compat-route-shared";
|
|
4
|
+
import { _resetSharedVaultForTesting, mirrorPluginSensitiveToVault } from "@elizaos/app-core/services/vault-mirror";
|
|
5
|
+
import { type AgentRuntime } from "@elizaos/core";
|
|
6
|
+
type PluginCategory = "ai-provider" | "connector" | "streaming" | "database" | "app" | "feature";
|
|
7
|
+
interface CompatPluginParameter {
|
|
8
|
+
key: string;
|
|
9
|
+
type: string;
|
|
10
|
+
description: string;
|
|
11
|
+
required: boolean;
|
|
12
|
+
sensitive: boolean;
|
|
13
|
+
default?: string;
|
|
14
|
+
options?: string[];
|
|
15
|
+
currentValue: string | null;
|
|
16
|
+
isSet: boolean;
|
|
17
|
+
}
|
|
18
|
+
interface CompatPluginRecord {
|
|
19
|
+
id: string;
|
|
20
|
+
name?: string;
|
|
21
|
+
description?: string;
|
|
22
|
+
enabled?: boolean;
|
|
23
|
+
configured?: boolean;
|
|
24
|
+
envKey?: string | null;
|
|
25
|
+
category?: PluginCategory;
|
|
26
|
+
source?: string;
|
|
27
|
+
parameters: CompatPluginParameter[];
|
|
28
|
+
validationErrors: Array<{
|
|
29
|
+
field: string;
|
|
30
|
+
message: string;
|
|
31
|
+
}>;
|
|
32
|
+
validationWarnings?: Array<{
|
|
33
|
+
field?: string;
|
|
34
|
+
message: string;
|
|
35
|
+
}>;
|
|
36
|
+
npmName?: string;
|
|
37
|
+
version?: string;
|
|
38
|
+
isActive?: boolean;
|
|
39
|
+
tags?: string[];
|
|
40
|
+
configKeys?: string[];
|
|
41
|
+
pluginDeps?: string[];
|
|
42
|
+
configUiHints?: Record<string, unknown>;
|
|
43
|
+
icon?: string | null;
|
|
44
|
+
homepage?: string;
|
|
45
|
+
repository?: string;
|
|
46
|
+
setupGuideUrl?: string;
|
|
47
|
+
iconName?: string;
|
|
48
|
+
group?: string;
|
|
49
|
+
groupOrder?: number;
|
|
50
|
+
visible?: boolean;
|
|
51
|
+
}
|
|
52
|
+
type PluginDriftFlag = "entries_vs_compat" | "entries_vs_allowlist" | "inactive_but_enabled" | "active_but_disabled";
|
|
53
|
+
interface PluginDriftDiagnostic {
|
|
54
|
+
pluginId: string;
|
|
55
|
+
npmName: string | null;
|
|
56
|
+
category: PluginCategory;
|
|
57
|
+
enabled_ui: boolean;
|
|
58
|
+
enabled_allowlist: boolean | null;
|
|
59
|
+
is_active: boolean;
|
|
60
|
+
drift_flags: PluginDriftFlag[];
|
|
61
|
+
}
|
|
62
|
+
interface PluginDriftDiagnosticsSummary {
|
|
63
|
+
total: number;
|
|
64
|
+
withDrift: number;
|
|
65
|
+
byFlag: Record<PluginDriftFlag, number>;
|
|
66
|
+
}
|
|
67
|
+
interface PluginDriftDiagnosticsReport {
|
|
68
|
+
summary: PluginDriftDiagnosticsSummary;
|
|
69
|
+
plugins: PluginDriftDiagnostic[];
|
|
70
|
+
}
|
|
71
|
+
export { _resetSharedVaultForTesting, mirrorPluginSensitiveToVault };
|
|
72
|
+
export declare function resolveCompatPluginEnabledForList(active: boolean, persistedEnabled: boolean | undefined, advancedCapabilityEnabled?: boolean): boolean;
|
|
73
|
+
export declare function analyzePluginStateDrift(pluginList: CompatPluginRecord[], configRecord: Record<string, unknown>, configEntries: Record<string, {
|
|
74
|
+
enabled?: unknown;
|
|
75
|
+
}>, allowList: Set<string> | null): PluginDriftDiagnosticsReport;
|
|
76
|
+
export declare function resolvePluginManifestPath(): string | null;
|
|
77
|
+
export declare function resolveAdvancedCapabilityCompatStatus(pluginId: string, config: ReturnType<typeof loadElizaConfig>, runtime: Pick<AgentRuntime, "getService"> | null): {
|
|
78
|
+
enabled: boolean;
|
|
79
|
+
isActive: boolean;
|
|
80
|
+
} | null;
|
|
81
|
+
export declare function buildPluginListResponse(runtime: AgentRuntime | null): {
|
|
82
|
+
plugins: CompatPluginRecord[];
|
|
83
|
+
};
|
|
84
|
+
export declare function persistCompatPluginMutation(pluginId: string, body: Record<string, unknown>, plugin: CompatPluginRecord): {
|
|
85
|
+
status: number;
|
|
86
|
+
payload: Record<string, unknown>;
|
|
87
|
+
};
|
|
88
|
+
/**
|
|
89
|
+
* Plugin management routes.
|
|
90
|
+
*
|
|
91
|
+
* Contract note:
|
|
92
|
+
* - `/api/plugins` is the Settings/UI model.
|
|
93
|
+
* - `/api/plugins/core` is the optional-core allow-list model.
|
|
94
|
+
* - These can drift; use `/api/plugins/diagnostics` to inspect mismatches.
|
|
95
|
+
*
|
|
96
|
+
* - `GET /api/plugins` — returns filtered plugin list
|
|
97
|
+
* - `GET /api/plugins/diagnostics` — returns drift diagnostics
|
|
98
|
+
* - `PUT /api/plugins/:id` — updates plugin config, writes env vars
|
|
99
|
+
* - `POST /api/plugins/:id/test` — tests plugin connectivity
|
|
100
|
+
* - `POST /api/plugins/:id/reveal` — reveals plugin env var value
|
|
101
|
+
*/
|
|
102
|
+
export declare function handlePluginsCompatRoutes(req: http.IncomingMessage, res: http.ServerResponse, state: CompatRuntimeState): Promise<boolean>;
|
|
103
|
+
//# sourceMappingURL=app-plugins-routes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app-plugins-routes.d.ts","sourceRoot":"","sources":["../../src/api/app-plugins-routes.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAWlC,OAAO,EAQL,eAAe,EAMhB,MAAM,gBAAgB,CAAC;AAKxB,OAAO,EACL,KAAK,kBAAkB,EAGxB,MAAM,2CAA2C,CAAC;AAUnD,OAAO,EACL,2BAA2B,EAC3B,4BAA4B,EAE7B,MAAM,yCAAyC,CAAC;AACjD,OAAO,EAAE,KAAK,YAAY,EAAU,MAAM,eAAe,CAAC;AAc1D,KAAK,cAAc,GACf,aAAa,GACb,WAAW,GACX,WAAW,GACX,UAAU,GACV,KAAK,GACL,SAAS,CAAC;AAkId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