@hasna/mementos 0.4.14 → 0.4.15

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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":";AACA;;;GAGG;AAkkCH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAkH9C"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":";AACA;;;GAGG;AAukCH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAkH9C"}
@@ -2418,11 +2418,15 @@ addRoute("PATCH", "/api/memories/:id", async (req, _url, params) => {
2418
2418
  if (!body) {
2419
2419
  return errorResponse("Invalid JSON body", 400);
2420
2420
  }
2421
- if (body["version"] === undefined) {
2422
- return errorResponse("Missing required field: version", 400);
2421
+ const updateBody = { ...body };
2422
+ if (updateBody["version"] === undefined) {
2423
+ const existing = getMemory(params["id"]);
2424
+ if (!existing)
2425
+ return errorResponse("Memory not found", 404);
2426
+ updateBody["version"] = existing.version;
2423
2427
  }
2424
2428
  try {
2425
- const memory = updateMemory(params["id"], body);
2429
+ const memory = updateMemory(params["id"], updateBody);
2426
2430
  return json(memory);
2427
2431
  } catch (e) {
2428
2432
  if (e instanceof MemoryNotFoundError) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hasna/mementos",
3
- "version": "0.4.14",
3
+ "version": "0.4.15",
4
4
  "description": "Universal memory system for AI agents - CLI + MCP server + library API",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",