ofiere-openclaw-plugin 3.5.2 → 3.5.4
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 +1 -1
- package/src/tools.ts +41 -9
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ofiere-openclaw-plugin",
|
|
3
|
-
"version": "3.5.
|
|
3
|
+
"version": "3.5.4",
|
|
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,18 +1968,26 @@ function registerConstellationOps(
|
|
|
1952
1968
|
function tryRegisterAgent(agentName: string): { success: boolean; message: string } {
|
|
1953
1969
|
const wsPath = getWorkspacePath(agentName);
|
|
1954
1970
|
try {
|
|
1955
|
-
const cmd =
|
|
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` };
|
|
1959
1975
|
} catch (e: any) {
|
|
1960
|
-
|
|
1961
|
-
// Check
|
|
1962
|
-
|
|
1976
|
+
// OpenClaw CLI may exit non-zero due to config warnings even when the
|
|
1977
|
+
// actual operation succeeded. Check the combined stdout+stderr for
|
|
1978
|
+
// success indicators before reporting failure.
|
|
1979
|
+
const combined = [e?.stdout, e?.stderr, e?.output?.join?.("\n"), String(e)]
|
|
1980
|
+
.filter(Boolean).join("\n");
|
|
1981
|
+
// Success indicators: JSON output with agentId, or "already exists"
|
|
1982
|
+
if (combined.includes(`"agentId"`) || combined.includes(`"${agentName}"`)) {
|
|
1983
|
+
api.logger?.info?.(`[ofiere] Auto-registered agent "${agentName}" (exit non-zero but output confirms success)`);
|
|
1984
|
+
return { success: true, message: `Agent "${agentName}" registered in OpenClaw` };
|
|
1985
|
+
}
|
|
1986
|
+
if (combined.includes("already exists") || combined.includes("duplicate")) {
|
|
1963
1987
|
return { success: true, message: `Agent "${agentName}" was already registered` };
|
|
1964
1988
|
}
|
|
1965
|
-
api.logger?.warn?.(`[ofiere] Auto-registration failed for "${agentName}": ${
|
|
1966
|
-
return { success: false, message: `Auto-registration failed
|
|
1989
|
+
api.logger?.warn?.(`[ofiere] Auto-registration failed for "${agentName}": ${combined.slice(0, 300)}`);
|
|
1990
|
+
return { success: false, message: `Auto-registration failed: ${combined.slice(0, 200)}` };
|
|
1967
1991
|
}
|
|
1968
1992
|
}
|
|
1969
1993
|
|
|
@@ -2282,11 +2306,19 @@ function registerConstellationOps(
|
|
|
2282
2306
|
// Unregister from OpenClaw (best-effort)
|
|
2283
2307
|
let unregResult = { success: false, message: "" };
|
|
2284
2308
|
try {
|
|
2285
|
-
const cmd =
|
|
2309
|
+
const cmd = `${OPENCLAW_CLI} agents delete ${agentName} --force 2>&1`;
|
|
2286
2310
|
const output = execSync(cmd, { encoding: "utf8", timeout: 15000 });
|
|
2287
|
-
unregResult = { success: true, message:
|
|
2311
|
+
unregResult = { success: true, message: `Agent "${agentName}" unregistered from OpenClaw` };
|
|
2288
2312
|
} catch (e: any) {
|
|
2289
|
-
|
|
2313
|
+
// OpenClaw CLI may exit non-zero due to config warnings even when
|
|
2314
|
+
// the delete operation succeeded. Check output for success indicators.
|
|
2315
|
+
const combined = [e?.stdout, e?.stderr, e?.output?.join?.("\n"), String(e)]
|
|
2316
|
+
.filter(Boolean).join("\n");
|
|
2317
|
+
if (combined.includes(`"agentId"`) || combined.includes(`"${agentName}"`)) {
|
|
2318
|
+
unregResult = { success: true, message: `Agent "${agentName}" unregistered from OpenClaw` };
|
|
2319
|
+
} else {
|
|
2320
|
+
unregResult = { success: false, message: `Unregistration may have failed: ${combined.slice(0, 200)}` };
|
|
2321
|
+
}
|
|
2290
2322
|
}
|
|
2291
2323
|
|
|
2292
2324
|
api.logger?.info?.(`[ofiere] Deleted agent "${agentName}" — ${deletedFiles.length} files removed`);
|