@elizaos/app-core 2.0.0-alpha.155 → 2.0.0-alpha.156
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/package.json +5 -5
- package/packages/agent/src/api/plugin-routes.d.ts.map +1 -1
- package/packages/agent/src/api/plugin-routes.js +50 -0
- package/packages/app-core/src/api/client-agent.js +14 -5
- package/packages/app-core/src/api/plugins-compat-routes.d.ts +32 -4
- package/packages/app-core/src/api/plugins-compat-routes.d.ts.map +1 -1
- package/packages/app-core/src/api/plugins-compat-routes.js +140 -4
- package/packages/typescript/src/plugin.d.ts.map +1 -1
- package/packages/typescript/src/plugin.js +10 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elizaos/app-core",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.156",
|
|
4
4
|
"description": "Shared application core for elizaOS white-label agent apps.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -411,17 +411,17 @@
|
|
|
411
411
|
"@capacitor/keyboard": "8.0.0",
|
|
412
412
|
"@capacitor/preferences": "^8.0.1",
|
|
413
413
|
"@clack/prompts": "^1.0.0",
|
|
414
|
-
"@elizaos/agent": "^2.0.0-alpha.
|
|
414
|
+
"@elizaos/agent": "^2.0.0-alpha.156",
|
|
415
415
|
"@elizaos/app-companion": "^0.0.0",
|
|
416
416
|
"@elizaos/app-shopify": "^0.0.0",
|
|
417
417
|
"@elizaos/app-steward": "^0.0.0",
|
|
418
418
|
"@elizaos/app-task-coordinator": "^0.0.0",
|
|
419
419
|
"@elizaos/app-training": "^0.0.1",
|
|
420
420
|
"@elizaos/app-vincent": "^0.0.0",
|
|
421
|
-
"@elizaos/core": "^2.0.0-alpha.
|
|
421
|
+
"@elizaos/core": "^2.0.0-alpha.156",
|
|
422
422
|
"@elizaos/plugin-wechat": "github:milady-ai/plugin-wechat",
|
|
423
|
-
"@elizaos/shared": "^2.0.0-alpha.
|
|
424
|
-
"@elizaos/ui": "^2.0.0-alpha.
|
|
423
|
+
"@elizaos/shared": "^2.0.0-alpha.156",
|
|
424
|
+
"@elizaos/ui": "^2.0.0-alpha.156",
|
|
425
425
|
"@radix-ui/react-checkbox": "^1.3.3",
|
|
426
426
|
"@radix-ui/react-dialog": "^1.1.15",
|
|
427
427
|
"@radix-ui/react-dropdown-menu": "^2.1.16",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin-routes.d.ts","sourceRoot":"","sources":["../../../../../../agent/src/api/plugin-routes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAOlD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAEvD,OAAO,EAEL,KAAK,6BAA6B,EACnC,MAAM,6BAA6B,CAAC;AAOrC,OAAO,KAAK,EACV,eAAe,EAEf,iBAAiB,EAClB,MAAM,qCAAqC,CAAC;AAC7C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAmB7D,UAAU,cAAc;IACtB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,OAAO,CAAC;IAClB,SAAS,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,KAAK,EAAE,OAAO,CAAC;CAChB;AAED,UAAU,WAAW;IACnB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,OAAO,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PluginListId(npmName) {
|
|
|
14
14
|
return npmName.replace("@elizaos/plugin-", "");
|
|
15
15
|
}
|
|
16
16
|
const pluginsListInFlight = new WeakMap();
|
|
17
|
+
function readCompatEnabledFromConfig(config, pluginId) {
|
|
18
|
+
const asRecord = (value) => {
|
|
19
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
return value;
|
|
23
|
+
};
|
|
24
|
+
const legacyStreaming = asRecord(config.streaming);
|
|
25
|
+
const container = asRecord(config.connectors)?.[pluginId] ?? legacyStreaming?.[pluginId];
|
|
26
|
+
const value = asRecord(container)?.enabled;
|
|
27
|
+
return typeof value === "boolean" ? value : null;
|
|
28
|
+
}
|
|
29
|
+
function buildCoreToggleDiagnostics(config, npmName) {
|
|
30
|
+
const pluginId = optionalPluginListId(npmName);
|
|
31
|
+
const isOptional = OPTIONAL_CORE_PLUGINS.includes(npmName);
|
|
32
|
+
if (!isOptional) {
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
const allowList = new Set(config.plugins?.allow ?? []);
|
|
36
|
+
const enabledAllowList = allowList.has(npmName) || allowList.has(pluginId);
|
|
37
|
+
const entryEnabledRaw = config.plugins?.entries?.[pluginId]?.enabled;
|
|
38
|
+
const enabledEntries = typeof entryEnabledRaw === "boolean" ? entryEnabledRaw : null;
|
|
39
|
+
const enabledCompat = readCompatEnabledFromConfig(config, pluginId);
|
|
40
|
+
const driftFlags = [];
|
|
41
|
+
if (enabledEntries !== null && enabledEntries !== enabledAllowList) {
|
|
42
|
+
driftFlags.push("entries_vs_allowlist");
|
|
43
|
+
}
|
|
44
|
+
if (enabledEntries !== null &&
|
|
45
|
+
enabledCompat !== null &&
|
|
46
|
+
enabledEntries !== enabledCompat) {
|
|
47
|
+
driftFlags.push("entries_vs_compat");
|
|
48
|
+
}
|
|
49
|
+
return {
|
|
50
|
+
pluginId,
|
|
51
|
+
npmName,
|
|
52
|
+
enabled_allowlist: enabledAllowList,
|
|
53
|
+
enabled_entries: enabledEntries,
|
|
54
|
+
enabled_compat: enabledCompat,
|
|
55
|
+
drift_flags: driftFlags,
|
|
56
|
+
};
|
|
57
|
+
}
|
|
17
58
|
// ---------------------------------------------------------------------------
|
|
18
59
|
// Route handler
|
|
19
60
|
// ---------------------------------------------------------------------------
|
|
@@ -1130,6 +1171,15 @@ export async function handlePluginRoutes(ctx) {
|
|
|
1130
1171
|
loadedPackages: runtimeApply.loadedPackages,
|
|
1131
1172
|
unloadedPackages: runtimeApply.unloadedPackages,
|
|
1132
1173
|
reloadedPackages: runtimeApply.reloadedPackages,
|
|
1174
|
+
diagnostics: (() => {
|
|
1175
|
+
const diagnostic = buildCoreToggleDiagnostics(state.config, body.npmName);
|
|
1176
|
+
return diagnostic && diagnostic.drift_flags.length > 0
|
|
1177
|
+
? {
|
|
1178
|
+
withDrift: true,
|
|
1179
|
+
plugin: diagnostic,
|
|
1180
|
+
}
|
|
1181
|
+
: undefined;
|
|
1182
|
+
})(),
|
|
1133
1183
|
message: runtimeApply.requiresRestart
|
|
1134
1184
|
? `${shortId} ${body.enabled ? "enabled" : "disabled"}. Restart required.`
|
|
1135
1185
|
: `${shortId} ${body.enabled ? "enabled" : "disabled"}.`,
|
|
@@ -248,10 +248,19 @@ ElizaClient.prototype.resumeAgent = async function () {
|
|
|
248
248
|
return res.status;
|
|
249
249
|
};
|
|
250
250
|
ElizaClient.prototype.restartAgent = async function () {
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
251
|
+
try {
|
|
252
|
+
const res = await this.fetch("/api/agent/restart", {
|
|
253
|
+
method: "POST",
|
|
254
|
+
});
|
|
255
|
+
return res.status;
|
|
256
|
+
}
|
|
257
|
+
catch {
|
|
258
|
+
// Back-compat for older runtimes that still expose the legacy restart path.
|
|
259
|
+
const legacy = await this.fetch("/api@elizaos/agent/restart", {
|
|
260
|
+
method: "POST",
|
|
261
|
+
});
|
|
262
|
+
return legacy.status;
|
|
263
|
+
}
|
|
255
264
|
};
|
|
256
265
|
ElizaClient.prototype.restartAndWait = async function (maxWaitMs = 30000) {
|
|
257
266
|
const t0 = Date.now();
|
|
@@ -261,7 +270,7 @@ ElizaClient.prototype.restartAndWait = async function (maxWaitMs = 30000) {
|
|
|
261
270
|
});
|
|
262
271
|
try {
|
|
263
272
|
await this.restartAgent();
|
|
264
|
-
console.info("[eliza][reset][client] restartAndWait:
|
|
273
|
+
console.info("[eliza][reset][client] restartAndWait: restart accepted");
|
|
265
274
|
}
|
|
266
275
|
catch (e) {
|
|
267
276
|
console.info("[eliza][reset][client] restartAndWait: initial restart call failed (often 409 while restarting)", e);
|
|
@@ -35,6 +35,28 @@ interface CompatPluginRecord {
|
|
|
35
35
|
version?: string;
|
|
36
36
|
isActive?: boolean;
|
|
37
37
|
}
|
|
38
|
+
type PluginDriftFlag = "entries_vs_compat" | "entries_vs_allowlist" | "inactive_but_enabled" | "active_but_disabled";
|
|
39
|
+
interface PluginDriftDiagnostic {
|
|
40
|
+
pluginId: string;
|
|
41
|
+
npmName: string | null;
|
|
42
|
+
category: PluginCategory;
|
|
43
|
+
enabled_ui: boolean;
|
|
44
|
+
enabled_allowlist: boolean | null;
|
|
45
|
+
is_active: boolean;
|
|
46
|
+
drift_flags: PluginDriftFlag[];
|
|
47
|
+
}
|
|
48
|
+
interface PluginDriftDiagnosticsSummary {
|
|
49
|
+
total: number;
|
|
50
|
+
withDrift: number;
|
|
51
|
+
byFlag: Record<PluginDriftFlag, number>;
|
|
52
|
+
}
|
|
53
|
+
interface PluginDriftDiagnosticsReport {
|
|
54
|
+
summary: PluginDriftDiagnosticsSummary;
|
|
55
|
+
plugins: PluginDriftDiagnostic[];
|
|
56
|
+
}
|
|
57
|
+
export declare function analyzePluginStateDrift(pluginList: CompatPluginRecord[], configRecord: Record<string, unknown>, configEntries: Record<string, {
|
|
58
|
+
enabled?: unknown;
|
|
59
|
+
}>, allowList: Set<string>): PluginDriftDiagnosticsReport;
|
|
38
60
|
export declare function resolvePluginManifestPath(): string | null;
|
|
39
61
|
export declare function buildPluginListResponse(runtime: AgentRuntime | null): {
|
|
40
62
|
plugins: Array<Record<string, unknown>>;
|
|
@@ -46,10 +68,16 @@ export declare function persistCompatPluginMutation(pluginId: string, body: Reco
|
|
|
46
68
|
/**
|
|
47
69
|
* Plugin management routes.
|
|
48
70
|
*
|
|
49
|
-
*
|
|
50
|
-
* -
|
|
51
|
-
* -
|
|
52
|
-
* -
|
|
71
|
+
* Contract note:
|
|
72
|
+
* - `/api/plugins` is the Settings/UI model.
|
|
73
|
+
* - `/api/plugins/core` is the optional-core allow-list model.
|
|
74
|
+
* - These can drift; use `/api/plugins/diagnostics` to inspect mismatches.
|
|
75
|
+
*
|
|
76
|
+
* - `GET /api/plugins` — returns filtered plugin list
|
|
77
|
+
* - `GET /api/plugins/diagnostics` — returns drift diagnostics
|
|
78
|
+
* - `PUT /api/plugins/:id` — updates plugin config, writes env vars
|
|
79
|
+
* - `POST /api/plugins/:id/test` — tests plugin connectivity
|
|
80
|
+
* - `POST /api/plugins/:id/reveal` — reveals plugin env var value
|
|
53
81
|
*/
|
|
54
82
|
export declare function handlePluginsCompatRoutes(req: http.IncomingMessage, res: http.ServerResponse, state: CompatRuntimeState): Promise<boolean>;
|
|
55
83
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugins-compat-routes.d.ts","sourceRoot":"","sources":["../../../../../src/api/plugins-compat-routes.ts"],"names":[],"mappings":"AACA,OAAO,IAAI,MAAM,WAAW,CAAC;AAI7B,OAAO,EAAE,KAAK,YAAY,EAAU,MAAM,eAAe,CAAC;AAuB1D,OAAO,EAGL,KAAK,kBAAkB,EACxB,MAAM,uBAAuB,CAAC;AAQ/B,KAAK,cAAc,GACf,aAAa,GACb,WAAW,GACX,WAAW,GACX,UAAU,GACV,KAAK,GACL,SAAS,CAAC;AA0Cd,UAAU,qBAAqB;IAC7B,GAAG,EAAE,MAAM,CAAC;IACZ,I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H,wBAAsB,yBAAyB,CAC7C,GAAG,EAAE,IAAI,CAAC,eAAe,EACzB,GAAG,EAAE,IAAI,CAAC,cAAc,EACxB,KAAK,EAAE,kBAAkB,GACxB,OAAO,CAAC,OAAO,CAAC,CA2LlB"}
|
|
@@ -65,6 +65,9 @@ const REVEALABLE_KEY_PREFIXES = [
|
|
|
65
65
|
"LIVEPEER_",
|
|
66
66
|
...SENSITIVE_KEY_PREFIXES,
|
|
67
67
|
];
|
|
68
|
+
const DRIFT_LOG_THROTTLE_MS = 5 * 60 * 1000;
|
|
69
|
+
let _lastDriftWarningAt = 0;
|
|
70
|
+
let _lastDriftWarningFingerprint = "";
|
|
68
71
|
// ---------------------------------------------------------------------------
|
|
69
72
|
// Helpers
|
|
70
73
|
// ---------------------------------------------------------------------------
|
|
@@ -202,6 +205,119 @@ function resolvePersistedPluginEnabled(pluginId, category, npmName, configEntrie
|
|
|
202
205
|
}
|
|
203
206
|
return pluginEnabled;
|
|
204
207
|
}
|
|
208
|
+
function shortPluginIdFromNpmName(npmName) {
|
|
209
|
+
if (!npmName || typeof npmName !== "string") {
|
|
210
|
+
return null;
|
|
211
|
+
}
|
|
212
|
+
if (npmName.startsWith("@elizaos/app-")) {
|
|
213
|
+
return npmName.slice("@elizaos/".length);
|
|
214
|
+
}
|
|
215
|
+
if (npmName.startsWith("@elizaos/plugin-")) {
|
|
216
|
+
return npmName.slice("@elizaos/plugin-".length);
|
|
217
|
+
}
|
|
218
|
+
return normalizePluginId(npmName);
|
|
219
|
+
}
|
|
220
|
+
export function analyzePluginStateDrift(pluginList, configRecord, configEntries, allowList) {
|
|
221
|
+
const diagnostics = pluginList.map((plugin) => {
|
|
222
|
+
const pluginId = String(plugin.id ?? "");
|
|
223
|
+
const category = normalizePluginCategory(plugin.category);
|
|
224
|
+
const npmName = typeof plugin.npmName === "string" && plugin.npmName.length > 0
|
|
225
|
+
? plugin.npmName
|
|
226
|
+
: null;
|
|
227
|
+
const shortId = shortPluginIdFromNpmName(npmName) ?? pluginId;
|
|
228
|
+
const uiEnabled = Boolean(plugin.enabled);
|
|
229
|
+
const compatEnabled = category === "connector"
|
|
230
|
+
? readCompatSectionEnabled(configRecord.connectors, resolveCompatConfigKey(pluginId, npmName ?? undefined, CONNECTOR_PLUGINS))
|
|
231
|
+
: category === "streaming"
|
|
232
|
+
? readCompatSectionEnabled(configRecord.streaming, resolveCompatConfigKey(pluginId, npmName ?? undefined, STREAMING_PLUGINS))
|
|
233
|
+
: undefined;
|
|
234
|
+
const entryEnabled = typeof configEntries[pluginId]?.enabled === "boolean"
|
|
235
|
+
? Boolean(configEntries[pluginId]?.enabled)
|
|
236
|
+
: undefined;
|
|
237
|
+
const enabledAllowList = npmName == null
|
|
238
|
+
? null
|
|
239
|
+
: allowList.has(npmName) || allowList.has(shortId);
|
|
240
|
+
const isActive = Boolean(plugin.isActive);
|
|
241
|
+
const driftFlags = [];
|
|
242
|
+
if (compatEnabled !== undefined &&
|
|
243
|
+
entryEnabled !== undefined &&
|
|
244
|
+
compatEnabled !== entryEnabled) {
|
|
245
|
+
driftFlags.push("entries_vs_compat");
|
|
246
|
+
}
|
|
247
|
+
if (enabledAllowList !== null && entryEnabled !== undefined) {
|
|
248
|
+
if (enabledAllowList !== entryEnabled) {
|
|
249
|
+
driftFlags.push("entries_vs_allowlist");
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
if (uiEnabled && !isActive) {
|
|
253
|
+
driftFlags.push("inactive_but_enabled");
|
|
254
|
+
}
|
|
255
|
+
if (!uiEnabled && isActive) {
|
|
256
|
+
driftFlags.push("active_but_disabled");
|
|
257
|
+
}
|
|
258
|
+
return {
|
|
259
|
+
pluginId,
|
|
260
|
+
npmName,
|
|
261
|
+
category,
|
|
262
|
+
enabled_ui: uiEnabled,
|
|
263
|
+
enabled_allowlist: enabledAllowList,
|
|
264
|
+
is_active: isActive,
|
|
265
|
+
drift_flags: driftFlags,
|
|
266
|
+
};
|
|
267
|
+
});
|
|
268
|
+
const withDrift = diagnostics.filter((plugin) => plugin.drift_flags.length > 0);
|
|
269
|
+
const byFlag = {
|
|
270
|
+
entries_vs_compat: 0,
|
|
271
|
+
entries_vs_allowlist: 0,
|
|
272
|
+
inactive_but_enabled: 0,
|
|
273
|
+
active_but_disabled: 0,
|
|
274
|
+
};
|
|
275
|
+
for (const plugin of withDrift) {
|
|
276
|
+
for (const flag of plugin.drift_flags) {
|
|
277
|
+
byFlag[flag] += 1;
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
return {
|
|
281
|
+
summary: {
|
|
282
|
+
total: diagnostics.length,
|
|
283
|
+
withDrift: withDrift.length,
|
|
284
|
+
byFlag,
|
|
285
|
+
},
|
|
286
|
+
plugins: diagnostics,
|
|
287
|
+
};
|
|
288
|
+
}
|
|
289
|
+
function buildPluginDriftDiagnostics(runtime) {
|
|
290
|
+
const pluginList = buildPluginListResponse(runtime)
|
|
291
|
+
.plugins;
|
|
292
|
+
const config = loadElizaConfig();
|
|
293
|
+
const configRecord = config;
|
|
294
|
+
const configEntries = config.plugins?.entries ?? {};
|
|
295
|
+
const allowList = new Set(config.plugins?.allow ?? []);
|
|
296
|
+
return analyzePluginStateDrift(pluginList, configRecord, configEntries, allowList);
|
|
297
|
+
}
|
|
298
|
+
function maybeLogPluginStateDrift(report) {
|
|
299
|
+
if (report.summary.withDrift === 0) {
|
|
300
|
+
return;
|
|
301
|
+
}
|
|
302
|
+
const drifted = report.plugins
|
|
303
|
+
.filter((plugin) => plugin.drift_flags.length > 0)
|
|
304
|
+
.map((plugin) => `${plugin.pluginId}:${plugin.drift_flags.join("+")}`)
|
|
305
|
+
.sort();
|
|
306
|
+
const fingerprint = drifted.join("|");
|
|
307
|
+
const now = Date.now();
|
|
308
|
+
if (fingerprint === _lastDriftWarningFingerprint &&
|
|
309
|
+
now - _lastDriftWarningAt < DRIFT_LOG_THROTTLE_MS) {
|
|
310
|
+
return;
|
|
311
|
+
}
|
|
312
|
+
_lastDriftWarningAt = now;
|
|
313
|
+
_lastDriftWarningFingerprint = fingerprint;
|
|
314
|
+
logger.warn({
|
|
315
|
+
src: "api:plugins",
|
|
316
|
+
driftCount: report.summary.withDrift,
|
|
317
|
+
byFlag: report.summary.byFlag,
|
|
318
|
+
plugins: drifted,
|
|
319
|
+
}, "Plugin enable-state drift detected between /api/plugins and /api/plugins/core models");
|
|
320
|
+
}
|
|
205
321
|
// ── Enabled-state drift reconciliation ────────────────────────────────
|
|
206
322
|
//
|
|
207
323
|
// The write path (persistCompatPluginMutation) always updates both
|
|
@@ -693,10 +809,16 @@ export function persistCompatPluginMutation(pluginId, body, plugin) {
|
|
|
693
809
|
/**
|
|
694
810
|
* Plugin management routes.
|
|
695
811
|
*
|
|
696
|
-
*
|
|
697
|
-
* -
|
|
698
|
-
* -
|
|
699
|
-
* -
|
|
812
|
+
* Contract note:
|
|
813
|
+
* - `/api/plugins` is the Settings/UI model.
|
|
814
|
+
* - `/api/plugins/core` is the optional-core allow-list model.
|
|
815
|
+
* - These can drift; use `/api/plugins/diagnostics` to inspect mismatches.
|
|
816
|
+
*
|
|
817
|
+
* - `GET /api/plugins` — returns filtered plugin list
|
|
818
|
+
* - `GET /api/plugins/diagnostics` — returns drift diagnostics
|
|
819
|
+
* - `PUT /api/plugins/:id` — updates plugin config, writes env vars
|
|
820
|
+
* - `POST /api/plugins/:id/test` — tests plugin connectivity
|
|
821
|
+
* - `POST /api/plugins/:id/reveal` — reveals plugin env var value
|
|
700
822
|
*/
|
|
701
823
|
export async function handlePluginsCompatRoutes(req, res, state) {
|
|
702
824
|
const method = (req.method ?? "GET").toUpperCase();
|
|
@@ -711,9 +833,19 @@ export async function handlePluginsCompatRoutes(req, res, state) {
|
|
|
711
833
|
const pluginResponse = buildPluginListResponse(state.current);
|
|
712
834
|
const manifestPath = resolvePluginManifestPath();
|
|
713
835
|
logger.debug(`[api/plugins] manifest=${manifestPath ?? "NOT_FOUND"} total=${pluginResponse.plugins.length} runtime=${state.current ? "active" : "null"}`);
|
|
836
|
+
maybeLogPluginStateDrift(buildPluginDriftDiagnostics(state.current));
|
|
714
837
|
sendJsonResponse(res, 200, pluginResponse);
|
|
715
838
|
return true;
|
|
716
839
|
}
|
|
840
|
+
if (method === "GET" && url.pathname === "/api/plugins/diagnostics") {
|
|
841
|
+
if (!ensureCompatApiAuthorized(req, res)) {
|
|
842
|
+
return true;
|
|
843
|
+
}
|
|
844
|
+
const diagnostics = buildPluginDriftDiagnostics(state.current);
|
|
845
|
+
maybeLogPluginStateDrift(diagnostics);
|
|
846
|
+
sendJsonResponse(res, 200, diagnostics);
|
|
847
|
+
return true;
|
|
848
|
+
}
|
|
717
849
|
if (method === "PUT" && url.pathname.startsWith("/api/plugins/")) {
|
|
718
850
|
if (!ensureCompatApiAuthorized(req, res)) {
|
|
719
851
|
return true;
|
|
@@ -753,6 +885,10 @@ export async function handlePluginsCompatRoutes(req, res, state) {
|
|
|
753
885
|
result.payload.loadedPackages = runtimeApply.loadedPackages;
|
|
754
886
|
result.payload.unloadedPackages = runtimeApply.unloadedPackages;
|
|
755
887
|
result.payload.reloadedPackages = runtimeApply.reloadedPackages;
|
|
888
|
+
const diagnostics = buildPluginDriftDiagnostics(state.current);
|
|
889
|
+
if (diagnostics.summary.withDrift > 0) {
|
|
890
|
+
result.payload.diagnostics = diagnostics;
|
|
891
|
+
}
|
|
756
892
|
}
|
|
757
893
|
sendJsonResponse(res, result.status, result.payload);
|
|
758
894
|
return true;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../../typescript/src/plugin.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../../typescript/src/plugin.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAqCtC,wBAAsB,gBAAgB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAiF3E;AAED,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,MAAM,CAkB9D;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,OAAO,GAAG;IAChD,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,MAAM,EAAE,CAAC;CACjB,CAsDA;AAED,wBAAsB,oBAAoB,CACzC,UAAU,EAAE,MAAM,GAChB,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CA6DxB;AAED,wBAAgB,mBAAmB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAM9D;AAED,wBAAgB,yBAAyB,CACxC,gBAAgB,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,EACrC,UAAU,GAAE,OAAe,GACzB,MAAM,EAAE,CAuFV;AAED,wBAAsB,UAAU,CAC/B,YAAY,EAAE,MAAM,GAAG,MAAM,GAC3B,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAexB;AAiFD,wBAAsB,cAAc,CACnC,OAAO,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,EAC5B,UAAU,GAAE,OAAe,GACzB,OAAO,CAAC,MAAM,EAAE,CAAC,CAyBnB"}
|
|
@@ -9,6 +9,12 @@ var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExte
|
|
|
9
9
|
import { logger } from "./logger";
|
|
10
10
|
import { detectEnvironment } from "./utils/environment";
|
|
11
11
|
const attemptedInstalls = new Set();
|
|
12
|
+
function getBunRuntime() {
|
|
13
|
+
const bunRuntime = globalThis.Bun;
|
|
14
|
+
return bunRuntime && typeof bunRuntime.spawn === "function"
|
|
15
|
+
? bunRuntime
|
|
16
|
+
: null;
|
|
17
|
+
}
|
|
12
18
|
function isAutoInstallAllowed() {
|
|
13
19
|
if (process.env.ELIZA_NO_AUTO_INSTALL === "true")
|
|
14
20
|
return false;
|
|
@@ -33,12 +39,13 @@ export async function tryInstallPlugin(pluginName) {
|
|
|
33
39
|
return false;
|
|
34
40
|
}
|
|
35
41
|
attemptedInstalls.add(pluginName);
|
|
36
|
-
|
|
42
|
+
const bunRuntime = getBunRuntime();
|
|
43
|
+
if (!bunRuntime) {
|
|
37
44
|
logger.warn({ src: "core:plugin", pluginName }, "Bun runtime not available, cannot auto-install");
|
|
38
45
|
return false;
|
|
39
46
|
}
|
|
40
47
|
try {
|
|
41
|
-
const check =
|
|
48
|
+
const check = bunRuntime.spawn(["bun", "--version"], {
|
|
42
49
|
stdout: "pipe",
|
|
43
50
|
stderr: "pipe",
|
|
44
51
|
});
|
|
@@ -53,7 +60,7 @@ export async function tryInstallPlugin(pluginName) {
|
|
|
53
60
|
return false;
|
|
54
61
|
}
|
|
55
62
|
logger.info({ src: "core:plugin", pluginName }, "Auto-installing missing plugin");
|
|
56
|
-
const install =
|
|
63
|
+
const install = bunRuntime.spawn(["bun", "add", pluginName], {
|
|
57
64
|
cwd: process.cwd(),
|
|
58
65
|
env: process.env,
|
|
59
66
|
stdout: "inherit",
|