@vectorize-io/self-driving-agents 0.0.19 → 0.0.21
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 +25 -2
- 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
|
|
@@ -267,7 +271,25 @@ async function ensurePlugin() {
|
|
|
267
271
|
}
|
|
268
272
|
}
|
|
269
273
|
else if (currentVersion) {
|
|
270
|
-
|
|
274
|
+
// Plugin meets the floor — still try to pull the latest minor/patch in case
|
|
275
|
+
// a newer release shipped fixes (mirrors the claude-code flow which always
|
|
276
|
+
// runs `claude plugin update`). Best-effort: if openclaw is already on the
|
|
277
|
+
// latest, this is a no-op; if it fails, we keep the current install.
|
|
278
|
+
p.log.info(`Hindsight plugin v${currentVersion} — checking for updates...`);
|
|
279
|
+
try {
|
|
280
|
+
execSync("openclaw plugins update hindsight-openclaw", { stdio: "pipe" });
|
|
281
|
+
const updated = getInstalledPluginVersion();
|
|
282
|
+
if (updated && updated !== currentVersion) {
|
|
283
|
+
p.log.success(`Hindsight plugin updated v${currentVersion} → v${updated}`);
|
|
284
|
+
}
|
|
285
|
+
else {
|
|
286
|
+
p.log.info(`Hindsight plugin v${currentVersion} (already latest)`);
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
catch (err) {
|
|
290
|
+
const msg = err?.stderr?.toString?.()?.trim() || err?.message || String(err);
|
|
291
|
+
p.log.warn(`Plugin update failed (keeping v${currentVersion}): ${msg.split("\n")[0]}`);
|
|
292
|
+
}
|
|
271
293
|
}
|
|
272
294
|
if (!isPluginConfigured()) {
|
|
273
295
|
p.log.warn("Hindsight plugin needs configuration.");
|
|
@@ -1019,6 +1041,7 @@ async function main() {
|
|
|
1019
1041
|
p.log.info([
|
|
1020
1042
|
`Agent: ${color.bold(agentId)}`,
|
|
1021
1043
|
`Source: ${color.dim(source)}`,
|
|
1044
|
+
`Bank: ${color.dim(bankId)}`,
|
|
1022
1045
|
`API: ${color.dim(apiUrl)}`,
|
|
1023
1046
|
`Workspace: ${color.dim(workspaceDir)}`,
|
|
1024
1047
|
].join("\n"));
|
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 ensurePlugin 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;
|