mindkeeper-openclaw 0.2.15 → 0.2.16

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/index.js CHANGED
@@ -1201,15 +1201,19 @@ function mindkeeperPlugin(api) {
1201
1201
  registerTrackerCli(api, trackerRef);
1202
1202
  const watcherService = createWatcherService(api, trackerRef);
1203
1203
  api.registerService?.(watcherService);
1204
- ensureToolsAlsoAllow(api);
1204
+ ensureToolsInConfig(api);
1205
1205
  api.log?.info?.("[mindkeeper] Plugin loaded.");
1206
1206
  }
1207
- function ensureToolsAlsoAllow(api) {
1207
+ function ensureToolsInConfig(api) {
1208
1208
  const cfg = api.config;
1209
1209
  const writeConfigFile = api.runtime?.config?.writeConfigFile;
1210
1210
  if (!cfg || !writeConfigFile) return;
1211
+ const allow = cfg.tools?.allow ?? [];
1212
+ const alsoAllow = cfg.tools?.alsoAllow ?? [];
1213
+ const target = allow.length > 0 ? allow : alsoAllow;
1214
+ const key = allow.length > 0 ? "allow" : "alsoAllow";
1211
1215
  const existing = new Set(
1212
- (cfg.tools?.alsoAllow ?? []).map((e) => String(e).trim().toLowerCase()).filter(Boolean)
1216
+ target.map((e) => String(e).trim().toLowerCase()).filter(Boolean)
1213
1217
  );
1214
1218
  const needed = MINDKEEPER_TOOLS.filter((t) => !existing.has(t));
1215
1219
  if (needed.length === 0) return;
@@ -1217,6 +1221,6 @@ function ensureToolsAlsoAllow(api) {
1217
1221
  const merged = Array.from(existing);
1218
1222
  void writeConfigFile({
1219
1223
  ...cfg,
1220
- tools: { ...cfg.tools, alsoAllow: merged }
1221
- }).catch((err) => api.log?.warn?.("[mindkeeper] Failed to auto-update tools.alsoAllow:", String(err)));
1224
+ tools: { ...cfg.tools, [key]: merged }
1225
+ }).catch((err) => api.log?.warn?.(`[mindkeeper] Failed to auto-update tools.${key}:`, String(err)));
1222
1226
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mindkeeper-openclaw",
3
- "version": "0.2.15",
3
+ "version": "0.2.16",
4
4
  "description": "OpenClaw plugin for mindkeeper: auto-snapshot, diff, and rollback for agent context files",
5
5
  "keywords": [
6
6
  "openclaw",
@@ -1,5 +1,7 @@
1
1
  /**
2
- * Postinstall: merge mindkeeper tools into OpenClaw config.tools.alsoAllow.
2
+ * Postinstall: merge mindkeeper tools into OpenClaw config.
3
+ * - If tools.allow exists: merge into tools.allow (allow and alsoAllow are mutually exclusive).
4
+ * - Else: merge into tools.alsoAllow.
3
5
  * Runs during plugin install so a single gateway restart is enough.
4
6
  */
5
7
  const fs = require("node:fs");
@@ -51,14 +53,19 @@ function run() {
51
53
  return;
52
54
  }
53
55
 
56
+ const allow = cfg.tools?.allow ?? [];
57
+ const alsoAllow = cfg.tools?.alsoAllow ?? [];
58
+ const target = allow.length > 0 ? allow : alsoAllow;
59
+ const key = allow.length > 0 ? "allow" : "alsoAllow";
60
+
54
61
  const existing = new Set(
55
- (cfg.tools?.alsoAllow ?? []).map((e) => String(e).trim().toLowerCase()).filter(Boolean),
62
+ target.map((e) => String(e).trim().toLowerCase()).filter(Boolean),
56
63
  );
57
64
  const needed = TOOLS.filter((t) => !existing.has(t));
58
65
  if (needed.length === 0) return;
59
66
 
60
67
  for (const t of needed) existing.add(t);
61
- cfg.tools = { ...cfg.tools, alsoAllow: Array.from(existing) };
68
+ cfg.tools = { ...cfg.tools, [key]: Array.from(existing) };
62
69
 
63
70
  try {
64
71
  fs.writeFileSync(configPath, JSON.stringify(cfg, null, 2), "utf-8");