@bubstack/moe-memory 0.1.0
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/.mcp.json +18 -0
- package/README.md +47 -0
- package/agents/search-conversations.md +171 -0
- package/dist/LICENSE +25 -0
- package/dist/cli.d.ts +25 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +125 -0
- package/dist/cli.js.map +1 -0
- package/dist/codex-hook-trust.d.ts +4 -0
- package/dist/codex-hook-trust.d.ts.map +1 -0
- package/dist/codex-hook-trust.js +114 -0
- package/dist/codex-hook-trust.js.map +1 -0
- package/dist/codex-support.d.ts +6 -0
- package/dist/codex-support.d.ts.map +1 -0
- package/dist/codex-support.js +29 -0
- package/dist/codex-support.js.map +1 -0
- package/dist/constants.d.ts +14 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +14 -0
- package/dist/constants.js.map +1 -0
- package/dist/db.d.ts +103 -0
- package/dist/db.d.ts.map +1 -0
- package/dist/db.js +430 -0
- package/dist/db.js.map +1 -0
- package/dist/doctor-cli.d.ts +3 -0
- package/dist/doctor-cli.d.ts.map +1 -0
- package/dist/doctor-cli.js +43 -0
- package/dist/doctor-cli.js.map +1 -0
- package/dist/doctor.d.ts +17 -0
- package/dist/doctor.d.ts.map +1 -0
- package/dist/doctor.js +98 -0
- package/dist/doctor.js.map +1 -0
- package/dist/embedding-migration.d.ts +73 -0
- package/dist/embedding-migration.d.ts.map +1 -0
- package/dist/embedding-migration.js +120 -0
- package/dist/embedding-migration.js.map +1 -0
- package/dist/embeddings.d.ts +78 -0
- package/dist/embeddings.d.ts.map +1 -0
- package/dist/embeddings.js +180 -0
- package/dist/embeddings.js.map +1 -0
- package/dist/file-lock.d.ts +39 -0
- package/dist/file-lock.d.ts.map +1 -0
- package/dist/file-lock.js +91 -0
- package/dist/file-lock.js.map +1 -0
- package/dist/index-cli.d.ts +10 -0
- package/dist/index-cli.d.ts.map +1 -0
- package/dist/index-cli.js +195 -0
- package/dist/index-cli.js.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +19 -0
- package/dist/index.js.map +1 -0
- package/dist/indexer.d.ts +4 -0
- package/dist/indexer.d.ts.map +1 -0
- package/dist/indexer.js +318 -0
- package/dist/indexer.js.map +1 -0
- package/dist/install-check.d.ts +48 -0
- package/dist/install-check.d.ts.map +1 -0
- package/dist/install-check.js +82 -0
- package/dist/install-check.js.map +1 -0
- package/dist/journal/index.d.ts +5 -0
- package/dist/journal/index.d.ts.map +1 -0
- package/dist/journal/index.js +5 -0
- package/dist/journal/index.js.map +1 -0
- package/dist/journal/legacy-sidecars.d.ts +74 -0
- package/dist/journal/legacy-sidecars.d.ts.map +1 -0
- package/dist/journal/legacy-sidecars.js +151 -0
- package/dist/journal/legacy-sidecars.js.map +1 -0
- package/dist/journal/markdown.d.ts +91 -0
- package/dist/journal/markdown.d.ts.map +1 -0
- package/dist/journal/markdown.js +234 -0
- package/dist/journal/markdown.js.map +1 -0
- package/dist/journal/search.d.ts +91 -0
- package/dist/journal/search.d.ts.map +1 -0
- package/dist/journal/search.js +203 -0
- package/dist/journal/search.js.map +1 -0
- package/dist/journal/store.d.ts +96 -0
- package/dist/journal/store.d.ts.map +1 -0
- package/dist/journal/store.js +270 -0
- package/dist/journal/store.js.map +1 -0
- package/dist/journal-cli.d.ts +19 -0
- package/dist/journal-cli.d.ts.map +1 -0
- package/dist/journal-cli.js +153 -0
- package/dist/journal-cli.js.map +1 -0
- package/dist/logging.d.ts +6 -0
- package/dist/logging.d.ts.map +1 -0
- package/dist/logging.js +20 -0
- package/dist/logging.js.map +1 -0
- package/dist/mcp-server.d.ts +34 -0
- package/dist/mcp-server.d.ts.map +1 -0
- package/dist/mcp-server.js +607 -0
- package/dist/mcp-server.js.map +1 -0
- package/dist/parser.d.ts +11 -0
- package/dist/parser.d.ts.map +1 -0
- package/dist/parser.js +445 -0
- package/dist/parser.js.map +1 -0
- package/dist/paths.d.ts +103 -0
- package/dist/paths.d.ts.map +1 -0
- package/dist/paths.js +258 -0
- package/dist/paths.js.map +1 -0
- package/dist/search-cli.d.ts +3 -0
- package/dist/search-cli.d.ts.map +1 -0
- package/dist/search-cli.js +138 -0
- package/dist/search-cli.js.map +1 -0
- package/dist/search.d.ts +36 -0
- package/dist/search.d.ts.map +1 -0
- package/dist/search.js +371 -0
- package/dist/search.js.map +1 -0
- package/dist/show-cli.d.ts +3 -0
- package/dist/show-cli.d.ts.map +1 -0
- package/dist/show-cli.js +60 -0
- package/dist/show-cli.js.map +1 -0
- package/dist/show.d.ts +3 -0
- package/dist/show.d.ts.map +1 -0
- package/dist/show.js +984 -0
- package/dist/show.js.map +1 -0
- package/dist/stats-cli.d.ts +3 -0
- package/dist/stats-cli.d.ts.map +1 -0
- package/dist/stats-cli.js +51 -0
- package/dist/stats-cli.js.map +1 -0
- package/dist/stats.d.ts +19 -0
- package/dist/stats.d.ts.map +1 -0
- package/dist/stats.js +116 -0
- package/dist/stats.js.map +1 -0
- package/dist/summarizer.d.ts +83 -0
- package/dist/summarizer.d.ts.map +1 -0
- package/dist/summarizer.js +526 -0
- package/dist/summarizer.js.map +1 -0
- package/dist/summary-sentinel.d.ts +31 -0
- package/dist/summary-sentinel.d.ts.map +1 -0
- package/dist/summary-sentinel.js +80 -0
- package/dist/summary-sentinel.js.map +1 -0
- package/dist/sync-cli.d.ts +15 -0
- package/dist/sync-cli.d.ts.map +1 -0
- package/dist/sync-cli.js +202 -0
- package/dist/sync-cli.js.map +1 -0
- package/dist/sync.d.ts +35 -0
- package/dist/sync.d.ts.map +1 -0
- package/dist/sync.js +204 -0
- package/dist/sync.js.map +1 -0
- package/dist/types.d.ts +125 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +32 -0
- package/dist/types.js.map +1 -0
- package/dist/verify.d.ts +30 -0
- package/dist/verify.d.ts.map +1 -0
- package/dist/verify.js +174 -0
- package/dist/verify.js.map +1 -0
- package/dist/version.d.ts +13 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +13 -0
- package/dist/version.js.map +1 -0
- package/hooks/hooks.json +15 -0
- package/package.json +71 -0
- package/prompts/search-agent.md +160 -0
- package/skills/remembering-conversations/MCP-TOOLS.md +147 -0
- package/skills/remembering-conversations/SKILL.md +97 -0
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `moe-memory journal <subcommand>` — the journal half from the terminal.
|
|
3
|
+
*
|
|
4
|
+
* private-journal-mcp had no CLI beyond `--journal-path`: its single bin was the
|
|
5
|
+
* MCP server and nothing else. These subcommands are new surface, and they exist
|
|
6
|
+
* because the journal is no longer self-indexing through sidecars — if the index
|
|
7
|
+
* can be rebuilt, something has to be able to rebuild it.
|
|
8
|
+
*/
|
|
9
|
+
import { initDatabase } from "./db.js";
|
|
10
|
+
import { JournalSearchService } from "./journal/search.js";
|
|
11
|
+
import { JournalStore } from "./journal/store.js";
|
|
12
|
+
import { resolveProjectJournalPath, resolveUserJournalPath } from "./paths.js";
|
|
13
|
+
const HELP = `
|
|
14
|
+
Usage: moe-memory journal <command> [options]
|
|
15
|
+
|
|
16
|
+
COMMANDS:
|
|
17
|
+
index Re-scan both journal directories and update the index
|
|
18
|
+
search <query> Semantic search over journal entries
|
|
19
|
+
recent List the most recent entries
|
|
20
|
+
paths Print the resolved project and user journal directories
|
|
21
|
+
|
|
22
|
+
OPTIONS:
|
|
23
|
+
--journal-path DIR Override the project journal directory
|
|
24
|
+
--scope SCOPE project | user | both (default: both)
|
|
25
|
+
--limit N Max results (default: 10)
|
|
26
|
+
--help, -h Show this help
|
|
27
|
+
|
|
28
|
+
The user-global journal lives under the Moe Memory data directory alongside the
|
|
29
|
+
conversation index; the project journal is <project>/.moe-journal. Set
|
|
30
|
+
MOE_MEMORY_JOURNAL_PATH to point both at one directory.
|
|
31
|
+
`;
|
|
32
|
+
/**
|
|
33
|
+
* Flags that consume the NEXT argument as their value.
|
|
34
|
+
*
|
|
35
|
+
* This set is the whole fix for a real defect. The query used to be built as
|
|
36
|
+
* `rest.filter((arg) => !arg.startsWith("--")).join(" ")`, which drops flag
|
|
37
|
+
* names but keeps their values — so every value-taking flag leaked into the
|
|
38
|
+
* search string:
|
|
39
|
+
*
|
|
40
|
+
* journal search --limit 5 foo searched for "5 foo"
|
|
41
|
+
* journal search --scope user foo searched for "user foo"
|
|
42
|
+
* journal search --journal-path /x foo searched for "/x foo"
|
|
43
|
+
*
|
|
44
|
+
* A semantic search does not fail on a polluted query, it silently returns
|
|
45
|
+
* worse results, which is why nothing caught it. Parsing positionals and flags
|
|
46
|
+
* in one pass is the only way the two cannot disagree.
|
|
47
|
+
*/
|
|
48
|
+
const VALUE_FLAGS = new Set(["--journal-path", "--scope", "--limit"]);
|
|
49
|
+
const DEFAULT_LIMIT = 10;
|
|
50
|
+
export function parseJournalArgs(args) {
|
|
51
|
+
const positionals = [];
|
|
52
|
+
const values = new Map();
|
|
53
|
+
for (let i = 0; i < args.length; i++) {
|
|
54
|
+
const arg = args[i];
|
|
55
|
+
if (!arg.startsWith("--")) {
|
|
56
|
+
positionals.push(arg);
|
|
57
|
+
continue;
|
|
58
|
+
}
|
|
59
|
+
if (!VALUE_FLAGS.has(arg))
|
|
60
|
+
continue;
|
|
61
|
+
const value = args[i + 1];
|
|
62
|
+
// A value flag at the end of the line, or one followed by another flag,
|
|
63
|
+
// consumes nothing — so a missing value can never eat the query.
|
|
64
|
+
if (value === undefined || value.startsWith("--"))
|
|
65
|
+
continue;
|
|
66
|
+
values.set(arg, value);
|
|
67
|
+
i++;
|
|
68
|
+
}
|
|
69
|
+
const rawScope = values.get("--scope");
|
|
70
|
+
const scope = rawScope === "project" || rawScope === "user" || rawScope === "both" ? rawScope : "both";
|
|
71
|
+
const rawLimit = values.get("--limit");
|
|
72
|
+
const parsedLimit = rawLimit === undefined ? Number.NaN : Number.parseInt(rawLimit, 10);
|
|
73
|
+
const limit = Number.isFinite(parsedLimit) && parsedLimit >= 1 ? parsedLimit : DEFAULT_LIMIT;
|
|
74
|
+
return {
|
|
75
|
+
query: positionals.join(" ").trim(),
|
|
76
|
+
limit,
|
|
77
|
+
scope,
|
|
78
|
+
journalPath: values.get("--journal-path"),
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
export async function runJournal(args) {
|
|
82
|
+
if (args.length === 0 || args.includes("--help") || args.includes("-h")) {
|
|
83
|
+
console.log(HELP);
|
|
84
|
+
return 0;
|
|
85
|
+
}
|
|
86
|
+
const command = args[0];
|
|
87
|
+
const rest = args.slice(1);
|
|
88
|
+
const parsed = parseJournalArgs(rest);
|
|
89
|
+
const journalPath = parsed.journalPath;
|
|
90
|
+
const store = new JournalStore({ projectPath: journalPath });
|
|
91
|
+
if (command === "paths") {
|
|
92
|
+
console.log(`project: ${journalPath ?? resolveProjectJournalPath()}`);
|
|
93
|
+
console.log(`user: ${resolveUserJournalPath()}`);
|
|
94
|
+
for (const root of store.roots()) {
|
|
95
|
+
console.log(`root: ${root.path} (${root.scope})`);
|
|
96
|
+
}
|
|
97
|
+
return 0;
|
|
98
|
+
}
|
|
99
|
+
const db = initDatabase();
|
|
100
|
+
try {
|
|
101
|
+
if (command === "index") {
|
|
102
|
+
const result = await store.indexJournal(db);
|
|
103
|
+
console.log(`✅ Journal index updated: ${result.indexed} indexed, ${result.pruned} pruned, ${result.failed} failed, ${result.total} entries on disk`);
|
|
104
|
+
return result.failed > 0 ? 1 : 0;
|
|
105
|
+
}
|
|
106
|
+
const search = new JournalSearchService(db, store.roots().map((root) => root.path));
|
|
107
|
+
if (command === "search") {
|
|
108
|
+
const query = parsed.query;
|
|
109
|
+
if (!query) {
|
|
110
|
+
console.error("Usage: moe-memory journal search <query>");
|
|
111
|
+
return 1;
|
|
112
|
+
}
|
|
113
|
+
const results = await search.search(query, {
|
|
114
|
+
limit: parsed.limit,
|
|
115
|
+
scope: parsed.scope,
|
|
116
|
+
});
|
|
117
|
+
if (results.length === 0) {
|
|
118
|
+
console.log("No relevant entries found.");
|
|
119
|
+
return 0;
|
|
120
|
+
}
|
|
121
|
+
for (const [i, result] of results.entries()) {
|
|
122
|
+
console.log(`${i + 1}. [${result.score.toFixed(3)}] ${new Date(result.entry.timestamp).toISOString()} (${result.entry.scope})`);
|
|
123
|
+
console.log(` Sections: ${result.entry.sections.join(", ")}`);
|
|
124
|
+
console.log(` ${result.entry.path}`);
|
|
125
|
+
console.log(` ${result.excerpt}\n`);
|
|
126
|
+
}
|
|
127
|
+
return 0;
|
|
128
|
+
}
|
|
129
|
+
if (command === "recent") {
|
|
130
|
+
const results = search.listRecent({
|
|
131
|
+
limit: parsed.limit,
|
|
132
|
+
scope: parsed.scope,
|
|
133
|
+
});
|
|
134
|
+
if (results.length === 0) {
|
|
135
|
+
console.log("No entries found.");
|
|
136
|
+
return 0;
|
|
137
|
+
}
|
|
138
|
+
for (const [i, result] of results.entries()) {
|
|
139
|
+
console.log(`${i + 1}. ${new Date(result.entry.timestamp).toISOString()} (${result.entry.scope})`);
|
|
140
|
+
console.log(` ${result.entry.path}`);
|
|
141
|
+
console.log(` ${result.excerpt}\n`);
|
|
142
|
+
}
|
|
143
|
+
return 0;
|
|
144
|
+
}
|
|
145
|
+
console.error(`Unknown journal command: ${command}`);
|
|
146
|
+
console.error("Try: moe-memory journal --help");
|
|
147
|
+
return 1;
|
|
148
|
+
}
|
|
149
|
+
finally {
|
|
150
|
+
db.close();
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
//# sourceMappingURL=journal-cli.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"journal-cli.js","sourceRoot":"","sources":["../src/journal-cli.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvC,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,yBAAyB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AAO,EAAE,EAAE,CAAC;gBAC5C,OAAO,CAAC,GAAG,CACT,GAAG,CAAC,GAAG,CAAC,KAAK,IAAI,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,WAAW,EAAE,KAAK,MAAM,CAAC,KAAK,CAAC,KAAK,GAAG,CACtF,CAAC;gBACF,OAAO,CAAC,GAAG,CAAC,MAAM,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC;gBACvC,OAAO,CAAC,GAAG,CAAC,MAAM,MAAM,CAAC,OAAO,IAAI,CAAC,CAAC;YACxC,CAAC;YACD,OAAO,CAAC,CAAC;QACX,CAAC;QAED,OAAO,CAAC,KAAK,CAAC,4BAA4B,OAAO,EAAE,CAAC,CAAC;QACrD,OAAO,CAAC,KAAK,CAAC,gCAAgC,CAAC,CAAC;QAChD,OAAO,CAAC,CAAC;IACX,CAAC;YAAS,CAAC;QACT,EAAE,CAAC,KAAK,EAAE,CAAC;IACb,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export type LogLevel = "info" | "warn" | "error";
|
|
2
|
+
export declare function getLogDir(): string;
|
|
3
|
+
export declare function getSyncLogPath(): string;
|
|
4
|
+
export declare function formatLogLine(level: LogLevel, message: string): string;
|
|
5
|
+
export declare function appendLogLine(level: LogLevel, message: string): void;
|
|
6
|
+
//# sourceMappingURL=logging.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logging.d.ts","sourceRoot":"","sources":["../src/logging.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;AAEjD,wBAAgB,SAAS,IAAI,MAAM,CAMlC;AAED,wBAAgB,cAAc,IAAI,MAAM,CAEvC;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAEtE;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAEpE"}
|
package/dist/logging.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { getMemoryDataDir } from "./paths.js";
|
|
4
|
+
export function getLogDir() {
|
|
5
|
+
const dir = path.join(getMemoryDataDir(), "logs");
|
|
6
|
+
if (!fs.existsSync(dir)) {
|
|
7
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
8
|
+
}
|
|
9
|
+
return dir;
|
|
10
|
+
}
|
|
11
|
+
export function getSyncLogPath() {
|
|
12
|
+
return path.join(getLogDir(), "moe-memory.log");
|
|
13
|
+
}
|
|
14
|
+
export function formatLogLine(level, message) {
|
|
15
|
+
return `${new Date().toISOString()} [${level}] ${message}\n`;
|
|
16
|
+
}
|
|
17
|
+
export function appendLogLine(level, message) {
|
|
18
|
+
fs.appendFileSync(getSyncLogPath(), formatLogLine(level, message), "utf-8");
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=logging.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logging.js","sourceRoot":"","sources":["../src/logging.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAI9C,MAAM,UAAU,SAAS;IACvB,MAAM,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,gBAAgB,EAAE,EAAE,MAAM,CAAC,CAAC;IAClD,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;QACxB,EAAE,CAAC,SAAS,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IACzC,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAED,MAAM,UAAU,cAAc;IAC5B,OAAO,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,EAAE,gBAAgB,CAAC,CAAC;AAClD,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,KAAe,EAAE,OAAe;IAC5D,OAAO,GAAG,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,KAAK,KAAK,KAAK,OAAO,IAAI,CAAC;AAC/D,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,KAAe,EAAE,OAAe;IAC5D,EAAE,CAAC,cAAc,CAAC,cAAc,EAAE,EAAE,aAAa,CAAC,KAAK,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC,CAAC;AAC9E,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* The one MCP server, keyed `moe-memory`.
|
|
4
|
+
*
|
|
5
|
+
* Seven tools over two record types:
|
|
6
|
+
*
|
|
7
|
+
* search_conversations read_conversation harvested transcript turns
|
|
8
|
+
* process_thoughts search_journal read_journal_entry deliberately written entries
|
|
9
|
+
* list_recent_entries read_recent_entries
|
|
10
|
+
*
|
|
11
|
+
* Upstream this was two servers. episodic-memory registered bare `search` and
|
|
12
|
+
* `read`; private-journal-mcp registered the five journal tools. There was no
|
|
13
|
+
* byte-identical collision, but `search` alongside `search_journal` reads as a
|
|
14
|
+
* bug — so the two generic names are the ones that got namespaced. That rename
|
|
15
|
+
* drags eleven Zone-A sites with it: the agent's `tools:` frontmatter, SKILL.md,
|
|
16
|
+
* MCP-TOOLS.md, prompts/search-agent.md, both e2e harnesses and two tests.
|
|
17
|
+
*
|
|
18
|
+
* private-journal-mcp's `PrivateJournalServer` class is gone. Its `new Server({name,
|
|
19
|
+
* version})` single-argument constructor is legal only on SDK 0.x; on ^1.20 a
|
|
20
|
+
* tools server must declare `capabilities: { tools: {} }` or the capability
|
|
21
|
+
* assertion rejects tools/list and tools/call — which would have looked exactly
|
|
22
|
+
* like the "empty tools/list on Node 22+" bug its own CHANGELOG records, and been
|
|
23
|
+
* misdiagnosed as that.
|
|
24
|
+
*/
|
|
25
|
+
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
26
|
+
export interface MemoryServerOptions {
|
|
27
|
+
/** Overrides the project journal directory. `moe-memory mcp-server --journal-path <dir>`. */
|
|
28
|
+
journalPath?: string | undefined;
|
|
29
|
+
}
|
|
30
|
+
export declare function createMemoryMcpServer(options?: MemoryServerOptions): Server;
|
|
31
|
+
/** Parse the one CLI flag the MCP entry point accepts. */
|
|
32
|
+
export declare function parseJournalPathArg(argv: string[]): string | undefined;
|
|
33
|
+
export declare function runMemoryMcpServer(argv?: string[]): Promise<void>;
|
|
34
|
+
//# sourceMappingURL=mcp-server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-server.d.ts","sourceRoot":"","sources":["../src/mcp-server.ts"],"names":[],"mappings":";AAEA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAIH,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AAoYnE,MAAM,WAAW,mBAAmB;IAClC,6FAA6F;IAC7F,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAClC;AAED,wBAAgB,qBAAqB,CAAC,OAAO,GAAE,mBAAwB,GAAG,MAAM,CAgP/E;AAED,0DAA0D;AAC1D,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,GAAG,SAAS,CAQtE;AAED,wBAAsB,kBAAkB,CAAC,IAAI,GAAE,MAAM,EAA0B,GAAG,OAAO,CAAC,IAAI,CAAC,CAoC9F"}
|