@a2hmarket/a2hmarket 0.3.0 → 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@a2hmarket/a2hmarket",
3
- "version": "0.3.0",
3
+ "version": "0.3.2",
4
4
  "type": "module",
5
5
  "description": "A2H Market OpenClaw plugin — AI agent marketplace with A2A messaging via MQTT.",
6
6
  "license": "MIT-0",
@@ -302,9 +302,39 @@ async function main() {
302
302
  try {
303
303
  const pluginDir = join(OPENCLAW_DIR, "extensions", "a2hmarket");
304
304
  if (existsSync(pluginDir)) {
305
- const openclawPath = execSync("dirname $(which openclaw)", { encoding: "utf-8" }).trim();
306
- const openclawPkg = join(openclawPath, "..", "lib", "node_modules", "openclaw");
307
- if (existsSync(openclawPkg)) {
305
+ // Find openclaw package resolve from the actual binary location
306
+ let openclawPkg = null;
307
+ try {
308
+ // Follow symlinks to find the real openclaw.mjs, then derive the package root
309
+ const realBin = execSync("realpath $(which openclaw) 2>/dev/null || readlink -f $(which openclaw) 2>/dev/null", { encoding: "utf-8" }).trim();
310
+ if (realBin) {
311
+ // openclaw.mjs is at {pkg}/openclaw.mjs or {pkg}/dist/cli/...
312
+ // Walk up until we find package.json with name "openclaw"
313
+ let dir = realBin;
314
+ for (let i = 0; i < 5; i++) {
315
+ dir = join(dir, "..");
316
+ const pj = join(dir, "package.json");
317
+ if (existsSync(pj)) {
318
+ try {
319
+ const pkg = JSON.parse(readFileSync(pj, "utf-8"));
320
+ if (pkg.name === "openclaw") { openclawPkg = dir; break; }
321
+ } catch {}
322
+ }
323
+ }
324
+ }
325
+ } catch {}
326
+
327
+ // Fallback: try common paths
328
+ if (!openclawPkg) {
329
+ for (const p of [
330
+ "/opt/homebrew/lib/node_modules/openclaw",
331
+ "/usr/local/lib/node_modules/openclaw",
332
+ ]) {
333
+ if (existsSync(join(p, "package.json"))) { openclawPkg = p; break; }
334
+ }
335
+ }
336
+
337
+ if (openclawPkg) {
308
338
  const symlinkDir = join(pluginDir, "node_modules");
309
339
  const symlinkTarget = join(symlinkDir, "openclaw");
310
340
  mkdirSync(symlinkDir, { recursive: true });
@@ -313,6 +343,7 @@ async function main() {
313
343
  log(` ${CHECK} openclaw/plugin-sdk 已链接`);
314
344
  } else {
315
345
  log(` ${WARN} 未找到 openclaw 包路径,服务可能无法启动`);
346
+ log(` ${DIM} 尝试过: ${candidates.slice(0, 3).join(", ")}${RESET}`);
316
347
  }
317
348
  }
318
349
  } catch (err) {