mindkeeper-openclaw 0.2.10 → 0.2.11
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 +50 -51
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -26278,50 +26278,6 @@ function isProcessRunning(pid) {
|
|
|
26278
26278
|
}
|
|
26279
26279
|
}
|
|
26280
26280
|
|
|
26281
|
-
// src/service.ts
|
|
26282
|
-
function createWatcherService(api, trackerRef, llmProvider) {
|
|
26283
|
-
let watcher = null;
|
|
26284
|
-
const log = {
|
|
26285
|
-
info: (msg) => api.log?.info?.(msg),
|
|
26286
|
-
warn: (msg) => api.log?.warn?.(msg),
|
|
26287
|
-
error: (msg) => api.log?.error?.(msg)
|
|
26288
|
-
};
|
|
26289
|
-
return {
|
|
26290
|
-
id: "mindkeeper-watcher",
|
|
26291
|
-
async start(ctx) {
|
|
26292
|
-
const workspaceDir = ctx.workspaceDir ?? process.env.OPENCLAW_WORKSPACE;
|
|
26293
|
-
if (!workspaceDir) {
|
|
26294
|
-
log.warn("[mindkeeper] No workspace directory in service context. Watcher disabled.");
|
|
26295
|
-
return;
|
|
26296
|
-
}
|
|
26297
|
-
const tracker = new Tracker({ workDir: workspaceDir, llmProvider });
|
|
26298
|
-
await tracker.init();
|
|
26299
|
-
trackerRef.current = tracker;
|
|
26300
|
-
watcher = new Watcher({
|
|
26301
|
-
tracker,
|
|
26302
|
-
onSnapshot: (commit) => {
|
|
26303
|
-
log.info(`[mindkeeper] Auto-snapshot ${commit.oid.slice(0, 8)}: ${commit.message}`);
|
|
26304
|
-
},
|
|
26305
|
-
onError: (err) => {
|
|
26306
|
-
log.error(`[mindkeeper] Watcher error: ${err.message}`);
|
|
26307
|
-
}
|
|
26308
|
-
});
|
|
26309
|
-
await watcher.start();
|
|
26310
|
-
log.info(
|
|
26311
|
-
`[mindkeeper] Watching ${workspaceDir} (debounce: ${tracker.getConfig().snapshot.debounceMs}ms)`
|
|
26312
|
-
);
|
|
26313
|
-
},
|
|
26314
|
-
async stop() {
|
|
26315
|
-
if (watcher) {
|
|
26316
|
-
await watcher.stop();
|
|
26317
|
-
watcher = null;
|
|
26318
|
-
log.info("[mindkeeper] Watcher stopped.");
|
|
26319
|
-
}
|
|
26320
|
-
trackerRef.current = null;
|
|
26321
|
-
}
|
|
26322
|
-
};
|
|
26323
|
-
}
|
|
26324
|
-
|
|
26325
26281
|
// src/auth-resolver.ts
|
|
26326
26282
|
import fsPromises5 from "node:fs/promises";
|
|
26327
26283
|
import path6 from "node:path";
|
|
@@ -26476,17 +26432,60 @@ function resolveModelFromConfig(config) {
|
|
|
26476
26432
|
return { provider, model, baseUrl };
|
|
26477
26433
|
}
|
|
26478
26434
|
|
|
26435
|
+
// src/service.ts
|
|
26436
|
+
function createWatcherService(api, trackerRef) {
|
|
26437
|
+
let watcher = null;
|
|
26438
|
+
const log = {
|
|
26439
|
+
info: (msg) => api.log?.info?.(msg),
|
|
26440
|
+
warn: (msg) => api.log?.warn?.(msg),
|
|
26441
|
+
error: (msg) => api.log?.error?.(msg)
|
|
26442
|
+
};
|
|
26443
|
+
return {
|
|
26444
|
+
id: "mindkeeper-watcher",
|
|
26445
|
+
async start(ctx) {
|
|
26446
|
+
const workspaceDir = ctx.workspaceDir ?? process.env.OPENCLAW_WORKSPACE;
|
|
26447
|
+
if (!workspaceDir) {
|
|
26448
|
+
log.warn("[mindkeeper] No workspace directory in service context. Watcher disabled.");
|
|
26449
|
+
return;
|
|
26450
|
+
}
|
|
26451
|
+
const llmProvider = await createOpenClawLlmProvider({
|
|
26452
|
+
config: ctx.config,
|
|
26453
|
+
log
|
|
26454
|
+
});
|
|
26455
|
+
const tracker = new Tracker({ workDir: workspaceDir, llmProvider: llmProvider ?? void 0 });
|
|
26456
|
+
await tracker.init();
|
|
26457
|
+
trackerRef.current = tracker;
|
|
26458
|
+
watcher = new Watcher({
|
|
26459
|
+
tracker,
|
|
26460
|
+
onSnapshot: (commit) => {
|
|
26461
|
+
log.info(`[mindkeeper] Auto-snapshot ${commit.oid.slice(0, 8)}: ${commit.message}`);
|
|
26462
|
+
},
|
|
26463
|
+
onError: (err) => {
|
|
26464
|
+
log.error(`[mindkeeper] Watcher error: ${err.message}`);
|
|
26465
|
+
}
|
|
26466
|
+
});
|
|
26467
|
+
await watcher.start();
|
|
26468
|
+
log.info(
|
|
26469
|
+
`[mindkeeper] Watching ${workspaceDir} (debounce: ${tracker.getConfig().snapshot.debounceMs}ms)`
|
|
26470
|
+
);
|
|
26471
|
+
},
|
|
26472
|
+
async stop() {
|
|
26473
|
+
if (watcher) {
|
|
26474
|
+
await watcher.stop();
|
|
26475
|
+
watcher = null;
|
|
26476
|
+
log.info("[mindkeeper] Watcher stopped.");
|
|
26477
|
+
}
|
|
26478
|
+
trackerRef.current = null;
|
|
26479
|
+
}
|
|
26480
|
+
};
|
|
26481
|
+
}
|
|
26482
|
+
|
|
26479
26483
|
// src/index.ts
|
|
26480
|
-
|
|
26481
|
-
const llmProvider = await createOpenClawLlmProvider({
|
|
26482
|
-
config: api.config,
|
|
26483
|
-
pluginConfig: api.pluginConfig,
|
|
26484
|
-
log: api.log
|
|
26485
|
-
});
|
|
26484
|
+
function mindkeeperPlugin(api) {
|
|
26486
26485
|
const trackerRef = { current: null };
|
|
26487
26486
|
registerTrackerTools(api, trackerRef);
|
|
26488
26487
|
registerTrackerCli(api, trackerRef);
|
|
26489
|
-
const watcherService = createWatcherService(api, trackerRef
|
|
26488
|
+
const watcherService = createWatcherService(api, trackerRef);
|
|
26490
26489
|
api.registerService?.(watcherService);
|
|
26491
26490
|
api.log?.info?.("[mindkeeper] Plugin loaded.");
|
|
26492
26491
|
}
|