mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 12:50:42 +00:00
fix(plugins): recover source-only install shadows
This commit is contained in:
@@ -421,7 +421,7 @@ function isTerminalPluginInstallSecurityFailure(code?: string): boolean {
|
||||
);
|
||||
}
|
||||
|
||||
function isAllowedBundledRecoveryIssue(
|
||||
function isAllowedPluginRecoveryIssue(
|
||||
issue: { path?: string; message?: string },
|
||||
request: PluginInstallRequestContext,
|
||||
): boolean {
|
||||
@@ -434,7 +434,10 @@ function isAllowedBundledRecoveryIssue(
|
||||
issue.message === `unknown channel id: ${pluginId}`) ||
|
||||
(issue.path === "plugins.load.paths" &&
|
||||
typeof issue.message === "string" &&
|
||||
issue.message.includes("plugin path not found"))
|
||||
issue.message.includes("plugin path not found")) ||
|
||||
(issue.path === "plugins" &&
|
||||
typeof issue.message === "string" &&
|
||||
issue.message.includes("requires compiled runtime output"))
|
||||
);
|
||||
}
|
||||
|
||||
@@ -448,7 +451,7 @@ async function loadConfigFromSnapshotForInstall(
|
||||
request: PluginInstallRequestContext,
|
||||
snapshot: Awaited<ReturnType<typeof readConfigFileSnapshot>>,
|
||||
): Promise<ConfigSnapshotForInstallPersist> {
|
||||
if (resolvePluginInstallInvalidConfigPolicy(request) !== "allow-bundled-recovery") {
|
||||
if (resolvePluginInstallInvalidConfigPolicy(request) !== "allow-plugin-recovery") {
|
||||
throw buildInvalidPluginInstallConfigError(
|
||||
"Config invalid; run `openclaw doctor --fix` before installing plugins.",
|
||||
);
|
||||
@@ -462,11 +465,11 @@ async function loadConfigFromSnapshotForInstall(
|
||||
if (
|
||||
snapshot.legacyIssues.length > 0 ||
|
||||
snapshot.issues.length === 0 ||
|
||||
snapshot.issues.some((issue) => !isAllowedBundledRecoveryIssue(issue, request))
|
||||
snapshot.issues.some((issue) => !isAllowedPluginRecoveryIssue(issue, request))
|
||||
) {
|
||||
const pluginLabel = request.bundledPluginId ?? "the requested plugin";
|
||||
throw buildInvalidPluginInstallConfigError(
|
||||
`Config invalid outside the bundled recovery path for ${pluginLabel}; run \`openclaw doctor --fix\` before reinstalling it.`,
|
||||
`Config invalid outside the plugin recovery path for ${pluginLabel}; run \`openclaw doctor --fix\` before reinstalling it.`,
|
||||
);
|
||||
}
|
||||
let nextConfig = snapshot.config;
|
||||
|
||||
Reference in New Issue
Block a user