@vectorize-io/self-driving-agents 0.0.5 → 0.0.6

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/dist/cli.js +31 -7
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -125,7 +125,7 @@ function enableKnowledgeTools() {
125
125
  pc.enableKnowledgeTools = true;
126
126
  writeFileSync(OPENCLAW_CONFIG_PATH, JSON.stringify(config, null, 2) + "\n");
127
127
  }
128
- const MIN_PLUGIN_VERSION = "0.7.0";
128
+ const MIN_PLUGIN_VERSION = "0.7.2";
129
129
  function getInstalledPluginVersion() {
130
130
  try {
131
131
  // Check the installed plugin's package.json
@@ -153,8 +153,11 @@ function isPluginInstalled() {
153
153
  const config = readOpenClawConfig();
154
154
  if (!config)
155
155
  return false;
156
- return (config.plugins?.entries?.["hindsight-openclaw"]?.enabled !== false &&
157
- config.plugins?.entries?.["hindsight-openclaw"] !== undefined);
156
+ const hasConfig = config.plugins?.entries?.["hindsight-openclaw"]?.enabled !== false &&
157
+ config.plugins?.entries?.["hindsight-openclaw"] !== undefined;
158
+ // Also check the extension dir actually exists (may have been deleted during a failed upgrade)
159
+ const extDir = join(homedir(), ".openclaw", "extensions", "hindsight-openclaw");
160
+ return hasConfig && existsSync(extDir);
158
161
  }
159
162
  function isPluginConfigured() {
160
163
  const config = readOpenClawConfig();
@@ -217,13 +220,28 @@ async function ensurePlugin() {
217
220
  p.log.warn("Hindsight plugin not found. Installing...");
218
221
  }
219
222
  try {
223
+ // Remove old extension if present — openclaw doesn't support in-place upgrade
224
+ const extDir = join(homedir(), ".openclaw", "extensions", "hindsight-openclaw");
225
+ rmSync(extDir, { recursive: true, force: true });
226
+ // Temporarily clear plugins.slots.memory so openclaw doesn't reject
227
+ // the config while the extension is missing
228
+ const cfg = readOpenClawConfig();
229
+ if (cfg?.plugins?.slots?.memory === "hindsight-openclaw") {
230
+ delete cfg.plugins.slots.memory;
231
+ writeFileSync(OPENCLAW_CONFIG_PATH, JSON.stringify(cfg, null, 2) + "\n");
232
+ }
220
233
  execSync("openclaw plugins install @vectorize-io/hindsight-openclaw", { stdio: "inherit" });
234
+ const newVersion = getInstalledPluginVersion();
235
+ p.log.success(`Hindsight plugin v${newVersion} installed`);
221
236
  }
222
237
  catch {
223
238
  p.cancel("Failed to install plugin. Run manually:\n openclaw plugins install @vectorize-io/hindsight-openclaw");
224
239
  process.exit(1);
225
240
  }
226
241
  }
242
+ else if (currentVersion) {
243
+ p.log.info(`Hindsight plugin v${currentVersion}`);
244
+ }
227
245
  if (!isPluginConfigured()) {
228
246
  p.log.warn("Hindsight plugin needs configuration.");
229
247
  try {
@@ -380,11 +398,15 @@ async function main() {
380
398
  p.log.success("Knowledge skill installed");
381
399
  if (harness === "openclaw") {
382
400
  try {
383
- const listOut = execSync("openclaw agents list --json 2>/dev/null", { encoding: "utf-8" });
401
+ const listOut = execSync("openclaw agents list --json", {
402
+ encoding: "utf-8",
403
+ stdio: ["pipe", "pipe", "pipe"],
404
+ });
384
405
  const agents = parseAgentsJson(listOut);
385
406
  if (!agents.some((a) => a.name === agentId || a.id === agentId)) {
386
407
  execSync(`openclaw agents add ${agentId} --workspace ${workspaceDir} --non-interactive`, {
387
- stdio: "pipe",
408
+ encoding: "utf-8",
409
+ stdio: ["pipe", "pipe", "pipe"],
388
410
  });
389
411
  p.log.success(`Agent '${agentId}' created`);
390
412
  }
@@ -392,8 +414,10 @@ async function main() {
392
414
  p.log.info(`Agent '${agentId}' already exists`);
393
415
  }
394
416
  }
395
- catch {
396
- p.log.warn(`Create agent manually:\n openclaw agents add ${agentId} --workspace ${workspaceDir} --non-interactive`);
417
+ catch (err) {
418
+ const stderr = err?.stderr?.toString?.()?.trim() || "";
419
+ const msg = stderr || err?.message || String(err);
420
+ p.log.warn(`Failed to manage agent: ${msg}\n Create manually:\n openclaw agents add ${agentId} --workspace ${workspaceDir} --non-interactive`);
397
421
  }
398
422
  }
399
423
  // Step 7: Patch startup
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vectorize-io/self-driving-agents",
3
- "version": "0.0.5",
3
+ "version": "0.0.6",
4
4
  "description": "Install self-driving agents with portable memory on any harness",
5
5
  "type": "module",
6
6
  "main": "dist/cli.js",