Files
openclaw/src/cli/plugin-registry-loader.ts
Peter Steinberger 250376f885 fix: simplify bundled runtime dependency repair (#75183)
Summary:
- Merged fix: simplify bundled runtime dependency repair after ClawSweeper review.

ClawSweeper fixups:
- Included follow-up commit: fix: verify cached bundled runtime roots
- Included follow-up commit: refactor: simplify plugin runtime startup paths
- Included follow-up commit: refactor: trim plugin startup policy helpers
- Included follow-up commit: refactor: trust package manager runtime deps materialization
- Included follow-up commit: fix: narrow channel runtime deps skip policy
- Included follow-up commit: refactor: defer startup plugin runtime deps
- Ran the ClawSweeper repair loop before final review.

Validation:
- ClawSweeper review passed for head 04dc566534.
- Required merge gates passed before the squash merge.

Prepared head SHA: 04dc566534
Review: https://github.com/openclaw/openclaw/pull/75183#issuecomment-4358383786

Co-authored-by: Peter Steinberger <steipete@gmail.com>
Co-authored-by: Shakker <shakkerdroid@gmail.com>
Co-authored-by: clawsweeper-repair <clawsweeper-repair@users.noreply.github.com>
2026-05-01 07:49:02 +00:00

44 lines
1.5 KiB
TypeScript

import type { OpenClawConfig } from "../config/types.openclaw.js";
import { loggingState } from "../logging/state.js";
import type { CliPluginRegistryScope } from "./command-catalog.js";
let pluginRegistryModulePromise: Promise<typeof import("./plugin-registry.js")> | undefined;
function loadPluginRegistryModule() {
pluginRegistryModulePromise ??= import("./plugin-registry.js");
return pluginRegistryModulePromise;
}
export type CliPluginRegistryLoadPolicy = {
scope: CliPluginRegistryScope;
installBundledRuntimeDeps?: boolean;
};
export async function ensureCliPluginRegistryLoaded(params: {
scope: CliPluginRegistryScope;
routeLogsToStderr?: boolean;
config?: OpenClawConfig;
activationSourceConfig?: OpenClawConfig;
installBundledRuntimeDeps?: boolean;
}) {
const { ensurePluginRegistryLoaded } = await loadPluginRegistryModule();
const previousForceStderr = loggingState.forceConsoleToStderr;
if (params.routeLogsToStderr) {
loggingState.forceConsoleToStderr = true;
}
try {
ensurePluginRegistryLoaded({
scope: params.scope,
...(params.config ? { config: params.config } : {}),
...(params.activationSourceConfig
? { activationSourceConfig: params.activationSourceConfig }
: {}),
...(params.installBundledRuntimeDeps !== undefined
? { installBundledRuntimeDeps: params.installBundledRuntimeDeps }
: {}),
});
} finally {
loggingState.forceConsoleToStderr = previousForceStderr;
}
}