ofiere-openclaw-plugin 3.5.4 → 3.5.5
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 +33 -35
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ofiere-openclaw-plugin",
|
|
3
|
-
"version": "3.5.
|
|
3
|
+
"version": "3.5.5",
|
|
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
|
@@ -1697,7 +1697,7 @@ function registerConstellationOps(
|
|
|
1697
1697
|
// Resolve the OpenClaw data directory — the plugin runs inside the gateway process
|
|
1698
1698
|
const fs = require("fs");
|
|
1699
1699
|
const path = require("path");
|
|
1700
|
-
const {
|
|
1700
|
+
const { spawnSync } = require("child_process");
|
|
1701
1701
|
|
|
1702
1702
|
// OpenClaw stores data at /data/.openclaw/ inside the Docker container
|
|
1703
1703
|
// Fallback: check HOME/.openclaw/ for local dev
|
|
@@ -1967,28 +1967,27 @@ function registerConstellationOps(
|
|
|
1967
1967
|
|
|
1968
1968
|
function tryRegisterAgent(agentName: string): { success: boolean; message: string } {
|
|
1969
1969
|
const wsPath = getWorkspacePath(agentName);
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1970
|
+
// Use spawnSync instead of execSync: spawnSync never throws on non-zero
|
|
1971
|
+
// exit codes, giving us clean access to stdout/stderr/status regardless
|
|
1972
|
+
// of CLI config warnings that cause non-zero exits.
|
|
1973
|
+
const result = spawnSync(OPENCLAW_CLI, [
|
|
1974
|
+
"agents", "add", agentName, "--workspace", wsPath, "--non-interactive",
|
|
1975
|
+
], { encoding: "utf8", timeout: 15000 });
|
|
1976
|
+
|
|
1977
|
+
const stdout = result.stdout || "";
|
|
1978
|
+
const stderr = result.stderr || "";
|
|
1979
|
+
const combined = stdout + "\n" + stderr;
|
|
1980
|
+
|
|
1981
|
+
// Success indicators: JSON with agentId, agent name present, or zero exit
|
|
1982
|
+
if (result.status === 0 || combined.includes('"agentId"') || combined.includes(`"${agentName}"`)) {
|
|
1983
|
+
api.logger?.info?.(`[ofiere] Auto-registered agent "${agentName}": ${stdout.slice(0, 200)}`);
|
|
1974
1984
|
return { success: true, message: `Agent "${agentName}" registered in OpenClaw` };
|
|
1975
|
-
} catch (e: any) {
|
|
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")) {
|
|
1987
|
-
return { success: true, message: `Agent "${agentName}" was already registered` };
|
|
1988
|
-
}
|
|
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)}` };
|
|
1991
1985
|
}
|
|
1986
|
+
if (combined.includes("already exists") || combined.includes("duplicate")) {
|
|
1987
|
+
return { success: true, message: `Agent "${agentName}" was already registered` };
|
|
1988
|
+
}
|
|
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)}` };
|
|
1992
1991
|
}
|
|
1993
1992
|
|
|
1994
1993
|
// ── Register the tool ──
|
|
@@ -2304,21 +2303,20 @@ function registerConstellationOps(
|
|
|
2304
2303
|
}
|
|
2305
2304
|
|
|
2306
2305
|
// Unregister from OpenClaw (best-effort)
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2306
|
+
// Use spawnSync: never throws, gives clean stdout/stderr/status
|
|
2307
|
+
const unregCmd = spawnSync(OPENCLAW_CLI, [
|
|
2308
|
+
"agents", "delete", agentName, "--force",
|
|
2309
|
+
], { encoding: "utf8", timeout: 15000 });
|
|
2310
|
+
|
|
2311
|
+
const unregStdout = unregCmd.stdout || "";
|
|
2312
|
+
const unregStderr = unregCmd.stderr || "";
|
|
2313
|
+
const unregCombined = unregStdout + "\n" + unregStderr;
|
|
2314
|
+
|
|
2315
|
+
let unregResult: { success: boolean; message: string };
|
|
2316
|
+
if (unregCmd.status === 0 || unregCombined.includes('"agentId"') || unregCombined.includes(`"${agentName}"`)) {
|
|
2311
2317
|
unregResult = { success: true, message: `Agent "${agentName}" unregistered from OpenClaw` };
|
|
2312
|
-
}
|
|
2313
|
-
|
|
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
|
-
}
|
|
2318
|
+
} else {
|
|
2319
|
+
unregResult = { success: false, message: `Unregistration may have failed: ${unregCombined.slice(0, 200)}` };
|
|
2322
2320
|
}
|
|
2323
2321
|
|
|
2324
2322
|
api.logger?.info?.(`[ofiere] Deleted agent "${agentName}" — ${deletedFiles.length} files removed`);
|