
























@@ -1,8 +1,11 @@
1+import path from "node:path";
12import { resolveAgentWorkspaceDir, resolveDefaultAgentId } from "../../../agents/agent-scope.js";
23import type { OpenClawConfig } from "../../../config/types.openclaw.js";
34import {
45buildBundledPluginLoadPathAliases,
56normalizeBundledLookupPath,
7+parseLegacyBundledPluginPath,
8+parsePackagedBundledPluginPath,
69} from "../../../plugins/bundled-load-path-aliases.js";
710import { resolveBundledPluginSources } from "../../../plugins/bundled-sources.js";
811import { sanitizeForLog } from "../../../terminal/ansi.js";
@@ -20,6 +23,13 @@ function resolveBundledWorkspaceDir(cfg: OpenClawConfig): string | undefined {
2023return resolveAgentWorkspaceDir(cfg, resolveDefaultAgentId(cfg)) ?? undefined;
2124}
222526+function isOpenClawNodeModulesPackageRoot(packageRoot: string): boolean {
27+const normalized = normalizeBundledLookupPath(packageRoot);
28+const packageDir = path.basename(normalized);
29+const parentDir = path.basename(path.dirname(normalized));
30+return packageDir === "openclaw" && parentDir === "node_modules";
31+}
32+2333export function scanBundledPluginLoadPathMigrations(
2434cfg: OpenClawConfig,
2535env: NodeJS.ProcessEnv = process.env,
@@ -40,13 +50,21 @@ export function scanBundledPluginLoadPathMigrations(
4050}
41514252const bundledPathMap = new Map<string, { pluginId: string; toPath: string }>();
53+const packagedBundledLeafMap = new Map<string, { pluginId: string; toPath: string }>();
4354for (const source of bundled.values()) {
4455for (const alias of buildBundledPluginLoadPathAliases(source.localPath)) {
4556bundledPathMap.set(normalizeBundledLookupPath(alias.path), {
4657pluginId: source.pluginId,
4758toPath: source.localPath,
4859});
4960}
61+const packaged = parsePackagedBundledPluginPath(source.localPath);
62+if (packaged) {
63+packagedBundledLeafMap.set(normalizeBundledLookupPath(packaged.bundledLeaf), {
64+pluginId: source.pluginId,
65+toPath: source.localPath,
66+});
67+}
5068}
51695270const hits: BundledPluginLoadPathHit[] = [];
@@ -57,6 +75,23 @@ export function scanBundledPluginLoadPathMigrations(
5775const normalized = normalizeBundledLookupPath(resolveUserPath(rawPath, env));
5876const match = bundledPathMap.get(normalized);
5977if (!match) {
78+const oldPackaged = parsePackagedBundledPluginPath(normalized);
79+const oldLegacy = oldPackaged ? null : parseLegacyBundledPluginPath(normalized);
80+const oldPackageRoot = oldPackaged?.packageRoot ?? oldLegacy?.packageRoot;
81+const oldBundledLeaf = oldPackaged?.bundledLeaf ?? oldLegacy?.bundledLeaf;
82+const oldPackageMatch =
83+oldPackageRoot && oldBundledLeaf && isOpenClawNodeModulesPackageRoot(oldPackageRoot)
84+ ? packagedBundledLeafMap.get(normalizeBundledLookupPath(oldBundledLeaf))
85+ : undefined;
86+if (!oldPackageMatch) {
87+continue;
88+}
89+hits.push({
90+pluginId: oldPackageMatch.pluginId,
91+fromPath: rawPath,
92+toPath: oldPackageMatch.toPath,
93+pathLabel: "plugins.load.paths",
94+});
6095continue;
6196}
6297hits.push({
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。