From b8a00774d45c02fe7923c7b6b1fd2e287a2b96dd Mon Sep 17 00:00:00 2001 From: jlin53882 Date: Fri, 10 Apr 2026 01:14:59 +0800 Subject: [PATCH] fix: add Windows APPDATA path fallback for extensionAPI.js On Windows, npm global packages are installed to %APPDATA%\npm\node_modules\. This change adds automatic detection of this path when running on Windows, eliminating the need for users to manually set OPENCLAW_EXTENSION_API_PATH. Fixes #575 --- index.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/index.ts b/index.ts index 4d3bc46b..7f9fadae 100644 --- a/index.ts +++ b/index.ts @@ -431,6 +431,11 @@ function getExtensionApiImportSpecifiers(): string[] { specifiers.push(toImportSpecifier("/usr/local/lib/node_modules/openclaw/dist/extensionAPI.js")); specifiers.push(toImportSpecifier("/opt/homebrew/lib/node_modules/openclaw/dist/extensionAPI.js")); + if (process.platform === "win32" && process.env.APPDATA) { + const windowsNpmPath = join(process.env.APPDATA, "npm", "node_modules", "openclaw", "dist", "extensionAPI.js"); + specifiers.push(toImportSpecifier(windowsNpmPath)); + } + return [...new Set(specifiers.filter(Boolean))]; }