upgrade openclaw to 3.23 (#652)

Co-authored-by: Felix <24791380+vcfgv@users.noreply.github.com>
This commit is contained in:
paisley
2026-03-26 16:58:04 +08:00
committed by GitHub
Unverified
parent b786b773f1
commit ba5947e2cb
22 changed files with 2927 additions and 4739 deletions

View File

@@ -11,12 +11,24 @@ const require = createRequire(import.meta.url);
// Resolve dependencies from OpenClaw package context (pnpm-safe)
const openclawPath = getOpenClawDir();
const openclawResolvedPath = getOpenClawResolvedDir();
// Primary: resolves from openclaw's real (dereferenced) path in pnpm store.
// In packaged builds this is the flat `resources/openclaw/node_modules/`.
const openclawRequire = createRequire(join(openclawResolvedPath, 'package.json'));
// Fallback: resolves from the symlink path (`node_modules/openclaw`).
// In dev mode, Node walks UP from here to `<project>/node_modules/`, which
// contains ClawX's own devDependencies — packages that are NOT deps of openclaw
// (e.g. @whiskeysockets/baileys) become resolvable through pnpm hoisting.
const projectRequire = createRequire(join(openclawPath, 'package.json'));
function resolveOpenClawPackageJson(packageName: string): string {
const specifier = `${packageName}/package.json`;
// 1. Try openclaw's own deps (works in packaged mode + openclaw transitive deps)
try {
return openclawRequire.resolve(specifier);
} catch { /* fall through */ }
// 2. Fallback to project-level deps (works in dev mode for ClawX devDependencies)
try {
return projectRequire.resolve(specifier);
} catch (err) {
const reason = err instanceof Error ? err.message : String(err);
throw new Error(