cortexdb-cli 0.3.0__tar.gz → 0.4.0__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.
Files changed (34) hide show
  1. {cortexdb_cli-0.3.0 → cortexdb_cli-0.4.0}/PKG-INFO +1 -1
  2. {cortexdb_cli-0.3.0 → cortexdb_cli-0.4.0}/cortexdb_cli/__init__.py +1 -1
  3. {cortexdb_cli-0.3.0 → cortexdb_cli-0.4.0}/cortexdb_cli/commands/recall.py +121 -99
  4. {cortexdb_cli-0.3.0 → cortexdb_cli-0.4.0}/pyproject.toml +1 -1
  5. {cortexdb_cli-0.3.0 → cortexdb_cli-0.4.0}/.gitignore +0 -0
  6. {cortexdb_cli-0.3.0 → cortexdb_cli-0.4.0}/README.md +0 -0
  7. {cortexdb_cli-0.3.0 → cortexdb_cli-0.4.0}/cortexdb_cli/client.py +0 -0
  8. {cortexdb_cli-0.3.0 → cortexdb_cli-0.4.0}/cortexdb_cli/commands/__init__.py +0 -0
  9. {cortexdb_cli-0.3.0 → cortexdb_cli-0.4.0}/cortexdb_cli/commands/admin.py +0 -0
  10. {cortexdb_cli-0.3.0 → cortexdb_cli-0.4.0}/cortexdb_cli/commands/answer.py +0 -0
  11. {cortexdb_cli-0.3.0 → cortexdb_cli-0.4.0}/cortexdb_cli/commands/auth.py +0 -0
  12. {cortexdb_cli-0.3.0 → cortexdb_cli-0.4.0}/cortexdb_cli/commands/beliefs.py +0 -0
  13. {cortexdb_cli-0.3.0 → cortexdb_cli-0.4.0}/cortexdb_cli/commands/claims.py +0 -0
  14. {cortexdb_cli-0.3.0 → cortexdb_cli-0.4.0}/cortexdb_cli/commands/compose.py +0 -0
  15. {cortexdb_cli-0.3.0 → cortexdb_cli-0.4.0}/cortexdb_cli/commands/config_cmd.py +0 -0
  16. {cortexdb_cli-0.3.0 → cortexdb_cli-0.4.0}/cortexdb_cli/commands/conflicts.py +0 -0
  17. {cortexdb_cli-0.3.0 → cortexdb_cli-0.4.0}/cortexdb_cli/commands/entities.py +0 -0
  18. {cortexdb_cli-0.3.0 → cortexdb_cli-0.4.0}/cortexdb_cli/commands/episodes.py +0 -0
  19. {cortexdb_cli-0.3.0 → cortexdb_cli-0.4.0}/cortexdb_cli/commands/experience.py +0 -0
  20. {cortexdb_cli-0.3.0 → cortexdb_cli-0.4.0}/cortexdb_cli/commands/export_cmd.py +0 -0
  21. {cortexdb_cli-0.3.0 → cortexdb_cli-0.4.0}/cortexdb_cli/commands/facts.py +0 -0
  22. {cortexdb_cli-0.3.0 → cortexdb_cli-0.4.0}/cortexdb_cli/commands/forget.py +0 -0
  23. {cortexdb_cli-0.3.0 → cortexdb_cli-0.4.0}/cortexdb_cli/commands/import_cmd.py +0 -0
  24. {cortexdb_cli-0.3.0 → cortexdb_cli-0.4.0}/cortexdb_cli/commands/init.py +0 -0
  25. {cortexdb_cli-0.3.0 → cortexdb_cli-0.4.0}/cortexdb_cli/commands/interactive.py +0 -0
  26. {cortexdb_cli-0.3.0 → cortexdb_cli-0.4.0}/cortexdb_cli/commands/policy.py +0 -0
  27. {cortexdb_cli-0.3.0 → cortexdb_cli-0.4.0}/cortexdb_cli/commands/scopes.py +0 -0
  28. {cortexdb_cli-0.3.0 → cortexdb_cli-0.4.0}/cortexdb_cli/commands/search.py +0 -0
  29. {cortexdb_cli-0.3.0 → cortexdb_cli-0.4.0}/cortexdb_cli/commands/understanding.py +0 -0
  30. {cortexdb_cli-0.3.0 → cortexdb_cli-0.4.0}/cortexdb_cli/config.py +0 -0
  31. {cortexdb_cli-0.3.0 → cortexdb_cli-0.4.0}/cortexdb_cli/errors.py +0 -0
  32. {cortexdb_cli-0.3.0 → cortexdb_cli-0.4.0}/cortexdb_cli/main.py +0 -0
  33. {cortexdb_cli-0.3.0 → cortexdb_cli-0.4.0}/cortexdb_cli/output.py +0 -0
  34. {cortexdb_cli-0.3.0 → cortexdb_cli-0.4.0}/cortexdb_cli/state.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cortexdb-cli
3
- Version: 0.3.0
3
+ Version: 0.4.0
4
4
  Summary: Command-line interface for CortexDB — the long-term memory layer for AI.
5
5
  Project-URL: Homepage, https://cortexdb.ai
6
6
  Project-URL: Documentation, https://cortexdb.ai/docs
@@ -1,3 +1,3 @@
1
1
  """CortexDB CLI — command-line interface for the v1 memory API."""
2
2
 
3
- __version__ = "0.3.0"
3
+ __version__ = "0.4.0"
@@ -1,99 +1,121 @@
1
- """cortexdb recall — POST /v1/recall."""
2
-
3
- from __future__ import annotations
4
-
5
- from typing import Any
6
-
7
- import click
8
-
9
- from cortexdb_cli.client import get_client
10
- from cortexdb_cli.errors import handle_errors
11
- from cortexdb_cli.output import is_json_mode, print_recall, spinner
12
-
13
-
14
- @click.command("recall")
15
- @click.argument("query")
16
- @click.option("--scope", "-S", help="Scope path (defaults to your default scope)")
17
- @click.option(
18
- "--view",
19
- type=click.Choice(["raw", "granular", "structured", "holistic", "descend"]),
20
- default=None,
21
- help="Pack shape. Defaults to your configured view (CORTEXDB_VIEW env or "
22
- "`cortexdb config set view ...`), else 'holistic'. 'descend' = the scope + all "
23
- "child scopes; 'holistic' = the scope + its parents; 'granular' = exact scope only.",
24
- )
25
- @click.option(
26
- "--include",
27
- multiple=True,
28
- type=click.Choice(["events", "episodes", "facts", "beliefs", "understanding"]),
29
- help="Layers to fill (repeatable). Default: facts + beliefs + episodes.",
30
- )
31
- @click.option(
32
- "--temporal",
33
- default=None,
34
- help='Natural-language time window, e.g. "last 30 days".',
35
- )
36
- @click.option(
37
- "--max-tokens",
38
- type=int,
39
- default=None,
40
- help="Budget for the returned context_block (string).",
41
- )
42
- @click.option(
43
- "--diagnostics",
44
- type=click.Choice(["none", "summary", "full"]),
45
- default="none",
46
- show_default=True,
47
- help='"none" works on every tier. "summary"/"full" need the diagnostics.read capability.',
48
- )
49
- @click.pass_context
50
- @handle_errors
51
- def recall_cmd(
52
- ctx: click.Context,
53
- query: str,
54
- scope: str | None,
55
- view: str,
56
- include: tuple[str, ...],
57
- temporal: str | None,
58
- max_tokens: int | None,
59
- diagnostics: str,
60
- ) -> None:
61
- """Recall context from memory.
62
-
63
- \b
64
- cortexdb recall "what did we decide about Acme?"
65
- cortexdb recall "renewal status" --temporal "last 30 days"
66
- """
67
- cfg = ctx.obj
68
- view = view or cfg.get("view") or "holistic"
69
- if view not in ("raw", "granular", "structured", "holistic", "descend"):
70
- raise click.UsageError(
71
- f"Invalid view {view!r}. Choose: raw, granular, structured, holistic, descend."
72
- )
73
- target_scope = scope or cfg.get("scope") or cfg.get("actor")
74
- if not target_scope:
75
- raise click.UsageError(
76
- "No scope configured. Run `cortexdb init` first, or pass --scope explicitly."
77
- )
78
-
79
- body: dict[str, Any] = {
80
- "scope": target_scope,
81
- "view": view,
82
- "query": query,
83
- "diagnostics": diagnostics,
84
- }
85
- if include:
86
- body["include"] = list(include)
87
- if temporal:
88
- body["temporal"] = {"natural": temporal}
89
- if max_tokens is not None:
90
- body["budgets"] = {"max_tokens": max_tokens}
91
-
92
- with get_client(cfg) as client:
93
- if not is_json_mode(cfg):
94
- with spinner("Recalling..."):
95
- resp = client.post("/v1/recall", json=body)
96
- else:
97
- resp = client.post("/v1/recall", json=body)
98
- resp.raise_for_status()
99
- print_recall(resp.json(), cfg)
1
+ """cortexdb recall — POST /v1/recall."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import Any
6
+
7
+ import click
8
+
9
+ from cortexdb_cli.client import get_client
10
+ from cortexdb_cli.errors import handle_errors
11
+ from cortexdb_cli.output import is_json_mode, print_recall, spinner
12
+
13
+
14
+ @click.command("recall")
15
+ @click.argument("query")
16
+ @click.option("--scope", "-S", help="Scope path (defaults to your default scope)")
17
+ @click.option(
18
+ "--view",
19
+ type=click.Choice(["raw", "granular", "structured", "holistic", "descend"]),
20
+ default=None,
21
+ help="Pack shape. Defaults to your configured view (CORTEXDB_VIEW env or "
22
+ "`cortexdb config set view ...`), else 'holistic'. 'descend' = the scope + all "
23
+ "child scopes; 'holistic' = the scope + its parents; 'granular' = exact scope only.",
24
+ )
25
+ @click.option(
26
+ "--include",
27
+ multiple=True,
28
+ type=click.Choice(["events", "episodes", "facts", "beliefs", "understanding"]),
29
+ help="Layers to fill (repeatable). Default: facts + beliefs + episodes.",
30
+ )
31
+ @click.option(
32
+ "--temporal",
33
+ default=None,
34
+ help='Natural-language time window, e.g. "last 30 days".',
35
+ )
36
+ @click.option(
37
+ "--max-tokens",
38
+ type=int,
39
+ default=None,
40
+ help="Budget for the returned context_block (string).",
41
+ )
42
+ @click.option(
43
+ "--diagnostics",
44
+ type=click.Choice(["none", "summary", "full"]),
45
+ default="none",
46
+ show_default=True,
47
+ help='"none" works on every tier. "summary"/"full" need the diagnostics.read capability.',
48
+ )
49
+ @click.option(
50
+ "--filter",
51
+ "filters",
52
+ multiple=True,
53
+ metavar="KEY=VALUE",
54
+ help="Hard attribute filter, repeatable (AND across keys, any-of when a "
55
+ "key repeats). Keys: labels, intent, modality, caller, observed_actor. "
56
+ "Example: --filter labels=primary_inbox",
57
+ )
58
+ @click.pass_context
59
+ @handle_errors
60
+ def recall_cmd(
61
+ ctx: click.Context,
62
+ query: str,
63
+ scope: str | None,
64
+ view: str,
65
+ include: tuple[str, ...],
66
+ temporal: str | None,
67
+ max_tokens: int | None,
68
+ diagnostics: str,
69
+ filters: tuple[str, ...],
70
+ ) -> None:
71
+ """Recall context from memory.
72
+
73
+ \b
74
+ cortexdb recall "what did we decide about Acme?"
75
+ cortexdb recall "renewal status" --temporal "last 30 days"
76
+ """
77
+ cfg = ctx.obj
78
+ view = view or cfg.get("view") or "holistic"
79
+ if view not in ("raw", "granular", "structured", "holistic", "descend"):
80
+ raise click.UsageError(
81
+ f"Invalid view {view!r}. Choose: raw, granular, structured, holistic, descend."
82
+ )
83
+ target_scope = scope or cfg.get("scope") or cfg.get("actor")
84
+ if not target_scope:
85
+ raise click.UsageError(
86
+ "No scope configured. Run `cortexdb init` first, or pass --scope explicitly."
87
+ )
88
+
89
+ body: dict[str, Any] = {
90
+ "scope": target_scope,
91
+ "view": view,
92
+ "query": query,
93
+ "diagnostics": diagnostics,
94
+ }
95
+ if include:
96
+ body["include"] = list(include)
97
+ if temporal:
98
+ body["temporal"] = {"natural": temporal}
99
+ if max_tokens is not None:
100
+ body["budgets"] = {"max_tokens": max_tokens}
101
+ if filters:
102
+ fmap: dict[str, Any] = {}
103
+ for f in filters:
104
+ if "=" not in f:
105
+ raise click.UsageError(f"--filter must be KEY=VALUE, got {f!r}")
106
+ k, v = f.split("=", 1)
107
+ if k in fmap:
108
+ prev = fmap[k] if isinstance(fmap[k], list) else [fmap[k]]
109
+ fmap[k] = prev + [v]
110
+ else:
111
+ fmap[k] = v
112
+ body["filters"] = {"metadata": fmap}
113
+
114
+ with get_client(cfg) as client:
115
+ if not is_json_mode(cfg):
116
+ with spinner("Recalling..."):
117
+ resp = client.post("/v1/recall", json=body)
118
+ else:
119
+ resp = client.post("/v1/recall", json=body)
120
+ resp.raise_for_status()
121
+ print_recall(resp.json(), cfg)
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "cortexdb-cli"
7
- version = "0.3.0"
7
+ version = "0.4.0"
8
8
  description = "Command-line interface for CortexDB — the long-term memory layer for AI."
9
9
  readme = "README.md"
10
10
  license = "Apache-2.0"
File without changes
File without changes