@vectorize-io/self-driving-agents 0.0.3 → 0.0.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.
Files changed (2) hide show
  1. package/dist/cli.js +40 -6
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -62,7 +62,7 @@ async function resolveAgentDir(input, spinner) {
62
62
  const dir = resolve(input.replace(/^~/, homedir()));
63
63
  if (!existsSync(dir))
64
64
  throw new Error(`Directory not found: ${dir}`);
65
- return { dir, source: dir };
65
+ return { dir, source: dir, defaultName: basename(dir) };
66
66
  }
67
67
  // Parse GitHub reference: "name" or "org/repo/path/to/agent"
68
68
  const parts = input.split("/");
@@ -98,8 +98,9 @@ async function resolveAgentDir(input, spinner) {
98
98
  throw new Error(`Path '${subpath}' not found in ${org}/${repo}`);
99
99
  }
100
100
  const source = `github.com/${org}/${repo}/${subpath}`;
101
+ const defaultName = subpath.replace(/\//g, "-");
101
102
  spinner.stop(`Fetched ${color.cyan(source)}`);
102
- return { dir, source, cleanup: () => rmSync(tmp, { recursive: true, force: true }) };
103
+ return { dir, source, defaultName, cleanup: () => rmSync(tmp, { recursive: true, force: true }) };
103
104
  }
104
105
  // ── Skill ───────────────────────────────────────────────
105
106
  const __dirname = dirname(fileURLToPath(import.meta.url));
@@ -124,6 +125,30 @@ function enableKnowledgeTools() {
124
125
  pc.enableKnowledgeTools = true;
125
126
  writeFileSync(OPENCLAW_CONFIG_PATH, JSON.stringify(config, null, 2) + "\n");
126
127
  }
128
+ const MIN_PLUGIN_VERSION = "0.7.0";
129
+ function getInstalledPluginVersion() {
130
+ try {
131
+ // Check the installed plugin's package.json
132
+ const extDir = join(homedir(), ".openclaw", "extensions", "hindsight-openclaw");
133
+ const pkgPath = join(extDir, "package.json");
134
+ if (!existsSync(pkgPath))
135
+ return null;
136
+ const pkg = JSON.parse(readFileSync(pkgPath, "utf-8"));
137
+ return pkg.version || null;
138
+ }
139
+ catch {
140
+ return null;
141
+ }
142
+ }
143
+ function versionGte(current, required) {
144
+ const [aMaj, aMin, aPat] = current.split(".").map(Number);
145
+ const [bMaj, bMin, bPat] = required.split(".").map(Number);
146
+ if (aMaj !== bMaj)
147
+ return aMaj > bMaj;
148
+ if (aMin !== bMin)
149
+ return aMin > bMin;
150
+ return aPat >= bPat;
151
+ }
127
152
  function isPluginInstalled() {
128
153
  const config = readOpenClawConfig();
129
154
  if (!config)
@@ -180,8 +205,17 @@ function parseAgentsJson(raw) {
180
205
  return JSON.parse(jsonStr);
181
206
  }
182
207
  async function ensurePlugin() {
183
- if (!isPluginInstalled()) {
184
- p.log.warn("Hindsight plugin not found. Installing...");
208
+ const installed = isPluginInstalled();
209
+ const currentVersion = installed ? getInstalledPluginVersion() : null;
210
+ const needsInstall = !installed;
211
+ const needsUpgrade = installed && currentVersion && !versionGte(currentVersion, MIN_PLUGIN_VERSION);
212
+ if (needsInstall || needsUpgrade) {
213
+ if (needsUpgrade) {
214
+ p.log.warn(`Hindsight plugin v${currentVersion} is outdated (need >=${MIN_PLUGIN_VERSION}). Upgrading...`);
215
+ }
216
+ else {
217
+ p.log.warn("Hindsight plugin not found. Installing...");
218
+ }
185
219
  try {
186
220
  execSync("openclaw plugins install @vectorize-io/hindsight-openclaw", { stdio: "inherit" });
187
221
  }
@@ -270,9 +304,9 @@ async function main() {
270
304
  p.intro(color.bgCyan(color.black(` self-driving-agents `)));
271
305
  // Step 0: Resolve agent directory (local or GitHub)
272
306
  const spin = p.spinner();
273
- const { dir, source, cleanup } = await resolveAgentDir(dirArg, spin);
307
+ const { dir, source, defaultName, cleanup } = await resolveAgentDir(dirArg, spin);
274
308
  try {
275
- const agentId = agentName || basename(dir);
309
+ const agentId = agentName || defaultName;
276
310
  // Step 1: Ensure plugin
277
311
  if (harness === "openclaw") {
278
312
  await ensurePlugin();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vectorize-io/self-driving-agents",
3
- "version": "0.0.3",
3
+ "version": "0.0.5",
4
4
  "description": "Install self-driving agents with portable memory on any harness",
5
5
  "type": "module",
6
6
  "main": "dist/cli.js",