@hasna/mementos 0.14.15 → 0.14.17

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/cli/index.js CHANGED
@@ -14015,6 +14015,7 @@ function getDatabase(dbPath) {
14015
14015
  _db.run("PRAGMA journal_mode = WAL");
14016
14016
  _db.run("PRAGMA busy_timeout = 5000");
14017
14017
  _db.run("PRAGMA foreign_keys = ON");
14018
+ _db.run("PRAGMA wal_autocheckpoint = 100");
14018
14019
  runMigrations(_db);
14019
14020
  _db.run(`CREATE TABLE IF NOT EXISTS feedback (
14020
14021
  id TEXT PRIMARY KEY DEFAULT (lower(hex(randomblob(16)))),
@@ -25139,7 +25140,7 @@ function getPackageVersion2() {
25139
25140
  }
25140
25141
  }
25141
25142
  var program2 = new Command;
25142
- program2.name("mementos").description("Universal memory system for AI agents").version(getPackageVersion2()).option("--project <path>", "Project path for scoping").option("--json", "Output as JSON").option("--format <fmt>", "Output format: compact, json, csv, yaml").option("--agent <name>", "Agent name or ID").option("--session <id>", "Session ID");
25143
+ program2.name("mementos").description("Universal memory system for AI agents").version(getPackageVersion2()).option("-p, --project <path>", "Project path for scoping").option("-j, --json", "Output as JSON").option("-f, --format <fmt>", "Output format: compact, json, csv, yaml").option("-a, --agent <name>", "Agent name or ID").option("-s, --session <id>", "Session ID");
25143
25144
  registerInitCommand(program2);
25144
25145
  registerMemoryCommands(program2);
25145
25146
  registerInfoCommands(program2);
package/dist/index.js CHANGED
@@ -10233,6 +10233,7 @@ function getDatabase(dbPath) {
10233
10233
  _db.run("PRAGMA journal_mode = WAL");
10234
10234
  _db.run("PRAGMA busy_timeout = 5000");
10235
10235
  _db.run("PRAGMA foreign_keys = ON");
10236
+ _db.run("PRAGMA wal_autocheckpoint = 100");
10236
10237
  runMigrations(_db);
10237
10238
  _db.run(`CREATE TABLE IF NOT EXISTS feedback (
10238
10239
  id TEXT PRIMARY KEY DEFAULT (lower(hex(randomblob(16)))),
package/dist/mcp/index.js CHANGED
@@ -12025,6 +12025,7 @@ function getDatabase(dbPath) {
12025
12025
  _db.run("PRAGMA journal_mode = WAL");
12026
12026
  _db.run("PRAGMA busy_timeout = 5000");
12027
12027
  _db.run("PRAGMA foreign_keys = ON");
12028
+ _db.run("PRAGMA wal_autocheckpoint = 100");
12028
12029
  runMigrations(_db);
12029
12030
  _db.run(`CREATE TABLE IF NOT EXISTS feedback (
12030
12031
  id TEXT PRIMARY KEY DEFAULT (lower(hex(randomblob(16)))),
@@ -29703,6 +29704,19 @@ var server = new McpServer({
29703
29704
  When running with --dangerously-load-development-channels, mementos will proactively push relevant memories into your conversation via channel notifications. These appear as <channel source="mementos"> tags. They contain memories activated by your current task context \u2014 use them to inform your work. You don't need to call memory_inject when auto-inject is active.`
29704
29705
  });
29705
29706
  mcpServer = server;
29707
+ function hasFlag(...flags) {
29708
+ return process.argv.some((arg) => flags.includes(arg));
29709
+ }
29710
+ function printHelp() {
29711
+ process.stdout.write(`Usage: mementos-mcp [options]
29712
+
29713
+ Mementos MCP server (stdio transport)
29714
+
29715
+ Options:
29716
+ -h, --help Show help
29717
+ -V, --version Show version
29718
+ `);
29719
+ }
29706
29720
  registerMemoryTools(server);
29707
29721
  registerGraphTools(server);
29708
29722
  registerAgentTools(server);
@@ -29754,6 +29768,15 @@ async function ensureRestServerRunning() {
29754
29768
  }
29755
29769
  }
29756
29770
  async function main() {
29771
+ if (hasFlag("--help", "-h")) {
29772
+ printHelp();
29773
+ return;
29774
+ }
29775
+ if (hasFlag("--version", "-V")) {
29776
+ process.stdout.write(`${_pkg.version}
29777
+ `);
29778
+ return;
29779
+ }
29757
29780
  await ensureRestServerRunning();
29758
29781
  loadWebhooksFromDb();
29759
29782
  const transport = new StdioServerTransport;
@@ -10258,6 +10258,7 @@ function getDatabase(dbPath) {
10258
10258
  _db.run("PRAGMA journal_mode = WAL");
10259
10259
  _db.run("PRAGMA busy_timeout = 5000");
10260
10260
  _db.run("PRAGMA foreign_keys = ON");
10261
+ _db.run("PRAGMA wal_autocheckpoint = 100");
10261
10262
  runMigrations(_db);
10262
10263
  _db.run(`CREATE TABLE IF NOT EXISTS feedback (
10263
10264
  id TEXT PRIMARY KEY DEFAULT (lower(hex(randomblob(16)))),
@@ -17255,20 +17256,49 @@ addRoute("GET", "/api/chains/:sequence_group", (_req, _url, params) => {
17255
17256
 
17256
17257
  // src/server/index.ts
17257
17258
  var DEFAULT_PORT = 19428;
17259
+ function hasFlag(...flags) {
17260
+ return process.argv.some((arg) => flags.includes(arg));
17261
+ }
17262
+ function printHelp() {
17263
+ process.stdout.write(`Usage: mementos-serve [options]
17264
+
17265
+ Mementos REST API server.
17266
+
17267
+ Options:
17268
+ --port <number> Port to bind (default: 19428)
17269
+ -h, --help Show help
17270
+ -V, --version Show version
17271
+ `);
17272
+ }
17273
+ function parsePortNumber(raw, source) {
17274
+ if (!/^\d+$/.test(raw)) {
17275
+ throw new Error(`Invalid ${source} value "${raw}". Expected an integer between 1 and 65535.`);
17276
+ }
17277
+ const parsed = Number(raw);
17278
+ if (!Number.isInteger(parsed) || parsed < 1 || parsed > 65535) {
17279
+ throw new Error(`Invalid ${source} value "${raw}". Expected an integer between 1 and 65535.`);
17280
+ }
17281
+ return parsed;
17282
+ }
17258
17283
  function parsePort() {
17259
17284
  const envPort = process.env["PORT"];
17260
17285
  if (envPort) {
17261
- const p = parseInt(envPort, 10);
17262
- if (!Number.isNaN(p))
17263
- return p;
17286
+ return parsePortNumber(envPort, "PORT");
17264
17287
  }
17265
17288
  const portArg = process.argv.find((a) => a === "--port" || a.startsWith("--port="));
17266
17289
  if (portArg) {
17267
17290
  if (portArg.includes("=")) {
17268
- return parseInt(portArg.split("=")[1], 10) || DEFAULT_PORT;
17291
+ const raw2 = portArg.split("=")[1] ?? "";
17292
+ if (!raw2)
17293
+ throw new Error("Missing value for --port. Example: --port 19428");
17294
+ return parsePortNumber(raw2, "--port");
17269
17295
  }
17270
17296
  const idx = process.argv.indexOf(portArg);
17271
- return parseInt(process.argv[idx + 1], 10) || DEFAULT_PORT;
17297
+ const raw = process.argv[idx + 1];
17298
+ if (!raw || raw.startsWith("-")) {
17299
+ throw new Error("Missing value for --port. Example: --port 19428");
17300
+ }
17301
+ return parsePortNumber(raw, "--port");
17272
17302
  }
17273
17303
  return DEFAULT_PORT;
17274
17304
  }
@@ -17383,6 +17413,18 @@ function startServer(port) {
17383
17413
  console.log(`Mementos server listening on http://${hostname}:${port}`);
17384
17414
  }
17385
17415
  async function main() {
17416
+ if (hasFlag("--help", "-h")) {
17417
+ printHelp();
17418
+ return;
17419
+ }
17420
+ if (hasFlag("--version", "-V")) {
17421
+ const { createRequire: createRequire2 } = await import("module");
17422
+ const req = createRequire2(import.meta.url);
17423
+ const pkg = req("../../package.json");
17424
+ process.stdout.write(`${pkg.version}
17425
+ `);
17426
+ return;
17427
+ }
17386
17428
  const requestedPort = parsePort();
17387
17429
  const port = await findFreePort(requestedPort);
17388
17430
  if (port !== requestedPort) {
@@ -17390,7 +17432,11 @@ async function main() {
17390
17432
  }
17391
17433
  startServer(port);
17392
17434
  }
17393
- main();
17435
+ main().catch((error) => {
17436
+ const message = error instanceof Error ? error.message : String(error);
17437
+ console.error(`[mementos-serve] ${message}`);
17438
+ process.exit(1);
17439
+ });
17394
17440
  export {
17395
17441
  startServer
17396
17442
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hasna/mementos",
3
- "version": "0.14.15",
3
+ "version": "0.14.17",
4
4
  "description": "Universal memory system for AI agents - CLI + MCP server + library API",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -77,4 +77,4 @@
77
77
  "@types/react": "^18.3.18",
78
78
  "typescript": "^5.7.3"
79
79
  }
80
- }
80
+ }