@vectorize-io/self-driving-agents 0.0.20 → 0.0.22
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/dist/cli.js +42 -4
- package/dist/tests/cli.test.js +35 -0
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -152,7 +152,11 @@ async function ensureOpenClawAgentGranularity() {
|
|
|
152
152
|
writeFileSync(OPENCLAW_CONFIG_PATH, JSON.stringify(config, null, 2) + "\n");
|
|
153
153
|
p.log.success("Set dynamicBankGranularity = [\"agent\"] for per-agent bank isolation");
|
|
154
154
|
}
|
|
155
|
-
|
|
155
|
+
// Floor for the openclaw hindsight-openclaw plugin. 0.7.4 is the first version
|
|
156
|
+
// that actually wires `enableKnowledgeTools` through getPluginConfig — older
|
|
157
|
+
// versions silently drop the flag and never register the agent_knowledge_*
|
|
158
|
+
// tools. Bumping the floor forces a reinstall for anyone below.
|
|
159
|
+
const MIN_PLUGIN_VERSION = "0.7.4";
|
|
156
160
|
function getInstalledPluginVersion() {
|
|
157
161
|
try {
|
|
158
162
|
// Check the installed plugin's package.json
|
|
@@ -234,7 +238,12 @@ function parseAgentsJson(raw) {
|
|
|
234
238
|
const jsonStr = arrStart >= 0 ? clean.slice(arrStart + 1) : clean.startsWith("[") ? clean : "[]";
|
|
235
239
|
return JSON.parse(jsonStr);
|
|
236
240
|
}
|
|
237
|
-
|
|
241
|
+
// Install/upgrade the host-level hindsight-openclaw extension. Used by both
|
|
242
|
+
// the openclaw flow (followed by the openclaw config wizard) and the nemoclaw
|
|
243
|
+
// flow (which then handles config + sandbox network policy via its own setup
|
|
244
|
+
// script). Splitting this out lets nemoclaw share the upgrade path without
|
|
245
|
+
// triggering the openclaw-specific configuration wizard.
|
|
246
|
+
async function ensureOpenClawPluginInstalled() {
|
|
238
247
|
const installed = isPluginInstalled();
|
|
239
248
|
const currentVersion = installed ? getInstalledPluginVersion() : null;
|
|
240
249
|
const needsInstall = !installed;
|
|
@@ -265,10 +274,32 @@ async function ensurePlugin() {
|
|
|
265
274
|
p.cancel("Failed to install plugin. Run manually:\n openclaw plugins install @vectorize-io/hindsight-openclaw");
|
|
266
275
|
process.exit(1);
|
|
267
276
|
}
|
|
277
|
+
return;
|
|
278
|
+
}
|
|
279
|
+
if (!currentVersion)
|
|
280
|
+
return;
|
|
281
|
+
// Plugin meets the floor — still try to pull the latest minor/patch in case
|
|
282
|
+
// a newer release shipped fixes (mirrors the claude-code flow which always
|
|
283
|
+
// runs `claude plugin update`). Best-effort: if openclaw is already on the
|
|
284
|
+
// latest, this is a no-op; if it fails, we keep the current install.
|
|
285
|
+
p.log.info(`Hindsight plugin v${currentVersion} — checking for updates...`);
|
|
286
|
+
try {
|
|
287
|
+
execSync("openclaw plugins update hindsight-openclaw", { stdio: "pipe" });
|
|
288
|
+
const updated = getInstalledPluginVersion();
|
|
289
|
+
if (updated && updated !== currentVersion) {
|
|
290
|
+
p.log.success(`Hindsight plugin updated v${currentVersion} → v${updated}`);
|
|
291
|
+
}
|
|
292
|
+
else {
|
|
293
|
+
p.log.info(`Hindsight plugin v${currentVersion} (already latest)`);
|
|
294
|
+
}
|
|
268
295
|
}
|
|
269
|
-
|
|
270
|
-
|
|
296
|
+
catch (err) {
|
|
297
|
+
const msg = err?.stderr?.toString?.()?.trim() || err?.message || String(err);
|
|
298
|
+
p.log.warn(`Plugin update failed (keeping v${currentVersion}): ${msg.split("\n")[0]}`);
|
|
271
299
|
}
|
|
300
|
+
}
|
|
301
|
+
async function ensurePlugin() {
|
|
302
|
+
await ensureOpenClawPluginInstalled();
|
|
272
303
|
if (!isPluginConfigured()) {
|
|
273
304
|
p.log.warn("Hindsight plugin needs configuration.");
|
|
274
305
|
try {
|
|
@@ -755,6 +786,13 @@ async function main() {
|
|
|
755
786
|
({ apiUrl, bankId, apiToken } = resolveFromPlugin(agentId));
|
|
756
787
|
}
|
|
757
788
|
else if (harness === "nemoclaw") {
|
|
789
|
+
// Plugin extension lives at the host level (~/.openclaw/extensions/...)
|
|
790
|
+
// and the sandbox just gets read-only Landlock access to it. The
|
|
791
|
+
// hindsight-nemoclaw setup script otherwise passes --skip-plugin-install
|
|
792
|
+
// when Hindsight is already configured, which means existing nemoclaw
|
|
793
|
+
// users never receive plugin upgrades. Run the openclaw install/upgrade
|
|
794
|
+
// path first so they get the same upgrade behavior as the openclaw flow.
|
|
795
|
+
await ensureOpenClawPluginInstalled();
|
|
758
796
|
await ensureNemoClawPlugin(sandbox, agentId);
|
|
759
797
|
await ensureOpenClawAgentGranularity();
|
|
760
798
|
({ apiUrl, bankId, apiToken } = resolveFromPlugin(agentId));
|
package/dist/tests/cli.test.js
CHANGED
|
@@ -287,6 +287,41 @@ describe("versionGte", () => {
|
|
|
287
287
|
expect(versionGte("0.6.9", "1.0.0")).toBe(false);
|
|
288
288
|
});
|
|
289
289
|
});
|
|
290
|
+
describe("openclaw ensureOpenClawPluginInstalled decision tree", () => {
|
|
291
|
+
const FLOOR = "0.7.4";
|
|
292
|
+
function decide(installed, currentVersion) {
|
|
293
|
+
function gte(c, r) {
|
|
294
|
+
const [aM, an, ap] = c.split(".").map(Number);
|
|
295
|
+
const [bM, bn, bp] = r.split(".").map(Number);
|
|
296
|
+
if (aM !== bM)
|
|
297
|
+
return aM > bM;
|
|
298
|
+
if (an !== bn)
|
|
299
|
+
return an > bn;
|
|
300
|
+
return ap >= bp;
|
|
301
|
+
}
|
|
302
|
+
if (!installed)
|
|
303
|
+
return "install";
|
|
304
|
+
if (!currentVersion || !gte(currentVersion, FLOOR))
|
|
305
|
+
return "reinstall";
|
|
306
|
+
return "check-update";
|
|
307
|
+
}
|
|
308
|
+
it("installs when plugin is missing", () => {
|
|
309
|
+
expect(decide(false, null)).toBe("install");
|
|
310
|
+
});
|
|
311
|
+
it("reinstalls when below the floor (drops the enableKnowledgeTools fix)", () => {
|
|
312
|
+
expect(decide(true, "0.7.2")).toBe("reinstall");
|
|
313
|
+
expect(decide(true, "0.7.3")).toBe("reinstall");
|
|
314
|
+
expect(decide(true, "0.6.9")).toBe("reinstall");
|
|
315
|
+
});
|
|
316
|
+
it("checks for updates when at or above the floor", () => {
|
|
317
|
+
expect(decide(true, "0.7.4")).toBe("check-update");
|
|
318
|
+
expect(decide(true, "0.7.5")).toBe("check-update");
|
|
319
|
+
expect(decide(true, "0.8.0")).toBe("check-update");
|
|
320
|
+
});
|
|
321
|
+
it("reinstalls when version cannot be read (treats as below floor)", () => {
|
|
322
|
+
expect(decide(true, null)).toBe("reinstall");
|
|
323
|
+
});
|
|
324
|
+
});
|
|
290
325
|
describe("harness argument parsing", () => {
|
|
291
326
|
function parseHarness(args) {
|
|
292
327
|
let harness;
|