mindkeeper-openclaw 0.2.33 → 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 CHANGED
@@ -996,9 +996,9 @@ var Tracker = class {
996
996
  }
997
997
  async resolveHead() {
998
998
  const git2 = await import("isomorphic-git");
999
- const fs2 = await import("node:fs");
999
+ const fs3 = await import("node:fs");
1000
1000
  return git2.default.resolveRef({
1001
- fs: fs2.default,
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 fs2 = await import("node:fs");
1016
+ const fs3 = await import("node:fs");
1017
1017
  try {
1018
1018
  return await git2.default.expandOid({
1019
- fs: fs2.default,
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 envHome = process.env.OPENCLAW_HOME;
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.join(envHome, "auth-profiles.json"));
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 import_node_fs2 = require("node:fs");
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, import_node_fs2.existsSync)(sourceDir)) {
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, import_node_fs2.mkdirSync)(targetDir, { recursive: true });
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, import_node_fs2.existsSync)(sourceFile)) {
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, import_node_fs2.existsSync)(targetFile)) continue;
1356
- (0, import_node_fs2.copyFileSync)(sourceFile, targetFile);
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) {
@@ -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.33",
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",