mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 15:21:35 +00:00
fix(cli): clear plugin manifest cache after install
This commit is contained in:
@@ -9,6 +9,7 @@ import { resolveStateDir } from "../config/paths.js";
|
|||||||
import { resolveArchiveKind } from "../infra/archive.js";
|
import { resolveArchiveKind } from "../infra/archive.js";
|
||||||
import { installPluginFromNpmSpec, installPluginFromPath } from "../plugins/install.js";
|
import { installPluginFromNpmSpec, installPluginFromPath } from "../plugins/install.js";
|
||||||
import { recordPluginInstall } from "../plugins/installs.js";
|
import { recordPluginInstall } from "../plugins/installs.js";
|
||||||
|
import { clearPluginManifestRegistryCache } from "../plugins/manifest-registry.js";
|
||||||
import { applyExclusiveSlotSelection } from "../plugins/slots.js";
|
import { applyExclusiveSlotSelection } from "../plugins/slots.js";
|
||||||
import { resolvePluginSourceRoots, formatPluginSourceForTable } from "../plugins/source-display.js";
|
import { resolvePluginSourceRoots, formatPluginSourceForTable } from "../plugins/source-display.js";
|
||||||
import { buildPluginStatusReport } from "../plugins/status.js";
|
import { buildPluginStatusReport } from "../plugins/status.js";
|
||||||
@@ -591,6 +592,9 @@ export function registerPluginsCli(program: Command) {
|
|||||||
defaultRuntime.error(result.error);
|
defaultRuntime.error(result.error);
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
|
// Plugin CLI registrars may have warmed the manifest registry cache before install;
|
||||||
|
// force a rescan so config validation sees the freshly installed plugin.
|
||||||
|
clearPluginManifestRegistryCache();
|
||||||
|
|
||||||
let next = enablePluginInConfig(cfg, result.pluginId);
|
let next = enablePluginInConfig(cfg, result.pluginId);
|
||||||
const source: "archive" | "path" = resolveArchiveKind(resolved) ? "archive" : "path";
|
const source: "archive" | "path" = resolveArchiveKind(resolved) ? "archive" : "path";
|
||||||
@@ -640,6 +644,8 @@ export function registerPluginsCli(program: Command) {
|
|||||||
defaultRuntime.error(result.error);
|
defaultRuntime.error(result.error);
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
|
// Ensure config validation sees newly installed plugin(s) even if the cache was warmed at startup.
|
||||||
|
clearPluginManifestRegistryCache();
|
||||||
|
|
||||||
let next = enablePluginInConfig(cfg, result.pluginId);
|
let next = enablePluginInConfig(cfg, result.pluginId);
|
||||||
next = recordPluginInstall(next, {
|
next = recordPluginInstall(next, {
|
||||||
|
|||||||
@@ -61,6 +61,10 @@ const registryCache = new Map<string, { expiresAt: number; registry: PluginManif
|
|||||||
|
|
||||||
const DEFAULT_MANIFEST_CACHE_MS = 200;
|
const DEFAULT_MANIFEST_CACHE_MS = 200;
|
||||||
|
|
||||||
|
export function clearPluginManifestRegistryCache(): void {
|
||||||
|
registryCache.clear();
|
||||||
|
}
|
||||||
|
|
||||||
function resolveManifestCacheMs(env: NodeJS.ProcessEnv): number {
|
function resolveManifestCacheMs(env: NodeJS.ProcessEnv): number {
|
||||||
const raw = env.OPENCLAW_PLUGIN_MANIFEST_CACHE_MS?.trim();
|
const raw = env.OPENCLAW_PLUGIN_MANIFEST_CACHE_MS?.trim();
|
||||||
if (raw === "" || raw === "0") {
|
if (raw === "" || raw === "0") {
|
||||||
|
|||||||
Reference in New Issue
Block a user