superb-memory 0.2.2__tar.gz → 0.2.3__tar.gz

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,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: superb-memory
3
- Version: 0.2.2
3
+ Version: 0.2.3
4
4
  Summary: Python client, mdb CLI and MCP server for the MemoryDB Go document and agent memory database
5
5
  Author: humaniods
6
6
  License-Expression: MIT
@@ -24,7 +24,7 @@ from urllib.parse import urlparse
24
24
  sys.path.insert(0, str(os.path.dirname(os.path.abspath(__file__))))
25
25
  from memorydb import MemoryDB, MemoryDBError # noqa: E402
26
26
 
27
- SERVER_VERSION = "0.2.2" # the release tag mdb serve downloads by default
27
+ SERVER_VERSION = "0.2.3" # the release tag mdb serve downloads by default
28
28
  REPO = "humaniods/MemoryDB"
29
29
 
30
30
 
@@ -38,10 +38,22 @@ def load_db(args):
38
38
  return MemoryDB(url, token=token)
39
39
 
40
40
 
41
- def read_json_arg(value, path):
42
- if path:
41
+ def read_json_file(path):
42
+ """Read a JSON input file named on the command line.
43
+
44
+ Paths in these commands come from README and docs, so a wrong one has to name the
45
+ file instead of raising a traceback from wherever argparse happened to call us.
46
+ """
47
+ try:
43
48
  with open(path) as fh:
44
49
  return json.load(fh)
50
+ except OSError as exc:
51
+ sys.exit(f"mdb: cannot read {path}: {exc.strerror or exc}")
52
+
53
+
54
+ def read_json_arg(value, path):
55
+ if path:
56
+ return read_json_file(path)
45
57
  if value:
46
58
  return json.loads(value)
47
59
  sys.exit("provide --json or --file")
@@ -337,12 +349,12 @@ def main(argv=None):
337
349
  elif args.cmd == "search":
338
350
  emit(db.objects.search(args.text, kind=args.kind, limit=args.limit))
339
351
  elif args.cmd == "ingest":
340
- with open(args.file) as fh:
341
- payload = json.load(fh)
342
- emit(db.ingest(payload["messages"], facts=payload.get("facts"), source=payload.get("source", "cli")))
352
+ payload = read_json_file(args.file)
353
+ emit(db.ingest(payload["messages"], facts=payload.get("facts"),
354
+ source=payload.get("source", "cli"),
355
+ context=payload.get("context", "")))
343
356
  elif args.cmd == "tx":
344
- with open(args.file) as fh:
345
- payload = json.load(fh)
357
+ payload = read_json_file(args.file)
346
358
  emit(db.transaction(payload["changes"], idempotency_key=args.key))
347
359
  elif args.cmd == "sync":
348
360
  rows = read_json_arg(args.json, args.file)
@@ -17,7 +17,7 @@ sys.path.insert(0, str(__import__("pathlib").Path(__file__).resolve().parent))
17
17
  from memorydb import MemoryDB # noqa: E402
18
18
 
19
19
  PROTOCOL_VERSION = "2024-11-05"
20
- SERVER_INFO = {"name": "memorydb", "version": "0.2.2"}
20
+ SERVER_INFO = {"name": "memorydb", "version": "0.2.3"}
21
21
 
22
22
  TOOL_DEFS = [
23
23
  {"name": "memorydb_health", "description": "Server status, identity and transaction sequence.",
@@ -3,7 +3,7 @@ requires = ["setuptools>=77"]
3
3
  build-backend = "setuptools.build_meta"
4
4
  [project]
5
5
  name = "superb-memory"
6
- version = "0.2.2"
6
+ version = "0.2.3"
7
7
  description = "Python client, mdb CLI and MCP server for the MemoryDB Go document and agent memory database"
8
8
  readme = "README.md"
9
9
  requires-python = ">=3.10"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: superb-memory
3
- Version: 0.2.2
3
+ Version: 0.2.3
4
4
  Summary: Python client, mdb CLI and MCP server for the MemoryDB Go document and agent memory database
5
5
  Author: humaniods
6
6
  License-Expression: MIT
File without changes
File without changes
File without changes