@vectorize-io/self-driving-agents 0.0.4 → 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 +35 -2
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -125,6 +125,30 @@ 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";
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
+ }
128
152
  function isPluginInstalled() {
129
153
  const config = readOpenClawConfig();
130
154
  if (!config)
@@ -181,8 +205,17 @@ function parseAgentsJson(raw) {
181
205
  return JSON.parse(jsonStr);
182
206
  }
183
207
  async function ensurePlugin() {
184
- if (!isPluginInstalled()) {
185
- 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
+ }
186
219
  try {
187
220
  execSync("openclaw plugins install @vectorize-io/hindsight-openclaw", { stdio: "inherit" });
188
221
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vectorize-io/self-driving-agents",
3
- "version": "0.0.4",
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",