mindkeeper-openclaw 0.2.8 → 0.2.9
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 +230 -214
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -18416,6 +18416,212 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
18416
18416
|
}
|
|
18417
18417
|
});
|
|
18418
18418
|
|
|
18419
|
+
// src/tools.ts
|
|
18420
|
+
function getTracker(ref) {
|
|
18421
|
+
if (!ref.current) {
|
|
18422
|
+
throw new Error("mindkeeper: tracker not ready \u2014 workspace not initialized yet.");
|
|
18423
|
+
}
|
|
18424
|
+
return ref.current;
|
|
18425
|
+
}
|
|
18426
|
+
function registerTrackerTools(api, trackerRef) {
|
|
18427
|
+
if (!api.registerTool) return;
|
|
18428
|
+
api.registerTool({
|
|
18429
|
+
name: "mind_history",
|
|
18430
|
+
description: "View version history of agent context files. Optionally filter by a specific file. Returns commit hashes, dates, and messages.",
|
|
18431
|
+
parameters: {
|
|
18432
|
+
type: "object",
|
|
18433
|
+
properties: {
|
|
18434
|
+
file: {
|
|
18435
|
+
type: "string",
|
|
18436
|
+
description: "File path to filter history (e.g. 'SOUL.md'). Omit for all files."
|
|
18437
|
+
},
|
|
18438
|
+
limit: {
|
|
18439
|
+
type: "number",
|
|
18440
|
+
description: "Maximum number of entries to return (default: 10)."
|
|
18441
|
+
}
|
|
18442
|
+
}
|
|
18443
|
+
},
|
|
18444
|
+
handler: async (args) => {
|
|
18445
|
+
const commits = await getTracker(trackerRef).history({
|
|
18446
|
+
file: args.file,
|
|
18447
|
+
limit: args.limit ?? 10
|
|
18448
|
+
});
|
|
18449
|
+
return formatHistoryResult(commits);
|
|
18450
|
+
}
|
|
18451
|
+
});
|
|
18452
|
+
api.registerTool({
|
|
18453
|
+
name: "mind_diff",
|
|
18454
|
+
description: "Compare two versions of an agent context file. Shows additions, deletions, and a unified diff.",
|
|
18455
|
+
parameters: {
|
|
18456
|
+
type: "object",
|
|
18457
|
+
properties: {
|
|
18458
|
+
file: { type: "string", description: "File path to compare (e.g. 'SOUL.md')." },
|
|
18459
|
+
from: { type: "string", description: "Source commit hash." },
|
|
18460
|
+
to: { type: "string", description: "Target commit hash (defaults to HEAD)." }
|
|
18461
|
+
},
|
|
18462
|
+
required: ["file", "from"]
|
|
18463
|
+
},
|
|
18464
|
+
handler: async (args) => {
|
|
18465
|
+
const result = await getTracker(trackerRef).diff({
|
|
18466
|
+
file: args.file,
|
|
18467
|
+
from: args.from,
|
|
18468
|
+
to: args.to
|
|
18469
|
+
});
|
|
18470
|
+
return formatDiffResult(result);
|
|
18471
|
+
}
|
|
18472
|
+
});
|
|
18473
|
+
api.registerTool({
|
|
18474
|
+
name: "mind_rollback",
|
|
18475
|
+
description: "Rollback an agent context file to a previous version. First call with preview=true to see the diff, then call again without preview to execute.",
|
|
18476
|
+
parameters: {
|
|
18477
|
+
type: "object",
|
|
18478
|
+
properties: {
|
|
18479
|
+
file: { type: "string", description: "File path to rollback (e.g. 'SOUL.md')." },
|
|
18480
|
+
to: { type: "string", description: "Commit hash to rollback to." },
|
|
18481
|
+
preview: {
|
|
18482
|
+
type: "boolean",
|
|
18483
|
+
description: "If true, show diff preview without executing rollback. Default: true."
|
|
18484
|
+
}
|
|
18485
|
+
},
|
|
18486
|
+
required: ["file", "to"]
|
|
18487
|
+
},
|
|
18488
|
+
handler: async (args) => {
|
|
18489
|
+
const file = args.file;
|
|
18490
|
+
const to = args.to;
|
|
18491
|
+
const preview = args.preview ?? true;
|
|
18492
|
+
const tracker = getTracker(trackerRef);
|
|
18493
|
+
if (preview) {
|
|
18494
|
+
const diff2 = await tracker.diff({ file, from: to, to: "HEAD" });
|
|
18495
|
+
return {
|
|
18496
|
+
preview: true,
|
|
18497
|
+
diff: formatDiffResult(diff2),
|
|
18498
|
+
instruction: "Show this diff to the user. If they confirm, call mind_rollback again with preview=false."
|
|
18499
|
+
};
|
|
18500
|
+
}
|
|
18501
|
+
const commit = await tracker.rollback({ file, to });
|
|
18502
|
+
return {
|
|
18503
|
+
preview: false,
|
|
18504
|
+
success: true,
|
|
18505
|
+
commit: { oid: commit.oid.slice(0, 8), message: commit.message },
|
|
18506
|
+
note: "Tell the user to run /new to apply the changes to the current session."
|
|
18507
|
+
};
|
|
18508
|
+
}
|
|
18509
|
+
});
|
|
18510
|
+
api.registerTool({
|
|
18511
|
+
name: "mind_snapshot",
|
|
18512
|
+
description: "Create a named checkpoint of the current state of all agent context files. Useful before making significant changes.",
|
|
18513
|
+
parameters: {
|
|
18514
|
+
type: "object",
|
|
18515
|
+
properties: {
|
|
18516
|
+
name: { type: "string", description: "Snapshot name (e.g. 'personality-v2')." },
|
|
18517
|
+
message: { type: "string", description: "Optional description of this snapshot." }
|
|
18518
|
+
},
|
|
18519
|
+
required: ["name"]
|
|
18520
|
+
},
|
|
18521
|
+
handler: async (args) => {
|
|
18522
|
+
const commit = await getTracker(trackerRef).snapshot({
|
|
18523
|
+
name: args.name,
|
|
18524
|
+
message: args.message
|
|
18525
|
+
});
|
|
18526
|
+
return {
|
|
18527
|
+
success: true,
|
|
18528
|
+
snapshot: args.name,
|
|
18529
|
+
commit: { oid: commit.oid.slice(0, 8), message: commit.message }
|
|
18530
|
+
};
|
|
18531
|
+
}
|
|
18532
|
+
});
|
|
18533
|
+
api.registerTool({
|
|
18534
|
+
name: "mind_status",
|
|
18535
|
+
description: "Show the current tracking status: tracked files, pending changes, and named snapshots.",
|
|
18536
|
+
parameters: { type: "object", properties: {} },
|
|
18537
|
+
handler: async () => {
|
|
18538
|
+
const status = await getTracker(trackerRef).status();
|
|
18539
|
+
return formatStatusResult(status);
|
|
18540
|
+
}
|
|
18541
|
+
});
|
|
18542
|
+
}
|
|
18543
|
+
function formatHistoryResult(commits) {
|
|
18544
|
+
return {
|
|
18545
|
+
count: commits.length,
|
|
18546
|
+
entries: commits.map((c) => ({
|
|
18547
|
+
oid: c.oid.slice(0, 8),
|
|
18548
|
+
date: c.date.toISOString().replace("T", " ").slice(0, 19),
|
|
18549
|
+
message: c.message
|
|
18550
|
+
}))
|
|
18551
|
+
};
|
|
18552
|
+
}
|
|
18553
|
+
function formatDiffResult(result) {
|
|
18554
|
+
return {
|
|
18555
|
+
file: result.file,
|
|
18556
|
+
from: result.fromVersion,
|
|
18557
|
+
to: result.toVersion,
|
|
18558
|
+
additions: result.additions,
|
|
18559
|
+
deletions: result.deletions,
|
|
18560
|
+
unified: result.unified
|
|
18561
|
+
};
|
|
18562
|
+
}
|
|
18563
|
+
function formatStatusResult(status) {
|
|
18564
|
+
return {
|
|
18565
|
+
initialized: status.initialized,
|
|
18566
|
+
workDir: status.workDir,
|
|
18567
|
+
pendingChanges: status.pendingChanges.map((e) => ({
|
|
18568
|
+
file: e.filepath,
|
|
18569
|
+
status: e.status
|
|
18570
|
+
})),
|
|
18571
|
+
snapshots: status.snapshots.map((s) => ({
|
|
18572
|
+
name: s.name,
|
|
18573
|
+
oid: s.oid.slice(0, 8)
|
|
18574
|
+
}))
|
|
18575
|
+
};
|
|
18576
|
+
}
|
|
18577
|
+
|
|
18578
|
+
// src/cli.ts
|
|
18579
|
+
function getTracker2(ref) {
|
|
18580
|
+
if (!ref.current) {
|
|
18581
|
+
throw new Error("mindkeeper: tracker not ready \u2014 workspace not initialized yet.");
|
|
18582
|
+
}
|
|
18583
|
+
return ref.current;
|
|
18584
|
+
}
|
|
18585
|
+
function registerTrackerCli(api, trackerRef) {
|
|
18586
|
+
if (!api.registerCli) return;
|
|
18587
|
+
api.registerCli((program) => {
|
|
18588
|
+
const cmd = program;
|
|
18589
|
+
const mindCmd = cmd.command("mind");
|
|
18590
|
+
addSubcommand(mindCmd, "status", "Show tracking status", async () => {
|
|
18591
|
+
const status = await getTracker2(trackerRef).status();
|
|
18592
|
+
console.log(`Workspace: ${status.workDir}`);
|
|
18593
|
+
console.log(`Pending changes: ${status.pendingChanges.length}`);
|
|
18594
|
+
console.log(`Named snapshots: ${status.snapshots.length}`);
|
|
18595
|
+
});
|
|
18596
|
+
addSubcommand(mindCmd, "history [file]", "View change history", async (...args) => {
|
|
18597
|
+
const file = args[0];
|
|
18598
|
+
const commits = await getTracker2(trackerRef).history({ file, limit: 20 });
|
|
18599
|
+
if (commits.length === 0) {
|
|
18600
|
+
console.log("No history found.");
|
|
18601
|
+
return;
|
|
18602
|
+
}
|
|
18603
|
+
for (const c of commits) {
|
|
18604
|
+
const date = c.date.toISOString().replace("T", " ").slice(0, 19);
|
|
18605
|
+
console.log(`${c.oid.slice(0, 8)} ${date} ${c.message}`);
|
|
18606
|
+
}
|
|
18607
|
+
});
|
|
18608
|
+
addSubcommand(
|
|
18609
|
+
mindCmd,
|
|
18610
|
+
"snapshot [name]",
|
|
18611
|
+
"Create a named snapshot",
|
|
18612
|
+
async (...args) => {
|
|
18613
|
+
const name = args[0];
|
|
18614
|
+
const commit = await getTracker2(trackerRef).snapshot({ name });
|
|
18615
|
+
console.log(`Snapshot created: ${commit.oid.slice(0, 8)} ${commit.message}`);
|
|
18616
|
+
if (name) console.log(`Tagged as: ${name}`);
|
|
18617
|
+
}
|
|
18618
|
+
);
|
|
18619
|
+
});
|
|
18620
|
+
}
|
|
18621
|
+
function addSubcommand(parent, name, description, handler) {
|
|
18622
|
+
parent.command(name).description(description).action(handler);
|
|
18623
|
+
}
|
|
18624
|
+
|
|
18419
18625
|
// ../core/dist/tracker.js
|
|
18420
18626
|
import fsPromises3 from "node:fs/promises";
|
|
18421
18627
|
import path4 from "node:path";
|
|
@@ -23447,228 +23653,46 @@ function isProcessRunning(pid) {
|
|
|
23447
23653
|
}
|
|
23448
23654
|
}
|
|
23449
23655
|
|
|
23450
|
-
// src/tools.ts
|
|
23451
|
-
function registerTrackerTools(api, tracker) {
|
|
23452
|
-
if (!api.registerTool) return;
|
|
23453
|
-
api.registerTool({
|
|
23454
|
-
name: "mind_history",
|
|
23455
|
-
description: "View version history of agent context files. Optionally filter by a specific file. Returns commit hashes, dates, and messages.",
|
|
23456
|
-
parameters: {
|
|
23457
|
-
type: "object",
|
|
23458
|
-
properties: {
|
|
23459
|
-
file: {
|
|
23460
|
-
type: "string",
|
|
23461
|
-
description: "File path to filter history (e.g. 'SOUL.md'). Omit for all files."
|
|
23462
|
-
},
|
|
23463
|
-
limit: {
|
|
23464
|
-
type: "number",
|
|
23465
|
-
description: "Maximum number of entries to return (default: 10)."
|
|
23466
|
-
}
|
|
23467
|
-
}
|
|
23468
|
-
},
|
|
23469
|
-
handler: async (args) => {
|
|
23470
|
-
const commits = await tracker.history({
|
|
23471
|
-
file: args.file,
|
|
23472
|
-
limit: args.limit ?? 10
|
|
23473
|
-
});
|
|
23474
|
-
return formatHistoryResult(commits);
|
|
23475
|
-
}
|
|
23476
|
-
});
|
|
23477
|
-
api.registerTool({
|
|
23478
|
-
name: "mind_diff",
|
|
23479
|
-
description: "Compare two versions of an agent context file. Shows additions, deletions, and a unified diff.",
|
|
23480
|
-
parameters: {
|
|
23481
|
-
type: "object",
|
|
23482
|
-
properties: {
|
|
23483
|
-
file: { type: "string", description: "File path to compare (e.g. 'SOUL.md')." },
|
|
23484
|
-
from: { type: "string", description: "Source commit hash." },
|
|
23485
|
-
to: { type: "string", description: "Target commit hash (defaults to HEAD)." }
|
|
23486
|
-
},
|
|
23487
|
-
required: ["file", "from"]
|
|
23488
|
-
},
|
|
23489
|
-
handler: async (args) => {
|
|
23490
|
-
const result = await tracker.diff({
|
|
23491
|
-
file: args.file,
|
|
23492
|
-
from: args.from,
|
|
23493
|
-
to: args.to
|
|
23494
|
-
});
|
|
23495
|
-
return formatDiffResult(result);
|
|
23496
|
-
}
|
|
23497
|
-
});
|
|
23498
|
-
api.registerTool({
|
|
23499
|
-
name: "mind_rollback",
|
|
23500
|
-
description: "Rollback an agent context file to a previous version. First call with preview=true to see the diff, then call again without preview to execute.",
|
|
23501
|
-
parameters: {
|
|
23502
|
-
type: "object",
|
|
23503
|
-
properties: {
|
|
23504
|
-
file: { type: "string", description: "File path to rollback (e.g. 'SOUL.md')." },
|
|
23505
|
-
to: { type: "string", description: "Commit hash to rollback to." },
|
|
23506
|
-
preview: {
|
|
23507
|
-
type: "boolean",
|
|
23508
|
-
description: "If true, show diff preview without executing rollback. Default: true."
|
|
23509
|
-
}
|
|
23510
|
-
},
|
|
23511
|
-
required: ["file", "to"]
|
|
23512
|
-
},
|
|
23513
|
-
handler: async (args) => {
|
|
23514
|
-
const file = args.file;
|
|
23515
|
-
const to = args.to;
|
|
23516
|
-
const preview = args.preview ?? true;
|
|
23517
|
-
if (preview) {
|
|
23518
|
-
const diff2 = await tracker.diff({ file, from: to, to: "HEAD" });
|
|
23519
|
-
return {
|
|
23520
|
-
preview: true,
|
|
23521
|
-
diff: formatDiffResult(diff2),
|
|
23522
|
-
instruction: "Show this diff to the user. If they confirm, call mind_rollback again with preview=false."
|
|
23523
|
-
};
|
|
23524
|
-
}
|
|
23525
|
-
const commit = await tracker.rollback({ file, to });
|
|
23526
|
-
return {
|
|
23527
|
-
preview: false,
|
|
23528
|
-
success: true,
|
|
23529
|
-
commit: { oid: commit.oid.slice(0, 8), message: commit.message },
|
|
23530
|
-
note: "Tell the user to run /new to apply the changes to the current session."
|
|
23531
|
-
};
|
|
23532
|
-
}
|
|
23533
|
-
});
|
|
23534
|
-
api.registerTool({
|
|
23535
|
-
name: "mind_snapshot",
|
|
23536
|
-
description: "Create a named checkpoint of the current state of all agent context files. Useful before making significant changes.",
|
|
23537
|
-
parameters: {
|
|
23538
|
-
type: "object",
|
|
23539
|
-
properties: {
|
|
23540
|
-
name: { type: "string", description: "Snapshot name (e.g. 'personality-v2')." },
|
|
23541
|
-
message: { type: "string", description: "Optional description of this snapshot." }
|
|
23542
|
-
},
|
|
23543
|
-
required: ["name"]
|
|
23544
|
-
},
|
|
23545
|
-
handler: async (args) => {
|
|
23546
|
-
const commit = await tracker.snapshot({
|
|
23547
|
-
name: args.name,
|
|
23548
|
-
message: args.message
|
|
23549
|
-
});
|
|
23550
|
-
return {
|
|
23551
|
-
success: true,
|
|
23552
|
-
snapshot: args.name,
|
|
23553
|
-
commit: { oid: commit.oid.slice(0, 8), message: commit.message }
|
|
23554
|
-
};
|
|
23555
|
-
}
|
|
23556
|
-
});
|
|
23557
|
-
api.registerTool({
|
|
23558
|
-
name: "mind_status",
|
|
23559
|
-
description: "Show the current tracking status: tracked files, pending changes, and named snapshots.",
|
|
23560
|
-
parameters: { type: "object", properties: {} },
|
|
23561
|
-
handler: async () => {
|
|
23562
|
-
const status = await tracker.status();
|
|
23563
|
-
return formatStatusResult(status);
|
|
23564
|
-
}
|
|
23565
|
-
});
|
|
23566
|
-
}
|
|
23567
|
-
function formatHistoryResult(commits) {
|
|
23568
|
-
return {
|
|
23569
|
-
count: commits.length,
|
|
23570
|
-
entries: commits.map((c) => ({
|
|
23571
|
-
oid: c.oid.slice(0, 8),
|
|
23572
|
-
date: c.date.toISOString().replace("T", " ").slice(0, 19),
|
|
23573
|
-
message: c.message
|
|
23574
|
-
}))
|
|
23575
|
-
};
|
|
23576
|
-
}
|
|
23577
|
-
function formatDiffResult(result) {
|
|
23578
|
-
return {
|
|
23579
|
-
file: result.file,
|
|
23580
|
-
from: result.fromVersion,
|
|
23581
|
-
to: result.toVersion,
|
|
23582
|
-
additions: result.additions,
|
|
23583
|
-
deletions: result.deletions,
|
|
23584
|
-
unified: result.unified
|
|
23585
|
-
};
|
|
23586
|
-
}
|
|
23587
|
-
function formatStatusResult(status) {
|
|
23588
|
-
return {
|
|
23589
|
-
initialized: status.initialized,
|
|
23590
|
-
workDir: status.workDir,
|
|
23591
|
-
pendingChanges: status.pendingChanges.map((e) => ({
|
|
23592
|
-
file: e.filepath,
|
|
23593
|
-
status: e.status
|
|
23594
|
-
})),
|
|
23595
|
-
snapshots: status.snapshots.map((s) => ({
|
|
23596
|
-
name: s.name,
|
|
23597
|
-
oid: s.oid.slice(0, 8)
|
|
23598
|
-
}))
|
|
23599
|
-
};
|
|
23600
|
-
}
|
|
23601
|
-
|
|
23602
|
-
// src/cli.ts
|
|
23603
|
-
function registerTrackerCli(api, tracker) {
|
|
23604
|
-
if (!api.registerCli) return;
|
|
23605
|
-
api.registerCli((program) => {
|
|
23606
|
-
const cmd = program;
|
|
23607
|
-
const mindCmd = cmd.command("mind");
|
|
23608
|
-
addSubcommand(mindCmd, "status", "Show tracking status", async () => {
|
|
23609
|
-
const status = await tracker.status();
|
|
23610
|
-
console.log(`Workspace: ${status.workDir}`);
|
|
23611
|
-
console.log(`Pending changes: ${status.pendingChanges.length}`);
|
|
23612
|
-
console.log(`Named snapshots: ${status.snapshots.length}`);
|
|
23613
|
-
});
|
|
23614
|
-
addSubcommand(mindCmd, "history [file]", "View change history", async (...args) => {
|
|
23615
|
-
const file = args[0];
|
|
23616
|
-
const commits = await tracker.history({ file, limit: 20 });
|
|
23617
|
-
if (commits.length === 0) {
|
|
23618
|
-
console.log("No history found.");
|
|
23619
|
-
return;
|
|
23620
|
-
}
|
|
23621
|
-
for (const c of commits) {
|
|
23622
|
-
const date = c.date.toISOString().replace("T", " ").slice(0, 19);
|
|
23623
|
-
console.log(`${c.oid.slice(0, 8)} ${date} ${c.message}`);
|
|
23624
|
-
}
|
|
23625
|
-
});
|
|
23626
|
-
addSubcommand(
|
|
23627
|
-
mindCmd,
|
|
23628
|
-
"snapshot [name]",
|
|
23629
|
-
"Create a named snapshot",
|
|
23630
|
-
async (...args) => {
|
|
23631
|
-
const name = args[0];
|
|
23632
|
-
const commit = await tracker.snapshot({ name });
|
|
23633
|
-
console.log(`Snapshot created: ${commit.oid.slice(0, 8)} ${commit.message}`);
|
|
23634
|
-
if (name) console.log(`Tagged as: ${name}`);
|
|
23635
|
-
}
|
|
23636
|
-
);
|
|
23637
|
-
});
|
|
23638
|
-
}
|
|
23639
|
-
function addSubcommand(parent, name, description, handler) {
|
|
23640
|
-
parent.command(name).description(description).action(handler);
|
|
23641
|
-
}
|
|
23642
|
-
|
|
23643
23656
|
// src/service.ts
|
|
23644
|
-
function createWatcherService(
|
|
23657
|
+
function createWatcherService(api, trackerRef, llmProvider) {
|
|
23645
23658
|
let watcher = null;
|
|
23659
|
+
const log = {
|
|
23660
|
+
info: (msg) => api.log?.info?.(msg),
|
|
23661
|
+
warn: (msg) => api.log?.warn?.(msg),
|
|
23662
|
+
error: (msg) => api.log?.error?.(msg)
|
|
23663
|
+
};
|
|
23646
23664
|
return {
|
|
23647
23665
|
id: "mindkeeper-watcher",
|
|
23648
|
-
async start() {
|
|
23666
|
+
async start(ctx) {
|
|
23667
|
+
const workspaceDir = ctx.workspaceDir ?? process.env.OPENCLAW_WORKSPACE;
|
|
23668
|
+
if (!workspaceDir) {
|
|
23669
|
+
log.warn("[mindkeeper] No workspace directory in service context. Watcher disabled.");
|
|
23670
|
+
return;
|
|
23671
|
+
}
|
|
23672
|
+
const tracker = new Tracker({ workDir: workspaceDir, llmProvider });
|
|
23649
23673
|
await tracker.init();
|
|
23674
|
+
trackerRef.current = tracker;
|
|
23650
23675
|
watcher = new Watcher({
|
|
23651
23676
|
tracker,
|
|
23652
23677
|
onSnapshot: (commit) => {
|
|
23653
|
-
|
|
23654
|
-
`[mindkeeper] Auto-snapshot ${commit.oid.slice(0, 8)}: ${commit.message}`
|
|
23655
|
-
);
|
|
23678
|
+
log.info(`[mindkeeper] Auto-snapshot ${commit.oid.slice(0, 8)}: ${commit.message}`);
|
|
23656
23679
|
},
|
|
23657
23680
|
onError: (err) => {
|
|
23658
|
-
|
|
23681
|
+
log.error(`[mindkeeper] Watcher error: ${err.message}`);
|
|
23659
23682
|
}
|
|
23660
23683
|
});
|
|
23661
23684
|
await watcher.start();
|
|
23662
|
-
|
|
23663
|
-
`[mindkeeper] Watching ${
|
|
23685
|
+
log.info(
|
|
23686
|
+
`[mindkeeper] Watching ${workspaceDir} (debounce: ${tracker.getConfig().snapshot.debounceMs}ms)`
|
|
23664
23687
|
);
|
|
23665
23688
|
},
|
|
23666
23689
|
async stop() {
|
|
23667
23690
|
if (watcher) {
|
|
23668
23691
|
await watcher.stop();
|
|
23669
23692
|
watcher = null;
|
|
23670
|
-
|
|
23693
|
+
log.info("[mindkeeper] Watcher stopped.");
|
|
23671
23694
|
}
|
|
23695
|
+
trackerRef.current = null;
|
|
23672
23696
|
}
|
|
23673
23697
|
};
|
|
23674
23698
|
}
|
|
@@ -23829,23 +23853,15 @@ function resolveModelFromConfig(config) {
|
|
|
23829
23853
|
|
|
23830
23854
|
// src/index.ts
|
|
23831
23855
|
async function mindkeeperPlugin(api) {
|
|
23832
|
-
const workspaceDir = api.getWorkspaceDir?.() ?? process.env.OPENCLAW_WORKSPACE;
|
|
23833
|
-
if (!workspaceDir) {
|
|
23834
|
-
api.log?.warn?.("[mindkeeper] No workspace directory found. Plugin disabled.");
|
|
23835
|
-
return;
|
|
23836
|
-
}
|
|
23837
23856
|
const llmProvider = await createOpenClawLlmProvider({
|
|
23838
23857
|
config: api.config,
|
|
23839
23858
|
pluginConfig: api.pluginConfig,
|
|
23840
23859
|
log: api.log
|
|
23841
23860
|
});
|
|
23842
|
-
const
|
|
23843
|
-
|
|
23844
|
-
|
|
23845
|
-
|
|
23846
|
-
registerTrackerTools(api, tracker);
|
|
23847
|
-
registerTrackerCli(api, tracker);
|
|
23848
|
-
const watcherService = createWatcherService(tracker, api);
|
|
23861
|
+
const trackerRef = { current: null };
|
|
23862
|
+
registerTrackerTools(api, trackerRef);
|
|
23863
|
+
registerTrackerCli(api, trackerRef);
|
|
23864
|
+
const watcherService = createWatcherService(api, trackerRef, llmProvider ?? void 0);
|
|
23849
23865
|
api.registerService?.(watcherService);
|
|
23850
23866
|
api.log?.info?.("[mindkeeper] Plugin loaded.");
|
|
23851
23867
|
}
|