@illli-studio/mory 0.1.1 → 0.1.3
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/README.md +2 -0
- package/package.json +2 -2
- package/src/cli.mjs +16 -3
- /package/bin/{mory.mjs → mory} +0 -0
package/README.md
CHANGED
|
@@ -6,6 +6,7 @@ Local-first memory runtime with a web console and a generic MCP server.
|
|
|
6
6
|
npm install -g @illli-studio/mory
|
|
7
7
|
mory init
|
|
8
8
|
mory start
|
|
9
|
+
mory start --background
|
|
9
10
|
mory status
|
|
10
11
|
mory stop
|
|
11
12
|
mory export ./mory-export.json
|
|
@@ -13,6 +14,7 @@ mory import ./mory-export.json
|
|
|
13
14
|
```
|
|
14
15
|
|
|
15
16
|
For MCP clients, use `mory mcp` as a stdio server. Set `MORY_API_URL` and `MORY_API_TOKEN` when the API is managed separately.
|
|
17
|
+
Use `mory mcp --check` to diagnose the local API connection without starting the stdio protocol.
|
|
16
18
|
|
|
17
19
|
The same package also exports the TypeScript client:
|
|
18
20
|
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@illli-studio/mory",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "Local-first memory runtime with a web console and MCP server.",
|
|
5
5
|
"license": "AGPL-3.0-or-later",
|
|
6
6
|
"publishConfig": { "access": "public" },
|
|
7
7
|
"type": "module",
|
|
8
8
|
"bin": {
|
|
9
|
-
"mory": "./bin/mory
|
|
9
|
+
"mory": "./bin/mory"
|
|
10
10
|
},
|
|
11
11
|
"exports": {
|
|
12
12
|
".": { "types": "./client/index.d.ts", "import": "./client/index.js" },
|
package/src/cli.mjs
CHANGED
|
@@ -32,22 +32,34 @@ async function waitForHealth(base, token, timeout = 8000) {
|
|
|
32
32
|
return false;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
async function start() {
|
|
35
|
+
async function start(background = false) {
|
|
36
36
|
const current = config();
|
|
37
37
|
const base = `http://127.0.0.1:${current.port}`;
|
|
38
38
|
if (await waitForHealth(base, current.token, 500)) { console.log(`Mory is already running at ${base}`); return; }
|
|
39
39
|
const env = { ...process.env, MORY_PORT: String(current.port), MORY_API_TOKEN: current.token, MORY_DATABASE: current.database, MORY_WEB_DIST: webDist() };
|
|
40
|
-
const child = spawn(process.execPath, [apiEntry()], { env, stdio: "inherit", detached:
|
|
40
|
+
const child = spawn(process.execPath, [apiEntry()], { env, stdio: background ? "ignore" : "inherit", detached: background });
|
|
41
41
|
if (!await waitForHealth(base, current.token)) { child.kill(); throw new Error("Mory failed to start. Run `mory doctor` for diagnostics."); }
|
|
42
42
|
writeFileSync(pidPath, String(child.pid));
|
|
43
43
|
child.once("exit", () => { if (existsSync(pidPath) && readFileSync(pidPath, "utf8").trim() === String(child.pid)) unlinkSync(pidPath); });
|
|
44
|
+
if (background) child.unref();
|
|
44
45
|
console.log(`Mory is running at ${base}`);
|
|
45
46
|
console.log(`Data: ${current.database}`);
|
|
46
47
|
console.log("MCP: run `mory mcp` from your agent configuration");
|
|
48
|
+
if (background) console.log("Running in background. Use `mory status` or `mory stop`.");
|
|
49
|
+
if (background) return;
|
|
47
50
|
process.on("SIGINT", () => child.kill("SIGINT"));
|
|
48
51
|
process.on("SIGTERM", () => child.kill("SIGTERM"));
|
|
49
52
|
}
|
|
50
53
|
|
|
54
|
+
async function mcpCheck() {
|
|
55
|
+
const current = config();
|
|
56
|
+
const base = process.env.MORY_API_URL || `http://127.0.0.1:${current.port}`;
|
|
57
|
+
const token = process.env.MORY_API_TOKEN || current.token;
|
|
58
|
+
const response = await fetch(base.replace(/\/$/, "") + "/health", { headers: { authorization: `Bearer ${token}` } });
|
|
59
|
+
console.log(JSON.stringify({ api: base, reachable: response.ok, mcp: "ready", protocol: "2025-06-18" }, null, 2));
|
|
60
|
+
if (!response.ok) process.exitCode = 1;
|
|
61
|
+
}
|
|
62
|
+
|
|
51
63
|
async function stop() {
|
|
52
64
|
const current = config();
|
|
53
65
|
if (!await waitForHealth(`http://127.0.0.1:${current.port}`, current.token, 500)) { if (existsSync(pidPath)) unlinkSync(pidPath); console.log("Mory is not running."); return; }
|
|
@@ -92,10 +104,11 @@ async function importMemories(inputPath) {
|
|
|
92
104
|
const [command = "start", ...args] = process.argv.slice(2);
|
|
93
105
|
try {
|
|
94
106
|
if (command === "init") { config(); console.log(`Initialized Mory at ${dataDir}`); }
|
|
95
|
-
else if (command === "start") await start();
|
|
107
|
+
else if (command === "start") await start(args.includes("--background") || args.includes("-d"));
|
|
96
108
|
else if (command === "stop") await stop();
|
|
97
109
|
else if (command === "export") await exportMemories(args[0]);
|
|
98
110
|
else if (command === "import") await importMemories(args[0]);
|
|
111
|
+
else if (command === "mcp" && args.includes("--check")) await mcpCheck();
|
|
99
112
|
else if (command === "mcp") await runMcp({ baseUrl: process.env.MORY_API_URL || `http://127.0.0.1:${config().port}`, token: process.env.MORY_API_TOKEN || config().token });
|
|
100
113
|
else if (command === "doctor") await doctor();
|
|
101
114
|
else if (command === "status") { const c = config(); console.log(JSON.stringify({ url: `http://127.0.0.1:${c.port}`, dataDir, running: await waitForHealth(`http://127.0.0.1:${c.port}`, c.token, 500) }, null, 2)); }
|
/package/bin/{mory.mjs → mory}
RENAMED
|
File without changes
|