mindkeeper-openclaw 0.2.32 → 0.2.34
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 +65 -19
- package/dist/llm-client.cjs +1 -0
- package/package.json +10 -9
- package/LICENSE +0 -21
package/dist/index.js
CHANGED
|
@@ -996,9 +996,9 @@ var Tracker = class {
|
|
|
996
996
|
}
|
|
997
997
|
async resolveHead() {
|
|
998
998
|
const git2 = await import("isomorphic-git");
|
|
999
|
-
const
|
|
999
|
+
const fs3 = await import("node:fs");
|
|
1000
1000
|
return git2.default.resolveRef({
|
|
1001
|
-
fs:
|
|
1001
|
+
fs: fs3.default,
|
|
1002
1002
|
dir: this.workDir,
|
|
1003
1003
|
gitdir: this.gitDir,
|
|
1004
1004
|
ref: "HEAD"
|
|
@@ -1013,10 +1013,10 @@ var Tracker = class {
|
|
|
1013
1013
|
return this.resolveHead();
|
|
1014
1014
|
}
|
|
1015
1015
|
const git2 = await import("isomorphic-git");
|
|
1016
|
-
const
|
|
1016
|
+
const fs3 = await import("node:fs");
|
|
1017
1017
|
try {
|
|
1018
1018
|
return await git2.default.expandOid({
|
|
1019
|
-
fs:
|
|
1019
|
+
fs: fs3.default,
|
|
1020
1020
|
dir: this.workDir,
|
|
1021
1021
|
gitdir: this.gitDir,
|
|
1022
1022
|
oid: ref
|
|
@@ -1161,6 +1161,7 @@ function isProcessRunning(pid) {
|
|
|
1161
1161
|
}
|
|
1162
1162
|
|
|
1163
1163
|
// src/auth-resolver.ts
|
|
1164
|
+
var import_node_fs2 = __toESM(require("node:fs"));
|
|
1164
1165
|
var import_promises5 = __toESM(require("node:fs/promises"));
|
|
1165
1166
|
var import_node_path5 = __toESM(require("node:path"));
|
|
1166
1167
|
var import_node_os2 = __toESM(require("node:os"));
|
|
@@ -1203,9 +1204,27 @@ async function readAuthProfileKey(provider) {
|
|
|
1203
1204
|
function buildAuthProfilePaths() {
|
|
1204
1205
|
const home = import_node_os2.default.homedir();
|
|
1205
1206
|
const paths = [];
|
|
1206
|
-
const
|
|
1207
|
+
const agentDir = process.env.OPENCLAW_AGENT_DIR?.trim() || process.env.PI_CODING_AGENT_DIR?.trim();
|
|
1208
|
+
if (agentDir) {
|
|
1209
|
+
const resolved = import_node_path5.default.resolve(agentDir.replace(/^~(?=$|[\\/])/, home));
|
|
1210
|
+
paths.push(import_node_path5.default.join(resolved, "auth-profiles.json"));
|
|
1211
|
+
}
|
|
1212
|
+
const stateDir = resolveStateDir();
|
|
1213
|
+
paths.push(import_node_path5.default.join(stateDir, "agents", "main", "agent", "auth-profiles.json"));
|
|
1214
|
+
const agentsRoot = import_node_path5.default.join(stateDir, "agents");
|
|
1215
|
+
try {
|
|
1216
|
+
if (import_node_fs2.default.existsSync(agentsRoot)) {
|
|
1217
|
+
for (const entry of import_node_fs2.default.readdirSync(agentsRoot, { withFileTypes: true })) {
|
|
1218
|
+
if (entry.isDirectory()) {
|
|
1219
|
+
paths.push(import_node_path5.default.join(agentsRoot, entry.name, "agent", "auth-profiles.json"));
|
|
1220
|
+
}
|
|
1221
|
+
}
|
|
1222
|
+
}
|
|
1223
|
+
} catch {
|
|
1224
|
+
}
|
|
1225
|
+
const envHome = process.env.OPENCLAW_HOME?.trim();
|
|
1207
1226
|
if (envHome) {
|
|
1208
|
-
paths.push(import_node_path5.default.
|
|
1227
|
+
paths.push(import_node_path5.default.resolve(envHome.replace(/^~(?=$|[\\/])/, home), "auth-profiles.json"));
|
|
1209
1228
|
}
|
|
1210
1229
|
paths.push(
|
|
1211
1230
|
import_node_path5.default.join(home, ".openclaw", "auth-profiles.json"),
|
|
@@ -1213,6 +1232,33 @@ function buildAuthProfilePaths() {
|
|
|
1213
1232
|
);
|
|
1214
1233
|
return paths;
|
|
1215
1234
|
}
|
|
1235
|
+
function resolveStateDir() {
|
|
1236
|
+
const home = import_node_os2.default.homedir();
|
|
1237
|
+
const override = process.env.OPENCLAW_STATE_DIR?.trim() || process.env.CLAWDBOT_STATE_DIR?.trim();
|
|
1238
|
+
if (override) {
|
|
1239
|
+
return import_node_path5.default.resolve(override.replace(/^~(?=$|[\\/])/, home));
|
|
1240
|
+
}
|
|
1241
|
+
const newDir = import_node_path5.default.join(home, ".openclaw");
|
|
1242
|
+
const legacyDirs = [
|
|
1243
|
+
import_node_path5.default.join(home, ".clawdbot"),
|
|
1244
|
+
import_node_path5.default.join(home, ".moldbot"),
|
|
1245
|
+
import_node_path5.default.join(home, ".moltbot")
|
|
1246
|
+
];
|
|
1247
|
+
if (process.env.OPENCLAW_TEST_FAST === "1") {
|
|
1248
|
+
return newDir;
|
|
1249
|
+
}
|
|
1250
|
+
if (import_node_fs2.default.existsSync(newDir)) {
|
|
1251
|
+
return newDir;
|
|
1252
|
+
}
|
|
1253
|
+
const existingLegacy = legacyDirs.find((dir) => {
|
|
1254
|
+
try {
|
|
1255
|
+
return import_node_fs2.default.existsSync(dir);
|
|
1256
|
+
} catch {
|
|
1257
|
+
return false;
|
|
1258
|
+
}
|
|
1259
|
+
});
|
|
1260
|
+
return existingLegacy ?? newDir;
|
|
1261
|
+
}
|
|
1216
1262
|
function readEnvApiKey(provider) {
|
|
1217
1263
|
const normalized = normalizeProvider(provider);
|
|
1218
1264
|
const map = {
|
|
@@ -1330,7 +1376,7 @@ function resolveModelFromConfig(config, log) {
|
|
|
1330
1376
|
}
|
|
1331
1377
|
|
|
1332
1378
|
// src/skill-mirror.ts
|
|
1333
|
-
var
|
|
1379
|
+
var import_node_fs3 = require("node:fs");
|
|
1334
1380
|
var import_node_path6 = __toESM(require("node:path"));
|
|
1335
1381
|
var SKILL_DIR_NAME = "mindkeeper";
|
|
1336
1382
|
var SKILL_FILES = ["SKILL.md", "README.md", "clawhub.json"];
|
|
@@ -1338,22 +1384,22 @@ function ensureWorkspaceSkillMirror(workspaceDir, options = {}) {
|
|
|
1338
1384
|
if (!workspaceDir) return;
|
|
1339
1385
|
const sourceDir = options.sourceDir ?? resolveBundledSkillDir();
|
|
1340
1386
|
const targetDir = import_node_path6.default.join(workspaceDir, "skills", SKILL_DIR_NAME);
|
|
1341
|
-
if (!(0,
|
|
1387
|
+
if (!(0, import_node_fs3.existsSync)(sourceDir)) {
|
|
1342
1388
|
options.log?.warn?.(`[mindkeeper] Built-in skill directory not found: ${sourceDir}`);
|
|
1343
1389
|
return;
|
|
1344
1390
|
}
|
|
1345
1391
|
try {
|
|
1346
|
-
(0,
|
|
1392
|
+
(0, import_node_fs3.mkdirSync)(targetDir, { recursive: true });
|
|
1347
1393
|
const copied = [];
|
|
1348
1394
|
for (const file of SKILL_FILES) {
|
|
1349
1395
|
const sourceFile = import_node_path6.default.join(sourceDir, file);
|
|
1350
1396
|
const targetFile = import_node_path6.default.join(targetDir, file);
|
|
1351
|
-
if (!(0,
|
|
1397
|
+
if (!(0, import_node_fs3.existsSync)(sourceFile)) {
|
|
1352
1398
|
options.log?.warn?.(`[mindkeeper] Built-in skill file missing: ${sourceFile}`);
|
|
1353
1399
|
continue;
|
|
1354
1400
|
}
|
|
1355
|
-
if ((0,
|
|
1356
|
-
(0,
|
|
1401
|
+
if ((0, import_node_fs3.existsSync)(targetFile)) continue;
|
|
1402
|
+
(0, import_node_fs3.copyFileSync)(sourceFile, targetFile);
|
|
1357
1403
|
copied.push(file);
|
|
1358
1404
|
}
|
|
1359
1405
|
if (copied.length > 0) {
|
|
@@ -1376,9 +1422,9 @@ function resolveBundledSkillDir() {
|
|
|
1376
1422
|
function createWatcherService(api, trackerRef) {
|
|
1377
1423
|
let watcher = null;
|
|
1378
1424
|
const log = {
|
|
1379
|
-
info: (msg) => api.
|
|
1380
|
-
warn: (msg) => api.
|
|
1381
|
-
error: (msg) => api.
|
|
1425
|
+
info: (msg) => api.logger?.info?.(msg),
|
|
1426
|
+
warn: (msg) => api.logger?.warn?.(msg),
|
|
1427
|
+
error: (msg) => api.logger?.error?.(msg)
|
|
1382
1428
|
};
|
|
1383
1429
|
return {
|
|
1384
1430
|
id: "mindkeeper-watcher",
|
|
@@ -1388,7 +1434,7 @@ function createWatcherService(api, trackerRef) {
|
|
|
1388
1434
|
log.warn("[mindkeeper] No workspace directory in service context. Watcher disabled.");
|
|
1389
1435
|
return;
|
|
1390
1436
|
}
|
|
1391
|
-
ensureWorkspaceSkillMirror(workspaceDir, { log: api.
|
|
1437
|
+
ensureWorkspaceSkillMirror(workspaceDir, { log: api.logger });
|
|
1392
1438
|
log.info(
|
|
1393
1439
|
`[mindkeeper] Service starting: ctx.config=${ctx.config ? "present" : "missing"}, pluginConfig=${api.pluginConfig ? JSON.stringify(api.pluginConfig) : "none"}`
|
|
1394
1440
|
);
|
|
@@ -1447,11 +1493,11 @@ function mindkeeperPlugin(api) {
|
|
|
1447
1493
|
const trackerRef = { current: null };
|
|
1448
1494
|
registerTrackerTools(api, trackerRef);
|
|
1449
1495
|
registerTrackerCli(api, trackerRef);
|
|
1450
|
-
ensureWorkspaceSkillMirror(api.getWorkspaceDir?.(), { log: api.
|
|
1496
|
+
ensureWorkspaceSkillMirror(api.getWorkspaceDir?.(), { log: api.logger });
|
|
1451
1497
|
const watcherService = createWatcherService(api, trackerRef);
|
|
1452
1498
|
api.registerService?.(watcherService);
|
|
1453
1499
|
ensureToolsInConfig(api);
|
|
1454
|
-
api.
|
|
1500
|
+
api.logger?.info?.("[mindkeeper] Plugin loaded.");
|
|
1455
1501
|
}
|
|
1456
1502
|
function ensureToolsInConfig(api) {
|
|
1457
1503
|
const cfg = api.config;
|
|
@@ -1472,5 +1518,5 @@ function ensureToolsInConfig(api) {
|
|
|
1472
1518
|
void writeConfigFile({
|
|
1473
1519
|
...cfg,
|
|
1474
1520
|
tools: { ...cfg.tools, [key]: merged }
|
|
1475
|
-
}).catch((err) => api.
|
|
1521
|
+
}).catch((err) => api.logger?.warn?.(`[mindkeeper] Failed to auto-update tools.${key}:`, String(err)));
|
|
1476
1522
|
}
|
package/dist/llm-client.cjs
CHANGED
|
@@ -35,6 +35,7 @@ __export(llm_client_exports, {
|
|
|
35
35
|
module.exports = __toCommonJS(llm_client_exports);
|
|
36
36
|
|
|
37
37
|
// src/auth-resolver.ts
|
|
38
|
+
var import_node_fs = __toESM(require("node:fs"));
|
|
38
39
|
var import_promises = __toESM(require("node:fs/promises"));
|
|
39
40
|
var import_node_path = __toESM(require("node:path"));
|
|
40
41
|
var import_node_os = __toESM(require("node:os"));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mindkeeper-openclaw",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.34",
|
|
4
4
|
"description": "OpenClaw plugin for mindkeeper: auto-snapshot, diff, and rollback for agent context files",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"openclaw",
|
|
@@ -29,6 +29,14 @@
|
|
|
29
29
|
"scripts/postinstall-merge-config.cjs",
|
|
30
30
|
"README.md"
|
|
31
31
|
],
|
|
32
|
+
"scripts": {
|
|
33
|
+
"build": "node build.mjs",
|
|
34
|
+
"test": "vitest run",
|
|
35
|
+
"typecheck": "tsc --noEmit",
|
|
36
|
+
"clean": "rm -rf dist",
|
|
37
|
+
"prepublishOnly": "npm run clean && npm run build",
|
|
38
|
+
"postinstall": "node scripts/postinstall-merge-config.cjs"
|
|
39
|
+
},
|
|
32
40
|
"openclaw": {
|
|
33
41
|
"extensions": [
|
|
34
42
|
"./dist/index.js"
|
|
@@ -51,12 +59,5 @@
|
|
|
51
59
|
},
|
|
52
60
|
"publishConfig": {
|
|
53
61
|
"access": "public"
|
|
54
|
-
},
|
|
55
|
-
"scripts": {
|
|
56
|
-
"build": "node build.mjs",
|
|
57
|
-
"test": "vitest run",
|
|
58
|
-
"typecheck": "tsc --noEmit",
|
|
59
|
-
"clean": "rm -rf dist",
|
|
60
|
-
"postinstall": "node scripts/postinstall-merge-config.cjs"
|
|
61
62
|
}
|
|
62
|
-
}
|
|
63
|
+
}
|
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2026 context-vault contributors
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|