@hasna/mementos 0.4.29 → 0.4.31

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 CHANGED
@@ -140,6 +140,10 @@ bun add @hasna/mementos-sdk
140
140
  ```typescript
141
141
  import { MementosClient } from "@hasna/mementos-sdk";
142
142
 
143
+ // Auto-configure from MEMENTOS_URL env var
144
+ const client = MementosClient.fromEnv();
145
+
146
+ // Or explicit:
143
147
  const client = new MementosClient({ baseUrl: "http://localhost:19428" });
144
148
 
145
149
  // Save memory
@@ -205,6 +209,7 @@ POST /api/memories/extract
205
209
  | `MEMENTOS_DB_SCOPE` | `project` = git root `.mementos/mementos.db` | global |
206
210
  | `MEMENTOS_HOST` | Server bind address | `127.0.0.1` |
207
211
  | `PORT` | Server port | `19428` |
212
+ | `MEMENTOS_URL` | SDK client base URL (`MementosClient.fromEnv()`) | `http://localhost:19428` |
208
213
 
209
214
  ## Library
210
215
 
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":";AACA;;;GAGG;AA2qCH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAsH9C"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":";AACA;;;GAGG;AA2qCH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CA6H9C"}
@@ -2984,7 +2984,14 @@ function startServer(port) {
2984
2984
  const { createRequire } = await import("module");
2985
2985
  const req2 = createRequire(import.meta.url);
2986
2986
  const pkg = req2("../../package.json");
2987
- return json({ status: "ok", version: pkg.version, profile: profile ?? "default", db_path: getDbPath2(), hostname });
2987
+ const db = getDatabase();
2988
+ const total = db.query("SELECT COUNT(*) as c FROM memories WHERE status = 'active'").get().c;
2989
+ const expired = db.query("SELECT COUNT(*) as c FROM memories WHERE status = 'expired' OR (expires_at IS NOT NULL AND expires_at < datetime('now'))").get().c;
2990
+ const pinned = db.query("SELECT COUNT(*) as c FROM memories WHERE status = 'active' AND pinned = 1").get().c;
2991
+ const agents = db.query("SELECT COUNT(*) as c FROM agents").get().c;
2992
+ const projects = db.query("SELECT COUNT(*) as c FROM projects").get().c;
2993
+ const status = expired > 50 ? "warn" : "ok";
2994
+ return json({ status, version: pkg.version, profile: profile ?? "default", db_path: getDbPath2(), hostname, memories: { total, expired, pinned }, agents, projects });
2988
2995
  }
2989
2996
  if (pathname === "/api/profile" && req.method === "GET") {
2990
2997
  const profile = getActiveProfile();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hasna/mementos",
3
- "version": "0.4.29",
3
+ "version": "0.4.31",
4
4
  "description": "Universal memory system for AI agents - CLI + MCP server + library API",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",