Self-evolving Context Database for AI Agents. Unify Agent Memory, Knowledge RAG and Skills.
Python agent-contextagent-memoryagent-pluginsagentic-ragcontext-databasedsh-pluginknowledge-basememorymemory-managementself-evolvingvector-database
fix(openclaw): add plugin load path before enable (#1913)
Mingjian Que0a960dc53862
diff --git a/examples/openclaw-plugin/setup-helper/install.js b/examples/openclaw-plugin/setup-helper/install.jsindex a75ee2212..a50a27796 100755--- a/examples/openclaw-plugin/setup-helper/install.js+++ b/examples/openclaw-plugin/setup-helper/install.js@@ -1768,6 +1768,53 @@ async function cleanupConflictingPluginVariants() {info(tr("Conflicting plugin variants cleaned up", "冲突的插件变体已清理"));}+function normalizeOpenClawLoadPath(filePath) {+ return String(filePath || "")+ .replace(/\\/g, "/")+ .replace(/\/+$/g, "");+}++async function ensureOpenClawPluginLoadPath() {+ const configPath = getOpenClawConfigPath();+ let cfg = {};+ if (existsSync(configPath)) {+ try {+ cfg = JSON.parse(await readFile(configPath, "utf8"));+ } catch {+ return;+ }+ }++ const pluginPath = PLUGIN_DEST;+ const normalizedPluginPath = normalizeOpenClawLoadPath(pluginPath);+ const plugins = cfg.plugins && typeof cfg.plugins === "object" && !Array.isArray(cfg.plugins)+ ? cfg.plugins+ : {};+ const load = plugins.load && typeof plugins.load === "object" && !Array.isArray(plugins.load)+ ? plugins.load+ : {};+ const paths = Array.isArray(load.paths) ? load.paths : [];+ if (paths.some((item) => normalizeOpenClawLoadPath(item) === normalizedPluginPath)) {+ return;+ }++ const next = {+ ...cfg,+ plugins: {+ ...plugins,+ load: {+ ...load,+ paths: [...paths, pluginPath],+ },+ },+ };+ await mkdir(dirname(configPath), { recursive: true });+ const tmp = `${configPath}.ov-install-tmp.${process.pid}`;+ await writeFile(tmp, `${JSON.stringify(next, null, 2)}\n`, "utf8");+ await rename(tmp, configPath);+ info(tr(`Added OpenClaw plugin load path: ${pluginPath}`, `已添加 OpenClaw 插件加载路径: ${pluginPath}`));+}+async function configureOpenClawPlugin({preserveExistingConfig = false,runtimeConfig = null,@@ -1821,6 +1868,8 @@ async function configureOpenClawPlugin({await scrubStaleOpenClawPluginRegistration();}+ await ensureOpenClawPluginLoadPath();+// Enable plugin: try CLI first (default path), fall back to direct file for --workdirif (!needWorkdirFlag) {try {