ofiere-openclaw-plugin 3.5.1 → 3.5.3

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/tools.ts +21 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ofiere-openclaw-plugin",
3
- "version": "3.5.1",
3
+ "version": "3.5.3",
4
4
  "type": "module",
5
5
  "description": "OpenClaw plugin for Ofiere PM - 10 meta-tools covering tasks, agents, projects, scheduling, knowledge, workflows, notifications, memory, prompts, and constellation agent architecture",
6
6
  "keywords": ["openclaw", "ofiere", "project-management", "agents", "plugin"],
package/src/tools.ts CHANGED
@@ -1705,6 +1705,22 @@ function registerConstellationOps(
1705
1705
  fs.existsSync("/data/.openclaw") ? "/data/.openclaw"
1706
1706
  : path.join(process.env.HOME || process.env.USERPROFILE || "/root", ".openclaw");
1707
1707
 
1708
+ // ── Resolve the `openclaw` CLI binary path ──
1709
+ // Inside Docker, the binary is NOT in PATH — we need the absolute path.
1710
+ const OPENCLAW_CLI = (() => {
1711
+ const candidates = [
1712
+ "/data/.npm-global/bin/openclaw", // Docker container (npm global)
1713
+ "/usr/local/bin/openclaw", // Standard global install
1714
+ path.join(process.env.HOME || "/root", ".npm-global/bin/openclaw"),
1715
+ path.join(process.env.HOME || "/root", "node_modules/.bin/openclaw"),
1716
+ ];
1717
+ for (const c of candidates) {
1718
+ try { if (fs.existsSync(c)) return c; } catch {}
1719
+ }
1720
+ // Last resort: hope it's in PATH (works for native installs)
1721
+ return "openclaw";
1722
+ })();
1723
+
1708
1724
  // ── Helpers ──
1709
1725
 
1710
1726
  function getWorkspacePath(agentName: string): string {
@@ -1952,7 +1968,7 @@ function registerConstellationOps(
1952
1968
  function tryRegisterAgent(agentName: string): { success: boolean; message: string } {
1953
1969
  const wsPath = getWorkspacePath(agentName);
1954
1970
  try {
1955
- const cmd = `openclaw agents add "${agentName}" --workspace "${wsPath}" --non-interactive 2>&1`;
1971
+ const cmd = `${OPENCLAW_CLI} agents add ${agentName} --workspace ${wsPath} --non-interactive 2>&1`;
1956
1972
  const output = execSync(cmd, { encoding: "utf8", timeout: 15000 });
1957
1973
  api.logger?.info?.(`[ofiere] Auto-registered agent "${agentName}": ${output.slice(0, 200)}`);
1958
1974
  return { success: true, message: `Agent "${agentName}" registered in OpenClaw` };
@@ -1963,7 +1979,7 @@ function registerConstellationOps(
1963
1979
  return { success: true, message: `Agent "${agentName}" was already registered` };
1964
1980
  }
1965
1981
  api.logger?.warn?.(`[ofiere] Auto-registration failed for "${agentName}": ${msg.slice(0, 300)}`);
1966
- return { success: false, message: `Auto-registration failed. Manual step: openclaw agents add "${agentName}" --workspace "${wsPath}"` };
1982
+ return { success: false, message: `Auto-registration failed: ${msg.slice(0, 200)}. CLI path: ${OPENCLAW_CLI}` };
1967
1983
  }
1968
1984
  }
1969
1985
 
@@ -2282,11 +2298,12 @@ function registerConstellationOps(
2282
2298
  // Unregister from OpenClaw (best-effort)
2283
2299
  let unregResult = { success: false, message: "" };
2284
2300
  try {
2285
- const cmd = `openclaw agents remove "${agentName}" --non-interactive 2>&1`;
2301
+ const cmd = `${OPENCLAW_CLI} agents delete ${agentName} --force 2>&1`;
2286
2302
  const output = execSync(cmd, { encoding: "utf8", timeout: 15000 });
2287
2303
  unregResult = { success: true, message: output.slice(0, 200) };
2288
2304
  } catch (e: any) {
2289
- unregResult = { success: false, message: `Manual step needed: openclaw agents remove "${agentName}"` };
2305
+ const emsg = e?.stderr || e?.stdout || String(e);
2306
+ unregResult = { success: false, message: `Unregistration failed: ${emsg.slice(0, 200)}. CLI path: ${OPENCLAW_CLI}` };
2290
2307
  }
2291
2308
 
2292
2309
  api.logger?.info?.(`[ofiere] Deleted agent "${agentName}" — ${deletedFiles.length} files removed`);