agent-recall-mcp 3.3.2 → 3.3.4
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 +6 -13
- package/dist/index.js.map +1 -1
- package/dist/resources/journal-resources.d.ts.map +1 -1
- package/dist/resources/journal-resources.js +5 -29
- package/dist/resources/journal-resources.js.map +1 -1
- package/dist/server.js +1 -1
- package/dist/server.js.map +1 -1
- package/dist/tools/alignment-check.d.ts.map +1 -1
- package/dist/tools/alignment-check.js +3 -54
- package/dist/tools/alignment-check.js.map +1 -1
- package/dist/tools/awareness-update.d.ts +2 -8
- package/dist/tools/awareness-update.d.ts.map +1 -1
- package/dist/tools/awareness-update.js +3 -66
- package/dist/tools/awareness-update.js.map +1 -1
- package/dist/tools/context-synthesize.d.ts.map +1 -1
- package/dist/tools/context-synthesize.js +6 -187
- package/dist/tools/context-synthesize.js.map +1 -1
- package/dist/tools/journal-archive.d.ts.map +1 -1
- package/dist/tools/journal-archive.js +3 -48
- package/dist/tools/journal-archive.js.map +1 -1
- package/dist/tools/journal-capture.d.ts.map +1 -1
- package/dist/tools/journal-capture.js +3 -60
- package/dist/tools/journal-capture.js.map +1 -1
- package/dist/tools/journal-cold-start.d.ts.map +1 -1
- package/dist/tools/journal-cold-start.js +10 -52
- package/dist/tools/journal-cold-start.js.map +1 -1
- package/dist/tools/journal-list.d.ts.map +1 -1
- package/dist/tools/journal-list.js +3 -23
- package/dist/tools/journal-list.js.map +1 -1
- package/dist/tools/journal-projects.d.ts.map +1 -1
- package/dist/tools/journal-projects.js +3 -16
- package/dist/tools/journal-projects.js.map +1 -1
- package/dist/tools/journal-read.d.ts.map +1 -1
- package/dist/tools/journal-read.js +5 -45
- package/dist/tools/journal-read.js.map +1 -1
- package/dist/tools/journal-rollup.d.ts +3 -0
- package/dist/tools/journal-rollup.d.ts.map +1 -0
- package/dist/tools/journal-rollup.js +21 -0
- package/dist/tools/journal-rollup.js.map +1 -0
- package/dist/tools/journal-search.d.ts.map +1 -1
- package/dist/tools/journal-search.js +3 -91
- package/dist/tools/journal-search.js.map +1 -1
- package/dist/tools/journal-state.d.ts +0 -3
- package/dist/tools/journal-state.d.ts.map +1 -1
- package/dist/tools/journal-state.js +5 -93
- package/dist/tools/journal-state.js.map +1 -1
- package/dist/tools/journal-write.d.ts.map +1 -1
- package/dist/tools/journal-write.js +3 -62
- package/dist/tools/journal-write.js.map +1 -1
- package/dist/tools/knowledge-read.d.ts.map +1 -1
- package/dist/tools/knowledge-read.js +3 -100
- package/dist/tools/knowledge-read.js.map +1 -1
- package/dist/tools/knowledge-write.d.ts.map +1 -1
- package/dist/tools/knowledge-write.js +3 -66
- package/dist/tools/knowledge-write.js.map +1 -1
- package/dist/tools/nudge.d.ts.map +1 -1
- package/dist/tools/nudge.js +3 -25
- package/dist/tools/nudge.js.map +1 -1
- package/dist/tools/palace-lint.d.ts +2 -6
- package/dist/tools/palace-lint.d.ts.map +1 -1
- package/dist/tools/palace-lint.js +3 -135
- package/dist/tools/palace-lint.js.map +1 -1
- package/dist/tools/palace-read.d.ts +2 -5
- package/dist/tools/palace-read.d.ts.map +1 -1
- package/dist/tools/palace-read.js +5 -62
- package/dist/tools/palace-read.js.map +1 -1
- package/dist/tools/palace-search.d.ts +2 -5
- package/dist/tools/palace-search.d.ts.map +1 -1
- package/dist/tools/palace-search.js +3 -66
- package/dist/tools/palace-search.js.map +1 -1
- package/dist/tools/palace-walk.d.ts +2 -11
- package/dist/tools/palace-walk.d.ts.map +1 -1
- package/dist/tools/palace-walk.js +3 -149
- package/dist/tools/palace-walk.js.map +1 -1
- package/dist/tools/palace-write.d.ts +2 -5
- package/dist/tools/palace-write.d.ts.map +1 -1
- package/dist/tools/palace-write.js +3 -90
- package/dist/tools/palace-write.js.map +1 -1
- package/dist/tools/recall-insight.d.ts +2 -8
- package/dist/tools/recall-insight.d.ts.map +1 -1
- package/dist/tools/recall-insight.js +3 -35
- package/dist/tools/recall-insight.js.map +1 -1
- package/package.json +9 -46
- package/README.md +0 -435
- package/dist/helpers/journal-files.d.ts +0 -30
- package/dist/helpers/journal-files.d.ts.map +0 -1
- package/dist/helpers/journal-files.js +0 -96
- package/dist/helpers/journal-files.js.map +0 -1
- package/dist/helpers/sections.d.ts +0 -12
- package/dist/helpers/sections.d.ts.map +0 -1
- package/dist/helpers/sections.js +0 -84
- package/dist/helpers/sections.js.map +0 -1
- package/dist/palace/awareness.d.ts +0 -67
- package/dist/palace/awareness.d.ts.map +0 -1
- package/dist/palace/awareness.js +0 -231
- package/dist/palace/awareness.js.map +0 -1
- package/dist/palace/consolidate.d.ts +0 -28
- package/dist/palace/consolidate.d.ts.map +0 -1
- package/dist/palace/consolidate.js +0 -129
- package/dist/palace/consolidate.js.map +0 -1
- package/dist/palace/fan-out.d.ts +0 -15
- package/dist/palace/fan-out.d.ts.map +0 -1
- package/dist/palace/fan-out.js +0 -78
- package/dist/palace/fan-out.js.map +0 -1
- package/dist/palace/graph.d.ts +0 -11
- package/dist/palace/graph.d.ts.map +0 -1
- package/dist/palace/graph.js +0 -59
- package/dist/palace/graph.js.map +0 -1
- package/dist/palace/identity.d.ts +0 -6
- package/dist/palace/identity.d.ts.map +0 -1
- package/dist/palace/identity.js +0 -18
- package/dist/palace/identity.js.map +0 -1
- package/dist/palace/index-manager.d.ts +0 -7
- package/dist/palace/index-manager.d.ts.map +0 -1
- package/dist/palace/index-manager.js +0 -46
- package/dist/palace/index-manager.js.map +0 -1
- package/dist/palace/insights-index.d.ts +0 -39
- package/dist/palace/insights-index.d.ts.map +0 -1
- package/dist/palace/insights-index.js +0 -101
- package/dist/palace/insights-index.js.map +0 -1
- package/dist/palace/log.d.ts +0 -9
- package/dist/palace/log.d.ts.map +0 -1
- package/dist/palace/log.js +0 -28
- package/dist/palace/log.js.map +0 -1
- package/dist/palace/obsidian.d.ts +0 -12
- package/dist/palace/obsidian.d.ts.map +0 -1
- package/dist/palace/obsidian.js +0 -76
- package/dist/palace/obsidian.js.map +0 -1
- package/dist/palace/rooms.d.ts +0 -14
- package/dist/palace/rooms.d.ts.map +0 -1
- package/dist/palace/rooms.js +0 -117
- package/dist/palace/rooms.js.map +0 -1
- package/dist/palace/salience.d.ts +0 -15
- package/dist/palace/salience.d.ts.map +0 -1
- package/dist/palace/salience.js +0 -33
- package/dist/palace/salience.js.map +0 -1
- package/dist/storage/fs-utils.d.ts +0 -8
- package/dist/storage/fs-utils.d.ts.map +0 -1
- package/dist/storage/fs-utils.js +0 -28
- package/dist/storage/fs-utils.js.map +0 -1
- package/dist/storage/paths.d.ts +0 -21
- package/dist/storage/paths.d.ts.map +0 -1
- package/dist/storage/paths.js +0 -59
- package/dist/storage/paths.js.map +0 -1
- package/dist/storage/project.d.ts +0 -17
- package/dist/storage/project.d.ts.map +0 -1
- package/dist/storage/project.js +0 -130
- package/dist/storage/project.js.map +0 -1
- package/dist/types.d.ts +0 -112
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -31
- package/dist/types.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context-synthesize.js","sourceRoot":"","sources":["../../src/tools/context-synthesize.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,
|
|
1
|
+
{"version":3,"file":"context-synthesize.js","sourceRoot":"","sources":["../../src/tools/context-synthesize.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAEtD,MAAM,UAAU,QAAQ,CAAC,MAAiB;IACxC,MAAM,CAAC,YAAY,CAAC,oBAAoB,EAAE;QACxC,KAAK,EAAE,oBAAoB;QAC3B,WAAW,EACT,wEAAwE;YACxE,6FAA6F;QAC/F,WAAW,EAAE;YACX,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,QAAQ,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
|
+
{"version":3,"file":"journal-archive.d.ts","sourceRoot":"","sources":["../../src/tools/journal-archive.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAIzE,wBAAgB,QAAQ,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAchD"}
|
|
@@ -1,12 +1,5 @@
|
|
|
1
1
|
import * as z from "zod/v4";
|
|
2
|
-
import
|
|
3
|
-
import * as path from "node:path";
|
|
4
|
-
import { resolveProject } from "../storage/project.js";
|
|
5
|
-
import { journalDir } from "../storage/paths.js";
|
|
6
|
-
import { ensureDir } from "../storage/fs-utils.js";
|
|
7
|
-
import { listJournalFiles, updateIndex } from "../helpers/journal-files.js";
|
|
8
|
-
import { extractSection } from "../helpers/sections.js";
|
|
9
|
-
import { stateFilePath } from "./journal-state.js";
|
|
2
|
+
import { journalArchive } from "agent-recall-core";
|
|
10
3
|
export function register(server) {
|
|
11
4
|
server.registerTool("journal_archive", {
|
|
12
5
|
title: "Archive Old Entries",
|
|
@@ -17,46 +10,8 @@ export function register(server) {
|
|
|
17
10
|
project: z.string().default("auto"),
|
|
18
11
|
},
|
|
19
12
|
}, async ({ older_than_days, project }) => {
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
const dir = journalDir(slug);
|
|
23
|
-
const archiveDir = path.join(dir, "archive");
|
|
24
|
-
ensureDir(archiveDir);
|
|
25
|
-
let archived = 0;
|
|
26
|
-
const summaries = [];
|
|
27
|
-
for (const entry of entries) {
|
|
28
|
-
const ageMs = Date.now() - new Date(entry.date).getTime();
|
|
29
|
-
const ageDays = ageMs / (1000 * 60 * 60 * 24);
|
|
30
|
-
if (ageDays > older_than_days) {
|
|
31
|
-
const srcPath = path.join(entry.dir, entry.file);
|
|
32
|
-
const content = fs.readFileSync(srcPath, "utf-8");
|
|
33
|
-
const brief = extractSection(content, "brief");
|
|
34
|
-
const firstLine = brief?.split("\n").find(l => l.trim().length > 0) ?? "(no brief)";
|
|
35
|
-
const destPath = path.join(archiveDir, entry.file);
|
|
36
|
-
fs.copyFileSync(srcPath, destPath);
|
|
37
|
-
fs.unlinkSync(srcPath);
|
|
38
|
-
const stateSrc = stateFilePath(slug, entry.date);
|
|
39
|
-
if (fs.existsSync(stateSrc)) {
|
|
40
|
-
const stateDest = path.join(archiveDir, `${entry.date}.state.json`);
|
|
41
|
-
fs.copyFileSync(stateSrc, stateDest);
|
|
42
|
-
fs.unlinkSync(stateSrc);
|
|
43
|
-
}
|
|
44
|
-
summaries.push(`${entry.date}: ${firstLine}`);
|
|
45
|
-
archived++;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
if (summaries.length > 0) {
|
|
49
|
-
const indexPath = path.join(archiveDir, "index.md");
|
|
50
|
-
const existing = fs.existsSync(indexPath) ? fs.readFileSync(indexPath, "utf-8") : "# Archive\n\n";
|
|
51
|
-
fs.writeFileSync(indexPath, existing + summaries.join("\n") + "\n", "utf-8");
|
|
52
|
-
}
|
|
53
|
-
updateIndex(slug);
|
|
54
|
-
return {
|
|
55
|
-
content: [{
|
|
56
|
-
type: "text",
|
|
57
|
-
text: JSON.stringify({ archived, summaries, archive_dir: archiveDir }),
|
|
58
|
-
}],
|
|
59
|
-
};
|
|
13
|
+
const result = await journalArchive({ older_than_days, project });
|
|
14
|
+
return { content: [{ type: "text", text: JSON.stringify(result) }] };
|
|
60
15
|
});
|
|
61
16
|
}
|
|
62
17
|
//# sourceMappingURL=journal-archive.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"journal-archive.js","sourceRoot":"","sources":["../../src/tools/journal-archive.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,
|
|
1
|
+
{"version":3,"file":"journal-archive.js","sourceRoot":"","sources":["../../src/tools/journal-archive.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEnD,MAAM,UAAU,QAAQ,CAAC,MAAiB;IACxC,MAAM,CAAC,YAAY,CAAC,iBAAiB,EAAE;QACrC,KAAK,EAAE,qBAAqB;QAC5B,WAAW,EACT,+FAA+F;YAC/F,oEAAoE;QACtE,WAAW,EAAE;YACX,eAAe,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,2CAA2C,CAAC;YAClG,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC;SACpC;KACF,EAAE,KAAK,EAAE,EAAE,eAAe,EAAE,OAAO,EAAE,EAAE,EAAE;QACxC,MAAM,MAAM,GAAG,MAAM,cAAc,CAAC,EAAE,eAAe,EAAE,OAAO,EAAE,CAAC,CAAC;QAClE,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,CAAC;IAChF,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"journal-capture.d.ts","sourceRoot":"","sources":["../../src/tools/journal-capture.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;
|
|
1
|
+
{"version":3,"file":"journal-capture.d.ts","sourceRoot":"","sources":["../../src/tools/journal-capture.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAIzE,wBAAgB,QAAQ,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CA+BhD"}
|
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
import * as z from "zod/v4";
|
|
2
|
-
import
|
|
3
|
-
import * as path from "node:path";
|
|
4
|
-
import { resolveProject } from "../storage/project.js";
|
|
5
|
-
import { journalDir } from "../storage/paths.js";
|
|
6
|
-
import { ensureDir, todayISO } from "../storage/fs-utils.js";
|
|
7
|
-
import { countLogEntries } from "../helpers/journal-files.js";
|
|
2
|
+
import { journalCapture } from "agent-recall-core";
|
|
8
3
|
export function register(server) {
|
|
9
4
|
server.registerTool("journal_capture", {
|
|
10
5
|
title: "Capture Q&A",
|
|
@@ -28,60 +23,8 @@ export function register(server) {
|
|
|
28
23
|
.describe("Project slug. Defaults to auto-detect."),
|
|
29
24
|
},
|
|
30
25
|
}, async ({ question, answer, tags, palace_room, project }) => {
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
const dir = journalDir(slug);
|
|
34
|
-
ensureDir(dir);
|
|
35
|
-
const logPath = path.join(dir, `${date}-log.md`);
|
|
36
|
-
const entryNum = countLogEntries(logPath) + 1;
|
|
37
|
-
const tagStr = tags && tags.length > 0 ? ` [${tags.join(", ")}]` : "";
|
|
38
|
-
const timestamp = new Date().toISOString().slice(11, 19);
|
|
39
|
-
let entry = `### Q${entryNum} (${timestamp})${tagStr}\n\n`;
|
|
40
|
-
entry += `**Q:** ${question}\n\n`;
|
|
41
|
-
entry += `**A:** ${answer}\n\n`;
|
|
42
|
-
if (!fs.existsSync(logPath)) {
|
|
43
|
-
const header = `# ${date} — ${slug} — Session Log\n\n`;
|
|
44
|
-
fs.writeFileSync(logPath, header + entry, "utf-8");
|
|
45
|
-
}
|
|
46
|
-
else {
|
|
47
|
-
fs.appendFileSync(logPath, entry, "utf-8");
|
|
48
|
-
}
|
|
49
|
-
// Palace integration
|
|
50
|
-
let palaceResult = null;
|
|
51
|
-
if (palace_room) {
|
|
52
|
-
try {
|
|
53
|
-
const { ensurePalaceInitialized, roomExists, createRoom } = await import("../palace/rooms.js");
|
|
54
|
-
const { palaceDir } = await import("../storage/paths.js");
|
|
55
|
-
const { fanOut } = await import("../palace/fan-out.js");
|
|
56
|
-
const { updatePalaceIndex } = await import("../palace/index-manager.js");
|
|
57
|
-
ensurePalaceInitialized(slug);
|
|
58
|
-
if (!roomExists(slug, palace_room)) {
|
|
59
|
-
createRoom(slug, palace_room, palace_room.charAt(0).toUpperCase() + palace_room.slice(1), "Auto-created from capture", []);
|
|
60
|
-
}
|
|
61
|
-
const pd = palaceDir(slug);
|
|
62
|
-
const targetPath = path.join(pd, "rooms", palace_room, "captures.md");
|
|
63
|
-
ensureDir(path.dirname(targetPath));
|
|
64
|
-
const captureEntry = `\n### Q${entryNum} (${date})\n**Q:** ${question}\n**A:** ${answer}\n`;
|
|
65
|
-
if (fs.existsSync(targetPath)) {
|
|
66
|
-
fs.appendFileSync(targetPath, captureEntry, "utf-8");
|
|
67
|
-
}
|
|
68
|
-
else {
|
|
69
|
-
fs.writeFileSync(targetPath, `# ${palace_room} / captures\n${captureEntry}`, "utf-8");
|
|
70
|
-
}
|
|
71
|
-
fanOut(slug, palace_room, "captures", `${question} ${answer}`, [], "medium");
|
|
72
|
-
updatePalaceIndex(slug);
|
|
73
|
-
palaceResult = { room: palace_room };
|
|
74
|
-
}
|
|
75
|
-
catch {
|
|
76
|
-
// Palace integration is optional, don't fail the capture
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
return {
|
|
80
|
-
content: [{
|
|
81
|
-
type: "text",
|
|
82
|
-
text: JSON.stringify({ success: true, entry_number: entryNum, palace: palaceResult }),
|
|
83
|
-
}],
|
|
84
|
-
};
|
|
26
|
+
const result = await journalCapture({ question, answer, tags, palace_room, project });
|
|
27
|
+
return { content: [{ type: "text", text: JSON.stringify(result) }] };
|
|
85
28
|
});
|
|
86
29
|
}
|
|
87
30
|
//# sourceMappingURL=journal-capture.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"journal-capture.js","sourceRoot":"","sources":["../../src/tools/journal-capture.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,
|
|
1
|
+
{"version":3,"file":"journal-capture.js","sourceRoot":"","sources":["../../src/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sources":["../../src/tools/journal-cold-start.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;
|
|
1
|
+
{"version":3,"file":"journal-cold-start.d.ts","sourceRoot":"","sources":["../../src/tools/journal-cold-start.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAIzE,wBAAgB,QAAQ,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAyBhD"}
|
|
@@ -1,67 +1,25 @@
|
|
|
1
1
|
import * as z from "zod/v4";
|
|
2
|
-
import
|
|
3
|
-
import * as path from "node:path";
|
|
4
|
-
import { resolveProject } from "../storage/project.js";
|
|
5
|
-
import { listJournalFiles } from "../helpers/journal-files.js";
|
|
6
|
-
import { extractSection } from "../helpers/sections.js";
|
|
7
|
-
import { todayISO } from "../storage/fs-utils.js";
|
|
8
|
-
import { readState } from "./journal-state.js";
|
|
2
|
+
import { journalColdStart } from "agent-recall-core";
|
|
9
3
|
export function register(server) {
|
|
10
4
|
server.registerTool("journal_cold_start", {
|
|
11
|
-
title: "Cold Start Brief (
|
|
12
|
-
description: "Returns a
|
|
13
|
-
"
|
|
5
|
+
title: "Cold Start Brief (Palace-First)",
|
|
6
|
+
description: "Returns a palace-first cold-start package. " +
|
|
7
|
+
"Loads curated palace context (~200 tokens) FIRST, then recent journals. " +
|
|
8
|
+
"HOT: today + yesterday (full state + brief). " +
|
|
9
|
+
"WARM: 2-7 days (count only — content already promoted to palace). " +
|
|
10
|
+
"COLD: older (count only). " +
|
|
14
11
|
"Designed for minimal context consumption on session start.",
|
|
15
12
|
inputSchema: {
|
|
16
13
|
project: z.string().default("auto"),
|
|
17
14
|
},
|
|
18
15
|
}, async ({ project }) => {
|
|
19
|
-
const
|
|
20
|
-
const entries = listJournalFiles(slug);
|
|
21
|
-
const _today = todayISO();
|
|
22
|
-
const hot = [];
|
|
23
|
-
const warm = [];
|
|
24
|
-
let coldCount = 0;
|
|
25
|
-
for (const entry of entries) {
|
|
26
|
-
const ageMs = Date.now() - new Date(entry.date).getTime();
|
|
27
|
-
const ageDays = ageMs / (1000 * 60 * 60 * 24);
|
|
28
|
-
if (ageDays <= 1.5) {
|
|
29
|
-
const state = readState(slug, entry.date);
|
|
30
|
-
const fullPath = path.join(entry.dir, entry.file);
|
|
31
|
-
const stats = fs.statSync(fullPath);
|
|
32
|
-
const content = stats.size > 5120
|
|
33
|
-
? fs.readFileSync(fullPath, "utf-8").slice(0, 5120) + "\n...(truncated, use journal_read for full)"
|
|
34
|
-
: fs.readFileSync(fullPath, "utf-8");
|
|
35
|
-
hot.push({
|
|
36
|
-
date: entry.date,
|
|
37
|
-
state,
|
|
38
|
-
brief: extractSection(content, "brief"),
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
else if (ageDays <= 7) {
|
|
42
|
-
const fullPath = path.join(entry.dir, entry.file);
|
|
43
|
-
const content = fs.readFileSync(fullPath, "utf-8").slice(0, 2048);
|
|
44
|
-
warm.push({
|
|
45
|
-
date: entry.date,
|
|
46
|
-
brief: extractSection(content, "brief"),
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
else {
|
|
50
|
-
coldCount++;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
16
|
+
const result = await journalColdStart({ project });
|
|
53
17
|
return {
|
|
54
18
|
content: [{
|
|
55
19
|
type: "text",
|
|
56
20
|
text: JSON.stringify({
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
hot: { count: hot.length, entries: hot },
|
|
60
|
-
warm: { count: warm.length, entries: warm },
|
|
61
|
-
cold: { count: coldCount },
|
|
62
|
-
},
|
|
63
|
-
total_entries: entries.length,
|
|
64
|
-
tip: "HOT entries have full state. WARM have briefs only. Use journal_read for COLD entries.",
|
|
21
|
+
...result,
|
|
22
|
+
tip: "Palace context is your curated starting point. HOT entries have today's raw state. Use journal_read for older entries.",
|
|
65
23
|
}),
|
|
66
24
|
}],
|
|
67
25
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"journal-cold-start.js","sourceRoot":"","sources":["../../src/tools/journal-cold-start.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,
|
|
1
|
+
{"version":3,"file":"journal-cold-start.js","sourceRoot":"","sources":["../../src/tools/journal-cold-start.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAErD,MAAM,UAAU,QAAQ,CAAC,MAAiB;IACxC,MAAM,CAAC,YAAY,CAAC,oBAAoB,EAAE;QACxC,KAAK,EAAE,iCAAiC;QACxC,WAAW,EACT,6CAA6C;YAC7C,0EAA0E;YAC1E,+CAA+C;YAC/C,oEAAoE;YACpE,4BAA4B;YAC5B,4DAA4D;QAC9D,WAAW,EAAE;YACX,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC;SACpC;KACF,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;QACvB,MAAM,MAAM,GAAG,MAAM,gBAAgB,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC;QACnD,OAAO;YACL,OAAO,EAAE,CAAC;oBACR,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;wBACnB,GAAG,MAAM;wBACT,GAAG,EAAE,wHAAwH;qBAC9H,CAAC;iBACH,CAAC;SACH,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"journal-list.d.ts","sourceRoot":"","sources":["../../src/tools/journal-list.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;
|
|
1
|
+
{"version":3,"file":"journal-list.d.ts","sourceRoot":"","sources":["../../src/tools/journal-list.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAIzE,wBAAgB,QAAQ,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAmBhD"}
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import * as z from "zod/v4";
|
|
2
|
-
import
|
|
3
|
-
import * as path from "node:path";
|
|
4
|
-
import { resolveProject } from "../storage/project.js";
|
|
5
|
-
import { listJournalFiles, extractTitle, extractMomentum } from "../helpers/journal-files.js";
|
|
2
|
+
import { journalList } from "agent-recall-core";
|
|
6
3
|
export function register(server) {
|
|
7
4
|
server.registerTool("journal_list", {
|
|
8
5
|
title: "List Journal Entries",
|
|
@@ -19,25 +16,8 @@ export function register(server) {
|
|
|
19
16
|
.describe("Return the N most recent entries. 0 = all."),
|
|
20
17
|
},
|
|
21
18
|
}, async ({ project, limit }) => {
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
if (limit > 0) {
|
|
25
|
-
entries = entries.slice(0, limit);
|
|
26
|
-
}
|
|
27
|
-
const result = entries.map((e) => {
|
|
28
|
-
const content = fs.readFileSync(path.join(e.dir, e.file), "utf-8");
|
|
29
|
-
return {
|
|
30
|
-
date: e.date,
|
|
31
|
-
title: extractTitle(content),
|
|
32
|
-
momentum: extractMomentum(content),
|
|
33
|
-
};
|
|
34
|
-
});
|
|
35
|
-
return {
|
|
36
|
-
content: [{
|
|
37
|
-
type: "text",
|
|
38
|
-
text: JSON.stringify({ project: slug, entries: result }),
|
|
39
|
-
}],
|
|
40
|
-
};
|
|
19
|
+
const result = await journalList({ project, limit });
|
|
20
|
+
return { content: [{ type: "text", text: JSON.stringify(result) }] };
|
|
41
21
|
});
|
|
42
22
|
}
|
|
43
23
|
//# sourceMappingURL=journal-list.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"journal-list.js","sourceRoot":"","sources":["../../src/tools/journal-list.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,
|
|
1
|
+
{"version":3,"file":"journal-list.js","sourceRoot":"","sources":["../../src/tools/journal-list.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,MAAM,UAAU,QAAQ,CAAC,MAAiB;IACxC,MAAM,CAAC,YAAY,CAAC,cAAc,EAAE;QAClC,KAAK,EAAE,sBAAsB;QAC7B,WAAW,EAAE,+CAA+C;QAC5D,WAAW,EAAE;YACX,OAAO,EAAE,CAAC;iBACP,MAAM,EAAE;iBACR,OAAO,CAAC,MAAM,CAAC;iBACf,QAAQ,CAAC,wCAAwC,CAAC;YACrD,KAAK,EAAE,CAAC;iBACL,MAAM,EAAE;iBACR,GAAG,EAAE;iBACL,OAAO,CAAC,EAAE,CAAC;iBACX,QAAQ,CAAC,4CAA4C,CAAC;SAC1D;KACF,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE;QAC9B,MAAM,MAAM,GAAG,MAAM,WAAW,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC;QACrD,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,CAAC;IAChF,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"journal-projects.d.ts","sourceRoot":"","sources":["../../src/tools/journal-projects.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;
|
|
1
|
+
{"version":3,"file":"journal-projects.d.ts","sourceRoot":"","sources":["../../src/tools/journal-projects.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAGzE,wBAAgB,QAAQ,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAShD"}
|
|
@@ -1,25 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { listAllProjects } from "../storage/project.js";
|
|
1
|
+
import { journalProjects } from "agent-recall-core";
|
|
3
2
|
export function register(server) {
|
|
4
3
|
server.registerTool("journal_projects", {
|
|
5
4
|
title: "List Projects",
|
|
6
5
|
description: "List all projects tracked by agent-recall on this machine.",
|
|
7
6
|
inputSchema: {},
|
|
8
7
|
}, async () => {
|
|
9
|
-
const
|
|
10
|
-
return {
|
|
11
|
-
content: [{
|
|
12
|
-
type: "text",
|
|
13
|
-
text: JSON.stringify({
|
|
14
|
-
projects: projects.map((p) => ({
|
|
15
|
-
slug: p.slug,
|
|
16
|
-
last_entry: p.lastEntry,
|
|
17
|
-
entry_count: p.entryCount,
|
|
18
|
-
})),
|
|
19
|
-
journal_root: JOURNAL_ROOT,
|
|
20
|
-
}),
|
|
21
|
-
}],
|
|
22
|
-
};
|
|
8
|
+
const result = await journalProjects();
|
|
9
|
+
return { content: [{ type: "text", text: JSON.stringify(result) }] };
|
|
23
10
|
});
|
|
24
11
|
}
|
|
25
12
|
//# sourceMappingURL=journal-projects.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"journal-projects.js","sourceRoot":"","sources":["../../src/tools/journal-projects.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"journal-projects.js","sourceRoot":"","sources":["../../src/tools/journal-projects.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,MAAM,UAAU,QAAQ,CAAC,MAAiB;IACxC,MAAM,CAAC,YAAY,CAAC,kBAAkB,EAAE;QACtC,KAAK,EAAE,eAAe;QACtB,WAAW,EAAE,4DAA4D;QACzE,WAAW,EAAE,EAAE;KAChB,EAAE,KAAK,IAAI,EAAE;QACZ,MAAM,MAAM,GAAG,MAAM,eAAe,EAAE,CAAC;QACvC,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,CAAC;IAChF,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"journal-read.d.ts","sourceRoot":"","sources":["../../src/tools/journal-read.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;
|
|
1
|
+
{"version":3,"file":"journal-read.d.ts","sourceRoot":"","sources":["../../src/tools/journal-read.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAIzE,wBAAgB,QAAQ,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAmChD"}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import * as z from "zod/v4";
|
|
2
|
-
import {
|
|
3
|
-
import { listJournalFiles, readJournalFile } from "../helpers/journal-files.js";
|
|
4
|
-
import { extractSection } from "../helpers/sections.js";
|
|
2
|
+
import { journalRead } from "agent-recall-core";
|
|
5
3
|
export function register(server) {
|
|
6
4
|
server.registerTool("journal_read", {
|
|
7
5
|
title: "Read Journal Entry",
|
|
@@ -24,49 +22,11 @@ export function register(server) {
|
|
|
24
22
|
.describe("Which section to return. 'brief' returns only the cold-start summary. 'all' returns full file."),
|
|
25
23
|
},
|
|
26
24
|
}, async ({ date, project, section }) => {
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
const entries = listJournalFiles(slug);
|
|
31
|
-
if (entries.length === 0) {
|
|
32
|
-
return {
|
|
33
|
-
content: [{
|
|
34
|
-
type: "text",
|
|
35
|
-
text: JSON.stringify({
|
|
36
|
-
error: `No journal entries found for project '${slug}'`,
|
|
37
|
-
project: slug,
|
|
38
|
-
}),
|
|
39
|
-
}],
|
|
40
|
-
isError: true,
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
targetDate = entries[0].date;
|
|
25
|
+
const result = await journalRead({ date, project, section });
|
|
26
|
+
if (result.error) {
|
|
27
|
+
return { content: [{ type: "text", text: JSON.stringify(result) }], isError: true };
|
|
44
28
|
}
|
|
45
|
-
|
|
46
|
-
if (!fileContent) {
|
|
47
|
-
return {
|
|
48
|
-
content: [{
|
|
49
|
-
type: "text",
|
|
50
|
-
text: JSON.stringify({
|
|
51
|
-
error: `No journal entry found for ${targetDate} in project '${slug}'`,
|
|
52
|
-
project: slug,
|
|
53
|
-
date: targetDate,
|
|
54
|
-
}),
|
|
55
|
-
}],
|
|
56
|
-
isError: true,
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
const extracted = extractSection(fileContent, section);
|
|
60
|
-
return {
|
|
61
|
-
content: [{
|
|
62
|
-
type: "text",
|
|
63
|
-
text: JSON.stringify({
|
|
64
|
-
content: extracted || "",
|
|
65
|
-
date: targetDate,
|
|
66
|
-
project: slug,
|
|
67
|
-
}),
|
|
68
|
-
}],
|
|
69
|
-
};
|
|
29
|
+
return { content: [{ type: "text", text: JSON.stringify(result) }] };
|
|
70
30
|
});
|
|
71
31
|
}
|
|
72
32
|
//# sourceMappingURL=journal-read.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"journal-read.js","sourceRoot":"","sources":["../../src/tools/journal-read.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"journal-read.js","sourceRoot":"","sources":["../../src/tools/journal-read.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,MAAM,UAAU,QAAQ,CAAC,MAAiB;IACxC,MAA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ollup.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAIzE,wBAAgB,QAAQ,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAkBhD"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import * as z from "zod/v4";
|
|
2
|
+
import { journalRollup } from "agent-recall-core";
|
|
3
|
+
export function register(server) {
|
|
4
|
+
server.registerTool("journal_rollup", {
|
|
5
|
+
title: "Weekly Journal Roll-Up",
|
|
6
|
+
description: "Condense old daily journals into weekly summaries. " +
|
|
7
|
+
"Groups entries by ISO week, synthesizes a summary, archives originals. " +
|
|
8
|
+
"Prevents journal accumulation — after 30 days you have 4 weekly files instead of 30 daily files. " +
|
|
9
|
+
"Only processes complete weeks that are 7+ days old with 2+ entries. Use dry_run=true to preview.",
|
|
10
|
+
inputSchema: {
|
|
11
|
+
min_age_days: z.number().int().default(7).describe("Only roll up weeks where ALL entries are older than this"),
|
|
12
|
+
min_entries: z.number().int().default(2).describe("Minimum daily entries in a week to trigger roll-up"),
|
|
13
|
+
dry_run: z.boolean().default(false).describe("Preview without writing or archiving"),
|
|
14
|
+
project: z.string().default("auto"),
|
|
15
|
+
},
|
|
16
|
+
}, async ({ min_age_days, min_entries, dry_run, project }) => {
|
|
17
|
+
const result = await journalRollup({ min_age_days, min_entries, dry_run, project });
|
|
18
|
+
return { content: [{ type: "text", text: JSON.stringify(result) }] };
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=journal-rollup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"journal-rollup.js","sourceRoot":"","sources":["../../src/tools/journal-rollup.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElD,MAAM,UAAU,QAAQ,CAAC,MAAiB;IACxC,MAAM,CAAC,YAAY,CAAC,gBAAgB,EAAE;QACpC,KAAK,EAAE,wBAAwB;QAC/B,WAAW,EACT,qDAAqD;YACrD,yEAAyE;YACzE,mGAAmG;YACnG,kGAAkG;QACpG,WAAW,EAAE;YACX,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,0DAA0D,CAAC;YAC9G,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,oDAAoD,CAAC;YACvG,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,sCAAsC,CAAC;YACpF,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC;SACpC;KACF,EAAE,KAAK,EAAE,EAAE,YAAY,EAAE,WAAW,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE;QAC3D,MAAM,MAAM,GAAG,MAAM,aAAa,CAAC,EAAE,YAAY,EAAE,WAAW,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC;QACpF,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,CAAC;IAChF,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"journal-search.d.ts","sourceRoot":"","sources":["../../src/tools/journal-search.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;
|
|
1
|
+
{"version":3,"file":"journal-search.d.ts","sourceRoot":"","sources":["../../src/tools/journal-search.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAIzE,wBAAgB,QAAQ,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAqBhD"}
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import * as z from "zod/v4";
|
|
2
|
-
import
|
|
3
|
-
import * as path from "node:path";
|
|
4
|
-
import { resolveProject } from "../storage/project.js";
|
|
5
|
-
import { journalDirs, palaceDir } from "../storage/paths.js";
|
|
6
|
-
import { ensurePalaceInitialized, listRooms } from "../palace/rooms.js";
|
|
2
|
+
import { journalSearch } from "agent-recall-core";
|
|
7
3
|
export function register(server) {
|
|
8
4
|
server.registerTool("journal_search", {
|
|
9
5
|
title: "Search Journals",
|
|
@@ -22,92 +18,8 @@ export function register(server) {
|
|
|
22
18
|
.describe("Also search palace rooms (slower but more comprehensive)"),
|
|
23
19
|
},
|
|
24
20
|
}, async ({ query, project, section, include_palace }) => {
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
const queryLower = query.toLowerCase();
|
|
28
|
-
const results = [];
|
|
29
|
-
for (const dir of dirs) {
|
|
30
|
-
if (!fs.existsSync(dir))
|
|
31
|
-
continue;
|
|
32
|
-
const files = fs.readdirSync(dir).filter((f) => f.endsWith(".md"));
|
|
33
|
-
for (const file of files) {
|
|
34
|
-
const filePath = path.join(dir, file);
|
|
35
|
-
const content = fs.readFileSync(filePath, "utf-8");
|
|
36
|
-
const lines = content.split("\n");
|
|
37
|
-
let currentSection = "top";
|
|
38
|
-
for (let i = 0; i < lines.length; i++) {
|
|
39
|
-
const line = lines[i];
|
|
40
|
-
if (line.startsWith("## ")) {
|
|
41
|
-
currentSection = line
|
|
42
|
-
.slice(3)
|
|
43
|
-
.trim()
|
|
44
|
-
.toLowerCase()
|
|
45
|
-
.replace(/\s+/g, "_");
|
|
46
|
-
}
|
|
47
|
-
if (section && currentSection !== section.toLowerCase()) {
|
|
48
|
-
continue;
|
|
49
|
-
}
|
|
50
|
-
if (line.toLowerCase().includes(queryLower)) {
|
|
51
|
-
const dateMatch = file.match(/^(\d{4}-\d{2}-\d{2})/);
|
|
52
|
-
const date = dateMatch ? dateMatch[1] : file;
|
|
53
|
-
const start = Math.max(0, line.toLowerCase().indexOf(queryLower) - 40);
|
|
54
|
-
const end = Math.min(line.length, line.toLowerCase().indexOf(queryLower) + query.length + 40);
|
|
55
|
-
let excerpt = line.slice(start, end).trim();
|
|
56
|
-
if (start > 0)
|
|
57
|
-
excerpt = "..." + excerpt;
|
|
58
|
-
if (end < line.length)
|
|
59
|
-
excerpt = excerpt + "...";
|
|
60
|
-
results.push({ date, section: currentSection, excerpt, line: i + 1 });
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
// Palace search
|
|
66
|
-
if (include_palace) {
|
|
67
|
-
try {
|
|
68
|
-
ensurePalaceInitialized(slug);
|
|
69
|
-
const pd = palaceDir(slug);
|
|
70
|
-
const rooms = listRooms(slug);
|
|
71
|
-
for (const room of rooms) {
|
|
72
|
-
const roomPath = path.join(pd, "rooms", room.slug);
|
|
73
|
-
if (!fs.existsSync(roomPath))
|
|
74
|
-
continue;
|
|
75
|
-
const files = fs.readdirSync(roomPath).filter((f) => f.endsWith(".md"));
|
|
76
|
-
for (const file of files) {
|
|
77
|
-
const filePath = path.join(roomPath, file);
|
|
78
|
-
const content = fs.readFileSync(filePath, "utf-8");
|
|
79
|
-
const lines = content.split("\n");
|
|
80
|
-
for (let i = 0; i < lines.length; i++) {
|
|
81
|
-
if (lines[i].toLowerCase().includes(queryLower)) {
|
|
82
|
-
const start = Math.max(0, lines[i].toLowerCase().indexOf(queryLower) - 40);
|
|
83
|
-
const end = Math.min(lines[i].length, lines[i].toLowerCase().indexOf(queryLower) + query.length + 40);
|
|
84
|
-
let excerpt = lines[i].slice(start, end).trim();
|
|
85
|
-
if (start > 0)
|
|
86
|
-
excerpt = "..." + excerpt;
|
|
87
|
-
if (end < lines[i].length)
|
|
88
|
-
excerpt = excerpt + "...";
|
|
89
|
-
results.push({
|
|
90
|
-
date: `palace:${room.slug}`,
|
|
91
|
-
section: file.replace(".md", ""),
|
|
92
|
-
excerpt,
|
|
93
|
-
line: i + 1,
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
catch {
|
|
101
|
-
// Palace search is optional
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
results.sort((a, b) => b.date.localeCompare(a.date));
|
|
105
|
-
return {
|
|
106
|
-
content: [{
|
|
107
|
-
type: "text",
|
|
108
|
-
text: JSON.stringify({ results }),
|
|
109
|
-
}],
|
|
110
|
-
};
|
|
21
|
+
const result = await journalSearch({ query, project, section, include_palace });
|
|
22
|
+
return { content: [{ type: "text", text: JSON.stringify(result) }] };
|
|
111
23
|
});
|
|
112
24
|
}
|
|
113
25
|
//# sourceMappingURL=journal-search.js.map
|